@mastra/deployer-cloud 1.33.0-alpha.1 → 1.33.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 (22) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/studio/assets/{index-D8WmaG2W.js → index-BPGtLMXv.js} +1 -1
  3. package/dist/studio/assets/{index-B9fCyqyZ.js → index-BiigrE1w.js} +1 -1
  4. package/dist/studio/assets/{index-CQFgjXuF.js → index-BmR9ljo2.js} +1 -1
  5. package/dist/studio/assets/{index-7CvzrXxr.js → index-CQWUz_Ua.js} +1 -1
  6. package/dist/studio/assets/{index-9wg3FSzj.js → index-CaD7ddjV.js} +1 -1
  7. package/dist/studio/assets/{index-DOw0Sd_J.js → index-CdggTBzd.js} +1 -1
  8. package/dist/studio/assets/{index-C2xWg42r.js → index-Cmdv7FN5.js} +1 -1
  9. package/dist/studio/assets/{index-Dy77nOsH.js → index-DAO3kR5r.js} +1 -1
  10. package/dist/studio/assets/{index-8sozPXbo.js → index-DBAgKJUH.js} +1 -1
  11. package/dist/studio/assets/{index-A3BXvFwX.js → index-DI9zd2Nn.js} +1 -1
  12. package/dist/studio/assets/{index-fnQbidjI.js → index-DNHDjLYs.js} +1 -1
  13. package/dist/studio/assets/{index-Cjt4ARtq.js → index-DNfvq-Ph.js} +1 -1
  14. package/dist/studio/assets/{index-Ct7qJl0G.js → index-DX5l222Z.js} +1 -1
  15. package/dist/studio/assets/{index-MmwM57Ps.js → index-DZf7g_uc.js} +1 -1
  16. package/dist/studio/assets/{index-Bzse5zFx.js → index-LVEEbtZn.js} +1 -1
  17. package/dist/studio/assets/{index-C0V7VVcG.js → index-ZpLrnVFB.js} +1 -1
  18. package/dist/studio/assets/{index-B6n7w36d.js → index-mTon5-ys.js} +1 -1
  19. package/dist/studio/assets/{index-DVk1DRCU.js → index-u_lqiE2u.js} +1 -1
  20. package/dist/studio/assets/{main-Or_dFROw.js → main-DqVfM6wN.js} +6 -6
  21. package/dist/studio/index.html +1 -1
  22. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D8WmaG2W.js","./index-Bzse5zFx.js","./index-Ct7qJl0G.js","./index-CQFgjXuF.js","./index-7CvzrXxr.js","./index-DOw0Sd_J.js","./index-C2xWg42r.js","./index-MmwM57Ps.js","./index-C0V7VVcG.js","./index-fnQbidjI.js","./index-9wg3FSzj.js","./index-B6n7w36d.js","./index-A3BXvFwX.js","./index-Dy77nOsH.js","./index-B9fCyqyZ.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-Cjt4ARtq.js","./index-DVk1DRCU.js","./index-8sozPXbo.js"])))=>i.map(i=>d[i]);
2
- import{_ as nt}from"./index-Bzse5zFx.js";function _Ke(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var uz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var JZ={exports:{}},QN={};var Gje;function CFt(){if(Gje)return QN;Gje=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var o in s)o!=="key"&&(a[o]=s[o])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:a}}return QN.Fragment=t,QN.jsx=n,QN.jsxs=n,QN}var Qje;function TFt(){return Qje||(Qje=1,JZ.exports=CFt()),JZ.exports}var l=TFt(),eG={exports:{}},Rr={},Yje;function jFt(){if(Yje)return Rr;Yje=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=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(V){return V===null||typeof V!="object"?null:(V=p&&V[p]||V["@@iterator"],typeof V=="function"?V:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,x={};function w(V,$,Z){this.props=V,this.context=$,this.refs=x,this.updater=Z||g}w.prototype.isReactComponent={},w.prototype.setState=function(V,$){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,$,"setState")},w.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function S(){}S.prototype=w.prototype;function _(V,$,Z){this.props=V,this.context=$,this.refs=x,this.updater=Z||g}var O=_.prototype=new S;O.constructor=_,v(O,w.prototype),O.isPureReactComponent=!0;var E=Array.isArray;function j(){}var T={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function I(V,$,Z){var G=Z.ref;return{$$typeof:t,type:V,key:$,ref:G!==void 0?G:null,props:Z}}function P(V,$){return I(V.type,$,V.props)}function R(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function F(V){var $={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(Z){return $[Z]})}var M=/\/+/g;function L(V,$){return typeof V=="object"&&V!==null&&V.key!=null?F(""+V.key):$.toString(36)}function U(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(j,j):(V.status="pending",V.then(function($){V.status==="pending"&&(V.status="fulfilled",V.value=$)},function($){V.status==="pending"&&(V.status="rejected",V.reason=$)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function z(V,$,Z,G,J){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var ne=!1;if(V===null)ne=!0;else switch(ie){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(V.$$typeof){case t:case n:ne=!0;break;case f:return ne=V._init,z(ne(V._payload),$,Z,G,J)}}if(ne)return J=J(V),ne=G===""?"."+L(V,0):G,E(J)?(Z="",ne!=null&&(Z=ne.replace(M,"$&/")+"/"),z(J,$,Z,"",function(de){return de})):J!=null&&(R(J)&&(J=P(J,Z+(J.key==null||V&&V.key===J.key?"":(""+J.key).replace(M,"$&/")+"/")+ne)),$.push(J)),1;ne=0;var te=G===""?".":G+":";if(E(V))for(var ae=0;ae<V.length;ae++)G=V[ae],ie=te+L(G,ae),ne+=z(G,$,Z,ie,J);else if(ae=m(V),typeof ae=="function")for(V=ae.call(V),ae=0;!(G=V.next()).done;)G=G.value,ie=te+L(G,ae++),ne+=z(G,$,Z,ie,J);else if(ie==="object"){if(typeof V.then=="function")return z(U(V),$,Z,G,J);throw $=String(V),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return ne}function q(V,$,Z){if(V==null)return V;var G=[],J=0;return z(V,G,"","",function(ie){return $.call(Z,ie,J++)}),G}function W(V){if(V._status===-1){var $=V._result;$=$(),$.then(function(Z){(V._status===0||V._status===-1)&&(V._status=1,V._result=Z)},function(Z){(V._status===0||V._status===-1)&&(V._status=2,V._result=Z)}),V._status===-1&&(V._status=0,V._result=$)}if(V._status===1)return V._result.default;throw V._result}var D=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent($))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",V);return}console.error(V)},Q={map:q,forEach:function(V,$,Z){q(V,function(){$.apply(this,arguments)},Z)},count:function(V){var $=0;return q(V,function(){$++}),$},toArray:function(V){return q(V,function($){return $})||[]},only:function(V){if(!R(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return Rr.Activity=h,Rr.Children=Q,Rr.Component=w,Rr.Fragment=r,Rr.Profiler=a,Rr.PureComponent=_,Rr.StrictMode=s,Rr.Suspense=u,Rr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,Rr.__COMPILER_RUNTIME={__proto__:null,c:function(V){return T.H.useMemoCache(V)}},Rr.cache=function(V){return function(){return V.apply(null,arguments)}},Rr.cacheSignal=function(){return null},Rr.cloneElement=function(V,$,Z){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var G=v({},V.props),J=V.key;if($!=null)for(ie in $.key!==void 0&&(J=""+$.key),$)!N.call($,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&$.ref===void 0||(G[ie]=$[ie]);var ie=arguments.length-2;if(ie===1)G.children=Z;else if(1<ie){for(var ne=Array(ie),te=0;te<ie;te++)ne[te]=arguments[te+2];G.children=ne}return I(V.type,J,G)},Rr.createContext=function(V){return V={$$typeof:o,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:i,_context:V},V},Rr.createElement=function(V,$,Z){var G,J={},ie=null;if($!=null)for(G in $.key!==void 0&&(ie=""+$.key),$)N.call($,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=$[G]);var ne=arguments.length-2;if(ne===1)J.children=Z;else if(1<ne){for(var te=Array(ne),ae=0;ae<ne;ae++)te[ae]=arguments[ae+2];J.children=te}if(V&&V.defaultProps)for(G in ne=V.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(V,ie,J)},Rr.createRef=function(){return{current:null}},Rr.forwardRef=function(V){return{$$typeof:c,render:V}},Rr.isValidElement=R,Rr.lazy=function(V){return{$$typeof:f,_payload:{_status:-1,_result:V},_init:W}},Rr.memo=function(V,$){return{$$typeof:d,type:V,compare:$===void 0?null:$}},Rr.startTransition=function(V){var $=T.T,Z={};T.T=Z;try{var G=V(),J=T.S;J!==null&&J(Z,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(j,D)}catch(ie){D(ie)}finally{$!==null&&Z.types!==null&&($.types=Z.types),T.T=$}},Rr.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},Rr.use=function(V){return T.H.use(V)},Rr.useActionState=function(V,$,Z){return T.H.useActionState(V,$,Z)},Rr.useCallback=function(V,$){return T.H.useCallback(V,$)},Rr.useContext=function(V){return T.H.useContext(V)},Rr.useDebugValue=function(){},Rr.useDeferredValue=function(V,$){return T.H.useDeferredValue(V,$)},Rr.useEffect=function(V,$){return T.H.useEffect(V,$)},Rr.useEffectEvent=function(V){return T.H.useEffectEvent(V)},Rr.useId=function(){return T.H.useId()},Rr.useImperativeHandle=function(V,$,Z){return T.H.useImperativeHandle(V,$,Z)},Rr.useInsertionEffect=function(V,$){return T.H.useInsertionEffect(V,$)},Rr.useLayoutEffect=function(V,$){return T.H.useLayoutEffect(V,$)},Rr.useMemo=function(V,$){return T.H.useMemo(V,$)},Rr.useOptimistic=function(V,$){return T.H.useOptimistic(V,$)},Rr.useReducer=function(V,$,Z){return T.H.useReducer(V,$,Z)},Rr.useRef=function(V){return T.H.useRef(V)},Rr.useState=function(V){return T.H.useState(V)},Rr.useSyncExternalStore=function(V,$,Z){return T.H.useSyncExternalStore(V,$,Z)},Rr.useTransition=function(){return T.H.useTransition()},Rr.version="19.2.5",Rr}var Xje;function tj(){return Xje||(Xje=1,eG.exports=jFt()),eG.exports}var y=tj();const _e=Tl(y),Qk=_Ke({__proto__:null,default:_e},[y]);var tG={exports:{}},YN={},nG={exports:{}},rG={};var Kje;function NFt(){return Kje||(Kje=1,(function(e){function t(U,z){var q=U.length;U.push(z);e:for(;0<q;){var W=q-1>>>1,D=U[W];if(0<s(D,z))U[W]=z,U[q]=D,q=W;else break e}}function n(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var z=U[0],q=U.pop();if(q!==z){U[0]=q;e:for(var W=0,D=U.length,Q=D>>>1;W<Q;){var V=2*(W+1)-1,$=U[V],Z=V+1,G=U[Z];if(0>s($,q))Z<D&&0>s(G,$)?(U[W]=G,U[Z]=q,W=Z):(U[W]=$,U[V]=q,W=V);else if(Z<D&&0>s(G,q))U[W]=G,U[Z]=q,W=Z;else break e}}return z}function s(U,z){var q=U.sortIndex-z.sortIndex;return q!==0?q: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,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function _(U){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=U)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function O(U){if(g=!1,_(U),!m)if(n(c)!==null)m=!0,E||(E=!0,R());else{var z=n(u);z!==null&&L(O,z.startTime-U)}}var E=!1,j=-1,T=5,N=-1;function I(){return v?!0:!(e.unstable_now()-N<T)}function P(){if(v=!1,E){var U=e.unstable_now();N=U;var z=!0;try{e:{m=!1,g&&(g=!1,w(j),j=-1),p=!0;var q=h;try{t:{for(_(U),f=n(c);f!==null&&!(f.expirationTime>U&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var D=W(f.expirationTime<=U);if(U=e.unstable_now(),typeof D=="function"){f.callback=D,_(U),z=!0;break t}f===n(c)&&r(c),_(U)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Q=n(u);Q!==null&&L(O,Q.startTime-U),z=!1}}break e}finally{f=null,h=q,p=!1}z=void 0}}finally{z?R():E=!1}}}var R;if(typeof S=="function")R=function(){S(P)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,M=F.port2;F.port1.onmessage=P,R=function(){M.postMessage(null)}}else R=function(){x(P,0)};function L(U,z){j=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"):T=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 q=h;h=z;try{return U()}finally{h=q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(U,z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var q=h;h=U;try{return z()}finally{h=q}},e.unstable_scheduleCallback=function(U,z,q){var W=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?W+q:W):q=W,U){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=q+D,U={id:d++,callback:z,priorityLevel:U,startTime:q,expirationTime:D,sortIndex:-1},q>W?(U.sortIndex=q,t(u,U),n(c)===null&&U===n(u)&&(g?(w(j),j=-1):g=!0,L(O,q-W))):(U.sortIndex=D,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 q=h;h=z;try{return U.apply(this,arguments)}finally{h=q}}}})(rG)),rG}var Jje;function AFt(){return Jje||(Jje=1,nG.exports=NFt()),nG.exports}var sG={exports:{}},Uc={};var eNe;function IFt(){if(eNe)return Uc;eNe=1;var e=tj();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 n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},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 o(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Uc.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Uc.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)},Uc.flushSync=function(c){var u=i.T,d=r.p;try{if(i.T=null,r.p=2,c)return c()}finally{i.T=u,r.p=d,r.d.f()}},Uc.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},Uc.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Uc.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Uc.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(u.as,u.crossOrigin);r.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&&r.d.M(c)},Uc.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin);r.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})}},Uc.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=o(u.as,u.crossOrigin);r.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 r.d.m(c)},Uc.requestFormReset=function(c){r.d.r(c)},Uc.unstable_batchedUpdates=function(c,u){return c(u)},Uc.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},Uc.useFormStatus=function(){return i.H.useHostTransitionStatus()},Uc.version="19.2.5",Uc}var tNe;function OKe(){if(tNe)return sG.exports;tNe=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(),sG.exports=IFt(),sG.exports}var nNe;function RFt(){if(nNe)return YN;nNe=1;var e={env:{}};var t=AFt(),n=tj(),r=OKe();function s(b){var k="https://react.dev/errors/"+b;if(1<arguments.length){k+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)k+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+b+"; visit "+k+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(b){return!(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)}function i(b){var k=b,C=b;if(b.alternate)for(;k.return;)k=k.return;else{b=k;do k=b,(k.flags&4098)!==0&&(C=k.return),b=k.return;while(b)}return k.tag===3?C:null}function o(b){if(b.tag===13){var k=b.memoizedState;if(k===null&&(b=b.alternate,b!==null&&(k=b.memoizedState)),k!==null)return k.dehydrated}return null}function c(b){if(b.tag===31){var k=b.memoizedState;if(k===null&&(b=b.alternate,b!==null&&(k=b.memoizedState)),k!==null)return k.dehydrated}return null}function u(b){if(i(b)!==b)throw Error(s(188))}function d(b){var k=b.alternate;if(!k){if(k=i(b),k===null)throw Error(s(188));return k!==b?null:b}for(var C=b,A=k;;){var B=C.return;if(B===null)break;var H=B.alternate;if(H===null){if(A=B.return,A!==null){C=A;continue}break}if(B.child===H.child){for(H=B.child;H;){if(H===C)return u(B),b;if(H===A)return u(B),k;H=H.sibling}throw Error(s(188))}if(C.return!==A.return)C=B,A=H;else{for(var ee=!1,he=B.child;he;){if(he===C){ee=!0,C=B,A=H;break}if(he===A){ee=!0,A=B,C=H;break}he=he.sibling}if(!ee){for(he=H.child;he;){if(he===C){ee=!0,C=H,A=B;break}if(he===A){ee=!0,A=H,C=B;break}he=he.sibling}if(!ee)throw Error(s(189))}}if(C.alternate!==A)throw Error(s(190))}if(C.tag!==3)throw Error(s(188));return C.stateNode.current===C?b:k}function f(b){var k=b.tag;if(k===5||k===26||k===27||k===6)return b;for(b=b.child;b!==null;){if(k=f(b),k!==null)return k;b=b.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),_=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function F(b){return b===null||typeof b!="object"?null:(b=R&&b[R]||b["@@iterator"],typeof b=="function"?b:null)}var M=Symbol.for("react.client.reference");function L(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===M?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case v:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case j:return"SuspenseList";case I:return"Activity"}if(typeof b=="object")switch(b.$$typeof){case g:return"Portal";case _:return b.displayName||"Context";case S:return(b._context.displayName||"Context")+".Consumer";case O:var k=b.render;return b=b.displayName,b||(b=k.displayName||k.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case T:return k=b.displayName||null,k!==null?k:L(b.type)||"Memo";case N:k=b._payload,b=b._init;try{return L(b(k))}catch{}}return null}var U=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},D=[],Q=-1;function V(b){return{current:b}}function $(b){0>Q||(b.current=D[Q],D[Q]=null,Q--)}function Z(b,k){Q++,D[Q]=b.current,b.current=k}var G=V(null),J=V(null),ie=V(null),ne=V(null);function te(b,k){switch(Z(ie,k),Z(J,b),Z(G,null),k.nodeType){case 9:case 11:b=(b=k.documentElement)&&(b=b.namespaceURI)?vje(b):0;break;default:if(b=k.tagName,k=k.namespaceURI)k=vje(k),b=yje(k,b);else switch(b){case"svg":b=1;break;case"math":b=2;break;default:b=0}}$(G),Z(G,b)}function ae(){$(G),$(J),$(ie)}function de(b){b.memoizedState!==null&&Z(ne,b);var k=G.current,C=yje(k,b.type);k!==C&&(Z(J,b),Z(G,C))}function X(b){J.current===b&&($(G),$(J)),ne.current===b&&($(ne),HN._currentValue=W)}var re,le;function ge(b){if(re===void 0)try{throw Error()}catch(C){var k=C.stack.trim().match(/\n( *(at )?)/);re=k&&k[1]||"",le=-1<C.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BPGtLMXv.js","./index-LVEEbtZn.js","./index-DX5l222Z.js","./index-BmR9ljo2.js","./index-CQWUz_Ua.js","./index-CdggTBzd.js","./index-Cmdv7FN5.js","./index-DZf7g_uc.js","./index-ZpLrnVFB.js","./index-DNHDjLYs.js","./index-CaD7ddjV.js","./index-mTon5-ys.js","./index-DI9zd2Nn.js","./index-DAO3kR5r.js","./index-BiigrE1w.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-DNfvq-Ph.js","./index-u_lqiE2u.js","./index-DBAgKJUH.js"])))=>i.map(i=>d[i]);
2
+ import{_ as nt}from"./index-LVEEbtZn.js";function _Ke(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var uz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var JZ={exports:{}},QN={};var Gje;function CFt(){if(Gje)return QN;Gje=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var o in s)o!=="key"&&(a[o]=s[o])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:a}}return QN.Fragment=t,QN.jsx=n,QN.jsxs=n,QN}var Qje;function TFt(){return Qje||(Qje=1,JZ.exports=CFt()),JZ.exports}var l=TFt(),eG={exports:{}},Rr={},Yje;function jFt(){if(Yje)return Rr;Yje=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=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(V){return V===null||typeof V!="object"?null:(V=p&&V[p]||V["@@iterator"],typeof V=="function"?V:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,x={};function w(V,$,Z){this.props=V,this.context=$,this.refs=x,this.updater=Z||g}w.prototype.isReactComponent={},w.prototype.setState=function(V,$){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,$,"setState")},w.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function S(){}S.prototype=w.prototype;function _(V,$,Z){this.props=V,this.context=$,this.refs=x,this.updater=Z||g}var O=_.prototype=new S;O.constructor=_,v(O,w.prototype),O.isPureReactComponent=!0;var E=Array.isArray;function j(){}var T={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function I(V,$,Z){var G=Z.ref;return{$$typeof:t,type:V,key:$,ref:G!==void 0?G:null,props:Z}}function P(V,$){return I(V.type,$,V.props)}function R(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function F(V){var $={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(Z){return $[Z]})}var M=/\/+/g;function L(V,$){return typeof V=="object"&&V!==null&&V.key!=null?F(""+V.key):$.toString(36)}function U(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(j,j):(V.status="pending",V.then(function($){V.status==="pending"&&(V.status="fulfilled",V.value=$)},function($){V.status==="pending"&&(V.status="rejected",V.reason=$)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function z(V,$,Z,G,J){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var ne=!1;if(V===null)ne=!0;else switch(ie){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(V.$$typeof){case t:case n:ne=!0;break;case f:return ne=V._init,z(ne(V._payload),$,Z,G,J)}}if(ne)return J=J(V),ne=G===""?"."+L(V,0):G,E(J)?(Z="",ne!=null&&(Z=ne.replace(M,"$&/")+"/"),z(J,$,Z,"",function(de){return de})):J!=null&&(R(J)&&(J=P(J,Z+(J.key==null||V&&V.key===J.key?"":(""+J.key).replace(M,"$&/")+"/")+ne)),$.push(J)),1;ne=0;var te=G===""?".":G+":";if(E(V))for(var ae=0;ae<V.length;ae++)G=V[ae],ie=te+L(G,ae),ne+=z(G,$,Z,ie,J);else if(ae=m(V),typeof ae=="function")for(V=ae.call(V),ae=0;!(G=V.next()).done;)G=G.value,ie=te+L(G,ae++),ne+=z(G,$,Z,ie,J);else if(ie==="object"){if(typeof V.then=="function")return z(U(V),$,Z,G,J);throw $=String(V),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return ne}function q(V,$,Z){if(V==null)return V;var G=[],J=0;return z(V,G,"","",function(ie){return $.call(Z,ie,J++)}),G}function W(V){if(V._status===-1){var $=V._result;$=$(),$.then(function(Z){(V._status===0||V._status===-1)&&(V._status=1,V._result=Z)},function(Z){(V._status===0||V._status===-1)&&(V._status=2,V._result=Z)}),V._status===-1&&(V._status=0,V._result=$)}if(V._status===1)return V._result.default;throw V._result}var D=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent($))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",V);return}console.error(V)},Q={map:q,forEach:function(V,$,Z){q(V,function(){$.apply(this,arguments)},Z)},count:function(V){var $=0;return q(V,function(){$++}),$},toArray:function(V){return q(V,function($){return $})||[]},only:function(V){if(!R(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return Rr.Activity=h,Rr.Children=Q,Rr.Component=w,Rr.Fragment=r,Rr.Profiler=a,Rr.PureComponent=_,Rr.StrictMode=s,Rr.Suspense=u,Rr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,Rr.__COMPILER_RUNTIME={__proto__:null,c:function(V){return T.H.useMemoCache(V)}},Rr.cache=function(V){return function(){return V.apply(null,arguments)}},Rr.cacheSignal=function(){return null},Rr.cloneElement=function(V,$,Z){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var G=v({},V.props),J=V.key;if($!=null)for(ie in $.key!==void 0&&(J=""+$.key),$)!N.call($,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&$.ref===void 0||(G[ie]=$[ie]);var ie=arguments.length-2;if(ie===1)G.children=Z;else if(1<ie){for(var ne=Array(ie),te=0;te<ie;te++)ne[te]=arguments[te+2];G.children=ne}return I(V.type,J,G)},Rr.createContext=function(V){return V={$$typeof:o,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:i,_context:V},V},Rr.createElement=function(V,$,Z){var G,J={},ie=null;if($!=null)for(G in $.key!==void 0&&(ie=""+$.key),$)N.call($,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=$[G]);var ne=arguments.length-2;if(ne===1)J.children=Z;else if(1<ne){for(var te=Array(ne),ae=0;ae<ne;ae++)te[ae]=arguments[ae+2];J.children=te}if(V&&V.defaultProps)for(G in ne=V.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(V,ie,J)},Rr.createRef=function(){return{current:null}},Rr.forwardRef=function(V){return{$$typeof:c,render:V}},Rr.isValidElement=R,Rr.lazy=function(V){return{$$typeof:f,_payload:{_status:-1,_result:V},_init:W}},Rr.memo=function(V,$){return{$$typeof:d,type:V,compare:$===void 0?null:$}},Rr.startTransition=function(V){var $=T.T,Z={};T.T=Z;try{var G=V(),J=T.S;J!==null&&J(Z,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(j,D)}catch(ie){D(ie)}finally{$!==null&&Z.types!==null&&($.types=Z.types),T.T=$}},Rr.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},Rr.use=function(V){return T.H.use(V)},Rr.useActionState=function(V,$,Z){return T.H.useActionState(V,$,Z)},Rr.useCallback=function(V,$){return T.H.useCallback(V,$)},Rr.useContext=function(V){return T.H.useContext(V)},Rr.useDebugValue=function(){},Rr.useDeferredValue=function(V,$){return T.H.useDeferredValue(V,$)},Rr.useEffect=function(V,$){return T.H.useEffect(V,$)},Rr.useEffectEvent=function(V){return T.H.useEffectEvent(V)},Rr.useId=function(){return T.H.useId()},Rr.useImperativeHandle=function(V,$,Z){return T.H.useImperativeHandle(V,$,Z)},Rr.useInsertionEffect=function(V,$){return T.H.useInsertionEffect(V,$)},Rr.useLayoutEffect=function(V,$){return T.H.useLayoutEffect(V,$)},Rr.useMemo=function(V,$){return T.H.useMemo(V,$)},Rr.useOptimistic=function(V,$){return T.H.useOptimistic(V,$)},Rr.useReducer=function(V,$,Z){return T.H.useReducer(V,$,Z)},Rr.useRef=function(V){return T.H.useRef(V)},Rr.useState=function(V){return T.H.useState(V)},Rr.useSyncExternalStore=function(V,$,Z){return T.H.useSyncExternalStore(V,$,Z)},Rr.useTransition=function(){return T.H.useTransition()},Rr.version="19.2.5",Rr}var Xje;function tj(){return Xje||(Xje=1,eG.exports=jFt()),eG.exports}var y=tj();const _e=Tl(y),Qk=_Ke({__proto__:null,default:_e},[y]);var tG={exports:{}},YN={},nG={exports:{}},rG={};var Kje;function NFt(){return Kje||(Kje=1,(function(e){function t(U,z){var q=U.length;U.push(z);e:for(;0<q;){var W=q-1>>>1,D=U[W];if(0<s(D,z))U[W]=z,U[q]=D,q=W;else break e}}function n(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var z=U[0],q=U.pop();if(q!==z){U[0]=q;e:for(var W=0,D=U.length,Q=D>>>1;W<Q;){var V=2*(W+1)-1,$=U[V],Z=V+1,G=U[Z];if(0>s($,q))Z<D&&0>s(G,$)?(U[W]=G,U[Z]=q,W=Z):(U[W]=$,U[V]=q,W=V);else if(Z<D&&0>s(G,q))U[W]=G,U[Z]=q,W=Z;else break e}}return z}function s(U,z){var q=U.sortIndex-z.sortIndex;return q!==0?q: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,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function _(U){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=U)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function O(U){if(g=!1,_(U),!m)if(n(c)!==null)m=!0,E||(E=!0,R());else{var z=n(u);z!==null&&L(O,z.startTime-U)}}var E=!1,j=-1,T=5,N=-1;function I(){return v?!0:!(e.unstable_now()-N<T)}function P(){if(v=!1,E){var U=e.unstable_now();N=U;var z=!0;try{e:{m=!1,g&&(g=!1,w(j),j=-1),p=!0;var q=h;try{t:{for(_(U),f=n(c);f!==null&&!(f.expirationTime>U&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var D=W(f.expirationTime<=U);if(U=e.unstable_now(),typeof D=="function"){f.callback=D,_(U),z=!0;break t}f===n(c)&&r(c),_(U)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Q=n(u);Q!==null&&L(O,Q.startTime-U),z=!1}}break e}finally{f=null,h=q,p=!1}z=void 0}}finally{z?R():E=!1}}}var R;if(typeof S=="function")R=function(){S(P)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,M=F.port2;F.port1.onmessage=P,R=function(){M.postMessage(null)}}else R=function(){x(P,0)};function L(U,z){j=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"):T=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 q=h;h=z;try{return U()}finally{h=q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(U,z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var q=h;h=U;try{return z()}finally{h=q}},e.unstable_scheduleCallback=function(U,z,q){var W=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?W+q:W):q=W,U){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=q+D,U={id:d++,callback:z,priorityLevel:U,startTime:q,expirationTime:D,sortIndex:-1},q>W?(U.sortIndex=q,t(u,U),n(c)===null&&U===n(u)&&(g?(w(j),j=-1):g=!0,L(O,q-W))):(U.sortIndex=D,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 q=h;h=z;try{return U.apply(this,arguments)}finally{h=q}}}})(rG)),rG}var Jje;function AFt(){return Jje||(Jje=1,nG.exports=NFt()),nG.exports}var sG={exports:{}},Uc={};var eNe;function IFt(){if(eNe)return Uc;eNe=1;var e=tj();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 n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},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 o(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Uc.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Uc.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)},Uc.flushSync=function(c){var u=i.T,d=r.p;try{if(i.T=null,r.p=2,c)return c()}finally{i.T=u,r.p=d,r.d.f()}},Uc.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},Uc.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Uc.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Uc.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(u.as,u.crossOrigin);r.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&&r.d.M(c)},Uc.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin);r.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})}},Uc.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=o(u.as,u.crossOrigin);r.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 r.d.m(c)},Uc.requestFormReset=function(c){r.d.r(c)},Uc.unstable_batchedUpdates=function(c,u){return c(u)},Uc.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},Uc.useFormStatus=function(){return i.H.useHostTransitionStatus()},Uc.version="19.2.5",Uc}var tNe;function OKe(){if(tNe)return sG.exports;tNe=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(),sG.exports=IFt(),sG.exports}var nNe;function RFt(){if(nNe)return YN;nNe=1;var e={env:{}};var t=AFt(),n=tj(),r=OKe();function s(b){var k="https://react.dev/errors/"+b;if(1<arguments.length){k+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)k+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+b+"; visit "+k+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(b){return!(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)}function i(b){var k=b,C=b;if(b.alternate)for(;k.return;)k=k.return;else{b=k;do k=b,(k.flags&4098)!==0&&(C=k.return),b=k.return;while(b)}return k.tag===3?C:null}function o(b){if(b.tag===13){var k=b.memoizedState;if(k===null&&(b=b.alternate,b!==null&&(k=b.memoizedState)),k!==null)return k.dehydrated}return null}function c(b){if(b.tag===31){var k=b.memoizedState;if(k===null&&(b=b.alternate,b!==null&&(k=b.memoizedState)),k!==null)return k.dehydrated}return null}function u(b){if(i(b)!==b)throw Error(s(188))}function d(b){var k=b.alternate;if(!k){if(k=i(b),k===null)throw Error(s(188));return k!==b?null:b}for(var C=b,A=k;;){var B=C.return;if(B===null)break;var H=B.alternate;if(H===null){if(A=B.return,A!==null){C=A;continue}break}if(B.child===H.child){for(H=B.child;H;){if(H===C)return u(B),b;if(H===A)return u(B),k;H=H.sibling}throw Error(s(188))}if(C.return!==A.return)C=B,A=H;else{for(var ee=!1,he=B.child;he;){if(he===C){ee=!0,C=B,A=H;break}if(he===A){ee=!0,A=B,C=H;break}he=he.sibling}if(!ee){for(he=H.child;he;){if(he===C){ee=!0,C=H,A=B;break}if(he===A){ee=!0,A=H,C=B;break}he=he.sibling}if(!ee)throw Error(s(189))}}if(C.alternate!==A)throw Error(s(190))}if(C.tag!==3)throw Error(s(188));return C.stateNode.current===C?b:k}function f(b){var k=b.tag;if(k===5||k===26||k===27||k===6)return b;for(b=b.child;b!==null;){if(k=f(b),k!==null)return k;b=b.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),_=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function F(b){return b===null||typeof b!="object"?null:(b=R&&b[R]||b["@@iterator"],typeof b=="function"?b:null)}var M=Symbol.for("react.client.reference");function L(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===M?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case v:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case j:return"SuspenseList";case I:return"Activity"}if(typeof b=="object")switch(b.$$typeof){case g:return"Portal";case _:return b.displayName||"Context";case S:return(b._context.displayName||"Context")+".Consumer";case O:var k=b.render;return b=b.displayName,b||(b=k.displayName||k.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case T:return k=b.displayName||null,k!==null?k:L(b.type)||"Memo";case N:k=b._payload,b=b._init;try{return L(b(k))}catch{}}return null}var U=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},D=[],Q=-1;function V(b){return{current:b}}function $(b){0>Q||(b.current=D[Q],D[Q]=null,Q--)}function Z(b,k){Q++,D[Q]=b.current,b.current=k}var G=V(null),J=V(null),ie=V(null),ne=V(null);function te(b,k){switch(Z(ie,k),Z(J,b),Z(G,null),k.nodeType){case 9:case 11:b=(b=k.documentElement)&&(b=b.namespaceURI)?vje(b):0;break;default:if(b=k.tagName,k=k.namespaceURI)k=vje(k),b=yje(k,b);else switch(b){case"svg":b=1;break;case"math":b=2;break;default:b=0}}$(G),Z(G,b)}function ae(){$(G),$(J),$(ie)}function de(b){b.memoizedState!==null&&Z(ne,b);var k=G.current,C=yje(k,b.type);k!==C&&(Z(J,b),Z(G,C))}function X(b){J.current===b&&($(G),$(J)),ne.current===b&&($(ne),HN._currentValue=W)}var re,le;function ge(b){if(re===void 0)try{throw Error()}catch(C){var k=C.stack.trim().match(/\n( *(at )?)/);re=k&&k[1]||"",le=-1<C.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<C.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+re+b+le}var fe=!1;function ue(b,k){if(!b||fe)return"";fe=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var A={DetermineComponentFrameRoot:function(){try{if(k){var mt=function(){throw Error()};if(Object.defineProperty(mt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(mt,[])}catch(at){var Ke=at}Reflect.construct(b,[],mt)}else{try{mt.call()}catch(at){Ke=at}b.call(mt.prototype)}}else{try{throw Error()}catch(at){Ke=at}(mt=b())&&typeof mt.catch=="function"&&mt.catch(function(){})}}catch(at){if(at&&Ke&&typeof at.stack=="string")return[at.stack,Ke.stack]}return[null,null]}};A.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var B=Object.getOwnPropertyDescriptor(A.DetermineComponentFrameRoot,"name");B&&B.configurable&&Object.defineProperty(A.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var H=A.DetermineComponentFrameRoot(),ee=H[0],he=H[1];if(ee&&he){var Ae=ee.split(`
5
5
  `),Xe=he.split(`
@@ -112,7 +112,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
112
112
  constructor(\${params}) {
113
113
  \${}
114
114
  }
115
- }`,{label:"class",detail:"definition",type:"keyword"}),bd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),bd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],zit=Rve.concat([bd("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),bd("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),bd("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),mPe=new drt,Fit=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function cA(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Jfn=["FunctionDeclaration"],ehn={FunctionDeclaration:cA("function"),ClassDeclaration:cA("class"),ClassExpression:()=>!0,EnumDeclaration:cA("constant"),TypeAliasDeclaration:cA("type"),NamespaceDeclaration:cA("namespace"),VariableDefinition(e,t){e.matchContext(Jfn)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function Bit(e,t){let n=mPe.get(t);if(n)return n;let r=[],s=!0;function a(i,o){let c=e.sliceString(i.from,i.to);r.push({label:c,type:o})}return t.cursor(Ea.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let o=ehn[i.name];if(o&&o(i,a)||Fit.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of Bit(e,i.node))r.push(o);return!1}}),mPe.set(t,r),r}const lF=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Pve=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Uit(e){let t=ri(e.state).resolveInner(e.pos,-1);if(Pve.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&lF.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let s=t;s;s=s.parent)Fit.has(s.name)&&(r=r.concat(Bit(e.state.doc,s)));return{options:r,from:n?t.from:e.pos,validFor:lF}}function oQ(e,t,n){var r;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:n};if(a?.name=="MemberExpression"&&((r=i=a.lastChild)===null||r===void 0?void 0:r.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function qit(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=ri(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?oQ(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?oQ(t,n.parent,""):Pve.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&lF.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?oQ(t,n,""):e.explicit?{path:[],name:""}:null}function thn(e,t){let n=e,r=[],s=new Set;for(let a=0;;a++){for(let o of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(o)||s.has(o))continue;s.add(o);let c;try{c=n[o]}catch{continue}r.push({label:o,type:typeof c=="function"?/^[A-Z]/.test(o)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return r;e=i}}function nhn(e){let t=new Map;return n=>{let r=qit(n);if(!r)return null;let s=e;for(let i of r.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=thn(s,!r.path.length)),{from:n.pos-r.name.length,options:a,validFor:lF}}}const xp=KS.define({name:"javascript",parser:Kfn.configure({props:[o_.add({IfStatement:YE({except:/^\s*({|else\b)/}),TryStatement:YE({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:acn,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:scn({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":YE({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}}),l_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":dve,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 n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Vit={test:e=>/^JSX/.test(e.name),facet:TU({commentTokens:{block:{open:"{/*",close:"*/}"}}})},$ve=xp.configure({dialect:"ts"},"typescript"),Mve=xp.configure({dialect:"jsx",props:[lve.add(e=>e.isTop?[Vit]:void 0)]}),Dve=xp.configure({dialect:"jsx ts",props:[lve.add(e=>e.isTop?[Vit]:void 0)]},"typescript");let Hit=e=>({label:e,type:"keyword"});const Wit="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(Hit),rhn=Wit.concat(["declare","implements","private","protected","public"].map(Hit));function cF(e={}){let t=e.jsx?e.typescript?Dve:Mve:e.typescript?$ve:xp,n=e.typescript?zit.concat(rhn):Rve.concat(Wit);return new ek(t,[xp.data.of({autocomplete:zcn(Pve,Bat(n))}),xp.data.of({autocomplete:Uit}),e.jsx?Zit:[]])}function shn(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 gPe(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const ahn=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Zit=vt.inputHandler.of((e,t,n,r,s)=>{if((ahn?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!xp.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(c=>{var u;let{head:d}=c,f=ri(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(r=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=gPe(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:Be.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let p=shn(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=gPe(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function ihn(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((n,r)=>{var s;!((s=n.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[r]=2)})),n=>{let{state:r}=n,s=[];for(let{from:a,to:i}of xp.findRegions(r)){let o=r.doc.lineAt(a),c={line:o.number-1,col:a-o.from,pos:a};for(let u of e.verify(r.sliceDoc(a,i),t))s.push(ohn(u,r.doc,c))}return s}}function vPe(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function ohn(e,t,n){let r=vPe(e.line,e.column,t,n),s={from:r,to:e.endLine!=null&&e.endColumn!=1?vPe(e.endLine,e.endColumn,t,n):r,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,o=a[0]+n.pos-r,c=a[1]+n.pos-r;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+o,to:d+c,insert:i},scrollIntoView:!0})}}]}return s}const q4=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:Zit,completionPath:qit,esLint:ihn,javascript:cF,javascriptLanguage:xp,jsxLanguage:Mve,localCompletionSource:Uit,scopeCompletionSource:nhn,snippets:Rve,tsxLanguage:Dve,typescriptLanguage:$ve,typescriptSnippets:zit},Symbol.toStringTag,{value:"Module"})),uA=["_blank","_self","_top","_parent"],lQ=["ascii","utf-8","utf-16","latin1","latin1"],cQ=["get","post","put","delete"],uQ=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],xf=["true","false"],Qn={},lhn={a:{attrs:{href:null,ping:null,type:null,media:null,target:uA,hreflang:null}},abbr:Qn,address:Qn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Qn,aside:Qn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Qn,base:{attrs:{href:null,target:uA}},bdi:Qn,bdo:Qn,blockquote:{attrs:{cite:null}},body:Qn,br:Qn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:uQ,formmethod:cQ,formnovalidate:["novalidate"],formtarget:uA,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Qn,center:Qn,cite:Qn,code:Qn,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:Qn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Qn,div:Qn,dl:Qn,dt:Qn,em:Qn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Qn,figure:Qn,footer:Qn,form:{attrs:{action:null,name:null,"accept-charset":lQ,autocomplete:["on","off"],enctype:uQ,method:cQ,novalidate:["novalidate"],target:uA}},h1:Qn,h2:Qn,h3:Qn,h4:Qn,h5:Qn,h6:Qn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Qn,hgroup:Qn,hr:Qn,html:{attrs:{manifest:null}},i:Qn,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:uQ,formmethod:cQ,formnovalidate:["novalidate"],formtarget:uA,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:Qn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Qn,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:Qn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:lQ,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:Qn,noscript:Qn,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:Qn,param:{attrs:{name:null,value:null}},pre:Qn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Qn,rt:Qn,ruby:Qn,samp:Qn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:lQ}},section:Qn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Qn,source:{attrs:{src:null,type:null,media:null}},span:Qn,strong:Qn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Qn,summary:Qn,sup:Qn,table:Qn,tbody:Qn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Qn,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:Qn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Qn,time:{attrs:{datetime:null}},title:Qn,tr:Qn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Qn,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:Qn},Git={accesskey:null,class:null,contenteditable:xf,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:xf,autocorrect:xf,autocapitalize:xf,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":xf,"aria-autocomplete":["inline","list","both","none"],"aria-busy":xf,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":xf,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":xf,"aria-hidden":xf,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":xf,"aria-multiselectable":xf,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":xf,"aria-relevant":null,"aria-required":xf,"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},Qit="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 Qit)Git[e]=null;let yP=class{constructor(t,n){this.tags={...lhn,...t},this.globalAttrs={...Git,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};yP.default=new yP;function VC(e,t,n=e.length){if(!t)return"";let r=t.firstChild,s=r&&r.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,n)):""}function HC(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function Yit(e,t,n){let r=n.tags[VC(e,HC(t))];return r?.children||n.allTags}function Lve(e,t){let n=[];for(let r=HC(t);r&&!r.type.isTop;r=HC(r.parent)){let s=VC(e,r);if(s&&r.lastChild.name=="CloseTag")break;s&&n.indexOf(s)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(s)}return n}const Xit=/^[:\-\.\w\u00b7-\uffff]*$/;function yPe(e,t,n,r,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=HC(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:s,options:Yit(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(Lve(e.doc,n).map((o,c)=>({label:"/"+o,apply:"/"+o+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function bPe(e,t,n,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:Lve(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:Xit}}function chn(e,t,n,r){let s=[],a=0;for(let i of Yit(e.doc,n,t))s.push({label:"<"+i,type:"type"});for(let i of Lve(e.doc,n))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function uhn(e,t,n,r,s){let a=HC(n),i=a?t.tags[VC(e.doc,a)]:null,o=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?o:o.length?o.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:Xit}}function dhn(e,t,n,r,s){var a;let i=(a=n.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),o=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=HC(n),h=f?t.tags[VC(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(r,s).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let m of d)o.push({label:m,apply:h+m+p,type:"constant"})}}return{from:r,to:s,options:o,validFor:c}}function Kit(e,t){let{state:n,pos:r}=t,s=ri(n).resolveInner(r,-1),a=s.resolve(r);for(let i=r,o;a==s&&(o=s.childBefore(i));){let c=o.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=o,i=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?bPe(n,s,s.from,r):yPe(n,e,s,s.from,r):s.name=="StartTag"||s.name=="IncompleteTag"?yPe(n,e,s,r,r):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?bPe(n,s,r,r):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?uhn(n,e,s,s.name=="AttributeName"?s.from:r,r):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?dhn(n,e,s,s.name=="Is"?r:s.from,r):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?chn(n,e,s,r):null}function Jit(e){return Kit(yP.default,e)}function eot(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new yP(t,n):yP.default;return s=>Kit(r,s)}const fhn=xp.parser.configure({top:"SingleExpression"}),tot=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:$ve.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Mve.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Dve.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:fhn},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:xp.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:vP.parser}],not=[{name:"style",parser:vP.parser.configure({top:"Styles"})}].concat(Qit.map(e=>({name:e,parser:xp.parser}))),rot=KS.define({name:"html",parser:Bdn.configure({props:[o_.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,n;for(let r=e.node;;){let s=r.lastChild;if(!s||s.name!="Element"||s.to!=r.to)break;t=r=s}return t&&!((n=t.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),l_.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),Pat.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),nR=rot.configure({wrap:jit(tot,not)});function sot(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=jit((e.nestedLanguages||[]).concat(tot),(e.nestedAttributes||[]).concat(not)));let r=n?rot.configure({wrap:n,dialect:t}):t?nR.configure({dialect:t}):nR;return new ek(r,[nR.data.of({autocomplete:eot(e)}),e.autoCloseTags!==!1?aot:[],cF().support,Dit().support])}const xPe=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),aot=vt.inputHandler.of((e,t,n,r,s)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!nR.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==r,{head:p}=c,m=ri(i).resolveInner(p,-1),g;if(h&&r==">"&&m.name=="EndTag"){let v=m.parent;if(((d=(u=v.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=VC(i.doc,v.parent,p))&&!xPe.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&&r=="/"&&m.name=="IncompleteCloseTag"){let v=m.parent;if(m.from==p-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=VC(i.doc,v,p))&&!xPe.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:Be.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),hhn=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:aot,html:sot,htmlCompletionSource:Jit,htmlCompletionSourceWith:eot,htmlLanguage:nR},Symbol.toStringTag,{value:"Module"})),iot=TU({commentTokens:{block:{open:"<!--",close:"-->"}}}),oot=new Nr,lot=qun.configure({props:[l_.add(e=>!e.is("Block")||e.is("Document")||bue(e)!=null||phn(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),oot.add(bue),o_.add({Document:()=>null}),g0.add({Document:iot})]});function bue(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function phn(e){return e.name=="OrderedList"||e.name=="BulletList"}function mhn(e,t){let n=e;for(;;){let r=n.nextSibling,s;if(!r||(s=bue(r.type))!=null&&s<=t)break;n=r}return n.to}const ghn=yat.of((e,t,n)=>{for(let r=ri(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let s=r.type.prop(oot);if(s==null)continue;let a=mhn(r,s);if(a>n)return{from:n,to:a}}return null});function zve(e){return new Hf(iot,e,[],"markdown")}const cot=zve(lot),vhn=lot.configure([edn,ndn,tdn,rdn,{props:[l_.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),rk=zve(vhn);function yhn(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=et.matchLanguageName(e,n,!0),r instanceof et)return r.support?r.support.language.parser:JS.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class dQ{constructor(t,n,r,s,a,i,o){this.node=t,this.from=n,this.to=r,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=o}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length<t;)r+=" ";return r}else{for(let s=this.to-this.from-r.length-this.spaceAfter.length;s>0;s--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+dot(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function uot(e,t){let n=[],r=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&n.push(s)}for(let s=n.length-1;s>=0;s--){let a=n[s],i,o=t.lineAt(a.from),c=a.from-o.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(o.text.slice(c))))r.push(new dQ(a,c,c+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(o.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new dQ(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(o.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]/," ")),r.push(new dQ(a.parent,c,c+d,i[1],u,f,a))}}return r}function dot(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function fQ(e,t,n,r=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let o=dot(a,t),c=+o[2];if(s>=0){if(c!=s+1)return;n.push({from:a.from+o[1].length,to:a.from+o[0].length,insert:String(s+2+r)})}s=c}let i=a.nextSibling;if(!i)break;a=i}}function Fve(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(i_)!=" ")return e;let r=Dm(e,4,n),s="";for(let a=r;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(n)}const fot=(e={})=>({state:t,dispatch:n})=>{let r=ri(t),{doc:s}=t,a=null,i=t.changeByRange(o=>{if(!o.empty||!rk.isActiveAt(t,o.from,-1)&&!rk.isActiveAt(t,o.from,1))return a={range:o};let c=o.from,u=s.lineAt(c),d=uot(r.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:o};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:o};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 S=d.length>1?d[d.length-2]:null,_,O="";S&&S.item?(_=u.from+S.from,O=S.marker(s,1)):_=u.from+(S?S.to:0);let E=[{from:_,to:c,insert:O}];return f.node.name=="OrderedList"&&fQ(f.item,s,E,-2),S&&S.node.name=="OrderedList"&&fQ(S.item,s,E),{range:Be.cursor(_+O.length),changes:E}}else{let S=SPe(d,t,u);return{range:Be.cursor(c+S.length+1),changes:{from:u.from,insert:S+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 S=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:o.map(S),changes:S}}}let p=[];f.node.name=="OrderedList"&&fQ(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?Dm(u.text,4,d[x+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=Fve(g,t),bhn(f.node,t.doc)&&(g=SPe(d,t,u)+t.lineBreak+g),p.push({from:v,to:c,insert:t.lineBreak+g}),{range:Be.cursor(v+g.length+1),changes:p}});return a?!1:(n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},hot=fot();function wPe(e){return e.name=="QuoteMark"||e.name=="ListMark"}function bhn(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let s=t.lineAt(n.to),a=t.lineAt(r.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function SPe(e,t,n){let r="";for(let s=0,a=e.length-2;s<=a;s++)r+=e[s].blank(s<a?Dm(n.text,4,e[s+1].from)-r.length:null,s<a);return Fve(r,t)}function xhn(e,t){let n=e.resolveInner(t,-1),r=t;wPe(n)&&(r=n.from,n=n.parent);for(let s;s=n.childBefore(r);)if(wPe(s))r=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")n=s.lastChild,r=n.to;else break;return n}const pot=({state:e,dispatch:t})=>{let n=ri(e),r=null,s=e.changeByRange(a=>{let i=a.from,{doc:o}=e;if(a.empty&&rk.isActiveAt(e,a.from)){let c=o.lineAt(i),u=uot(xhn(n,i),o);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:Be.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(Dm(c.text,4,d.to)-Dm(c.text,4,d.from));return h==c.from&&(p=Fve(p,e)),{range:Be.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:Be.cursor(h),changes:{from:h,to:i}}}}}return r={range:a}});return r?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},mot=[{key:"Enter",run:hot},{key:"Backspace",run:pot}],got=sot({matchClosingTags:!1});function Bve(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:s}=cot,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=got}=e;if(!(s instanceof IU))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[o.support,ghn],d;i&&u.push(vot),n instanceof ek?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?yhn(t,d):void 0;c.push(Hun({codeParser:f,htmlParser:o.language.parser})),r&&u.push(ef.high(Aw.of(mot)));let h=zve(s.configure(c));return a&&u.push(h.data.of({autocomplete:whn})),new ek(h,u)}function whn(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let s=ri(t).resolveInner(n,-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:n-r[0].length,to:n,options:Shn(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let hQ=null;function Shn(){if(hQ)return hQ;let e=Jit(new mve(xr.create({extensions:got}),0,!0));return hQ=e?e.options:[]}const khn=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,vot=vt.domEventHandlers({paste:(e,t)=>{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!rk.isActiveAt(t.state,r.from,1)))return!1;let a=ri(t.state),i=!1;return a.iterate({from:r.from,to:r.to,enter:o=>{(o.from>r.from||khn.test(o.name))&&(i=!0)},leave:o=>{o.to<r.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),_hn=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:cot,deleteMarkupBackward:pot,insertNewlineContinueMarkup:hot,insertNewlineContinueMarkupCommand:fot,markdown:Bve,markdownKeymap:mot,markdownLanguage:rk,pasteURLAsLink:vot},Symbol.toStringTag,{value:"Module"}));function yt(e){return new ek(fve.define(e))}function Rx(e){return nt(()=>import("./index-D8WmaG2W.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const yot=[et.of({name:"C",extensions:["c","h","ino"],load(){return nt(()=>import("./index-Ct7qJl0G.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),et.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return nt(()=>import("./index-Ct7qJl0G.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),et.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Rx("Cassandra")}}),et.of({name:"CSS",extensions:["css"],load(){return nt(()=>Promise.resolve().then(()=>wfn),void 0,import.meta.url).then(e=>e.css())}}),et.of({name:"Go",extensions:["go"],load(){return nt(()=>import("./index-CQFgjXuF.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),et.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return nt(()=>Promise.resolve().then(()=>hhn),void 0,import.meta.url).then(e=>e.html())}}),et.of({name:"Java",extensions:["java"],load(){return nt(()=>import("./index-7CvzrXxr.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),et.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript())}}),et.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return nt(()=>import("./index-DOw0Sd_J.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),et.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return nt(()=>Promise.resolve().then(()=>Dcn),void 0,import.meta.url).then(e=>e.json())}}),et.of({name:"JSX",extensions:["jsx"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),et.of({name:"LESS",extensions:["less"],load(){return nt(()=>import("./index-C2xWg42r.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),et.of({name:"Liquid",extensions:["liquid"],load(){return nt(()=>import("./index-MmwM57Ps.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),et.of({name:"MariaDB SQL",load(){return Rx("MariaSQL")}}),et.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return nt(()=>Promise.resolve().then(()=>_hn),void 0,import.meta.url).then(e=>e.markdown())}}),et.of({name:"MS SQL",load(){return Rx("MSSQL")}}),et.of({name:"MySQL",load(){return Rx("MySQL")}}),et.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return nt(()=>import("./index-C0V7VVcG.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),et.of({name:"PLSQL",extensions:["pls"],load(){return Rx("PLSQL")}}),et.of({name:"PostgreSQL",load(){return Rx("PostgreSQL")}}),et.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return nt(()=>import("./index-fnQbidjI.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),et.of({name:"Rust",extensions:["rs"],load(){return nt(()=>import("./index-9wg3FSzj.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),et.of({name:"Sass",extensions:["sass"],load(){return nt(()=>import("./index-B6n7w36d.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),et.of({name:"SCSS",extensions:["scss"],load(){return nt(()=>import("./index-B6n7w36d.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),et.of({name:"SQL",extensions:["sql"],load(){return Rx("StandardSQL")}}),et.of({name:"SQLite",load(){return Rx("SQLite")}}),et.of({name:"TSX",extensions:["tsx"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),et.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),et.of({name:"WebAssembly",extensions:["wat","wast"],load(){return nt(()=>import("./index-A3BXvFwX.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),et.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return nt(()=>import("./index-Dy77nOsH.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),et.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return nt(()=>import("./index-B9fCyqyZ.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),et.of({name:"APL",extensions:["dyalog","apl"],load(){return nt(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>yt(e.apl))}}),et.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return nt(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>yt(e.asciiArmor))}}),et.of({name:"ASN.1",extensions:["asn","asn1"],load(){return nt(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>yt(e.asn1({})))}}),et.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return nt(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>yt(e.asterisk))}}),et.of({name:"Brainfuck",extensions:["b","bf"],load(){return nt(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>yt(e.brainfuck))}}),et.of({name:"Cobol",extensions:["cob","cpy"],load(){return nt(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>yt(e.cobol))}}),et.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.csharp))}}),et.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>yt(e.clojure))}}),et.of({name:"ClojureScript",extensions:["cljs"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>yt(e.clojure))}}),et.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return nt(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>yt(e.gss))}}),et.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return nt(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>yt(e.cmake))}}),et.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return nt(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>yt(e.coffeeScript))}}),et.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return nt(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>yt(e.commonLisp))}}),et.of({name:"Cypher",extensions:["cyp","cypher"],load(){return nt(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>yt(e.cypher))}}),et.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return nt(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>yt(e.cython))}}),et.of({name:"Crystal",extensions:["cr"],load(){return nt(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>yt(e.crystal))}}),et.of({name:"D",extensions:["d"],load(){return nt(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>yt(e.d))}}),et.of({name:"Dart",extensions:["dart"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.dart))}}),et.of({name:"diff",extensions:["diff","patch"],load(){return nt(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>yt(e.diff))}}),et.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return nt(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>yt(e.dockerFile))}}),et.of({name:"DTD",extensions:["dtd"],load(){return nt(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>yt(e.dtd))}}),et.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return nt(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>yt(e.dylan))}}),et.of({name:"EBNF",load(){return nt(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>yt(e.ebnf))}}),et.of({name:"ECL",extensions:["ecl"],load(){return nt(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>yt(e.ecl))}}),et.of({name:"edn",extensions:["edn"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>yt(e.clojure))}}),et.of({name:"Eiffel",extensions:["e"],load(){return nt(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>yt(e.eiffel))}}),et.of({name:"Elm",extensions:["elm"],load(){return nt(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>yt(e.elm))}}),et.of({name:"Erlang",extensions:["erl"],load(){return nt(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>yt(e.erlang))}}),et.of({name:"Esper",load(){return nt(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>yt(e.esper))}}),et.of({name:"Factor",extensions:["factor"],load(){return nt(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>yt(e.factor))}}),et.of({name:"FCL",load(){return nt(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>yt(e.fcl))}}),et.of({name:"Forth",extensions:["forth","fth","4th"],load(){return nt(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>yt(e.forth))}}),et.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return nt(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>yt(e.fortran))}}),et.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>yt(e.fSharp))}}),et.of({name:"Gas",extensions:["s"],load(){return nt(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>yt(e.gas))}}),et.of({name:"Gherkin",extensions:["feature"],load(){return nt(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>yt(e.gherkin))}}),et.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return nt(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>yt(e.groovy))}}),et.of({name:"Haskell",extensions:["hs"],load(){return nt(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>yt(e.haskell))}}),et.of({name:"Haxe",extensions:["hx"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>yt(e.haxe))}}),et.of({name:"HXML",extensions:["hxml"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>yt(e.hxml))}}),et.of({name:"HTTP",load(){return nt(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>yt(e.http))}}),et.of({name:"IDL",extensions:["pro"],load(){return nt(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>yt(e.idl))}}),et.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return nt(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>yt(e.jsonld))}}),et.of({name:"Julia",extensions:["jl"],load(){return nt(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>yt(e.julia))}}),et.of({name:"Kotlin",extensions:["kt","kts"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.kotlin))}}),et.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return nt(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>yt(e.liveScript))}}),et.of({name:"Lua",extensions:["lua"],load(){return nt(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>yt(e.lua))}}),et.of({name:"mIRC",extensions:["mrc"],load(){return nt(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>yt(e.mirc))}}),et.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return nt(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>yt(e.mathematica))}}),et.of({name:"Modelica",extensions:["mo"],load(){return nt(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>yt(e.modelica))}}),et.of({name:"MUMPS",extensions:["mps"],load(){return nt(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>yt(e.mumps))}}),et.of({name:"Mbox",extensions:["mbox"],load(){return nt(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>yt(e.mbox))}}),et.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return nt(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>yt(e.nginx))}}),et.of({name:"NSIS",extensions:["nsh","nsi"],load(){return nt(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>yt(e.nsis))}}),et.of({name:"NTriples",extensions:["nt","nq"],load(){return nt(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>yt(e.ntriples))}}),et.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.objectiveC))}}),et.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.objectiveCpp))}}),et.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>yt(e.oCaml))}}),et.of({name:"Octave",extensions:["m"],load(){return nt(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>yt(e.octave))}}),et.of({name:"Oz",extensions:["oz"],load(){return nt(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>yt(e.oz))}}),et.of({name:"Pascal",extensions:["p","pas"],load(){return nt(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>yt(e.pascal))}}),et.of({name:"Perl",extensions:["pl","pm"],load(){return nt(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>yt(e.perl))}}),et.of({name:"Pig",extensions:["pig"],load(){return nt(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>yt(e.pig))}}),et.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return nt(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>yt(e.powerShell))}}),et.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return nt(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>yt(e.properties))}}),et.of({name:"ProtoBuf",extensions:["proto"],load(){return nt(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>yt(e.protobuf))}}),et.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return nt(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>yt(e.pug))}}),et.of({name:"Puppet",extensions:["pp"],load(){return nt(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>yt(e.puppet))}}),et.of({name:"Q",extensions:["q"],load(){return nt(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>yt(e.q))}}),et.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return nt(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>yt(e.r))}}),et.of({name:"RPM Changes",load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>yt(e.rpmChanges))}}),et.of({name:"RPM Spec",extensions:["spec"],load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>yt(e.rpmSpec))}}),et.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return nt(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>yt(e.ruby))}}),et.of({name:"SAS",extensions:["sas"],load(){return nt(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>yt(e.sas))}}),et.of({name:"Scala",extensions:["scala"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.scala))}}),et.of({name:"Scheme",extensions:["scm","ss"],load(){return nt(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>yt(e.scheme))}}),et.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return nt(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>yt(e.shell))}}),et.of({name:"Sieve",extensions:["siv","sieve"],load(){return nt(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>yt(e.sieve))}}),et.of({name:"Smalltalk",extensions:["st"],load(){return nt(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>yt(e.smalltalk))}}),et.of({name:"Solr",load(){return nt(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>yt(e.solr))}}),et.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>yt(e.sml))}}),et.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return nt(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>yt(e.sparql))}}),et.of({name:"Spreadsheet",alias:["excel","formula"],load(){return nt(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>yt(e.spreadsheet))}}),et.of({name:"Squirrel",extensions:["nut"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.squirrel))}}),et.of({name:"Stylus",extensions:["styl"],load(){return nt(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>yt(e.stylus))}}),et.of({name:"Swift",extensions:["swift"],load(){return nt(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>yt(e.swift))}}),et.of({name:"sTeX",load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>yt(e.stex))}}),et.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>yt(e.stex))}}),et.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>yt(e.verilog))}}),et.of({name:"Tcl",extensions:["tcl"],load(){return nt(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>yt(e.tcl))}}),et.of({name:"Textile",extensions:["textile"],load(){return nt(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>yt(e.textile))}}),et.of({name:"TiddlyWiki",load(){return nt(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>yt(e.tiddlyWiki))}}),et.of({name:"Tiki wiki",load(){return nt(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>yt(e.tiki))}}),et.of({name:"TOML",extensions:["toml"],load(){return nt(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>yt(e.toml))}}),et.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return nt(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>yt(e.troff))}}),et.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return nt(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>yt(e.ttcn))}}),et.of({name:"TTCN_CFG",extensions:["cfg"],load(){return nt(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>yt(e.ttcnCfg))}}),et.of({name:"Turtle",extensions:["ttl"],load(){return nt(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>yt(e.turtle))}}),et.of({name:"Web IDL",extensions:["webidl"],load(){return nt(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>yt(e.webIDL))}}),et.of({name:"VB.NET",extensions:["vb"],load(){return nt(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>yt(e.vb))}}),et.of({name:"VBScript",extensions:["vbs"],load(){return nt(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>yt(e.vbScript))}}),et.of({name:"Velocity",extensions:["vtl"],load(){return nt(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>yt(e.velocity))}}),et.of({name:"Verilog",extensions:["v"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>yt(e.verilog))}}),et.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return nt(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>yt(e.vhdl))}}),et.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return nt(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>yt(e.xQuery))}}),et.of({name:"Yacas",extensions:["ys"],load(){return nt(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>yt(e.yacas))}}),et.of({name:"Z80",extensions:["z80"],load(){return nt(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>yt(e.z80))}}),et.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>yt(e.mscgen))}}),et.of({name:"Xù",extensions:["xu"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>yt(e.xu))}}),et.of({name:"MsGenny",extensions:["msgenny"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>yt(e.msgenny))}}),et.of({name:"Vue",extensions:["vue"],load(){return nt(()=>import("./index-Cjt4ARtq.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),et.of({name:"Angular Template",load(){return nt(()=>import("./index-DVk1DRCU.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];function gb(){return gb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gb.apply(null,arguments)}var Ohn=e=>{var{theme:t,settings:n={},styles:r=[]}=e,s={".cm-gutters":{}},a={};n.background&&(a.backgroundColor=n.background),n.backgroundImage&&(a.backgroundImage=n.backgroundImage),n.foreground&&(a.color=n.foreground),n.fontSize&&(a.fontSize=n.fontSize),(n.background||n.foreground)&&(s["&"]=a),n.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(s[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(s[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(s[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(s[".cm-content"]={caretColor:n.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var i={};n.gutterActiveForeground&&(i.color=n.gutterActiveForeground),n.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:n.lineHighlight},i.backgroundColor=n.lineHighlight),s[".cm-activeLineGutter"]=i,n.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var o=vt.theme(s,{dark:t==="dark"}),c=Km.define(r),u=[o,zb(c)];return u},Ehn={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)"},Chn=[{tag:se.comment,color:"#6272a4"},{tag:se.string,color:"#f1fa8c"},{tag:se.atom,color:"#bd93f9"},{tag:se.meta,color:"#f8f8f2"},{tag:[se.keyword,se.operator,se.tagName],color:"#ff79c6"},{tag:[se.function(se.propertyName),se.propertyName],color:"#66d9ef"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"#50fa7b"},{tag:se.atom,color:"#bd93f9"}],mj=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return Ohn({theme:t,settings:gb({},Ehn,n),styles:[...Chn,...r]})};mj();function RU(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}const Thn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=qve(e.state,n.from);return r.line?jhn(e):r.block?Ahn(e):!1};function Uve(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const jhn=Uve(Phn,0),Nhn=Uve(bot,0),Ahn=Uve((e,t)=>bot(e,t,Rhn(t)),0);function qve(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const dA=50;function Ihn(e,{open:t,close:n},r,s){let a=e.sliceDoc(r-dA,r),i=e.sliceDoc(s,s+dA),o=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(i)[0].length,u=a.length-o;if(a.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-r<=2*dA?d=f=e.sliceDoc(r,s):(d=e.sliceDoc(r,r+dA),f=e.sliceDoc(s-dA,s));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function Rhn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function bot(e,t,n=t.selection.ranges){let r=n.map(a=>qve(t,a.from).block);if(!r.every(a=>a))return null;let s=n.map((a,i)=>Ihn(t,r[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(n.map((a,i)=>s[i]?[]:[{from:a.from,insert:r[i].open+" "},{from:a.to,insert:" "+r[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,o;i<s.length;i++)if(o=s[i]){let c=r[i],{open:u,close:d}=o;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 Phn(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:a,to:i}of n){let o=r.length,c=1e9,u;for(let d=a;d<=i;){let f=t.doc.lineAt(d);if(u==null&&(u=qve(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),r.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=o;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==o+1&&(r[o].single=!0)}if(e!=2&&r.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:o,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&a.push({from:o.from+u,insert:c+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&r.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:o,token:c}of r)if(o>=0){let u=i.from+o,d=u+c.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const xue=Up.define(),$hn=Up.define(),Mhn=kt.define(),xot=kt.define({combine(e){return qp(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),wot=So.define({create(){return Kg.empty},update(e,t){let n=t.state.facet(xot),r=t.annotation(xue);if(r){let c=Id.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=uF(d,d.length,n.minDepth,c):d=Oot(d,t.startState.selection),new Kg(u==0?r.rest:d,u==0?d:r.rest)}let s=t.annotation($hn);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(il.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Id.fromTransaction(t),i=t.annotation(il.time),o=t.annotation(il.userEvent);return a?e=e.addChanges(a,i,o,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,o,n.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 Kg(e.done.map(Id.fromJSON),e.undone.map(Id.fromJSON))}});function Sot(e={}){return[wot,xot.of(e),vt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?kot:t.inputType=="historyRedo"?wue:null;return r?(t.preventDefault(),r(n)):!1}})]}function PU(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(wot,!1);if(!s)return!1;let a=s.pop(e,n,t);return a?(r(a),!0):!1}}const kot=PU(0,!1),wue=PU(1,!1),Dhn=PU(0,!0),Lhn=PU(1,!0);class Id{constructor(t,n,r,s,a){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new Id(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Id(t.changes&&Po.fromJSON(t.changes),[],t.mapped&&fv.fromJSON(t.mapped),t.startSelection&&Be.fromJSON(t.startSelection),t.selectionsAfter.map(Be.fromJSON))}static fromTransaction(t,n){let r=dp;for(let s of t.startState.facet(Mhn)){let a=s(t);a.length&&(r=r.concat(a))}return!r.length&&t.changes.empty?null:new Id(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,dp)}static selection(t){return new Id(void 0,dp,void 0,void 0,t)}}function uF(e,t,n,r){let s=t+1>n+20?t-n-1:0,a=e.slice(s,t);return a.push(r),a}function zhn(e,t){let n=[],r=!1;return e.iterChangedRanges((s,a)=>n.push(s,a)),t.iterChangedRanges((s,a,i,o)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];o>=u&&i<=d&&(r=!0)}}),r}function Fhn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function _ot(e,t){return e.length?t.length?e.concat(t):e:t}const dp=[],Bhn=200;function Oot(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Bhn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),uF(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Id.selection([t])]}function Uhn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function pQ(e,t){if(!e.length)return e;let n=e.length,r=dp;for(;n;){let s=qhn(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,n);return a[n-1]=s,a}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[Id.selection(r)]:dp}function qhn(e,t,n){let r=_ot(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):dp,n);if(!e.changes)return Id.selection(r);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new Id(s,Un.mapEffects(e.effects,t),i,e.startSelection.map(a),r)}const Vhn=/^(input\.type|delete)($|\.)/;class Kg{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Kg(this.done,this.undone):this}addChanges(t,n,r,s,a){let i=this.done,o=i[i.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!r||Vhn.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,zhn(o.changes,t.changes))||r=="input.type.compose")?i=uF(i,i.length-1,s.minDepth,new Id(t.changes.compose(o.changes),_ot(Un.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,dp)):i=uF(i,i.length,s.minDepth,t),new Kg(i,dp,n,r)}addSelection(t,n,r,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:dp;return a.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Fhn(a[a.length-1],t)?this:new Kg(Oot(this.done,t),this.undone,n,r)}addMapping(t){return new Kg(pQ(this.done,t),pQ(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){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):n.selection);if(r&&a.selectionsAfter.length)return n.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:xue.of({side:t,rest:Uhn(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let o=s.length==1?dp:s.slice(0,s.length-1);return a.mapped&&(o=pQ(o,a.mapped)),n.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:xue.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Kg.empty=new Kg(dp,dp);const Eot=[{key:"Mod-z",run:kot,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wue,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wue,preventDefault:!0},{key:"Mod-u",run:Dhn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Lhn,preventDefault:!0}];function gj(e,t){return Be.create(e.ranges.map(t),e.mainIndex)}function Jm(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function eg({state:e,dispatch:t},n){let r=gj(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Jm(e,r)),!0)}function $U(e,t){return Be.cursor(t?e.to:e.from)}function Cot(e,t){return eg(e,n=>n.empty?e.moveByChar(n,t):$U(n,t))}function gu(e){return e.textDirectionAt(e.state.selection.main.head)==di.LTR}const Tot=e=>Cot(e,!gu(e)),jot=e=>Cot(e,gu(e));function Not(e,t){return eg(e,n=>n.empty?e.moveByGroup(n,t):$U(n,t))}const Hhn=e=>Not(e,!gu(e)),Whn=e=>Not(e,gu(e));function Zhn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function MU(e,t,n){let r=ri(e).resolveInner(t.head),s=n?Nr.closedBy:Nr.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;Zhn(e,u,s)?r=u:c=n?u.to:u.from}let a=r.type.prop(s),i,o;return a&&(i=n?Xg(e,r.from,1):Xg(e,r.to,-1))&&i.matched?o=n?i.end.to:i.end.from:o=n?r.to:r.from,Be.cursor(o,n?-1:1)}const Ghn=e=>eg(e,t=>MU(e.state,t,!gu(e))),Qhn=e=>eg(e,t=>MU(e.state,t,gu(e)));function Aot(e,t){return eg(e,n=>{if(!n.empty)return $U(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Iot=e=>Aot(e,!1),Rot=e=>Aot(e,!0);function Pot(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let a of e.state.facet(vt.scrollMargins)){let i=a(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function $ot(e,t){let n=Pot(e),{state:r}=e,s=gj(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):$U(i,t));if(s.eq(r.selection))return!1;let a;if(n.selfScroll){let i=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,u=o.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(a=vt.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Jm(r,s),{effects:a}),!0}const kPe=e=>$ot(e,!1),Sue=e=>$ot(e,!0);function Iw(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let a=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&t.head!=r.from+a&&(s=Be.cursor(r.from+a))}return s}const Yhn=e=>eg(e,t=>Iw(e,t,!0)),Xhn=e=>eg(e,t=>Iw(e,t,!1)),Khn=e=>eg(e,t=>Iw(e,t,!gu(e))),Jhn=e=>eg(e,t=>Iw(e,t,gu(e))),epn=e=>eg(e,t=>Be.cursor(e.lineBlockAt(t.head).from,1)),tpn=e=>eg(e,t=>Be.cursor(e.lineBlockAt(t.head).to,-1));function npn(e,t,n){let r=!1,s=gj(e.selection,a=>{let i=Xg(e,a.head,-1)||Xg(e,a.head,1)||a.head>0&&Xg(e,a.head-1,1)||a.head<e.doc.length&&Xg(e,a.head+1,-1);if(!i||!i.end)return a;r=!0;let o=i.start.from==a.head?i.end.to:i.end.from;return Be.cursor(o)});return r?(t(Jm(e,s)),!0):!1}const rpn=({state:e,dispatch:t})=>npn(e,t);function Hp(e,t){let n=gj(e.state.selection,r=>{let s=t(r);return Be.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Jm(e.state,n)),!0)}function Mot(e,t){return Hp(e,n=>e.moveByChar(n,t))}const Dot=e=>Mot(e,!gu(e)),Lot=e=>Mot(e,gu(e));function zot(e,t){return Hp(e,n=>e.moveByGroup(n,t))}const spn=e=>zot(e,!gu(e)),apn=e=>zot(e,gu(e)),ipn=e=>Hp(e,t=>MU(e.state,t,!gu(e))),opn=e=>Hp(e,t=>MU(e.state,t,gu(e)));function Fot(e,t){return Hp(e,n=>e.moveVertically(n,t))}const Bot=e=>Fot(e,!1),Uot=e=>Fot(e,!0);function qot(e,t){return Hp(e,n=>e.moveVertically(n,t,Pot(e).height))}const _Pe=e=>qot(e,!1),OPe=e=>qot(e,!0),lpn=e=>Hp(e,t=>Iw(e,t,!0)),cpn=e=>Hp(e,t=>Iw(e,t,!1)),upn=e=>Hp(e,t=>Iw(e,t,!gu(e))),dpn=e=>Hp(e,t=>Iw(e,t,gu(e))),fpn=e=>Hp(e,t=>Be.cursor(e.lineBlockAt(t.head).from)),hpn=e=>Hp(e,t=>Be.cursor(e.lineBlockAt(t.head).to)),EPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:0})),!0),CPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:e.doc.length})),!0),TPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:e.selection.main.anchor,head:0})),!0),jPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ppn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),mpn=({state:e,dispatch:t})=>{let n=DU(e).map(({from:r,to:s})=>Be.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Be.create(n),userEvent:"select"})),!0},gpn=({state:e,dispatch:t})=>{let n=gj(e.selection,r=>{let s=ri(e),a=s.resolveStack(r.from,1);if(r.empty){let i=s.resolveStack(r.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:o}=i;if((o.from<r.from&&o.to>=r.to||o.to>r.to&&o.from<=r.from)&&i.next)return Be.range(o.to,o.from)}return r});return n.eq(e.selection)?!1:(t(Jm(e,n)),!0)};function Vot(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let a of n.selection.ranges){let i=n.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let o=a;;){let c=e.moveVertically(o,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==o.head)break;o=c}}}return s.length==r.ranges.length?!1:(e.dispatch(Jm(n,Be.create(s,s.length-1))),!0)}const vpn=e=>Vot(e,!1),ypn=e=>Vot(e,!0),bpn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Be.create([n.main]):n.main.empty||(r=Be.create([Be.cursor(n.main.head)])),r?(t(Jm(e,r)),!0):!1};function VM(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(a=>{let{from:i,to:o}=a;if(i==o){let c=t(a);c<i?(n="delete.backward",c=V4(e,c,!1)):c>i&&(n="delete.forward",c=V4(e,c,!0)),i=Math.min(i,c),o=Math.max(o,c)}else i=V4(e,i,!1),o=V4(e,o,!0);return i==o?{range:a}:{changes:{from:i,to:o},range:Be.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?vt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function V4(e,t,n){if(e instanceof vt)for(let r of e.state.facet(vt.atomicRanges).map(s=>s(e)))r.between(t,t,(s,a)=>{s<t&&a>t&&(t=n?a:s)});return t}const Hot=(e,t,n)=>VM(e,r=>{let s=r.from,{state:a}=e,i=a.doc.lineAt(s),o,c;if(n&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(o=i.text.slice(0,s-i.from))){if(o[o.length-1]==" ")return s-1;let u=Dm(o,a.tabSize),d=u%tk(a)||tk(a);for(let f=0;f<d&&o[o.length-1-f]==" ";f++)s--;c=s}else c=ui(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=ui(i.text,c-i.from,!1,!1)+i.from);return c}),kue=e=>Hot(e,!1,!0),Wot=e=>Hot(e,!0,!1),Zot=(e,t)=>VM(e,n=>{let r=n.head,{state:s}=e,a=s.doc.lineAt(r),i=s.charCategorizer(r);for(let o=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let c=ui(a.text,r-a.from,t)+a.from,u=a.text.slice(Math.min(r,c)-a.from,Math.max(r,c)-a.from),d=i(u);if(o!=null&&d!=o)break;(u!=" "||r!=n.head)&&(o=d),r=c}return r}),Got=e=>Zot(e,!1),xpn=e=>Zot(e,!0),wpn=e=>VM(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Spn=e=>VM(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kpn=e=>VM(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),_pn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Dr.of(["",""])},range:Be.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Opn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,a=e.doc.lineAt(s),i=s==a.from?s-1:ui(a.text,s-a.from,!1)+a.from,o=s==a.to?s+1:ui(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:o,insert:e.doc.slice(s,o).append(e.doc.slice(i,s))},range:Be.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function DU(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(r)}else t.push({from:s.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Qot(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let a of DU(e)){if(n?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(n?a.to+1:a.from-1),o=i.length+1;if(n){r.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let c of a.ranges)s.push(Be.range(Math.min(e.doc.length,c.anchor+o),Math.min(e.doc.length,c.head+o)))}else{r.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let c of a.ranges)s.push(Be.range(c.anchor-o,c.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Be.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Epn=({state:e,dispatch:t})=>Qot(e,t,!1),Cpn=({state:e,dispatch:t})=>Qot(e,t,!0);function Yot(e,t,n){if(e.readOnly)return!1;let r=[];for(let a of DU(e))n?r.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):r.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Tpn=({state:e,dispatch:t})=>Yot(e,t,!1),jpn=({state:e,dispatch:t})=>Yot(e,t,!0),Npn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(DU(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),r=gj(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),o=e.coordsAtPos(s.head,s.assoc||1);o&&(a=i.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Apn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ri(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),a;return r&&s&&r.to<=t&&s.from>=t&&(a=r.type.prop(Nr.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const NPe=Xot(!1),Ipn=Xot(!0);function Xot(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:a,to:i}=s,o=t.doc.lineAt(a),c=!e&&a==i&&Apn(t,a);e&&(a=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new jU(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=cve(u,a);for(d==null&&(d=Dm(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;c?{from:a,to:i}=c:a>o.from&&a<o.from+100&&!/\S/.test(o.text.slice(0,a))&&(a=o.from);let f=["",cP(t,d)];return c&&f.push(cP(t,u.lineIndent(o.from,-1))),{changes:{from:a,to:i,insert:Dr.of(f)},range:Be.cursor(a+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Vve(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let i=r.from;i<=r.to;){let o=e.doc.lineAt(i);o.number>n&&(r.empty||r.to>o.from)&&(t(o,s,r),n=o.number),i=o.to+1}let a=e.changes(s);return{changes:s,range:Be.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}const Rpn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new jU(e,{overrideIndentation:a=>{let i=n[a];return i??-1}}),s=Vve(e,(a,i,o)=>{let c=cve(r,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=cP(e,c);(u!=d||o.from<a.from+u.length)&&(n[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},Kot=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Vve(e,(n,r)=>{r.push({from:n.from,insert:e.facet(i_)})}),{userEvent:"input.indent"})),!0),Jot=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Vve(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let a=Dm(s,e.tabSize),i=0,o=cP(e,Math.max(0,a-tk(e)));for(;i<s.length&&i<o.length&&s.charCodeAt(i)==o.charCodeAt(i);)i++;r.push({from:n.from+i,to:n.from+s.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0),Ppn=e=>(e.setTabFocusMode(),!0),$pn=[{key:"Ctrl-b",run:Tot,shift:Dot,preventDefault:!0},{key:"Ctrl-f",run:jot,shift:Lot},{key:"Ctrl-p",run:Iot,shift:Bot},{key:"Ctrl-n",run:Rot,shift:Uot},{key:"Ctrl-a",run:epn,shift:fpn},{key:"Ctrl-e",run:tpn,shift:hpn},{key:"Ctrl-d",run:Wot},{key:"Ctrl-h",run:kue},{key:"Ctrl-k",run:wpn},{key:"Ctrl-Alt-h",run:Got},{key:"Ctrl-o",run:_pn},{key:"Ctrl-t",run:Opn},{key:"Ctrl-v",run:Sue}],Mpn=[{key:"ArrowLeft",run:Tot,shift:Dot,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Hhn,shift:spn,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Khn,shift:upn,preventDefault:!0},{key:"ArrowRight",run:jot,shift:Lot,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Whn,shift:apn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Jhn,shift:dpn,preventDefault:!0},{key:"ArrowUp",run:Iot,shift:Bot,preventDefault:!0},{mac:"Cmd-ArrowUp",run:EPe,shift:TPe},{mac:"Ctrl-ArrowUp",run:kPe,shift:_Pe},{key:"ArrowDown",run:Rot,shift:Uot,preventDefault:!0},{mac:"Cmd-ArrowDown",run:CPe,shift:jPe},{mac:"Ctrl-ArrowDown",run:Sue,shift:OPe},{key:"PageUp",run:kPe,shift:_Pe},{key:"PageDown",run:Sue,shift:OPe},{key:"Home",run:Xhn,shift:cpn,preventDefault:!0},{key:"Mod-Home",run:EPe,shift:TPe},{key:"End",run:Yhn,shift:lpn,preventDefault:!0},{key:"Mod-End",run:CPe,shift:jPe},{key:"Enter",run:NPe,shift:NPe},{key:"Mod-a",run:ppn},{key:"Backspace",run:kue,shift:kue,preventDefault:!0},{key:"Delete",run:Wot,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Got,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:xpn,preventDefault:!0},{mac:"Mod-Backspace",run:Spn,preventDefault:!0},{mac:"Mod-Delete",run:kpn,preventDefault:!0}].concat($pn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),elt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Ghn,shift:ipn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Qhn,shift:opn},{key:"Alt-ArrowUp",run:Epn},{key:"Shift-Alt-ArrowUp",run:Tpn},{key:"Alt-ArrowDown",run:Cpn},{key:"Shift-Alt-ArrowDown",run:jpn},{key:"Mod-Alt-ArrowUp",run:vpn},{key:"Mod-Alt-ArrowDown",run:ypn},{key:"Escape",run:bpn},{key:"Mod-Enter",run:Ipn},{key:"Alt-l",mac:"Ctrl-l",run:mpn},{key:"Mod-i",run:gpn,preventDefault:!0},{key:"Mod-[",run:Jot},{key:"Mod-]",run:Kot},{key:"Mod-Alt-\\",run:Rpn},{key:"Shift-Mod-k",run:Npn},{key:"Shift-Mod-\\",run:rpn},{key:"Mod-/",run:Thn},{key:"Alt-A",run:Nhn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ppn}].concat(Mpn),tlt={key:"Tab",run:Kot,shift:Jot},APe=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;let vb=class{constructor(t,n,r=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(r,s),this.bufferStart=r,this.normalize=a?o=>a(APe(o)):APe,this.query=this.normalize(n)}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 Jc(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 n=wU(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=sp(t);let s=this.normalize(n);if(s.length)for(let a=0,i=r;;a++){let o=s.charCodeAt(a),c=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}i==r&&a<n.length&&n.charCodeAt(a)==o&&i++}}}match(t,n,r){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:r}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}};typeof Symbol<"u"&&(vb.prototype[Symbol.iterator]=function(){return this});const nlt={from:-1,to:-1,match:/.*/.exec("")},Hve="gm"+(/x/.unicode==null?"":"u");let rlt=class{constructor(t,n,r,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=nlt,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new slt(t,n,r,s,a);this.re=new RegExp(n,Hve+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=dF(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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=dF(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},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 mQ=new WeakMap;let IPe=class w6{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let s=mQ.get(t);if(!s||s.from>=r||s.to<=n){let o=new w6(n,t.sliceString(n,r));return mQ.set(t,o),o}if(s.from==n&&s.to==r)return s;let{text:a,from:i}=s;return i>n&&(a=t.sliceString(n,i)+a,i=n),s.to<r&&(a+=t.sliceString(s.to,r)),mQ.set(t,new w6(i,a)),new w6(n,a.slice(n-i,r-i))}},slt=class{constructor(t,n,r,s,a){this.text=t,this.to=a,this.done=!1,this.value=nlt,this.matchPos=dF(t,s),this.re=new RegExp(n,Hve+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=IPe.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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=dF(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=IPe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(rlt.prototype[Symbol.iterator]=slt.prototype[Symbol.iterator]=function(){return this});function Dpn(e){try{return new RegExp(e,Hve),!0}catch{return!1}}function dF(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}const Lpn=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:s}=Dln(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},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:r});return}let o=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=i,h=d?+d.slice(1):0,p=u?+u:o.number;if(u&&f){let v=p/100;c&&(v=v*(c=="-"?-1:1)+o.number/t.doc.lines),p=Math.round(t.doc.lines*v)}else u&&c&&(p=p*(c=="-"?-1:1)+o.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=Be.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[r,vt.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},zpn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Fpn=kt.define({combine(e){return qp(e,zpn,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Bpn(e){return[Wpn,Hpn]}const Upn=dn.mark({class:"cm-selectionMatch"}),qpn=dn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function RPe(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=As.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=As.Word)}function Vpn(e,t,n,r){return e(t.sliceDoc(n,n+1))==As.Word&&e(t.sliceDoc(r-1,r))==As.Word}const Hpn=dl.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(Fpn),{state:n}=e,r=n.selection;if(r.ranges.length>1)return dn.none;let s=r.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return dn.none;let c=n.wordAt(s.head);if(!c)return dn.none;i=n.charCategorizer(s.head),a=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return dn.none;if(t.wholeWords){if(a=n.sliceDoc(s.from,s.to),i=n.charCategorizer(s.head),!(RPe(i,n,s.from,s.to)&&Vpn(i,n,s.from,s.to)))return dn.none}else if(a=n.sliceDoc(s.from,s.to),!a)return dn.none}let o=[];for(let c of e.visibleRanges){let u=new vb(n.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||RPe(i,n,d,f))&&(s.empty&&d<=s.from&&f>=s.to?o.push(qpn.range(d,f)):(d>=s.to||f<=s.from)&&o.push(Upn.range(d,f)),o.length>t.maxMatches))return dn.none}}return dn.set(o)}},{decorations:e=>e.decorations}),Wpn=vt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Zpn=({state:e,dispatch:t})=>{let{selection:n}=e,r=Be.create(n.ranges.map(s=>e.wordAt(s.head)||Be.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Gpn(e,t){let{main:n,ranges:r}=e.selection,s=e.wordAt(n.head),a=s&&s.from==n.from&&s.to==n.to;for(let i=!1,o=new vb(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new vb(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),i=!0}else{if(i&&r.some(c=>c.from==o.value.from))continue;if(a){let c=e.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Qpn=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(a=>a.from===a.to))return Zpn({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=r))return!1;let s=Gpn(e,r);return s?(t(e.update({selection:e.selection.addRange(Be.range(s.from,s.to),!1),effects:vt.scrollIntoView(s.to)})),!0):!1},vj=kt.define({combine(e){return qp(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new cmn(t),scrollToMatch:t=>vt.scrollIntoView(t)})}});let alt=class{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||Dpn(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,(n,r)=>r=="n"?`
115
+ }`,{label:"class",detail:"definition",type:"keyword"}),bd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),bd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],zit=Rve.concat([bd("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),bd("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),bd("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),mPe=new drt,Fit=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function cA(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Jfn=["FunctionDeclaration"],ehn={FunctionDeclaration:cA("function"),ClassDeclaration:cA("class"),ClassExpression:()=>!0,EnumDeclaration:cA("constant"),TypeAliasDeclaration:cA("type"),NamespaceDeclaration:cA("namespace"),VariableDefinition(e,t){e.matchContext(Jfn)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function Bit(e,t){let n=mPe.get(t);if(n)return n;let r=[],s=!0;function a(i,o){let c=e.sliceString(i.from,i.to);r.push({label:c,type:o})}return t.cursor(Ea.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let o=ehn[i.name];if(o&&o(i,a)||Fit.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of Bit(e,i.node))r.push(o);return!1}}),mPe.set(t,r),r}const lF=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Pve=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Uit(e){let t=ri(e.state).resolveInner(e.pos,-1);if(Pve.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&lF.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let s=t;s;s=s.parent)Fit.has(s.name)&&(r=r.concat(Bit(e.state.doc,s)));return{options:r,from:n?t.from:e.pos,validFor:lF}}function oQ(e,t,n){var r;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:n};if(a?.name=="MemberExpression"&&((r=i=a.lastChild)===null||r===void 0?void 0:r.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function qit(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=ri(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?oQ(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?oQ(t,n.parent,""):Pve.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&lF.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?oQ(t,n,""):e.explicit?{path:[],name:""}:null}function thn(e,t){let n=e,r=[],s=new Set;for(let a=0;;a++){for(let o of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(o)||s.has(o))continue;s.add(o);let c;try{c=n[o]}catch{continue}r.push({label:o,type:typeof c=="function"?/^[A-Z]/.test(o)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return r;e=i}}function nhn(e){let t=new Map;return n=>{let r=qit(n);if(!r)return null;let s=e;for(let i of r.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=thn(s,!r.path.length)),{from:n.pos-r.name.length,options:a,validFor:lF}}}const xp=KS.define({name:"javascript",parser:Kfn.configure({props:[o_.add({IfStatement:YE({except:/^\s*({|else\b)/}),TryStatement:YE({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:acn,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:scn({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":YE({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}}),l_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":dve,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 n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Vit={test:e=>/^JSX/.test(e.name),facet:TU({commentTokens:{block:{open:"{/*",close:"*/}"}}})},$ve=xp.configure({dialect:"ts"},"typescript"),Mve=xp.configure({dialect:"jsx",props:[lve.add(e=>e.isTop?[Vit]:void 0)]}),Dve=xp.configure({dialect:"jsx ts",props:[lve.add(e=>e.isTop?[Vit]:void 0)]},"typescript");let Hit=e=>({label:e,type:"keyword"});const Wit="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(Hit),rhn=Wit.concat(["declare","implements","private","protected","public"].map(Hit));function cF(e={}){let t=e.jsx?e.typescript?Dve:Mve:e.typescript?$ve:xp,n=e.typescript?zit.concat(rhn):Rve.concat(Wit);return new ek(t,[xp.data.of({autocomplete:zcn(Pve,Bat(n))}),xp.data.of({autocomplete:Uit}),e.jsx?Zit:[]])}function shn(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 gPe(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const ahn=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Zit=vt.inputHandler.of((e,t,n,r,s)=>{if((ahn?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!xp.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(c=>{var u;let{head:d}=c,f=ri(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(r=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=gPe(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:Be.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let p=shn(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=gPe(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function ihn(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((n,r)=>{var s;!((s=n.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[r]=2)})),n=>{let{state:r}=n,s=[];for(let{from:a,to:i}of xp.findRegions(r)){let o=r.doc.lineAt(a),c={line:o.number-1,col:a-o.from,pos:a};for(let u of e.verify(r.sliceDoc(a,i),t))s.push(ohn(u,r.doc,c))}return s}}function vPe(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function ohn(e,t,n){let r=vPe(e.line,e.column,t,n),s={from:r,to:e.endLine!=null&&e.endColumn!=1?vPe(e.endLine,e.endColumn,t,n):r,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,o=a[0]+n.pos-r,c=a[1]+n.pos-r;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+o,to:d+c,insert:i},scrollIntoView:!0})}}]}return s}const q4=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:Zit,completionPath:qit,esLint:ihn,javascript:cF,javascriptLanguage:xp,jsxLanguage:Mve,localCompletionSource:Uit,scopeCompletionSource:nhn,snippets:Rve,tsxLanguage:Dve,typescriptLanguage:$ve,typescriptSnippets:zit},Symbol.toStringTag,{value:"Module"})),uA=["_blank","_self","_top","_parent"],lQ=["ascii","utf-8","utf-16","latin1","latin1"],cQ=["get","post","put","delete"],uQ=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],xf=["true","false"],Qn={},lhn={a:{attrs:{href:null,ping:null,type:null,media:null,target:uA,hreflang:null}},abbr:Qn,address:Qn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Qn,aside:Qn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Qn,base:{attrs:{href:null,target:uA}},bdi:Qn,bdo:Qn,blockquote:{attrs:{cite:null}},body:Qn,br:Qn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:uQ,formmethod:cQ,formnovalidate:["novalidate"],formtarget:uA,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Qn,center:Qn,cite:Qn,code:Qn,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:Qn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Qn,div:Qn,dl:Qn,dt:Qn,em:Qn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Qn,figure:Qn,footer:Qn,form:{attrs:{action:null,name:null,"accept-charset":lQ,autocomplete:["on","off"],enctype:uQ,method:cQ,novalidate:["novalidate"],target:uA}},h1:Qn,h2:Qn,h3:Qn,h4:Qn,h5:Qn,h6:Qn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Qn,hgroup:Qn,hr:Qn,html:{attrs:{manifest:null}},i:Qn,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:uQ,formmethod:cQ,formnovalidate:["novalidate"],formtarget:uA,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:Qn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Qn,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:Qn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:lQ,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:Qn,noscript:Qn,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:Qn,param:{attrs:{name:null,value:null}},pre:Qn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Qn,rt:Qn,ruby:Qn,samp:Qn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:lQ}},section:Qn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Qn,source:{attrs:{src:null,type:null,media:null}},span:Qn,strong:Qn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Qn,summary:Qn,sup:Qn,table:Qn,tbody:Qn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Qn,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:Qn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Qn,time:{attrs:{datetime:null}},title:Qn,tr:Qn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Qn,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:Qn},Git={accesskey:null,class:null,contenteditable:xf,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:xf,autocorrect:xf,autocapitalize:xf,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":xf,"aria-autocomplete":["inline","list","both","none"],"aria-busy":xf,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":xf,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":xf,"aria-hidden":xf,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":xf,"aria-multiselectable":xf,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":xf,"aria-relevant":null,"aria-required":xf,"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},Qit="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 Qit)Git[e]=null;let yP=class{constructor(t,n){this.tags={...lhn,...t},this.globalAttrs={...Git,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};yP.default=new yP;function VC(e,t,n=e.length){if(!t)return"";let r=t.firstChild,s=r&&r.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,n)):""}function HC(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function Yit(e,t,n){let r=n.tags[VC(e,HC(t))];return r?.children||n.allTags}function Lve(e,t){let n=[];for(let r=HC(t);r&&!r.type.isTop;r=HC(r.parent)){let s=VC(e,r);if(s&&r.lastChild.name=="CloseTag")break;s&&n.indexOf(s)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(s)}return n}const Xit=/^[:\-\.\w\u00b7-\uffff]*$/;function yPe(e,t,n,r,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=HC(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:s,options:Yit(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(Lve(e.doc,n).map((o,c)=>({label:"/"+o,apply:"/"+o+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function bPe(e,t,n,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:Lve(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:Xit}}function chn(e,t,n,r){let s=[],a=0;for(let i of Yit(e.doc,n,t))s.push({label:"<"+i,type:"type"});for(let i of Lve(e.doc,n))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function uhn(e,t,n,r,s){let a=HC(n),i=a?t.tags[VC(e.doc,a)]:null,o=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?o:o.length?o.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:Xit}}function dhn(e,t,n,r,s){var a;let i=(a=n.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),o=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=HC(n),h=f?t.tags[VC(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(r,s).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let m of d)o.push({label:m,apply:h+m+p,type:"constant"})}}return{from:r,to:s,options:o,validFor:c}}function Kit(e,t){let{state:n,pos:r}=t,s=ri(n).resolveInner(r,-1),a=s.resolve(r);for(let i=r,o;a==s&&(o=s.childBefore(i));){let c=o.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=o,i=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?bPe(n,s,s.from,r):yPe(n,e,s,s.from,r):s.name=="StartTag"||s.name=="IncompleteTag"?yPe(n,e,s,r,r):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?bPe(n,s,r,r):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?uhn(n,e,s,s.name=="AttributeName"?s.from:r,r):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?dhn(n,e,s,s.name=="Is"?r:s.from,r):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?chn(n,e,s,r):null}function Jit(e){return Kit(yP.default,e)}function eot(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new yP(t,n):yP.default;return s=>Kit(r,s)}const fhn=xp.parser.configure({top:"SingleExpression"}),tot=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:$ve.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Mve.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Dve.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:fhn},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:xp.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:vP.parser}],not=[{name:"style",parser:vP.parser.configure({top:"Styles"})}].concat(Qit.map(e=>({name:e,parser:xp.parser}))),rot=KS.define({name:"html",parser:Bdn.configure({props:[o_.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,n;for(let r=e.node;;){let s=r.lastChild;if(!s||s.name!="Element"||s.to!=r.to)break;t=r=s}return t&&!((n=t.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),l_.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),Pat.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),nR=rot.configure({wrap:jit(tot,not)});function sot(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=jit((e.nestedLanguages||[]).concat(tot),(e.nestedAttributes||[]).concat(not)));let r=n?rot.configure({wrap:n,dialect:t}):t?nR.configure({dialect:t}):nR;return new ek(r,[nR.data.of({autocomplete:eot(e)}),e.autoCloseTags!==!1?aot:[],cF().support,Dit().support])}const xPe=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),aot=vt.inputHandler.of((e,t,n,r,s)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!nR.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==r,{head:p}=c,m=ri(i).resolveInner(p,-1),g;if(h&&r==">"&&m.name=="EndTag"){let v=m.parent;if(((d=(u=v.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=VC(i.doc,v.parent,p))&&!xPe.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&&r=="/"&&m.name=="IncompleteCloseTag"){let v=m.parent;if(m.from==p-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=VC(i.doc,v,p))&&!xPe.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:Be.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),hhn=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:aot,html:sot,htmlCompletionSource:Jit,htmlCompletionSourceWith:eot,htmlLanguage:nR},Symbol.toStringTag,{value:"Module"})),iot=TU({commentTokens:{block:{open:"<!--",close:"-->"}}}),oot=new Nr,lot=qun.configure({props:[l_.add(e=>!e.is("Block")||e.is("Document")||bue(e)!=null||phn(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),oot.add(bue),o_.add({Document:()=>null}),g0.add({Document:iot})]});function bue(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function phn(e){return e.name=="OrderedList"||e.name=="BulletList"}function mhn(e,t){let n=e;for(;;){let r=n.nextSibling,s;if(!r||(s=bue(r.type))!=null&&s<=t)break;n=r}return n.to}const ghn=yat.of((e,t,n)=>{for(let r=ri(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let s=r.type.prop(oot);if(s==null)continue;let a=mhn(r,s);if(a>n)return{from:n,to:a}}return null});function zve(e){return new Hf(iot,e,[],"markdown")}const cot=zve(lot),vhn=lot.configure([edn,ndn,tdn,rdn,{props:[l_.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),rk=zve(vhn);function yhn(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=et.matchLanguageName(e,n,!0),r instanceof et)return r.support?r.support.language.parser:JS.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class dQ{constructor(t,n,r,s,a,i,o){this.node=t,this.from=n,this.to=r,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=o}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length<t;)r+=" ";return r}else{for(let s=this.to-this.from-r.length-this.spaceAfter.length;s>0;s--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+dot(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function uot(e,t){let n=[],r=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&n.push(s)}for(let s=n.length-1;s>=0;s--){let a=n[s],i,o=t.lineAt(a.from),c=a.from-o.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(o.text.slice(c))))r.push(new dQ(a,c,c+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(o.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new dQ(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(o.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]/," ")),r.push(new dQ(a.parent,c,c+d,i[1],u,f,a))}}return r}function dot(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function fQ(e,t,n,r=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let o=dot(a,t),c=+o[2];if(s>=0){if(c!=s+1)return;n.push({from:a.from+o[1].length,to:a.from+o[0].length,insert:String(s+2+r)})}s=c}let i=a.nextSibling;if(!i)break;a=i}}function Fve(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(i_)!=" ")return e;let r=Dm(e,4,n),s="";for(let a=r;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(n)}const fot=(e={})=>({state:t,dispatch:n})=>{let r=ri(t),{doc:s}=t,a=null,i=t.changeByRange(o=>{if(!o.empty||!rk.isActiveAt(t,o.from,-1)&&!rk.isActiveAt(t,o.from,1))return a={range:o};let c=o.from,u=s.lineAt(c),d=uot(r.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:o};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:o};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 S=d.length>1?d[d.length-2]:null,_,O="";S&&S.item?(_=u.from+S.from,O=S.marker(s,1)):_=u.from+(S?S.to:0);let E=[{from:_,to:c,insert:O}];return f.node.name=="OrderedList"&&fQ(f.item,s,E,-2),S&&S.node.name=="OrderedList"&&fQ(S.item,s,E),{range:Be.cursor(_+O.length),changes:E}}else{let S=SPe(d,t,u);return{range:Be.cursor(c+S.length+1),changes:{from:u.from,insert:S+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 S=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:o.map(S),changes:S}}}let p=[];f.node.name=="OrderedList"&&fQ(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?Dm(u.text,4,d[x+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=Fve(g,t),bhn(f.node,t.doc)&&(g=SPe(d,t,u)+t.lineBreak+g),p.push({from:v,to:c,insert:t.lineBreak+g}),{range:Be.cursor(v+g.length+1),changes:p}});return a?!1:(n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},hot=fot();function wPe(e){return e.name=="QuoteMark"||e.name=="ListMark"}function bhn(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let s=t.lineAt(n.to),a=t.lineAt(r.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function SPe(e,t,n){let r="";for(let s=0,a=e.length-2;s<=a;s++)r+=e[s].blank(s<a?Dm(n.text,4,e[s+1].from)-r.length:null,s<a);return Fve(r,t)}function xhn(e,t){let n=e.resolveInner(t,-1),r=t;wPe(n)&&(r=n.from,n=n.parent);for(let s;s=n.childBefore(r);)if(wPe(s))r=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")n=s.lastChild,r=n.to;else break;return n}const pot=({state:e,dispatch:t})=>{let n=ri(e),r=null,s=e.changeByRange(a=>{let i=a.from,{doc:o}=e;if(a.empty&&rk.isActiveAt(e,a.from)){let c=o.lineAt(i),u=uot(xhn(n,i),o);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:Be.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(Dm(c.text,4,d.to)-Dm(c.text,4,d.from));return h==c.from&&(p=Fve(p,e)),{range:Be.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:Be.cursor(h),changes:{from:h,to:i}}}}}return r={range:a}});return r?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},mot=[{key:"Enter",run:hot},{key:"Backspace",run:pot}],got=sot({matchClosingTags:!1});function Bve(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:s}=cot,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=got}=e;if(!(s instanceof IU))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[o.support,ghn],d;i&&u.push(vot),n instanceof ek?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?yhn(t,d):void 0;c.push(Hun({codeParser:f,htmlParser:o.language.parser})),r&&u.push(ef.high(Aw.of(mot)));let h=zve(s.configure(c));return a&&u.push(h.data.of({autocomplete:whn})),new ek(h,u)}function whn(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let s=ri(t).resolveInner(n,-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:n-r[0].length,to:n,options:Shn(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let hQ=null;function Shn(){if(hQ)return hQ;let e=Jit(new mve(xr.create({extensions:got}),0,!0));return hQ=e?e.options:[]}const khn=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,vot=vt.domEventHandlers({paste:(e,t)=>{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!rk.isActiveAt(t.state,r.from,1)))return!1;let a=ri(t.state),i=!1;return a.iterate({from:r.from,to:r.to,enter:o=>{(o.from>r.from||khn.test(o.name))&&(i=!0)},leave:o=>{o.to<r.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),_hn=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:cot,deleteMarkupBackward:pot,insertNewlineContinueMarkup:hot,insertNewlineContinueMarkupCommand:fot,markdown:Bve,markdownKeymap:mot,markdownLanguage:rk,pasteURLAsLink:vot},Symbol.toStringTag,{value:"Module"}));function yt(e){return new ek(fve.define(e))}function Rx(e){return nt(()=>import("./index-BPGtLMXv.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const yot=[et.of({name:"C",extensions:["c","h","ino"],load(){return nt(()=>import("./index-DX5l222Z.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),et.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return nt(()=>import("./index-DX5l222Z.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),et.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Rx("Cassandra")}}),et.of({name:"CSS",extensions:["css"],load(){return nt(()=>Promise.resolve().then(()=>wfn),void 0,import.meta.url).then(e=>e.css())}}),et.of({name:"Go",extensions:["go"],load(){return nt(()=>import("./index-BmR9ljo2.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),et.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return nt(()=>Promise.resolve().then(()=>hhn),void 0,import.meta.url).then(e=>e.html())}}),et.of({name:"Java",extensions:["java"],load(){return nt(()=>import("./index-CQWUz_Ua.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),et.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript())}}),et.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return nt(()=>import("./index-CdggTBzd.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),et.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return nt(()=>Promise.resolve().then(()=>Dcn),void 0,import.meta.url).then(e=>e.json())}}),et.of({name:"JSX",extensions:["jsx"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),et.of({name:"LESS",extensions:["less"],load(){return nt(()=>import("./index-Cmdv7FN5.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),et.of({name:"Liquid",extensions:["liquid"],load(){return nt(()=>import("./index-DZf7g_uc.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),et.of({name:"MariaDB SQL",load(){return Rx("MariaSQL")}}),et.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return nt(()=>Promise.resolve().then(()=>_hn),void 0,import.meta.url).then(e=>e.markdown())}}),et.of({name:"MS SQL",load(){return Rx("MSSQL")}}),et.of({name:"MySQL",load(){return Rx("MySQL")}}),et.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return nt(()=>import("./index-ZpLrnVFB.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),et.of({name:"PLSQL",extensions:["pls"],load(){return Rx("PLSQL")}}),et.of({name:"PostgreSQL",load(){return Rx("PostgreSQL")}}),et.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return nt(()=>import("./index-DNHDjLYs.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),et.of({name:"Rust",extensions:["rs"],load(){return nt(()=>import("./index-CaD7ddjV.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),et.of({name:"Sass",extensions:["sass"],load(){return nt(()=>import("./index-mTon5-ys.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),et.of({name:"SCSS",extensions:["scss"],load(){return nt(()=>import("./index-mTon5-ys.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),et.of({name:"SQL",extensions:["sql"],load(){return Rx("StandardSQL")}}),et.of({name:"SQLite",load(){return Rx("SQLite")}}),et.of({name:"TSX",extensions:["tsx"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),et.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return nt(()=>Promise.resolve().then(()=>q4),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),et.of({name:"WebAssembly",extensions:["wat","wast"],load(){return nt(()=>import("./index-DI9zd2Nn.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),et.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return nt(()=>import("./index-DAO3kR5r.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),et.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return nt(()=>import("./index-BiigrE1w.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),et.of({name:"APL",extensions:["dyalog","apl"],load(){return nt(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>yt(e.apl))}}),et.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return nt(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>yt(e.asciiArmor))}}),et.of({name:"ASN.1",extensions:["asn","asn1"],load(){return nt(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>yt(e.asn1({})))}}),et.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return nt(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>yt(e.asterisk))}}),et.of({name:"Brainfuck",extensions:["b","bf"],load(){return nt(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>yt(e.brainfuck))}}),et.of({name:"Cobol",extensions:["cob","cpy"],load(){return nt(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>yt(e.cobol))}}),et.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.csharp))}}),et.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>yt(e.clojure))}}),et.of({name:"ClojureScript",extensions:["cljs"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>yt(e.clojure))}}),et.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return nt(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>yt(e.gss))}}),et.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return nt(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>yt(e.cmake))}}),et.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return nt(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>yt(e.coffeeScript))}}),et.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return nt(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>yt(e.commonLisp))}}),et.of({name:"Cypher",extensions:["cyp","cypher"],load(){return nt(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>yt(e.cypher))}}),et.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return nt(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>yt(e.cython))}}),et.of({name:"Crystal",extensions:["cr"],load(){return nt(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>yt(e.crystal))}}),et.of({name:"D",extensions:["d"],load(){return nt(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>yt(e.d))}}),et.of({name:"Dart",extensions:["dart"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.dart))}}),et.of({name:"diff",extensions:["diff","patch"],load(){return nt(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>yt(e.diff))}}),et.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return nt(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>yt(e.dockerFile))}}),et.of({name:"DTD",extensions:["dtd"],load(){return nt(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>yt(e.dtd))}}),et.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return nt(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>yt(e.dylan))}}),et.of({name:"EBNF",load(){return nt(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>yt(e.ebnf))}}),et.of({name:"ECL",extensions:["ecl"],load(){return nt(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>yt(e.ecl))}}),et.of({name:"edn",extensions:["edn"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>yt(e.clojure))}}),et.of({name:"Eiffel",extensions:["e"],load(){return nt(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>yt(e.eiffel))}}),et.of({name:"Elm",extensions:["elm"],load(){return nt(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>yt(e.elm))}}),et.of({name:"Erlang",extensions:["erl"],load(){return nt(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>yt(e.erlang))}}),et.of({name:"Esper",load(){return nt(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>yt(e.esper))}}),et.of({name:"Factor",extensions:["factor"],load(){return nt(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>yt(e.factor))}}),et.of({name:"FCL",load(){return nt(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>yt(e.fcl))}}),et.of({name:"Forth",extensions:["forth","fth","4th"],load(){return nt(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>yt(e.forth))}}),et.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return nt(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>yt(e.fortran))}}),et.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>yt(e.fSharp))}}),et.of({name:"Gas",extensions:["s"],load(){return nt(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>yt(e.gas))}}),et.of({name:"Gherkin",extensions:["feature"],load(){return nt(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>yt(e.gherkin))}}),et.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return nt(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>yt(e.groovy))}}),et.of({name:"Haskell",extensions:["hs"],load(){return nt(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>yt(e.haskell))}}),et.of({name:"Haxe",extensions:["hx"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>yt(e.haxe))}}),et.of({name:"HXML",extensions:["hxml"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>yt(e.hxml))}}),et.of({name:"HTTP",load(){return nt(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>yt(e.http))}}),et.of({name:"IDL",extensions:["pro"],load(){return nt(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>yt(e.idl))}}),et.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return nt(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>yt(e.jsonld))}}),et.of({name:"Julia",extensions:["jl"],load(){return nt(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>yt(e.julia))}}),et.of({name:"Kotlin",extensions:["kt","kts"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.kotlin))}}),et.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return nt(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>yt(e.liveScript))}}),et.of({name:"Lua",extensions:["lua"],load(){return nt(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>yt(e.lua))}}),et.of({name:"mIRC",extensions:["mrc"],load(){return nt(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>yt(e.mirc))}}),et.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return nt(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>yt(e.mathematica))}}),et.of({name:"Modelica",extensions:["mo"],load(){return nt(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>yt(e.modelica))}}),et.of({name:"MUMPS",extensions:["mps"],load(){return nt(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>yt(e.mumps))}}),et.of({name:"Mbox",extensions:["mbox"],load(){return nt(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>yt(e.mbox))}}),et.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return nt(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>yt(e.nginx))}}),et.of({name:"NSIS",extensions:["nsh","nsi"],load(){return nt(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>yt(e.nsis))}}),et.of({name:"NTriples",extensions:["nt","nq"],load(){return nt(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>yt(e.ntriples))}}),et.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.objectiveC))}}),et.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.objectiveCpp))}}),et.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>yt(e.oCaml))}}),et.of({name:"Octave",extensions:["m"],load(){return nt(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>yt(e.octave))}}),et.of({name:"Oz",extensions:["oz"],load(){return nt(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>yt(e.oz))}}),et.of({name:"Pascal",extensions:["p","pas"],load(){return nt(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>yt(e.pascal))}}),et.of({name:"Perl",extensions:["pl","pm"],load(){return nt(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>yt(e.perl))}}),et.of({name:"Pig",extensions:["pig"],load(){return nt(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>yt(e.pig))}}),et.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return nt(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>yt(e.powerShell))}}),et.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return nt(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>yt(e.properties))}}),et.of({name:"ProtoBuf",extensions:["proto"],load(){return nt(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>yt(e.protobuf))}}),et.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return nt(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>yt(e.pug))}}),et.of({name:"Puppet",extensions:["pp"],load(){return nt(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>yt(e.puppet))}}),et.of({name:"Q",extensions:["q"],load(){return nt(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>yt(e.q))}}),et.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return nt(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>yt(e.r))}}),et.of({name:"RPM Changes",load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>yt(e.rpmChanges))}}),et.of({name:"RPM Spec",extensions:["spec"],load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>yt(e.rpmSpec))}}),et.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return nt(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>yt(e.ruby))}}),et.of({name:"SAS",extensions:["sas"],load(){return nt(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>yt(e.sas))}}),et.of({name:"Scala",extensions:["scala"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.scala))}}),et.of({name:"Scheme",extensions:["scm","ss"],load(){return nt(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>yt(e.scheme))}}),et.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return nt(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>yt(e.shell))}}),et.of({name:"Sieve",extensions:["siv","sieve"],load(){return nt(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>yt(e.sieve))}}),et.of({name:"Smalltalk",extensions:["st"],load(){return nt(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>yt(e.smalltalk))}}),et.of({name:"Solr",load(){return nt(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>yt(e.solr))}}),et.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>yt(e.sml))}}),et.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return nt(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>yt(e.sparql))}}),et.of({name:"Spreadsheet",alias:["excel","formula"],load(){return nt(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>yt(e.spreadsheet))}}),et.of({name:"Squirrel",extensions:["nut"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>yt(e.squirrel))}}),et.of({name:"Stylus",extensions:["styl"],load(){return nt(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>yt(e.stylus))}}),et.of({name:"Swift",extensions:["swift"],load(){return nt(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>yt(e.swift))}}),et.of({name:"sTeX",load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>yt(e.stex))}}),et.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>yt(e.stex))}}),et.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>yt(e.verilog))}}),et.of({name:"Tcl",extensions:["tcl"],load(){return nt(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>yt(e.tcl))}}),et.of({name:"Textile",extensions:["textile"],load(){return nt(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>yt(e.textile))}}),et.of({name:"TiddlyWiki",load(){return nt(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>yt(e.tiddlyWiki))}}),et.of({name:"Tiki wiki",load(){return nt(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>yt(e.tiki))}}),et.of({name:"TOML",extensions:["toml"],load(){return nt(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>yt(e.toml))}}),et.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return nt(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>yt(e.troff))}}),et.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return nt(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>yt(e.ttcn))}}),et.of({name:"TTCN_CFG",extensions:["cfg"],load(){return nt(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>yt(e.ttcnCfg))}}),et.of({name:"Turtle",extensions:["ttl"],load(){return nt(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>yt(e.turtle))}}),et.of({name:"Web IDL",extensions:["webidl"],load(){return nt(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>yt(e.webIDL))}}),et.of({name:"VB.NET",extensions:["vb"],load(){return nt(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>yt(e.vb))}}),et.of({name:"VBScript",extensions:["vbs"],load(){return nt(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>yt(e.vbScript))}}),et.of({name:"Velocity",extensions:["vtl"],load(){return nt(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>yt(e.velocity))}}),et.of({name:"Verilog",extensions:["v"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>yt(e.verilog))}}),et.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return nt(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>yt(e.vhdl))}}),et.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return nt(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>yt(e.xQuery))}}),et.of({name:"Yacas",extensions:["ys"],load(){return nt(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>yt(e.yacas))}}),et.of({name:"Z80",extensions:["z80"],load(){return nt(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>yt(e.z80))}}),et.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>yt(e.mscgen))}}),et.of({name:"Xù",extensions:["xu"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>yt(e.xu))}}),et.of({name:"MsGenny",extensions:["msgenny"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>yt(e.msgenny))}}),et.of({name:"Vue",extensions:["vue"],load(){return nt(()=>import("./index-DNfvq-Ph.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),et.of({name:"Angular Template",load(){return nt(()=>import("./index-u_lqiE2u.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];function gb(){return gb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gb.apply(null,arguments)}var Ohn=e=>{var{theme:t,settings:n={},styles:r=[]}=e,s={".cm-gutters":{}},a={};n.background&&(a.backgroundColor=n.background),n.backgroundImage&&(a.backgroundImage=n.backgroundImage),n.foreground&&(a.color=n.foreground),n.fontSize&&(a.fontSize=n.fontSize),(n.background||n.foreground)&&(s["&"]=a),n.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(s[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(s[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(s[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(s[".cm-content"]={caretColor:n.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var i={};n.gutterActiveForeground&&(i.color=n.gutterActiveForeground),n.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:n.lineHighlight},i.backgroundColor=n.lineHighlight),s[".cm-activeLineGutter"]=i,n.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var o=vt.theme(s,{dark:t==="dark"}),c=Km.define(r),u=[o,zb(c)];return u},Ehn={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)"},Chn=[{tag:se.comment,color:"#6272a4"},{tag:se.string,color:"#f1fa8c"},{tag:se.atom,color:"#bd93f9"},{tag:se.meta,color:"#f8f8f2"},{tag:[se.keyword,se.operator,se.tagName],color:"#ff79c6"},{tag:[se.function(se.propertyName),se.propertyName],color:"#66d9ef"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"#50fa7b"},{tag:se.atom,color:"#bd93f9"}],mj=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return Ohn({theme:t,settings:gb({},Ehn,n),styles:[...Chn,...r]})};mj();function RU(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}const Thn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=qve(e.state,n.from);return r.line?jhn(e):r.block?Ahn(e):!1};function Uve(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const jhn=Uve(Phn,0),Nhn=Uve(bot,0),Ahn=Uve((e,t)=>bot(e,t,Rhn(t)),0);function qve(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const dA=50;function Ihn(e,{open:t,close:n},r,s){let a=e.sliceDoc(r-dA,r),i=e.sliceDoc(s,s+dA),o=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(i)[0].length,u=a.length-o;if(a.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-r<=2*dA?d=f=e.sliceDoc(r,s):(d=e.sliceDoc(r,r+dA),f=e.sliceDoc(s-dA,s));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function Rhn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function bot(e,t,n=t.selection.ranges){let r=n.map(a=>qve(t,a.from).block);if(!r.every(a=>a))return null;let s=n.map((a,i)=>Ihn(t,r[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(n.map((a,i)=>s[i]?[]:[{from:a.from,insert:r[i].open+" "},{from:a.to,insert:" "+r[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,o;i<s.length;i++)if(o=s[i]){let c=r[i],{open:u,close:d}=o;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 Phn(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:a,to:i}of n){let o=r.length,c=1e9,u;for(let d=a;d<=i;){let f=t.doc.lineAt(d);if(u==null&&(u=qve(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),r.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=o;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==o+1&&(r[o].single=!0)}if(e!=2&&r.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:o,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&a.push({from:o.from+u,insert:c+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&r.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:o,token:c}of r)if(o>=0){let u=i.from+o,d=u+c.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const xue=Up.define(),$hn=Up.define(),Mhn=kt.define(),xot=kt.define({combine(e){return qp(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),wot=So.define({create(){return Kg.empty},update(e,t){let n=t.state.facet(xot),r=t.annotation(xue);if(r){let c=Id.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=uF(d,d.length,n.minDepth,c):d=Oot(d,t.startState.selection),new Kg(u==0?r.rest:d,u==0?d:r.rest)}let s=t.annotation($hn);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(il.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Id.fromTransaction(t),i=t.annotation(il.time),o=t.annotation(il.userEvent);return a?e=e.addChanges(a,i,o,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,o,n.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 Kg(e.done.map(Id.fromJSON),e.undone.map(Id.fromJSON))}});function Sot(e={}){return[wot,xot.of(e),vt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?kot:t.inputType=="historyRedo"?wue:null;return r?(t.preventDefault(),r(n)):!1}})]}function PU(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(wot,!1);if(!s)return!1;let a=s.pop(e,n,t);return a?(r(a),!0):!1}}const kot=PU(0,!1),wue=PU(1,!1),Dhn=PU(0,!0),Lhn=PU(1,!0);class Id{constructor(t,n,r,s,a){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new Id(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Id(t.changes&&Po.fromJSON(t.changes),[],t.mapped&&fv.fromJSON(t.mapped),t.startSelection&&Be.fromJSON(t.startSelection),t.selectionsAfter.map(Be.fromJSON))}static fromTransaction(t,n){let r=dp;for(let s of t.startState.facet(Mhn)){let a=s(t);a.length&&(r=r.concat(a))}return!r.length&&t.changes.empty?null:new Id(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,dp)}static selection(t){return new Id(void 0,dp,void 0,void 0,t)}}function uF(e,t,n,r){let s=t+1>n+20?t-n-1:0,a=e.slice(s,t);return a.push(r),a}function zhn(e,t){let n=[],r=!1;return e.iterChangedRanges((s,a)=>n.push(s,a)),t.iterChangedRanges((s,a,i,o)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];o>=u&&i<=d&&(r=!0)}}),r}function Fhn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function _ot(e,t){return e.length?t.length?e.concat(t):e:t}const dp=[],Bhn=200;function Oot(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Bhn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),uF(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Id.selection([t])]}function Uhn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function pQ(e,t){if(!e.length)return e;let n=e.length,r=dp;for(;n;){let s=qhn(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,n);return a[n-1]=s,a}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[Id.selection(r)]:dp}function qhn(e,t,n){let r=_ot(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):dp,n);if(!e.changes)return Id.selection(r);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new Id(s,Un.mapEffects(e.effects,t),i,e.startSelection.map(a),r)}const Vhn=/^(input\.type|delete)($|\.)/;class Kg{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Kg(this.done,this.undone):this}addChanges(t,n,r,s,a){let i=this.done,o=i[i.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!r||Vhn.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,zhn(o.changes,t.changes))||r=="input.type.compose")?i=uF(i,i.length-1,s.minDepth,new Id(t.changes.compose(o.changes),_ot(Un.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,dp)):i=uF(i,i.length,s.minDepth,t),new Kg(i,dp,n,r)}addSelection(t,n,r,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:dp;return a.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Fhn(a[a.length-1],t)?this:new Kg(Oot(this.done,t),this.undone,n,r)}addMapping(t){return new Kg(pQ(this.done,t),pQ(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){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):n.selection);if(r&&a.selectionsAfter.length)return n.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:xue.of({side:t,rest:Uhn(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let o=s.length==1?dp:s.slice(0,s.length-1);return a.mapped&&(o=pQ(o,a.mapped)),n.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:xue.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Kg.empty=new Kg(dp,dp);const Eot=[{key:"Mod-z",run:kot,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wue,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wue,preventDefault:!0},{key:"Mod-u",run:Dhn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Lhn,preventDefault:!0}];function gj(e,t){return Be.create(e.ranges.map(t),e.mainIndex)}function Jm(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function eg({state:e,dispatch:t},n){let r=gj(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Jm(e,r)),!0)}function $U(e,t){return Be.cursor(t?e.to:e.from)}function Cot(e,t){return eg(e,n=>n.empty?e.moveByChar(n,t):$U(n,t))}function gu(e){return e.textDirectionAt(e.state.selection.main.head)==di.LTR}const Tot=e=>Cot(e,!gu(e)),jot=e=>Cot(e,gu(e));function Not(e,t){return eg(e,n=>n.empty?e.moveByGroup(n,t):$U(n,t))}const Hhn=e=>Not(e,!gu(e)),Whn=e=>Not(e,gu(e));function Zhn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function MU(e,t,n){let r=ri(e).resolveInner(t.head),s=n?Nr.closedBy:Nr.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;Zhn(e,u,s)?r=u:c=n?u.to:u.from}let a=r.type.prop(s),i,o;return a&&(i=n?Xg(e,r.from,1):Xg(e,r.to,-1))&&i.matched?o=n?i.end.to:i.end.from:o=n?r.to:r.from,Be.cursor(o,n?-1:1)}const Ghn=e=>eg(e,t=>MU(e.state,t,!gu(e))),Qhn=e=>eg(e,t=>MU(e.state,t,gu(e)));function Aot(e,t){return eg(e,n=>{if(!n.empty)return $U(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Iot=e=>Aot(e,!1),Rot=e=>Aot(e,!0);function Pot(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let a of e.state.facet(vt.scrollMargins)){let i=a(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function $ot(e,t){let n=Pot(e),{state:r}=e,s=gj(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):$U(i,t));if(s.eq(r.selection))return!1;let a;if(n.selfScroll){let i=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,u=o.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(a=vt.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Jm(r,s),{effects:a}),!0}const kPe=e=>$ot(e,!1),Sue=e=>$ot(e,!0);function Iw(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let a=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&t.head!=r.from+a&&(s=Be.cursor(r.from+a))}return s}const Yhn=e=>eg(e,t=>Iw(e,t,!0)),Xhn=e=>eg(e,t=>Iw(e,t,!1)),Khn=e=>eg(e,t=>Iw(e,t,!gu(e))),Jhn=e=>eg(e,t=>Iw(e,t,gu(e))),epn=e=>eg(e,t=>Be.cursor(e.lineBlockAt(t.head).from,1)),tpn=e=>eg(e,t=>Be.cursor(e.lineBlockAt(t.head).to,-1));function npn(e,t,n){let r=!1,s=gj(e.selection,a=>{let i=Xg(e,a.head,-1)||Xg(e,a.head,1)||a.head>0&&Xg(e,a.head-1,1)||a.head<e.doc.length&&Xg(e,a.head+1,-1);if(!i||!i.end)return a;r=!0;let o=i.start.from==a.head?i.end.to:i.end.from;return Be.cursor(o)});return r?(t(Jm(e,s)),!0):!1}const rpn=({state:e,dispatch:t})=>npn(e,t);function Hp(e,t){let n=gj(e.state.selection,r=>{let s=t(r);return Be.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Jm(e.state,n)),!0)}function Mot(e,t){return Hp(e,n=>e.moveByChar(n,t))}const Dot=e=>Mot(e,!gu(e)),Lot=e=>Mot(e,gu(e));function zot(e,t){return Hp(e,n=>e.moveByGroup(n,t))}const spn=e=>zot(e,!gu(e)),apn=e=>zot(e,gu(e)),ipn=e=>Hp(e,t=>MU(e.state,t,!gu(e))),opn=e=>Hp(e,t=>MU(e.state,t,gu(e)));function Fot(e,t){return Hp(e,n=>e.moveVertically(n,t))}const Bot=e=>Fot(e,!1),Uot=e=>Fot(e,!0);function qot(e,t){return Hp(e,n=>e.moveVertically(n,t,Pot(e).height))}const _Pe=e=>qot(e,!1),OPe=e=>qot(e,!0),lpn=e=>Hp(e,t=>Iw(e,t,!0)),cpn=e=>Hp(e,t=>Iw(e,t,!1)),upn=e=>Hp(e,t=>Iw(e,t,!gu(e))),dpn=e=>Hp(e,t=>Iw(e,t,gu(e))),fpn=e=>Hp(e,t=>Be.cursor(e.lineBlockAt(t.head).from)),hpn=e=>Hp(e,t=>Be.cursor(e.lineBlockAt(t.head).to)),EPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:0})),!0),CPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:e.doc.length})),!0),TPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:e.selection.main.anchor,head:0})),!0),jPe=({state:e,dispatch:t})=>(t(Jm(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ppn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),mpn=({state:e,dispatch:t})=>{let n=DU(e).map(({from:r,to:s})=>Be.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Be.create(n),userEvent:"select"})),!0},gpn=({state:e,dispatch:t})=>{let n=gj(e.selection,r=>{let s=ri(e),a=s.resolveStack(r.from,1);if(r.empty){let i=s.resolveStack(r.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:o}=i;if((o.from<r.from&&o.to>=r.to||o.to>r.to&&o.from<=r.from)&&i.next)return Be.range(o.to,o.from)}return r});return n.eq(e.selection)?!1:(t(Jm(e,n)),!0)};function Vot(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let a of n.selection.ranges){let i=n.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let o=a;;){let c=e.moveVertically(o,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==o.head)break;o=c}}}return s.length==r.ranges.length?!1:(e.dispatch(Jm(n,Be.create(s,s.length-1))),!0)}const vpn=e=>Vot(e,!1),ypn=e=>Vot(e,!0),bpn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Be.create([n.main]):n.main.empty||(r=Be.create([Be.cursor(n.main.head)])),r?(t(Jm(e,r)),!0):!1};function VM(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(a=>{let{from:i,to:o}=a;if(i==o){let c=t(a);c<i?(n="delete.backward",c=V4(e,c,!1)):c>i&&(n="delete.forward",c=V4(e,c,!0)),i=Math.min(i,c),o=Math.max(o,c)}else i=V4(e,i,!1),o=V4(e,o,!0);return i==o?{range:a}:{changes:{from:i,to:o},range:Be.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?vt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function V4(e,t,n){if(e instanceof vt)for(let r of e.state.facet(vt.atomicRanges).map(s=>s(e)))r.between(t,t,(s,a)=>{s<t&&a>t&&(t=n?a:s)});return t}const Hot=(e,t,n)=>VM(e,r=>{let s=r.from,{state:a}=e,i=a.doc.lineAt(s),o,c;if(n&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(o=i.text.slice(0,s-i.from))){if(o[o.length-1]==" ")return s-1;let u=Dm(o,a.tabSize),d=u%tk(a)||tk(a);for(let f=0;f<d&&o[o.length-1-f]==" ";f++)s--;c=s}else c=ui(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=ui(i.text,c-i.from,!1,!1)+i.from);return c}),kue=e=>Hot(e,!1,!0),Wot=e=>Hot(e,!0,!1),Zot=(e,t)=>VM(e,n=>{let r=n.head,{state:s}=e,a=s.doc.lineAt(r),i=s.charCategorizer(r);for(let o=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let c=ui(a.text,r-a.from,t)+a.from,u=a.text.slice(Math.min(r,c)-a.from,Math.max(r,c)-a.from),d=i(u);if(o!=null&&d!=o)break;(u!=" "||r!=n.head)&&(o=d),r=c}return r}),Got=e=>Zot(e,!1),xpn=e=>Zot(e,!0),wpn=e=>VM(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Spn=e=>VM(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kpn=e=>VM(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),_pn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Dr.of(["",""])},range:Be.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Opn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,a=e.doc.lineAt(s),i=s==a.from?s-1:ui(a.text,s-a.from,!1)+a.from,o=s==a.to?s+1:ui(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:o,insert:e.doc.slice(s,o).append(e.doc.slice(i,s))},range:Be.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function DU(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(r)}else t.push({from:s.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Qot(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let a of DU(e)){if(n?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(n?a.to+1:a.from-1),o=i.length+1;if(n){r.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let c of a.ranges)s.push(Be.range(Math.min(e.doc.length,c.anchor+o),Math.min(e.doc.length,c.head+o)))}else{r.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let c of a.ranges)s.push(Be.range(c.anchor-o,c.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Be.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Epn=({state:e,dispatch:t})=>Qot(e,t,!1),Cpn=({state:e,dispatch:t})=>Qot(e,t,!0);function Yot(e,t,n){if(e.readOnly)return!1;let r=[];for(let a of DU(e))n?r.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):r.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Tpn=({state:e,dispatch:t})=>Yot(e,t,!1),jpn=({state:e,dispatch:t})=>Yot(e,t,!0),Npn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(DU(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),r=gj(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),o=e.coordsAtPos(s.head,s.assoc||1);o&&(a=i.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Apn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ri(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),a;return r&&s&&r.to<=t&&s.from>=t&&(a=r.type.prop(Nr.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const NPe=Xot(!1),Ipn=Xot(!0);function Xot(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:a,to:i}=s,o=t.doc.lineAt(a),c=!e&&a==i&&Apn(t,a);e&&(a=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new jU(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=cve(u,a);for(d==null&&(d=Dm(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;c?{from:a,to:i}=c:a>o.from&&a<o.from+100&&!/\S/.test(o.text.slice(0,a))&&(a=o.from);let f=["",cP(t,d)];return c&&f.push(cP(t,u.lineIndent(o.from,-1))),{changes:{from:a,to:i,insert:Dr.of(f)},range:Be.cursor(a+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Vve(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let i=r.from;i<=r.to;){let o=e.doc.lineAt(i);o.number>n&&(r.empty||r.to>o.from)&&(t(o,s,r),n=o.number),i=o.to+1}let a=e.changes(s);return{changes:s,range:Be.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}const Rpn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new jU(e,{overrideIndentation:a=>{let i=n[a];return i??-1}}),s=Vve(e,(a,i,o)=>{let c=cve(r,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=cP(e,c);(u!=d||o.from<a.from+u.length)&&(n[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},Kot=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Vve(e,(n,r)=>{r.push({from:n.from,insert:e.facet(i_)})}),{userEvent:"input.indent"})),!0),Jot=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Vve(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let a=Dm(s,e.tabSize),i=0,o=cP(e,Math.max(0,a-tk(e)));for(;i<s.length&&i<o.length&&s.charCodeAt(i)==o.charCodeAt(i);)i++;r.push({from:n.from+i,to:n.from+s.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0),Ppn=e=>(e.setTabFocusMode(),!0),$pn=[{key:"Ctrl-b",run:Tot,shift:Dot,preventDefault:!0},{key:"Ctrl-f",run:jot,shift:Lot},{key:"Ctrl-p",run:Iot,shift:Bot},{key:"Ctrl-n",run:Rot,shift:Uot},{key:"Ctrl-a",run:epn,shift:fpn},{key:"Ctrl-e",run:tpn,shift:hpn},{key:"Ctrl-d",run:Wot},{key:"Ctrl-h",run:kue},{key:"Ctrl-k",run:wpn},{key:"Ctrl-Alt-h",run:Got},{key:"Ctrl-o",run:_pn},{key:"Ctrl-t",run:Opn},{key:"Ctrl-v",run:Sue}],Mpn=[{key:"ArrowLeft",run:Tot,shift:Dot,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Hhn,shift:spn,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Khn,shift:upn,preventDefault:!0},{key:"ArrowRight",run:jot,shift:Lot,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Whn,shift:apn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Jhn,shift:dpn,preventDefault:!0},{key:"ArrowUp",run:Iot,shift:Bot,preventDefault:!0},{mac:"Cmd-ArrowUp",run:EPe,shift:TPe},{mac:"Ctrl-ArrowUp",run:kPe,shift:_Pe},{key:"ArrowDown",run:Rot,shift:Uot,preventDefault:!0},{mac:"Cmd-ArrowDown",run:CPe,shift:jPe},{mac:"Ctrl-ArrowDown",run:Sue,shift:OPe},{key:"PageUp",run:kPe,shift:_Pe},{key:"PageDown",run:Sue,shift:OPe},{key:"Home",run:Xhn,shift:cpn,preventDefault:!0},{key:"Mod-Home",run:EPe,shift:TPe},{key:"End",run:Yhn,shift:lpn,preventDefault:!0},{key:"Mod-End",run:CPe,shift:jPe},{key:"Enter",run:NPe,shift:NPe},{key:"Mod-a",run:ppn},{key:"Backspace",run:kue,shift:kue,preventDefault:!0},{key:"Delete",run:Wot,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Got,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:xpn,preventDefault:!0},{mac:"Mod-Backspace",run:Spn,preventDefault:!0},{mac:"Mod-Delete",run:kpn,preventDefault:!0}].concat($pn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),elt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Ghn,shift:ipn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Qhn,shift:opn},{key:"Alt-ArrowUp",run:Epn},{key:"Shift-Alt-ArrowUp",run:Tpn},{key:"Alt-ArrowDown",run:Cpn},{key:"Shift-Alt-ArrowDown",run:jpn},{key:"Mod-Alt-ArrowUp",run:vpn},{key:"Mod-Alt-ArrowDown",run:ypn},{key:"Escape",run:bpn},{key:"Mod-Enter",run:Ipn},{key:"Alt-l",mac:"Ctrl-l",run:mpn},{key:"Mod-i",run:gpn,preventDefault:!0},{key:"Mod-[",run:Jot},{key:"Mod-]",run:Kot},{key:"Mod-Alt-\\",run:Rpn},{key:"Shift-Mod-k",run:Npn},{key:"Shift-Mod-\\",run:rpn},{key:"Mod-/",run:Thn},{key:"Alt-A",run:Nhn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ppn}].concat(Mpn),tlt={key:"Tab",run:Kot,shift:Jot},APe=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;let vb=class{constructor(t,n,r=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(r,s),this.bufferStart=r,this.normalize=a?o=>a(APe(o)):APe,this.query=this.normalize(n)}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 Jc(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 n=wU(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=sp(t);let s=this.normalize(n);if(s.length)for(let a=0,i=r;;a++){let o=s.charCodeAt(a),c=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}i==r&&a<n.length&&n.charCodeAt(a)==o&&i++}}}match(t,n,r){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:r}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}};typeof Symbol<"u"&&(vb.prototype[Symbol.iterator]=function(){return this});const nlt={from:-1,to:-1,match:/.*/.exec("")},Hve="gm"+(/x/.unicode==null?"":"u");let rlt=class{constructor(t,n,r,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=nlt,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new slt(t,n,r,s,a);this.re=new RegExp(n,Hve+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=dF(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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=dF(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},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 mQ=new WeakMap;let IPe=class w6{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let s=mQ.get(t);if(!s||s.from>=r||s.to<=n){let o=new w6(n,t.sliceString(n,r));return mQ.set(t,o),o}if(s.from==n&&s.to==r)return s;let{text:a,from:i}=s;return i>n&&(a=t.sliceString(n,i)+a,i=n),s.to<r&&(a+=t.sliceString(s.to,r)),mQ.set(t,new w6(i,a)),new w6(n,a.slice(n-i,r-i))}},slt=class{constructor(t,n,r,s,a){this.text=t,this.to=a,this.done=!1,this.value=nlt,this.matchPos=dF(t,s),this.re=new RegExp(n,Hve+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=IPe.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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=dF(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=IPe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(rlt.prototype[Symbol.iterator]=slt.prototype[Symbol.iterator]=function(){return this});function Dpn(e){try{return new RegExp(e,Hve),!0}catch{return!1}}function dF(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}const Lpn=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:s}=Dln(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},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:r});return}let o=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=i,h=d?+d.slice(1):0,p=u?+u:o.number;if(u&&f){let v=p/100;c&&(v=v*(c=="-"?-1:1)+o.number/t.doc.lines),p=Math.round(t.doc.lines*v)}else u&&c&&(p=p*(c=="-"?-1:1)+o.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=Be.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[r,vt.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},zpn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Fpn=kt.define({combine(e){return qp(e,zpn,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Bpn(e){return[Wpn,Hpn]}const Upn=dn.mark({class:"cm-selectionMatch"}),qpn=dn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function RPe(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=As.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=As.Word)}function Vpn(e,t,n,r){return e(t.sliceDoc(n,n+1))==As.Word&&e(t.sliceDoc(r-1,r))==As.Word}const Hpn=dl.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(Fpn),{state:n}=e,r=n.selection;if(r.ranges.length>1)return dn.none;let s=r.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return dn.none;let c=n.wordAt(s.head);if(!c)return dn.none;i=n.charCategorizer(s.head),a=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return dn.none;if(t.wholeWords){if(a=n.sliceDoc(s.from,s.to),i=n.charCategorizer(s.head),!(RPe(i,n,s.from,s.to)&&Vpn(i,n,s.from,s.to)))return dn.none}else if(a=n.sliceDoc(s.from,s.to),!a)return dn.none}let o=[];for(let c of e.visibleRanges){let u=new vb(n.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||RPe(i,n,d,f))&&(s.empty&&d<=s.from&&f>=s.to?o.push(qpn.range(d,f)):(d>=s.to||f<=s.from)&&o.push(Upn.range(d,f)),o.length>t.maxMatches))return dn.none}}return dn.set(o)}},{decorations:e=>e.decorations}),Wpn=vt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Zpn=({state:e,dispatch:t})=>{let{selection:n}=e,r=Be.create(n.ranges.map(s=>e.wordAt(s.head)||Be.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Gpn(e,t){let{main:n,ranges:r}=e.selection,s=e.wordAt(n.head),a=s&&s.from==n.from&&s.to==n.to;for(let i=!1,o=new vb(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new vb(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),i=!0}else{if(i&&r.some(c=>c.from==o.value.from))continue;if(a){let c=e.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Qpn=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(a=>a.from===a.to))return Zpn({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=r))return!1;let s=Gpn(e,r);return s?(t(e.update({selection:e.selection.addRange(Be.range(s.from,s.to),!1),effects:vt.scrollIntoView(s.to)})),!0):!1},vj=kt.define({combine(e){return qp(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new cmn(t),scrollToMatch:t=>vt.scrollIntoView(t)})}});let alt=class{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||Dpn(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,(n,r)=>r=="n"?`
116
116
  `:r=="r"?"\r":r=="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 tmn(this):new Kpn(this)}getCursor(t,n=0,r){let s=t.doc?t:xr.create({doc:t});return r==null&&(r=s.doc.length),this.regexp?GO(this,s,n,r):ZO(this,s,n,r)}},ilt=class{constructor(t){this.spec=t}};function Ypn(e,t,n){return(r,s,a,i)=>{if(n&&!n(r,s,a,i))return!1;let o=r>=i&&s<=i+a.length?a.slice(r-i,s-i):t.doc.sliceString(r,s);return e(o,t,r,s)}}function ZO(e,t,n,r){let s;return e.wholeWord&&(s=Xpn(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(s=Ypn(e.test,t,s)),new vb(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:a=>a.toLowerCase(),s)}function Xpn(e,t){return(n,r,s,a)=>((a>n||a+s.length<r)&&(a=Math.max(0,n-2),s=e.sliceString(a,Math.min(e.length,r+2))),(t(fF(s,n-a))!=As.Word||t(hF(s,n-a))!=As.Word)&&(t(hF(s,r-a))!=As.Word||t(fF(s,r-a))!=As.Word))}let Kpn=class extends ilt{constructor(t){super(t)}nextMatch(t,n,r){let s=ZO(this.spec,t,r,t.doc.length).nextOverlapping();if(s.done){let a=Math.min(t.doc.length,n+this.spec.unquoted.length);s=ZO(this.spec,t,0,a).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(t,n,r){for(let s=r;;){let a=Math.max(n,s-1e4-this.spec.unquoted.length),i=ZO(this.spec,t,a,s),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(a==n)return null;s-=1e4}}prevMatch(t,n,r){let s=this.prevMatchInRange(t,0,n);return s||(s=this.prevMatchInRange(t,Math.max(0,r-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let r=ZO(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let a=ZO(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}};function Jpn(e,t,n){return(r,s,a)=>(!n||n(r,s,a))&&e(a[0],t,r,s)}function GO(e,t,n,r){let s;return e.wholeWord&&(s=emn(t.charCategorizer(t.selection.main.head))),e.test&&(s=Jpn(e.test,t,s)),new rlt(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},n,r)}function fF(e,t){return e.slice(ui(e,t,!1),t)}function hF(e,t){return e.slice(t,ui(e,t))}function emn(e){return(t,n,r)=>!r[0].length||(e(fF(r.input,r.index))!=As.Word||e(hF(r.input,r.index))!=As.Word)&&(e(hF(r.input,r.index+r[0].length))!=As.Word||e(fF(r.input,r.index+r[0].length))!=As.Word)}let tmn=class extends ilt{nextMatch(t,n,r){let s=GO(this.spec,t,r,t.doc.length).next();return s.done&&(s=GO(this.spec,t,0,n).next()),s.done?null:s.value}prevMatchInRange(t,n,r){for(let s=1;;s++){let a=Math.max(n,r-s*1e4),i=GO(this.spec,t,a,r),o=null;for(;!i.next().done;)o=i.value;if(o&&(a==n||o.from>a+10))return o;if(a==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let a=+r.slice(0,s);if(a>0&&a<t.match.length)return t.match[a]+r.slice(s)}return n})}matchAll(t,n){let r=GO(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let a=GO(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}};const bP=Un.define(),Wve=Un.define(),S0=So.define({create(e){return new gQ(_ue(e).create(),null)},update(e,t){for(let n of t.effects)n.is(bP)?e=new gQ(n.value.create(),e.panel):n.is(Wve)&&(e=new gQ(e.query,n.value?Zve:null));return e},provide:e=>lP.from(e,t=>t.panel)});let gQ=class{constructor(t,n){this.query=t,this.panel=n}};const nmn=dn.mark({class:"cm-searchMatch"}),rmn=dn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),smn=dl.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(S0))}update(e){let t=e.state.field(S0);(t!=e.startState.field(S0)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return dn.none;let{view:n}=this,r=new lu;for(let s=0,a=n.visibleRanges,i=a.length;s<i;s++){let{from:o,to:c}=a[s];for(;s<i-1&&c>a[s+1].from-500;)c=a[++s].to;e.highlight(n.state,o,c,(u,d)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==d);r.add(u,d,f?rmn:nmn)})}return r.finish()}},{decorations:e=>e.decorations});function HM(e){return t=>{let n=t.state.field(S0,!1);return n&&n.query.spec.valid?e(t,n):clt(t)}}const pF=HM((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let s=Be.single(r.from,r.to),a=e.state.facet(vj);return e.dispatch({selection:s,effects:[Gve(e,r),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),llt(e),!0}),mF=HM((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,s=t.prevMatch(n,r,r);if(!s)return!1;let a=Be.single(s.from,s.to),i=e.state.facet(vj);return e.dispatch({selection:a,effects:[Gve(e,s),i.scrollToMatch(a.main,e)],userEvent:"select.search"}),llt(e),!0}),amn=HM((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Be.create(n.map(r=>Be.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),imn=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,a=[],i=0;for(let o=new vb(e.doc,e.sliceDoc(r,s));!o.next().done;){if(a.length>1e3)return!1;o.value.from==r&&(i=a.length),a.push(Be.range(o.value.from,o.value.to))}return t(e.update({selection:Be.create(a,i),userEvent:"select.search.matches"})),!0},PPe=HM((e,{query:t})=>{let{state:n}=e,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let i=a,o=[],c,u,d=[];i.from==r&&i.to==s&&(u=n.toText(t.getReplacement(i)),o.push({from:i.from,to:i.to,insert:u}),i=t.nextMatch(n,i.from,i.to),d.push(vt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=e.state.changes(o);return i&&(c=Be.single(i.from,i.to).map(f),d.push(Gve(e,i)),d.push(n.facet(vj).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),omn=HM((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:t.getReplacement(s)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:vt.announce.of(r),userEvent:"input.replace.all"}),!0});function Zve(e){return e.state.facet(vj).createPanel(e)}function _ue(e,t){var n,r,s,a,i;let o=e.selection.main,c=o.empty||o.to>o.from+100?"":e.sliceDoc(o.from,o.to);if(t&&!c)return t;let u=e.facet(vj);return new alt({search:((n=t?.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r: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 olt(e){let t=ove(e,Zve);return t&&t.dom.querySelector("[main-field]")}function llt(e){let t=olt(e);t&&t==e.root.activeElement&&t.select()}const clt=e=>{let t=e.state.field(S0,!1);if(t&&t.panel){let n=olt(e);if(n&&n!=e.root.activeElement){let r=_ue(e.state,t.query.spec);r.valid&&e.dispatch({effects:bP.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Wve.of(!0),t?bP.of(_ue(e.state,t.query.spec)):Un.appendConfig.of(dmn)]});return!0},ult=e=>{let t=e.state.field(S0,!1);if(!t||!t.panel)return!1;let n=ove(e,Zve);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Wve.of(!1)}),!0},lmn=[{key:"Mod-f",run:clt,scope:"editor search-panel"},{key:"F3",run:pF,shift:mF,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:pF,shift:mF,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:ult,scope:"editor search-panel"},{key:"Mod-Shift-l",run:imn},{key:"Mod-Alt-g",run:Lpn},{key:"Mod-d",run:Qpn,preventDefault:!0}];let cmn=class{constructor(t){this.view=t;let n=this.query=t.state.field(S0).query.spec;this.commit=this.commit.bind(this),this.searchField=Ar("input",{value:n.search,placeholder:wf(t,"Find"),"aria-label":wf(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ar("input",{value:n.replace,placeholder:wf(t,"Replace"),"aria-label":wf(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ar("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ar("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ar("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,a,i){return Ar("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=Ar("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>pF(t),[wf(t,"next")]),r("prev",()=>mF(t),[wf(t,"previous")]),r("select",()=>amn(t),[wf(t,"all")]),Ar("label",null,[this.caseField,wf(t,"match case")]),Ar("label",null,[this.reField,wf(t,"regexp")]),Ar("label",null,[this.wordField,wf(t,"by word")]),...t.state.readOnly?[]:[Ar("br"),this.replaceField,r("replace",()=>PPe(t),[wf(t,"replace")]),r("replaceAll",()=>omn(t),[wf(t,"replace all")])],Ar("button",{name:"close",onclick:()=>ult(t),"aria-label":wf(t,"close"),type:"button"},["×"])])}commit(){let t=new alt({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:bP.of(t)}))}keydown(t){tln(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?mF:pF)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),PPe(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(bP)&&!r.value.eq(this.query)&&this.setQuery(r.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(vj).top}};function wf(e,t){return e.state.phrase(t)}const H4=30,W4=/[\s\.,:;?!]/;function Gve(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),s=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-H4),i=Math.min(s,n+H4),o=e.state.sliceDoc(a,i);if(a!=r.from){for(let c=0;c<H4;c++)if(!W4.test(o[c+1])&&W4.test(o[c])){o=o.slice(c);break}}if(i!=s){for(let c=o.length-1;c>o.length-H4;c--)if(!W4.test(o[c-1])&&W4.test(o[c])){o=o.slice(0,c);break}}return vt.announce.of(`${e.state.phrase("current match")}. ${o} ${e.state.phrase("on line")} ${r.number}.`)}const umn=vt.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"}}),dmn=[S0,ef.low(smn),umn];class $Pe{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class rS{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let s=r.facet(xP).markerFilter;s&&(t=s(t,r));let a=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),i=new lu,o=[],c=0;for(let d=0;;){let f=d==a.length?null:a[d];if(!f&&!o.length)break;let h,p;for(o.length?(h=c,p=o.reduce((g,v)=>Math.min(g,v.to),f&&f.from>h?f.from:1e8)):(h=f.from,p=f.to,o.push(f),d++);d<a.length;){let g=a[d];if(g.from==h&&(g.to>g.from||g.to==h))o.push(g),d++,p=Math.min(g.to,p);else{p=Math.min(g.from,p);break}}let m=kmn(o);if(o.some(g=>g.from==g.to||g.from==g.to-1&&r.doc.lineAt(g.from).to==g.from))i.add(h,h,dn.widget({widget:new bmn(m),diagnostics:o.slice()}));else{let g=o.reduce((v,x)=>x.markClass?v+" "+x.markClass:v,"");i.add(h,p,dn.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:o.slice(),inclusiveEnd:o.some(v=>v.to>p)}))}c=p;for(let g=0;g<o.length;g++)o[g].to<=c&&o.splice(g--,1)}let u=i.finish();return new rS(u,n,WC(u))}}function WC(e,t=null,n=0){let r=null;return e.between(n,1e9,(s,a,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new $Pe(s,a,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new $Pe(r.from,a,r.diagnostic)}}),r}function fmn(e,t){let n=t.pos,r=t.end||n,s=e.state.facet(xP).hideOn(e,n,r);if(s!=null)return s;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(dlt))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function hmn(e,t){return e.field(Wf,!1)?t:t.concat(Un.appendConfig.of(_mn))}const dlt=Un.define(),Qve=Un.define(),flt=Un.define(),Wf=So.define({create(){return new rS(dn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,s=e.panel;if(e.selected){let a=t.changes.mapPos(e.selected.from,1);r=WC(n,e.selected.diagnostic,a)||WC(n,null,a)}!n.size&&s&&t.state.facet(xP).autoPanel&&(s=null),e=new rS(n,s,r)}for(let n of t.effects)if(n.is(dlt)){let r=t.state.facet(xP).autoPanel?n.value.length?wP.open:null:e.panel;e=rS.init(n.value,r,t.state)}else n.is(Qve)?e=new rS(e.diagnostics,n.value?wP.open:null,e.selected):n.is(flt)&&(e=new rS(e.diagnostics,e.panel,n.value));return e},provide:e=>[lP.from(e,t=>t.panel),vt.decorations.from(e,t=>t.diagnostics)]}),pmn=dn.mark({class:"cm-lintRange cm-lintRange-active"});function mmn(e,t,n){let{diagnostics:r}=e.state.field(Wf),s,a=-1,i=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return s=d.diagnostics,a=c,i=u,!1});let o=e.state.facet(xP).tooltipFilter;return s&&o&&(s=o(s,e.state)),s?{pos:a,end:i,above:e.state.doc.lineAt(a).to<i,create(){return{dom:gmn(e,s)}}}:null}function gmn(e,t){return Ar("ul",{class:"cm-tooltip-lint"},t.map(n=>mlt(e,n,!1)))}const vmn=e=>{let t=e.state.field(Wf,!1);(!t||!t.panel)&&e.dispatch({effects:hmn(e.state,[Qve.of(!0)])});let n=ove(e,wP.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},MPe=e=>{let t=e.state.field(Wf,!1);return!t||!t.panel?!1:(e.dispatch({effects:Qve.of(!1)}),!0)},ymn=e=>{let t=e.state.field(Wf,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},hlt=[{key:"Mod-Shift-m",run:vmn,preventDefault:!0},{key:"F8",run:ymn}],xP=kt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...qp(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:DPe,tooltipFilter:DPe,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,s,a)=>t(r,s,a)||n(r,s,a):t:n,autoPanel:(t,n)=>t||n})}}});function DPe(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function plt(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!t.some(a=>a.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function mlt(e,t,n){var r;let s=n?plt(t.actions):[];return Ar("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ar("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((a,i)=>{let o=!1,c=p=>{if(p.preventDefault(),o)return;o=!0;let m=WC(e.state.field(Wf).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),Ar("u",u.slice(d,d+1)),u.slice(d+1)],h=a.markClass?" "+a.markClass:"";return Ar("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[i]})"`}.`},f)}),t.source&&Ar("div",{class:"cm-diagnosticSource"},t.source))}class bmn extends kh{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Ar("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class LPe{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=mlt(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class wP{constructor(t){this.view=t,this.items=[];let n=s=>{if(s.keyCode==27)MPe(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=plt(a.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==s.keyCode){let c=WC(this.view.state.field(Wf).diagnostics,a);c&&a.actions[o].apply(t,c.from,c.to)}}else return;s.preventDefault()},r=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=Ar("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Ar("div",{class:"cm-panel-lint"},this.list,Ar("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>MPe(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Wf).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(Wf),r=0,s=!1,a=null,i=new Set;for(t.between(0,this.view.state.doc.length,(o,c,{spec:u})=>{for(let d of u.diagnostics){if(i.has(d))continue;i.add(d);let f=-1,h;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==d){f=p;break}f<0?(h=new LPe(this.view,d),this.items.splice(r,0,h),s=!0):(h=this.items[f],f>r&&(this.items.splice(r,f-r),s=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),a=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r<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 LPe(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:o,panel:c})=>{let u=c.height/this.list.offsetHeight;o.top<c.top?this.list.scrollTop-=(c.top-o.top)/u:o.bottom>c.bottom&&(this.list.scrollTop+=(o.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Wf),r=WC(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:flt.of(r)})}static open(t){return new wP(t)}}function xmn(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 Z4(e){return xmn(`<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 wmn=vt.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:Z4("#d11")},".cm-lintRange-warning":{backgroundImage:Z4("orange")},".cm-lintRange-info":{backgroundImage:Z4("#999")},".cm-lintRange-hint":{backgroundImage:Z4("#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 Smn(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function kmn(e){let t="hint",n=1;for(let r of e){let s=Smn(r.severity);s>n&&(n=s,t=r.severity)}return t}const _mn=[Wf,vt.decorations.compute([Wf],e=>{let{selected:t,panel:n}=e.field(Wf);return!t||!n||t.from==t.to?dn.none:dn.set([pmn.range(t.from,t.to)])}),$ln(mmn,{hideOn:fmn}),wmn];var zPe=function(t){t===void 0&&(t={});var{crosshairCursor:n=!1}=t,r=[];t.closeBracketsKeymap!==!1&&(r=r.concat(Yat)),t.defaultKeymap!==!1&&(r=r.concat(elt)),t.searchKeymap!==!1&&(r=r.concat(lmn)),t.historyKeymap!==!1&&(r=r.concat(Eot)),t.foldKeymap!==!1&&(r=r.concat(kat)),t.completionKeymap!==!1&&(r=r.concat(Ove)),t.lintKeymap!==!1&&(r=r.concat(hlt));var s=[];return t.lineNumbers!==!1&&s.push(fat()),t.highlightActiveLineGutter!==!1&&s.push(hat()),t.highlightSpecialChars!==!1&&s.push(Jst()),t.history!==!1&&s.push(Sot()),t.foldGutter!==!1&&s.push(Cat()),t.drawSelection!==!1&&s.push(Gst()),t.dropCursor!==!1&&s.push(Xst()),t.allowMultipleSelections!==!1&&s.push(xr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&s.push(vat()),t.syntaxHighlighting!==!1&&s.push(zb(jat,{fallback:!0})),t.bracketMatching!==!1&&s.push(Rat()),t.closeBrackets!==!1&&s.push(Zat()),t.autocompletion!==!1&&s.push(_ve()),t.rectangularSelection!==!1&&s.push(nat()),n!==!1&&s.push(rat()),t.highlightActiveLine!==!1&&s.push(eat()),t.highlightSelectionMatches!==!1&&s.push(Bpn()),t.tabSize&&typeof t.tabSize=="number"&&s.push(i_.of(" ".repeat(t.tabSize))),s.concat([Aw.of(r.flat())]).filter(Boolean)};let Uu=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Oue=typeof document<"u"?document:{documentElement:{style:{}}};const Eue=/Edge\/(\d+)/.exec(Uu.userAgent),glt=/MSIE \d/.test(Uu.userAgent),Cue=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Uu.userAgent),LU=!!(glt||Cue||Eue),FPe=!LU&&/gecko\/(\d+)/i.test(Uu.userAgent),vQ=!LU&&/Chrome\/(\d+)/.exec(Uu.userAgent),Omn="webkitFontSmoothing"in Oue.documentElement.style,Tue=!LU&&/Apple Computer/.test(Uu.vendor),BPe=Tue&&(/Mobile\/\w+/.test(Uu.userAgent)||Uu.maxTouchPoints>2);var kn={mac:BPe||/Mac/.test(Uu.platform),windows:/Win/.test(Uu.platform),linux:/Linux|X11/.test(Uu.platform),ie:LU,ie_version:glt?Oue.documentMode||6:Cue?+Cue[1]:Eue?+Eue[1]:0,gecko:FPe,gecko_version:FPe?+(/Firefox\/(\d+)/.exec(Uu.userAgent)||[0,0])[1]:0,chrome:!!vQ,chrome_version:vQ?+vQ[1]:0,ios:BPe,android:/Android\b/.test(Uu.userAgent),webkit_version:Omn?+(/\bAppleWebKit\/(\d+)/.exec(Uu.userAgent)||[0,0])[1]:0,safari:Tue,safari_version:Tue?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Uu.userAgent)||[0,0])[1]:0,tabSize:Oue.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Yve(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const gF=Object.create(null);function Xve(e,t,n){if(e==t)return!0;e||(e=gF),t||(t=gF);let r=Object.keys(e),s=Object.keys(t);if(r.length-0!=s.length-0)return!1;for(let a of r)if(a!=n&&(s.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function Emn(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function UPe(e,t,n){let r=!1;if(t)for(let s in t)n&&s in n||(r=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(r=!0,s=="style"?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return r}function Cmn(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}class zU{eq(t){return!1}updateDOM(t,n,r){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var wp=(function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e})(wp||(wp={}));class li extends Mm{constructor(t,n,r,s){super(),this.startSide=t,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(t){return new WM(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return n+=r&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new sk(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,s;if(t.isBlockGap)r=-5e8,s=4e8;else{let{start:a,end:i}=vlt(t,n);r=(a?n?-3e8:-1:5e8)-1,s=(i?n?2e8:1:-6e8)+1}return new sk(t,r,s,n,t.widget||null,!0)}static line(t){return new ZM(t)}static set(t,n=!1){return gr.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}li.none=gr.empty;class WM extends li{constructor(t){let{start:n,end:r}=vlt(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?Yve(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||gF}eq(t){return this==t||t instanceof WM&&this.tagName==t.tagName&&Xve(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}WM.prototype.point=!1;class ZM extends li{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ZM&&this.spec.class==t.spec.class&&Xve(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}ZM.prototype.mapMode=zo.TrackBefore;ZM.prototype.point=!0;class sk extends li{constructor(t,n,r,s,a,i){super(n,r,a,t),this.block=s,this.isReplace=i,this.mapMode=s?n<=0?zo.TrackBefore:zo.TrackAfter:zo.TrackDel}get type(){return this.startSide!=this.endSide?wp.WidgetRange:this.startSide<=0?wp.WidgetBefore:wp.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof sk&&Tmn(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}sk.prototype.point=!0;function vlt(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function Tmn(e,t){return e==t||!!(e&&t&&e.compare(t))}function KE(e,t,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=e?n[s]=Math.max(n[s],t):n.push(e,t)}class SP extends Mm{constructor(t,n){super(),this.tagName=t,this.attributes=n}eq(t){return t==this||t instanceof SP&&this.tagName==t.tagName&&Xve(this.attributes,t.attributes)}static create(t){return new SP(t.tagName,t.attributes||gF)}static set(t,n=!1){return gr.of(t,n)}}SP.prototype.startSide=SP.prototype.endSide=-1;function kP(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function jue(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function rR(e,t){if(!t.anchorNode)return!1;try{return jue(e,t.anchorNode)}catch{return!1}}function S6(e){return e.nodeType==3?_P(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function sR(e,t,n,r){return n?qPe(e,t,n,r,-1)||qPe(e,t,n,r,1):!1}function X0(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function vF(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function qPe(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:yb(e))){if(e.nodeName=="DIV")return!1;let a=e.parentNode;if(!a||a.nodeType!=1)return!1;t=X0(e)+(s<0?0:1),e=a}else if(e.nodeType==1){if(e=e.childNodes[t+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=s<0?yb(e):0}else return!1}}function yb(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function yF(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function jmn(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function ylt(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Nmn(e,t,n,r,s,a,i,o){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let h,p=d==c.body,m=1,g=1;if(p)h=jmn(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let w=d.getBoundingClientRect();({scaleX:m,scaleY:g}=ylt(d,w)),h={left:w.left,right:w.left+d.clientWidth*m,top:w.top,bottom:w.top+d.clientHeight*g}}let v=0,x=0;if(s=="nearest")t.top<h.top+i?(x=t.top-(h.top+i),n>0&&t.bottom>h.bottom+x&&(x=t.bottom-h.bottom+i)):t.bottom>h.bottom-i&&(x=t.bottom-h.bottom+i,n<0&&t.top-x<h.top&&(x=t.top-(h.top+i)));else{let w=t.bottom-t.top,S=h.bottom-h.top;x=(s=="center"&&w<=S?t.top+w/2-S/2:s=="start"||s=="center"&&n<0?t.top-i:t.bottom-S+i)-h.top}if(r=="nearest"?t.left<h.left+a?(v=t.left-(h.left+a),n>0&&t.right>h.right+v&&(v=t.right-h.right+a)):t.right>h.right-a&&(v=t.right-h.right+a,n<0&&t.left<h.left+v&&(v=t.left-(h.left+a))):v=(r=="center"?t.left+(t.right-t.left)/2-(h.right-h.left)/2:r=="start"==o?t.left-a:t.right-(h.right-h.left)+a)-h.left,v||x)if(p)u.scrollBy(v,x);else{let w=0,S=0;if(x){let _=d.scrollTop;d.scrollTop+=x/g,S=(d.scrollTop-_)*g}if(v){let _=d.scrollLeft;d.scrollLeft+=v/m,w=(d.scrollLeft-_)*m}t={left:t.left-w,top:t.top-S,right:t.right-w,bottom:t.bottom-S},w&&Math.abs(w-v)<1&&(r="nearest"),S&&Math.abs(S-x)<1&&(s="nearest")}if(p)break;(t.top<h.top||t.bottom>h.bottom||t.left<h.left||t.right>h.right)&&(t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function blt(e,t=!0){let n=e.ownerDocument,r=null,s=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&s);)if(a.nodeType==1)!s&&a.scrollHeight>a.clientHeight&&(s=a),t&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:s}}class Amn{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:r}=t;this.set(n,Math.min(t.anchorOffset,n?yb(n):0),r,Math.min(t.focusOffset,r?yb(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let B1=null;kn.safari&&kn.safari_version>=26&&(B1=!1);function xlt(e){if(e.setActive)return e.setActive();if(B1)return e.focus(B1);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(B1==null?{get preventScroll(){return B1={preventScroll:!0},!0}}:void 0),!B1){B1=!1;for(let n=0;n<t.length;){let r=t[n++],s=t[n++],a=t[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=a&&(r.scrollLeft=a)}}}let VPe;function _P(e,t,n=t){let r=VPe||(VPe=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function JE(e,t,n,r){let s={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,e.dispatchEvent(a);let i=new KeyboardEvent("keyup",s);return i.synthetic=!0,e.dispatchEvent(i),a.defaultPrevented||i.defaultPrevented}function Imn(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Rmn(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,yb(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=yb(n))}else{if(n==e)return!0;r=X0(n),n=n.parentNode}}function wlt(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Slt(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=yb(n)}else if(n.parentNode&&!vF(n))r=X0(n),n=n.parentNode;else return null}}function klt(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!vF(n))r=X0(n)+1,n=n.parentNode;else return null}}class Om{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new Om(t.parentNode,X0(t),n)}static after(t,n){return new Om(t.parentNode,X0(t)+1,n)}}var Tc=(function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e})(Tc||(Tc={}));const ak=Tc.LTR,Kve=Tc.RTL;function _lt(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const Pmn=_lt("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),$mn=_lt("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Nue=Object.create(null),bg=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Nue[t]=n,Nue[n]=-t}function Olt(e){return e<=247?Pmn[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?$mn[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const Mmn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Jg{get dir(){return this.level%2?Kve:ak}constructor(t,n,r){this.from=t,this.to=n,this.level=r}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,r,s){let a=-1;for(let i=0;i<t.length;i++){let o=t[i];if(o.from<=n&&o.to>=n){if(o.level==r)return i;(a<0||(s!=0?s<0?o.from<n:o.to>n:t[a].level>o.level))&&(a=i)}}if(a<0)throw new RangeError("Index out of range");return a}}function Elt(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!Elt(r.inner,s.inner))return!1}return!0}const oi=[];function Dmn(e,t,n,r,s){for(let a=0;a<=r.length;a++){let i=a?r[a-1].to:t,o=a<r.length?r[a].from:n,c=a?256:s;for(let u=i,d=c,f=c;u<o;u++){let h=Olt(e.charCodeAt(u));h==512?h=d:h==8&&f==4&&(h=16),oi[u]=h==4?2:h,h&7&&(f=h),d=h}for(let u=i,d=c,f=c;u<o;u++){let h=oi[u];if(h==128)u<o-1&&d==oi[u+1]&&d&24?h=oi[u]=d:oi[u]=256;else if(h==64){let p=u+1;for(;p<o&&oi[p]==64;)p++;let m=u&&d==8||p<n&&oi[p]==8?f==1?1:8:256;for(let g=u;g<p;g++)oi[g]=m;u=p-1}else h==8&&f==1&&(oi[u]=1);d=h,h&7&&(f=h)}}}function Lmn(e,t,n,r,s){let a=s==1?2:1;for(let i=0,o=0,c=0;i<=r.length;i++){let u=i?r[i-1].to:t,d=i<r.length?r[i].from:n;for(let f=u,h,p,m;f<d;f++)if(p=Nue[h=e.charCodeAt(f)])if(p<0){for(let g=o-3;g>=0;g-=3)if(bg[g+1]==-p){let v=bg[g+2],x=v&2?s:v&4?v&1?a:s:0;x&&(oi[f]=oi[bg[g]]=x),o=g;break}}else{if(bg.length==189)break;bg[o++]=f,bg[o++]=h,bg[o++]=c}else if((m=oi[f])==2||m==1){let g=m==s;c=g?0:1;for(let v=o-3;v>=0;v-=3){let x=bg[v+2];if(x&2)break;if(g)bg[v+2]|=2;else{if(x&4)break;bg[v+2]|=4}}}}}function zmn(e,t,n,r){for(let s=0,a=r;s<=n.length;s++){let i=s?n[s-1].to:e,o=s<n.length?n[s].from:t;for(let c=i;c<o;){let u=oi[c];if(u==256){let d=c+1;for(;;)if(d==o){if(s==n.length)break;d=n[s++].to,o=s<n.length?n[s].from:t}else if(oi[d]==256)d++;else break;let f=a==1,h=(d<t?oi[d]:r)==1,p=f==h?f?1:2:r;for(let m=d,g=s,v=g?n[g-1].to:e;m>c;)m==v&&(m=n[--g].from,v=g?n[g-1].to:e),oi[--m]=p;c=d}else a=u,c++}}}function Aue(e,t,n,r,s,a,i){let o=r%2?2:1;if(r%2==s%2)for(let c=t,u=0;c<n;){let d=!0,f=!1;if(u==a.length||c<a[u].from){let g=oi[c];g!=o&&(d=!1,f=g==16)}let h=!d&&o==1?[]:null,p=d?r:r+1,m=c;e:for(;;)if(u<a.length&&m==a[u].from){if(f)break e;let g=a[u];if(!d)for(let v=g.to,x=u+1;;){if(v==n)break e;if(x<a.length&&a[x].from==v)v=a[x++].to;else{if(oi[v]==o)break e;break}}if(u++,h)h.push(g);else{g.from>c&&i.push(new Jg(c,g.from,p));let v=g.direction==ak!=!(p%2);Iue(e,v?r+1:r,s,g.inner,g.from,g.to,i),c=g.to}m=g.to}else{if(m==n||(d?oi[m]!=o:oi[m]==o))break;m++}h?Aue(e,c,m,r+1,s,h,i):c<m&&i.push(new Jg(c,m,p)),c=m}else for(let c=n,u=a.length;c>t;){let d=!0,f=!1;if(!u||c>a[u-1].to){let g=oi[c-1];g!=o&&(d=!1,f=g==16)}let h=!d&&o==1?[]:null,p=d?r:r+1,m=c;e:for(;;)if(u&&m==a[u-1].to){if(f)break e;let g=a[--u];if(!d)for(let v=g.from,x=u;;){if(v==t)break e;if(x&&a[x-1].to==v)v=a[--x].from;else{if(oi[v-1]==o)break e;break}}if(h)h.push(g);else{g.to<c&&i.push(new Jg(g.to,c,p));let v=g.direction==ak!=!(p%2);Iue(e,v?r+1:r,s,g.inner,g.from,g.to,i),c=g.from}m=g.from}else{if(m==t||(d?oi[m-1]!=o:oi[m-1]==o))break;m--}h?Aue(e,m,c,r+1,s,h,i):m<c&&i.push(new Jg(m,c,p)),c=m}}function Iue(e,t,n,r,s,a,i){let o=t%2?2:1;Dmn(e,s,a,r,o),Lmn(e,s,a,r,o),zmn(s,a,r,o),Aue(e,s,a,t,n,r,i)}function Fmn(e,t,n){if(!e)return[new Jg(0,0,t==Kve?1:0)];if(t==ak&&!n.length&&!Mmn.test(e))return Clt(e.length);if(n.length)for(;e.length>oi.length;)oi[oi.length]=256;let r=[],s=t==ak?0:1;return Iue(e,s,s,n,0,e.length,r),r}function Clt(e){return[new Jg(0,e,0)]}let Tlt="";function Bmn(e,t,n,r,s){var a;let i=r.head-e.from,o=Jg.find(t,i,(a=r.bidiLevel)!==null&&a!==void 0?a:-1,r.assoc),c=t[o],u=c.side(s,n);if(i==u){let h=o+=s?1:-1;if(h<0||h>=t.length)return null;c=t[o=h],i=c.side(!s,n),u=c.side(s,n)}let d=ui(e.text,i,c.forward(s,n));(d<c.from||d>c.to)&&(d=u),Tlt=e.text.slice(Math.min(i,d),Math.max(i,d));let f=o==(s?t.length-1:0)?null:t[o+(s?1:-1)];return f&&d==u&&f.level+(s?0:1)<c.level?Be.cursor(f.side(!s,n)+e.from,f.forward(s,n)?1:-1,f.level):Be.cursor(d+e.from,c.forward(s,n)?-1:1,c.level)}function Umn(e,t,n){for(let r=t;r<n;r++){let s=Olt(e.charCodeAt(r));if(s==1)return ak;if(s==2||s==4)return Kve}return ak}const jlt=kt.define(),Nlt=kt.define(),Alt=kt.define(),Ilt=kt.define(),Rue=kt.define(),Rlt=kt.define(),Plt=kt.define(),Jve=kt.define(),eye=kt.define(),$lt=kt.define({combine:e=>e.some(t=>t)}),qmn=kt.define({combine:e=>e.some(t=>t)}),Mlt=kt.define();class eC{constructor(t,n,r,s,a,i=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=a,this.isSnapshot=i}map(t){return t.empty?this:new eC(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new eC(Be.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const G4=Un.define({map:(e,t)=>e.map(t)}),Dlt=Un.define();function Gy(e,t,n){let r=e.facet(Ilt);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Uy=kt.define({combine:e=>e.length?e[0]:!0});let Vmn=0;const bE=kt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}});class K0{constructor(t,n,r,s,a){this.id=t,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(bE.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(bE.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:a,decorations:i}=n||{};return new K0(Vmn++,t,r,s,o=>{let c=[];return i&&c.push(FU.of(u=>{let d=u.plugin(o);return d?i(d):li.none})),a&&c.push(a(o)),c})}static fromClass(t,n){return K0.define((r,s)=>new t(r,s),n)}}class yQ{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Gy(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){Gy(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Gy(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Llt=kt.define(),tye=kt.define(),FU=kt.define(),zlt=kt.define(),nye=kt.define(),GM=kt.define(),Flt=kt.define();function HPe(e,t){let n=e.state.facet(Flt);if(!n.length)return n;let r=n.map(a=>a instanceof Function?a(e):a),s=[];return gr.spans(r,t.from,t.to,{point(){},span(a,i,o,c){let u=a-t.from,d=i-t.from,f=s;for(let h=o.length-1;h>=0;h--,c--){let p=o[h].spec.bidiIsolate,m;if(p==null&&(p=Umn(t.text,u,d)),c>0&&f.length&&(m=f[f.length-1]).to==u&&m.direction==p)m.to=d,f=m.inner;else{let g={from:u,to:d,direction:p,inner:[]};f.push(g),f=g.inner}}}}),s}const Blt=kt.define();function Ult(e){let t=0,n=0,r=0,s=0;for(let a of e.state.facet(Blt)){let i=a(e);i&&(i.left!=null&&(t=Math.max(t,i.left)),i.right!=null&&(n=Math.max(n,i.right)),i.top!=null&&(r=Math.max(r,i.top)),i.bottom!=null&&(s=Math.max(s,i.bottom)))}return{left:t,right:n,top:r,bottom:s}}const pI=kt.define();class fp{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new fp(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let s=t[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),t.splice(n-1,1)}}return t.splice(n,0,r),t}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let s=0,a=0,i=0;;){let o=s<t.length?t[s].fromB:1e9,c=a<n.length?n[a]:1e9,u=Math.min(o,c);if(u==1e9)break;let d=u+i,f=u,h=d;for(;;)if(a<n.length&&n[a]<=f){let p=n[a+1];a+=2,f=Math.max(f,p);for(let m=s;m<t.length&&t[m].fromB<=f;m++)i=t[m].toA-t[m].toB;h=Math.max(h,p+i)}else if(s<t.length&&t[s].fromB<=f){let p=t[s++];f=Math.max(f,p.toB),h=Math.max(h,p.toA),i=p.toA-p.toB}else break;r.push(new fp(d,h,u,f))}return r}}class bF{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=Po.empty(this.startState.doc.length);for(let a of r)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,i,o,c)=>s.push(new fp(a,i,o,c))),this.changedRanges=s}static create(t,n,r){return new bF(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Hmn=[];class Vo{constructor(t,n,r=0){this.dom=t,this.length=n,this.flags=r,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Hmn}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&Emn(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let r=n;for(let s of this.children){if(s==t)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n){return null}domPosFor(t,n){let r=X0(this.dom),s=this.length?t>0:n>0;return new Om(this.parent.dom,r+(s?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof UU)return t;return null}static get(t){return t.cmTile}}class BU extends Vo{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,r=null,s,a=t?.node==n?t:null,i=0;for(let o of this.children){if(o.sync(t),i+=o.length+o.breakAfter,s=r?r.nextSibling:n.firstChild,a&&s!=o.dom&&(a.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=WPe(s);else n.insertBefore(o.dom,s);r=o.dom}for(s=r?r.nextSibling:n.firstChild,a&&s&&(a.written=!0);s;)s=WPe(s);this.length=i}}function WPe(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class UU extends BU{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=Vo.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,s=0,a=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&a++,s=n.pop()}else{let i=r.children[s++];if(i instanceof sb)n.push(s),r=i,s=0;else{let o=a+i.length,c=t(i,a);if(c!==void 0)return c;a=o+i.breakAfter}}}resolveBlock(t,n){let r,s=-1,a,i=-1;if(this.blockTiles((o,c)=>{let u=c+o.length;if(t>=c&&t<=u){if(o.isWidget()&&n>=-1&&n<=1){if(o.flags&32)return!0;o.flags&16&&(r=void 0)}(c<t||t==u&&(n<-1?o.length:o.covers(1)))&&(!r||!o.isWidget()&&r.isWidget())&&(r=o,s=t-c),(u>t||t==c&&(n>1?o.length:o.covers(-1)))&&(!a||!o.isWidget()&&a.isWidget())&&(a=o,i=t-c)}}),!r&&!a)throw new Error("No tile at position "+t);return r&&n<0||!a?{tile:r,offset:s}:{tile:a,offset:i}}}class sb extends BU{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new sb(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class ZC extends BU{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new ZC(n||document.createElement("div"),t);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,n,r){let s=null,a=-1,i=null,o=-1;function c(d,f){for(let h=0,p=0;h<d.children.length&&p<=f;h++){let m=d.children[h],g=p+m.length;g>=f&&(m.isComposite()?c(m,f-p):(!i||i.isHidden&&(n>0||r&&Zmn(i,m)))&&(g>f||m.flags&32)?(i=m,o=f-p):(p<f||m.flags&16&&!m.isHidden)&&(s=m,a=f-p)),p=g}}c(this,t);let u=(n<0?s:i)||s||i;return u?{tile:u,offset:u==s?a:o}:null}coordsIn(t,n){let r=this.resolveInline(t,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):Wmn(this)}domIn(t,n){let r=this.resolveInline(t,n);if(r){let{tile:s,offset:a}=r;if(this.dom.contains(s.dom))return s.isText()?new Om(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:n);let i=r.tile.parent,o=!1;for(let c of i.children){if(o)return new Om(c.dom,0);c==r.tile&&(o=!0)}}return new Om(this.dom,0)}}function Wmn(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=S6(t);return n[n.length-1]||null}function Zmn(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Cd extends BU{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new Cd(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class dS extends Vo{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let r=this.dom.nodeValue.length;t>r&&(t=r);let s=t,a=t,i=0;t==0&&n<0||t==r&&n>=0?kn.chrome||kn.gecko||(t?(s--,i=1):a<r&&(a++,i=-1)):n<0?s--:a<r&&a++;let o=_P(this.dom,s,a).getClientRects();if(!o.length)return null;let c=o[(i?i<0:n>=0)?0:o.length-1];return kn.safari&&!i&&c.width==0&&(c=Array.prototype.find.call(o,u=>u.width)||c),i?yF(c,i<0):c||null}static of(t,n){let r=new dS(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class ik extends Vo{constructor(t,n,r,s){super(t,n,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,r){let s=this.widget.coordsAt(this.dom,t,n);if(s)return s;if(r)return yF(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let a=this.dom.getClientRects(),i=null;if(!a.length)return null;let o=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=o?a.length-1:0;i=a[c],!(t>0?c==0:c==a.length-1||i.top<i.bottom);c+=o?-1:1);return yF(i,!o)}}get overrideDOMText(){if(!this.length)return Dr.empty;let{root:t}=this;if(!t)return Dr.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,s,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable="false")),new ik(a,r,t,s)}}class xF extends Vo{constructor(t){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,t)}get isHidden(){return!0}get overrideDOMText(){return Dr.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class Gmn{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:s,index:a,beforeBreak:i,parents:o}=this;for(;t||n>0;)if(s.isComposite())if(i){if(!t)break;r&&r.break(),t--,i=!1}else if(a==s.children.length){if(!t&&!o.length)break;r&&r.leave(s),i=!!s.breakAfter,{tile:s,index:a}=o.pop(),a++}else{let c=s.children[a],u=c.breakAfter;(n>0?c.length<=t:c.length<t)&&(!r||r.skip(c,0,c.length)!==!1||!c.isComposite)?(i=!!u,a++,t-=c.length):(o.push({tile:s,index:a}),s=c,a=0,r&&c.isComposite()&&r.enter(c))}else if(a==s.length)i=!!s.breakAfter,{tile:s,index:a}=o.pop(),a++;else if(t){let c=Math.min(t,s.length-a);r&&r.skip(s,a,a+c),t-=c,a+=c}else break;return this.tile=s,this.index=a,this.beforeBreak=i,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Qmn{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class Ymn{constructor(t,n,r){this.cache=t,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,r,s){var a;this.flushBuffer();let i=this.ensureMarks(n,r),o=i.lastChild;if(o&&o.isText()&&!(o.flags&8)&&o.length+t.length<512){this.cache.reused.set(o,2);let c=i.children[i.children.length-1]=new dS(o.dom,o.text+t);c.parent=i}else i.append(s||dS.of(t,(a=this.cache.find(dS))===null||a===void 0?void 0:a.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?bQ(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let o=n.marks.length-1;o>=0;o--){let c=n.marks[o],u=s.lastChild;if(u instanceof Cd&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(bQ(c.dom)),s=u;else{if(this.cache.reused.get(c)){let f=Vo.get(c.dom);f&&f.setDOM(bQ(c.dom))}let d=Cd.of(c.mark,c.dom);s.append(d),s=d}this.cache.reused.set(c,2)}let a=Vo.get(t.text);a&&this.cache.reused.set(a,2);let i=new dS(t.text,t.text.nodeValue);i.flags|=8,s.append(i)}addInlineWidget(t,n,r){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let a=this.ensureMarks(n,r);!s&&!(t.flags&16)&&a.append(this.getBuffer(1)),a.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var r;t||(t=qlt);let s=ZC.start(t,n||((r=this.cache.find(ZC))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var r;let s=this.curLine;for(let a=t.length-1;a>=0;a--){let i=t[a],o;if(n>0&&(o=s.lastChild)&&o instanceof Cd&&o.mark.eq(i))s=o,n--;else{let c=Cd.of(i,(r=this.cache.find(Cd,u=>u.mark.eq(i)))===null||r===void 0?void 0:r.dom);s.append(c),s=c,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!ZPe(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(kn.ios&&ZPe(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(xQ,0,32)||new ik(xQ.toDOM(),0,xQ,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let n=new Qmn(t.from,t.to,t.value,t.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof sb&&s.wrapper.eq(r.wrapper))n=s;else{let a=sb.of(r.wrapper,(t=this.cache.find(sb,i=>i.wrapper.eq(r.wrapper)))===null||t===void 0?void 0:t.dom);n.append(a),n=a}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),r=this.cache.find(xF,void 0,1);return r&&(r.flags=n),r||new xF(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Xmn{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:a,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=s;let o=this.textOff=Math.min(t,s.length);return a?null:s.slice(0,o)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const wF=[ik,ZC,dS,Cd,xF,sb,UU];for(let e=0;e<wF.length;e++)wF[e].bucket=e;class Kmn{constructor(t){this.view=t,this.buckets=wF.map(()=>[]),this.index=wF.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let s=t.bucket,a=this.buckets[s],i=this.index[s];for(let o=a.length-1;o>=0;o--){let c=(o+i)%a.length,u=a[c];if((!n||n(u))&&!this.reused.has(u))return a.splice(c,1),c<i&&this.index[s]--,this.reused.set(u,r),u}return null}findWidget(t,n,r){let s=this.buckets[0];if(s.length)for(let a=0,i=0;;a++){if(a==s.length){if(i)return null;i=1,a=0}let o=s[a];if(!this.reused.has(o)&&(i==0?o.widget.compare(t):o.widget.constructor==t.constructor&&t.updateDOM(o.dom,this.view,o.widget)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,o.widget==t&&o.length==n&&(o.flags&497)==r?(this.reused.set(o,1),o):(this.reused.set(o,2),new ik(o.dom,n,t,o.flags&-498|r))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class Jmn{constructor(t,n,r,s,a){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new Kmn(t),this.text=new Xmn(t.state.doc),this.builder=new Ymn(this.cache,new UU(t,t.contentDOM),gr.iter(r)),this.cache.reused.set(n,2),this.old=new Gmn(n),this.reuseWalker={skip:(i,o,c)=>{if(this.cache.add(i),i.isComposite())return!1},enter:i=>this.cache.add(i),leave:()=>{},break:()=>{}}}run(t,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,a=0,i=0;;){let o=i<t.length?t[i++]:null,c=o?o.fromA:this.old.root.length;if(c>s){let u=c-s;this.preserve(u,!i,!o),s=c,a+=u}if(!o)break;n&&o.fromA<=n.range.fromA&&o.toA>=n.range.toA?(this.forward(o.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(a,n.range.fromB),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,o.toA),this.emit(n.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(a,o.toB)),a=o.toB,s=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,r){let s=ngn(this.old),a=this.openMarks;this.old.advance(t,r?1:-1,{skip:(i,o,c)=>{if(i.isWidget())if(this.openWidget)this.builder.continueWidget(c-o);else{let u=c>0||o<i.length?ik.of(i.widget,this.view,c-o,i.flags&496,this.cache.maybeReuse(i)):this.cache.reuse(i);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,s,a),a=s.length)}else if(i.isText())this.builder.ensureLine(null),!o&&c==i.length&&!this.cache.reused.has(i)?this.builder.addText(i.text,s,a,this.cache.reuse(i)):(this.cache.add(i),this.builder.addText(i.text.slice(o,c),s,a)),a=s.length;else if(i.isLine())i.flags&=-2,this.cache.reused.set(i,1),this.builder.addLine(i);else if(i instanceof xF)this.cache.add(i);else if(i instanceof Cd)this.builder.ensureLine(null),this.builder.addMark(i,s,a),this.cache.reused.set(i,1),a=s.length;else return!1;this.openWidget=!1},enter:i=>{i.isLine()?this.builder.addLineStart(i.attrs,this.cache.maybeReuse(i)):(this.cache.add(i),i instanceof Cd&&s.unshift(i.mark)),this.openWidget=!1},leave:i=>{i.isLine()?s.length&&(s.length=a=0):i instanceof Cd&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,s=this.builder,a=0,i=gr.spans(this.decorations,t,n,{point:(o,c,u,d,f,h)=>{if(u instanceof sk){if(this.disallowBlockEffectsFor[h]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(o).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=d.length,f>d.length)s.continueWidget(c-o);else{let p=u.widget||(u.block?GC.block:GC.inline),m=egn(u),g=this.cache.findWidget(p,c-o,m)||ik.of(p,this.view,c-o,m);u.block?(u.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(g)):(s.ensureLine(r),s.addInlineWidget(g,d,f))}r=null}else r=tgn(r,u);c>o&&this.text.skip(c-o)},span:(o,c,u,d)=>{for(let f=o;f<c;){let h=this.text.next(Math.min(512,c-f));h==null?(s.addLineStartIfNotCovered(r),s.addBreak(),f++):(s.ensureLine(r),s.addText(h,u,f==o?d:u.length),f+=h.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=i>a,this.openMarks=i}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let s=t.parentNode;;s=s.parentNode){let a=Vo.get(s);if(s==this.view.contentDOM)break;a instanceof Cd?n.push(a):a?.isLine()?r=a:a instanceof sb||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new ZC(s,qlt):r||n.push(Cd.of(new WM({tagName:s.nodeName.toLowerCase(),attributes:Cmn(s)}),s)))}return{line:r,marks:n}}}function ZPe(e,t){let n=r=>{for(let s of r.children)if((t?s.isText():s.length)||n(s))return!0;return!1};return n(e)}function egn(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const qlt={class:"cm-line"};function tgn(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&Yve(n,e),r&&(e.class+=" "+r)),e}function ngn(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Cd&&t.push(r.mark)}return t}function bQ(e){let t=Vo.get(e);return t&&t.setDOM(e.cloneNode()),e}class GC extends zU{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}GC.inline=new GC("span");GC.block=new GC("div");const xQ=new class extends zU{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class GPe{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=li.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new UU(t,t.contentDOM),this.updateInner([new fp(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:f})=>f<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!dgn(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let a=s>-1?sgn(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;r=new fp(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(kn.ie||kn.chrome)&&!a&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,o=this.blockWrappers;this.updateDeco();let c=ogn(i,this.decorations,t.changes);c.length&&(r=fp.extendWithRanges(r,c));let u=cgn(o,this.blockWrappers,t.changes);return u.length&&(r=fp.extendWithRanges(r,u)),a&&!r.some(d=>d.fromA<=a.range.fromA&&d.toA>=a.range.toA)&&(r=a.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,a),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let i=this.tile,o=new Jmn(this.view,i,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Vo.get(n.text)&&o.cache.reused.set(Vo.get(n.text),2),this.tile=o.run(t,n),Pue(i,o.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=kn.chrome||kn.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||r.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof wQ&&s.push(a.dom);r.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let r of n.effects)r.is(Dlt)&&(this.editContextFormatting=r.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,a=s==r,i=!a&&!(this.view.state.facet(Uy)||r.tabIndex>-1)&&rR(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(a||n||i))return;let o=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),kn.gecko&&c.empty&&!this.hasComposition&&rgn(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new Om(h,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!sR(u.node,u.offset,f.anchorNode,f.anchorOffset)||!sR(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{kn.android&&kn.chrome&&r.contains(f.focusNode)&&ugn(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=kP(this.view.root);if(h)if(c.empty){if(kn.gecko){let p=agn(u.node,u.offset);if(p&&p!=3){let m=(p==1?Slt:klt)(u.node,u.offset);m&&(u=new Om(m.node,m.offset))}}h.collapse(u.node,u.offset),c.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=c.bidiLevel)}else if(h.extend){h.collapse(u.node,u.offset);try{h.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),p.setEnd(d.node,d.offset),p.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(p)}i&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new Om(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new Om(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&sR(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,r=kP(t.root),{anchorNode:s,anchorOffset:a}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let i=this.lineAt(n.head,n.assoc);if(!i)return;let o=i.posAtStart;if(n.head==o||n.head==o+i.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(s,a)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let a;if(t==r.dom)a=r.dom.childNodes[n];else{let i=yb(t)==0?0:n==0?-1:1;for(;;){let o=t.parentNode;if(o==r.dom)break;i==0&&o.firstChild!=o.lastChild&&(t==o.firstChild?i=-1:i=1),t=o}i<0?a=t:a=t.nextSibling}if(a==r.dom.firstChild)return s;for(;a&&!Vo.get(a);)a=a.nextSibling;if(!a)return s+r.length;for(let i=0,o=s;;i++){let c=r.children[i];if(c.dom==a)return o;o+=c.length+c.breakAfter}}else return r.isText()?t==r.dom?s+n:s+(n?r.length:0):s}domAtPos(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(t,n):r.domIn(s,n)}inlineDOMNearPos(t,n){let r,s=-1,a=!1,i,o=-1,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(a=!0)}else{let f=d+u.length;if(d<=t&&(r=u,s=t-d,a=f<t),f>=t&&!i&&(i=u,o=t-d,c=d>t),d>t&&i)return!0}}),!r&&!i?this.domAtPos(t,n):(a&&i?r=null:c&&r&&(i=null),r&&n<0||!i?r.domIn(s,n):i.domIn(o,n))}coordsAt(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof wQ?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function s(a,i){if(a.isComposite())for(let o of a.children){if(o.length>=i){let c=s(o,i);if(c)return c}if(i-=o.length,i<0)break}else if(a.isText()&&i<a.length){let o=ui(a.text,i);if(o==i)return null;let c=_P(a.dom,i,o).getClientRects();for(let u=0;u<c.length;u++){let d=c[u];if(u==c.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return s(n,r)}measureVisibleLineHeights(t){let n=[],{from:r,to:s}=t,a=this.view.contentDOM.clientWidth,i=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,c=this.view.textDirection==Tc.LTR,u=0,d=(f,h,p)=>{for(let m=0;m<f.children.length&&!(h>s);m++){let g=f.children[m],v=h+g.length,x=g.dom.getBoundingClientRect(),{height:w}=x;if(p&&!m&&(u+=x.top-p.top),g instanceof sb)v>r&&d(g,h,x);else if(h>=r&&(u>0&&n.push(-u),n.push(w+u),u=0,i)){let S=g.dom.lastChild,_=S?S6(S):[];if(_.length){let O=_[_.length-1],E=c?O.right-x.left:x.right-O.left;E>o&&(o=E,this.minWidth=a,this.minWidthFrom=h,this.minWidthTo=v)}}p&&m==f.children.length-1&&(u+=p.bottom-x.bottom),h=v+g.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?Tc.RTL:Tc.LTR}measureTextSize(){let t=this.tile.blockTiles(i=>{if(i.isLine()&&i.children.length&&i.length<=20){let o=0,c;for(let u of i.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=S6(u.dom);if(d.length!=1)return;o+=d[0].width,c=d[0].height}if(o)return{lineHeight:i.dom.getBoundingClientRect().height,charWidth:o/i.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),r,s,a;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let i=S6(n.firstChild)[0];r=n.getBoundingClientRect().height,s=i&&i.width?i.width/27:7,a=i&&i.height?i.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:a}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,s=0;;s++){let a=s==n.viewports.length?null:n.viewports[s],i=a?a.from-1:this.view.state.doc.length;if(i>r){let o=(n.lineBlockAt(i).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(li.replace({widget:new wQ(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,i))}if(!a)break;r=a.to+1}return li.set(t)}updateDeco(){let t=1,n=this.view.state.facet(FU).map(a=>(this.dynamicDecorationMap[t++]=typeof a=="function")?a(this.view):a),r=!1,s=this.view.state.facet(nye).map((a,i)=>{let o=typeof a=="function";return o&&(r=!0),o?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[t++]=r,n.push(gr.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(zlt).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(t){var n;if(t.isSnapshot){let d=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=d.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let d of this.view.state.facet(Mlt))try{if(d(this.view,t.range,t))return!0}catch(f){Gy(this.view.state,f,"scroll handler")}let{range:r}=t,s=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),a;if(!s)return;!r.empty&&(a=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(s={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top),right:Math.max(s.right,a.right),bottom:Math.max(s.bottom,a.bottom)});let i=Ult(this.view),o={left:s.left-i.left,top:s.top-i.top,right:s.right+i.right,bottom:s.bottom+i.bottom},{offsetWidth:c,offsetHeight:u}=this.view.scrollDOM;if(Nmn(this.view.scrollDOM,o,r.head<r.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,c),-c),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==Tc.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(r.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){Pue(this.tile)}}function Pue(e,t){let n=t?.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)Pue(r,t)}}function rgn(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function Vlt(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Slt(n.focusNode,n.focusOffset),s=klt(n.focusNode,n.focusOffset),a=r||s;if(s&&r&&s.node!=r.node){let o=Vo.get(s.node);if(!o||o.isText()&&o.text!=s.node.nodeValue)a=s;else if(e.docView.lastCompositionAfterCursor){let c=Vo.get(r.node);!c||c.isText()&&c.text!=r.node.nodeValue||(a=s)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let i=t-a.offset;return{from:i,to:i+a.node.nodeValue.length,node:a.node}}function sgn(e,t,n){let r=Vlt(e,n);if(!r)return null;let{node:s,from:a,to:i}=r,o=s.nodeValue;if(/[\n\r]/.test(o)||e.state.doc.sliceString(r.from,r.to)!=o)return null;let c=t.invertedDesc;return{range:new fp(c.mapPos(a),c.mapPos(i),a,i),text:s}}function agn(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}let ign=class{constructor(){this.changes=[]}compareRange(t,n){KE(t,n,this.changes)}comparePoint(t,n){KE(t,n,this.changes)}boundChange(t){KE(t,t,this.changes)}};function ogn(e,t,n){let r=new ign;return gr.compare(e,t,n,r),r.changes}class lgn{constructor(){this.changes=[]}compareRange(t,n){KE(t,n,this.changes)}comparePoint(){}boundChange(t){KE(t,t,this.changes)}}function cgn(e,t,n){let r=new lgn;return gr.compare(e,t,n,r),r.changes}function ugn(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function dgn(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class wQ extends zU{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function fgn(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),a=t-s.from;if(s.length==0)return Be.cursor(t);a==0?n=1:a==s.length&&(n=-1);let i=a,o=a;n<0?i=ui(s.text,a,!1):o=ui(s.text,a);let c=r(s.text.slice(i,o));for(;i>0;){let u=ui(s.text,i,!1);if(r(s.text.slice(u,i))!=c)break;i=u}for(;o<s.length;){let u=ui(s.text,o);if(r(s.text.slice(o,u))!=c)break;o=u}return Be.range(i+s.from,o+s.from)}function hgn(e,t,n,r,s){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let o=e.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(e.defaultLineHeight-o)*.5)/o);a+=c*e.viewState.heightOracle.lineLength}let i=e.state.sliceDoc(n.from,n.to);return n.from+Zz(i,a,e.state.tabSize)}function pgn(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let s;for(let a of r.type){if(a.from>t)break;if(!(a.to<t)){if(a.from<t&&a.to>t)return a;(!s||a.type==wp.Text&&(s.type!=a.type||(n<0?a.from<t:a.to>t)))&&(s=a)}}return s||r}return r}function mgn(e,t,n,r){let s=pgn(e,t.head,t.assoc||-1),a=!r||s.type!=wp.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(a){let i=e.dom.getBoundingClientRect(),o=e.textDirectionAt(s.from),c=e.posAtCoords({x:n==(o==Tc.LTR)?i.right-1:i.left+1,y:(a.top+a.bottom)/2});if(c!=null)return Be.cursor(c,n?-1:1)}return Be.cursor(n?s.to:s.from,n?-1:1)}function QPe(e,t,n,r){let s=e.state.doc.lineAt(t.head),a=e.bidiSpans(s),i=e.textDirectionAt(s.from);for(let o=t,c=null;;){let u=Bmn(s,a,i,o,n),d=Tlt;if(!u){if(s.number==(n?e.state.doc.lines:1))return o;d=`
117
117
  `,s=e.state.doc.line(s.number+(n?1:-1)),a=e.bidiSpans(s),u=e.visualLineSide(s,!n)}if(c){if(!c(d))return o}else{if(!r)return u;c=r(d)}o=u}}function ggn(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return a=>{let i=r(a);return s==As.Space&&(s=i),s==i}}function vgn(e,t,n,r){let s=t.head,a=n?1:-1;if(s==(n?e.state.doc.length:0))return Be.cursor(s,t.assoc);let i=t.goalColumn,o,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)i==null&&(i=u.left-c.left),o=a<0?u.top:u.bottom;else{let m=e.viewState.lineBlockAt(s);i==null&&(i=Math.min(c.right-c.left,e.defaultCharacterWidth*(s-m.from))),o=(a<0?m.top:m.bottom)+d}let f=c.left+i,h=e.viewState.heightOracle.textHeight>>1,p=r??h;for(let m=0;;m+=h){let g=o+(p+m)*a,v=$ue(e,{x:f,y:g},!1,a);if(n?g>c.bottom:g<c.top)return Be.cursor(v.pos,v.assoc);let x=e.coordsAtPos(v.pos,v.assoc),w=x?(x.top+x.bottom)/2:0;if(!x||(n?w>o:w<o))return Be.cursor(v.pos,v.assoc,void 0,i)}}function aR(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(a,i,o)=>{if(t>a&&t<i){let c=r||n||(t-a<i-t?-1:1);t=c<0?a:i,r=c}});if(!r)return t}}function Hlt(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let s=t.ranges[r],a=null;if(s.empty){let i=aR(e,s.from,0);i!=s.from&&(a=Be.cursor(i,-1))}else{let i=aR(e,s.from,-1),o=aR(e,s.to,1);(i!=s.from||o!=s.to)&&(a=Be.range(s.from==s.anchor?i:o,s.from==s.head?i:o))}a&&(n||(n=t.ranges.slice()),n[r]=a)}return n?Be.create(n,t.mainIndex):t}function SQ(e,t,n){let r=aR(e.state.facet(GM).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Be.cursor(r,r<n.from?1:-1)}class Fg{constructor(t,n){this.pos=t,this.assoc=n}}function $ue(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),a=s.top+e.viewState.paddingTop,{x:i,y:o}=t,c=o-a,u;for(;;){if(c<0)return new Fg(0,1);if(c>e.viewState.docHeight)return new Fg(e.state.doc.length,-1);if(u=e.elementAtHeight(c),r==null)break;if(u.type==wp.Text){if(r<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let h=e.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(h&&(r<0?h.top<=c+a:h.bottom>=c+a))break}let f=e.viewState.heightOracle.textHeight/2;c=r>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==wp.Text){let f=hgn(e,s,u,i,o);return new Fg(f,f==u.from?1:-1)}}if(u.type!=wp.Text)return c<(u.top+u.bottom)/2?new Fg(u.from,1):new Fg(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new ygn(e,i,o,e.textDirectionAt(u.from)).scanTile(d,u.from)}class ygn{constructor(t,n,r,s){this.view=t,this.x=n,this.y=r,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[Jg.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[Jg.find(s,t-r.from,-1,n)].dir}bidiIn(t,n){let{spans:r,line:s}=this.bidiSpansAt(t);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(t,n){let r=0,s=t.length-1,a=new Set,i=this.bidiIn(t[0],t[s]),o,c,u=-1,d=1e9,f;e:for(;r<s;){let p=s-r,m=r+s>>1;t:if(a.has(m)){let v=r+Math.floor(Math.random()*p);for(let x=0;x<p;x++){if(!a.has(v)){m=v;break t}v++,v==s&&(v=r)}break e}a.add(m);let g=n(m);if(g)for(let v=0;v<g.length;v++){let x=g[v],w=0;if(!(x.width==0&&g.length>1)){if(x.bottom<this.y)(!o||o.bottom<x.bottom)&&(o=x),w=1;else if(x.top>this.y)(!c||c.top>x.top)&&(c=x),w=-1;else{let S=x.left>this.x?this.x-x.left:x.right<this.x?this.x-x.right:0,_=Math.abs(S);_<d&&(u=m,d=_,f=x),S&&(w=S<0==(this.baseDir==Tc.LTR)?-1:1)}w==-1&&(!i||this.baseDirAt(t[m],1))?s=m:w==1&&(!i||this.baseDirAt(t[m+1],-1))&&(r=m+1)}}}if(!f){let p=o&&(!c||this.y-o.bottom<c.top-this.y)?o:c;return this.y=(p.top+p.bottom)/2,this.scan(t,n)}if(d){let{top:p,bottom:m}=f;if(o&&o.bottom>(p+p+m)/3)return this.y=o.bottom-1,this.scan(t,n);if(c&&c.top<(p+m+m)/3)return this.y=c.top+1,this.scan(t,n)}let h=(i?this.dirAt(t[u],1):this.baseDir)==Tc.LTR;return{i:u,after:this.x>(f.left+f.right)/2==h}}scanText(t,n){let r=[];for(let a=0;a<t.length;a=ui(t.text,a))r.push(n+a);r.push(n+t.length);let s=this.scan(r,a=>{let i=r[a]-n,o=r[a+1]-n;return _P(t.dom,i,o).getClientRects()});return s.after?new Fg(r[s.i+1],-1):new Fg(r[s.i],1)}scanTile(t,n){if(!t.length)return new Fg(n,1);if(t.children.length==1){let o=t.children[0];if(o.isText())return this.scanText(o,n);if(o.isComposite())return this.scanTile(o,n)}let r=[n];for(let o=0,c=n;o<t.children.length;o++)r.push(c+=t.children[o].length);let s=this.scan(r,o=>{let c=t.children[o];return c.flags&48?null:(c.dom.nodeType==1?c.dom:_P(c.dom,0,c.length)).getClientRects()}),a=t.children[s.i],i=r[s.i];return a.isText()?this.scanText(a,i):a.isComposite()?this.scanTile(a,i):s.after?new Fg(r[s.i+1],-1):new Fg(i,1)}}const QO="￿";class bgn{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(xr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=QO}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let s=t;;){this.findPointBefore(r,s);let a=this.text.length;this.readNode(s);let i=Vo.get(s),o=s.nextSibling;if(o==n){i?.breakAfter&&!o&&r!=this.view.contentDOM&&this.lineBreak();break}let c=Vo.get(o);(i&&c?i.breakAfter:(i?i.breakAfter:vF(s))||vF(o)&&(s.nodeName!="BR"||i?.isWidget())&&this.text.length>a)&&!wgn(o,n)&&this.lineBreak(),s=o}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,i=1,o;if(this.lineSeparator?(a=n.indexOf(this.lineSeparator,r),i=this.lineSeparator.length):(o=s.exec(n))&&(a=o.index,i=o[0].length),this.append(n.slice(r,a<0?n.length:a)),a<0)break;if(this.lineBreak(),i>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=i-1);r=a+i}}readNode(t){let n=Vo.get(t),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(t,n){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(xgn(t,r.node,r.offset)?n:0))}}function xgn(e,t,n){for(;;){if(!t||n<yb(t))return!1;if(t==e)return!0;n=X0(t)+1,t=t.parentNode}}function wgn(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=Vo.get(e);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class YPe{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class Sgn{constructor(t,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:a,impreciseAnchor:i}=t.docView,o=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=Wlt(t.docView.tile,n,r,0))){let c=a||i?[]:_gn(t),u=new bgn(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=Ogn(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=a&&a.node==c.focusNode&&a.offset==c.focusOffset||!jue(t.contentDOM,c.focusNode)?o.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=i&&i.node==c.anchorNode&&i.offset==c.anchorOffset||!jue(t.contentDOM,c.anchorNode)?o.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((kn.ios||kn.chrome)&&o.main.empty&&u!=d&&(f.from>0||f.to<t.state.doc.length)){let h=Math.min(u,d),p=Math.max(u,d),m=f.from-h,g=f.to-p;(m==0||m==1||h==0)&&(g==0||g==-1||p==t.state.doc.length)&&(u=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(Be.range(d,u));else if(t.lineWrapping&&d==u&&!(o.main.empty&&o.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let h=t.coordsAtPos(u,-1),p=0;h&&(p=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=Be.create([Be.cursor(u,p)])}else this.newSel=Be.single(d,u)}}}function Wlt(e,t,n,r){if(e.isComposite()){let s=-1,a=-1,i=-1,o=-1;for(let c=0,u=r,d=r;c<e.children.length;c++){let f=e.children[c],h=u+f.length;if(u<t&&h>n)return Wlt(f,t,n,u);if(h>=t&&s==-1&&(s=c,a=u),u>n&&f.dom.parentNode==e.dom){i=c,o=d;break}d=h,u=h+f.breakAfter}return{from:a,to:o<0?r+e.length:o,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:i<e.children.length&&i>=0?e.children[i].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Zlt(e,t){let n,{newSel:r}=t,{state:s}=e,a=s.selection.main,i=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:c}=t.bounds,u=a.from,d=null;(i===8||kn.android&&t.text.length<c-o)&&(u=a.to,d="end");let f=s.doc.sliceString(o,c,QO),h,p;!a.empty&&a.from>=o&&a.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,a.from-o)==t.text.slice(0,a.from-o)&&f.slice(a.to-o)==t.text.slice(h=t.text.length-(f.length-(a.to-o)))?n={from:a.from,to:a.to,insert:Dr.of(t.text.slice(a.from-o,h).split(QO))}:(p=Glt(f,t.text,u-o,d))&&(kn.chrome&&i==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==QO+QO&&p.toB--,n={from:o+p.from,to:o+p.toA,insert:Dr.of(t.text.slice(p.from,p.toB).split(QO))})}else r&&(!e.hasFocus&&s.facet(Uy)||SF(r,a))&&(r=null);if(!n&&!r)return!1;if((kn.mac||kn.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Be.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Dr.of([n.insert.toString().replace("."," ")])}):s.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:s.toText(e.inputState.insertingText)}:kn.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
118
118
  `&&e.lineWrapping&&(r&&(r=Be.single(r.main.anchor-1,r.main.head-1)),n={from:a.from,to:a.to,insert:Dr.of([" "])}),n)return rye(e,n,r,i);if(r&&!SF(r,a)){let o=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(o=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=Hlt(s.facet(GM).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:o,userEvent:c}),!0}else return!1}function rye(e,t,n,r=-1){if(kn.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(kn.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&e.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&JE(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&JE(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&JE(e.contentDOM,"Delete",46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let i,o=()=>i||(i=kgn(e,t,n));return e.state.facet(Rlt).some(c=>c(e,t.from,t.to,a,o))||e.dispatch(o()),!0}function kgn(e,t,n){let r,s=e.state,a=s.selection.main,i=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let c=t.from<a.from?-1:1,u=c<0?a.from:a.to,d=aR(s.facet(GM).map(f=>f(e)),u,c);t.from==d&&(i=d)}if(i>-1)r={changes:t,selection:Be.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let c=a.from<t.from?s.sliceDoc(a.from,t.from):"",u=a.to>t.to?s.sliceDoc(t.to,a.to):"";r=s.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=s.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let d=e.state.sliceDoc(t.from,t.to),f,h=n&&Vlt(e,n.main.head);if(h){let m=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-m}}else f=e.state.doc.lineAt(a.head);let p=a.to-t.to;r=s.changeByRange(m=>{if(m.from==a.from&&m.to==a.to)return{changes:c,range:u||m.map(c)};let g=m.to-p,v=g-d.length;if(e.state.sliceDoc(v,g)!=d||g>=f.from&&v<=f.to)return{range:m};let x=s.changes({from:v,to:g,insert:t.insert}),w=m.to-a.to;return{changes:x,range:u?Be.range(Math.max(0,u.anchor+w),Math.max(0,u.head+w)):m.map(x)}})}else r={changes:c,selection:u&&s.selection.replaceRange(u)}}let o="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,o+=".compose",e.inputState.compositionFirstChange&&(o+=".start",e.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:o,scrollIntoView:!0})}function Glt(e,t,n,r){let s=Math.min(e.length,t.length),a=0;for(;a<s&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==s&&e.length==t.length)return null;let i=e.length,o=t.length;for(;i>0&&o>0&&e.charCodeAt(i-1)==t.charCodeAt(o-1);)i--,o--;if(r=="end"){let c=Math.max(0,a-Math.min(i,o));n-=i+c-a}if(i<a&&e.length<t.length){let c=n<=a&&n>=i?a-n:0;a-=c,o=a+(o-i),i=a}else if(o<a){let c=n<=a&&n>=o?a-n:0;a-=c,i=a+(i-o),o=a}return{from:a,toA:i,toB:o}}function _gn(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new YPe(n,r)),(s!=n||a!=r)&&t.push(new YPe(s,a))),t}function Ogn(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?Be.single(n+t,r+t):null}function SF(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Egn{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,kn.safari&&t.contentDOM.addEventListener("input",()=>null),kn.gecko&&Bgn(t.contentDOM.ownerDocument)}handleEvent(t){!Pgn(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let r=this.handlers[t];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=Cgn(t),r=this.handlers,s=this.view.contentDOM;for(let a in n)if(a!="scroll"){let i=!n[a].handlers.length,o=r[a];o&&i!=!o.handlers.length&&(s.removeEventListener(a,this.handleEvent),o=null),o||s.addEventListener(a,this.handleEvent,{passive:i})}for(let a in r)a!="scroll"&&!n[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&Ylt.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),kn.android&&kn.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return kn.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=Qlt.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||Tgn.indexOf(t.key)>-1&&t.ctrlKey)?(this.pendingIOSKey=n||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,JE(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:kn.safari&&!kn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function XPe(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){Gy(n.state,s)}}}function Cgn(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let s=r.spec,a=s&&s.plugin.domEventHandlers,i=s&&s.plugin.domEventObservers;if(a)for(let o in a){let c=a[o];c&&n(o).handlers.push(XPe(r.value,c))}if(i)for(let o in i){let c=i[o];c&&n(o).observers.push(XPe(r.value,c))}}for(let r in zm)n(r).handlers.push(zm[r]);for(let r in Wd)n(r).observers.push(Wd[r]);return t}const Qlt=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Tgn="dthko",Ylt=[16,17,18,20,91,92,224,225],Q4=6;function Y4(e){return Math.max(0,e)*.7+8}function jgn(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Ngn{constructor(t,n,r,s){this.view=t,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=blt(t.contentDOM),this.atoms=t.state.facet(GM).map(i=>i(t));let a=t.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(xr.allowMultipleSelections)&&Agn(t,n),this.dragging=Rgn(t,n)&&Jlt(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&jgn(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,s=0,a=0,i=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:i}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:o}=this.scrollParents.y.getBoundingClientRect());let c=Ult(this.view);t.clientX-c.left<=s+Q4?n=-Y4(s-t.clientX):t.clientX+c.right>=i-Q4&&(n=Y4(t.clientX-i)),t.clientY-c.top<=a+Q4?r=-Y4(a-t.clientY):t.clientY+c.bottom>=o-Q4&&(r=Y4(t.clientY-o)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,r=Hlt(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Agn(e,t){let n=e.state.facet(jlt);return n.length?n[0](t):kn.mac?t.metaKey:t.ctrlKey}function Ign(e,t){let n=e.state.facet(Nlt);return n.length?n[0](t):kn.mac?!t.altKey:!t.ctrlKey}function Rgn(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=kP(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let i=s[a];if(i.left<=t.clientX&&i.right>=t.clientX&&i.top<=t.clientY&&i.bottom>=t.clientY)return!0}return!1}function Pgn(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Vo.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const zm=Object.create(null),Wd=Object.create(null),Xlt=kn.ie&&kn.ie_version<15||kn.ios&&kn.webkit_version<604;function $gn(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),Klt(e,n.value)},50)}function qU(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Klt(e,t){t=qU(e.state,Jve,t);let{state:n}=e,r,s=1,a=n.toText(t),i=a.lines==n.selection.ranges.length;if(Mue!=null&&n.selection.ranges.every(c=>c.empty)&&Mue==a.toString()){let c=-1;r=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let f=n.toText((i?a.line(s++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:Be.cursor(u.from+f.length)}})}else i?r=n.changeByRange(c=>{let u=a.line(s++);return{changes:{from:c.from,to:c.to,insert:u.text},range:Be.cursor(c.from+u.length)}}):r=n.replaceSelection(a);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Wd.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};Wd.wheel=Wd.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};zm.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Wd.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};Wd.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};zm.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(Alt))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Dgn(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Ngn(e,t,n,r)),r&&e.observer.ignore(()=>{xlt(e.contentDOM);let a=e.root.activeElement;a&&!a.contains(e.contentDOM)&&a.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function KPe(e,t,n,r){if(r==1)return Be.cursor(t,n);if(r==2)return fgn(e.state,t,n);{let s=e.docView.lineAt(t,n),a=e.state.doc.lineAt(s?s.posAtEnd:t),i=s?s.posAtStart:a.from,o=s?s.posAtEnd:a.to;return o<e.state.doc.length&&o==a.to&&o++,Be.range(i,o)}}const Mgn=kn.ie&&kn.ie_version<=11;let JPe=null,e$e=0,t$e=0;function Jlt(e){if(!Mgn)return e.detail;let t=JPe,n=t$e;return JPe=e,t$e=Date.now(),e$e=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(e$e+1)%3:1}function Dgn(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Jlt(t),s=e.state.selection;return{update(a){a.docChanged&&(n.pos=a.changes.mapPos(n.pos),s=s.map(a.changes))},get(a,i,o){let c=e.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),u,d=KPe(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!i){let f=KPe(e,n.pos,n.assoc,r),h=Math.min(f.from,d.from),p=Math.max(f.to,d.to);d=h<d.from?Be.range(h,p,d.assoc):Be.range(p,h,d.assoc)}return i?s.replaceRange(s.main.extend(d.from,d.to,d.assoc)):o&&r==1&&s.ranges.length>1&&(u=Lgn(s,c.pos))?u:o?s.addRange(d):Be.create([d])}}}function Lgn(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:s}=e.ranges[n];if(r<=t&&s>=t)return Be.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}zm.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.tile.nearest(t.target);if(s&&s.isWidget()){let a=s.posAtStart,i=a+s.length;(a>=n.to||i<=n.from)&&(n=Be.range(a,i))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",qU(e.state,eye,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};zm.dragend=e=>(e.inputState.draggedContent=null,!1);function n$e(e,t,n,r){if(n=qU(e.state,Jve,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,i=r&&a&&Ign(e,t)?{from:a.from,to:a.to}:null,o={from:s,insert:n},c=e.state.changes(i?[i,o]:o);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:i?"move.drop":"input.drop"}),e.inputState.draggedContent=null}zm.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,a=()=>{++s==n.length&&n$e(e,t,r.filter(i=>i!=null).join(e.state.lineBreak),!1)};for(let i=0;i<n.length;i++){let o=new FileReader;o.onerror=a,o.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[i]=o.result),a()},o.readAsText(n[i])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return n$e(e,t,r,!0),!0}return!1};zm.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Xlt?null:t.clipboardData;return n?(Klt(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):($gn(e),!1)};function zgn(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function Fgn(e){let t=[],n=[],r=!1;for(let s of e.selection.ranges)s.empty||(t.push(e.sliceDoc(s.from,s.to)),n.push(s));if(!t.length){let s=-1;for(let{from:a}of e.selection.ranges){let i=e.doc.lineAt(a);i.number>s&&(t.push(i.text),n.push({from:i.from,to:Math.min(e.doc.length,i.to+1)})),s=i.number}r=!0}return{text:qU(e,eye,t.join(e.lineBreak)),ranges:n,linewise:r}}let Mue=null;zm.copy=zm.cut=(e,t)=>{if(!rR(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=Fgn(e.state);if(!n&&!s)return!1;Mue=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let a=Xlt?null:t.clipboardData;return a?(a.clearData(),a.setData("text/plain",n),!0):(zgn(e,n),!1)};const ect=Up.define();function tct(e,t){let n=[];for(let r of e.facet(Plt)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:ect.of(!0)}):null}function nct(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=tct(e.state,t);n?e.dispatch(n):e.update([])}},10)}Wd.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),nct(e)};Wd.blur=e=>{e.observer.clearSelectionRange(),nct(e)};Wd.compositionstart=Wd.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Wd.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,kn.chrome&&kn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Wd.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};zm.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let a=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(a&&i.length){let o=i[0],c=e.posAtDOM(o.startContainer,o.startOffset),u=e.posAtDOM(o.endContainer,o.endOffset);return rye(e,{from:c,to:u,insert:e.state.toText(a)},null),!0}}let s;if(kn.chrome&&kn.android&&(s=Qlt.find(a=>a.inputType==t.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var i;(((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0)>a+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return kn.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),kn.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Wd.compositionend(e,t),20),!1};const r$e=new Set;function Bgn(e){r$e.has(e)||(r$e.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const s$e=["pre-wrap","normal","pre-line","break-spaces"];let QC=!1;function a$e(){QC=!1}class Ugn{constructor(t){this.lineWrapping=t,this.doc=Dr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return s$e.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r<t.length;r++){let s=t[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(t,n,r,s,a,i){let o=s$e.indexOf(t)>-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=o||Math.abs(r-this.charWidth)>.1;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=a,c){this.heightSamples={};for(let u=0;u<i.length;u++){let d=i[u];d<0?u++:this.heightSamples[Math.floor(d*10)]=!0}}return c}}class qgn{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class bm{constructor(t,n,r,s,a){this.from=t,this.length=n,this.top=r,this.height=s,this._content=a}get type(){return typeof this._content=="number"?wp.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof sk?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new bm(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Ti=(function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e})(Ti||(Ti={}));const k6=.001;class Qu{constructor(t,n,r=2){this.length=t,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>k6&&(QC=!0),this.height=t)}replace(t,n,r){return Qu.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let a=this,i=r.doc;for(let o=s.length-1;o>=0;o--){let{fromA:c,toA:u,fromB:d,toB:f}=s[o],h=a.lineAt(c,Ti.ByPosNoHeight,r.setDoc(n),0,0),p=h.to>=u?h:a.lineAt(u,Ti.ByPosNoHeight,r,0,0);for(f+=p.to-u,u=p.to;o>0&&h.from<=s[o-1].toA;)c=s[o-1].fromA,d=s[o-1].fromB,o--,c<h.from&&(h=a.lineAt(c,Ti.ByPosNoHeight,r,0,0));d+=h.from-c,c=h.from;let m=sye.build(r.setDoc(i),t,d,f);a=kF(a,a.replace(c,u,m))}return a.updateHeight(r,0)}static empty(){return new Mf(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,s=0,a=0;for(;;)if(n==r)if(s>a*2){let o=t[n-1];o.break?t.splice(--n,1,o.left,null,o.right):t.splice(--n,1,o.left,o.right),r+=1+o.break,s-=o.size}else if(a>s*2){let o=t[r];o.break?t.splice(r,1,o.left,null,o.right):t.splice(r,1,o.left,o.right),r+=2+o.break,a-=o.size}else break;else if(s<a){let o=t[n++];o&&(s+=o.size)}else{let o=t[--r];o&&(a+=o.size)}let i=0;return t[n-1]==null?(i=1,n--):t[n]==null&&(i=1,r++),new Hgn(Qu.of(t.slice(0,n)),i,Qu.of(t.slice(r)))}}function kF(e,t){return e==t?e:(e.constructor!=t.constructor&&(QC=!0),t)}Qu.prototype.size=1;const Vgn=li.replace({});class rct extends Qu{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new bm(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,r,s){return this.spaceAbove&&t<r+this.spaceAbove?new bm(s,0,r,this.spaceAbove,Vgn):this.mainBlock(r,s)}lineAt(t,n,r,s,a){let i=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,r,s,a).join(i):i}forEachLine(t,n,r,s,a,i){t<=a+this.length&&n>=a&&i(this.lineAt(0,Ti.ByPos,r,s,a))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Mf extends rct{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new bm(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let s=r[0];return r.length==1&&(s instanceof Mf||s instanceof Sc&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Sc?s=new Mf(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Qu.of(r)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Sc extends Qu{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,s=t.doc.lineAt(n+this.length).number,a=s-r+1,i,o=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*a);i=c/a,this.length>a+1&&(o=(this.height-c)/(this.length-a-1))}else i=this.height/a;return{firstLine:r,lastLine:s,perLine:i,perChar:o}}blockAt(t,n,r,s){let{firstLine:a,lastLine:i,perLine:o,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let u=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),d=n.doc.lineAt(u),f=o+d.length*c,h=Math.max(r,t-f/2);return new bm(d.from,d.length,h,f,0)}else{let u=Math.max(0,Math.min(i-a,Math.floor((t-r)/o))),{from:d,length:f}=n.doc.line(a+u);return new bm(d,f,r+o*u,o,0)}}lineAt(t,n,r,s,a){if(n==Ti.ByHeight)return this.blockAt(t,r,s,a);if(n==Ti.ByPosNoHeight){let{from:p,to:m}=r.doc.lineAt(t);return new bm(p,m-p,0,0,0)}let{firstLine:i,perLine:o,perChar:c}=this.heightMetrics(r,a),u=r.doc.lineAt(t),d=o+u.length*c,f=u.number-i,h=s+o*f+c*(u.from-a-f);return new bm(u.from,u.length,Math.max(s,Math.min(h,s+this.height-d)),d,0)}forEachLine(t,n,r,s,a,i){t=Math.max(t,a),n=Math.min(n,a+this.length);let{firstLine:o,perLine:c,perChar:u}=this.heightMetrics(r,a);for(let d=t,f=s;d<=n;){let h=r.doc.lineAt(d);if(d==t){let m=h.number-o;f+=c*m+u*(t-a-m)}let p=c+u*h.length;i(new bm(h.from,h.length,f,p,0)),f+=p,d=h.to+1}}replace(t,n,r){let s=this.length-n;if(s>0){let a=r[r.length-1];a instanceof Sc?r[r.length-1]=new Sc(a.length+s):r.push(null,new Sc(s-1))}if(t>0){let a=r[0];a instanceof Sc?r[0]=new Sc(t+a.length):r.unshift(new Sc(t-1),null)}return Qu.of(r)}decomposeLeft(t,n){n.push(new Sc(t-1),null)}decomposeRight(t,n){n.push(null,new Sc(this.length-t-1))}updateHeight(t,n=0,r=!1,s){let a=n+this.length;if(s&&s.from<=n+this.length&&s.more){let i=[],o=Math.max(n,s.from),c=-1;for(s.from>n&&i.push(new Sc(s.from-n-1).updateHeight(t,n));o<=a&&s.more;){let d=t.doc.lineAt(o).length;i.length&&i.push(null);let f=s.heights[s.index++],h=0;f<0&&(h=-f,f=s.heights[s.index++]),c==-1?c=f:Math.abs(f-c)>=k6&&(c=-2);let p=new Mf(d,f,h);p.outdated=!1,i.push(p),o+=d+1}o<=a&&i.push(null,new Sc(a-o).updateHeight(t,o));let u=Qu.of(i);return(c<0||Math.abs(u.height-this.height)>=k6||Math.abs(c-this.heightMetrics(t,n).perLine)>=k6)&&(QC=!0),kF(this,u)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Hgn extends Qu{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,s){let a=r+this.left.height;return t<a?this.left.blockAt(t,n,r,s):this.right.blockAt(t,n,a,s+this.left.length+this.break)}lineAt(t,n,r,s,a){let i=s+this.left.height,o=a+this.left.length+this.break,c=n==Ti.ByHeight?t<i:t<o,u=c?this.left.lineAt(t,n,r,s,a):this.right.lineAt(t,n,r,i,o);if(this.break||(c?u.to<o:u.from>o))return u;let d=n==Ti.ByPosNoHeight?Ti.ByPosNoHeight:Ti.ByPos;return c?u.join(this.right.lineAt(o,d,r,i,o)):this.left.lineAt(o,d,r,s,a).join(u)}forEachLine(t,n,r,s,a,i){let o=s+this.left.height,c=a+this.left.length+this.break;if(this.break)t<c&&this.left.forEachLine(t,n,r,s,a,i),n>=c&&this.right.forEachLine(t,n,r,o,c,i);else{let u=this.lineAt(c,Ti.ByPos,r,s,a);t<u.from&&this.left.forEachLine(t,u.from-1,r,s,a,i),u.to>=t&&u.from<=n&&i(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,o,c,i)}}replace(t,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(t,n,r),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,n-s,r));let a=[];t>0&&this.decomposeLeft(t,a);let i=a.length;for(let o of r)a.push(o);if(t>0&&i$e(a,i-1),n<this.length){let o=a.length;this.decomposeRight(n,a),i$e(a,o)}return Qu.of(a)}decomposeLeft(t,n){let r=this.left.length;if(t<=r)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(r++,t>=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,s=r+this.break;if(t>=s)return this.right.decomposeRight(t-s,n);t<r&&this.left.decomposeRight(t,n),this.break&&t<s&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Qu.of(this.break?[t,null,n]:[t,n]):(this.left=kF(this.left,t),this.right=kF(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,r=!1,s){let{left:a,right:i}=this,o=n+a.length+this.break,c=null;return s&&s.from<=n+a.length&&s.more?c=a=a.updateHeight(t,n,r,s):a.updateHeight(t,n,r),s&&s.from<=o+i.length&&s.more?c=i=i.updateHeight(t,o,r,s):i.updateHeight(t,o,r),c?this.balanced(a,i):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function i$e(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Sc&&(r=e[t+1])instanceof Sc&&e.splice(t-1,3,new Sc(n.length+1+r.length))}const Wgn=5;class sye{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Mf?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Mf(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,a=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let i=n-t;r.block?this.addBlock(new rct(i,s,r)):(i||a||s>=Wgn)&&this.addLineDeco(s,a,i)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new Mf(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new Sc(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Mf)return t;let n=new Mf(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Mf)&&!this.isCovered?this.nodes.push(new Mf(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=t;for(let s of this.nodes)s instanceof Mf&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let a=new sye(r,t);return gr.spans(n,r,s,a,0),a.finish(r)}}function Zgn(e,t,n){let r=new Ggn;return gr.compare(e,t,n,r,0),r.changes}class Ggn{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&KE(t,n,this.changes,5)}}function Qgn(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,a=Math.max(0,n.left),i=Math.min(s.innerWidth,n.right),o=Math.max(0,n.top),c=Math.min(s.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=r.body;)if(u.nodeType==1){let d=u,f=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let h=d.getBoundingClientRect();a=Math.max(a,h.left),i=Math.min(i,h.right),o=Math.max(o,h.top),c=Math.min(u==e.parentNode?s.innerHeight:c,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:a-n.left,right:Math.max(a,i)-n.left,top:o-(n.top+t),bottom:Math.max(o,c)-(n.top+t)}}function Ygn(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function Xgn(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class kQ{constructor(t,n,r,s){this.from=t,this.to=n,this.size=r,this.displaySize=s}static same(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let s=t[r],a=n[r];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(t,n){return li.replace({widget:new Kgn(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class Kgn extends zU{constructor(t,n){super(),this.size=t,this.vertical=n}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class o$e{constructor(t,n){this.view=t,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=l$e,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Tc.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(tye).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new Ugn(r),this.stateDeco=c$e(n),this.heightMap=Qu.empty().applyChanges(this.stateDeco,Dr.empty,this.heightOracle.setDoc(n.doc),[new fp(0,0,0,n.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=li.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!t.some(({from:a,to:i})=>s>=a&&s<=i)){let{from:a,to:i}=this.lineBlockAt(s);t.push(new X4(a,i))}}return this.viewports=t.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?l$e:new aye(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(mI(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=c$e(this.state);let s=t.changedRanges,a=fp.extendWithRanges(s,Zgn(r,this.stateDeco,t?t.changes:Po.empty(this.state.doc.length))),i=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);a$e(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=i||QC)&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=i);let c=a.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(qmn)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,a=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Tc.RTL:Tc.LTR;let i=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",o=n.getBoundingClientRect(),c=i||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let u=0,d=0;if(o.width&&o.height){let{scaleX:O,scaleY:E}=ylt(n,o);(O>.005&&Math.abs(this.scaleX-O)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=O,this.scaleY=E,u|=16,i=c=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=blt(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let m=this.getScrollOffset();this.scrollOffset!=m&&(this.scrollAnchorHeight=-1,this.scrollOffset=m),this.scrolledToBottom=wlt(this.scrollParent||t.win);let g=(this.printing?Xgn:Qgn)(n,this.paddingTop),v=g.top-this.pixelViewport.top,x=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(c=!0)),!this.inView&&!this.scrollTarget&&!Ygn(t.dom))return 0;let S=o.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let O=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(O)&&(i=!0),i||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:j,textHeight:T}=t.docView.measureTextSize();i=E>0&&s.refresh(a,E,j,T,Math.max(5,S/j),O),i&&(t.docView.minWidth=0,u|=16)}v>0&&x>0?d=Math.max(v,x):v<0&&x<0&&(d=Math.min(v,x)),a$e();for(let E of this.viewports){let j=E.from==this.viewport.from?O:t.docView.measureVisibleLineHeights(E);this.heightMap=(i?Qu.empty().applyChanges(this.stateDeco,Dr.empty,this.heightOracle,[new fp(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,i,new qgn(E.from,j))}QC&&(u|=2)}let _=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return _&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||_)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(i?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:i,visibleBottom:o}=this,c=new X4(s.lineAt(i-r*1e3,Ti.ByHeight,a,0,0).from,s.lineAt(o+(1-r)*1e3,Ti.ByHeight,a,0,0).to);if(n){let{head:u}=n.range;if(u<c.from||u>c.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(u,Ti.ByPos,a,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<c.from?h=f.top:h=f.bottom-d,c=new X4(s.lineAt(h-1e3/2,Ti.ByHeight,a,0,0).from,s.lineAt(h+d+1e3/2,Ti.ByHeight,a,0,0).to)}}return c}mapViewport(t,n){let r=n.mapPos(t.from,-1),s=n.mapPos(t.to,1);return new X4(this.heightMap.lineAt(r,Ti.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ti.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,Ti.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(n,Ti.ByPos,this.heightOracle,0,0),{visibleTop:i,visibleBottom:o}=this;return(t==0||s<=i-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||a>=o+Math.max(10,Math.min(r,250)))&&s>i-2*1e3&&a<o+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let r=[];for(let s of t)n.touchesRange(s.from,s.to)||r.push(new kQ(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(t,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,a=s>>1,i=s<<1;if(this.defaultTextDirection!=Tc.LTR&&!r)return[];let o=[],c=(d,f,h,p)=>{if(f-d<a)return;let m=this.state.selection.main,g=[m.from];m.empty||g.push(m.to);for(let x of g)if(x>d&&x<f){c(d,x-10,h,p),c(x+10,f,h,p);return}let v=evn(t,x=>x.from>=h.from&&x.to<=h.to&&Math.abs(x.from-d)<a&&Math.abs(x.to-f)<a&&!g.some(w=>x.from<w&&x.to>w));if(!v){if(f<h.to&&n&&r&&n.visibleRanges.some(S=>S.from<=f&&S.to>=f)){let S=n.moveToLineBoundary(Be.cursor(f),!1,!0).head;S>d&&(f=S)}let x=this.gapSize(h,d,f,p),w=r||x<2e6?x:2e6;v=new kQ(d,f,x,w)}o.push(v)},u=d=>{if(d.length<i||d.type!=wp.Text)return;let f=Jgn(d.from,d.to,this.stateDeco);if(f.total<i)return;let h=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(r){let g=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,x;if(h!=null){let w=J4(f,h),S=((this.visibleBottom-this.visibleTop)/2+g)/d.height;v=w-S,x=w+S}else v=(this.visibleTop-d.top-g)/d.height,x=(this.visibleBottom-d.top+g)/d.height;p=K4(f,v),m=K4(f,x)}else{let g=f.total*this.heightOracle.charWidth,v=s*this.heightOracle.charWidth,x=0;if(g>2e6)for(let E of t)E.from>=d.from&&E.from<d.to&&E.size!=E.displaySize&&E.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=E.size-E.displaySize);let w=this.pixelViewport.left+x,S=this.pixelViewport.right+x,_,O;if(h!=null){let E=J4(f,h),j=((S-w)/2+v)/g;_=E-j,O=E+j}else _=(w-v)/g,O=(S+v)/g;p=K4(f,_),m=K4(f,O)}p>d.from&&c(d.from,p,d,f),m<d.to&&c(m,d.to,d,f)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(u):u(d);return o}gapSize(t,n,r,s){let a=J4(s,r)-J4(s,n);return this.heightOracle.lineWrapping?t.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(t){kQ.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=li.set(t.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];gr.spans(n,this.viewport.from,this.viewport.to,{span(a,i){r.push({from:a,to:i})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let a=0;a<r.length&&!(s&8);a++){let i=this.visibleRanges[a],o=r[a];(i.from!=o.from||i.to!=o.to)&&(s|=4,t&&t.mapPos(i.from,-1)==o.from&&t.mapPos(i.to,1)==o.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||mI(this.heightMap.lineAt(t,Ti.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||mI(this.heightMap.lineAt(this.scaler.fromDOM(t),Ti.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return mI(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let X4=class{constructor(t,n){this.from=t,this.to=n}};function Jgn(e,t,n){let r=[],s=e,a=0;return gr.spans(n,e,t,{span(){},point(i,o){i>s&&(r.push({from:s,to:i}),a+=i-s),s=o}},20),s<t&&(r.push({from:s,to:t}),a+=t-s),{total:a,ranges:r}}function K4({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let s=0;;s++){let{from:a,to:i}=t[s],o=i-a;if(r<=o)return a+r;r-=o}}function J4(e,t){let n=0;for(let{from:r,to:s}of e.ranges){if(t<=s){n+=t-r;break}n+=s-r}return n/e.total}function evn(e,t){for(let n of e)if(t(n))return n}const l$e={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function c$e(e){let t=e.facet(FU).filter(r=>typeof r!="function"),n=e.facet(nye).filter(r=>typeof r!="function");return n.length&&t.push(gr.join(n)),t}class aye{constructor(t,n,r){let s=0,a=0,i=0;this.viewports=r.map(({from:o,to:c})=>{let u=n.lineAt(o,Ti.ByPos,t,0,0).top,d=n.lineAt(c,Ti.ByPos,t,0,0).bottom;return s+=d-u,{from:o,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let o of this.viewports)o.domTop=i+(o.top-a)*this.scale,i=o.domBottom=o.domTop+(o.bottom-o.top),a=o.bottom}toDOM(t){for(let n=0,r=0,s=0;;n++){let a=n<this.viewports.length?this.viewports[n]:null;if(!a||t<a.top)return s+(t-r)*this.scale;if(t<=a.bottom)return a.domTop+(t-a.top);r=a.bottom,s=a.domBottom}}fromDOM(t){for(let n=0,r=0,s=0;;n++){let a=n<this.viewports.length?this.viewports[n]:null;if(!a||t<a.domTop)return r+(t-s)/this.scale;if(t<=a.domBottom)return a.top+(t-a.domTop);r=a.bottom,s=a.domBottom}}eq(t){return t instanceof aye?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,r)=>n.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}}function mI(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new bm(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>mI(s,t)):e._content)}const e3=kt.define({combine:e=>e.join(" ")}),Due=kt.define({combine:e=>e.indexOf(!0)>-1}),Lue=ed.newName(),sct=ed.newName(),act=ed.newName(),ict={"&light":"."+sct,"&dark":"."+act};function zue(e,t,n){return new ed(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return e;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):e+" "+r}})}const tvn=zue("."+Lue,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ict),nvn={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_Q=kn.ie&&kn.ie_version<=11;class rvn{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Amn,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(kn.ie&&kn.ie_version<=11||kn.ios&&t.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&kn.android&&t.constructor.EDIT_CONTEXT!==!1&&!(kn.chrome&&kn.chrome_version<126)&&(this.editContext=new avn(t),t.state.facet(Uy)&&(t.contentDOM.editContext=this.editContext.editContext)),_Q&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,r)=>n!=t[r]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Uy)?r.root.activeElement!=this.dom:!rR(this.dom,s))return;let a=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(kn.ie&&kn.ie_version<=11||kn.android&&kn.chrome)&&!r.state.selection.main.empty&&s.focusNode&&sR(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=kP(t.root);if(!n)return!1;let r=kn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&svn(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=rR(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Rmn(this.dom,r)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(t,n){this.selectionRange.set(t.node,t.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==r?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,nvn),_Q&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),_Q&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var r;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&JE(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let a of t){let i=this.readMutation(a);i&&(i.typeOver&&(s=!0),n==-1?{from:n,to:r}=i:(n=Math.min(i.from,n),r=Math.max(i.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&rR(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new Sgn(this.view,t,n,r);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=Zlt(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!SF(this.view.state.selection,n.newSel.main))&&this.view.update([]),s}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let r=u$e(n,t.previousSibling||t.target.previousSibling,-1),s=u$e(n,t.nextSibling||t.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Uy)!=t.state.facet(Uy)&&(t.view.contentDOM.editContext=t.state.facet(Uy)?this.editContext.editContext:null))}destroy(){var t,n,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function u$e(e,t,n){for(;t;){let r=Vo.get(t);if(r&&r.parent==e)return r;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function d$e(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,a=t.endOffset,i=e.docView.domAtPos(e.state.selection.main.anchor,1);return sR(i.node,i.offset,s,a)&&([n,r,s,a]=[s,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}}function svn(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return d$e(e,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?d$e(e,n):null}class avn{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=r=>{let s=t.state.selection.main,{anchor:a,head:i}=s,o=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let u=c-o>r.text.length;o==this.from&&a<this.from?o=a:c==this.to&&a>this.to&&(c=a);let d=Glt(t.state.sliceDoc(o,c),r.text,(u?s.from:s.to)-o,u?"end":null);if(!d){let h=Be.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));SF(h,s)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+o,to:d.toA+o,insert:Dr.of(r.text.slice(d.from,d.toB).split(`
@@ -296,7 +296,7 @@ ${J.current.stack}
296
296
  `).concat(_.x,",").concat(_.y),E=uc(e.id)?zP("recharts-radial-line-"):e.id;return y.createElement("text",qy({},r,{dominantBaseline:"central",className:Ha("recharts-radial-bar-label",i)}),y.createElement("defs",null,y.createElement("path",{id:E,d:O})),y.createElement("textPath",{xlinkHref:"#".concat(E)},n))},TVn=(e,t,n)=>{var{cx:r,cy:s,innerRadius:a,outerRadius:i,startAngle:o,endAngle:c}=e,u=(o+c)/2;if(n==="outside"){var{x:d,y:f}=Nc(r,s,i+t,u);return{x:d,y:f,textAnchor:d>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:s,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:s,textAnchor:"middle",verticalAnchor:"end"};var h=(a+i)/2,{x:p,y:m}=Nc(r,s,h,u);return{x:p,y:m,textAnchor:"middle",verticalAnchor:"middle"}},L6=e=>e!=null&&"cx"in e&&rr(e.cx),jVn={angle:0,offset:5,zIndex:Wu.label,position:"middle",textBreakAll:!1};function NVn(e){if(!L6(e))return e;var{cx:t,cy:n,outerRadius:r}=e,s=r*2;return{x:t-r,y:n-r,width:s,upperWidth:s,lowerWidth:s,height:s}}function Jx(e){var t=nf(e,jVn),{viewBox:n,parentViewBox:r,position:s,value:a,children:i,content:o,className:c="",textBreakAll:u,labelRef:d}=t,f=_Vn(),h=W0t(),p=s==="center"?h:f??h,m,g,v;n==null?m=p:L6(n)?m=n:m=Cxe(n);var x=NVn(m);if(!m||uc(a)&&uc(i)&&!y.isValidElement(o)&&typeof o!="function")return null;var w=_I(_I({},t),{},{viewBox:m});if(y.isValidElement(o)){var{labelRef:S}=w,_=Y3e(w,gVn);return y.cloneElement(o,_)}if(typeof o=="function"){var{content:O}=w,E=Y3e(w,vVn);if(g=y.createElement(o,E),y.isValidElement(g))return g}else g=OVn(t);var j=td(t);if(L6(m)){if(s==="insideStart"||s==="insideEnd"||s==="end")return CVn(t,s,g,j,m);v=TVn(m,t.offset,t.position)}else{if(!x)return null;var T=mVn({viewBox:x,position:s,offset:t.offset,parentViewBox:L6(r)?void 0:r});v=_I(_I({x:T.x,y:T.y,textAnchor:T.horizontalAnchor,verticalAnchor:T.verticalAnchor},T.width!==void 0?{width:T.width}:{}),T.height!==void 0?{height:T.height}:{})}return y.createElement(Yb,{zIndex:t.zIndex},y.createElement(R0e,qy({ref:d,className:Ha("recharts-label",c)},j,v,{textAnchor:B0t(j.textAnchor)?j.textAnchor:v.textAnchor,breakAll:u}),g))}Jx.displayName="Label";var AVn=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?y.createElement(Jx,qy({key:"label-implicit"},r)):kv(e)?y.createElement(Jx,qy({key:"label-implicit",value:e},r)):y.isValidElement(e)?e.type===Jx?y.cloneElement(e,_I({key:"label-implicit"},r)):y.createElement(Jx,qy({key:"label-implicit",content:e},r)):P0e(e)?y.createElement(Jx,qy({key:"label-implicit",content:e},r)):e&&typeof e=="object"?y.createElement(Jx,qy({},e,{key:"label-implicit"},r)):null};function IVn(e){var{label:t,labelRef:n}=e,r=W0t();return AVn(t,r,n)||null}var RVn=["valueAccessor"],PVn=["dataKey","clockWise","id","textBreakAll","zIndex"];function H9(){return H9=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H9.apply(null,arguments)}function K3e(e,t){if(e==null)return{};var n,r,s=$Vn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function $Vn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var MVn=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(oVn(t))return t},Z0t=y.createContext(void 0),DVn=Z0t.Provider,G0t=y.createContext(void 0);G0t.Provider;function LVn(){return y.useContext(Z0t)}function zVn(){return y.useContext(G0t)}function z6(e){var{valueAccessor:t=MVn}=e,n=K3e(e,RVn),{dataKey:r,clockWise:s,id:a,textBreakAll:i,zIndex:o}=n,c=K3e(n,PVn),u=LVn(),d=zVn(),f=u||d;return!f||!f.length?null:y.createElement(Yb,{zIndex:o??Wu.label},y.createElement(xb,{className:"recharts-label-list"},f.map((h,p)=>{var m,g=uc(r)?t(h,p):$c(h.payload,r),v=uc(a)?{}:{id:"".concat(a,"-").concat(p)};return y.createElement(Jx,H9({key:"label-".concat(p)},td(h),c,v,{fill:(m=n.fill)!==null&&m!==void 0?m:h.fill,parentViewBox:h.parentViewBox,value:g,textBreakAll:i,viewBox:h.viewBox,index:p,zIndex:0}))})))}z6.displayName="LabelList";function FVn(e){var{label:t}=e;return t?t===!0?y.createElement(z6,{key:"labelList-implicit"}):y.isValidElement(t)||P0e(t)?y.createElement(z6,{key:"labelList-implicit",content:t}):typeof t=="object"?y.createElement(z6,H9({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function _fe(){return _fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_fe.apply(null,arguments)}var Q0t=e=>{var{cx:t,cy:n,r,className:s}=e,a=Ha("recharts-dot",s);return rr(t)&&rr(n)&&rr(r)?y.createElement("circle",_fe({},Sv(e),yxe(e),{className:a,cx:t,cy:n,r})):null},BVn={radiusAxis:{},angleAxis:{}},Y0t=yu({name:"polarAxis",initialState:BVn,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:Jis,removeRadiusAxis:eos,addAngleAxis:tos,removeAngleAxis:nos}=Y0t.actions,UVn=Y0t.reducer;function qVn(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var QX={exports:{}},Oa={};var J3e;function VVn(){if(J3e)return Oa;J3e=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),o=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(v){if(typeof v=="object"&&v!==null){var x=v.$$typeof;switch(x){case e:switch(v=v.type,v){case n:case s:case r:case u:case d:return v;default:switch(v=v&&v.$$typeof,v){case o:case i:case c:case h:case f:case a:return v;default:return x}}case t:return x}}}return Oa.ContextConsumer=i,Oa.ContextProvider=a,Oa.Element=e,Oa.ForwardRef=c,Oa.Fragment=n,Oa.Lazy=h,Oa.Memo=f,Oa.Portal=t,Oa.Profiler=s,Oa.StrictMode=r,Oa.Suspense=u,Oa.SuspenseList=d,Oa.isAsyncMode=function(){return!1},Oa.isConcurrentMode=function(){return!1},Oa.isContextConsumer=function(v){return g(v)===i},Oa.isContextProvider=function(v){return g(v)===a},Oa.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},Oa.isForwardRef=function(v){return g(v)===c},Oa.isFragment=function(v){return g(v)===n},Oa.isLazy=function(v){return g(v)===h},Oa.isMemo=function(v){return g(v)===f},Oa.isPortal=function(v){return g(v)===t},Oa.isProfiler=function(v){return g(v)===s},Oa.isStrictMode=function(v){return g(v)===r},Oa.isSuspense=function(v){return g(v)===u},Oa.isSuspenseList=function(v){return g(v)===d},Oa.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===n||v===s||v===r||v===u||v===d||v===p||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===f||v.$$typeof===a||v.$$typeof===i||v.$$typeof===c||v.$$typeof===m||v.getModuleId!==void 0)},Oa.typeOf=g,Oa}var e5e;function HVn(){return e5e||(e5e=1,QX.exports=VVn()),QX.exports}HVn();var X0t=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,YX={},t5e;function WVn(){return t5e||(t5e=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const s=n[Symbol.toStringTag];return s==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${s}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(YX)),YX}var XX,n5e;function ZVn(){return n5e||(n5e=1,XX=WVn().isPlainObject),XX}var GVn=ZVn();const QVn=Tl(GVn);var r5e,s5e,a5e,i5e,o5e;function l5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function c5e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?l5e(Object(n),!0).forEach(function(r){YVn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YVn(e,t,n){return(t=XVn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XVn(e){var t=KVn(e,"string");return typeof t=="symbol"?t:t+""}function KVn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W9(){return W9=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W9.apply(null,arguments)}function IA(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var u5e=(e,t,n,r,s)=>{var a=n-r,i;return i=Io(r5e||(r5e=IA(["M ",",",""])),e,t),i+=Io(s5e||(s5e=IA(["L ",",",""])),e+n,t),i+=Io(a5e||(a5e=IA(["L ",",",""])),e+n-a/2,t+s),i+=Io(i5e||(i5e=IA(["L ",",",""])),e+n-a/2-r,t+s),i+=Io(o5e||(o5e=IA(["L ",","," Z"])),e,t),i},JVn={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},eHn=e=>{var t=nf(e,JVn),{x:n,y:r,upperWidth:s,lowerWidth:a,height:i,className:o}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,h=y.useRef(null),[p,m]=y.useState(-1),g=y.useRef(s),v=y.useRef(a),x=y.useRef(i),w=y.useRef(n),S=y.useRef(r),_=Axe(e,"trapezoid-");if(y.useEffect(()=>{if(h.current&&h.current.getTotalLength)try{var M=h.current.getTotalLength();M&&m(M)}catch{}},[]),n!==+n||r!==+r||s!==+s||a!==+a||i!==+i||s===0&&a===0||i===0)return null;var O=Ha("recharts-trapezoid",o);if(!f)return y.createElement("g",null,y.createElement("path",W9({},td(t),{className:O,d:u5e(n,r,s,a,i)})));var E=g.current,j=v.current,T=x.current,N=w.current,I=S.current,P="0px ".concat(p===-1?1:p,"px"),R="".concat(p,"px ").concat(p,"px"),F=hbt(["strokeDasharray"],u,c);return y.createElement(Nxe,{animationId:_,key:_,canBegin:p>0,duration:u,easing:c,isActive:f,begin:d},M=>{var L=jd(E,s,M),U=jd(j,a,M),z=jd(T,i,M),q=jd(N,n,M),W=jd(I,r,M);h.current&&(g.current=L,v.current=U,x.current=z,w.current=q,S.current=W);var D=M>0?{transition:F,strokeDasharray:R}:{strokeDasharray:P};return y.createElement("path",W9({},td(t),{className:O,d:u5e(q,W,L,U,z),ref:h,style:c5e(c5e({},D),t.style)}))})},tHn=["option","shapeType","activeClassName","inActiveClassName"];function nHn(e,t){if(e==null)return{};var n,r,s=rHn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function rHn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function d5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Z9(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d5e(Object(n),!0).forEach(function(r){sHn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sHn(e,t,n){return(t=aHn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aHn(e){var t=iHn(e,"string");return typeof t=="symbol"?t:t+""}function iHn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oHn(e,t){return Z9(Z9({},t),e)}function lHn(e,t){return e==="symbols"}function f5e(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return y.createElement(vbt,n);case"trapezoid":return y.createElement(eHn,n);case"sector":return y.createElement(xbt,n);case"symbols":if(lHn(t))return y.createElement(ryt,n);break;case"curve":return y.createElement(fbt,n);default:return null}}function cHn(e){return y.isValidElement(e)?e.props:e}function uHn(e){var{option:t,shapeType:n,activeClassName:r="recharts-active-shape",inActiveClassName:s="recharts-shape"}=e,a=nHn(e,tHn),i;if(y.isValidElement(t))i=y.cloneElement(t,Z9(Z9({},a),cHn(t)));else if(typeof t=="function")i=t(a,a.index);else if(QVn(t)&&typeof t!="boolean"){var o=oHn(t,a);i=y.createElement(f5e,{shapeType:n,elementProps:o})}else{var c=a;i=y.createElement(f5e,{shapeType:n,elementProps:c})}return a.isActive?y.createElement(xb,{className:r},i):y.createElement(xb,{className:s},i)}function dHn(e){var{tooltipEntrySettings:t}=e,n=jl(),r=rf(),s=y.useRef(null);return y.useLayoutEffect(()=>{r||(s.current===null?n(bUn(t)):s.current!==t&&n(xUn({prev:s.current,next:t})),s.current=t)},[t,n,r]),y.useLayoutEffect(()=>()=>{s.current&&(n(wUn(s.current)),s.current=null)},[n]),null}function fHn(e){var{legendPayload:t}=e,n=jl(),r=rf(),s=y.useRef(null);return y.useLayoutEffect(()=>{r||(s.current===null?n(P6n(t)):s.current!==t&&n($6n({prev:s.current,next:t})),s.current=t)},[n,r,t]),y.useLayoutEffect(()=>()=>{s.current&&(n(M6n(s.current)),s.current=null)},[n]),null}var KX,hHn=()=>{var[e]=y.useState(()=>zP("uid-"));return e},pHn=(KX=Qk.useId)!==null&&KX!==void 0?KX:hHn;function mHn(e,t){var n=pHn();return t||(e?"".concat(e,"-").concat(n):n)}var gHn=y.createContext(void 0),vHn=e=>{var{id:t,type:n,children:r}=e,s=mHn("recharts-".concat(n),t);return y.createElement(gHn.Provider,{value:s},r(s))},yHn={cartesianItems:[],polarItems:[]},K0t=yu({name:"graphicalItems",initialState:yHn,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Bi()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,s=mp(e).cartesianItems.indexOf(n);s>-1&&(e.cartesianItems[s]=r)},prepare:Bi()},removeCartesianGraphicalItem:{reducer(e,t){var n=mp(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:Bi()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Bi()},removePolarGraphicalItem:{reducer(e,t){var n=mp(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:Bi()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,s=mp(e).polarItems.indexOf(n);s>-1&&(e.polarItems[s]=r)},prepare:Bi()}}}),{addCartesianGraphicalItem:bHn,replaceCartesianGraphicalItem:xHn,removeCartesianGraphicalItem:wHn,addPolarGraphicalItem:ros,removePolarGraphicalItem:sos,replacePolarGraphicalItem:aos}=K0t.actions,SHn=K0t.reducer,kHn=e=>{var t=jl(),n=y.useRef(null);return y.useLayoutEffect(()=>{n.current===null?t(bHn(e)):n.current!==e&&t(xHn({prev:n.current,next:e})),n.current=e},[t,e]),y.useLayoutEffect(()=>()=>{n.current&&(t(wHn(n.current)),n.current=null)},[t]),null},_Hn=y.memo(kHn),OHn=["points"];function h5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function JX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?h5e(Object(n),!0).forEach(function(r){EHn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function EHn(e,t,n){return(t=CHn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CHn(e){var t=THn(e,"string");return typeof t=="symbol"?t:t+""}function THn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function G9(){return G9=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G9.apply(null,arguments)}function jHn(e,t){if(e==null)return{};var n,r,s=NHn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function NHn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function AHn(e){var{option:t,dotProps:n,className:r}=e;if(y.isValidElement(t))return y.cloneElement(t,n);if(typeof t=="function")return t(n);var s=Ha(r,typeof t!="boolean"?t.className:""),a=n??{},{points:i}=a,o=jHn(a,OHn);return y.createElement(Q0t,G9({},o,{className:s}))}function IHn(e,t){return e==null?!1:t?!0:e.length===1}function RHn(e){var{points:t,dot:n,className:r,dotClassName:s,dataKey:a,baseProps:i,needClip:o,clipPathId:c,zIndex:u=Wu.scatter}=e;if(!IHn(t,n))return null;var d=X0t(n),f=HLn(n),h=t.map((m,g)=>{var v,x,w=JX(JX(JX({r:3},i),f),{},{index:g,cx:(v=m.x)!==null&&v!==void 0?v:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:a,value:m.value,payload:m.payload,points:t});return y.createElement(AHn,{key:"dot-".concat(g),option:n,dotProps:w,className:s})}),p={};return o&&c!=null&&(p.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),y.createElement(Yb,{zIndex:u},y.createElement(xb,G9({className:r},p),h))}function p5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function m5e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p5e(Object(n),!0).forEach(function(r){PHn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PHn(e,t,n){return(t=$Hn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $Hn(e){var t=MHn(e,"string");return typeof t=="symbol"?t:t+""}function MHn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var DHn={xAxis:{},yAxis:{},zAxis:{}},J0t=yu({name:"cartesianAxis",initialState:DHn,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:Bi()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:Bi()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:Bi()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:Bi()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:Bi()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:Bi()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:Bi()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:Bi()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:Bi()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,s=e.yAxis[n];if(s){var a,i=s.widthHistory||[];if(i.length===3&&i[0]===i[2]&&r===i[1]&&r!==s.width&&Math.abs(r-((a=i[0])!==null&&a!==void 0?a:0))<=1)return;var o=[...i,r].slice(-3);e.yAxis[n]=m5e(m5e({},s),{},{width:r,widthHistory:o})}}}}),{addXAxis:LHn,replaceXAxis:zHn,removeXAxis:FHn,addYAxis:BHn,replaceYAxis:UHn,removeYAxis:qHn,addZAxis:ios,replaceZAxis:oos,removeZAxis:los,updateYAxisWidth:VHn}=J0t.actions,HHn=J0t.reducer,WHn=tt([Lc],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),ZHn=tt([WHn,Vb,Hb],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),$0e=()=>pr(ZHn),GHn=()=>pr(b7n);function g5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function eK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?g5e(Object(n),!0).forEach(function(r){QHn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QHn(e,t,n){return(t=YHn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YHn(e){var t=XHn(e,"string");return typeof t=="symbol"?t:t+""}function XHn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var KHn=e=>{var{point:t,childIndex:n,mainColor:r,activeDot:s,dataKey:a,clipPath:i}=e;if(s===!1||t.x==null||t.y==null)return null;var o={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=eK(eK(eK({},o),P7(s)),yxe(s)),u;return y.isValidElement(s)?u=y.cloneElement(s,c):typeof s=="function"?u=s(c):u=y.createElement(Q0t,c),y.createElement(xb,{className:"recharts-active-dot",clipPath:i},u)};function JHn(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:s,clipPath:a,zIndex:i=Wu.activeDot}=e,o=pr(XP),c=GHn();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return uc(u)?null:y.createElement(Yb,{zIndex:i},y.createElement(KHn,{point:u,childIndex:Number(o),mainColor:n,dataKey:s,activeDot:r,clipPath:a}))}var eWn=e=>{var{chartData:t}=e,n=jl(),r=rf();return y.useEffect(()=>r?()=>{}:(n(P3e(t)),()=>{n(P3e(void 0))}),[t,n,r]),null},v5e={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},ewt=yu({name:"brush",initialState:v5e,reducers:{setBrushSettings(e,t){return t.payload==null?v5e:t.payload}}}),{setBrushSettings:cos}=ewt.actions,tWn=ewt.reducer;function nWn(e){return(e%180+180)%180}var rWn=function(t){var{width:n,height:r}=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=nWn(s),i=a*Math.PI/180,o=Math.atan(r/n),c=i>o&&i<Math.PI-o?r/Math.sin(i):n/Math.cos(i);return Math.abs(c)},sWn={dots:[],areas:[],lines:[]},twt=yu({name:"referenceElements",initialState:sWn,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=mp(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=mp(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=mp(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:uos,removeDot:dos,addArea:fos,removeArea:hos,addLine:pos,removeLine:mos}=twt.actions,aWn=twt.reducer,iWn=y.createContext(void 0),oWn=e=>{var{children:t}=e,[n]=y.useState("".concat(zP("recharts"),"-clip")),r=$0e();if(r==null)return null;var{x:s,y:a,width:i,height:o}=r;return y.createElement(iWn.Provider,{value:n},y.createElement("defs",null,y.createElement("clipPath",{id:n},y.createElement("rect",{x:s,y:a,height:o,width:i}))),t)};function nwt(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var s=e[r];s!==void 0&&n.push(s)}return n}function lWn(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return rWn(r,n)}function cWn(e,t,n){var r=n==="width",{x:s,y:a,width:i,height:o}=e;return t===1?{start:r?s:a,end:r?s+i:a+o}:{start:r?s+i:a+o,end:r?s:a}}function JP(e,t,n,r,s){if(e*t<e*r||e*t>e*s)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-s)<=0}function uWn(e,t){return nwt(e,t+1)}function dWn(e,t,n,r,s){for(var a=(r||[]).slice(),{start:i,end:o}=t,c=0,u=1,d=i,f=function(){var m=r?.[c];if(m===void 0)return{v:nwt(r,u)};var g=c,v,x=()=>(v===void 0&&(v=n(m,g)),v),w=m.coordinate,S=c===0||JP(e,w,x,d,o);S||(c=0,d=i,u+=1),S&&(d=w+e*(x()/2+s),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function fWn(e,t,n,r,s){var a=(r||[]).slice(),i=a.length;if(i===0)return[];for(var{start:o,end:c}=t,u=1;u<=i;u++){for(var d=(i-1)%u,f=o,h=!0,p=function(){var _=r[g];if(_==null)return 0;var O=g,E,j=()=>(E===void 0&&(E=n(_,O)),E),T=_.coordinate,N=g===d||JP(e,T,j,f,c);if(!N)return h=!1,1;N&&(f=T+e*(j()/2+s))},m,g=d;g<i&&(m=p(),!(m!==0&&m===1));g+=u);if(h){for(var v=[],x=d;x<i;x+=u){var w=r[x];w!=null&&v.push(w)}return v}}return[]}function y5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Wc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y5e(Object(n),!0).forEach(function(r){hWn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hWn(e,t,n){return(t=pWn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pWn(e){var t=mWn(e,"string");return typeof t=="symbol"?t:t+""}function mWn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gWn(e,t,n,r,s){for(var a=(r||[]).slice(),i=a.length,{start:o}=t,{end:c}=t,u=function(h){var p=a[h];if(p==null)return 1;var m=p,g,v=()=>(g===void 0&&(g=n(p,h)),g);if(h===i-1){var x=e*(m.coordinate+e*v()/2-c);a[h]=m=Wc(Wc({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate})}else a[h]=m=Wc(Wc({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var w=JP(e,m.tickCoord,v,o,c);w&&(c=m.tickCoord-e*(v()/2+s),a[h]=Wc(Wc({},m),{},{isShow:!0}))}},d=i-1;d>=0;d--)u(d);return a}function vWn(e,t,n,r,s,a){var i=(r||[]).slice(),o=i.length,{start:c,end:u}=t;if(a){var d=r[o-1];if(d!=null){var f=n(d,o-1),h=e*(d.coordinate+e*f/2-u);if(i[o-1]=d=Wc(Wc({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate}),d.tickCoord!=null){var p=JP(e,d.tickCoord,()=>f,c,u);p&&(u=d.tickCoord-e*(f/2+s),i[o-1]=Wc(Wc({},d),{},{isShow:!0}))}}}for(var m=a?o-1:o,g=function(w){var S=i[w];if(S==null)return 1;var _=S,O,E=()=>(O===void 0&&(O=n(S,w)),O);if(w===0){var j=e*(_.coordinate-e*E()/2-c);i[w]=_=Wc(Wc({},_),{},{tickCoord:j<0?_.coordinate-j*e:_.coordinate})}else i[w]=_=Wc(Wc({},_),{},{tickCoord:_.coordinate});if(_.tickCoord!=null){var T=JP(e,_.tickCoord,E,c,u);T&&(c=_.tickCoord+e*(E()/2+s),i[w]=Wc(Wc({},_),{},{isShow:!0}))}},v=0;v<m;v++)g(v);return i}function M0e(e,t,n){var{tick:r,ticks:s,viewBox:a,minTickGap:i,orientation:o,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!s||!s.length||!r)return[];if(rr(c)||O2.isSsr){var h;return(h=uWn(s,rr(c)?c:0))!==null&&h!==void 0?h:[]}var p=[],m=o==="top"||o==="bottom"?"width":"height",g=d&&m==="width"?hR(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},v=(O,E)=>{var j=typeof u=="function"?u(O.value,E):O.value;return m==="width"?lWn(hR(j,{fontSize:t,letterSpacing:n}),g,f):hR(j,{fontSize:t,letterSpacing:n})[m]},x=s[0],w=s[1],S=s.length>=2&&x!=null&&w!=null?pp(w.coordinate-x.coordinate):1,_=cWn(a,S,m);return c==="equidistantPreserveStart"?dWn(S,_,v,s,i):c==="equidistantPreserveEnd"?fWn(S,_,v,s,i):(c==="preserveStart"||c==="preserveStartEnd"?p=vWn(S,_,v,s,i,c==="preserveStartEnd"):p=gWn(S,_,v,s,i),p.filter(O=>O.isShow))}var yWn=e=>{var{ticks:t,label:n,labelGapWithTick:r=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 o=n?n.getBoundingClientRect().width:0,c=s+a,u=i+c+o+(n?r:0);return Math.round(u)}return 0},bWn={xAxis:{},yAxis:{}},rwt=yu({name:"renderedTicks",initialState:bWn,reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:s}=t.payload;e[n][r]=s},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:xWn,removeRenderedTicks:wWn}=rwt.actions,SWn=rwt.reducer,kWn=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function _Wn(e,t){if(e==null)return{};var n,r,s=OWn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function OWn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _k(){return _k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_k.apply(null,arguments)}function b5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ao(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?b5e(Object(n),!0).forEach(function(r){EWn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function EWn(e,t,n){return(t=CWn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CWn(e){var t=TWn(e,"string");return typeof t=="symbol"?t:t+""}function TWn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ob={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:Wu.axis};function jWn(e){var{x:t,y:n,width:r,height:s,orientation:a,mirror:i,axisLine:o,otherSvgProps:c}=e;if(!o)return null;var u=Ao(Ao(Ao({},c),Sv(o)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!i||a==="bottom"&&i);u=Ao(Ao({},u),{},{x1:t,y1:n+d*s,x2:t+r,y2:n+d*s})}else{var f=+(a==="left"&&!i||a==="right"&&i);u=Ao(Ao({},u),{},{x1:t+f*r,y1:n,x2:t+f*r,y2:n+s})}return y.createElement("line",_k({},u,{className:Ha("recharts-cartesian-axis-line",L7(o,"className"))}))}function NWn(e,t,n,r,s,a,i,o,c){var u,d,f,h,p,m,g=o?-1:1,v=e.tickSize||i,x=rr(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=d=e.coordinate,h=n+ +!o*s,f=h-g*v,m=f-g*c,p=x;break;case"left":f=h=e.coordinate,d=t+ +!o*r,u=d-g*v,p=u-g*c,m=x;break;case"right":f=h=e.coordinate,d=t+ +o*r,u=d+g*v,p=u+g*c,m=x;break;default:u=d=e.coordinate,h=n+ +o*s,f=h+g*v,m=f+g*c,p=x;break}return{line:{x1:u,y1:f,x2:d,y2:h},tick:{x:p,y:m}}}function AWn(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function IWn(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function RWn(e){var{option:t,tickProps:n,value:r}=e,s,a=Ha(n.className,"recharts-cartesian-axis-tick-value");if(y.isValidElement(t))s=y.cloneElement(t,Ao(Ao({},n),{},{className:a}));else if(typeof t=="function")s=t(Ao(Ao({},n),{},{className:a}));else{var i="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(i=Ha(i,qVn(t))),s=y.createElement(R0e,_k({},n,{className:i}),r)}return s}function PWn(e){var{ticks:t,axisType:n,axisId:r}=e,s=jl();return y.useEffect(()=>{if(r==null||n==null)return p_;var a=t.map(i=>({value:i.value,coordinate:i.coordinate,offset:i.offset,index:i.index}));return s(xWn({ticks:a,axisId:r,axisType:n})),()=>{s(wWn({axisId:r,axisType:n}))}},[s,t,r,n]),null}var $Wn=y.forwardRef((e,t)=>{var{ticks:n=[],tick:r,tickLine:s,stroke:a,tickFormatter:i,unit:o,padding:c,tickTextProps:u,orientation:d,mirror:f,x:h,y:p,width:m,height:g,tickSize:v,tickMargin:x,fontSize:w,letterSpacing:S,getTicksConfig:_,events:O,axisType:E,axisId:j}=e,T=M0e(Ao(Ao({},_),{},{ticks:n}),w,S),N=Sv(_),I=P7(r),P=B0t(N.textAnchor)?N.textAnchor:AWn(d,f),R=IWn(d,f),F={};typeof s=="object"&&(F=s);var M=Ao(Ao({},N),{},{fill:"none"},F),L=T.map(q=>Ao({entry:q},NWn(q,h,p,m,g,d,v,f,x))),U=L.map(q=>{var{entry:W,line:D}=q;return y.createElement(xb,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},s&&y.createElement("line",_k({},M,D,{className:Ha("recharts-cartesian-axis-tick-line",L7(s,"className"))})))}),z=L.map((q,W)=>{var D,Q,{entry:V,tick:$}=q,Z=Ao(Ao(Ao(Ao({verticalAnchor:R},N),{},{textAnchor:P,stroke:"none",fill:a},$),{},{index:W,payload:V,visibleTicksCount:T.length,tickFormatter:i,padding:c},u),{},{angle:(D=(Q=u?.angle)!==null&&Q!==void 0?Q:N.angle)!==null&&D!==void 0?D:0}),G=Ao(Ao({},Z),I);return y.createElement(xb,_k({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(V.value,"-").concat(V.coordinate,"-").concat(V.tickCoord)},Q4n(O,V,W)),r&&y.createElement(RWn,{option:r,tickProps:G,value:"".concat(typeof i=="function"?i(V.value,W):V.value).concat(o||"")}))});return y.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(E,"-ticks")},y.createElement(PWn,{ticks:T,axisId:j,axisType:E}),z.length>0&&y.createElement(Yb,{zIndex:Wu.label},y.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(E,"-tick-labels"),ref:t},z)),U.length>0&&y.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(E,"-tick-lines")},U))}),MWn=y.forwardRef((e,t)=>{var{axisLine:n,width:r,height:s,className:a,hide:i,ticks:o,axisType:c,axisId:u}=e,d=_Wn(e,kWn),[f,h]=y.useState(""),[p,m]=y.useState(""),g=y.useRef(null);y.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return yWn({ticks:g.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var v=y.useCallback(x=>{if(x){var w=x.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=w;var S=w[0];if(S){var _=window.getComputedStyle(S),O=_.fontSize,E=_.letterSpacing;(O!==f||E!==p)&&(h(O),m(E))}}},[f,p]);return i||r!=null&&r<=0||s!=null&&s<=0?null:y.createElement(Yb,{zIndex:e.zIndex},y.createElement(xb,{className:Ha("recharts-cartesian-axis",a)},y.createElement(jWn,{x:e.x,y:e.y,width:r,height:s,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Sv(e)}),y.createElement($Wn,{ref:v,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:o,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),y.createElement(SVn,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},y.createElement(IVn,{label:e.label,labelRef:e.labelRef}),e.children)))}),D0e=y.forwardRef((e,t)=>{var n=nf(e,ob);return y.createElement(MWn,_k({},n,{ref:t}))});D0e.displayName="CartesianAxis";var DWn=["x1","y1","x2","y2","key"],LWn=["offset"],zWn=["xAxisId","yAxisId"],FWn=["xAxisId","yAxisId"];function x5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?x5e(Object(n),!0).forEach(function(r){BWn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function BWn(e,t,n){return(t=UWn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UWn(e){var t=qWn(e,"string");return typeof t=="symbol"?t:t+""}function qWn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mS(){return mS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mS.apply(null,arguments)}function Q9(e,t){if(e==null)return{};var n,r,s=VWn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function VWn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var HWn=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:s,width:a,height:i,ry:o}=e;return y.createElement("rect",{x:r,y:s,ry:o,width:a,height:i,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function swt(e){var{option:t,lineItemProps:n}=e,r;if(y.isValidElement(t))r=y.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var s,{x1:a,y1:i,x2:o,y2:c,key:u}=n,d=Q9(n,DWn),f=(s=Sv(d))!==null&&s!==void 0?s:{},{offset:h}=f,p=Q9(f,LWn);r=y.createElement("line",mS({},p,{x1:a,y1:i,x2:o,y2:c,fill:"none",key:u}))}return r}function WWn(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:s}=e;if(!r||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,o=Q9(e,zWn),c=s.map((u,d)=>{var f=eu(eu({},o),{},{x1:t,y1:u,x2:t+n,y2:u,key:"line-".concat(d),index:d});return y.createElement(swt,{key:"line-".concat(d),option:r,lineItemProps:f})});return y.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function ZWn(e){var{y:t,height:n,vertical:r=!0,verticalPoints:s}=e;if(!r||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,o=Q9(e,FWn),c=s.map((u,d)=>{var f=eu(eu({},o),{},{x1:u,y1:t,x2:u,y2:t+n,key:"line-".concat(d),index:d});return y.createElement(swt,{option:r,lineItemProps:f,key:"line-".concat(d)})});return y.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function GWn(e){var{horizontalFill:t,fillOpacity:n,x:r,y:s,width:a,height:i,horizontalPoints:o,horizontal:c=!0}=e;if(!c||!t||!t.length||o==null)return null;var u=o.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 v=h%t.length;return y.createElement("rect",{key:"react-".concat(h),y:f,x:r,height:g,width:a,stroke:"none",fill:t[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return y.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function QWn(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:s,y:a,width:i,height:o,verticalPoints:c}=e;if(!t||!n||!n.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 v=h%n.length;return y.createElement("rect",{key:"react-".concat(h),x:f,y:a,width:g,height:o,stroke:"none",fill:n[v],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return y.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var YWn=(e,t)=>{var{xAxis:n,width:r,height:s,offset:a}=e;return Vyt(M0e(eu(eu(eu({},ob),n),{},{ticks:Hyt(n),viewBox:{x:0,y:0,width:r,height:s}})),a.left,a.left+a.width,t)},XWn=(e,t)=>{var{yAxis:n,width:r,height:s,offset:a}=e;return Vyt(M0e(eu(eu(eu({},ob),n),{},{ticks:Hyt(n),viewBox:{x:0,y:0,width:r,height:s}})),a.top,a.top+a.height,t)},KWn={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Wu.grid};function awt(e){var t=Jyt(),n=ebt(),r=Kyt(),s=eu(eu({},nf(e,KWn)),{},{x:rr(e.x)?e.x:r.left,y:rr(e.y)?e.y:r.top,width:rr(e.width)?e.width:r.width,height:rr(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:i,x:o,y:c,width:u,height:d,syncWithTicks:f,horizontalValues:h,verticalValues:p}=s,m=rf(),g=pr(N=>w3e(N,"xAxis",a,m)),v=pr(N=>w3e(N,"yAxis",i,m));if(!_v(u)||!_v(d)||!rr(o)||!rr(c))return null;var x=s.verticalCoordinatesGenerator||YWn,w=s.horizontalCoordinatesGenerator||XWn,{horizontalPoints:S,verticalPoints:_}=s;if((!S||!S.length)&&typeof w=="function"){var O=h&&h.length,E=w({yAxis:v?eu(eu({},v),{},{ticks:O?h:v.ticks}):void 0,width:t??u,height:n??d,offset:r},O?!0:f);x9(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(S=E)}if((!_||!_.length)&&typeof x=="function"){var j=p&&p.length,T=x({xAxis:g?eu(eu({},g),{},{ticks:j?p:g.ticks}):void 0,width:t??u,height:n??d,offset:r},j?!0:f);x9(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof T,"]")),Array.isArray(T)&&(_=T)}return y.createElement(Yb,{zIndex:s.zIndex},y.createElement("g",{className:"recharts-cartesian-grid"},y.createElement(HWn,{fill:s.fill,fillOpacity:s.fillOpacity,x:s.x,y:s.y,width:s.width,height:s.height,ry:s.ry}),y.createElement(GWn,mS({},s,{horizontalPoints:S})),y.createElement(QWn,mS({},s,{verticalPoints:_})),y.createElement(WWn,mS({},s,{offset:r,horizontalPoints:S,xAxis:g,yAxis:v})),y.createElement(ZWn,mS({},s,{offset:r,verticalPoints:_,xAxis:g,yAxis:v}))))}awt.displayName="CartesianGrid";var JWn={},iwt=yu({name:"errorBars",initialState:JWn,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:s}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?s:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(s=>s.dataKey!==r.dataKey||s.direction!==r.direction))}}}),{addErrorBar:gos,replaceErrorBar:vos,removeErrorBar:yos}=iwt.actions,eZn=iwt.reducer,tZn=["children"];function nZn(e,t){if(e==null)return{};var n,r,s=rZn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function rZn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var sZn={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},aZn=y.createContext(sZn);function iZn(e){var{children:t}=e,n=nZn(e,tZn);return y.createElement(aZn.Provider,{value:n},t)}function owt(e,t){var n,r,s=pr(u=>Zb(u,e)),a=pr(u=>Gb(u,t)),i=(n=s?.allowDataOverflow)!==null&&n!==void 0?n:Dl.allowDataOverflow,o=(r=a?.allowDataOverflow)!==null&&r!==void 0?r:Ll.allowDataOverflow,c=i||o;return{needClip:c,needClipX:i,needClipY:o}}function oZn(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,s=$0e(),{needClipX:a,needClipY:i,needClip:o}=owt(t,n);if(!o||!s)return null;var{x:c,y:u,width:d,height:f}=s;return y.createElement("clipPath",{id:"clipPath-".concat(r)},y.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 lwt=(e,t,n,r)=>o0t(e,"xAxis",t,r),cwt=(e,t,n,r)=>i0t(e,"xAxis",t,r),uwt=(e,t,n,r)=>o0t(e,"yAxis",n,r),dwt=(e,t,n,r)=>i0t(e,"yAxis",n,r),lZn=tt([ko,lwt,uwt,cwt,dwt],(e,t,n,r,s)=>qb(e,"xAxis")?b9(t,r,!1):b9(n,s,!1)),cZn=(e,t,n,r,s)=>s;function uZn(e){return e.type==="line"}var dZn=tt([Nxt,cZn],(e,t)=>e.filter(uZn).find(n=>n.id===t)),fZn=tt([ko,lwt,uwt,cwt,dwt,dZn,lZn,Ixe],(e,t,n,r,s,a,i,o)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:d}=o;if(!(a==null||t==null||n==null||r==null||s==null||r.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 RZn({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:s,dataKey:f,bandSize:i,displayedData:p})}});function hZn(e){var t=P7(e),n=3,r=2;if(t!=null){var{r:s,strokeWidth:a}=t,i=Number(s),o=Number(a);return(Number.isNaN(i)||i<0)&&(i=n),(Number.isNaN(o)||o<0)&&(o=r),{r:i,strokeWidth:o}}return{r:n,strokeWidth:r}}var pZn=["id"],mZn=["type","layout","connectNulls","needClip","shape"],gZn=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function e$(){return e$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e$.apply(null,arguments)}function w5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function $g(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?w5e(Object(n),!0).forEach(function(r){vZn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vZn(e,t,n){return(t=yZn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yZn(e){var t=bZn(e,"string");return typeof t=="symbol"?t:t+""}function bZn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L0e(e,t){if(e==null)return{};var n,r,s=xZn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function xZn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var wZn=e=>{var{dataKey:t,name:n,stroke:r,legendType:s,hide:a}=e;return[{inactive:a,dataKey:t,type:s,color:r,value:Wyt(n,t),payload:e}]},SZn=y.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:s,fill:a,name:i,hide:o,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:p_,settings:{stroke:r,strokeWidth:s,fill:a,dataKey:t,nameKey:void 0,name:Wyt(i,t),hide:o,type:u,color:r,unit:c,graphicalItemId:d}};return y.createElement(dHn,{tooltipEntrySettings:f})}),fwt=(e,t)=>"".concat(t,"px ").concat(e,"px");function kZn(e,t){for(var n=e.length%2!==0?[...e,0]:e,r=[],s=0;s<t;++s)r.push(...n);return r}var _Zn=(e,t,n)=>{var r=n.reduce((h,p)=>h+p,0);if(!r)return fwt(t,e);for(var s=Math.floor(e/r),a=e%r,i=[],o=0,c=0;o<n.length;c+=(u=n[o])!==null&&u!==void 0?u:0,++o){var u,d=n[o];if(d!=null&&c+d>a){i=[...n.slice(0,o),a-c];break}}var f=i.length%2===0?[0,t]:[t];return[...kZn(n,s),...i,...f].map(h=>"".concat(h,"px")).join(", ")};function OZn(e){var{clipPathId:t,points:n,props:r}=e,{dot:s,dataKey:a,needClip:i}=r,{id:o}=r,c=L0e(r,pZn),u=Sv(c);return y.createElement(RHn,{points:n,dot:s,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:u,needClip:i,clipPathId:t})}function EZn(e){var{showLabels:t,children:n,points:r}=e,s=y.useMemo(()=>r?.map(a=>{var i,o,c={x:(i=a.x)!==null&&i!==void 0?i:0,y:(o=a.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return $g($g({},c),{},{value:a.value,payload:a.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[r]);return y.createElement(DVn,{value:t?s:void 0},n)}function S5e(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:s,props:a}=e,{type:i,layout:o,connectNulls:c,needClip:u,shape:d}=a,f=L0e(a,mZn),h=$g($g({},td(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:u?"url(#clipPath-".concat(t,")"):void 0,points:r,type:i,layout:o,connectNulls:c,strokeDasharray:s??a.strokeDasharray});return y.createElement(y.Fragment,null,r?.length>1&&y.createElement(uHn,e$({shapeType:"curve",option:d},h,{pathRef:n})),y.createElement(OZn,{points:r,clipPathId:t,props:a}))}function CZn(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function TZn(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:s,longestAnimatedLengthRef:a}=e,{points:i,strokeDasharray:o,isAnimationActive:c,animationBegin:u,animationDuration:d,animationEasing:f,animateNewValues:h,width:p,height:m,onAnimationEnd:g,onAnimationStart:v}=n,x=s.current,w=Axe(i,"recharts-line-"),S=y.useRef(w),[_,O]=y.useState(!1),E=!_,j=y.useCallback(()=>{typeof g=="function"&&g(),O(!1)},[g]),T=y.useCallback(()=>{typeof v=="function"&&v(),O(!0)},[v]),N=CZn(r.current),I=y.useRef(0);S.current!==w&&(I.current=a.current,S.current=w);var P=I.current;return y.createElement(EZn,{points:i,showLabels:E},n.children,y.createElement(Nxe,{animationId:w,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:j,onAnimationStart:T,key:w},R=>{var F=jd(P,N+P,R),M=Math.min(F,N),L;if(c)if(o){var U="".concat(o).split(/[,\s]+/gim).map(W=>parseFloat(W));L=_Zn(M,N,U)}else L=fwt(N,M);else L=o==null?void 0:String(o);if(R>0&&N>0&&(s.current=i,a.current=Math.max(a.current,M)),x){var z=x.length/i.length,q=R===1?i:i.map((W,D)=>{var Q=Math.floor(D*z);if(x[Q]){var V=x[Q];return $g($g({},W),{},{x:jd(V.x,W.x,R),y:jd(V.y,W.y,R)})}return h?$g($g({},W),{},{x:jd(p*2,W.x,R),y:jd(m/2,W.y,R)}):$g($g({},W),{},{x:W.x,y:W.y})});return s.current=q,y.createElement(S5e,{props:n,points:q,clipPathId:t,pathRef:r,strokeDasharray:L})}return y.createElement(S5e,{props:n,points:i,clipPathId:t,pathRef:r,strokeDasharray:L})}),y.createElement(FVn,{label:n.label}))}function jZn(e){var{clipPathId:t,props:n}=e,r=y.useRef(null),s=y.useRef(0),a=y.useRef(null);return y.createElement(TZn,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:s,pathRef:a})}var NZn=(e,t)=>{var n,r;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:$c(e.payload,t)}};class AZn extends y.Component{render(){var{hide:t,dot:n,points:r,className:s,xAxisId:a,yAxisId:i,top:o,left:c,width:u,height:d,id:f,needClip:h,zIndex:p}=this.props;if(t)return null;var m=Ha("recharts-line",s),g=f,{r:v,strokeWidth:x}=hZn(n),w=X0t(n),S=v*2+x,_=h?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return y.createElement(Yb,{zIndex:p},y.createElement(xb,{className:m},h&&y.createElement("defs",null,y.createElement(oZn,{clipPathId:g,xAxisId:a,yAxisId:i}),!w&&y.createElement("clipPath",{id:"clipPath-dots-".concat(g)},y.createElement("rect",{x:c-S/2,y:o-S/2,width:u+S,height:d+S}))),y.createElement(iZn,{xAxisId:a,yAxisId:i,data:r,dataPointFormatter:NZn,errorBarOffset:0},y.createElement(jZn,{props:this.props,clipPathId:g}))),y.createElement(JHn,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:_}))}}var hwt={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:Wu.line,type:"linear"};function IZn(e){var t=nf(e,hwt),{activeDot:n,animateNewValues:r,animationBegin:s,animationDuration:a,animationEasing:i,connectNulls:o,dot:c,hide:u,isAnimationActive:d,label:f,legendType:h,xAxisId:p,yAxisId:m,id:g}=t,v=L0e(t,gZn),{needClip:x}=owt(p,m),w=$0e(),S=Tj(),_=rf(),O=pr(I=>fZn(I,p,m,_,g));if(S!=="horizontal"&&S!=="vertical"||O==null||w==null)return null;var{height:E,width:j,x:T,y:N}=w;return y.createElement(AZn,e$({},v,{id:g,connectNulls:o,dot:c,activeDot:n,animateNewValues:r,animationBegin:s,animationDuration:a,animationEasing:i,isAnimationActive:d,hide:u,label:f,legendType:h,xAxisId:p,yAxisId:m,points:O,layout:S,height:E,width:j,left:T,top:N,needClip:x}))}function RZn(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:s,yAxisTicks:a,dataKey:i,bandSize:o,displayedData:c}=e;return c.map((u,d)=>{var f=$c(u,i);if(t==="horizontal"){var h=xLe({axis:n,ticks:s,bandSize:o,entry:u,index:d}),p=uc(f)?null:r.scale.map(f);return{x:h,y:p??null,value:f,payload:u}}var m=uc(f)?null:n.scale.map(f),g=xLe({axis:r,ticks:a,bandSize:o,entry:u,index:d});return m==null||g==null?null:{x:m,y:g,value:f,payload:u}}).filter(Boolean)}function PZn(e){var t=nf(e,hwt),n=rf();return y.createElement(vHn,{id:t.id,type:"line"},r=>y.createElement(y.Fragment,null,y.createElement(fHn,{legendPayload:wZn(t)}),y.createElement(SZn,{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:r}),y.createElement(_Hn,{type:"line",id:r,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),y.createElement(IZn,e$({},t,{id:r}))))}var pwt=y.memo(PZn,rq);pwt.displayName="Line";var $Zn=["domain","range"],MZn=["domain","range"];function k5e(e,t){if(e==null)return{};var n,r,s=DZn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function DZn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _5e(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 mwt(e,t){if(e===t)return!0;var{domain:n,range:r}=e,s=k5e(e,$Zn),{domain:a,range:i}=t,o=k5e(t,MZn);return!_5e(n,a)||!_5e(r,i)?!1:rq(s,o)}var LZn=["type"],zZn=["dangerouslySetInnerHTML","ticks","scale"],FZn=["id","scale"];function Ofe(){return Ofe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ofe.apply(null,arguments)}function O5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function E5e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?O5e(Object(n),!0).forEach(function(r){BZn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function BZn(e,t,n){return(t=UZn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UZn(e){var t=qZn(e,"string");return typeof t=="symbol"?t:t+""}function qZn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Efe(e,t){if(e==null)return{};var n,r,s=VZn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function VZn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function HZn(e){var t=jl(),n=y.useRef(null),r=tbt(),{type:s}=e,a=Efe(e,LZn),i=iq(r,"xAxis",s),o=y.useMemo(()=>{if(i!=null)return E5e(E5e({},a),{},{type:i})},[a,i]);return y.useLayoutEffect(()=>{o!=null&&(n.current===null?t(LHn(o)):n.current!==o&&t(zHn({prev:n.current,next:o})),n.current=o)},[o,t]),y.useLayoutEffect(()=>()=>{n.current&&(t(FHn(n.current)),n.current=null)},[t]),null}var WZn=e=>{var{xAxisId:t,className:n}=e,r=pr(Gyt),s=rf(),a="xAxis",i=pr(x=>a0t(x,a,t,s)),o=pr(x=>eUn(x,t)),c=pr(x=>iUn(x,t)),u=pr(x=>Ext(x,t));if(o==null||c==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:h}=e,p=Efe(e,zZn),{id:m,scale:g}=u,v=Efe(u,FZn);return y.createElement(D0e,Ofe({},p,v,{x:c.x,y:c.y,width:o.width,height:o.height,className:Ha("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:i,axisType:a,axisId:t}))},ZZn={allowDataOverflow:Dl.allowDataOverflow,allowDecimals:Dl.allowDecimals,allowDuplicatedCategory:Dl.allowDuplicatedCategory,angle:Dl.angle,axisLine:ob.axisLine,height:Dl.height,hide:!1,includeHidden:Dl.includeHidden,interval:Dl.interval,label:!1,minTickGap:Dl.minTickGap,mirror:Dl.mirror,orientation:Dl.orientation,padding:Dl.padding,reversed:Dl.reversed,scale:Dl.scale,tick:Dl.tick,tickCount:Dl.tickCount,tickLine:ob.tickLine,tickSize:ob.tickSize,type:Dl.type,niceTicks:Dl.niceTicks,xAxisId:0},GZn=e=>{var t=nf(e,ZZn);return y.createElement(y.Fragment,null,y.createElement(HZn,{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}),y.createElement(WZn,t))},gwt=y.memo(GZn,mwt);gwt.displayName="XAxis";var QZn=["type"],YZn=["dangerouslySetInnerHTML","ticks","scale"],XZn=["id","scale"];function Cfe(){return Cfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cfe.apply(null,arguments)}function C5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function T5e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?C5e(Object(n),!0).forEach(function(r){KZn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function KZn(e,t,n){return(t=JZn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JZn(e){var t=eGn(e,"string");return typeof t=="symbol"?t:t+""}function eGn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tfe(e,t){if(e==null)return{};var n,r,s=tGn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function tGn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function nGn(e){var t=jl(),n=y.useRef(null),r=tbt(),{type:s}=e,a=Tfe(e,QZn),i=iq(r,"yAxis",s),o=y.useMemo(()=>{if(i!=null)return T5e(T5e({},a),{},{type:i})},[i,a]);return y.useLayoutEffect(()=>{o!=null&&(n.current===null?t(BHn(o)):n.current!==o&&t(UHn({prev:n.current,next:o})),n.current=o)},[o,t]),y.useLayoutEffect(()=>()=>{n.current&&(t(qHn(n.current)),n.current=null)},[t]),null}function rGn(e){var{yAxisId:t,className:n,width:r,label:s}=e,a=y.useRef(null),i=y.useRef(null),o=pr(Gyt),c=rf(),u=jl(),d="yAxis",f=pr(E=>cUn(E,t)),h=pr(E=>lUn(E,t)),p=pr(E=>a0t(E,d,t,c)),m=pr(E=>Cxt(E,t));if(y.useLayoutEffect(()=>{if(!(r!=="auto"||!f||P0e(s)||y.isValidElement(s)||m==null)){var E=a.current;if(E){var j=E.getCalculatedWidth();Math.round(f.width)!==Math.round(j)&&u(VHn({id:t,width:j}))}}},[p,f,u,s,t,r,m]),f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,w=Tfe(e,YZn),{id:S,scale:_}=m,O=Tfe(m,XZn);return y.createElement(D0e,Cfe({},w,O,{ref:a,labelRef:i,x:h.x,y:h.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:Ha("recharts-".concat(d," ").concat(d),n),viewBox:o,ticks:p,axisType:d,axisId:t}))}var sGn={allowDataOverflow:Ll.allowDataOverflow,allowDecimals:Ll.allowDecimals,allowDuplicatedCategory:Ll.allowDuplicatedCategory,angle:Ll.angle,axisLine:ob.axisLine,hide:!1,includeHidden:Ll.includeHidden,interval:Ll.interval,label:!1,minTickGap:Ll.minTickGap,mirror:Ll.mirror,orientation:Ll.orientation,padding:Ll.padding,reversed:Ll.reversed,scale:Ll.scale,tick:Ll.tick,tickCount:Ll.tickCount,tickLine:ob.tickLine,tickSize:ob.tickSize,type:Ll.type,niceTicks:Ll.niceTicks,width:Ll.width,yAxisId:0},aGn=e=>{var t=nf(e,sGn);return y.createElement(y.Fragment,null,y.createElement(nGn,{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}),y.createElement(rGn,t))},vwt=y.memo(aGn,mwt);vwt.displayName="YAxis";var iGn=(e,t)=>t,z0e=tt([iGn,ko,zbt,pc,k0t,Qb,I7n,Lc],z7n);function oGn(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function F0e(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(oGn(e)){var s=e.currentTarget.getBBox();n=s.width>0?t.width/s.width:1,r=s.height>0?t.height/s.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var i=(o,c)=>({relativeX:Math.round((o-t.left)/n),relativeY:Math.round((c-t.top)/r)});return"touches"in e?Array.from(e.touches).map(o=>i(o.clientX,o.clientY)):i(e.clientX,e.clientY)}var ywt=fh("mouseClick"),bwt=w2();bwt.startListening({actionCreator:ywt,effect:(e,t)=>{var n=e.payload,r=z0e(t.getState(),F0e(n));r?.activeIndex!=null&&t.dispatch(_Un({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jfe=fh("mouseMove"),xwt=w2(),EO=null,_1=null,tK=null;xwt.startListening({actionCreator:jfe,effect:(e,t)=>{var n=e.payload,r=t.getState(),{throttleDelay:s,throttledEvents:a}=r.eventSettings,i=a==="all"||a?.includes("mousemove");EO!==null&&(cancelAnimationFrame(EO),EO=null),_1!==null&&(typeof s!="number"||!i)&&(clearTimeout(_1),_1=null),tK=F0e(n);var o=()=>{var c=t.getState(),u=k0e(c,c.tooltip.settings.shared);if(!tK){EO=null,_1=null;return}if(u==="axis"){var d=z0e(c,tK);d?.activeIndex!=null?t.dispatch(p0t({activeIndex:d.activeIndex,activeDataKey:void 0,activeCoordinate:d.activeCoordinate})):t.dispatch(h0t())}EO=null,_1=null};if(!i){o();return}s==="raf"?EO=requestAnimationFrame(o):typeof s=="number"&&_1===null&&(_1=setTimeout(o,s))}});function lGn(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 j5e={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},wwt=yu({name:"rootProps",initialState:j5e,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:j5e.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}}}),cGn=wwt.reducer,{updateOptions:uGn}=wwt.actions,dGn=null,fGn={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)},Swt=yu({name:"polarOptions",initialState:dGn,reducers:fGn}),{updatePolarOptions:bos}=Swt.actions,hGn=Swt.reducer,kwt=fh("keyDown"),_wt=fh("focus"),Owt=fh("blur"),xq=w2(),CO=null,O1=null,U3=null;xq.startListening({actionCreator:kwt,effect:(e,t)=>{U3=e.payload,CO!==null&&(cancelAnimationFrame(CO),CO=null);var n=t.getState(),{throttleDelay:r,throttledEvents:s}=n.eventSettings,a=s==="all"||s.includes("keydown");O1!==null&&(typeof r!="number"||!a)&&(clearTimeout(O1),O1=null);var i=()=>{try{var o=t.getState(),c=o.rootProps.accessibilityLayer!==!1;if(!c)return;var{keyboardInteraction:u}=o.tooltip,d=U3;if(d!=="ArrowRight"&&d!=="ArrowLeft"&&d!=="Enter")return;var f=_0e(u,Mj(o),R2(o),$2(o)),h=f==null?-1:Number(f);if(!Number.isFinite(h)||h<0)return;var p=Qb(o);if(d==="Enter"){var m=V9(o,"axis","hover",String(u.index));t.dispatch(q9({active:!u.active,activeIndex:u.index,activeCoordinate:m}));return}var g=pUn(o),v=g==="left-to-right"?1:-1,x=d==="ArrowRight"?1:-1,w=h+x*v;if(p==null||w>=p.length||w<0)return;var S=V9(o,"axis","hover",String(w));t.dispatch(q9({active:!0,activeIndex:w.toString(),activeCoordinate:S}))}finally{CO=null,O1=null}};if(!a){i();return}r==="raf"?CO=requestAnimationFrame(i):typeof r=="number"&&O1===null&&(i(),U3=null,O1=setTimeout(()=>{U3?i():(O1=null,CO=null)},r))}});xq.startListening({actionCreator:_wt,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:s}=n.tooltip;if(!s.active&&s.index==null){var a="0",i=V9(n,"axis","hover",String(a));t.dispatch(q9({active:!0,activeIndex:a,activeCoordinate:i}))}}}});xq.startListening({actionCreator:Owt,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:s}=n.tooltip;s.active&&t.dispatch(q9({active:!1,activeIndex:s.index,activeCoordinate:s.coordinate}))}}});function Ewt(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(n,r)=>{if(r==="currentTarget")return t;var s=Reflect.get(n,r);return typeof s=="function"?s.bind(n):s}})}var Kh=fh("externalEvent"),Cwt=w2(),q3=new Map,RA=new Map,nK=new Map;Cwt.startListening({actionCreator:Kh,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var s=r.type,a=Ewt(r);nK.set(s,{handler:n,reactEvent:a});var i=q3.get(s);i!==void 0&&(cancelAnimationFrame(i),q3.delete(s));var o=t.getState(),{throttleDelay:c,throttledEvents:u}=o.eventSettings,d=u,f=d==="all"||d?.includes(s),h=RA.get(s);h!==void 0&&(typeof c!="number"||!f)&&(clearTimeout(h),RA.delete(s));var p=()=>{var v=nK.get(s);try{if(!v)return;var{handler:x,reactEvent:w}=v,S=t.getState(),_={activeCoordinate:g7n(S),activeDataKey:h7n(S),activeIndex:XP(S),activeLabel:E0t(S),activeTooltipIndex:XP(S),isTooltipActive:v7n(S)};x&&x(_,w)}finally{q3.delete(s),RA.delete(s),nK.delete(s)}};if(!f){p();return}if(c==="raf"){var m=requestAnimationFrame(p);q3.set(s,m)}else if(typeof c=="number"){if(!RA.has(s)){p();var g=setTimeout(p,c);RA.set(s,g)}}else p()}}});var pGn=tt([Pj],e=>e.tooltipItemPayloads),mGn=tt([pGn,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:s}=r;if(s!=null)return s(t)}}}),Twt=fh("touchMove"),jwt=w2(),E1=null,Mx=null,N5e=null,PA=null;jwt.startListening({actionCreator:Twt,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){PA=Ewt(n);var r=t.getState(),{throttleDelay:s,throttledEvents:a}=r.eventSettings,i=a==="all"||a.includes("touchmove");E1!==null&&(cancelAnimationFrame(E1),E1=null),Mx!==null&&(typeof s!="number"||!i)&&(clearTimeout(Mx),Mx=null),N5e=Array.from(n.touches).map(c=>F0e({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var o=()=>{if(PA!=null){var c=t.getState(),u=k0e(c,c.tooltip.settings.shared);if(u==="axis"){var d,f=(d=N5e)===null||d===void 0?void 0:d[0];if(f==null){E1=null,Mx=null;return}var h=z0e(c,f);h?.activeIndex!=null&&t.dispatch(p0t({activeIndex:h.activeIndex,activeDataKey:void 0,activeCoordinate:h.activeCoordinate}))}else if(u==="item"){var p,m=PA.touches[0];if(document.elementFromPoint==null||m==null)return;var g=document.elementFromPoint(m.clientX,m.clientY);if(!g||!g.getAttribute)return;var v=g.getAttribute(V5n),x=(p=g.getAttribute(H5n))!==null&&p!==void 0?p:void 0,w=$j(c).find(O=>O.id===x);if(v==null||w==null||x==null)return;var{dataKey:S}=w,_=mGn(c,v,x);t.dispatch(kUn({activeDataKey:S,activeIndex:v,activeCoordinate:_,activeGraphicalItemId:x}))}E1=null,Mx=null}};if(!i){o();return}s==="raf"?E1=requestAnimationFrame(o):typeof s=="number"&&Mx===null&&(o(),PA=null,Mx=setTimeout(()=>{PA?o():(Mx=null,E1=null)},s))}}});var Nwt={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},Awt=yu({name:"eventSettings",initialState:Nwt,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:gGn}=Awt.actions,vGn=Awt.reducer,yGn=ogt({brush:tWn,cartesianAxis:HHn,chartData:vqn,errorBars:eZn,eventSettings:vGn,graphicalItems:SHn,layout:j5n,legend:D6n,options:fqn,polarAxis:UVn,polarOptions:hGn,referenceElements:aWn,renderedTicks:SWn,rootProps:cGn,tooltip:OUn,zIndex:J7n}),bGn=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return e5n({reducer:yGn,preloadedState:t,middleware:r=>{var s;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([bwt.middleware,xwt.middleware,xq.middleware,Cwt.middleware,jwt.middleware])},enhancers:r=>{var s=r;return typeof r=="function"&&(s=r()),s.concat(Nyt({type:"raf"}))},devTools:{serialize:{replacer:lGn},name:"recharts-".concat(n)}})};function xGn(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,s=rf(),a=y.useRef(null);if(s)return n;a.current==null&&(a.current=bGn(t,r));var i=xxe;return y.createElement(ggt,{context:i,store:a.current},n)}function wGn(e){var{layout:t,margin:n}=e,r=jl(),s=rf();return y.useEffect(()=>{s||(r(E5n(t)),r(O5n(n)))},[r,s,t,n]),null}var SGn=y.memo(wGn,rq);function kGn(e){var t=jl();return y.useEffect(()=>{t(uGn(e))},[t,e]),null}var _Gn=e=>{var t=jl();return y.useEffect(()=>{t(gGn(e))},[t,e]),null},OGn=y.memo(_Gn,rq);function A5e(e){var{zIndex:t,isPanorama:n}=e,r=y.useRef(null),s=jl();return y.useLayoutEffect(()=>(r.current&&s(X7n({zIndex:t,element:r.current,isPanorama:n})),()=>{s(K7n({zIndex:t,isPanorama:n}))}),[s,t,n]),y.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(t)})}function I5e(e){var{children:t,isPanorama:n}=e,r=pr(B7n);if(!r||r.length===0)return t;var s=r.filter(i=>i<0),a=r.filter(i=>i>0);return y.createElement(y.Fragment,null,s.map(i=>y.createElement(A5e,{key:i,zIndex:i,isPanorama:n})),t,a.map(i=>y.createElement(A5e,{key:i,zIndex:i,isPanorama:n})))}var EGn=["children"];function CGn(e,t){if(e==null)return{};var n,r,s=TGn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function TGn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Y9(){return Y9=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y9.apply(null,arguments)}var jGn={width:"100%",height:"100%",display:"block"},NGn=y.forwardRef((e,t)=>{var n=Jyt(),r=ebt(),s=dbt();if(!_v(n)||!_v(r))return null;var{children:a,otherAttributes:i,title:o,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),y.createElement(Mvt,Y9({},i,{title:o,desc:c,role:d,tabIndex:u,width:n,height:r,style:jGn,ref:t}),a)}),AGn=e=>{var{children:t}=e,n=pr(K7);if(!n)return null;var{width:r,height:s,y:a,x:i}=n;return y.createElement(Mvt,{width:r,height:s,x:i,y:a},t)},R5e=y.forwardRef((e,t)=>{var{children:n}=e,r=CGn(e,EGn),s=rf();return s?y.createElement(AGn,null,y.createElement(I5e,{isPanorama:!0},n)):y.createElement(NGn,Y9({ref:t},r),y.createElement(I5e,{isPanorama:!1},n))});function IGn(){var e=jl(),[t,n]=y.useState(null),r=pr(q5n);return y.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),a=s.width/t.offsetWidth;ua(a)&&a!==r&&e(T5n(a))}},[t,e,r]),n}function P5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function RGn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?P5e(Object(n),!0).forEach(function(r){PGn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PGn(e,t,n){return(t=$Gn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $Gn(e){var t=MGn(e,"string");return typeof t=="symbol"?t:t+""}function MGn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function j0(){return j0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j0.apply(null,arguments)}var DGn=()=>(Eqn(),null);function X9(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var LGn=y.forwardRef((e,t)=>{var n,r,s=y.useRef(null),[a,i]=y.useState({containerWidth:X9((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:X9((r=e.style)===null||r===void 0?void 0:r.height)}),o=y.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=y.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();o(d,f);var h=m=>{var g=m[0];if(g!=null){var{width:v,height:x}=g.contentRect;o(v,x)}},p=new ResizeObserver(h);p.observe(u),s.current=p}},[t,o]);return y.useEffect(()=>()=>{var u=s.current;u?.disconnect()},[o]),y.createElement(y.Fragment,null,y.createElement(k2,{width:a.containerWidth,height:a.containerHeight}),y.createElement("div",j0({ref:c},e)))}),zGn=y.forwardRef((e,t)=>{var{width:n,height:r}=e,[s,a]=y.useState({containerWidth:X9(n),containerHeight:X9(r)}),i=y.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}})},[]),o=y.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();i(u,d)}},[t,i]);return y.createElement(y.Fragment,null,y.createElement(k2,{width:s.containerWidth,height:s.containerHeight}),y.createElement("div",j0({ref:o},e)))}),FGn=y.forwardRef((e,t)=>{var{width:n,height:r}=e;return y.createElement(y.Fragment,null,y.createElement(k2,{width:n,height:r}),y.createElement("div",j0({ref:t},e)))}),BGn=y.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?y.createElement(zGn,j0({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?y.createElement(FGn,j0({},e,{width:n,height:r,ref:t})):y.createElement(y.Fragment,null,y.createElement(k2,{width:n,height:r}),y.createElement("div",j0({ref:t},e)))});function UGn(e){return e?LGn:BGn}var qGn=y.forwardRef((e,t)=>{var{children:n,className:r,height:s,onClick:a,onContextMenu:i,onDoubleClick:o,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:h,onTouchEnd:p,onTouchMove:m,onTouchStart:g,style:v,width:x,responsive:w,dispatchTouchEvents:S=!0}=e,_=y.useRef(null),O=jl(),[E,j]=y.useState(null),[T,N]=y.useState(null),I=IGn(),P=Exe(),R=P?.width>0?P.width:x,F=P?.height>0?P.height:s,M=y.useCallback(ae=>{I(ae),typeof t=="function"&&t(ae),j(ae),N(ae),ae!=null&&(_.current=ae)},[I,t,j,N]),L=y.useCallback(ae=>{O(ywt(ae)),O(Kh({handler:a,reactEvent:ae}))},[O,a]),U=y.useCallback(ae=>{O(jfe(ae)),O(Kh({handler:u,reactEvent:ae}))},[O,u]),z=y.useCallback(ae=>{O(h0t()),O(Kh({handler:d,reactEvent:ae}))},[O,d]),q=y.useCallback(ae=>{O(jfe(ae)),O(Kh({handler:f,reactEvent:ae}))},[O,f]),W=y.useCallback(()=>{O(_wt())},[O]),D=y.useCallback(()=>{O(Owt())},[O]),Q=y.useCallback(ae=>{O(kwt(ae.key))},[O]),V=y.useCallback(ae=>{O(Kh({handler:i,reactEvent:ae}))},[O,i]),$=y.useCallback(ae=>{O(Kh({handler:o,reactEvent:ae}))},[O,o]),Z=y.useCallback(ae=>{O(Kh({handler:c,reactEvent:ae}))},[O,c]),G=y.useCallback(ae=>{O(Kh({handler:h,reactEvent:ae}))},[O,h]),J=y.useCallback(ae=>{O(Kh({handler:g,reactEvent:ae}))},[O,g]),ie=y.useCallback(ae=>{S&&O(Twt(ae)),O(Kh({handler:m,reactEvent:ae}))},[O,S,m]),ne=y.useCallback(ae=>{O(Kh({handler:p,reactEvent:ae}))},[O,p]),te=UGn(w);return y.createElement(R0t.Provider,{value:E},y.createElement(KLn.Provider,{value:T},y.createElement(te,{width:R??v?.width,height:F??v?.height,className:Ha("recharts-wrapper",r),style:RGn({position:"relative",cursor:"default",width:R,height:F},v),onClick:L,onContextMenu:V,onDoubleClick:$,onFocus:W,onBlur:D,onKeyDown:Q,onMouseDown:Z,onMouseEnter:U,onMouseLeave:z,onMouseMove:q,onMouseUp:G,onTouchEnd:ne,onTouchMove:ie,onTouchStart:J,ref:M},y.createElement(DGn,null),n)))}),VGn=["width","height","responsive","children","className","style","compact","title","desc"];function HGn(e,t){if(e==null)return{};var n,r,s=WGn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function WGn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ZGn=y.forwardRef((e,t)=>{var{width:n,height:r,responsive:s,children:a,className:i,style:o,compact:c,title:u,desc:d}=e,f=HGn(e,VGn),h=Sv(f);return c?y.createElement(y.Fragment,null,y.createElement(k2,{width:n,height:r}),y.createElement(R5e,{otherAttributes:h,title:u,desc:d},a)):y.createElement(qGn,{className:i,style:o,width:n,height:r,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},y.createElement(R5e,{otherAttributes:h,title:u,desc:d,ref:t},y.createElement(oWn,null,a)))});function Nfe(){return Nfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nfe.apply(null,arguments)}function $5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function GGn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$5e(Object(n),!0).forEach(function(r){QGn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$5e(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QGn(e,t,n){return(t=YGn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YGn(e){var t=XGn(e,"string");return typeof t=="symbol"?t:t+""}function XGn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var KGn={top:5,right:5,bottom:5,left:5},JGn=GGn({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:KGn,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Nwt),eQn=y.forwardRef(function(t,n){var r,s=nf(t.categoricalChartProps,JGn),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:o,tooltipPayloadSearcher:c,categoricalChartProps:u}=t,d={chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:o,tooltipPayloadSearcher:c,eventEmitter:void 0};return y.createElement(xGn,{preloadedState:{options:d},reduxStoreName:(r=u.id)!==null&&r!==void 0?r:a},y.createElement(eWn,{chartData:u.data}),y.createElement(SGn,{layout:s.layout,margin:s.margin}),y.createElement(OGn,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),y.createElement(kGn,{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}),y.createElement(ZGn,Nfe({},s,{ref:n})))}),tQn=["axis"],nQn=y.forwardRef((e,t)=>y.createElement(eQn,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:tQn,tooltipPayloadSearcher:uqn,categoricalChartProps:e,ref:t}));function rQn(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function sQn(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function aQn(e){return e/100*window.innerHeight}function iQn(e){return e/100*window.innerWidth}function oQn(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 OI({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,a]=oQn(n);switch(a){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=sQn(t,s);break}case"em":{r=rQn(t,s);break}case"vh":{r=aQn(s);break}case"vw":{r=iQn(s);break}}return r}function $d(e){return parseFloat(e.toFixed(3))}function mT({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function Afe(e){const{panels:t}=e,n=mT({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:a}=r;let i=0;if(a.collapsedSize!==void 0){const d=OI({groupSize:n,panelElement:s,styleProp:a.collapsedSize});i=$d(d/n*100)}let o;if(a.defaultSize!==void 0){const d=OI({groupSize:n,panelElement:s,styleProp:a.defaultSize});o=$d(d/n*100)}let c=0;if(a.minSize!==void 0){const d=OI({groupSize:n,panelElement:s,styleProp:a.minSize});c=$d(d/n*100)}let u=100;if(a.maxSize!==void 0){const d=OI({groupSize:n,panelElement:s,styleProp:a.maxSize});u=$d(d/n*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:a.collapsible===!0,defaultSize:o,disabled:a.disabled,minSize:c,maxSize:u,panelId:r.id}})}function Xa(e,t="Assertion error"){if(!e)throw Error(t)}function Ife(e,t){return Array.from(t).sort(e==="horizontal"?lQn:cQn)}function lQn(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function cQn(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Iwt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Rwt(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 uQn({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,a=Number.MAX_VALUE;for(const i of t){const{x:o,y:c}=Rwt(r,i),u=e==="horizontal"?o:c;u<a&&(a=u,s=i)}return Xa(s,"No rect found"),s}let V3;function dQn(){return V3===void 0&&(typeof matchMedia=="function"?V3=!!matchMedia("(pointer:coarse)").matches:V3=!1),V3}function Pwt(e){const{element:t,orientation:n,panels:r,separators:s}=e,a=Ife(n,Array.from(t.children).filter(Iwt).map(m=>({element:m}))).map(({element:m})=>m),i=[];let o=!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 v=r.find(x=>x.element===g);if(v){if(h){const x=h.element.getBoundingClientRect(),w=g.getBoundingClientRect();let S;if(c){const _=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),O=n==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(p.length){case 0:{S=[_,O];break}case 1:{const E=p[0],j=uQn({orientation:n,rects:[x,w],targetRect:E.element.getBoundingClientRect()});S=[E,j===x?O:_];break}default:{S=p;break}}}else p.length?S=p:S=[n==="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 _ of S){let O="width"in _?_:_.element.getBoundingClientRect();const E=dQn()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(O.width<E){const T=E-O.width;O=new DOMRect(O.x-T/2,O.y,O.width+T,O.height)}if(O.height<E){const T=E-O.height;O=new DOMRect(O.x,O.y-T/2,O.width,O.height+T)}const j=m<=u||m>d;!o&&!j&&i.push({group:e,groupSize:mT({group:e}),panels:[h,v],separator:"width"in _?void 0:_,rect:O}),o=!1}}c=!1,h=v,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(o=!0);const v=s.find(x=>x.element===g);v?p.push(v):(h=void 0,p=[])}else c=!0}return i}let $wt=class{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,a=null;const i=Array.from(r);for(let o=0;o<i.length;o++){const c=i[o];try{c.call(null,n)}catch(u){a===null&&(s=!0,a=u)}}if(s)throw a}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}},rv=new Map;const Mwt=new $wt;function fQn(e){rv=new Map(rv),rv.delete(e)}function M5e(e,t){for(const[n]of rv)if(n.id===e)return n}function N0(e,t){for(const[n,r]of rv)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function v_(){return rv}function B0e(e,t){return Mwt.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Cb(e,t){const n=rv.get(e);rv=new Map(rv),rv.set(e,t),Mwt.emit("groupChange",{group:e,prev:n,next:t})}function hQn(e,t,n){let r,s={x:1/0,y:1/0};for(const a of t){const i=Rwt(n,a.rect);switch(e){case"horizontal":{i.x<=s.x&&(r=a,s=i);break}case"vertical":{i.y<=s.y&&(r=a,s=i);break}}}return r?{distance:s,hitRegion:r}:void 0}function pQn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function mQn(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:z5e(e),b:z5e(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Xa(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:L5e(D5e(n.a)),b:L5e(D5e(n.b))};if(s.a===s.b){const a=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let o=a.length;for(;o--;){const c=a[o];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(s.a-s.b)}const gQn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function vQn(e){const t=getComputedStyle(Dwt(e)??e).display;return t==="flex"||t==="inline-flex"}function yQn(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||vQn(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"||gQn.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function D5e(e){let t=e.length;for(;t--;){const n=e[t];if(Xa(n,"Missing node"),yQn(n))return n}return null}function L5e(e){return e&&Number(getComputedStyle(e).zIndex)||0}function z5e(e){const t=[];for(;e;)t.push(e),e=Dwt(e);return t}function Dwt(e){const{parentNode:t}=e;return pQn(t)?t.host:t}function bQn(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 xQn({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Iwt(n)||n.contains(e)||e.contains(n))return!0;if(mQn(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(bQn(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function U0e(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const a=Pwt(s),i=hQn(s.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&xQn({groupElement:s.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&n.push(i.hitRegion)}),n}function wQn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Fu(e,t,n=0){return Math.abs($d(e)-$d(t))<=n}function Ag(e,t){return Fu(e,t)?0:e>t?1:-1}function _E({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:a,disabled:i,maxSize:o=100,minSize:c=0}=t;if(i&&!e)return n;if(Ag(r,c)<0)if(a){const u=(s+c)/2;Ag(r,u)<0?r=s:r=c}else r=c;return r=Math.min(o,r),r=$d(r),r}function t$({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:a}){if(Fu(e,0))return t;const i=a==="imperative-api",o=Object.values(t),c=Object.values(s),u=[...o],[d,f]=r;Xa(d!=null,"Invalid first pivot index"),Xa(f!=null,"Invalid second pivot index");let h=0;switch(a){case"keyboard":{{const g=e<0?f:d,v=n[g];Xa(v,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:S=0}=v;if(w){const _=o[g];if(Xa(_!=null,`Previous layout not found for panel index ${g}`),Fu(_,x)){const O=S-_;Ag(O,Math.abs(e))>0&&(e=e<0?0-O:O)}}}{const g=e<0?d:f,v=n[g];Xa(v,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:S=0}=v;if(w){const _=o[g];if(Xa(_!=null,`Previous layout not found for panel index ${g}`),Fu(_,S)){const O=_-x;Ag(O,Math.abs(e))>0&&(e=e<0?0-O:O)}}}break}default:{const g=e<0?f:d,v=n[g];Xa(v,`Panel constraints not found for index ${g}`);const x=o[g],{collapsible:w,collapsedSize:S,minSize:_}=v;if(w&&Ag(x,_)<0)if(e>0){const O=_-S,E=O/2,j=x+e;Ag(j,_)<0&&(e=Ag(e,E)<=0?0:O)}else{const O=_-S,E=100-O/2,j=x-e;Ag(j,_)<0&&(e=Ag(100+e,E)>0?0:-O)}break}}{const g=e<0?1:-1;let v=e<0?f:d,x=0;for(;;){const S=o[v];Xa(S!=null,`Previous layout not found for panel index ${v}`);const _=_E({overrideDisabledPanels:i,panelConstraints:n[v],prevSize:S,size:100})-S;if(x+=_,v+=g,v<0||v>=n.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<n.length;){const v=Math.abs(e)-Math.abs(h),x=o[g];Xa(x!=null,`Previous layout not found for panel index ${g}`);const w=x-v,S=_E({overrideDisabledPanels:i,panelConstraints:n[g],prevSize:x,size:w});if(!Fu(x,S)&&(h+=x-S,u[g]=S,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(wQn(c,u))return s;{const g=e<0?f:d,v=o[g];Xa(v!=null,`Previous layout not found for panel index ${g}`);const x=v+h,w=_E({overrideDisabledPanels:i,panelConstraints:n[g],prevSize:v,size:x});if(u[g]=w,!Fu(w,x)){let S=x-w,_=e<0?f:d;for(;_>=0&&_<n.length;){const O=u[_];Xa(O!=null,`Previous layout not found for panel index ${_}`);const E=O+S,j=_E({overrideDisabledPanels:i,panelConstraints:n[_],prevSize:O,size:E});if(Fu(O,j)||(S-=j-O,u[_]=j),Fu(S,0))break;e>0?_--:_++}}}const p=Object.values(u).reduce((g,v)=>v+g,0);if(!Fu(p,100,.1))return s;const m=Object.keys(s);return u.reduce((g,v,x)=>(g[m[x]]=v,g),{})}function Ok(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Ag(e[n],t[n])!==0)return!1;return!0}function Ek({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((o,c)=>o+c,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(o=>`${o}%`).join(", ")}`);if(!Fu(s,100)&&r.length>0)for(let o=0;o<t.length;o++){const c=r[o];Xa(c!=null,`No layout data found for index ${o}`);const u=100/s*c;r[o]=u}let a=0;for(let o=0;o<t.length;o++){const c=n[o];Xa(c!=null,`No layout data found for index ${o}`);const u=r[o];Xa(u!=null,`No layout data found for index ${o}`);const d=_E({overrideDisabledPanels:!0,panelConstraints:t[o],prevSize:c,size:u});u!=d&&(a+=u-d,r[o]=d)}if(!Fu(a,0))for(let o=0;o<t.length;o++){const c=r[o];Xa(c!=null,`No layout data found for index ${o}`);const u=c+a,d=_E({overrideDisabledPanels:!0,panelConstraints:t[o],prevSize:c,size:u});if(c!==d&&(a-=d-c,r[o]=d,Fu(a,0)))break}const i=Object.keys(e);return r.reduce((o,c,u)=>(o[i[u]]=c,o),{})}function Lwt({groupId:e,panelId:t}){const n=()=>{const o=v_();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:h,separatorToPanels:p}]of o)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:h,layout:f,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(c=>c.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const o=n().group.panels.find(c=>c.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},i=o=>{const c=a();if(o===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:h,layout:p,separatorToPanels:m}=n(),g=f.panels.findIndex(S=>S.id===t),v=g===f.panels.length-1,x=t$({delta:v?c-o:o-c,initialLayout:p,panelConstraints:d,pivotIndices:v?[g-1,g]:[g,g+1],prevLayout:p,trigger:"imperative-api"}),w=Ek({layout:x,panelConstraints:d});Ok(p,w)||Cb(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:h,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:o,collapsedSize:c}=r(),{mutableValues:u}=s(),d=a();o&&d!==c&&(u.expandToSize=d,i(c))},expand:()=>{const{collapsible:o,collapsedSize:c,minSize:u}=r(),{mutableValues:d}=s(),f=a();if(o&&f===c){let h=d.expandToSize??u;h===0&&(h=1),i(h)}},getSize:()=>{const{group:o}=n(),c=a(),{element:u}=s(),d=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:o,collapsedSize:c}=r(),u=a();return o&&Fu(c,u)},resize:o=>{const{group:c}=n(),{element:u}=s(),d=mT({group:c}),f=OI({groupSize:d,panelElement:u,styleProp:o}),h=$d(f/d*100);i(h)}}}function F5e(e){if(e.defaultPrevented)return;const t=v_();U0e(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,a=Lwt({groupId:n.group.id,panelId:r.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function F6(e){const t=v_();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function zwt({groupId:e}){const t=()=>{const n=v_();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:a,groupSize:i,layout:o,separatorToPanels:c}=t(),u=Ek({layout:n,panelConstraints:s});return r?o:(Ok(o,u)||Cb(a,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:i,layout:u,separatorToPanels:c}),u)}}}function C1(e,t){const n=F6(e),r=N0(n.id,!0),s=n.separators.find(d=>d.element===e);Xa(s,"Matching separator not found");const a=r.separatorToPanels.get(s);Xa(a,"Matching panels not found");const i=a.map(d=>n.panels.indexOf(d)),o=zwt({groupId:n.id}).getLayout(),c=t$({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:i,prevLayout:o,trigger:"keyboard"}),u=Ek({layout:c,panelConstraints:r.derivedPanelConstraints});Ok(o,u)||Cb(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:u,separatorToPanels:r.separatorToPanels})}function B5e(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=F6(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&C1(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&C1(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&C1(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&C1(t,-5);break}case"End":{e.preventDefault(),C1(t,100);break}case"Enter":{e.preventDefault();const r=F6(t),s=N0(r.id,!0),{derivedPanelConstraints:a,layout:i,separatorToPanels:o}=s,c=r.separators.find(h=>h.element===t);Xa(c,"Matching separator not found");const u=o.get(c);Xa(u,"Matching panels not found");const d=u[0],f=a.find(h=>h.panelId===d.id);if(Xa(f,"Panel metadata not found"),f.collapsible){const h=i[d.id],p=f.collapsedSize===h?r.mutableState.expandedPanelSizes[d.id]??f.minSize:f.collapsedSize;C1(t,p-h)}break}case"F6":{e.preventDefault();const r=F6(t).separators.map(i=>i.element),s=Array.from(r).findIndex(i=>i===e.currentTarget);Xa(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),C1(t,-100);break}}}let uC={cursorFlags:0,state:"inactive"};const q0e=new $wt;function Ck(){return uC}function SQn(e){return q0e.addListener("change",e)}function kQn(e){const t=uC,n={...uC};n.cursorFlags=e,uC=n,q0e.emit("change",{prev:t,next:n})}function dC(e){const t=uC;uC=e,q0e.emit("change",{prev:t,next:e})}function U5e(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=v_(),n=U0e(e,t),r=new Map;let s=!1;n.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const i=t.get(a.group);i&&r.set(a.group,i.layout)}),dC({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const _Qn=e=>e,rK=()=>{},Fwt=1,Bwt=2,Uwt=4,qwt=8,q5e=3,V5e=12;let H3;function H5e(){return H3===void 0&&(H3=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(H3=!0)),H3}function OQn({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&H5e()){const a=(e&Fwt)!==0,i=(e&Bwt)!==0,o=(e&Uwt)!==0,c=(e&qwt)!==0;if(a)return o?"se-resize":c?"ne-resize":"e-resize";if(i)return o?"sw-resize":c?"nw-resize":"w-resize";if(o)return"s-resize";if(c)return"n-resize"}break}}return H5e()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const W5e=new WeakMap;function V0e(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=W5e.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=Ck();switch(r.state){case"active":case"hover":{const s=OQn({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(i=>i.group),state:r.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}W5e.set(e,{prevStyle:t,styleSheet:n})}function Vwt({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:i}){let o=0;n.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 v=r.get(d),x=s.get(d);if(!v||!x)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:_,layout:O,separatorToPanels:E}=x;if(S&&O&&E){const j=t$({delta:g,initialLayout:v,panelConstraints:S,pivotIndices:u.panels.map(T=>p.indexOf(T)),prevLayout:O,trigger:"mouse-or-touch"});if(Ok(j,O)){if(g!==0&&!m)switch(h){case"horizontal":{o|=g<0?Fwt:Bwt;break}case"vertical":{o|=g<0?Uwt:qwt;break}}}else Cb(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:_,layout:j,separatorToPanels:E})}});let c=0;t.movementX===0?c|=i&q5e:c|=o&q5e,t.movementY===0?c|=i&V5e:c|=o&V5e,kQn(c),V0e(e)}function Z5e(e){const t=v_(),n=Ck();n.state==="active"&&Vwt({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function G5e(e){if(e.defaultPrevented)return;const t=Ck(),n=v_();switch(t.state){case"active":{if(e.buttons===0){dC({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=N0(r.group.id,!0);Cb(r.group,s)});return}Vwt({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=U0e(e,n);r.length===0?t.state!=="inactive"&&dC({cursorFlags:0,state:"inactive"}):dC({cursorFlags:0,hitRegions:r,state:"hover"}),V0e(e.currentTarget);break}}}function Q5e(e){e.relatedTarget instanceof HTMLIFrameElement&&Ck().state==="hover"&&dC({cursorFlags:0,state:"inactive"})}function Y5e(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Ck();t.state==="active"&&(dC({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(V0e(e.currentTarget),t.hitRegions.forEach(n=>{const r=N0(n.group.id,!0);Cb(n.group,r)}),e.preventDefault()))}function X5e(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const i=$d(a.defaultSize);n+=i,r[a.panelId]=i}else r[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=$d((100-n)/s);for(const i of e)i.defaultSize===void 0&&(r[i.panelId]=a)}return r}function EQn(e,t,n){if(!n[0])return;const r=e.panels.find(c=>c.element===t);if(!r||!r.onResize)return;const s=mT({group:e}),a=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i=r.mutableValues.prevSize,o={asPercentage:$d(a/s*100),inPixels:a};r.mutableValues.prevSize=o,r.onResize(o,r.id,i)}function CQn(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function TQn({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,a=0,i=!1;const o=new Map,c=[];for(const f of e.panels){const h=r[f.id]??0;if(f.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){i=!0;const p=h/100*n,m=$d(p/t*100);o.set(f.id,m),s+=m}else c.push(f.id),a+=h}if(!i||c.length===0)return r;const u=100-s,d={...r};if(o.forEach((f,h)=>{d[h]=f}),a>0)for(const f of c){const h=r[f]??0;d[f]=$d(h/a*u)}else{const f=$d(u/c.length);for(const h of c)d[h]=f}return d}function jQn(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const TO=new Map;function NQn(e){let t=!0;Xa(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,a=new n(m=>{for(const g of m){const{borderBoxSize:v,target:x}=g;if(x===e.element){if(t){const w=mT({group:e});if(w===0)return;const S=N0(e.id);if(!S)return;const _=Afe(e),O=S.defaultLayoutDeferred?X5e(_):S.layout,E=TQn({group:e,nextGroupSize:w,prevGroupSize:S.groupSize,prevLayout:O}),j=Ek({layout:E,panelConstraints:_});if(!S.defaultLayoutDeferred&&Ok(S.layout,j)&&CQn(S.derivedPanelConstraints,_)&&S.groupSize===w)return;Cb(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:_,groupSize:w,layout:j,separatorToPanels:S.separatorToPanels})}}else EQn(e,x,v)}});a.observe(e.element),e.panels.forEach(m=>{Xa(!r.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.onResize&&a.observe(m.element)});const i=mT({group:e}),o=Afe(e),c=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(jQn(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[c]??u??X5e(o),f=Ek({layout:d,panelConstraints:o}),h=e.element.ownerDocument;TO.set(h,(TO.get(h)??0)+1);const p=new Map;return Pwt(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Cb(e,{defaultLayoutDeferred:i===0,derivedPanelConstraints:o,groupSize:i,layout:f,separatorToPanels:p}),e.separators.forEach(m=>{Xa(!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",B5e)}),TO.get(h)===1&&(h.addEventListener("dblclick",F5e,!0),h.addEventListener("pointerdown",U5e,!0),h.addEventListener("pointerleave",Z5e),h.addEventListener("pointermove",G5e),h.addEventListener("pointerout",Q5e),h.addEventListener("pointerup",Y5e,!0)),function(){t=!1,TO.set(h,Math.max(0,(TO.get(h)??0)-1)),fQn(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",B5e)}),TO.get(h)||(h.removeEventListener("dblclick",F5e,!0),h.removeEventListener("pointerdown",U5e,!0),h.removeEventListener("pointerleave",Z5e),h.removeEventListener("pointermove",G5e),h.removeEventListener("pointerout",Q5e),h.removeEventListener("pointerup",Y5e,!0)),a.disconnect()}}function AQn(){const[e,t]=y.useState({}),n=y.useCallback(()=>t({}),[]);return[e,n]}function H0e(e){const t=y.useId();return`${e??t}`}const y_=typeof window<"u"?y.useLayoutEffect:y.useEffect;function pR(e){const t=y.useRef(e);return y_(()=>{t.current=e},[e]),y.useCallback((...n)=>t.current?.(...n),[t])}function W0e(...e){return pR(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Z0e(e){const t=y.useRef({...e});return y_(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Hwt=y.createContext(null);function IQn(e,t){const n=y.useRef({getLayout:()=>({}),setLayout:_Qn});y.useImperativeHandle(t,()=>n.current,[]),y_(()=>{Object.assign(n.current,zwt({groupId:e}))})}function wq({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:a,groupRef:i,id:o,onLayoutChange:c,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:f={coarse:20,fine:10},style:h,...p}){const m=y.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=pR(P=>{Ok(m.current.onLayoutChange,P)||(m.current.onLayoutChange=P,c?.(P))}),v=pR(P=>{Ok(m.current.onLayoutChanged,P)||(m.current.onLayoutChanged=P,u?.(P))}),x=H0e(o),w=y.useRef(null),[S,_]=AQn(),O=y.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:f,separators:[]}),E=W0e(w,a);IQn(x,i);const j=pR((P,R)=>{const F=Ck(),M=M5e(P),L=N0(P);if(L){let U=!1;return F.state==="active"&&(U=F.hitRegions.some(z=>z.group===M)),{flexGrow:L.layout[R]??1,pointerEvents:U?"none":void 0}}return{flexGrow:n?.[R]??1}}),T=Z0e({defaultLayout:n,disableCursor:r}),N=y.useMemo(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:j,id:x,orientation:d,registerPanel:P=>{const R=O.current;return R.panels=Ife(d,[...R.panels,P]),_(),()=>{R.panels=R.panels.filter(F=>F!==P),_()}},registerSeparator:P=>{const R=O.current;return R.separators=Ife(d,[...R.separators,P]),_(),()=>{R.separators=R.separators.filter(F=>F!==P),_()}},togglePanelDisabled:(P,R)=>{const F=O.current.panels.find(U=>U.id===P);F&&(F.panelConstraints.disabled=R);const M=M5e(x),L=N0(x);M&&L&&Cb(M,{...L,derivedPanelConstraints:Afe(M)})},toggleSeparatorDisabled:(P,R)=>{const F=O.current.separators.find(M=>M.id===P);F&&(F.disabled=R)}}),[j,x,_,d,T]),I=y.useRef(null);return y_(()=>{const P=w.current;if(P===null)return;const R=O.current;let F;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===R.panels.length){F={};for(const D of R.panels){const Q=T.defaultLayout[D.id];Q!==void 0&&(F[D.id]=Q)}}const M={disabled:!!s,element:P,id:x,mutableState:{defaultLayout:F,disableCursor:!!T.disableCursor,expandedPanelSizes:O.current.lastExpandedPanelSizes,layouts:O.current.layouts},orientation:d,panels:R.panels,resizeTargetMinimumSize:R.resizeTargetMinimumSize,separators:R.separators};I.current=M;const L=NQn(M),{defaultLayoutDeferred:U,derivedPanelConstraints:z,layout:q}=N0(M.id,!0);!U&&z.length>0&&(g(q),v(q));const W=B0e(x,D=>{const{defaultLayoutDeferred:Q,derivedPanelConstraints:V,layout:$}=D.next;if(Q||V.length===0)return;const Z=M.panels.map(({id:J})=>J).join(",");M.mutableState.layouts[Z]=$,V.forEach(J=>{if(J.collapsible){const{layout:ie}=D.prev??{};if(ie){const ne=Fu(J.collapsedSize,$[J.panelId]),te=Fu(J.collapsedSize,ie[J.panelId]);ne&&!te&&(M.mutableState.expandedPanelSizes[J.panelId]=ie[J.panelId])}}});const G=Ck().state!=="active";g($),G&&v($)});return()=>{I.current=null,L(),W()}},[s,x,v,g,d,S,T]),y.useEffect(()=>{const P=I.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!r)}),l.jsx(Hwt.Provider,{value:N,children:l.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})})}wq.displayName="Group";function sK(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function G0e({debounceSaveMs:e=100,panelIds:t,storage:n=localStorage,...r}){const s=t!==void 0,a="id"in r?r.id:r.groupId,i=sK(a,t??[]),o=y.useSyncExternalStore(RQn,()=>n.getItem(i),()=>n.getItem(i)),c=y.useMemo(()=>o?JSON.parse(o):void 0,[o]),u=y.useRef(null),d=y.useCallback(()=>{const p=u.current;p&&(u.current=null,clearTimeout(p))},[]);y.useLayoutEffect(()=>()=>{d()},[d]);const f=y.useCallback(p=>{d();let m;s?m=sK(a,Object.keys(p)):m=sK(a,[]);try{n.setItem(m,JSON.stringify(p))}catch(g){console.error(g)}},[d,s,a,n]),h=y.useCallback(p=>{d(),e===0?f(p):u.current=setTimeout(()=>{f(p)},e)},[d,e,f]);return{defaultLayout:c,onLayoutChange:h,onLayoutChanged:f}}function RQn(){return function(){}}function Q0e(){const e=y.useContext(Hwt);return Xa(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function PQn(e,t){const{id:n}=Q0e(),r=y.useRef({collapse:rK,expand:rK,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:rK});y.useImperativeHandle(t,()=>r.current,[]),y_(()=>{Object.assign(r.current,Lwt({groupId:n,panelId:e}))})}function gT({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:a,elementRef:i,groupResizeBehavior:o="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:f,panelRef:h,style:p,...m}){const g=!!c,v=H0e(c),x=Z0e({disabled:a}),w=y.useRef(null),S=W0e(w,i),{getPanelStyles:_,id:O,orientation:E,registerPanel:j,togglePanelDisabled:T}=Q0e(),N=f!==null,I=pR((R,F,M)=>{f?.(R,c,M)});y_(()=>{const R=w.current;if(R!==null){const F={element:R,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?I:void 0,panelConstraints:{groupResizeBehavior:o,collapsedSize:n,collapsible:r,defaultSize:s,disabled:x.disabled,maxSize:u,minSize:d}};return j(F)}},[o,n,r,s,N,v,g,u,d,I,j,x]),y.useEffect(()=>{T(v,!!a)},[a,v,T]),PQn(v,h);const P=y.useSyncExternalStore(R=>B0e(O,R),()=>JSON.stringify(_(O,v)),()=>JSON.stringify(_(O,v)));return l.jsx("div",{...m,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":v,id:v,ref:S,style:{...$Qn,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:l.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}gT.displayName="Panel";const $Qn={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function MQn(){return y.useRef(null)}function DQn({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,a;const i=e[n],o=t.find(c=>c.panelId===n);if(o){const c=o.maxSize,u=o.collapsible?o.collapsedSize:o.minSize,d=[r,r+1];a=Ek({layout:t$({delta:u-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],s=Ek({layout:t$({delta:c-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:a,valueNow:i}}function Wwt({children:e,className:t,disabled:n,elementRef:r,id:s,style:a,...i}){const o=H0e(s),c=Z0e({disabled:n}),[u,d]=y.useState({}),[f,h]=y.useState("inactive"),p=y.useRef(null),m=W0e(p,r),{disableCursor:g,id:v,orientation:x,registerSeparator:w,toggleSeparatorDisabled:S}=Q0e(),_=x==="horizontal"?"vertical":"horizontal";y_(()=>{const E=p.current;if(E!==null){const j={disabled:c.disabled,element:E,id:o},T=w(j),N=SQn(P=>{h(P.next.state!=="inactive"&&P.next.hitRegions.some(R=>R.separator===j)?P.next.state:"inactive")}),I=B0e(v,P=>{const{derivedPanelConstraints:R,layout:F,separatorToPanels:M}=P.next,L=M.get(j);if(L){const U=L[0],z=L.indexOf(U);d(DQn({layout:F,panelConstraints:R,panelId:U.id,panelIndex:z}))}});return()=>{N(),I(),T()}}},[v,o,w,c]),y.useEffect(()=>{S(o,!!n)},[n,o,S]);let O;return n&&!g&&(O="not-allowed"),l.jsx("div",{...i,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":_,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?"disabled":f,"data-testid":o,id:o,ref:m,role:"separator",style:{flexBasis:"auto",cursor:O,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Wwt.displayName="Separator";const K5e=e=>{let t;const n=new Set,r=(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),n.forEach(p=>p(t,h))}},s=()=>t,o={setState:r,getState:s,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,s,o);return o},LQn=(e=>e?K5e(e):K5e),zQn=e=>e;function FQn(e,t=zQn){const n=_e.useSyncExternalStore(e.subscribe,_e.useCallback(()=>t(e.getState()),[e,t]),_e.useCallback(()=>t(e.getInitialState()),[e,t]));return _e.useDebugValue(n),n}const J5e=e=>{const t=LQn(e),n=r=>FQn(t,r);return Object.assign(n,t),n},Y0e=(e=>e?J5e(e):J5e);function BQn(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var a;const i=c=>c===null?null:JSON.parse(c,void 0),o=(a=n.getItem(s))!=null?a:null;return o instanceof Promise?o.then(i):i(o)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const Rfe=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Rfe(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Rfe(r)(n)}}}},UQn=(e,t)=>(n,r,s)=>{let a={storage:BQn(()=>window.localStorage),partialize:v=>v,version:0,merge:(v,x)=>({...x,...v}),...t},i=!1,o=0;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...v)},r,s);const f=()=>{const v=a.partialize({...r()});return d.setItem(a.name,{state:v,version:a.version})},h=s.setState;s.setState=(v,x)=>(h(v,x),f());const p=e((...v)=>(n(...v),f()),r,s);s.getInitialState=()=>p;let m;const g=()=>{var v,x;if(!d)return;const w=++o;i=!1,c.forEach(_=>{var O;return _((O=r())!=null?O:p)});const S=((x=a.onRehydrateStorage)==null?void 0:x.call(a,(v=r())!=null?v:p))||void 0;return Rfe(d.getItem.bind(d))(a.name).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==a.version){if(a.migrate){const O=a.migrate(_.state,_.version);return O instanceof Promise?O.then(E=>[!0,E]):[!0,O]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,_.state];return[!1,void 0]}).then(_=>{var O;if(w!==o)return;const[E,j]=_;if(m=a.merge(j,(O=r())!=null?O:p),n(m,!0),E)return f()}).then(()=>{w===o&&(S?.(r(),void 0),m=r(),i=!0,u.forEach(_=>_(m)))}).catch(_=>{w===o&&S?.(void 0,_)})};return s.persist={setOptions:v=>{a={...a,...v},v.storage&&(d=v.storage)},clearStorage:()=>{d?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>g(),hasHydrated:()=>i,onHydrate:v=>(c.add(v),()=>{c.delete(v)}),onFinishHydration:v=>(u.add(v),()=>{u.delete(v)})},a.skipHydration||g(),m||p},qQn=UQn;var b_=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},VQn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},HQn=class{#e=VQn;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},gS=new HQn;function WQn(e){setTimeout(e,0)}var Tk=typeof window>"u"||"Deno"in globalThis;function Yc(){}function ZQn(e,t){return typeof e=="function"?e(t):e}function Pfe(e){return typeof e=="number"&&e>=0&&e!==1/0}function Zwt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function A0(e,t){return typeof e=="function"?e(t):e}function ep(e,t){return typeof e=="function"?e(t):e}function e6e(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:i,stale:o}=e;if(i){if(r){if(t.queryHash!==X0e(i,t.options))return!1}else if(!n$(t.queryKey,i))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||a&&!a(t))}function t6e(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(jk(t.options.mutationKey)!==jk(a))return!1}else if(!n$(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function X0e(e,t){return(t?.queryKeyHashFn||jk)(e)}function jk(e){return JSON.stringify(e,(t,n)=>$fe(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function n$(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>n$(e[n],t[n])):!1}var GQn=Object.prototype.hasOwnProperty;function K0e(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=n6e(e)&&n6e(t);if(!r&&!($fe(e)&&$fe(t)))return t;const a=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),o=i.length,c=r?new Array(o):{};let u=0;for(let d=0;d<o;d++){const f=r?d:i[d],h=e[f],p=t[f];if(h===p){c[f]=h,(r?d<a:GQn.call(e,f))&&u++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){c[f]=p;continue}const m=K0e(h,p,n+1);c[f]=m,m===h&&u++}return a===o&&u===a?e:c}function r$(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function n6e(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function $fe(e){if(!r6e(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!r6e(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function r6e(e){return Object.prototype.toString.call(e)==="[object Object]"}function QQn(e){return new Promise(t=>{gS.setTimeout(t,e)})}function Mfe(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?K0e(e,t):t}function YQn(e){return e}function XQn(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function KQn(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var J0e=Symbol();function Gwt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===J0e?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ewe(e,t){return typeof e=="function"?e(...t):!!e}function JQn(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var eYn=class extends b_{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Tk&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},twe=new eYn;function Dfe(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var tYn=WQn;function nYn(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=tYn;const a=o=>{t?e.push(o):s(()=>{n(o)})},i=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(c=>{n(c)})})})};return{batch:o=>{let c;t++;try{c=o()}finally{t--,t||i()}return c},batchCalls:o=>(...c)=>{a(()=>{o(...c)})},schedule:a,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var Mo=nYn(),rYn=class extends b_{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Tk&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},K9=new rYn;function sYn(e){return Math.min(1e3*2**e,3e4)}function Qwt(e){return(e??"online")==="online"?K9.isOnline():!0}var Lfe=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ywt(e){let t=!1,n=0,r;const s=Dfe(),a=()=>s.status!=="pending",i=g=>{if(!a()){const v=new Lfe(g);h(v),e.onCancel?.(v)}},o=()=>{t=!0},c=()=>{t=!1},u=()=>twe.isFocused()&&(e.networkMode==="always"||K9.isOnline())&&e.canRun(),d=()=>Qwt(e.networkMode)&&e.canRun(),f=g=>{a()||(r?.(),s.resolve(g))},h=g=>{a()||(r?.(),s.reject(g))},p=()=>new Promise(g=>{r=v=>{(a()||u())&&g(v)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let g;const v=n===0?e.initialPromise:void 0;try{g=v??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(f).catch(x=>{if(a())return;const w=e.retry??(Tk?0:3),S=e.retryDelay??sYn,_=typeof S=="function"?S(n,x):S,O=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,x);if(t||!O){h(x);return}n++,e.onFail?.(n,x),QQn(_).then(()=>u()?void 0:p()).then(()=>{t?h(x):m()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r?.(),s),cancelRetry:o,continueRetry:c,canStart:d,start:()=>(d()?m():p().then(m),s)}}var Xwt=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pfe(this.gcTime)&&(this.#e=gS.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Tk?1/0:300*1e3))}clearGcTimeout(){this.#e&&(gS.clearTimeout(this.#e),this.#e=void 0)}},aYn=class extends Xwt{#e;#t;#n;#s;#r;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=a6e(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=a6e(this.options);t.data!==void 0&&(this.setState(s6e(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Mfe(this.state.data,e,this.options);return this.#i({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Yc).catch(Yc):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>ep(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===J0e||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>A0(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Zwt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const o=this.observers.find(c=>c.options.queryFn);o&&this.setOptions(o.options)}const n=new AbortController,r=o=>{Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const o=Gwt(this.options,t),u=(()=>{const d={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(d),d})();return this.#o=!1,this.options.persister?this.options.persister(o,u,this):o(u)},i=(()=>{const o={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(o),o})();this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#i({type:"fetch",meta:i.fetchOptions?.meta}),this.#r=Ywt({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:o=>{o instanceof Lfe&&o.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(o,c)=>{this.#i({type:"failed",failureCount:o,error:c})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const o=await this.#r.start();if(o===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(o),this.#n.config.onSuccess?.(o,this),this.#n.config.onSettled?.(o,this.state.error,this),o}catch(o){if(o instanceof Lfe){if(o.silent)return this.#r.promise;if(o.revert){if(this.state.data===void 0)throw o;return this.state.data}}throw this.#i({type:"error",error:o}),this.#n.config.onError?.(o,this),this.#n.config.onSettled?.(this.state.data,o,this),o}finally{this.scheduleGc()}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Kwt(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...s6e(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Mo.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Kwt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qwt(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function s6e(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function a6e(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Sq=class extends b_{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#o=Dfe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#a;#o;#i;#p;#d;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),i6e(this.#t,this.options)?this.#m():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zfe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zfe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ep(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!r$(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&o6e(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||ep(this.options.enabled,this.#t)!==ep(t.enabled,this.#t)||A0(this.options.staleTime,this.#t)!==A0(t.staleTime,this.#t))&&this.#g();const s=this.#v();r&&(this.#t!==n||ep(this.options.enabled,this.#t)!==ep(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return oYn(this,n)&&(this.#s=n,this.#a=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Yc)),t}#g(){this.#x();const e=A0(this.options.staleTime,this.#t);if(Tk||this.#s.isStale||!Pfe(e))return;const n=Zwt(this.#s.dataUpdatedAt,e)+1;this.#c=gS.setTimeout(()=>{this.#s.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(Tk||ep(this.options.enabled,this.#t)===!1||!Pfe(this.#l)||this.#l===0)&&(this.#u=gS.setInterval(()=>{(this.options.refetchIntervalInBackground||twe.isFocused())&&this.#m()},this.#l))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#c&&(gS.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(gS.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#s,a=this.#r,i=this.#a,c=e!==n?e.state:this.#n,{state:u}=e;let d={...u},f=!1,h;if(t._optimisticResults){const T=this.hasListeners(),N=!T&&i6e(e,t),I=T&&o6e(e,n,t,r);(N||I)&&(d={...d,...Kwt(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:g}=d;h=d.data;let v=!1;if(t.placeholderData!==void 0&&h===void 0&&g==="pending"){let T;s?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(T=s.data,v=!0):T=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,T!==void 0&&(g="success",h=Mfe(s?.data,T,t),f=!0)}if(t.select&&h!==void 0&&!v)if(s&&h===a?.data&&t.select===this.#p)h=this.#d;else try{this.#p=t.select,h=t.select(h),h=Mfe(s?.data,h,t),this.#d=h,this.#i=null}catch(T){this.#i=T}this.#i&&(p=this.#i,h=this.#d,m=Date.now(),g="error");const x=d.fetchStatus==="fetching",w=g==="pending",S=g==="error",_=w&&x,O=h!==void 0,j={status:g,fetchStatus:d.fetchStatus,isPending:w,isSuccess:g==="success",isError:S,isInitialLoading:_,isLoading:_,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:S&&!O,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&O,isStale:nwe(e,t),refetch:this.refetch,promise:this.#o,isEnabled:ep(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const T=j.data!==void 0,N=j.status==="error"&&!T,I=F=>{N?F.reject(j.error):T&&F.resolve(j.data)},P=()=>{const F=this.#o=j.promise=Dfe();I(F)},R=this.#o;switch(R.status){case"pending":e.queryHash===n.queryHash&&I(R);break;case"fulfilled":(N||j.data!==R.value)&&P();break;case"rejected":(!N||j.error!==R.reason)&&P();break}}return j}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#a=this.options,this.#r.data!==void 0&&(this.#f=this.#t),r$(t,e))return;this.#s=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#h.size)return!0;const a=new Set(s??this.#h);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(i=>{const o=i;return this.#s[o]!==e[o]&&a.has(o)})};this.#k({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){Mo.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function iYn(e,t){return ep(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function i6e(e,t){return iYn(e,t)||e.state.data!==void 0&&zfe(e,t,t.refetchOnMount)}function zfe(e,t,n){if(ep(t.enabled,e)!==!1&&A0(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&nwe(e,t)}return!1}function o6e(e,t,n,r){return(e!==t||ep(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&nwe(e,n)}function nwe(e,t){return ep(t.enabled,e)!==!1&&e.isStaleByTime(A0(t.staleTime,e))}function oYn(e,t){return!r$(e.getCurrentResult(),t)}function J9(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},c=0;const u=async()=>{let d=!1;const f=m=>{JQn(m,()=>t.signal,()=>d=!0)},h=Gwt(t.options,t.fetchOptions),p=async(m,g,v)=>{if(d)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);const w=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:g,direction:v?"backward":"forward",meta:t.options.meta};return f(E),E})(),S=await h(w),{maxPages:_}=t.options,O=v?KQn:XQn;return{pages:O(m.pages,S,_),pageParams:O(m.pageParams,g,_)}};if(s&&a.length){const m=s==="backward",g=m?Jwt:Ffe,v={pages:a,pageParams:i},x=g(r,v);o=await p(v,x,m)}else{const m=e??a.length;do{const g=c===0?i[0]??r.initialPageParam:Ffe(r,o);if(c>0&&g==null)break;o=await p(o,g),c++}while(c<m)}return o};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function Ffe(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Jwt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function lYn(e,t){return t?Ffe(e,t)!=null:!1}function cYn(e,t){return!t||!e.getPreviousPageParam?!1:Jwt(e,t)!=null}var uYn=class extends Sq{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:J9()})}getOptimisticResult(e){return e.behavior=J9(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:i,isRefetchError:o}=r,c=n.fetchMeta?.fetchMore?.direction,u=i&&c==="forward",d=s&&c==="forward",f=i&&c==="backward",h=s&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:lYn(t,n.data),hasPreviousPage:cYn(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:o&&!u&&!f,isRefetching:a&&!d&&!h}}},dYn=class extends Xwt{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||e1t(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=Ywt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(a,i)=>{this.#r({type:"failed",failureCount:a,error:i})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#s.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const i=await this.options.onMutate?.(e,n);i!==this.state.context&&this.#r({type:"pending",context:i,variables:e,isPaused:s})}const a=await this.#s.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#r({type:"success",data:a}),a}catch(a){try{await this.#n.config.onError?.(a,e,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onError?.(a,e,this.state.context,n)}catch(i){Promise.reject(i)}try{await this.#n.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,a,e,this.state.context,n)}catch(i){Promise.reject(i)}throw this.#r({type:"error",error:a}),a}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Mo.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function e1t(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fYn=class extends b_{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new dYn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=W3(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=W3(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=W3(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=W3(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Mo.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>t6e(t,n))}findAll(e={}){return this.getAll().filter(t=>t6e(e,t))}notify(e){Mo.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Mo.batch(()=>Promise.all(e.map(t=>t.continue().catch(Yc))))}};function W3(e){return e.options.scope?.id}var hYn=class extends b_{#e;#t=void 0;#n;#s;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),r$(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&jk(n.mutationKey)!==jk(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#a(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#a()}mutate(t,n){return this.#s=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??e1t();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Mo.batch(()=>{if(this.#s&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#s.onSuccess?.(t.data,n,r,s)}catch(a){Promise.reject(a)}try{this.#s.onSettled?.(t.data,null,n,r,s)}catch(a){Promise.reject(a)}}else if(t?.type==="error"){try{this.#s.onError?.(t.error,n,r,s)}catch(a){Promise.reject(a)}try{this.#s.onSettled?.(void 0,t.error,n,r,s)}catch(a){Promise.reject(a)}}}this.listeners.forEach(n=>{n(this.#t)})})}};function l6e(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function pYn(e,t,n){const r=e.slice(0);return r[t]=n,r}var mYn=class extends b_{#e;#t;#n;#s;#r;#a;#o;#i;#p;#d=[];constructor(e,t,n){super(),this.#e=e,this.#s=n,this.#n=[],this.#r=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#r.forEach(e=>{e.subscribe(t=>{this.#l(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#r.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#s=t,Mo.batch(()=>{const n=this.#r,r=this.#u(this.#n);r.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const s=r.map(d=>d.observer),a=s.map(d=>d.getCurrentResult()),i=n.length!==s.length,o=s.some((d,f)=>d!==n[f]),c=i||o,u=c?!0:a.some((d,f)=>{const h=this.#t[f];return!h||!r$(d,h)});!c&&!u||(c&&(this.#d=r,this.#r=s),this.#t=a,this.hasListeners()&&(c&&(l6e(n,s).forEach(d=>{d.destroy()}),l6e(s,n).forEach(d=>{d.subscribe(f=>{this.#l(d,f)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#r.map(e=>e.getCurrentQuery())}getObservers(){return this.#r}getOptimisticResult(e,t){const n=this.#u(e),r=n.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),s=n.map(a=>a.defaultedQueryOptions.queryHash);return[r,a=>this.#c(a??r,t,s),()=>this.#f(r,n)]}#f(e,t){return t.map((n,r)=>{const s=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?s:n.observer.trackResult(s,a=>{t.forEach(i=>{i.observer.trackProp(a)})})})}#c(e,t,n){if(t){const r=this.#p,s=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((a,i)=>a!==r[i]));return(!this.#a||this.#t!==this.#i||s||t!==this.#o)&&(this.#o=t,this.#i=this.#t,n!==void 0&&(this.#p=n),this.#a=K0e(this.#a,t(e))),this.#a}return e}#u(e){const t=new Map;this.#r.forEach(r=>{const s=r.options.queryHash;if(!s)return;const a=t.get(s);a?a.push(r):t.set(s,[r])});const n=[];return e.forEach(r=>{const s=this.#e.defaultQueryOptions(r),i=t.get(s.queryHash)?.shift()??new Sq(this.#e,s);n.push({defaultedQueryOptions:s,observer:i})}),n}#l(e,t){const n=this.#r.indexOf(e);n!==-1&&(this.#t=pYn(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){const e=this.#a,t=this.#f(this.#t,this.#d),n=this.#c(t,this.#s?.combine);e!==n&&Mo.batch(()=>{this.listeners.forEach(r=>{r(this.#t)})})}}},gYn=class extends b_{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??X0e(r,t);let a=this.get(s);return a||(a=new aYn({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Mo.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>e6e(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>e6e(e,n)):t}notify(e){Mo.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Mo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Mo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vYn=class{#e;#t;#n;#s;#r;#a;#o;#i;constructor(e={}){this.#e=e.queryCache||new gYn,this.#t=e.mutationCache||new fYn,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=twe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=K9.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(A0(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=this.#e.get(r.queryHash)?.state.data,i=ZQn(t,a);if(i!==void 0)return this.#e.build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Mo.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Mo.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Mo.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Mo.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Yc).catch(Yc)}invalidateQueries(e,t={}){return Mo.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Mo.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Yc)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Yc)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(A0(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yc).catch(Yc)}fetchInfiniteQuery(e){return e.behavior=J9(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yc).catch(Yc)}ensureInfiniteQueryData(e){return e.behavior=J9(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return K9.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(jk(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{n$(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(jk(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{n$(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=X0e(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===J0e&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},t1t=y.createContext(void 0),ha=e=>{const t=y.useContext(t1t);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yYn=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(t1t.Provider,{value:e,children:t})),n1t=y.createContext(!1),r1t=()=>y.useContext(n1t);n1t.Provider;function bYn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var xYn=y.createContext(bYn()),s1t=()=>y.useContext(xYn),a1t=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?ewe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},i1t=e=>{y.useEffect(()=>{e.clearReset()},[e])},o1t=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||ewe(n,[e.error,r])),l1t=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},wYn=(e,t)=>e.isLoading&&e.isFetching&&!t,Bfe=(e,t)=>e?.suspense&&t.isPending,Ufe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function SYn({queries:e,...t},n){const r=ha(),s=r1t(),a=s1t(),i=y.useMemo(()=>e.map(g=>{const v=r.defaultQueryOptions(g);return v._optimisticResults=s?"isRestoring":"optimistic",v}),[e,r,s]);i.forEach(g=>{l1t(g);const v=r.getQueryCache().get(g.queryHash);a1t(g,a,v)}),i1t(a);const[o]=y.useState(()=>new mYn(r,i,t)),[c,u,d]=o.getOptimisticResult(i,t.combine),f=!s&&t.subscribed!==!1;y.useSyncExternalStore(y.useCallback(g=>f?o.subscribe(Mo.batchCalls(g)):Yc,[o,f]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),y.useEffect(()=>{o.setQueries(i,t)},[i,t,o]);const p=c.some((g,v)=>Bfe(i[v],g))?c.flatMap((g,v)=>{const x=i[v];if(x&&Bfe(x,g)){const w=new Sq(r,x);return Ufe(x,w,a)}return[]}):[];if(p.length>0)throw Promise.all(p);const m=c.find((g,v)=>{const x=i[v];return x&&o1t({result:g,errorResetBoundary:a,throwOnError:x.throwOnError,query:r.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(m?.error)throw m.error;return u(d())}function c1t(e,t,n){const r=r1t(),s=s1t(),a=ha(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);const o=a.getQueryCache().get(i.queryHash);i._optimisticResults=r?"isRestoring":"optimistic",l1t(i),a1t(i,s,o),i1t(s);const c=!a.getQueryCache().get(i.queryHash),[u]=y.useState(()=>new t(a,i)),d=u.getOptimisticResult(i),f=!r&&e.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(h=>{const p=f?u.subscribe(Mo.batchCalls(h)):Yc;return u.updateResult(),p},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),y.useEffect(()=>{u.setOptions(i)},[i,u]),Bfe(i,d))throw Ufe(i,u,s);if(o1t({result:d,errorResetBoundary:s,throwOnError:i.throwOnError,query:o,suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!Tk&&wYn(d,r)&&(c?Ufe(i,u,s):o?.promise)?.catch(Yc).finally(()=>{u.updateResult()}),i.notifyOnChangeProps?d:u.trackResult(d)}function Ct(e,t){return c1t(e,Sq)}function or(e,t){const n=ha(),[r]=y.useState(()=>new hYn(n,e));y.useEffect(()=>{r.setOptions(e)},[r,e]);const s=y.useSyncExternalStore(y.useCallback(i=>r.subscribe(Mo.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=y.useCallback((i,o)=>{r.mutate(i,o).catch(Yc)},[r]);if(s.error&&ewe(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function Xb(e,t){return c1t(e,uYn)}function jO(e,t,n){let r=n.initialDeps??[],s,a=!0;function i(){var o,c,u;let d;n.key&&((o=n.debug)!=null&&o.call(n))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((m,g)=>r[g]!==m)))return s;r=f;let p;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(p=Date.now()),s=t(...f),n.key&&((u=n.debug)!=null&&u.call(n))){const m=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-p)*100)/100,v=g/16,x=(w,S)=>{for(w=String(w);w.length<S;)w=" "+w;return w};console.info(`%c⏱ ${x(g,5)} /${x(m,5)} ms`,`
297
297
  font-size: .6rem;
298
298
  font-weight: bold;
299
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(s),a=!1,s}return i.updateDeps=o=>{r=o},i}function c6e(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const kYn=(e,t)=>Math.abs(e-t)<1.01,_Yn=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}},u6e=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},OYn=e=>e,EYn=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=t;s<=n;s++)r.push(s);return r},CYn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=i=>{const{width:o,height:c}=i;t({width:Math.round(o),height:Math.round(c)})};if(s(u6e(n)),!r.ResizeObserver)return()=>{};const a=new r.ResizeObserver(i=>{const o=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(u6e(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},d6e={passive:!0},f6e=typeof window>"u"?!0:"onscrollend"in window,TYn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let s=0;const a=e.options.useScrollendEvent&&f6e?()=>{}:_Yn(r,()=>{t(s,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:h}=e.options;s=f?n.scrollLeft*(h&&-1||1):n.scrollTop,a(),t(s,d)},o=i(!0),c=i(!1);n.addEventListener("scroll",o,d6e);const u=e.options.useScrollendEvent&&f6e;return u&&n.addEventListener("scrollend",c,d6e),()=>{n.removeEventListener("scroll",o),u&&n.removeEventListener("scrollend",c)}},jYn=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},NYn=(e,{adjustments:t=0,behavior:n},r)=>{var s,a;const i=e+t;(a=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||a.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:n})};class AYn{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(a=>{const i=()=>{const o=a.target,c=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(o,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var a;return(a=r())==null?void 0:a.observe(s,{box:"border-box"})},unobserve:s=>{var a;return(a=r())==null?void 0:a.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:OYn,rangeExtractor:EYn,onChange:()=>{},measureElement:jYn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=jO(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=a,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,a=new Map;for(let i=r-1;i>=0;i--){const o=n[i];if(s.has(o.lane))continue;const c=a.get(o.lane);if(c==null||o.end>c.end?a.set(o.lane,o):o.end<c.end&&s.set(o.lane,!0),s.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((i,o)=>i.end===o.end?i.index-o.index:i.end-o.end)[0]:void 0},this.getMeasurementOptions=jO(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,s,a,i,o)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:a,enabled:i,lanes:o}),{key:!1}),this.getMeasurements=jO(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:a,enabled:i,lanes:o},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const h of this.laneAssignments.keys())h>=n&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),f=new Array(o).fill(void 0);for(let h=0;h<u;h++){const p=d[h];p&&(f[p.lane]=h)}for(let h=u;h<n;h++){const p=a(h),m=this.laneAssignments.get(h);let g,v;if(m!==void 0&&this.options.lanes>1){g=m;const _=f[g],O=_!==void 0?d[_]:void 0;v=O?O.end+this.options.gap:r+s}else{const _=this.options.lanes===1?d[h-1]:this.getFurthestMeasurement(d,h);v=_?_.end+this.options.gap:r+s,g=_?_.lane:h%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(h,g)}const x=c.get(p),w=typeof x=="number"?x:this.options.estimateSize(h),S=v+w;d[h]={index:h,start:v,size:w,end:S,key:p,lane:g},f[g]=h}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=jO(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,a)=>this.range=n.length>0&&r>0?IYn({measurements:n,outerSize:r,scrollOffset:s,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=jO(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,a,i)=>a===null||i===null?[]:n({startIndex:a,endIndex:i,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,s-a),o=Math.min(this.options.count-1,s+a);return n>=i&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,o)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(o))});return}const r=this.indexFromElement(n),s=this.options.getItemKey(r),a=this.elementsCache.get(s);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s;const a=this.measurementsCache[n];if(!a)return;const i=this.itemSizeCache.get(a.key)??a.size,o=r-i;o!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,o,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,r)),this.notify(!1))},this.getVirtualItems=jO(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let a=0,i=n.length;a<i;a++){const o=n[a],c=r[o];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return c6e(r[u1t(0,r.length-1,s=>c6e(r[s]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,s=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+a?"end":"start"),r==="center"?n+=(s-a)/2:r==="end"&&(n-=a);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),a=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const a=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getOffsetForIndex(n,r);if(!a)return;const[i,o]=a,c=this.now();this.scrollState={index:n,align:o,behavior:s,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const a=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&a.some(o=>o===null);){const o=r[i];a[o.lane]===null&&(a[o.lane]=o.end),i--}s=Math.max(...a.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,a=1,i=s!==this.scrollState.lastTargetOffset;if(!i&&kYn(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const u1t=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,a=n(s);if(a<r)e=s+1;else if(a>r)t=s-1;else return s}return e>0?e-1:0};function IYn({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const s=e.length-1,a=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:s};let i=u1t(0,s,a,n),o=i;if(r===1)for(;o<s&&e[o].end<n+t;)o++;else if(r>1){const c=Array(r).fill(0);for(;o<s&&c.some(d=>d<n+t);){const d=e[o];c[d.lane]=d.end,o++}const u=Array(r).fill(n+t);for(;i>=0&&u.some(d=>d>=n);){const d=e[i];u[d.lane]=d.start,i--}i=Math.max(0,i-i%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:i,endIndex:o}}const h6e=typeof document<"u"?y.useLayoutEffect:y.useEffect;function RYn({useFlushSync:e=!0,...t}){const n=y.useReducer(()=>({}),{})[1],r={...t,onChange:(a,i)=>{var o;e&&i?hu.flushSync(n):n(),(o=t.onChange)==null||o.call(t,a,i)}},[s]=y.useState(()=>new AYn(r));return s.setOptions(r),h6e(()=>s._didMount(),[]),h6e(()=>s._willUpdate()),s}function d1t(e){return RYn({observeElementRect:CYn,observeElementOffset:TYn,scrollToFn:NYn,...e})}var Sl=(e=>(e.AGENT="agent",e.SCORER="scorer",e.RAG_INGESTION="rag_ingestion",e.TRAJECTORY="trajectory",e.INPUT_PROCESSOR="input_processor",e.INPUT_STEP_PROCESSOR="input_step_processor",e.OUTPUT_PROCESSOR="output_processor",e.OUTPUT_STEP_PROCESSOR="output_step_processor",e.WORKFLOW_STEP="workflow_step",e.TOOL="tool",e.WORKFLOW_RUN="workflow_run",e.MEMORY="memory",e))(Sl||{});Xk().describe("Database record creation time");var PYn=Xk().describe("Database record last update time");PYn.nullable();var kq=Ee({page:DNe().int().min(0).optional().default(0).describe("Zero-indexed page number"),perPage:DNe().int().min(1).max(100).optional().default(10).describe("Number of items per page")}).describe("Pagination options for list queries"),_q=Ee({total:Tt().describe("Total number of items available"),page:Tt().describe("Current page"),perPage:cr([Tt(),Qt(!1)]).describe("Number of items per page, or false if pagination is disabled"),hasMore:al().describe("True if more pages are available")}),$Yn=Ee({start:LNe().optional().describe("Start of date range (inclusive by default)"),end:LNe().optional().describe("End of date range (inclusive by default)"),startExclusive:al().optional().describe("When true, excludes the start date from results (uses > instead of >=)"),endExclusive:al().optional().describe("When true, excludes the end date from results (uses < instead of <=)")}).describe("Date range filter for timestamps"),D2=Zo(["ASC","DESC"]).describe("Sort direction: 'ASC' | 'DESC'"),Uv=Zo(["sum","avg","min","max","count","count_distinct","last"]).describe("Aggregation function"),x_=Zo(["1m","5m","15m","1h","1d"]).describe("Time bucket interval"),rwe=Zo(["previous_period","previous_day","previous_week"]).describe("Comparison period for aggregate queries"),w_=It(pe()).min(1).describe("Fields to group by"),swe=It(Tt().min(0).max(1)).min(1).describe("Percentile values (0-1)"),awe={value:Tt().nullable().describe("Aggregated value"),previousValue:Tt().nullable().optional().describe("Value from comparison period"),changePercent:Tt().nullable().optional().describe("Percentage change from comparison period")},iwe=xa(pe(),pe().nullable()).describe("Dimension values for this group"),Dj=Tt().describe("Aggregated value"),Lj=Xk().describe("Bucket timestamp"),owe=Tt().describe("Percentile value"),lwe=Tt().describe("Percentile value at this bucket"),zj=qme(Sl).describe("Entity type (e.g., 'agent' | 'processor' | 'tool' | 'workflow')"),MYn=pe().describe('ID of the entity (e.g., "weatherAgent", "orderWorkflow")'),f1t=pe().describe("Name of the entity"),h1t=pe().describe("Human end-user who triggered execution"),p1t=pe().describe("Multi-tenant organization/account"),m1t=pe().describe("Broader resource context (Mastra memory compatibility)"),g1t=pe().describe("Unique execution run identifier"),v1t=pe().describe("Session identifier for grouping traces"),y1t=pe().describe("Conversation thread identifier"),b1t=pe().describe("HTTP request ID for log correlation"),x1t=pe().describe('Environment (e.g., "production" | "staging" | "development")'),DYn=pe().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),w1t=pe().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),S1t=pe().describe("Name of the service"),k1t=qme(Sl).describe("Entity type of the parent entity"),LYn=pe().describe("ID of the parent entity"),_1t=pe().describe("Name of the parent entity"),O1t=qme(Sl).describe("Entity type of the root entity"),zYn=pe().describe("ID of the root entity"),E1t=pe().describe("Name of the root entity"),C1t=pe().describe("Version ID of the entity that produced this signal (e.g., agent version, workflow version)"),T1t=pe().describe("Version ID of the parent entity that produced this signal"),j1t=pe().describe("Version ID of the root entity that produced this signal"),Oq=pe().describe("Experiment or eval run identifier"),FYn=xa(pe(),ni()).describe('Arbitrary package/app version info (e.g., {"core": "1.0.0", "memory": "1.0.0", "gitSha": "abcd1234"})'),N1t=xa(pe(),ni()).describe("User-defined metadata for custom filtering"),A1t=It(pe()).describe("Labels for filtering"),BYn={entityType:zj.nullish(),entityId:MYn.nullish(),entityName:f1t.nullish(),parentEntityType:k1t.nullish(),parentEntityId:LYn.nullish(),parentEntityName:_1t.nullish(),rootEntityType:O1t.nullish(),rootEntityId:zYn.nullish(),rootEntityName:E1t.nullish(),userId:h1t.nullish(),organizationId:p1t.nullish(),resourceId:m1t.nullish(),runId:g1t.nullish(),sessionId:v1t.nullish(),threadId:y1t.nullish(),requestId:b1t.nullish(),environment:x1t.nullish(),serviceName:S1t.nullish(),scope:FYn.nullish(),entityVersionId:C1t.nullish(),parentEntityVersionId:T1t.nullish(),rootEntityVersionId:j1t.nullish(),experimentId:Oq.nullish()},Eq={...BYn,executionSource:w1t.nullish(),tags:A1t.nullish()};DYn.nullish();var Cq={timestamp:$Yn.optional().describe("Filter by timestamp range"),traceId:pe().optional().describe("Filter by trace ID"),spanId:pe().optional().describe("Filter by span ID"),entityType:zj.optional(),entityName:f1t.optional(),entityVersionId:C1t.optional(),parentEntityVersionId:T1t.optional(),rootEntityVersionId:j1t.optional(),userId:h1t.optional(),organizationId:p1t.optional(),experimentId:Oq.optional(),serviceName:S1t.optional(),environment:x1t.optional(),parentEntityType:k1t.optional(),parentEntityName:_1t.optional(),rootEntityType:O1t.optional(),rootEntityName:E1t.optional(),resourceId:m1t.optional(),runId:g1t.optional(),sessionId:v1t.optional(),threadId:y1t.optional(),requestId:b1t.optional(),executionSource:w1t.optional(),tags:It(pe()).optional().describe("Filter by tags (must have all specified tags)")},Tq=pe().describe("Unique trace identifier"),jq=pe().describe("Unique span identifier within a trace"),eB=Zo(["debug","info","warn","error","fatal"]),I1t=pe().describe("Log message"),R1t=xa(pe(),ni()).describe("Structured data attached to the log"),P1t=Ee({logId:pe().nullish().describe("Unique id for this log event"),timestamp:Xk().describe("When the log was created"),level:eB.describe("Log severity level"),message:I1t,data:R1t.nullish(),traceId:Tq.nullish(),spanId:jq.nullish(),...Eq,source:pe().nullish().describe("Execution source"),metadata:N1t.nullish()}).describe("Log record as stored in the database");Ee({level:eB,message:I1t,data:R1t.optional(),tags:A1t.optional()}).describe("User-provided log input");var UYn=P1t;Ee({logs:It(UYn)}).describe("Arguments for batch creating logs");var qYn=Ee({...Cq,source:pe().optional().describe("Filter by execution source"),level:cr([eB,It(eB)]).optional().describe("Filter by log level(s)")}).describe("Filters for querying logs"),VYn=Zo(["timestamp"]).describe("Field to order by: 'timestamp'"),HYn=Ee({field:VYn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:qYn.optional().describe("Optional filters to apply"),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:HYn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing logs");Ee({pagination:_q,logs:It(P1t)});var Fj=pe().describe("Identifier of the scorer (e.g., relevance, accuracy)"),$1t=pe().describe("Display name of the scorer"),M1t=pe().describe("Version of the scorer"),Ev=pe().describe("How the score was produced (e.g., manual, automated, experiment)"),D1t=Tt().describe("Score value (range defined by scorer)"),L1t=pe().describe("Explanation for the score"),z1t=Ee({scoreId:pe().nullish().describe("Unique id for this score event"),timestamp:Xk().describe("When the score was recorded"),traceId:Tq.nullish().describe("Trace that anchors the scored target when available"),spanId:jq.nullish().describe("Span ID this score applies to"),scorerId:Fj,scorerName:$1t.nullish(),scorerVersion:M1t.nullish(),scoreSource:Ev.nullish(),source:Ev.nullish(),score:D1t,reason:L1t.nullish(),...Eq,scoreTraceId:pe().nullish().describe("Trace ID of the scoring run for debugging score generation"),metadata:xa(pe(),ni()).nullish().describe("User-defined metadata")}).describe("Score record as stored in the database");Ee({scorerId:Fj,scorerName:$1t.optional(),scorerVersion:M1t.optional(),scoreSource:Ev.optional(),source:Ev.optional(),score:D1t,reason:L1t.optional(),metadata:xa(pe(),ni()).optional().describe("Additional scorer-specific metadata"),experimentId:Oq.optional(),scoreTraceId:pe().optional().describe("Trace ID of the scoring run for debugging score generation"),targetEntityType:zj.optional().describe("Entity type the scorer evaluated when known")}).describe("User-provided score input");var cwe=z1t;Ee({score:cwe}).describe("Arguments for creating a score");Ee({score:cwe.omit({timestamp:!0})}).describe("Arguments for creating a score");Ee({success:al()}).describe("Response from creating a score");Ee({scores:It(cwe)}).describe("Arguments for batch recording scores");var L2=Ee({...Cq,scorerId:cr([pe(),It(pe())]).optional().describe("Filter by scorer ID(s)"),scoreSource:Ev.optional().describe("Filter by how the score was produced"),source:Ev.optional().describe("Filter by how the score was produced")}).describe("Filters for querying scores"),WYn=Zo(["timestamp","score"]).describe("Field to order by: 'timestamp' | 'score'"),ZYn=Ee({field:WYn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:L2.optional(),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:ZYn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing scores");Ee({pagination:_q,scores:It(z1t)});Ee({scorerId:Fj,scoreSource:Ev.optional(),aggregation:Uv,filters:L2.optional(),comparePeriod:rwe.optional()}).describe("Arguments for getting a score aggregate");Ee(awe);Ee({scorerId:Fj,scoreSource:Ev.optional(),groupBy:w_,aggregation:Uv,filters:L2.optional()}).describe("Arguments for getting a score breakdown");Ee({groups:It(Ee({dimensions:iwe,value:Dj}))});Ee({scorerId:Fj,scoreSource:Ev.optional(),interval:x_,aggregation:Uv,filters:L2.optional(),groupBy:w_.optional()}).describe("Arguments for getting score time series");Ee({series:It(Ee({name:pe().describe("Series name (scorer ID or group key)"),points:It(Ee({timestamp:Lj,value:Dj}))}))});Ee({scorerId:Fj,scoreSource:Ev.optional(),percentiles:swe,interval:x_,filters:L2.optional()}).describe("Arguments for getting score percentiles");Ee({series:It(Ee({percentile:owe,points:It(Ee({timestamp:Lj,value:lwe}))}))});var Cv=pe().describe("Source of feedback (e.g., 'user', 'system', 'manual')"),Bj=pe().describe("Type of feedback (e.g., 'thumbs', 'rating', 'correction')"),F1t=cr([Tt(),pe()]).describe("Feedback value (rating number or correction text)"),B1t=pe().describe("Additional comment or context"),tB=pe().describe("User who provided the feedback");function uwe(e){if(!e||typeof e!="object"||Array.isArray(e))return e;const t={...e};return typeof t.userId=="string"&&t.feedbackUserId==null&&(t.feedbackUserId=t.userId,delete t.userId),t}var Nq=Ee({feedbackId:pe().nullish().describe("Unique id for this feedback event"),timestamp:Xk().describe("When the feedback was recorded"),traceId:Tq.nullish().describe("Trace that anchors the feedback target when available"),spanId:jq.nullish().describe("Span ID this feedback applies to"),feedbackSource:Cv.nullish(),source:Cv.nullish(),feedbackType:Bj,value:F1t,comment:B1t.nullish(),feedbackUserId:tB.nullish(),...Eq,sourceId:pe().nullish().describe("ID of the source record this feedback is linked to (e.g. experiment result ID)"),metadata:xa(pe(),ni()).nullish().describe("User-defined metadata")}),GYn=Ee(Nq.shape).describe("Feedback record as stored in the database"),QYn=Ee({feedbackSource:Cv.optional(),source:Cv.optional(),feedbackType:Bj,value:F1t,comment:B1t.optional(),feedbackUserId:tB.optional(),userId:tB.optional(),metadata:xa(pe(),ni()).optional().describe("Additional feedback-specific metadata"),experimentId:Oq.optional(),sourceId:pe().optional().describe("ID of the source record this feedback is linked to")});Ee(QYn.shape).describe("User-provided feedback input");Ee({feedback:Zme(uwe,Nq)}).describe("Arguments for creating feedback");Ee({feedback:Nq.omit({timestamp:!0})}).describe("Arguments for creating feedback");Ee({success:al()}).describe("Response from creating feedback");Ee({feedbacks:It(Zme(uwe,Nq))}).describe("Arguments for batch recording feedback");var U1t=Ee({...Cq,feedbackType:cr([pe(),It(pe())]).optional().describe("Filter by feedback type(s)"),feedbackSource:Cv.optional(),source:Cv.optional(),feedbackUserId:tB.optional()}),Aq=Ee(U1t.shape).describe("Filters for querying feedback"),YYn=Zo(["timestamp"]).describe("Field to order by: 'timestamp'"),XYn=Ee({field:YYn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:Zme(uwe,U1t).optional().describe("Optional filters to apply"),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:XYn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing feedback");Ee({pagination:_q,feedback:It(GYn)});Ee({feedbackType:Bj,feedbackSource:Cv.optional(),aggregation:Uv,filters:Aq.optional(),comparePeriod:rwe.optional()}).describe("Arguments for getting a feedback aggregate over numeric values");Ee(awe);Ee({feedbackType:Bj,feedbackSource:Cv.optional(),groupBy:w_,aggregation:Uv,filters:Aq.optional()}).describe("Arguments for getting a feedback breakdown over numeric values");Ee({groups:It(Ee({dimensions:iwe,value:Dj}))});Ee({feedbackType:Bj,feedbackSource:Cv.optional(),interval:x_,aggregation:Uv,filters:Aq.optional(),groupBy:w_.optional()}).describe("Arguments for getting feedback time series over numeric values");Ee({series:It(Ee({name:pe().describe("Series name (feedback type or group key)"),points:It(Ee({timestamp:Lj,value:Dj}))}))});Ee({feedbackType:Bj,feedbackSource:Cv.optional(),percentiles:swe,interval:x_,filters:Aq.optional()}).describe("Arguments for getting feedback percentiles over numeric values");Ee({series:It(Ee({percentile:owe,points:It(Ee({timestamp:Lj,value:lwe}))}))});Zo(["counter","gauge","histogram"]);var q1t=pe().describe("Metric name (e.g., mastra_agent_duration_ms)"),V1t=Tt().describe("Metric value"),H1t=xa(pe(),pe()).describe("Metric labels for dimensional filtering"),W1t=pe().describe("Model provider"),Z1t=pe().describe("Model"),KYn=Tt().describe("Estimated cost"),G1t=pe().describe("Unit for the estimated cost (e.g., usd)"),JYn=xa(pe(),ni()).nullish().describe("Structured costing metadata"),Q1t=Ee({metricId:pe().nullish().describe("Unique id for this metric event"),timestamp:Xk().describe("When the metric was recorded"),name:q1t,value:V1t,traceId:Tq.nullish(),spanId:jq.nullish(),...Eq,source:pe().nullish().describe("Execution source"),provider:W1t.nullish(),model:Z1t.nullish(),estimatedCost:KYn.nullish(),costUnit:G1t.nullish(),costMetadata:JYn.nullish(),labels:H1t.default({}),metadata:N1t.nullish()}).describe("Metric record as stored in the database");Ee({name:q1t,value:V1t,labels:H1t.optional()}).describe("User-provided metric input");var eXn=Q1t;Ee({metrics:It(eXn)}).describe("Arguments for batch recording metrics");Ee({type:Uv,interval:x_.optional(),groupBy:w_.optional()}).describe("Metrics aggregation configuration");var z2=Ee({...Cq,name:It(pe()).nonempty().optional().describe("Filter by metric name(s)"),source:pe().optional().describe("Filter by execution source"),provider:W1t.optional(),model:Z1t.optional(),costUnit:G1t.optional(),labels:xa(pe(),pe()).optional().describe("Exact match on label key-value pairs")}).describe("Filters for querying metrics"),tXn=Zo(["timestamp"]).describe("Field to order by: 'timestamp'"),nXn=Ee({field:tXn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:z2.optional(),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:nXn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing metrics");Ee({pagination:_q,metrics:It(Q1t)});var rXn=["entityType","entityName","parentEntityType","parentEntityName","rootEntityType","rootEntityName","name","provider","model","environment","executionSource","serviceName"],dwe=Zo(rXn).optional().describe("Column to apply count_distinct over (required when aggregation is 'count_distinct'). Restricted to low/medium-cardinality categorical columns; ID columns are not allowed."),vT={check:e=>e.aggregation!=="count_distinct"||e.distinctColumn!==void 0,options:{message:"distinctColumn is required when aggregation is 'count_distinct'",path:["distinctColumn"]}};Ee({name:It(pe()).nonempty().describe("Metric name(s) to aggregate"),aggregation:Uv,distinctColumn:dwe,filters:z2.optional(),comparePeriod:rwe.optional()}).refine(vT.check,vT.options).describe("Arguments for getting a metric aggregate");Ee({...awe,estimatedCost:Tt().nullable().optional().describe("Aggregated estimated cost from the same filtered row set"),costUnit:pe().nullable().optional().describe("Shared cost unit for the aggregated rows, or null when mixed/unknown"),previousEstimatedCost:Tt().nullable().optional().describe("Aggregated estimated cost from the comparison period"),costChangePercent:Tt().nullable().optional().describe("Percentage change in estimated cost from comparison period")});Ee({name:It(pe()).nonempty().describe("Metric name(s) to break down"),groupBy:w_,aggregation:Uv,distinctColumn:dwe,filters:z2.optional(),limit:Tt().int().positive().max(1e3).optional().describe("Maximum number of groups to return (server-side TopK). Required for high-cardinality groupBy."),orderDirection:D2.optional().describe("Sort direction for the aggregated value (defaults to 'DESC' at the storage layer; pairs with limit for top/bottom-N).")}).refine(vT.check,vT.options).describe("Arguments for getting a metric breakdown");Ee({groups:It(Ee({dimensions:iwe,value:Dj,estimatedCost:Tt().nullable().optional().describe("Summed estimated cost for this group"),costUnit:pe().nullable().optional().describe("Shared cost unit for this group, or null when mixed/unknown")}))});Ee({name:It(pe()).nonempty().describe("Metric name(s)"),interval:x_,aggregation:Uv,distinctColumn:dwe,filters:z2.optional(),groupBy:w_.optional()}).refine(vT.check,vT.options).describe("Arguments for getting metric time series");Ee({series:It(Ee({name:pe().describe("Series name (metric name or group key)"),costUnit:pe().nullable().optional().describe("Shared cost unit for this series, or null when mixed/unknown"),points:It(Ee({timestamp:Lj,value:Dj,estimatedCost:Tt().nullable().optional().describe("Summed estimated cost in this bucket")}))}))});Ee({name:pe().describe("Metric name"),percentiles:swe,interval:x_,filters:z2.optional()}).describe("Arguments for getting metric percentiles");Ee({series:It(Ee({percentile:owe,points:It(Ee({timestamp:Lj,value:lwe}))}))});Ee({prefix:pe().optional().describe("Filter metric names by prefix"),limit:Tt().int().min(1).optional().describe("Maximum number of names to return")}).describe("Arguments for getting metric names");Ee({names:It(pe()).describe("Distinct metric names")});Ee({metricName:pe().describe("Metric name to get label keys for")}).describe("Arguments for getting metric label keys");Ee({keys:It(pe()).describe("Distinct label keys for the metric")});Ee({metricName:pe().describe("Metric name"),labelKey:pe().describe("Label key to get values for"),prefix:pe().optional().describe("Filter values by prefix"),limit:Tt().int().min(1).optional().describe("Maximum number of values to return")}).describe("Arguments for getting label values");Ee({values:It(pe()).describe("Distinct label values")});Ee({}).describe("Arguments for getting entity types");Ee({entityTypes:It(zj).describe("Distinct entity types")});Ee({entityType:zj.optional().describe("Optional entity type filter")}).describe("Arguments for getting entity names");Ee({names:It(pe()).describe("Distinct entity names")});Ee({}).describe("Arguments for getting service names");Ee({serviceNames:It(pe()).describe("Distinct service names")});Ee({}).describe("Arguments for getting environments");Ee({environments:It(pe()).describe("Distinct environments")});Ee({entityType:zj.optional().describe("Optional entity type filter")}).describe("Arguments for getting tags");Ee({tags:It(pe()).describe("Distinct tags")});function Y1t(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Y1t(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function X1t(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Y1t(e))&&(r&&(r+=" "),r+=t);return r}const p6e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,m6e=X1t,S_=(e,t)=>n=>{var r;if(t?.variants==null)return m6e(e,n?.class,n?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=n?.[u],f=a?.[u];if(d===null)return null;const h=p6e(d)||p6e(f);return s[u][h]}),o=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...a,...o}[g]):{...a,...o}[g]===v})?[...u,f,h]:u},[]);return m6e(e,i,c,n?.class,n?.className)},sXn=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},aXn=(e,t)=>({classGroupId:e,validator:t}),K1t=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),nB="-",g6e=[],iXn="arbitrary..",oXn=e=>{const t=cXn(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return lXn(i);const o=i.split(nB),c=o[0]===""&&o.length>1?1:0;return J1t(o,c,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const c=r[i],u=n[i];return c?u?sXn(u,c):c:u||g6e}return n[i]||g6e}}},J1t=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const u=J1t(e,t+1,a);if(u)return u}const i=n.validators;if(i===null)return;const o=t===0?e.join(nB):e.slice(t).join(nB),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(o))return d.classGroupId}},lXn=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?iXn+r:void 0})(),cXn=e=>{const{theme:t,classGroups:n}=e;return uXn(n,t)},uXn=(e,t)=>{const n=K1t();for(const r in e){const s=e[r];fwe(s,n,r,t)}return n},fwe=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];dXn(i,t,n,r)}},dXn=(e,t,n,r)=>{if(typeof e=="string"){fXn(e,t,n);return}if(typeof e=="function"){hXn(e,t,n,r);return}pXn(e,t,n,r)},fXn=(e,t,n)=>{const r=e===""?t:eSt(t,e);r.classGroupId=n},hXn=(e,t,n,r)=>{if(mXn(e)){fwe(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(aXn(n,e))},pXn=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,c]=s[i];fwe(c,eSt(t,o),n,r)}},eSt=(e,t)=>{let n=e;const r=t.split(nB),s=r.length;for(let a=0;a<s;a++){const i=r[a];let o=n.nextPart.get(i);o||(o=K1t(),n.nextPart.set(i,o)),n=o}return n},mXn=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gXn=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,i)=>{n[a]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=r[a])!==void 0)return s(a,i),i},set(a,i){a in n?n[a]=i:s(a,i)}}},qfe="!",v6e=":",vXn=[],y6e=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),yXn=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let i=0,o=0,c=0,u;const d=s.length;for(let g=0;g<d;g++){const v=s[g];if(i===0&&o===0){if(v===v6e){a.push(s.slice(c,g)),c=g+1;continue}if(v==="/"){u=g;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=a.length===0?s:s.slice(c);let h=f,p=!1;f.endsWith(qfe)?(h=f.slice(0,-1),p=!0):f.startsWith(qfe)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return y6e(a,p,h,m)};if(t){const s=t+v6e,a=r;r=i=>i.startsWith(s)?a(i.slice(s.length)):y6e(vXn,!1,i,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},bXn=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const i=n[a],o=i[0]==="[",c=t.has(i);o||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},xXn=e=>({cache:gXn(e.cacheSize),parseClassName:yXn(e),sortModifiers:bXn(e),...oXn(e)}),wXn=/\s+/,SXn=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],o=e.trim().split(wXn);let c="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=r(v?m.substring(0,g):m);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),S=p?w+qfe:w,_=S+x;if(i.indexOf(_)>-1)continue;i.push(_);const O=s(x,v);for(let E=0;E<O.length;++E){const j=O[E];i.push(S+j)}c=d+(c.length>0?" "+c:c)}return c},kXn=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=tSt(n))&&(s&&(s+=" "),s+=r);return s},tSt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=tSt(e[r]))&&(n&&(n+=" "),n+=t);return n},b6e=(e,...t)=>{let n,r,s,a;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=xXn(u),r=n.cache.get,s=n.cache.set,a=o,o(c)},o=c=>{const u=r(c);if(u)return u;const d=SXn(c,n);return s(c,d),d};return a=i,(...c)=>a(kXn(...c))},_Xn=[],Pl=e=>{const t=n=>n[e]||_Xn;return t.isThemeGetter=!0,t},nSt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rSt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,OXn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,EXn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CXn=/\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$/,TXn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jXn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NXn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dx=e=>OXn.test(e),cs=e=>!!e&&!Number.isNaN(Number(e)),Lx=e=>!!e&&Number.isInteger(Number(e)),aK=e=>e.endsWith("%")&&cs(e.slice(0,-1)),by=e=>EXn.test(e),sSt=()=>!0,AXn=e=>CXn.test(e)&&!TXn.test(e),hwe=()=>!1,IXn=e=>jXn.test(e),RXn=e=>NXn.test(e),PXn=e=>!In(e)&&!Ln(e),$Xn=e=>Uw(e,oSt,hwe),In=e=>nSt.test(e),T1=e=>Uw(e,lSt,AXn),x6e=e=>Uw(e,qXn,cs),MXn=e=>Uw(e,uSt,sSt),DXn=e=>Uw(e,cSt,hwe),w6e=e=>Uw(e,aSt,hwe),LXn=e=>Uw(e,iSt,RXn),Z3=e=>Uw(e,dSt,IXn),Ln=e=>rSt.test(e),$A=e=>k_(e,lSt),zXn=e=>k_(e,cSt),S6e=e=>k_(e,aSt),FXn=e=>k_(e,oSt),BXn=e=>k_(e,iSt),G3=e=>k_(e,dSt,!0),UXn=e=>k_(e,uSt,!0),Uw=(e,t,n)=>{const r=nSt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},k_=(e,t,n=!1)=>{const r=rSt.exec(e);return r?r[1]?t(r[1]):n:!1},aSt=e=>e==="position"||e==="percentage",iSt=e=>e==="image"||e==="url",oSt=e=>e==="length"||e==="size"||e==="bg-size",lSt=e=>e==="length",qXn=e=>e==="number",cSt=e=>e==="family-name",uSt=e=>e==="number"||e==="weight",dSt=e=>e==="shadow",k6e=()=>{const e=Pl("color"),t=Pl("font"),n=Pl("text"),r=Pl("font-weight"),s=Pl("tracking"),a=Pl("leading"),i=Pl("breakpoint"),o=Pl("container"),c=Pl("spacing"),u=Pl("radius"),d=Pl("shadow"),f=Pl("inset-shadow"),h=Pl("text-shadow"),p=Pl("drop-shadow"),m=Pl("blur"),g=Pl("perspective"),v=Pl("aspect"),x=Pl("ease"),w=Pl("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[..._(),Ln,In],E=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],T=()=>[Ln,In,c],N=()=>[Dx,"full","auto",...T()],I=()=>[Lx,"none","subgrid",Ln,In],P=()=>["auto",{span:["full",Lx,Ln,In]},Lx,Ln,In],R=()=>[Lx,"auto",Ln,In],F=()=>["auto","min","max","fr",Ln,In],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],z=()=>[Dx,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],q=()=>[Dx,"screen","full","dvw","lvw","svw","min","max","fit",...T()],W=()=>[Dx,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],D=()=>[e,Ln,In],Q=()=>[..._(),S6e,w6e,{position:[Ln,In]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",FXn,$Xn,{size:[Ln,In]}],Z=()=>[aK,$A,T1],G=()=>["","none","full",u,Ln,In],J=()=>["",cs,$A,T1],ie=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[cs,aK,S6e,w6e],ae=()=>["","none",m,Ln,In],de=()=>["none",cs,Ln,In],X=()=>["none",cs,Ln,In],re=()=>[cs,Ln,In],le=()=>[Dx,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[by],breakpoint:[by],color:[sSt],container:[by],"drop-shadow":[by],ease:["in","out","in-out"],font:[PXn],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[by],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[by],shadow:[by],spacing:["px",cs],text:[by],"text-shadow":[by],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Dx,In,Ln,v]}],container:["container"],columns:[{columns:[cs,In,Ln,o]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"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:O()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Lx,"auto",Ln,In]}],basis:[{basis:[Dx,"full","auto",o,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[cs,Dx,"auto","initial","none",In]}],grow:[{grow:["",cs,Ln,In]}],shrink:[{shrink:["",cs,Ln,In]}],order:[{order:[Lx,"first","last","none",Ln,In]}],"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":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],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":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...q()]}],"min-inline-size":[{"min-inline":["auto",...q()]}],"max-inline-size":[{"max-inline":["none",...q()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[o,"screen",...z()]}],"min-w":[{"min-w":[o,"screen","none",...z()]}],"max-w":[{"max-w":[o,"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",n,$A,T1]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,UXn,MXn]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",aK,In]}],"font-family":[{font:[zXn,DXn,t]}],"font-features":[{"font-features":[In]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ln,In]}],"line-clamp":[{"line-clamp":[cs,"none",Ln,x6e]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",Ln,In]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ln,In]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[cs,"from-font","auto",Ln,T1]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[cs,"auto",Ln,In]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ln,In]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ln,In]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lx,Ln,In],radial:["",Ln,In],conic:[Lx,Ln,In]},BXn,LXn]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],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:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[cs,Ln,In]}],"outline-w":[{outline:["",cs,$A,T1]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,G3,Z3]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",f,G3,Z3]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[cs,T1]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,G3,Z3]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[cs,Ln,In]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[cs]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Ln,In]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[cs]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ln,In]}],filter:[{filter:["","none",Ln,In]}],blur:[{blur:ae()}],brightness:[{brightness:[cs,Ln,In]}],contrast:[{contrast:[cs,Ln,In]}],"drop-shadow":[{"drop-shadow":["","none",p,G3,Z3]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",cs,Ln,In]}],"hue-rotate":[{"hue-rotate":[cs,Ln,In]}],invert:[{invert:["",cs,Ln,In]}],saturate:[{saturate:[cs,Ln,In]}],sepia:[{sepia:["",cs,Ln,In]}],"backdrop-filter":[{"backdrop-filter":["","none",Ln,In]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[cs,Ln,In]}],"backdrop-contrast":[{"backdrop-contrast":[cs,Ln,In]}],"backdrop-grayscale":[{"backdrop-grayscale":["",cs,Ln,In]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[cs,Ln,In]}],"backdrop-invert":[{"backdrop-invert":["",cs,Ln,In]}],"backdrop-opacity":[{"backdrop-opacity":[cs,Ln,In]}],"backdrop-saturate":[{"backdrop-saturate":[cs,Ln,In]}],"backdrop-sepia":[{"backdrop-sepia":["",cs,Ln,In]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ln,In]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[cs,"initial",Ln,In]}],ease:[{ease:["linear","initial",x,Ln,In]}],delay:[{delay:[cs,Ln,In]}],animate:[{animate:["none",w,Ln,In]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Ln,In]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[Ln,In,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"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:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ln,In]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ln,In]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[cs,$A,T1,x6e]}],stroke:[{stroke:["none",...D()]}],"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"]}},VXn=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:s={},override:a={}})=>(EI(e,"cacheSize",t),EI(e,"prefix",n),EI(e,"experimentalParseClassName",r),Q3(e.theme,a.theme),Q3(e.classGroups,a.classGroups),Q3(e.conflictingClassGroups,a.conflictingClassGroups),Q3(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),EI(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Y3(e.theme,s.theme),Y3(e.classGroups,s.classGroups),Y3(e.conflictingClassGroups,s.conflictingClassGroups),Y3(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),fSt(e,s,"orderSensitiveModifiers"),e),EI=(e,t,n)=>{n!==void 0&&(e[t]=n)},Q3=(e,t)=>{if(t)for(const n in t)EI(e,n,t[n])},Y3=(e,t)=>{if(t)for(const n in t)fSt(e,t,n)},fSt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},HXn=(e,...t)=>typeof e=="function"?b6e(k6e,e,...t):b6e(()=>VXn(k6e(),e),...t),WXn=Object.keys({...Wy,...can}),ZXn=Object.keys(man),GXn=Object.keys(uan),QXn=Object.keys(dan),YXn=Object.keys(lan),j1=Object.keys(pan),XXn=Object.keys(fan).concat(Object.keys(han)),KXn=HXn({extend:{theme:{color:WXn,spacing:ZXn,radius:YXn,leading:QXn,shadow:XXn},classGroups:{"font-size":[{text:GXn}],h:[{h:j1}],w:[{w:j1}],size:[{size:j1}],"min-h":[{"min-h":j1}],"min-w":[{"min-w":j1}],"max-h":[{"max-h":j1}],"max-w":[{"max-w":j1}]}}});function Y(...e){return KXn(X1t(e))}const sf=kJt,sr=_Jt,ar=OJt,er=y.forwardRef(({className:e,sideOffset:t=4,children:n,...r},s)=>l.jsx(EJt,{children:l.jsxs(rnt,{ref:s,sideOffset:t,className:Y("z-50 overflow-hidden rounded-lg border border-border1 bg-surface3 px-2.5 py-1.5 text-ui-sm leading-ui-sm text-neutral5 shadow-dialog 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-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",e),...r,children:[n,l.jsx(CJt,{className:"fill-surface3"})]})}));er.displayName=rnt.displayName;const JXn={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"},Ne=({children:e,className:t,size:n="default",...r})=>l.jsx("span",{className:Y("block",JXn[n],t),...r,children:e}),Bl={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},Iq="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",eKn="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",tKn="rounded-md",hSt="bg-surface2 border border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",pwe="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",mwe="disabled:opacity-50 disabled:cursor-not-allowed",X3=Y("gap-[.75em] rounded-full","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100"),gwe=S_(Y("inline-flex items-center justify-center leading-0 cursor-pointer","transition-all duration-normal ease-out-custom",mwe,pwe),{variants:{variant:{default:"bg-surface3 border border-border1 hover:bg-surface5 hover:text-neutral6 active:bg-surface6 text-neutral6",primary:"bg-surface4 border border-border2 hover:bg-surface5 hover:text-neutral6 active:bg-surface6 text-neutral6",cta:"bg-accent1 border border-transparent hover:bg-accent1/90 hover:shadow-glow-accent1 disabled:hover:shadow-none text-surface1 font-medium",ghost:"bg-transparent border border-transparent hover:bg-surface4 hover:text-neutral6 active:bg-surface5 text-neutral4",outline:"bg-transparent border border-border1 hover:bg-surface3 hover:text-neutral6 active:bg-surface4 text-neutral5",link:"inline-flex justify-start rounded-none h-auto px-0 bg-transparent text-neutral3 hover:text-neutral4 gap-1 [&>svg]:mx-0 w-auto [&>svg]:opacity-70"},size:{sm:Y(`${Bl.sm} text-ui-sm px-[.9em]`,X3),md:Y(`${Bl.md} text-ui-md px-[.9em]`,X3),default:Y(`${Bl.default} text-ui-md px-[1em]`,X3),lg:Y(`${Bl.lg} text-ui-lg px-[1.15em]`,X3),"icon-sm":`${Bl.sm} w-form-sm rounded-full`,"icon-md":`${Bl.md} w-form-md rounded-full`,"icon-lg":`${Bl.lg} w-form-lg rounded-full`}},defaultVariants:{variant:"default",size:"default"}}),nKn={"icon-sm":"sm","icon-md":"default","icon-lg":"lg"};function pSt(e){const t=[];return _e.Children.forEach(e,n=>{_e.isValidElement(n)&&n.type===_e.Fragment?t.push(...pSt(n.props.children)):t.push(n)}),t}function rKn(e){const t=pSt(e);return t.length>0&&t.every(n=>_e.isValidElement(n))}function sKn(e){return typeof e=="string"&&e.startsWith("icon-")}const ce=_e.forwardRef(({className:e,as:t,size:n,variant:r="default",disabled:s,children:a,tooltip:i,"aria-label":o,...c},u)=>{const d=t||"button",f=sKn(n),h=n??"default",p=!f&&rKn(a),m=o??((f||p)&&typeof i=="string"?i:void 0),g=f?l.jsx(Ne,{size:nKn[n],children:a}):a,v=l.jsx(d,{ref:u,disabled:s,"aria-label":m,className:Y(gwe({variant:r,size:h}),p&&"[&>svg]:opacity-75",e),...c,children:g});return i?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:v}),l.jsx(er,{children:i})]}):v});ce.displayName="Button";const ss=_e.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{ref:n,...t})}),e&&l.jsx(er,{children:e})]}));ss.displayName="ButtonWithTooltip";const kr={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"},qw={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},mSt=({children:e})=>l.jsx("nav",{className:"bg-surface2 min-h-full overflow-hidden",children:e}),rB=({children:e,as:t="a",href:n,className:r,prefetch:s,to:a})=>l.jsx(t,{href:n,prefetch:s,to:a,className:Y("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer",kr.colors,r),children:e}),gSt=({children:e})=>l.jsx("ol",{"data-testid":"thread-list",children:e}),sB=({children:e,isActive:t,className:n})=>l.jsx("li",{className:Y("border-b border-border1 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",kr.colors,"hover:bg-surface3",t&&"bg-accent1Dark",n),children:e}),vSt=({onClick:e})=>l.jsx(ce,{variant:"ghost",className:Y("shrink-0 opacity-0",kr.all,"group-focus-within:opacity-100 group-hover:opacity-100","hover:bg-surface4 hover:text-accent2"),onClick:e,children:l.jsx(Ne,{children:l.jsx(Ju,{"aria-label":"delete thread",className:"text-neutral3 hover:text-accent2 transition-colors"})})}),aKn={"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"},iKn={mono:"font-mono"},me=({as:e="p",className:t,variant:n="ui-md",font:r,...s})=>l.jsx(e,{className:Y(aKn[n],r&&iKn[r],t),...s}),oKn={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},ySt=({src:e,name:t,size:n="sm",interactive:r=!1})=>l.jsx("div",{className:Y(oKn[n],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",kr.all,r&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?l.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):l.jsx(me,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),lKn={default:"text-neutral5 bg-surface4 border-border1",success:"text-notice-success-fg bg-notice-success/20 border-notice-success/20",error:"text-notice-destructive-fg bg-notice-destructive/20 border-notice-destructive/20",info:"text-notice-info-fg bg-notice-info/20 border-notice-info/20",warning:"text-notice-warning-fg bg-notice-warning/20 border-notice-warning/20"},_t=({icon:e,variant:t="default",className:n,children:r,...s})=>l.jsxs("div",{className:Y("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border shrink-0",kr.colors,e?"pl-2 pr-2.5":"px-2.5",lKn[t],n),...s,children:[e&&l.jsx(Ne,{size:"sm",children:e}),r]}),cKn=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Ni=({children:e,label:t})=>l.jsx("nav",{"aria-label":t,children:l.jsx("ol",{className:"gap-0.5 flex items-center",children:e})}),Bn=({className:e,as:t,isCurrent:n,action:r,...s})=>{const a=t||"span";return l.jsxs(l.Fragment,{children:[l.jsxs("li",{className:"flex h-full shrink-0 items-center gap-1",children:[l.jsx(a,{"aria-current":n?"page":void 0,className:Y("text-ui-md leading-ui-md flex items-center gap-2",kr.colors,n?"text-white":"text-neutral3 hover:text-neutral5",e),...s}),r]}),!n&&l.jsx("li",{role:"separator",className:"flex h-full items-center",children:l.jsx(Ne,{className:Y("text-neutral2",kr.colors),children:l.jsx(cKn,{})})})]})};function uKn(e,t=5){if(!e?.properties)return[];const n=[];function r(s,a,i){if(i>t)return;const o=Array.isArray(s.type)?s.type.join(" | "):s.type;if(n.push({path:a,label:a,description:s.description??s.title,type:o}),s.properties)for(const[c,u]of Object.entries(s.properties))r(u,`${a}.${c}`,i+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))r(u,`${a}[].${c}`,i+1)}for(const[s,a]of Object.entries(e.properties))r(a,s,1);return n}function dKn(e){const t=uKn(e);return _ve({override:[fKn(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function fKn(e){return t=>{const r=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!r)return null;const s=r[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 o=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:o,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const hKn=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,pKn=dn.mark({class:"cm-variable-highlight"}),_6e=new Kst({regexp:hKn,decoration:()=>pKn}),mKn=dl.fromClass(class{decorations;constructor(e){this.decorations=_6e.createDeco(e)}update(e){this.decorations=_6e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),gKn=mKn,bSt=({className:e,toastOptions:t,...n})=>l.jsx(oyn,{...n,closeButton:!0,richColors:!0,className:Y("mastra-toaster",e),toastOptions:{duration:5e3,...t}}),Rq=(e,t)=>Array.isArray(e)?e.map(t):t(e),ze=(e,t={})=>{if(Array.isArray(e))return e.map(n=>Fm(n,t));if(_e.isValidElement(e)||typeof e=="string")return Fm(e,t);throw new Error("Invalid message type")};ze.success=(e,t={})=>Rq(e,n=>Fm.success(n,t));ze.error=(e,t={})=>Rq(e,n=>Fm.error(n,t));ze.warning=(e,t={})=>Rq(e,n=>Fm.warning(n,t));ze.info=(e,t={})=>Rq(e,n=>Fm.info(n,t));ze.custom=(e,t={})=>Fm(e,t);ze.dismiss=e=>Fm.dismiss(e);ze.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:s,onError:a,options:i={}})=>Fm.promise(e,{loading:t??"Loading...",success:o=>(s?.(o),n),error:o=>(a?.(o),r||(o instanceof Error?o.message:"Error...")),...i});function Vm({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=y.useState(!1),s=y.useRef(null),a=y.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{ze.success(t),r(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{ze.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:a}}function da({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:s}){const[a,i]=y.useState(!1),{handleCopy:o}=Vm({text:e,copyMessage:t}),c=()=>{o(),i(!0),setTimeout(()=>i(!1),2e3)};return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{onClick:c,type:"button",size:r,className:s,"aria-label":a?"Copied!":n,children:a?l.jsx(Lb,{}):l.jsx(nrt,{})})}),l.jsx(er,{children:a?"Copied!":n})]})}const vKn="mastra-theme",yKn="mastra-playground-store",Vfe=e=>e==="dark"||e==="light"||e==="system",bKn=e=>{try{const t=e.getItem(yKn);if(!t)return;const r=JSON.parse(t)?.state?.theme;return Vfe(r)?r:void 0}catch{return}},xKn=(e=vKn)=>({get(){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(Vfe(t))return t;const n=bKn(window.localStorage);return n?(window.localStorage.setItem(e,n),n):null}catch{return null}},set(t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},subscribe(t){if(typeof window>"u")return()=>{};const n=r=>{if(r.key===e){if(r.newValue===null){t(null);return}Vfe(r.newValue)&&t(r.newValue)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)}}),xSt=y.createContext(null),wSt="(prefers-color-scheme: dark)",wKn=typeof window>"u"?y.useEffect:y.useLayoutEffect,SSt=()=>typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia(wSt).matches?"dark":"light",kSt=e=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(wSt);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},SKn=(e,t)=>{e.classList.remove(t==="dark"?"light":"dark"),e.classList.add(t)},_St=({children:e,defaultTheme:t="system",storageKey:n,target:r})=>{const s=y.useMemo(()=>xKn(n),[n]),a=y.useRef(null),[i,o]=y.useState(()=>s.get()??t),c=y.useSyncExternalStore(kSt,SSt,()=>"dark");y.useEffect(()=>s.subscribe(f=>o(f??t)),[s,t]);const u=i==="system"?c:i;wKn(()=>{const f=r??(typeof window>"u"?null:window.document.documentElement);a.current&&a.current!==f&&a.current.classList.remove("dark","light"),f&&SKn(f,u),a.current=f},[u,r]);const d=y.useMemo(()=>({theme:i,resolvedTheme:u,systemTheme:c,setTheme:f=>{o(f),s.set(f)}}),[i,u,c,s]);return l.jsx(xSt.Provider,{value:d,children:e})},kKn=()=>{},Uj=()=>{const e=y.useContext(xSt),t=y.useSyncExternalStore(kSt,SSt,()=>"dark");return y.useMemo(()=>e??{theme:"system",resolvedTheme:t,systemTheme:t,setTheme:kKn},[e,t])};function _Kn(){const e=mj({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:[se.className,se.propertyName],color:"var(--neutral6)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:se.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:se.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:se.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=vt.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 OKn(){const e=vt.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=Km.define([{tag:[se.comment,se.bracket],color:"var(--neutral2)"},{tag:[se.string,se.meta,se.regexp],color:"var(--accent1)"},{tag:[se.atom,se.bool,se.special(se.variableName)],color:"var(--accent6)"},{tag:[se.keyword,se.operator,se.tagName],color:"var(--accent2)"},{tag:[se.function(se.propertyName),se.propertyName],color:"var(--accent5)"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"var(--accent3)"},{tag:[se.variableName,se.number],color:"var(--accent5)"},{tag:[se.name,se.quote],color:"var(--accent1)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[se.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[se.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:[se.deleted],color:"var(--accent2)"},{tag:se.invalid,color:"var(--error)"},{tag:[se.standard(se.tagName)],color:"var(--accent1)"}]);return[e,zb(t)]}const Kb=()=>{const e=Uj().resolvedTheme==="dark";return y.useMemo(()=>e?_Kn():OKn(),[e])},vs=y.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:o,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=Kb(),g=e?JSON.stringify(e,null,2):t??"",v=y.useMemo(()=>{const x=[];return a==="json"?x.push(Kf):a==="markdown"&&(x.push(Bve({base:rk,codeLanguages:yot})),x.push(vt.lineWrapping)),i&&a==="markdown"&&x.push(gKn),c&&a==="markdown"&&x.push(dKn(c)),f===!1&&x.push(xr.readOnly.of(!0)),x},[a,i,c,f]);return l.jsxs("div",{className:Y("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...h,children:[r&&l.jsx(da,{content:g,className:"absolute top-2 right-2 z-20"}),l.jsx(XC,{ref:p,value:g,theme:m,extensions:v,onChange:n,editable:f,"aria-label":"Code editor",placeholder:o,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function OSt(e,t){const{codeToTokens:n,bundledLanguages:r}=await nt(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-8sozPXbo.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([23,1]),import.meta.url);if(!(t in r))return null;const{tokens:s}=await n(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}function Ii({iconSlot:e,titleSlot:t,descriptionSlot:n,actionSlot:r,className:s,as:a="h3"}){return l.jsxs("div",{className:Y("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&l.jsx("div",{className:"mb-4",children:e}),l.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),n&&l.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:n}),r&&l.jsx("div",{className:"mt-5",children:r})]})}const za=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),EKn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),vwe=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),ywe=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Vw=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),ESt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:l.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"})}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_22095",children:l.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),CSt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[l.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"}),l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_20513",children:l.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),CKn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"}),l.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),Pq=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),bwe=e=>l.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),mo=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),qj=e=>l.jsx(ian,{...e}),go=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),ac=e=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),$q=e=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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 km(e){return l.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:[l.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),l.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),l.jsx("path",{d:"M15 2v2"}),l.jsx("path",{d:"M15 20v2"}),l.jsx("path",{d:"M2 15h2"}),l.jsx("path",{d:"M2 9h2"}),l.jsx("path",{d:"M20 15h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M9 2v2"}),l.jsx("path",{d:"M9 20v2"})]})}const TSt=e=>l.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:[l.jsxs("g",{clipPath:"url(#clip0_1480_1723)",children:[l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_1480_1723",children:l.jsx("rect",{width:"180",height:"107.763",fill:"white",transform:"translate(0.0625)"})})})]}),TKn=e=>l.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:l.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"})}),jKn=e=>l.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:l.jsx("g",{transform:"translate(0,2)",children:l.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"})})}),jSt=e=>l.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:l.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}})}),NKn=e=>l.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"18",fill:"none",...e,children:[l.jsx("mask",{id:"mask0_174_2406",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"17",height:"18",children:l.jsx("path",{d:"M17 0.5H0V17.5H17V0.5Z",fill:"white"})}),l.jsxs("g",{mask:"url(#mask0_174_2406)",children:[l.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"}),l.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"}),l.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"})]})]}),AKn=e=>l.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:[l.jsx("mask",{id:"mask0_4345_1846",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"59",style:{maskType:"luminance"},children:l.jsx("path",{d:"M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z",fill:"white"})}),l.jsx("g",{mask:"url(#mask0_4345_1846)",children:l.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"})})]}),IKn=e=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:l.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"})}),RKn=e=>l.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:[l.jsx("rect",{x:"15",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"47",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"111",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"47",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"79",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"111",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"79",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{y:"1",width:"16",height:"160",fill:"black"}),l.jsx("rect",{x:"63",y:"97",width:"16",height:"32",fill:"black"}),l.jsx("rect",{x:"95",y:"33",width:"16",height:"32",fill:"black"}),l.jsx("rect",{x:"127",y:"1",width:"16",height:"32",fill:"black"}),l.jsx("rect",{x:"127",y:"97",width:"16",height:"64",fill:"black"})]}),PKn=e=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"128",height:"113",viewBox:"0 0 128 113",children:[l.jsxs("g",{clipPath:"url(#clip0_236_138)",...e,children:[l.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"}),l.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"}),l.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"}),l.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"}),l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_236_138",children:l.jsx("rect",{width:"128",height:"112.635",fill:"white"})})})]}),O6e=e=>l.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:l.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"})}),$Kn=e=>l.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:l.jsxs("g",{children:[l.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"}),l.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"}),l.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"}),l.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"})]})}),_h=({children:e,className:t,onClick:n})=>l.jsx("div",{tabIndex:n?0:void 0,onKeyDown:r=>{n&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n?.())},className:Y("flex gap-3 group/entity bg-surface3 rounded-xl border border-border1 py-3 px-4",n&&"cursor-pointer hover:bg-surface4 transition-all",t),onClick:n,children:e}),NSt=({children:e,className:t,style:n})=>l.jsx(Ne,{size:"lg",className:Y("text-neutral3 mt-1 shrink-0",t),style:n,children:e}),Oh=({children:e,className:t})=>l.jsx(me,{as:"p",variant:"ui-lg",className:Y("text-neutral6 font-medium",t),children:e}),Eh=({children:e,className:t})=>l.jsx(me,{as:"div",variant:"ui-sm",className:Y("text-neutral3",t),children:e}),Ch=({children:e,className:t})=>l.jsx("div",{className:Y("flex-1 w-full",t),children:e});function aa({resource:e,title:t,description:n,actionSlot:r,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 l.jsx(Ii,{className:s,iconSlot:l.jsx(Ne,{size:"lg",className:"text-neutral3",children:l.jsx(Vsn,{})}),titleSlot:t??a,descriptionSlot:n??i,actionSlot:r})}function pa({title:e,description:t,className:n}){const[r,s]=y.useState(!1),a=Ze(),i=y.useCallback(async()=>{try{s(!0);const{baseUrl:o="",apiPrefix:c}=a.options||{},u=(c||"/api").trim(),d=(u.startsWith("/")?u:`/${u}`).replace(/\/$/,""),f=new URLSearchParams({redirect_uri:window.location.href}),h=`${o}${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 l.jsx(Ii,{className:n,iconSlot:l.jsx(Ne,{size:"lg",className:"text-neutral3",children:l.jsx(Rsn,{})}),titleSlot:e??"Session Expired",descriptionSlot:t??"Your session has expired. Please log in again to continue.",actionSlot:l.jsx(ce,{variant:"default",onClick:i,disabled:r,children:r?"Redirecting...":"Log in"})})}const Zr=({children:e,border:t=!0,className:n})=>l.jsx("header",{className:Y("h-header-default z-50 flex w-full items-center gap-4 bg-transparent px-3",{"border-b border-border1":t},n),children:e}),Ud=({children:e})=>l.jsx(me,{as:"h1",variant:"ui-md",className:"text-neutral6 flex items-center gap-2",children:e}),ld=({children:e})=>l.jsx("div",{className:"ml-auto flex items-center gap-3",children:e}),MKn=({children:e})=>l.jsx("div",{className:"gap-2 flex items-center",children:e}),lb=e=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:l.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"})}),DKn={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},LKn=({className:e,children:t,size:n="default",style:r})=>l.jsx("table",{className:Y("w-full",DKn[n],e),style:r,children:t}),zKn=({className:e,children:t})=>l.jsx("thead",{children:l.jsx("tr",{className:Y("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),FKn=({className:e,children:t,...n})=>l.jsx("th",{className:Y("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...n,children:t}),BKn=({className:e,children:t,...n})=>l.jsx("tbody",{className:Y("",e),...n,children:t}),UKn=y.forwardRef(({className:e,children:t,selected:n=!1,style:r,onClick:s,isActive:a=!1,...i},o)=>{const c=y.useRef(null);y.useEffect(()=>{o&&(typeof o=="function"?o(c.current):o.current=c.current)},[o]),y.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return l.jsx("tr",{className:Y("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",n&&"bg-surface4",s&&"cursor-pointer",e),style:r,onClick:s,ref:c,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),qKn=({className:e,children:t,...n})=>l.jsx("td",{className:Y("text-neutral5 first:pl-3 last:pr-3",e),...n,children:l.jsx("div",{className:Y("flex h-full w-full shrink-0 items-center"),children:t})}),VKn=S_(Y("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:Y(hSt,pwe,mwe),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"}}),iu=y.forwardRef(({className:e,size:t,testId:n,variant:r,error:s,...a},i)=>l.jsx("textarea",{className:Y(VKn({variant:r,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:i,"aria-invalid":s,...a}));iu.displayName="Textarea";const HKn=bbn,WKn=xbn,ASt=wbn;function Wt({open:e,onOpenChange:t,children:n}){return l.jsx(HKn,{open:e,onOpenChange:t,children:n})}const xwe=y.forwardRef(({className:e,...t},n)=>l.jsx(eut,{ref:n,className:Y("dialog-overlay-anim fixed inset-0 z-50 bg-overlay backdrop-blur-xs",e),...t}));xwe.displayName=eut.displayName;const ISt=y.forwardRef(({className:e,...t},n)=>l.jsxs(ASt,{children:[l.jsx(xwe,{}),l.jsx(tut,{ref:n,className:Y("dialog-content-anim","fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%]","w-full max-w-[calc(100%-2rem)] sm:max-w-lg","rounded-xl border border-border1/40 bg-surface2/96 backdrop-blur-md shadow-dialog",e),...t})]}));ISt.displayName=tut.displayName;const RSt=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col gap-0.5 px-4 py-3 text-left",e),...t});RSt.displayName="AlertDialogHeader";const PSt=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse gap-1.5 px-4 py-2.5 sm:flex-row sm:justify-end",e),...t});PSt.displayName="AlertDialogFooter";const $St=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-4 py-3.5 max-h-[50vh]",e),...t});$St.displayName="AlertDialogBody";const MSt=y.forwardRef(({className:e,...t},n)=>l.jsx(sut,{ref:n,className:Y("text-ui-md font-medium",e),...t}));MSt.displayName=sut.displayName;const DSt=y.forwardRef(({className:e,...t},n)=>l.jsx(aut,{ref:n,className:Y("text-ui-sm text-neutral3",e),...t}));DSt.displayName=aut.displayName;const LSt=y.forwardRef(({className:e,...t},n)=>l.jsx(nut,{ref:n,className:Y(gwe({variant:"primary",size:"default"}),e),...t}));LSt.displayName=nut.displayName;const zSt=y.forwardRef(({className:e,...t},n)=>l.jsx(rut,{ref:n,className:Y(gwe({variant:"default",size:"default"}),e),...t}));zSt.displayName=rut.displayName;Wt.Trigger=WKn;Wt.Portal=ASt;Wt.Overlay=xwe;Wt.Content=ISt;Wt.Header=RSt;Wt.Footer=PSt;Wt.Body=$St;Wt.Title=MSt;Wt.Description=DSt;Wt.Action=LSt;Wt.Cancel=zSt;const Wi=y.forwardRef(({className:e,...t},n)=>l.jsx(uye,{ref:n,className:Y("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",kr.all,"hover:border-neutral5 hover:shadow-md",Iq,"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:l.jsx(cut,{className:Y("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:l.jsx(Lb,{className:"h-3.5 w-3.5 stroke-3"})})}));Wi.displayName=uye.displayName;const Hm=jbn,Ip=_e.forwardRef(({className:e,children:t,...n},r)=>l.jsx(fye,{ref:r,className:Y("-outline-offset-2",kr.colors,qw.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...n,children:t}));Ip.displayName=fye.displayName;const Rp=_e.forwardRef(({className:e,children:t,...n},r)=>l.jsx(pye,{ref:r,className:Y("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),...n,children:t}));Rp.displayName=pye.displayName;const Pr={root:"flex flex-col gap-1.5",trigger:Y("inline-flex w-full min-w-32 select-none items-center justify-between gap-1.5 whitespace-nowrap","rounded-lg border border-border1 bg-transparent px-2.5 text-ui-smd leading-ui-sm text-neutral4","outline-none transition-colors duration-normal ease-out-custom","hover:bg-surface3 hover:text-neutral6 hover:border-border2","focus:outline-none focus-visible:outline-none focus-visible:border-border2","data-[popup-open]:bg-surface3 data-[popup-open]:text-neutral6 data-[popup-open]:border-border2","disabled:cursor-not-allowed disabled:opacity-50"),triggerError:"border-accent2 hover:border-accent2 focus-visible:border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 text-neutral3 opacity-70",placeholder:"text-neutral3",popup:Y("min-w-(--anchor-width) w-max max-w-[500px] rounded-xl border border-border1 bg-surface3 text-neutral4","shadow-dialog","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:Y("flex items-center border-b border-border1 px-2.5 py-2",kr.colors),searchIcon:Y("mr-2 h-4 w-4 shrink-0 text-neutral3",kr.colors),searchInput:Y("flex h-7 w-full rounded-md bg-transparent py-1 text-ui-smd leading-ui-sm text-neutral6","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-none focus:outline-none focus-visible:outline-none",kr.colors),empty:"not-empty:block hidden py-6 text-center text-ui-smd text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:Y("relative flex cursor-pointer select-none items-center gap-2.5 rounded-lg px-2 py-1.5","text-ui-smd leading-ui-sm text-neutral4","outline-none focus:outline-none focus-visible:outline-none",kr.colors,"data-highlighted:bg-surface4 data-highlighted:text-neutral6"),itemSelected:"data-selected:text-neutral6",checkContainer:"flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:Y("h-4 w-4 text-neutral6",kr.opacity),checkbox:"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border2",checkboxIcon:"h-3 w-3 text-surface1",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-ui-sm text-neutral3 truncate",optionEnd:"ml-auto",error:"text-ui-sm text-accent2"};function Mc({options:e,value:t,onValueChange:n,placeholder:r="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:o=!1,size:c="default",open:u,onOpenChange:d,container:f,error:h}){const p=e.find(g=>g.value===t)??null,m=g=>{g&&n?.(g.value)};return l.jsxs("div",{className:Pr.root,children:[l.jsxs(fdt,{items:e,value:p,onValueChange:m,disabled:o,open:u,onOpenChange:d,children:[l.jsxs(xdt,{className:Y(Pr.trigger,Bl[c],h&&Pr.triggerError,i),children:[l.jsxs("span",{className:"truncate flex items-center gap-2",children:[p?.start,l.jsx(iwn,{placeholder:r})]}),l.jsx(zM,{className:Pr.chevron})]}),l.jsx(_dt,{container:f,children:l.jsx(Cdt,{align:"start",sideOffset:4,className:Pr.positioner,children:l.jsxs(Tdt,{className:Pr.popup,children:[l.jsxs("div",{className:Pr.searchContainer,children:[l.jsx($C,{className:Pr.searchIcon}),l.jsx(bdt,{className:Pr.searchInput,placeholder:s})]}),l.jsx(Rdt,{className:Pr.empty,children:a}),l.jsx(Sdt,{className:Pr.list,children:g=>l.jsxs(Idt,{value:g,className:Y(Pr.item,Pr.itemSelected),children:[l.jsx("span",{className:Pr.checkContainer,children:l.jsx(Zwn,{children:l.jsx(Lb,{className:Pr.checkIcon})})}),l.jsxs("span",{className:Pr.optionContent,children:[g.start,l.jsxs("span",{className:Pr.optionText,children:[l.jsx("span",{className:Pr.optionLabel,children:g.label}),g.description&&l.jsx("span",{className:Pr.optionDescription,children:g.description})]}),g.end?l.jsx("div",{className:Pr.optionEnd,children:g.end}):null]})]},g.value)})]})})})]}),h&&l.jsx("span",{className:Pr.error,children:h})]})}function FSt({options:e,value:t=[],onValueChange:n,placeholder:r="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:o=!1,size:c="md",open:u,onOpenChange:d,container:f,error:h}){const p=e.filter(v=>t.includes(v.value)),m=v=>{v&&n?.(v.map(x=>x.value))},g=p.length===0?r:`${p.length} selected`;return l.jsxs("div",{className:Pr.root,children:[l.jsxs(fdt,{multiple:!0,items:e,value:p,onValueChange:m,disabled:o,open:u,onOpenChange:d,children:[l.jsxs(xdt,{className:Y(Pr.trigger,Bl[c],h&&Pr.triggerError,i),children:[l.jsx("span",{className:Y("truncate",p.length===0&&Pr.placeholder),children:g}),l.jsx(zM,{className:Pr.chevron})]}),l.jsx(_dt,{container:f,children:l.jsx(Cdt,{align:"start",sideOffset:4,className:Pr.positioner,children:l.jsxs(Tdt,{className:Pr.popup,children:[l.jsxs("div",{className:Pr.searchContainer,children:[l.jsx($C,{className:Pr.searchIcon}),l.jsx(bdt,{className:Pr.searchInput,placeholder:s})]}),l.jsx(Rdt,{className:Pr.empty,children:a}),l.jsx(Sdt,{className:Pr.list,children:v=>{const x=t.includes(v.value);return l.jsxs(Idt,{value:v,className:Pr.item,children:[l.jsx("span",{className:Y(Pr.checkbox,x?Pr.checkboxSelected:Pr.checkboxUnselected),children:x&&l.jsx(Lb,{className:Pr.checkboxIcon})}),l.jsxs("span",{className:Pr.optionContent,children:[v.start,l.jsxs("span",{className:Pr.optionText,children:[l.jsx("span",{className:Pr.optionLabel,children:v.label}),v.description&&l.jsx("span",{className:Pr.optionDescription,children:v.description})]}),v.end?l.jsx("div",{className:Pr.optionEnd,children:v.end}):null]})]},v.value)}})]})})})]}),h&&l.jsx("span",{className:Pr.error,children:h})]})}const Fr=XM,BSt=Fct,ZKn=KM,GKn=t2,USt=y.forwardRef(({className:e,...t},n)=>l.jsx(yj,{ref:n,className:Y("dialog-overlay-anim fixed inset-0 z-50 bg-overlay backdrop-blur-xs",e),...t}));USt.displayName=yj.displayName;const $r=y.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(ZKn,{children:[l.jsx(USt,{}),l.jsxs(bj,{ref:r,className:Y("dialog-content-anim","fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%]","w-full max-w-[calc(100%-2rem)] sm:max-w-lg","rounded-xl border border-border1/40 bg-surface2/96 backdrop-blur-md shadow-dialog",e),...n,children:[t,l.jsx(t2,{asChild:!0,children:l.jsx(ce,{variant:"ghost",size:"sm",className:"absolute top-3 right-3","aria-label":"Close",children:l.jsx(Ju,{})})})]})]}));$r.displayName=bj.displayName;const Br=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col gap-0.5 px-4 py-3 text-left",e),...t});Br.displayName="DialogHeader";const ph=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse gap-1.5 px-4 py-2.5 sm:flex-row sm:justify-end",e),...t});ph.displayName="DialogFooter";const is=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-4 py-3.5 max-h-[50vh]",e),...t});is.displayName="DialogBody";const Mr=y.forwardRef(({className:e,...t},n)=>l.jsx(JM,{ref:n,className:Y("text-ui-md font-medium",e),...t}));Mr.displayName=JM.displayName;const va=y.forwardRef(({className:e,...t},n)=>l.jsx(e2,{ref:n,className:Y("sr-only",e),...t}));va.displayName=e2.displayName;const qSt=y.forwardRef(({className:e,...t},n)=>l.jsx(tf,{ref:n,className:Y("flex h-full w-full flex-col overflow-hidden rounded-xl bg-surface3 text-neutral4",e),...t}));qSt.displayName=tf.displayName;const QKn=({children:e,title:t="Command Palette",description:n="Search for commands and actions",...r})=>{const s=y.useCallback((i,o)=>{const c=i.toLowerCase();return o.toLowerCase().split(/\s+/).filter(Boolean).every(h=>c.includes(h))?1:0},[]),a=y.useCallback(i=>{i.stopPropagation()},[]);return l.jsx(Fr,{...r,children:l.jsxs($r,{className:"overflow-hidden p-0",children:[l.jsx(Mr,{className:"sr-only",children:t}),l.jsx(va,{className:"sr-only",children:n}),l.jsx(qSt,{filter:s,onKeyDown:a,className:Y("**:[[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})]})})},VSt=y.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:Y("flex items-center border-b border-border1 px-3",kr.colors),"cmdk-input-wrapper":"",children:[l.jsx($C,{className:Y("mr-2 h-4 w-4 shrink-0 text-neutral3",kr.colors)}),l.jsx(tf.Input,{ref:n,className:Y("flex h-10 w-full rounded-md bg-transparent py-3 text-ui-smd leading-ui-sm text-neutral6","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-none focus:outline-none focus-visible:outline-none",kr.colors,e),...t})]}));VSt.displayName=tf.Input.displayName;const HSt=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.List,{ref:n,className:Y("max-h-dropdown-max-height overflow-y-auto overflow-x-hidden",e),...t}));HSt.displayName=tf.List.displayName;const WSt=y.forwardRef((e,t)=>l.jsx(tf.Empty,{ref:t,className:"py-6 text-center text-ui-smd text-neutral3",...e}));WSt.displayName=tf.Empty.displayName;const Wx=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.Group,{ref:n,className:Y("overflow-hidden p-1 text-neutral4","**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:pt-1.5 **:[[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-ui-xs [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:uppercase **:[[cmdk-group-heading]]:tracking-wider **:[[cmdk-group-heading]]:text-neutral3",e),...t}));Wx.displayName=tf.Group.displayName;const Z1=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.Separator,{ref:n,className:Y("-mx-1 h-px bg-border1",e),...t}));Z1.displayName=tf.Separator.displayName;const Ml=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.Item,{ref:n,className:Y("relative flex cursor-pointer select-none items-center gap-2.5 rounded-lg px-2 py-1.5 text-ui-smd leading-ui-sm text-neutral4","outline-none focus:outline-none focus-visible:outline-none",kr.colors,"data-[selected=true]:bg-surface4 data-[selected=true]:text-neutral6","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-neutral3 data-[selected=true]:[&_svg]:text-neutral6",e),...t}));Ml.displayName=tf.Item.displayName;const ZSt=({className:e,...t})=>l.jsx("span",{className:Y("ml-auto text-ui-xs tabular-nums tracking-wider text-neutral3",e),...t});ZSt.displayName="CommandShortcut";const Ri=eSn,Pi=tSn,mi=y.forwardRef(({className:e,children:t,size:n="default",...r},s)=>l.jsxs(pft,{ref:s,className:Y("inline-flex w-full cursor-pointer select-none items-center justify-between gap-1.5 whitespace-nowrap",Bl[n],"rounded-lg border border-border1 bg-transparent px-2.5 text-ui-smd leading-ui-sm text-neutral4","outline-none transition-colors duration-normal ease-out-custom","hover:bg-surface3 hover:text-neutral6 hover:border-border2","focus:outline-none focus-visible:outline-none focus-visible:border-border2","data-[state=open]:bg-surface3 data-[state=open]:text-neutral6 data-[state=open]:border-border2","data-[placeholder]:text-neutral3","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:truncate",e),...r,children:[t,l.jsx(nSn,{asChild:!0,children:l.jsx(Rge,{className:Y("h-4 w-4 shrink-0 text-neutral3 opacity-70",kr.colors)})})]}));mi.displayName=pft.displayName;const gi=y.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(rSn,{children:l.jsx(mft,{ref:s,className:Y("relative z-50 min-w-32 max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-xl border border-border1 bg-surface3 text-neutral4 shadow-dialog 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-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:l.jsx(sSn,{className:Y("p-1",n==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),children:t})})}));gi.displayName=mft.displayName;const hs=y.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(gft,{ref:r,className:Y("relative flex w-full cursor-pointer select-none items-center gap-2.5 rounded-lg py-1.5 pl-2 pr-8 text-neutral4 text-ui-smd leading-ui-sm","outline-none focus:outline-none focus-visible:outline-none",kr.colors,"hover:bg-surface4 hover:text-neutral6","focus:bg-surface4 focus:text-neutral6","data-[highlighted]:bg-surface4 data-[highlighted]:text-neutral6","data-[state=checked]:text-neutral6","data-disabled:pointer-events-none data-disabled:opacity-50",e),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(iSn,{children:l.jsx(Lb,{className:"h-4 w-4 text-neutral6"})})}),l.jsx(aSn,{children:t})]}));hs.displayName=gft.displayName;const bu=({children:e,defaultTab:t,value:n,onValueChange:r,className:s})=>{const[a,i]=y.useState(t),o=n!==void 0&&r!==void 0,c=o?n:a,u=d=>{const f=d;o?r(f):i(f)};return l.jsx(bSn,{value:c,onValueChange:u,className:Y("overflow-y-auto",s),children:e})},xu=({children:e,className:t})=>l.jsx("div",{className:Y("w-full overflow-x-auto",t),children:l.jsx(xSn,{className:Y("flex items-center relative w-max min-w-full","text-ui-lg border-b border-border1",t),children:e})}),Wr=({children:e,value:t,onClick:n,onClose:r,disabled:s,className:a})=>l.jsxs(wSn,{value:t,disabled:s,className:Y("py-2 px-5 text-ui-md font-normal text-neutral3 border-b-2 border-transparent","whitespace-nowrap shrink-0 flex items-center justify-center gap-1.5 outline-none cursor-pointer",kr.colors,qw.visible,"hover:text-neutral4","data-[state=active]:text-neutral5 data-[state=active]:border-neutral3","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:text-neutral3",a),onClick:n,children:[e,r&&l.jsx("button",{onClick:i=>{i.stopPropagation(),r()},className:Y("p-0.5 hover:bg-surface4 rounded",kr.colors,"hover:text-neutral5"),"aria-label":"Close tab",children:l.jsx(Ju,{className:"w-3 h-3"})})]}),Ns=({children:e,value:t,className:n})=>l.jsx(SSn,{value:t,className:Y("grid py-3 overflow-y-auto ring-offset-background",qw.visible,n),children:e});function YKn({code:e,options:t,value:n,onValueChange:r,selector:s="select",fileName:a,lang:i,copyMessage:o,copyTooltip:c,className:u}){const d=t&&t.length>0,f=d&&s==="tabs",h=d&&s==="select",p=n??t?.[0]?.value;return l.jsxs("figure",{className:Y("group relative flex w-full flex-col overflow-hidden rounded-2xl border border-border2/40 bg-surface2",u),children:[f&&t&&l.jsx(bu,{defaultTab:t[0].value,value:p,onValueChange:r??(()=>{}),children:l.jsx(xu,{children:t.map(m=>l.jsx(Wr,{value:m.value,children:m.label},m.value))})}),h&&t&&l.jsx("div",{className:"flex items-center border-b border-border2/40 px-2 py-1.5",children:l.jsxs(Ri,{value:p,onValueChange:r,children:[l.jsx(mi,{size:"sm",variant:"ghost",children:l.jsx(Pi,{})}),l.jsx(gi,{children:t.map(m=>l.jsx(hs,{value:m.value,children:m.label},m.value))})]})}),!d&&a&&l.jsx("div",{className:"flex items-center border-b border-border2/40 px-4 py-2",children:l.jsx("figcaption",{className:"font-mono text-ui-sm text-neutral4",children:a})}),l.jsxs("div",{className:"relative",children:[l.jsx(XKn,{code:e,lang:i}),l.jsx(da,{content:e,copyMessage:o,tooltip:c,size:"sm",className:Y("absolute top-2 right-2 opacity-100 pointer-fine:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",kr.opacity)})]})]})}function XKn({code:e,lang:t}){const[n,r]=y.useState(null);y.useEffect(()=>{if(!t){r(null);return}r(null);let a=!1;return OSt(e,t).then(i=>{!a&&i&&r(i)}).catch(()=>{}),()=>{a=!0}},[e,t]);const s="px-4 py-3 font-mono text-ui-sm text-neutral5 whitespace-pre-wrap break-all";return!t||!n?l.jsx("pre",{className:s,children:e}):l.jsx("pre",{className:s,children:l.jsx("code",{children:n.map((a,i)=>l.jsxs(y.Fragment,{children:[l.jsx("span",{children:a.map((o,c)=>l.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",children:o.content},c))}),i!==n.length-1&&`
299
+ color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(s),a=!1,s}return i.updateDeps=o=>{r=o},i}function c6e(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const kYn=(e,t)=>Math.abs(e-t)<1.01,_Yn=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}},u6e=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},OYn=e=>e,EYn=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=t;s<=n;s++)r.push(s);return r},CYn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=i=>{const{width:o,height:c}=i;t({width:Math.round(o),height:Math.round(c)})};if(s(u6e(n)),!r.ResizeObserver)return()=>{};const a=new r.ResizeObserver(i=>{const o=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(u6e(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},d6e={passive:!0},f6e=typeof window>"u"?!0:"onscrollend"in window,TYn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let s=0;const a=e.options.useScrollendEvent&&f6e?()=>{}:_Yn(r,()=>{t(s,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:h}=e.options;s=f?n.scrollLeft*(h&&-1||1):n.scrollTop,a(),t(s,d)},o=i(!0),c=i(!1);n.addEventListener("scroll",o,d6e);const u=e.options.useScrollendEvent&&f6e;return u&&n.addEventListener("scrollend",c,d6e),()=>{n.removeEventListener("scroll",o),u&&n.removeEventListener("scrollend",c)}},jYn=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},NYn=(e,{adjustments:t=0,behavior:n},r)=>{var s,a;const i=e+t;(a=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||a.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:n})};class AYn{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(a=>{const i=()=>{const o=a.target,c=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(o,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var a;return(a=r())==null?void 0:a.observe(s,{box:"border-box"})},unobserve:s=>{var a;return(a=r())==null?void 0:a.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:OYn,rangeExtractor:EYn,onChange:()=>{},measureElement:jYn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=jO(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=a,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,a=new Map;for(let i=r-1;i>=0;i--){const o=n[i];if(s.has(o.lane))continue;const c=a.get(o.lane);if(c==null||o.end>c.end?a.set(o.lane,o):o.end<c.end&&s.set(o.lane,!0),s.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((i,o)=>i.end===o.end?i.index-o.index:i.end-o.end)[0]:void 0},this.getMeasurementOptions=jO(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,s,a,i,o)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:a,enabled:i,lanes:o}),{key:!1}),this.getMeasurements=jO(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:a,enabled:i,lanes:o},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const h of this.laneAssignments.keys())h>=n&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),f=new Array(o).fill(void 0);for(let h=0;h<u;h++){const p=d[h];p&&(f[p.lane]=h)}for(let h=u;h<n;h++){const p=a(h),m=this.laneAssignments.get(h);let g,v;if(m!==void 0&&this.options.lanes>1){g=m;const _=f[g],O=_!==void 0?d[_]:void 0;v=O?O.end+this.options.gap:r+s}else{const _=this.options.lanes===1?d[h-1]:this.getFurthestMeasurement(d,h);v=_?_.end+this.options.gap:r+s,g=_?_.lane:h%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(h,g)}const x=c.get(p),w=typeof x=="number"?x:this.options.estimateSize(h),S=v+w;d[h]={index:h,start:v,size:w,end:S,key:p,lane:g},f[g]=h}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=jO(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,a)=>this.range=n.length>0&&r>0?IYn({measurements:n,outerSize:r,scrollOffset:s,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=jO(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,a,i)=>a===null||i===null?[]:n({startIndex:a,endIndex:i,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,s-a),o=Math.min(this.options.count-1,s+a);return n>=i&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,o)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(o))});return}const r=this.indexFromElement(n),s=this.options.getItemKey(r),a=this.elementsCache.get(s);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s;const a=this.measurementsCache[n];if(!a)return;const i=this.itemSizeCache.get(a.key)??a.size,o=r-i;o!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,o,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,r)),this.notify(!1))},this.getVirtualItems=jO(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let a=0,i=n.length;a<i;a++){const o=n[a],c=r[o];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return c6e(r[u1t(0,r.length-1,s=>c6e(r[s]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,s=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+a?"end":"start"),r==="center"?n+=(s-a)/2:r==="end"&&(n-=a);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),a=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const a=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getOffsetForIndex(n,r);if(!a)return;const[i,o]=a,c=this.now();this.scrollState={index:n,align:o,behavior:s,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const a=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&a.some(o=>o===null);){const o=r[i];a[o.lane]===null&&(a[o.lane]=o.end),i--}s=Math.max(...a.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,a=1,i=s!==this.scrollState.lastTargetOffset;if(!i&&kYn(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const u1t=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,a=n(s);if(a<r)e=s+1;else if(a>r)t=s-1;else return s}return e>0?e-1:0};function IYn({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const s=e.length-1,a=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:s};let i=u1t(0,s,a,n),o=i;if(r===1)for(;o<s&&e[o].end<n+t;)o++;else if(r>1){const c=Array(r).fill(0);for(;o<s&&c.some(d=>d<n+t);){const d=e[o];c[d.lane]=d.end,o++}const u=Array(r).fill(n+t);for(;i>=0&&u.some(d=>d>=n);){const d=e[i];u[d.lane]=d.start,i--}i=Math.max(0,i-i%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:i,endIndex:o}}const h6e=typeof document<"u"?y.useLayoutEffect:y.useEffect;function RYn({useFlushSync:e=!0,...t}){const n=y.useReducer(()=>({}),{})[1],r={...t,onChange:(a,i)=>{var o;e&&i?hu.flushSync(n):n(),(o=t.onChange)==null||o.call(t,a,i)}},[s]=y.useState(()=>new AYn(r));return s.setOptions(r),h6e(()=>s._didMount(),[]),h6e(()=>s._willUpdate()),s}function d1t(e){return RYn({observeElementRect:CYn,observeElementOffset:TYn,scrollToFn:NYn,...e})}var Sl=(e=>(e.AGENT="agent",e.SCORER="scorer",e.RAG_INGESTION="rag_ingestion",e.TRAJECTORY="trajectory",e.INPUT_PROCESSOR="input_processor",e.INPUT_STEP_PROCESSOR="input_step_processor",e.OUTPUT_PROCESSOR="output_processor",e.OUTPUT_STEP_PROCESSOR="output_step_processor",e.WORKFLOW_STEP="workflow_step",e.TOOL="tool",e.WORKFLOW_RUN="workflow_run",e.MEMORY="memory",e))(Sl||{});Xk().describe("Database record creation time");var PYn=Xk().describe("Database record last update time");PYn.nullable();var kq=Ee({page:DNe().int().min(0).optional().default(0).describe("Zero-indexed page number"),perPage:DNe().int().min(1).max(100).optional().default(10).describe("Number of items per page")}).describe("Pagination options for list queries"),_q=Ee({total:Tt().describe("Total number of items available"),page:Tt().describe("Current page"),perPage:cr([Tt(),Qt(!1)]).describe("Number of items per page, or false if pagination is disabled"),hasMore:al().describe("True if more pages are available")}),$Yn=Ee({start:LNe().optional().describe("Start of date range (inclusive by default)"),end:LNe().optional().describe("End of date range (inclusive by default)"),startExclusive:al().optional().describe("When true, excludes the start date from results (uses > instead of >=)"),endExclusive:al().optional().describe("When true, excludes the end date from results (uses < instead of <=)")}).describe("Date range filter for timestamps"),D2=Zo(["ASC","DESC"]).describe("Sort direction: 'ASC' | 'DESC'"),Uv=Zo(["sum","avg","min","max","count","count_distinct","last"]).describe("Aggregation function"),x_=Zo(["1m","5m","15m","1h","1d"]).describe("Time bucket interval"),rwe=Zo(["previous_period","previous_day","previous_week"]).describe("Comparison period for aggregate queries"),w_=It(pe()).min(1).describe("Fields to group by"),swe=It(Tt().min(0).max(1)).min(1).describe("Percentile values (0-1)"),awe={value:Tt().nullable().describe("Aggregated value"),previousValue:Tt().nullable().optional().describe("Value from comparison period"),changePercent:Tt().nullable().optional().describe("Percentage change from comparison period")},iwe=xa(pe(),pe().nullable()).describe("Dimension values for this group"),Dj=Tt().describe("Aggregated value"),Lj=Xk().describe("Bucket timestamp"),owe=Tt().describe("Percentile value"),lwe=Tt().describe("Percentile value at this bucket"),zj=qme(Sl).describe("Entity type (e.g., 'agent' | 'processor' | 'tool' | 'workflow')"),MYn=pe().describe('ID of the entity (e.g., "weatherAgent", "orderWorkflow")'),f1t=pe().describe("Name of the entity"),h1t=pe().describe("Human end-user who triggered execution"),p1t=pe().describe("Multi-tenant organization/account"),m1t=pe().describe("Broader resource context (Mastra memory compatibility)"),g1t=pe().describe("Unique execution run identifier"),v1t=pe().describe("Session identifier for grouping traces"),y1t=pe().describe("Conversation thread identifier"),b1t=pe().describe("HTTP request ID for log correlation"),x1t=pe().describe('Environment (e.g., "production" | "staging" | "development")'),DYn=pe().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),w1t=pe().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),S1t=pe().describe("Name of the service"),k1t=qme(Sl).describe("Entity type of the parent entity"),LYn=pe().describe("ID of the parent entity"),_1t=pe().describe("Name of the parent entity"),O1t=qme(Sl).describe("Entity type of the root entity"),zYn=pe().describe("ID of the root entity"),E1t=pe().describe("Name of the root entity"),C1t=pe().describe("Version ID of the entity that produced this signal (e.g., agent version, workflow version)"),T1t=pe().describe("Version ID of the parent entity that produced this signal"),j1t=pe().describe("Version ID of the root entity that produced this signal"),Oq=pe().describe("Experiment or eval run identifier"),FYn=xa(pe(),ni()).describe('Arbitrary package/app version info (e.g., {"core": "1.0.0", "memory": "1.0.0", "gitSha": "abcd1234"})'),N1t=xa(pe(),ni()).describe("User-defined metadata for custom filtering"),A1t=It(pe()).describe("Labels for filtering"),BYn={entityType:zj.nullish(),entityId:MYn.nullish(),entityName:f1t.nullish(),parentEntityType:k1t.nullish(),parentEntityId:LYn.nullish(),parentEntityName:_1t.nullish(),rootEntityType:O1t.nullish(),rootEntityId:zYn.nullish(),rootEntityName:E1t.nullish(),userId:h1t.nullish(),organizationId:p1t.nullish(),resourceId:m1t.nullish(),runId:g1t.nullish(),sessionId:v1t.nullish(),threadId:y1t.nullish(),requestId:b1t.nullish(),environment:x1t.nullish(),serviceName:S1t.nullish(),scope:FYn.nullish(),entityVersionId:C1t.nullish(),parentEntityVersionId:T1t.nullish(),rootEntityVersionId:j1t.nullish(),experimentId:Oq.nullish()},Eq={...BYn,executionSource:w1t.nullish(),tags:A1t.nullish()};DYn.nullish();var Cq={timestamp:$Yn.optional().describe("Filter by timestamp range"),traceId:pe().optional().describe("Filter by trace ID"),spanId:pe().optional().describe("Filter by span ID"),entityType:zj.optional(),entityName:f1t.optional(),entityVersionId:C1t.optional(),parentEntityVersionId:T1t.optional(),rootEntityVersionId:j1t.optional(),userId:h1t.optional(),organizationId:p1t.optional(),experimentId:Oq.optional(),serviceName:S1t.optional(),environment:x1t.optional(),parentEntityType:k1t.optional(),parentEntityName:_1t.optional(),rootEntityType:O1t.optional(),rootEntityName:E1t.optional(),resourceId:m1t.optional(),runId:g1t.optional(),sessionId:v1t.optional(),threadId:y1t.optional(),requestId:b1t.optional(),executionSource:w1t.optional(),tags:It(pe()).optional().describe("Filter by tags (must have all specified tags)")},Tq=pe().describe("Unique trace identifier"),jq=pe().describe("Unique span identifier within a trace"),eB=Zo(["debug","info","warn","error","fatal"]),I1t=pe().describe("Log message"),R1t=xa(pe(),ni()).describe("Structured data attached to the log"),P1t=Ee({logId:pe().nullish().describe("Unique id for this log event"),timestamp:Xk().describe("When the log was created"),level:eB.describe("Log severity level"),message:I1t,data:R1t.nullish(),traceId:Tq.nullish(),spanId:jq.nullish(),...Eq,source:pe().nullish().describe("Execution source"),metadata:N1t.nullish()}).describe("Log record as stored in the database");Ee({level:eB,message:I1t,data:R1t.optional(),tags:A1t.optional()}).describe("User-provided log input");var UYn=P1t;Ee({logs:It(UYn)}).describe("Arguments for batch creating logs");var qYn=Ee({...Cq,source:pe().optional().describe("Filter by execution source"),level:cr([eB,It(eB)]).optional().describe("Filter by log level(s)")}).describe("Filters for querying logs"),VYn=Zo(["timestamp"]).describe("Field to order by: 'timestamp'"),HYn=Ee({field:VYn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:qYn.optional().describe("Optional filters to apply"),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:HYn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing logs");Ee({pagination:_q,logs:It(P1t)});var Fj=pe().describe("Identifier of the scorer (e.g., relevance, accuracy)"),$1t=pe().describe("Display name of the scorer"),M1t=pe().describe("Version of the scorer"),Ev=pe().describe("How the score was produced (e.g., manual, automated, experiment)"),D1t=Tt().describe("Score value (range defined by scorer)"),L1t=pe().describe("Explanation for the score"),z1t=Ee({scoreId:pe().nullish().describe("Unique id for this score event"),timestamp:Xk().describe("When the score was recorded"),traceId:Tq.nullish().describe("Trace that anchors the scored target when available"),spanId:jq.nullish().describe("Span ID this score applies to"),scorerId:Fj,scorerName:$1t.nullish(),scorerVersion:M1t.nullish(),scoreSource:Ev.nullish(),source:Ev.nullish(),score:D1t,reason:L1t.nullish(),...Eq,scoreTraceId:pe().nullish().describe("Trace ID of the scoring run for debugging score generation"),metadata:xa(pe(),ni()).nullish().describe("User-defined metadata")}).describe("Score record as stored in the database");Ee({scorerId:Fj,scorerName:$1t.optional(),scorerVersion:M1t.optional(),scoreSource:Ev.optional(),source:Ev.optional(),score:D1t,reason:L1t.optional(),metadata:xa(pe(),ni()).optional().describe("Additional scorer-specific metadata"),experimentId:Oq.optional(),scoreTraceId:pe().optional().describe("Trace ID of the scoring run for debugging score generation"),targetEntityType:zj.optional().describe("Entity type the scorer evaluated when known")}).describe("User-provided score input");var cwe=z1t;Ee({score:cwe}).describe("Arguments for creating a score");Ee({score:cwe.omit({timestamp:!0})}).describe("Arguments for creating a score");Ee({success:al()}).describe("Response from creating a score");Ee({scores:It(cwe)}).describe("Arguments for batch recording scores");var L2=Ee({...Cq,scorerId:cr([pe(),It(pe())]).optional().describe("Filter by scorer ID(s)"),scoreSource:Ev.optional().describe("Filter by how the score was produced"),source:Ev.optional().describe("Filter by how the score was produced")}).describe("Filters for querying scores"),WYn=Zo(["timestamp","score"]).describe("Field to order by: 'timestamp' | 'score'"),ZYn=Ee({field:WYn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:L2.optional(),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:ZYn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing scores");Ee({pagination:_q,scores:It(z1t)});Ee({scorerId:Fj,scoreSource:Ev.optional(),aggregation:Uv,filters:L2.optional(),comparePeriod:rwe.optional()}).describe("Arguments for getting a score aggregate");Ee(awe);Ee({scorerId:Fj,scoreSource:Ev.optional(),groupBy:w_,aggregation:Uv,filters:L2.optional()}).describe("Arguments for getting a score breakdown");Ee({groups:It(Ee({dimensions:iwe,value:Dj}))});Ee({scorerId:Fj,scoreSource:Ev.optional(),interval:x_,aggregation:Uv,filters:L2.optional(),groupBy:w_.optional()}).describe("Arguments for getting score time series");Ee({series:It(Ee({name:pe().describe("Series name (scorer ID or group key)"),points:It(Ee({timestamp:Lj,value:Dj}))}))});Ee({scorerId:Fj,scoreSource:Ev.optional(),percentiles:swe,interval:x_,filters:L2.optional()}).describe("Arguments for getting score percentiles");Ee({series:It(Ee({percentile:owe,points:It(Ee({timestamp:Lj,value:lwe}))}))});var Cv=pe().describe("Source of feedback (e.g., 'user', 'system', 'manual')"),Bj=pe().describe("Type of feedback (e.g., 'thumbs', 'rating', 'correction')"),F1t=cr([Tt(),pe()]).describe("Feedback value (rating number or correction text)"),B1t=pe().describe("Additional comment or context"),tB=pe().describe("User who provided the feedback");function uwe(e){if(!e||typeof e!="object"||Array.isArray(e))return e;const t={...e};return typeof t.userId=="string"&&t.feedbackUserId==null&&(t.feedbackUserId=t.userId,delete t.userId),t}var Nq=Ee({feedbackId:pe().nullish().describe("Unique id for this feedback event"),timestamp:Xk().describe("When the feedback was recorded"),traceId:Tq.nullish().describe("Trace that anchors the feedback target when available"),spanId:jq.nullish().describe("Span ID this feedback applies to"),feedbackSource:Cv.nullish(),source:Cv.nullish(),feedbackType:Bj,value:F1t,comment:B1t.nullish(),feedbackUserId:tB.nullish(),...Eq,sourceId:pe().nullish().describe("ID of the source record this feedback is linked to (e.g. experiment result ID)"),metadata:xa(pe(),ni()).nullish().describe("User-defined metadata")}),GYn=Ee(Nq.shape).describe("Feedback record as stored in the database"),QYn=Ee({feedbackSource:Cv.optional(),source:Cv.optional(),feedbackType:Bj,value:F1t,comment:B1t.optional(),feedbackUserId:tB.optional(),userId:tB.optional(),metadata:xa(pe(),ni()).optional().describe("Additional feedback-specific metadata"),experimentId:Oq.optional(),sourceId:pe().optional().describe("ID of the source record this feedback is linked to")});Ee(QYn.shape).describe("User-provided feedback input");Ee({feedback:Zme(uwe,Nq)}).describe("Arguments for creating feedback");Ee({feedback:Nq.omit({timestamp:!0})}).describe("Arguments for creating feedback");Ee({success:al()}).describe("Response from creating feedback");Ee({feedbacks:It(Zme(uwe,Nq))}).describe("Arguments for batch recording feedback");var U1t=Ee({...Cq,feedbackType:cr([pe(),It(pe())]).optional().describe("Filter by feedback type(s)"),feedbackSource:Cv.optional(),source:Cv.optional(),feedbackUserId:tB.optional()}),Aq=Ee(U1t.shape).describe("Filters for querying feedback"),YYn=Zo(["timestamp"]).describe("Field to order by: 'timestamp'"),XYn=Ee({field:YYn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:Zme(uwe,U1t).optional().describe("Optional filters to apply"),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:XYn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing feedback");Ee({pagination:_q,feedback:It(GYn)});Ee({feedbackType:Bj,feedbackSource:Cv.optional(),aggregation:Uv,filters:Aq.optional(),comparePeriod:rwe.optional()}).describe("Arguments for getting a feedback aggregate over numeric values");Ee(awe);Ee({feedbackType:Bj,feedbackSource:Cv.optional(),groupBy:w_,aggregation:Uv,filters:Aq.optional()}).describe("Arguments for getting a feedback breakdown over numeric values");Ee({groups:It(Ee({dimensions:iwe,value:Dj}))});Ee({feedbackType:Bj,feedbackSource:Cv.optional(),interval:x_,aggregation:Uv,filters:Aq.optional(),groupBy:w_.optional()}).describe("Arguments for getting feedback time series over numeric values");Ee({series:It(Ee({name:pe().describe("Series name (feedback type or group key)"),points:It(Ee({timestamp:Lj,value:Dj}))}))});Ee({feedbackType:Bj,feedbackSource:Cv.optional(),percentiles:swe,interval:x_,filters:Aq.optional()}).describe("Arguments for getting feedback percentiles over numeric values");Ee({series:It(Ee({percentile:owe,points:It(Ee({timestamp:Lj,value:lwe}))}))});Zo(["counter","gauge","histogram"]);var q1t=pe().describe("Metric name (e.g., mastra_agent_duration_ms)"),V1t=Tt().describe("Metric value"),H1t=xa(pe(),pe()).describe("Metric labels for dimensional filtering"),W1t=pe().describe("Model provider"),Z1t=pe().describe("Model"),KYn=Tt().describe("Estimated cost"),G1t=pe().describe("Unit for the estimated cost (e.g., usd)"),JYn=xa(pe(),ni()).nullish().describe("Structured costing metadata"),Q1t=Ee({metricId:pe().nullish().describe("Unique id for this metric event"),timestamp:Xk().describe("When the metric was recorded"),name:q1t,value:V1t,traceId:Tq.nullish(),spanId:jq.nullish(),...Eq,source:pe().nullish().describe("Execution source"),provider:W1t.nullish(),model:Z1t.nullish(),estimatedCost:KYn.nullish(),costUnit:G1t.nullish(),costMetadata:JYn.nullish(),labels:H1t.default({}),metadata:N1t.nullish()}).describe("Metric record as stored in the database");Ee({name:q1t,value:V1t,labels:H1t.optional()}).describe("User-provided metric input");var eXn=Q1t;Ee({metrics:It(eXn)}).describe("Arguments for batch recording metrics");Ee({type:Uv,interval:x_.optional(),groupBy:w_.optional()}).describe("Metrics aggregation configuration");var z2=Ee({...Cq,name:It(pe()).nonempty().optional().describe("Filter by metric name(s)"),source:pe().optional().describe("Filter by execution source"),provider:W1t.optional(),model:Z1t.optional(),costUnit:G1t.optional(),labels:xa(pe(),pe()).optional().describe("Exact match on label key-value pairs")}).describe("Filters for querying metrics"),tXn=Zo(["timestamp"]).describe("Field to order by: 'timestamp'"),nXn=Ee({field:tXn.default("timestamp").describe("Field to order by"),direction:D2.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:z2.optional(),pagination:kq.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:nXn.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing metrics");Ee({pagination:_q,metrics:It(Q1t)});var rXn=["entityType","entityName","parentEntityType","parentEntityName","rootEntityType","rootEntityName","name","provider","model","environment","executionSource","serviceName"],dwe=Zo(rXn).optional().describe("Column to apply count_distinct over (required when aggregation is 'count_distinct'). Restricted to low/medium-cardinality categorical columns; ID columns are not allowed."),vT={check:e=>e.aggregation!=="count_distinct"||e.distinctColumn!==void 0,options:{message:"distinctColumn is required when aggregation is 'count_distinct'",path:["distinctColumn"]}};Ee({name:It(pe()).nonempty().describe("Metric name(s) to aggregate"),aggregation:Uv,distinctColumn:dwe,filters:z2.optional(),comparePeriod:rwe.optional()}).refine(vT.check,vT.options).describe("Arguments for getting a metric aggregate");Ee({...awe,estimatedCost:Tt().nullable().optional().describe("Aggregated estimated cost from the same filtered row set"),costUnit:pe().nullable().optional().describe("Shared cost unit for the aggregated rows, or null when mixed/unknown"),previousEstimatedCost:Tt().nullable().optional().describe("Aggregated estimated cost from the comparison period"),costChangePercent:Tt().nullable().optional().describe("Percentage change in estimated cost from comparison period")});Ee({name:It(pe()).nonempty().describe("Metric name(s) to break down"),groupBy:w_,aggregation:Uv,distinctColumn:dwe,filters:z2.optional(),limit:Tt().int().positive().max(1e3).optional().describe("Maximum number of groups to return (server-side TopK). Required for high-cardinality groupBy."),orderDirection:D2.optional().describe("Sort direction for the aggregated value (defaults to 'DESC' at the storage layer; pairs with limit for top/bottom-N).")}).refine(vT.check,vT.options).describe("Arguments for getting a metric breakdown");Ee({groups:It(Ee({dimensions:iwe,value:Dj,estimatedCost:Tt().nullable().optional().describe("Summed estimated cost for this group"),costUnit:pe().nullable().optional().describe("Shared cost unit for this group, or null when mixed/unknown")}))});Ee({name:It(pe()).nonempty().describe("Metric name(s)"),interval:x_,aggregation:Uv,distinctColumn:dwe,filters:z2.optional(),groupBy:w_.optional()}).refine(vT.check,vT.options).describe("Arguments for getting metric time series");Ee({series:It(Ee({name:pe().describe("Series name (metric name or group key)"),costUnit:pe().nullable().optional().describe("Shared cost unit for this series, or null when mixed/unknown"),points:It(Ee({timestamp:Lj,value:Dj,estimatedCost:Tt().nullable().optional().describe("Summed estimated cost in this bucket")}))}))});Ee({name:pe().describe("Metric name"),percentiles:swe,interval:x_,filters:z2.optional()}).describe("Arguments for getting metric percentiles");Ee({series:It(Ee({percentile:owe,points:It(Ee({timestamp:Lj,value:lwe}))}))});Ee({prefix:pe().optional().describe("Filter metric names by prefix"),limit:Tt().int().min(1).optional().describe("Maximum number of names to return")}).describe("Arguments for getting metric names");Ee({names:It(pe()).describe("Distinct metric names")});Ee({metricName:pe().describe("Metric name to get label keys for")}).describe("Arguments for getting metric label keys");Ee({keys:It(pe()).describe("Distinct label keys for the metric")});Ee({metricName:pe().describe("Metric name"),labelKey:pe().describe("Label key to get values for"),prefix:pe().optional().describe("Filter values by prefix"),limit:Tt().int().min(1).optional().describe("Maximum number of values to return")}).describe("Arguments for getting label values");Ee({values:It(pe()).describe("Distinct label values")});Ee({}).describe("Arguments for getting entity types");Ee({entityTypes:It(zj).describe("Distinct entity types")});Ee({entityType:zj.optional().describe("Optional entity type filter")}).describe("Arguments for getting entity names");Ee({names:It(pe()).describe("Distinct entity names")});Ee({}).describe("Arguments for getting service names");Ee({serviceNames:It(pe()).describe("Distinct service names")});Ee({}).describe("Arguments for getting environments");Ee({environments:It(pe()).describe("Distinct environments")});Ee({entityType:zj.optional().describe("Optional entity type filter")}).describe("Arguments for getting tags");Ee({tags:It(pe()).describe("Distinct tags")});function Y1t(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Y1t(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function X1t(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Y1t(e))&&(r&&(r+=" "),r+=t);return r}const p6e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,m6e=X1t,S_=(e,t)=>n=>{var r;if(t?.variants==null)return m6e(e,n?.class,n?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=n?.[u],f=a?.[u];if(d===null)return null;const h=p6e(d)||p6e(f);return s[u][h]}),o=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...a,...o}[g]):{...a,...o}[g]===v})?[...u,f,h]:u},[]);return m6e(e,i,c,n?.class,n?.className)},sXn=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},aXn=(e,t)=>({classGroupId:e,validator:t}),K1t=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),nB="-",g6e=[],iXn="arbitrary..",oXn=e=>{const t=cXn(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return lXn(i);const o=i.split(nB),c=o[0]===""&&o.length>1?1:0;return J1t(o,c,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const c=r[i],u=n[i];return c?u?sXn(u,c):c:u||g6e}return n[i]||g6e}}},J1t=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const u=J1t(e,t+1,a);if(u)return u}const i=n.validators;if(i===null)return;const o=t===0?e.join(nB):e.slice(t).join(nB),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(o))return d.classGroupId}},lXn=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?iXn+r:void 0})(),cXn=e=>{const{theme:t,classGroups:n}=e;return uXn(n,t)},uXn=(e,t)=>{const n=K1t();for(const r in e){const s=e[r];fwe(s,n,r,t)}return n},fwe=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];dXn(i,t,n,r)}},dXn=(e,t,n,r)=>{if(typeof e=="string"){fXn(e,t,n);return}if(typeof e=="function"){hXn(e,t,n,r);return}pXn(e,t,n,r)},fXn=(e,t,n)=>{const r=e===""?t:eSt(t,e);r.classGroupId=n},hXn=(e,t,n,r)=>{if(mXn(e)){fwe(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(aXn(n,e))},pXn=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,c]=s[i];fwe(c,eSt(t,o),n,r)}},eSt=(e,t)=>{let n=e;const r=t.split(nB),s=r.length;for(let a=0;a<s;a++){const i=r[a];let o=n.nextPart.get(i);o||(o=K1t(),n.nextPart.set(i,o)),n=o}return n},mXn=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gXn=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,i)=>{n[a]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=r[a])!==void 0)return s(a,i),i},set(a,i){a in n?n[a]=i:s(a,i)}}},qfe="!",v6e=":",vXn=[],y6e=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),yXn=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let i=0,o=0,c=0,u;const d=s.length;for(let g=0;g<d;g++){const v=s[g];if(i===0&&o===0){if(v===v6e){a.push(s.slice(c,g)),c=g+1;continue}if(v==="/"){u=g;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=a.length===0?s:s.slice(c);let h=f,p=!1;f.endsWith(qfe)?(h=f.slice(0,-1),p=!0):f.startsWith(qfe)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return y6e(a,p,h,m)};if(t){const s=t+v6e,a=r;r=i=>i.startsWith(s)?a(i.slice(s.length)):y6e(vXn,!1,i,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},bXn=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const i=n[a],o=i[0]==="[",c=t.has(i);o||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},xXn=e=>({cache:gXn(e.cacheSize),parseClassName:yXn(e),sortModifiers:bXn(e),...oXn(e)}),wXn=/\s+/,SXn=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],o=e.trim().split(wXn);let c="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=r(v?m.substring(0,g):m);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),S=p?w+qfe:w,_=S+x;if(i.indexOf(_)>-1)continue;i.push(_);const O=s(x,v);for(let E=0;E<O.length;++E){const j=O[E];i.push(S+j)}c=d+(c.length>0?" "+c:c)}return c},kXn=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=tSt(n))&&(s&&(s+=" "),s+=r);return s},tSt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=tSt(e[r]))&&(n&&(n+=" "),n+=t);return n},b6e=(e,...t)=>{let n,r,s,a;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=xXn(u),r=n.cache.get,s=n.cache.set,a=o,o(c)},o=c=>{const u=r(c);if(u)return u;const d=SXn(c,n);return s(c,d),d};return a=i,(...c)=>a(kXn(...c))},_Xn=[],Pl=e=>{const t=n=>n[e]||_Xn;return t.isThemeGetter=!0,t},nSt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rSt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,OXn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,EXn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CXn=/\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$/,TXn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jXn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NXn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dx=e=>OXn.test(e),cs=e=>!!e&&!Number.isNaN(Number(e)),Lx=e=>!!e&&Number.isInteger(Number(e)),aK=e=>e.endsWith("%")&&cs(e.slice(0,-1)),by=e=>EXn.test(e),sSt=()=>!0,AXn=e=>CXn.test(e)&&!TXn.test(e),hwe=()=>!1,IXn=e=>jXn.test(e),RXn=e=>NXn.test(e),PXn=e=>!In(e)&&!Ln(e),$Xn=e=>Uw(e,oSt,hwe),In=e=>nSt.test(e),T1=e=>Uw(e,lSt,AXn),x6e=e=>Uw(e,qXn,cs),MXn=e=>Uw(e,uSt,sSt),DXn=e=>Uw(e,cSt,hwe),w6e=e=>Uw(e,aSt,hwe),LXn=e=>Uw(e,iSt,RXn),Z3=e=>Uw(e,dSt,IXn),Ln=e=>rSt.test(e),$A=e=>k_(e,lSt),zXn=e=>k_(e,cSt),S6e=e=>k_(e,aSt),FXn=e=>k_(e,oSt),BXn=e=>k_(e,iSt),G3=e=>k_(e,dSt,!0),UXn=e=>k_(e,uSt,!0),Uw=(e,t,n)=>{const r=nSt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},k_=(e,t,n=!1)=>{const r=rSt.exec(e);return r?r[1]?t(r[1]):n:!1},aSt=e=>e==="position"||e==="percentage",iSt=e=>e==="image"||e==="url",oSt=e=>e==="length"||e==="size"||e==="bg-size",lSt=e=>e==="length",qXn=e=>e==="number",cSt=e=>e==="family-name",uSt=e=>e==="number"||e==="weight",dSt=e=>e==="shadow",k6e=()=>{const e=Pl("color"),t=Pl("font"),n=Pl("text"),r=Pl("font-weight"),s=Pl("tracking"),a=Pl("leading"),i=Pl("breakpoint"),o=Pl("container"),c=Pl("spacing"),u=Pl("radius"),d=Pl("shadow"),f=Pl("inset-shadow"),h=Pl("text-shadow"),p=Pl("drop-shadow"),m=Pl("blur"),g=Pl("perspective"),v=Pl("aspect"),x=Pl("ease"),w=Pl("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[..._(),Ln,In],E=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],T=()=>[Ln,In,c],N=()=>[Dx,"full","auto",...T()],I=()=>[Lx,"none","subgrid",Ln,In],P=()=>["auto",{span:["full",Lx,Ln,In]},Lx,Ln,In],R=()=>[Lx,"auto",Ln,In],F=()=>["auto","min","max","fr",Ln,In],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],z=()=>[Dx,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],q=()=>[Dx,"screen","full","dvw","lvw","svw","min","max","fit",...T()],W=()=>[Dx,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],D=()=>[e,Ln,In],Q=()=>[..._(),S6e,w6e,{position:[Ln,In]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",FXn,$Xn,{size:[Ln,In]}],Z=()=>[aK,$A,T1],G=()=>["","none","full",u,Ln,In],J=()=>["",cs,$A,T1],ie=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[cs,aK,S6e,w6e],ae=()=>["","none",m,Ln,In],de=()=>["none",cs,Ln,In],X=()=>["none",cs,Ln,In],re=()=>[cs,Ln,In],le=()=>[Dx,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[by],breakpoint:[by],color:[sSt],container:[by],"drop-shadow":[by],ease:["in","out","in-out"],font:[PXn],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[by],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[by],shadow:[by],spacing:["px",cs],text:[by],"text-shadow":[by],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Dx,In,Ln,v]}],container:["container"],columns:[{columns:[cs,In,Ln,o]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"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:O()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Lx,"auto",Ln,In]}],basis:[{basis:[Dx,"full","auto",o,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[cs,Dx,"auto","initial","none",In]}],grow:[{grow:["",cs,Ln,In]}],shrink:[{shrink:["",cs,Ln,In]}],order:[{order:[Lx,"first","last","none",Ln,In]}],"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":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],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":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...q()]}],"min-inline-size":[{"min-inline":["auto",...q()]}],"max-inline-size":[{"max-inline":["none",...q()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[o,"screen",...z()]}],"min-w":[{"min-w":[o,"screen","none",...z()]}],"max-w":[{"max-w":[o,"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",n,$A,T1]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,UXn,MXn]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",aK,In]}],"font-family":[{font:[zXn,DXn,t]}],"font-features":[{"font-features":[In]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ln,In]}],"line-clamp":[{"line-clamp":[cs,"none",Ln,x6e]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",Ln,In]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ln,In]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[cs,"from-font","auto",Ln,T1]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[cs,"auto",Ln,In]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ln,In]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ln,In]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lx,Ln,In],radial:["",Ln,In],conic:[Lx,Ln,In]},BXn,LXn]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],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:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[cs,Ln,In]}],"outline-w":[{outline:["",cs,$A,T1]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,G3,Z3]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",f,G3,Z3]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[cs,T1]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,G3,Z3]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[cs,Ln,In]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[cs]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Ln,In]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[cs]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ln,In]}],filter:[{filter:["","none",Ln,In]}],blur:[{blur:ae()}],brightness:[{brightness:[cs,Ln,In]}],contrast:[{contrast:[cs,Ln,In]}],"drop-shadow":[{"drop-shadow":["","none",p,G3,Z3]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",cs,Ln,In]}],"hue-rotate":[{"hue-rotate":[cs,Ln,In]}],invert:[{invert:["",cs,Ln,In]}],saturate:[{saturate:[cs,Ln,In]}],sepia:[{sepia:["",cs,Ln,In]}],"backdrop-filter":[{"backdrop-filter":["","none",Ln,In]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[cs,Ln,In]}],"backdrop-contrast":[{"backdrop-contrast":[cs,Ln,In]}],"backdrop-grayscale":[{"backdrop-grayscale":["",cs,Ln,In]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[cs,Ln,In]}],"backdrop-invert":[{"backdrop-invert":["",cs,Ln,In]}],"backdrop-opacity":[{"backdrop-opacity":[cs,Ln,In]}],"backdrop-saturate":[{"backdrop-saturate":[cs,Ln,In]}],"backdrop-sepia":[{"backdrop-sepia":["",cs,Ln,In]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ln,In]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[cs,"initial",Ln,In]}],ease:[{ease:["linear","initial",x,Ln,In]}],delay:[{delay:[cs,Ln,In]}],animate:[{animate:["none",w,Ln,In]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Ln,In]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[Ln,In,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"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:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ln,In]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ln,In]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[cs,$A,T1,x6e]}],stroke:[{stroke:["none",...D()]}],"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"]}},VXn=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:s={},override:a={}})=>(EI(e,"cacheSize",t),EI(e,"prefix",n),EI(e,"experimentalParseClassName",r),Q3(e.theme,a.theme),Q3(e.classGroups,a.classGroups),Q3(e.conflictingClassGroups,a.conflictingClassGroups),Q3(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),EI(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Y3(e.theme,s.theme),Y3(e.classGroups,s.classGroups),Y3(e.conflictingClassGroups,s.conflictingClassGroups),Y3(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),fSt(e,s,"orderSensitiveModifiers"),e),EI=(e,t,n)=>{n!==void 0&&(e[t]=n)},Q3=(e,t)=>{if(t)for(const n in t)EI(e,n,t[n])},Y3=(e,t)=>{if(t)for(const n in t)fSt(e,t,n)},fSt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},HXn=(e,...t)=>typeof e=="function"?b6e(k6e,e,...t):b6e(()=>VXn(k6e(),e),...t),WXn=Object.keys({...Wy,...can}),ZXn=Object.keys(man),GXn=Object.keys(uan),QXn=Object.keys(dan),YXn=Object.keys(lan),j1=Object.keys(pan),XXn=Object.keys(fan).concat(Object.keys(han)),KXn=HXn({extend:{theme:{color:WXn,spacing:ZXn,radius:YXn,leading:QXn,shadow:XXn},classGroups:{"font-size":[{text:GXn}],h:[{h:j1}],w:[{w:j1}],size:[{size:j1}],"min-h":[{"min-h":j1}],"min-w":[{"min-w":j1}],"max-h":[{"max-h":j1}],"max-w":[{"max-w":j1}]}}});function Y(...e){return KXn(X1t(e))}const sf=kJt,sr=_Jt,ar=OJt,er=y.forwardRef(({className:e,sideOffset:t=4,children:n,...r},s)=>l.jsx(EJt,{children:l.jsxs(rnt,{ref:s,sideOffset:t,className:Y("z-50 overflow-hidden rounded-lg border border-border1 bg-surface3 px-2.5 py-1.5 text-ui-sm leading-ui-sm text-neutral5 shadow-dialog 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-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",e),...r,children:[n,l.jsx(CJt,{className:"fill-surface3"})]})}));er.displayName=rnt.displayName;const JXn={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"},Ne=({children:e,className:t,size:n="default",...r})=>l.jsx("span",{className:Y("block",JXn[n],t),...r,children:e}),Bl={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},Iq="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",eKn="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",tKn="rounded-md",hSt="bg-surface2 border border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",pwe="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",mwe="disabled:opacity-50 disabled:cursor-not-allowed",X3=Y("gap-[.75em] rounded-full","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100"),gwe=S_(Y("inline-flex items-center justify-center leading-0 cursor-pointer","transition-all duration-normal ease-out-custom",mwe,pwe),{variants:{variant:{default:"bg-surface3 border border-border1 hover:bg-surface5 hover:text-neutral6 active:bg-surface6 text-neutral6",primary:"bg-surface4 border border-border2 hover:bg-surface5 hover:text-neutral6 active:bg-surface6 text-neutral6",cta:"bg-accent1 border border-transparent hover:bg-accent1/90 hover:shadow-glow-accent1 disabled:hover:shadow-none text-surface1 font-medium",ghost:"bg-transparent border border-transparent hover:bg-surface4 hover:text-neutral6 active:bg-surface5 text-neutral4",outline:"bg-transparent border border-border1 hover:bg-surface3 hover:text-neutral6 active:bg-surface4 text-neutral5",link:"inline-flex justify-start rounded-none h-auto px-0 bg-transparent text-neutral3 hover:text-neutral4 gap-1 [&>svg]:mx-0 w-auto [&>svg]:opacity-70"},size:{sm:Y(`${Bl.sm} text-ui-sm px-[.9em]`,X3),md:Y(`${Bl.md} text-ui-md px-[.9em]`,X3),default:Y(`${Bl.default} text-ui-md px-[1em]`,X3),lg:Y(`${Bl.lg} text-ui-lg px-[1.15em]`,X3),"icon-sm":`${Bl.sm} w-form-sm rounded-full`,"icon-md":`${Bl.md} w-form-md rounded-full`,"icon-lg":`${Bl.lg} w-form-lg rounded-full`}},defaultVariants:{variant:"default",size:"default"}}),nKn={"icon-sm":"sm","icon-md":"default","icon-lg":"lg"};function pSt(e){const t=[];return _e.Children.forEach(e,n=>{_e.isValidElement(n)&&n.type===_e.Fragment?t.push(...pSt(n.props.children)):t.push(n)}),t}function rKn(e){const t=pSt(e);return t.length>0&&t.every(n=>_e.isValidElement(n))}function sKn(e){return typeof e=="string"&&e.startsWith("icon-")}const ce=_e.forwardRef(({className:e,as:t,size:n,variant:r="default",disabled:s,children:a,tooltip:i,"aria-label":o,...c},u)=>{const d=t||"button",f=sKn(n),h=n??"default",p=!f&&rKn(a),m=o??((f||p)&&typeof i=="string"?i:void 0),g=f?l.jsx(Ne,{size:nKn[n],children:a}):a,v=l.jsx(d,{ref:u,disabled:s,"aria-label":m,className:Y(gwe({variant:r,size:h}),p&&"[&>svg]:opacity-75",e),...c,children:g});return i?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:v}),l.jsx(er,{children:i})]}):v});ce.displayName="Button";const ss=_e.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{ref:n,...t})}),e&&l.jsx(er,{children:e})]}));ss.displayName="ButtonWithTooltip";const kr={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"},qw={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},mSt=({children:e})=>l.jsx("nav",{className:"bg-surface2 min-h-full overflow-hidden",children:e}),rB=({children:e,as:t="a",href:n,className:r,prefetch:s,to:a})=>l.jsx(t,{href:n,prefetch:s,to:a,className:Y("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer",kr.colors,r),children:e}),gSt=({children:e})=>l.jsx("ol",{"data-testid":"thread-list",children:e}),sB=({children:e,isActive:t,className:n})=>l.jsx("li",{className:Y("border-b border-border1 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",kr.colors,"hover:bg-surface3",t&&"bg-accent1Dark",n),children:e}),vSt=({onClick:e})=>l.jsx(ce,{variant:"ghost",className:Y("shrink-0 opacity-0",kr.all,"group-focus-within:opacity-100 group-hover:opacity-100","hover:bg-surface4 hover:text-accent2"),onClick:e,children:l.jsx(Ne,{children:l.jsx(Ju,{"aria-label":"delete thread",className:"text-neutral3 hover:text-accent2 transition-colors"})})}),aKn={"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"},iKn={mono:"font-mono"},me=({as:e="p",className:t,variant:n="ui-md",font:r,...s})=>l.jsx(e,{className:Y(aKn[n],r&&iKn[r],t),...s}),oKn={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},ySt=({src:e,name:t,size:n="sm",interactive:r=!1})=>l.jsx("div",{className:Y(oKn[n],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",kr.all,r&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?l.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):l.jsx(me,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),lKn={default:"text-neutral5 bg-surface4 border-border1",success:"text-notice-success-fg bg-notice-success/20 border-notice-success/20",error:"text-notice-destructive-fg bg-notice-destructive/20 border-notice-destructive/20",info:"text-notice-info-fg bg-notice-info/20 border-notice-info/20",warning:"text-notice-warning-fg bg-notice-warning/20 border-notice-warning/20"},_t=({icon:e,variant:t="default",className:n,children:r,...s})=>l.jsxs("div",{className:Y("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border shrink-0",kr.colors,e?"pl-2 pr-2.5":"px-2.5",lKn[t],n),...s,children:[e&&l.jsx(Ne,{size:"sm",children:e}),r]}),cKn=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Ni=({children:e,label:t})=>l.jsx("nav",{"aria-label":t,children:l.jsx("ol",{className:"gap-0.5 flex items-center",children:e})}),Bn=({className:e,as:t,isCurrent:n,action:r,...s})=>{const a=t||"span";return l.jsxs(l.Fragment,{children:[l.jsxs("li",{className:"flex h-full shrink-0 items-center gap-1",children:[l.jsx(a,{"aria-current":n?"page":void 0,className:Y("text-ui-md leading-ui-md flex items-center gap-2",kr.colors,n?"text-white":"text-neutral3 hover:text-neutral5",e),...s}),r]}),!n&&l.jsx("li",{role:"separator",className:"flex h-full items-center",children:l.jsx(Ne,{className:Y("text-neutral2",kr.colors),children:l.jsx(cKn,{})})})]})};function uKn(e,t=5){if(!e?.properties)return[];const n=[];function r(s,a,i){if(i>t)return;const o=Array.isArray(s.type)?s.type.join(" | "):s.type;if(n.push({path:a,label:a,description:s.description??s.title,type:o}),s.properties)for(const[c,u]of Object.entries(s.properties))r(u,`${a}.${c}`,i+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))r(u,`${a}[].${c}`,i+1)}for(const[s,a]of Object.entries(e.properties))r(a,s,1);return n}function dKn(e){const t=uKn(e);return _ve({override:[fKn(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function fKn(e){return t=>{const r=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!r)return null;const s=r[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 o=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:o,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const hKn=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,pKn=dn.mark({class:"cm-variable-highlight"}),_6e=new Kst({regexp:hKn,decoration:()=>pKn}),mKn=dl.fromClass(class{decorations;constructor(e){this.decorations=_6e.createDeco(e)}update(e){this.decorations=_6e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),gKn=mKn,bSt=({className:e,toastOptions:t,...n})=>l.jsx(oyn,{...n,closeButton:!0,richColors:!0,className:Y("mastra-toaster",e),toastOptions:{duration:5e3,...t}}),Rq=(e,t)=>Array.isArray(e)?e.map(t):t(e),ze=(e,t={})=>{if(Array.isArray(e))return e.map(n=>Fm(n,t));if(_e.isValidElement(e)||typeof e=="string")return Fm(e,t);throw new Error("Invalid message type")};ze.success=(e,t={})=>Rq(e,n=>Fm.success(n,t));ze.error=(e,t={})=>Rq(e,n=>Fm.error(n,t));ze.warning=(e,t={})=>Rq(e,n=>Fm.warning(n,t));ze.info=(e,t={})=>Rq(e,n=>Fm.info(n,t));ze.custom=(e,t={})=>Fm(e,t);ze.dismiss=e=>Fm.dismiss(e);ze.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:s,onError:a,options:i={}})=>Fm.promise(e,{loading:t??"Loading...",success:o=>(s?.(o),n),error:o=>(a?.(o),r||(o instanceof Error?o.message:"Error...")),...i});function Vm({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=y.useState(!1),s=y.useRef(null),a=y.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{ze.success(t),r(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{ze.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:a}}function da({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:s}){const[a,i]=y.useState(!1),{handleCopy:o}=Vm({text:e,copyMessage:t}),c=()=>{o(),i(!0),setTimeout(()=>i(!1),2e3)};return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{onClick:c,type:"button",size:r,className:s,"aria-label":a?"Copied!":n,children:a?l.jsx(Lb,{}):l.jsx(nrt,{})})}),l.jsx(er,{children:a?"Copied!":n})]})}const vKn="mastra-theme",yKn="mastra-playground-store",Vfe=e=>e==="dark"||e==="light"||e==="system",bKn=e=>{try{const t=e.getItem(yKn);if(!t)return;const r=JSON.parse(t)?.state?.theme;return Vfe(r)?r:void 0}catch{return}},xKn=(e=vKn)=>({get(){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(Vfe(t))return t;const n=bKn(window.localStorage);return n?(window.localStorage.setItem(e,n),n):null}catch{return null}},set(t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},subscribe(t){if(typeof window>"u")return()=>{};const n=r=>{if(r.key===e){if(r.newValue===null){t(null);return}Vfe(r.newValue)&&t(r.newValue)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)}}),xSt=y.createContext(null),wSt="(prefers-color-scheme: dark)",wKn=typeof window>"u"?y.useEffect:y.useLayoutEffect,SSt=()=>typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia(wSt).matches?"dark":"light",kSt=e=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(wSt);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},SKn=(e,t)=>{e.classList.remove(t==="dark"?"light":"dark"),e.classList.add(t)},_St=({children:e,defaultTheme:t="system",storageKey:n,target:r})=>{const s=y.useMemo(()=>xKn(n),[n]),a=y.useRef(null),[i,o]=y.useState(()=>s.get()??t),c=y.useSyncExternalStore(kSt,SSt,()=>"dark");y.useEffect(()=>s.subscribe(f=>o(f??t)),[s,t]);const u=i==="system"?c:i;wKn(()=>{const f=r??(typeof window>"u"?null:window.document.documentElement);a.current&&a.current!==f&&a.current.classList.remove("dark","light"),f&&SKn(f,u),a.current=f},[u,r]);const d=y.useMemo(()=>({theme:i,resolvedTheme:u,systemTheme:c,setTheme:f=>{o(f),s.set(f)}}),[i,u,c,s]);return l.jsx(xSt.Provider,{value:d,children:e})},kKn=()=>{},Uj=()=>{const e=y.useContext(xSt),t=y.useSyncExternalStore(kSt,SSt,()=>"dark");return y.useMemo(()=>e??{theme:"system",resolvedTheme:t,systemTheme:t,setTheme:kKn},[e,t])};function _Kn(){const e=mj({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:[se.className,se.propertyName],color:"var(--neutral6)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:se.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:se.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:se.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=vt.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 OKn(){const e=vt.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=Km.define([{tag:[se.comment,se.bracket],color:"var(--neutral2)"},{tag:[se.string,se.meta,se.regexp],color:"var(--accent1)"},{tag:[se.atom,se.bool,se.special(se.variableName)],color:"var(--accent6)"},{tag:[se.keyword,se.operator,se.tagName],color:"var(--accent2)"},{tag:[se.function(se.propertyName),se.propertyName],color:"var(--accent5)"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"var(--accent3)"},{tag:[se.variableName,se.number],color:"var(--accent5)"},{tag:[se.name,se.quote],color:"var(--accent1)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[se.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[se.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:[se.deleted],color:"var(--accent2)"},{tag:se.invalid,color:"var(--error)"},{tag:[se.standard(se.tagName)],color:"var(--accent1)"}]);return[e,zb(t)]}const Kb=()=>{const e=Uj().resolvedTheme==="dark";return y.useMemo(()=>e?_Kn():OKn(),[e])},vs=y.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:o,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=Kb(),g=e?JSON.stringify(e,null,2):t??"",v=y.useMemo(()=>{const x=[];return a==="json"?x.push(Kf):a==="markdown"&&(x.push(Bve({base:rk,codeLanguages:yot})),x.push(vt.lineWrapping)),i&&a==="markdown"&&x.push(gKn),c&&a==="markdown"&&x.push(dKn(c)),f===!1&&x.push(xr.readOnly.of(!0)),x},[a,i,c,f]);return l.jsxs("div",{className:Y("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...h,children:[r&&l.jsx(da,{content:g,className:"absolute top-2 right-2 z-20"}),l.jsx(XC,{ref:p,value:g,theme:m,extensions:v,onChange:n,editable:f,"aria-label":"Code editor",placeholder:o,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function OSt(e,t){const{codeToTokens:n,bundledLanguages:r}=await nt(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-DBAgKJUH.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([23,1]),import.meta.url);if(!(t in r))return null;const{tokens:s}=await n(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}function Ii({iconSlot:e,titleSlot:t,descriptionSlot:n,actionSlot:r,className:s,as:a="h3"}){return l.jsxs("div",{className:Y("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&l.jsx("div",{className:"mb-4",children:e}),l.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),n&&l.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:n}),r&&l.jsx("div",{className:"mt-5",children:r})]})}const za=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),EKn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),vwe=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),ywe=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Vw=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),ESt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:l.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"})}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_22095",children:l.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),CSt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[l.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"}),l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_20513",children:l.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),CKn=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"}),l.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),Pq=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),bwe=e=>l.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),mo=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),qj=e=>l.jsx(ian,{...e}),go=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),ac=e=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),$q=e=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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 km(e){return l.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:[l.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),l.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),l.jsx("path",{d:"M15 2v2"}),l.jsx("path",{d:"M15 20v2"}),l.jsx("path",{d:"M2 15h2"}),l.jsx("path",{d:"M2 9h2"}),l.jsx("path",{d:"M20 15h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M9 2v2"}),l.jsx("path",{d:"M9 20v2"})]})}const TSt=e=>l.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:[l.jsxs("g",{clipPath:"url(#clip0_1480_1723)",children:[l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_1480_1723",children:l.jsx("rect",{width:"180",height:"107.763",fill:"white",transform:"translate(0.0625)"})})})]}),TKn=e=>l.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:l.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"})}),jKn=e=>l.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:l.jsx("g",{transform:"translate(0,2)",children:l.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"})})}),jSt=e=>l.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:l.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}})}),NKn=e=>l.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"18",fill:"none",...e,children:[l.jsx("mask",{id:"mask0_174_2406",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"17",height:"18",children:l.jsx("path",{d:"M17 0.5H0V17.5H17V0.5Z",fill:"white"})}),l.jsxs("g",{mask:"url(#mask0_174_2406)",children:[l.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"}),l.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"}),l.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"})]})]}),AKn=e=>l.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:[l.jsx("mask",{id:"mask0_4345_1846",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"59",style:{maskType:"luminance"},children:l.jsx("path",{d:"M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z",fill:"white"})}),l.jsx("g",{mask:"url(#mask0_4345_1846)",children:l.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"})})]}),IKn=e=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:l.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"})}),RKn=e=>l.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:[l.jsx("rect",{x:"15",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"47",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"111",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"47",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"79",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"111",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"79",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"15",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{x:"143",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),l.jsx("rect",{y:"1",width:"16",height:"160",fill:"black"}),l.jsx("rect",{x:"63",y:"97",width:"16",height:"32",fill:"black"}),l.jsx("rect",{x:"95",y:"33",width:"16",height:"32",fill:"black"}),l.jsx("rect",{x:"127",y:"1",width:"16",height:"32",fill:"black"}),l.jsx("rect",{x:"127",y:"97",width:"16",height:"64",fill:"black"})]}),PKn=e=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"128",height:"113",viewBox:"0 0 128 113",children:[l.jsxs("g",{clipPath:"url(#clip0_236_138)",...e,children:[l.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"}),l.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"}),l.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"}),l.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"}),l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_236_138",children:l.jsx("rect",{width:"128",height:"112.635",fill:"white"})})})]}),O6e=e=>l.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:l.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"})}),$Kn=e=>l.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:l.jsxs("g",{children:[l.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"}),l.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"}),l.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"}),l.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"})]})}),_h=({children:e,className:t,onClick:n})=>l.jsx("div",{tabIndex:n?0:void 0,onKeyDown:r=>{n&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n?.())},className:Y("flex gap-3 group/entity bg-surface3 rounded-xl border border-border1 py-3 px-4",n&&"cursor-pointer hover:bg-surface4 transition-all",t),onClick:n,children:e}),NSt=({children:e,className:t,style:n})=>l.jsx(Ne,{size:"lg",className:Y("text-neutral3 mt-1 shrink-0",t),style:n,children:e}),Oh=({children:e,className:t})=>l.jsx(me,{as:"p",variant:"ui-lg",className:Y("text-neutral6 font-medium",t),children:e}),Eh=({children:e,className:t})=>l.jsx(me,{as:"div",variant:"ui-sm",className:Y("text-neutral3",t),children:e}),Ch=({children:e,className:t})=>l.jsx("div",{className:Y("flex-1 w-full",t),children:e});function aa({resource:e,title:t,description:n,actionSlot:r,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 l.jsx(Ii,{className:s,iconSlot:l.jsx(Ne,{size:"lg",className:"text-neutral3",children:l.jsx(Vsn,{})}),titleSlot:t??a,descriptionSlot:n??i,actionSlot:r})}function pa({title:e,description:t,className:n}){const[r,s]=y.useState(!1),a=Ze(),i=y.useCallback(async()=>{try{s(!0);const{baseUrl:o="",apiPrefix:c}=a.options||{},u=(c||"/api").trim(),d=(u.startsWith("/")?u:`/${u}`).replace(/\/$/,""),f=new URLSearchParams({redirect_uri:window.location.href}),h=`${o}${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 l.jsx(Ii,{className:n,iconSlot:l.jsx(Ne,{size:"lg",className:"text-neutral3",children:l.jsx(Rsn,{})}),titleSlot:e??"Session Expired",descriptionSlot:t??"Your session has expired. Please log in again to continue.",actionSlot:l.jsx(ce,{variant:"default",onClick:i,disabled:r,children:r?"Redirecting...":"Log in"})})}const Zr=({children:e,border:t=!0,className:n})=>l.jsx("header",{className:Y("h-header-default z-50 flex w-full items-center gap-4 bg-transparent px-3",{"border-b border-border1":t},n),children:e}),Ud=({children:e})=>l.jsx(me,{as:"h1",variant:"ui-md",className:"text-neutral6 flex items-center gap-2",children:e}),ld=({children:e})=>l.jsx("div",{className:"ml-auto flex items-center gap-3",children:e}),MKn=({children:e})=>l.jsx("div",{className:"gap-2 flex items-center",children:e}),lb=e=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:l.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"})}),DKn={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},LKn=({className:e,children:t,size:n="default",style:r})=>l.jsx("table",{className:Y("w-full",DKn[n],e),style:r,children:t}),zKn=({className:e,children:t})=>l.jsx("thead",{children:l.jsx("tr",{className:Y("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),FKn=({className:e,children:t,...n})=>l.jsx("th",{className:Y("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...n,children:t}),BKn=({className:e,children:t,...n})=>l.jsx("tbody",{className:Y("",e),...n,children:t}),UKn=y.forwardRef(({className:e,children:t,selected:n=!1,style:r,onClick:s,isActive:a=!1,...i},o)=>{const c=y.useRef(null);y.useEffect(()=>{o&&(typeof o=="function"?o(c.current):o.current=c.current)},[o]),y.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return l.jsx("tr",{className:Y("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",n&&"bg-surface4",s&&"cursor-pointer",e),style:r,onClick:s,ref:c,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),qKn=({className:e,children:t,...n})=>l.jsx("td",{className:Y("text-neutral5 first:pl-3 last:pr-3",e),...n,children:l.jsx("div",{className:Y("flex h-full w-full shrink-0 items-center"),children:t})}),VKn=S_(Y("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:Y(hSt,pwe,mwe),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"}}),iu=y.forwardRef(({className:e,size:t,testId:n,variant:r,error:s,...a},i)=>l.jsx("textarea",{className:Y(VKn({variant:r,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:i,"aria-invalid":s,...a}));iu.displayName="Textarea";const HKn=bbn,WKn=xbn,ASt=wbn;function Wt({open:e,onOpenChange:t,children:n}){return l.jsx(HKn,{open:e,onOpenChange:t,children:n})}const xwe=y.forwardRef(({className:e,...t},n)=>l.jsx(eut,{ref:n,className:Y("dialog-overlay-anim fixed inset-0 z-50 bg-overlay backdrop-blur-xs",e),...t}));xwe.displayName=eut.displayName;const ISt=y.forwardRef(({className:e,...t},n)=>l.jsxs(ASt,{children:[l.jsx(xwe,{}),l.jsx(tut,{ref:n,className:Y("dialog-content-anim","fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%]","w-full max-w-[calc(100%-2rem)] sm:max-w-lg","rounded-xl border border-border1/40 bg-surface2/96 backdrop-blur-md shadow-dialog",e),...t})]}));ISt.displayName=tut.displayName;const RSt=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col gap-0.5 px-4 py-3 text-left",e),...t});RSt.displayName="AlertDialogHeader";const PSt=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse gap-1.5 px-4 py-2.5 sm:flex-row sm:justify-end",e),...t});PSt.displayName="AlertDialogFooter";const $St=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-4 py-3.5 max-h-[50vh]",e),...t});$St.displayName="AlertDialogBody";const MSt=y.forwardRef(({className:e,...t},n)=>l.jsx(sut,{ref:n,className:Y("text-ui-md font-medium",e),...t}));MSt.displayName=sut.displayName;const DSt=y.forwardRef(({className:e,...t},n)=>l.jsx(aut,{ref:n,className:Y("text-ui-sm text-neutral3",e),...t}));DSt.displayName=aut.displayName;const LSt=y.forwardRef(({className:e,...t},n)=>l.jsx(nut,{ref:n,className:Y(gwe({variant:"primary",size:"default"}),e),...t}));LSt.displayName=nut.displayName;const zSt=y.forwardRef(({className:e,...t},n)=>l.jsx(rut,{ref:n,className:Y(gwe({variant:"default",size:"default"}),e),...t}));zSt.displayName=rut.displayName;Wt.Trigger=WKn;Wt.Portal=ASt;Wt.Overlay=xwe;Wt.Content=ISt;Wt.Header=RSt;Wt.Footer=PSt;Wt.Body=$St;Wt.Title=MSt;Wt.Description=DSt;Wt.Action=LSt;Wt.Cancel=zSt;const Wi=y.forwardRef(({className:e,...t},n)=>l.jsx(uye,{ref:n,className:Y("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",kr.all,"hover:border-neutral5 hover:shadow-md",Iq,"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:l.jsx(cut,{className:Y("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:l.jsx(Lb,{className:"h-3.5 w-3.5 stroke-3"})})}));Wi.displayName=uye.displayName;const Hm=jbn,Ip=_e.forwardRef(({className:e,children:t,...n},r)=>l.jsx(fye,{ref:r,className:Y("-outline-offset-2",kr.colors,qw.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...n,children:t}));Ip.displayName=fye.displayName;const Rp=_e.forwardRef(({className:e,children:t,...n},r)=>l.jsx(pye,{ref:r,className:Y("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),...n,children:t}));Rp.displayName=pye.displayName;const Pr={root:"flex flex-col gap-1.5",trigger:Y("inline-flex w-full min-w-32 select-none items-center justify-between gap-1.5 whitespace-nowrap","rounded-lg border border-border1 bg-transparent px-2.5 text-ui-smd leading-ui-sm text-neutral4","outline-none transition-colors duration-normal ease-out-custom","hover:bg-surface3 hover:text-neutral6 hover:border-border2","focus:outline-none focus-visible:outline-none focus-visible:border-border2","data-[popup-open]:bg-surface3 data-[popup-open]:text-neutral6 data-[popup-open]:border-border2","disabled:cursor-not-allowed disabled:opacity-50"),triggerError:"border-accent2 hover:border-accent2 focus-visible:border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 text-neutral3 opacity-70",placeholder:"text-neutral3",popup:Y("min-w-(--anchor-width) w-max max-w-[500px] rounded-xl border border-border1 bg-surface3 text-neutral4","shadow-dialog","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:Y("flex items-center border-b border-border1 px-2.5 py-2",kr.colors),searchIcon:Y("mr-2 h-4 w-4 shrink-0 text-neutral3",kr.colors),searchInput:Y("flex h-7 w-full rounded-md bg-transparent py-1 text-ui-smd leading-ui-sm text-neutral6","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-none focus:outline-none focus-visible:outline-none",kr.colors),empty:"not-empty:block hidden py-6 text-center text-ui-smd text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:Y("relative flex cursor-pointer select-none items-center gap-2.5 rounded-lg px-2 py-1.5","text-ui-smd leading-ui-sm text-neutral4","outline-none focus:outline-none focus-visible:outline-none",kr.colors,"data-highlighted:bg-surface4 data-highlighted:text-neutral6"),itemSelected:"data-selected:text-neutral6",checkContainer:"flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:Y("h-4 w-4 text-neutral6",kr.opacity),checkbox:"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border2",checkboxIcon:"h-3 w-3 text-surface1",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-ui-sm text-neutral3 truncate",optionEnd:"ml-auto",error:"text-ui-sm text-accent2"};function Mc({options:e,value:t,onValueChange:n,placeholder:r="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:o=!1,size:c="default",open:u,onOpenChange:d,container:f,error:h}){const p=e.find(g=>g.value===t)??null,m=g=>{g&&n?.(g.value)};return l.jsxs("div",{className:Pr.root,children:[l.jsxs(fdt,{items:e,value:p,onValueChange:m,disabled:o,open:u,onOpenChange:d,children:[l.jsxs(xdt,{className:Y(Pr.trigger,Bl[c],h&&Pr.triggerError,i),children:[l.jsxs("span",{className:"truncate flex items-center gap-2",children:[p?.start,l.jsx(iwn,{placeholder:r})]}),l.jsx(zM,{className:Pr.chevron})]}),l.jsx(_dt,{container:f,children:l.jsx(Cdt,{align:"start",sideOffset:4,className:Pr.positioner,children:l.jsxs(Tdt,{className:Pr.popup,children:[l.jsxs("div",{className:Pr.searchContainer,children:[l.jsx($C,{className:Pr.searchIcon}),l.jsx(bdt,{className:Pr.searchInput,placeholder:s})]}),l.jsx(Rdt,{className:Pr.empty,children:a}),l.jsx(Sdt,{className:Pr.list,children:g=>l.jsxs(Idt,{value:g,className:Y(Pr.item,Pr.itemSelected),children:[l.jsx("span",{className:Pr.checkContainer,children:l.jsx(Zwn,{children:l.jsx(Lb,{className:Pr.checkIcon})})}),l.jsxs("span",{className:Pr.optionContent,children:[g.start,l.jsxs("span",{className:Pr.optionText,children:[l.jsx("span",{className:Pr.optionLabel,children:g.label}),g.description&&l.jsx("span",{className:Pr.optionDescription,children:g.description})]}),g.end?l.jsx("div",{className:Pr.optionEnd,children:g.end}):null]})]},g.value)})]})})})]}),h&&l.jsx("span",{className:Pr.error,children:h})]})}function FSt({options:e,value:t=[],onValueChange:n,placeholder:r="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:o=!1,size:c="md",open:u,onOpenChange:d,container:f,error:h}){const p=e.filter(v=>t.includes(v.value)),m=v=>{v&&n?.(v.map(x=>x.value))},g=p.length===0?r:`${p.length} selected`;return l.jsxs("div",{className:Pr.root,children:[l.jsxs(fdt,{multiple:!0,items:e,value:p,onValueChange:m,disabled:o,open:u,onOpenChange:d,children:[l.jsxs(xdt,{className:Y(Pr.trigger,Bl[c],h&&Pr.triggerError,i),children:[l.jsx("span",{className:Y("truncate",p.length===0&&Pr.placeholder),children:g}),l.jsx(zM,{className:Pr.chevron})]}),l.jsx(_dt,{container:f,children:l.jsx(Cdt,{align:"start",sideOffset:4,className:Pr.positioner,children:l.jsxs(Tdt,{className:Pr.popup,children:[l.jsxs("div",{className:Pr.searchContainer,children:[l.jsx($C,{className:Pr.searchIcon}),l.jsx(bdt,{className:Pr.searchInput,placeholder:s})]}),l.jsx(Rdt,{className:Pr.empty,children:a}),l.jsx(Sdt,{className:Pr.list,children:v=>{const x=t.includes(v.value);return l.jsxs(Idt,{value:v,className:Pr.item,children:[l.jsx("span",{className:Y(Pr.checkbox,x?Pr.checkboxSelected:Pr.checkboxUnselected),children:x&&l.jsx(Lb,{className:Pr.checkboxIcon})}),l.jsxs("span",{className:Pr.optionContent,children:[v.start,l.jsxs("span",{className:Pr.optionText,children:[l.jsx("span",{className:Pr.optionLabel,children:v.label}),v.description&&l.jsx("span",{className:Pr.optionDescription,children:v.description})]}),v.end?l.jsx("div",{className:Pr.optionEnd,children:v.end}):null]})]},v.value)}})]})})})]}),h&&l.jsx("span",{className:Pr.error,children:h})]})}const Fr=XM,BSt=Fct,ZKn=KM,GKn=t2,USt=y.forwardRef(({className:e,...t},n)=>l.jsx(yj,{ref:n,className:Y("dialog-overlay-anim fixed inset-0 z-50 bg-overlay backdrop-blur-xs",e),...t}));USt.displayName=yj.displayName;const $r=y.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(ZKn,{children:[l.jsx(USt,{}),l.jsxs(bj,{ref:r,className:Y("dialog-content-anim","fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%]","w-full max-w-[calc(100%-2rem)] sm:max-w-lg","rounded-xl border border-border1/40 bg-surface2/96 backdrop-blur-md shadow-dialog",e),...n,children:[t,l.jsx(t2,{asChild:!0,children:l.jsx(ce,{variant:"ghost",size:"sm",className:"absolute top-3 right-3","aria-label":"Close",children:l.jsx(Ju,{})})})]})]}));$r.displayName=bj.displayName;const Br=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col gap-0.5 px-4 py-3 text-left",e),...t});Br.displayName="DialogHeader";const ph=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse gap-1.5 px-4 py-2.5 sm:flex-row sm:justify-end",e),...t});ph.displayName="DialogFooter";const is=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-4 py-3.5 max-h-[50vh]",e),...t});is.displayName="DialogBody";const Mr=y.forwardRef(({className:e,...t},n)=>l.jsx(JM,{ref:n,className:Y("text-ui-md font-medium",e),...t}));Mr.displayName=JM.displayName;const va=y.forwardRef(({className:e,...t},n)=>l.jsx(e2,{ref:n,className:Y("sr-only",e),...t}));va.displayName=e2.displayName;const qSt=y.forwardRef(({className:e,...t},n)=>l.jsx(tf,{ref:n,className:Y("flex h-full w-full flex-col overflow-hidden rounded-xl bg-surface3 text-neutral4",e),...t}));qSt.displayName=tf.displayName;const QKn=({children:e,title:t="Command Palette",description:n="Search for commands and actions",...r})=>{const s=y.useCallback((i,o)=>{const c=i.toLowerCase();return o.toLowerCase().split(/\s+/).filter(Boolean).every(h=>c.includes(h))?1:0},[]),a=y.useCallback(i=>{i.stopPropagation()},[]);return l.jsx(Fr,{...r,children:l.jsxs($r,{className:"overflow-hidden p-0",children:[l.jsx(Mr,{className:"sr-only",children:t}),l.jsx(va,{className:"sr-only",children:n}),l.jsx(qSt,{filter:s,onKeyDown:a,className:Y("**:[[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})]})})},VSt=y.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:Y("flex items-center border-b border-border1 px-3",kr.colors),"cmdk-input-wrapper":"",children:[l.jsx($C,{className:Y("mr-2 h-4 w-4 shrink-0 text-neutral3",kr.colors)}),l.jsx(tf.Input,{ref:n,className:Y("flex h-10 w-full rounded-md bg-transparent py-3 text-ui-smd leading-ui-sm text-neutral6","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-none focus:outline-none focus-visible:outline-none",kr.colors,e),...t})]}));VSt.displayName=tf.Input.displayName;const HSt=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.List,{ref:n,className:Y("max-h-dropdown-max-height overflow-y-auto overflow-x-hidden",e),...t}));HSt.displayName=tf.List.displayName;const WSt=y.forwardRef((e,t)=>l.jsx(tf.Empty,{ref:t,className:"py-6 text-center text-ui-smd text-neutral3",...e}));WSt.displayName=tf.Empty.displayName;const Wx=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.Group,{ref:n,className:Y("overflow-hidden p-1 text-neutral4","**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:pt-1.5 **:[[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-ui-xs [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:uppercase **:[[cmdk-group-heading]]:tracking-wider **:[[cmdk-group-heading]]:text-neutral3",e),...t}));Wx.displayName=tf.Group.displayName;const Z1=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.Separator,{ref:n,className:Y("-mx-1 h-px bg-border1",e),...t}));Z1.displayName=tf.Separator.displayName;const Ml=y.forwardRef(({className:e,...t},n)=>l.jsx(tf.Item,{ref:n,className:Y("relative flex cursor-pointer select-none items-center gap-2.5 rounded-lg px-2 py-1.5 text-ui-smd leading-ui-sm text-neutral4","outline-none focus:outline-none focus-visible:outline-none",kr.colors,"data-[selected=true]:bg-surface4 data-[selected=true]:text-neutral6","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-neutral3 data-[selected=true]:[&_svg]:text-neutral6",e),...t}));Ml.displayName=tf.Item.displayName;const ZSt=({className:e,...t})=>l.jsx("span",{className:Y("ml-auto text-ui-xs tabular-nums tracking-wider text-neutral3",e),...t});ZSt.displayName="CommandShortcut";const Ri=eSn,Pi=tSn,mi=y.forwardRef(({className:e,children:t,size:n="default",...r},s)=>l.jsxs(pft,{ref:s,className:Y("inline-flex w-full cursor-pointer select-none items-center justify-between gap-1.5 whitespace-nowrap",Bl[n],"rounded-lg border border-border1 bg-transparent px-2.5 text-ui-smd leading-ui-sm text-neutral4","outline-none transition-colors duration-normal ease-out-custom","hover:bg-surface3 hover:text-neutral6 hover:border-border2","focus:outline-none focus-visible:outline-none focus-visible:border-border2","data-[state=open]:bg-surface3 data-[state=open]:text-neutral6 data-[state=open]:border-border2","data-[placeholder]:text-neutral3","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:truncate",e),...r,children:[t,l.jsx(nSn,{asChild:!0,children:l.jsx(Rge,{className:Y("h-4 w-4 shrink-0 text-neutral3 opacity-70",kr.colors)})})]}));mi.displayName=pft.displayName;const gi=y.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(rSn,{children:l.jsx(mft,{ref:s,className:Y("relative z-50 min-w-32 max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-xl border border-border1 bg-surface3 text-neutral4 shadow-dialog 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-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:l.jsx(sSn,{className:Y("p-1",n==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),children:t})})}));gi.displayName=mft.displayName;const hs=y.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(gft,{ref:r,className:Y("relative flex w-full cursor-pointer select-none items-center gap-2.5 rounded-lg py-1.5 pl-2 pr-8 text-neutral4 text-ui-smd leading-ui-sm","outline-none focus:outline-none focus-visible:outline-none",kr.colors,"hover:bg-surface4 hover:text-neutral6","focus:bg-surface4 focus:text-neutral6","data-[highlighted]:bg-surface4 data-[highlighted]:text-neutral6","data-[state=checked]:text-neutral6","data-disabled:pointer-events-none data-disabled:opacity-50",e),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(iSn,{children:l.jsx(Lb,{className:"h-4 w-4 text-neutral6"})})}),l.jsx(aSn,{children:t})]}));hs.displayName=gft.displayName;const bu=({children:e,defaultTab:t,value:n,onValueChange:r,className:s})=>{const[a,i]=y.useState(t),o=n!==void 0&&r!==void 0,c=o?n:a,u=d=>{const f=d;o?r(f):i(f)};return l.jsx(bSn,{value:c,onValueChange:u,className:Y("overflow-y-auto",s),children:e})},xu=({children:e,className:t})=>l.jsx("div",{className:Y("w-full overflow-x-auto",t),children:l.jsx(xSn,{className:Y("flex items-center relative w-max min-w-full","text-ui-lg border-b border-border1",t),children:e})}),Wr=({children:e,value:t,onClick:n,onClose:r,disabled:s,className:a})=>l.jsxs(wSn,{value:t,disabled:s,className:Y("py-2 px-5 text-ui-md font-normal text-neutral3 border-b-2 border-transparent","whitespace-nowrap shrink-0 flex items-center justify-center gap-1.5 outline-none cursor-pointer",kr.colors,qw.visible,"hover:text-neutral4","data-[state=active]:text-neutral5 data-[state=active]:border-neutral3","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:text-neutral3",a),onClick:n,children:[e,r&&l.jsx("button",{onClick:i=>{i.stopPropagation(),r()},className:Y("p-0.5 hover:bg-surface4 rounded",kr.colors,"hover:text-neutral5"),"aria-label":"Close tab",children:l.jsx(Ju,{className:"w-3 h-3"})})]}),Ns=({children:e,value:t,className:n})=>l.jsx(SSn,{value:t,className:Y("grid py-3 overflow-y-auto ring-offset-background",qw.visible,n),children:e});function YKn({code:e,options:t,value:n,onValueChange:r,selector:s="select",fileName:a,lang:i,copyMessage:o,copyTooltip:c,className:u}){const d=t&&t.length>0,f=d&&s==="tabs",h=d&&s==="select",p=n??t?.[0]?.value;return l.jsxs("figure",{className:Y("group relative flex w-full flex-col overflow-hidden rounded-2xl border border-border2/40 bg-surface2",u),children:[f&&t&&l.jsx(bu,{defaultTab:t[0].value,value:p,onValueChange:r??(()=>{}),children:l.jsx(xu,{children:t.map(m=>l.jsx(Wr,{value:m.value,children:m.label},m.value))})}),h&&t&&l.jsx("div",{className:"flex items-center border-b border-border2/40 px-2 py-1.5",children:l.jsxs(Ri,{value:p,onValueChange:r,children:[l.jsx(mi,{size:"sm",variant:"ghost",children:l.jsx(Pi,{})}),l.jsx(gi,{children:t.map(m=>l.jsx(hs,{value:m.value,children:m.label},m.value))})]})}),!d&&a&&l.jsx("div",{className:"flex items-center border-b border-border2/40 px-4 py-2",children:l.jsx("figcaption",{className:"font-mono text-ui-sm text-neutral4",children:a})}),l.jsxs("div",{className:"relative",children:[l.jsx(XKn,{code:e,lang:i}),l.jsx(da,{content:e,copyMessage:o,tooltip:c,size:"sm",className:Y("absolute top-2 right-2 opacity-100 pointer-fine:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",kr.opacity)})]})]})}function XKn({code:e,lang:t}){const[n,r]=y.useState(null);y.useEffect(()=>{if(!t){r(null);return}r(null);let a=!1;return OSt(e,t).then(i=>{!a&&i&&r(i)}).catch(()=>{}),()=>{a=!0}},[e,t]);const s="px-4 py-3 font-mono text-ui-sm text-neutral5 whitespace-pre-wrap break-all";return!t||!n?l.jsx("pre",{className:s,children:e}):l.jsx("pre",{className:s,children:l.jsx("code",{children:n.map((a,i)=>l.jsxs(y.Fragment,{children:[l.jsx("span",{children:a.map((o,c)=>l.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",children:o.content},c))}),i!==n.length-1&&`
300
300
  `]},i))})})}function GSt({children:e,className:t}){return l.jsx("div",{className:Y("border border-border1 rounded-lg p-6 bg-surface2",t),children:e})}const KKn=Tkn,JKn=jkn,eJn=u2,tJn=Ikn,nJn=Nkn,wwe=Y("relative flex cursor-pointer select-none items-center gap-2.5 rounded-lg px-2 py-1.5 text-ui-smd leading-ui-sm transition-colors text-neutral4 hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 data-[highlighted]:bg-surface4 data-[highlighted]:text-neutral6 data-disabled:pointer-events-none data-disabled:opacity-50 [&>span]:truncate [&_svg]:size-4 [&_svg]:shrink-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-60 [&:hover>svg]:opacity-100"),QSt=y.forwardRef(({className:e,children:t,...n},r)=>l.jsx(xht,{ref:r,className:Y("cursor-pointer outline-none",e),...n,children:t}));QSt.displayName=xht.displayName;const YSt=y.forwardRef(({className:e,inset:t,children:n,...r},s)=>l.jsxs(Cht,{ref:s,className:Y(wwe,"data-[state=open]:bg-surface4",t&&"pl-8",e),...r,children:[n,l.jsx("span",{className:"ml-auto pl-2",children:l.jsx(Rge,{className:"-rotate-90 opacity-50"})})]}));YSt.displayName=Cht.displayName;const XSt=y.forwardRef(({className:e,...t},n)=>l.jsx(u2,{children:l.jsx(u7,{ref:n,className:Y("bg-surface3 text-neutral4 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 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 z-50 min-w-44 max-h-[min(20rem,var(--radix-dropdown-menu-content-available-height))] overflow-x-hidden overflow-y-auto rounded-xl border border-border1 p-1 shadow-dialog",e),...t})}));XSt.displayName=u7.displayName;const KSt=y.forwardRef(({className:e,container:t,sideOffset:n=8,...r},s)=>l.jsx(u2,{container:t,children:l.jsx(wht,{ref:s,sideOffset:n,className:Y("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 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 text-neutral4 z-50 min-w-44 max-h-[min(20rem,var(--radix-dropdown-menu-content-available-height))] overflow-x-hidden overflow-y-auto rounded-xl border border-border1 p-1 shadow-dialog",e),...r})}));KSt.displayName=wht.displayName;const JSt=y.forwardRef(({className:e,...t},n)=>l.jsx(kht,{ref:n,className:Y(wwe,e),...t}));JSt.displayName=kht.displayName;const ekt=y.forwardRef(({className:e,children:t,checked:n,...r},s)=>l.jsxs(_ht,{ref:s,className:Y(wwe,"w-full",e),checked:n,...r,children:[l.jsx("div",{className:"border border-border2 flex h-4 w-4 items-center justify-center rounded-sm",children:n&&l.jsx(Lb,{})}),t]}));ekt.displayName=_ht.displayName;const tkt=y.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Oht,{ref:r,className:Y("relative flex cursor-pointer select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-ui-smd leading-ui-sm transition-colors text-neutral4 hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 data-[highlighted]:bg-surface4 data-[highlighted]:text-neutral6 data-disabled:pointer-events-none data-disabled:opacity-50 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0",e),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(Akn,{children:l.jsx(trt,{className:"h-2 w-2 fill-current"})})}),t]}));tkt.displayName=Oht.displayName;const nkt=y.forwardRef(({className:e,inset:t,...n},r)=>l.jsx(Sht,{ref:r,className:Y("px-2 pt-1.5 pb-1 text-ui-xs font-medium uppercase tracking-wider text-neutral3",t&&"pl-8",e),...n}));nkt.displayName=Sht.displayName;const rkt=y.forwardRef(({className:e,...t},n)=>l.jsx(Eht,{ref:n,className:Y("bg-border1 -mx-1 my-1 h-px",e),...t}));rkt.displayName=Eht.displayName;const skt=({className:e,...t})=>l.jsx("span",{className:Y("ml-auto text-xs tracking-widest opacity-60",e),...t});skt.displayName="DropdownMenuShortcut";function St({open:e,onOpenChange:t,children:n,modal:r}){return l.jsx(KKn,{modal:r,open:e,onOpenChange:t,children:n})}St.Trigger=QSt;St.Content=KSt;St.Group=JKn;St.Portal=eJn;St.Item=JSt;St.CheckboxItem=ekt;St.RadioItem=tkt;St.Label=nkt;St.Separator=rkt;St.Shortcut=skt;St.Sub=tJn;St.SubContent=XSt;St.SubTrigger=YSt;St.RadioGroup=nJn;const K3=({label:e,children:t})=>l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"p",variant:"ui-md",className:"text-neutral3",children:e}),t]});function Ur({className:e,...t}){return l.jsx("div",{className:Y("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 akt=({icon:e,title:t,isLoading:n,children:r})=>l.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[l.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[l.jsx(Ne,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),n?l.jsx(Ur,{className:"h-3 w-1/3"}):l.jsx("div",{className:"flex min-w-0 items-center gap-4",children:l.jsx(me,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),r&&l.jsx("div",{className:"pt-2",children:r})]});function rJn({children:e,className:t}){return l.jsx("div",{className:Y("grid gap-2 text-neutral4",t),children:e})}function sJn({children:e}){return l.jsxs("p",{className:Y("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:[l.jsx(FM,{})," ",e]})}function aJn({children:e}){return l.jsx("p",{className:"text-neutral3 text-ui-sm",children:e})}function iJn({children:e,name:t,required:n,size:r="default",className:s}){return l.jsxs("label",{htmlFor:`input-${t}`,className:Y("text-ui-smd text-neutral3 flex justify-between items-center ","in-[.horizontal-field-block]:grid in-[.horizontal-field-block]:content-start",{"text-ui-md":r==="bigger"},s),children:[e,n&&l.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}function oJn({children:e,className:t,layout:n="vertical",labelColumnWidth:r}){return l.jsx("div",{className:Y("grid gap-2 text-neutral4",{"horizontal-field-block grid-cols-[auto_1fr] items-baseline":n==="horizontal"},t),style:n==="horizontal"&&r?{gridTemplateColumns:`${r} 1fr`}:void 0,children:e})}const rl=Object.assign({},{Layout:oJn,Column:rJn,Label:iJn,HelpText:aJn,ErrorMsg:sJn});function lJn({children:e,className:t}){return l.jsx("div",{className:Y("grid gap-6 content-start",t),children:e})}function cJn({children:e,className:t,columns:n=1,gap:r}){return l.jsx("div",{className:Y("grid",{"grid-cols-1":n===1,"grid-cols-2":n===2},r??"gap-6",t),children:e})}Object.assign(cJn,{Column:lJn});const uJn=S_(Y("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:Y(hSt,pwe,mwe),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Bl.sm} text-ui-sm px-[.75em]`,md:`${Bl.md} text-ui-md px-[.75em]`,default:`${Bl.default} text-ui-md px-[.85em]`,lg:`${Bl.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),mn=y.forwardRef(({className:e,size:t,testId:n,variant:r,type:s,error:a,...i},o)=>l.jsx("input",{type:s,className:Y(uJn({variant:r,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:o,"aria-invalid":a,...i}));mn.displayName="Input";function nw({name:e,value:t,label:n,labelIsHidden:r=!1,labelColumnWidth:s,helpText:a,errorMsg:i,required:o=!1,disabled:c=!1,labelSize:u,layout:d="vertical",placeholder:f,size:h="default",testId:p,className:m,...g}){return l.jsxs(rl.Layout,{layout:d,labelColumnWidth:s,className:m,children:[d==="horizontal"?l.jsx(rl.Column,{children:l.jsx(rl.Label,{name:e,required:o,size:u||"bigger",children:r?l.jsx(uh,{children:n}):n})}):null,l.jsxs(rl.Column,{children:[!r&&d==="vertical"?l.jsx(rl.Label,{name:e,required:o,size:u||"default",children:n}):null,l.jsx(mn,{name:e,disabled:c,required:o,value:t,placeholder:f,"data-testid":p,size:h,...g}),a&&l.jsx(rl.HelpText,{children:a}),i&&l.jsx(rl.ErrorMsg,{children:i})]})]})}function rw({name:e,helpText:t,errorMsg:n,required:r=!1,disabled:s=!1,value:a,label:i,labelIsHidden:o=!1,layout:c="vertical",placeholder:u="Search...",onChange:d,onReset:f,className:h,size:p,isMinimized:m,onMinimizedChange:g}){const v=y.useRef(null);return y.useEffect(()=>{m===!1&&v.current?.focus()},[m]),m?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{size:p||"sm","aria-label":i||"Search",disabled:s,onClick:()=>g?.(!1),children:l.jsx($C,{})})}),l.jsx(er,{children:i||"Search"})]}):l.jsxs(rl.Layout,{layout:c,className:h,children:[c==="horizontal"?l.jsx(rl.Column,{children:l.jsx(rl.Label,{name:e,required:r,children:o?l.jsx(uh,{children:i}):i})}):null,l.jsxs(rl.Column,{children:[c==="vertical"&&i&&!o?l.jsx(rl.Label,{name:e,required:r,children:i}):null,l.jsxs("div",{className:"relative group",children:[l.jsx(mn,{ref:v,name:e,disabled:s,value:a,placeholder:u,onChange:d,size:p,className:Y(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")}),l.jsx($C,{"aria-hidden":"true",className:Y("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)&&l.jsx(ce,{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:l.jsx(Ju,{})})]}),t&&l.jsx(rl.HelpText,{children:t}),n&&l.jsx(rl.ErrorMsg,{children:n})]})]})}function _l({name:e,helpText:t,errorMsg:n,required:r=!1,disabled:s=!1,size:a="default",value:i,label:o,labelIsHidden:c=!1,layout:u="vertical",labelColumnWidth:d,options:f,placeholder:h="Select an option",onValueChange:p,className:m}){return l.jsxs(rl.Layout,{layout:u,labelColumnWidth:d,className:m,children:[u==="horizontal"?l.jsx(rl.Column,{children:l.jsx(rl.Label,{name:e,required:r,children:c?l.jsx(uh,{children:o}):o})}):null,l.jsxs(rl.Column,{children:[u==="vertical"&&o&&!c?l.jsx(rl.Label,{name:e,required:r,children:o}):null,l.jsxs(Ri,{"aria-label":c?o:void 0,name:e,value:i,onValueChange:p,disabled:s,children:[l.jsx(mi,{size:a,children:l.jsx(Pi,{placeholder:h})}),l.jsx(gi,{children:f.map(g=>l.jsx(hs,{value:g.value,children:g.label},g.value))})]}),t&&l.jsx(rl.HelpText,{children:t}),n&&l.jsx(rl.ErrorMsg,{children:n})]})]})}const dJn=S_("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Et=y.forwardRef(({className:e,...t},n)=>l.jsx(jht,{ref:n,className:Y(dJn(),e),...t}));Et.displayName=jht.displayName;function yT({children:e}){const t=e.replace(/\\n/g,`
301
301
  `);return l.jsx(tpt,{remarkPlugins:[Opt],components:hJn,className:"space-y-3",children:t})}const ikt=_e.memo(({children:e,language:t,...n})=>{const[r,s]=y.useState([]);return y.useEffect(()=>{OSt(e,t).then(a=>{a&&s(a)})},[e,t]),r.length?l.jsx("pre",{...n,children:l.jsx("code",{children:r.map((a,i)=>l.jsxs(l.Fragment,{children:[l.jsx("span",{children:a.map((o,c)=>{const u=typeof o.htmlStyle=="string"?void 0:o.htmlStyle;return l.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:o.content},c)})},i),i!==r.length-1&&`
302
302
  `]}))})}):l.jsx("pre",{...n,children:e})});ikt.displayName="HighlightedCode";const fJn=({children:e,className:t,language:n,...r})=>{const s=typeof e=="string"?e:Hfe(e),a=Y("overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]",t);return l.jsxs("div",{className:"group/code relative mb-4",children:[l.jsx(y.Suspense,{fallback:l.jsx("pre",{className:a,...r,children:e}),children:l.jsx(ikt,{language:n,className:a,children:s})}),l.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:l.jsx(da,{content:s,copyMessage:"Copied code to clipboard"})})]})};function Hfe(e){if(typeof e=="string")return e;if(e?.props?.children){let t=e.props.children;return Array.isArray(t)?t.map(n=>Hfe(n)).join(""):Hfe(t)}return""}const hJn={h1:({children:e,...t})=>l.jsx("h1",{className:"text-2xl font-semibold",...t,children:e}),h2:({children:e,...t})=>l.jsx("h2",{className:"font-semibold text-xl",...t,children:e}),h3:({children:e,...t})=>l.jsx("h3",{className:"font-semibold text-lg",...t,children:e}),h4:({children:e,...t})=>l.jsx("h4",{className:"font-semibold text-base",...t,children:e}),h5:({children:e,...t})=>l.jsx("h5",{className:"font-medium",...t,children:e}),strong:({children:e,...t})=>l.jsx("strong",{className:"font-semibold",...t,children:e}),a:({children:e,...t})=>l.jsx("a",{className:"underline underline-offset-2",...t,children:e}),blockquote:({children:e,...t})=>l.jsx("blockquote",{className:"border-l-2 border-neutral6 pl-4",...t,children:e}),code:({children:e,className:t,...n})=>{const r=/language-(\w+)/.exec(t||"");return r?l.jsx(fJn,{className:t,language:r[1],...n,children:e}):l.jsx("code",{className:Y("font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5"),...n,children:e})},pre:({children:e})=>e,ol:({children:e,...t})=>l.jsx("ol",{className:"list-decimal space-y-2 pl-6",...t,children:e}),ul:({children:e,...t})=>l.jsx("ul",{className:"list-disc space-y-2 pl-6",...t,children:e}),li:({children:e,...t})=>l.jsx("li",{className:"my-1.5",...t,children:e}),table:({children:e,...t})=>l.jsx("table",{className:"w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20",...t,children:e}),th:({children:e,...t})=>l.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})=>l.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})=>l.jsx("tr",{className:"m-0 border-t p-0 even:bg-surface4",...t,children:e}),p:({children:e,...t})=>l.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",...t,children:e}),hr:({...e})=>l.jsx("hr",{className:"border-neutral6/20",...e})};function pJn({children:e,className:t}){return l.jsx("div",{className:Y("overflow-x-auto ",t),children:e})}function okt({children:e,className:t}){return l.jsx("p",{className:Y("text-ui-md text-neutral2 leading-tight mt-0.5",t),children:e})}function mJn({message:e="Failed to load data",className:t}){return l.jsx("div",{className:Y("flex flex-col gap-3 items-center justify-center",t),children:l.jsx("p",{className:"text-ui-sm text-accent2",children:e})})}const gJn={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Ut({color:e,className:t,size:n="md"}){return l.jsx("svg",{className:Y("animate-spin",gJn[n],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:l.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}function vJn({className:e}){return l.jsx("div",{className:Y("flex items-center justify-center",e),children:l.jsx(Ut,{size:"md",color:Wy.neutral1})})}function yJn({message:e="No data yet",className:t}){return l.jsx("div",{className:Y("flex items-center justify-center h-full",t),children:l.jsx("p",{className:"text-neutral1 text-sm",children:e})})}function E6e({children:e,className:t}){return l.jsx(GSt,{className:Y("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 bJn({value:e,label:t,className:n}){return l.jsxs("div",{className:Y("grid justify-end content-start text-right gap-1",n),children:[l.jsx("span",{className:"text-ui-lg font-semibold text-neutral4 leading-none",children:e}),t&&l.jsx("span",{className:"text-ui-md text-neutral2",children:t})]})}function lkt({children:e,className:t,as:n="h2"}){return l.jsx(n,{className:Y("text-ui-md font-normal text-neutral4",t),children:e})}function xJn(e){if("children"in e)return l.jsx("div",{className:e.className,children:e.children});const{title:t,description:n,titleAs:r}=e;return l.jsxs("div",{className:e.className,children:[l.jsx(lkt,{as:r,children:t}),n&&l.jsx(okt,{children:n})]})}function wJn({children:e,className:t}){return l.jsx("div",{className:Y("grid grid-cols-[1fr_auto] gap-4",t),children:e})}function SJn({changePct:e,prevValue:t,lowerIsBetter:n,className:r}){const s=n?e<0:e>=0;return l.jsxs("div",{className:Y("flex items-center gap-1 text-sm text-neutral1 flex-wrap",r),children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:Y("[&>svg]:w-4 [&>svg]:h-4",s?"text-green-600":"text-red-600"),children:e>=0?l.jsx(ean,{}):l.jsx(Ksn,{})}),l.jsx("span",{className:Y(s?"text-green-600":"text-red-600"),children:`${e>=0?"+":"-"}${Math.abs(e).toFixed(1)}%`})]}),t&&l.jsxs("div",{children:["vs previous ",l.jsx("b",{className:"text-neutral2 font-semibold",children:t})]})]})}function kJn({message:e="Failed to load data",className:t}){return l.jsx("span",{className:Y("text-ui-sm text-accent2",t),children:e})}function _Jn({children:e,className:t}){return l.jsx("span",{className:Y("text-ui-md text-neutral3 leading-relaxed",t),children:e})}function OJn({className:e}){return l.jsx("span",{className:Y("text-sm",e),children:l.jsx(Ut,{size:"md",color:Wy.neutral1})})}function EJn({message:e="No previous value to compare",className:t}){return l.jsx("span",{className:Y("text-sm text-neutral1",t),children:e})}function CJn({message:e="No data yet",className:t}){return l.jsx("span",{className:Y("text-sm text-neutral1",t),children:e})}function TJn({children:e,className:t}){return l.jsx(GSt,{className:Y("flex-1 min-w-60",t),children:l.jsx("div",{className:"grid gap-1",children:e})})}function jJn({children:e,className:t}){return l.jsx("strong",{className:Y("text-header-lg text-neutral4 font-semibold",t),children:e})}const Hr=Object.assign(TJn,{Label:_Jn,Value:jJn,Change:SJn,NoChange:EJn,NoData:CJn,Error:kJn,Loading:OJn}),en=Object.assign(E6e,{Root:E6e,Kpi:Hr,TopBar:wJn,TitleAndDescription:xJn,Title:lkt,Description:okt,Summary:bJn,Loading:vJn,Error:mJn,Content:pJn,NoData:yJn});function Wfe({children:e,className:t}){return l.jsx("div",{className:Y("flex flex-wrap gap-8",t),children:e})}const Th=kjn,af=_jn,cd=y.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>l.jsx(Ojn,{children:l.jsx(Mpt,{ref:s,align:t,sideOffset:n,className:Y("z-50 w-72 rounded-xl border border-border1 bg-surface3 text-neutral5 shadow-dialog 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-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",e&&/\bp[trblxy]?-\S+/.test(e)?!1:"py-3.5 px-3",e),...r})}));cd.displayName=Mpt.displayName;function ckt({children:e,...t}){const[n,r]=y.useState(!1),s=y.useRef(void 0),a=y.useCallback(()=>{clearTimeout(s.current),r(!0)},[]),i=y.useCallback(()=>{s.current=setTimeout(()=>r(!1),150)},[]);return y.useEffect(()=>()=>clearTimeout(s.current),[]),l.jsx(Th,{open:n,onOpenChange:r,...t,children:l.jsx("span",{onMouseEnter:a,onMouseLeave:i,onFocusCapture:a,onBlurCapture:i,style:{display:"contents"},children:e})})}function ukt({disabled:e,onClear:t,onRemoveAll:n,onSave:r,onRemoveSaved:s}){const a=!!(n||r||s),i=!!t;return!i&&!a?null:l.jsxs("div",{className:"flex items-center gap-2",children:[i&&l.jsxs(ce,{disabled:e,size:"md",onClick:()=>t(),children:[l.jsx(Ju,{}),"Clear"]}),a&&l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsx(ce,{disabled:e,size:"md","aria-label":"More filter actions",children:l.jsx(Krn,{})})}),l.jsxs(St.Content,{align:"end",children:[n&&l.jsxs(St.Item,{onSelect:()=>n(),children:[l.jsx(Ju,{}),"Remove all filters"]}),n&&(r||s)&&l.jsx(St.Separator,{}),r&&l.jsxs(St.Item,{onSelect:()=>r(),children:[l.jsx(art,{}),"Save filters for next time"]}),s&&l.jsxs(St.Item,{onSelect:()=>s(),children:[l.jsx(irt,{}),"Remove saved filters"]})]})]})]})}const Vj=y.forwardRef(({className:e,...t},n)=>l.jsx(Qpt,{className:Y("grid gap-2",e),...t,ref:n}));Vj.displayName=Qpt.displayName;const Gu=y.forwardRef(({className:e,...t},n)=>l.jsx(Ypt,{ref:n,className:Y("aspect-square h-4 w-4 rounded-full border border-neutral3 text-neutral6","shadow-sm",kr.all,"hover:border-neutral5 hover:shadow-md",Iq,"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:l.jsx($jn,{className:Y("flex items-center justify-center","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:l.jsx(trt,{className:"h-2 w-2 fill-accent1 text-accent1"})})}));Gu.displayName=Ypt.displayName;function dkt({field:e,tokens:t,onChange:n}){const[r,s]=y.useState(""),a=y.useMemo(()=>{const u=r.trim().toLowerCase();return u?e.options.filter(d=>d.label.toLowerCase().includes(u)):e.options},[e.options,r]),i=y.useMemo(()=>t.find(u=>u.fieldId===e.id),[t,e.id]),o=typeof i?.value=="string"?i.value:void 0,c=y.useMemo(()=>Array.isArray(i?.value)?i.value:typeof i?.value=="string"?[i.value]:[],[i]);return l.jsxs(l.Fragment,{children:[e.searchable!==!1&&l.jsx(mn,{size:"sm",value:r,onChange:u=>s(u.target.value),placeholder:`Search ${e.label.toLowerCase()}...`,className:"mb-2",onKeyDown:u=>{if(u.key!=="ArrowDown")return;const f=u.currentTarget.closest("[data-pick-multi-panel]")?.querySelector("[data-pick-multi-item]:not([disabled])");f&&(u.preventDefault(),u.stopPropagation(),f.focus())}}),e.isLoading?l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-ui-sm text-neutral3",children:[l.jsx(Ut,{size:"sm",className:"w-3 h-3",color:"var(--neutral3)"}),"Loading options…"]}):a.length===0?l.jsx("div",{className:"px-2 py-1.5 text-ui-sm text-neutral3",children:e.emptyText??"No option found."}):e.multi?l.jsx("div",{className:"max-h-[80dvh] overflow-auto",children:a.map(u=>{const d=c.includes(u.value);return l.jsxs("label",{title:u.label,className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 cursor-pointer focus-within:bg-surface4 focus-within:text-neutral6 min-w-0",children:[l.jsx(Wi,{"data-pick-multi-item":"",checked:d,onCheckedChange:f=>{const p=f===!0?c.includes(u.value)?c:[...c,u.value]:c.filter(m=>m!==u.value);n(e.id,p)},className:"shrink-0"}),l.jsx("span",{className:"truncate min-w-0 flex-1",children:u.label})]},u.value)})}):l.jsxs(Vj,{value:o??"",onValueChange:u=>n(e.id,u),className:"max-h-[80dvh] gap-0 overflow-auto",children:[a.map(u=>l.jsxs("label",{title:u.label,className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 cursor-pointer focus-within:bg-surface4 focus-within:text-neutral6 min-w-0",children:[l.jsx(Gu,{"data-pick-multi-item":"",value:u.value,className:"shrink-0"}),l.jsx("span",{className:"truncate min-w-0 flex-1",children:u.label})]},u.value)),l.jsxs("label",{title:"Any",className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 cursor-pointer focus-within:bg-surface4 focus-within:text-neutral6 min-w-0",children:[l.jsx(Gu,{"data-pick-multi-item":"",value:"Any",className:"shrink-0"}),l.jsx("span",{className:"truncate min-w-0 flex-1",children:"Any"})]})]})]})}function fkt(e){return Array.isArray(e)?e.length===0?"Any":e.join(", "):e}const Swe="inline-flex",hkt=`${Bl.md} border-y-2 border-border1 px-[.75em] text-neutral3 whitespace-nowrap flex items-center`,kwe=`${hkt} text-ui-md rounded-l-lg border-l-2 border-r-1`,_we=`${hkt} text-ui-md `,Owe="rounded-tl-none rounded-bl-none border-l-transparent",NJn="rounded-none",AJn="rounded-none";function IJn({field:e,value:t,onChange:n,onRemove:r,disabled:s,autoFocus:a}){const[i,o]=y.useState(t),c=y.useRef(null);return y.useEffect(()=>{i.trim()!==t&&o(t)},[t]),y.useEffect(()=>{a&&c.current?.focus()},[a]),l.jsxs("div",{className:Swe,children:[l.jsx("span",{className:kwe,children:e.label}),l.jsx("span",{className:_we,children:"is"}),l.jsx(mn,{ref:c,size:"md",disabled:s,value:i,placeholder:e.placeholder??`Enter ${e.label}`,className:NJn,onChange:u=>{const d=u.target.value;o(d),d.trim()!==t&&n(d)},onKeyDown:u=>{if(u.key==="Enter"){u.preventDefault();const d=i.trim();d!==t&&n(d)}else u.key==="Escape"&&(u.preventDefault(),o(t),u.target.blur())}}),l.jsx(ce,{type:"button",disabled:s,"aria-label":`Remove ${e.label} filter`,className:Owe,size:"md",onMouseDown:u=>u.preventDefault(),onClick:r,children:l.jsx(Ju,{})})]})}function RJn({field:e,token:t,tokens:n,onChange:r,onRemove:s,disabled:a}){const[i,o]=y.useState(!1);return l.jsxs("div",{className:Swe,children:[l.jsx("span",{className:kwe,children:e.label}),l.jsx("span",{className:_we,children:"is"}),l.jsxs(Th,{open:i,onOpenChange:o,children:[l.jsx(af,{asChild:!0,children:l.jsx(ce,{type:"button",disabled:a,size:"md",className:AJn,children:fkt(t.value)})}),l.jsx(cd,{align:"start",sideOffset:8,className:"w-64 p-2","data-pick-multi-panel":!0,children:l.jsx(dkt,{field:e,tokens:n,onChange:r})})]}),l.jsx(ce,{type:"button",disabled:a,"aria-label":`Remove ${e.label} filter`,className:Owe,size:"md",onClick:s,children:l.jsx(Ju,{})})]})}function pkt({fields:e,tokens:t,onTokensChange:n,disabled:r,autoFocusFieldId:s}){if(t.length===0)return null;const a=(o,c)=>{const u=[...t];u[o]=c,n(u)},i=o=>{n(t.filter((c,u)=>u!==o))};return l.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.map((o,c)=>{const u=e.find(d=>d.id===o.fieldId);return u?u.kind==="text"&&typeof o.value=="string"?l.jsx(IJn,{field:u,value:o.value,disabled:r,autoFocus:s===o.fieldId,onChange:d=>a(c,{fieldId:o.fieldId,value:d}),onRemove:()=>i(c)},`${o.fieldId}-${c}`):u.kind==="pick-multi"?l.jsx(RJn,{field:u,token:o,tokens:t,disabled:r,onChange:(d,f)=>{if(f===void 0){i(c);return}a(c,{fieldId:d,value:f})},onRemove:()=>i(c)},`${o.fieldId}-${c}`):l.jsxs("div",{className:Swe,children:[l.jsx("span",{className:kwe,children:u.label}),l.jsx("span",{className:_we,children:"is"}),l.jsx("span",{className:"px-2.5 py-1.5 max-w-[20rem] truncate",children:fkt(o.value)}),l.jsx(ce,{type:"button",disabled:r,size:"md","aria-label":`Remove ${u.label} filter`,className:Owe,onClick:()=>i(c),children:l.jsx(Ju,{})})]},`${o.fieldId}-${c}`):null})})}function mkt({fields:e,tokens:t,onTokensChange:n,label:r="Add Filter",disabled:s,size:a,onStartTextFilter:i}){const[o,c]=y.useState(!1),[u,d]=y.useState(),[f,h]=y.useState(""),[p,m]=y.useState([]),[g,v]=y.useState(),[x,w]=y.useState(),S=y.useRef(null),_=y.useRef(!1),O=y.useCallback(R=>{w(F=>F===R?void 0:R)},[]),E=y.useCallback(()=>w(void 0),[]);y.useEffect(()=>{o||w(void 0)},[o]);const j=y.useMemo(()=>e.find(R=>R.id===u),[e,u]),T=y.useMemo(()=>{const R=new Set;for(const F of t){const M=e.find(L=>L.id===F.fieldId);M&&M.kind!=="pick-multi"&&R.add(F.fieldId)}return R},[t,e]),N=y.useCallback(()=>{d(void 0),h(""),m([]),v(void 0)},[]);y.useEffect(()=>{o||N()},[o,N]),y.useEffect(()=>{o&&j?.kind==="text"&&S.current?.focus()},[o,j]);const I=y.useCallback((R,F)=>{const M=t.findIndex(z=>z.fieldId===R);if(F===void 0||Array.isArray(F)&&F.length===0){if(M===-1)return;n(t.filter((z,q)=>q!==M));return}if(M===-1){n([...t,{fieldId:R,value:F}]);return}const U=[...t];U[M]={fieldId:R,value:F},n(U)},[n,t]),P=y.useCallback(()=>{if(!j){v("Choose a property first.");return}if(T.has(j.id)){v(`Remove the existing ${j.label} filter before adding another.`);return}if(j.kind==="text"&&!f.trim()){v(`Enter a value for ${j.label}.`);return}if(j.kind==="multi-select"&&p.length===0){v(`Choose at least one ${j.label.toLowerCase()} value.`);return}const R=j.kind==="multi-select"?{fieldId:j.id,value:p}:{fieldId:j.id,value:f.trim()};n([...t,R]),c(!1)},[p,n,j,T,f,t]);return l.jsxs(Th,{open:o,onOpenChange:c,children:[l.jsx(af,{asChild:!0,children:l.jsxs(ce,{variant:"outline",size:a,disabled:s,children:[l.jsx(Tsn,{}),r]})}),l.jsx(cd,{align:"end",className:"p-3 w-64",onOpenAutoFocus:R=>R.preventDefault(),onCloseAutoFocus:R=>{_.current&&(_.current=!1,R.preventDefault())},children:l.jsxs("div",{className:"grid gap-3",children:[j&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{type:"button","aria-label":"Back to properties",className:"text-neutral3 hover:text-neutral6 transition-colors",onClick:()=>{d(void 0),h(""),m([]),v(void 0)},children:l.jsx(dj,{className:"h-4 w-4"})}),l.jsx(hsn,{className:"h-4 w-4 shrink-0 text-neutral3"}),l.jsx("span",{className:"text-ui-sm text-neutral3",children:`${j.label} · is`})]}),!j&&l.jsx("div",{role:"menu",className:"max-h-[80dvh] overflow-auto",onKeyDown:R=>{if(R.key!=="ArrowDown"&&R.key!=="ArrowUp"&&R.key!=="Home"&&R.key!=="End")return;const F=Array.from(R.currentTarget.querySelectorAll("[data-filter-item]:not([disabled])"));if(F.length===0)return;R.preventDefault();const M=document.activeElement,L=F.findIndex(z=>z===M);let U;R.key==="Home"?U=0:R.key==="End"?U=F.length-1:R.key==="ArrowDown"?U=L<0?0:(L+1)%F.length:U=L<=0?F.length-1:L-1,F[U]?.focus()},children:e.length>0?e.map(R=>{const F=T.has(R.id);return R.kind==="pick-multi"?l.jsx(PJn,{field:R,tokens:t,onChange:I,open:x===R.id,onToggle:O,onClose:E},R.id):l.jsxs("button",{type:"button",role:"menuitem","data-filter-item":"",className:Y("group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-ui-md transition-colors","focus:bg-surface4 focus:text-neutral6 focus:outline-none",F?"cursor-not-allowed text-neutral2 opacity-70":"text-neutral4 hover:bg-surface4 hover:text-neutral6"),disabled:F,onClick:()=>{if(v(void 0),R.kind==="text"){n([...t,{fieldId:R.id,value:""}]),i?.(R.id),_.current=!0,c(!1);return}d(R.id)},children:[l.jsx("span",{className:"truncate",children:R.label}),F?l.jsx("span",{className:"ml-auto text-neutral3",children:"In use"}):l.jsx(zge,{className:"ml-auto h-4 w-4 text-neutral3 opacity-0 transition-opacity group-hover:opacity-100 group-focus:opacity-100"})]},R.id)}):l.jsx("div",{className:"px-2 py-1.5 text-ui-sm text-neutral3",children:"No matching property."})}),j&&j.kind==="text"&&l.jsx(mn,{ref:S,size:"md",value:f,onChange:R=>{h(R.target.value),v(void 0)},placeholder:j.placeholder??`Enter ${j.label}`,onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),P())}}),j&&j.kind==="multi-select"&&l.jsx(FSt,{options:j.options??[],value:p,onValueChange:R=>{m(R),v(void 0)},placeholder:j.placeholder??`Choose ${j.label}`,searchPlaceholder:`Search ${j.label.toLowerCase()}...`,emptyText:j.emptyText??"No option found.",size:"md"}),g&&l.jsx("div",{className:"text-ui-sm text-red-500",children:g}),j&&j.kind!=="pick-multi"&&l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(ce,{variant:"ghost",size:"md",onClick:()=>c(!1),children:"Cancel"}),l.jsx(ce,{variant:"outline",size:"md",onClick:P,children:"Add filter"})]})]})})]})}function PJn({field:e,tokens:t,onChange:n,open:r,onToggle:s,onClose:a}){const i=y.useRef(null);return l.jsxs(Th,{open:r,onOpenChange:o=>{o?s(e.id):a()},children:[l.jsx(af,{asChild:!0,children:l.jsxs("button",{type:"button",role:"menuitem","data-filter-item":"",className:Y("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 transition-colors","focus:bg-surface4 focus:text-neutral6 focus:outline-none"),onKeyDown:o=>{o.key!=="ArrowRight"&&o.key!=="ArrowLeft"||(r||s(e.id),o.preventDefault(),requestAnimationFrame(()=>{i.current?.querySelector('input, button, [tabindex]:not([tabindex="-1"])')?.focus()}))},children:[r&&l.jsx(Pge,{className:"h-4 w-4 text-neutral3 shrink-0"}),l.jsx("span",{className:"truncate",children:e.label}),!r&&l.jsx(PC,{className:"h-4 w-4 ml-auto text-neutral3 shrink-0"})]})}),l.jsx(cd,{ref:i,side:"right",align:"start",sideOffset:8,className:"w-64 p-2",onOpenAutoFocus:o=>o.preventDefault(),onKeyDown:o=>{if(o.key!=="ArrowDown"&&o.key!=="ArrowUp"&&o.key!=="Home"&&o.key!=="End")return;const c=Array.from(o.currentTarget.querySelectorAll("[data-pick-multi-item]:not([disabled])"));if(c.length===0)return;o.preventDefault(),o.stopPropagation();const u=document.activeElement,d=c.findIndex(h=>h===u);let f;o.key==="Home"?f=0:o.key==="End"?f=c.length-1:o.key==="ArrowDown"?f=d<0?0:(d+1)%c.length:f=d<=0?c.length-1:d-1,c[f]?.focus()},"data-pick-multi-panel":!0,children:l.jsx(dkt,{field:e,tokens:t,onChange:n})})]})}const gkt=(e,{enabled:t=!0})=>{const n=y.useRef(t);_e.useEffect(()=>{if(!t||!e?.current)return;const r=e.current,s=new MutationObserver(()=>{n.current&&r.scrollTo({top:r.scrollHeight,behavior:"smooth"})});s.observe(r,{childList:!0,subtree:!0,characterData:!0});const a=i=>{const o=i.target,c=o.scrollTop+o.clientHeight,u=o.scrollHeight;c>=u-1?n.current=!0:n.current=!1};return r.addEventListener("scroll",a),()=>{r.removeEventListener("scroll",a),s.disconnect()}},[t,e])};function $Jn(e){y.useEffect(()=>{const t=e.current;if(!t)return;const n=()=>{const{scrollTop:a,scrollLeft:i,scrollHeight:o,scrollWidth:c,clientHeight:u,clientWidth:d}=t;t.toggleAttribute("data-overflow-y-start",a>0),t.toggleAttribute("data-overflow-y-end",a+u<o-1),t.toggleAttribute("data-overflow-x-start",i>0),t.toggleAttribute("data-overflow-x-end",i+d<c-1)};n(),t.addEventListener("scroll",n,{passive:!0});const r=new ResizeObserver(n);r.observe(t);const s=t.firstElementChild;return s&&r.observe(s),()=>{t.removeEventListener("scroll",n),r.disconnect()}},[e])}const MJn="data-[overflow-y-start]:mask-t-from-[calc(100%-2rem)] data-[overflow-y-end]:mask-b-from-[calc(100%-2rem)] data-[overflow-x-start]:mask-l-from-[calc(100%-2rem)] data-[overflow-x-end]:mask-r-from-[calc(100%-2rem)]",na=y.forwardRef(({className:e,children:t,viewPortClassName:n,maxHeight:r,autoScroll:s=!1,orientation:a="vertical",showMask:i=!1,...o},c)=>{const u=y.useRef(null);return gkt(u,{enabled:s}),$Jn(u),l.jsxs(cmt,{ref:c,className:Y("relative overflow-hidden",e),...o,children:[l.jsx(Zjn,{ref:u,className:Y("h-full w-full rounded-[inherit] [&>div]:block!",i&&MJn,n),style:r?{maxHeight:r}:void 0,children:t}),(a==="vertical"||a==="both")&&l.jsx(Zfe,{orientation:"vertical"}),(a==="horizontal"||a==="both")&&l.jsx(Zfe,{orientation:"horizontal"}),a==="both"&&l.jsx(Gjn,{})]})});na.displayName=cmt.displayName;const Zfe=y.forwardRef(({className:e,orientation:t="vertical",...n},r)=>l.jsx(abe,{ref:r,orientation:t,className:Y("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-1.5 p-px",t==="horizontal"&&"h-1.5 w-full flex-col p-px",e),...n,children:l.jsx(smt,{className:"relative flex-1 rounded-full bg-neutral4/30 hover:bg-neutral4/60 transition-colors duration-normal"})}));Zfe.displayName=abe.displayName;const C6e={sm:Bl.sm,md:Bl.md,lg:Bl.lg,default:Bl.default},Hg=({onSearch:e,label:t,placeholder:n,debounceMs:r=300,size:s="md"})=>{const a=y.useId(),i=y.useRef(null),o=f_(u=>{e(u)},r);y.useEffect(()=>()=>{o.cancel()},[o]),y.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=>{o(u.target.value)};return l.jsxs("div",{className:Y("border border-border1 flex w-full items-center gap-2 overflow-hidden pl-2 pr-1",tKn,eKn,kr.all,"hover:border-neutral2",C6e[s]),children:[l.jsx($C,{className:Y("text-neutral3 h-4 w-4",kr.colors)}),l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{htmlFor:a,className:"sr-only",children:t}),l.jsx("input",{id:a,type:"text",placeholder:n,className:Y("bg-transparent text-ui-md placeholder:text-neutral3 block w-full px-2 outline-hidden",C6e[s]),name:a,ref:i,onChange:c})]})]})},DJn=({children:e})=>l.jsx("div",{className:"px-3 py-2.5 border-b border-border1",children:e}),aB=y.forwardRef(({className:e,...t},n)=>l.jsxs(Omt,{ref:n,className:Y("relative flex w-full touch-none select-none items-center group",e),...t,children:[l.jsx(fNn,{className:Y("relative h-1.5 w-full grow overflow-hidden rounded-full bg-neutral2",kr.colors),children:l.jsx(hNn,{className:Y("absolute h-full bg-accent1",kr.all)})}),l.jsx(pNn,{className:Y("block h-4 w-4 rounded-full border-2 border-accent1 bg-white shadow-md","transition-all duration-normal ease-out-custom",Iq,"hover:scale-110 hover:shadow-lg","active:scale-95","disabled:pointer-events-none disabled:opacity-50")})]}));aB.displayName=Omt.displayName;const cu=y.forwardRef(({className:e,...t},n)=>l.jsx(Amt,{className:Y("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent",kr.all,Iq,"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:n,children:l.jsx(bNn,{className:Y("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")})}));cu.displayName=Amt.displayName;function LJn({children:e,untilChar:t,charCount:n,copy:r,withTooltip:s=!0,className:a,as:i="span",...o}){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 n!==void 0&&c.length>n&&(u=c.slice(0,n),d=!0);if(!d)return l.jsx(me,{as:i,className:a,...o,children:c});const f=l.jsxs(me,{as:"span",className:"cursor-default",variant:o.variant,font:o.font,children:[u,"..."]});return l.jsxs(me,{as:i,className:Y("group inline-flex items-center gap-1",a),...o,children:[s?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:f}),l.jsx(er,{children:c})]}):f,r&&l.jsx(da,{content:c,className:"opacity-0 group-hover:opacity-100 transition-opacity"})]})}function ys({children:e,className:t,spacing:n="default"}){return l.jsx("div",{className:Y("flex gap-2 items-center",{"gap-0 [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:-ml-px":n==="close"},t),children:e})}function Jn({children:e,className:t,style:n}){const r=vkt("MainContentLayout");return l.jsx("main",{className:Y("grid grid-rows-[auto_1fr] h-full items-start content-start",t),style:{...n,...r?{border:"3px dotted red"}:{}},children:e})}function mh({children:e,className:t,isCentered:n=!1,isDivided:r=!1,hasLeftServiceColumn:s=!1,style:a}){const i=vkt("MainContentContent"),o=Ewe({isCentered:n,isDivided:r,hasLeftServiceColumn:s,className:t});return l.jsx("div",{className:o,style:{...a,...i?{border:"3px dotted orange"}:{}},children:e})}const Ewe=({isCentered:e,isDivided:t,hasLeftServiceColumn:n,className:r})=>Y("grid overflow-y-auto h-full ","overflow-x-auto min-w-min",{"items-start content-start":!e&&!t&&!n,"grid place-items-center":e,"grid-cols-[1fr_1fr]":t&&!n,"grid-cols-[12rem_1fr_1fr]":t&&n,"grid-cols-[auto_1fr]":!t&&n},r);function vkt(e){try{const t=localStorage.getItem("add-dev-style-to-components");return t?t.split(",").map(r=>r.trim()).filter(Boolean).includes(e):!1}catch(t){return console.error("Error reading or parsing localStorage:",t),!1}}function zJn({children:e,className:t}){return l.jsx("div",{className:Y("grid content-start",t),children:e})}function FJn({children:e,isLoading:t}){return l.jsx("p",{className:Y("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?l.jsx(l.Fragment,{children:" "}):l.jsx(l.Fragment,{children:e})})}function BJn({children:e,title:t,description:n,icon:r,className:s,withMargins:a=!0}){const i=t==="loading",o=n==="loading";return e?l.jsx("header",{className:Y("grid grid-cols-[1fr_auto] gap-16 w-full ",{"mt-[6vh] mb-[4vh]":a},s),children:e}):l.jsxs("header",{className:Y("grid gap-2 pt-8 pb-8 ",s),children:[l.jsx("h1",{className:Y("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?l.jsx(l.Fragment,{children:" "}):l.jsxs(l.Fragment,{children:[r&&r," ",t]})}),n&&l.jsx("p",{className:Y("text-neutral4 text-sm m-0",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":o}),children:o?l.jsx(l.Fragment,{children:" "}):n})]})}function UJn({children:e,isLoading:t,size:n="default"}){return l.jsx("h1",{className:Y("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":n==="smaller"}),children:t?l.jsx(l.Fragment,{children:" "}):l.jsx(l.Fragment,{children:e})})}const Hn=Object.assign(BJn,{Title:UJn,Description:FJn,Column:zJn});function sw({children:e,className:t}){return l.jsx("div",{className:Y("grid gap-12",t),children:e})}function iB({className:e,classNames:t,showOutsideDays:n=!0,...r}){return l.jsx(tPn,{showOutsideDays:n,className:Y("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:Y("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_next:Y("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:Y("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",r.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:Y("bg-accent1! text-white! hover:bg-accent1/80! focus:bg-accent1/80! focus:text-white!",r.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},...r})}const iK=["12","1","2","3","4","5","6","7","8","9","10","11"],J3=["00","15","30","45","59"],e5=["AM","PM"];function Gfe({defaultValue:e,onValueChange:t,className:n}){const[r,s]=y.useState("12"),[a,i]=y.useState("00"),[o,c]=y.useState("AM");y.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),v=p[3]?.toUpperCase();m>=1&&m<=12&&g>=0&&g<=59&&(s(m.toString()),i(g===0?"00":g.toString()),c(v||"AM"))}}},[e]);const u=h=>{s(h),t(`${iK[+h]}:${a} ${o}`.trim())},d=h=>{i(J3[+h]),t(`${r}:${J3[+h]} ${o}`.trim())},f=h=>{c(e5[+h]),t(`${r}:${a} ${e5[+h]}`.trim())};return l.jsxs("div",{className:Y("flex gap-2 items-center",n),children:[l.jsxs(Ri,{name:"hour",value:iK.indexOf(r).toString(),onValueChange:u,children:[l.jsx(mi,{size:"sm",children:l.jsx(Pi,{placeholder:"Select..."})}),l.jsx(gi,{children:iK.map((h,p)=>l.jsx(hs,{value:`${p}`,children:h},h))})]}),":",l.jsxs(Ri,{name:"minute",value:J3.indexOf(a).toString(),onValueChange:d,children:[l.jsx(mi,{size:"sm",children:l.jsx(Pi,{placeholder:"Select..."})}),l.jsx(gi,{children:J3.map((h,p)=>l.jsx(hs,{value:`${p}`,children:h},h))})]}),l.jsxs(Ri,{name:"period",value:e5.indexOf(o).toString(),onValueChange:f,children:[l.jsx(mi,{size:"sm",children:l.jsx(Pi,{placeholder:"Select..."})}),l.jsx(gi,{children:e5.map((h,p)=>l.jsx(hs,{value:`${p}`,children:h},h))})]})]})}const T6e=({value:e,minValue:t,maxValue:n,defaultTimeStrValue:r,onValueChange:s,children:a,className:i,placeholder:o,...c})=>{const[u,d]=y.useState(!1);return l.jsxs(Th,{open:u,onOpenChange:d,children:[l.jsx(af,{asChild:!0,children:a||l.jsx(VJn,{value:e,placeholder:o,className:i,"data-testid":"datepicker-button"})}),l.jsx(cd,{className:"backdrop-blur-4xl w-auto p-0! bg-surface4 max-w-[16.5rem]",align:"start","data-testid":"datepicker-calendar",children:l.jsx(qJn,{value:e,minValue:t,maxValue:n,onValueChange:s,setOpenPopover:d,defaultTimeStrValue:r,...c})})]})};function t5({date:e,timeStr:t=""}){if(!Qy(e))return null;if(t){const n=on(e,"yyyy-MM-dd"),r=new Date(`${n} ${t}`);if(Qy(r))return r}return e}const qJn=({value:e,minValue:t,maxValue:n,onValueChange:r,setOpenPopover:s,placeholder:a,className:i,defaultTimeStrValue:o,...c})=>{const[u,d]=y.useState(null),[f,h]=y.useState(e?on(t5({date:e,timeStr:o})||"","PP p"):""),[p,m]=y.useState(o||""),[g,v]=y.useState(e?new Date(e):void 0),x=f_(F=>{Qy(F)&&(v(F),r?.(F),s?.(!1))},500),w=F=>{h(F.currentTarget.value);const M=new Date(F.currentTarget.value);x(M)},S=F=>{Qy(F)?n&&F>n?(d(`The selected date should be before ${on(n,"PP p")}`),h("")):t&&F<t?(d(`The selected date should be after ${on(t,"PP p")}`),h("")):(h(on(F,"PP p")),d("")):(h(""),d(""))},_=new Date(f),O=Qy(_),E=O&&_.getTime()!==e?.getTime(),j=F=>{if(v(F),F){const M=t5({date:F,timeStr:p});S(M||"")}else S("")},T=F=>{if(v(F),F){const M=t5({date:F,timeStr:p});S(M||"")}else S("")},N=F=>{if(m(F),O){const M=t5({date:_,timeStr:F});S(M||"")}},I=()=>{s?.(!1)},P=()=>{Qy(_)&&r(_),s?.(!1)},R=()=>{r(void 0),v(void 0),h(""),m(""),s?.(!1)};return l.jsxs("div",{"aria-label":"Choose date",className:Y("relative flex flex-col",i),onKeyDown:F=>{F.stopPropagation(),F.key==="Escape"&&s?.(!1)},children:[l.jsx(nw,{name:"date-range",type:"text",value:f,onChange:w,placeholder:a,className:"m-4 mb-0 w-auto!"}),u&&l.jsxs("div",{className:Y("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:[l.jsx(ert,{})," ",u]}),l.jsx(iB,{mode:"single",month:g,selected:g,onMonthChange:T,onSelect:j,...c}),l.jsx(Gfe,{onValueChange:N,className:"m-4 mt-0 w-auto",defaultValue:e?on(new Date(e),"hh:mm a"):o}),l.jsxs("div",{className:"grid grid-cols-[1fr_2fr] gap-2 m-4 mt-0",children:[E&&l.jsx(ce,{tabIndex:0,size:"md",onClick:R,type:"button",children:"Clear"}),l.jsx(ce,{tabIndex:0,type:"button",size:"md",variant:E?"primary":"default",onClick:()=>{O?P():I()},children:E?"Apply":"Cancel"})]})]})},VJn=y.forwardRef(({value:e,placeholder:t,className:n,...r},s)=>l.jsxs(ce,{ref:s,className:Y("justify-start",n),...r,children:[l.jsx(pce,{className:"h-4 w-4"}),e?l.jsx("span",{className:"text-white",children:on(e,"PP p")}):l.jsx("span",{className:"text-gray",children:t??"Pick a date"})]}));function ykt({children:e}){return l.jsx("ul",{className:"grid bg-surface3 overflow-y-auto",children:e})}function bkt(e){return!e||e.length===0?"":e?.map(t=>t.size).join(" ")}function xkt({entry:e,isSelected:t,onClick:n,children:r,columns:s}){const a=()=>{n?.(e?.id)};return l.jsx("li",{className:Y("border-t text-neutral5 border-border1 last:border-b-0 text-ui-md","[&:last-child>button]:rounded-b-lg",kr.colors,{"bg-accent1Dark":t}),children:l.jsx("button",{onClick:a,className:Y("grid w-full px-6 gap-6 text-left items-center min-h-12",kr.colors,qw.visible,{"hover:bg-surface4":e&&!t}),style:{gridTemplateColumns:bkt(s)},disabled:!e,children:r})})}function HJn({children:e,isLoading:t}){return l.jsx("div",{className:"text-neutral4 text-ui-md truncate ",children:t?l.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-4 select-none"}):e})}function WJn({status:e}){return l.jsxs("div",{className:Y("flex justify-center items-center w-full relative"),children:[e?l.jsx("div",{className:Y("w-[0.6rem] h-[0.6rem] rounded-full",{"bg-green-600":e==="success","bg-red-700":e==="failed"})}):l.jsx("div",{className:"text-neutral2 text-ui-sm leading-none",children:"-"}),l.jsxs(uh,{children:["Status: ",e||"not provided"]})]})}function wkt({columns:e}){return l.jsx("div",{className:Y("sticky top-0 bg-surface4 z-10 rounded-t-lg px-6"),children:l.jsx("div",{className:Y("grid gap-6 text-left uppercase py-3 text-neutral3 text-ui-sm"),style:{gridTemplateColumns:bkt(e)},children:e?.map(t=>l.jsx("span",{children:t.label||t.name},t.name))})})}function ZJn({children:e,message:t,className:n,type:r}){return!e&&!t?null:l.jsx("div",{className:Y("grid border-t border-border1",n),children:t?l.jsxs("p",{className:Y("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":r==="error"}),children:[r==="error"?l.jsx(FM,{}):l.jsx(Dge,{})," ",t]}):e})}function GJn({isLoading:e,hasMore:t,setEndOfListElement:n,loadingText:r="Loading more data...",noMoreDataText:s="No more data to load"}){return n?l.jsxs("div",{ref:n,className:"text-ui-md text-neutral3 opacity-50 flex mt-8 justify-center",children:[e&&r,!t&&!e&&s]}):null}function QJn({currentPage:e,hasMore:t,onNextPage:n,onPrevPage:r}){const s=typeof e=="number"&&e>0||t;return l.jsxs("div",{className:Y("flex pt-6 items-center justify-center text-neutral3 text-ui-md gap-8"),children:[l.jsxs("span",{children:["Page ",l.jsx("b",{children:e?e+1:"1"})]}),s&&l.jsxs("div",{className:Y("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&&l.jsxs("button",{onClick:r,children:[l.jsx(dj,{}),"Previous"]}),t&&l.jsxs("button",{onClick:n,children:["Next",l.jsx(QS,{})]})]})]})}function YJn({children:e}){return l.jsx("div",{className:"grid",children:e})}function Skt({children:e}){return l.jsx("div",{className:Y("rounded-lg border border-border1 overflow-clip"),children:e})}const Ma=Object.assign(YJn,{Header:wkt,Trim:Skt,Entries:ykt,Entry:xkt,Message:ZJn,NextPageLoading:GJn,Pagination:QJn,EntryText:HJn,EntryStatus:WJn}),j6e=["75%","50%","65%","90%","60%","80%"];function XJn({columns:e,numberOfRows:t=3}){const n=(r,s)=>{const a=(r+s+(e?.length||0)+(t||0))%j6e.length;return j6e[a]};return l.jsx(ykt,{children:Array.from({length:t}).map((r,s)=>l.jsx(xkt,{columns:e,children:(e||[]).map((a,i)=>{const o=`${a.name}-${i}`;return l.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-4 select-none",style:{width:`${n(s,i)}`}},o)})},s))})}function kkt({columns:e,numberOfRows:t}){return l.jsx(Ma,{children:l.jsxs(Skt,{children:[l.jsx(wkt,{columns:e}),l.jsx(XJn,{columns:e,numberOfRows:t})]})})}function _kt({entries:e,id:t,update:n}){const r=e.findIndex(a=>a.id===t);if(r<e.length-1)return()=>{const a=e[r+1];n(a.id)}}function Okt({entries:e,id:t,update:n}){const r=e.findIndex(a=>a.id===t);if(r>0)return()=>{const a=e[r-1];n(a.id)}}const Ekt=y.createContext(null);function KJn({children:e,value:t}){return l.jsx(Ekt.Provider,{value:t,children:e})}function Mq(){const e=y.useContext(Ekt);if(!e)throw new Error("useJSONSchemaForm must be used within a JSONSchemaForm.Root");return e}let JJn=0;function Dq(e={}){return{id:`field-${Date.now()}-${JJn++}`,name:"",type:"string",nullable:!1,optional:!1,...e}}function eer(e){return e==="text"?"string":e}function Ckt(e){const t=eer(e.type),r={type:e.nullable?[t,"null"]:t};if(e.description&&(r.description=e.description),e.type==="object"&&e.properties&&e.properties.length>0){const{properties:s,required:a}=Tkt(e.properties);r.properties=s,a.length>0&&(r.required=a)}return e.type==="array"&&e.items&&(r.items=Ckt(e.items)),r}function Tkt(e){const t={},n=[];for(const r of e)r.name.trim()&&(t[r.name]=Ckt(r),r.optional||n.push(r.name));return{properties:t,required:n}}function ter(e){const{properties:t,required:n}=Tkt(e),r={type:"object",properties:t};return n.length>0&&(r.required=n),r}function jkt(e){if(Array.isArray(e)){const t=e.includes("null");return{type:e.find(r=>r!=="null")||"string",nullable:t}}return{type:e||"string",nullable:!1}}function Nkt(e){return["string","number","boolean","object","array"].includes(e)?e:"string"}function Akt(e){const{type:t,nullable:n}=jkt(e.type);return Dq({name:"",type:Nkt(t),description:e.description,nullable:n,optional:!1,properties:e.properties?Lq({properties:e.properties,required:e.required}):void 0,items:e.items?Akt(e.items):void 0})}function Lq(e){if(!e?.properties)return[];const t=new Set(e.required||[]);return Object.entries(e.properties).map(([n,r])=>{const{type:s,nullable:a}=jkt(r.type);return Dq({name:n,type:Nkt(s),description:r.description,nullable:a,optional:!t.has(n),properties:r.properties?Lq({properties:r.properties,required:r.required}):void 0,items:r.items?Akt(r.items):void 0})})}function Qfe(e,t,n,r){if(t.length===0)return e.map(i=>i.id===n?{...i,...r}:i);const[s,...a]=t;return e.map(i=>i.id!==s?i:i.type==="object"?{...i,properties:Qfe(i.properties||[],a,n,r)}:i.type==="array"&&i.items?{...i,items:{...i.items,properties:Qfe(i.items.properties||[],a,n,r)}}:i)}function Yfe(e,t,n){if(t.length===0)return[...e,n];const[r,...s]=t;return e.map(a=>a.id!==r?a:a.type==="object"?{...a,properties:Yfe(a.properties||[],s,n)}:a.type==="array"&&a.items?{...a,items:{...a.items,properties:Yfe(a.items.properties||[],s,n)}}:a)}function Xfe(e,t,n){if(t.length===0)return e.filter(a=>a.id!==n);const[r,...s]=t;return e.map(a=>a.id!==r?a:a.type==="object"?{...a,properties:Xfe(a.properties||[],s,n)}:a.type==="array"&&a.items?{...a,items:{...a.items,properties:Xfe(a.items.properties||[],s,n)}}:a)}function ner({onChange:e,onFieldsChange:t,defaultValue:n,maxDepth:r=5,className:s,children:a}){const[i,o]=y.useState(()=>n||[]),c=y.useRef("");y.useEffect(()=>{const p=ter(i),m=JSON.stringify(p);m!==c.current&&(c.current=m,e?.(p))},[i,e]),y.useEffect(()=>{t?.(i)},[i,t]);const u=y.useCallback(p=>{const m=Dq();o(g=>Yfe(g,p,m))},[]),d=y.useCallback((p,m)=>{o(g=>Xfe(g,p,m))},[]),f=y.useCallback((p,m,g)=>{o(v=>Qfe(v,p,m,g))},[]),h=y.useMemo(()=>({fields:i,addField:u,removeField:d,updateField:f,maxDepth:r}),[i,u,d,f,r]);return l.jsx(KJn,{value:h,children:l.jsx("div",{className:Y(s),children:a})})}const Ikt=y.createContext(null);function rer({children:e,value:t}){return l.jsx(Ikt.Provider,{value:t,children:e})}function Hj(){const e=y.useContext(Ikt);if(!e)throw new Error("useJSONSchemaFormField must be used within a JSONSchemaForm.Field");return e}function ser({field:e,parentPath:t=[],depth:n=0,className:r,children:s}){const{updateField:a,removeField:i}=Mq(),o=y.useCallback(d=>{a(t,e.id,d)},[a,t,e.id]),c=y.useCallback(()=>{i(t,e.id)},[i,t,e.id]),u=y.useMemo(()=>({field:e,parentPath:t,depth:n,update:o,remove:c}),[e,t,n,o,c]);return l.jsx(rer,{value:u,children:l.jsx("div",{className:Y(r),children:s})})}const Rkt=y.createContext(null);function aer({children:e,value:t}){return l.jsx(Rkt.Provider,{value:t,children:e})}function Pkt(){return y.useContext(Rkt)}function ier({className:e,children:t}){const{fields:n}=Mq(),r=Pkt(),s=r?r.fields:n,a=r?r.parentPath:[],i=r?r.depth:0;return s.length===0?null:l.jsx("div",{className:e,children:s.map((o,c)=>t(o,c,{parentPath:a,depth:i}))})}function oer(e){const{field:t,update:n}=Hj(),r=y.useCallback(s=>{n({name:s.target.value})},[n]);return l.jsx(nw,{...e,size:"md",labelIsHidden:!0,name:`field-name-${t.id}`,value:t.name,onChange:r})}const ler=[{value:"string",label:"String",icon:l.jsx(Ne,{size:"sm",children:l.jsx(Bge,{})})},{value:"number",label:"Number",icon:l.jsx(Ne,{size:"sm",children:l.jsx(Mge,{})})},{value:"boolean",label:"Boolean",icon:l.jsx(Ne,{size:"sm",children:l.jsx(Fge,{})})},{value:"text",label:"Text",icon:l.jsx(Ne,{size:"sm",children:l.jsx(KR,{})})},{value:"object",label:"Object",icon:l.jsx(Ne,{size:"sm",children:l.jsx(h0,{})})},{value:"array",label:"Array",icon:l.jsx(Ne,{size:"sm",children:l.jsx(Lge,{})})}];function cer({className:e,...t}){const{field:n,update:r}=Hj(),s=y.useCallback(a=>{r({type:a})},[r]);return l.jsx(_l,{className:Y("w-28 shrink-0",e),name:`field-type-${n.id}`,label:"Select type",labelIsHidden:!0,value:n.type,onValueChange:s,options:ler,size:"md",...t})}function uer({label:e="Optional",labelClassName:t,className:n,...r}){const{field:s,update:a}=Hj(),i=y.useCallback(o=>{a({optional:o===!0})},[a]);return l.jsxs("label",{className:Y("flex items-center gap-2 text-ui-sm text-neutral3 cursor-pointer",t),children:[l.jsx(Wi,{...r,className:n,checked:s.optional,onCheckedChange:i}),e]})}function der({label:e="Nullable",labelClassName:t,className:n,...r}){const{field:s,update:a}=Hj(),i=y.useCallback(o=>{a({nullable:o===!0})},[a]);return l.jsxs("label",{className:Y("flex items-center gap-2 text-ui-sm text-neutral3 cursor-pointer",t),children:[l.jsx(Wi,{...r,className:n,checked:s.nullable,onCheckedChange:i}),e]})}function fer({children:e,tooltip:t="Remove field",...n}){const{remove:r}=Hj();return l.jsx(ce,{...n,tooltip:t,onClick:r,size:"icon-md",children:e||l.jsx(irt,{})})}function her({className:e,children:t}){const{maxDepth:n,updateField:r}=Mq(),{field:s,parentPath:a,depth:i}=Hj(),o=s.type==="object"||s.type==="array",c=i>=n;if(y.useEffect(()=>{s.type==="object"&&!s.properties&&r(a,s.id,{properties:[]}),s.type==="array"&&!s.items&&r(a,s.id,{items:Dq({name:"items",type:"object",properties:[]})})},[s.type,s.properties,s.items,s.id,a,r]),!o||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 l.jsx(aer,{value:{parentPath:u,depth:d,fields:f},children:l.jsx("div",{className:Y("pl-4 border-l border-border1 mt-2",e),children:t})})}function per({children:e,...t}){const{addField:n}=Mq(),r=Pkt(),s=r?r.parentPath:[],a=y.useCallback(()=>{n(s)},[n,s]);return l.jsx(ce,{type:"button",...t,onClick:a,children:e||"Add field"})}const Ki={Root:ner,Field:ser,FieldList:ier,FieldName:oer,FieldType:cer,FieldOptional:uer,FieldNullable:der,FieldRemove:fer,NestedFields:her,AddField:per};function __({data:e,className:t,labelsAreHidden:n,isLoading:r,LinkComponent:s}){const a=({children:i})=>n?l.jsx(uh,{children:i}):i;return!e||e.length===0?null:l.jsx("dl",{className:Y("grid grid-cols-[auto_1fr] gap-x-4 items-start content-start",t),children:e.map(({label:i,value:o,icon:c,separator:u},d)=>{const f=Array.isArray(o);return l.jsxs(_e.Fragment,{children:[l.jsxs("dt",{className:Y("text-neutral3 text-ui-md flex items-center gap-8 justify-between min-h-9"),children:[l.jsxs("span",{className:Y("flex items-center gap-2","[&>svg]:w-[1.4em] [&>svg]:h-[1.4em] [&>svg]:text-neutral3 [&>svg]:opacity-50",{"[&>svg]:opacity-20":r}),children:[c," ",l.jsx(a,{children:i})]}),!n&&l.jsx("span",{className:Y("text-neutral3","[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:text-neutral3"),children:u})]}),l.jsx("dd",{className:Y("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:r?l.jsx("span",{className:Y("bg-surface4 rounded-e-lg w-full"),style:{width:`${Math.floor(Math.random()*61)+50}%`},children:" "}):f?o?.map(h=>h.path&&s?l.jsx(N6e,{description:h.description,children:l.jsxs(s,{href:h.path,children:[h?.name," ",l.jsx(PC,{})]})},h.id):h.path?l.jsx(N6e,{description:h.description,children:l.jsxs("a",{href:h.path,children:[h?.name," ",l.jsx(PC,{})]})},h.id):l.jsx("span",{children:h?.name},h.id)):l.jsx(l.Fragment,{children:o||l.jsx("span",{className:"text-neutral3 text-ui-sm",children:"n/a"})})})]},i+d)})})}function N6e({description:e,children:t}){return e?l.jsxs(Nbe,{openDelay:250,children:[l.jsx(Abe,{asChild:!0,children:t}),l.jsx(Ibe,{children:l.jsxs(Rbe,{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,l.jsx(Pbe,{className:"fill-surface5"})]})})]}):t}function mer({className:e,children:t,...n}){return l.jsx("div",{className:Y("mt-auto",e),...n,children:t})}const A6e="sidebar:state",I6e="sidebar:width",R6e="--sidebar-width",Cwe=_e.createContext(null),Twe=_e.createContext(null);function zq(){const e=_e.useContext(Cwe),t=_e.useContext(Twe);if(!e||!t)throw new Error("useMainSidebar must be used within a MainSidebarProvider.");return{...e,...t}}function Fq(){const e=_e.useContext(Cwe),t=_e.useContext(Twe);return!e||!t?null:{...e,...t}}const oK=(e,t,n)=>Math.min(n,Math.max(t,e)),ger=typeof window<"u"?_e.useLayoutEffect:_e.useEffect;function ver({children:e,defaultState:t="default",defaultWidth:n=240,minWidth:r=200,maxWidth:s=480,collapseBelow:a,collapsedWidth:i=64,disableKeyboardShortcut:o=!1,storageKey:c,mobileBreakpoint:u=1024,mobileWidth:d=360,LinkComponent:f}){const h=Math.max(0,Math.min(r,s)),p=Math.max(h,s),m=Math.max(0,Math.min(i,p)),g=oK(n,h,p),v=a??h,x=c?`${c}:${A6e}`:A6e,w=c?`${c}:${I6e}`:I6e,S=()=>{if(typeof window>"u")return{state:t,width:g};try{let te=t,ae=g;const de=window.localStorage.getItem(x);(de==="collapsed"||de==="default")&&(te=de);const X=window.localStorage.getItem(w);if(X!==null){const re=Number(X);Number.isFinite(re)&&(ae=oK(re,h,p))}return{state:te,width:ae}}catch{return{state:t,width:g}}},_=_e.useRef(null);_.current===null&&(_.current=S());const O=_.current,[E,j]=_e.useState(O.state),[T,N]=_e.useState(O.width),[I,P]=_e.useState(!1),[R,F]=_e.useState(!1),M=_e.useRef(O.width),L=_e.useRef(O.state);L.current=E;const U=_e.useRef(null);_e.useEffect(()=>{if(typeof window>"u")return;const te=window.matchMedia(`(max-width: ${u-1}px)`),ae=()=>P(te.matches);return ae(),te.addEventListener("change",ae),()=>te.removeEventListener("change",ae)},[u]),_e.useEffect(()=>{!I&&R&&F(!1)},[I,R]);const z=_e.useCallback(te=>{const ae=U.current;ae&&ae.style.setProperty(R6e,`${te}px`)},[]);ger(()=>{z(E==="collapsed"?m:M.current)},[E,m,z]);const q=_e.useCallback(te=>{try{window.localStorage.setItem(x,te)}catch{}},[x]),W=_e.useCallback(()=>{if(I){F(te=>!te);return}j(te=>{const ae=te==="default"?"collapsed":"default";return L.current=ae,q(ae),ae})},[I,q]),D=_e.useCallback(te=>{const ae=oK(te,h,p);M.current=ae,z(ae)},[h,p,z]),Q=_e.useCallback(()=>{L.current="collapsed",q("collapsed"),j("collapsed")},[q]),V=_e.useCallback(()=>{L.current="default",q("default"),j("default")},[q]),$=_e.useCallback(()=>{N(M.current);try{window.localStorage.setItem(x,L.current),window.localStorage.setItem(w,String(M.current))}catch{}},[x,w]),Z=_e.useCallback(te=>{const ae=U.current;ae&&(te?ae.setAttribute("data-sidebar-gesture","active"):ae.removeAttribute("data-sidebar-gesture"))},[]);_e.useEffect(()=>{if(o)return;const te=ae=>{if(ae.code!=="KeyB"||!(ae.metaKey||ae.ctrlKey)||ae.altKey||ae.shiftKey)return;const de=ae.target;if(de){const X=de.tagName;if(X==="INPUT"||X==="TEXTAREA"||X==="SELECT"||de.isContentEditable)return}ae.preventDefault(),W()};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[o,W]);const G=I?"default":E,J=_e.useMemo(()=>({state:G,desktopState:E,width:T,minWidth:h,maxWidth:p,collapseBelow:v,collapsedWidth:m,isMobile:I,toggleSidebar:W,setWidth:D,collapse:Q,expand:V,commit:$,setGestureActive:Z,LinkComponent:f}),[G,E,T,h,p,v,m,I,W,D,Q,V,$,Z,f]),ie=_e.useMemo(()=>({openMobile:R,setOpenMobile:F}),[R]),ne={[R6e]:`${O.state==="collapsed"?m:O.width}px`,"--sidebar-width-mobile":`${d}px`,display:"contents"};return l.jsx("div",{ref:U,"data-sidebar-scope":!0,"data-sidebar-state":E,"data-sidebar-mobile":I?"true":"false",style:ne,suppressHydrationWarning:!0,children:l.jsx(Cwe.Provider,{value:J,children:l.jsx(Twe.Provider,{value:ie,children:e})})})}function yer({className:e,icon:t,"aria-label":n="Open navigation menu",onClick:r,...s}){const{isMobile:a,setOpenMobile:i}=zq();return l.jsx("button",{type:"button","aria-label":n,"aria-hidden":!a,tabIndex:a?0:-1,"data-mobile-only":!0,...s,onClick:o=>{r?.(o),o.defaultPrevented||i(!0)},className:Y("inline-flex size-10 items-center justify-center rounded-md","in-data-[sidebar-mobile=false]:hidden","text-neutral4 hover:text-neutral6 hover:bg-surface3","focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1",e),children:t??l.jsx($sn,{className:"size-5"})})}function ber({"aria-label":e="Main",children:t,className:n,...r}){return l.jsx("nav",{"aria-label":e,className:Y("flex flex-col flex-1 min-h-0",n),...r,children:l.jsx(na,{showMask:!0,className:"flex-1 min-h-0",children:t})})}function oB({className:e,...t}){return l.jsx("div",{role:"separator","aria-orientation":"horizontal",className:Y("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),...t})}function $kt({children:e,className:t,state:n,href:r,isActive:s,LinkComponent:a,...i}){const o=Fq(),c=n??o?.state??"default",u=a??o?.LinkComponent??"a";return c==="default"?l.jsxs("div",{className:Y("grid grid-cols-[auto_1fr] items-center gap-2 min-w-0 min-h-11",t),children:[l.jsx("header",{...i,className:Y("min-w-0 max-w-full truncate text-ui-xs uppercase tracking-widest pl-3",{"text-black dark:text-white font-semibold":s,"text-neutral3/75":!s}),children:r?l.jsx(u,{href:r,className:Y("block min-w-0 truncate transition-colors duration-normal",{"hover:text-neutral5":!s,"text-black dark:text-white":s}),children:e}):e}),l.jsx(oB,{})]}):l.jsxs("div",{className:Y("grid items-center min-h-11",t),children:[l.jsx(uh,{asChild:!0,children:l.jsx("header",{...i,children:e})}),l.jsx(oB,{})]})}function Mkt({children:e,className:t,state:n,...r}){const s=Fq();return(n??s?.state??"default")==="collapsed"?l.jsx(uh,{children:e}):l.jsx("span",{...r,className:Y("min-w-0 flex-1 truncate text-left",t),children:e})}const xer=({isActive:e,isCollapsed:t,isFeatured:n,indent:r}={})=>Y("flex items-center text-ui-md text-neutral3 rounded-lg h-9 min-w-0 whitespace-nowrap","transition-all duration-normal ease-out-custom motion-reduce:transition-none","[&_svg]:w-4 [&_svg]:h-4 [&_svg]:shrink-0 [&_svg]:text-neutral3/60 [&_svg]:transition-colors [&_svg]:duration-normal motion-reduce:[&_svg]:transition-none","hover:bg-surface3 hover:text-neutral5 [&:hover_svg]:text-neutral3","focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring",!t&&"w-full gap-2.5 py-1 px-3 justify-start",t&&"w-9 mx-auto p-0 justify-center",e&&"text-neutral5 bg-surface4 [&_svg]:text-neutral5",t&&"[&_svg]:text-neutral3",n&&"rounded-md my-2 bg-accent1Dark hover:bg-accent1Darker text-accent1 hover:text-accent1 border border-accent1/30",n&&"dark:bg-accent1 dark:hover:bg-accent1/90 dark:text-black dark:hover:text-black dark:border-transparent",n&&"[&_svg]:text-accent1 [&:hover_svg]:text-accent1 dark:[&_svg]:text-black/75 dark:[&:hover_svg]:text-black",r&&!t&&"pl-7 text-ui-sm");function Dkt({link:e,state:t,children:n,isActive:r,className:s,LinkComponent:a,asChild:i=!1,...o}){const c=Fq(),u=t??c?.state??"default",d=a??c?.LinkComponent??"a",f=u==="collapsed",h=e?.variant==="featured",m=!!(e?.url&&/^(https?:)?\/\//.test(e.url))?{target:"_blank",rel:"noreferrer"}:{},g=e?f||!!e.tooltipMsg:!1,v=xer({isActive:r,isCollapsed:f,isFeatured:h,indent:e?.indent});let x=null;return i?x=l.jsx(i1n,{className:v,children:n}):e&&(x=l.jsxs(d,{href:e.url,...m,className:v,children:[e.icon,l.jsx(Mkt,{state:u,children:e.name}),n,e.isExperimental&&!f&&!g&&l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ert,{className:"ml-auto stroke-accent5"})}),l.jsx(er,{side:"right",align:"center",className:"ml-4",children:"Experimental Feature"})]})]})),l.jsx("li",{...o,className:Y("flex relative min-w-0",r&&!f&&"before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-1 before:h-5 before:bg-accent1 before:rounded-r-full before:transition-all before:duration-normal motion-reduce:before:transition-none",s),children:e&&g&&x?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:x}),l.jsx(er,{side:"right",align:"center",className:"ml-4",children:e.tooltipMsg?f?`${e.name} | ${e.tooltipMsg}`:e.tooltipMsg:e.name})]}):x??n})}function Lkt({className:e,children:t,...n}){return l.jsx("ul",{className:Y("grid grid-cols-[minmax(0,1fr)] gap-1 items-start content-center",e),...n,children:t})}function zkt({className:e,children:t,...n}){return l.jsx("section",{className:Y("grid grid-cols-[minmax(0,1fr)] items-start content-center relative",e),...n,children:t})}const P6e=10,wer=5;function Ser({children:e,className:t}){const{state:n,width:r,minWidth:s,maxWidth:a,collapseBelow:i,collapsedWidth:o,isMobile:c,openMobile:u,setOpenMobile:d,setWidth:f,collapse:h,expand:p,commit:m,toggleSidebar:g,setGestureActive:v}=zq(),x=n==="collapsed",w=x&&o===0,S=y.useRef(!1),_=y.useRef(null);y.useEffect(()=>()=>{_.current?.(),_.current=null},[]);const O=y.useCallback(I=>{if(I.button!==0)return;I.preventDefault(),S.current=!1;const P=I.clientX,R=I.currentTarget,F=I.pointerId,M=R.parentElement,L=M?M.getBoundingClientRect().left:0,U=document.body.style.cursor,z=document.body.style.userSelect,q=D=>{if(D.pointerId!==F)return;const Q=D.clientX-P;if(!S.current){if(Math.abs(Q)<=wer)return;S.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",v(!0)}const V=D.clientX-L;if(i>0&&V<i){h();return}p(),f(V)},W=D=>{D&&D.pointerId!==F||(window.removeEventListener("pointermove",q),window.removeEventListener("pointerup",W),window.removeEventListener("pointercancel",W),document.body.style.cursor=U,document.body.style.userSelect=z,v(!1),m(),_.current=null)};_.current=()=>W(),window.addEventListener("pointermove",q),window.addEventListener("pointerup",W),window.addEventListener("pointercancel",W)},[i,f,p,h,m,v]),E=y.useCallback(()=>{if(S.current){S.current=!1;return}g()},[g]),j=y.useCallback(I=>{switch(I.key){case"Enter":case" ":{I.preventDefault(),g();return}case"ArrowLeft":{if(I.preventDefault(),x)return;f(r-P6e),m();return}case"ArrowRight":{if(I.preventDefault(),x){p(),m();return}f(r+P6e),m();return}case"Home":{I.preventDefault(),p(),f(s),m();return}case"End":{I.preventDefault(),p(),f(a),m();return}}},[x,r,s,a,f,p,m,g]),T=y.useCallback(I=>{const P=I.target.closest("a");!P||!P.hasAttribute("href")||I.button!==0||I.metaKey||I.ctrlKey||I.shiftKey||I.altKey||P.target==="_blank"||P.hasAttribute("download")||d(!1)},[d]);if(c)return l.jsx(XM,{open:u,onOpenChange:d,children:l.jsxs(KM,{children:[l.jsx(yj,{className:Y("fixed inset-0 z-40 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0")}),l.jsxs(bj,{className:Y("fixed inset-y-0 left-0 z-50 flex h-full flex-col","w-3/4 max-w-(--sidebar-width-mobile)","bg-surface2 shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left","duration-200",t),children:[l.jsx(uh,{asChild:!0,children:l.jsx(JM,{children:"Navigation"})}),l.jsx(uh,{asChild:!0,children:l.jsx(e2,{children:"Primary site navigation drawer"})}),l.jsx("div",{onClick:T,className:"flex flex-col h-full min-h-0 px-4 py-2 overflow-hidden",children:e})]})]})});const N=x?o:r;return l.jsxs("div",{className:Y("sidebar-layout group/sidebar relative shrink-0 self-stretch min-h-0","w-(--sidebar-width)","transition-[width] duration-220 ease-[cubic-bezier(0.32,0.72,0,1)]","motion-reduce:transition-none","in-data-[sidebar-gesture=active]:transition-none",t,w&&"border-r-0 border-transparent"),children:[l.jsx("div",{className:Y("flex flex-col h-full min-h-0 overflow-hidden","transition-opacity duration-200 motion-reduce:transition-none",x?"px-2":"px-4",w&&"opacity-0 pointer-events-none px-0"),children:e}),l.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuenow":x?void 0:N,"aria-valuemin":x?void 0:s,"aria-valuemax":x?void 0:a,"aria-valuetext":x?"collapsed":`${N} pixels`,"aria-label":`Resize sidebar. Arrow keys to resize, Enter to ${x?"expand":"collapse"}.`,tabIndex:0,onPointerDown:O,onClick:E,onKeyDown:j,className:Y("group absolute top-0 -right-1 z-10 h-full w-2 cursor-col-resize touch-none","flex items-center justify-center","focus-visible:outline-hidden"),children:l.jsx("span",{"aria-hidden":!0,className:Y("block h-10 w-0.5 translate-x-0 group-hover:translate-x-1.5 rounded-full bg-transparent scale-50 group-hover:scale-100","transition duration-150 ease-out motion-reduce:transition-none pointer-events-none","group-hover:bg-surface5","group-focus-visible:bg-accent1","in-data-[sidebar-gesture=active]:bg-accent1")})})]})}function ker({sections:e,isActive:t,className:n}){const r=y.useId();return l.jsx(l.Fragment,{children:e.map(s=>{const a=s.links.length>0&&s.separator,i=s.title?`${r}-${s.key}`:void 0;return l.jsxs(zkt,{className:n,"aria-labelledby":i,"aria-label":i?void 0:s.key,children:[a?l.jsx(oB,{}):null,s.title?l.jsx($kt,{id:i,href:s.href,isActive:s.isHeaderActive,children:s.title}):null,l.jsx(Lkt,{children:s.links.map(o=>l.jsx(Dkt,{link:o,isActive:t?.(o,s.links)??o.isActive},o.name))})]},s.key)})})}function _er({className:e,onClick:t,...n}){const{desktopState:r,toggleSidebar:s}=zq(),a=r==="collapsed";return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("button",{type:"button","aria-label":"Toggle sidebar","aria-expanded":!a,...n,onClick:i=>{t?.(i),i.defaultPrevented||s()},className:Y("flex items-center justify-center text-neutral3 rounded-md","size-9",a?"mx-auto":"ml-auto","hover:bg-surface4 hover:text-neutral5","transition-all duration-normal ease-out-custom","focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring","[&_svg]:w-4 [&_svg]:h-4 [&_svg]:text-neutral3 [&_svg]:transition-transform [&_svg]:duration-normal",e),children:l.jsx(zsn,{className:Y({"rotate-180":a})})})}),l.jsxs(er,{children:["Toggle Sidebar",l.jsxs("div",{className:"flex items-center gap-1 [&>svg]:w-[1em] [&>svg]:h-[1em]",children:[l.jsx(ksn,{})," Ctrl+B"]})]})]})}const Tf=Object.assign(Ser,{Bottom:mer,Nav:ber,NavSection:zkt,NavLink:Dkt,NavLabel:Mkt,NavHeader:$kt,NavList:Lkt,NavSeparator:oB,Sections:ker,Trigger:_er,MobileTrigger:yer});function Fkt({children:e,isLoading:t}){return l.jsx("p",{className:Y("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?l.jsx(l.Fragment,{children:" "}):l.jsx(l.Fragment,{children:e})})}function Bkt({children:e,isLoading:t,size:n="default"}){return l.jsx("h1",{className:Y("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":n==="smaller"}),children:t?l.jsx(l.Fragment,{children:" "}):l.jsx(l.Fragment,{children:e})})}function Oer({children:e,className:t,title:n,description:r,icon:s,isLoading:a}){const i=e===void 0&&n!==void 0;return l.jsx("header",{className:Y("w-full grid",t),children:i?l.jsxs(l.Fragment,{children:[l.jsxs(Bkt,{isLoading:a,children:[s," ",n]}),r!==void 0&&l.jsx(Fkt,{isLoading:a,children:r})]}):e})}const Tr=Object.assign(Oer,{Title:Bkt,Description:Fkt});function Eer({children:e,className:t}){return l.jsx("header",{className:Y("grid items-center grid-cols-[1fr_auto]",t),children:e})}function Cer({headingLevel:e="h2",children:t,className:n}){const r=e;return l.jsx(r,{className:Y("flex items-center gap-2 text-ui-lg font-bold text-neutral4","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",n),children:t})}function Ukt({children:e,className:t}){return l.jsx("section",{className:Y("grid gap-4",t),children:e})}function O_({children:e,className:t}){return l.jsx("section",{className:Y("grid gap-2",t),children:e})}const rc=Object.assign(Ukt,{Header:Eer,Heading:Cer});function Ter({title:e,description:t,tone:n="default",id:r,className:s,descriptionClassName:a}){const i=n==="danger";return l.jsxs(l.Fragment,{children:[l.jsx("h3",{id:r,className:Y("font-serif text-header-md font-normal leading-tight tracking-normal",i?"text-accent2":"text-neutral4",s),children:e}),t!=null&&l.jsx("p",{className:Y("mt-2 max-w-[62ch] font-sans text-[13.5px] leading-ui-xs",i?"text-accent2/70":"text-neutral-500",a),children:t})]})}function $6e({title:e,description:t,action:n,variant:r="default",fillHeight:s=!1,className:a,contentClassName:i,children:o}){const c=r==="danger";return l.jsxs("section",{"data-variant":r,className:Y("overflow-hidden rounded-2xl border",s&&"flex h-full flex-col",c?"border-accent2/25":"border-border2/40",a),children:[l.jsxs("div",{className:Y("flex flex-col gap-3 px-7 pt-7 pb-6 sm:flex-row sm:items-start sm:justify-between sm:gap-6",c?"bg-accent2/[0.08]":"bg-surface2"),children:[l.jsx("div",{className:"min-w-0",children:l.jsx(Ter,{title:e,description:t,tone:c?"danger":"default"})}),n!=null?l.jsx("div",{className:"shrink-0",children:n}):null]}),l.jsx("div",{className:Y("min-w-0 px-7 pt-6 pb-7",s&&"flex-1",c?"bg-accent2/[0.04]":null,i),children:o})]})}function jer({label:e,description:t,htmlFor:n,className:r,children:s}){return l.jsxs("div",{className:Y("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",r),"data-slot":"settings-row",children:[l.jsxs("div",{children:[n?l.jsx(Et,{htmlFor:n,className:"text-sm font-medium",children:e}):l.jsx("p",{className:"text-sm font-medium",children:e}),t&&l.jsx("p",{className:"text-sm text-neutral3",children:t})]}),s]})}function Ner(){return mj({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8125rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[se.className,se.propertyName]}]})}function Aer(){const e=vt.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=Km.define([{tag:[se.comment,se.bracket],color:"var(--neutral2)"},{tag:[se.string,se.meta,se.regexp],color:"var(--accent1)"},{tag:[se.atom,se.bool,se.special(se.variableName)],color:"var(--accent6)"},{tag:[se.keyword,se.operator,se.tagName],color:"var(--accent2)"},{tag:[se.function(se.propertyName),se.propertyName],color:"var(--accent5)"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"var(--accent3)"},{tag:[se.variableName,se.number],color:"var(--accent5)"},{tag:[se.name,se.quote],color:"var(--accent1)"}]);return[e,zb(t)]}const Ier=()=>{const e=Uj().resolvedTheme==="dark";return y.useMemo(()=>e?Ner():Aer(),[e])};function Rer({codeStr:e="",title:t,icon:n,simplified:r=!1}){const s=Ier(),[a,i]=y.useState(!1),o=y.useMemo(()=>{try{const u=JSON.parse(e);return Kfe(u||"")}catch{return!1}},[e]),c=a?e?.replace(/\\n/g,`
@@ -668,7 +668,7 @@ Token usage: ${n} input + ${r} output = ${s} total`:`The model stopped generatin
668
668
  "groundTruth": "Expected result (optional)",
669
669
  "metadata": { "key": "value" } // optional
670
670
  }
671
- ]`})]})]})}function Yes({errors:e,maxErrors:t=5}){if(e.length===0)return null;const n=e.slice(0,t),r=e.length-t;return l.jsxs("div",{className:"bg-accent2/10 border border-accent2/30 rounded-md p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-accent2 mb-2",children:[l.jsx(Ne,{children:l.jsx(tb,{className:"w-4 h-4"})}),l.jsxs("span",{className:"font-medium text-sm",children:[e.length," validation error",e.length!==1?"s":""]})]}),l.jsx("ul",{className:"text-sm text-accent2/80 space-y-1",children:n.map((s,a)=>l.jsxs("li",{className:"flex gap-2",children:[l.jsx("span",{className:"shrink-0",children:"•"}),l.jsx("span",{children:s.message})]},a))}),r>0&&l.jsxs("div",{className:"text-xs text-accent2/60 mt-2",children:["+",r," more error",r!==1?"s":""]})]})}function Xes({datasetId:e,open:t,onOpenChange:n,onSuccess:r}){const[s,a]=y.useState("upload"),[i,o]=y.useState(null),[c,u]=y.useState({current:0,total:0}),[d,f]=y.useState(null),[h,p]=y.useState(!1),{parseFile:m,isParsing:g,error:v}=nes(),{batchInsertItems:x}=$i(),w=y.useCallback(async I=>{try{const P=await m(I);o(P),a("preview")}catch{}},[m]),S=y.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]),_=y.useCallback(()=>{n(!1),r?.(),d&&d.success>0&&ze.success(`Imported ${d.success} item${d.success!==1?"s":""}`),setTimeout(()=>{a("upload"),o(null),u({current:0,total:0}),f(null)},150)},[n,r,d]),O=y.useCallback(()=>{h||(n(!1),setTimeout(()=>{a("upload"),o(null),u({current:0,total:0}),f(null)},150))},[h,n]),E=i&&i.items.length>0&&i.errors.length===0,j=()=>{switch(s){case"upload":return l.jsx(Qes,{onFileSelect:w,isParsing:g,error:v?.message});case"preview":return i?l.jsx("div",{className:"flex flex-col gap-4",children:i.errors.length>0?l.jsxs(l.Fragment,{children:[l.jsx(Yes,{errors:i.errors}),l.jsx("div",{className:"text-sm text-neutral4",children:"Please fix the errors in your JSON file and try again."})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"text-sm text-neutral4",children:["Found ",i.items.length," valid item",i.items.length!==1?"s":""," to import."]}),l.jsx(Ges,{items:i.items,maxRows:5})]})}):null;case"importing":return l.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[l.jsx(Ut,{size:"lg"}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Importing items..."}),l.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[c.current," of ",c.total]})]})]});case"complete":return l.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[l.jsx("div",{className:"text-4xl",children:d&&d.errors===0?"✓":"⚠"}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Import Complete"}),l.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[d?.success??0," item",d?.success!==1?"s":""," imported",d&&d.errors>0&&l.jsxs("span",{className:"text-accent2",children:[" ","(",d.errors," error",d.errors!==1?"s":"",")"]})]})]})]})}},T=()=>{switch(s){case"upload":return l.jsx(ce,{onClick:O,children:"Cancel"});case"preview":return l.jsxs(l.Fragment,{children:[l.jsx(ce,{onClick:()=>a("upload"),children:"Back"}),l.jsxs(ce,{variant:"primary",onClick:S,disabled:!E,children:["Import ",i?.items.length??0," Item",i?.items.length!==1?"s":""]})]});case"importing":return null;case"complete":return l.jsx(ce,{variant:"primary",onClick:_,children:"Done"})}},N={upload:"Import JSON",preview:"Preview Data",importing:"Importing",complete:"Import Complete"};return l.jsx(Fr,{open:t,onOpenChange:O,children:l.jsxs($r,{className:"max-w-2xl max-h-[90vh]",children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:N[s]}),l.jsx(va,{children:"Import dataset items from a JSON file."})]}),l.jsx(is,{className:"min-h-[200px] max-h-[50vh] overflow-y-auto",children:j()}),l.jsx(ph,{className:"px-6 pt-4 flex justify-end gap-2",children:T()})]})})}function Kes({dataset:e,isLoading:t=!1,onEditClick:n,onDuplicateClick:r,onDeleteClick:s,experimentTriggerSlot:a,disableExperimentTrigger:i=!1,onExperimentClick:o,className:c}){return l.jsxs(Hn,{className:c,children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{isLoading:t,children:[l.jsx(Ja,{})," ",e?.name]}),l.jsx(Hn.Description,{isLoading:t,children:e?.description}),l.jsxs(Hn.Description,{isLoading:t,children:[l.jsxs(ms,{children:[l.jsx(TC,{})," Created at ",e?.createdAt?on(new Date(e.createdAt),"MMM d, yyyy"):""]}),l.jsxs(ms,{children:[l.jsx(Ew,{})," Latest version v",e?.version??""]})]})]}),l.jsx(Hn.Column,{children:l.jsxs(ys,{children:[a?i?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"cursor-not-allowed",children:l.jsx("div",{className:"pointer-events-none opacity-50",inert:!0,"aria-disabled":"true",children:a})})}),l.jsx(er,{children:"Add items to the dataset before running an experiment"})]}):a:o?i?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"cursor-not-allowed",children:l.jsxs(ce,{disabled:!0,tabIndex:-1,children:[l.jsx(fb,{}),"Run Experiment"]})})}),l.jsx(er,{children:"Add items to the dataset before running an experiment"})]}):l.jsxs(ce,{onClick:o,children:[l.jsx(fb,{}),"Run Experiment"]}):null,l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsx(ce,{size:"default","aria-label":"Dataset actions menu",children:l.jsx(Uet,{})})}),l.jsxs(St.Content,{align:"end",className:"w-48",children:[l.jsxs(St.Item,{onSelect:n,children:[l.jsx($b,{})," Edit Dataset"]}),l.jsxs(St.Item,{onSelect:r,children:[l.jsx(lh,{})," Duplicate Dataset"]}),l.jsxs(St.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[l.jsx(Kd,{})," Delete Dataset"]})]})]})]})})]})}const K5t=e=>{const t=Ze(),{data:n}=wM(e),r=n?.experiments;return Ct({queryKey:["dataset-review-items",e,r?.map(s=>s.id)],queryFn:async()=>!r||r.length===0?[]:(await Promise.all(r.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(o=>o.status==="needs-review").map(o=>({id:o.id,input:o.input,output:o.output,error:o.error,itemId:o.itemId,experimentId:o.experimentId,datasetId:a.datasetId??void 0,traceId:o.traceId??void 0,scores:o.scores?Object.fromEntries(o.scores.map(c=>[c.scorerId,c.score??0])):{},tags:o.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!r&&r.length>0,refetchOnWindowFocus:!1})},Jes=e=>{const t=Ze(),{data:n}=wM(e),r=n?.experiments;return Ct({queryKey:["dataset-completed-items",e,r?.map(s=>s.id)],queryFn:async()=>!r||r.length===0?[]:(await Promise.all(r.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(o=>o.status==="complete").map(o=>({id:o.id,input:o.input,output:o.output,error:o.error,itemId:o.itemId,experimentId:o.experimentId,datasetId:a.datasetId??void 0,traceId:o.traceId??void 0,scores:o.scores?Object.fromEntries(o.scores.map(c=>[c.scorerId,c.score??0])):{},tags:o.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!r&&r.length>0,refetchOnWindowFocus:!1})};function ets(e,t){if(typeof e=="string")return e.length>t?e.slice(0,t)+"...":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t)+"...":n}catch{return String(e)}}const tts=Y("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 nKe({className:e,children:t,...n}){return l.jsx(u2,{children:l.jsx(u7,{className:Y(tts,e),...n,children:t})})}function nts({datasetId:e}){const t=Ze(),{data:n}=Qv(e),{data:r,isLoading:s}=K5t(e),{data:a,isLoading:i}=Jes(e),{updateExperimentResult:o}=$i(),[c,u]=y.useState(null),[d,f]=y.useState(null),[h,p]=y.useState(new Set),[m,g]=y.useState(!1),[v,x]=y.useState(!1),[w,S]=y.useState(!1),[_,O]=y.useState(""),[E,j]=y.useState(""),[T,N]=y.useState(""),[I,P]=y.useState([]),[R,F]=y.useState(!1),[M,L]=y.useState(null),U=M??r??[];y.useEffect(()=>{r&&M===null&&L(r)},[r]);const z=y.useMemo(()=>{const ye=new Set;if(n?.tags)for(const Te of n.tags)ye.add(Te);for(const Te of U)for(const De of Te.tags)ye.add(De);return[...ye].sort()},[n,U]),q=y.useCallback(ye=>{!n||!e||(n.tags??[]).includes(ye)},[n,e]),W=y.useMemo(()=>d?d==="__untagged__"?U.filter(ye=>ye.tags.length===0):U.filter(ye=>ye.tags.includes(d)):U,[U,d]),D=y.useMemo(()=>{const ye=new Map;for(const Te of U)for(const De of Te.tags)ye.set(De,(ye.get(De)??0)+1);return[...ye.entries()].sort((Te,De)=>De[1]-Te[1])},[U]),Q=y.useMemo(()=>U.filter(ye=>ye.tags.length===0).length,[U]),V=y.useMemo(()=>{let ye=0;return d&&ye++,m&&ye++,ye},[d,m]),$=y.useCallback((ye,Te)=>{L(ut=>(ut??[]).map(jt=>jt.id===ye?{...jt,tags:Te}:jt));const De=U.find(ut=>ut.id===ye);De?.experimentId&&De?.datasetId&&o.mutate({datasetId:De.datasetId,experimentId:De.experimentId,resultId:De.id,tags:Te})},[U,o]),Z=y.useCallback((ye,Te)=>{const De=U.find(ut=>ut.id===ye);De?.traceId&&Te!==void 0&&t.createFeedback({feedback:{traceId:De.traceId,source:"studio",feedbackSource:"studio",feedbackType:"rating",value:Te==="positive"?1:-1,experimentId:De.experimentId??void 0,sourceId:De.id}}).catch(()=>{}),L(ut=>(ut??[]).map(jt=>jt.id===ye?{...jt,rating:Te}:jt))},[U,t]),G=y.useCallback((ye,Te)=>{const De=U.find(ut=>ut.id===ye);De?.traceId&&t.createFeedback({feedback:{traceId:De.traceId,source:"studio",feedbackSource:"studio",feedbackType:"comment",value:Te,comment:Te,experimentId:De.experimentId??void 0,sourceId:De.id}}).catch(()=>{}),L(ut=>(ut??[]).map(jt=>jt.id===ye?{...jt,comment:Te}:jt))},[U,t]),J=y.useCallback(ye=>{const Te=U.find(De=>De.id===ye);L(De=>(De??[]).filter(ut=>ut.id!==ye)),p(De=>{const ut=new Set(De);return ut.delete(ye),ut}),c===ye&&u(null),Te?.experimentId&&Te?.datasetId&&o.mutate({datasetId:Te.datasetId,experimentId:Te.experimentId,resultId:Te.id,status:null})},[U,o,c]),ie=y.useCallback(ye=>{const Te=U.find(De=>De.id===ye);L(De=>(De??[]).filter(ut=>ut.id!==ye)),p(De=>{const ut=new Set(De);return ut.delete(ye),ut}),c===ye&&u(null),Te?.experimentId&&Te?.datasetId&&o.mutate({datasetId:Te.datasetId,experimentId:Te.experimentId,resultId:Te.id,status:"complete"})},[U,o,c]),ne=y.useMemo(()=>{const ye=m?a??[]:W;return!m||!d?ye:d==="__untagged__"?ye.filter(Te=>Te.tags.length===0):ye.filter(Te=>Te.tags.includes(d))},[m,a,W,d]),te=m?i:!1,ae=y.useMemo(()=>new Set(ne.map(ye=>ye.id)),[ne]),de=y.useMemo(()=>[...h].filter(ye=>ae.has(ye)).length,[h,ae]),X=ne.length>0&&de===ne.length,re=de>0&&!X,le=y.useCallback(ye=>{p(Te=>{const De=new Set(Te);return De.has(ye)?De.delete(ye):De.add(ye),De})},[]),ge=y.useCallback(()=>{p(X?new Set:new Set(ne.map(ye=>ye.id)))},[X,ne]),fe=y.useCallback(ye=>{for(const Te of h){const De=U.find(ut=>ut.id===Te);De&&!De.tags.includes(ye)&&$(Te,[...De.tags,ye])}},[U,h,$]),ue=y.useCallback(ye=>{for(const Te of h){const De=U.find(ut=>ut.id===Te);De&&De.tags.includes(ye)&&$(Te,De.tags.filter(ut=>ut!==ye))}},[U,h,$]),be=y.useCallback(()=>{for(const ye of h)ie(ye);p(new Set)},[h,ie]),ke=y.useCallback(()=>{for(const ye of h)J(ye);p(new Set)},[h,J]),Ie=y.useCallback(()=>{O(""),S(!0)},[]),K=y.useCallback(async()=>{if(!(!E||!T)){x(!0),S(!1);try{const ye=U.filter(De=>h.has(De.id));if(ye.length===0){x(!1);return}const Te=await t.clusterFailures({modelId:`${E}/${T}`,items:ye.map(De=>({id:De.id,input:De.input,output:De.output??void 0,error:typeof De.error=="string"?De.error:De.error?String(De.error):void 0,scores:De.scores,existingTags:De.tags.length>0?De.tags:void 0})),availableTags:z.length>0?z:void 0,prompt:_||void 0});Te.proposedTags&&Te.proposedTags.length>0&&(P(Te.proposedTags.map(De=>({...De,accepted:!0}))),F(!0))}catch(ye){console.error("Analysis failed:",ye)}finally{x(!1)}}},[E,T,U,h,t,z,_]),oe=y.useCallback(()=>{for(const ye of I){if(!ye.accepted)continue;const Te=U.find(De=>De.id===ye.itemId);if(Te){const De=[...new Set([...Te.tags,...ye.tags])];$(Te.id,De)}}F(!1)},[I,U,$]),we=y.useCallback(ye=>{u(Te=>Te===ye?null:ye)},[]),Pe=y.useMemo(()=>c?ne.find(ye=>ye.id===c)??null:null,[c,ne]),Le=y.useCallback(()=>{if(!c||ne.length===0)return;const ye=ne.findIndex(Te=>Te.id===c);ye<ne.length-1&&u(ne[ye+1].id)},[c,ne]),ve=y.useCallback(()=>{if(!c||ne.length===0)return;const ye=ne.findIndex(Te=>Te.id===c);ye>0&&u(ne[ye-1].id)},[c,ne]),Ce=Pe?"2rem 1fr 10rem 8rem":"2rem 1fr 10rem 8rem 6rem 6rem";return s?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(Ut,{className:"w-6 h-6"})}):l.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[l.jsx(Fr,{open:w,onOpenChange:S,children:l.jsxs($r,{children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Analyze Items"}),l.jsx(va,{children:"Use an LLM to automatically suggest tags for the selected items."})]}),l.jsxs("div",{className:"space-y-4 py-2",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx(Et,{className:"text-xs mb-1 block",children:"Provider"}),l.jsx(Yv,{value:E,onValueChange:j})]}),l.jsxs("div",{children:[l.jsx(Et,{className:"text-xs mb-1 block",children:"Model"}),l.jsx(Xv,{llmId:E,value:T,onValueChange:N})]})]}),l.jsxs(me,{variant:"ui-xs",className:"text-neutral3",children:[h.size," item",h.size!==1?"s":""," will be analyzed"]}),l.jsxs("div",{children:[l.jsx(Et,{className:"text-xs",children:"Instructions (optional)"}),l.jsx(iu,{value:_,onChange:ye=>O(ye.target.value),placeholder:"E.g., Focus on safety issues and factual errors...",rows:3,className:"text-xs mt-1"})]})]}),l.jsxs(ph,{children:[l.jsx(ce,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),l.jsxs(ce,{onClick:K,disabled:!E||!T||v,children:[v?l.jsx(Ut,{className:"w-4 h-4 mr-1"}):null,"Analyze"]})]})]})}),l.jsx(Fr,{open:R,onOpenChange:F,children:l.jsxs($r,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Review Proposed Tags"}),l.jsxs(va,{children:[I.filter(ye=>ye.accepted).length," of ",I.length," proposals selected"]})]}),l.jsx("div",{className:"space-y-3 py-2",children:I.map((ye,Te)=>{const De=U.find(ut=>ut.id===ye.itemId);return l.jsx("div",{className:Y("p-3 border rounded-lg",!ye.accepted&&"opacity-50"),children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Wi,{checked:ye.accepted,onCheckedChange:ut=>P(jt=>jt.map((xn,He)=>He===Te?{...xn,accepted:!!ut}:xn))}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate block",children:De?typeof De.input=="string"?De.input.slice(0,100):JSON.stringify(De.input).slice(0,100):ye.itemId}),l.jsx("div",{className:"flex gap-1 flex-wrap mt-1.5",children:ye.tags.map((ut,jt)=>l.jsx(V5t,{tag:ut,onRename:xn=>P(He=>He.map((We,Re)=>Re===Te?{...We,tags:We.tags.map((Qe,Fe)=>Fe===jt?xn:Qe)}:We)),onRemove:()=>P(xn=>xn.map((He,We)=>We===Te?{...He,tags:He.tags.filter((Re,Qe)=>Qe!==jt)}:He))},`${ut}-${jt}`))}),ye.reason&&l.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-1 block italic",children:ye.reason})]})]})},ye.itemId)})}),l.jsxs(ph,{children:[l.jsx(ce,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),l.jsxs(ce,{onClick:oe,disabled:I.filter(ye=>ye.accepted).length===0,children:["Accept ",I.filter(ye=>ye.accepted).length," proposals"]})]})]})}),l.jsxs(sh,{className:Pe?"grid-cols-[1fr_1fr]":"",children:[l.jsxs(Tn,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsxs(ce,{variant:"outline",size:"md",children:[l.jsx(qet,{}),"Filter",V>0&&l.jsx("span",{className:Y("ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"),children:V})]})}),l.jsxs(St.Content,{align:"start",className:Y("min-w-48"),children:[l.jsxs(St.Sub,{children:[l.jsxs(St.SubTrigger,{children:["Status",m&&l.jsx("span",{className:Y("ml-auto text-ui-sm text-accent1"),children:"1"})]}),l.jsxs(nKe,{children:[l.jsx(St.CheckboxItem,{checked:!m,onCheckedChange:()=>{g(!1),u(null)},onSelect:ye=>ye.preventDefault(),children:"Review Queue"}),l.jsx(St.CheckboxItem,{checked:m,onCheckedChange:()=>{g(!0),u(null)},onSelect:ye=>ye.preventDefault(),children:"Completed"})]})]}),l.jsxs(St.Sub,{children:[l.jsxs(St.SubTrigger,{children:["Tags",d&&l.jsx("span",{className:Y("ml-auto text-ui-sm text-accent1"),children:"1"})]}),l.jsxs(nKe,{children:[l.jsx(St.CheckboxItem,{checked:!d,onCheckedChange:()=>f(null),onSelect:ye=>ye.preventDefault(),children:"All"}),Q>0&&l.jsx(St.CheckboxItem,{checked:d==="__untagged__",onCheckedChange:()=>f(d==="__untagged__"?null:"__untagged__"),onSelect:ye=>ye.preventDefault(),children:"Untagged"}),D.length>0&&l.jsx(St.Separator,{}),D.map(([ye])=>l.jsx(St.CheckboxItem,{checked:d===ye,onCheckedChange:()=>f(d===ye?null:ye),onSelect:Te=>Te.preventDefault(),children:ye},ye))]})]}),V>0&&l.jsxs(l.Fragment,{children:[l.jsx(St.Separator,{}),l.jsxs(St.Item,{onSelect:()=>{f(null),g(!1),u(null)},children:[l.jsx(qr,{}),"Clear all filters"]})]})]})]}),V>0&&l.jsxs(ce,{variant:"outline",size:"md",onClick:()=>{f(null),g(!1),u(null)},children:[l.jsx(qr,{}),"Reset"]})]}),!m&&h.size>0&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(q5t,{selectedCount:h.size,vocabulary:z,onApplyTag:fe,onRemoveTag:ue,onNewTag:ye=>fe(ye)}),l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsxs(ce,{disabled:v,children:[v?l.jsx(Ut,{className:"w-4 h-4"}):l.jsx(Ne,{size:"sm",children:l.jsx(Os,{})}),"Actions"]})}),l.jsxs(St.Content,{align:"end",children:[l.jsxs(St.Item,{onSelect:be,children:[l.jsx(Ne,{size:"sm",children:l.jsx(WS,{})}),"Complete"]}),l.jsxs(St.Item,{onSelect:ke,children:[l.jsx(Ne,{size:"sm",children:l.jsx(Kd,{})}),"Remove"]}),l.jsx(St.Separator,{}),l.jsxs(St.Item,{onSelect:Ie,children:[l.jsx(Ne,{size:"sm",children:l.jsx(AC,{})}),"Analyze"]})]})]})]})]}),te?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(Ut,{className:"w-6 h-6"})}):ne.length===0?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsxs("div",{className:"text-center px-8",children:[l.jsx(me,{variant:"ui-sm",className:"text-neutral3 block",children:m?"No completed reviews yet":"No items to review"}),l.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."})]})}):l.jsxs(xe,{columns:Ce,children:[l.jsxs(xe.Top,{children:[!m&&l.jsx(xe.TopCell,{children:l.jsx(Wi,{checked:X?!0:re?"indeterminate":!1,onCheckedChange:()=>ge(),"aria-label":"Select all"})}),m&&l.jsx(xe.TopCell,{children:" "}),l.jsx(xe.TopCell,{children:"Input"}),l.jsx(xe.TopCell,{children:"Comment"}),l.jsx(xe.TopCell,{children:"Tags"}),!Pe&&l.jsx(xe.TopCell,{children:"Rating"}),!Pe&&l.jsx(xe.TopCell,{children:"Scores"})]}),l.jsx(xe.Rows,{children:ne.map(ye=>{const Te=ye.scores?Object.entries(ye.scores):[];return l.jsxs(xe.Row,{onClick:()=>we(ye.id),selected:c===ye.id,children:[l.jsx(xe.Cell,{children:m?ye.error?l.jsx("div",{className:"w-2 h-2 rounded-full bg-red-700",title:"Error"}):l.jsx("div",{className:"w-2 h-2 rounded-full bg-green-600",title:"Success"}):l.jsx(Wi,{checked:h.has(ye.id),onCheckedChange:()=>le(ye.id),onClick:De=>De.stopPropagation(),"aria-label":`Select item ${ye.id}`})}),l.jsx(xe.NameCell,{children:ets(ye.input,80)}),l.jsx(xe.Cell,{children:ye.comment?l.jsx(me,{variant:"ui-xs",className:"text-neutral3 truncate",children:ye.comment}):l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),l.jsx(xe.Cell,{children:ye.tags.length>0?l.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate",children:ye.tags.join(", ")}):l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),!Pe&&l.jsxs(xe.Cell,{children:[ye.rating==="positive"&&l.jsx(Ne,{size:"sm",className:"text-positive1",children:l.jsx(rge,{})}),ye.rating==="negative"&&l.jsx(Ne,{size:"sm",className:"text-negative1",children:l.jsx(nge,{})}),!ye.rating&&l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})]}),!Pe&&l.jsx(xe.Cell,{children:Te.length>0?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Ne,{size:"sm",className:"text-neutral3",children:l.jsx(ci,{})}),l.jsx(me,{variant:"ui-xs",className:"text-neutral4 font-mono",children:Te[0][1].toFixed(2)}),Te.length>1&&l.jsxs(_t,{variant:"default",children:["+",Te.length-1]})]}):l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})})]},ye.id)})})]})]}),Pe&&l.jsx(U5t,{item:Pe,isCompleted:m,tagVocabulary:z,onRate:ye=>Z(Pe.id,ye),onSetTags:ye=>{$(Pe.id,ye);for(const Te of ye)z.includes(Te)||q(Te)},onComment:ye=>G(Pe.id,ye),onRemove:()=>J(Pe.id),onComplete:m?void 0:()=>ie(Pe.id),onPrevious:ve,onNext:Le,onClose:()=>u(null)})]})]})}function rts({datasetId:e,onExperimentClick:t,onEditClick:n,onDeleteClick:r,onAddItemClick:s,experimentTriggerSlot:a,onNavigateToDataset:i,activeDatasetVersion:o,onVersionSelect:c,initialTab:u,onTabChange:d}){const{navigate:f}=cn(),[h,p]=y.useState(u??"items"),m=Nt=>{p(Nt),d?.(Nt)},[g,v]=y.useState(!1),[x,w]=y.useState(!1),[S,_]=y.useState(!1),[O,E]=y.useState([]),[j,T]=y.useState(!1),[N,I]=y.useState([]),[P,R]=y.useState(!1),[F,M]=y.useState([]),[L,U]=y.useState(!1),[z,q]=y.useState(0),[W,D]=y.useState(null),[Q,V]=y.useState(""),[$]=Yjn(Q,300),[Z,G]=y.useState(null),ie=o!==void 0?o:Z,{data:ne,isLoading:te}=Qv(e),{data:ae=[],total:de,isLoading:X,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:ge}=ej(e,$||void 0,ie),{data:fe=[],total:ue,isLoading:be}=ej(e,void 0,ie),[ke,Ie]=y.useState({}),{data:K,isLoading:oe}=wM(e,void 0,ke),{data:we}=wM(e),{deleteItems:Pe}=$i(),Le=K?.experiments??[],ve=we?.experiments??[],Ce=xes({hasSearchQuery:!!$,filteredItemsLength:ae.length,unfilteredItemsTotal:ue,itemsTotal:de}),{data:ye}=K5t(e),Te=ye?.length??0,De=Nt=>{D(Nt)},ut=()=>{D(null)},jt=Nt=>{const un=Nt.isCurrent?null:Nt;c?c(un):G(Nt.isCurrent?null:Nt.version)},xn=Nt=>{E(Nt),_(!0)},He=Nt=>{I(Nt),T(!0)},We=Nt=>{T(Nt),Nt||(I([]),q(un=>un+1))},Re=Nt=>{f(`/datasets/${e}/items?items=${Nt.join(",")}`)},Qe=Nt=>{f(`/datasets/${e}/versions?ids=${Nt.join(",")}`)},Fe=Nt=>{M(Nt),R(!0)},Je=async()=>{await Pe.mutateAsync({datasetId:e,itemIds:F}),ze.success(`Deleted ${F.length} items`),R(!1),M([]),q(Nt=>Nt+1)},st=Nt=>{_(!1),E([]),q(un=>un+1),i?.(Nt)},Ot=Nt=>{_(Nt),Nt||(E([]),q(un=>un+1))};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsx("div",{className:Y("h-full w-full",kr.allSlow),children:l.jsxs("div",{className:Y("grid grid-rows-[auto_1fr] mx-auto h-full w-full m-auto",W?"max-w-[120rem]":"max-w-[90rem]"),children:[l.jsx(Kes,{dataset:ne,isLoading:te,onEditClick:n,onDuplicateClick:()=>U(!0),onDeleteClick:r,experimentTriggerSlot:a,disableExperimentTrigger:!be&&fe.length===0,onExperimentClick:t}),l.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:l.jsxs(bu,{defaultTab:"items",value:h,onValueChange:m,className:"grid grid-rows-[auto_1fr] h-full",children:[l.jsxs(xu,{children:[l.jsxs(Wr,{value:"items",children:["Items ",l.jsx(hi,{color:"gray",children:Ce})]}),l.jsxs(Wr,{value:"experiments",children:["Experiments",l.jsx(hi,{color:"gray",children:Le.length})]}),l.jsxs(Wr,{value:"review",children:["Review",Te>0&&l.jsx(hi,{color:"orange",children:Te})]})]}),l.jsx(Ns,{value:"items",className:"grid overflow-auto mt-5",children:l.jsx(Zes,{datasetId:e,items:ae,isLoading:X,featuredItemId:W,onItemSelect:De,onItemClose:ut,onAddClick:s??(()=>{}),onImportClick:()=>v(!0),onImportJsonClick:()=>w(!0),onBulkDeleteClick:Fe,onCreateDatasetClick:xn,onAddToDatasetClick:He,onCompareItemsClick:Re,datasetName:ne?.name,clearSelectionTrigger:z,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:ge,searchQuery:Q,onSearchChange:V,activeDatasetVersion:ie,currentDatasetVersion:ne?.version,onVersionSelect:jt,onCompareVersionsClick:Qe})}),l.jsx(Ns,{value:"experiments",className:"grid overflow-auto mt-5",children:l.jsx(Mes,{experiments:Le,allExperiments:ve,isLoading:oe,datasetId:e,filters:ke,onFiltersChange:Ie})}),l.jsx(Ns,{value:"review",className:"overflow-auto mt-0",children:l.jsx(nts,{datasetId:e})})]})})]})})}),l.jsx(Tes,{datasetId:e,open:g,onOpenChange:v}),l.jsx(Xes,{datasetId:e,open:x,onOpenChange:w}),l.jsx(pes,{open:S,onOpenChange:Ot,items:O,onSuccess:st}),l.jsx(mes,{open:j,onOpenChange:We,items:N,currentDatasetId:e}),l.jsx(ges,{open:L,onOpenChange:U,sourceDatasetId:e,sourceDatasetName:ne?.name||"",sourceDatasetDescription:ne?.description,onSuccess:i}),l.jsx(Wt,{open:P,onOpenChange:R,children:l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Delete Items"}),l.jsxs(Wt.Description,{children:["Are you sure you want to delete ",F.length," item",F.length!==1?"s":"","? This action cannot be undone."]})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{children:"Cancel"}),l.jsx(Wt.Action,{onClick:Je,children:Pe.isPending?"Deleting...":"Delete"})]})]})})]})}function sts(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const n=JSON.parse(t[1]);if(n.field&&Array.isArray(n.errors))return{field:n.field,errors:n.errors}}catch{}return null}function rKe({field:e,errors:t}){return t.length?l.jsx("div",{className:"mt-2 space-y-1",children:t.map((n,r)=>l.jsxs("p",{className:"text-xs text-destructive",children:[l.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,n.path!=="/"?n.path:""]}),": ",n.message]},r))}):null}function ats({datasetId:e,open:t,onOpenChange:n,onSuccess:r}){const[s,a]=y.useState("{}"),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,f]=y.useState(null),{addItem:h}=$i(),p=async x=>{x.preventDefault();let w;try{w=JSON.parse(s)}catch{ze.error("Input must be valid JSON");return}let S;if(i.trim())try{S=JSON.parse(i)}catch{ze.error("Ground Truth must be valid JSON");return}let _;if(c.trim())try{_=JSON.parse(c)}catch{ze.error("Expected Trajectory must be valid JSON");return}try{await h.mutateAsync({datasetId:e,input:w,groundTruth:S,expectedTrajectory:_}),ze.success("Item added successfully"),f(null),a("{}"),o(""),u(""),n(!1),r?.()}catch(O){const E=sts(O);E?f(E):ze.error(`Failed to add item: ${O instanceof Error?O.message:"Unknown error"}`)}},m=x=>{a(x),d?.field==="input"&&f(null)},g=x=>{o(x),d?.field==="groundTruth"&&f(null)},v=()=>{a("{}"),o(""),u(""),f(null),n(!1)};return l.jsx(Fr,{open:t,onOpenChange:n,children:l.jsxs($r,{className:"max-w-lg",children:[l.jsx(Br,{children:l.jsx(Mr,{children:"Add Item"})}),l.jsx(is,{children:l.jsxs("form",{onSubmit:p,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Et,{htmlFor:"item-input",children:"Input (JSON) *"}),l.jsx(vs,{value:s,onChange:m,showCopyButton:!1,className:"min-h-[120px]"}),d?.field==="input"&&l.jsx(rKe,{field:"input",errors:d.errors})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Et,{htmlFor:"item-ground-truth",children:"Ground Truth (JSON, optional)"}),l.jsx(vs,{value:i,onChange:g,showCopyButton:!1,className:"min-h-[80px]"}),d?.field==="groundTruth"&&l.jsx(rKe,{field:"groundTruth",errors:d.errors})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Et,{htmlFor:"item-trajectory",children:"Expected Trajectory (JSON, optional)"}),l.jsx(vs,{value:c,onChange:u,showCopyButton:!1,className:"min-h-[80px]"})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[l.jsx(ce,{type:"button",onClick:v,children:"Cancel"}),l.jsx(ce,{type:"submit",variant:"primary",disabled:h.isPending,children:h.isPending?"Adding...":"Add Item"})]})]})})]})})}function its({selectedScorers:e,setSelectedScorers:t,disabled:n=!1,container:r}){const{data:s,isLoading:a}=uf(),i=y.useMemo(()=>s?Object.entries(s).map(([o,c])=>({value:o,label:c.scorer?.config?.name||o,description:c.scorer?.config?.description||""})):[],[s]);return l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Et,{children:"Scorers (Optional)"}),l.jsx(FSt,{options:i,value:e,onValueChange:t,placeholder:"Select scorers...",searchPlaceholder:"Search scorers...",emptyText:"No scorers available",disabled:n||a,container:r})]})}const ots=[{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"}];function lts({targetType:e,setTargetType:t,targetId:n,setTargetId:r,container:s}){const{data:a,isLoading:i}=Wv(),{data:o,isLoading:c}=Zw(),{data:u,isLoading:d}=uf(),f=e==="agent"?Object.entries(a??{}).map(([g,v])=>({value:g,label:v.name??g})):e==="workflow"?Object.entries(o??{}).map(([g,v])=>({value:g,label:v.name??g})):e==="scorer"?Object.entries(u??{}).map(([g,v])=>({value:g,label:v.scorer?.config?.name??g})):[],h=e==="agent"&&i||e==="workflow"&&c||e==="scorer"&&d,p=g=>{t(g),r("")},m=e==="agent"?"Agent":e==="workflow"?"Workflow":"Scorer";return l.jsxs("div",{className:"grid gap-6",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Et,{children:"Target Type"}),l.jsx(Mc,{options:ots,value:e,onValueChange:p,placeholder:"Select target type",searchPlaceholder:"Search types...",emptyText:"No types available",container:s})]}),e&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Et,{children:m}),l.jsx(Mc,{options:f,value:n,onValueChange:r,placeholder:`Select ${e}`,searchPlaceholder:"Search...",emptyText:"No targets available",disabled:h,container:s})]})]})}function cts({datasetId:e,version:t,open:n,onOpenChange:r,onSuccess:s}){const a=y.useRef(null),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,f]=y.useState([]),{triggerExperiment:h}=$i(),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});Fm.success("Experiment triggered successfully"),r(!1),s?.(x.experimentId),o(""),u(""),f([])}catch(x){const w=x instanceof Error?x.message:"Failed to trigger experiment";Fm.error(w)}},v=()=>{m||(r(!1),o(""),u(""),f([]))};return l.jsx(Fr,{open:n,onOpenChange:v,children:l.jsxs($r,{ref:a,children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Run Experiment"}),l.jsx(va,{children:t?`Execute items from ${on(new Date(t),"MMM d, yyyy")} version against a target.`:"Execute all items in this dataset against a target."})]}),l.jsxs(is,{className:"grid gap-6",children:[l.jsx(lts,{targetType:i,setTargetType:o,targetId:c,setTargetId:u,container:a}),i&&i!=="scorer"&&l.jsx(its,{selectedScorers:d,setSelectedScorers:f,disabled:m,container:a})]}),l.jsxs(ph,{className:"px-6 pt-4",children:[l.jsx(ce,{onClick:v,disabled:m,children:"Cancel"}),l.jsx(ce,{variant:"primary",onClick:g,disabled:!p||m,children:m?l.jsxs(l.Fragment,{children:[l.jsx(Ut,{className:"w-4 h-4"}),"Running..."]}):"Run"})]})]})})}const J5t=e=>{const t=Ze();return Ct({queryKey:["experiment-trace-light",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return t.getTraceLight(e)},enabled:!!e})},sKe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"score",label:"Score",size:"1fr"}];function uts({result:e,scores:t,onPrevious:n,onNext:r,onClose:s,onShowTrace:a,onScoreClick:i,featuredScoreId:o}){const c=!!e?.error,u=ple(e?.input),d=ple(e?.output);return l.jsxs(l.Fragment,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:n,onNext:r,previousAriaLabel:"View previous result details",nextAriaLabel:"View next result details"}),l.jsxs(ys,{children:[l.jsxs(ce,{onClick:a,disabled:!e.traceId,children:[l.jsx(ege,{}),"Show Trace"]}),l.jsx(ce,{onClick:s,"aria-label":"Close result details panel",children:l.jsx(qr,{})})]})]}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(fb,{})," ",e.id]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:[l.jsx(V0,{})," ",e.itemId]})})]})}),c&&l.jsx(hr,{variant:"destructive",title:"Error",children:l.jsx(hr.Message,{children:ple(e?.error&&typeof e.error=="object"?e.error.message:e?.error)})}),t&&t.length>0&&l.jsxs(Bt,{className:"grid-rows-[auto_auto] overflow-visible",children:[l.jsxs(Bt.Header,{columns:sKe,children:[l.jsx(Bt.HeaderCol,{children:"Scorer"}),l.jsx(Bt.HeaderCol,{children:"Score"})]}),l.jsx(Bt.Items,{children:t.map(f=>l.jsx(Bt.Row,{children:l.jsxs(Bt.RowButton,{item:{id:f.id},columns:sKe,isFeatured:o===f.id,onClick:i,children:[l.jsx(Bt.TextCell,{children:f.scorerId}),l.jsx(Bt.TextCell,{className:"font-mono",children:f.score.toFixed(3)})]})},f.id))})]}),(e.status||Array.isArray(e.tags)&&e.tags.length>0)&&l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[l.jsx(ij,{className:"w-4 h-4"})," Review Status"]}),l.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.status&&l.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=>l.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-surface4 text-neutral4",children:f},f))]})]}),l.jsx(Yt.CodeSection,{title:"Input",icon:l.jsx(V0,{}),codeStr:u}),l.jsx(Yt.CodeSection,{title:"Output",icon:l.jsx(Yf,{}),codeStr:d}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[l.jsx(TC,{className:"w-4 h-4"})," Created"]}),l.jsx("p",{className:"text-sm text-neutral4",children:on(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")})]})]})]})}function ple(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function dts({span:e}){return e?l.jsxs(l.Fragment,{children:[l.jsx(Yt.CodeSection,{title:"Input",icon:l.jsx(H0,{}),codeStr:JSON.stringify(e.input||null,null,2)}),l.jsx(Yt.CodeSection,{title:"Output",icon:l.jsx(Yf,{}),codeStr:JSON.stringify(e.output||null,null,2)}),l.jsx(Yt.CodeSection,{title:"Metadata",icon:l.jsx(Tp,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),l.jsx(Yt.CodeSection,{title:"Attributes",icon:l.jsx(Tp,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]}):null}function fts({traceId:e,spanId:t,onNext:n,onPrevious:r,onClose:s}){const{data:a}=Ak(e,t),i=a?.span;return l.jsxs(l.Fragment,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:r,onNext:n,previousAriaLabel:"View previous span details",nextAriaLabel:"View next span details"}),l.jsx(ce,{onClick:s,"aria-label":"Close span details",children:l.jsx(qr,{})})]}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(Tp,{})," Span ",rh(t)]})})}),l.jsx(dts,{span:i})]})]})}const hts=e=>{if(!e||e.length===0)return[];const t=e.reduce((o,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!o||u>o)?u:o},null),n=new Map,r=[];e.forEach(o=>{const c=new Date(o.startedAt),u=o.endedAt?new Date(o.endedAt):void 0,d={id:o.spanId,name:o.name,type:o.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:o.parentSpanId};n.set(o.spanId,d)}),e.forEach(o=>{const c=n.get(o.spanId);if(o?.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}r.push(c)}else{const u=n.get(o.parentSpanId);u?u.spans.push(c):r.push(c)}});const s=o=>o.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(r),i=o=>{o.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function e6t(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(n=>{t.push(n.id),t.push(...e6t(n))}),t}const aKe=["agent","workflow","model","mcp","tool","workspace","other"];function t6t(e){const t=e?.toLowerCase().split("_")[0],n={agent:{icon:l.jsx(za,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:l.jsx(go,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:l.jsx(Zg,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:l.jsx(ac,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"bg-oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:l.jsx(mo,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},workspace:{icon:l.jsx($q,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"bg-oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}};return t in n?n[t]:{typePrefix:"other"}}function pts({isSelected:e,isFaded:t,isExpanded:n,toggleChildren:r,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:o}){return l.jsx("div",{className:Y("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:o&&o>0?l.jsxs("div",{className:"flex gap-1",children:[l.jsxs(iKe,{onClick:()=>r?.(),children:[i?a:o," ",n?i?l.jsx(Ret,{}):l.jsx(Ow,{}):l.jsx(Os,{})]}),a>(o??0)&&!i&&l.jsxs(iKe,{onClick:()=>s?.(),children:[a," ",l.jsx(Iet,{})]})]}):null})}function iKe({onClick:e,children:t,className:n}){return l.jsx("button",{onClick:e,className:Y("h-full",n),children:l.jsx("div",{className:Y("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 mts({isLastChild:e,hasChildren:t=!1,expanded:n=!1}){return l.jsx("div",{className:Y("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&&l.jsx("span",{className:Y("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:n?l.jsx(Met,{}):l.jsx($et,{})})})}function gts({span:e,spanUI:t,isFaded:n,depth:r=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:o,isRootSpan:c,isExpanded:u,toggleChildren:d}){return l.jsxs("div",{className:"flex overflow-x-auto",style:{paddingLeft:`${r*1.5}rem`},children:[!c&&l.jsx("button",{onClick:()=>d?.(),disabled:!o,className:Y({"cursor-default":!o,"cursor-pointer":o}),children:l.jsx(mts,{isLastChild:i,hasChildren:!!o,expanded:u})}),l.jsx("button",{className:"truncate",onClick:()=>s?.(e.id),children:e.name})]})}function n6t({span:e,depth:t=0,onSpanClick:n,selectedSpanId:r,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:o,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=e6t(e),v=g.length,x=t===0,w=t6t(e?.type),S=f?f.includes(e.id):!1,_=d&&d.length>0?!d.includes(e.id):!1,E=(c&&c.length>0?c.includes(w?.typePrefix||""):!1)||_;y.useEffect(()=>{x&&h?.([e.id])},[x,e.id,h]),y.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(P=>d.includes(P.id));!S&&I&&j()},[d,e.spans,e.id,S,h,f]);const j=()=>{if(!(!h||!f))if(S){const I=[e.id,...g];h(f.filter(P=>!I.includes(P)))}else h([...f,e.id])},T=()=>{!h||!f||h([...f,e.id,...g])},N=g.every(I=>f?.includes(I));return l.jsxs(l.Fragment,{children:[l.jsx(gts,{span:e,spanUI:w,isFaded:E,depth:t,onSpanClick:n,selectedSpanId:r,isLastChild:s,hasChildren:p,isRootSpan:x,isExpanded:S,toggleChildren:j}),l.jsx(pts,{isSelected:r===e.id,isFaded:E,isExpanded:S,toggleChildren:j,expandAllDescendants:T,totalDescendants:v,allDescendantsExpanded:N,numOfChildren:m}),p&&S&&e.spans?.map((I,P,R)=>{const F=P===R.length-1;return l.jsx(n6t,{span:I,depth:t+1,onSpanClick:n,selectedSpanId:r,isLastChild:F,overallLatency:a,overallStartTime:i,fadedTypes:c,searchPhrase:u,expandedSpanIds:f,setExpandedSpanIds:h,featuredSpanIds:d},I.id)})]})}function vts({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:n,isLoading:r,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:o}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return l.jsx(l.Fragment,{children:r?l.jsxs("div",{className:Y("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:[l.jsx(Ut,{})," Loading Trace Timeline ..."]}):l.jsx("div",{className:"grid grid-cols-[1fr_auto]",children:e?.map(f=>l.jsx(n6t,{span:f,onSpanClick:t,selectedSpanId:n,overallLatency:c,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:o,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})})}function yts({spans:e=[],fadedTypes:t,onLegendClick:n,onLegendReset:r,onSearchPhraseChange:s,traceId:a}){const[i,o]=y.useState("");y.useEffect(()=>{o("")},[a]);const c=aKe.filter(h=>e.some(p=>p?.spanType?.startsWith(h)))||[],u=e.some(h=>!aKe.some(m=>h?.spanType?.startsWith(m))),d=h=>{n?.(h)};y.useEffect(()=>{f(i)},[i,s]);const f=umt(h=>{s?.(h)},1e3);return l.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[l.jsx("div",{className:"flex",children:l.jsx(rw,{name:"search-spans",label:"Find span by name",labelIsHidden:!0,placeholder:"Look for span name",value:i,onChange:h=>{o(h.target.value)},onReset:()=>o("")})}),l.jsxs(ys,{spacing:"close",children:[c.map(h=>{const p=t6t(h),m=t?.includes(h);return l.jsx(y.Fragment,{children:l.jsxs(ce,{onClick:()=>d(h),className:m?"opacity-40":"",style:{color:m?void 0:p?.color,backgroundColor:p?.bgColor},children:[p?.icon&&l.jsx(Ne,{children:p.icon}),p?.label]})},h)}),u&&l.jsxs(ce,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",children:[l.jsx(Ne,{children:l.jsx(K8,{})}),"Other"]}),l.jsx(ce,{onClick:r,disabled:t?.length===0,children:l.jsx(Ne,{children:l.jsx(qr,{})})})]})]})}function bts({traceId:e,selectedSpanId:t,onSpanSelect:n,onClose:r}){const{data:s,isLoading:a}=J5t(e),i=s?.spans??[],[o,c]=y.useState(""),[u,d]=y.useState([]),[f,h]=y.useState([]),[p,m]=y.useState([]),g=y.useMemo(()=>hts(i),[i]);y.useEffect(()=>{if(o.trim()===""){h([]);return}const S=o.toLowerCase(),_=i.filter(O=>O.name.toLowerCase().includes(S)).map(O=>O.spanId);h(_)},[o,i]),y.useEffect(()=>{c(""),d([]),h([]),m([])},[e]);const v=S=>{n?.(t===S?void 0:S)},x=S=>{d(_=>_.includes(S)?_.filter(O=>O!==S):[..._,S])},w=()=>{d([])};return l.jsxs(l.Fragment,{children:[l.jsx(Tn.Toolbar,{children:l.jsx(ce,{onClick:r,"aria-label":"Close trace panel",children:l.jsx(qr,{})})}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(cl,{})," Trace ",rh(e)]})})}),l.jsx(yts,{spans:i,fadedTypes:u,onLegendClick:x,onLegendReset:w,searchPhrase:o,onSearchPhraseChange:c,traceId:e}),l.jsx(vts,{hierarchicalSpans:g,onSpanClick:v,selectedSpanId:t,isLoading:a,fadedTypes:u,expandedSpanIds:p,setExpandedSpanIds:m,featuredSpanIds:f})]})]})}function xts({results:e,isLoading:t,featuredResultId:n,onResultClick:r,columns:s,scoresByItemId:a,scorerIds:i,setEndOfListElement:o,isFetchingNextPage:c,hasNextPage:u}){const d=s.map(f=>f.size).join(" ");return t?l.jsxs(xe,{columns:d,children:[l.jsx(xe.Top,{children:s.map(f=>l.jsx(xe.TopCell,{children:f.label},f.name))}),l.jsx("div",{className:"flex items-center justify-center py-20 col-span-full",children:l.jsx(Ut,{})})]}):e.length===0?l.jsxs(xe,{columns:d,children:[l.jsx(xe.Top,{children:s.map(f=>l.jsx(xe.TopCell,{children:f.label},f.name))}),l.jsx(xe.NoMatch,{message:"No results yet"})]}):l.jsxs(xe,{columns:d,children:[l.jsx(xe.Top,{children:s.map(f=>l.jsx(xe.TopCell,{children:f.label},f.name))}),l.jsxs(xe.Rows,{children:[e.map(f=>{const h=!!f.error,p=f.id===n;return l.jsxs(xe.Row,{onClick:()=>r(f.id),selected:p,children:[l.jsx(xe.TextCell,{children:l.jsx("span",{className:"truncate block font-mono",children:f.itemId})}),l.jsx(xe.Cell,{children:l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("div",{className:"flex items-center justify-center w-10 relative bg-transparent h-full",children:l.jsx("div",{className:Y("w-2 h-2 rounded-full",h?"bg-red-700":"bg-green-600")})})}),l.jsx(er,{children:h?"Error":"Success"})]})}),s.some(m=>m.name==="input")&&l.jsx(xe.TextCell,{children:l.jsx("span",{className:"truncate block font-mono",children:Sts(wts(f.input),200)})}),i?.map(m=>{const v=a?.[f.itemId]?.find(x=>x.scorerId===m);return l.jsx(xe.TextCell,{children:l.jsx("span",{className:"font-mono",children:v!=null?v.score.toFixed(3):"-"})},m)})]},f.id)}),l.jsxs("div",{ref:o,className:"h-1 col-span-full",children:[c&&l.jsx("div",{className:"flex justify-center py-4",children:l.jsx(Ut,{})}),!u&&e.length>0&&l.jsx(me,{variant:"ui-xs",className:"text-icon3 text-center py-4 block",children:"All results loaded"})]})]})]})}function wts(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function Sts(e,t){return e.length<=t?e:e.slice(0,t-1)+"..."}function kts(e){const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function _ts({score:e,onNext:t,onPrevious:n,onClose:r}){const s=kts(e),a=s?"N/A — code-based scorer":"N/A — step not configured";return l.jsxs(l.Fragment,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:n,onNext:t,previousAriaLabel:"View previous score details",nextAriaLabel:"View next score details"}),l.jsx(ce,{onClick:r,"aria-label":"Close score details",children:l.jsx(qr,{})})]}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(ci,{})," ",e.scorerId]})})}),l.jsxs(sw,{children:[l.jsx(Yt.CodeSection,{title:`Score: ${e.score}`,icon:l.jsx(ci,{}),codeStr:e.reason||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Input",icon:l.jsx(V0,{}),codeStr:JSON.stringify(e.input??null,null,2)}),l.jsx(Yt.CodeSection,{title:"Output",icon:l.jsx(Yf,{}),codeStr:JSON.stringify(e.output??null,null,2)}),!s&&l.jsxs(l.Fragment,{children:[l.jsx(Yt.CodeSection,{title:"Preprocess Prompt",icon:l.jsx(Gc,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Analyze Prompt",icon:l.jsx(Gc,{}),codeStr:e.analyzePrompt||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Generate Score Prompt",icon:l.jsx(Gc,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Generate Reason Prompt",icon:l.jsx(Gc,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})]})}const oKe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"avg",label:"Avg Score",size:"1fr"},{name:"count",label:"Items Scored",size:"1fr"}];function Ots({scoresByItemId:e,experimentStatus:t}){const n=y.useMemo(()=>{if(!e)return[];const r={};for(const s of Object.values(e))for(const a of s)r[a.scorerId]||(r[a.scorerId]={sum:0,count:0}),r[a.scorerId].sum+=a.score,r[a.scorerId].count++;return Object.entries(r).map(([s,{sum:a,count:i}])=>({scorerId:s,avg:a/i,count:i})).sort((s,a)=>s.scorerId.localeCompare(a.scorerId))},[e]);if(n.length===0){const r=t==="running"||t==="pending",s=e!==void 0;let a,i;return r?(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…"),l.jsx("div",{className:"flex h-full items-center justify-center py-12",children:l.jsx(Ii,{iconSlot:l.jsx(ci,{className:"w-8 h-8 text-neutral3"}),titleSlot:a,descriptionSlot:i})})}return l.jsxs(Bt,{children:[l.jsxs(Bt.Header,{columns:oKe,children:[l.jsx(Bt.HeaderCol,{children:"Scorer"}),l.jsx(Bt.HeaderCol,{children:"Avg Score"}),l.jsx(Bt.HeaderCol,{children:"Items Scored"})]}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:n.map(({scorerId:r,avg:s,count:a})=>l.jsxs(Bt.Row,{columns:oKe,children:[l.jsx(Bt.TextCell,{children:r}),l.jsx(Bt.TextCell,{className:"font-mono",children:s.toFixed(3)}),l.jsx(Bt.TextCell,{className:"font-mono",children:a})]},r))})})]})}function r6t({experimentId:e,experimentStatus:t,results:n,isLoading:r,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i}){const[o,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(void 0),[p,m]=y.useState(null),g=n.find(z=>z.id===o)??null,{data:v}=R5t(e,t),x=y.useMemo(()=>{if(!v)return[];const z=new Set;for(const q of Object.values(v))for(const W of q)z.add(W.scorerId);return[...z].sort()},[v]),{data:w}=J5t(u),S=w?.spans??[],_=()=>{if(!f)return;const z=S.findIndex(q=>q.spanId===f);if(z>=0&&z<S.length-1)return()=>h(S[z+1].spanId)},O=()=>{if(!f)return;const z=S.findIndex(q=>q.spanId===f);if(z>0)return()=>h(S[z-1].spanId)},E=z=>{c(z),d(null),h(void 0),m(null)},j=z=>{E(z===o?null:z)},T=()=>{E(null)},N=()=>{if(!g)return;const z=n.findIndex(q=>q.id===g.id);if(z>=0&&z<n.length-1)return()=>E(n[z+1].id)},I=()=>{if(!g)return;const z=n.findIndex(q=>q.id===g.id);if(z>0)return()=>E(n[z-1].id)},P=g?v?.[g.itemId]:void 0,R=P?.find(z=>z.id===p)??null,F=z=>{m(z===p?null:z),d(null),h(void 0)},M=()=>{if(!p||!P)return;const z=P.findIndex(q=>q.id===p);if(z>=0&&z<P.length-1)return()=>m(P[z+1].id)},L=()=>{if(!p||!P)return;const z=P.findIndex(q=>q.id===p);if(z>0)return()=>m(P[z-1].id)},U=y.useMemo(()=>[{name:"itemId",label:"Item ID",size:"5rem"},{name:"status",label:"Status",size:"3rem"},{name:"input",label:"Input",size:"1fr"},...o?[]:x.map(z=>({name:z,label:z,size:"1fr"}))],[o,x]);return l.jsxs(bu,{defaultTab:"summary",className:"grid grid-rows-[auto_1fr] h-full overflow-hidden",children:[l.jsxs(xu,{children:[l.jsx(Wr,{value:"summary",children:"Summary"}),l.jsx(Wr,{value:"results",children:"Results"})]}),l.jsx(Ns,{value:"summary",className:"overflow-y-auto mt-5",children:l.jsx(Ots,{scoresByItemId:v,experimentStatus:t})}),l.jsx(Ns,{value:"results",className:"grid overflow-hidden mt-5",children:l.jsxs(sh,{className:g?"grid-cols-[1fr_2fr]":void 0,children:[l.jsx(Tn,{children:l.jsx(xts,{results:n,isLoading:r,featuredResultId:o,onResultClick:j,columns:U,scoresByItemId:v,scorerIds:o?void 0:x,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i})}),g&&l.jsxs(Qer,{numOfColumns:1+(!u&&p?1:0)+(u?1:0)+(f?1:0),minColumnWidth:"35rem",children:[g&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(uts,{result:g,scores:P,onPrevious:I(),onNext:N(),onClose:T,onScoreClick:F,featuredScoreId:p,onShowTrace:()=>{d(g.traceId??null),h(void 0),m(null)}})}),g&&!u&&R&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(_ts,{score:R,onNext:M(),onPrevious:L(),onClose:()=>m(null)})}),g&&u&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(bts,{traceId:u,selectedSpanId:f,onSpanSelect:h,onClose:()=>{d(null),h(void 0)}})}),g&&u&&f&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(fts,{traceId:u,spanId:f,onNext:_(),onPrevious:O(),onClose:()=>h(void 0)})})]})]})})]})}const Ets={pending:l.jsx(Kk,{}),running:l.jsx(Nz,{}),completed:l.jsx(qa,{}),failed:l.jsx(qr,{})};function Cts({experiment:e,className:t}){const n=e.status,r=e.totalItems-e.succeededCount-e.failedCount;return l.jsxs("div",{className:Y("grid justify-items-end gap-3",t),children:[l.jsxs("div",{className:"flex p-1 px-3 text-ui-lg capitalize text-neutral4 gap-2 items-center bg-surface5 rounded-lg ",children:[l.jsx("span",{className:Y("w-5 h-5 flex items-center justify-center rounded-full text-black","[&>svg]:w-4 [&>svg]:h-4",{"bg-green-700":n==="completed","bg-red-700":n==="failed","bg-cyan-600":n==="running","bg-yellow-600":n==="pending"}),children:Ets[n]}),e.status]}),l.jsxs("div",{className:Y("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:[l.jsxs("span",{children:["Total: ",l.jsx("b",{children:e.totalItems})]}),l.jsxs("span",{children:["Succeeded: ",l.jsx("b",{children:e.succeededCount})]}),l.jsxs("span",{children:["Failed: ",l.jsx("b",{children:e.failedCount})]}),(n==="pending"||n==="running")&&l.jsxs("span",{children:["Pending: ",l.jsx("b",{children:r})]})]})]})}function s6t({experimentId:e,experiment:t}){const{Link:n,paths:r}=cn(),{data:s}=Wv(),{data:a}=Zw(),{data:i}=uf(),o=()=>{switch(t.targetType){case"agent":return r.agentLink(t.targetId);case"workflow":return r.workflowLink(t.targetId);case"scorer":return r.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 l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(Det,{}),e," ",e&&l.jsx(da,{content:e})]}),l.jsxs(Hn.Description,{children:[l.jsxs(ms,{children:[l.jsx(TC,{})," Created at ",on(new Date(t.createdAt),"MMM d, yyyy 'at' h:mm a")]}),t.completedAt&&l.jsxs(ms,{children:[l.jsx(TC,{})," Completed at ",on(new Date(t.completedAt),"MMM d, yyyy 'at' h:mm a")]})]}),l.jsxs(Hn.Description,{children:[l.jsxs(ms,{children:[l.jsx(mGt,{})," Target",l.jsx(n,{href:o(),children:c()})]}),t.agentVersion&&l.jsxs(ms,{children:[l.jsx(eU,{})," Version",t.targetType==="agent"&&t.targetId?l.jsx(n,{href:`${r.agentLink(t.targetId)}/editor?version=${encodeURIComponent(t.agentVersion)}`,className:"font-mono text-xs underline hover:text-accent1",children:t.agentVersion}):l.jsx("span",{className:"font-mono text-xs",children:t.agentVersion}),l.jsx(da,{content:t.agentVersion})]})]})]}),l.jsx(Hn.Column,{children:l.jsx(Cts,{experiment:t})})]})}function pEe({delta:e}){const t=e>0?l.jsx(hi,{size:"small",color:"green",intensity:"muted",children:l.jsx(Gme,{})}):e<0?l.jsx(hi,{size:"small",color:"red",intensity:"muted",children:l.jsx(jet,{})}):null;return l.jsxs("span",{className:Y("font-mono text-sm text-neutral4 min-w-20"),children:[l.jsx("span",{className:"w-3 inline-block",children:e>0?"+ ":e<0?"- ":""}),Math.abs(e).toFixed(2)," ",t]})}function G5(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function Tts({item:e,baselineId:t,contenderId:n,baselineVersion:r,contenderVersion:s,onPrevious:a,onNext:i,onClose:o}){const c=e.results[t],u=e.results[n],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 l.jsxs(Tn,{withLeftSeparator:!0,children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:a,onNext:i,previousAriaLabel:"Previous comparison item",nextAriaLabel:"Next comparison item"}),l.jsx(ys,{children:l.jsx(ce,{onClick:o,"aria-label":"Close comparison detail panel",children:l.jsx(qr,{})})})]}),l.jsxs(Tn.Content,{className:"pb-6",children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(V0,{})," ",e.itemId]})})}),d?l.jsx(l.Fragment,{children:l.jsxs(sw,{children:[h.length>0&&l.jsxs("div",{className:"grid gap-3",children:[l.jsx("h4",{className:"text-sm font-medium text-neutral5",children:"Scores"}),l.jsx("div",{className:"grid gap-2",children:h.map(p=>{const m=c?.scores[p]??null,g=u?.scores[p]??null,v=m!=null&&g!=null?g-m:null;return l.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2 rounded-lg bg-surface2",children:[l.jsx("span",{className:"text-sm text-neutral5 font-medium",children:p}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"text-sm text-neutral3",children:[m!=null?m.toFixed(3):"-"," →"," ",g!=null?g.toFixed(3):"-"]}),v!=null&&l.jsx(pEe,{delta:v})]})]},p)})})]}),l.jsx(Yt.CodeSection,{title:l.jsxs(l.Fragment,{children:[l.jsx(hi,{color:"purple",children:"Baseline "})," Experiment Output"]}),icon:l.jsx(Yf,{}),codeStr:G5(c?.output)}),l.jsx(Yt.CodeSection,{title:l.jsxs(l.Fragment,{children:[l.jsx(hi,{color:"cyan",children:"Contender "})," Experiment Output"]}),icon:l.jsx(Yf,{}),codeStr:G5(u?.output)}),l.jsx(Yt.CodeSection,{title:"Item Input",icon:l.jsx(H0,{}),codeStr:G5(e.input)}),l.jsx(Yt.CodeSection,{title:"Item Ground Truth",icon:l.jsx(ttt,{}),codeStr:G5(e.groundTruth)})]})}):l.jsx(hr,{variant:"warning",title:"Comparison not available",children:l.jsx(hr.Message,{children:(()=>{const p=c?"Contender":"Baseline",m=c?s:r;return l.jsxs(l.Fragment,{children:["The ",p," experiment was run against dataset",m!=null?` v. ${m}`:"",", which does not contain this item."]})})()})})]})]})}function jts({items:e,baselineId:t,contenderId:n,scorerIds:r,featuredItemId:s,columns:a,onItemClick:i}){return l.jsx(Tn,{children:l.jsxs(Bt,{children:[l.jsxs(Bt.Header,{columns:a,children:[l.jsx(Bt.HeaderCol,{children:"Item ID"}),!s&&r.map(o=>l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:o},o))]}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:e.map(o=>{const c=o.results[t],u=o.results[n],d=!!(c&&u);return l.jsx(Bt.Row,{children:l.jsxs(Bt.RowButton,{item:{id:o.itemId},columns:a,isFeatured:s===o.itemId,onClick:i,children:[l.jsx(Bt.IdCell,{id:o.itemId,className:d?"":"text-neutral1"}),!s&&l.jsx(l.Fragment,{children:r.map(f=>{const h=c?.scores[f]??null,p=u?.scores[f]??null,m=h!=null&&p!=null?p-h:null;return l.jsx(Bt.Cell,{className:"flex items-center gap-5 justify-center font-mono",children:m!=null?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center text-neutral2 min-w-24",children:[h?.toFixed(2)," → ",p?.toFixed(2)]}),l.jsx(pEe,{delta:m})]}):l.jsx("span",{className:"text-neutral1",children:"-"})},f)})})]})},o.itemId)})})})]})})}const Nts={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 lKe({datasetId:e,experiment:t,type:n}){const{Link:r}=cn(),{label:s,color:a,customStyle:i}=Nts[n];if(!t)return null;const o=t.createdAt?new Date(t.createdAt):null;return l.jsxs("div",{className:`grid border-2 border-border1 rounded-lg p-5 gap-3 ${i}`,children:[l.jsxs("div",{className:"flex items-center gap-3 w-full overflow-clip",children:[n==="contender"&&l.jsxs(hi,{size:"small",color:a,children:[s,l.jsx(CS,{})]}),l.jsx(ce,{as:r,href:`/datasets/${e}/experiments/${t.id}`,children:l.jsx("span",{className:"truncate min-w-0",children:t.id})}),n==="baseline"&&l.jsxs(hi,{size:"small",color:a,children:[l.jsx(oh,{})," ",s]})]}),l.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-ui-sm text-neutral3",children:[l.jsxs(ms,{children:[l.jsx(ttt,{})," ",t.targetType," / ",t.targetId]}),l.jsxs(ms,{children:[l.jsx(Vet,{})," v",t.datasetVersion??"—"]}),o&&l.jsxs(ms,{children:[l.jsx(Net,{})," ",on(o,"MMM d, yyyy HH:mm")]})]})]})}function Ats({datasetId:e,experimentIdA:t,experimentIdB:n,onSwap:r}){const[s,a]=y.useState(null),{data:i,isLoading:o,error:c}=WJr(e,t,n),{data:u}=z8(e,t),{data:d}=z8(e,n),f=u&&d&&u.datasetVersion!==d.datasetVersion,h=y.useMemo(()=>{if(!i)return[];const j=new Set;for(const T of i.items)for(const N of Object.values(T.results))if(N)for(const I of Object.keys(N.scores))j.add(I);return[...j].sort()},[i]),p=y.useMemo(()=>{if(!i||h.length===0)return[];const j=i.baselineId,T=t===j?n:t;return h.map(N=>{let I=0,P=0,R=0,F=0;for(const z of i.items){const q=z.results[j]?.scores[N],W=z.results[T]?.scores[N];q!=null&&(I+=q,R++),W!=null&&(P+=W,F++)}const M=R>0?I/R:null,L=F>0?P/F:null,U=M!=null&&L!=null?L-M:null;return{scorerId:N,avgA:M,avgB:L,delta:U}})},[i,h,t,n]),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=y.useMemo(()=>[{name:"itemId",label:"Item ID",size:"8rem"},...s?[]:h.map(j=>({name:j,label:j,size:"1fr"}))],[h,s]),v=i?.items.find(j=>j.itemId===s)??null,x=j=>{a(j===s?null:j)},w=()=>{a(null)},S=()=>{if(!i||!s)return;const j=i.items.findIndex(T=>T.itemId===s);if(j>=0&&j<i.items.length-1)return()=>a(i.items[j+1].itemId)},_=()=>{if(!i||!s)return;const j=i.items.findIndex(T=>T.itemId===s);if(j>0)return()=>a(i.items[j-1].itemId)};if(o)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(Ut,{})});if(c)return l.jsx(hr,{variant:"warning",title:"Error loading comparison",children:l.jsx(hr.Message,{children:c instanceof Error?c.message:"Unknown error"})});if(!i||i.items.length===0)return l.jsx("div",{className:"text-neutral4 text-sm text-center py-8",children:"No comparison data"});const O=i.baselineId,E=t===O?n:t;return l.jsxs("div",{className:"grid gap-10",children:[u&&d&&l.jsxs("div",{className:Y("relative grid xl:grid-cols-[1fr_auto_1fr] gap-4 xl:gap-0"),children:[l.jsx(lKe,{datasetId:e,experiment:u,type:"baseline"}),l.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:l.jsx("div",{className:"relative z-1 bg-surface2 rounded-lg p-2",children:l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{onClick:r,children:"VS"})}),l.jsx(er,{children:"Switch the order"})]})})}),l.jsx(lKe,{datasetId:e,experiment:d,type:"contender"})]}),f&&l.jsx(hr,{variant:"warning",title:"Version mismatch",children:l.jsxs(hr.Message,{children:["These experiments used different dataset versions (v",u.datasetVersion," vs v",d.datasetVersion,"). Results may not be directly comparable."]})}),p.length>0&&l.jsxs(Bt,{children:[l.jsxs(Bt.Header,{columns:m,children:[l.jsx(Bt.HeaderCol,{children:"Scorer"}),l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:l.jsxs(L6e,{children:[l.jsx(hi,{color:"purple",size:"small",intensity:"muted",children:"Baseline"}),l.jsx(hi,{color:"purple",size:"small",children:"Avg"})]})}),l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:l.jsxs(L6e,{children:[l.jsx(hi,{color:"cyan",size:"small",intensity:"muted",children:"Contender"}),l.jsx(hi,{color:"cyan",size:"small",children:"Avg"})]})}),l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:"Delta"})]}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:p.map(({scorerId:j,avgA:T,avgB:N,delta:I})=>l.jsxs(Bt.Row,{columns:m,children:[l.jsx(Bt.TextCell,{children:j}),l.jsx(Bt.TextCell,{className:"text-center font-mono",children:T!=null?T.toFixed(3):"-"}),l.jsx(Bt.TextCell,{className:"text-center font-mono",children:N!=null?N.toFixed(3):"-"}),l.jsx(Bt.TextCell,{className:"flex justify-center",children:I!=null?l.jsx(pEe,{delta:I}):"-"})]},j))})})]}),l.jsxs(sh,{className:Y({"grid-cols-[1fr_2fr]":!!v}),children:[l.jsx(jts,{items:i.items,baselineId:O,contenderId:E,scorerIds:h,featuredItemId:s,columns:g,onItemClick:x}),!!v&&l.jsx(Tts,{item:v,baselineId:O,contenderId:E,baselineVersion:u?.datasetVersion,contenderVersion:d?.datasetVersion,onPrevious:_(),onNext:S(),onClose:w})]})]})}function Its({datasetId:e,itemId:t,onVersionSelect:n,onCompareVersionsClick:r,activeVersion:s}){const{data:a,isLoading:i}=hEe(e,t),[o,c]=y.useState(!1),[u,d]=y.useState(new Set),f=x=>{n?.(x)},h=x=>s==null?x.isLatest:x.datasetVersion===s,p=x=>{d(w=>{const S=new Set(w);if(S.has(x))S.delete(x);else if(S.size>=2){const[_]=Array.from(S);return new Set([_,x])}else S.add(x);return S})},m=()=>{c(!1),d(new Set)},g=()=>{c(!0)},v=()=>{u.size===2&&r?.([...u])};return l.jsxs(Tn,{className:"min-w-56",children:[o?l.jsx(Tn.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:l.jsxs(ys,{children:[l.jsx(ce,{onClick:m,children:"Cancel"}),l.jsx(ss,{variant:"primary",disabled:u.size!==2,onClick:v,tooltipContent:u.size!==2?"Check 2 versions to compare":void 0,className:"grow",children:"Compare"})]})}):l.jsx(l.Fragment,{children:(a||[]).length>1&&l.jsx(Tn.Toolbar,{children:l.jsxs(ce,{onClick:g,className:"w-full",children:[l.jsx(uv,{})," Compare Ver."]})})}),i?l.jsx(Rts,{}):l.jsxs(Bt,{children:[l.jsx(Bt.Header,{children:l.jsx(Bt.HeaderCol,{children:"Item Version History"})}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:a?.map(x=>{const w=String(x.datasetVersion),S=typeof x.updatedAt=="string"?new Date(x.updatedAt):x.updatedAt;return l.jsxs(Bt.Row,{isSelected:o&&u.has(w),children:[o&&l.jsx(Bt.LabelCell,{children:l.jsx(Wi,{checked:u.has(w),disabled:x.isDeleted,onCheckedChange:()=>{},onClick:_=>{_.stopPropagation(),x.isDeleted||p(w)},"aria-label":`Select version ${x.datasetVersion}`})}),l.jsx(Bt.RowButton,{item:x,columns:[{name:"version",label:"Item Version History",size:"1fr"}],isFeatured:h(x),onClick:()=>f(x),className:"py-2",children:l.jsx(Bt.VersionCell,{version:x.datasetVersion,date:S,isLatest:x.isLatest,isDeleted:x.isDeleted})})]},String(x.datasetVersion))})})})]})]})}function Rts(){return l.jsxs(Bt,{children:[l.jsx(Bt.Header,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:l.jsx(Bt.HeaderCol,{children:"Item Version History"})}),l.jsx(Bt.Items,{children:Array.from({length:3}).map((e,t)=>l.jsx(Bt.Row,{children:l.jsx(Bt.RowButton,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:l.jsx(Bt.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}function Pts(e,t){if(t){const n=typeof t=="string"?new Date(t):t;return`v${e} ${on(n,"MMM dd 'at' H:mm:ss a")}`}return`v${e}`}function $ts({datasetId:e,versionA:t,versionB:n,onVersionChange:r}){const{data:s}=dEe(e),a=(s??[]).map(i=>({value:String(i.version),label:`${Pts(i.version,i.createdAt)}${i.isCurrent?" (current)":""}`}));return l.jsxs(Tn.Toolbar,{className:"grid grid-cols-[1fr_1fr_1fr_10rem] gap-4 w-full",children:[l.jsx("div",{}),l.jsx(_l,{label:"Version A",labelIsHidden:!0,name:"version-a",placeholder:"Select version",options:a,value:t??"",onValueChange:i=>r?.(i,n??"")}),l.jsx(_l,{label:"Version B",labelIsHidden:!0,name:"version-b",options:a,value:n??"",onValueChange:i=>r?.(t??"",i)}),l.jsx("div",{})]})}const Mts=[{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"}],Dts={added:{color:"blue",borderColor:"border-blue-900",icon:l.jsx(Rs,{}),tooltip:"Added in this version"},changed:{color:"orange",borderColor:"border-yellow-900",icon:l.jsx(Jet,{}),tooltip:"Changed in this version"},same:{color:"green",borderColor:"border-green-900",icon:l.jsx(EGt,{}),tooltip:"Same in both versions"}};function mle({red:e=!1,tooltip:t}){return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(iZt,{className:Y("text-neutral3/40 w-5 h-5 ",{"text-red-900":e})})}),t&&l.jsx(er,{children:t})]})}function z1({variant:e,version:t}){if(!e)return l.jsxs("span",{className:"text-ui-md text-neutral4",children:["v. ",t]});const{color:n,icon:r,tooltip:s}=Dts[e];return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[t!==void 0&&l.jsxs("span",{className:"pr-3 text-ui-md text-neutral4 min-w-16 flex justify-end",children:["v. ",t]}),l.jsx(hi,{color:n,size:"small",children:r})]})}),l.jsx(er,{children:s})]})}function Lts(e,t){return e&&t&&e.datasetVersion===t.datasetVersion?"same":e&&t&&e.datasetVersion!==t.datasetVersion?"changed":e?"added":"removed"}function zts({datasetId:e,versionA:t,versionB:n,allItems:r,itemsAMap:s,itemsBMap:a}){const{Link:i}=cn(),o=t>n;return l.jsx(Bt,{children:l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:r.map(({id:c})=>{const u=s.get(c),d=a.get(c),f=Lts(u,d);return l.jsxs(Bt.Row,{columns:Mts,children:[l.jsx(Bt.IdCell,{id:c,isShortened:!1}),f!=="same"?l.jsxs(l.Fragment,{children:[u?.datasetVersion?l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!d&&o?l.jsx(z1,{variant:"added",version:u.datasetVersion}):f==="changed"&&o?l.jsx(z1,{variant:"changed",version:u.datasetVersion}):l.jsx(z1,{version:u.datasetVersion})}):l.jsx(Bt.Cell,{className:"justify-center flex items-center",children:l.jsx(mle,{red:o,tooltip:o?"Deleted in this version":"Not present in this version"})}),d?.datasetVersion?l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!u&&!o?l.jsx(z1,{variant:"added",version:d.datasetVersion}):f==="changed"&&!o?l.jsx(z1,{variant:"changed",version:d.datasetVersion}):l.jsx(z1,{version:d.datasetVersion})}):l.jsx(Bt.Cell,{className:"justify-center flex items-center",children:l.jsx(mle,{red:!o,tooltip:o?"Not present in this version":"Deleted in this version"})})]}):l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"col-span-2 gap-2",children:l.jsx(z1,{variant:"same",version:d?.datasetVersion})}),f==="changed"?l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}/versions?ids=${u?.datasetVersion},${d?.datasetVersion}`,children:"Compare"}):l.jsx(Bt.Cell,{children:l.jsx(mle,{tooltip:l.jsxs(l.Fragment,{children:["Comparing is available",l.jsx("br",{})," only for changed items"]})})})]},c)})})})})}const cKe={needsReview:"#facc15",complete:"#22c55e"},Fts=[{label:"Needs Review",color:cKe.needsReview},{label:"Reviewed",color:cKe.complete}];function Bts({reviewSummary:e,experiments:t,datasets:n,isLoading:r,isError:s}){const{data:a,maxVal:i,totalInPipeline:o}=y.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(n)for(const m of n)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 v=u.get(m.experimentId),x=v?.datasetId?d.get(v.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,n]),c=a.length>0;return l.jsxs(en,{children:[l.jsxs(en.TopBar,{children:[l.jsx(en.TitleAndDescription,{title:"Review Pipeline",description:"Items in review across experiments."}),c&&l.jsx(en.Summary,{value:String(o),label:"Items in pipeline"})]}),r?l.jsx(en.Loading,{}):s?l.jsx(en.Error,{message:"Failed to load review data"}):l.jsx(en.Content,{children:c?l.jsx(bT,{data:a,segments:Fts,maxVal:i,fmt:u=>String(u)}):l.jsx(en.NoData,{message:"No items have been sent to review yet"})})]})}function mEe(){const e=Ze();return Ct({queryKey:["experiment-review-summary"],queryFn:()=>e.getExperimentReviewSummary()})}function a6t(e){const t=new Map;if(!e?.counts)return t;for(const n of e.counts)t.set(n.experimentId,{needsReview:n.needsReview,complete:n.complete,total:n.total});return t}function Uts(e,t){const n=new Map,r=a6t(e);if(!r.size||!t)return n;for(const s of t){const a=r.get(s.id);if(!a||!s.datasetId||a.needsReview+a.complete===0)continue;const o=n.get(s.datasetId)??{needsReview:0,complete:0};o.needsReview+=a.needsReview,o.complete+=a.complete,n.set(s.datasetId,o)}return n}function qts(e){return e?.counts?e.counts.reduce((t,n)=>({needsReview:t.needsReview+n.needsReview,complete:t.complete+n.complete,inPipeline:t.inPipeline+n.needsReview+n.complete}),{needsReview:0,complete:0,inPipeline:0}):{needsReview:0,complete:0,inPipeline:0}}const Vts=10;function Hts(){const[e,t]=y.useState(!1),[n,r]=y.useState(""),[s,a]=y.useState("all"),[i,o]=y.useState("all"),[c,u]=y.useState("all"),[d,f]=y.useState(0),{data:h,isLoading:p,error:m}=Xp({page:d,perPage:Vts}),{data:g,isLoading:v,error:x}=GH(),{data:w}=mEe(),S=y.useMemo(()=>h?.datasets??[],[h?.datasets]),_=h?.pagination?.hasMore??!1,O=y.useMemo(()=>g?.experiments??[],[g?.experiments]),E=y.useMemo(()=>ues(S),[S]),j=y.useMemo(()=>Uts(w,O),[w,O]),T=p||v,N=m||x,I=()=>t(!0),P=y.useCallback(()=>f(W=>W+1),[]),R=y.useCallback(()=>f(W=>Math.max(0,W-1)),[]),F=y.useCallback(W=>{r(W),f(0)},[]),M=y.useCallback(W=>{a(W),f(0)},[]),L=y.useCallback(W=>{o(W),f(0)},[]),U=y.useCallback(W=>{u(W),f(0)},[]);if(N&&Hs(N))return l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(pa,{})});if(N&&Ps(N))return l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(aa,{resource:"datasets"})});if(N)return l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(dc,{title:"Failed to load datasets",message:N.message})});if(S.length===0&&!T&&d===0)return l.jsxs(l.Fragment,{children:[l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(des,{onCreateClick:I})}),l.jsx(_me,{open:e,onOpenChange:t})]});const z=s!=="all"||i!=="all"||c!=="all"||n!=="",q=()=>{r(""),a("all"),o("all"),u("all"),f(0)};return l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:T,children:[l.jsx(Ja,{})," Datasets"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsx(ss,{onClick:I,tooltipContent:"Create a dataset",children:l.jsx(Rs,{})}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Datasets documentation",children:l.jsx(yo,{})})]})]}),l.jsx(hes,{search:n,onSearchChange:F,targetFilter:s,onTargetFilterChange:M,experimentFilter:i,onExperimentFilterChange:L,tagFilter:c,onTagFilterChange:U,tagOptions:E,onReset:q,hasActiveFilters:z})]}),l.jsx(oes,{datasets:S,experiments:O,reviewByDataset:j,isLoading:T,search:n,targetFilter:s,experimentFilter:i,tagFilter:c,currentPage:d,hasMore:_,onNextPage:P,onPrevPage:R}),l.jsx(_me,{open:e,onOpenChange:t})]})}const Wts=new Set(["items","experiments","review"]);function Zts(){const{datasetId:e}=Sa(),t=id(),[n,r]=wo(),s=n.get("tab"),a=s&&Wts.has(s)?s:"items",i=E=>{r(E==="items"?{}:{tab:E},{replace:!0})},[o,c]=y.useState(!1),[u,d]=y.useState(!1),[f,h]=y.useState(!1),[p,m]=y.useState(!1),[g,v]=y.useState(null),{data:x,error:w}=Qv(e??"");if(!e)return l.jsx(Jn,{children:l.jsx(mh,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&Hs(w))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})});if(w&&Ps(w))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})});const S=E=>{t(`/datasets/${e}/experiments/${E}`)},_=()=>{t("/datasets")},O=E=>{v(E?.version??null)};return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(bes,{value:e,variant:"ghost"})})]})}),l.jsxs(mh,{className:"content-stretch",children:[l.jsx(rts,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:O,initialTab:a,onTabChange:i,experimentTriggerSlot:l.jsxs(ce,{variant:"primary",onClick:()=>c(!0),children:[l.jsx(fb,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),l.jsx(cts,{datasetId:e,version:g??void 0,open:o,onOpenChange:c,onSuccess:S}),l.jsx(ats,{datasetId:e,open:u,onOpenChange:d}),x&&l.jsx(ves,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&l.jsx(yes,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:_})]})]})}function Gts(){const{datasetId:e,experimentId:t}=Sa(),{data:n}=Qv(e??""),{data:r,isLoading:s,error:a}=z8(e,t),{data:i,isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=ZH({datasetId:e,experimentId:t,experimentStatus:r?.status});return!e||!t?null:s?l.jsx(Jn,{children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ut,{})})}):a&&Hs(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):a&&Ps(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):a||!r?l.jsx(Jn,{children:l.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:n?.name}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsx(s6t,{experimentId:t,experiment:r}),l.jsx(r6t,{experimentId:t,experimentStatus:r?.status,results:i??[],isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function Qts(){const{datasetId:e}=Sa(),[t,n]=wo(),{data:r,error:s}=Qv(e??""),a=t.get("baseline")??"",i=t.get("contender")??"";return s&&Hs(s)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):s&&Ps(s)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):!e||!a||!i?l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsxs(Bn,{isCurrent:!0,as:"span",children:[l.jsx(Ne,{children:l.jsx(uv,{})}),"Compare Experiments"]})]})}),l.jsx(mh,{children:l.jsxs("div",{className:"text-neutral4 text-center py-8",children:[l.jsx("p",{children:"Select two experiments to compare."}),l.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:r?.name??e?.slice(0,8)}),l.jsxs(Bn,{isCurrent:!0,as:"span",children:[l.jsx(Ne,{children:l.jsx(uv,{})}),"Experiments Comparison"]})]})}),l.jsx(mh,{children:l.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(uv,{})," Dataset Experiments Comparison"]}),l.jsxs(Hn.Description,{children:["Comparing"," ",l.jsx(ln,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",l.jsx(ln,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),l.jsx(Hn.Column,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}`,children:[l.jsx(oh,{}),"Back to Dataset"]})})]}),l.jsx(Ats,{datasetId:e,experimentIdA:a,experimentIdB:i,onSwap:()=>{n({baseline:i,contender:a})}})]})})]})}function Yts(){const{datasetId:e,itemId:t}=Sa(),{Link:n}=cn(),r=id(),{data:s,isLoading:a,error:i}=hEe(e??"",t??""),{updateItem:o,deleteItem:c}=$i(),{data:u}=Qv(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[h,p]=y.useState(null),m=y.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,[v,x]=y.useState(!1),[w,S]=y.useState(m.input),[_,O]=y.useState(m.groundTruth),[E,j]=y.useState(m.metadata),[T,N]=y.useState(g);g!==T&&(N(g),S(m.input),O(m.groundTruth),j(m.metadata));const[I,P]=y.useState(!1),R=V=>{p(f?V:V.isLatest?null:V)},F=()=>{p(null)},M=!f&&h!=null,L=()=>{M||x(!0)},U=()=>{M||P(!0)},z=async()=>{if(!e||!t)return;let V;try{V=JSON.parse(w)}catch{ze.error("Input must be valid JSON");return}let $;if(_.trim())try{$=JSON.parse(_)}catch{ze.error("Ground Truth must be valid JSON");return}let Z;if(E.trim())try{Z=JSON.parse(E)}catch{ze.error("Metadata must be valid JSON");return}try{await o.mutateAsync({datasetId:e,itemId:t,input:V,groundTruth:$,metadata:Z}),ze.success("Item updated successfully"),x(!1)}catch(G){ze.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},q=()=>{d&&(S(JSON.stringify(d.input,null,2)),O(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),j(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),ze.success("Item deleted successfully"),P(!1),r(`/datasets/${e}`)}catch(V){ze.error(`Failed to delete item: ${V instanceof Error?V.message:"Unknown error"}`)}},D=h??d,Q=D?{id:t??"",datasetId:e??"",datasetVersion:D.datasetVersion,input:D.input,groundTruth:D.groundTruth,metadata:D.metadata,createdAt:D.createdAt,updatedAt:D.updatedAt}:null;return i&&Hs(i)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):i&&Ps(i)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?l.jsx(Jn,{children:l.jsx(mh,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):l.jsxs(l.Fragment,{children:[l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:u?.name}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Item"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(V0,{}),t," ",l.jsx(da,{content:t})]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:["Item of ",l.jsx(Ja,{})," ",u?.name]})}),l.jsxs(Hn.Description,{children:[l.jsxs(ms,{children:[l.jsx(TC,{})," Created at"," ",d?.createdAt?on(new Date(d.createdAt),"MMM d, yyyy"):""]}),l.jsxs(ms,{children:[l.jsx(Ew,{})," Latest version v",d?.datasetVersion??""]})]})]}),l.jsx(Hn.Column,{children:!v&&!f&&l.jsxs(ys,{children:[l.jsxs(ce,{onClick:L,disabled:M,title:M?"Return to latest version to edit":void 0,children:[l.jsx(Jet,{})," Edit"]}),l.jsxs(ce,{onClick:U,disabled:M,title:M?"Return to latest version to delete":void 0,children:[l.jsx(Kd,{})," Delete"]})]})})]}),l.jsxs(sh,{className:v?"grid-cols-1":"grid-cols-[1fr_auto]",children:[l.jsxs(Tn,{withRightSeparator:!v,children:[f&&d&&l.jsx(hr,{variant:"destructive",title:"Item deleted",children:l.jsxs(hr.Message,{children:["This item was deleted at version v",d.datasetVersion]})}),!f&&M&&h&&l.jsx(hr,{variant:"warning",title:"Previous version",action:l.jsxs(hr.Button,{onClick:F,children:[l.jsx(tS,{})," Return to the latest version"]}),children:l.jsxs(hr.Message,{children:["Viewing version v",h.datasetVersion]})}),v?l.jsx(Y5t,{inputValue:w,setInputValue:S,groundTruthValue:_,setGroundTruthValue:O,metadataValue:E,setMetadataValue:j,validationErrors:null,onSave:z,onCancel:q,isSaving:o.isPending}):Q?l.jsx(QH,{item:Q,Link:n}):l.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!v&&l.jsx(Tn,{children:l.jsx(Its,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:V=>{r(`/datasets/${e}/items/${t}/versions?ids=${V.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),l.jsx(Wt,{open:I,onOpenChange:P,children:l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Delete Item"}),l.jsx(Wt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{children:"Cancel"}),l.jsx(Wt.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function uKe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Xts(){const{datasetId:e}=Sa(),[t,n]=wo(),r=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=Qv(e??""),{Link:i}=cn(),[o,c]=y.useState(!1),{data:u}=wme(e??"",r[0]??""),{data:d}=wme(e??"",r[1]??"");return a&&Hs(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):a&&Ps(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):!e||r.length<2?l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),l.jsx(mh,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two items to compare."})})})]}):l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Items"})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}`,variant:"outline",children:[l.jsx(Ne,{children:l.jsx(oh,{})}),"Back to Dataset"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":o}),children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(uv,{}),"Compare Dataset Items"]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:["Comparing ",r.length," items of"," ",l.jsx(ln,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),l.jsx(Hn.Column,{children:l.jsxs(ys,{children:[l.jsxs(ce,{as:ln,to:`/datasets/${e}`,children:[l.jsx(oh,{}),"Back to Dataset"]}),l.jsx(ce,{variant:"primary",onClick:()=>c(f=>!f),children:o?l.jsxs(l.Fragment,{children:[l.jsx(Bet,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(yGt,{})," Diff View"]})})]})})]}),l.jsx(sh,{className:"grid-cols-[1fr_3vw_1fr]",children:r.map((f,h)=>l.jsxs(y.Fragment,{children:[l.jsx(Kts,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:r,showContent:!o,onItemChange:p=>{const m=[...r];m[h]=p,n({items:m.join(",")})}}),h==0&&l.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),o&&u&&d&&l.jsx(Vkt,{codeA:uKe(u),codeB:uKe(d)})]})})]})}function Kts({datasetId:e,itemId:t,Link:n,idx:r,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:o,isLoading:c}=wme(e,t),{data:u}=ej(e),d=new Set(s.filter((h,p)=>p!==r)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return l.jsxs(Tn,{children:[l.jsxs(Tn.Toolbar,{className:"flex gap-4",children:[l.jsx(h1e,{label:"Item",name:`compare-item-${r}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),l.jsxs(ce,{as:n,to:`/datasets/${e}/items/${t}`,children:[l.jsx(Ew,{}),"Versions"]})]}),i&&l.jsx(Tn.Content,{children:c?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):o?l.jsxs(l.Fragment,{children:[l.jsx(X5t,{item:o}),l.jsx(QH,{item:o,Link:n})]}):l.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function dKe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Jts(){const{datasetId:e,itemId:t}=Sa(),[n,r]=wo(),[s,a]=y.useState(!1),i=n.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:o,error:c}=Qv(e??""),{Link:u}=cn(),{data:d}=hEe(e??"",t??""),{data:f}=Eme(e??"",t??"",i[0]??0,o?.version),{data:h}=Eme(e??"",t??"",i[1]??0,o?.version);return c&&Hs(c)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):c&&Ps(c)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):!e||!t||i.length<2?l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(mh,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]}):l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:o?.name}),l.jsx(Bn,{as:ln,to:`/datasets/${e}/items/${t}`,children:"Item"}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[l.jsx(Ne,{children:l.jsx(oh,{})}),"Back to Item"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(uv,{}),"Compare Dataset Item Versions"]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:["Comparing ",i.length," versions of"," ",l.jsx(ln,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),l.jsx(Hn.Column,{children:l.jsxs(ys,{children:[l.jsxs(ce,{as:ln,to:`/datasets/${e}/items/${t}`,children:[l.jsx(oh,{}),"Back to Item"]}),l.jsx(ce,{variant:"primary",onClick:()=>a(p=>!p),children:s?l.jsxs(l.Fragment,{children:[l.jsx(Bet,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(tQt,{})," Diff View"]})})]})})]}),l.jsx(sh,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>l.jsxs(y.Fragment,{children:[l.jsx(ens,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:o?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!s,onVersionChange:g=>{const v=[...i];v[m]=g,r({ids:v.join(",")})}}),m===0&&l.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),s&&f&&h&&l.jsx(Vkt,{codeA:dKe(f),codeB:dKe(h)})]})})]})}function ens({datasetId:e,itemId:t,datasetVersion:n,latestVersion:r,allVersions:s,versionNumbers:a,Link:i,idx:o,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=Eme(e,t,n,r),h=new Set(a.filter((g,v)=>v!==o)),p=s.map(g=>{const v=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:l.jsxs(l.Fragment,{children:[l.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",on(v,"MMM d, yyyy h:mm a"),g.isLatest?l.jsx(hi,{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 l.jsxs(Tn,{children:[l.jsxs(Tn.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[l.jsx(Ew,{className:"w-6 h-6 opacity-50"}),l.jsx(h1e,{label:"Version",name:`compare-version-${o}`,value:String(n),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&l.jsx(Tn.Content,{children:f?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?l.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",n," not found"]}):l.jsx(QH,{item:m,Link:i})})]})}function tns(){const{datasetId:e}=Sa(),[t]=wo(),n=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],r=id(),{data:s,error:a}=Qv(e??""),i=ej(e??"",void 0,n[0]??null),o=ej(e??"",void 0,n[1]??null),c=y.useMemo(()=>i.data??[],[i.data]),u=y.useMemo(()=>o.data??[],[o.data]),d=y.useMemo(()=>{const g=new Map;for(const v of[...c,...u])g.has(v.id)||g.set(v.id,{id:v.id,createdAt:new Date(v.createdAt)});return[...g.values()].sort((v,x)=>x.createdAt.getTime()-v.createdAt.getTime())},[c,u]),f=y.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=y.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(a&&Hs(a))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})});if(a&&Ps(a))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})});if(!e||n.length<2)return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(mh,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,v,x)=>{r(`/datasets/${e}/items/${g}/versions?ids=${v?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,v)=>{r(`/datasets/${e}/versions?ids=${g},${v}`,{replace:!0})};return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),l.jsxs(Bn,{isCurrent:!0,as:"span",children:[l.jsx(Ne,{children:l.jsx(XNe,{})}),"Compare Versions"]})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(XNe,{})," Compare Dataset Versions"]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:[l.jsx(Ew,{})," Comparing ",n.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),l.jsx(Hn.Column,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}`,children:[l.jsx(oh,{}),"Back to Dataset"]})})]}),l.jsx(sh,{children:l.jsxs(Tn,{children:[l.jsx($ts,{datasetId:e,versionA:String(n[0]),versionB:String(n[1]),onVersionChange:m}),l.jsx(zts,{datasetId:e,versionA:n[0],versionB:n[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}function nns(e){if(!e||e.length<2)return null;const t=[...e].sort((i,o)=>new Date(i.createdAt).getTime()-new Date(o.createdAt).getTime()),n=Math.floor(t.length/2),r=n,s=t.length-n;if(r===0)return null;const a=(s-r)/r*100;return{changePct:Math.round(a*10)/10,prevValue:String(r)}}function rns({scorers:e,datasets:t,experiments:n,avgScore:r,prevAvgScore:s,totalNeedsReview:a,isLoadingScorers:i,isLoadingDatasets:o,isLoadingExperiments:c,isLoadingScores:u,isLoadingReview:d}){const f=e?Object.keys(e).length:void 0,h=t?.length,p=n?.length,m=r!=null&&s!=null&&s!==0?{changePct:Math.round((r-s)/s*100*10)/10,prevValue:String(s)}:null,g=nns(n);return l.jsxs(l.Fragment,{children:[l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Total Scorers"}),i?l.jsx(Hr.Loading,{}):f!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(f)}),l.jsx(Hr.NoChange,{message:"Static count"})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Total Datasets"}),o?l.jsx(Hr.Loading,{}):h!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(h)}),l.jsx(Hr.NoChange,{message:"Static count"})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Avg Score"}),u?l.jsx(Hr.Loading,{}):r!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(r)}),m?l.jsx(Hr.Change,{changePct:m.changePct,prevValue:m.prevValue}):l.jsx(Hr.NoChange,{})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Total Experiments"}),c?l.jsx(Hr.Loading,{}):p!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(p)}),g?l.jsx(Hr.Change,{changePct:g.changePct,prevValue:g.prevValue}):l.jsx(Hr.NoChange,{})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Needs Review"}),d?l.jsx(Hr.Loading,{}):a!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(a)}),a>0?l.jsx(Hr.NoChange,{message:"items pending review"}):l.jsx(Hr.NoChange,{message:"All caught up"})]}):l.jsx(Hr.NoData,{})]})]})}const sns=[{value:"all",label:"All statuses"},{value:"completed",label:"Completed"},{value:"running",label:"Running"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}],fKe="auto 1fr auto auto auto auto auto auto auto";function ans(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const ins={completed:"success",running:"warning",failed:"error",pending:"neutral"};function ons({experiments:e,datasets:t,reviewByExperiment:n,isLoading:r,search:s="",statusFilter:a="all",datasetFilter:i="all"}){const{paths:o,Link:c}=cn(),u=y.useMemo(()=>{const h=new Map;return t?.forEach(p=>h.set(p.id,p.name)),h},[t]),d=y.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=y.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),v=a==="all"||p.status===a,x=i==="all"||p.datasetId===i;return g&&v&&x})},[d,s,u,a,i]);return r?l.jsx(qd,{columns:fKe}):l.jsxs(xe,{columns:fKe,children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Experiment"}),l.jsx(xe.TopCell,{children:"Dataset"}),l.jsx(xe.TopCell,{children:"Target"}),l.jsx(xe.TopCell,{children:"Status"}),l.jsx(xe.TopCell,{className:"text-center",children:"Items"}),l.jsx(xe.TopCell,{className:"text-center",children:"Succeeded"}),l.jsx(xe.TopCell,{className:"text-center",children:"Failed"}),l.jsx(xe.TopCell,{className:"text-center",children:"Review"}),l.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,v=h.failedCount??0,x=h.totalItems??0,w=x>0?Math.round(g/x*100):0;return l.jsxs(xe.RowLink,{to:o.experimentLink(h.id),LinkComponent:c,children:[l.jsx(xe.NameCell,{className:"font-mono",children:h.id.slice(0,8)}),l.jsx(xe.TextCell,{children:p}),l.jsx(xe.Cell,{children:l.jsxs("span",{className:"truncate",children:[h.targetType," ",h.targetId]})}),l.jsx(xe.Cell,{children:l.jsx(Nk,{variant:ins[m]??"neutral",withDot:!0,children:m})}),l.jsx(xe.TextCell,{className:"text-center",children:x}),l.jsx(xe.TextCell,{className:"text-center",children:l.jsxs("span",{className:g>0?"text-accent1":"",children:[g," (",w,"%)"]})}),l.jsx(xe.TextCell,{className:"text-center",children:l.jsx("span",{className:v>0?"text-accent2":"",children:v})}),l.jsx(xe.Cell,{className:"text-center",children:(()=>{const S=n?.get(h.id);if(!S)return l.jsx("span",{className:"text-neutral2",children:"—"});const _=S.needsReview+S.complete;return _===0?l.jsx("span",{className:"text-neutral2",children:"—"}):S.needsReview>0?l.jsxs(_t,{variant:"warning",children:[S.needsReview," pending"]}):l.jsxs(_t,{variant:"success",children:[S.complete,"/",_," reviewed"]})})()}),l.jsx(xe.TextCell,{children:ans(h.createdAt)})]},h.id)})]})}function lns(e){return[{value:"all",label:"All datasets"},...(e??[]).map(t=>({value:t.id,label:t.name}))]}const Q5={completed:"#22c55e",running:"#facc15",pending:"#fb923c",failed:"#f87171"},cns=[{label:"Completed",color:Q5.completed},{label:"Running",color:Q5.running},{label:"Pending",color:Q5.pending},{label:"Failed",color:Q5.failed}];function uns({experiments:e,datasets:t,isLoading:n,isError:r}){const{data:s,maxVal:a}=y.useMemo(()=>{if(!e||e.length===0)return{data:[],maxVal:0};const o=new Map;if(t)for(const f of t)o.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:o.get(f)??f.slice(0,12),values:[h.completed,h.running,h.pending,h.failed]}}),maxVal:u}},[e,t]),i=s.length>0;return l.jsxs(en,{children:[l.jsxs(en.TopBar,{children:[l.jsx(en.TitleAndDescription,{title:"Experiments by Dataset",description:"Experiment status breakdown per dataset."}),i&&l.jsx(en.Summary,{value:String(e?.length??0),label:"Total experiments"})]}),n?l.jsx(en.Loading,{}):r?l.jsx(en.Error,{message:"Failed to load experiments data"}):l.jsx(en.Content,{children:i?l.jsx(bT,{data:s,segments:cns,maxVal:a,fmt:o=>String(o)}):l.jsx(en.NoData,{message:"No experiments have been run yet"})})]})}const dns=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Experiments yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Run an experiment from a dataset to evaluate ",l.jsx("br",{}),"your agents and workflows."]}),actionSlot:l.jsx("div",{className:"flex flex-col items-center gap-2",children:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",children:["Experiments Documentation ",l.jsx(Va,{})]})})})});function fns({search:e,onSearchChange:t,statusFilter:n,onStatusFilterChange:r,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:i,onReset:o,hasActiveFilters:c}){return l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(sg,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",value:e,onSearch:t}),l.jsxs(ys,{children:[l.jsx(_l,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...sns],value:n,onValueChange:r,className:"whitespace-nowrap"}),l.jsx(_l,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:i,value:s,onValueChange:a,className:"whitespace-nowrap"}),o&&c&&l.jsxs(ce,{onClick:o,size:"sm",variant:"default",children:[l.jsx(qr,{className:"size-3"})," Reset"]})]})]})}function hns(){const{data:e,isLoading:t,error:n}=uf(),{data:r,isLoading:s,error:a}=Xp(),{data:i,isLoading:o,error:c}=GH(),{data:u,isLoading:d,isError:f,error:h}=uGr(),{data:p,isLoading:m,isError:g,error:v}=mEe(),x=r?.datasets,w=i?.experiments,S=y.useMemo(()=>qts(p),[p]),_=n||a||c||h||v;return _&&Hs(_)?l.jsx(lr,{title:"Evaluation",icon:l.jsx(_d,{}),children:l.jsx(pa,{})}):_&&Ps(_)?l.jsx(lr,{title:"Evaluation",icon:l.jsx(_d,{}),children:l.jsx(aa,{resource:"evaluation"})}):_?l.jsx(lr,{title:"Evaluation",icon:l.jsx(_d,{}),children:l.jsx(dc,{title:"Failed to load evaluation data",message:_.message})}):l.jsxs(ht,{width:"wide",height:"full",children:[l.jsx(ht.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(_d,{})," Evaluation"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Evaluation documentation",children:l.jsx(yo,{})})})]})}),l.jsxs("div",{className:"flex flex-col gap-6 pt-4",children:[l.jsx(Wfe,{children:l.jsx(rns,{scorers:e,datasets:x,experiments:w,avgScore:u?.avgScore??null,prevAvgScore:u?.prevAvgScore??null,totalNeedsReview:S.needsReview,isLoadingScorers:t,isLoadingDatasets:s,isLoadingExperiments:o,isLoadingScores:d,isLoadingReview:m})}),l.jsx(JZr,{summaryData:u?.summaryData??[],overTimeData:u?.overTimeData??[],scorerNames:u?.scorerNames??[],avgScore:u?.avgScore??null,isLoading:d,isError:f}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[l.jsx(fes,{experiments:w,isLoading:o,isError:!!c}),l.jsx(uns,{experiments:w,datasets:x,isLoading:o,isError:!!c})]}),l.jsx(Bts,{reviewSummary:p,experiments:w,datasets:x,isLoading:m,isError:!!g})]})]})}function pns(){const[e,t]=y.useState(""),[n,r]=y.useState("all"),[s,a]=y.useState("all"),{data:i,isLoading:o,error:c}=Xp(),{data:u,isLoading:d,error:f}=GH(),{data:h}=mEe(),p=y.useMemo(()=>i?.datasets??[],[i?.datasets]),m=y.useMemo(()=>u?.experiments??[],[u?.experiments]),g=y.useMemo(()=>lns(p),[p]),v=y.useMemo(()=>a6t(h),[h]),x=o||d,w=f||c;if(w&&Hs(w))return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(pa,{})});if(f&&Ps(f))return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(aa,{resource:"experiments"})});if(c&&Ps(c))return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(aa,{resource:"datasets"})});if(w)return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(dc,{title:"Failed to load experiments",message:w.message})});if(m.length===0&&!x)return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(dns,{})});const S=n!=="all"||s!=="all"||e!=="",_=()=>{t(""),r("all"),a("all")};return l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:x,children:[l.jsx(_d,{})," Experiments"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Experiments documentation",children:l.jsx(yo,{})})})]}),l.jsx(fns,{search:e,onSearchChange:t,statusFilter:n,onStatusFilterChange:r,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:g,onReset:_,hasActiveFilters:S})]}),l.jsx(ons,{experiments:m,datasets:p,reviewByExperiment:v,isLoading:x,search:e,statusFilter:n,datasetFilter:s})]})}function mns(){const{experimentId:e}=Sa(),{data:t,isLoading:n}=GH(),s=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:a,isLoading:i,error:o}=z8(s,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=ZH({datasetId:s,experimentId:e??"",experimentStatus:a?.status});return e?n||i||!s?l.jsx(Jn,{children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ut,{})})}):o&&Hs(o)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):o&&Ps(o)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):o||!a?l.jsx(Jn,{children:l.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",o instanceof Error?o.message:"Unknown error"]})}):l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/experiments",children:[l.jsx(Ne,{children:l.jsx(_d,{})}),"Experiments"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsx(s6t,{experimentId:e,experiment:a}),l.jsx(r6t,{experimentId:e,experimentStatus:a?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function i6t({redirectUri:e,onSuccess:t,initialMode:n="signin",errorMessage:r}){const{data:s,isLoading:a}=Gj(),{mutate:i,isPending:o,error:c}=wJr(),{mutate:u,isPending:d,error:f}=SJr(),{mutate:h,isPending:p}=Z5t(),[m,g]=y.useState(n),[v,x]=y.useState(""),[w,S]=y.useState(""),[_,O]=y.useState("");if(a)return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:l.jsx("div",{className:"text-neutral3",children:"Loading..."})});if(!s?.enabled||!s?.login)return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:l.jsx("div",{className:"text-neutral3",children:"Authentication is not configured"})});const{login:E}=s,j=E.type==="sso"||E.type==="both",T=E.type==="credentials"||E.type==="both",N=E.sso,I=E.signUpEnabled!==!1,P=m==="signin"||!I,R=P?o:d,F=P?c:f,M=()=>{t?t():e?window.location.href=e:window.location.href="/"},L=q=>{q.preventDefault(),P?i({email:w,password:_},{onSuccess:M}):u({email:w,password:_,name:v||void 0},{onSuccess:M})},U=()=>{h({redirectUri:e},{onSuccess:q=>{window.location.href=q.url}})},z=()=>{g(P?"signup":"signin")};return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:l.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border1 bg-surface2 p-8",children:[l.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[l.jsx(lb,{className:"h-10 w-10"}),l.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:P?"Sign in to Mastra Studio":"Create your account"})]}),E.description&&l.jsxs("div",{className:"flex items-start gap-2.5 rounded-md border border-border1 bg-surface1 p-3",children:[l.jsx(Wet,{className:"mt-0.5 h-4 w-4 shrink-0 text-neutral4"}),l.jsx("p",{className:"text-sm text-neutral3",children:E.description})]}),r&&l.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:r}),T&&l.jsxs("form",{onSubmit:L,className:"space-y-4",children:[!P&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"name",className:"block text-sm text-neutral4",children:"Name"}),l.jsx(mn,{id:"name",type:"text",value:v,onChange:q=>x(q.target.value),placeholder:"Your name",variant:"default",size:"lg"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"email",className:"block text-sm text-neutral4",children:"Email"}),l.jsx(mn,{id:"email",type:"email",value:w,onChange:q=>S(q.target.value),placeholder:"you@example.com",required:!0,variant:"default",size:"lg"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"password",className:"block text-sm text-neutral4",children:"Password"}),l.jsx(mn,{id:"password",type:"password",value:_,onChange:q=>O(q.target.value),placeholder:P?"Enter your password":"Create a password",required:!0,variant:"default",size:"lg"})]}),F&&l.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:F.message}),l.jsx(ce,{type:"submit",disabled:R,className:"w-full",size:"lg",children:R?P?"Signing in...":"Creating account...":P?"Sign in":"Create account"}),I&&l.jsxs("div",{className:"text-center text-sm",children:[l.jsx("span",{className:"text-neutral3",children:P?"Don't have an account? ":"Already have an account? "}),l.jsx("button",{type:"button",onClick:z,className:"text-neutral6 hover:underline",children:P?"Sign up":"Sign in"})]})]}),j&&T&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 flex items-center",children:l.jsx("div",{className:"w-full border-t border-border1"})}),l.jsx("div",{className:"relative flex justify-center text-sm",children:l.jsx("span",{className:"bg-surface2 px-2 text-neutral3",children:"or continue with"})})]}),j&&N&&l.jsxs(ce,{onClick:U,disabled:p,className:"w-full",size:"lg",variant:"outline",children:[N.icon&&l.jsx("span",{className:"mr-2",children:N.icon}),p?"Redirecting...":N.text||"Sign in"]})]})})}function gns(){const[e]=wo(),t=id(),n=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(i6t,{redirectUri:n,onSuccess:i,initialMode:s,errorMessage:a})}function vns(){const[e,t]=wo(),n=$ar(e,t),r=Lar(e,t),[s,a]=y.useState(),[i,o]=y.useState(!1),{data:c=[],isPending:u}=I_t(),{data:d=[],isPending:f}=R_t({entityType:n.selectedEntityOption?.entityType,rootOnly:!0}),{data:h=[],isPending:p}=P_t(),{data:m=[],isPending:g}=$_t(),v=y.useMemo(()=>Tar({availableTags:c,availableRootEntityNames:d,availableServiceNames:m,availableEnvironments:h,loading:{tags:u,entityNames:f,serviceNames:g,environments:p}}),[c,d,m,h,u,f,g,p]),x=y.useMemo(()=>Iar({rootEntityType:n.selectedEntityOption?.entityType,dateFrom:n.selectedDateFrom,dateTo:n.selectedDateTo,tokens:n.filterTokens}),[n.filterTokens,n.selectedDateFrom,n.selectedDateTo,n.selectedEntityOption]),{data:w=[],isLoading:S,error:_,isFetchingNextPage:O,hasNextPage:E,setEndOfListElement:j}=Sar({filters:x}),{logIdMap:T,featuredLog:N,handleLogClick:I,handlePreviousLog:P,handleNextLog:R}=Bar(w,n.featuredLogId,n.handleFeaturedChange,n.featuredTraceId),{data:F,isLoading:M}=qwe(n.featuredTraceId??null),{data:L,isLoading:U}=Ak(n.featuredTraceId??"",n.featuredSpanId??""),z=y.useCallback(()=>n.applyFilterTokens(Rar(v,n.filterTokens)),[v,n]),q=y.useCallback(()=>n.handleFeaturedChange({logId:null}),[n]),W=y.useCallback(G=>n.handleFeaturedChange({traceId:G,spanId:null}),[n]),D=y.useCallback((G,J)=>n.handleFeaturedChange({traceId:G,spanId:J}),[n]),Q=y.useCallback(()=>{n.handleFeaturedChange({traceId:null,spanId:null}),o(!1)},[n]),V=y.useCallback(()=>n.handleFeaturedChange({spanId:null}),[n]),$=y.useCallback(G=>n.handleFeaturedChange({spanId:G??null}),[n]),Z=l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:S,children:[l.jsx(Zet,{})," Logs"]})})}),l.jsxs(ht.Column,{className:"flex justify-end items-center gap-2",children:[l.jsx(d_t,{preset:n.datePreset,onPresetChange:n.handleDatePresetChange,dateFrom:n.selectedDateFrom,dateTo:n.selectedDateTo,onDateChange:n.handleDateChange,disabled:S,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),l.jsx(mkt,{fields:v,tokens:n.filterTokens,onTokensChange:n.handleFilterTokensChange,disabled:S,onStartTextFilter:a}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/observability/logging",target:"_blank",rel:"noopener noreferrer","aria-label":"Logs documentation",tooltipContent:"Go to Logs documentation",children:l.jsx(yo,{})})]})]}),l.jsx(har,{isLoading:S,filterFields:v,filterTokens:n.filterTokens,onFilterTokensChange:n.handleFilterTokensChange,onClear:z,onRemoveAll:n.handleRemoveAll,onSave:r.handleSave,onRemoveSaved:r.hasSavedFilters?r.handleRemoveSaved:void 0,autoFocusFilterFieldId:s})]});return _?l.jsxs(ht,{width:"wide",height:"full",children:[Z,l.jsx(ht.MainArea,{isCentered:!0,children:l.jsx(lar,{error:_,resource:"logs",errorTitle:"Failed to load logs"})})]}):w.length===0&&!S&&n.filterTokens.length===0?l.jsxs(ht,{width:"wide",height:"full",children:[Z,l.jsx(ht.MainArea,{isCentered:!0,children:l.jsx(yar,{datePreset:n.datePreset,dateFrom:n.selectedDateFrom,dateTo:n.selectedDateTo})})]}):l.jsxs(ht,{width:"wide",height:"full",children:[Z,l.jsx(car,{logCollapsed:i,listSlot:l.jsx(far,{logs:w,isLoading:S,isFetchingNextPage:O,hasNextPage:E,setEndOfListElement:j,logIdMap:T,featuredLogId:n.featuredLogId,onLogClick:I}),logPanelSlot:N?l.jsx(oar,{log:N,onClose:q,onTraceClick:W,onSpanClick:D,onPrevious:P,onNext:R,collapsed:i,onCollapsedChange:o}):null,tracePanelSlot:n.featuredTraceId?l.jsx(jsr,{traceId:n.featuredTraceId,spans:F?.spans,isLoading:M,onClose:Q,onSpanSelect:$,selectedSpanId:n.featuredSpanId}):null,spanPanelSlot:n.featuredTraceId&&n.featuredSpanId?l.jsx(Tsr,{spanId:n.featuredSpanId,span:L?.span,isLoading:U,onClose:V}):null})]})}function yns({server:e}){const{paths:t,Link:n}=cn(),s=Ze().options.baseUrl,a=s?`${s}/api/mcp/${e.id}/sse`:"",{data:i}=Z4t(e),o=Object.values(i||{}),c=o.length,u=o.filter(h=>h.toolType==="agent").length,d=o.filter(h=>h.toolType==="workflow").length,f=Pp(e.name,50);return l.jsxs(xe.RowLink,{to:t.mcpServerLink(e.id),LinkComponent:n,children:[l.jsx(xe.NameCell,{children:f}),l.jsx(xe.DescriptionCell,{children:a}),l.jsx(xe.TextCell,{className:"text-center",children:u||""}),l.jsx(xe.TextCell,{className:"text-center",children:c||""}),l.jsx(xe.TextCell,{className:"text-center",children:d||""})]})}function bns({mcpServers:e,isLoading:t,search:n=""}){const r=y.useMemo(()=>{const s=n.toLowerCase();return e.filter(a=>a.name?.toLowerCase().includes(s)||a.id?.toLowerCase().includes(s))},[e,n]);return t?l.jsx(qd,{columns:"auto 1fr auto auto auto"}):l.jsxs(xe,{columns:"auto 1fr auto auto auto",children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Name"}),l.jsx(xe.TopCell,{children:"URL"}),l.jsx(xe.TopCellSmart,{long:"Agents",short:l.jsx(za,{}),tooltip:"Agent Tools",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Tools",short:l.jsx(mo,{}),tooltip:"Tools",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Workflows",short:l.jsx(go,{}),tooltip:"Workflow Tools",className:"text-center"})]}),r.length===0&&n?l.jsx(xe.NoMatch,{message:"No MCP Servers match your search"}):null,r.map(s=>l.jsx(yns,{server:s},s.id))]})}const xns=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No MCP Servers yet",descriptionSlot:l.jsxs(l.Fragment,{children:["MCP servers are not configured yet. ",l.jsx("br",{}),"More information in the documentation."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",children:["MCP Documentation ",l.jsx(Va,{})]})})}),wns=()=>{const{data:e=[],isLoading:t,error:n}=GD(),[r,s]=y.useState("");return n&&Hs(n)?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(pa,{})}):n&&Ps(n)?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(aa,{resource:"MCP servers"})}):n?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(dc,{title:"Failed to load MCP servers",message:n.message})}):e.length===0&&!t?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(xns,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(ac,{})," MCP Servers"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:l.jsx(yo,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:s,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),l.jsx(bns,{mcpServers:e,isLoading:t,search:r})]})},Sns=(e,t)=>{const n=new Map,r=Object.keys(t);for(const s of r){const a=t[s],i=a.tools,o=Object.keys(i);for(const c of o){const u=i[c];n.has(u.id)||n.set(u.id,{...u,agents:[]}),n.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))n.has(a.id)||n.set(a.id,{...a,agents:[]});return Array.from(n.values())};function kns({tools:e,agents:t,isLoading:n,search:r=""}){const{paths:s,Link:a}=cn(),i=y.useMemo(()=>Sns(e,t),[e,t]),o=y.useMemo(()=>i.filter(c=>c.id.toLowerCase().includes(r.toLowerCase())),[i,r]);return n?l.jsx(qd,{columns:"auto 1fr auto"}):l.jsxs(xe,{columns:"auto 1fr auto",children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Name"}),l.jsx(xe.TopCell,{children:"Description"}),l.jsx(xe.TopCellSmart,{long:"Agents",short:l.jsx(za,{}),tooltip:"Attached Agents",className:"text-center"})]}),o.length===0&&r?l.jsx(xe.NoMatch,{message:"No Tools match your search"}):null,o.map(c=>{const u=Pp(c.id,50),d=Pp(c.description??"",200),f=c.agents.length;return l.jsxs(xe.RowLink,{to:s.toolLink(c.id),LinkComponent:a,children:[l.jsx(xe.NameCell,{children:u}),l.jsx(xe.DescriptionCell,{children:d}),l.jsx(xe.TextCell,{className:"text-center",children:f||""})]},c.id)})]})}const _ns=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Tools yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Mastra tools are not configured yet. ",l.jsx("br",{}),"More information in the documentation."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",children:["Tools Documentation ",l.jsx(Va,{})]})})}),Ons=()=>{const e=Ze();return or({mutationFn:async({toolId:t,input:n,requestContext:r})=>{const s=new CC;Object.entries(r??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:n,requestContext:s})}catch(a){throw ze.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},Ens=({toolId:e})=>{const{canExecute:t}=Jb(),n=t("tools"),{data:r={}}=Wv(),s=y.useMemo(()=>{for(const g of Object.values(r))if(g.tools){const v=Object.values(g.tools).find(x=>x.id===e);if(v)return v}return null},[r,e]),{data:a,isLoading:i,error:o}=HQr(e,{enabled:!s}),c=s||a,{mutateAsync:u,isPending:d,data:f}=Ons(),{requestContext:h}=Zs();y.useEffect(()=>{if(o){const g=o instanceof Error?o.message:"Failed to load tool";ze.error(`Error loading tool: ${g}`)}},[o]);const p=async(g,v)=>{if(!c)return;const x={...h??{},...v??{}};return u({toolId:c.id,input:g,requestContext:x})},m=c?.inputSchema?Av(Tv(Tb(c?.inputSchema))):ps({});return i?l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]}):o?null:c?n?l.jsx(tEe,{executionResult:f,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:p,toolDescription:c.description,toolId:c.id,requestContextSchema:c.requestContextSchema}):l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function Cns({value:e,onValueChange:t,placeholder:n="Select a tool...",searchPlaceholder:r="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:o="default"}){const{data:c={},isLoading:u,isError:d,error:f}=HH(),{data:h={},isLoading:p,isError:m,error:g}=Wv(),{navigate:v,paths:x}=cn();y.useEffect(()=>{if(d){const O=f instanceof Error?f.message:"Failed to load tools";ze.error(`Error loading tools: ${O}`)}},[d,f]),y.useEffect(()=>{if(m){const O=g instanceof Error?g.message:"Failed to load agents";ze.error(`Error loading agents: ${O}`)}},[m,g]);const w=new Map;Object.values(h).forEach(O=>{O.tools&&Object.values(O.tools).forEach(E=>{w.has(E.id)||w.set(E.id,E)})}),Object.values(c).forEach(O=>{w.has(O.id)||w.set(O.id,O)});const S=Array.from(w.values()).map(O=>({label:O.id,value:O.id})),_=O=>{t?t(O):O&&O!==e&&v(x.toolLink(O))};return l.jsx(Mc,{options:S,value:e,onValueChange:_,placeholder:u||p?"Loading tools...":n,searchPlaceholder:r,emptyText:s,className:a,disabled:i||u||p||d||m,variant:o})}const Tns=({isLoading:e,server:t})=>{const[{sseUrl:n,httpStreamUrl:r},s]=y.useState({sseUrl:"",httpStreamUrl:""});if(y.useEffect(()=>{if(!t)return;const i=window.MASTRA_SERVER_HOST,o=window.MASTRA_SERVER_PORT;let c=null;i&&o&&(c=`http://${i}:${o}`);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 l.jsx(mh,{children:l.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 ${n}`;return l.jsxs(mh,{isDivided:!0,children:[l.jsxs("div",{className:"px-8 py-12 mx-auto max-w-2xl w-full",children:[l.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral6 font-medium pb-4",children:t.name}),l.jsxs("div",{className:"flex items-center gap-1 pb-6",children:[l.jsx(_t,{icon:l.jsx($q,{className:"text-neutral6"}),className:"rounded-r-sm text-neutral4!",children:"Version"}),l.jsx(_t,{className:"rounded-l-sm text-neutral4!",children:t.version_detail.version})]}),l.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."}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[l.jsx(_t,{icon:l.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"HTTP"}),children:"Regular HTTP Endpoint"}),l.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for stateless HTTP transport with streamable responses."}),l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:r}),l.jsx("div",{className:"pt-1",children:l.jsx(da,{tooltip:"Copy HTTP Stream URL",content:r})})]})]}),l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[l.jsx(_t,{icon:l.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"SSE"}),children:"Server-Sent Events"}),l.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for real-time communication via SSE."}),l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:n}),l.jsx("div",{className:"pt-1",children:l.jsx(da,{tooltip:"Copy SSE URL",content:n})})]})]}),l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[l.jsx(_t,{icon:l.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"CLI"}),children:"Command Line"}),l.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for local command-line access via npx and mcp-remote."}),l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:a}),l.jsx("div",{className:"pt-1",children:l.jsx(da,{tooltip:"Copy Command Line Config",content:a})})]})]})]})]}),l.jsx("div",{className:"h-full overflow-y-scroll border-l border-border1",children:l.jsx(jns,{server:t})})]})},jns=({server:e})=>{const{data:t={},isLoading:n}=Z4t(e);if(n)return null;const r=Object.keys(t);return l.jsxs("div",{className:"p-5 overflow-y-scroll",children:[l.jsxs("div",{className:"text-neutral6 flex gap-2 items-center",children:[l.jsx(Ne,{size:"lg",className:"bg-surface4 rounded-md p-1",children:l.jsx(ac,{})}),l.jsx(me,{variant:"header-md",as:"h2",className:"font-medium",children:"Available Tools"})]}),l.jsx("div",{className:"flex flex-col gap-2 pt-6",children:r.map(s=>{const a=t[s];return l.jsx(Ans,{tool:a,serverId:e.id},s)})})]})};function Nns(e){if(!e)return!1;const t=e.ui;return!!(typeof t?.resourceUri=="string"&&t.resourceUri.startsWith("ui://")||typeof e["ui/resourceUri"]=="string"&&e["ui/resourceUri"].startsWith("ui://"))}const Ans=({tool:e,serverId:t})=>{const n=y.useRef(null),{Link:r,paths:s}=cn(),a=Q3t[e.toolType||"tool"],i=Nns(e._meta);return l.jsxs(_h,{onClick:()=>n.current?.click(),children:[l.jsx(NSt,{children:l.jsx(a,{className:"group-hover/entity:text-accent6"})}),l.jsxs(Ch,{children:[l.jsx(Oh,{children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(r,{ref:n,href:s.mcpServerToolLink(t,e.id),children:e.id}),i&&l.jsx(_t,{className:"text-[10px] py-0",children:"App"})]})}),l.jsx(Eh,{children:e.description})]})]})},Ins=()=>{const{serverId:e}=Sa(),{data:t=[],isLoading:n}=GD(),r=t.find(s=>s.id===e);return l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/mcps",children:[l.jsx(Ne,{children:l.jsx(ac,{})}),"MCP Servers"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(f5t,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"MCP documentation"]})})]}),l.jsx(Tns,{isLoading:n,server:r})]})};function Rns(e){if(!e)return;const t=e.ui;if(t?.resourceUri)return t.resourceUri;const n=e["ui/resourceUri"];if(typeof n=="string")return n}const Pns=({toolId:e,serverId:t})=>{const{canExecute:n}=Jb(),r=n("tools"),s=Ze(),{data:a,isLoading:i,error:o}=G4t(t,e),{mutateAsync:c,isPending:u,data:d}=rFr(t,e),f=a?Rns(a._meta):void 0,{data:h}=Ct({queryKey:["mcp-app-resource",t,f],queryFn:async()=>f?(await s.readMcpServerResource(t,f)).contents[0]?.text??null:null,enabled:!!f}),p=y.useCallback(async(v,x)=>await c(x),[c]);y.useEffect(()=>{if(o){const v=o instanceof Error?o.message:"Failed to load tool";ze.error(`Error loading tool: ${v}`)}},[o]);const m=async v=>{if(a)return await c(v)};if(i)return l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]});if(o)return null;if(!a)return l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})});if(!r)return l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})});let g;try{g=Av(Tv(a.inputSchema))}catch(v){console.error("Error processing input schema:",v),ze.error("Failed to process tool input schema."),g=ps({})}return l.jsxs("div",{className:"flex flex-col gap-4",children:[h&&l.jsx("div",{className:"border-b border-border1 p-4",children:l.jsx(W4t,{html:h,toolName:a.name??a.id,onToolCall:p})}),l.jsx(tEe,{executionResult:d,isExecutingTool:u,zodInputSchema:g,handleExecuteTool:m,toolDescription:a.description||"",toolId:a.id})]})},$ns=()=>{const{data:e}=GD(),{serverId:t,toolId:n}=Sa(),{data:r,isLoading:s}=G4t(t,n),a=e?.find(c=>c.id===t),i=r?.name,o=a?.name||"";return s||!r?null:l.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-auto",children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/mcps",children:[l.jsx(Ne,{children:l.jsx(ac,{})}),"MCP Servers"]}),l.jsx(Bn,{as:ln,to:`/mcps/${t}`,children:o}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:i})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"MCP documentation"]})})]}),l.jsx(Pns,{toolId:n,serverId:t})]})};function Mns(){const{data:e,isLoading:t,isError:n}=osr();return l.jsx(Xrr,{data:e,isLoading:t,isError:n})}function Dns(){const{data:e,isLoading:t,isError:n}=__t();return l.jsx(Fwe,{label:"Total Agent Runs",value:e?.value!=null?e.value.toLocaleString():null,prevValue:e?.previousValue!=null?e.previousValue.toLocaleString():void 0,changePct:e?.changePercent??null,isLoading:t,isError:n})}function Lns(){const{data:e,isLoading:t,isError:n}=ssr();return l.jsx(Fwe,{label:"Total Model Cost",value:e?.cost!=null?$S(e.cost,e.costUnit):null,prevValue:e?.previousCost!=null?$S(e.previousCost,e.costUnit):void 0,changePct:e?.costChangePercent??null,isLoading:t,isError:n})}function zns(){const{data:e,isLoading:t,isError:n}=asr();return l.jsx(Fwe,{label:"Total Tokens",value:e?.value!=null?sv(e.value):null,prevValue:e?.previousValue!=null?sv(e.previousValue):void 0,changePct:e?.changePercent??null,isLoading:t,isError:n})}function Fns(){const{data:e,isLoading:t,isError:n}=isr();return l.jsx(Krr,{rows:e,isLoading:t,isError:n})}function Bns(){const{data:e,isLoading:t,isError:n}=csr();return l.jsx(Jrr,{data:e,isLoading:t,isError:n})}function Uns(){const{data:e,isLoading:t,isError:n}=usr();return l.jsx(tsr,{data:e,isLoading:t,isError:n})}function qns(){const{data:e,isLoading:t,isError:n}=lsr();return l.jsx(nsr,{data:e,isLoading:t,isError:n})}const Vns=new Set(["ObservabilityStorageClickhouseVNext","ObservabilityStorageDuckDB","ObservabilityInMemory"]),gle="period";function Hns(){const[e,t]=wo(),n=e.get(gle),r=w_t(n)?n:"24h",s=y.useCallback(a=>{t(i=>{const o=new URLSearchParams(i);return a==="24h"?o.delete(gle):o.set(gle,a),o},{replace:!0})},[t]);return l.jsx(Grr,{initialPreset:r,onPresetChange:s,children:l.jsx(Wns,{})})}function Wns(){const{error:e}=__t(),{data:t,isLoading:n}=DH(),r=t?.observabilityStorageType,s=r?Vns.has(r):!1,a=r==="ObservabilityInMemory";return e&&Hs(e)?l.jsx(lr,{title:"Metrics",icon:l.jsx(hE,{}),children:l.jsx(pa,{})}):e&&Ps(e)?l.jsx(lr,{title:"Metrics",icon:l.jsx(hE,{}),children:l.jsx(aa,{resource:"metrics"})}):e?l.jsx(lr,{title:"Metrics",icon:l.jsx(hE,{}),children:l.jsx(dc,{title:"Failed to load metrics",message:e.message})}):l.jsxs(ht,{width:"wide",height:"full",children:[l.jsx(ht.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(hE,{})," Metrics"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsx(Qrr,{}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:l.jsx(yo,{})})]})]})}),n?null:s?l.jsxs("div",{className:"grid gap-8 content-start pb-10",children:[a&&l.jsx(hr,{variant:"info",title:"Metrics are not persisted",children:l.jsx(hr.Message,{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."})}),l.jsxs(Wfe,{children:[l.jsx(Dns,{}),l.jsx(Lns,{}),l.jsx(zns,{})]}),l.jsxs(Wfe,{children:[l.jsx(Fns,{}),l.jsx(Uns,{}),l.jsx(Bns,{}),l.jsx(qns,{}),l.jsx(Mns,{})]})]}):l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),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:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/observability/metrics/overview",target:"_blank",rel:"noopener noreferrer",children:["Metrics Documentation ",l.jsx(Va,{})]})})})]})}const Zns=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:hE,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:cl,href:"/observability"}];function Gns(){return l.jsxs(OE,{children:[l.jsx(OE.Top,{children:l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{children:[l.jsx(cl,{})," Observability"]})})})}),l.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:Zns.map(e=>l.jsxs(ln,{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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const Qns=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:za,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:Do,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:go,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:ZS,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:ac,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:mo,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:Zc,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:sj,href:"/request-context"}];function Yns(){return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(lQt,{})," Primitives"]})})}),l.jsx(ht.MainArea,{children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Qns.map(e=>l.jsxs(ln,{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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function Xns(){const{paths:e}=cn(),{data:t,isLoading:n,error:r}=n5t(),{isCmsAvailable:s}=XD(),[a,i]=y.useState(""),o=t?.promptBlocks??[];return r&&Hs(r)?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx(pa,{})}):r&&Ps(r)?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx(aa,{resource:"prompt blocks"})}):r?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx(dc,{title:"Failed to load prompt blocks",message:r.message})}):o.length===0&&!n?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx($Qr,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:n,children:[l.jsx(Do,{})," Prompts"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:l.jsx(yo,{})}),s&&l.jsxs(ce,{as:ln,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[l.jsx(Rs,{}),"Create Prompt"]})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:i,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),l.jsx(PQr,{promptBlocks:o,isLoading:n,search:a})]})}function Kns(){return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(sj,{})," Request Context"]})})}),l.jsx(ht.MainArea,{children:l.jsx(FWr,{children:l.jsx(R3t,{})})})]})}const Jns=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:kGt,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:yo,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:Va,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:VR,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:Fet,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:yZt,href:"https://mastra.ai/contact?ref=studio",external:!0}];function ers(){return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(yo,{})," Resources"]})})}),l.jsx(ht.MainArea,{children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:Jns.map(e=>l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&l.jsx(Va,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function trs(){const{data:e={},isLoading:t,error:n}=uf(),[r,s]=y.useState(""),[a,i]=y.useState("all");if(n&&Hs(n))return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(pa,{})});if(n&&Ps(n))return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(aa,{resource:"scorers"})});if(n)return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(dc,{title:"Failed to load scorers",message:n.message})});if(Object.keys(e).length===0&&!t)return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(tGr,{})});const o=a!=="all"||r!=="",c=()=>{s(""),i("all")};return l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(ci,{})," Scorers"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Scorers documentation",children:l.jsx(yo,{})})})]}),l.jsx(rGr,{search:r,onSearchChange:s,sourceFilter:a,onSourceFilterChange:i,onReset:c,hasActiveFilters:o})]}),l.jsx(eGr,{scorers:e,isLoading:t,search:r,sourceFilter:a})]})}function nrs(){const{scorerId:e}=Sa(),[t,n]=wo(),r=t.get("scoreId")??void 0,[s,a]=y.useState(r),[i,o]=y.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:c,isLoading:u,error:d}=XZr(e),{data:f={},isLoading:h,error:p}=Wv(),{isLoading:m,error:g}=Zw(),{data:v=[],isLoading:x,error:w,isFetchingNextPage:S,hasNextPage:_,setEndOfListElement:O}=YZr({scorerId:e,entityId:i?.value==="all"?void 0:i?.value,entityType:i?.type==="ALL"?void 0:i?.type}),E=y.useMemo(()=>c?.agentIds?.filter(D=>f[D]).map(D=>({value:D,label:f[D].name,type:"AGENT"}))||[],[c?.agentIds,f]),j=y.useMemo(()=>c?.workflowIds?.map(D=>({value:D,label:D,type:"WORKFLOW"}))||[],[c?.workflowIds]),T=y.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...E,...j],[E,j]),N=t.get("entity")??"all",I=T.find(D=>D.value===N);I&&I.value!==i?.value&&o(I),y.useEffect(()=>{if(d){const D=d instanceof Error?d.message:"Failed to load scorer";ze.error(`Error loading scorer: ${D}`)}},[d]),y.useEffect(()=>{if(p){const D=p instanceof Error?p.message:"Failed to load agents";ze.error(`Error loading agents: ${D}`)}},[p]),y.useEffect(()=>{if(g){const D=g instanceof Error?g.message:"Failed to load workflows";ze.error(`Error loading workflows: ${D}`)}},[g]);const P=D=>{D?.value&&n(Q=>{const V=new URLSearchParams(Q);return V.set("entity",D.value),V})};y.useEffect(()=>{const D=t.get("scoreId")??void 0;if(D===s)return;if(!D){a(void 0);return}v.find(V=>V.id===D)&&a(D)},[t,v]);const R=y.useCallback(D=>{a(D||void 0),n(Q=>{const V=new URLSearchParams(Q);return D?V.set("scoreId",D):V.delete("scoreId"),V})},[n]);if(!c)return null;const F=Hs(d)||Hs(p)||Hs(g),M=d&&Ps(d),L=!F&&!M&&(d||p||g),U=!x&&v.length===0,z=i?.value!=="all",q=l.jsxs(l.Fragment,{children:[l.jsxs(Ni,{children:[l.jsx(Bn,{as:ln,to:"/scorers",children:"Scorers"}),l.jsx(KZr,{value:e,variant:"link"})]}),l.jsxs(ht.Row,{children:[l.jsxs(Tr,{children:[l.jsxs(Tr.Title,{isLoading:u,children:[l.jsx(ci,{})," ",c?.scorer?.config?.name||e]}),(u||c?.scorer?.config?.description)&&l.jsx(Tr.Description,{isLoading:u,children:c?.scorer?.config?.description})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Scorers documentation",tooltipContent:"Go to Scorers documentation",children:l.jsx(yo,{})}),c?.scorer?.source==="stored"&&l.jsxs(ce,{variant:"default",as:ln,to:`/cms/scorers/${e}/edit`,children:[l.jsx($b,{})," Edit"]})]})]})]});if(F||M||L||U&&!z){const D=(d instanceof Error?d.message:void 0)??(p instanceof Error?p.message:void 0)??(g instanceof Error?g.message:void 0)??"An unexpected error occurred";return l.jsxs(ht,{width:"wide",height:"full",children:[l.jsx(ht.TopArea,{children:q}),l.jsx(ht.MainArea,{isCentered:!0,children:F?l.jsx(pa,{}):M?l.jsx(aa,{resource:"scorers"}):L?l.jsx(dc,{title:"Failed to load scorer",message:D}):l.jsx(qZr,{})})]})}return l.jsxs(ht,{width:"wide",children:[l.jsxs(ht.TopArea,{children:[q,l.jsx(WZr,{selectedEntity:i,entityOptions:T,onEntityChange:P,onReset:()=>{n(D=>{const Q=new URLSearchParams(D);return Q.set("entity","all"),Q})},isLoading:x||h||m})]}),l.jsx(UZr,{scores:v,isLoading:x,selectedScoreId:s,isFetchingNextPage:S,hasNextPage:_,setEndOfListElement:O,onScoreClick:R,errorMsg:w?.message})]})}const o6t=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],rrs=e=>o6t.some(t=>t.value===e),srs=()=>{const{baseUrl:e,headers:t,apiPrefix:n}=VOe(),{theme:r,setTheme:s}=Uj();return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(bwe,{})," Settings"]})})}),l.jsxs(ht.MainArea,{className:"flex flex-col gap-5 mt-6",children:[l.jsx($6e,{title:"Theme",description:"Customize the appearance of the studio.",children:l.jsx(jer,{label:"Theme mode",htmlFor:"theme",children:l.jsxs(Ri,{value:r,onValueChange:a=>{rrs(a)&&s(a)},children:[l.jsx(mi,{id:"theme",className:"w-full sm:w-48",children:l.jsx(Pi,{})}),l.jsx(gi,{children:o6t.map(a=>l.jsx(hs,{value:a.value,children:a.label},a.value))})]})})}),l.jsx($6e,{title:"Mastra Connection",description:"Configure the Mastra instance URL, API prefix, and request headers used by the studio.",children:l.jsx(M3t,{initialConfig:{baseUrl:e,headers:t,apiPrefix:n}})})]})]})};function ars(){const[e]=wo(),t=id(),n=e.get("redirect")||"/",r=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(i6t,{redirectUri:n,onSuccess:r,initialMode:"signup"})}function irs(e){return e.replace(/\/$/,"").split("/").pop()}function YH({children:e,className:t}){return l.jsx("div",{className:Y("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function ors({templates:e,linkComponent:t,className:n,isLoading:r}){const s=t||"a";return r?l.jsx("div",{className:Y("grid gap-y-4",n),children:Array.from({length:5}).map((a,i)=>l.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):l.jsx("div",{className:Y("grid gap-y-4",n),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return l.jsxs("article",{className:Y("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[l.jsxs(s,{to:`/templates/${a.slug}`,className:Y("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&l.jsx("div",{className:Y("overflow-hidden"),children:l.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),l.jsxs("div",{className:Y("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[l.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),l.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),l.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&l.jsxs("ul",{className:Y("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&&l.jsxs("li",{children:[l.jsx(za,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&l.jsxs("li",{children:[l.jsx(mo,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&l.jsxs("li",{children:[l.jsx(Yet,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&l.jsxs("li",{children:[l.jsx(sU,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&l.jsxs("li",{children:[l.jsx(ac,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&l.jsx("small",{children:"|"}),l.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(o=>l.jsx("span",{className:"",children:o},o))})]})]})]}),l.jsx("a",{href:a.githubUrl,className:Y("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:l.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:[l.jsx(ESt,{})," ",irs(a.githubUrl)]})})]},a.slug)})})}function lrs({tagOptions:e,selectedTag:t,providerOptions:n,selectedProvider:r,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:o,onReset:c,className:u,isLoading:d}){return d?l.jsxs("div",{className:Y("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[l.jsx("div",{})," ",l.jsx("div",{})," ",l.jsx("div",{})]}):l.jsxs("div",{className:Y("flex flex-wrap mx-auto sticky top-0 gap-4 bg-surface2 py-8",u),children:[l.jsx(rw,{name:"search-templates",label:"Search templates",labelIsHidden:!0,value:i,onChange:f=>o?.(f.target.value),placeholder:"Search Template"}),l.jsx(_l,{label:"Filter by tag",labelIsHidden:!0,name:"filter-tag",value:t,onValueChange:s,options:e}),l.jsx(_l,{label:"Filter by provider",labelIsHidden:!0,name:"filter-provider",value:r,onValueChange:a,options:n}),c&&l.jsxs(ce,{onClick:c,children:["Reset ",l.jsx(qr,{})]})]})}function crs(){const{data:e,isLoading:t}=Qar(),{templates:n,tags:r,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=y.useState("all"),[o,c]=y.useState("all"),[u,d]=y.useState(""),f=[{value:"all",label:"Any tag"}];(r||[]).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,S)=>{S==="tag"?i(w):S==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},v=n.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||a!=="all"&&!w.tags.includes(a)||o!=="all"&&!w.supportedProviders.includes(o))),x=u||a!=="all"||o!=="all";return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ud,{children:[l.jsx(Ne,{children:l.jsx(w0,{})}),"Templates"]})}),l.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[l.jsx(lrs,{selectedTag:a,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:o,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),l.jsx(ors,{templates:v,linkComponent:ln,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const urs="1.33.0-alpha.1";function drs({errorMsg:e,validationErrors:t}){const n=typeof e=="string"?e:e!=null?String(e):void 0,r=n?.includes("Invalid schema for function"),s=n?.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.":r?"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:l.jsx(tb,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:l.jsx(YGt,{}),title:"Template Installation Failed"},{icon:o,title:c}=i();return l.jsxs(YH,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[l.jsxs("div",{className:Y("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[o,l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:c}),l.jsx("p",{className:"text-ui-md text-neutral3",children:a()})]})]}),t&&t.length>0&&l.jsxs("details",{className:"text-xs",children:[l.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),l.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)=>l.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[l.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:u.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),l.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))})]}),n&&!s&&l.jsxs("details",{className:"text-xs",children:[l.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),l.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:l.jsx("div",{className:"whitespace-pre-wrap wrap-break-word",children:n})})]})]})}function frs({providerOptions:e,selectedProvider:t,onProviderChange:n,variables:r,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:o,isInstalling:c,defaultModelProvider:u,defaultModelId:d,onModelUpdate:f}){return l.jsx(YH,{children:l.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[l.jsxs("h2",{className:Y("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 ",l.jsx(Xet,{})]}),l.jsx(_l,{name:"template-provider",options:e,label:"Template AI Model Provider",onValueChange:n,value:t,placeholder:"Select",layout:"horizontal"}),t&&Object.entries(r||{}).length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),l.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:o?l.jsxs("div",{className:Y("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:[l.jsx(Ut,{})," Loading variables..."]}):Object.entries(r).map(([h,p])=>l.jsxs(y.Fragment,{children:[l.jsx(nw,{name:`env-${h}`,labelIsHidden:!0,label:"Key",value:h,disabled:!0,className:"w-full"}),l.jsx(nw,{name:h,labelIsHidden:!0,label:"Value",value:p,onChange:i,errorMsg:s.includes(h)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},h))}),l.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[l.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"}),l.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),l.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"}),l.jsx(P3t,{defaultProvider:u||"",defaultModel:d||"",updateModel:f||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!o&&l.jsx(ce,{className:Y("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?l.jsxs(l.Fragment,{children:[l.jsx(Ut,{className:"w-4 h-4"})," Installing..."]}):l.jsxs(l.Fragment,{children:["Install ",l.jsx(CS,{})]})})]})})}function hrs({title:e,description:t,githubUrl:n,isLoading:r,infoData:s,templateSlug:a}){const i=a?`feat/install-template-${a}`:"feat/install-template-[slug]";return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Y("grid mt-8 items-center"),children:l.jsxs("div",{className:Y("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":r}),children:[l.jsx(w0,{}),l.jsx("h2",{className:Y({"bg-surface4 flex rounded-lg min-w-[50%]":r}),children:r?l.jsx(l.Fragment,{children:" "}):e})]})}),l.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[l.jsxs("div",{className:"grid",children:[l.jsx("p",{className:Y("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":r}),children:r?l.jsx(l.Fragment,{children:" "}):t}),!r&&a&&l.jsxs("div",{className:Y("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[l.jsx("div",{className:"shrink-0 mt-0.5",children:l.jsx(Cw,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(eU,{className:"w-[1em] h-[1em] text-neutral4"}),l.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),l.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-medium",children:"Branch name:"})," ",l.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:i})]}),l.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),n&&l.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[l.jsx(ESt,{}),n?.split("/")?.pop()]})]}),s&&l.jsx(__,{data:s,labelsAreHidden:!0,isLoading:r})]})]})}function prs({name:e,streamResult:t,workflowInfo:n}){const r=t?.phase||"initializing",s=t?.payload?.workflowState,a=t?.payload?.currentStep,i=t?.error,o=s?.steps||{},c=Object.keys(o).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:n?.allSteps?m in n.allSteps:!0,d=Object.entries(o).filter(([m,g])=>u(m)),f=d.length,h=()=>{switch(r){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 l.jsxs(YH,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[l.jsxs("div",{className:"text-center",children:[l.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&l.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),c&&f>0&&!["error"].includes(r)&&l.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:l.jsx(qer,{steps:p})}),i&&r==="error"&&l.jsxs("div",{className:Y("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:[l.jsx(UQt,{}),i||"Something went wrong"]}),c&&l.jsx(Uer,{steps:p,currentStep:a,className:"pb-4"}),!c&&r==="initializing"&&l.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[l.jsx(Ut,{}),l.jsx("p",{children:"This may take some time..."})]})]})}function mrs({name:e,installedEntities:t}){return l.jsxs(YH,{className:Y("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[l.jsx(Xet,{}),l.jsx("h2",{className:"text-header-md",children:"Done!"}),l.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",l.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&l.jsx(__,{data:t})]})}function grs(){const{templateSlug:e}=Sa(),[t,n]=wo(),[r,s]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState(""),[u,d]=y.useState({}),[f,h]=y.useState([]),[p,m]=y.useState(null),[g,v]=y.useState(!1),[x,w]=y.useState(""),[S,_]=y.useState(!1),[O,E]=y.useState(!1),[j,T]=y.useState([]),{data:N,isLoading:I}=Yar({repoOrSlug:e,owner:"mastra-ai"}),R=urs?.includes("beta")??!1?"beta":"main",{data:F,isLoading:M}=Xar({repo:N?.githubUrl?new URL(N.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:R}),{data:L,isLoading:U}=Kar(),{mutateAsync:z,isPending:q}=Jar(),{mutateAsync:W}=eir(),{streamInstall:D,streamResult:Q,isStreaming:V}=nir(L),{observeInstall:$,streamResult:Z,isStreaming:G}=rir(L);y.useEffect(()=>{const re=t.get("runId");re&&!g&&!p&&!V&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:re}),w(re),W({runId:re}).then(le=>{const ge=le.snapshot;if(ge?.status==="success"&&ge?.result?.success)v(!0);else if(ge?.result?.success===!1)if(ge?.result?.validationResults&&!ge?.result?.validationResults?.valid&&ge?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:be}=ge.result.validationResults,ke=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(ke),T(be||[])}else{const ue=ge?.result?.message||ge?.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,V,G,W]),y.useEffect(()=>{const re=t.get("runId"),le=t.get("resume"),ge=t.get("provider");if(re&&le==="true"&&ge&&!V&&!G&&!S&&!O&&L){w(re),_(!0);try{W({runId:re}).then(fe=>{if(fe.snapshot?.status==="running")return $.mutateAsync({runId:re})}).then(()=>{n(fe=>{const ue=new URLSearchParams(fe);return ue.delete("resume"),ue})}).catch(fe=>{console.error("❌ Failed to resume template installation:",fe),fe.message?.includes("404")||fe.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(fe){console.error("❌ Auto-resume failed with error:",fe),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,V,G,S,O,L,W,$,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ie=[{key:"tools",label:"Tools",value:N?.tools?.length?N.tools.map(re=>re).join(", "):"n/a",icon:l.jsx(mo,{})},{key:"agents",label:"Agents",value:N?.agents?.length?N.agents.map(re=>re).join(", "):"n/a",icon:l.jsx(za,{})},{key:"workflows",label:"Workflows",value:N?.workflows?.length?N.workflows.map(re=>re).join(", "):"n/a",icon:l.jsx(sU,{})},{key:"providers",label:"Providers",value:N?.supportedProviders?.length?N.supportedProviders.join(", "):"n/a",icon:l.jsx(Zg,{})},{key:"tags",label:"Tags",value:N?.tags?.length?N.tags.join(", "):"n/a",icon:l.jsx(ij,{})}],ne=[{...ie[0]},{...ie[1]},{...ie[2]}].filter(re=>re.value!=="n/a");y.useEffect(()=>{F&&d(F)},[F]),y.useEffect(()=>{const re=Q||Z;re?.phase==="error"&&re?.error&&m(typeof re.error=="string"?re.error:String(re.error))},[Q?.phase,Q?.error,Z?.phase,Z?.error]);const te=re=>{s(re)},ae=async re=>(i(re.provider),c(re.modelId),{message:"Model updated successfully"}),de=async()=>{const re=Object.entries(u).reduce((le,[ge,fe])=>(fe===""&&le.push(ge),le),[]);if(re.length>0){h(re);return}if(N){m(null),v(!1),w(""),E(!0);try{const ge={repo:N.githubUrl||`https://github.com/mastra-ai/template-${N.slug}`,ref:R,slug:N.slug,variables:u},{runId:fe}=await z({});w(fe),n(ue=>{const be=new URLSearchParams(ue);return be.set("runId",fe),be.set("resume","true"),be.set("provider",r||"openai"),be}),await D.mutateAsync({inputData:ge,selectedModel:{provider:a,modelId:o},runId:fe})}catch(le){E(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},X=re=>{const{name:le,value:ge}=re.target;ge.trim()===""?h(fe=>[...fe,le]):h(fe=>fe.filter(ue=>ue!==le)),d(fe=>({...fe,[le]:ge}))};return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/templates",children:[l.jsx(Ne,{children:l.jsx(w0,{})}),"Templates"]}),l.jsx(Bn,{as:ln,to:`/templates/${N?.slug}`,isCurrent:!0,children:N?.title&&N.title})]})}),l.jsx("div",{className:Y("w-full lg:px-12 h-full overflow-y-scroll"),children:l.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[l.jsx(hrs,{isLoading:I,title:N?.title,description:N?.longDescription,imageURL:N?.imageURL,githubUrl:N?.githubUrl,infoData:ie,templateSlug:e}),N&&l.jsxs(l.Fragment,{children:[(V||G)&&l.jsx(prs,{name:N.title,streamResult:G?Z:Q,runId:x,workflowInfo:L}),g&&l.jsx(mrs,{name:N.title,installedEntities:ne,linkComponent:ln}),p&&l.jsx(drs,{errorMsg:p,validationErrors:j.length>0?j:Q?.validationResults?.errors||Z?.validationResults?.errors}),!V&&!G&&!g&&!p&&l.jsx(frs,{providerOptions:J,selectedProvider:r,onProviderChange:te,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:de,handleVariableChange:X,isLoadingEnvVars:M||U,isInstalling:q,defaultModelProvider:a,defaultModelId:o,onModelUpdate:ae})]})]})})]})}const vrs=()=>{const{toolId:e,agentId:t}=Sa();return l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/agents",children:[l.jsx(Ne,{children:l.jsx(za,{})}),"Agents"]}),l.jsx(Bn,{as:ln,to:`/agents/${t}/chat`,children:t}),l.jsx(Bn,{as:ln,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(Ne,{children:l.jsx(Vw,{})}),"Tools documentation"]})})]}),l.jsx(NGr,{toolId:e,agentId:t})]})},yrs=()=>{const{toolId:e}=Sa();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/tools",children:[l.jsx(Ne,{children:l.jsx(mo,{})}),"Tools"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Cns,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"Tools documentation"]})})]}),l.jsx(Ens,{toolId:e})]})};function brs(e){return e.feedbackType==="thumbs"?e.value===1?"👍 Positive (1)":e.value===0||e.value===-1?"👎 Negative":String(e.value):e.feedbackType==="rating"?String(e.value):e.feedbackType==="comment"?String(e.value??e.comment??"-"):String(e.value??"-")}function xrs({feedback:e,isOpen:t,onClose:n,onNext:r,onPrevious:s}){const a=e?.metadata&&Object.keys(e.metadata).length>0?JSON.stringify(e.metadata,null,2):void 0;return l.jsxs(Yt,{dialogTitle:"Feedback Detail",dialogDescription:"View feedback details",isOpen:t,onClose:n,level:3,children:[l.jsxs(Yt.Top,{children:[l.jsxs(ms,{children:[l.jsx(VR,{})," Feedback"]}),"|",l.jsx(Yt.Nav,{onNext:r,onPrevious:s})]}),l.jsxs(Yt.Content,{children:[l.jsxs(Yt.Header,{children:[l.jsxs(Yt.Heading,{children:[l.jsx(VR,{})," Feedback"]}),e?.traceId&&l.jsxs(ms,{children:[l.jsx(NC,{})," ",e.traceId]})]}),l.jsxs(sw,{children:[l.jsx(__,{data:[{label:"Created at",value:e?.timestamp?on(new Date(e.timestamp),"MMM d, h:mm:ss aaa"):"n/a",key:"timestamp"},{label:"Type",value:e?.feedbackType??"n/a",key:"type"},{label:"Value",value:e?brs(e):"n/a",key:"value"},...e?.comment?[{label:"Comment",value:e.comment,key:"comment"}]:[],{label:"Source",value:e?.feedbackSource??e?.source??"n/a",key:"source"},...e?.feedbackUserId?[{label:"User",value:e.feedbackUserId,key:"userId"}]:[],...e?.traceId?[{label:"Trace ID",value:e.traceId,key:"traceId"}]:[],...e?.spanId?[{label:"Span ID",value:e.spanId,key:"spanId"}]:[]]}),a&&l.jsx(Yt.CodeSection,{title:"Metadata",icon:l.jsx(NC,{}),codeStr:a,simplified:!0})]})]})]})}const Y5=[{name:"source",label:"Source",size:"1fr"},{name:"date",label:"Date",size:"0.8fr"},{name:"time",label:"Time",size:"0.8fr"},{name:"value",label:"Value",size:"0.6fr"},{name:"comment",label:"Comment",size:"2fr"}];function wrs(e){return e.feedbackType==="thumbs"?e.value===1?"👍":e.value===0||e.value===-1?"👎":String(e.value):typeof e.value=="number"?String(e.value):"—"}function Srs(e){const t=e.comment||(typeof e.value=="string"?e.value:"");return t?t.length>60?t.slice(0,60)+"…":t:"—"}function l6t({feedbackData:e,isLoadingFeedbackData:t,onPageChange:n}){const[r,s]=y.useState(!1),[a,i]=y.useState(),o=e?.feedback??[],c=h=>{i(o[h]),s(!0)};if(t)return l.jsx(kkt,{columns:Y5});const u=a?o.indexOf(a):-1,d=u>=0&&u<o.length-1?()=>i(o[u+1]):void 0,f=u>0?()=>i(o[u-1]):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs(Ma,{children:[l.jsxs(Ma.Trim,{children:[l.jsx(Ma.Header,{columns:Y5}),o.length>0?l.jsx(Ma.Entries,{children:o.map((h,p)=>{const m=new Date(h.timestamp),g=Bv(m),v={id:`${h.traceId}-${p}`,source:h.feedbackUserId||h.feedbackSource||"unknown",date:g?"Today":on(m,"MMM dd"),time:on(m,"h:mm:ss aaa"),value:wrs(h),comment:Srs(h)};return l.jsx(Ma.Entry,{columns:Y5,onClick:()=>c(p),entry:v,children:Y5.map(x=>l.jsx(Ma.EntryText,{children:String(v[x.name]??"")},`col-${x.name}`))},v.id)})}):l.jsx(Ma.Message,{message:"No feedback found",type:"info"})]}),l.jsx(Ma.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>n?.((e?.pagination?.page||0)+1),onPrevPage:()=>{const h=e?.pagination?.page||0;h>0&&n?.(h-1)}})]}),l.jsx(xrs,{feedback:a,isOpen:r,onClose:()=>s(!1),onNext:d,onPrevious:f})]})}const hKe="auto auto auto auto 1fr";function c6t({scoresData:e,isLoadingScoresData:t,onPageChange:n,onScoreSelect:r}){return t?l.jsx(Hq,{columns:hKe}):l.jsxs("div",{className:"grid gap-2",children:[l.jsxs(Ou,{columns:hKe,className:"min-w-0",children:[l.jsxs(Ou.Top,{children:[l.jsx(Ou.TopCell,{children:"ID"}),l.jsx(Ou.TopCell,{children:"Date"}),l.jsx(Ou.TopCell,{children:"Time"}),l.jsx(Ou.TopCell,{children:"Score"}),l.jsx(Ou.TopCell,{children:"Scorer"})]}),e?.scores&&e.scores.length>0?e.scores.map(s=>{const a=new Date(s.createdAt),i=Bv(a);return l.jsxs(Ou.RowButton,{onClick:()=>r?.(s),children:[l.jsx(Ou.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:rh(s?.id)||"n/a"}),l.jsx(Ou.Cell,{height:"compact",className:"text-neutral2 text-ui-smd",children:i?"Today":on(a,"MMM dd")}),l.jsx(Ou.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:on(a,"h:mm:ss aaa")}),l.jsx(Ou.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.score??"")}),l.jsx(Ou.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.scorer?.name||s?.scorer?.id||"")})]},s.id)}):l.jsx(Ou.NoMatch,{message:"No scores found"})]}),l.jsx(Ou.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>n?.((e?.pagination?.page||0)+1),onPrevPage:()=>n?.((e?.pagination?.page||0)-1)})]})}const u6t=({traceId:e="",page:t})=>{const n=Ze(),r=t??0;return Ct({queryKey:["trace-feedback",e,r],queryFn:()=>n.listFeedback({filters:{traceId:e},pagination:{page:r,perPage:10}}),enabled:!!e,refetchInterval:3e3,gcTime:0,staleTime:0})};function krs(){const[e,t]=wo(),[n,r]=y.useState(!1),s=nar(e,t,{onRemoveAll:()=>r(!1)}),[a,i]=y.useState(),[o,c]=y.useState(0),[u,d]=y.useState(!1),[f,h]=y.useState(null);y.useEffect(()=>c(0),[s.traceIdParam,s.spanIdParam]);const{data:p,isLoading:m}=uf(),{data:g,isLoading:v}=JOe({traceId:s.traceIdParam,spanId:s.spanIdParam,page:o}),[x,w]=y.useState(0);y.useEffect(()=>w(0),[s.traceIdParam,s.spanIdParam]);const{data:S,isLoading:_}=u6t({traceId:s.traceIdParam,page:x}),{data:O,isLoading:E}=qwe(s.traceIdParam??null),j=y.useMemo(()=>O?.spans,[O?.spans]),{data:T,isLoading:N}=Ak(s.traceIdParam??"",s.spanIdParam??""),I=s.scoreIdParam?g?.scores?.find(ue=>ue.id===s.scoreIdParam):void 0,{data:P=[],isPending:R}=I_t(),{data:F=[],isPending:M}=R_t({entityType:s.selectedEntityOption?.entityType,rootOnly:!0}),{data:L=[],isPending:U}=P_t(),{data:z=[],isPending:q}=$_t(),W=y.useMemo(()=>Gsr({availableTags:P,availableRootEntityNames:F,availableServiceNames:z,availableEnvironments:L,loading:{tags:R,entityNames:M,serviceNames:q,environments:U}}),[P,F,z,L,R,M,q,U]),D=y.useMemo(()=>Ksr({rootEntityType:s.selectedEntityOption?.entityType,status:s.selectedStatus,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,tokens:s.filterTokens}),[s.filterTokens,s.selectedDateFrom,s.selectedDateTo,s.selectedEntityOption,s.selectedStatus]),{data:Q,isLoading:V,isFetchingNextPage:$,hasNextPage:Z,setEndOfListElement:G,error:J}=Bsr({filters:D}),ie=y.useMemo(()=>Q?.spans??[],[Q?.spans]),ne=Q?.threadTitles??{},{handlePreviousSpan:te,handleNextSpan:ae}=M_t(j,s.spanIdParam??null,ue=>s.handleSpanChange(ue)),de=aar(e,t),X=y.useCallback(()=>s.applyFilterTokens(Jsr(W,s.filterTokens)),[W,s]),{handlePreviousTrace:re,handleNextTrace:le}=ear(ie,s.traceIdParam,s.handleTraceClick),ge=y.useCallback(()=>{const ue=j?.find(be=>be.parentSpanId==null);ue&&(s.handleSpanChange(ue.spanId),s.handleSpanTabChange("scoring"))},[j,s]);if(J)return l.jsx(lr,{title:"Traces",icon:l.jsx(cl,{}),children:l.jsx(A_t,{error:J,resource:"traces",errorTitle:"Failed to load traces"})});const fe=!!s.selectedEntityOption||!!s.selectedStatus||s.filterTokens.length>0||s.datePreset!=="last-24h"||!!s.selectedDateTo;return l.jsxs(ht,{width:"wide",height:"full",children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:V,children:[l.jsx(cl,{})," Traces"]})})}),l.jsxs(ht.Column,{className:"flex justify-end items-center gap-2",children:[l.jsx(d_t,{preset:s.datePreset,onPresetChange:s.handleDatePresetChange,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,onDateChange:s.handleDateChange,disabled:V,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),l.jsx(mkt,{fields:W,tokens:s.filterTokens,onTokensChange:s.handleFilterTokensChange,disabled:V,onStartTextFilter:i}),l.jsx(ss,{disabled:V,"aria-pressed":n,"aria-label":n?"Ungroup traces":"Group traces by thread",tooltipContent:n?"Ungroup traces":"Group traces by thread",onClick:()=>r(ue=>!ue),children:n?l.jsx(jz,{}):l.jsx(Het,{})}),l.jsx(ss,{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:l.jsx(yo,{})})]})]}),l.jsx(Ssr,{isLoading:V,filterFields:W,filterTokens:s.filterTokens,onFilterTokensChange:s.handleFilterTokensChange,onClear:X,onRemoveAll:s.handleRemoveAll,onSave:de.handleSave,onRemoveSaved:de.hasSavedFilters?de.handleRemoveSaved:void 0,autoFocusFilterFieldId:a})]}),l.jsx(Nsr,{traceCollapsed:u,listSlot:l.jsx(Psr,{traces:ie,isLoading:V,isFetchingNextPage:$,hasNextPage:Z,setEndOfListElement:G,filtersApplied:fe,featuredTraceId:s.traceIdParam,onTraceClick:ue=>s.handleTraceClick(s.traceIdParam===ue.traceId?"":ue.traceId),groupByThread:n,threadTitles:ne}),tracePanelSlot:s.traceIdParam?l.jsx(j_t,{traceId:s.traceIdParam,spans:j,isLoading:E,onClose:s.handleTraceClose,onSpanSelect:ue=>s.handleSpanChange(ue??null),onEvaluateTrace:ge,onSaveAsDatasetItem:ue=>h(ue),initialSpanId:s.spanIdParam,onPrevious:re,onNext:le,collapsed:u,onCollapsedChange:d,placement:"traces-list",LinkComponent:xV,traceHref:`/traces/${s.traceIdParam}`}):null,spanPanelSlot:s.traceIdParam&&s.spanIdParam?l.jsx(N_t,{traceId:s.traceIdParam,spanId:s.spanIdParam,span:T?.span,isLoading:N,onClose:s.handleSpanClose,onPrevious:te,onNext:ae,activeTab:s.spanTabParam??"details",onTabChange:ue=>s.handleSpanTabChange(ue),feedbackTabBadge:S?.pagination?.total??void 0,feedbackTabSlot:()=>l.jsx(l6t,{feedbackData:S,onPageChange:w,isLoadingFeedbackData:_}),scoringTabBadge:g?.pagination?.total??void 0,scoringTabSlot:({span:ue,traceId:be,spanId:ke})=>l.jsxs("div",{className:"grid gap-6",children:[l.jsx(lEe,{traceId:be,isTopLevelSpan:!ue.parentSpanId,spanId:ke,entityType:ue.attributes?.agentId||ue.entityType===Sl.AGENT?"Agent":ue.attributes?.workflowId||ue.entityType===Sl.WORKFLOW_RUN?"Workflow":void 0,scorers:p,isLoadingScorers:m}),l.jsx(c6t,{scoresData:g,onPageChange:c,isLoadingScoresData:v,onScoreSelect:Ie=>s.handleScoreChange(Ie.id)})]})}):null,scorePanelSlot:I?l.jsx(XOe,{score:I,onClose:()=>s.handleScoreChange(null)}):null}),f&&l.jsx(cEe,{rootSpanId:f.rootSpanId,traceId:f.traceId,isOpen:!0,onClose:()=>h(null)})]})}function _rs(){const{traceId:e}=Sa(),[t,n]=wo(),r=id(),s=t.get("spanId")||void 0,a=t.get("tab"),i=a==="scoring"?"scoring":a==="feedback"?"feedback":"details",o=t.get("scoreId")||void 0,[c,u]=y.useState(s??null),[d,f]=y.useState(),[h,p]=y.useState(i),[m,g]=y.useState(0),[v,x]=y.useState(!1),{data:w,isLoading:S,error:_}=qwe(e),O=y.useMemo(()=>w?.spans??[],[w?.spans]),E=y.useMemo(()=>O.find(te=>te.parentSpanId==null),[O]),{data:j,isLoading:T}=Ak(e,c??"");y.useEffect(()=>g(0),[e,c]);const{data:N,isLoading:I}=uf(),{data:P,isLoading:R}=JOe({traceId:e,spanId:c??void 0,page:m}),[F,M]=y.useState(0);y.useEffect(()=>M(0),[e,c]);const{data:L,isLoading:U}=u6t({traceId:e,page:F});y.useEffect(()=>{if(o&&P?.scores&&!d){const te=P.scores.find(ae=>ae.id===o);te&&f(te)}},[o,P?.scores,d]);const z=y.useCallback(te=>{const ae=new URLSearchParams(t);for(const[de,X]of Object.entries(te))X===null||X===""?ae.delete(de):ae.set(de,X);n(ae,{replace:!0})},[t,n]),q=y.useCallback(te=>{const ae=te??null,de=ae===c;u(ae),de||(f(void 0),p("details"),z({spanId:ae,tab:null,scoreId:null}))},[c,z]),W=y.useCallback(()=>{u(null),f(void 0),p("details"),z({spanId:null,tab:null,scoreId:null})},[z]),D=y.useCallback(te=>{u(te),f(void 0),p("details"),z({spanId:te,tab:null,scoreId:null})},[z]),{handlePreviousSpan:Q,handleNextSpan:V}=M_t(O,c,D),$=y.useCallback(te=>{const ae=te;p(ae),f(void 0),z({tab:ae==="details"?null:ae,scoreId:null})},[z]),Z=y.useCallback(te=>{f(te),z({scoreId:te.id})},[z]),G=y.useCallback(()=>{f(void 0),z({scoreId:null})},[z]),J=y.useCallback(()=>{r("/observability")},[r]),ie=y.useCallback(()=>{p("scoring"),E&&c!==E.spanId?(u(E.spanId),f(void 0),z({spanId:E.spanId,tab:"scoring",scoreId:null})):z({tab:"scoring"})},[E,c,z]),ne=l.jsxs(l.Fragment,{children:[l.jsxs(ce,{as:xV,href:"/observability",variant:"link",size:"md",className:"text-neutral2",children:[l.jsx(oh,{}),"Back to Traces"]}),l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:S,children:[l.jsx(cl,{})," Trace ",l.jsx("span",{className:"text-neutral3",children:e})]})})}),l.jsx(ht.Column,{children:l.jsxs(ys,{children:[l.jsx(ss,{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:l.jsx(yo,{})}),E&&l.jsxs(l.Fragment,{children:[l.jsxs(ss,{tooltipContent:"Evaluate Trace","aria-label":"Evaluate Trace",onClick:ie,children:[l.jsx(Tz,{}),"Evaluate"]}),l.jsxs(ss,{tooltipContent:"Save as Dataset Item","aria-label":"Save as Dataset Item",onClick:()=>x(!0),children:[l.jsx(ou,{}),"Save"]})]})]})})]}),E&&l.jsx(ht.Row,{children:l.jsx(ht.Column,{children:l.jsx(E_t,{rootSpan:E,numOfCol:3})})})]});return _?l.jsxs(ht,{height:"full",children:[l.jsx(ht.TopArea,{children:ne}),l.jsx(ht.MainArea,{isCentered:!0,children:l.jsx(A_t,{error:_,resource:"traces",errorTitle:"Failed to load trace"})})]}):l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:ne}),l.jsx(cEe,{rootSpanId:E?.spanId,traceId:e,isOpen:v,onClose:()=>x(!1)}),l.jsxs("div",{className:Y("grid h-full min-h-0 gap-4 overflow-hidden items-start mt-4",c?"grid-cols-[2fr_3fr]":"grid-cols-[1fr]"),children:[l.jsx(j_t,{traceId:e,spans:O,isLoading:S,onClose:J,onSpanSelect:q,onEvaluateTrace:ie,initialSpanId:c,placement:"trace-page",timelineChartWidth:c?"default":"wide"}),c&&!S&&l.jsxs("div",{className:Y("grid gap-4 max-h-full min-h-0 overflow-auto",d?"grid-rows-[1fr_1fr]":"grid-rows-[1fr]"),children:[l.jsx(N_t,{traceId:e,spanId:c,span:j?.span,isLoading:T,onClose:W,onPrevious:Q,onNext:V,activeTab:h,onTabChange:$,feedbackTabBadge:L?.pagination?.total??void 0,feedbackTabSlot:()=>l.jsx(l6t,{feedbackData:L,onPageChange:M,isLoadingFeedbackData:U}),scoringTabBadge:P?.pagination?.total??void 0,scoringTabSlot:({span:te,traceId:ae,spanId:de})=>l.jsxs("div",{className:"grid gap-6",children:[l.jsx(lEe,{traceId:ae,isTopLevelSpan:!te.parentSpanId,spanId:de,entityType:te.attributes?.agentId||te.entityType===Sl.AGENT?"Agent":te.attributes?.workflowId||te.entityType===Sl.WORKFLOW_RUN?"Workflow":void 0,scorers:N,isLoadingScorers:I}),l.jsx(c6t,{scoresData:P,onPageChange:g,isLoadingScoresData:R,onScoreSelect:Z})]})}),d&&l.jsx(XOe,{score:d,onClose:G})]})]})]})}function Ors(){const{data:e,isLoading:t,error:n}=Zw(),[r,s]=y.useState("");return n&&Hs(n)?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(pa,{})}):n&&Ps(n)?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(aa,{resource:"workflows"})}):n?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(dc,{title:"Failed to load workflows",message:n.message})}):Object.keys(e||{}).length===0&&!t?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(n$r,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(go,{})," Workflows"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsxs(ce,{as:ln,to:"/workflows/schedules",children:[l.jsx(Gg,{}),"Schedules"]}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:l.jsx(yo,{})})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:s,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),l.jsx(t$r,{workflows:e||{},isLoading:t,search:r})]})}const Ers={active:"bg-accent1",paused:"bg-accent3"},Crs={active:"text-accent1",paused:"text-accent3"},d6t=({status:e})=>l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${Ers[e]}`,"aria-hidden":!0}),l.jsx("span",{className:`text-ui-sm ${Crs[e]}`,children:e})]}),SC=e=>!e||e<=0?"—":new Date(e).toLocaleString(),AR=e=>{if(!e||e<=0)return"—";const t=e-Date.now(),n=Math.abs(t),r=Math.floor(n/1e3);if(r<60)return t>=0?`in ${r}s`:`${r}s ago`;const s=Math.floor(r/60);if(s<60)return t>=0?`in ${s}m`:`${s}m ago`;const a=Math.floor(s/60);if(a<24)return t>=0?`in ${a}h`:`${a}h ago`;const i=Math.floor(a/24);return t>=0?`in ${i}d`:`${i}d ago`};function f6t({status:e}){const{icon:t,color:n}=Trs(e);return l.jsxs("span",{className:`inline-flex items-center gap-1.5 whitespace-nowrap text-ui-sm ${n}`,children:[l.jsx("span",{className:"inline-flex shrink-0 items-center","aria-hidden":!0,children:t}),l.jsx("span",{children:e})]})}function Trs(e){switch(e){case"success":return{icon:l.jsx(qa,{size:14}),color:"text-accent1"};case"failed":return{icon:l.jsx(qr,{size:14}),color:"text-accent2"};case"running":return{icon:l.jsx(Ut,{}),color:"text-neutral3"};case"suspended":return{icon:l.jsx(Qme,{size:14}),color:"text-accent3"};case"canceled":return{icon:l.jsx(Xd,{size:14}),color:"text-neutral3"};case"pending":case"waiting":return{icon:l.jsx(Kk,{size:14}),color:"text-neutral3"};default:return{icon:null,color:"text-neutral3"}}}const pKe="auto auto auto auto 1fr";function jrs(e){if(e===void 0)return"—";if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${t}m ${n}s`}function Nrs(e){const t=Math.abs(e),n=e<0?"-":"";return t<1e3?`${n}${t}ms`:t<6e4?`${n}${(t/1e3).toFixed(1)}s`:t<36e5?`${n}${(t/6e4).toFixed(1)}m`:`${n}${(t/36e5).toFixed(1)}h`}const Ars=3e4,Irs=5*6e4;function Rrs({triggers:e,isLoading:t,workflowId:n,hasNextPage:r,isFetchingNextPage:s,setEndOfListElement:a}){const{Link:i,paths:o}=cn();return t?l.jsx(qd,{columns:pKe}):e.length===0?l.jsx(me,{variant:"ui-md",className:"text-neutral4 p-4",children:"No trigger history yet."}):l.jsxs(xe,{columns:pKe,children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Run"}),l.jsx(xe.TopCell,{children:"Status"}),l.jsx(xe.TopCell,{children:"Started"}),l.jsx(xe.TopCell,{children:"Duration"}),l.jsx(xe.TopCell,{children:" "})]}),e.map(c=>{const u=c.actualFireAt-c.scheduledFireAt,d=Nrs(u),f=`Scheduled ${SC(c.scheduledFireAt)} — published ${SC(c.actualFireAt)} (drift ${d})`,h=c.outcome==="failed",p=h?c.error:c.run?.error,m=Math.abs(u),g=!h&&m>Ars&&m<=Irs,v=`${c.scheduleId}-${c.runId}-${c.actualFireAt}`,x=l.jsx("span",{className:n&&!h?"text-accent1 font-mono text-ui-sm whitespace-nowrap":"text-neutral3 font-mono text-ui-sm whitespace-nowrap",children:c.runId}),w=l.jsxs(l.Fragment,{children:[l.jsx(xe.NameCell,{children:x}),l.jsx(xe.TextCell,{children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[h?l.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-ui-sm text-accent2",children:[l.jsx(tb,{size:14}),"publish failed"]}):c.run?l.jsx(f6t,{status:c.run.status}):l.jsx("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-ui-sm text-neutral3",children:"pending"}),p?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"text-accent2 inline-flex",children:l.jsx(tb,{size:14})})}),l.jsx(er,{children:p})]}):null]})}),l.jsx(xe.TextCell,{children:l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx("span",{title:f,children:AR(c.actualFireAt)}),g?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"text-accent3 inline-flex",children:l.jsx(tb,{size:14})})}),l.jsxs(er,{children:["Published ",d," after the scheduled fire time"]})]}):null]})}),l.jsx(xe.TextCell,{children:c.run?l.jsx("span",{children:jrs(c.run.durationMs)}):l.jsx("span",{className:"text-neutral4",children:"—"})}),l.jsx(xe.TextCell,{children:" "})]});return n&&c.run&&!h?l.jsx(xe.RowLink,{to:o.workflowRunLink(n,c.runId),LinkComponent:i,children:w},v):l.jsx(xe.Row,{children:w},v)}),a?l.jsxs("div",{ref:a,className:"h-1 col-span-full",children:[s?l.jsx("div",{className:"flex justify-center py-4",children:l.jsx(Ut,{})}):null,!r&&e.length>0?l.jsx(me,{variant:"ui-xs",className:"text-neutral4 text-center py-4 block",children:"All triggers loaded"}):null]}):null]})}const Prs=e=>{const t=Ze();return Ct({queryKey:["schedule",e],enabled:!!e,queryFn:async()=>{if(!e)throw new Error("scheduleId is required");return t.getSchedule(e)}})},mKe=25,$rs=e=>{const t=Ze(),{inView:n,setRef:r}=Hw(),s=Xb({queryKey:["schedule-triggers",e],enabled:!!e,initialPageParam:void 0,queryFn:async({pageParam:u})=>e?t.listScheduleTriggers(e,{limit:mKe,toActualFireAt:u}):{triggers:[]},getNextPageParam:u=>{if(!(!u?.triggers?.length||u.triggers.length<mKe))return u.triggers[u.triggers.length-1].actualFireAt},refetchInterval:u=>(u.state.data?.pages.flatMap(h=>h.triggers)??[]).some(h=>h.run?h.run.status==="pending"||h.run.status==="running"||h.run.status==="waiting":h.outcome==="published")?5e3:!1}),a=s.data?.pages.flatMap(u=>u?.triggers??[])??[],{hasNextPage:i,isFetchingNextPage:o,fetchNextPage:c}=s;return y.useEffect(()=>{n&&i&&!o&&c()},[n,i,o,c]),{...s,data:a,setEndOfListElement:r}},Mrs=e=>{const t=Ze(),n=ha();return or({mutationFn:async r=>{if(!e)throw new Error("scheduleId is required");return r==="pause"?t.pauseSchedule(e):t.resumeSchedule(e)},onSuccess:(r,s)=>{n.invalidateQueries({queryKey:["schedule",e]}),n.invalidateQueries({queryKey:["schedules"]}),ze.success(s==="pause"?"Schedule paused":"Schedule resumed")},onError:r=>{ze.error(r.message)}})};function X5({label:e,children:t}){return l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx(me,{variant:"ui-xs",className:"text-neutral4 uppercase tracking-wide",children:e}),l.jsx("div",{className:"text-ui-md",children:t})]})}function Drs(){const{scheduleId:e}=Sa(),{paths:t}=cn(),{data:n,isLoading:r,error:s}=Prs(e),{data:a,isLoading:i,error:o,hasNextPage:c,isFetchingNextPage:u,setEndOfListElement:d}=$rs(e),f=Mrs(e);if(s&&Hs(s))return l.jsx(lr,{title:"Schedule",icon:l.jsx(Gg,{}),children:l.jsx(pa,{})});if(s&&Ps(s))return l.jsx(lr,{title:"Schedule",icon:l.jsx(Gg,{}),children:l.jsx(aa,{resource:"schedules"})});if(s)return l.jsx(lr,{title:"Schedule",icon:l.jsx(Gg,{}),children:l.jsx(dc,{title:"Failed to load schedule",message:s.message})});const h=n?.target.type==="workflow"?n.target.workflowId:void 0;return l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:r,children:[l.jsx(Gg,{}),l.jsx("span",{className:"font-mono",children:n?.id??e})]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsxs(ce,{as:ln,to:t.schedulesLink(),variant:"ghost",children:[l.jsx(oh,{}),"Back to schedules"]}),h?l.jsx(ce,{as:ln,to:t.workflowLink(h),variant:"ghost",children:"Open workflow"}):null,n?l.jsx(ce,{onClick:()=>f.mutate(n.status==="active"?"pause":"resume"),disabled:f.isPending,"data-testid":"schedule-toggle-button",children:n.status==="active"?l.jsxs(l.Fragment,{children:[l.jsx(tge,{}),"Pause"]}):l.jsxs(l.Fragment,{children:[l.jsx(fb,{}),"Resume"]})}):null]})]})}),n?l.jsxs("div",{className:"grid gap-6 h-full overflow-hidden grid-cols-[minmax(0,20rem)_1fr]",children:[l.jsxs("div",{className:"flex flex-col gap-4 border border-border1 rounded-md p-4 h-fit",children:[l.jsx(X5,{label:"Workflow",children:h?l.jsx(ln,{to:t.workflowLink(h),className:"text-accent1 hover:underline",children:h}):"—"}),l.jsxs(X5,{label:"Cron",children:[l.jsx("code",{className:"font-mono text-ui-md",children:n.cron}),n.timezone?l.jsx("span",{className:"text-neutral4 ml-2 text-ui-sm",children:n.timezone}):null]}),l.jsx(X5,{label:"Status",children:l.jsx(d6t,{status:n.status})}),l.jsx(X5,{label:"Next fire",children:l.jsx("span",{title:SC(n.nextFireAt),children:AR(n.nextFireAt)})})]}),l.jsxs("div",{className:"overflow-y-auto","data-testid":"schedule-triggers-panel",children:[l.jsx(me,{variant:"ui-md",className:"mb-3",children:"Trigger history"}),o?l.jsx(dc,{title:"Failed to load trigger history",message:o.message}):l.jsx(Rrs,{triggers:a??[],isLoading:i,workflowId:h,hasNextPage:c,isFetchingNextPage:u,setEndOfListElement:d})]})]}):null]})}const gKe="minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1fr) auto auto auto";function Lrs({schedules:e,isLoading:t,search:n=""}){const{paths:r,Link:s}=cn(),a=y.useMemo(()=>{const i=n.toLowerCase();return i?e.filter(o=>o.id.toLowerCase().includes(i)||o.target.workflowId.toLowerCase().includes(i)):e},[e,n]);return t?l.jsx(qd,{columns:gKe}):l.jsxs(xe,{columns:gKe,children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Workflow"}),l.jsx(xe.TopCell,{children:"Schedule ID"}),l.jsx(xe.TopCell,{children:"Cron"}),l.jsx(xe.TopCell,{children:"Status"}),l.jsx(xe.TopCell,{children:"Next fire"}),l.jsx(xe.TopCell,{children:"Last run"})]}),a.length===0&&n?l.jsx(xe.NoMatch,{message:"No schedules match your search"}):null,a.length===0&&!n?l.jsx(xe.NoMatch,{message:"No schedules configured"}):null,a.map(i=>l.jsxs(xe.RowLink,{to:r.scheduleLink(i.id),LinkComponent:s,children:[l.jsx(xe.NameCell,{children:l.jsx("span",{className:"truncate",children:i.target.workflowId})}),l.jsx(xe.TextCell,{children:l.jsx("span",{className:"truncate font-mono text-ui-sm",title:i.id,children:i.id})}),l.jsx(xe.TextCell,{children:l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx("code",{className:"font-mono text-ui-sm",children:i.cron}),i.timezone?l.jsx("span",{className:"text-neutral4 text-ui-xs",children:i.timezone}):null]})}),l.jsx(xe.TextCell,{children:l.jsx(d6t,{status:i.status})}),l.jsx(xe.TextCell,{children:l.jsx("span",{className:"whitespace-nowrap",title:SC(i.nextFireAt),children:AR(i.nextFireAt)})}),l.jsx(xe.TextCell,{children:i.lastRun?l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx(f6t,{status:i.lastRun.status}),l.jsx("span",{className:"text-neutral4 text-ui-sm",title:SC(i.lastFireAt),children:i.lastFireAt?AR(i.lastFireAt):""})]}):i.lastFireAt?l.jsx("span",{className:"whitespace-nowrap",title:SC(i.lastFireAt),children:AR(i.lastFireAt)}):l.jsx("span",{className:"text-neutral4",children:"Never"})})]},i.id))]})}function zrs({workflowId:e}={}){const{data:t,isLoading:n,error:r}=Gwe(e?{workflowId:e}:{}),[s,a]=y.useState("");return r?l.jsx(dc,{title:"Failed to load schedules",message:r.message}):l.jsxs("div",{className:"grid grid-rows-[auto_1fr] gap-4 h-full overflow-hidden",children:[l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:a,label:"Filter schedules",placeholder:"Filter by id or workflow"})}),l.jsx("div",{className:"overflow-y-auto",children:l.jsx(Lrs,{schedules:t??[],isLoading:n,search:s})})]})}function Frs(){const[e]=wo(),t=e.get("workflowId")??void 0,{error:n}=Gwe(t?{workflowId:t}:{});if(n&&Hs(n))return l.jsx(lr,{title:"Schedules",icon:l.jsx(Gg,{}),children:l.jsx(pa,{})});if(n&&Ps(n))return l.jsx(lr,{title:"Schedules",icon:l.jsx(Gg,{}),children:l.jsx(aa,{resource:"schedules"})});const r=t?`/workflows/${t}`:"/workflows",s=t?"Back to workflow":"Back to workflows";return l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(Gg,{})," ",t?`Schedules · ${t}`:"Schedules"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsxs(ce,{as:ln,to:r,variant:"ghost",children:[l.jsx(oh,{}),s]})})]})}),l.jsx(zrs,{workflowId:t})]})}const vKe=()=>{const{workflowId:e}=Sa(),{data:t,isLoading:n,error:r}=W2(e);return r&&Hs(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})}):r&&Ps(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"workflows"})}):l.jsx(GRt,{workflowId:e,workflow:t??void 0,isLoading:n})};function Brs(e){if(!e)return null;switch(e.icon||e.provider){case"aws-s3":case"s3":return l.jsx(TSt,{className:"h-4 w-4 text-[#FF9900]"});case"google-cloud":case"google-cloud-storage":case"gcs":return l.jsx(CSt,{className:"h-4 w-4"});case"azure-blob":case"azure":return l.jsx(jSt,{className:"h-4 w-4 text-[#0078D4]"});case"cloudflare":case"cloudflare-r2":case"r2":return l.jsx(cG,{className:"h-4 w-4 text-[#F38020]"});case"minio":return l.jsx(Yle,{className:"h-4 w-4 text-red-400"});case"database":return l.jsx(Ja,{className:"h-4 w-4 text-emerald-400"});case"local":case"folder":return l.jsx(Zc,{className:"h-4 w-4 text-amber-400"});case"hard-drive":return l.jsx(Yle,{className:"h-4 w-4 text-slate-400"});case"cloud":return l.jsx(cG,{className:"h-4 w-4 text-sky-400"});default:return l.jsx(cG,{className:"h-4 w-4 text-neutral4"})}}function h6t(e,t=!1){const{name:n,type:r,mount:s}=e;if(r==="directory")return s?Brs(s):t?l.jsx(rj,{className:"h-4 w-4 text-amber-400"}):l.jsx(Zc,{className:"h-4 w-4 text-amber-400"});switch(n.split(".").pop()?.toLowerCase()){case"ts":case"tsx":case"js":case"jsx":return l.jsx(V0,{className:"h-4 w-4 text-blue-400"});case"json":return l.jsx(EM,{className:"h-4 w-4 text-yellow-400"});case"md":case"mdx":return l.jsx(Do,{className:"h-4 w-4 text-neutral4"});case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return l.jsx(Kme,{className:"h-4 w-4 text-purple-400"});default:return l.jsx(Yme,{className:"h-4 w-4 text-neutral4"})}}function p6t(e){if(e==null||Number.isNaN(e))return"";if(e<0)return"-"+p6t(-e);if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/Math.pow(t,r)).toFixed(1))+" "+n[r]}function Urs(e){if("body"in e&&e.body&&typeof e.body=="object"){const r=e.body;if(typeof r.error=="string")return r.error;if(typeof r.message=="string")return r.message}const t=e.message,n=t.lastIndexOf(" - {");if(n!==-1)try{const r=t.slice(n+3),s=JSON.parse(r);if(s.error)return s.error;if(s.message)return s.message}catch{}return t.includes("status: 404")?"Directory not found":t}function m6t(e){return e==="."||e===""}function qrs({path:e,onNavigate:t}){const r=m6t(e)?[]:e.split("/").filter(Boolean);return l.jsxs("div",{className:"flex items-center gap-1 text-sm overflow-x-auto",children:[l.jsx("button",{onClick:()=>t("."),className:"p-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors","aria-label":"Workspace root",children:l.jsx(rj,{className:"h-4 w-4"})}),r.map((s,a)=>{const i=r.slice(0,a+1).join("/");return l.jsxs("div",{className:"flex items-center",children:[l.jsx(ga,{className:"h-4 w-4 text-neutral3"}),l.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 Vrs({entries:e,currentPath:t,isLoading:n,error:r,onNavigate:s,onFileSelect:a,onRefresh:i,onUpload:o,onCreateDirectory:c,onDelete:u,isCreatingDirectory:d,isDeleting:f}){const[h,p]=y.useState(null),m=[...e].sort((w,S)=>w.type==="directory"&&S.type!=="directory"?-1:w.type!=="directory"&&S.type==="directory"?1:w.name.localeCompare(S.name)),g=m6t(t),v=w=>{const S=g?w.name:`${t}/${w.name}`;w.type==="directory"?s(S):a?.(S)},x=w=>{const S=g?w.name:`${t}/${w.name}`;p(S)};return l.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[l.jsx(qrs,{path:t,onNavigate:s}),l.jsxs("div",{className:"flex items-center gap-1",children:[i&&l.jsx(ce,{variant:"ghost",size:"md",onClick:i,disabled:n,"aria-label":"Refresh files",children:l.jsx(CM,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),c&&l.jsx(ce,{variant:"ghost",size:"md",disabled:d,"aria-label":"Create directory",onClick:()=>{const w=prompt("Directory name:");if(w){const S=g?w:`${t}/${w}`;c(S)}},children:d?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):l.jsx(J8,{className:"h-4 w-4"})}),o&&l.jsx(ce,{variant:"ghost",size:"md",onClick:o,"aria-label":"Upload files",children:l.jsx(rU,{className:"h-4 w-4"})})]})]}),l.jsx("div",{className:"max-h-[400px] overflow-auto",children:n?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):r?l.jsxs("div",{className:"py-12 px-4 text-center",children:[l.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-500/10 mb-4",children:l.jsx(qR,{className:"h-6 w-6 text-red-400"})}),l.jsx("p",{className:"text-sm text-neutral6 font-medium mb-1",children:"Failed to load directory"}),l.jsx("p",{className:"text-xs text-neutral4 max-w-sm mx-auto",children:Urs(r)})]}):m.length===0?l.jsx("div",{className:"py-12 text-center text-neutral4 text-sm",children:g?"Workspace is empty":"Directory is empty"}):l.jsx(sf,{children:l.jsxs("ul",{children:[!g&&l.jsx("li",{children:l.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:[l.jsx(rj,{className:"h-4 w-4 text-amber-400"}),l.jsx("span",{className:"text-sm text-neutral5",children:".."})]})}),m.map(w=>{const S=w.mount?.displayName||w.mount?.provider,_=w.mount?.status==="error";return l.jsx("li",{className:"group",children:l.jsxs("div",{className:"flex items-center hover:bg-surface4 transition-colors",children:[l.jsxs("button",{onClick:()=>v(w),className:"flex-1 flex items-center gap-3 px-4 py-2 text-left",children:[h6t(w),l.jsx("span",{className:"text-sm text-neutral6 flex-1 truncate",children:w.name}),w.mount&&_&&l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{tabIndex:0,className:"flex items-center",children:l.jsx(qR,{className:"h-4 w-4 text-red-400"})})}),l.jsxs(er,{className:"max-w-xs",children:[l.jsx("span",{className:"text-red-400",children:"Error:"})," ",w.mount.error||"Failed to connect to this filesystem"]})]}),w.mount&&S&&(w.mount.description?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{tabIndex:0,className:`text-xs px-1.5 py-0.5 rounded ${_?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})}),l.jsx(er,{children:w.mount.description})]}):l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${_?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})),w.type==="file"&&w.size!==void 0&&l.jsx("span",{className:"text-xs text-neutral3 tabular-nums",children:p6t(w.size)})]}),u&&!w.mount&&l.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:l.jsx(Kd,{className:"h-3.5 w-3.5"})})]})},w.name)})]})})}),l.jsx(Wt,{open:!!h,onOpenChange:w=>!f&&!w&&p(null),children:l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Delete Item"}),l.jsxs(Wt.Description,{children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{disabled:f,children:"Cancel"}),l.jsxs(Wt.Action,{disabled:f,onClick:async()=>{try{h&&u&&await u(h)}finally{p(null)}},children:[f?l.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}):null,"Delete"]})]})]})})]})}function Hrs(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 Wrs({content:e,language:t}){return l.jsx(LOe,{language:t,style:zOe.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},codeTagProps:{style:{fontFamily:"var(--geist-mono), ui-monospace, monospace"}},children:e})}function Zrs({path:e,content:t,isLoading:n,mimeType:r,onClose:s}){const a=e.split("/").pop()||e,i=a.split(".").pop()?.toLowerCase(),o=r?.startsWith("image/")||["png","jpg","jpeg","gif","svg","webp"].includes(i||""),c=Hrs(i);return l.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[h6t({name:a,type:"file"}),l.jsx("span",{className:"text-sm font-medium text-neutral6",children:a})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(da,{content:t,copyMessage:"Copied file content"}),s&&l.jsx(ce,{variant:"ghost",size:"md",onClick:s,children:"Close"})]})]}),l.jsx("div",{className:"max-h-[500px] overflow-auto h-full",style:{backgroundColor:"black"},children:n?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):o?l.jsx("div",{className:"p-4 flex items-center justify-center",children:l.jsx("img",{src:`data:${r||"image/png"};base64,${btoa(t)}`,alt:a,className:"max-w-full max-h-[400px] object-contain"})}):c?l.jsx(Wrs,{content:t,language:c}):l.jsx("pre",{className:"p-4 text-sm text-neutral5 whitespace-pre-wrap font-mono overflow-x-auto",children:t})})]})}const Grs=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Workspaces yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Add a workspace to your Mastra configuration to ",l.jsx("br",{}),"manage files, skills, and enable semantic search."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",l.jsx(Va,{})]})})}),Qrs=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(iGt,{}),titleSlot:"Workspace Not Configured",descriptionSlot:l.jsxs(l.Fragment,{children:["No workspace is configured. Add a workspace to your ",l.jsx("br",{}),"Mastra configuration to manage files, skills, and enable semantic search."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",l.jsx(Va,{})]})})}),Yrs=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(qR,{}),titleSlot:"Workspace Not Supported",descriptionSlot:l.jsxs(l.Fragment,{children:["The workspace feature requires a newer version of ",l.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),".",l.jsx("br",{}),"Please upgrade your dependencies to enable workspace functionality."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",l.jsx(Va,{})]})})}),vle={bm25:{label:"Keyword",icon:l.jsx(Do,{className:"h-3.5 w-3.5"}),color:"bg-blue-500/10 text-blue-400 border-blue-500/30"},vector:{label:"Semantic",icon:l.jsx(AC,{className:"h-3.5 w-3.5"}),color:"bg-purple-500/10 text-purple-400 border-purple-500/30"},hybrid:{label:"Hybrid",icon:l.jsx(VYt,{className:"h-3.5 w-3.5"}),color:"bg-amber-500/10 text-amber-400 border-amber-500/30"}};function g6t(e){return e.id.replace(/#chunk-\d+$/,"")}function Xrs({onSearch:e,isSearching:t,searchResults:n,canBM25:r,canVector:s,onViewResult:a}){const[i,o]=y.useState(""),[c,u]=y.useState(5),d=()=>r&&s?"hybrid":r?"bm25":s?"vector":"bm25",[f,h]=y.useState(d()),p=g=>{g.preventDefault(),i.trim()&&e({query:i.trim(),topK:c,mode:f})},m=[...r?["bm25"]:[],...s?["vector"]:[],...r&&s?["hybrid"]:[]];return l.jsxs("div",{className:"rounded-lg bg-surface4",children:[l.jsxs("form",{onSubmit:p,className:"p-4",children:[l.jsxs("div",{className:"flex gap-3 items-center",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(aj,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),l.jsx(mn,{value:i,onChange:g=>o(g.target.value),placeholder:"Search workspace files...",className:"pl-9 h-10 bg-surface2 border-border1"})]}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-xs text-neutral4",children:"Top"}),l.jsx(mn,{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"})]}),l.jsx(ce,{type:"submit",disabled:t||!i.trim(),size:"lg",className:"h-10 px-4",children:t?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):"Search"})]}),m.length>0&&l.jsx("div",{className:"flex gap-2 mt-3",children:m.map(g=>{const v=vle[g],x=f===g;return l.jsxs("button",{type:"button",onClick:()=>h(g),className:`
671
+ ]`})]})]})}function Yes({errors:e,maxErrors:t=5}){if(e.length===0)return null;const n=e.slice(0,t),r=e.length-t;return l.jsxs("div",{className:"bg-accent2/10 border border-accent2/30 rounded-md p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-accent2 mb-2",children:[l.jsx(Ne,{children:l.jsx(tb,{className:"w-4 h-4"})}),l.jsxs("span",{className:"font-medium text-sm",children:[e.length," validation error",e.length!==1?"s":""]})]}),l.jsx("ul",{className:"text-sm text-accent2/80 space-y-1",children:n.map((s,a)=>l.jsxs("li",{className:"flex gap-2",children:[l.jsx("span",{className:"shrink-0",children:"•"}),l.jsx("span",{children:s.message})]},a))}),r>0&&l.jsxs("div",{className:"text-xs text-accent2/60 mt-2",children:["+",r," more error",r!==1?"s":""]})]})}function Xes({datasetId:e,open:t,onOpenChange:n,onSuccess:r}){const[s,a]=y.useState("upload"),[i,o]=y.useState(null),[c,u]=y.useState({current:0,total:0}),[d,f]=y.useState(null),[h,p]=y.useState(!1),{parseFile:m,isParsing:g,error:v}=nes(),{batchInsertItems:x}=$i(),w=y.useCallback(async I=>{try{const P=await m(I);o(P),a("preview")}catch{}},[m]),S=y.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]),_=y.useCallback(()=>{n(!1),r?.(),d&&d.success>0&&ze.success(`Imported ${d.success} item${d.success!==1?"s":""}`),setTimeout(()=>{a("upload"),o(null),u({current:0,total:0}),f(null)},150)},[n,r,d]),O=y.useCallback(()=>{h||(n(!1),setTimeout(()=>{a("upload"),o(null),u({current:0,total:0}),f(null)},150))},[h,n]),E=i&&i.items.length>0&&i.errors.length===0,j=()=>{switch(s){case"upload":return l.jsx(Qes,{onFileSelect:w,isParsing:g,error:v?.message});case"preview":return i?l.jsx("div",{className:"flex flex-col gap-4",children:i.errors.length>0?l.jsxs(l.Fragment,{children:[l.jsx(Yes,{errors:i.errors}),l.jsx("div",{className:"text-sm text-neutral4",children:"Please fix the errors in your JSON file and try again."})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"text-sm text-neutral4",children:["Found ",i.items.length," valid item",i.items.length!==1?"s":""," to import."]}),l.jsx(Ges,{items:i.items,maxRows:5})]})}):null;case"importing":return l.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[l.jsx(Ut,{size:"lg"}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Importing items..."}),l.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[c.current," of ",c.total]})]})]});case"complete":return l.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[l.jsx("div",{className:"text-4xl",children:d&&d.errors===0?"✓":"⚠"}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Import Complete"}),l.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[d?.success??0," item",d?.success!==1?"s":""," imported",d&&d.errors>0&&l.jsxs("span",{className:"text-accent2",children:[" ","(",d.errors," error",d.errors!==1?"s":"",")"]})]})]})]})}},T=()=>{switch(s){case"upload":return l.jsx(ce,{onClick:O,children:"Cancel"});case"preview":return l.jsxs(l.Fragment,{children:[l.jsx(ce,{onClick:()=>a("upload"),children:"Back"}),l.jsxs(ce,{variant:"primary",onClick:S,disabled:!E,children:["Import ",i?.items.length??0," Item",i?.items.length!==1?"s":""]})]});case"importing":return null;case"complete":return l.jsx(ce,{variant:"primary",onClick:_,children:"Done"})}},N={upload:"Import JSON",preview:"Preview Data",importing:"Importing",complete:"Import Complete"};return l.jsx(Fr,{open:t,onOpenChange:O,children:l.jsxs($r,{className:"max-w-2xl max-h-[90vh]",children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:N[s]}),l.jsx(va,{children:"Import dataset items from a JSON file."})]}),l.jsx(is,{className:"min-h-[200px] max-h-[50vh] overflow-y-auto",children:j()}),l.jsx(ph,{className:"px-6 pt-4 flex justify-end gap-2",children:T()})]})})}function Kes({dataset:e,isLoading:t=!1,onEditClick:n,onDuplicateClick:r,onDeleteClick:s,experimentTriggerSlot:a,disableExperimentTrigger:i=!1,onExperimentClick:o,className:c}){return l.jsxs(Hn,{className:c,children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{isLoading:t,children:[l.jsx(Ja,{})," ",e?.name]}),l.jsx(Hn.Description,{isLoading:t,children:e?.description}),l.jsxs(Hn.Description,{isLoading:t,children:[l.jsxs(ms,{children:[l.jsx(TC,{})," Created at ",e?.createdAt?on(new Date(e.createdAt),"MMM d, yyyy"):""]}),l.jsxs(ms,{children:[l.jsx(Ew,{})," Latest version v",e?.version??""]})]})]}),l.jsx(Hn.Column,{children:l.jsxs(ys,{children:[a?i?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"cursor-not-allowed",children:l.jsx("div",{className:"pointer-events-none opacity-50",inert:!0,"aria-disabled":"true",children:a})})}),l.jsx(er,{children:"Add items to the dataset before running an experiment"})]}):a:o?i?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"cursor-not-allowed",children:l.jsxs(ce,{disabled:!0,tabIndex:-1,children:[l.jsx(fb,{}),"Run Experiment"]})})}),l.jsx(er,{children:"Add items to the dataset before running an experiment"})]}):l.jsxs(ce,{onClick:o,children:[l.jsx(fb,{}),"Run Experiment"]}):null,l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsx(ce,{size:"default","aria-label":"Dataset actions menu",children:l.jsx(Uet,{})})}),l.jsxs(St.Content,{align:"end",className:"w-48",children:[l.jsxs(St.Item,{onSelect:n,children:[l.jsx($b,{})," Edit Dataset"]}),l.jsxs(St.Item,{onSelect:r,children:[l.jsx(lh,{})," Duplicate Dataset"]}),l.jsxs(St.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[l.jsx(Kd,{})," Delete Dataset"]})]})]})]})})]})}const K5t=e=>{const t=Ze(),{data:n}=wM(e),r=n?.experiments;return Ct({queryKey:["dataset-review-items",e,r?.map(s=>s.id)],queryFn:async()=>!r||r.length===0?[]:(await Promise.all(r.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(o=>o.status==="needs-review").map(o=>({id:o.id,input:o.input,output:o.output,error:o.error,itemId:o.itemId,experimentId:o.experimentId,datasetId:a.datasetId??void 0,traceId:o.traceId??void 0,scores:o.scores?Object.fromEntries(o.scores.map(c=>[c.scorerId,c.score??0])):{},tags:o.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!r&&r.length>0,refetchOnWindowFocus:!1})},Jes=e=>{const t=Ze(),{data:n}=wM(e),r=n?.experiments;return Ct({queryKey:["dataset-completed-items",e,r?.map(s=>s.id)],queryFn:async()=>!r||r.length===0?[]:(await Promise.all(r.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(o=>o.status==="complete").map(o=>({id:o.id,input:o.input,output:o.output,error:o.error,itemId:o.itemId,experimentId:o.experimentId,datasetId:a.datasetId??void 0,traceId:o.traceId??void 0,scores:o.scores?Object.fromEntries(o.scores.map(c=>[c.scorerId,c.score??0])):{},tags:o.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!r&&r.length>0,refetchOnWindowFocus:!1})};function ets(e,t){if(typeof e=="string")return e.length>t?e.slice(0,t)+"...":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t)+"...":n}catch{return String(e)}}const tts=Y("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 nKe({className:e,children:t,...n}){return l.jsx(u2,{children:l.jsx(u7,{className:Y(tts,e),...n,children:t})})}function nts({datasetId:e}){const t=Ze(),{data:n}=Qv(e),{data:r,isLoading:s}=K5t(e),{data:a,isLoading:i}=Jes(e),{updateExperimentResult:o}=$i(),[c,u]=y.useState(null),[d,f]=y.useState(null),[h,p]=y.useState(new Set),[m,g]=y.useState(!1),[v,x]=y.useState(!1),[w,S]=y.useState(!1),[_,O]=y.useState(""),[E,j]=y.useState(""),[T,N]=y.useState(""),[I,P]=y.useState([]),[R,F]=y.useState(!1),[M,L]=y.useState(null),U=M??r??[];y.useEffect(()=>{r&&M===null&&L(r)},[r]);const z=y.useMemo(()=>{const ye=new Set;if(n?.tags)for(const Te of n.tags)ye.add(Te);for(const Te of U)for(const De of Te.tags)ye.add(De);return[...ye].sort()},[n,U]),q=y.useCallback(ye=>{!n||!e||(n.tags??[]).includes(ye)},[n,e]),W=y.useMemo(()=>d?d==="__untagged__"?U.filter(ye=>ye.tags.length===0):U.filter(ye=>ye.tags.includes(d)):U,[U,d]),D=y.useMemo(()=>{const ye=new Map;for(const Te of U)for(const De of Te.tags)ye.set(De,(ye.get(De)??0)+1);return[...ye.entries()].sort((Te,De)=>De[1]-Te[1])},[U]),Q=y.useMemo(()=>U.filter(ye=>ye.tags.length===0).length,[U]),V=y.useMemo(()=>{let ye=0;return d&&ye++,m&&ye++,ye},[d,m]),$=y.useCallback((ye,Te)=>{L(ut=>(ut??[]).map(jt=>jt.id===ye?{...jt,tags:Te}:jt));const De=U.find(ut=>ut.id===ye);De?.experimentId&&De?.datasetId&&o.mutate({datasetId:De.datasetId,experimentId:De.experimentId,resultId:De.id,tags:Te})},[U,o]),Z=y.useCallback((ye,Te)=>{const De=U.find(ut=>ut.id===ye);De?.traceId&&Te!==void 0&&t.createFeedback({feedback:{traceId:De.traceId,source:"studio",feedbackSource:"studio",feedbackType:"rating",value:Te==="positive"?1:-1,experimentId:De.experimentId??void 0,sourceId:De.id}}).catch(()=>{}),L(ut=>(ut??[]).map(jt=>jt.id===ye?{...jt,rating:Te}:jt))},[U,t]),G=y.useCallback((ye,Te)=>{const De=U.find(ut=>ut.id===ye);De?.traceId&&t.createFeedback({feedback:{traceId:De.traceId,source:"studio",feedbackSource:"studio",feedbackType:"comment",value:Te,comment:Te,experimentId:De.experimentId??void 0,sourceId:De.id}}).catch(()=>{}),L(ut=>(ut??[]).map(jt=>jt.id===ye?{...jt,comment:Te}:jt))},[U,t]),J=y.useCallback(ye=>{const Te=U.find(De=>De.id===ye);L(De=>(De??[]).filter(ut=>ut.id!==ye)),p(De=>{const ut=new Set(De);return ut.delete(ye),ut}),c===ye&&u(null),Te?.experimentId&&Te?.datasetId&&o.mutate({datasetId:Te.datasetId,experimentId:Te.experimentId,resultId:Te.id,status:null})},[U,o,c]),ie=y.useCallback(ye=>{const Te=U.find(De=>De.id===ye);L(De=>(De??[]).filter(ut=>ut.id!==ye)),p(De=>{const ut=new Set(De);return ut.delete(ye),ut}),c===ye&&u(null),Te?.experimentId&&Te?.datasetId&&o.mutate({datasetId:Te.datasetId,experimentId:Te.experimentId,resultId:Te.id,status:"complete"})},[U,o,c]),ne=y.useMemo(()=>{const ye=m?a??[]:W;return!m||!d?ye:d==="__untagged__"?ye.filter(Te=>Te.tags.length===0):ye.filter(Te=>Te.tags.includes(d))},[m,a,W,d]),te=m?i:!1,ae=y.useMemo(()=>new Set(ne.map(ye=>ye.id)),[ne]),de=y.useMemo(()=>[...h].filter(ye=>ae.has(ye)).length,[h,ae]),X=ne.length>0&&de===ne.length,re=de>0&&!X,le=y.useCallback(ye=>{p(Te=>{const De=new Set(Te);return De.has(ye)?De.delete(ye):De.add(ye),De})},[]),ge=y.useCallback(()=>{p(X?new Set:new Set(ne.map(ye=>ye.id)))},[X,ne]),fe=y.useCallback(ye=>{for(const Te of h){const De=U.find(ut=>ut.id===Te);De&&!De.tags.includes(ye)&&$(Te,[...De.tags,ye])}},[U,h,$]),ue=y.useCallback(ye=>{for(const Te of h){const De=U.find(ut=>ut.id===Te);De&&De.tags.includes(ye)&&$(Te,De.tags.filter(ut=>ut!==ye))}},[U,h,$]),be=y.useCallback(()=>{for(const ye of h)ie(ye);p(new Set)},[h,ie]),ke=y.useCallback(()=>{for(const ye of h)J(ye);p(new Set)},[h,J]),Ie=y.useCallback(()=>{O(""),S(!0)},[]),K=y.useCallback(async()=>{if(!(!E||!T)){x(!0),S(!1);try{const ye=U.filter(De=>h.has(De.id));if(ye.length===0){x(!1);return}const Te=await t.clusterFailures({modelId:`${E}/${T}`,items:ye.map(De=>({id:De.id,input:De.input,output:De.output??void 0,error:typeof De.error=="string"?De.error:De.error?String(De.error):void 0,scores:De.scores,existingTags:De.tags.length>0?De.tags:void 0})),availableTags:z.length>0?z:void 0,prompt:_||void 0});Te.proposedTags&&Te.proposedTags.length>0&&(P(Te.proposedTags.map(De=>({...De,accepted:!0}))),F(!0))}catch(ye){console.error("Analysis failed:",ye)}finally{x(!1)}}},[E,T,U,h,t,z,_]),oe=y.useCallback(()=>{for(const ye of I){if(!ye.accepted)continue;const Te=U.find(De=>De.id===ye.itemId);if(Te){const De=[...new Set([...Te.tags,...ye.tags])];$(Te.id,De)}}F(!1)},[I,U,$]),we=y.useCallback(ye=>{u(Te=>Te===ye?null:ye)},[]),Pe=y.useMemo(()=>c?ne.find(ye=>ye.id===c)??null:null,[c,ne]),Le=y.useCallback(()=>{if(!c||ne.length===0)return;const ye=ne.findIndex(Te=>Te.id===c);ye<ne.length-1&&u(ne[ye+1].id)},[c,ne]),ve=y.useCallback(()=>{if(!c||ne.length===0)return;const ye=ne.findIndex(Te=>Te.id===c);ye>0&&u(ne[ye-1].id)},[c,ne]),Ce=Pe?"2rem 1fr 10rem 8rem":"2rem 1fr 10rem 8rem 6rem 6rem";return s?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(Ut,{className:"w-6 h-6"})}):l.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[l.jsx(Fr,{open:w,onOpenChange:S,children:l.jsxs($r,{children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Analyze Items"}),l.jsx(va,{children:"Use an LLM to automatically suggest tags for the selected items."})]}),l.jsxs("div",{className:"space-y-4 py-2",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx(Et,{className:"text-xs mb-1 block",children:"Provider"}),l.jsx(Yv,{value:E,onValueChange:j})]}),l.jsxs("div",{children:[l.jsx(Et,{className:"text-xs mb-1 block",children:"Model"}),l.jsx(Xv,{llmId:E,value:T,onValueChange:N})]})]}),l.jsxs(me,{variant:"ui-xs",className:"text-neutral3",children:[h.size," item",h.size!==1?"s":""," will be analyzed"]}),l.jsxs("div",{children:[l.jsx(Et,{className:"text-xs",children:"Instructions (optional)"}),l.jsx(iu,{value:_,onChange:ye=>O(ye.target.value),placeholder:"E.g., Focus on safety issues and factual errors...",rows:3,className:"text-xs mt-1"})]})]}),l.jsxs(ph,{children:[l.jsx(ce,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),l.jsxs(ce,{onClick:K,disabled:!E||!T||v,children:[v?l.jsx(Ut,{className:"w-4 h-4 mr-1"}):null,"Analyze"]})]})]})}),l.jsx(Fr,{open:R,onOpenChange:F,children:l.jsxs($r,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Review Proposed Tags"}),l.jsxs(va,{children:[I.filter(ye=>ye.accepted).length," of ",I.length," proposals selected"]})]}),l.jsx("div",{className:"space-y-3 py-2",children:I.map((ye,Te)=>{const De=U.find(ut=>ut.id===ye.itemId);return l.jsx("div",{className:Y("p-3 border rounded-lg",!ye.accepted&&"opacity-50"),children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Wi,{checked:ye.accepted,onCheckedChange:ut=>P(jt=>jt.map((xn,He)=>He===Te?{...xn,accepted:!!ut}:xn))}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate block",children:De?typeof De.input=="string"?De.input.slice(0,100):JSON.stringify(De.input).slice(0,100):ye.itemId}),l.jsx("div",{className:"flex gap-1 flex-wrap mt-1.5",children:ye.tags.map((ut,jt)=>l.jsx(V5t,{tag:ut,onRename:xn=>P(He=>He.map((We,Re)=>Re===Te?{...We,tags:We.tags.map((Qe,Fe)=>Fe===jt?xn:Qe)}:We)),onRemove:()=>P(xn=>xn.map((He,We)=>We===Te?{...He,tags:He.tags.filter((Re,Qe)=>Qe!==jt)}:He))},`${ut}-${jt}`))}),ye.reason&&l.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-1 block italic",children:ye.reason})]})]})},ye.itemId)})}),l.jsxs(ph,{children:[l.jsx(ce,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),l.jsxs(ce,{onClick:oe,disabled:I.filter(ye=>ye.accepted).length===0,children:["Accept ",I.filter(ye=>ye.accepted).length," proposals"]})]})]})}),l.jsxs(sh,{className:Pe?"grid-cols-[1fr_1fr]":"",children:[l.jsxs(Tn,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsxs(ce,{variant:"outline",size:"md",children:[l.jsx(qet,{}),"Filter",V>0&&l.jsx("span",{className:Y("ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"),children:V})]})}),l.jsxs(St.Content,{align:"start",className:Y("min-w-48"),children:[l.jsxs(St.Sub,{children:[l.jsxs(St.SubTrigger,{children:["Status",m&&l.jsx("span",{className:Y("ml-auto text-ui-sm text-accent1"),children:"1"})]}),l.jsxs(nKe,{children:[l.jsx(St.CheckboxItem,{checked:!m,onCheckedChange:()=>{g(!1),u(null)},onSelect:ye=>ye.preventDefault(),children:"Review Queue"}),l.jsx(St.CheckboxItem,{checked:m,onCheckedChange:()=>{g(!0),u(null)},onSelect:ye=>ye.preventDefault(),children:"Completed"})]})]}),l.jsxs(St.Sub,{children:[l.jsxs(St.SubTrigger,{children:["Tags",d&&l.jsx("span",{className:Y("ml-auto text-ui-sm text-accent1"),children:"1"})]}),l.jsxs(nKe,{children:[l.jsx(St.CheckboxItem,{checked:!d,onCheckedChange:()=>f(null),onSelect:ye=>ye.preventDefault(),children:"All"}),Q>0&&l.jsx(St.CheckboxItem,{checked:d==="__untagged__",onCheckedChange:()=>f(d==="__untagged__"?null:"__untagged__"),onSelect:ye=>ye.preventDefault(),children:"Untagged"}),D.length>0&&l.jsx(St.Separator,{}),D.map(([ye])=>l.jsx(St.CheckboxItem,{checked:d===ye,onCheckedChange:()=>f(d===ye?null:ye),onSelect:Te=>Te.preventDefault(),children:ye},ye))]})]}),V>0&&l.jsxs(l.Fragment,{children:[l.jsx(St.Separator,{}),l.jsxs(St.Item,{onSelect:()=>{f(null),g(!1),u(null)},children:[l.jsx(qr,{}),"Clear all filters"]})]})]})]}),V>0&&l.jsxs(ce,{variant:"outline",size:"md",onClick:()=>{f(null),g(!1),u(null)},children:[l.jsx(qr,{}),"Reset"]})]}),!m&&h.size>0&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(q5t,{selectedCount:h.size,vocabulary:z,onApplyTag:fe,onRemoveTag:ue,onNewTag:ye=>fe(ye)}),l.jsxs(St,{children:[l.jsx(St.Trigger,{asChild:!0,children:l.jsxs(ce,{disabled:v,children:[v?l.jsx(Ut,{className:"w-4 h-4"}):l.jsx(Ne,{size:"sm",children:l.jsx(Os,{})}),"Actions"]})}),l.jsxs(St.Content,{align:"end",children:[l.jsxs(St.Item,{onSelect:be,children:[l.jsx(Ne,{size:"sm",children:l.jsx(WS,{})}),"Complete"]}),l.jsxs(St.Item,{onSelect:ke,children:[l.jsx(Ne,{size:"sm",children:l.jsx(Kd,{})}),"Remove"]}),l.jsx(St.Separator,{}),l.jsxs(St.Item,{onSelect:Ie,children:[l.jsx(Ne,{size:"sm",children:l.jsx(AC,{})}),"Analyze"]})]})]})]})]}),te?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(Ut,{className:"w-6 h-6"})}):ne.length===0?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsxs("div",{className:"text-center px-8",children:[l.jsx(me,{variant:"ui-sm",className:"text-neutral3 block",children:m?"No completed reviews yet":"No items to review"}),l.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."})]})}):l.jsxs(xe,{columns:Ce,children:[l.jsxs(xe.Top,{children:[!m&&l.jsx(xe.TopCell,{children:l.jsx(Wi,{checked:X?!0:re?"indeterminate":!1,onCheckedChange:()=>ge(),"aria-label":"Select all"})}),m&&l.jsx(xe.TopCell,{children:" "}),l.jsx(xe.TopCell,{children:"Input"}),l.jsx(xe.TopCell,{children:"Comment"}),l.jsx(xe.TopCell,{children:"Tags"}),!Pe&&l.jsx(xe.TopCell,{children:"Rating"}),!Pe&&l.jsx(xe.TopCell,{children:"Scores"})]}),l.jsx(xe.Rows,{children:ne.map(ye=>{const Te=ye.scores?Object.entries(ye.scores):[];return l.jsxs(xe.Row,{onClick:()=>we(ye.id),selected:c===ye.id,children:[l.jsx(xe.Cell,{children:m?ye.error?l.jsx("div",{className:"w-2 h-2 rounded-full bg-red-700",title:"Error"}):l.jsx("div",{className:"w-2 h-2 rounded-full bg-green-600",title:"Success"}):l.jsx(Wi,{checked:h.has(ye.id),onCheckedChange:()=>le(ye.id),onClick:De=>De.stopPropagation(),"aria-label":`Select item ${ye.id}`})}),l.jsx(xe.NameCell,{children:ets(ye.input,80)}),l.jsx(xe.Cell,{children:ye.comment?l.jsx(me,{variant:"ui-xs",className:"text-neutral3 truncate",children:ye.comment}):l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),l.jsx(xe.Cell,{children:ye.tags.length>0?l.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate",children:ye.tags.join(", ")}):l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),!Pe&&l.jsxs(xe.Cell,{children:[ye.rating==="positive"&&l.jsx(Ne,{size:"sm",className:"text-positive1",children:l.jsx(rge,{})}),ye.rating==="negative"&&l.jsx(Ne,{size:"sm",className:"text-negative1",children:l.jsx(nge,{})}),!ye.rating&&l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})]}),!Pe&&l.jsx(xe.Cell,{children:Te.length>0?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Ne,{size:"sm",className:"text-neutral3",children:l.jsx(ci,{})}),l.jsx(me,{variant:"ui-xs",className:"text-neutral4 font-mono",children:Te[0][1].toFixed(2)}),Te.length>1&&l.jsxs(_t,{variant:"default",children:["+",Te.length-1]})]}):l.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})})]},ye.id)})})]})]}),Pe&&l.jsx(U5t,{item:Pe,isCompleted:m,tagVocabulary:z,onRate:ye=>Z(Pe.id,ye),onSetTags:ye=>{$(Pe.id,ye);for(const Te of ye)z.includes(Te)||q(Te)},onComment:ye=>G(Pe.id,ye),onRemove:()=>J(Pe.id),onComplete:m?void 0:()=>ie(Pe.id),onPrevious:ve,onNext:Le,onClose:()=>u(null)})]})]})}function rts({datasetId:e,onExperimentClick:t,onEditClick:n,onDeleteClick:r,onAddItemClick:s,experimentTriggerSlot:a,onNavigateToDataset:i,activeDatasetVersion:o,onVersionSelect:c,initialTab:u,onTabChange:d}){const{navigate:f}=cn(),[h,p]=y.useState(u??"items"),m=Nt=>{p(Nt),d?.(Nt)},[g,v]=y.useState(!1),[x,w]=y.useState(!1),[S,_]=y.useState(!1),[O,E]=y.useState([]),[j,T]=y.useState(!1),[N,I]=y.useState([]),[P,R]=y.useState(!1),[F,M]=y.useState([]),[L,U]=y.useState(!1),[z,q]=y.useState(0),[W,D]=y.useState(null),[Q,V]=y.useState(""),[$]=Yjn(Q,300),[Z,G]=y.useState(null),ie=o!==void 0?o:Z,{data:ne,isLoading:te}=Qv(e),{data:ae=[],total:de,isLoading:X,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:ge}=ej(e,$||void 0,ie),{data:fe=[],total:ue,isLoading:be}=ej(e,void 0,ie),[ke,Ie]=y.useState({}),{data:K,isLoading:oe}=wM(e,void 0,ke),{data:we}=wM(e),{deleteItems:Pe}=$i(),Le=K?.experiments??[],ve=we?.experiments??[],Ce=xes({hasSearchQuery:!!$,filteredItemsLength:ae.length,unfilteredItemsTotal:ue,itemsTotal:de}),{data:ye}=K5t(e),Te=ye?.length??0,De=Nt=>{D(Nt)},ut=()=>{D(null)},jt=Nt=>{const un=Nt.isCurrent?null:Nt;c?c(un):G(Nt.isCurrent?null:Nt.version)},xn=Nt=>{E(Nt),_(!0)},He=Nt=>{I(Nt),T(!0)},We=Nt=>{T(Nt),Nt||(I([]),q(un=>un+1))},Re=Nt=>{f(`/datasets/${e}/items?items=${Nt.join(",")}`)},Qe=Nt=>{f(`/datasets/${e}/versions?ids=${Nt.join(",")}`)},Fe=Nt=>{M(Nt),R(!0)},Je=async()=>{await Pe.mutateAsync({datasetId:e,itemIds:F}),ze.success(`Deleted ${F.length} items`),R(!1),M([]),q(Nt=>Nt+1)},st=Nt=>{_(!1),E([]),q(un=>un+1),i?.(Nt)},Ot=Nt=>{_(Nt),Nt||(E([]),q(un=>un+1))};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsx("div",{className:Y("h-full w-full",kr.allSlow),children:l.jsxs("div",{className:Y("grid grid-rows-[auto_1fr] mx-auto h-full w-full m-auto",W?"max-w-[120rem]":"max-w-[90rem]"),children:[l.jsx(Kes,{dataset:ne,isLoading:te,onEditClick:n,onDuplicateClick:()=>U(!0),onDeleteClick:r,experimentTriggerSlot:a,disableExperimentTrigger:!be&&fe.length===0,onExperimentClick:t}),l.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:l.jsxs(bu,{defaultTab:"items",value:h,onValueChange:m,className:"grid grid-rows-[auto_1fr] h-full",children:[l.jsxs(xu,{children:[l.jsxs(Wr,{value:"items",children:["Items ",l.jsx(hi,{color:"gray",children:Ce})]}),l.jsxs(Wr,{value:"experiments",children:["Experiments",l.jsx(hi,{color:"gray",children:Le.length})]}),l.jsxs(Wr,{value:"review",children:["Review",Te>0&&l.jsx(hi,{color:"orange",children:Te})]})]}),l.jsx(Ns,{value:"items",className:"grid overflow-auto mt-5",children:l.jsx(Zes,{datasetId:e,items:ae,isLoading:X,featuredItemId:W,onItemSelect:De,onItemClose:ut,onAddClick:s??(()=>{}),onImportClick:()=>v(!0),onImportJsonClick:()=>w(!0),onBulkDeleteClick:Fe,onCreateDatasetClick:xn,onAddToDatasetClick:He,onCompareItemsClick:Re,datasetName:ne?.name,clearSelectionTrigger:z,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:ge,searchQuery:Q,onSearchChange:V,activeDatasetVersion:ie,currentDatasetVersion:ne?.version,onVersionSelect:jt,onCompareVersionsClick:Qe})}),l.jsx(Ns,{value:"experiments",className:"grid overflow-auto mt-5",children:l.jsx(Mes,{experiments:Le,allExperiments:ve,isLoading:oe,datasetId:e,filters:ke,onFiltersChange:Ie})}),l.jsx(Ns,{value:"review",className:"overflow-auto mt-0",children:l.jsx(nts,{datasetId:e})})]})})]})})}),l.jsx(Tes,{datasetId:e,open:g,onOpenChange:v}),l.jsx(Xes,{datasetId:e,open:x,onOpenChange:w}),l.jsx(pes,{open:S,onOpenChange:Ot,items:O,onSuccess:st}),l.jsx(mes,{open:j,onOpenChange:We,items:N,currentDatasetId:e}),l.jsx(ges,{open:L,onOpenChange:U,sourceDatasetId:e,sourceDatasetName:ne?.name||"",sourceDatasetDescription:ne?.description,onSuccess:i}),l.jsx(Wt,{open:P,onOpenChange:R,children:l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Delete Items"}),l.jsxs(Wt.Description,{children:["Are you sure you want to delete ",F.length," item",F.length!==1?"s":"","? This action cannot be undone."]})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{children:"Cancel"}),l.jsx(Wt.Action,{onClick:Je,children:Pe.isPending?"Deleting...":"Delete"})]})]})})]})}function sts(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const n=JSON.parse(t[1]);if(n.field&&Array.isArray(n.errors))return{field:n.field,errors:n.errors}}catch{}return null}function rKe({field:e,errors:t}){return t.length?l.jsx("div",{className:"mt-2 space-y-1",children:t.map((n,r)=>l.jsxs("p",{className:"text-xs text-destructive",children:[l.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,n.path!=="/"?n.path:""]}),": ",n.message]},r))}):null}function ats({datasetId:e,open:t,onOpenChange:n,onSuccess:r}){const[s,a]=y.useState("{}"),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,f]=y.useState(null),{addItem:h}=$i(),p=async x=>{x.preventDefault();let w;try{w=JSON.parse(s)}catch{ze.error("Input must be valid JSON");return}let S;if(i.trim())try{S=JSON.parse(i)}catch{ze.error("Ground Truth must be valid JSON");return}let _;if(c.trim())try{_=JSON.parse(c)}catch{ze.error("Expected Trajectory must be valid JSON");return}try{await h.mutateAsync({datasetId:e,input:w,groundTruth:S,expectedTrajectory:_}),ze.success("Item added successfully"),f(null),a("{}"),o(""),u(""),n(!1),r?.()}catch(O){const E=sts(O);E?f(E):ze.error(`Failed to add item: ${O instanceof Error?O.message:"Unknown error"}`)}},m=x=>{a(x),d?.field==="input"&&f(null)},g=x=>{o(x),d?.field==="groundTruth"&&f(null)},v=()=>{a("{}"),o(""),u(""),f(null),n(!1)};return l.jsx(Fr,{open:t,onOpenChange:n,children:l.jsxs($r,{className:"max-w-lg",children:[l.jsx(Br,{children:l.jsx(Mr,{children:"Add Item"})}),l.jsx(is,{children:l.jsxs("form",{onSubmit:p,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Et,{htmlFor:"item-input",children:"Input (JSON) *"}),l.jsx(vs,{value:s,onChange:m,showCopyButton:!1,className:"min-h-[120px]"}),d?.field==="input"&&l.jsx(rKe,{field:"input",errors:d.errors})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Et,{htmlFor:"item-ground-truth",children:"Ground Truth (JSON, optional)"}),l.jsx(vs,{value:i,onChange:g,showCopyButton:!1,className:"min-h-[80px]"}),d?.field==="groundTruth"&&l.jsx(rKe,{field:"groundTruth",errors:d.errors})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Et,{htmlFor:"item-trajectory",children:"Expected Trajectory (JSON, optional)"}),l.jsx(vs,{value:c,onChange:u,showCopyButton:!1,className:"min-h-[80px]"})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[l.jsx(ce,{type:"button",onClick:v,children:"Cancel"}),l.jsx(ce,{type:"submit",variant:"primary",disabled:h.isPending,children:h.isPending?"Adding...":"Add Item"})]})]})})]})})}function its({selectedScorers:e,setSelectedScorers:t,disabled:n=!1,container:r}){const{data:s,isLoading:a}=uf(),i=y.useMemo(()=>s?Object.entries(s).map(([o,c])=>({value:o,label:c.scorer?.config?.name||o,description:c.scorer?.config?.description||""})):[],[s]);return l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Et,{children:"Scorers (Optional)"}),l.jsx(FSt,{options:i,value:e,onValueChange:t,placeholder:"Select scorers...",searchPlaceholder:"Search scorers...",emptyText:"No scorers available",disabled:n||a,container:r})]})}const ots=[{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"}];function lts({targetType:e,setTargetType:t,targetId:n,setTargetId:r,container:s}){const{data:a,isLoading:i}=Wv(),{data:o,isLoading:c}=Zw(),{data:u,isLoading:d}=uf(),f=e==="agent"?Object.entries(a??{}).map(([g,v])=>({value:g,label:v.name??g})):e==="workflow"?Object.entries(o??{}).map(([g,v])=>({value:g,label:v.name??g})):e==="scorer"?Object.entries(u??{}).map(([g,v])=>({value:g,label:v.scorer?.config?.name??g})):[],h=e==="agent"&&i||e==="workflow"&&c||e==="scorer"&&d,p=g=>{t(g),r("")},m=e==="agent"?"Agent":e==="workflow"?"Workflow":"Scorer";return l.jsxs("div",{className:"grid gap-6",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Et,{children:"Target Type"}),l.jsx(Mc,{options:ots,value:e,onValueChange:p,placeholder:"Select target type",searchPlaceholder:"Search types...",emptyText:"No types available",container:s})]}),e&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Et,{children:m}),l.jsx(Mc,{options:f,value:n,onValueChange:r,placeholder:`Select ${e}`,searchPlaceholder:"Search...",emptyText:"No targets available",disabled:h,container:s})]})]})}function cts({datasetId:e,version:t,open:n,onOpenChange:r,onSuccess:s}){const a=y.useRef(null),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,f]=y.useState([]),{triggerExperiment:h}=$i(),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});Fm.success("Experiment triggered successfully"),r(!1),s?.(x.experimentId),o(""),u(""),f([])}catch(x){const w=x instanceof Error?x.message:"Failed to trigger experiment";Fm.error(w)}},v=()=>{m||(r(!1),o(""),u(""),f([]))};return l.jsx(Fr,{open:n,onOpenChange:v,children:l.jsxs($r,{ref:a,children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Run Experiment"}),l.jsx(va,{children:t?`Execute items from ${on(new Date(t),"MMM d, yyyy")} version against a target.`:"Execute all items in this dataset against a target."})]}),l.jsxs(is,{className:"grid gap-6",children:[l.jsx(lts,{targetType:i,setTargetType:o,targetId:c,setTargetId:u,container:a}),i&&i!=="scorer"&&l.jsx(its,{selectedScorers:d,setSelectedScorers:f,disabled:m,container:a})]}),l.jsxs(ph,{className:"px-6 pt-4",children:[l.jsx(ce,{onClick:v,disabled:m,children:"Cancel"}),l.jsx(ce,{variant:"primary",onClick:g,disabled:!p||m,children:m?l.jsxs(l.Fragment,{children:[l.jsx(Ut,{className:"w-4 h-4"}),"Running..."]}):"Run"})]})]})})}const J5t=e=>{const t=Ze();return Ct({queryKey:["experiment-trace-light",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return t.getTraceLight(e)},enabled:!!e})},sKe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"score",label:"Score",size:"1fr"}];function uts({result:e,scores:t,onPrevious:n,onNext:r,onClose:s,onShowTrace:a,onScoreClick:i,featuredScoreId:o}){const c=!!e?.error,u=ple(e?.input),d=ple(e?.output);return l.jsxs(l.Fragment,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:n,onNext:r,previousAriaLabel:"View previous result details",nextAriaLabel:"View next result details"}),l.jsxs(ys,{children:[l.jsxs(ce,{onClick:a,disabled:!e.traceId,children:[l.jsx(ege,{}),"Show Trace"]}),l.jsx(ce,{onClick:s,"aria-label":"Close result details panel",children:l.jsx(qr,{})})]})]}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(fb,{})," ",e.id]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:[l.jsx(V0,{})," ",e.itemId]})})]})}),c&&l.jsx(hr,{variant:"destructive",title:"Error",children:l.jsx(hr.Message,{children:ple(e?.error&&typeof e.error=="object"?e.error.message:e?.error)})}),t&&t.length>0&&l.jsxs(Bt,{className:"grid-rows-[auto_auto] overflow-visible",children:[l.jsxs(Bt.Header,{columns:sKe,children:[l.jsx(Bt.HeaderCol,{children:"Scorer"}),l.jsx(Bt.HeaderCol,{children:"Score"})]}),l.jsx(Bt.Items,{children:t.map(f=>l.jsx(Bt.Row,{children:l.jsxs(Bt.RowButton,{item:{id:f.id},columns:sKe,isFeatured:o===f.id,onClick:i,children:[l.jsx(Bt.TextCell,{children:f.scorerId}),l.jsx(Bt.TextCell,{className:"font-mono",children:f.score.toFixed(3)})]})},f.id))})]}),(e.status||Array.isArray(e.tags)&&e.tags.length>0)&&l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[l.jsx(ij,{className:"w-4 h-4"})," Review Status"]}),l.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.status&&l.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=>l.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-surface4 text-neutral4",children:f},f))]})]}),l.jsx(Yt.CodeSection,{title:"Input",icon:l.jsx(V0,{}),codeStr:u}),l.jsx(Yt.CodeSection,{title:"Output",icon:l.jsx(Yf,{}),codeStr:d}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[l.jsx(TC,{className:"w-4 h-4"})," Created"]}),l.jsx("p",{className:"text-sm text-neutral4",children:on(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")})]})]})]})}function ple(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function dts({span:e}){return e?l.jsxs(l.Fragment,{children:[l.jsx(Yt.CodeSection,{title:"Input",icon:l.jsx(H0,{}),codeStr:JSON.stringify(e.input||null,null,2)}),l.jsx(Yt.CodeSection,{title:"Output",icon:l.jsx(Yf,{}),codeStr:JSON.stringify(e.output||null,null,2)}),l.jsx(Yt.CodeSection,{title:"Metadata",icon:l.jsx(Tp,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),l.jsx(Yt.CodeSection,{title:"Attributes",icon:l.jsx(Tp,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]}):null}function fts({traceId:e,spanId:t,onNext:n,onPrevious:r,onClose:s}){const{data:a}=Ak(e,t),i=a?.span;return l.jsxs(l.Fragment,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:r,onNext:n,previousAriaLabel:"View previous span details",nextAriaLabel:"View next span details"}),l.jsx(ce,{onClick:s,"aria-label":"Close span details",children:l.jsx(qr,{})})]}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(Tp,{})," Span ",rh(t)]})})}),l.jsx(dts,{span:i})]})]})}const hts=e=>{if(!e||e.length===0)return[];const t=e.reduce((o,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!o||u>o)?u:o},null),n=new Map,r=[];e.forEach(o=>{const c=new Date(o.startedAt),u=o.endedAt?new Date(o.endedAt):void 0,d={id:o.spanId,name:o.name,type:o.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:o.parentSpanId};n.set(o.spanId,d)}),e.forEach(o=>{const c=n.get(o.spanId);if(o?.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}r.push(c)}else{const u=n.get(o.parentSpanId);u?u.spans.push(c):r.push(c)}});const s=o=>o.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(r),i=o=>{o.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function e6t(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(n=>{t.push(n.id),t.push(...e6t(n))}),t}const aKe=["agent","workflow","model","mcp","tool","workspace","other"];function t6t(e){const t=e?.toLowerCase().split("_")[0],n={agent:{icon:l.jsx(za,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:l.jsx(go,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:l.jsx(Zg,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:l.jsx(ac,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"bg-oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:l.jsx(mo,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},workspace:{icon:l.jsx($q,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"bg-oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}};return t in n?n[t]:{typePrefix:"other"}}function pts({isSelected:e,isFaded:t,isExpanded:n,toggleChildren:r,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:o}){return l.jsx("div",{className:Y("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:o&&o>0?l.jsxs("div",{className:"flex gap-1",children:[l.jsxs(iKe,{onClick:()=>r?.(),children:[i?a:o," ",n?i?l.jsx(Ret,{}):l.jsx(Ow,{}):l.jsx(Os,{})]}),a>(o??0)&&!i&&l.jsxs(iKe,{onClick:()=>s?.(),children:[a," ",l.jsx(Iet,{})]})]}):null})}function iKe({onClick:e,children:t,className:n}){return l.jsx("button",{onClick:e,className:Y("h-full",n),children:l.jsx("div",{className:Y("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 mts({isLastChild:e,hasChildren:t=!1,expanded:n=!1}){return l.jsx("div",{className:Y("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&&l.jsx("span",{className:Y("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:n?l.jsx(Met,{}):l.jsx($et,{})})})}function gts({span:e,spanUI:t,isFaded:n,depth:r=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:o,isRootSpan:c,isExpanded:u,toggleChildren:d}){return l.jsxs("div",{className:"flex overflow-x-auto",style:{paddingLeft:`${r*1.5}rem`},children:[!c&&l.jsx("button",{onClick:()=>d?.(),disabled:!o,className:Y({"cursor-default":!o,"cursor-pointer":o}),children:l.jsx(mts,{isLastChild:i,hasChildren:!!o,expanded:u})}),l.jsx("button",{className:"truncate",onClick:()=>s?.(e.id),children:e.name})]})}function n6t({span:e,depth:t=0,onSpanClick:n,selectedSpanId:r,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:o,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=e6t(e),v=g.length,x=t===0,w=t6t(e?.type),S=f?f.includes(e.id):!1,_=d&&d.length>0?!d.includes(e.id):!1,E=(c&&c.length>0?c.includes(w?.typePrefix||""):!1)||_;y.useEffect(()=>{x&&h?.([e.id])},[x,e.id,h]),y.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(P=>d.includes(P.id));!S&&I&&j()},[d,e.spans,e.id,S,h,f]);const j=()=>{if(!(!h||!f))if(S){const I=[e.id,...g];h(f.filter(P=>!I.includes(P)))}else h([...f,e.id])},T=()=>{!h||!f||h([...f,e.id,...g])},N=g.every(I=>f?.includes(I));return l.jsxs(l.Fragment,{children:[l.jsx(gts,{span:e,spanUI:w,isFaded:E,depth:t,onSpanClick:n,selectedSpanId:r,isLastChild:s,hasChildren:p,isRootSpan:x,isExpanded:S,toggleChildren:j}),l.jsx(pts,{isSelected:r===e.id,isFaded:E,isExpanded:S,toggleChildren:j,expandAllDescendants:T,totalDescendants:v,allDescendantsExpanded:N,numOfChildren:m}),p&&S&&e.spans?.map((I,P,R)=>{const F=P===R.length-1;return l.jsx(n6t,{span:I,depth:t+1,onSpanClick:n,selectedSpanId:r,isLastChild:F,overallLatency:a,overallStartTime:i,fadedTypes:c,searchPhrase:u,expandedSpanIds:f,setExpandedSpanIds:h,featuredSpanIds:d},I.id)})]})}function vts({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:n,isLoading:r,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:o}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return l.jsx(l.Fragment,{children:r?l.jsxs("div",{className:Y("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:[l.jsx(Ut,{})," Loading Trace Timeline ..."]}):l.jsx("div",{className:"grid grid-cols-[1fr_auto]",children:e?.map(f=>l.jsx(n6t,{span:f,onSpanClick:t,selectedSpanId:n,overallLatency:c,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:o,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})})}function yts({spans:e=[],fadedTypes:t,onLegendClick:n,onLegendReset:r,onSearchPhraseChange:s,traceId:a}){const[i,o]=y.useState("");y.useEffect(()=>{o("")},[a]);const c=aKe.filter(h=>e.some(p=>p?.spanType?.startsWith(h)))||[],u=e.some(h=>!aKe.some(m=>h?.spanType?.startsWith(m))),d=h=>{n?.(h)};y.useEffect(()=>{f(i)},[i,s]);const f=umt(h=>{s?.(h)},1e3);return l.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[l.jsx("div",{className:"flex",children:l.jsx(rw,{name:"search-spans",label:"Find span by name",labelIsHidden:!0,placeholder:"Look for span name",value:i,onChange:h=>{o(h.target.value)},onReset:()=>o("")})}),l.jsxs(ys,{spacing:"close",children:[c.map(h=>{const p=t6t(h),m=t?.includes(h);return l.jsx(y.Fragment,{children:l.jsxs(ce,{onClick:()=>d(h),className:m?"opacity-40":"",style:{color:m?void 0:p?.color,backgroundColor:p?.bgColor},children:[p?.icon&&l.jsx(Ne,{children:p.icon}),p?.label]})},h)}),u&&l.jsxs(ce,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",children:[l.jsx(Ne,{children:l.jsx(K8,{})}),"Other"]}),l.jsx(ce,{onClick:r,disabled:t?.length===0,children:l.jsx(Ne,{children:l.jsx(qr,{})})})]})]})}function bts({traceId:e,selectedSpanId:t,onSpanSelect:n,onClose:r}){const{data:s,isLoading:a}=J5t(e),i=s?.spans??[],[o,c]=y.useState(""),[u,d]=y.useState([]),[f,h]=y.useState([]),[p,m]=y.useState([]),g=y.useMemo(()=>hts(i),[i]);y.useEffect(()=>{if(o.trim()===""){h([]);return}const S=o.toLowerCase(),_=i.filter(O=>O.name.toLowerCase().includes(S)).map(O=>O.spanId);h(_)},[o,i]),y.useEffect(()=>{c(""),d([]),h([]),m([])},[e]);const v=S=>{n?.(t===S?void 0:S)},x=S=>{d(_=>_.includes(S)?_.filter(O=>O!==S):[..._,S])},w=()=>{d([])};return l.jsxs(l.Fragment,{children:[l.jsx(Tn.Toolbar,{children:l.jsx(ce,{onClick:r,"aria-label":"Close trace panel",children:l.jsx(qr,{})})}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(cl,{})," Trace ",rh(e)]})})}),l.jsx(yts,{spans:i,fadedTypes:u,onLegendClick:x,onLegendReset:w,searchPhrase:o,onSearchPhraseChange:c,traceId:e}),l.jsx(vts,{hierarchicalSpans:g,onSpanClick:v,selectedSpanId:t,isLoading:a,fadedTypes:u,expandedSpanIds:p,setExpandedSpanIds:m,featuredSpanIds:f})]})]})}function xts({results:e,isLoading:t,featuredResultId:n,onResultClick:r,columns:s,scoresByItemId:a,scorerIds:i,setEndOfListElement:o,isFetchingNextPage:c,hasNextPage:u}){const d=s.map(f=>f.size).join(" ");return t?l.jsxs(xe,{columns:d,children:[l.jsx(xe.Top,{children:s.map(f=>l.jsx(xe.TopCell,{children:f.label},f.name))}),l.jsx("div",{className:"flex items-center justify-center py-20 col-span-full",children:l.jsx(Ut,{})})]}):e.length===0?l.jsxs(xe,{columns:d,children:[l.jsx(xe.Top,{children:s.map(f=>l.jsx(xe.TopCell,{children:f.label},f.name))}),l.jsx(xe.NoMatch,{message:"No results yet"})]}):l.jsxs(xe,{columns:d,children:[l.jsx(xe.Top,{children:s.map(f=>l.jsx(xe.TopCell,{children:f.label},f.name))}),l.jsxs(xe.Rows,{children:[e.map(f=>{const h=!!f.error,p=f.id===n;return l.jsxs(xe.Row,{onClick:()=>r(f.id),selected:p,children:[l.jsx(xe.TextCell,{children:l.jsx("span",{className:"truncate block font-mono",children:f.itemId})}),l.jsx(xe.Cell,{children:l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("div",{className:"flex items-center justify-center w-10 relative bg-transparent h-full",children:l.jsx("div",{className:Y("w-2 h-2 rounded-full",h?"bg-red-700":"bg-green-600")})})}),l.jsx(er,{children:h?"Error":"Success"})]})}),s.some(m=>m.name==="input")&&l.jsx(xe.TextCell,{children:l.jsx("span",{className:"truncate block font-mono",children:Sts(wts(f.input),200)})}),i?.map(m=>{const v=a?.[f.itemId]?.find(x=>x.scorerId===m);return l.jsx(xe.TextCell,{children:l.jsx("span",{className:"font-mono",children:v!=null?v.score.toFixed(3):"-"})},m)})]},f.id)}),l.jsxs("div",{ref:o,className:"h-1 col-span-full",children:[c&&l.jsx("div",{className:"flex justify-center py-4",children:l.jsx(Ut,{})}),!u&&e.length>0&&l.jsx(me,{variant:"ui-xs",className:"text-icon3 text-center py-4 block",children:"All results loaded"})]})]})]})}function wts(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function Sts(e,t){return e.length<=t?e:e.slice(0,t-1)+"..."}function kts(e){const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function _ts({score:e,onNext:t,onPrevious:n,onClose:r}){const s=kts(e),a=s?"N/A — code-based scorer":"N/A — step not configured";return l.jsxs(l.Fragment,{children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:n,onNext:t,previousAriaLabel:"View previous score details",nextAriaLabel:"View next score details"}),l.jsx(ce,{onClick:r,"aria-label":"Close score details",children:l.jsx(qr,{})})]}),l.jsxs(Tn.Content,{children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(ci,{})," ",e.scorerId]})})}),l.jsxs(sw,{children:[l.jsx(Yt.CodeSection,{title:`Score: ${e.score}`,icon:l.jsx(ci,{}),codeStr:e.reason||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Input",icon:l.jsx(V0,{}),codeStr:JSON.stringify(e.input??null,null,2)}),l.jsx(Yt.CodeSection,{title:"Output",icon:l.jsx(Yf,{}),codeStr:JSON.stringify(e.output??null,null,2)}),!s&&l.jsxs(l.Fragment,{children:[l.jsx(Yt.CodeSection,{title:"Preprocess Prompt",icon:l.jsx(Gc,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Analyze Prompt",icon:l.jsx(Gc,{}),codeStr:e.analyzePrompt||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Generate Score Prompt",icon:l.jsx(Gc,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),l.jsx(Yt.CodeSection,{title:"Generate Reason Prompt",icon:l.jsx(Gc,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})]})}const oKe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"avg",label:"Avg Score",size:"1fr"},{name:"count",label:"Items Scored",size:"1fr"}];function Ots({scoresByItemId:e,experimentStatus:t}){const n=y.useMemo(()=>{if(!e)return[];const r={};for(const s of Object.values(e))for(const a of s)r[a.scorerId]||(r[a.scorerId]={sum:0,count:0}),r[a.scorerId].sum+=a.score,r[a.scorerId].count++;return Object.entries(r).map(([s,{sum:a,count:i}])=>({scorerId:s,avg:a/i,count:i})).sort((s,a)=>s.scorerId.localeCompare(a.scorerId))},[e]);if(n.length===0){const r=t==="running"||t==="pending",s=e!==void 0;let a,i;return r?(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…"),l.jsx("div",{className:"flex h-full items-center justify-center py-12",children:l.jsx(Ii,{iconSlot:l.jsx(ci,{className:"w-8 h-8 text-neutral3"}),titleSlot:a,descriptionSlot:i})})}return l.jsxs(Bt,{children:[l.jsxs(Bt.Header,{columns:oKe,children:[l.jsx(Bt.HeaderCol,{children:"Scorer"}),l.jsx(Bt.HeaderCol,{children:"Avg Score"}),l.jsx(Bt.HeaderCol,{children:"Items Scored"})]}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:n.map(({scorerId:r,avg:s,count:a})=>l.jsxs(Bt.Row,{columns:oKe,children:[l.jsx(Bt.TextCell,{children:r}),l.jsx(Bt.TextCell,{className:"font-mono",children:s.toFixed(3)}),l.jsx(Bt.TextCell,{className:"font-mono",children:a})]},r))})})]})}function r6t({experimentId:e,experimentStatus:t,results:n,isLoading:r,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i}){const[o,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(void 0),[p,m]=y.useState(null),g=n.find(z=>z.id===o)??null,{data:v}=R5t(e,t),x=y.useMemo(()=>{if(!v)return[];const z=new Set;for(const q of Object.values(v))for(const W of q)z.add(W.scorerId);return[...z].sort()},[v]),{data:w}=J5t(u),S=w?.spans??[],_=()=>{if(!f)return;const z=S.findIndex(q=>q.spanId===f);if(z>=0&&z<S.length-1)return()=>h(S[z+1].spanId)},O=()=>{if(!f)return;const z=S.findIndex(q=>q.spanId===f);if(z>0)return()=>h(S[z-1].spanId)},E=z=>{c(z),d(null),h(void 0),m(null)},j=z=>{E(z===o?null:z)},T=()=>{E(null)},N=()=>{if(!g)return;const z=n.findIndex(q=>q.id===g.id);if(z>=0&&z<n.length-1)return()=>E(n[z+1].id)},I=()=>{if(!g)return;const z=n.findIndex(q=>q.id===g.id);if(z>0)return()=>E(n[z-1].id)},P=g?v?.[g.itemId]:void 0,R=P?.find(z=>z.id===p)??null,F=z=>{m(z===p?null:z),d(null),h(void 0)},M=()=>{if(!p||!P)return;const z=P.findIndex(q=>q.id===p);if(z>=0&&z<P.length-1)return()=>m(P[z+1].id)},L=()=>{if(!p||!P)return;const z=P.findIndex(q=>q.id===p);if(z>0)return()=>m(P[z-1].id)},U=y.useMemo(()=>[{name:"itemId",label:"Item ID",size:"5rem"},{name:"status",label:"Status",size:"3rem"},{name:"input",label:"Input",size:"1fr"},...o?[]:x.map(z=>({name:z,label:z,size:"1fr"}))],[o,x]);return l.jsxs(bu,{defaultTab:"summary",className:"grid grid-rows-[auto_1fr] h-full overflow-hidden",children:[l.jsxs(xu,{children:[l.jsx(Wr,{value:"summary",children:"Summary"}),l.jsx(Wr,{value:"results",children:"Results"})]}),l.jsx(Ns,{value:"summary",className:"overflow-y-auto mt-5",children:l.jsx(Ots,{scoresByItemId:v,experimentStatus:t})}),l.jsx(Ns,{value:"results",className:"grid overflow-hidden mt-5",children:l.jsxs(sh,{className:g?"grid-cols-[1fr_2fr]":void 0,children:[l.jsx(Tn,{children:l.jsx(xts,{results:n,isLoading:r,featuredResultId:o,onResultClick:j,columns:U,scoresByItemId:v,scorerIds:o?void 0:x,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i})}),g&&l.jsxs(Qer,{numOfColumns:1+(!u&&p?1:0)+(u?1:0)+(f?1:0),minColumnWidth:"35rem",children:[g&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(uts,{result:g,scores:P,onPrevious:I(),onNext:N(),onClose:T,onScoreClick:F,featuredScoreId:p,onShowTrace:()=>{d(g.traceId??null),h(void 0),m(null)}})}),g&&!u&&R&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(_ts,{score:R,onNext:M(),onPrevious:L(),onClose:()=>m(null)})}),g&&u&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(bts,{traceId:u,selectedSpanId:f,onSpanSelect:h,onClose:()=>{d(null),h(void 0)}})}),g&&u&&f&&l.jsx(Tn,{withLeftSeparator:!0,children:l.jsx(fts,{traceId:u,spanId:f,onNext:_(),onPrevious:O(),onClose:()=>h(void 0)})})]})]})})]})}const Ets={pending:l.jsx(Kk,{}),running:l.jsx(Nz,{}),completed:l.jsx(qa,{}),failed:l.jsx(qr,{})};function Cts({experiment:e,className:t}){const n=e.status,r=e.totalItems-e.succeededCount-e.failedCount;return l.jsxs("div",{className:Y("grid justify-items-end gap-3",t),children:[l.jsxs("div",{className:"flex p-1 px-3 text-ui-lg capitalize text-neutral4 gap-2 items-center bg-surface5 rounded-lg ",children:[l.jsx("span",{className:Y("w-5 h-5 flex items-center justify-center rounded-full text-black","[&>svg]:w-4 [&>svg]:h-4",{"bg-green-700":n==="completed","bg-red-700":n==="failed","bg-cyan-600":n==="running","bg-yellow-600":n==="pending"}),children:Ets[n]}),e.status]}),l.jsxs("div",{className:Y("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:[l.jsxs("span",{children:["Total: ",l.jsx("b",{children:e.totalItems})]}),l.jsxs("span",{children:["Succeeded: ",l.jsx("b",{children:e.succeededCount})]}),l.jsxs("span",{children:["Failed: ",l.jsx("b",{children:e.failedCount})]}),(n==="pending"||n==="running")&&l.jsxs("span",{children:["Pending: ",l.jsx("b",{children:r})]})]})]})}function s6t({experimentId:e,experiment:t}){const{Link:n,paths:r}=cn(),{data:s}=Wv(),{data:a}=Zw(),{data:i}=uf(),o=()=>{switch(t.targetType){case"agent":return r.agentLink(t.targetId);case"workflow":return r.workflowLink(t.targetId);case"scorer":return r.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 l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(Det,{}),e," ",e&&l.jsx(da,{content:e})]}),l.jsxs(Hn.Description,{children:[l.jsxs(ms,{children:[l.jsx(TC,{})," Created at ",on(new Date(t.createdAt),"MMM d, yyyy 'at' h:mm a")]}),t.completedAt&&l.jsxs(ms,{children:[l.jsx(TC,{})," Completed at ",on(new Date(t.completedAt),"MMM d, yyyy 'at' h:mm a")]})]}),l.jsxs(Hn.Description,{children:[l.jsxs(ms,{children:[l.jsx(mGt,{})," Target",l.jsx(n,{href:o(),children:c()})]}),t.agentVersion&&l.jsxs(ms,{children:[l.jsx(eU,{})," Version",t.targetType==="agent"&&t.targetId?l.jsx(n,{href:`${r.agentLink(t.targetId)}/editor?version=${encodeURIComponent(t.agentVersion)}`,className:"font-mono text-xs underline hover:text-accent1",children:t.agentVersion}):l.jsx("span",{className:"font-mono text-xs",children:t.agentVersion}),l.jsx(da,{content:t.agentVersion})]})]})]}),l.jsx(Hn.Column,{children:l.jsx(Cts,{experiment:t})})]})}function pEe({delta:e}){const t=e>0?l.jsx(hi,{size:"small",color:"green",intensity:"muted",children:l.jsx(Gme,{})}):e<0?l.jsx(hi,{size:"small",color:"red",intensity:"muted",children:l.jsx(jet,{})}):null;return l.jsxs("span",{className:Y("font-mono text-sm text-neutral4 min-w-20"),children:[l.jsx("span",{className:"w-3 inline-block",children:e>0?"+ ":e<0?"- ":""}),Math.abs(e).toFixed(2)," ",t]})}function G5(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function Tts({item:e,baselineId:t,contenderId:n,baselineVersion:r,contenderVersion:s,onPrevious:a,onNext:i,onClose:o}){const c=e.results[t],u=e.results[n],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 l.jsxs(Tn,{withLeftSeparator:!0,children:[l.jsxs(Tn.Toolbar,{children:[l.jsx(Zj,{onPrevious:a,onNext:i,previousAriaLabel:"Previous comparison item",nextAriaLabel:"Next comparison item"}),l.jsx(ys,{children:l.jsx(ce,{onClick:o,"aria-label":"Close comparison detail panel",children:l.jsx(qr,{})})})]}),l.jsxs(Tn.Content,{className:"pb-6",children:[l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{size:"smaller",children:[l.jsx(V0,{})," ",e.itemId]})})}),d?l.jsx(l.Fragment,{children:l.jsxs(sw,{children:[h.length>0&&l.jsxs("div",{className:"grid gap-3",children:[l.jsx("h4",{className:"text-sm font-medium text-neutral5",children:"Scores"}),l.jsx("div",{className:"grid gap-2",children:h.map(p=>{const m=c?.scores[p]??null,g=u?.scores[p]??null,v=m!=null&&g!=null?g-m:null;return l.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2 rounded-lg bg-surface2",children:[l.jsx("span",{className:"text-sm text-neutral5 font-medium",children:p}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"text-sm text-neutral3",children:[m!=null?m.toFixed(3):"-"," →"," ",g!=null?g.toFixed(3):"-"]}),v!=null&&l.jsx(pEe,{delta:v})]})]},p)})})]}),l.jsx(Yt.CodeSection,{title:l.jsxs(l.Fragment,{children:[l.jsx(hi,{color:"purple",children:"Baseline "})," Experiment Output"]}),icon:l.jsx(Yf,{}),codeStr:G5(c?.output)}),l.jsx(Yt.CodeSection,{title:l.jsxs(l.Fragment,{children:[l.jsx(hi,{color:"cyan",children:"Contender "})," Experiment Output"]}),icon:l.jsx(Yf,{}),codeStr:G5(u?.output)}),l.jsx(Yt.CodeSection,{title:"Item Input",icon:l.jsx(H0,{}),codeStr:G5(e.input)}),l.jsx(Yt.CodeSection,{title:"Item Ground Truth",icon:l.jsx(ttt,{}),codeStr:G5(e.groundTruth)})]})}):l.jsx(hr,{variant:"warning",title:"Comparison not available",children:l.jsx(hr.Message,{children:(()=>{const p=c?"Contender":"Baseline",m=c?s:r;return l.jsxs(l.Fragment,{children:["The ",p," experiment was run against dataset",m!=null?` v. ${m}`:"",", which does not contain this item."]})})()})})]})]})}function jts({items:e,baselineId:t,contenderId:n,scorerIds:r,featuredItemId:s,columns:a,onItemClick:i}){return l.jsx(Tn,{children:l.jsxs(Bt,{children:[l.jsxs(Bt.Header,{columns:a,children:[l.jsx(Bt.HeaderCol,{children:"Item ID"}),!s&&r.map(o=>l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:o},o))]}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:e.map(o=>{const c=o.results[t],u=o.results[n],d=!!(c&&u);return l.jsx(Bt.Row,{children:l.jsxs(Bt.RowButton,{item:{id:o.itemId},columns:a,isFeatured:s===o.itemId,onClick:i,children:[l.jsx(Bt.IdCell,{id:o.itemId,className:d?"":"text-neutral1"}),!s&&l.jsx(l.Fragment,{children:r.map(f=>{const h=c?.scores[f]??null,p=u?.scores[f]??null,m=h!=null&&p!=null?p-h:null;return l.jsx(Bt.Cell,{className:"flex items-center gap-5 justify-center font-mono",children:m!=null?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center text-neutral2 min-w-24",children:[h?.toFixed(2)," → ",p?.toFixed(2)]}),l.jsx(pEe,{delta:m})]}):l.jsx("span",{className:"text-neutral1",children:"-"})},f)})})]})},o.itemId)})})})]})})}const Nts={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 lKe({datasetId:e,experiment:t,type:n}){const{Link:r}=cn(),{label:s,color:a,customStyle:i}=Nts[n];if(!t)return null;const o=t.createdAt?new Date(t.createdAt):null;return l.jsxs("div",{className:`grid border-2 border-border1 rounded-lg p-5 gap-3 ${i}`,children:[l.jsxs("div",{className:"flex items-center gap-3 w-full overflow-clip",children:[n==="contender"&&l.jsxs(hi,{size:"small",color:a,children:[s,l.jsx(CS,{})]}),l.jsx(ce,{as:r,href:`/datasets/${e}/experiments/${t.id}`,children:l.jsx("span",{className:"truncate min-w-0",children:t.id})}),n==="baseline"&&l.jsxs(hi,{size:"small",color:a,children:[l.jsx(oh,{})," ",s]})]}),l.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-ui-sm text-neutral3",children:[l.jsxs(ms,{children:[l.jsx(ttt,{})," ",t.targetType," / ",t.targetId]}),l.jsxs(ms,{children:[l.jsx(Vet,{})," v",t.datasetVersion??"—"]}),o&&l.jsxs(ms,{children:[l.jsx(Net,{})," ",on(o,"MMM d, yyyy HH:mm")]})]})]})}function Ats({datasetId:e,experimentIdA:t,experimentIdB:n,onSwap:r}){const[s,a]=y.useState(null),{data:i,isLoading:o,error:c}=WJr(e,t,n),{data:u}=z8(e,t),{data:d}=z8(e,n),f=u&&d&&u.datasetVersion!==d.datasetVersion,h=y.useMemo(()=>{if(!i)return[];const j=new Set;for(const T of i.items)for(const N of Object.values(T.results))if(N)for(const I of Object.keys(N.scores))j.add(I);return[...j].sort()},[i]),p=y.useMemo(()=>{if(!i||h.length===0)return[];const j=i.baselineId,T=t===j?n:t;return h.map(N=>{let I=0,P=0,R=0,F=0;for(const z of i.items){const q=z.results[j]?.scores[N],W=z.results[T]?.scores[N];q!=null&&(I+=q,R++),W!=null&&(P+=W,F++)}const M=R>0?I/R:null,L=F>0?P/F:null,U=M!=null&&L!=null?L-M:null;return{scorerId:N,avgA:M,avgB:L,delta:U}})},[i,h,t,n]),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=y.useMemo(()=>[{name:"itemId",label:"Item ID",size:"8rem"},...s?[]:h.map(j=>({name:j,label:j,size:"1fr"}))],[h,s]),v=i?.items.find(j=>j.itemId===s)??null,x=j=>{a(j===s?null:j)},w=()=>{a(null)},S=()=>{if(!i||!s)return;const j=i.items.findIndex(T=>T.itemId===s);if(j>=0&&j<i.items.length-1)return()=>a(i.items[j+1].itemId)},_=()=>{if(!i||!s)return;const j=i.items.findIndex(T=>T.itemId===s);if(j>0)return()=>a(i.items[j-1].itemId)};if(o)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(Ut,{})});if(c)return l.jsx(hr,{variant:"warning",title:"Error loading comparison",children:l.jsx(hr.Message,{children:c instanceof Error?c.message:"Unknown error"})});if(!i||i.items.length===0)return l.jsx("div",{className:"text-neutral4 text-sm text-center py-8",children:"No comparison data"});const O=i.baselineId,E=t===O?n:t;return l.jsxs("div",{className:"grid gap-10",children:[u&&d&&l.jsxs("div",{className:Y("relative grid xl:grid-cols-[1fr_auto_1fr] gap-4 xl:gap-0"),children:[l.jsx(lKe,{datasetId:e,experiment:u,type:"baseline"}),l.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:l.jsx("div",{className:"relative z-1 bg-surface2 rounded-lg p-2",children:l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(ce,{onClick:r,children:"VS"})}),l.jsx(er,{children:"Switch the order"})]})})}),l.jsx(lKe,{datasetId:e,experiment:d,type:"contender"})]}),f&&l.jsx(hr,{variant:"warning",title:"Version mismatch",children:l.jsxs(hr.Message,{children:["These experiments used different dataset versions (v",u.datasetVersion," vs v",d.datasetVersion,"). Results may not be directly comparable."]})}),p.length>0&&l.jsxs(Bt,{children:[l.jsxs(Bt.Header,{columns:m,children:[l.jsx(Bt.HeaderCol,{children:"Scorer"}),l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:l.jsxs(L6e,{children:[l.jsx(hi,{color:"purple",size:"small",intensity:"muted",children:"Baseline"}),l.jsx(hi,{color:"purple",size:"small",children:"Avg"})]})}),l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:l.jsxs(L6e,{children:[l.jsx(hi,{color:"cyan",size:"small",intensity:"muted",children:"Contender"}),l.jsx(hi,{color:"cyan",size:"small",children:"Avg"})]})}),l.jsx(Bt.HeaderCol,{className:"flex justify-center",children:"Delta"})]}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:p.map(({scorerId:j,avgA:T,avgB:N,delta:I})=>l.jsxs(Bt.Row,{columns:m,children:[l.jsx(Bt.TextCell,{children:j}),l.jsx(Bt.TextCell,{className:"text-center font-mono",children:T!=null?T.toFixed(3):"-"}),l.jsx(Bt.TextCell,{className:"text-center font-mono",children:N!=null?N.toFixed(3):"-"}),l.jsx(Bt.TextCell,{className:"flex justify-center",children:I!=null?l.jsx(pEe,{delta:I}):"-"})]},j))})})]}),l.jsxs(sh,{className:Y({"grid-cols-[1fr_2fr]":!!v}),children:[l.jsx(jts,{items:i.items,baselineId:O,contenderId:E,scorerIds:h,featuredItemId:s,columns:g,onItemClick:x}),!!v&&l.jsx(Tts,{item:v,baselineId:O,contenderId:E,baselineVersion:u?.datasetVersion,contenderVersion:d?.datasetVersion,onPrevious:_(),onNext:S(),onClose:w})]})]})}function Its({datasetId:e,itemId:t,onVersionSelect:n,onCompareVersionsClick:r,activeVersion:s}){const{data:a,isLoading:i}=hEe(e,t),[o,c]=y.useState(!1),[u,d]=y.useState(new Set),f=x=>{n?.(x)},h=x=>s==null?x.isLatest:x.datasetVersion===s,p=x=>{d(w=>{const S=new Set(w);if(S.has(x))S.delete(x);else if(S.size>=2){const[_]=Array.from(S);return new Set([_,x])}else S.add(x);return S})},m=()=>{c(!1),d(new Set)},g=()=>{c(!0)},v=()=>{u.size===2&&r?.([...u])};return l.jsxs(Tn,{className:"min-w-56",children:[o?l.jsx(Tn.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:l.jsxs(ys,{children:[l.jsx(ce,{onClick:m,children:"Cancel"}),l.jsx(ss,{variant:"primary",disabled:u.size!==2,onClick:v,tooltipContent:u.size!==2?"Check 2 versions to compare":void 0,className:"grow",children:"Compare"})]})}):l.jsx(l.Fragment,{children:(a||[]).length>1&&l.jsx(Tn.Toolbar,{children:l.jsxs(ce,{onClick:g,className:"w-full",children:[l.jsx(uv,{})," Compare Ver."]})})}),i?l.jsx(Rts,{}):l.jsxs(Bt,{children:[l.jsx(Bt.Header,{children:l.jsx(Bt.HeaderCol,{children:"Item Version History"})}),l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:a?.map(x=>{const w=String(x.datasetVersion),S=typeof x.updatedAt=="string"?new Date(x.updatedAt):x.updatedAt;return l.jsxs(Bt.Row,{isSelected:o&&u.has(w),children:[o&&l.jsx(Bt.LabelCell,{children:l.jsx(Wi,{checked:u.has(w),disabled:x.isDeleted,onCheckedChange:()=>{},onClick:_=>{_.stopPropagation(),x.isDeleted||p(w)},"aria-label":`Select version ${x.datasetVersion}`})}),l.jsx(Bt.RowButton,{item:x,columns:[{name:"version",label:"Item Version History",size:"1fr"}],isFeatured:h(x),onClick:()=>f(x),className:"py-2",children:l.jsx(Bt.VersionCell,{version:x.datasetVersion,date:S,isLatest:x.isLatest,isDeleted:x.isDeleted})})]},String(x.datasetVersion))})})})]})]})}function Rts(){return l.jsxs(Bt,{children:[l.jsx(Bt.Header,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:l.jsx(Bt.HeaderCol,{children:"Item Version History"})}),l.jsx(Bt.Items,{children:Array.from({length:3}).map((e,t)=>l.jsx(Bt.Row,{children:l.jsx(Bt.RowButton,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:l.jsx(Bt.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}function Pts(e,t){if(t){const n=typeof t=="string"?new Date(t):t;return`v${e} ${on(n,"MMM dd 'at' H:mm:ss a")}`}return`v${e}`}function $ts({datasetId:e,versionA:t,versionB:n,onVersionChange:r}){const{data:s}=dEe(e),a=(s??[]).map(i=>({value:String(i.version),label:`${Pts(i.version,i.createdAt)}${i.isCurrent?" (current)":""}`}));return l.jsxs(Tn.Toolbar,{className:"grid grid-cols-[1fr_1fr_1fr_10rem] gap-4 w-full",children:[l.jsx("div",{}),l.jsx(_l,{label:"Version A",labelIsHidden:!0,name:"version-a",placeholder:"Select version",options:a,value:t??"",onValueChange:i=>r?.(i,n??"")}),l.jsx(_l,{label:"Version B",labelIsHidden:!0,name:"version-b",options:a,value:n??"",onValueChange:i=>r?.(t??"",i)}),l.jsx("div",{})]})}const Mts=[{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"}],Dts={added:{color:"blue",borderColor:"border-blue-900",icon:l.jsx(Rs,{}),tooltip:"Added in this version"},changed:{color:"orange",borderColor:"border-yellow-900",icon:l.jsx(Jet,{}),tooltip:"Changed in this version"},same:{color:"green",borderColor:"border-green-900",icon:l.jsx(EGt,{}),tooltip:"Same in both versions"}};function mle({red:e=!1,tooltip:t}){return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx(iZt,{className:Y("text-neutral3/40 w-5 h-5 ",{"text-red-900":e})})}),t&&l.jsx(er,{children:t})]})}function z1({variant:e,version:t}){if(!e)return l.jsxs("span",{className:"text-ui-md text-neutral4",children:["v. ",t]});const{color:n,icon:r,tooltip:s}=Dts[e];return l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[t!==void 0&&l.jsxs("span",{className:"pr-3 text-ui-md text-neutral4 min-w-16 flex justify-end",children:["v. ",t]}),l.jsx(hi,{color:n,size:"small",children:r})]})}),l.jsx(er,{children:s})]})}function Lts(e,t){return e&&t&&e.datasetVersion===t.datasetVersion?"same":e&&t&&e.datasetVersion!==t.datasetVersion?"changed":e?"added":"removed"}function zts({datasetId:e,versionA:t,versionB:n,allItems:r,itemsAMap:s,itemsBMap:a}){const{Link:i}=cn(),o=t>n;return l.jsx(Bt,{children:l.jsx(Bt.Scroller,{children:l.jsx(Bt.Items,{children:r.map(({id:c})=>{const u=s.get(c),d=a.get(c),f=Lts(u,d);return l.jsxs(Bt.Row,{columns:Mts,children:[l.jsx(Bt.IdCell,{id:c,isShortened:!1}),f!=="same"?l.jsxs(l.Fragment,{children:[u?.datasetVersion?l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!d&&o?l.jsx(z1,{variant:"added",version:u.datasetVersion}):f==="changed"&&o?l.jsx(z1,{variant:"changed",version:u.datasetVersion}):l.jsx(z1,{version:u.datasetVersion})}):l.jsx(Bt.Cell,{className:"justify-center flex items-center",children:l.jsx(mle,{red:o,tooltip:o?"Deleted in this version":"Not present in this version"})}),d?.datasetVersion?l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!u&&!o?l.jsx(z1,{variant:"added",version:d.datasetVersion}):f==="changed"&&!o?l.jsx(z1,{variant:"changed",version:d.datasetVersion}):l.jsx(z1,{version:d.datasetVersion})}):l.jsx(Bt.Cell,{className:"justify-center flex items-center",children:l.jsx(mle,{red:!o,tooltip:o?"Not present in this version":"Deleted in this version"})})]}):l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"col-span-2 gap-2",children:l.jsx(z1,{variant:"same",version:d?.datasetVersion})}),f==="changed"?l.jsx(Bt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}/versions?ids=${u?.datasetVersion},${d?.datasetVersion}`,children:"Compare"}):l.jsx(Bt.Cell,{children:l.jsx(mle,{tooltip:l.jsxs(l.Fragment,{children:["Comparing is available",l.jsx("br",{})," only for changed items"]})})})]},c)})})})})}const cKe={needsReview:"#facc15",complete:"#22c55e"},Fts=[{label:"Needs Review",color:cKe.needsReview},{label:"Reviewed",color:cKe.complete}];function Bts({reviewSummary:e,experiments:t,datasets:n,isLoading:r,isError:s}){const{data:a,maxVal:i,totalInPipeline:o}=y.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(n)for(const m of n)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 v=u.get(m.experimentId),x=v?.datasetId?d.get(v.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,n]),c=a.length>0;return l.jsxs(en,{children:[l.jsxs(en.TopBar,{children:[l.jsx(en.TitleAndDescription,{title:"Review Pipeline",description:"Items in review across experiments."}),c&&l.jsx(en.Summary,{value:String(o),label:"Items in pipeline"})]}),r?l.jsx(en.Loading,{}):s?l.jsx(en.Error,{message:"Failed to load review data"}):l.jsx(en.Content,{children:c?l.jsx(bT,{data:a,segments:Fts,maxVal:i,fmt:u=>String(u)}):l.jsx(en.NoData,{message:"No items have been sent to review yet"})})]})}function mEe(){const e=Ze();return Ct({queryKey:["experiment-review-summary"],queryFn:()=>e.getExperimentReviewSummary()})}function a6t(e){const t=new Map;if(!e?.counts)return t;for(const n of e.counts)t.set(n.experimentId,{needsReview:n.needsReview,complete:n.complete,total:n.total});return t}function Uts(e,t){const n=new Map,r=a6t(e);if(!r.size||!t)return n;for(const s of t){const a=r.get(s.id);if(!a||!s.datasetId||a.needsReview+a.complete===0)continue;const o=n.get(s.datasetId)??{needsReview:0,complete:0};o.needsReview+=a.needsReview,o.complete+=a.complete,n.set(s.datasetId,o)}return n}function qts(e){return e?.counts?e.counts.reduce((t,n)=>({needsReview:t.needsReview+n.needsReview,complete:t.complete+n.complete,inPipeline:t.inPipeline+n.needsReview+n.complete}),{needsReview:0,complete:0,inPipeline:0}):{needsReview:0,complete:0,inPipeline:0}}const Vts=10;function Hts(){const[e,t]=y.useState(!1),[n,r]=y.useState(""),[s,a]=y.useState("all"),[i,o]=y.useState("all"),[c,u]=y.useState("all"),[d,f]=y.useState(0),{data:h,isLoading:p,error:m}=Xp({page:d,perPage:Vts}),{data:g,isLoading:v,error:x}=GH(),{data:w}=mEe(),S=y.useMemo(()=>h?.datasets??[],[h?.datasets]),_=h?.pagination?.hasMore??!1,O=y.useMemo(()=>g?.experiments??[],[g?.experiments]),E=y.useMemo(()=>ues(S),[S]),j=y.useMemo(()=>Uts(w,O),[w,O]),T=p||v,N=m||x,I=()=>t(!0),P=y.useCallback(()=>f(W=>W+1),[]),R=y.useCallback(()=>f(W=>Math.max(0,W-1)),[]),F=y.useCallback(W=>{r(W),f(0)},[]),M=y.useCallback(W=>{a(W),f(0)},[]),L=y.useCallback(W=>{o(W),f(0)},[]),U=y.useCallback(W=>{u(W),f(0)},[]);if(N&&Hs(N))return l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(pa,{})});if(N&&Ps(N))return l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(aa,{resource:"datasets"})});if(N)return l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(dc,{title:"Failed to load datasets",message:N.message})});if(S.length===0&&!T&&d===0)return l.jsxs(l.Fragment,{children:[l.jsx(lr,{title:"Datasets",icon:l.jsx(Ja,{}),children:l.jsx(des,{onCreateClick:I})}),l.jsx(_me,{open:e,onOpenChange:t})]});const z=s!=="all"||i!=="all"||c!=="all"||n!=="",q=()=>{r(""),a("all"),o("all"),u("all"),f(0)};return l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:T,children:[l.jsx(Ja,{})," Datasets"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsx(ss,{onClick:I,tooltipContent:"Create a dataset",children:l.jsx(Rs,{})}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Datasets documentation",children:l.jsx(yo,{})})]})]}),l.jsx(hes,{search:n,onSearchChange:F,targetFilter:s,onTargetFilterChange:M,experimentFilter:i,onExperimentFilterChange:L,tagFilter:c,onTagFilterChange:U,tagOptions:E,onReset:q,hasActiveFilters:z})]}),l.jsx(oes,{datasets:S,experiments:O,reviewByDataset:j,isLoading:T,search:n,targetFilter:s,experimentFilter:i,tagFilter:c,currentPage:d,hasMore:_,onNextPage:P,onPrevPage:R}),l.jsx(_me,{open:e,onOpenChange:t})]})}const Wts=new Set(["items","experiments","review"]);function Zts(){const{datasetId:e}=Sa(),t=id(),[n,r]=wo(),s=n.get("tab"),a=s&&Wts.has(s)?s:"items",i=E=>{r(E==="items"?{}:{tab:E},{replace:!0})},[o,c]=y.useState(!1),[u,d]=y.useState(!1),[f,h]=y.useState(!1),[p,m]=y.useState(!1),[g,v]=y.useState(null),{data:x,error:w}=Qv(e??"");if(!e)return l.jsx(Jn,{children:l.jsx(mh,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&Hs(w))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})});if(w&&Ps(w))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})});const S=E=>{t(`/datasets/${e}/experiments/${E}`)},_=()=>{t("/datasets")},O=E=>{v(E?.version??null)};return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(bes,{value:e,variant:"ghost"})})]})}),l.jsxs(mh,{className:"content-stretch",children:[l.jsx(rts,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:O,initialTab:a,onTabChange:i,experimentTriggerSlot:l.jsxs(ce,{variant:"primary",onClick:()=>c(!0),children:[l.jsx(fb,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),l.jsx(cts,{datasetId:e,version:g??void 0,open:o,onOpenChange:c,onSuccess:S}),l.jsx(ats,{datasetId:e,open:u,onOpenChange:d}),x&&l.jsx(ves,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&l.jsx(yes,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:_})]})]})}function Gts(){const{datasetId:e,experimentId:t}=Sa(),{data:n}=Qv(e??""),{data:r,isLoading:s,error:a}=z8(e,t),{data:i,isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=ZH({datasetId:e,experimentId:t,experimentStatus:r?.status});return!e||!t?null:s?l.jsx(Jn,{children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ut,{})})}):a&&Hs(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):a&&Ps(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):a||!r?l.jsx(Jn,{children:l.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:n?.name}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsx(s6t,{experimentId:t,experiment:r}),l.jsx(r6t,{experimentId:t,experimentStatus:r?.status,results:i??[],isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function Qts(){const{datasetId:e}=Sa(),[t,n]=wo(),{data:r,error:s}=Qv(e??""),a=t.get("baseline")??"",i=t.get("contender")??"";return s&&Hs(s)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):s&&Ps(s)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):!e||!a||!i?l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsxs(Bn,{isCurrent:!0,as:"span",children:[l.jsx(Ne,{children:l.jsx(uv,{})}),"Compare Experiments"]})]})}),l.jsx(mh,{children:l.jsxs("div",{className:"text-neutral4 text-center py-8",children:[l.jsx("p",{children:"Select two experiments to compare."}),l.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:r?.name??e?.slice(0,8)}),l.jsxs(Bn,{isCurrent:!0,as:"span",children:[l.jsx(Ne,{children:l.jsx(uv,{})}),"Experiments Comparison"]})]})}),l.jsx(mh,{children:l.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(uv,{})," Dataset Experiments Comparison"]}),l.jsxs(Hn.Description,{children:["Comparing"," ",l.jsx(ln,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",l.jsx(ln,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),l.jsx(Hn.Column,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}`,children:[l.jsx(oh,{}),"Back to Dataset"]})})]}),l.jsx(Ats,{datasetId:e,experimentIdA:a,experimentIdB:i,onSwap:()=>{n({baseline:i,contender:a})}})]})})]})}function Yts(){const{datasetId:e,itemId:t}=Sa(),{Link:n}=cn(),r=id(),{data:s,isLoading:a,error:i}=hEe(e??"",t??""),{updateItem:o,deleteItem:c}=$i(),{data:u}=Qv(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[h,p]=y.useState(null),m=y.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,[v,x]=y.useState(!1),[w,S]=y.useState(m.input),[_,O]=y.useState(m.groundTruth),[E,j]=y.useState(m.metadata),[T,N]=y.useState(g);g!==T&&(N(g),S(m.input),O(m.groundTruth),j(m.metadata));const[I,P]=y.useState(!1),R=V=>{p(f?V:V.isLatest?null:V)},F=()=>{p(null)},M=!f&&h!=null,L=()=>{M||x(!0)},U=()=>{M||P(!0)},z=async()=>{if(!e||!t)return;let V;try{V=JSON.parse(w)}catch{ze.error("Input must be valid JSON");return}let $;if(_.trim())try{$=JSON.parse(_)}catch{ze.error("Ground Truth must be valid JSON");return}let Z;if(E.trim())try{Z=JSON.parse(E)}catch{ze.error("Metadata must be valid JSON");return}try{await o.mutateAsync({datasetId:e,itemId:t,input:V,groundTruth:$,metadata:Z}),ze.success("Item updated successfully"),x(!1)}catch(G){ze.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},q=()=>{d&&(S(JSON.stringify(d.input,null,2)),O(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),j(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),ze.success("Item deleted successfully"),P(!1),r(`/datasets/${e}`)}catch(V){ze.error(`Failed to delete item: ${V instanceof Error?V.message:"Unknown error"}`)}},D=h??d,Q=D?{id:t??"",datasetId:e??"",datasetVersion:D.datasetVersion,input:D.input,groundTruth:D.groundTruth,metadata:D.metadata,createdAt:D.createdAt,updatedAt:D.updatedAt}:null;return i&&Hs(i)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):i&&Ps(i)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?l.jsx(Jn,{children:l.jsx(mh,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):l.jsxs(l.Fragment,{children:[l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:u?.name}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Item"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(V0,{}),t," ",l.jsx(da,{content:t})]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:["Item of ",l.jsx(Ja,{})," ",u?.name]})}),l.jsxs(Hn.Description,{children:[l.jsxs(ms,{children:[l.jsx(TC,{})," Created at"," ",d?.createdAt?on(new Date(d.createdAt),"MMM d, yyyy"):""]}),l.jsxs(ms,{children:[l.jsx(Ew,{})," Latest version v",d?.datasetVersion??""]})]})]}),l.jsx(Hn.Column,{children:!v&&!f&&l.jsxs(ys,{children:[l.jsxs(ce,{onClick:L,disabled:M,title:M?"Return to latest version to edit":void 0,children:[l.jsx(Jet,{})," Edit"]}),l.jsxs(ce,{onClick:U,disabled:M,title:M?"Return to latest version to delete":void 0,children:[l.jsx(Kd,{})," Delete"]})]})})]}),l.jsxs(sh,{className:v?"grid-cols-1":"grid-cols-[1fr_auto]",children:[l.jsxs(Tn,{withRightSeparator:!v,children:[f&&d&&l.jsx(hr,{variant:"destructive",title:"Item deleted",children:l.jsxs(hr.Message,{children:["This item was deleted at version v",d.datasetVersion]})}),!f&&M&&h&&l.jsx(hr,{variant:"warning",title:"Previous version",action:l.jsxs(hr.Button,{onClick:F,children:[l.jsx(tS,{})," Return to the latest version"]}),children:l.jsxs(hr.Message,{children:["Viewing version v",h.datasetVersion]})}),v?l.jsx(Y5t,{inputValue:w,setInputValue:S,groundTruthValue:_,setGroundTruthValue:O,metadataValue:E,setMetadataValue:j,validationErrors:null,onSave:z,onCancel:q,isSaving:o.isPending}):Q?l.jsx(QH,{item:Q,Link:n}):l.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!v&&l.jsx(Tn,{children:l.jsx(Its,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:V=>{r(`/datasets/${e}/items/${t}/versions?ids=${V.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),l.jsx(Wt,{open:I,onOpenChange:P,children:l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Delete Item"}),l.jsx(Wt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{children:"Cancel"}),l.jsx(Wt.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function uKe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Xts(){const{datasetId:e}=Sa(),[t,n]=wo(),r=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=Qv(e??""),{Link:i}=cn(),[o,c]=y.useState(!1),{data:u}=wme(e??"",r[0]??""),{data:d}=wme(e??"",r[1]??"");return a&&Hs(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):a&&Ps(a)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):!e||r.length<2?l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),l.jsx(mh,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two items to compare."})})})]}):l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Items"})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}`,variant:"outline",children:[l.jsx(Ne,{children:l.jsx(oh,{})}),"Back to Dataset"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":o}),children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(uv,{}),"Compare Dataset Items"]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:["Comparing ",r.length," items of"," ",l.jsx(ln,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),l.jsx(Hn.Column,{children:l.jsxs(ys,{children:[l.jsxs(ce,{as:ln,to:`/datasets/${e}`,children:[l.jsx(oh,{}),"Back to Dataset"]}),l.jsx(ce,{variant:"primary",onClick:()=>c(f=>!f),children:o?l.jsxs(l.Fragment,{children:[l.jsx(Bet,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(yGt,{})," Diff View"]})})]})})]}),l.jsx(sh,{className:"grid-cols-[1fr_3vw_1fr]",children:r.map((f,h)=>l.jsxs(y.Fragment,{children:[l.jsx(Kts,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:r,showContent:!o,onItemChange:p=>{const m=[...r];m[h]=p,n({items:m.join(",")})}}),h==0&&l.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),o&&u&&d&&l.jsx(Vkt,{codeA:uKe(u),codeB:uKe(d)})]})})]})}function Kts({datasetId:e,itemId:t,Link:n,idx:r,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:o,isLoading:c}=wme(e,t),{data:u}=ej(e),d=new Set(s.filter((h,p)=>p!==r)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return l.jsxs(Tn,{children:[l.jsxs(Tn.Toolbar,{className:"flex gap-4",children:[l.jsx(h1e,{label:"Item",name:`compare-item-${r}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),l.jsxs(ce,{as:n,to:`/datasets/${e}/items/${t}`,children:[l.jsx(Ew,{}),"Versions"]})]}),i&&l.jsx(Tn.Content,{children:c?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):o?l.jsxs(l.Fragment,{children:[l.jsx(X5t,{item:o}),l.jsx(QH,{item:o,Link:n})]}):l.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function dKe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Jts(){const{datasetId:e,itemId:t}=Sa(),[n,r]=wo(),[s,a]=y.useState(!1),i=n.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:o,error:c}=Qv(e??""),{Link:u}=cn(),{data:d}=hEe(e??"",t??""),{data:f}=Eme(e??"",t??"",i[0]??0,o?.version),{data:h}=Eme(e??"",t??"",i[1]??0,o?.version);return c&&Hs(c)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):c&&Ps(c)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):!e||!t||i.length<2?l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(mh,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]}):l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:o?.name}),l.jsx(Bn,{as:ln,to:`/datasets/${e}/items/${t}`,children:"Item"}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[l.jsx(Ne,{children:l.jsx(oh,{})}),"Back to Item"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(uv,{}),"Compare Dataset Item Versions"]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:["Comparing ",i.length," versions of"," ",l.jsx(ln,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),l.jsx(Hn.Column,{children:l.jsxs(ys,{children:[l.jsxs(ce,{as:ln,to:`/datasets/${e}/items/${t}`,children:[l.jsx(oh,{}),"Back to Item"]}),l.jsx(ce,{variant:"primary",onClick:()=>a(p=>!p),children:s?l.jsxs(l.Fragment,{children:[l.jsx(Bet,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(tQt,{})," Diff View"]})})]})})]}),l.jsx(sh,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>l.jsxs(y.Fragment,{children:[l.jsx(ens,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:o?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!s,onVersionChange:g=>{const v=[...i];v[m]=g,r({ids:v.join(",")})}}),m===0&&l.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),s&&f&&h&&l.jsx(Vkt,{codeA:dKe(f),codeB:dKe(h)})]})})]})}function ens({datasetId:e,itemId:t,datasetVersion:n,latestVersion:r,allVersions:s,versionNumbers:a,Link:i,idx:o,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=Eme(e,t,n,r),h=new Set(a.filter((g,v)=>v!==o)),p=s.map(g=>{const v=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:l.jsxs(l.Fragment,{children:[l.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",on(v,"MMM d, yyyy h:mm a"),g.isLatest?l.jsx(hi,{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 l.jsxs(Tn,{children:[l.jsxs(Tn.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[l.jsx(Ew,{className:"w-6 h-6 opacity-50"}),l.jsx(h1e,{label:"Version",name:`compare-version-${o}`,value:String(n),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&l.jsx(Tn.Content,{children:f?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?l.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",n," not found"]}):l.jsx(QH,{item:m,Link:i})})]})}function tns(){const{datasetId:e}=Sa(),[t]=wo(),n=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],r=id(),{data:s,error:a}=Qv(e??""),i=ej(e??"",void 0,n[0]??null),o=ej(e??"",void 0,n[1]??null),c=y.useMemo(()=>i.data??[],[i.data]),u=y.useMemo(()=>o.data??[],[o.data]),d=y.useMemo(()=>{const g=new Map;for(const v of[...c,...u])g.has(v.id)||g.set(v.id,{id:v.id,createdAt:new Date(v.createdAt)});return[...g.values()].sort((v,x)=>x.createdAt.getTime()-v.createdAt.getTime())},[c,u]),f=y.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=y.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(a&&Hs(a))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})});if(a&&Ps(a))return l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})});if(!e||n.length<2)return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(mh,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,v,x)=>{r(`/datasets/${e}/items/${g}/versions?ids=${v?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,v)=>{r(`/datasets/${e}/versions?ids=${g},${v}`,{replace:!0})};return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/datasets",children:[l.jsx(Ne,{children:l.jsx(Ja,{})}),"Datasets"]}),l.jsx(Bn,{as:ln,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),l.jsxs(Bn,{isCurrent:!0,as:"span",children:[l.jsx(Ne,{children:l.jsx(XNe,{})}),"Compare Versions"]})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(Hn,{children:[l.jsxs(Hn.Column,{children:[l.jsxs(Hn.Title,{children:[l.jsx(XNe,{})," Compare Dataset Versions"]}),l.jsx(Hn.Description,{children:l.jsxs(ms,{children:[l.jsx(Ew,{})," Comparing ",n.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),l.jsx(Hn.Column,{children:l.jsxs(ce,{as:ln,to:`/datasets/${e}`,children:[l.jsx(oh,{}),"Back to Dataset"]})})]}),l.jsx(sh,{children:l.jsxs(Tn,{children:[l.jsx($ts,{datasetId:e,versionA:String(n[0]),versionB:String(n[1]),onVersionChange:m}),l.jsx(zts,{datasetId:e,versionA:n[0],versionB:n[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}function nns(e){if(!e||e.length<2)return null;const t=[...e].sort((i,o)=>new Date(i.createdAt).getTime()-new Date(o.createdAt).getTime()),n=Math.floor(t.length/2),r=n,s=t.length-n;if(r===0)return null;const a=(s-r)/r*100;return{changePct:Math.round(a*10)/10,prevValue:String(r)}}function rns({scorers:e,datasets:t,experiments:n,avgScore:r,prevAvgScore:s,totalNeedsReview:a,isLoadingScorers:i,isLoadingDatasets:o,isLoadingExperiments:c,isLoadingScores:u,isLoadingReview:d}){const f=e?Object.keys(e).length:void 0,h=t?.length,p=n?.length,m=r!=null&&s!=null&&s!==0?{changePct:Math.round((r-s)/s*100*10)/10,prevValue:String(s)}:null,g=nns(n);return l.jsxs(l.Fragment,{children:[l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Total Scorers"}),i?l.jsx(Hr.Loading,{}):f!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(f)}),l.jsx(Hr.NoChange,{message:"Static count"})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Total Datasets"}),o?l.jsx(Hr.Loading,{}):h!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(h)}),l.jsx(Hr.NoChange,{message:"Static count"})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Avg Score"}),u?l.jsx(Hr.Loading,{}):r!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(r)}),m?l.jsx(Hr.Change,{changePct:m.changePct,prevValue:m.prevValue}):l.jsx(Hr.NoChange,{})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Total Experiments"}),c?l.jsx(Hr.Loading,{}):p!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(p)}),g?l.jsx(Hr.Change,{changePct:g.changePct,prevValue:g.prevValue}):l.jsx(Hr.NoChange,{})]}):l.jsx(Hr.NoData,{})]}),l.jsxs(Hr,{children:[l.jsx(Hr.Label,{children:"Needs Review"}),d?l.jsx(Hr.Loading,{}):a!=null?l.jsxs(l.Fragment,{children:[l.jsx(Hr.Value,{children:String(a)}),a>0?l.jsx(Hr.NoChange,{message:"items pending review"}):l.jsx(Hr.NoChange,{message:"All caught up"})]}):l.jsx(Hr.NoData,{})]})]})}const sns=[{value:"all",label:"All statuses"},{value:"completed",label:"Completed"},{value:"running",label:"Running"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}],fKe="auto 1fr auto auto auto auto auto auto auto";function ans(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const ins={completed:"success",running:"warning",failed:"error",pending:"neutral"};function ons({experiments:e,datasets:t,reviewByExperiment:n,isLoading:r,search:s="",statusFilter:a="all",datasetFilter:i="all"}){const{paths:o,Link:c}=cn(),u=y.useMemo(()=>{const h=new Map;return t?.forEach(p=>h.set(p.id,p.name)),h},[t]),d=y.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=y.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),v=a==="all"||p.status===a,x=i==="all"||p.datasetId===i;return g&&v&&x})},[d,s,u,a,i]);return r?l.jsx(qd,{columns:fKe}):l.jsxs(xe,{columns:fKe,children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Experiment"}),l.jsx(xe.TopCell,{children:"Dataset"}),l.jsx(xe.TopCell,{children:"Target"}),l.jsx(xe.TopCell,{children:"Status"}),l.jsx(xe.TopCell,{className:"text-center",children:"Items"}),l.jsx(xe.TopCell,{className:"text-center",children:"Succeeded"}),l.jsx(xe.TopCell,{className:"text-center",children:"Failed"}),l.jsx(xe.TopCell,{className:"text-center",children:"Review"}),l.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,v=h.failedCount??0,x=h.totalItems??0,w=x>0?Math.round(g/x*100):0;return l.jsxs(xe.RowLink,{to:o.experimentLink(h.id),LinkComponent:c,children:[l.jsx(xe.NameCell,{className:"font-mono",children:h.id.slice(0,8)}),l.jsx(xe.TextCell,{children:p}),l.jsx(xe.Cell,{children:l.jsxs("span",{className:"truncate",children:[h.targetType," ",h.targetId]})}),l.jsx(xe.Cell,{children:l.jsx(Nk,{variant:ins[m]??"neutral",withDot:!0,children:m})}),l.jsx(xe.TextCell,{className:"text-center",children:x}),l.jsx(xe.TextCell,{className:"text-center",children:l.jsxs("span",{className:g>0?"text-accent1":"",children:[g," (",w,"%)"]})}),l.jsx(xe.TextCell,{className:"text-center",children:l.jsx("span",{className:v>0?"text-accent2":"",children:v})}),l.jsx(xe.Cell,{className:"text-center",children:(()=>{const S=n?.get(h.id);if(!S)return l.jsx("span",{className:"text-neutral2",children:"—"});const _=S.needsReview+S.complete;return _===0?l.jsx("span",{className:"text-neutral2",children:"—"}):S.needsReview>0?l.jsxs(_t,{variant:"warning",children:[S.needsReview," pending"]}):l.jsxs(_t,{variant:"success",children:[S.complete,"/",_," reviewed"]})})()}),l.jsx(xe.TextCell,{children:ans(h.createdAt)})]},h.id)})]})}function lns(e){return[{value:"all",label:"All datasets"},...(e??[]).map(t=>({value:t.id,label:t.name}))]}const Q5={completed:"#22c55e",running:"#facc15",pending:"#fb923c",failed:"#f87171"},cns=[{label:"Completed",color:Q5.completed},{label:"Running",color:Q5.running},{label:"Pending",color:Q5.pending},{label:"Failed",color:Q5.failed}];function uns({experiments:e,datasets:t,isLoading:n,isError:r}){const{data:s,maxVal:a}=y.useMemo(()=>{if(!e||e.length===0)return{data:[],maxVal:0};const o=new Map;if(t)for(const f of t)o.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:o.get(f)??f.slice(0,12),values:[h.completed,h.running,h.pending,h.failed]}}),maxVal:u}},[e,t]),i=s.length>0;return l.jsxs(en,{children:[l.jsxs(en.TopBar,{children:[l.jsx(en.TitleAndDescription,{title:"Experiments by Dataset",description:"Experiment status breakdown per dataset."}),i&&l.jsx(en.Summary,{value:String(e?.length??0),label:"Total experiments"})]}),n?l.jsx(en.Loading,{}):r?l.jsx(en.Error,{message:"Failed to load experiments data"}):l.jsx(en.Content,{children:i?l.jsx(bT,{data:s,segments:cns,maxVal:a,fmt:o=>String(o)}):l.jsx(en.NoData,{message:"No experiments have been run yet"})})]})}const dns=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Experiments yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Run an experiment from a dataset to evaluate ",l.jsx("br",{}),"your agents and workflows."]}),actionSlot:l.jsx("div",{className:"flex flex-col items-center gap-2",children:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",children:["Experiments Documentation ",l.jsx(Va,{})]})})})});function fns({search:e,onSearchChange:t,statusFilter:n,onStatusFilterChange:r,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:i,onReset:o,hasActiveFilters:c}){return l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(sg,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",value:e,onSearch:t}),l.jsxs(ys,{children:[l.jsx(_l,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...sns],value:n,onValueChange:r,className:"whitespace-nowrap"}),l.jsx(_l,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:i,value:s,onValueChange:a,className:"whitespace-nowrap"}),o&&c&&l.jsxs(ce,{onClick:o,size:"sm",variant:"default",children:[l.jsx(qr,{className:"size-3"})," Reset"]})]})]})}function hns(){const{data:e,isLoading:t,error:n}=uf(),{data:r,isLoading:s,error:a}=Xp(),{data:i,isLoading:o,error:c}=GH(),{data:u,isLoading:d,isError:f,error:h}=uGr(),{data:p,isLoading:m,isError:g,error:v}=mEe(),x=r?.datasets,w=i?.experiments,S=y.useMemo(()=>qts(p),[p]),_=n||a||c||h||v;return _&&Hs(_)?l.jsx(lr,{title:"Evaluation",icon:l.jsx(_d,{}),children:l.jsx(pa,{})}):_&&Ps(_)?l.jsx(lr,{title:"Evaluation",icon:l.jsx(_d,{}),children:l.jsx(aa,{resource:"evaluation"})}):_?l.jsx(lr,{title:"Evaluation",icon:l.jsx(_d,{}),children:l.jsx(dc,{title:"Failed to load evaluation data",message:_.message})}):l.jsxs(ht,{width:"wide",height:"full",children:[l.jsx(ht.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(_d,{})," Evaluation"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Evaluation documentation",children:l.jsx(yo,{})})})]})}),l.jsxs("div",{className:"flex flex-col gap-6 pt-4",children:[l.jsx(Wfe,{children:l.jsx(rns,{scorers:e,datasets:x,experiments:w,avgScore:u?.avgScore??null,prevAvgScore:u?.prevAvgScore??null,totalNeedsReview:S.needsReview,isLoadingScorers:t,isLoadingDatasets:s,isLoadingExperiments:o,isLoadingScores:d,isLoadingReview:m})}),l.jsx(JZr,{summaryData:u?.summaryData??[],overTimeData:u?.overTimeData??[],scorerNames:u?.scorerNames??[],avgScore:u?.avgScore??null,isLoading:d,isError:f}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[l.jsx(fes,{experiments:w,isLoading:o,isError:!!c}),l.jsx(uns,{experiments:w,datasets:x,isLoading:o,isError:!!c})]}),l.jsx(Bts,{reviewSummary:p,experiments:w,datasets:x,isLoading:m,isError:!!g})]})]})}function pns(){const[e,t]=y.useState(""),[n,r]=y.useState("all"),[s,a]=y.useState("all"),{data:i,isLoading:o,error:c}=Xp(),{data:u,isLoading:d,error:f}=GH(),{data:h}=mEe(),p=y.useMemo(()=>i?.datasets??[],[i?.datasets]),m=y.useMemo(()=>u?.experiments??[],[u?.experiments]),g=y.useMemo(()=>lns(p),[p]),v=y.useMemo(()=>a6t(h),[h]),x=o||d,w=f||c;if(w&&Hs(w))return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(pa,{})});if(f&&Ps(f))return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(aa,{resource:"experiments"})});if(c&&Ps(c))return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(aa,{resource:"datasets"})});if(w)return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(dc,{title:"Failed to load experiments",message:w.message})});if(m.length===0&&!x)return l.jsx(lr,{title:"Experiments",icon:l.jsx(_d,{}),children:l.jsx(dns,{})});const S=n!=="all"||s!=="all"||e!=="",_=()=>{t(""),r("all"),a("all")};return l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:x,children:[l.jsx(_d,{})," Experiments"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Experiments documentation",children:l.jsx(yo,{})})})]}),l.jsx(fns,{search:e,onSearchChange:t,statusFilter:n,onStatusFilterChange:r,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:g,onReset:_,hasActiveFilters:S})]}),l.jsx(ons,{experiments:m,datasets:p,reviewByExperiment:v,isLoading:x,search:e,statusFilter:n,datasetFilter:s})]})}function mns(){const{experimentId:e}=Sa(),{data:t,isLoading:n}=GH(),s=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:a,isLoading:i,error:o}=z8(s,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=ZH({datasetId:s,experimentId:e??"",experimentStatus:a?.status});return e?n||i||!s?l.jsx(Jn,{children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ut,{})})}):o&&Hs(o)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})}):o&&Ps(o)?l.jsx(Jn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"datasets"})})}):o||!a?l.jsx(Jn,{children:l.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",o instanceof Error?o.message:"Unknown error"]})}):l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/experiments",children:[l.jsx(Ne,{children:l.jsx(_d,{})}),"Experiments"]}),l.jsx(Bn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsx(s6t,{experimentId:e,experiment:a}),l.jsx(r6t,{experimentId:e,experimentStatus:a?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function i6t({redirectUri:e,onSuccess:t,initialMode:n="signin",errorMessage:r}){const{data:s,isLoading:a}=Gj(),{mutate:i,isPending:o,error:c}=wJr(),{mutate:u,isPending:d,error:f}=SJr(),{mutate:h,isPending:p}=Z5t(),[m,g]=y.useState(n),[v,x]=y.useState(""),[w,S]=y.useState(""),[_,O]=y.useState("");if(a)return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:l.jsx("div",{className:"text-neutral3",children:"Loading..."})});if(!s?.enabled||!s?.login)return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:l.jsx("div",{className:"text-neutral3",children:"Authentication is not configured"})});const{login:E}=s,j=E.type==="sso"||E.type==="both",T=E.type==="credentials"||E.type==="both",N=E.sso,I=E.signUpEnabled!==!1,P=m==="signin"||!I,R=P?o:d,F=P?c:f,M=()=>{t?t():e?window.location.href=e:window.location.href="/"},L=q=>{q.preventDefault(),P?i({email:w,password:_},{onSuccess:M}):u({email:w,password:_,name:v||void 0},{onSuccess:M})},U=()=>{h({redirectUri:e},{onSuccess:q=>{window.location.href=q.url}})},z=()=>{g(P?"signup":"signin")};return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:l.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border1 bg-surface2 p-8",children:[l.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[l.jsx(lb,{className:"h-10 w-10"}),l.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:P?"Sign in to Mastra Studio":"Create your account"})]}),E.description&&l.jsxs("div",{className:"flex items-start gap-2.5 rounded-md border border-border1 bg-surface1 p-3",children:[l.jsx(Wet,{className:"mt-0.5 h-4 w-4 shrink-0 text-neutral4"}),l.jsx("p",{className:"text-sm text-neutral3",children:E.description})]}),r&&l.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:r}),T&&l.jsxs("form",{onSubmit:L,className:"space-y-4",children:[!P&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"name",className:"block text-sm text-neutral4",children:"Name"}),l.jsx(mn,{id:"name",type:"text",value:v,onChange:q=>x(q.target.value),placeholder:"Your name",variant:"default",size:"lg"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"email",className:"block text-sm text-neutral4",children:"Email"}),l.jsx(mn,{id:"email",type:"email",value:w,onChange:q=>S(q.target.value),placeholder:"you@example.com",required:!0,variant:"default",size:"lg"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"password",className:"block text-sm text-neutral4",children:"Password"}),l.jsx(mn,{id:"password",type:"password",value:_,onChange:q=>O(q.target.value),placeholder:P?"Enter your password":"Create a password",required:!0,variant:"default",size:"lg"})]}),F&&l.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:F.message}),l.jsx(ce,{type:"submit",disabled:R,className:"w-full",size:"lg",children:R?P?"Signing in...":"Creating account...":P?"Sign in":"Create account"}),I&&l.jsxs("div",{className:"text-center text-sm",children:[l.jsx("span",{className:"text-neutral3",children:P?"Don't have an account? ":"Already have an account? "}),l.jsx("button",{type:"button",onClick:z,className:"text-neutral6 hover:underline",children:P?"Sign up":"Sign in"})]})]}),j&&T&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 flex items-center",children:l.jsx("div",{className:"w-full border-t border-border1"})}),l.jsx("div",{className:"relative flex justify-center text-sm",children:l.jsx("span",{className:"bg-surface2 px-2 text-neutral3",children:"or continue with"})})]}),j&&N&&l.jsxs(ce,{onClick:U,disabled:p,className:"w-full",size:"lg",variant:"outline",children:[N.icon&&l.jsx("span",{className:"mr-2",children:N.icon}),p?"Redirecting...":N.text||"Sign in"]})]})})}function gns(){const[e]=wo(),t=id(),n=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(i6t,{redirectUri:n,onSuccess:i,initialMode:s,errorMessage:a})}function vns(){const[e,t]=wo(),n=$ar(e,t),r=Lar(e,t),[s,a]=y.useState(),[i,o]=y.useState(!1),{data:c=[],isPending:u}=I_t(),{data:d=[],isPending:f}=R_t({entityType:n.selectedEntityOption?.entityType,rootOnly:!0}),{data:h=[],isPending:p}=P_t(),{data:m=[],isPending:g}=$_t(),v=y.useMemo(()=>Tar({availableTags:c,availableRootEntityNames:d,availableServiceNames:m,availableEnvironments:h,loading:{tags:u,entityNames:f,serviceNames:g,environments:p}}),[c,d,m,h,u,f,g,p]),x=y.useMemo(()=>Iar({rootEntityType:n.selectedEntityOption?.entityType,dateFrom:n.selectedDateFrom,dateTo:n.selectedDateTo,tokens:n.filterTokens}),[n.filterTokens,n.selectedDateFrom,n.selectedDateTo,n.selectedEntityOption]),{data:w=[],isLoading:S,error:_,isFetchingNextPage:O,hasNextPage:E,setEndOfListElement:j}=Sar({filters:x}),{logIdMap:T,featuredLog:N,handleLogClick:I,handlePreviousLog:P,handleNextLog:R}=Bar(w,n.featuredLogId,n.handleFeaturedChange,n.featuredTraceId),{data:F,isLoading:M}=qwe(n.featuredTraceId??null),{data:L,isLoading:U}=Ak(n.featuredTraceId??"",n.featuredSpanId??""),z=y.useCallback(()=>n.applyFilterTokens(Rar(v,n.filterTokens)),[v,n]),q=y.useCallback(()=>n.handleFeaturedChange({logId:null}),[n]),W=y.useCallback(G=>n.handleFeaturedChange({traceId:G,spanId:null}),[n]),D=y.useCallback((G,J)=>n.handleFeaturedChange({traceId:G,spanId:J}),[n]),Q=y.useCallback(()=>{n.handleFeaturedChange({traceId:null,spanId:null}),o(!1)},[n]),V=y.useCallback(()=>n.handleFeaturedChange({spanId:null}),[n]),$=y.useCallback(G=>n.handleFeaturedChange({spanId:G??null}),[n]),Z=l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:S,children:[l.jsx(Zet,{})," Logs"]})})}),l.jsxs(ht.Column,{className:"flex justify-end items-center gap-2",children:[l.jsx(d_t,{preset:n.datePreset,onPresetChange:n.handleDatePresetChange,dateFrom:n.selectedDateFrom,dateTo:n.selectedDateTo,onDateChange:n.handleDateChange,disabled:S,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),l.jsx(mkt,{fields:v,tokens:n.filterTokens,onTokensChange:n.handleFilterTokensChange,disabled:S,onStartTextFilter:a}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/observability/logging",target:"_blank",rel:"noopener noreferrer","aria-label":"Logs documentation",tooltipContent:"Go to Logs documentation",children:l.jsx(yo,{})})]})]}),l.jsx(har,{isLoading:S,filterFields:v,filterTokens:n.filterTokens,onFilterTokensChange:n.handleFilterTokensChange,onClear:z,onRemoveAll:n.handleRemoveAll,onSave:r.handleSave,onRemoveSaved:r.hasSavedFilters?r.handleRemoveSaved:void 0,autoFocusFilterFieldId:s})]});return _?l.jsxs(ht,{width:"wide",height:"full",children:[Z,l.jsx(ht.MainArea,{isCentered:!0,children:l.jsx(lar,{error:_,resource:"logs",errorTitle:"Failed to load logs"})})]}):w.length===0&&!S&&n.filterTokens.length===0?l.jsxs(ht,{width:"wide",height:"full",children:[Z,l.jsx(ht.MainArea,{isCentered:!0,children:l.jsx(yar,{datePreset:n.datePreset,dateFrom:n.selectedDateFrom,dateTo:n.selectedDateTo})})]}):l.jsxs(ht,{width:"wide",height:"full",children:[Z,l.jsx(car,{logCollapsed:i,listSlot:l.jsx(far,{logs:w,isLoading:S,isFetchingNextPage:O,hasNextPage:E,setEndOfListElement:j,logIdMap:T,featuredLogId:n.featuredLogId,onLogClick:I}),logPanelSlot:N?l.jsx(oar,{log:N,onClose:q,onTraceClick:W,onSpanClick:D,onPrevious:P,onNext:R,collapsed:i,onCollapsedChange:o}):null,tracePanelSlot:n.featuredTraceId?l.jsx(jsr,{traceId:n.featuredTraceId,spans:F?.spans,isLoading:M,onClose:Q,onSpanSelect:$,selectedSpanId:n.featuredSpanId}):null,spanPanelSlot:n.featuredTraceId&&n.featuredSpanId?l.jsx(Tsr,{spanId:n.featuredSpanId,span:L?.span,isLoading:U,onClose:V}):null})]})}function yns({server:e}){const{paths:t,Link:n}=cn(),s=Ze().options.baseUrl,a=s?`${s}/api/mcp/${e.id}/sse`:"",{data:i}=Z4t(e),o=Object.values(i||{}),c=o.length,u=o.filter(h=>h.toolType==="agent").length,d=o.filter(h=>h.toolType==="workflow").length,f=Pp(e.name,50);return l.jsxs(xe.RowLink,{to:t.mcpServerLink(e.id),LinkComponent:n,children:[l.jsx(xe.NameCell,{children:f}),l.jsx(xe.DescriptionCell,{children:a}),l.jsx(xe.TextCell,{className:"text-center",children:u||""}),l.jsx(xe.TextCell,{className:"text-center",children:c||""}),l.jsx(xe.TextCell,{className:"text-center",children:d||""})]})}function bns({mcpServers:e,isLoading:t,search:n=""}){const r=y.useMemo(()=>{const s=n.toLowerCase();return e.filter(a=>a.name?.toLowerCase().includes(s)||a.id?.toLowerCase().includes(s))},[e,n]);return t?l.jsx(qd,{columns:"auto 1fr auto auto auto"}):l.jsxs(xe,{columns:"auto 1fr auto auto auto",children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Name"}),l.jsx(xe.TopCell,{children:"URL"}),l.jsx(xe.TopCellSmart,{long:"Agents",short:l.jsx(za,{}),tooltip:"Agent Tools",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Tools",short:l.jsx(mo,{}),tooltip:"Tools",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Workflows",short:l.jsx(go,{}),tooltip:"Workflow Tools",className:"text-center"})]}),r.length===0&&n?l.jsx(xe.NoMatch,{message:"No MCP Servers match your search"}):null,r.map(s=>l.jsx(yns,{server:s},s.id))]})}const xns=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No MCP Servers yet",descriptionSlot:l.jsxs(l.Fragment,{children:["MCP servers are not configured yet. ",l.jsx("br",{}),"More information in the documentation."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",children:["MCP Documentation ",l.jsx(Va,{})]})})}),wns=()=>{const{data:e=[],isLoading:t,error:n}=GD(),[r,s]=y.useState("");return n&&Hs(n)?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(pa,{})}):n&&Ps(n)?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(aa,{resource:"MCP servers"})}):n?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(dc,{title:"Failed to load MCP servers",message:n.message})}):e.length===0&&!t?l.jsx(lr,{title:"MCP Servers",icon:l.jsx(ac,{}),children:l.jsx(xns,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(ac,{})," MCP Servers"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:l.jsx(yo,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:s,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),l.jsx(bns,{mcpServers:e,isLoading:t,search:r})]})},Sns=(e,t)=>{const n=new Map,r=Object.keys(t);for(const s of r){const a=t[s],i=a.tools,o=Object.keys(i);for(const c of o){const u=i[c];n.has(u.id)||n.set(u.id,{...u,agents:[]}),n.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))n.has(a.id)||n.set(a.id,{...a,agents:[]});return Array.from(n.values())};function kns({tools:e,agents:t,isLoading:n,search:r=""}){const{paths:s,Link:a}=cn(),i=y.useMemo(()=>Sns(e,t),[e,t]),o=y.useMemo(()=>i.filter(c=>c.id.toLowerCase().includes(r.toLowerCase())),[i,r]);return n?l.jsx(qd,{columns:"auto 1fr auto"}):l.jsxs(xe,{columns:"auto 1fr auto",children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Name"}),l.jsx(xe.TopCell,{children:"Description"}),l.jsx(xe.TopCellSmart,{long:"Agents",short:l.jsx(za,{}),tooltip:"Attached Agents",className:"text-center"})]}),o.length===0&&r?l.jsx(xe.NoMatch,{message:"No Tools match your search"}):null,o.map(c=>{const u=Pp(c.id,50),d=Pp(c.description??"",200),f=c.agents.length;return l.jsxs(xe.RowLink,{to:s.toolLink(c.id),LinkComponent:a,children:[l.jsx(xe.NameCell,{children:u}),l.jsx(xe.DescriptionCell,{children:d}),l.jsx(xe.TextCell,{className:"text-center",children:f||""})]},c.id)})]})}const _ns=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Tools yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Mastra tools are not configured yet. ",l.jsx("br",{}),"More information in the documentation."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",children:["Tools Documentation ",l.jsx(Va,{})]})})}),Ons=()=>{const e=Ze();return or({mutationFn:async({toolId:t,input:n,requestContext:r})=>{const s=new CC;Object.entries(r??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:n,requestContext:s})}catch(a){throw ze.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},Ens=({toolId:e})=>{const{canExecute:t}=Jb(),n=t("tools"),{data:r={}}=Wv(),s=y.useMemo(()=>{for(const g of Object.values(r))if(g.tools){const v=Object.values(g.tools).find(x=>x.id===e);if(v)return v}return null},[r,e]),{data:a,isLoading:i,error:o}=HQr(e,{enabled:!s}),c=s||a,{mutateAsync:u,isPending:d,data:f}=Ons(),{requestContext:h}=Zs();y.useEffect(()=>{if(o){const g=o instanceof Error?o.message:"Failed to load tool";ze.error(`Error loading tool: ${g}`)}},[o]);const p=async(g,v)=>{if(!c)return;const x={...h??{},...v??{}};return u({toolId:c.id,input:g,requestContext:x})},m=c?.inputSchema?Av(Tv(Tb(c?.inputSchema))):ps({});return i?l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]}):o?null:c?n?l.jsx(tEe,{executionResult:f,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:p,toolDescription:c.description,toolId:c.id,requestContextSchema:c.requestContextSchema}):l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function Cns({value:e,onValueChange:t,placeholder:n="Select a tool...",searchPlaceholder:r="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:o="default"}){const{data:c={},isLoading:u,isError:d,error:f}=HH(),{data:h={},isLoading:p,isError:m,error:g}=Wv(),{navigate:v,paths:x}=cn();y.useEffect(()=>{if(d){const O=f instanceof Error?f.message:"Failed to load tools";ze.error(`Error loading tools: ${O}`)}},[d,f]),y.useEffect(()=>{if(m){const O=g instanceof Error?g.message:"Failed to load agents";ze.error(`Error loading agents: ${O}`)}},[m,g]);const w=new Map;Object.values(h).forEach(O=>{O.tools&&Object.values(O.tools).forEach(E=>{w.has(E.id)||w.set(E.id,E)})}),Object.values(c).forEach(O=>{w.has(O.id)||w.set(O.id,O)});const S=Array.from(w.values()).map(O=>({label:O.id,value:O.id})),_=O=>{t?t(O):O&&O!==e&&v(x.toolLink(O))};return l.jsx(Mc,{options:S,value:e,onValueChange:_,placeholder:u||p?"Loading tools...":n,searchPlaceholder:r,emptyText:s,className:a,disabled:i||u||p||d||m,variant:o})}const Tns=({isLoading:e,server:t})=>{const[{sseUrl:n,httpStreamUrl:r},s]=y.useState({sseUrl:"",httpStreamUrl:""});if(y.useEffect(()=>{if(!t)return;const i=window.MASTRA_SERVER_HOST,o=window.MASTRA_SERVER_PORT;let c=null;i&&o&&(c=`http://${i}:${o}`);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 l.jsx(mh,{children:l.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 ${n}`;return l.jsxs(mh,{isDivided:!0,children:[l.jsxs("div",{className:"px-8 py-12 mx-auto max-w-2xl w-full",children:[l.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral6 font-medium pb-4",children:t.name}),l.jsxs("div",{className:"flex items-center gap-1 pb-6",children:[l.jsx(_t,{icon:l.jsx($q,{className:"text-neutral6"}),className:"rounded-r-sm text-neutral4!",children:"Version"}),l.jsx(_t,{className:"rounded-l-sm text-neutral4!",children:t.version_detail.version})]}),l.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."}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[l.jsx(_t,{icon:l.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"HTTP"}),children:"Regular HTTP Endpoint"}),l.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for stateless HTTP transport with streamable responses."}),l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:r}),l.jsx("div",{className:"pt-1",children:l.jsx(da,{tooltip:"Copy HTTP Stream URL",content:r})})]})]}),l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[l.jsx(_t,{icon:l.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"SSE"}),children:"Server-Sent Events"}),l.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for real-time communication via SSE."}),l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:n}),l.jsx("div",{className:"pt-1",children:l.jsx(da,{tooltip:"Copy SSE URL",content:n})})]})]}),l.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[l.jsx(_t,{icon:l.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"CLI"}),children:"Command Line"}),l.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for local command-line access via npx and mcp-remote."}),l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:a}),l.jsx("div",{className:"pt-1",children:l.jsx(da,{tooltip:"Copy Command Line Config",content:a})})]})]})]})]}),l.jsx("div",{className:"h-full overflow-y-scroll border-l border-border1",children:l.jsx(jns,{server:t})})]})},jns=({server:e})=>{const{data:t={},isLoading:n}=Z4t(e);if(n)return null;const r=Object.keys(t);return l.jsxs("div",{className:"p-5 overflow-y-scroll",children:[l.jsxs("div",{className:"text-neutral6 flex gap-2 items-center",children:[l.jsx(Ne,{size:"lg",className:"bg-surface4 rounded-md p-1",children:l.jsx(ac,{})}),l.jsx(me,{variant:"header-md",as:"h2",className:"font-medium",children:"Available Tools"})]}),l.jsx("div",{className:"flex flex-col gap-2 pt-6",children:r.map(s=>{const a=t[s];return l.jsx(Ans,{tool:a,serverId:e.id},s)})})]})};function Nns(e){if(!e)return!1;const t=e.ui;return!!(typeof t?.resourceUri=="string"&&t.resourceUri.startsWith("ui://")||typeof e["ui/resourceUri"]=="string"&&e["ui/resourceUri"].startsWith("ui://"))}const Ans=({tool:e,serverId:t})=>{const n=y.useRef(null),{Link:r,paths:s}=cn(),a=Q3t[e.toolType||"tool"],i=Nns(e._meta);return l.jsxs(_h,{onClick:()=>n.current?.click(),children:[l.jsx(NSt,{children:l.jsx(a,{className:"group-hover/entity:text-accent6"})}),l.jsxs(Ch,{children:[l.jsx(Oh,{children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(r,{ref:n,href:s.mcpServerToolLink(t,e.id),children:e.id}),i&&l.jsx(_t,{className:"text-[10px] py-0",children:"App"})]})}),l.jsx(Eh,{children:e.description})]})]})},Ins=()=>{const{serverId:e}=Sa(),{data:t=[],isLoading:n}=GD(),r=t.find(s=>s.id===e);return l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/mcps",children:[l.jsx(Ne,{children:l.jsx(ac,{})}),"MCP Servers"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(f5t,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"MCP documentation"]})})]}),l.jsx(Tns,{isLoading:n,server:r})]})};function Rns(e){if(!e)return;const t=e.ui;if(t?.resourceUri)return t.resourceUri;const n=e["ui/resourceUri"];if(typeof n=="string")return n}const Pns=({toolId:e,serverId:t})=>{const{canExecute:n}=Jb(),r=n("tools"),s=Ze(),{data:a,isLoading:i,error:o}=G4t(t,e),{mutateAsync:c,isPending:u,data:d}=rFr(t,e),f=a?Rns(a._meta):void 0,{data:h}=Ct({queryKey:["mcp-app-resource",t,f],queryFn:async()=>f?(await s.readMcpServerResource(t,f)).contents[0]?.text??null:null,enabled:!!f}),p=y.useCallback(async(v,x)=>await c(x),[c]);y.useEffect(()=>{if(o){const v=o instanceof Error?o.message:"Failed to load tool";ze.error(`Error loading tool: ${v}`)}},[o]);const m=async v=>{if(a)return await c(v)};if(i)return l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]});if(o)return null;if(!a)return l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})});if(!r)return l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})});let g;try{g=Av(Tv(a.inputSchema))}catch(v){console.error("Error processing input schema:",v),ze.error("Failed to process tool input schema."),g=ps({})}return l.jsxs("div",{className:"flex flex-col gap-4",children:[h&&l.jsx("div",{className:"border-b border-border1 p-4",children:l.jsx(W4t,{html:h,toolName:a.name??a.id,onToolCall:p})}),l.jsx(tEe,{executionResult:d,isExecutingTool:u,zodInputSchema:g,handleExecuteTool:m,toolDescription:a.description||"",toolId:a.id})]})},$ns=()=>{const{data:e}=GD(),{serverId:t,toolId:n}=Sa(),{data:r,isLoading:s}=G4t(t,n),a=e?.find(c=>c.id===t),i=r?.name,o=a?.name||"";return s||!r?null:l.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-auto",children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/mcps",children:[l.jsx(Ne,{children:l.jsx(ac,{})}),"MCP Servers"]}),l.jsx(Bn,{as:ln,to:`/mcps/${t}`,children:o}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:i})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"MCP documentation"]})})]}),l.jsx(Pns,{toolId:n,serverId:t})]})};function Mns(){const{data:e,isLoading:t,isError:n}=osr();return l.jsx(Xrr,{data:e,isLoading:t,isError:n})}function Dns(){const{data:e,isLoading:t,isError:n}=__t();return l.jsx(Fwe,{label:"Total Agent Runs",value:e?.value!=null?e.value.toLocaleString():null,prevValue:e?.previousValue!=null?e.previousValue.toLocaleString():void 0,changePct:e?.changePercent??null,isLoading:t,isError:n})}function Lns(){const{data:e,isLoading:t,isError:n}=ssr();return l.jsx(Fwe,{label:"Total Model Cost",value:e?.cost!=null?$S(e.cost,e.costUnit):null,prevValue:e?.previousCost!=null?$S(e.previousCost,e.costUnit):void 0,changePct:e?.costChangePercent??null,isLoading:t,isError:n})}function zns(){const{data:e,isLoading:t,isError:n}=asr();return l.jsx(Fwe,{label:"Total Tokens",value:e?.value!=null?sv(e.value):null,prevValue:e?.previousValue!=null?sv(e.previousValue):void 0,changePct:e?.changePercent??null,isLoading:t,isError:n})}function Fns(){const{data:e,isLoading:t,isError:n}=isr();return l.jsx(Krr,{rows:e,isLoading:t,isError:n})}function Bns(){const{data:e,isLoading:t,isError:n}=csr();return l.jsx(Jrr,{data:e,isLoading:t,isError:n})}function Uns(){const{data:e,isLoading:t,isError:n}=usr();return l.jsx(tsr,{data:e,isLoading:t,isError:n})}function qns(){const{data:e,isLoading:t,isError:n}=lsr();return l.jsx(nsr,{data:e,isLoading:t,isError:n})}const Vns=new Set(["ObservabilityStorageClickhouseVNext","ObservabilityStorageDuckDB","ObservabilityInMemory"]),gle="period";function Hns(){const[e,t]=wo(),n=e.get(gle),r=w_t(n)?n:"24h",s=y.useCallback(a=>{t(i=>{const o=new URLSearchParams(i);return a==="24h"?o.delete(gle):o.set(gle,a),o},{replace:!0})},[t]);return l.jsx(Grr,{initialPreset:r,onPresetChange:s,children:l.jsx(Wns,{})})}function Wns(){const{error:e}=__t(),{data:t,isLoading:n}=DH(),r=t?.observabilityStorageType,s=r?Vns.has(r):!1,a=r==="ObservabilityInMemory";return e&&Hs(e)?l.jsx(lr,{title:"Metrics",icon:l.jsx(hE,{}),children:l.jsx(pa,{})}):e&&Ps(e)?l.jsx(lr,{title:"Metrics",icon:l.jsx(hE,{}),children:l.jsx(aa,{resource:"metrics"})}):e?l.jsx(lr,{title:"Metrics",icon:l.jsx(hE,{}),children:l.jsx(dc,{title:"Failed to load metrics",message:e.message})}):l.jsxs(ht,{width:"wide",height:"full",children:[l.jsx(ht.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(hE,{})," Metrics"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsx(Qrr,{}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:l.jsx(yo,{})})]})]})}),n?null:s?l.jsxs("div",{className:"grid gap-8 content-start pb-10",children:[a&&l.jsx(hr,{variant:"info",title:"Metrics are not persisted",children:l.jsx(hr.Message,{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."})}),l.jsxs(Wfe,{children:[l.jsx(Dns,{}),l.jsx(Lns,{}),l.jsx(zns,{})]}),l.jsxs(Wfe,{children:[l.jsx(Fns,{}),l.jsx(Uns,{}),l.jsx(Bns,{}),l.jsx(qns,{}),l.jsx(Mns,{})]})]}):l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),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:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/observability/metrics/overview",target:"_blank",rel:"noopener noreferrer",children:["Metrics Documentation ",l.jsx(Va,{})]})})})]})}const Zns=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:hE,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:cl,href:"/observability"}];function Gns(){return l.jsxs(OE,{children:[l.jsx(OE.Top,{children:l.jsx(Hn,{withMargins:!1,children:l.jsx(Hn.Column,{children:l.jsxs(Hn.Title,{children:[l.jsx(cl,{})," Observability"]})})})}),l.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:Zns.map(e=>l.jsxs(ln,{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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const Qns=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:za,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:Do,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:go,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:ZS,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:ac,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:mo,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:Zc,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:sj,href:"/request-context"}];function Yns(){return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(lQt,{})," Primitives"]})})}),l.jsx(ht.MainArea,{children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Qns.map(e=>l.jsxs(ln,{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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function Xns(){const{paths:e}=cn(),{data:t,isLoading:n,error:r}=n5t(),{isCmsAvailable:s}=XD(),[a,i]=y.useState(""),o=t?.promptBlocks??[];return r&&Hs(r)?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx(pa,{})}):r&&Ps(r)?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx(aa,{resource:"prompt blocks"})}):r?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx(dc,{title:"Failed to load prompt blocks",message:r.message})}):o.length===0&&!n?l.jsx(lr,{title:"Prompts",icon:l.jsx(Do,{}),children:l.jsx($Qr,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:n,children:[l.jsx(Do,{})," Prompts"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:l.jsx(yo,{})}),s&&l.jsxs(ce,{as:ln,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[l.jsx(Rs,{}),"Create Prompt"]})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:i,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),l.jsx(PQr,{promptBlocks:o,isLoading:n,search:a})]})}function Kns(){return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(sj,{})," Request Context"]})})}),l.jsx(ht.MainArea,{children:l.jsx(FWr,{children:l.jsx(R3t,{})})})]})}const Jns=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:kGt,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:yo,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:Va,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:VR,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:Fet,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:yZt,href:"https://mastra.ai/contact?ref=studio",external:!0}];function ers(){return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(yo,{})," Resources"]})})}),l.jsx(ht.MainArea,{children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:Jns.map(e=>l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&l.jsx(Va,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function trs(){const{data:e={},isLoading:t,error:n}=uf(),[r,s]=y.useState(""),[a,i]=y.useState("all");if(n&&Hs(n))return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(pa,{})});if(n&&Ps(n))return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(aa,{resource:"scorers"})});if(n)return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(dc,{title:"Failed to load scorers",message:n.message})});if(Object.keys(e).length===0&&!t)return l.jsx(lr,{title:"Scorers",icon:l.jsx(ci,{}),children:l.jsx(tGr,{})});const o=a!=="all"||r!=="",c=()=>{s(""),i("all")};return l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(ci,{})," Scorers"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Scorers documentation",children:l.jsx(yo,{})})})]}),l.jsx(rGr,{search:r,onSearchChange:s,sourceFilter:a,onSourceFilterChange:i,onReset:c,hasActiveFilters:o})]}),l.jsx(eGr,{scorers:e,isLoading:t,search:r,sourceFilter:a})]})}function nrs(){const{scorerId:e}=Sa(),[t,n]=wo(),r=t.get("scoreId")??void 0,[s,a]=y.useState(r),[i,o]=y.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:c,isLoading:u,error:d}=XZr(e),{data:f={},isLoading:h,error:p}=Wv(),{isLoading:m,error:g}=Zw(),{data:v=[],isLoading:x,error:w,isFetchingNextPage:S,hasNextPage:_,setEndOfListElement:O}=YZr({scorerId:e,entityId:i?.value==="all"?void 0:i?.value,entityType:i?.type==="ALL"?void 0:i?.type}),E=y.useMemo(()=>c?.agentIds?.filter(D=>f[D]).map(D=>({value:D,label:f[D].name,type:"AGENT"}))||[],[c?.agentIds,f]),j=y.useMemo(()=>c?.workflowIds?.map(D=>({value:D,label:D,type:"WORKFLOW"}))||[],[c?.workflowIds]),T=y.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...E,...j],[E,j]),N=t.get("entity")??"all",I=T.find(D=>D.value===N);I&&I.value!==i?.value&&o(I),y.useEffect(()=>{if(d){const D=d instanceof Error?d.message:"Failed to load scorer";ze.error(`Error loading scorer: ${D}`)}},[d]),y.useEffect(()=>{if(p){const D=p instanceof Error?p.message:"Failed to load agents";ze.error(`Error loading agents: ${D}`)}},[p]),y.useEffect(()=>{if(g){const D=g instanceof Error?g.message:"Failed to load workflows";ze.error(`Error loading workflows: ${D}`)}},[g]);const P=D=>{D?.value&&n(Q=>{const V=new URLSearchParams(Q);return V.set("entity",D.value),V})};y.useEffect(()=>{const D=t.get("scoreId")??void 0;if(D===s)return;if(!D){a(void 0);return}v.find(V=>V.id===D)&&a(D)},[t,v]);const R=y.useCallback(D=>{a(D||void 0),n(Q=>{const V=new URLSearchParams(Q);return D?V.set("scoreId",D):V.delete("scoreId"),V})},[n]);if(!c)return null;const F=Hs(d)||Hs(p)||Hs(g),M=d&&Ps(d),L=!F&&!M&&(d||p||g),U=!x&&v.length===0,z=i?.value!=="all",q=l.jsxs(l.Fragment,{children:[l.jsxs(Ni,{children:[l.jsx(Bn,{as:ln,to:"/scorers",children:"Scorers"}),l.jsx(KZr,{value:e,variant:"link"})]}),l.jsxs(ht.Row,{children:[l.jsxs(Tr,{children:[l.jsxs(Tr.Title,{isLoading:u,children:[l.jsx(ci,{})," ",c?.scorer?.config?.name||e]}),(u||c?.scorer?.config?.description)&&l.jsx(Tr.Description,{isLoading:u,children:c?.scorer?.config?.description})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Scorers documentation",tooltipContent:"Go to Scorers documentation",children:l.jsx(yo,{})}),c?.scorer?.source==="stored"&&l.jsxs(ce,{variant:"default",as:ln,to:`/cms/scorers/${e}/edit`,children:[l.jsx($b,{})," Edit"]})]})]})]});if(F||M||L||U&&!z){const D=(d instanceof Error?d.message:void 0)??(p instanceof Error?p.message:void 0)??(g instanceof Error?g.message:void 0)??"An unexpected error occurred";return l.jsxs(ht,{width:"wide",height:"full",children:[l.jsx(ht.TopArea,{children:q}),l.jsx(ht.MainArea,{isCentered:!0,children:F?l.jsx(pa,{}):M?l.jsx(aa,{resource:"scorers"}):L?l.jsx(dc,{title:"Failed to load scorer",message:D}):l.jsx(qZr,{})})]})}return l.jsxs(ht,{width:"wide",children:[l.jsxs(ht.TopArea,{children:[q,l.jsx(WZr,{selectedEntity:i,entityOptions:T,onEntityChange:P,onReset:()=>{n(D=>{const Q=new URLSearchParams(D);return Q.set("entity","all"),Q})},isLoading:x||h||m})]}),l.jsx(UZr,{scores:v,isLoading:x,selectedScoreId:s,isFetchingNextPage:S,hasNextPage:_,setEndOfListElement:O,onScoreClick:R,errorMsg:w?.message})]})}const o6t=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],rrs=e=>o6t.some(t=>t.value===e),srs=()=>{const{baseUrl:e,headers:t,apiPrefix:n}=VOe(),{theme:r,setTheme:s}=Uj();return l.jsxs(ht,{width:"narrow",children:[l.jsx(ht.TopArea,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(bwe,{})," Settings"]})})}),l.jsxs(ht.MainArea,{className:"flex flex-col gap-5 mt-6",children:[l.jsx($6e,{title:"Theme",description:"Customize the appearance of the studio.",children:l.jsx(jer,{label:"Theme mode",htmlFor:"theme",children:l.jsxs(Ri,{value:r,onValueChange:a=>{rrs(a)&&s(a)},children:[l.jsx(mi,{id:"theme",className:"w-full sm:w-48",children:l.jsx(Pi,{})}),l.jsx(gi,{children:o6t.map(a=>l.jsx(hs,{value:a.value,children:a.label},a.value))})]})})}),l.jsx($6e,{title:"Mastra Connection",description:"Configure the Mastra instance URL, API prefix, and request headers used by the studio.",children:l.jsx(M3t,{initialConfig:{baseUrl:e,headers:t,apiPrefix:n}})})]})]})};function ars(){const[e]=wo(),t=id(),n=e.get("redirect")||"/",r=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(i6t,{redirectUri:n,onSuccess:r,initialMode:"signup"})}function irs(e){return e.replace(/\/$/,"").split("/").pop()}function YH({children:e,className:t}){return l.jsx("div",{className:Y("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function ors({templates:e,linkComponent:t,className:n,isLoading:r}){const s=t||"a";return r?l.jsx("div",{className:Y("grid gap-y-4",n),children:Array.from({length:5}).map((a,i)=>l.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):l.jsx("div",{className:Y("grid gap-y-4",n),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return l.jsxs("article",{className:Y("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[l.jsxs(s,{to:`/templates/${a.slug}`,className:Y("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&l.jsx("div",{className:Y("overflow-hidden"),children:l.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),l.jsxs("div",{className:Y("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[l.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),l.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),l.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&l.jsxs("ul",{className:Y("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&&l.jsxs("li",{children:[l.jsx(za,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&l.jsxs("li",{children:[l.jsx(mo,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&l.jsxs("li",{children:[l.jsx(Yet,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&l.jsxs("li",{children:[l.jsx(sU,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&l.jsxs("li",{children:[l.jsx(ac,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&l.jsx("small",{children:"|"}),l.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(o=>l.jsx("span",{className:"",children:o},o))})]})]})]}),l.jsx("a",{href:a.githubUrl,className:Y("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:l.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:[l.jsx(ESt,{})," ",irs(a.githubUrl)]})})]},a.slug)})})}function lrs({tagOptions:e,selectedTag:t,providerOptions:n,selectedProvider:r,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:o,onReset:c,className:u,isLoading:d}){return d?l.jsxs("div",{className:Y("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[l.jsx("div",{})," ",l.jsx("div",{})," ",l.jsx("div",{})]}):l.jsxs("div",{className:Y("flex flex-wrap mx-auto sticky top-0 gap-4 bg-surface2 py-8",u),children:[l.jsx(rw,{name:"search-templates",label:"Search templates",labelIsHidden:!0,value:i,onChange:f=>o?.(f.target.value),placeholder:"Search Template"}),l.jsx(_l,{label:"Filter by tag",labelIsHidden:!0,name:"filter-tag",value:t,onValueChange:s,options:e}),l.jsx(_l,{label:"Filter by provider",labelIsHidden:!0,name:"filter-provider",value:r,onValueChange:a,options:n}),c&&l.jsxs(ce,{onClick:c,children:["Reset ",l.jsx(qr,{})]})]})}function crs(){const{data:e,isLoading:t}=Qar(),{templates:n,tags:r,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=y.useState("all"),[o,c]=y.useState("all"),[u,d]=y.useState(""),f=[{value:"all",label:"Any tag"}];(r||[]).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,S)=>{S==="tag"?i(w):S==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},v=n.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||a!=="all"&&!w.tags.includes(a)||o!=="all"&&!w.supportedProviders.includes(o))),x=u||a!=="all"||o!=="all";return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ud,{children:[l.jsx(Ne,{children:l.jsx(w0,{})}),"Templates"]})}),l.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[l.jsx(lrs,{selectedTag:a,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:o,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),l.jsx(ors,{templates:v,linkComponent:ln,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const urs="1.33.0-alpha.2";function drs({errorMsg:e,validationErrors:t}){const n=typeof e=="string"?e:e!=null?String(e):void 0,r=n?.includes("Invalid schema for function"),s=n?.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.":r?"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:l.jsx(tb,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:l.jsx(YGt,{}),title:"Template Installation Failed"},{icon:o,title:c}=i();return l.jsxs(YH,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[l.jsxs("div",{className:Y("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[o,l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:c}),l.jsx("p",{className:"text-ui-md text-neutral3",children:a()})]})]}),t&&t.length>0&&l.jsxs("details",{className:"text-xs",children:[l.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),l.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)=>l.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[l.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:u.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),l.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))})]}),n&&!s&&l.jsxs("details",{className:"text-xs",children:[l.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),l.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:l.jsx("div",{className:"whitespace-pre-wrap wrap-break-word",children:n})})]})]})}function frs({providerOptions:e,selectedProvider:t,onProviderChange:n,variables:r,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:o,isInstalling:c,defaultModelProvider:u,defaultModelId:d,onModelUpdate:f}){return l.jsx(YH,{children:l.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[l.jsxs("h2",{className:Y("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 ",l.jsx(Xet,{})]}),l.jsx(_l,{name:"template-provider",options:e,label:"Template AI Model Provider",onValueChange:n,value:t,placeholder:"Select",layout:"horizontal"}),t&&Object.entries(r||{}).length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),l.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:o?l.jsxs("div",{className:Y("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:[l.jsx(Ut,{})," Loading variables..."]}):Object.entries(r).map(([h,p])=>l.jsxs(y.Fragment,{children:[l.jsx(nw,{name:`env-${h}`,labelIsHidden:!0,label:"Key",value:h,disabled:!0,className:"w-full"}),l.jsx(nw,{name:h,labelIsHidden:!0,label:"Value",value:p,onChange:i,errorMsg:s.includes(h)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},h))}),l.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[l.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"}),l.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),l.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"}),l.jsx(P3t,{defaultProvider:u||"",defaultModel:d||"",updateModel:f||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!o&&l.jsx(ce,{className:Y("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?l.jsxs(l.Fragment,{children:[l.jsx(Ut,{className:"w-4 h-4"})," Installing..."]}):l.jsxs(l.Fragment,{children:["Install ",l.jsx(CS,{})]})})]})})}function hrs({title:e,description:t,githubUrl:n,isLoading:r,infoData:s,templateSlug:a}){const i=a?`feat/install-template-${a}`:"feat/install-template-[slug]";return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Y("grid mt-8 items-center"),children:l.jsxs("div",{className:Y("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":r}),children:[l.jsx(w0,{}),l.jsx("h2",{className:Y({"bg-surface4 flex rounded-lg min-w-[50%]":r}),children:r?l.jsx(l.Fragment,{children:" "}):e})]})}),l.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[l.jsxs("div",{className:"grid",children:[l.jsx("p",{className:Y("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":r}),children:r?l.jsx(l.Fragment,{children:" "}):t}),!r&&a&&l.jsxs("div",{className:Y("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[l.jsx("div",{className:"shrink-0 mt-0.5",children:l.jsx(Cw,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(eU,{className:"w-[1em] h-[1em] text-neutral4"}),l.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),l.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-medium",children:"Branch name:"})," ",l.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:i})]}),l.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),n&&l.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[l.jsx(ESt,{}),n?.split("/")?.pop()]})]}),s&&l.jsx(__,{data:s,labelsAreHidden:!0,isLoading:r})]})]})}function prs({name:e,streamResult:t,workflowInfo:n}){const r=t?.phase||"initializing",s=t?.payload?.workflowState,a=t?.payload?.currentStep,i=t?.error,o=s?.steps||{},c=Object.keys(o).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:n?.allSteps?m in n.allSteps:!0,d=Object.entries(o).filter(([m,g])=>u(m)),f=d.length,h=()=>{switch(r){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 l.jsxs(YH,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[l.jsxs("div",{className:"text-center",children:[l.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&l.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),c&&f>0&&!["error"].includes(r)&&l.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:l.jsx(qer,{steps:p})}),i&&r==="error"&&l.jsxs("div",{className:Y("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:[l.jsx(UQt,{}),i||"Something went wrong"]}),c&&l.jsx(Uer,{steps:p,currentStep:a,className:"pb-4"}),!c&&r==="initializing"&&l.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[l.jsx(Ut,{}),l.jsx("p",{children:"This may take some time..."})]})]})}function mrs({name:e,installedEntities:t}){return l.jsxs(YH,{className:Y("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[l.jsx(Xet,{}),l.jsx("h2",{className:"text-header-md",children:"Done!"}),l.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",l.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&l.jsx(__,{data:t})]})}function grs(){const{templateSlug:e}=Sa(),[t,n]=wo(),[r,s]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState(""),[u,d]=y.useState({}),[f,h]=y.useState([]),[p,m]=y.useState(null),[g,v]=y.useState(!1),[x,w]=y.useState(""),[S,_]=y.useState(!1),[O,E]=y.useState(!1),[j,T]=y.useState([]),{data:N,isLoading:I}=Yar({repoOrSlug:e,owner:"mastra-ai"}),R=urs?.includes("beta")??!1?"beta":"main",{data:F,isLoading:M}=Xar({repo:N?.githubUrl?new URL(N.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:R}),{data:L,isLoading:U}=Kar(),{mutateAsync:z,isPending:q}=Jar(),{mutateAsync:W}=eir(),{streamInstall:D,streamResult:Q,isStreaming:V}=nir(L),{observeInstall:$,streamResult:Z,isStreaming:G}=rir(L);y.useEffect(()=>{const re=t.get("runId");re&&!g&&!p&&!V&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:re}),w(re),W({runId:re}).then(le=>{const ge=le.snapshot;if(ge?.status==="success"&&ge?.result?.success)v(!0);else if(ge?.result?.success===!1)if(ge?.result?.validationResults&&!ge?.result?.validationResults?.valid&&ge?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:be}=ge.result.validationResults,ke=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(ke),T(be||[])}else{const ue=ge?.result?.message||ge?.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,V,G,W]),y.useEffect(()=>{const re=t.get("runId"),le=t.get("resume"),ge=t.get("provider");if(re&&le==="true"&&ge&&!V&&!G&&!S&&!O&&L){w(re),_(!0);try{W({runId:re}).then(fe=>{if(fe.snapshot?.status==="running")return $.mutateAsync({runId:re})}).then(()=>{n(fe=>{const ue=new URLSearchParams(fe);return ue.delete("resume"),ue})}).catch(fe=>{console.error("❌ Failed to resume template installation:",fe),fe.message?.includes("404")||fe.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(fe){console.error("❌ Auto-resume failed with error:",fe),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,V,G,S,O,L,W,$,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ie=[{key:"tools",label:"Tools",value:N?.tools?.length?N.tools.map(re=>re).join(", "):"n/a",icon:l.jsx(mo,{})},{key:"agents",label:"Agents",value:N?.agents?.length?N.agents.map(re=>re).join(", "):"n/a",icon:l.jsx(za,{})},{key:"workflows",label:"Workflows",value:N?.workflows?.length?N.workflows.map(re=>re).join(", "):"n/a",icon:l.jsx(sU,{})},{key:"providers",label:"Providers",value:N?.supportedProviders?.length?N.supportedProviders.join(", "):"n/a",icon:l.jsx(Zg,{})},{key:"tags",label:"Tags",value:N?.tags?.length?N.tags.join(", "):"n/a",icon:l.jsx(ij,{})}],ne=[{...ie[0]},{...ie[1]},{...ie[2]}].filter(re=>re.value!=="n/a");y.useEffect(()=>{F&&d(F)},[F]),y.useEffect(()=>{const re=Q||Z;re?.phase==="error"&&re?.error&&m(typeof re.error=="string"?re.error:String(re.error))},[Q?.phase,Q?.error,Z?.phase,Z?.error]);const te=re=>{s(re)},ae=async re=>(i(re.provider),c(re.modelId),{message:"Model updated successfully"}),de=async()=>{const re=Object.entries(u).reduce((le,[ge,fe])=>(fe===""&&le.push(ge),le),[]);if(re.length>0){h(re);return}if(N){m(null),v(!1),w(""),E(!0);try{const ge={repo:N.githubUrl||`https://github.com/mastra-ai/template-${N.slug}`,ref:R,slug:N.slug,variables:u},{runId:fe}=await z({});w(fe),n(ue=>{const be=new URLSearchParams(ue);return be.set("runId",fe),be.set("resume","true"),be.set("provider",r||"openai"),be}),await D.mutateAsync({inputData:ge,selectedModel:{provider:a,modelId:o},runId:fe})}catch(le){E(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},X=re=>{const{name:le,value:ge}=re.target;ge.trim()===""?h(fe=>[...fe,le]):h(fe=>fe.filter(ue=>ue!==le)),d(fe=>({...fe,[le]:ge}))};return l.jsxs(Jn,{children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/templates",children:[l.jsx(Ne,{children:l.jsx(w0,{})}),"Templates"]}),l.jsx(Bn,{as:ln,to:`/templates/${N?.slug}`,isCurrent:!0,children:N?.title&&N.title})]})}),l.jsx("div",{className:Y("w-full lg:px-12 h-full overflow-y-scroll"),children:l.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[l.jsx(hrs,{isLoading:I,title:N?.title,description:N?.longDescription,imageURL:N?.imageURL,githubUrl:N?.githubUrl,infoData:ie,templateSlug:e}),N&&l.jsxs(l.Fragment,{children:[(V||G)&&l.jsx(prs,{name:N.title,streamResult:G?Z:Q,runId:x,workflowInfo:L}),g&&l.jsx(mrs,{name:N.title,installedEntities:ne,linkComponent:ln}),p&&l.jsx(drs,{errorMsg:p,validationErrors:j.length>0?j:Q?.validationResults?.errors||Z?.validationResults?.errors}),!V&&!G&&!g&&!p&&l.jsx(frs,{providerOptions:J,selectedProvider:r,onProviderChange:te,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:de,handleVariableChange:X,isLoadingEnvVars:M||U,isInstalling:q,defaultModelProvider:a,defaultModelId:o,onModelUpdate:ae})]})]})})]})}const vrs=()=>{const{toolId:e,agentId:t}=Sa();return l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/agents",children:[l.jsx(Ne,{children:l.jsx(za,{})}),"Agents"]}),l.jsx(Bn,{as:ln,to:`/agents/${t}/chat`,children:t}),l.jsx(Bn,{as:ln,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(Ne,{children:l.jsx(Vw,{})}),"Tools documentation"]})})]}),l.jsx(NGr,{toolId:e,agentId:t})]})},yrs=()=>{const{toolId:e}=Sa();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/tools",children:[l.jsx(Ne,{children:l.jsx(mo,{})}),"Tools"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Cns,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"Tools documentation"]})})]}),l.jsx(Ens,{toolId:e})]})};function brs(e){return e.feedbackType==="thumbs"?e.value===1?"👍 Positive (1)":e.value===0||e.value===-1?"👎 Negative":String(e.value):e.feedbackType==="rating"?String(e.value):e.feedbackType==="comment"?String(e.value??e.comment??"-"):String(e.value??"-")}function xrs({feedback:e,isOpen:t,onClose:n,onNext:r,onPrevious:s}){const a=e?.metadata&&Object.keys(e.metadata).length>0?JSON.stringify(e.metadata,null,2):void 0;return l.jsxs(Yt,{dialogTitle:"Feedback Detail",dialogDescription:"View feedback details",isOpen:t,onClose:n,level:3,children:[l.jsxs(Yt.Top,{children:[l.jsxs(ms,{children:[l.jsx(VR,{})," Feedback"]}),"|",l.jsx(Yt.Nav,{onNext:r,onPrevious:s})]}),l.jsxs(Yt.Content,{children:[l.jsxs(Yt.Header,{children:[l.jsxs(Yt.Heading,{children:[l.jsx(VR,{})," Feedback"]}),e?.traceId&&l.jsxs(ms,{children:[l.jsx(NC,{})," ",e.traceId]})]}),l.jsxs(sw,{children:[l.jsx(__,{data:[{label:"Created at",value:e?.timestamp?on(new Date(e.timestamp),"MMM d, h:mm:ss aaa"):"n/a",key:"timestamp"},{label:"Type",value:e?.feedbackType??"n/a",key:"type"},{label:"Value",value:e?brs(e):"n/a",key:"value"},...e?.comment?[{label:"Comment",value:e.comment,key:"comment"}]:[],{label:"Source",value:e?.feedbackSource??e?.source??"n/a",key:"source"},...e?.feedbackUserId?[{label:"User",value:e.feedbackUserId,key:"userId"}]:[],...e?.traceId?[{label:"Trace ID",value:e.traceId,key:"traceId"}]:[],...e?.spanId?[{label:"Span ID",value:e.spanId,key:"spanId"}]:[]]}),a&&l.jsx(Yt.CodeSection,{title:"Metadata",icon:l.jsx(NC,{}),codeStr:a,simplified:!0})]})]})]})}const Y5=[{name:"source",label:"Source",size:"1fr"},{name:"date",label:"Date",size:"0.8fr"},{name:"time",label:"Time",size:"0.8fr"},{name:"value",label:"Value",size:"0.6fr"},{name:"comment",label:"Comment",size:"2fr"}];function wrs(e){return e.feedbackType==="thumbs"?e.value===1?"👍":e.value===0||e.value===-1?"👎":String(e.value):typeof e.value=="number"?String(e.value):"—"}function Srs(e){const t=e.comment||(typeof e.value=="string"?e.value:"");return t?t.length>60?t.slice(0,60)+"…":t:"—"}function l6t({feedbackData:e,isLoadingFeedbackData:t,onPageChange:n}){const[r,s]=y.useState(!1),[a,i]=y.useState(),o=e?.feedback??[],c=h=>{i(o[h]),s(!0)};if(t)return l.jsx(kkt,{columns:Y5});const u=a?o.indexOf(a):-1,d=u>=0&&u<o.length-1?()=>i(o[u+1]):void 0,f=u>0?()=>i(o[u-1]):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs(Ma,{children:[l.jsxs(Ma.Trim,{children:[l.jsx(Ma.Header,{columns:Y5}),o.length>0?l.jsx(Ma.Entries,{children:o.map((h,p)=>{const m=new Date(h.timestamp),g=Bv(m),v={id:`${h.traceId}-${p}`,source:h.feedbackUserId||h.feedbackSource||"unknown",date:g?"Today":on(m,"MMM dd"),time:on(m,"h:mm:ss aaa"),value:wrs(h),comment:Srs(h)};return l.jsx(Ma.Entry,{columns:Y5,onClick:()=>c(p),entry:v,children:Y5.map(x=>l.jsx(Ma.EntryText,{children:String(v[x.name]??"")},`col-${x.name}`))},v.id)})}):l.jsx(Ma.Message,{message:"No feedback found",type:"info"})]}),l.jsx(Ma.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>n?.((e?.pagination?.page||0)+1),onPrevPage:()=>{const h=e?.pagination?.page||0;h>0&&n?.(h-1)}})]}),l.jsx(xrs,{feedback:a,isOpen:r,onClose:()=>s(!1),onNext:d,onPrevious:f})]})}const hKe="auto auto auto auto 1fr";function c6t({scoresData:e,isLoadingScoresData:t,onPageChange:n,onScoreSelect:r}){return t?l.jsx(Hq,{columns:hKe}):l.jsxs("div",{className:"grid gap-2",children:[l.jsxs(Ou,{columns:hKe,className:"min-w-0",children:[l.jsxs(Ou.Top,{children:[l.jsx(Ou.TopCell,{children:"ID"}),l.jsx(Ou.TopCell,{children:"Date"}),l.jsx(Ou.TopCell,{children:"Time"}),l.jsx(Ou.TopCell,{children:"Score"}),l.jsx(Ou.TopCell,{children:"Scorer"})]}),e?.scores&&e.scores.length>0?e.scores.map(s=>{const a=new Date(s.createdAt),i=Bv(a);return l.jsxs(Ou.RowButton,{onClick:()=>r?.(s),children:[l.jsx(Ou.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:rh(s?.id)||"n/a"}),l.jsx(Ou.Cell,{height:"compact",className:"text-neutral2 text-ui-smd",children:i?"Today":on(a,"MMM dd")}),l.jsx(Ou.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:on(a,"h:mm:ss aaa")}),l.jsx(Ou.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.score??"")}),l.jsx(Ou.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.scorer?.name||s?.scorer?.id||"")})]},s.id)}):l.jsx(Ou.NoMatch,{message:"No scores found"})]}),l.jsx(Ou.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>n?.((e?.pagination?.page||0)+1),onPrevPage:()=>n?.((e?.pagination?.page||0)-1)})]})}const u6t=({traceId:e="",page:t})=>{const n=Ze(),r=t??0;return Ct({queryKey:["trace-feedback",e,r],queryFn:()=>n.listFeedback({filters:{traceId:e},pagination:{page:r,perPage:10}}),enabled:!!e,refetchInterval:3e3,gcTime:0,staleTime:0})};function krs(){const[e,t]=wo(),[n,r]=y.useState(!1),s=nar(e,t,{onRemoveAll:()=>r(!1)}),[a,i]=y.useState(),[o,c]=y.useState(0),[u,d]=y.useState(!1),[f,h]=y.useState(null);y.useEffect(()=>c(0),[s.traceIdParam,s.spanIdParam]);const{data:p,isLoading:m}=uf(),{data:g,isLoading:v}=JOe({traceId:s.traceIdParam,spanId:s.spanIdParam,page:o}),[x,w]=y.useState(0);y.useEffect(()=>w(0),[s.traceIdParam,s.spanIdParam]);const{data:S,isLoading:_}=u6t({traceId:s.traceIdParam,page:x}),{data:O,isLoading:E}=qwe(s.traceIdParam??null),j=y.useMemo(()=>O?.spans,[O?.spans]),{data:T,isLoading:N}=Ak(s.traceIdParam??"",s.spanIdParam??""),I=s.scoreIdParam?g?.scores?.find(ue=>ue.id===s.scoreIdParam):void 0,{data:P=[],isPending:R}=I_t(),{data:F=[],isPending:M}=R_t({entityType:s.selectedEntityOption?.entityType,rootOnly:!0}),{data:L=[],isPending:U}=P_t(),{data:z=[],isPending:q}=$_t(),W=y.useMemo(()=>Gsr({availableTags:P,availableRootEntityNames:F,availableServiceNames:z,availableEnvironments:L,loading:{tags:R,entityNames:M,serviceNames:q,environments:U}}),[P,F,z,L,R,M,q,U]),D=y.useMemo(()=>Ksr({rootEntityType:s.selectedEntityOption?.entityType,status:s.selectedStatus,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,tokens:s.filterTokens}),[s.filterTokens,s.selectedDateFrom,s.selectedDateTo,s.selectedEntityOption,s.selectedStatus]),{data:Q,isLoading:V,isFetchingNextPage:$,hasNextPage:Z,setEndOfListElement:G,error:J}=Bsr({filters:D}),ie=y.useMemo(()=>Q?.spans??[],[Q?.spans]),ne=Q?.threadTitles??{},{handlePreviousSpan:te,handleNextSpan:ae}=M_t(j,s.spanIdParam??null,ue=>s.handleSpanChange(ue)),de=aar(e,t),X=y.useCallback(()=>s.applyFilterTokens(Jsr(W,s.filterTokens)),[W,s]),{handlePreviousTrace:re,handleNextTrace:le}=ear(ie,s.traceIdParam,s.handleTraceClick),ge=y.useCallback(()=>{const ue=j?.find(be=>be.parentSpanId==null);ue&&(s.handleSpanChange(ue.spanId),s.handleSpanTabChange("scoring"))},[j,s]);if(J)return l.jsx(lr,{title:"Traces",icon:l.jsx(cl,{}),children:l.jsx(A_t,{error:J,resource:"traces",errorTitle:"Failed to load traces"})});const fe=!!s.selectedEntityOption||!!s.selectedStatus||s.filterTokens.length>0||s.datePreset!=="last-24h"||!!s.selectedDateTo;return l.jsxs(ht,{width:"wide",height:"full",children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:V,children:[l.jsx(cl,{})," Traces"]})})}),l.jsxs(ht.Column,{className:"flex justify-end items-center gap-2",children:[l.jsx(d_t,{preset:s.datePreset,onPresetChange:s.handleDatePresetChange,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,onDateChange:s.handleDateChange,disabled:V,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),l.jsx(mkt,{fields:W,tokens:s.filterTokens,onTokensChange:s.handleFilterTokensChange,disabled:V,onStartTextFilter:i}),l.jsx(ss,{disabled:V,"aria-pressed":n,"aria-label":n?"Ungroup traces":"Group traces by thread",tooltipContent:n?"Ungroup traces":"Group traces by thread",onClick:()=>r(ue=>!ue),children:n?l.jsx(jz,{}):l.jsx(Het,{})}),l.jsx(ss,{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:l.jsx(yo,{})})]})]}),l.jsx(Ssr,{isLoading:V,filterFields:W,filterTokens:s.filterTokens,onFilterTokensChange:s.handleFilterTokensChange,onClear:X,onRemoveAll:s.handleRemoveAll,onSave:de.handleSave,onRemoveSaved:de.hasSavedFilters?de.handleRemoveSaved:void 0,autoFocusFilterFieldId:a})]}),l.jsx(Nsr,{traceCollapsed:u,listSlot:l.jsx(Psr,{traces:ie,isLoading:V,isFetchingNextPage:$,hasNextPage:Z,setEndOfListElement:G,filtersApplied:fe,featuredTraceId:s.traceIdParam,onTraceClick:ue=>s.handleTraceClick(s.traceIdParam===ue.traceId?"":ue.traceId),groupByThread:n,threadTitles:ne}),tracePanelSlot:s.traceIdParam?l.jsx(j_t,{traceId:s.traceIdParam,spans:j,isLoading:E,onClose:s.handleTraceClose,onSpanSelect:ue=>s.handleSpanChange(ue??null),onEvaluateTrace:ge,onSaveAsDatasetItem:ue=>h(ue),initialSpanId:s.spanIdParam,onPrevious:re,onNext:le,collapsed:u,onCollapsedChange:d,placement:"traces-list",LinkComponent:xV,traceHref:`/traces/${s.traceIdParam}`}):null,spanPanelSlot:s.traceIdParam&&s.spanIdParam?l.jsx(N_t,{traceId:s.traceIdParam,spanId:s.spanIdParam,span:T?.span,isLoading:N,onClose:s.handleSpanClose,onPrevious:te,onNext:ae,activeTab:s.spanTabParam??"details",onTabChange:ue=>s.handleSpanTabChange(ue),feedbackTabBadge:S?.pagination?.total??void 0,feedbackTabSlot:()=>l.jsx(l6t,{feedbackData:S,onPageChange:w,isLoadingFeedbackData:_}),scoringTabBadge:g?.pagination?.total??void 0,scoringTabSlot:({span:ue,traceId:be,spanId:ke})=>l.jsxs("div",{className:"grid gap-6",children:[l.jsx(lEe,{traceId:be,isTopLevelSpan:!ue.parentSpanId,spanId:ke,entityType:ue.attributes?.agentId||ue.entityType===Sl.AGENT?"Agent":ue.attributes?.workflowId||ue.entityType===Sl.WORKFLOW_RUN?"Workflow":void 0,scorers:p,isLoadingScorers:m}),l.jsx(c6t,{scoresData:g,onPageChange:c,isLoadingScoresData:v,onScoreSelect:Ie=>s.handleScoreChange(Ie.id)})]})}):null,scorePanelSlot:I?l.jsx(XOe,{score:I,onClose:()=>s.handleScoreChange(null)}):null}),f&&l.jsx(cEe,{rootSpanId:f.rootSpanId,traceId:f.traceId,isOpen:!0,onClose:()=>h(null)})]})}function _rs(){const{traceId:e}=Sa(),[t,n]=wo(),r=id(),s=t.get("spanId")||void 0,a=t.get("tab"),i=a==="scoring"?"scoring":a==="feedback"?"feedback":"details",o=t.get("scoreId")||void 0,[c,u]=y.useState(s??null),[d,f]=y.useState(),[h,p]=y.useState(i),[m,g]=y.useState(0),[v,x]=y.useState(!1),{data:w,isLoading:S,error:_}=qwe(e),O=y.useMemo(()=>w?.spans??[],[w?.spans]),E=y.useMemo(()=>O.find(te=>te.parentSpanId==null),[O]),{data:j,isLoading:T}=Ak(e,c??"");y.useEffect(()=>g(0),[e,c]);const{data:N,isLoading:I}=uf(),{data:P,isLoading:R}=JOe({traceId:e,spanId:c??void 0,page:m}),[F,M]=y.useState(0);y.useEffect(()=>M(0),[e,c]);const{data:L,isLoading:U}=u6t({traceId:e,page:F});y.useEffect(()=>{if(o&&P?.scores&&!d){const te=P.scores.find(ae=>ae.id===o);te&&f(te)}},[o,P?.scores,d]);const z=y.useCallback(te=>{const ae=new URLSearchParams(t);for(const[de,X]of Object.entries(te))X===null||X===""?ae.delete(de):ae.set(de,X);n(ae,{replace:!0})},[t,n]),q=y.useCallback(te=>{const ae=te??null,de=ae===c;u(ae),de||(f(void 0),p("details"),z({spanId:ae,tab:null,scoreId:null}))},[c,z]),W=y.useCallback(()=>{u(null),f(void 0),p("details"),z({spanId:null,tab:null,scoreId:null})},[z]),D=y.useCallback(te=>{u(te),f(void 0),p("details"),z({spanId:te,tab:null,scoreId:null})},[z]),{handlePreviousSpan:Q,handleNextSpan:V}=M_t(O,c,D),$=y.useCallback(te=>{const ae=te;p(ae),f(void 0),z({tab:ae==="details"?null:ae,scoreId:null})},[z]),Z=y.useCallback(te=>{f(te),z({scoreId:te.id})},[z]),G=y.useCallback(()=>{f(void 0),z({scoreId:null})},[z]),J=y.useCallback(()=>{r("/observability")},[r]),ie=y.useCallback(()=>{p("scoring"),E&&c!==E.spanId?(u(E.spanId),f(void 0),z({spanId:E.spanId,tab:"scoring",scoreId:null})):z({tab:"scoring"})},[E,c,z]),ne=l.jsxs(l.Fragment,{children:[l.jsxs(ce,{as:xV,href:"/observability",variant:"link",size:"md",className:"text-neutral2",children:[l.jsx(oh,{}),"Back to Traces"]}),l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:S,children:[l.jsx(cl,{})," Trace ",l.jsx("span",{className:"text-neutral3",children:e})]})})}),l.jsx(ht.Column,{children:l.jsxs(ys,{children:[l.jsx(ss,{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:l.jsx(yo,{})}),E&&l.jsxs(l.Fragment,{children:[l.jsxs(ss,{tooltipContent:"Evaluate Trace","aria-label":"Evaluate Trace",onClick:ie,children:[l.jsx(Tz,{}),"Evaluate"]}),l.jsxs(ss,{tooltipContent:"Save as Dataset Item","aria-label":"Save as Dataset Item",onClick:()=>x(!0),children:[l.jsx(ou,{}),"Save"]})]})]})})]}),E&&l.jsx(ht.Row,{children:l.jsx(ht.Column,{children:l.jsx(E_t,{rootSpan:E,numOfCol:3})})})]});return _?l.jsxs(ht,{height:"full",children:[l.jsx(ht.TopArea,{children:ne}),l.jsx(ht.MainArea,{isCentered:!0,children:l.jsx(A_t,{error:_,resource:"traces",errorTitle:"Failed to load trace"})})]}):l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:ne}),l.jsx(cEe,{rootSpanId:E?.spanId,traceId:e,isOpen:v,onClose:()=>x(!1)}),l.jsxs("div",{className:Y("grid h-full min-h-0 gap-4 overflow-hidden items-start mt-4",c?"grid-cols-[2fr_3fr]":"grid-cols-[1fr]"),children:[l.jsx(j_t,{traceId:e,spans:O,isLoading:S,onClose:J,onSpanSelect:q,onEvaluateTrace:ie,initialSpanId:c,placement:"trace-page",timelineChartWidth:c?"default":"wide"}),c&&!S&&l.jsxs("div",{className:Y("grid gap-4 max-h-full min-h-0 overflow-auto",d?"grid-rows-[1fr_1fr]":"grid-rows-[1fr]"),children:[l.jsx(N_t,{traceId:e,spanId:c,span:j?.span,isLoading:T,onClose:W,onPrevious:Q,onNext:V,activeTab:h,onTabChange:$,feedbackTabBadge:L?.pagination?.total??void 0,feedbackTabSlot:()=>l.jsx(l6t,{feedbackData:L,onPageChange:M,isLoadingFeedbackData:U}),scoringTabBadge:P?.pagination?.total??void 0,scoringTabSlot:({span:te,traceId:ae,spanId:de})=>l.jsxs("div",{className:"grid gap-6",children:[l.jsx(lEe,{traceId:ae,isTopLevelSpan:!te.parentSpanId,spanId:de,entityType:te.attributes?.agentId||te.entityType===Sl.AGENT?"Agent":te.attributes?.workflowId||te.entityType===Sl.WORKFLOW_RUN?"Workflow":void 0,scorers:N,isLoadingScorers:I}),l.jsx(c6t,{scoresData:P,onPageChange:g,isLoadingScoresData:R,onScoreSelect:Z})]})}),d&&l.jsx(XOe,{score:d,onClose:G})]})]})]})}function Ors(){const{data:e,isLoading:t,error:n}=Zw(),[r,s]=y.useState("");return n&&Hs(n)?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(pa,{})}):n&&Ps(n)?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(aa,{resource:"workflows"})}):n?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(dc,{title:"Failed to load workflows",message:n.message})}):Object.keys(e||{}).length===0&&!t?l.jsx(lr,{title:"Workflows",icon:l.jsx(go,{}),children:l.jsx(n$r,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(go,{})," Workflows"]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsxs(ce,{as:ln,to:"/workflows/schedules",children:[l.jsx(Gg,{}),"Schedules"]}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:l.jsx(yo,{})})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:s,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),l.jsx(t$r,{workflows:e||{},isLoading:t,search:r})]})}const Ers={active:"bg-accent1",paused:"bg-accent3"},Crs={active:"text-accent1",paused:"text-accent3"},d6t=({status:e})=>l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${Ers[e]}`,"aria-hidden":!0}),l.jsx("span",{className:`text-ui-sm ${Crs[e]}`,children:e})]}),SC=e=>!e||e<=0?"—":new Date(e).toLocaleString(),AR=e=>{if(!e||e<=0)return"—";const t=e-Date.now(),n=Math.abs(t),r=Math.floor(n/1e3);if(r<60)return t>=0?`in ${r}s`:`${r}s ago`;const s=Math.floor(r/60);if(s<60)return t>=0?`in ${s}m`:`${s}m ago`;const a=Math.floor(s/60);if(a<24)return t>=0?`in ${a}h`:`${a}h ago`;const i=Math.floor(a/24);return t>=0?`in ${i}d`:`${i}d ago`};function f6t({status:e}){const{icon:t,color:n}=Trs(e);return l.jsxs("span",{className:`inline-flex items-center gap-1.5 whitespace-nowrap text-ui-sm ${n}`,children:[l.jsx("span",{className:"inline-flex shrink-0 items-center","aria-hidden":!0,children:t}),l.jsx("span",{children:e})]})}function Trs(e){switch(e){case"success":return{icon:l.jsx(qa,{size:14}),color:"text-accent1"};case"failed":return{icon:l.jsx(qr,{size:14}),color:"text-accent2"};case"running":return{icon:l.jsx(Ut,{}),color:"text-neutral3"};case"suspended":return{icon:l.jsx(Qme,{size:14}),color:"text-accent3"};case"canceled":return{icon:l.jsx(Xd,{size:14}),color:"text-neutral3"};case"pending":case"waiting":return{icon:l.jsx(Kk,{size:14}),color:"text-neutral3"};default:return{icon:null,color:"text-neutral3"}}}const pKe="auto auto auto auto 1fr";function jrs(e){if(e===void 0)return"—";if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${t}m ${n}s`}function Nrs(e){const t=Math.abs(e),n=e<0?"-":"";return t<1e3?`${n}${t}ms`:t<6e4?`${n}${(t/1e3).toFixed(1)}s`:t<36e5?`${n}${(t/6e4).toFixed(1)}m`:`${n}${(t/36e5).toFixed(1)}h`}const Ars=3e4,Irs=5*6e4;function Rrs({triggers:e,isLoading:t,workflowId:n,hasNextPage:r,isFetchingNextPage:s,setEndOfListElement:a}){const{Link:i,paths:o}=cn();return t?l.jsx(qd,{columns:pKe}):e.length===0?l.jsx(me,{variant:"ui-md",className:"text-neutral4 p-4",children:"No trigger history yet."}):l.jsxs(xe,{columns:pKe,children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Run"}),l.jsx(xe.TopCell,{children:"Status"}),l.jsx(xe.TopCell,{children:"Started"}),l.jsx(xe.TopCell,{children:"Duration"}),l.jsx(xe.TopCell,{children:" "})]}),e.map(c=>{const u=c.actualFireAt-c.scheduledFireAt,d=Nrs(u),f=`Scheduled ${SC(c.scheduledFireAt)} — published ${SC(c.actualFireAt)} (drift ${d})`,h=c.outcome==="failed",p=h?c.error:c.run?.error,m=Math.abs(u),g=!h&&m>Ars&&m<=Irs,v=`${c.scheduleId}-${c.runId}-${c.actualFireAt}`,x=l.jsx("span",{className:n&&!h?"text-accent1 font-mono text-ui-sm whitespace-nowrap":"text-neutral3 font-mono text-ui-sm whitespace-nowrap",children:c.runId}),w=l.jsxs(l.Fragment,{children:[l.jsx(xe.NameCell,{children:x}),l.jsx(xe.TextCell,{children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[h?l.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-ui-sm text-accent2",children:[l.jsx(tb,{size:14}),"publish failed"]}):c.run?l.jsx(f6t,{status:c.run.status}):l.jsx("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-ui-sm text-neutral3",children:"pending"}),p?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"text-accent2 inline-flex",children:l.jsx(tb,{size:14})})}),l.jsx(er,{children:p})]}):null]})}),l.jsx(xe.TextCell,{children:l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx("span",{title:f,children:AR(c.actualFireAt)}),g?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{className:"text-accent3 inline-flex",children:l.jsx(tb,{size:14})})}),l.jsxs(er,{children:["Published ",d," after the scheduled fire time"]})]}):null]})}),l.jsx(xe.TextCell,{children:c.run?l.jsx("span",{children:jrs(c.run.durationMs)}):l.jsx("span",{className:"text-neutral4",children:"—"})}),l.jsx(xe.TextCell,{children:" "})]});return n&&c.run&&!h?l.jsx(xe.RowLink,{to:o.workflowRunLink(n,c.runId),LinkComponent:i,children:w},v):l.jsx(xe.Row,{children:w},v)}),a?l.jsxs("div",{ref:a,className:"h-1 col-span-full",children:[s?l.jsx("div",{className:"flex justify-center py-4",children:l.jsx(Ut,{})}):null,!r&&e.length>0?l.jsx(me,{variant:"ui-xs",className:"text-neutral4 text-center py-4 block",children:"All triggers loaded"}):null]}):null]})}const Prs=e=>{const t=Ze();return Ct({queryKey:["schedule",e],enabled:!!e,queryFn:async()=>{if(!e)throw new Error("scheduleId is required");return t.getSchedule(e)}})},mKe=25,$rs=e=>{const t=Ze(),{inView:n,setRef:r}=Hw(),s=Xb({queryKey:["schedule-triggers",e],enabled:!!e,initialPageParam:void 0,queryFn:async({pageParam:u})=>e?t.listScheduleTriggers(e,{limit:mKe,toActualFireAt:u}):{triggers:[]},getNextPageParam:u=>{if(!(!u?.triggers?.length||u.triggers.length<mKe))return u.triggers[u.triggers.length-1].actualFireAt},refetchInterval:u=>(u.state.data?.pages.flatMap(h=>h.triggers)??[]).some(h=>h.run?h.run.status==="pending"||h.run.status==="running"||h.run.status==="waiting":h.outcome==="published")?5e3:!1}),a=s.data?.pages.flatMap(u=>u?.triggers??[])??[],{hasNextPage:i,isFetchingNextPage:o,fetchNextPage:c}=s;return y.useEffect(()=>{n&&i&&!o&&c()},[n,i,o,c]),{...s,data:a,setEndOfListElement:r}},Mrs=e=>{const t=Ze(),n=ha();return or({mutationFn:async r=>{if(!e)throw new Error("scheduleId is required");return r==="pause"?t.pauseSchedule(e):t.resumeSchedule(e)},onSuccess:(r,s)=>{n.invalidateQueries({queryKey:["schedule",e]}),n.invalidateQueries({queryKey:["schedules"]}),ze.success(s==="pause"?"Schedule paused":"Schedule resumed")},onError:r=>{ze.error(r.message)}})};function X5({label:e,children:t}){return l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx(me,{variant:"ui-xs",className:"text-neutral4 uppercase tracking-wide",children:e}),l.jsx("div",{className:"text-ui-md",children:t})]})}function Drs(){const{scheduleId:e}=Sa(),{paths:t}=cn(),{data:n,isLoading:r,error:s}=Prs(e),{data:a,isLoading:i,error:o,hasNextPage:c,isFetchingNextPage:u,setEndOfListElement:d}=$rs(e),f=Mrs(e);if(s&&Hs(s))return l.jsx(lr,{title:"Schedule",icon:l.jsx(Gg,{}),children:l.jsx(pa,{})});if(s&&Ps(s))return l.jsx(lr,{title:"Schedule",icon:l.jsx(Gg,{}),children:l.jsx(aa,{resource:"schedules"})});if(s)return l.jsx(lr,{title:"Schedule",icon:l.jsx(Gg,{}),children:l.jsx(dc,{title:"Failed to load schedule",message:s.message})});const h=n?.target.type==="workflow"?n.target.workflowId:void 0;return l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:r,children:[l.jsx(Gg,{}),l.jsx("span",{className:"font-mono",children:n?.id??e})]})})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[l.jsxs(ce,{as:ln,to:t.schedulesLink(),variant:"ghost",children:[l.jsx(oh,{}),"Back to schedules"]}),h?l.jsx(ce,{as:ln,to:t.workflowLink(h),variant:"ghost",children:"Open workflow"}):null,n?l.jsx(ce,{onClick:()=>f.mutate(n.status==="active"?"pause":"resume"),disabled:f.isPending,"data-testid":"schedule-toggle-button",children:n.status==="active"?l.jsxs(l.Fragment,{children:[l.jsx(tge,{}),"Pause"]}):l.jsxs(l.Fragment,{children:[l.jsx(fb,{}),"Resume"]})}):null]})]})}),n?l.jsxs("div",{className:"grid gap-6 h-full overflow-hidden grid-cols-[minmax(0,20rem)_1fr]",children:[l.jsxs("div",{className:"flex flex-col gap-4 border border-border1 rounded-md p-4 h-fit",children:[l.jsx(X5,{label:"Workflow",children:h?l.jsx(ln,{to:t.workflowLink(h),className:"text-accent1 hover:underline",children:h}):"—"}),l.jsxs(X5,{label:"Cron",children:[l.jsx("code",{className:"font-mono text-ui-md",children:n.cron}),n.timezone?l.jsx("span",{className:"text-neutral4 ml-2 text-ui-sm",children:n.timezone}):null]}),l.jsx(X5,{label:"Status",children:l.jsx(d6t,{status:n.status})}),l.jsx(X5,{label:"Next fire",children:l.jsx("span",{title:SC(n.nextFireAt),children:AR(n.nextFireAt)})})]}),l.jsxs("div",{className:"overflow-y-auto","data-testid":"schedule-triggers-panel",children:[l.jsx(me,{variant:"ui-md",className:"mb-3",children:"Trigger history"}),o?l.jsx(dc,{title:"Failed to load trigger history",message:o.message}):l.jsx(Rrs,{triggers:a??[],isLoading:i,workflowId:h,hasNextPage:c,isFetchingNextPage:u,setEndOfListElement:d})]})]}):null]})}const gKe="minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1fr) auto auto auto";function Lrs({schedules:e,isLoading:t,search:n=""}){const{paths:r,Link:s}=cn(),a=y.useMemo(()=>{const i=n.toLowerCase();return i?e.filter(o=>o.id.toLowerCase().includes(i)||o.target.workflowId.toLowerCase().includes(i)):e},[e,n]);return t?l.jsx(qd,{columns:gKe}):l.jsxs(xe,{columns:gKe,children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Workflow"}),l.jsx(xe.TopCell,{children:"Schedule ID"}),l.jsx(xe.TopCell,{children:"Cron"}),l.jsx(xe.TopCell,{children:"Status"}),l.jsx(xe.TopCell,{children:"Next fire"}),l.jsx(xe.TopCell,{children:"Last run"})]}),a.length===0&&n?l.jsx(xe.NoMatch,{message:"No schedules match your search"}):null,a.length===0&&!n?l.jsx(xe.NoMatch,{message:"No schedules configured"}):null,a.map(i=>l.jsxs(xe.RowLink,{to:r.scheduleLink(i.id),LinkComponent:s,children:[l.jsx(xe.NameCell,{children:l.jsx("span",{className:"truncate",children:i.target.workflowId})}),l.jsx(xe.TextCell,{children:l.jsx("span",{className:"truncate font-mono text-ui-sm",title:i.id,children:i.id})}),l.jsx(xe.TextCell,{children:l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx("code",{className:"font-mono text-ui-sm",children:i.cron}),i.timezone?l.jsx("span",{className:"text-neutral4 text-ui-xs",children:i.timezone}):null]})}),l.jsx(xe.TextCell,{children:l.jsx(d6t,{status:i.status})}),l.jsx(xe.TextCell,{children:l.jsx("span",{className:"whitespace-nowrap",title:SC(i.nextFireAt),children:AR(i.nextFireAt)})}),l.jsx(xe.TextCell,{children:i.lastRun?l.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[l.jsx(f6t,{status:i.lastRun.status}),l.jsx("span",{className:"text-neutral4 text-ui-sm",title:SC(i.lastFireAt),children:i.lastFireAt?AR(i.lastFireAt):""})]}):i.lastFireAt?l.jsx("span",{className:"whitespace-nowrap",title:SC(i.lastFireAt),children:AR(i.lastFireAt)}):l.jsx("span",{className:"text-neutral4",children:"Never"})})]},i.id))]})}function zrs({workflowId:e}={}){const{data:t,isLoading:n,error:r}=Gwe(e?{workflowId:e}:{}),[s,a]=y.useState("");return r?l.jsx(dc,{title:"Failed to load schedules",message:r.message}):l.jsxs("div",{className:"grid grid-rows-[auto_1fr] gap-4 h-full overflow-hidden",children:[l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:a,label:"Filter schedules",placeholder:"Filter by id or workflow"})}),l.jsx("div",{className:"overflow-y-auto",children:l.jsx(Lrs,{schedules:t??[],isLoading:n,search:s})})]})}function Frs(){const[e]=wo(),t=e.get("workflowId")??void 0,{error:n}=Gwe(t?{workflowId:t}:{});if(n&&Hs(n))return l.jsx(lr,{title:"Schedules",icon:l.jsx(Gg,{}),children:l.jsx(pa,{})});if(n&&Ps(n))return l.jsx(lr,{title:"Schedules",icon:l.jsx(Gg,{}),children:l.jsx(aa,{resource:"schedules"})});const r=t?`/workflows/${t}`:"/workflows",s=t?"Back to workflow":"Back to workflows";return l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{children:[l.jsx(Gg,{})," ",t?`Schedules · ${t}`:"Schedules"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsxs(ce,{as:ln,to:r,variant:"ghost",children:[l.jsx(oh,{}),s]})})]})}),l.jsx(zrs,{workflowId:t})]})}const vKe=()=>{const{workflowId:e}=Sa(),{data:t,isLoading:n,error:r}=W2(e);return r&&Hs(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})}):r&&Ps(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"workflows"})}):l.jsx(GRt,{workflowId:e,workflow:t??void 0,isLoading:n})};function Brs(e){if(!e)return null;switch(e.icon||e.provider){case"aws-s3":case"s3":return l.jsx(TSt,{className:"h-4 w-4 text-[#FF9900]"});case"google-cloud":case"google-cloud-storage":case"gcs":return l.jsx(CSt,{className:"h-4 w-4"});case"azure-blob":case"azure":return l.jsx(jSt,{className:"h-4 w-4 text-[#0078D4]"});case"cloudflare":case"cloudflare-r2":case"r2":return l.jsx(cG,{className:"h-4 w-4 text-[#F38020]"});case"minio":return l.jsx(Yle,{className:"h-4 w-4 text-red-400"});case"database":return l.jsx(Ja,{className:"h-4 w-4 text-emerald-400"});case"local":case"folder":return l.jsx(Zc,{className:"h-4 w-4 text-amber-400"});case"hard-drive":return l.jsx(Yle,{className:"h-4 w-4 text-slate-400"});case"cloud":return l.jsx(cG,{className:"h-4 w-4 text-sky-400"});default:return l.jsx(cG,{className:"h-4 w-4 text-neutral4"})}}function h6t(e,t=!1){const{name:n,type:r,mount:s}=e;if(r==="directory")return s?Brs(s):t?l.jsx(rj,{className:"h-4 w-4 text-amber-400"}):l.jsx(Zc,{className:"h-4 w-4 text-amber-400"});switch(n.split(".").pop()?.toLowerCase()){case"ts":case"tsx":case"js":case"jsx":return l.jsx(V0,{className:"h-4 w-4 text-blue-400"});case"json":return l.jsx(EM,{className:"h-4 w-4 text-yellow-400"});case"md":case"mdx":return l.jsx(Do,{className:"h-4 w-4 text-neutral4"});case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return l.jsx(Kme,{className:"h-4 w-4 text-purple-400"});default:return l.jsx(Yme,{className:"h-4 w-4 text-neutral4"})}}function p6t(e){if(e==null||Number.isNaN(e))return"";if(e<0)return"-"+p6t(-e);if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/Math.pow(t,r)).toFixed(1))+" "+n[r]}function Urs(e){if("body"in e&&e.body&&typeof e.body=="object"){const r=e.body;if(typeof r.error=="string")return r.error;if(typeof r.message=="string")return r.message}const t=e.message,n=t.lastIndexOf(" - {");if(n!==-1)try{const r=t.slice(n+3),s=JSON.parse(r);if(s.error)return s.error;if(s.message)return s.message}catch{}return t.includes("status: 404")?"Directory not found":t}function m6t(e){return e==="."||e===""}function qrs({path:e,onNavigate:t}){const r=m6t(e)?[]:e.split("/").filter(Boolean);return l.jsxs("div",{className:"flex items-center gap-1 text-sm overflow-x-auto",children:[l.jsx("button",{onClick:()=>t("."),className:"p-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors","aria-label":"Workspace root",children:l.jsx(rj,{className:"h-4 w-4"})}),r.map((s,a)=>{const i=r.slice(0,a+1).join("/");return l.jsxs("div",{className:"flex items-center",children:[l.jsx(ga,{className:"h-4 w-4 text-neutral3"}),l.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 Vrs({entries:e,currentPath:t,isLoading:n,error:r,onNavigate:s,onFileSelect:a,onRefresh:i,onUpload:o,onCreateDirectory:c,onDelete:u,isCreatingDirectory:d,isDeleting:f}){const[h,p]=y.useState(null),m=[...e].sort((w,S)=>w.type==="directory"&&S.type!=="directory"?-1:w.type!=="directory"&&S.type==="directory"?1:w.name.localeCompare(S.name)),g=m6t(t),v=w=>{const S=g?w.name:`${t}/${w.name}`;w.type==="directory"?s(S):a?.(S)},x=w=>{const S=g?w.name:`${t}/${w.name}`;p(S)};return l.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[l.jsx(qrs,{path:t,onNavigate:s}),l.jsxs("div",{className:"flex items-center gap-1",children:[i&&l.jsx(ce,{variant:"ghost",size:"md",onClick:i,disabled:n,"aria-label":"Refresh files",children:l.jsx(CM,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),c&&l.jsx(ce,{variant:"ghost",size:"md",disabled:d,"aria-label":"Create directory",onClick:()=>{const w=prompt("Directory name:");if(w){const S=g?w:`${t}/${w}`;c(S)}},children:d?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):l.jsx(J8,{className:"h-4 w-4"})}),o&&l.jsx(ce,{variant:"ghost",size:"md",onClick:o,"aria-label":"Upload files",children:l.jsx(rU,{className:"h-4 w-4"})})]})]}),l.jsx("div",{className:"max-h-[400px] overflow-auto",children:n?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):r?l.jsxs("div",{className:"py-12 px-4 text-center",children:[l.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-500/10 mb-4",children:l.jsx(qR,{className:"h-6 w-6 text-red-400"})}),l.jsx("p",{className:"text-sm text-neutral6 font-medium mb-1",children:"Failed to load directory"}),l.jsx("p",{className:"text-xs text-neutral4 max-w-sm mx-auto",children:Urs(r)})]}):m.length===0?l.jsx("div",{className:"py-12 text-center text-neutral4 text-sm",children:g?"Workspace is empty":"Directory is empty"}):l.jsx(sf,{children:l.jsxs("ul",{children:[!g&&l.jsx("li",{children:l.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:[l.jsx(rj,{className:"h-4 w-4 text-amber-400"}),l.jsx("span",{className:"text-sm text-neutral5",children:".."})]})}),m.map(w=>{const S=w.mount?.displayName||w.mount?.provider,_=w.mount?.status==="error";return l.jsx("li",{className:"group",children:l.jsxs("div",{className:"flex items-center hover:bg-surface4 transition-colors",children:[l.jsxs("button",{onClick:()=>v(w),className:"flex-1 flex items-center gap-3 px-4 py-2 text-left",children:[h6t(w),l.jsx("span",{className:"text-sm text-neutral6 flex-1 truncate",children:w.name}),w.mount&&_&&l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{tabIndex:0,className:"flex items-center",children:l.jsx(qR,{className:"h-4 w-4 text-red-400"})})}),l.jsxs(er,{className:"max-w-xs",children:[l.jsx("span",{className:"text-red-400",children:"Error:"})," ",w.mount.error||"Failed to connect to this filesystem"]})]}),w.mount&&S&&(w.mount.description?l.jsxs(sr,{children:[l.jsx(ar,{asChild:!0,children:l.jsx("span",{tabIndex:0,className:`text-xs px-1.5 py-0.5 rounded ${_?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})}),l.jsx(er,{children:w.mount.description})]}):l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${_?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})),w.type==="file"&&w.size!==void 0&&l.jsx("span",{className:"text-xs text-neutral3 tabular-nums",children:p6t(w.size)})]}),u&&!w.mount&&l.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:l.jsx(Kd,{className:"h-3.5 w-3.5"})})]})},w.name)})]})})}),l.jsx(Wt,{open:!!h,onOpenChange:w=>!f&&!w&&p(null),children:l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Delete Item"}),l.jsxs(Wt.Description,{children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{disabled:f,children:"Cancel"}),l.jsxs(Wt.Action,{disabled:f,onClick:async()=>{try{h&&u&&await u(h)}finally{p(null)}},children:[f?l.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}):null,"Delete"]})]})]})})]})}function Hrs(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 Wrs({content:e,language:t}){return l.jsx(LOe,{language:t,style:zOe.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},codeTagProps:{style:{fontFamily:"var(--geist-mono), ui-monospace, monospace"}},children:e})}function Zrs({path:e,content:t,isLoading:n,mimeType:r,onClose:s}){const a=e.split("/").pop()||e,i=a.split(".").pop()?.toLowerCase(),o=r?.startsWith("image/")||["png","jpg","jpeg","gif","svg","webp"].includes(i||""),c=Hrs(i);return l.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[h6t({name:a,type:"file"}),l.jsx("span",{className:"text-sm font-medium text-neutral6",children:a})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(da,{content:t,copyMessage:"Copied file content"}),s&&l.jsx(ce,{variant:"ghost",size:"md",onClick:s,children:"Close"})]})]}),l.jsx("div",{className:"max-h-[500px] overflow-auto h-full",style:{backgroundColor:"black"},children:n?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):o?l.jsx("div",{className:"p-4 flex items-center justify-center",children:l.jsx("img",{src:`data:${r||"image/png"};base64,${btoa(t)}`,alt:a,className:"max-w-full max-h-[400px] object-contain"})}):c?l.jsx(Wrs,{content:t,language:c}):l.jsx("pre",{className:"p-4 text-sm text-neutral5 whitespace-pre-wrap font-mono overflow-x-auto",children:t})})]})}const Grs=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Workspaces yet",descriptionSlot:l.jsxs(l.Fragment,{children:["Add a workspace to your Mastra configuration to ",l.jsx("br",{}),"manage files, skills, and enable semantic search."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",l.jsx(Va,{})]})})}),Qrs=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(iGt,{}),titleSlot:"Workspace Not Configured",descriptionSlot:l.jsxs(l.Fragment,{children:["No workspace is configured. Add a workspace to your ",l.jsx("br",{}),"Mastra configuration to manage files, skills, and enable semantic search."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",l.jsx(Va,{})]})})}),Yrs=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(qR,{}),titleSlot:"Workspace Not Supported",descriptionSlot:l.jsxs(l.Fragment,{children:["The workspace feature requires a newer version of ",l.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),".",l.jsx("br",{}),"Please upgrade your dependencies to enable workspace functionality."]}),actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",l.jsx(Va,{})]})})}),vle={bm25:{label:"Keyword",icon:l.jsx(Do,{className:"h-3.5 w-3.5"}),color:"bg-blue-500/10 text-blue-400 border-blue-500/30"},vector:{label:"Semantic",icon:l.jsx(AC,{className:"h-3.5 w-3.5"}),color:"bg-purple-500/10 text-purple-400 border-purple-500/30"},hybrid:{label:"Hybrid",icon:l.jsx(VYt,{className:"h-3.5 w-3.5"}),color:"bg-amber-500/10 text-amber-400 border-amber-500/30"}};function g6t(e){return e.id.replace(/#chunk-\d+$/,"")}function Xrs({onSearch:e,isSearching:t,searchResults:n,canBM25:r,canVector:s,onViewResult:a}){const[i,o]=y.useState(""),[c,u]=y.useState(5),d=()=>r&&s?"hybrid":r?"bm25":s?"vector":"bm25",[f,h]=y.useState(d()),p=g=>{g.preventDefault(),i.trim()&&e({query:i.trim(),topK:c,mode:f})},m=[...r?["bm25"]:[],...s?["vector"]:[],...r&&s?["hybrid"]:[]];return l.jsxs("div",{className:"rounded-lg bg-surface4",children:[l.jsxs("form",{onSubmit:p,className:"p-4",children:[l.jsxs("div",{className:"flex gap-3 items-center",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(aj,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),l.jsx(mn,{value:i,onChange:g=>o(g.target.value),placeholder:"Search workspace files...",className:"pl-9 h-10 bg-surface2 border-border1"})]}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-xs text-neutral4",children:"Top"}),l.jsx(mn,{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"})]}),l.jsx(ce,{type:"submit",disabled:t||!i.trim(),size:"lg",className:"h-10 px-4",children:t?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):"Search"})]}),m.length>0&&l.jsx("div",{className:"flex gap-2 mt-3",children:m.map(g=>{const v=vle[g],x=f===g;return l.jsxs("button",{type:"button",onClick:()=>h(g),className:`
672
672
  inline-flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium border transition-colors
673
673
  ${x?v.color:"bg-surface2 text-neutral4 border-transparent hover:bg-surface3"}
674
- `,children:[v.icon,v.label]},g)})})]}),n&&l.jsxs("div",{className:"border-t border-border1",children:[l.jsxs("div",{className:"px-4 py-2 flex items-center justify-between text-xs",children:[l.jsxs("span",{className:"text-neutral4",children:[n.results.length," result",n.results.length!==1?"s":"",' for "',l.jsx("span",{className:"text-neutral6",children:n.query}),'"']}),l.jsx("span",{className:`px-1.5 py-0.5 rounded ${vle[n.mode].color}`,children:vle[n.mode].label})]}),n.results.length===0?l.jsx("div",{className:"px-4 py-8 text-center text-neutral4 text-sm",children:"No results found. Try a different query."}):l.jsx("ul",{className:"max-h-[320px] overflow-auto",children:n.results.map((g,v)=>l.jsx(Krs,{result:g,rank:v+1,onClick:()=>a?.(g6t(g))},`${g.id}-${v}`))})]})]})}function Krs({result:e,rank:t,onClick:n}){const r=Math.min(100,Math.max(0,e.score*100)),s=g6t(e);return l.jsx("li",{className:"border-t border-border1 first:border-t-0",children:l.jsxs("button",{onClick:n,className:"w-full px-4 py-3 text-left hover:bg-surface5 transition-colors flex gap-3",children:[l.jsx("span",{className:"text-xs text-neutral3 tabular-nums w-4 shrink-0",children:t}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(rj,{className:"h-3.5 w-3.5 text-neutral4 shrink-0"}),l.jsx("span",{className:"font-mono text-sm text-neutral6 truncate",children:s}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("div",{className:"w-12 h-1 rounded-full bg-surface2 overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-accent1",style:{width:`${r}%`}})}),l.jsx("span",{className:"text-ui-xs text-neutral3 tabular-nums",children:e.score.toFixed(2)})]})]}),l.jsx("p",{className:"text-xs text-neutral4 line-clamp-2",children:e.content}),e.lineRange&&l.jsxs("p",{className:"text-xs text-neutral3 mt-1",children:["Lines ",e.lineRange.start,"–",e.lineRange.end]})]})]})})}function Jrs({onSearch:e,results:t,isSearching:n,onResultClick:r}){const[s,a]=y.useState(""),[i,o]=y.useState(5),[c,u]=y.useState(!0),d=f=>{f.preventDefault(),s.trim()&&e({query:s.trim(),topK:i,includeReferences:c})};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("form",{onSubmit:d,className:"space-y-3",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(aj,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),l.jsx("input",{type:"text",value:s,onChange:f=>a(f.target.value),placeholder:"Search across skills...",className:"w-full pl-10 pr-4 py-2 rounded-lg bg-surface3 border border-border1 text-sm text-neutral6 placeholder:text-neutral3 focus:outline-hidden focus:ring-2 focus:ring-accent1"})]}),l.jsx(ce,{type:"submit",disabled:!s.trim()||n,children:n?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):"Search"})]}),l.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[l.jsxs("label",{className:"flex items-center gap-2 text-neutral4",children:[l.jsx("span",{children:"Results:"}),l.jsxs("select",{value:i,onChange:f=>o(Number(f.target.value)),className:"px-2 py-1 rounded bg-surface3 border border-border1 text-neutral5",children:[l.jsx("option",{value:3,children:"3"}),l.jsx("option",{value:5,children:"5"}),l.jsx("option",{value:10,children:"10"}),l.jsx("option",{value:20,children:"20"})]})]}),l.jsxs("label",{className:"flex items-center gap-2 text-neutral4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:c,onChange:f=>u(f.target.checked),className:"rounded border-border1 bg-surface3"}),l.jsx("span",{children:"Include references"})]})]})]}),t.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5",children:["Found ",t.length," result",t.length!==1?"s":""]}),l.jsx("div",{className:"space-y-2",children:t.map((f,h)=>l.jsx(ess,{result:f,onClick:()=>r?.(f)},`${f.skillName}-${f.source}-${h}`))})]})]})}function ess({result:e,onClick:t}){const n=e.source!=="SKILL.md";return l.jsx("button",{onClick:t,className:"w-full p-4 rounded-lg bg-surface3 border border-border1 hover:border-accent1/50 text-left transition-colors",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"p-1.5 rounded bg-surface5 shrink-0 mt-0.5",children:n?l.jsx(Do,{className:"h-3.5 w-3.5 text-neutral4"}):l.jsx(qj,{className:"h-3.5 w-3.5 text-neutral4"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"font-medium text-neutral6",children:e.skillName}),l.jsx("span",{className:"text-xs text-neutral3",children:e.source}),l.jsxs("span",{className:"ml-auto text-xs text-neutral3",children:["Score: ",e.score.toFixed(3)]})]}),l.jsxs("p",{className:"text-sm text-neutral4 line-clamp-3 whitespace-pre-wrap",children:[e.content.slice(0,300),e.content.length>300&&"..."]}),e.lineRange&&l.jsxs("p",{className:"text-xs text-neutral3 mt-2",children:["Lines ",e.lineRange.start,"–",e.lineRange.end]})]})]})})}function tss({skillName:e,onUpdate:t,isUpdating:n}){return l.jsx(ce,{variant:"default",size:"icon-sm",disabled:n,tooltip:`Update ${e}`,onClick:t,children:n?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):l.jsx(FE,{className:"h-4 w-4"})})}function nss({skillName:e,onRemove:t,isRemoving:n}){return l.jsxs(Wt,{children:[l.jsx(Wt.Trigger,{asChild:!0,children:l.jsx(ce,{variant:"default",size:"icon-sm",disabled:n,tooltip:`Remove ${e}`,children:n?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):l.jsx(Kd,{className:"h-4 w-4"})})}),l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Remove Skill"}),l.jsxs(Wt.Description,{children:['Are you sure you want to remove the skill "',e,'"? This action cannot be undone.']})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{children:"Cancel"}),l.jsx(Wt.Action,{onClick:t,children:"Remove"})]})]})]})}const rss=".agents/skills/",gEe=[{name:"name",label:"Skill",size:"1fr"},{name:"description",label:"Description",size:"2fr"}],v6t=[...gEe,{name:"actions",label:"",size:"48px"}];function sss(e,t){if(!e||!t||t.length===0)return null;for(const n of t)if(e.startsWith(n+"/")||e===n)return n;return null}function ass({skills:e,isLoading:t,isSkillsConfigured:n=!0,hasUndiscoveredAgentSkills:r=!1,basePath:s="/workspace/skills",onAddSkill:a,onUpdateSkill:i,onRemoveSkill:o,updatingSkillName:c,removingSkillName:u,mountPaths:d}){const{navigate:f}=cn(),h=d&&d.length>0,p=w=>w.path?.includes(rss)??!1,m=e.some(p),g=!!o||!!i,v=g&&m,x=v?v6t:gEe;return!n&&!t?l.jsx(oss,{onAddSkill:a}):t?l.jsx(iss,{hasRowActions:g}):l.jsxs("div",{className:"space-y-4",children:[a&&l.jsx("div",{className:"flex items-center gap-4",children:l.jsxs(ce,{variant:"default",size:"sm",onClick:a,children:[l.jsx(Ne,{children:l.jsx(Rs,{className:"h-4 w-4"})}),"Add Skill"]})}),r&&l.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[l.jsx(tb,{className:"h-5 w-5 text-amber-500 shrink-0 mt-0.5"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("p",{className:"font-medium text-amber-500",children:"Skills installed but not discovered"}),l.jsxs("p",{className:"text-neutral4 mt-1",children:["You have skills in ",l.jsx("code",{className:"px-1 py-0.5 rounded bg-surface4 text-xs",children:".agents/skills"})," that aren't being discovered. Add this path to your workspace skills configuration to see them."]})]})]}),l.jsx(Ma,{children:l.jsxs(Ma.Trim,{children:[l.jsx(Ma.Header,{columns:x}),e.length>0?l.jsx(Ma.Entries,{children:e.map(w=>{const S={id:w.path,name:w.name,description:w.description||"—"},_=h?sss(w.path,d):null;return l.jsxs(Ma.Entry,{entry:S,columns:x,onClick:()=>{const O=`${s}/${encodeURIComponent(w.name)}?path=${encodeURIComponent(w.path)}`;f(O)},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"p-1.5 rounded bg-surface5",children:l.jsx(qj,{className:"h-3.5 w-3.5 text-neutral4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("span",{className:"font-medium text-neutral6",children:w.name}),w.path&&l.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[_&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral3 shrink-0",children:_}),l.jsx("span",{className:"text-[11px] text-neutral3 truncate",title:w.path,children:w.path})]})]})]}),l.jsx(Ma.EntryText,{children:w.description||"—"}),v&&l.jsx("div",{className:"flex justify-end gap-1",onClick:O=>O.stopPropagation(),children:p(w)&&l.jsxs(l.Fragment,{children:[i&&l.jsx(tss,{skillName:w.name,onUpdate:()=>i(w.name),isUpdating:c===w.name}),o&&l.jsx(nss,{skillName:w.name,onRemove:()=>o(w.name),isRemoving:u===w.name})]})})]},w.path)})}):l.jsx(Ma.Message,{message:a?'No skills discovered. Click "Add Skill" to install from skills.sh.':"No skills discovered. Add SKILL.md files to your skills directory."})]})})]})}function iss({hasRowActions:e}){const t=e?v6t:gEe;return l.jsx(Ma,{children:l.jsxs(Ma.Trim,{children:[l.jsx(Ma.Header,{columns:t}),l.jsx(Ma.Entries,{children:Array.from({length:3}).map((n,r)=>l.jsxs(Ma.Entry,{columns:t,isLoading:!0,children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"h-7 w-7 rounded bg-surface4 animate-pulse"}),l.jsxs("div",{children:[l.jsx("div",{className:"h-4 w-32 rounded bg-surface4 animate-pulse"}),l.jsx("div",{className:"h-3 w-40 rounded bg-surface4 animate-pulse mt-1"})]})]}),l.jsx("div",{className:"h-4 w-48 rounded bg-surface4 animate-pulse"}),e&&l.jsx("div",{className:"h-4 w-6 rounded bg-surface4 animate-pulse"})]},r))})]})})}function oss({onAddSkill:e}){return l.jsx("div",{className:"grid place-items-center py-16",children:l.jsxs("div",{className:"flex flex-col items-center text-center max-w-md",children:[l.jsx("div",{className:"p-4 rounded-full bg-surface4 mb-4",children:l.jsx(qj,{className:"h-8 w-8 text-neutral3"})}),l.jsx("h2",{className:"text-lg font-medium text-neutral6 mb-2",children:"Skills Not Configured"}),l.jsx("p",{className:"text-sm text-neutral4 mb-6",children:"No skills are configured in the workspace. Add SKILL.md files to your skills directory to discover and manage agent skills."}),l.jsxs("div",{className:"flex gap-3",children:[e&&l.jsxs(ce,{size:"lg",variant:"default",onClick:e,children:[l.jsx(Ne,{children:l.jsx(Rs,{className:"h-4 w-4"})}),"Add Skill from skills.sh"]}),l.jsxs(ce,{size:"lg",variant:"default",as:"a",href:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(Ne,{children:l.jsx(lZt,{className:"h-4 w-4"})}),"Learn about Skills"]})]})]})})}function lss(e){switch(e.type){case"external":return{icon:l.jsx(w0,{className:"h-3.5 w-3.5"}),label:"External Package",path:e.packagePath};case"local":return{icon:l.jsx(pQt,{className:"h-3.5 w-3.5"}),label:"Local Project",path:e.projectPath};case"managed":return{icon:l.jsx(a6,{className:"h-3.5 w-3.5"}),label:"Managed",path:e.mastraPath}}}function css({skill:e,rawSkillMd:t,onReferenceClick:n}){const[r,s]=y.useState(new Set(["instructions"])),[a,i]=y.useState(!1),o=lss(e.source),c=u=>{s(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})};return l.jsxs("div",{className:"space-y-6 min-w-0 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"p-3 rounded-lg bg-surface5",children:l.jsx(qj,{className:"h-6 w-6 text-neutral4"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:e.name}),l.jsx("p",{className:"text-sm text-neutral4 mt-1",children:e.description})]})]}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[l.jsx(sI,{label:"Source",value:o.label,icon:o.icon}),l.jsx(sI,{label:"Path",value:e.path,icon:l.jsx(rj,{className:"h-3.5 w-3.5"})}),e.license&&l.jsx(sI,{label:"License",value:e.license}),e.compatibility!=null&&l.jsx(sI,{label:"Compatibility",value:e.compatibility}),l.jsx(sI,{label:"References",value:`${e.references.length} files`,icon:l.jsx(Do,{className:"h-3.5 w-3.5"})})]}),l.jsx(K5,{title:"Instructions",isExpanded:r.has("instructions"),onToggle:()=>c("instructions"),headerAction:l.jsxs("button",{onClick:u=>{u.stopPropagation(),i(!a)},className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs text-neutral4 hover:text-neutral5 hover:bg-surface4 transition-colors",title:a?"Show rendered":"Show source",children:[a?l.jsx(cl,{className:"h-3.5 w-3.5"}):l.jsx(IGt,{className:"h-3.5 w-3.5"}),a?"Rendered":"Source"]}),children:a?l.jsx("div",{style:{backgroundColor:"black"},className:"rounded-lg overflow-x-auto w-0 min-w-full",children:l.jsx(LOe,{language:"markdown",style:zOe.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},children:t??e.instructions})}):l.jsx(yT,{children:e.instructions})}),e.references.length>0&&l.jsx(K5,{title:`References (${e.references.length})`,isExpanded:r.has("references"),onToggle:()=>c("references"),children:l.jsx("div",{className:"space-y-1",children:e.references.map(u=>l.jsxs("button",{onClick:()=>n?.(u),className:"flex items-center gap-2 w-full px-3 py-2 rounded hover:bg-surface4 text-left transition-colors",children:[l.jsx(Do,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),e.scripts.length>0&&l.jsx(K5,{title:`Scripts (${e.scripts.length})`,isExpanded:r.has("scripts"),onToggle:()=>c("scripts"),children:l.jsx("div",{className:"space-y-1",children:e.scripts.map(u=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded bg-surface3",children:[l.jsx(sGt,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),e.assets.length>0&&l.jsx(K5,{title:`Assets (${e.assets.length})`,isExpanded:r.has("assets"),onToggle:()=>c("assets"),children:l.jsx("div",{className:"space-y-1",children:e.assets.map(u=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded bg-surface3",children:[l.jsx(Kme,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),l.jsx("div",{className:"pt-4 border-t border-border1",children:l.jsxs("p",{className:"text-xs text-neutral3",children:["Path: ",l.jsx("code",{className:"px-1 py-0.5 rounded bg-surface4",children:e.path})]})})]})}function y6t(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>typeof t=="string"?t:JSON.stringify(t)).join(", ");if(typeof e=="object"&&e!==null){const t=Object.keys(e);if(t.length===0)return"{}";if(t.length===1){const n=t[0],r=e[n];return Array.isArray(r)?`${n}: ${r.join(", ")}`:`${n}: ${y6t(r)}`}return`{${t.join(", ")}}`}return String(e)}function sI({label:e,value:t,icon:n}){const r=y6t(t);return l.jsxs("div",{className:"p-3 rounded-lg bg-surface3",children:[l.jsx("p",{className:"text-xs text-neutral3 mb-1",children:e}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&l.jsx("span",{className:"text-neutral4",children:n}),l.jsx("p",{className:"text-sm font-medium text-neutral5 truncate",title:r,children:r})]})]})}function K5({title:e,isExpanded:t,onToggle:n,headerAction:r,children:s}){return l.jsxs("div",{className:"border border-border1 rounded-lg overflow-hidden min-w-0",children:[l.jsxs("div",{className:"flex items-center bg-surface3 hover:bg-surface4 transition-colors",children:[l.jsxs("button",{onClick:n,className:"flex items-center gap-2 flex-1 px-4 py-3",children:[t?l.jsx(Os,{className:"h-4 w-4 text-neutral3"}):l.jsx(ga,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm font-medium text-neutral5",children:e})]}),r&&l.jsx("div",{className:"pr-3",children:r})]}),t&&l.jsx("div",{className:"p-4 bg-surface2 overflow-x-auto w-0 min-w-full",children:s})]})}function uss({open:e,onOpenChange:t,skillName:n,referencePath:r,content:s,isLoading:a,error:i}){const{isCopied:o,copyToClipboard:c}=AV({copiedDuration:2e3});if(!e)return null;const u=()=>{s&&c(s)};return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>t(!1)}),l.jsxs("div",{className:"relative w-full max-w-4xl max-h-[85vh] mx-4 bg-surface2 rounded-xl border border-border1 shadow-2xl flex flex-col overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"reference-viewer-title",onKeyDown:d=>{d.key==="Escape"&&t(!1)},children:[l.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border1 bg-surface3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"p-1.5 rounded bg-surface5",children:l.jsx(Do,{className:"h-4 w-4 text-neutral4"})}),l.jsxs("div",{children:[l.jsx("h2",{id:"reference-viewer-title",className:"text-base font-medium text-neutral6",children:r}),l.jsxs("p",{className:"text-xs text-neutral3",children:["from ",n]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(ce,{size:"md",variant:"default",onClick:u,disabled:!s||a,children:[l.jsx(Ne,{children:o?l.jsx(qa,{className:"h-3.5 w-3.5 text-green-400"}):l.jsx(lh,{className:"h-3.5 w-3.5"})}),o?"Copied!":"Copy"]}),l.jsx("button",{onClick:()=>t(!1),"aria-label":"Close reference viewer",className:"p-2 rounded-lg hover:bg-surface4 text-neutral3 hover:text-neutral5 transition-colors",children:l.jsx(qr,{className:"h-4 w-4"})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-6",children:a?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx("div",{className:"h-6 w-6 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})}):i?l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load reference"}),l.jsx("p",{className:"text-sm text-neutral3",children:i})]}):s?l.jsx("pre",{className:"whitespace-pre-wrap text-sm text-neutral5 font-mono bg-surface3 p-4 rounded-lg overflow-auto",children:s}):l.jsx("div",{className:"flex items-center justify-center py-12 text-neutral3",children:"No content available"})})]})]})}function yKe(e){return`${e.topSource}/${e.name}`}function bKe(e){const t=_5t(e.topSource,e.name);return t?`${t.owner}/${t.repo}/${e.name}`:null}function dss({open:e,onOpenChange:t,workspaceId:n,onInstall:r,isInstalling:s,installedSkillIds:a=[],installedSkillNames:i=[],writableMounts:o,installedSkillPaths:c}){const[u,d]=y.useState(""),[f,h]=y.useState(null),[p,m]=y.useState(o&&o.length>0?o[0]?.path:void 0),{data:g,isLoading:v}=XYr(n),x=YYr(n),w=y.useMemo(()=>f?.topSource?_5t(f.topSource,f.name):null,[f]),S=y.useMemo(()=>!w||!f?null:`https://skills.sh/${w.owner}/${w.repo}/${f.name}`,[w,f]),{data:_,isLoading:O}=KYr(n,w?.owner,w?.repo,f?.name,{enabled:!!w&&!!f}),E=f_(M=>{M.trim().length>=2&&x.mutate(M)},300),j=y.useCallback(M=>{d(M),E(M)},[E]),T=y.useMemo(()=>u.trim().length>=2?x.data?.skills??[]:g?.skills??[],[u,x.data,g]),N=x.isPending,I=u.trim().length>=2,P=y.useMemo(()=>{if(!f)return!1;const M=bKe(f);return!!(M&&a.includes(M)||i.includes(f.name))},[f,a,i]),R=y.useCallback(()=>{!f||!w||r({repository:`${w.owner}/${w.repo}`,skillName:f.name,mount:o&&o.length>1?p:void 0})},[f,w,r,o,p]),F=y.useCallback(M=>{M||(d(""),h(null),m(o?.[0]?.path)),t(M)},[t,o]);return l.jsx(Fr,{open:e,onOpenChange:F,children:l.jsxs($r,{className:"max-w-4xl h-[80vh] flex flex-col",children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Add Skill"}),l.jsx(va,{children:"Search and install skills from the community registry"})]}),l.jsxs(is,{className:"flex-1 flex flex-col gap-4 overflow-hidden max-h-none",children:[l.jsxs("div",{className:"relative",children:[l.jsx(aj,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral3"}),l.jsx(mn,{placeholder:"Search skills...",value:u,onChange:M=>j(M.target.value),className:"pl-9"})]}),l.jsxs("div",{className:"flex flex-1 gap-4 min-h-0",children:[l.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[l.jsx("div",{className:"text-xs font-medium text-neutral4 uppercase tracking-wide mb-2",children:I?"Search Results":"Popular Skills"}),l.jsx(na,{className:"flex-1 border border-border1 rounded-lg",children:v||N?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):T.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-neutral4",children:[l.jsx(w0,{className:"h-8 w-8 mb-2"}),l.jsx("p",{className:"text-sm",children:I?"No skills found":"No skills available"})]}):l.jsx("div",{className:"p-2 space-y-1",children:T.map(M=>{const L=yKe(M),U=bKe(M),z=U&&a.includes(U)||i.includes(M.name),q=f?yKe(f):null;return l.jsx("button",{onClick:()=>h(M),className:Y("w-full text-left px-3 py-2 rounded-md transition-colors","hover:bg-surface4",q===L&&"bg-surface5 border border-accent1"),children:l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium text-sm text-neutral6 truncate",children:M.name}),z&&l.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent1/20 text-accent1",children:[l.jsx(qa,{className:"h-2.5 w-2.5"}),"Installed"]})]}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:M.topSource})]}),l.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral3 shrink-0",children:[l.jsx(FE,{className:"h-3 w-3"}),l.jsx("span",{children:M.installs.toLocaleString()})]})]})},L)})})})]}),l.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[l.jsx("div",{className:"text-xs font-medium text-neutral4 uppercase tracking-wide mb-2",children:"Preview"}),l.jsx("div",{className:"flex-1 border border-border1 rounded-lg overflow-hidden flex flex-col",children:f?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-4 border-b border-border1 bg-surface3",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"p-2 rounded-lg bg-surface5",children:l.jsx(qj,{className:"h-5 w-5 text-neutral4"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"font-semibold text-neutral6 truncate",children:f.name}),l.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-neutral4",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(sQt,{className:"h-3 w-3"}),f.topSource]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(FE,{className:"h-3 w-3"}),f.installs.toLocaleString()," installs"]})]})]}),w&&l.jsx("a",{href:`https://github.com/${w.owner}/${w.repo}`,target:"_blank",rel:"noopener noreferrer",className:"text-neutral4 hover:text-neutral5 transition-colors",title:"View on GitHub",children:l.jsx(Va,{className:"h-4 w-4"})})]})}),O?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):_?l.jsx(na,{className:"flex-1",children:l.jsx("div",{className:"p-4",children:l.jsx(yT,{children:_})})}):l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral4",children:[l.jsx(w0,{className:"h-8 w-8 mb-2"}),l.jsx("p",{className:"text-sm",children:"Preview unavailable"}),S&&l.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"text-xs mt-2 text-accent1 hover:underline flex items-center gap-1",children:["View on skills.sh ",l.jsx(Va,{className:"h-3 w-3"})]})]})]}):l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-neutral4",children:[l.jsx(w0,{className:"h-8 w-8 mb-2"}),l.jsx("p",{className:"text-sm",children:"Select a skill to preview"})]})})]})]}),f&&l.jsxs("div",{className:"flex flex-col gap-3 pt-4 border-t border-border1",children:[o&&o.length>1&&l.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-surface3 border border-border1",children:[l.jsx(Zc,{className:"h-4 w-4 text-icon4 shrink-0"}),l.jsx("label",{htmlFor:"mount-select",className:"text-sm text-icon5 whitespace-nowrap font-medium",children:"Install to"}),l.jsx("select",{id:"mount-select",value:p??"",onChange:M=>m(M.target.value),className:"flex-1 text-sm px-3 py-1.5 rounded-md border border-border1 bg-surface2 text-icon6",children:o.map(M=>{const L=M.displayName??M.name??M.provider??"unknown";return l.jsxs("option",{value:M.path,children:[L," (",M.path,")"]},M.path)})})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[P&&o&&o.length>1&&f&&c?.[f.name]&&(()=>{const M=c[f.name],L=o.find(U=>M.startsWith(U.path+"/")||M===U.path);return L?l.jsxs("span",{className:"text-xs text-icon4",children:["Installed at ",L.path]}):null})(),l.jsx(ce,{variant:"default",onClick:()=>F(!1),children:"Cancel"}),l.jsx(ce,{variant:"primary",onClick:R,disabled:!w||s||P,"data-testid":"install-skill-button",children:s?l.jsxs(l.Fragment,{children:[l.jsx(ei,{className:"h-4 w-4 mr-2 animate-spin"}),"Installing..."]}):P?l.jsxs(l.Fragment,{children:[l.jsx(qa,{className:"h-4 w-4 mr-2"}),"Already Installed"]}):l.jsxs(l.Fragment,{children:[l.jsx(FE,{className:"h-4 w-4 mr-2"}),"Install"]})})]})]})]})]})})}function xKe(){const{workspaceId:e}=Sa(),[t,n]=wo(),r=id(),[s,a]=y.useState(!1),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(null),[h,p]=y.useState(null),[m,g]=y.useState(!1),v=t.get("file"),x=t.get("tab"),{data:w,error:S,isLoading:_}=S5t(),O=w?.workspaces??[],E=e??O[0]?.id,{data:j,isLoading:T,error:N}=FYr(E),I=Hs(S)||Hs(N),P=Ps(S)||Ps(N),R=t.get("path")||".",F=vme(S)||vme(N),M=E?O.find(Fe=>Fe.id===E):void 0,L=Fe=>{const Je=new URLSearchParams(t);for(const[st,Ot]of Object.entries(Fe))Ot===null?Je.delete(st):Je.set(st,Ot);n(Je)},U=Fe=>{g(!1),a(!1),r(`/workspaces/${Fe}`)},z=Fe=>{L({path:Fe==="."||Fe===""?null:Fe,file:null})},q=Fe=>{L({file:Fe})},W=Fe=>{L({tab:Fe})},D=R,Q=v,{data:V,isLoading:$,error:Z,refetch:G}=BYr(D,{enabled:j?.isWorkspaceConfigured&&j?.capabilities?.hasFilesystem,workspaceId:E}),J=qYr(),ie=VYr(),{data:ne,isLoading:te}=k5t(Q??"",{enabled:!!Q,workspaceId:E}),{data:ae,isLoading:de,refetch:X}=WYr({workspaceId:E}),re=JYr(),le=eXr(),ge=tXr(),fe=j?.isWorkspaceConfigured??!1,ue=j?.capabilities?.hasFilesystem??!1,be=j?.capabilities?.hasSkills??!1,ke=j?.capabilities?.canBM25??!1,Ie=j?.capabilities?.canVector??!1,K=M?.safety?.readOnly??!1,oe=ue&&!K,we=j?.mounts,Pe=we?.filter(Fe=>!Fe.readOnly).map(Fe=>({path:Fe.path,displayName:Fe.displayName,icon:Fe.icon,provider:Fe.provider,name:Fe.name})),Le=we&&we.length>1?we.map(Fe=>Fe.path):void 0,ve=y.useCallback(Fe=>{E&&re.mutate({...Fe,workspaceId:E},{onSuccess:async Je=>{if(Je.success){u(!1);const{data:st,error:Ot}=await X();if(Ot||!st){ze.success(`Skill "${Je.skillName}" installed successfully (${Je.filesWritten} files)`);return}st.skills.some(un=>un.name===Je.skillName)?ze.success(`Skill "${Je.skillName}" installed successfully (${Je.filesWritten} files)`):(g(!0),ze.warning(`Skill "${Je.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else ze.error("Failed to install skill")},onError:Je=>{ze.error(`Failed to install skill: ${Je instanceof Error?Je.message:"Unknown error"}`)}})},[E,re,X]),Ce=y.useCallback(Fe=>{E&&(p(Fe),le.mutate({workspaceId:E,skillName:Fe},{onSuccess:Je=>{if(p(null),Je.updated.length>0){const st=Je.updated[0];st.success?(ze.success(`Skill "${Fe}" updated successfully (${st.filesWritten} files)`),X()):ze.error(`Failed to update skill: ${st.error??"Unknown error"}`)}else ze.error("Failed to update skill: No update result returned")},onError:Je=>{p(null),ze.error(`Failed to update skill: ${Je instanceof Error?Je.message:"Unknown error"}`)}}))},[E,le,X]),ye=y.useCallback(Fe=>{E&&(f(Fe),ge.mutate({workspaceId:E,skillName:Fe},{onSuccess:Je=>{f(null),Je.success?(ze.success(`Skill "${Je.skillName}" removed successfully`),X()):ze.error(`Failed to remove skill "${Je.skillName}"`)},onError:Je=>{f(null),ze.error(`Failed to remove skill: ${Je instanceof Error?Je.message:"Unknown error"}`)}}))},[E,ge,X]),De=x==="files"&&ue?"files":x==="skills"&&be?"skills":ue?"files":be?"skills":"files",ut=ae?.skills??[],jt=ae?.isSkillsConfigured??!1,xn=V?.entries??[],He=ue&&(ke||Ie),We=be&&jt&&ut.length>0,Re=He||We;if(_)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Ut,{})});if(I)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(pa,{})});if(P)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(aa,{resource:"workspaces"})});if(F)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Yrs,{})});const Qe=S||N;return Qe?l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(dc,{title:"Failed to load workspace",message:Qe.message})}):!_&&O.length===0?l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Grs,{})}):!T&&!_&&!fe?l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Qrs,{})}):l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsxs(Tr,{children:[l.jsxs(Tr.Title,{children:[l.jsx(Zc,{})," Workspace"]}),l.jsx(Tr.Description,{children:"Manage files, skills, and search your workspace"})]})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[Re&&l.jsx(ss,{onClick:()=>a(!s),tooltipContent:"Search workspace","aria-label":"Search workspace",children:l.jsx(aj,{})}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workspaces documentation","aria-label":"Workspaces documentation",children:l.jsx(yo,{})})]})]})}),l.jsxs(ht.MainArea,{className:"grid content-start gap-6",children:[O.length>1&&l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>o(!i),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[M?.source==="agent"?l.jsx(s6,{className:"h-4 w-4 text-accent1"}):l.jsx(a6,{className:"h-4 w-4 text-neutral4"}),l.jsxs("span",{className:"flex-1 text-left truncate",children:[M?.name??"Select workspace",M?.source==="agent"&&M.agentName&&l.jsxs("span",{className:"text-neutral4 ml-1",children:["(",M.agentName,")"]})]}),l.jsx(Os,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&l.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:O.map(Fe=>l.jsxs("button",{onClick:()=>{U(Fe.id),o(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${M?.id===Fe.id?"bg-surface3":""}`,children:[Fe.source==="agent"?l.jsx(s6,{className:"h-4 w-4 text-accent1 shrink-0"}):l.jsx(a6,{className:"h-4 w-4 text-neutral4 shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Fe.name}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:Fe.source==="agent"?`Agent: ${Fe.agentName}`:"Global workspace"})]}),l.jsxs("div",{className:"flex gap-1 shrink-0",children:[Fe.safety?.readOnly&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Fe.capabilities.hasFilesystem&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Fe.capabilities.hasSandbox&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Fe.capabilities.hasSkills&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Fe.id))})]}),O.length===1&&M&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[M.source==="agent"?l.jsx(s6,{className:"h-4 w-4 text-accent1"}):l.jsx(a6,{className:"h-4 w-4"}),l.jsx("span",{children:M.name}),M.source==="agent"&&M.agentName&&l.jsxs("span",{className:"text-neutral3",children:["(",M.agentName,")"]}),K&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&Re&&E&&l.jsx(fss,{workspaceId:E,canSearchFiles:He,canSearchSkills:We,canBM25:ke,canVector:Ie,showInitWarning:!T&&j?.status!=="ready",onViewFileResult:Fe=>{L({file:Fe,tab:"files"})},onViewSkillResult:(Fe,Je)=>{E&&r(`/workspaces/${E}/skills/${encodeURIComponent(Fe)}?path=${encodeURIComponent(Je)}`)}},E),(ue||be)&&l.jsxs(bu,{value:De,onValueChange:W,defaultTab:De,children:[l.jsxs(xu,{children:[ue&&l.jsxs(Wr,{value:"files",children:[l.jsx(Do,{className:"h-4 w-4"}),"Files"]}),be&&l.jsxs(Wr,{value:"skills",children:[l.jsx(Az,{className:"h-4 w-4"}),"Skills",jt&&ut.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:ut.length})]})]}),ue&&l.jsx(Ns,{value:"files",className:"pb-8",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[l.jsx(Vrs,{entries:xn,currentPath:D,isLoading:$,error:Z,onNavigate:z,onFileSelect:q,onRefresh:()=>G(),onCreateDirectory:K?void 0:Fe=>ie.mutate({path:Fe,workspaceId:E}),onDelete:K?void 0:Fe=>J.mutate({path:Fe,recursive:!0,force:!0,workspaceId:E})}),Q&&l.jsx(Zrs,{path:Q,content:ne?.content??"",isLoading:te,mimeType:ne?.mimeType,onClose:()=>q(null)})]})}),be&&l.jsx(Ns,{value:"skills",className:"pb-8",children:l.jsx(ass,{skills:ut,isLoading:de,isSkillsConfigured:jt,hasUndiscoveredAgentSkills:m,basePath:E?`/workspaces/${E}/skills`:"/workspaces",onAddSkill:oe?()=>u(!0):void 0,onUpdateSkill:oe?Ce:void 0,onRemoveSkill:oe?ye:void 0,updatingSkillName:h??void 0,removingSkillName:d??void 0,mountPaths:Le})})]}),!ue&&!be&&!T&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]}),E&&oe&&l.jsx(dss,{open:c,onOpenChange:u,workspaceId:E,onInstall:ve,isInstalling:re.isPending,installedSkillIds:ut.filter(Fe=>Fe.skillsShSource).map(Fe=>`${Fe.skillsShSource.owner}/${Fe.skillsShSource.repo}/${Fe.name}`),installedSkillNames:ut.filter(Fe=>!Fe.skillsShSource).map(Fe=>Fe.name),writableMounts:Pe,installedSkillPaths:Object.fromEntries(ut.filter(Fe=>Fe.path).map(Fe=>[Fe.name,Fe.path]))})]})}function fss({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:s,showInitWarning:a,onViewFileResult:i,onViewSkillResult:o}){const c=HYr(),u=QYr();return l.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(Do,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&l.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",l.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",l.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),l.jsx(Xrs,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:r,canVector:s,onViewResult:i})]}),n&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(Az,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(Jrs,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName,d.skillPath)})]})]})}function hss(e,t){return e==null||t==null?null:e in t?e:null}function pss(){const{skillName:e,workspaceId:t}=Sa(),[n]=wo(),r=ha(),s=e?decodeURIComponent(e):"",a=n.get("path"),i=a?decodeURIComponent(a):void 0,o=n.get("agentId"),c=o?decodeURIComponent(o):null,d=r.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=hss(c,d),h=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[p,m]=y.useState(null),{data:g,isLoading:v,error:x}=ZYr(s,{workspaceId:t,path:i}),{data:w}=k5t(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:S,isLoading:_}=GYr(s,p??"",{enabled:!!p,workspaceId:t,path:i}),O=E=>f?l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:h,children:[l.jsx(Ne,{children:l.jsx(s6,{className:"h-4 w-4"})}),f]}),l.jsxs(Bn,{as:"span",to:"",isCurrent:!0,children:[l.jsx(Ne,{children:l.jsx(Az,{className:"h-4 w-4"})}),E]})]}):l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:h,children:[l.jsx(Ne,{children:l.jsx(Zc,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(Bn,{as:ln,to:h,children:[l.jsx(Ne,{children:l.jsx(Az,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:E})]});return v?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Loading...")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):x&&Hs(x)?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Session Expired")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})]}):x&&Ps(x)?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"workspaces"})})]}):x||!g?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Error")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),l.jsx("p",{className:"text-sm text-neutral3",children:x?.message??"Skill not found"})]})})]}):l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[O(g.name),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(Ne,{children:l.jsx(Vw,{})}),"Documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:l.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:l.jsx(css,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),l.jsx(uss,{open:!!p,onOpenChange:E=>!E&&m(null),skillName:g.name,referencePath:p??"",content:S?.content,isLoading:_})]})}const b6t=()=>{const e=window.MASTRA_CLOUD_API_ENDPOINT;return{isMastraPlatform:!!e,mastraPlatformEndpoint:e}},mss=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:l.jsx(za,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:l.jsx(Do,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:l.jsx(go,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:l.jsx(ZS,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:l.jsx(ac,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:l.jsx(mo,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:l.jsx(Zc,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:l.jsx(sj,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/scorers",icon:l.jsx(ci,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/datasets",icon:l.jsx(Ja,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/experiments",icon:l.jsx(_d,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:l.jsx(hE,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",activePaths:["/traces"],icon:l.jsx(cl,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:l.jsx(Zet,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(bwe,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:l.jsx(yo,{}),isOnMastraPlatform:!0}]}];function wKe(e,t){const n=r=>t===r||t.startsWith(r+"/");return n(e.url)?!0:e.activePaths?.some(n)??!1}function gss(){const{Link:e}=cn(),{state:t,isMobile:n}=zq(),s=mu().pathname,{isMastraPlatform:a}=b6t(),{data:i}=Gj(),{isCmsAvailable:o,isLoading:c}=XD(),{hasPermission:u,hasAnyPermission:d,rbacEnabled:f,isAuthenticated:h,isLoading:p}=Jb(),m=i&&K2(i),g=new Set(["/prompts"]),v=x=>g.has(x.url)&&!o&&!c||a&&!x.isOnMastraPlatform?!1:f&&h&&p?!0:!(x.requiredPermission&&!u(x.requiredPermission)||x.requiredAnyPermission&&!d(x.requiredAnyPermission));return l.jsxs(Tf,{children:[l.jsx("div",{className:"pt-3 mb-4",children:t==="collapsed"?l.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[l.jsxs("div",{className:"relative grid place-items-center size-9",children:[l.jsx(lb,{className:Y("h-[1.5rem] w-[1.5rem] shrink-0 transition-opacity duration-150",!n&&"group-hover/sidebar:opacity-0")}),!n&&l.jsx("div",{className:"absolute inset-0 opacity-0 transition-opacity duration-150 group-hover/sidebar:opacity-100",children:l.jsx(Tf.Trigger,{})})]}),m&&l.jsx(Ome,{})]}):m?l.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[l.jsxs("span",{className:"flex items-center gap-2 flex-1 min-w-0",children:[l.jsx(lb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm whitespace-nowrap truncate",children:"Mastra Studio"}),!n&&l.jsx(Tf.Trigger,{})]}),l.jsx(Ome,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3 pr-2",children:[l.jsx(lb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm whitespace-nowrap truncate",children:"Mastra Studio"}),!n&&l.jsx(Tf.Trigger,{})]})}),l.jsx(Tf.Nav,{children:mss.map(x=>{const w=x.links.filter(v),S=w.length>0&&x?.separator,_=w.some(E=>wKe(E,s)),O=!!(x.href&&s===x.href&&!_);return l.jsxs(Tf.NavSection,{children:[x?.title?l.jsx(Tf.NavHeader,{LinkComponent:e,state:t,href:x.href,isActive:O,children:x.title}):l.jsx(l.Fragment,{children:S&&l.jsx(Tf.NavSeparator,{})}),l.jsx(Tf.NavList,{children:w.map(E=>{const j=wKe(E,s);return l.jsx(Tf.NavLink,{LinkComponent:e,state:t,link:E,isActive:j},E.name)})})]},x.key)})}),l.jsx(Tf.Bottom,{className:"pb-3",children:t!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(Tf.NavSeparator,{}),l.jsx(RZr,{collapsed:!1})]})})]})}function x6t({children:e,loginUrl:t="/login",signupUrl:n="/signup"}){const{data:r,isLoading:s}=Gj();if(s)return l.jsx(l.Fragment,{children:e});if(!r?.enabled)return l.jsx(l.Fragment,{children:e});if(K2(r))return l.jsx(l.Fragment,{children:e});const a=typeof window<"u"?window.location.href:void 0;if(!r.login)return l.jsx("div",{className:"flex h-full w-full items-center justify-center",children:l.jsxs("div",{className:"flex flex-col items-center space-y-6 text-center",children:[l.jsx(lb,{className:"h-16 w-16 opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-xl font-semibold text-neutral6",children:"Authentication Required"}),l.jsx("p",{className:"max-w-sm text-neutral3",children:"This page requires authentication, but no login method is configured. Please contact your administrator."})]})]})});const i=()=>{const o=new URL(n,window.location.origin);a&&o.searchParams.set("redirect",a),window.location.href=o.toString()};return l.jsx("div",{className:"flex h-full w-full items-center justify-center",children:l.jsxs("div",{className:"flex flex-col items-center space-y-6 text-center",children:[l.jsx(lb,{className:"h-16 w-16 opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-xl font-semibold text-neutral6",children:"Sign in to continue"}),l.jsx("p",{className:"max-w-sm text-neutral3",children:"You need to sign in to access this page."})]}),r.login.description&&l.jsxs("div",{className:"flex items-start gap-2.5 rounded-md border border-border1 bg-surface2 p-3 text-left",children:[l.jsx(Wet,{className:"mt-0.5 h-4 w-4 shrink-0 text-neutral4"}),l.jsx("p",{className:"max-w-sm text-sm text-neutral3",children:r.login.description})]}),l.jsx(G5t,{config:r.login,redirectUri:a,loginUrl:t}),(r.login.type==="credentials"||r.login.type==="both")&&r.login.signUpEnabled!==!1&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-neutral3",children:"Don't have an account? "}),l.jsx("button",{type:"button",onClick:i,className:"text-neutral6 hover:underline",children:"Sign up"})]})]})})}const w6t="experimental-ui:",S6t="current",vss=_e.createContext(null);function yss(e,t){const n=window.localStorage.getItem(w6t+e);return n&&t.has(n)?n:S6t}function bss({experiments:e,children:t}){const n=_e.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,s]=_e.useState({});_e.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=yss(u.key,d)}s(c)},[e,n]);const a=_e.useCallback(c=>r[c]??S6t,[r]),i=_e.useCallback((c,u)=>{window.localStorage.setItem(w6t+c,u),s(d=>({...d,[c]:u}))},[]),o=_e.useMemo(()=>({experiments:e,getVariant:a,setVariant:i}),[e,a,i]);return l.jsx(vss.Provider,{value:o,children:t})}const xss=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],wss=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"}),Sss=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>{t(r=>!r)},[]);return y.useEffect(()=>{const r=s=>{s.key==="k"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),n())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n]),{open:e,setOpen:t,toggle:n}},vEe=()=>{const{requestContext:e}=Zs(),t=Ze();return Ct({queryKey:["processors"],queryFn:()=>t.listProcessors(e)})},k6t=(e,t)=>{const n=Ze(),{requestContext:r}=Zs();return Ct({queryKey:["processor",e],queryFn:()=>n.getProcessor(e).details(r),enabled:!!e})},kss=()=>{const e=Ze(),{requestContext:t}=Zs();return or({mutationFn:async({processorId:n,phase:r,messages:s,agentId:a})=>e.getProcessor(n).execute({phase:r,messages:s,agentId:a,requestContext:t})})},_ss=()=>{const{open:e,setOpen:t}=Sss(),{navigate:n,paths:r}=cn(),{isMastraPlatform:s}=b6t(),a=Fq(),{data:i={}}=Wv(),{data:o={}}=Zw(),{data:c={}}=HH(),{data:u={}}=vEe(),{data:d=[]}=GD(),{data:f={}}=uf(),h=w=>{n(w),t(!1)},p=Object.entries(i),m=Object.entries(o),g=Object.entries(c),v=Object.values(u).filter(w=>w.phases&&w.phases.length>0),x=Object.entries(f);return l.jsxs(QKn,{open:e,onOpenChange:t,title:"Navigation",description:"Search and navigate to any entity",children:[l.jsx(VSt,{placeholder:"Search or navigate..."}),l.jsxs(HSt,{children:[l.jsx(WSt,{children:"No results found."}),l.jsxs(Wx,{heading:"Navigation",children:[a&&l.jsxs(Ml,{value:"toggle sidebar collapse expand",onSelect:()=>{a.toggleSidebar(),t(!1)},children:[l.jsx(Ket,{className:"text-neutral3"}),l.jsx("span",{children:"Toggle Sidebar"}),l.jsx(ZSt,{children:"Ctrl+B"})]}),l.jsxs(Ml,{value:"all agents",onSelect:()=>h("/agents"),children:[l.jsx(za,{className:"text-neutral3"}),l.jsx("span",{children:"All Agents"})]}),l.jsxs(Ml,{value:"all workflows",onSelect:()=>h("/workflows"),children:[l.jsx(go,{className:"text-neutral3"}),l.jsx("span",{children:"All Workflows"})]}),l.jsxs(Ml,{value:"all tools",onSelect:()=>h("/tools"),children:[l.jsx(mo,{className:"text-neutral3"}),l.jsx("span",{children:"All Tools"})]}),l.jsxs(Ml,{value:"all scorers",onSelect:()=>h("/scorers"),children:[l.jsx(ci,{className:"text-neutral3"}),l.jsx("span",{children:"All Scorers"})]}),l.jsxs(Ml,{value:"all processors",onSelect:()=>h("/processors"),children:[l.jsx(ZS,{className:"text-neutral3"}),l.jsx("span",{children:"All Processors"})]}),l.jsxs(Ml,{value:"all mcp servers",onSelect:()=>h("/mcps"),children:[l.jsx(ac,{className:"text-neutral3"}),l.jsx("span",{children:"All MCP Servers"})]}),l.jsxs(Ml,{value:"observability traces",onSelect:()=>h("/observability"),children:[l.jsx(cl,{className:"text-neutral3"}),l.jsx("span",{children:"Observability"})]}),!s&&l.jsxs(l.Fragment,{children:[l.jsxs(Ml,{value:"settings",onSelect:()=>h("/settings"),children:[l.jsx(bwe,{className:"text-neutral3"}),l.jsx("span",{children:"Settings"})]}),l.jsxs(Ml,{value:"templates",onSelect:()=>h("/templates"),children:[l.jsx(w0,{className:"text-neutral3"}),l.jsx("span",{children:"Templates"})]})]})]}),p.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Agents",children:p.map(([w,S])=>l.jsxs(_e.Fragment,{children:[l.jsxs(Ml,{value:`${S.name} chat agent`,onSelect:()=>h(r.agentLink(w)),children:[l.jsx(za,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Chat"]})]}),l.jsxs(Ml,{value:`${S.name} traces agent observability`,onSelect:()=>h(`/observability?entity=${w}`),children:[l.jsx(cl,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Traces"]})]})]},w))})]}),m.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Workflows",children:m.map(([w,S])=>l.jsxs(_e.Fragment,{children:[l.jsxs(Ml,{value:`${S.name} graph workflow view`,onSelect:()=>h(r.workflowLink(w)),children:[l.jsx(go,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Graph"]})]}),l.jsxs(Ml,{value:`${S.name} traces workflow observability`,onSelect:()=>h(`/observability?entity=${S.name}`),children:[l.jsx(cl,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Traces"]})]})]},w))})]}),g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Tools",children:g.map(([w,S])=>l.jsxs(Ml,{value:`tool ${S.id}`,onSelect:()=>h(r.toolLink(w)),children:[l.jsx(mo,{className:"text-neutral3"}),l.jsx("span",{children:S.id})]},w))})]}),x.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Scorers",children:x.map(([w,S])=>{const _=S.scorer?.config?.name||S.scorer?.config?.id||w;return l.jsxs(Ml,{value:`scorer ${_}`,onSelect:()=>h(r.scorerLink(w)),children:[l.jsx(ci,{className:"text-neutral3"}),l.jsx("span",{children:_})]},w)})})]}),v.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Processors",children:v.map(w=>{const S=w.name||w.id,_=w.isWorkflow?r.workflowLink(w.id)+"/graph":r.processorLink(w.id);return l.jsxs(Ml,{value:`processor ${S}`,onSelect:()=>h(_),children:[l.jsx(ZS,{className:"text-neutral3"}),l.jsx("span",{children:S})]},w.id)})})]}),d.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"MCP Servers",children:d.map(w=>l.jsxs(Ml,{value:`mcp server ${w.name}`,onSelect:()=>h(r.mcpServerLink(w.id)),children:[l.jsx(ac,{className:"text-neutral3"}),l.jsx("span",{children:w.name})]},w.id))})]})]})]})};function Oss(){return l.jsxs("header",{className:"lg:hidden sticky top-0 z-20 flex h-12 shrink-0 items-center gap-3 border-b border-border1 bg-surface1 px-3",children:[l.jsx(Tf.MobileTrigger,{}),l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(lb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm whitespace-nowrap",children:"Mastra Studio"})]})]})}function Ess({children:e}){const{data:t,isFetched:n}=Gj(),{pathname:r}=mu(),s=n&&t?.enabled&&!K2(t),a=n&&!s,i=l.jsx(x6t,{children:l.jsx(xnr,{resetKeys:[r],children:e})});return l.jsxs(l.Fragment,{children:[l.jsx(_ss,{}),l.jsxs("div",{className:Y("h-full",a&&"lg:grid lg:grid-cols-[auto_1fr] lg:grid-rows-[1fr]"),children:[a&&l.jsx(gss,{}),a?l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[l.jsx(Oss,{}),l.jsx("div",{className:"flex-1 min-h-0 bg-transparent overflow-y-auto",children:i})]}):l.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":s}),children:i})]})]})}const Css=({children:e})=>{const{experimentalUIEnabled:t}=wss();return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(bSt,{position:"bottom-right"}),l.jsx(_St,{defaultTheme:"dark",children:l.jsx(sf,{delayDuration:0,children:l.jsx(bss,{experiments:t?xss:[],children:l.jsx(ver,{children:l.jsx(Ess,{children:e})})})})})]})},Tss=({children:e})=>l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(bSt,{position:"bottom-right"}),l.jsx(_St,{defaultTheme:"dark",children:l.jsx(sf,{delayDuration:0,children:l.jsx("div",{className:"h-full overflow-y-auto",children:l.jsx(x6t,{children:e})})})})]});function jss({agentId:e}){return l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/agents",children:[l.jsx(Ne,{children:l.jsx(za,{})}),"Agents"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(_Gr,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"Agents documentation"]})})]})}const Nss=({children:e})=>{const{agentId:t}=Sa(),n=mu(),{isCmsAvailable:r}=XD(),{hasObservability:s}=DZr(),a=Cme.has("datasets"),i=r&&a,o=s&&a,{data:c}=$h(t),u=Yu(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,h=n.pathname.includes("/editor")?"versions":n.pathname.includes("/evaluate")?"evaluate":n.pathname.includes("/review")?"review":n.pathname.includes("/traces")?"traces":"chat",p=(h==="versions"||h==="evaluate"||h==="review")&&(i||o),m=l.jsxs(Jn,{className:"grid-rows-[auto_auto_1fr]",children:[l.jsx(jss,{agentId:t}),l.jsx($Kr,{agentId:t,activeTab:h,showPlayground:i,showObservability:o,rightSlot:p?l.jsx(MKr,{requestContextSchema:f}):void 0}),e]});return l.jsx(H2,{children:l.jsx(RWr,{defaultProvider:u,defaultModel:d,children:l.jsx(SKr,{children:l.jsx(PWr,{children:m})})})})},Ass=({children:e,options:t})=>{const n=new vYn({...t,defaultOptions:{...t?.defaultOptions,queries:{retry:krr,...t?.defaultOptions?.queries}}});return l.jsx(yYn,{client:n,children:e})},Iss=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Processors yet",descriptionSlot:"Configure processors. Add input or output processors to your agents to transform messages.",actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:["Processors Documentation ",l.jsx(Va,{})]})})}),Rss=["input","inputStep","outputStep","outputStream","outputResult"];function Pss({processors:e,isLoading:t,search:n=""}){const{paths:r,Link:s}=cn(),a=y.useMemo(()=>Object.values(e??{}).filter(o=>o.phases&&o.phases.length>0),[e]),i=y.useMemo(()=>{const o=n.toLowerCase();return a.filter(c=>c.id.toLowerCase().includes(o)||(c.name||"").toLowerCase().includes(o))},[a,n]);return t?l.jsx(qd,{columns:"auto 1fr auto auto auto auto auto auto"}):l.jsxs(xe,{columns:"auto 1fr auto auto auto auto auto auto",children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Name"}),l.jsx(xe.TopCell,{children:"Description"}),l.jsx(xe.TopCellSmart,{long:"Input",short:"Input",tooltip:"Contains Input phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Input Step",short:l.jsxs(l.Fragment,{children:[l.jsx(H0,{})," Step"]}),tooltip:"Contains Input Step phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Output Step",short:l.jsxs(l.Fragment,{children:[l.jsx(Yf,{})," Step"]}),tooltip:"Contains Output Step phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Output Stream",short:l.jsxs(l.Fragment,{children:[l.jsx(Yf,{})," Stream"]}),tooltip:"Contains Output Stream phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Output Result",short:l.jsxs(l.Fragment,{children:[l.jsx(Yf,{})," Result"]}),tooltip:"Contains Output Result phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{short:"Used by",long:"Used by Agents",className:"text-center"})]}),i.length===0&&n?l.jsx(xe.NoMatch,{message:"No Processors match your search"}):null,i.map(o=>{const c=Pp(o.name||o.id,50),u=Pp(o.description??"",200),d=o.agentIds?.length??0,f=new Set(o.phases||[]),h=o.isWorkflow?r.workflowLink(o.id)+"/graph":r.processorLink(o.id);return l.jsxs(xe.RowLink,{to:h,LinkComponent:s,children:[l.jsx(xe.NameCell,{children:c}),l.jsx(xe.DescriptionCell,{children:u}),Rss.map(p=>l.jsx(xe.TextCell,{className:"text-center",children:f.has(p)&&l.jsx(qa,{className:"size-4 mx-auto"})},p)),l.jsx(xe.TextCell,{className:"text-center",children:d||""})]},o.id)})]})}function $ss(){const{data:e={},isLoading:t,error:n}=vEe(),[r,s]=y.useState("");return n&&Hs(n)?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(pa,{})}):n&&Ps(n)?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(aa,{resource:"processors"})}):n?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(dc,{title:"Failed to load processors",message:n.message})}):Object.keys(e).length===0&&!t?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(Iss,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(km,{})," Processors"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:l.jsx(yo,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:s,label:"Filter processors",placeholder:"Filter by name"})})]}),l.jsx(Pss,{processors:e,isLoading:t,search:r})]})}function Mss({value:e,onValueChange:t,placeholder:n="Select a processor...",searchPlaceholder:r="Search processors...",emptyText:s="No processors found.",className:a,disabled:i=!1,variant:o="default"}){const{data:c={},isLoading:u,isError:d,error:f}=vEe(),{navigate:h,paths:p}=cn();y.useEffect(()=>{if(d){const v=f instanceof Error?f.message:"Failed to load processors";ze.error(`Error loading processors: ${v}`)}},[d,f]);const m=Object.keys(c).filter(v=>{const x=c[v];return x?.phases&&x.phases.length>0}).map(v=>({label:c[v]?.name||v,value:v})),g=v=>{t?t(v):v&&v!==e&&(c[v]?.isWorkflow?h(p.workflowLink(v)+"/graph"):h(p.processorLink(v)))};return l.jsx(Mc,{options:m,value:e,onValueChange:g,placeholder:u?"Loading processors...":n,searchPlaceholder:r,emptyText:s,className:a,disabled:i||u||d,variant:o})}const Dss={input:"Input - Process input messages before LLM (once at start)",inputStep:"Input Step - Process at each agentic loop step",outputStream:"Output Stream - Process streaming chunks",outputResult:"Output Result - Process complete output after streaming",outputStep:"Output Step - Process after each LLM response (before tools)"};function Lss({processorId:e}){const{data:t,isLoading:n,error:r}=k6t(e);return y.useEffect(()=>{if(r){const s=r instanceof Error?r.message:"Failed to load processor";ze.error(`Error loading processor: ${s}`)}},[r]),n?l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]}):r?null:t?l.jsx(zss,{processor:t}):l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Processor not found"})})}function zss({processor:e}){const t=Kb(),n=y.useId(),[r,s]=y.useState(e.phases[0]||"input"),[a,i]=y.useState(e.configurations[0]?.agentId||""),[o,c]=y.useState("Hello, this is a test message."),[u,d]=y.useState(null),[f,h]=y.useState(),p=kss(),m=async()=>{h(void 0),d(null);const x=r==="outputStep"||r==="outputResult"?"assistant":"user",w=[{id:crypto.randomUUID(),role:x,createdAt:new Date,content:{format:2,parts:[{type:"text",text:o}]}}];try{const S=await p.mutateAsync({processorId:e.id,phase:r,messages:w,agentId:a||void 0});d(S),!S.success&&S.error&&h(S.error)}catch(S){h(S.message||"An error occurred")}},g=u?JSON.stringify(u,null,2):"{}";return l.jsxs(mh,{hasLeftServiceColumn:!0,className:"relative",children:[l.jsxs("div",{className:"bg-surface2 border-r border-border1 w-[22rem] overflow-y-auto",children:[l.jsx(Fss,{processor:e}),l.jsxs("div",{className:"p-5 space-y-5",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Phase"}),l.jsxs(Ri,{value:r,onValueChange:v=>s(v),children:[l.jsx(mi,{className:"w-full",children:l.jsx(Pi,{placeholder:"Select phase"})}),l.jsx(gi,{children:e.phases.map(v=>l.jsx(hs,{value:v,children:v},v))})]}),l.jsx(me,{variant:"ui-xs",className:"text-neutral4",children:Dss[r]})]}),e.configurations.length>1&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Agent Configuration"}),l.jsxs(Ri,{value:a,onValueChange:i,children:[l.jsx(mi,{className:"w-full",children:l.jsx(Pi,{placeholder:"Select agent"})}),l.jsx(gi,{children:e.configurations.map(v=>l.jsxs(hs,{value:v.agentId,children:[v.agentName," (",v.type,")"]},v.agentId))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"label",htmlFor:n,variant:"ui-sm",className:"text-neutral3",children:"Test Message"}),l.jsx("textarea",{id:n,value:o,onChange:v=>c(v.target.value),placeholder:"Enter a test message...",rows:4,className:"w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-hidden focus:ring-2 focus:ring-accent1"})]}),l.jsx(ce,{onClick:m,disabled:p.isPending||r==="outputStream",className:"w-full",children:p.isPending?"Running...":"Run Processor"}),r==="outputStream"&&l.jsx(me,{variant:"ui-xs",className:"text-accent6",children:"Output Stream phase cannot be executed directly. Use streaming instead."}),u&&l.jsxs("div",{className:"space-y-2 pt-4 border-t border-border1",children:[l.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"Status"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(_t,{variant:u.success?"success":"error",children:u.success?"Success":"Failed"}),u.tripwire?.triggered&&l.jsx(_t,{variant:"info",children:"Tripwire Triggered"})]}),u.tripwire?.triggered&&u.tripwire.reason&&l.jsxs("div",{className:"mt-2 p-3 bg-accent6Dark rounded-md border border-accent6/20",children:[l.jsx(me,{variant:"ui-sm",className:"text-accent6 font-medium",children:"Tripwire Reason"}),l.jsx(me,{variant:"ui-sm",className:"text-neutral3 mt-1",children:u.tripwire.reason})]})]})]})]}),l.jsx("div",{className:"absolute top-4 right-4 z-10",children:l.jsx(da,{content:g,tooltip:"Copy JSON result to clipboard"})}),l.jsx("div",{className:"p-5 h-full relative overflow-x-auto overflow-y-auto",children:l.jsx(Zm,{value:f||g,editable:!0,theme:t,extensions:[Kf]})})]})}function Fss({processor:e}){return l.jsxs("div",{className:"px-5 pt-5 pb-4 border-b border-border1",children:[l.jsx(me,{variant:"header-md",className:"text-neutral1 mb-2",children:e.name||e.id}),e.name&&e.name!==e.id&&l.jsx(me,{variant:"ui-sm",className:"text-neutral4 mb-3",children:e.id}),l.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:e.phases.map(t=>l.jsx(_t,{variant:"default",children:t},t))}),l.jsx("div",{className:"mt-3",children:l.jsxs(me,{variant:"ui-xs",className:"text-neutral4",children:["Attached to ",e.configurations.length," agent",e.configurations.length!==1?"s":""]})})]})}function Bss(){const{processorId:e}=Sa(),{data:t,isLoading:n,error:r}=k6t(e);return r&&Hs(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})]}):r&&Ps(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(Onn,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Ur,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Mss,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"Processors documentation"]})})]}),l.jsx(Lss,{processorId:e})]})}function Uss(){const{data:e={},isLoading:t,error:n}=Wv(),{data:r={},isLoading:s,error:a}=HH(),[i,o]=y.useState(""),c=t||s,u=a||n;return u&&Hs(u)?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(pa,{})}):u&&Ps(u)?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(aa,{resource:"tools"})}):u?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(dc,{title:"Failed to load tools",message:u.message})}):Object.keys(r).length===0&&!c?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(_ns,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:c,children:[l.jsx(mo,{})," Tools"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:l.jsx(yo,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:o,label:"Filter tools",placeholder:"Filter by name"})})]}),l.jsx(kns,{tools:r,agents:e,isLoading:c,search:i})]})}const _6t={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,n,r)=>r?`/workspaces/${r}/skills/${encodeURIComponent(t)}?agentId=${encodeURIComponent(e)}${n?`&path=${encodeURIComponent(n)}`:""}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,n)=>n?`/agents/${e}/chat/${t}?messageId=${n}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,schedulesLink:()=>"/workflows/schedules",scheduleLink:e=>`/workflows/schedules/${encodeURIComponent(e)}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${Fo()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`,experimentLink:e=>`/experiments/${e}`},qss=()=>{const e=id(),t=n=>e(n,{viewTransition:!0});return l.jsx(z_t,{Link:xV,navigate:t,paths:_6t,children:l.jsx(Css,{children:l.jsx(RC,{})})})},Vss=()=>{const e=id(),t=n=>e(n,{viewTransition:!0});return l.jsx(z_t,{Link:xV,navigate:t,paths:_6t,children:l.jsx(Tss,{children:l.jsx(RC,{})})})},Hss=!!window.MASTRA_CLOUD_API_ENDPOINT,SKe=Cme.has("datasets"),kKe=[{index:!0,element:l.jsx(IJr,{})},{path:"instruction-blocks",element:l.jsx(RJr,{})},{path:"tools",element:l.jsx(DJr,{})},{path:"agents",element:l.jsx(jJr,{})},{path:"scorers",element:l.jsx($Jr,{})},{path:"workflows",element:l.jsx(zJr,{})},{path:"skills",element:l.jsx(MJr,{})},{path:"memory",element:l.jsx(PJr,{})},{path:"variables",element:l.jsx(LJr,{})}],Wss=[{path:"/login",element:l.jsx(gns,{})},{path:"/signup",element:l.jsx(ars,{})},{element:l.jsx(Vss,{}),children:[{path:"/agents/:agentId/session",element:l.jsx(UXe,{})},{path:"/agents/:agentId/session/:threadId",element:l.jsx(UXe,{})}]},{element:l.jsx(qss,{}),children:[...Hss?[]:[{path:"/settings",element:l.jsx(srs,{})},{path:"/templates",element:l.jsx(crs,{})},{path:"/templates/:templateSlug",element:l.jsx(grs,{})}],{path:"/logs",element:l.jsx(vns,{})},{path:"/primitives",element:l.jsx(Yns,{})},{path:"/evaluation",element:l.jsx(hns,{})},{path:"/scorers",element:l.jsx(trs,{})},{path:"/scorers/:scorerId",element:l.jsx(nrs,{})},{path:"/metrics",element:l.jsx(Hns,{})},{path:"/observability-overview",element:l.jsx(Gns,{})},{path:"/observability",element:l.jsx(krs,{})},{path:"/traces/:traceId",element:l.jsx(_rs,{})},{path:"/resources",element:l.jsx(ers,{})},{path:"/agents",element:l.jsx(k0r,{})},{path:"/cms/agents/create",element:l.jsx(NJr,{}),children:kKe},{path:"/cms/agents/:agentId/edit",element:l.jsx(AJr,{}),children:kKe},{path:"/cms/scorers/create",element:l.jsx(qJr,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(HJr,{})},{path:"/prompts",element:l.jsx(Xns,{})},{path:"/cms/prompts/create",element:l.jsx(FJr,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(UJr,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(vrs,{})},{path:"/agents/:agentId",element:l.jsx(Nss,{children:l.jsx(RC,{})}),children:[{index:!0,loader:({params:e})=>wG(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(FXe,{})},{path:"chat/:threadId",element:l.jsx(FXe,{})},...SKe?[{path:"editor",element:l.jsx(EJr,{})},{path:"evaluate",element:l.jsx(OJr,{})},{path:"review",element:l.jsx(CJr,{})}]:[],{path:"traces",element:l.jsx(TJr,{})}]},{path:"/tools",element:l.jsx(Uss,{})},{path:"/tools/:toolId",element:l.jsx(yrs,{})},{path:"/processors",element:l.jsx($ss,{})},{path:"/processors/:processorId",element:l.jsx(Bss,{})},{path:"/mcps",element:l.jsx(wns,{})},{path:"/mcps/:serverId",element:l.jsx(Ins,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx($ns,{})},{path:"/workspaces",element:l.jsx(xKe,{})},{path:"/workspaces/:workspaceId",element:l.jsx(xKe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(pss,{})},{path:"/workflows",element:l.jsx(Ors,{})},{path:"/workflows/schedules",element:l.jsx(Frs,{})},{path:"/workflows/schedules/:scheduleId",element:l.jsx(Drs,{})},{path:"/workflows/:workflowId",element:l.jsx(sbr,{children:l.jsx(RC,{})}),children:[{index:!0,loader:({params:e})=>wG(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(vKe,{})},{path:"graph/:runId",element:l.jsx(vKe,{})}]},...SKe?[{path:"/datasets",element:l.jsx(Hts,{})},{path:"/datasets/:datasetId",element:l.jsx(Zts,{})},{path:"/datasets/:datasetId/items/:itemId",element:l.jsx(Yts,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:l.jsx(Jts,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:l.jsx(Gts,{})},{path:"/experiments",element:l.jsx(pns,{})},{path:"/experiments/:experimentId",element:l.jsx(mns,{})},{path:"/datasets/:datasetId/experiments",element:l.jsx(Qts,{})},{path:"/datasets/:datasetId/items",element:l.jsx(Xts,{})},{path:"/datasets/:datasetId/versions",element:l.jsx(tns,{})}]:[],{index:!0,loader:()=>wG("/agents")},{path:"/request-context",element:l.jsx(Kns,{})}]}];function Zss(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:s}=VOe(),a=y.useMemo(()=>t?vJr(t,r):void 0,[t,r]);if(s)return null;if(!t)return l.jsx(MZr,{});const i=Xnn(Wss,{basename:e});return l.jsx(Sen,{baseUrl:t,headers:n,apiPrefix:r,customFetch:a,children:l.jsx(m0r,{children:l.jsx(Snn,{router:i})})})}function Gss(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",n=window.MASTRA_SERVER_PORT||4111,r=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",i=s||(a?window.location.origin:`${e}://${t}:${n}`);return l.jsx(Ass,{children:l.jsx(JWr,{endpoint:i,defaultApiPrefix:r,children:l.jsx(Zss,{})})})}$Ft.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(Gss,{})}));const Dls=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{frt as A,$it as B,prt as C,Pat as D,Sh as E,xp as F,Dls as G,Ea as I,KS as L,drt as N,TJt as a,VJt as b,Mls as c,CAe as d,ek as e,FJt as f,YE as g,qJt as h,o_ as i,l_ as j,a_ as k,zcn as l,Bat as m,YS as n,ri as o,acn as p,scn as q,dve as r,yge as s,se as t,qz as u,bd as v,RJt as w,vt as x,Be as y,sot as z};
674
+ `,children:[v.icon,v.label]},g)})})]}),n&&l.jsxs("div",{className:"border-t border-border1",children:[l.jsxs("div",{className:"px-4 py-2 flex items-center justify-between text-xs",children:[l.jsxs("span",{className:"text-neutral4",children:[n.results.length," result",n.results.length!==1?"s":"",' for "',l.jsx("span",{className:"text-neutral6",children:n.query}),'"']}),l.jsx("span",{className:`px-1.5 py-0.5 rounded ${vle[n.mode].color}`,children:vle[n.mode].label})]}),n.results.length===0?l.jsx("div",{className:"px-4 py-8 text-center text-neutral4 text-sm",children:"No results found. Try a different query."}):l.jsx("ul",{className:"max-h-[320px] overflow-auto",children:n.results.map((g,v)=>l.jsx(Krs,{result:g,rank:v+1,onClick:()=>a?.(g6t(g))},`${g.id}-${v}`))})]})]})}function Krs({result:e,rank:t,onClick:n}){const r=Math.min(100,Math.max(0,e.score*100)),s=g6t(e);return l.jsx("li",{className:"border-t border-border1 first:border-t-0",children:l.jsxs("button",{onClick:n,className:"w-full px-4 py-3 text-left hover:bg-surface5 transition-colors flex gap-3",children:[l.jsx("span",{className:"text-xs text-neutral3 tabular-nums w-4 shrink-0",children:t}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(rj,{className:"h-3.5 w-3.5 text-neutral4 shrink-0"}),l.jsx("span",{className:"font-mono text-sm text-neutral6 truncate",children:s}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("div",{className:"w-12 h-1 rounded-full bg-surface2 overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-accent1",style:{width:`${r}%`}})}),l.jsx("span",{className:"text-ui-xs text-neutral3 tabular-nums",children:e.score.toFixed(2)})]})]}),l.jsx("p",{className:"text-xs text-neutral4 line-clamp-2",children:e.content}),e.lineRange&&l.jsxs("p",{className:"text-xs text-neutral3 mt-1",children:["Lines ",e.lineRange.start,"–",e.lineRange.end]})]})]})})}function Jrs({onSearch:e,results:t,isSearching:n,onResultClick:r}){const[s,a]=y.useState(""),[i,o]=y.useState(5),[c,u]=y.useState(!0),d=f=>{f.preventDefault(),s.trim()&&e({query:s.trim(),topK:i,includeReferences:c})};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("form",{onSubmit:d,className:"space-y-3",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(aj,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),l.jsx("input",{type:"text",value:s,onChange:f=>a(f.target.value),placeholder:"Search across skills...",className:"w-full pl-10 pr-4 py-2 rounded-lg bg-surface3 border border-border1 text-sm text-neutral6 placeholder:text-neutral3 focus:outline-hidden focus:ring-2 focus:ring-accent1"})]}),l.jsx(ce,{type:"submit",disabled:!s.trim()||n,children:n?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):"Search"})]}),l.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[l.jsxs("label",{className:"flex items-center gap-2 text-neutral4",children:[l.jsx("span",{children:"Results:"}),l.jsxs("select",{value:i,onChange:f=>o(Number(f.target.value)),className:"px-2 py-1 rounded bg-surface3 border border-border1 text-neutral5",children:[l.jsx("option",{value:3,children:"3"}),l.jsx("option",{value:5,children:"5"}),l.jsx("option",{value:10,children:"10"}),l.jsx("option",{value:20,children:"20"})]})]}),l.jsxs("label",{className:"flex items-center gap-2 text-neutral4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:c,onChange:f=>u(f.target.checked),className:"rounded border-border1 bg-surface3"}),l.jsx("span",{children:"Include references"})]})]})]}),t.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5",children:["Found ",t.length," result",t.length!==1?"s":""]}),l.jsx("div",{className:"space-y-2",children:t.map((f,h)=>l.jsx(ess,{result:f,onClick:()=>r?.(f)},`${f.skillName}-${f.source}-${h}`))})]})]})}function ess({result:e,onClick:t}){const n=e.source!=="SKILL.md";return l.jsx("button",{onClick:t,className:"w-full p-4 rounded-lg bg-surface3 border border-border1 hover:border-accent1/50 text-left transition-colors",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"p-1.5 rounded bg-surface5 shrink-0 mt-0.5",children:n?l.jsx(Do,{className:"h-3.5 w-3.5 text-neutral4"}):l.jsx(qj,{className:"h-3.5 w-3.5 text-neutral4"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"font-medium text-neutral6",children:e.skillName}),l.jsx("span",{className:"text-xs text-neutral3",children:e.source}),l.jsxs("span",{className:"ml-auto text-xs text-neutral3",children:["Score: ",e.score.toFixed(3)]})]}),l.jsxs("p",{className:"text-sm text-neutral4 line-clamp-3 whitespace-pre-wrap",children:[e.content.slice(0,300),e.content.length>300&&"..."]}),e.lineRange&&l.jsxs("p",{className:"text-xs text-neutral3 mt-2",children:["Lines ",e.lineRange.start,"–",e.lineRange.end]})]})]})})}function tss({skillName:e,onUpdate:t,isUpdating:n}){return l.jsx(ce,{variant:"default",size:"icon-sm",disabled:n,tooltip:`Update ${e}`,onClick:t,children:n?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):l.jsx(FE,{className:"h-4 w-4"})})}function nss({skillName:e,onRemove:t,isRemoving:n}){return l.jsxs(Wt,{children:[l.jsx(Wt.Trigger,{asChild:!0,children:l.jsx(ce,{variant:"default",size:"icon-sm",disabled:n,tooltip:`Remove ${e}`,children:n?l.jsx(ei,{className:"h-4 w-4 animate-spin"}):l.jsx(Kd,{className:"h-4 w-4"})})}),l.jsxs(Wt.Content,{children:[l.jsxs(Wt.Header,{children:[l.jsx(Wt.Title,{children:"Remove Skill"}),l.jsxs(Wt.Description,{children:['Are you sure you want to remove the skill "',e,'"? This action cannot be undone.']})]}),l.jsxs(Wt.Footer,{children:[l.jsx(Wt.Cancel,{children:"Cancel"}),l.jsx(Wt.Action,{onClick:t,children:"Remove"})]})]})]})}const rss=".agents/skills/",gEe=[{name:"name",label:"Skill",size:"1fr"},{name:"description",label:"Description",size:"2fr"}],v6t=[...gEe,{name:"actions",label:"",size:"48px"}];function sss(e,t){if(!e||!t||t.length===0)return null;for(const n of t)if(e.startsWith(n+"/")||e===n)return n;return null}function ass({skills:e,isLoading:t,isSkillsConfigured:n=!0,hasUndiscoveredAgentSkills:r=!1,basePath:s="/workspace/skills",onAddSkill:a,onUpdateSkill:i,onRemoveSkill:o,updatingSkillName:c,removingSkillName:u,mountPaths:d}){const{navigate:f}=cn(),h=d&&d.length>0,p=w=>w.path?.includes(rss)??!1,m=e.some(p),g=!!o||!!i,v=g&&m,x=v?v6t:gEe;return!n&&!t?l.jsx(oss,{onAddSkill:a}):t?l.jsx(iss,{hasRowActions:g}):l.jsxs("div",{className:"space-y-4",children:[a&&l.jsx("div",{className:"flex items-center gap-4",children:l.jsxs(ce,{variant:"default",size:"sm",onClick:a,children:[l.jsx(Ne,{children:l.jsx(Rs,{className:"h-4 w-4"})}),"Add Skill"]})}),r&&l.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[l.jsx(tb,{className:"h-5 w-5 text-amber-500 shrink-0 mt-0.5"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("p",{className:"font-medium text-amber-500",children:"Skills installed but not discovered"}),l.jsxs("p",{className:"text-neutral4 mt-1",children:["You have skills in ",l.jsx("code",{className:"px-1 py-0.5 rounded bg-surface4 text-xs",children:".agents/skills"})," that aren't being discovered. Add this path to your workspace skills configuration to see them."]})]})]}),l.jsx(Ma,{children:l.jsxs(Ma.Trim,{children:[l.jsx(Ma.Header,{columns:x}),e.length>0?l.jsx(Ma.Entries,{children:e.map(w=>{const S={id:w.path,name:w.name,description:w.description||"—"},_=h?sss(w.path,d):null;return l.jsxs(Ma.Entry,{entry:S,columns:x,onClick:()=>{const O=`${s}/${encodeURIComponent(w.name)}?path=${encodeURIComponent(w.path)}`;f(O)},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"p-1.5 rounded bg-surface5",children:l.jsx(qj,{className:"h-3.5 w-3.5 text-neutral4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("span",{className:"font-medium text-neutral6",children:w.name}),w.path&&l.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[_&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral3 shrink-0",children:_}),l.jsx("span",{className:"text-[11px] text-neutral3 truncate",title:w.path,children:w.path})]})]})]}),l.jsx(Ma.EntryText,{children:w.description||"—"}),v&&l.jsx("div",{className:"flex justify-end gap-1",onClick:O=>O.stopPropagation(),children:p(w)&&l.jsxs(l.Fragment,{children:[i&&l.jsx(tss,{skillName:w.name,onUpdate:()=>i(w.name),isUpdating:c===w.name}),o&&l.jsx(nss,{skillName:w.name,onRemove:()=>o(w.name),isRemoving:u===w.name})]})})]},w.path)})}):l.jsx(Ma.Message,{message:a?'No skills discovered. Click "Add Skill" to install from skills.sh.':"No skills discovered. Add SKILL.md files to your skills directory."})]})})]})}function iss({hasRowActions:e}){const t=e?v6t:gEe;return l.jsx(Ma,{children:l.jsxs(Ma.Trim,{children:[l.jsx(Ma.Header,{columns:t}),l.jsx(Ma.Entries,{children:Array.from({length:3}).map((n,r)=>l.jsxs(Ma.Entry,{columns:t,isLoading:!0,children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"h-7 w-7 rounded bg-surface4 animate-pulse"}),l.jsxs("div",{children:[l.jsx("div",{className:"h-4 w-32 rounded bg-surface4 animate-pulse"}),l.jsx("div",{className:"h-3 w-40 rounded bg-surface4 animate-pulse mt-1"})]})]}),l.jsx("div",{className:"h-4 w-48 rounded bg-surface4 animate-pulse"}),e&&l.jsx("div",{className:"h-4 w-6 rounded bg-surface4 animate-pulse"})]},r))})]})})}function oss({onAddSkill:e}){return l.jsx("div",{className:"grid place-items-center py-16",children:l.jsxs("div",{className:"flex flex-col items-center text-center max-w-md",children:[l.jsx("div",{className:"p-4 rounded-full bg-surface4 mb-4",children:l.jsx(qj,{className:"h-8 w-8 text-neutral3"})}),l.jsx("h2",{className:"text-lg font-medium text-neutral6 mb-2",children:"Skills Not Configured"}),l.jsx("p",{className:"text-sm text-neutral4 mb-6",children:"No skills are configured in the workspace. Add SKILL.md files to your skills directory to discover and manage agent skills."}),l.jsxs("div",{className:"flex gap-3",children:[e&&l.jsxs(ce,{size:"lg",variant:"default",onClick:e,children:[l.jsx(Ne,{children:l.jsx(Rs,{className:"h-4 w-4"})}),"Add Skill from skills.sh"]}),l.jsxs(ce,{size:"lg",variant:"default",as:"a",href:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(Ne,{children:l.jsx(lZt,{className:"h-4 w-4"})}),"Learn about Skills"]})]})]})})}function lss(e){switch(e.type){case"external":return{icon:l.jsx(w0,{className:"h-3.5 w-3.5"}),label:"External Package",path:e.packagePath};case"local":return{icon:l.jsx(pQt,{className:"h-3.5 w-3.5"}),label:"Local Project",path:e.projectPath};case"managed":return{icon:l.jsx(a6,{className:"h-3.5 w-3.5"}),label:"Managed",path:e.mastraPath}}}function css({skill:e,rawSkillMd:t,onReferenceClick:n}){const[r,s]=y.useState(new Set(["instructions"])),[a,i]=y.useState(!1),o=lss(e.source),c=u=>{s(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})};return l.jsxs("div",{className:"space-y-6 min-w-0 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"p-3 rounded-lg bg-surface5",children:l.jsx(qj,{className:"h-6 w-6 text-neutral4"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:e.name}),l.jsx("p",{className:"text-sm text-neutral4 mt-1",children:e.description})]})]}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[l.jsx(sI,{label:"Source",value:o.label,icon:o.icon}),l.jsx(sI,{label:"Path",value:e.path,icon:l.jsx(rj,{className:"h-3.5 w-3.5"})}),e.license&&l.jsx(sI,{label:"License",value:e.license}),e.compatibility!=null&&l.jsx(sI,{label:"Compatibility",value:e.compatibility}),l.jsx(sI,{label:"References",value:`${e.references.length} files`,icon:l.jsx(Do,{className:"h-3.5 w-3.5"})})]}),l.jsx(K5,{title:"Instructions",isExpanded:r.has("instructions"),onToggle:()=>c("instructions"),headerAction:l.jsxs("button",{onClick:u=>{u.stopPropagation(),i(!a)},className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs text-neutral4 hover:text-neutral5 hover:bg-surface4 transition-colors",title:a?"Show rendered":"Show source",children:[a?l.jsx(cl,{className:"h-3.5 w-3.5"}):l.jsx(IGt,{className:"h-3.5 w-3.5"}),a?"Rendered":"Source"]}),children:a?l.jsx("div",{style:{backgroundColor:"black"},className:"rounded-lg overflow-x-auto w-0 min-w-full",children:l.jsx(LOe,{language:"markdown",style:zOe.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},children:t??e.instructions})}):l.jsx(yT,{children:e.instructions})}),e.references.length>0&&l.jsx(K5,{title:`References (${e.references.length})`,isExpanded:r.has("references"),onToggle:()=>c("references"),children:l.jsx("div",{className:"space-y-1",children:e.references.map(u=>l.jsxs("button",{onClick:()=>n?.(u),className:"flex items-center gap-2 w-full px-3 py-2 rounded hover:bg-surface4 text-left transition-colors",children:[l.jsx(Do,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),e.scripts.length>0&&l.jsx(K5,{title:`Scripts (${e.scripts.length})`,isExpanded:r.has("scripts"),onToggle:()=>c("scripts"),children:l.jsx("div",{className:"space-y-1",children:e.scripts.map(u=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded bg-surface3",children:[l.jsx(sGt,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),e.assets.length>0&&l.jsx(K5,{title:`Assets (${e.assets.length})`,isExpanded:r.has("assets"),onToggle:()=>c("assets"),children:l.jsx("div",{className:"space-y-1",children:e.assets.map(u=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded bg-surface3",children:[l.jsx(Kme,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),l.jsx("div",{className:"pt-4 border-t border-border1",children:l.jsxs("p",{className:"text-xs text-neutral3",children:["Path: ",l.jsx("code",{className:"px-1 py-0.5 rounded bg-surface4",children:e.path})]})})]})}function y6t(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>typeof t=="string"?t:JSON.stringify(t)).join(", ");if(typeof e=="object"&&e!==null){const t=Object.keys(e);if(t.length===0)return"{}";if(t.length===1){const n=t[0],r=e[n];return Array.isArray(r)?`${n}: ${r.join(", ")}`:`${n}: ${y6t(r)}`}return`{${t.join(", ")}}`}return String(e)}function sI({label:e,value:t,icon:n}){const r=y6t(t);return l.jsxs("div",{className:"p-3 rounded-lg bg-surface3",children:[l.jsx("p",{className:"text-xs text-neutral3 mb-1",children:e}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&l.jsx("span",{className:"text-neutral4",children:n}),l.jsx("p",{className:"text-sm font-medium text-neutral5 truncate",title:r,children:r})]})]})}function K5({title:e,isExpanded:t,onToggle:n,headerAction:r,children:s}){return l.jsxs("div",{className:"border border-border1 rounded-lg overflow-hidden min-w-0",children:[l.jsxs("div",{className:"flex items-center bg-surface3 hover:bg-surface4 transition-colors",children:[l.jsxs("button",{onClick:n,className:"flex items-center gap-2 flex-1 px-4 py-3",children:[t?l.jsx(Os,{className:"h-4 w-4 text-neutral3"}):l.jsx(ga,{className:"h-4 w-4 text-neutral3"}),l.jsx("span",{className:"text-sm font-medium text-neutral5",children:e})]}),r&&l.jsx("div",{className:"pr-3",children:r})]}),t&&l.jsx("div",{className:"p-4 bg-surface2 overflow-x-auto w-0 min-w-full",children:s})]})}function uss({open:e,onOpenChange:t,skillName:n,referencePath:r,content:s,isLoading:a,error:i}){const{isCopied:o,copyToClipboard:c}=AV({copiedDuration:2e3});if(!e)return null;const u=()=>{s&&c(s)};return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>t(!1)}),l.jsxs("div",{className:"relative w-full max-w-4xl max-h-[85vh] mx-4 bg-surface2 rounded-xl border border-border1 shadow-2xl flex flex-col overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"reference-viewer-title",onKeyDown:d=>{d.key==="Escape"&&t(!1)},children:[l.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border1 bg-surface3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"p-1.5 rounded bg-surface5",children:l.jsx(Do,{className:"h-4 w-4 text-neutral4"})}),l.jsxs("div",{children:[l.jsx("h2",{id:"reference-viewer-title",className:"text-base font-medium text-neutral6",children:r}),l.jsxs("p",{className:"text-xs text-neutral3",children:["from ",n]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(ce,{size:"md",variant:"default",onClick:u,disabled:!s||a,children:[l.jsx(Ne,{children:o?l.jsx(qa,{className:"h-3.5 w-3.5 text-green-400"}):l.jsx(lh,{className:"h-3.5 w-3.5"})}),o?"Copied!":"Copy"]}),l.jsx("button",{onClick:()=>t(!1),"aria-label":"Close reference viewer",className:"p-2 rounded-lg hover:bg-surface4 text-neutral3 hover:text-neutral5 transition-colors",children:l.jsx(qr,{className:"h-4 w-4"})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-6",children:a?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx("div",{className:"h-6 w-6 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})}):i?l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load reference"}),l.jsx("p",{className:"text-sm text-neutral3",children:i})]}):s?l.jsx("pre",{className:"whitespace-pre-wrap text-sm text-neutral5 font-mono bg-surface3 p-4 rounded-lg overflow-auto",children:s}):l.jsx("div",{className:"flex items-center justify-center py-12 text-neutral3",children:"No content available"})})]})]})}function yKe(e){return`${e.topSource}/${e.name}`}function bKe(e){const t=_5t(e.topSource,e.name);return t?`${t.owner}/${t.repo}/${e.name}`:null}function dss({open:e,onOpenChange:t,workspaceId:n,onInstall:r,isInstalling:s,installedSkillIds:a=[],installedSkillNames:i=[],writableMounts:o,installedSkillPaths:c}){const[u,d]=y.useState(""),[f,h]=y.useState(null),[p,m]=y.useState(o&&o.length>0?o[0]?.path:void 0),{data:g,isLoading:v}=XYr(n),x=YYr(n),w=y.useMemo(()=>f?.topSource?_5t(f.topSource,f.name):null,[f]),S=y.useMemo(()=>!w||!f?null:`https://skills.sh/${w.owner}/${w.repo}/${f.name}`,[w,f]),{data:_,isLoading:O}=KYr(n,w?.owner,w?.repo,f?.name,{enabled:!!w&&!!f}),E=f_(M=>{M.trim().length>=2&&x.mutate(M)},300),j=y.useCallback(M=>{d(M),E(M)},[E]),T=y.useMemo(()=>u.trim().length>=2?x.data?.skills??[]:g?.skills??[],[u,x.data,g]),N=x.isPending,I=u.trim().length>=2,P=y.useMemo(()=>{if(!f)return!1;const M=bKe(f);return!!(M&&a.includes(M)||i.includes(f.name))},[f,a,i]),R=y.useCallback(()=>{!f||!w||r({repository:`${w.owner}/${w.repo}`,skillName:f.name,mount:o&&o.length>1?p:void 0})},[f,w,r,o,p]),F=y.useCallback(M=>{M||(d(""),h(null),m(o?.[0]?.path)),t(M)},[t,o]);return l.jsx(Fr,{open:e,onOpenChange:F,children:l.jsxs($r,{className:"max-w-4xl h-[80vh] flex flex-col",children:[l.jsxs(Br,{children:[l.jsx(Mr,{children:"Add Skill"}),l.jsx(va,{children:"Search and install skills from the community registry"})]}),l.jsxs(is,{className:"flex-1 flex flex-col gap-4 overflow-hidden max-h-none",children:[l.jsxs("div",{className:"relative",children:[l.jsx(aj,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral3"}),l.jsx(mn,{placeholder:"Search skills...",value:u,onChange:M=>j(M.target.value),className:"pl-9"})]}),l.jsxs("div",{className:"flex flex-1 gap-4 min-h-0",children:[l.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[l.jsx("div",{className:"text-xs font-medium text-neutral4 uppercase tracking-wide mb-2",children:I?"Search Results":"Popular Skills"}),l.jsx(na,{className:"flex-1 border border-border1 rounded-lg",children:v||N?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):T.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-neutral4",children:[l.jsx(w0,{className:"h-8 w-8 mb-2"}),l.jsx("p",{className:"text-sm",children:I?"No skills found":"No skills available"})]}):l.jsx("div",{className:"p-2 space-y-1",children:T.map(M=>{const L=yKe(M),U=bKe(M),z=U&&a.includes(U)||i.includes(M.name),q=f?yKe(f):null;return l.jsx("button",{onClick:()=>h(M),className:Y("w-full text-left px-3 py-2 rounded-md transition-colors","hover:bg-surface4",q===L&&"bg-surface5 border border-accent1"),children:l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium text-sm text-neutral6 truncate",children:M.name}),z&&l.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent1/20 text-accent1",children:[l.jsx(qa,{className:"h-2.5 w-2.5"}),"Installed"]})]}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:M.topSource})]}),l.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral3 shrink-0",children:[l.jsx(FE,{className:"h-3 w-3"}),l.jsx("span",{children:M.installs.toLocaleString()})]})]})},L)})})})]}),l.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[l.jsx("div",{className:"text-xs font-medium text-neutral4 uppercase tracking-wide mb-2",children:"Preview"}),l.jsx("div",{className:"flex-1 border border-border1 rounded-lg overflow-hidden flex flex-col",children:f?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-4 border-b border-border1 bg-surface3",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"p-2 rounded-lg bg-surface5",children:l.jsx(qj,{className:"h-5 w-5 text-neutral4"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"font-semibold text-neutral6 truncate",children:f.name}),l.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-neutral4",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(sQt,{className:"h-3 w-3"}),f.topSource]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(FE,{className:"h-3 w-3"}),f.installs.toLocaleString()," installs"]})]})]}),w&&l.jsx("a",{href:`https://github.com/${w.owner}/${w.repo}`,target:"_blank",rel:"noopener noreferrer",className:"text-neutral4 hover:text-neutral5 transition-colors",title:"View on GitHub",children:l.jsx(Va,{className:"h-4 w-4"})})]})}),O?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(ei,{className:"h-6 w-6 animate-spin text-neutral3"})}):_?l.jsx(na,{className:"flex-1",children:l.jsx("div",{className:"p-4",children:l.jsx(yT,{children:_})})}):l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral4",children:[l.jsx(w0,{className:"h-8 w-8 mb-2"}),l.jsx("p",{className:"text-sm",children:"Preview unavailable"}),S&&l.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"text-xs mt-2 text-accent1 hover:underline flex items-center gap-1",children:["View on skills.sh ",l.jsx(Va,{className:"h-3 w-3"})]})]})]}):l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-neutral4",children:[l.jsx(w0,{className:"h-8 w-8 mb-2"}),l.jsx("p",{className:"text-sm",children:"Select a skill to preview"})]})})]})]}),f&&l.jsxs("div",{className:"flex flex-col gap-3 pt-4 border-t border-border1",children:[o&&o.length>1&&l.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-surface3 border border-border1",children:[l.jsx(Zc,{className:"h-4 w-4 text-icon4 shrink-0"}),l.jsx("label",{htmlFor:"mount-select",className:"text-sm text-icon5 whitespace-nowrap font-medium",children:"Install to"}),l.jsx("select",{id:"mount-select",value:p??"",onChange:M=>m(M.target.value),className:"flex-1 text-sm px-3 py-1.5 rounded-md border border-border1 bg-surface2 text-icon6",children:o.map(M=>{const L=M.displayName??M.name??M.provider??"unknown";return l.jsxs("option",{value:M.path,children:[L," (",M.path,")"]},M.path)})})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[P&&o&&o.length>1&&f&&c?.[f.name]&&(()=>{const M=c[f.name],L=o.find(U=>M.startsWith(U.path+"/")||M===U.path);return L?l.jsxs("span",{className:"text-xs text-icon4",children:["Installed at ",L.path]}):null})(),l.jsx(ce,{variant:"default",onClick:()=>F(!1),children:"Cancel"}),l.jsx(ce,{variant:"primary",onClick:R,disabled:!w||s||P,"data-testid":"install-skill-button",children:s?l.jsxs(l.Fragment,{children:[l.jsx(ei,{className:"h-4 w-4 mr-2 animate-spin"}),"Installing..."]}):P?l.jsxs(l.Fragment,{children:[l.jsx(qa,{className:"h-4 w-4 mr-2"}),"Already Installed"]}):l.jsxs(l.Fragment,{children:[l.jsx(FE,{className:"h-4 w-4 mr-2"}),"Install"]})})]})]})]})]})})}function xKe(){const{workspaceId:e}=Sa(),[t,n]=wo(),r=id(),[s,a]=y.useState(!1),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(null),[h,p]=y.useState(null),[m,g]=y.useState(!1),v=t.get("file"),x=t.get("tab"),{data:w,error:S,isLoading:_}=S5t(),O=w?.workspaces??[],E=e??O[0]?.id,{data:j,isLoading:T,error:N}=FYr(E),I=Hs(S)||Hs(N),P=Ps(S)||Ps(N),R=t.get("path")||".",F=vme(S)||vme(N),M=E?O.find(Fe=>Fe.id===E):void 0,L=Fe=>{const Je=new URLSearchParams(t);for(const[st,Ot]of Object.entries(Fe))Ot===null?Je.delete(st):Je.set(st,Ot);n(Je)},U=Fe=>{g(!1),a(!1),r(`/workspaces/${Fe}`)},z=Fe=>{L({path:Fe==="."||Fe===""?null:Fe,file:null})},q=Fe=>{L({file:Fe})},W=Fe=>{L({tab:Fe})},D=R,Q=v,{data:V,isLoading:$,error:Z,refetch:G}=BYr(D,{enabled:j?.isWorkspaceConfigured&&j?.capabilities?.hasFilesystem,workspaceId:E}),J=qYr(),ie=VYr(),{data:ne,isLoading:te}=k5t(Q??"",{enabled:!!Q,workspaceId:E}),{data:ae,isLoading:de,refetch:X}=WYr({workspaceId:E}),re=JYr(),le=eXr(),ge=tXr(),fe=j?.isWorkspaceConfigured??!1,ue=j?.capabilities?.hasFilesystem??!1,be=j?.capabilities?.hasSkills??!1,ke=j?.capabilities?.canBM25??!1,Ie=j?.capabilities?.canVector??!1,K=M?.safety?.readOnly??!1,oe=ue&&!K,we=j?.mounts,Pe=we?.filter(Fe=>!Fe.readOnly).map(Fe=>({path:Fe.path,displayName:Fe.displayName,icon:Fe.icon,provider:Fe.provider,name:Fe.name})),Le=we&&we.length>1?we.map(Fe=>Fe.path):void 0,ve=y.useCallback(Fe=>{E&&re.mutate({...Fe,workspaceId:E},{onSuccess:async Je=>{if(Je.success){u(!1);const{data:st,error:Ot}=await X();if(Ot||!st){ze.success(`Skill "${Je.skillName}" installed successfully (${Je.filesWritten} files)`);return}st.skills.some(un=>un.name===Je.skillName)?ze.success(`Skill "${Je.skillName}" installed successfully (${Je.filesWritten} files)`):(g(!0),ze.warning(`Skill "${Je.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else ze.error("Failed to install skill")},onError:Je=>{ze.error(`Failed to install skill: ${Je instanceof Error?Je.message:"Unknown error"}`)}})},[E,re,X]),Ce=y.useCallback(Fe=>{E&&(p(Fe),le.mutate({workspaceId:E,skillName:Fe},{onSuccess:Je=>{if(p(null),Je.updated.length>0){const st=Je.updated[0];st.success?(ze.success(`Skill "${Fe}" updated successfully (${st.filesWritten} files)`),X()):ze.error(`Failed to update skill: ${st.error??"Unknown error"}`)}else ze.error("Failed to update skill: No update result returned")},onError:Je=>{p(null),ze.error(`Failed to update skill: ${Je instanceof Error?Je.message:"Unknown error"}`)}}))},[E,le,X]),ye=y.useCallback(Fe=>{E&&(f(Fe),ge.mutate({workspaceId:E,skillName:Fe},{onSuccess:Je=>{f(null),Je.success?(ze.success(`Skill "${Je.skillName}" removed successfully`),X()):ze.error(`Failed to remove skill "${Je.skillName}"`)},onError:Je=>{f(null),ze.error(`Failed to remove skill: ${Je instanceof Error?Je.message:"Unknown error"}`)}}))},[E,ge,X]),De=x==="files"&&ue?"files":x==="skills"&&be?"skills":ue?"files":be?"skills":"files",ut=ae?.skills??[],jt=ae?.isSkillsConfigured??!1,xn=V?.entries??[],He=ue&&(ke||Ie),We=be&&jt&&ut.length>0,Re=He||We;if(_)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Ut,{})});if(I)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(pa,{})});if(P)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(aa,{resource:"workspaces"})});if(F)return l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Yrs,{})});const Qe=S||N;return Qe?l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(dc,{title:"Failed to load workspace",message:Qe.message})}):!_&&O.length===0?l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Grs,{})}):!T&&!_&&!fe?l.jsx(lr,{title:"Workspace",icon:l.jsx(Zc,{}),children:l.jsx(Qrs,{})}):l.jsxs(ht,{children:[l.jsx(ht.TopArea,{children:l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsxs(Tr,{children:[l.jsxs(Tr.Title,{children:[l.jsx(Zc,{})," Workspace"]}),l.jsx(Tr.Description,{children:"Manage files, skills, and search your workspace"})]})}),l.jsxs(ht.Column,{className:"flex justify-end gap-2",children:[Re&&l.jsx(ss,{onClick:()=>a(!s),tooltipContent:"Search workspace","aria-label":"Search workspace",children:l.jsx(aj,{})}),l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workspaces documentation","aria-label":"Workspaces documentation",children:l.jsx(yo,{})})]})]})}),l.jsxs(ht.MainArea,{className:"grid content-start gap-6",children:[O.length>1&&l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>o(!i),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[M?.source==="agent"?l.jsx(s6,{className:"h-4 w-4 text-accent1"}):l.jsx(a6,{className:"h-4 w-4 text-neutral4"}),l.jsxs("span",{className:"flex-1 text-left truncate",children:[M?.name??"Select workspace",M?.source==="agent"&&M.agentName&&l.jsxs("span",{className:"text-neutral4 ml-1",children:["(",M.agentName,")"]})]}),l.jsx(Os,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&l.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:O.map(Fe=>l.jsxs("button",{onClick:()=>{U(Fe.id),o(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${M?.id===Fe.id?"bg-surface3":""}`,children:[Fe.source==="agent"?l.jsx(s6,{className:"h-4 w-4 text-accent1 shrink-0"}):l.jsx(a6,{className:"h-4 w-4 text-neutral4 shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Fe.name}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:Fe.source==="agent"?`Agent: ${Fe.agentName}`:"Global workspace"})]}),l.jsxs("div",{className:"flex gap-1 shrink-0",children:[Fe.safety?.readOnly&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Fe.capabilities.hasFilesystem&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Fe.capabilities.hasSandbox&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Fe.capabilities.hasSkills&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Fe.id))})]}),O.length===1&&M&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[M.source==="agent"?l.jsx(s6,{className:"h-4 w-4 text-accent1"}):l.jsx(a6,{className:"h-4 w-4"}),l.jsx("span",{children:M.name}),M.source==="agent"&&M.agentName&&l.jsxs("span",{className:"text-neutral3",children:["(",M.agentName,")"]}),K&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&Re&&E&&l.jsx(fss,{workspaceId:E,canSearchFiles:He,canSearchSkills:We,canBM25:ke,canVector:Ie,showInitWarning:!T&&j?.status!=="ready",onViewFileResult:Fe=>{L({file:Fe,tab:"files"})},onViewSkillResult:(Fe,Je)=>{E&&r(`/workspaces/${E}/skills/${encodeURIComponent(Fe)}?path=${encodeURIComponent(Je)}`)}},E),(ue||be)&&l.jsxs(bu,{value:De,onValueChange:W,defaultTab:De,children:[l.jsxs(xu,{children:[ue&&l.jsxs(Wr,{value:"files",children:[l.jsx(Do,{className:"h-4 w-4"}),"Files"]}),be&&l.jsxs(Wr,{value:"skills",children:[l.jsx(Az,{className:"h-4 w-4"}),"Skills",jt&&ut.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:ut.length})]})]}),ue&&l.jsx(Ns,{value:"files",className:"pb-8",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[l.jsx(Vrs,{entries:xn,currentPath:D,isLoading:$,error:Z,onNavigate:z,onFileSelect:q,onRefresh:()=>G(),onCreateDirectory:K?void 0:Fe=>ie.mutate({path:Fe,workspaceId:E}),onDelete:K?void 0:Fe=>J.mutate({path:Fe,recursive:!0,force:!0,workspaceId:E})}),Q&&l.jsx(Zrs,{path:Q,content:ne?.content??"",isLoading:te,mimeType:ne?.mimeType,onClose:()=>q(null)})]})}),be&&l.jsx(Ns,{value:"skills",className:"pb-8",children:l.jsx(ass,{skills:ut,isLoading:de,isSkillsConfigured:jt,hasUndiscoveredAgentSkills:m,basePath:E?`/workspaces/${E}/skills`:"/workspaces",onAddSkill:oe?()=>u(!0):void 0,onUpdateSkill:oe?Ce:void 0,onRemoveSkill:oe?ye:void 0,updatingSkillName:h??void 0,removingSkillName:d??void 0,mountPaths:Le})})]}),!ue&&!be&&!T&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]}),E&&oe&&l.jsx(dss,{open:c,onOpenChange:u,workspaceId:E,onInstall:ve,isInstalling:re.isPending,installedSkillIds:ut.filter(Fe=>Fe.skillsShSource).map(Fe=>`${Fe.skillsShSource.owner}/${Fe.skillsShSource.repo}/${Fe.name}`),installedSkillNames:ut.filter(Fe=>!Fe.skillsShSource).map(Fe=>Fe.name),writableMounts:Pe,installedSkillPaths:Object.fromEntries(ut.filter(Fe=>Fe.path).map(Fe=>[Fe.name,Fe.path]))})]})}function fss({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:s,showInitWarning:a,onViewFileResult:i,onViewSkillResult:o}){const c=HYr(),u=QYr();return l.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(Do,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&l.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",l.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",l.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),l.jsx(Xrs,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:r,canVector:s,onViewResult:i})]}),n&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(Az,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(Jrs,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName,d.skillPath)})]})]})}function hss(e,t){return e==null||t==null?null:e in t?e:null}function pss(){const{skillName:e,workspaceId:t}=Sa(),[n]=wo(),r=ha(),s=e?decodeURIComponent(e):"",a=n.get("path"),i=a?decodeURIComponent(a):void 0,o=n.get("agentId"),c=o?decodeURIComponent(o):null,d=r.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=hss(c,d),h=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[p,m]=y.useState(null),{data:g,isLoading:v,error:x}=ZYr(s,{workspaceId:t,path:i}),{data:w}=k5t(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:S,isLoading:_}=GYr(s,p??"",{enabled:!!p,workspaceId:t,path:i}),O=E=>f?l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:h,children:[l.jsx(Ne,{children:l.jsx(s6,{className:"h-4 w-4"})}),f]}),l.jsxs(Bn,{as:"span",to:"",isCurrent:!0,children:[l.jsx(Ne,{children:l.jsx(Az,{className:"h-4 w-4"})}),E]})]}):l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:h,children:[l.jsx(Ne,{children:l.jsx(Zc,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(Bn,{as:ln,to:h,children:[l.jsx(Ne,{children:l.jsx(Az,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:E})]});return v?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Loading...")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):x&&Hs(x)?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Session Expired")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})]}):x&&Ps(x)?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"workspaces"})})]}):x||!g?l.jsxs(Jn,{children:[l.jsx(Zr,{children:O("Error")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),l.jsx("p",{className:"text-sm text-neutral3",children:x?.message??"Skill not found"})]})})]}):l.jsxs(Jn,{children:[l.jsxs(Zr,{children:[O(g.name),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(Ne,{children:l.jsx(Vw,{})}),"Documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:l.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:l.jsx(css,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),l.jsx(uss,{open:!!p,onOpenChange:E=>!E&&m(null),skillName:g.name,referencePath:p??"",content:S?.content,isLoading:_})]})}const b6t=()=>{const e=window.MASTRA_CLOUD_API_ENDPOINT;return{isMastraPlatform:!!e,mastraPlatformEndpoint:e}},mss=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:l.jsx(za,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:l.jsx(Do,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:l.jsx(go,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:l.jsx(ZS,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:l.jsx(ac,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:l.jsx(mo,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:l.jsx(Zc,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:l.jsx(sj,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/scorers",icon:l.jsx(ci,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/datasets",icon:l.jsx(Ja,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/experiments",icon:l.jsx(_d,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:l.jsx(hE,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",activePaths:["/traces"],icon:l.jsx(cl,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:l.jsx(Zet,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(bwe,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:l.jsx(yo,{}),isOnMastraPlatform:!0}]}];function wKe(e,t){const n=r=>t===r||t.startsWith(r+"/");return n(e.url)?!0:e.activePaths?.some(n)??!1}function gss(){const{Link:e}=cn(),{state:t,isMobile:n}=zq(),s=mu().pathname,{isMastraPlatform:a}=b6t(),{data:i}=Gj(),{isCmsAvailable:o,isLoading:c}=XD(),{hasPermission:u,hasAnyPermission:d,rbacEnabled:f,isAuthenticated:h,isLoading:p}=Jb(),m=i&&K2(i),g=new Set(["/prompts"]),v=x=>g.has(x.url)&&!o&&!c||a&&!x.isOnMastraPlatform?!1:f&&h&&p?!0:!(x.requiredPermission&&!u(x.requiredPermission)||x.requiredAnyPermission&&!d(x.requiredAnyPermission));return l.jsxs(Tf,{children:[l.jsx("div",{className:"pt-3 mb-4",children:t==="collapsed"?l.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[l.jsxs("div",{className:"relative grid place-items-center size-9",children:[l.jsx(lb,{className:Y("h-[1.5rem] w-[1.5rem] shrink-0 transition-opacity duration-150",!n&&"group-hover/sidebar:opacity-0")}),!n&&l.jsx("div",{className:"absolute inset-0 opacity-0 transition-opacity duration-150 group-hover/sidebar:opacity-100",children:l.jsx(Tf.Trigger,{})})]}),m&&l.jsx(Ome,{})]}):m?l.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[l.jsxs("span",{className:"flex items-center gap-2 flex-1 min-w-0",children:[l.jsx(lb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm whitespace-nowrap truncate",children:"Mastra Studio"}),!n&&l.jsx(Tf.Trigger,{})]}),l.jsx(Ome,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3 pr-2",children:[l.jsx(lb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm whitespace-nowrap truncate",children:"Mastra Studio"}),!n&&l.jsx(Tf.Trigger,{})]})}),l.jsx(Tf.Nav,{children:mss.map(x=>{const w=x.links.filter(v),S=w.length>0&&x?.separator,_=w.some(E=>wKe(E,s)),O=!!(x.href&&s===x.href&&!_);return l.jsxs(Tf.NavSection,{children:[x?.title?l.jsx(Tf.NavHeader,{LinkComponent:e,state:t,href:x.href,isActive:O,children:x.title}):l.jsx(l.Fragment,{children:S&&l.jsx(Tf.NavSeparator,{})}),l.jsx(Tf.NavList,{children:w.map(E=>{const j=wKe(E,s);return l.jsx(Tf.NavLink,{LinkComponent:e,state:t,link:E,isActive:j},E.name)})})]},x.key)})}),l.jsx(Tf.Bottom,{className:"pb-3",children:t!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(Tf.NavSeparator,{}),l.jsx(RZr,{collapsed:!1})]})})]})}function x6t({children:e,loginUrl:t="/login",signupUrl:n="/signup"}){const{data:r,isLoading:s}=Gj();if(s)return l.jsx(l.Fragment,{children:e});if(!r?.enabled)return l.jsx(l.Fragment,{children:e});if(K2(r))return l.jsx(l.Fragment,{children:e});const a=typeof window<"u"?window.location.href:void 0;if(!r.login)return l.jsx("div",{className:"flex h-full w-full items-center justify-center",children:l.jsxs("div",{className:"flex flex-col items-center space-y-6 text-center",children:[l.jsx(lb,{className:"h-16 w-16 opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-xl font-semibold text-neutral6",children:"Authentication Required"}),l.jsx("p",{className:"max-w-sm text-neutral3",children:"This page requires authentication, but no login method is configured. Please contact your administrator."})]})]})});const i=()=>{const o=new URL(n,window.location.origin);a&&o.searchParams.set("redirect",a),window.location.href=o.toString()};return l.jsx("div",{className:"flex h-full w-full items-center justify-center",children:l.jsxs("div",{className:"flex flex-col items-center space-y-6 text-center",children:[l.jsx(lb,{className:"h-16 w-16 opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-xl font-semibold text-neutral6",children:"Sign in to continue"}),l.jsx("p",{className:"max-w-sm text-neutral3",children:"You need to sign in to access this page."})]}),r.login.description&&l.jsxs("div",{className:"flex items-start gap-2.5 rounded-md border border-border1 bg-surface2 p-3 text-left",children:[l.jsx(Wet,{className:"mt-0.5 h-4 w-4 shrink-0 text-neutral4"}),l.jsx("p",{className:"max-w-sm text-sm text-neutral3",children:r.login.description})]}),l.jsx(G5t,{config:r.login,redirectUri:a,loginUrl:t}),(r.login.type==="credentials"||r.login.type==="both")&&r.login.signUpEnabled!==!1&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-neutral3",children:"Don't have an account? "}),l.jsx("button",{type:"button",onClick:i,className:"text-neutral6 hover:underline",children:"Sign up"})]})]})})}const w6t="experimental-ui:",S6t="current",vss=_e.createContext(null);function yss(e,t){const n=window.localStorage.getItem(w6t+e);return n&&t.has(n)?n:S6t}function bss({experiments:e,children:t}){const n=_e.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,s]=_e.useState({});_e.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=yss(u.key,d)}s(c)},[e,n]);const a=_e.useCallback(c=>r[c]??S6t,[r]),i=_e.useCallback((c,u)=>{window.localStorage.setItem(w6t+c,u),s(d=>({...d,[c]:u}))},[]),o=_e.useMemo(()=>({experiments:e,getVariant:a,setVariant:i}),[e,a,i]);return l.jsx(vss.Provider,{value:o,children:t})}const xss=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],wss=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"}),Sss=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>{t(r=>!r)},[]);return y.useEffect(()=>{const r=s=>{s.key==="k"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),n())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n]),{open:e,setOpen:t,toggle:n}},vEe=()=>{const{requestContext:e}=Zs(),t=Ze();return Ct({queryKey:["processors"],queryFn:()=>t.listProcessors(e)})},k6t=(e,t)=>{const n=Ze(),{requestContext:r}=Zs();return Ct({queryKey:["processor",e],queryFn:()=>n.getProcessor(e).details(r),enabled:!!e})},kss=()=>{const e=Ze(),{requestContext:t}=Zs();return or({mutationFn:async({processorId:n,phase:r,messages:s,agentId:a})=>e.getProcessor(n).execute({phase:r,messages:s,agentId:a,requestContext:t})})},_ss=()=>{const{open:e,setOpen:t}=Sss(),{navigate:n,paths:r}=cn(),{isMastraPlatform:s}=b6t(),a=Fq(),{data:i={}}=Wv(),{data:o={}}=Zw(),{data:c={}}=HH(),{data:u={}}=vEe(),{data:d=[]}=GD(),{data:f={}}=uf(),h=w=>{n(w),t(!1)},p=Object.entries(i),m=Object.entries(o),g=Object.entries(c),v=Object.values(u).filter(w=>w.phases&&w.phases.length>0),x=Object.entries(f);return l.jsxs(QKn,{open:e,onOpenChange:t,title:"Navigation",description:"Search and navigate to any entity",children:[l.jsx(VSt,{placeholder:"Search or navigate..."}),l.jsxs(HSt,{children:[l.jsx(WSt,{children:"No results found."}),l.jsxs(Wx,{heading:"Navigation",children:[a&&l.jsxs(Ml,{value:"toggle sidebar collapse expand",onSelect:()=>{a.toggleSidebar(),t(!1)},children:[l.jsx(Ket,{className:"text-neutral3"}),l.jsx("span",{children:"Toggle Sidebar"}),l.jsx(ZSt,{children:"Ctrl+B"})]}),l.jsxs(Ml,{value:"all agents",onSelect:()=>h("/agents"),children:[l.jsx(za,{className:"text-neutral3"}),l.jsx("span",{children:"All Agents"})]}),l.jsxs(Ml,{value:"all workflows",onSelect:()=>h("/workflows"),children:[l.jsx(go,{className:"text-neutral3"}),l.jsx("span",{children:"All Workflows"})]}),l.jsxs(Ml,{value:"all tools",onSelect:()=>h("/tools"),children:[l.jsx(mo,{className:"text-neutral3"}),l.jsx("span",{children:"All Tools"})]}),l.jsxs(Ml,{value:"all scorers",onSelect:()=>h("/scorers"),children:[l.jsx(ci,{className:"text-neutral3"}),l.jsx("span",{children:"All Scorers"})]}),l.jsxs(Ml,{value:"all processors",onSelect:()=>h("/processors"),children:[l.jsx(ZS,{className:"text-neutral3"}),l.jsx("span",{children:"All Processors"})]}),l.jsxs(Ml,{value:"all mcp servers",onSelect:()=>h("/mcps"),children:[l.jsx(ac,{className:"text-neutral3"}),l.jsx("span",{children:"All MCP Servers"})]}),l.jsxs(Ml,{value:"observability traces",onSelect:()=>h("/observability"),children:[l.jsx(cl,{className:"text-neutral3"}),l.jsx("span",{children:"Observability"})]}),!s&&l.jsxs(l.Fragment,{children:[l.jsxs(Ml,{value:"settings",onSelect:()=>h("/settings"),children:[l.jsx(bwe,{className:"text-neutral3"}),l.jsx("span",{children:"Settings"})]}),l.jsxs(Ml,{value:"templates",onSelect:()=>h("/templates"),children:[l.jsx(w0,{className:"text-neutral3"}),l.jsx("span",{children:"Templates"})]})]})]}),p.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Agents",children:p.map(([w,S])=>l.jsxs(_e.Fragment,{children:[l.jsxs(Ml,{value:`${S.name} chat agent`,onSelect:()=>h(r.agentLink(w)),children:[l.jsx(za,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Chat"]})]}),l.jsxs(Ml,{value:`${S.name} traces agent observability`,onSelect:()=>h(`/observability?entity=${w}`),children:[l.jsx(cl,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Traces"]})]})]},w))})]}),m.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Workflows",children:m.map(([w,S])=>l.jsxs(_e.Fragment,{children:[l.jsxs(Ml,{value:`${S.name} graph workflow view`,onSelect:()=>h(r.workflowLink(w)),children:[l.jsx(go,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Graph"]})]}),l.jsxs(Ml,{value:`${S.name} traces workflow observability`,onSelect:()=>h(`/observability?entity=${S.name}`),children:[l.jsx(cl,{className:"text-neutral3"}),l.jsxs("span",{children:[S.name,": Traces"]})]})]},w))})]}),g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Tools",children:g.map(([w,S])=>l.jsxs(Ml,{value:`tool ${S.id}`,onSelect:()=>h(r.toolLink(w)),children:[l.jsx(mo,{className:"text-neutral3"}),l.jsx("span",{children:S.id})]},w))})]}),x.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Scorers",children:x.map(([w,S])=>{const _=S.scorer?.config?.name||S.scorer?.config?.id||w;return l.jsxs(Ml,{value:`scorer ${_}`,onSelect:()=>h(r.scorerLink(w)),children:[l.jsx(ci,{className:"text-neutral3"}),l.jsx("span",{children:_})]},w)})})]}),v.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"Processors",children:v.map(w=>{const S=w.name||w.id,_=w.isWorkflow?r.workflowLink(w.id)+"/graph":r.processorLink(w.id);return l.jsxs(Ml,{value:`processor ${S}`,onSelect:()=>h(_),children:[l.jsx(ZS,{className:"text-neutral3"}),l.jsx("span",{children:S})]},w.id)})})]}),d.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Z1,{}),l.jsx(Wx,{heading:"MCP Servers",children:d.map(w=>l.jsxs(Ml,{value:`mcp server ${w.name}`,onSelect:()=>h(r.mcpServerLink(w.id)),children:[l.jsx(ac,{className:"text-neutral3"}),l.jsx("span",{children:w.name})]},w.id))})]})]})]})};function Oss(){return l.jsxs("header",{className:"lg:hidden sticky top-0 z-20 flex h-12 shrink-0 items-center gap-3 border-b border-border1 bg-surface1 px-3",children:[l.jsx(Tf.MobileTrigger,{}),l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(lb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm whitespace-nowrap",children:"Mastra Studio"})]})]})}function Ess({children:e}){const{data:t,isFetched:n}=Gj(),{pathname:r}=mu(),s=n&&t?.enabled&&!K2(t),a=n&&!s,i=l.jsx(x6t,{children:l.jsx(xnr,{resetKeys:[r],children:e})});return l.jsxs(l.Fragment,{children:[l.jsx(_ss,{}),l.jsxs("div",{className:Y("h-full",a&&"lg:grid lg:grid-cols-[auto_1fr] lg:grid-rows-[1fr]"),children:[a&&l.jsx(gss,{}),l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a&&l.jsx(Oss,{}),l.jsx("div",{className:Y("flex-1 min-h-0 bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":!a&&s}),children:i})]})]})]})}const Css=({children:e})=>{const{experimentalUIEnabled:t}=wss();return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(bSt,{position:"bottom-right"}),l.jsx(_St,{defaultTheme:"dark",children:l.jsx(sf,{delayDuration:0,children:l.jsx(bss,{experiments:t?xss:[],children:l.jsx(ver,{children:l.jsx(Ess,{children:e})})})})})]})},Tss=({children:e})=>l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(bSt,{position:"bottom-right"}),l.jsx(_St,{defaultTheme:"dark",children:l.jsx(sf,{delayDuration:0,children:l.jsx("div",{className:"h-full overflow-y-auto",children:l.jsx(x6t,{children:e})})})})]});function jss({agentId:e}){return l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/agents",children:[l.jsx(Ne,{children:l.jsx(za,{})}),"Agents"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(_Gr,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"Agents documentation"]})})]})}const Nss=({children:e})=>{const{agentId:t}=Sa(),n=mu(),{isCmsAvailable:r}=XD(),{hasObservability:s}=DZr(),a=Cme.has("datasets"),i=r&&a,o=s&&a,{data:c}=$h(t),u=Yu(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,h=n.pathname.includes("/editor")?"versions":n.pathname.includes("/evaluate")?"evaluate":n.pathname.includes("/review")?"review":n.pathname.includes("/traces")?"traces":"chat",p=(h==="versions"||h==="evaluate"||h==="review")&&(i||o),m=l.jsxs(Jn,{className:"grid-rows-[auto_auto_1fr]",children:[l.jsx(jss,{agentId:t}),l.jsx($Kr,{agentId:t,activeTab:h,showPlayground:i,showObservability:o,rightSlot:p?l.jsx(MKr,{requestContextSchema:f}):void 0}),e]});return l.jsx(H2,{children:l.jsx(RWr,{defaultProvider:u,defaultModel:d,children:l.jsx(SKr,{children:l.jsx(PWr,{children:m})})})})},Ass=({children:e,options:t})=>{const n=new vYn({...t,defaultOptions:{...t?.defaultOptions,queries:{retry:krr,...t?.defaultOptions?.queries}}});return l.jsx(yYn,{client:n,children:e})},Iss=()=>l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ii,{iconSlot:l.jsx(Xd,{}),titleSlot:"No Processors yet",descriptionSlot:"Configure processors. Add input or output processors to your agents to transform messages.",actionSlot:l.jsxs(ce,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:["Processors Documentation ",l.jsx(Va,{})]})})}),Rss=["input","inputStep","outputStep","outputStream","outputResult"];function Pss({processors:e,isLoading:t,search:n=""}){const{paths:r,Link:s}=cn(),a=y.useMemo(()=>Object.values(e??{}).filter(o=>o.phases&&o.phases.length>0),[e]),i=y.useMemo(()=>{const o=n.toLowerCase();return a.filter(c=>c.id.toLowerCase().includes(o)||(c.name||"").toLowerCase().includes(o))},[a,n]);return t?l.jsx(qd,{columns:"auto 1fr auto auto auto auto auto auto"}):l.jsxs(xe,{columns:"auto 1fr auto auto auto auto auto auto",children:[l.jsxs(xe.Top,{children:[l.jsx(xe.TopCell,{children:"Name"}),l.jsx(xe.TopCell,{children:"Description"}),l.jsx(xe.TopCellSmart,{long:"Input",short:"Input",tooltip:"Contains Input phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Input Step",short:l.jsxs(l.Fragment,{children:[l.jsx(H0,{})," Step"]}),tooltip:"Contains Input Step phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Output Step",short:l.jsxs(l.Fragment,{children:[l.jsx(Yf,{})," Step"]}),tooltip:"Contains Output Step phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Output Stream",short:l.jsxs(l.Fragment,{children:[l.jsx(Yf,{})," Stream"]}),tooltip:"Contains Output Stream phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{long:"Output Result",short:l.jsxs(l.Fragment,{children:[l.jsx(Yf,{})," Result"]}),tooltip:"Contains Output Result phase",className:"text-center"}),l.jsx(xe.TopCellSmart,{short:"Used by",long:"Used by Agents",className:"text-center"})]}),i.length===0&&n?l.jsx(xe.NoMatch,{message:"No Processors match your search"}):null,i.map(o=>{const c=Pp(o.name||o.id,50),u=Pp(o.description??"",200),d=o.agentIds?.length??0,f=new Set(o.phases||[]),h=o.isWorkflow?r.workflowLink(o.id)+"/graph":r.processorLink(o.id);return l.jsxs(xe.RowLink,{to:h,LinkComponent:s,children:[l.jsx(xe.NameCell,{children:c}),l.jsx(xe.DescriptionCell,{children:u}),Rss.map(p=>l.jsx(xe.TextCell,{className:"text-center",children:f.has(p)&&l.jsx(qa,{className:"size-4 mx-auto"})},p)),l.jsx(xe.TextCell,{className:"text-center",children:d||""})]},o.id)})]})}function $ss(){const{data:e={},isLoading:t,error:n}=vEe(),[r,s]=y.useState("");return n&&Hs(n)?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(pa,{})}):n&&Ps(n)?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(aa,{resource:"processors"})}):n?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(dc,{title:"Failed to load processors",message:n.message})}):Object.keys(e).length===0&&!t?l.jsx(lr,{title:"Processors",icon:l.jsx(km,{}),children:l.jsx(Iss,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:t,children:[l.jsx(km,{})," Processors"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:l.jsx(yo,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:s,label:"Filter processors",placeholder:"Filter by name"})})]}),l.jsx(Pss,{processors:e,isLoading:t,search:r})]})}function Mss({value:e,onValueChange:t,placeholder:n="Select a processor...",searchPlaceholder:r="Search processors...",emptyText:s="No processors found.",className:a,disabled:i=!1,variant:o="default"}){const{data:c={},isLoading:u,isError:d,error:f}=vEe(),{navigate:h,paths:p}=cn();y.useEffect(()=>{if(d){const v=f instanceof Error?f.message:"Failed to load processors";ze.error(`Error loading processors: ${v}`)}},[d,f]);const m=Object.keys(c).filter(v=>{const x=c[v];return x?.phases&&x.phases.length>0}).map(v=>({label:c[v]?.name||v,value:v})),g=v=>{t?t(v):v&&v!==e&&(c[v]?.isWorkflow?h(p.workflowLink(v)+"/graph"):h(p.processorLink(v)))};return l.jsx(Mc,{options:m,value:e,onValueChange:g,placeholder:u?"Loading processors...":n,searchPlaceholder:r,emptyText:s,className:a,disabled:i||u||d,variant:o})}const Dss={input:"Input - Process input messages before LLM (once at start)",inputStep:"Input Step - Process at each agentic loop step",outputStream:"Output Stream - Process streaming chunks",outputResult:"Output Result - Process complete output after streaming",outputStep:"Output Step - Process after each LLM response (before tools)"};function Lss({processorId:e}){const{data:t,isLoading:n,error:r}=k6t(e);return y.useEffect(()=>{if(r){const s=r instanceof Error?r.message:"Failed to load processor";ze.error(`Error loading processor: ${s}`)}},[r]),n?l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]}):r?null:t?l.jsx(zss,{processor:t}):l.jsx("div",{className:"py-12 text-center px-6",children:l.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Processor not found"})})}function zss({processor:e}){const t=Kb(),n=y.useId(),[r,s]=y.useState(e.phases[0]||"input"),[a,i]=y.useState(e.configurations[0]?.agentId||""),[o,c]=y.useState("Hello, this is a test message."),[u,d]=y.useState(null),[f,h]=y.useState(),p=kss(),m=async()=>{h(void 0),d(null);const x=r==="outputStep"||r==="outputResult"?"assistant":"user",w=[{id:crypto.randomUUID(),role:x,createdAt:new Date,content:{format:2,parts:[{type:"text",text:o}]}}];try{const S=await p.mutateAsync({processorId:e.id,phase:r,messages:w,agentId:a||void 0});d(S),!S.success&&S.error&&h(S.error)}catch(S){h(S.message||"An error occurred")}},g=u?JSON.stringify(u,null,2):"{}";return l.jsxs(mh,{hasLeftServiceColumn:!0,className:"relative",children:[l.jsxs("div",{className:"bg-surface2 border-r border-border1 w-[22rem] overflow-y-auto",children:[l.jsx(Fss,{processor:e}),l.jsxs("div",{className:"p-5 space-y-5",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Phase"}),l.jsxs(Ri,{value:r,onValueChange:v=>s(v),children:[l.jsx(mi,{className:"w-full",children:l.jsx(Pi,{placeholder:"Select phase"})}),l.jsx(gi,{children:e.phases.map(v=>l.jsx(hs,{value:v,children:v},v))})]}),l.jsx(me,{variant:"ui-xs",className:"text-neutral4",children:Dss[r]})]}),e.configurations.length>1&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Agent Configuration"}),l.jsxs(Ri,{value:a,onValueChange:i,children:[l.jsx(mi,{className:"w-full",children:l.jsx(Pi,{placeholder:"Select agent"})}),l.jsx(gi,{children:e.configurations.map(v=>l.jsxs(hs,{value:v.agentId,children:[v.agentName," (",v.type,")"]},v.agentId))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(me,{as:"label",htmlFor:n,variant:"ui-sm",className:"text-neutral3",children:"Test Message"}),l.jsx("textarea",{id:n,value:o,onChange:v=>c(v.target.value),placeholder:"Enter a test message...",rows:4,className:"w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-hidden focus:ring-2 focus:ring-accent1"})]}),l.jsx(ce,{onClick:m,disabled:p.isPending||r==="outputStream",className:"w-full",children:p.isPending?"Running...":"Run Processor"}),r==="outputStream"&&l.jsx(me,{variant:"ui-xs",className:"text-accent6",children:"Output Stream phase cannot be executed directly. Use streaming instead."}),u&&l.jsxs("div",{className:"space-y-2 pt-4 border-t border-border1",children:[l.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"Status"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(_t,{variant:u.success?"success":"error",children:u.success?"Success":"Failed"}),u.tripwire?.triggered&&l.jsx(_t,{variant:"info",children:"Tripwire Triggered"})]}),u.tripwire?.triggered&&u.tripwire.reason&&l.jsxs("div",{className:"mt-2 p-3 bg-accent6Dark rounded-md border border-accent6/20",children:[l.jsx(me,{variant:"ui-sm",className:"text-accent6 font-medium",children:"Tripwire Reason"}),l.jsx(me,{variant:"ui-sm",className:"text-neutral3 mt-1",children:u.tripwire.reason})]})]})]})]}),l.jsx("div",{className:"absolute top-4 right-4 z-10",children:l.jsx(da,{content:g,tooltip:"Copy JSON result to clipboard"})}),l.jsx("div",{className:"p-5 h-full relative overflow-x-auto overflow-y-auto",children:l.jsx(Zm,{value:f||g,editable:!0,theme:t,extensions:[Kf]})})]})}function Fss({processor:e}){return l.jsxs("div",{className:"px-5 pt-5 pb-4 border-b border-border1",children:[l.jsx(me,{variant:"header-md",className:"text-neutral1 mb-2",children:e.name||e.id}),e.name&&e.name!==e.id&&l.jsx(me,{variant:"ui-sm",className:"text-neutral4 mb-3",children:e.id}),l.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:e.phases.map(t=>l.jsx(_t,{variant:"default",children:t},t))}),l.jsx("div",{className:"mt-3",children:l.jsxs(me,{variant:"ui-xs",className:"text-neutral4",children:["Attached to ",e.configurations.length," agent",e.configurations.length!==1?"s":""]})})]})}function Bss(){const{processorId:e}=Sa(),{data:t,isLoading:n,error:r}=k6t(e);return r&&Hs(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(pa,{})})]}):r&&Ps(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(aa,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(Onn,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(Zr,{children:l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Ur,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(Ur,{className:"h-8 w-48 mb-4"}),l.jsx(Ur,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(Zr,{children:[l.jsxs(Ni,{children:[l.jsxs(Bn,{as:ln,to:"/processors",children:[l.jsx(Ne,{children:l.jsx(km,{})}),"Processors"]}),l.jsx(Bn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Mss,{value:e,variant:"ghost"})})]}),l.jsx(ld,{children:l.jsxs(ce,{as:ln,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(Vw,{}),"Processors documentation"]})})]}),l.jsx(Lss,{processorId:e})]})}function Uss(){const{data:e={},isLoading:t,error:n}=Wv(),{data:r={},isLoading:s,error:a}=HH(),[i,o]=y.useState(""),c=t||s,u=a||n;return u&&Hs(u)?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(pa,{})}):u&&Ps(u)?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(aa,{resource:"tools"})}):u?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(dc,{title:"Failed to load tools",message:u.message})}):Object.keys(r).length===0&&!c?l.jsx(lr,{title:"Tools",icon:l.jsx(mo,{}),children:l.jsx(_ns,{})}):l.jsxs(ht,{children:[l.jsxs(ht.TopArea,{children:[l.jsxs(ht.Row,{children:[l.jsx(ht.Column,{children:l.jsx(Tr,{children:l.jsxs(Tr.Title,{isLoading:c,children:[l.jsx(mo,{})," Tools"]})})}),l.jsx(ht.Column,{className:"flex justify-end gap-2",children:l.jsx(ss,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:l.jsx(yo,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(sg,{onSearch:o,label:"Filter tools",placeholder:"Filter by name"})})]}),l.jsx(kns,{tools:r,agents:e,isLoading:c,search:i})]})}const _6t={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,n,r)=>r?`/workspaces/${r}/skills/${encodeURIComponent(t)}?agentId=${encodeURIComponent(e)}${n?`&path=${encodeURIComponent(n)}`:""}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,n)=>n?`/agents/${e}/chat/${t}?messageId=${n}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,schedulesLink:()=>"/workflows/schedules",scheduleLink:e=>`/workflows/schedules/${encodeURIComponent(e)}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${Fo()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`,experimentLink:e=>`/experiments/${e}`},qss=()=>{const e=id(),t=n=>e(n,{viewTransition:!0});return l.jsx(z_t,{Link:xV,navigate:t,paths:_6t,children:l.jsx(Css,{children:l.jsx(RC,{})})})},Vss=()=>{const e=id(),t=n=>e(n,{viewTransition:!0});return l.jsx(z_t,{Link:xV,navigate:t,paths:_6t,children:l.jsx(Tss,{children:l.jsx(RC,{})})})},Hss=!!window.MASTRA_CLOUD_API_ENDPOINT,SKe=Cme.has("datasets"),kKe=[{index:!0,element:l.jsx(IJr,{})},{path:"instruction-blocks",element:l.jsx(RJr,{})},{path:"tools",element:l.jsx(DJr,{})},{path:"agents",element:l.jsx(jJr,{})},{path:"scorers",element:l.jsx($Jr,{})},{path:"workflows",element:l.jsx(zJr,{})},{path:"skills",element:l.jsx(MJr,{})},{path:"memory",element:l.jsx(PJr,{})},{path:"variables",element:l.jsx(LJr,{})}],Wss=[{path:"/login",element:l.jsx(gns,{})},{path:"/signup",element:l.jsx(ars,{})},{element:l.jsx(Vss,{}),children:[{path:"/agents/:agentId/session",element:l.jsx(UXe,{})},{path:"/agents/:agentId/session/:threadId",element:l.jsx(UXe,{})}]},{element:l.jsx(qss,{}),children:[...Hss?[]:[{path:"/settings",element:l.jsx(srs,{})},{path:"/templates",element:l.jsx(crs,{})},{path:"/templates/:templateSlug",element:l.jsx(grs,{})}],{path:"/logs",element:l.jsx(vns,{})},{path:"/primitives",element:l.jsx(Yns,{})},{path:"/evaluation",element:l.jsx(hns,{})},{path:"/scorers",element:l.jsx(trs,{})},{path:"/scorers/:scorerId",element:l.jsx(nrs,{})},{path:"/metrics",element:l.jsx(Hns,{})},{path:"/observability-overview",element:l.jsx(Gns,{})},{path:"/observability",element:l.jsx(krs,{})},{path:"/traces/:traceId",element:l.jsx(_rs,{})},{path:"/resources",element:l.jsx(ers,{})},{path:"/agents",element:l.jsx(k0r,{})},{path:"/cms/agents/create",element:l.jsx(NJr,{}),children:kKe},{path:"/cms/agents/:agentId/edit",element:l.jsx(AJr,{}),children:kKe},{path:"/cms/scorers/create",element:l.jsx(qJr,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(HJr,{})},{path:"/prompts",element:l.jsx(Xns,{})},{path:"/cms/prompts/create",element:l.jsx(FJr,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(UJr,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(vrs,{})},{path:"/agents/:agentId",element:l.jsx(Nss,{children:l.jsx(RC,{})}),children:[{index:!0,loader:({params:e})=>wG(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(FXe,{})},{path:"chat/:threadId",element:l.jsx(FXe,{})},...SKe?[{path:"editor",element:l.jsx(EJr,{})},{path:"evaluate",element:l.jsx(OJr,{})},{path:"review",element:l.jsx(CJr,{})}]:[],{path:"traces",element:l.jsx(TJr,{})}]},{path:"/tools",element:l.jsx(Uss,{})},{path:"/tools/:toolId",element:l.jsx(yrs,{})},{path:"/processors",element:l.jsx($ss,{})},{path:"/processors/:processorId",element:l.jsx(Bss,{})},{path:"/mcps",element:l.jsx(wns,{})},{path:"/mcps/:serverId",element:l.jsx(Ins,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx($ns,{})},{path:"/workspaces",element:l.jsx(xKe,{})},{path:"/workspaces/:workspaceId",element:l.jsx(xKe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(pss,{})},{path:"/workflows",element:l.jsx(Ors,{})},{path:"/workflows/schedules",element:l.jsx(Frs,{})},{path:"/workflows/schedules/:scheduleId",element:l.jsx(Drs,{})},{path:"/workflows/:workflowId",element:l.jsx(sbr,{children:l.jsx(RC,{})}),children:[{index:!0,loader:({params:e})=>wG(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(vKe,{})},{path:"graph/:runId",element:l.jsx(vKe,{})}]},...SKe?[{path:"/datasets",element:l.jsx(Hts,{})},{path:"/datasets/:datasetId",element:l.jsx(Zts,{})},{path:"/datasets/:datasetId/items/:itemId",element:l.jsx(Yts,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:l.jsx(Jts,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:l.jsx(Gts,{})},{path:"/experiments",element:l.jsx(pns,{})},{path:"/experiments/:experimentId",element:l.jsx(mns,{})},{path:"/datasets/:datasetId/experiments",element:l.jsx(Qts,{})},{path:"/datasets/:datasetId/items",element:l.jsx(Xts,{})},{path:"/datasets/:datasetId/versions",element:l.jsx(tns,{})}]:[],{index:!0,loader:()=>wG("/agents")},{path:"/request-context",element:l.jsx(Kns,{})}]}];function Zss(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:s}=VOe(),a=y.useMemo(()=>t?vJr(t,r):void 0,[t,r]);if(s)return null;if(!t)return l.jsx(MZr,{});const i=Xnn(Wss,{basename:e});return l.jsx(Sen,{baseUrl:t,headers:n,apiPrefix:r,customFetch:a,children:l.jsx(m0r,{children:l.jsx(Snn,{router:i})})})}function Gss(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",n=window.MASTRA_SERVER_PORT||4111,r=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",i=s||(a?window.location.origin:`${e}://${t}:${n}`);return l.jsx(Ass,{children:l.jsx(JWr,{endpoint:i,defaultApiPrefix:r,children:l.jsx(Zss,{})})})}$Ft.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(Gss,{})}));const Dls=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{frt as A,$it as B,prt as C,Pat as D,Sh as E,xp as F,Dls as G,Ea as I,KS as L,drt as N,TJt as a,VJt as b,Mls as c,CAe as d,ek as e,FJt as f,YE as g,qJt as h,o_ as i,l_ as j,a_ as k,zcn as l,Bat as m,YS as n,ri as o,acn as p,scn as q,dve as r,yge as s,se as t,qz as u,bd as v,RJt as w,vt as x,Be as y,sot as z};