@anvia/studio 0.7.13 → 0.7.14
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.
- package/dist/ui/assets/{evals-page-eIWZ_vsI.js → evals-page-w-gdHmQ3.js} +2 -2
- package/dist/ui/assets/{evals-page-eIWZ_vsI.js.map → evals-page-w-gdHmQ3.js.map} +1 -1
- package/dist/ui/assets/{index-CC5mjRie.js → index-BImv2lI7.js} +17 -17
- package/dist/ui/assets/index-BImv2lI7.js.map +1 -0
- package/dist/ui/assets/{knowledge-page-C6WkzIFh.js → knowledge-page-Diqg4sSt.js} +2 -2
- package/dist/ui/assets/{knowledge-page-C6WkzIFh.js.map → knowledge-page-Diqg4sSt.js.map} +1 -1
- package/dist/ui/assets/{mcps-page-BJ4m_GoP.js → mcps-page-XTpTg88A.js} +2 -2
- package/dist/ui/assets/{mcps-page-BJ4m_GoP.js.map → mcps-page-XTpTg88A.js.map} +1 -1
- package/dist/ui/assets/{memory-page-BuerJ-04.js → memory-page-DXesSt0M.js} +2 -2
- package/dist/ui/assets/{memory-page-BuerJ-04.js.map → memory-page-DXesSt0M.js.map} +1 -1
- package/dist/ui/assets/{pipelines-page-Dx0uB0Dm.js → pipelines-page-Bk0Qm7db.js} +2 -2
- package/dist/ui/assets/{pipelines-page-Dx0uB0Dm.js.map → pipelines-page-Bk0Qm7db.js.map} +1 -1
- package/dist/ui/assets/{sessions-page-UdXui_Zk.js → sessions-page-CmDz8RxM.js} +2 -2
- package/dist/ui/assets/{sessions-page-UdXui_Zk.js.map → sessions-page-CmDz8RxM.js.map} +1 -1
- package/dist/ui/assets/{status-page-DC5pVW4o.js → status-page-oWsYfXZZ.js} +2 -2
- package/dist/ui/assets/{status-page-DC5pVW4o.js.map → status-page-oWsYfXZZ.js.map} +1 -1
- package/dist/ui/assets/{tools-page-ByKfOqk3.js → tools-page-C-ht7C6S.js} +2 -2
- package/dist/ui/assets/{tools-page-ByKfOqk3.js.map → tools-page-C-ht7C6S.js.map} +1 -1
- package/dist/ui/assets/{trace-browser-Dk7nD7KO.js → trace-browser-DaE4vnXd.js} +2 -2
- package/dist/ui/assets/{trace-browser-Dk7nD7KO.js.map → trace-browser-DaE4vnXd.js.map} +1 -1
- package/dist/ui/assets/{transcript-item-DbtXMj-E.js → transcript-item-BqGgawoe.js} +2 -2
- package/dist/ui/assets/{transcript-item-DbtXMj-E.js.map → transcript-item-BqGgawoe.js.map} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +4 -4
- package/dist/ui/assets/index-CC5mjRie.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agents-page-B8Tw2e11.js","assets/utils-BN2yP0LH.js","assets/badge-BH7gz3tB.js","assets/evals-page-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agents-page-B8Tw2e11.js","assets/utils-BN2yP0LH.js","assets/badge-BH7gz3tB.js","assets/evals-page-w-gdHmQ3.js","assets/PlayIcon-Culan3xL.js","assets/knowledge-page-Diqg4sSt.js","assets/RefreshIcon-B3w42HZJ.js","assets/renderers-CIC1VVRv.js","assets/format-C9HPGfkW.js","assets/mcps-page-XTpTg88A.js","assets/memory-page-DXesSt0M.js","assets/pipelines-page-Bk0Qm7db.js","assets/pipelines-page-DtxX27Jz.css","assets/sessions-page-CmDz8RxM.js","assets/status-page-oWsYfXZZ.js","assets/tools-page-C-ht7C6S.js","assets/trace-browser-DaE4vnXd.js","assets/PathIcon-DX1w_Nk9.js","assets/transcript-item-BqGgawoe.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as e,i as t,n,r,s as i,t as a}from"./utils-BN2yP0LH.js";import{f as o,i as s,m as c,o as l,s as u}from"./format-C9HPGfkW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}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 o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=e(((e,t)=>{t.exports=d()})),p=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),m=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=e((e=>{var n=f(),r=t(),i=m();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function ne(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ne(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}var M=Array.isArray,N=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function F(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function I(e,t){ae++,ie[ae]=e.current,e.current=t}var se=oe(null),ce=oe(null),le=oe(null),L=oe(null);function ue(e,t){switch(I(le,t),I(ce,e),I(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(se),I(se,e)}function de(){F(se),F(ce),F(le)}function fe(e){e.memoizedState!==null&&I(L,e);var t=se.current,n=Hd(t,e.type);t!==n&&(I(ce,e),I(se,n))}function pe(e){ce.current===e&&(F(se),F(ce)),L.current===e&&(F(L),Qf._currentValue=re)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+me+e+he}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -106,16 +106,16 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
106
106
|
`}}return e?(p+=`
|
|
107
107
|
`+qu(l(e),c),s&&s()):d&&o&&o(),p}function Dd({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(vu(i))i.spaceBefore&&d.push(``),Od(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(hu(i)){let e=vu(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Od(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=vu(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=pd(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
108
108
|
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Ju(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
109
|
-
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function Od({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=qu(t(r),e);n.push(i.trimStart())}}function kd(e,t){let n=X(t)?t.value:t;for(let r of e)if(hu(r)&&(r.key===t||r.key===n||X(r.key)&&r.key.value===n))return r}var Ad=class extends Gu{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(su,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Cd(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=hu(e)?e:!e||typeof e!=`object`||!(`key`in e)?new wd(e,e?.value):new wd(e.key,e.value);let r=kd(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);X(r.value)&&zu(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=kd(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=kd(this.items,e)?.value;return(!t&&X(n)?n.value:n)??void 0}has(e){return!!kd(this.items,e)}set(e,t){this.add(new wd(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)xd(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!hu(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Td(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},jd={collection:`map`,default:!0,nodeClass:Ad,tag:`tag:yaml.org,2002:map`,resolve(e,t){return mu(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Ad.from(e,t,n)},Md=class extends Gu{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(uu,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=$(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=$(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&X(r)?r.value:r}has(e){let t=$(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=$(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];X(r)&&zu(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Fu(e,String(r++),t));return n}toString(e,t,n){return e?Td(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Uu(a,void 0,n))}}return i}};function $(e){let t=X(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Nd={collection:`seq`,default:!0,nodeClass:Md,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return gu(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Md.from(e,t,n)};function Pd(e){return typeof e==`bigint`||Number.isInteger(e)}var Fd=({value:e})=>JSON.stringify(e),Id=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Fd},{identify:e=>e==null,createNode:()=>new Bu(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Fd},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Fd},{identify:Pd,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Pd(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Fd}];[jd,Nd].concat(Id,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Ld(e,t,n){let{replacer:r}=n,i=new Md(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Cd(o,s,n))}return i}var Rd=class e extends Md{constructor(){super(),this.add=Ad.prototype.add.bind(this),this.delete=Ad.prototype.delete.bind(this),this.get=Ad.prototype.get.bind(this),this.has=Ad.prototype.has.bind(this),this.set=Ad.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(hu(e)?(r=Fu(e.key,``,t),i=Fu(e.value,r,t)):r=Fu(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Ld(e,t,n),i=new this;return i.items=r.items,i}};Rd.tag=`tag:yaml.org,2002:omap`;var zd=class e extends Ad{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=hu(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new wd(e.key,null):new wd(e,null),kd(this.items,t.key)||this.items.push(t)}get(e,t){let n=kd(this.items,e);return!t&&hu(n)?X(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=kd(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new wd(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Cd(e,null,n));return i}};zd.tag=`tag:yaml.org,2002:set`;var Bd=Symbol(`break visit`),Vd=Symbol(`skip children`),Hd=Symbol(`remove item`);function Ud(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Wd(Object.freeze([]),e,t)}Ud.BREAK=Bd,Ud.SKIP=Vd,Ud.REMOVE=Hd,Ud.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Ud.parentCollection=(e,t)=>{let n=Ud.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Wd(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Wd(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Bd)return Bd;else r===Hd&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var Gd={text(e){return{type:`text`,text:e}},imageUrl(e,t={}){let n={type:`image`,source:{type:`url`,url:e}};return t.detail!==void 0&&(n.detail=t.detail),n},imageBase64(e,t,n={}){let r={type:`image`,source:{type:`base64`,data:e,mediaType:t}};return n.detail!==void 0&&(r.detail=n.detail),r},documentUrl(e,t,n={}){return{type:`document`,source:n.filename===void 0?{type:`url`,url:e,mediaType:t}:{type:`url`,url:e,mediaType:t,filename:n.filename}}},documentBase64(e,t,n={}){return{type:`document`,source:n.filename===void 0?{type:`base64`,data:e,mediaType:t}:{type:`base64`,data:e,mediaType:t,filename:n.filename}}},documentText(e){return{type:`text`,text:e}}},Kd={toolResult(e,t,n){let r=typeof t==`string`?[{type:`text`,text:t}]:t;return n===void 0?{type:`tool_result`,id:e,content:r}:{type:`tool_result`,id:e,callId:n,content:r}}};function qd(e){if(typeof e==`string`)return e;try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}function Jd(e){return Array.isArray(e)&&e.length>0&&e.every(e=>typeof e!=`object`||!e||!(`type`in e)?!1:e.type===`text`?`text`in e&&typeof e.text==`string`:e.type===`image`?`data`in e&&typeof e.data==`string`&&(!(`mediaType`in e)||e.mediaType===void 0||typeof e.mediaType==`string`):!1)}var Yd={text(e){return{type:`text`,text:e}},imageUrl(e,t={}){let n={type:`image`,source:{type:`url`,url:e}};return t.detail!==void 0&&(n.detail=t.detail),n},imageBase64(e,t,n={}){let r={type:`image`,source:{type:`base64`,data:e,mediaType:t}};return n.detail!==void 0&&(r.detail=n.detail),r},reasoning(e,t){return t===void 0?{type:`reasoning`,text:e}:{type:`reasoning`,text:e,id:t}},reasoningFromContent(e,t){let n={type:`reasoning`,text:Xd(e),content:e};return t===void 0?n:{...n,id:t}},reasoningSummary(e,t){return Yd.reasoningFromContent([{type:`summary`,text:e}],t)},reasoningEncrypted(e,t){return Yd.reasoningFromContent([{type:`encrypted`,data:e}],t)},reasoningRedacted(e,t){return Yd.reasoningFromContent([{type:`redacted`,data:e}],t)},toolCall(e,t,n,r){let i={type:`tool_call`,id:e,function:{name:t,arguments:n}};return r===void 0?i:{...i,callId:r}}};function Xd(e){let t=Array.isArray(e)?e:e.content;return t===void 0?Array.isArray(e)?``:e.text:t.flatMap(e=>e.type===`text`||e.type===`summary`?[e.text]:[]).join(``)}var Zd={system(e){return{role:`system`,content:e}},user(e){return{role:`user`,content:typeof e==`string`?[Gd.text(e)]:e}},assistant(e,t){let n=typeof e==`string`?[Yd.text(e)]:e;return t===void 0?{role:`assistant`,content:n}:{role:`assistant`,id:t,content:n}},tool(e){return{role:`tool`,content:Array.isArray(e)?e:[e]}},toolResult(e,t,n={}){let r=Jd(t)?t:qd(t);return Zd.tool(Kd.toolResult(e,r,n.callId))}};function Qd(e){let t=[];for(let n of e){let e=$d(n.parts);if(n.role===`system`){e.length>0&&t.push(Zd.system(e));continue}if(n.role===`user`){let e=[];for(let t of n.parts){if(t.type===`text`){e.push(Gd.text(t.text));continue}if(t.type===`data`&&tf(t.data)){e.push(t.data);continue}throw TypeError(`User UI messages can only be converted from text parts or image/document data parts.`)}e.length>0&&t.push(Zd.user(e));continue}if(n.role===`assistant`){let e=[],r=[];for(let t of n.parts){if(t.type===`text`&&t.text.length>0){e.push(Yd.text(t.text));continue}if(t.type===`reasoning`&&t.text.length>0){e.push(Yd.reasoning(t.text,t.reasoningId));continue}t.type===`tool`&&(t.state===`input-streaming`||t.state===`input-available`||t.state===`output-available`)&&(e.push(Yd.toolCall(t.toolCallId,t.toolName,t.input??{},t.callId)),t.state===`output-available`&&r.push(Kd.toolResult(t.toolCallId,ef(t.output),t.callId)))}e.length>0&&t.push(Zd.assistant(e,n.id)),r.length>0&&t.push(Zd.tool(r));continue}let r=[];for(let e of n.parts)e.type!==`tool`||e.state!==`output-available`||r.push(Kd.toolResult(e.toolCallId,ef(e.output),e.callId));r.length>0&&t.push(Zd.tool(r))}return t}function $d(e){return e.flatMap(e=>e.type===`text`?[e.text]:[]).join(``)}function ef(e){return[{type:`text`,text:qd(e??null)}]}function tf(e){return af(e)?e.type===`text`?typeof e.text==`string`:e.type===`image`?nf(e):e.type===`document`?rf(e):!1:!1}function nf(e){return af(e.source)?e.source.type===`url`?typeof e.source.url==`string`:e.source.type===`base64`?typeof e.source.data==`string`&&typeof e.source.mediaType==`string`:!1:!1}function rf(e){return af(e.source)?e.source.type===`url`?typeof e.source.url==`string`&&typeof e.source.mediaType==`string`:e.source.type===`base64`?typeof e.source.data==`string`&&typeof e.source.mediaType==`string`:e.source.type===`text`?typeof e.source.text==`string`&&(e.source.mediaType===void 0||typeof e.source.mediaType==`string`):!1:!1}function af(e){return typeof e==`object`&&!!e}Nl({thought:al().describe(`A thought to record while reasoning through a task.`)});async function*of(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let e=await t.read();if(e.done===!0)break;r+=n.decode(e.value,{stream:!0});let i=r.split(/\r?\n/);r=i.pop()??``;for(let e of i){let t=e.trim();t.length>0&&(yield JSON.parse(t))}}r+=n.decode();let e=r.trim();e.length>0&&(yield JSON.parse(e))}finally{t.releaseLock()}}async function*sf(e){let t=e.getReader(),n=new TextDecoder,r=``,i=cf();try{for(;;){let e=await t.read();if(e.done===!0)break;r+=n.decode(e.value,{stream:!0});let a=r.split(/\r?\n/);r=a.pop()??``;for(let e of a){let t=lf(e,i);i=t.event,t.complete===!0&&t.data!==void 0&&(yield JSON.parse(t.data))}}if(r+=n.decode(),r.length>0){let e=lf(r,i);i=e.event,e.complete===!0&&e.data!==void 0&&(yield JSON.parse(e.data))}let e=uf(i);e!==void 0&&(yield JSON.parse(e))}finally{t.releaseLock()}}function cf(){return{data:[]}}function lf(e,t){if(e===``){let e=uf(t);return e===void 0?{event:cf(),complete:!0}:{event:cf(),complete:!0,data:e}}if(e.startsWith(`:`))return{event:t};let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1).replace(/^ /,``);return r===`data`&&t.data.push(i),{event:t}}function uf(e){if(e.data.length!==0)return e.data.join(`
|
|
110
|
-
`)}var
|
|
111
|
-
`)}function
|
|
112
|
-
`):``:``}function
|
|
113
|
-
`):typeof e.type==`string`?e.type:``:``}async function Op(e,t){for await(let n of of(e))await t(n)}function kp(){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})})}function Ap(e){let{attachments:t,messages:n,onActivePageChange:r,onAttachmentsChange:i,onBeforeRun:a,onError:c,onPromptChange:l,onRunStateChange:d,onStatus:f,promptRef:p,runState:m,selectedAgent:h,selectedAgentId:g,selectedModelRef:v,sessions:y,sessionsEnabled:b,traces:x,transcript:S}=e,C=(0,_.useRef)(void 0),w=(0,_.useRef)(void 0),T=(0,_.useRef)(Promise.resolve()),E=up({transport:Of({endpoint:e=>`/agents/${encodeURIComponent(e.agentId)}/runs`,method:`POST`,format:`jsonl`,headers:{"content-type":`application/json`},body:e=>{let{agentId:t,...n}=e;return JSON.stringify(n)},mapEvent:e=>e}),createRequest:()=>{let e=C.current;if(e===void 0)throw Error(`Missing playground run request`);return e},eventToDelta:()=>void 0,eventToFinal:()=>void 0,onEvent(e){O(e)&&(T.current=T.current.then(kp))},onError(e){w.current=e;let t=mp(e);c(t),S.appendAssistantError(t)}});(0,_.useEffect)(()=>{d(E.status===`streaming`?`running`:`idle`)},[d,E.status]);async function D(e){let u=e.trim(),_=t,D=h?.id??g;if(u.length===0&&_.length===0||D.length===0||m===`running`||E.status===`streaming`)return;d(`running`),a(),r(`playground`),c(``),l(``),i([]),requestAnimationFrame(()=>xp(p.current));let O=_.length===0?u:ri(u,_);S.setMessages(e=>[...e,{entryId:Sp(),kind:`message`,role:`user`,text:u,..._.length===0?{}:{attachments:ii(_)}},{entryId:Sp(),kind:`message`,role:`assistant`,text:``,tone:`pending`}]);try{let e=b&&y.selectedSessionId.length===0,t=e?(await y.createSession(o(u),{updatePath:!1})).id:y.selectedSessionId,r=b?void 0:yp(n);if(w.current=void 0,T.current=Promise.resolve(),C.current={agentId:D,message:O,...t.length===0?{}:{sessionId:t},...r===void 0?{}:{history:r},...v.length===0?{}:{model:v},stream:!0,metadata:{source:`anvia-studio`,...v.length===0?{}:{studioModel:v}}},await E.send(u),await T.current,w.current===void 0){if(await y.loadAllSessions(),t.length>0){y.setSelectedSessionId(t);let[n]=await Promise.all([x.loadSessionTraceSummaries(t),y.loadSessionLogs(t)]);S.setMessages(e=>Zr(e,n)),e&&y.openSessionPath(t)}f(`Connected`)}}catch(e){let t=s(e);c(t),S.appendAssistantError(t)}finally{C.current=void 0,E.reset(),d(`idle`)}}function O(e){if(e.type===`text_delta`)return S.appendAssistantText(e.delta),!0;if(e.type===`reasoning_delta`)return S.appendReasoningText(e.delta,e.id),!0;if(e.type===`tool_call`)return S.appendToolCall(e.toolCall.function.name,u(e.toolCall.function.arguments),e.toolCall.callId??e.toolCall.id),!0;if(e.type===`tool_result`)return S.appendToolResult({toolName:e.toolName,callId:e.toolCallId,args:e.args,result:e.result,...e.structuredResult===void 0?{}:{structuredResult:e.structuredResult}}),!0;if(e.type===`agent_tool_event`)return S.appendAgentToolEvent(e),!0;if(e.type===`tool_approval_request`||e.type===`tool_approval_result`)return S.updateToolApproval(e.approval),!0;if(e.type===`tool_question_request`||e.type===`tool_question_result`)return S.updateToolQuestion(e.question),!0;if(e.type===`session_log`)return y.appendSessionLogEntry(e.log),!0;if(e.type===`final`)return e.trace?.traceId!==void 0&&S.assignAssistantTraceId(e.trace.traceId),S.clearPendingAssistant(),!0;if(e.type===`error`){let t=hp(e.error);return w.current=e.error,c(t),S.appendAssistantError(t),!0}return!1}return{runPrompt:D}}function jp(){let[e,t]=(0,_.useState)([]);return{messages:e,setMessages:t,appendAgentToolEvent:e=>t(t=>Bp(t,e)),appendAssistantError:e=>t(t=>Np(t,e)),appendAssistantText:e=>t(t=>Mp(t,e)),appendReasoningText:(e,n)=>t(t=>Lp(t,e,n)),appendToolCall:(e,n,r)=>t(t=>Rp(t,e,n,r)),appendToolResult:e=>t(t=>zp(t,e)),assignAssistantTraceId:e=>t(t=>Pp(t,e)),clearPendingAssistant:()=>t(e=>Vp(e)),updateToolApproval:e=>t(t=>Fp(t,e)),updateToolQuestion:e=>t(t=>Ip(t,e))}}function Mp(e,t){let n=[...e],r=n.at(-1);if(r?.kind===`message`&&r.role===`assistant`)if(r.tone===`pending`){let{tone:e,...i}=r;n[n.length-1]={...i,text:t}}else n[n.length-1]={...r,text:`${r.text}${t}`};else n.push({entryId:Sp(),kind:`message`,role:`assistant`,text:t});return n}function Np(e,t){let n=[...e],r=n.at(-1),i={entryId:r?.kind===`message`&&r.role===`assistant`&&r.tone===`pending`?r.entryId:Sp(),kind:`message`,role:`assistant`,text:t,tone:`error`};return r?.kind===`message`&&r.role===`assistant`&&r.tone===`pending`?(n[n.length-1]=i,n):[...n,i]}function Pp(e,t){let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r?.kind===`message`&&r.role===`assistant`){n[e]={...r,traceId:t};break}}return n}function Fp(e,t){let n=Vp(e),r=Tp(n,t.toolName,t.callId);if(r<0)return n.push({entryId:Sp(),kind:`tool`,toolName:t.toolName,...t.callId===void 0?{}:{callId:t.callId},approval:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.resolvedAt===void 0?{}:{resolvedAt:t.resolvedAt},...t.reason===void 0?{}:{reason:t.reason}}}),n;let i=n[r];return i!==void 0&&i.kind===`tool`&&(n[r]={...i,approval:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.resolvedAt===void 0?{}:{resolvedAt:t.resolvedAt},...t.reason===void 0?{}:{reason:t.reason}}}),n}function Ip(e,t){let n=Vp(e),r=Tp(n,t.toolName,t.callId);if(r<0)return n.push({entryId:Sp(),kind:`tool`,toolName:t.toolName,...t.callId===void 0?{}:{callId:t.callId},question:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.answeredAt===void 0?{}:{answeredAt:t.answeredAt},questions:t.questions,...t.answers===void 0?{}:{answers:t.answers}}}),n;let i=n[r];return i!==void 0&&i.kind===`tool`&&(n[r]={...i,question:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.answeredAt===void 0?{}:{answeredAt:t.answeredAt},questions:t.questions,...t.answers===void 0?{}:{answers:t.answers}}}),n}function Lp(e,t,n){let r=Vp(e),i=r.at(-1);return i?.kind===`reasoning`&&(i.reasoningId??``)===(n??``)?r[r.length-1]={...i,text:`${i.text}${t}`}:r.push({entryId:Sp(),kind:`reasoning`,...n===void 0?{}:{reasoningId:n},text:t}),r}function Rp(e,t,n,r){return[...Vp(e),{entryId:Sp(),kind:`tool`,toolName:t,...r===void 0?{}:{callId:r},...n.length===0?{}:{args:n}}]}function zp(e,t){let n=Vp(e),r=wp(n,t.toolName,t.callId);if(r>=0){let e=n[r];if(e!==void 0&&e.kind===`tool`)return n[r]={...e,args:e.args??t.args,result:t.result,...t.structuredResult===void 0?{}:{structuredResult:t.structuredResult}},n}return n.push({entryId:Sp(),kind:`tool`,toolName:t.toolName,...t.callId===void 0?{}:{callId:t.callId},args:t.args,result:t.result,...t.structuredResult===void 0?{}:{structuredResult:t.structuredResult}}),n}function Bp(e,t){let n=Hp(t);if(n===void 0)return e;let r=Vp(e),i=wp(r,t.toolName,t.toolCallId);if(i<0)return r.push({entryId:Sp(),kind:`tool`,toolName:t.toolName,...t.toolCallId===void 0?{}:{callId:t.toolCallId},childEvents:[n]}),r;let a=r[i];if(a===void 0||a.kind!==`tool`)return r;let o=[...a.childEvents??[]];return Up(o,n),r[i]={...a,childEvents:o},r}function Vp(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.kind===`message`&&n.role===`assistant`&&n.tone===`pending`&&n.text.trim().length===0)return e.filter((e,n)=>n!==t)}return[...e]}function Hp(e){let t=e.event;if(t.type===`text_delta`)return{kind:`message`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},text:t.delta};if(t.type===`reasoning_delta`)return{kind:`reasoning`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},...t.id===void 0?{}:{reasoningId:t.id},text:t.delta};if(t.type===`tool_call`)return{kind:`tool`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},toolName:t.toolCall.function.name,...t.toolCall.callId===void 0&&t.toolCall.id===void 0?{}:{callId:t.toolCall.callId??t.toolCall.id},args:u(t.toolCall.function.arguments)};if(t.type===`tool_result`)return{kind:`tool`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},toolName:t.toolName,...t.toolCallId===void 0?{}:{callId:t.toolCallId},args:t.args,result:t.result,...t.structuredResult===void 0?{}:{structuredResult:t.structuredResult}};if(t.type===`error`)return{kind:`message`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},text:`Error: ${s(t.error)}`}}function Up(e,t){if(t.kind===`message`){let n=e.at(-1);n?.kind===`message`&&n.agentId===t.agentId?e[e.length-1]={...n,text:`${n.text}${t.text}`}:e.push(t);return}if(t.kind===`reasoning`){let n=e.at(-1);n?.kind===`reasoning`&&n.agentId===t.agentId&&(n.reasoningId??``)===(t.reasoningId??``)?e[e.length-1]={...n,text:`${n.text}${t.text}`}:e.push(t);return}let n=Wp(e,t);if(n<0){e.push(t);return}let r=e[n];r?.kind===`tool`&&(e[n]={...r,...r.args!==void 0||t.args===void 0?{}:{args:t.args},...t.result===void 0?{}:{result:t.result}})}function Wp(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(!(r?.kind!==`tool`||r.agentId!==t.agentId||r.toolName!==t.toolName||r.result!==void 0)&&(t.callId===void 0||r.callId===t.callId))return n}return-1}function Gp(e){let[t,n]=(0,_.useState)(()=>new Set),[r,i]=(0,_.useState)(()=>new Set);async function a(r,i){if(!t.has(r)){n(e=>new Set(e).add(r)),e.onError(``);try{let t=await fetch(`/approvals/${encodeURIComponent(r)}/decision`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({approved:i})});if(!t.ok)throw Error(`Approval decision failed with HTTP ${t.status}`);e.onToolApprovalUpdate(await t.json())}catch(t){e.onError(s(t))}finally{n(e=>{let t=new Set(e);return t.delete(r),t})}}}async function o(t,n){if(!r.has(t)){i(e=>new Set(e).add(t)),e.onError(``);try{let r=await fetch(`/questions/${encodeURIComponent(t)}/answer`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({answers:n})});if(!r.ok)throw Error(`Question answer failed with HTTP ${r.status}`);e.onToolQuestionUpdate(await r.json())}catch(t){e.onError(s(t))}finally{i(e=>{let n=new Set(e);return n.delete(t),n})}}}return{answeringQuestions:r,decidingApprovals:t,answerToolQuestion:o,decideToolApproval:a}}function Kp(e){let{currentAgentId:t,enabled:n,loadSessionTraceSummaries:r,runState:i,selectedModelRef:a,onError:o,onSessionCreated:c,onSessionDeleted:l,onSessionLoaded:u,onStatus:d}=e,[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)([]),[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(`idle`),[x,S]=(0,_.useState)(`idle`),C=(0,_.useRef)(``),w=(0,_.useCallback)(async()=>{if(!n){h([]);return}try{let e=await fetch(`/sessions?limit=100`);if(!e.ok)throw Error(`Sessions failed with HTTP ${e.status}`);h((await e.json()).sessions)}catch(e){o(s(e))}},[n,o]);(0,_.useEffect)(()=>{w()},[w]);let T=(0,_.useCallback)(async e=>{if(!n)return v([]),[];S(`loading`);try{let t=new URLSearchParams({limit:`1000`}),n=await fetch(`/sessions/${encodeURIComponent(e)}/logs?${t}`);if(!n.ok)throw Error(`Session logs failed with HTTP ${n.status}`);let r=await n.json();return v(r.logs),r.logs}catch(e){return o(s(e)),v([]),[]}finally{S(`idle`)}},[n,o]),E=(0,_.useCallback)(async(e,n={})=>{let r=await fetch(`/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agentId:t,title:e,metadata:{source:`anvia-studio`,...a.length===0?{}:{[Gr]:a}}})});if(!r.ok)throw Error(await pp(r,`Session create failed`));let i=await r.json();return p(i.id),h(e=>[i,...e.filter(e=>e.id!==i.id)]),n.updatePath!==!1&&c(i.id),await T(i.id),i},[t,T,c,a]),D=(0,_.useCallback)(async(e,t={})=>{if(i!==`running`){C.current=e,b(`loading`),o(``);try{let n=await fetch(`/sessions/${encodeURIComponent(e)}`);if(!n.ok)throw Error(`Session load failed with HTTP ${n.status}`);let i=await n.json(),[a]=await Promise.all([r(i.id),T(i.id)]);if(C.current!==e)return;p(i.id),u(i,a,t),d(`Connected`)}catch(t){C.current===e&&o(s(t))}finally{C.current===e&&b(`idle`)}}},[T,r,o,u,d,i]),O=(0,_.useCallback)(async e=>{if(i!==`running`){o(``);try{let t=await fetch(`/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`});if(!t.ok)throw Error(`Session delete failed with HTTP ${t.status}`);let n=f===e.id;h(t=>t.filter(t=>t.id!==e.id)),n&&(p(``),v([])),l(e.id,n),d(`Connected`)}catch(e){o(s(e))}}},[o,l,d,i,f]),k=(0,_.useCallback)(()=>{p(``),v([])},[]),A=(0,_.useCallback)(e=>{v(t=>t.some(t=>t.id===e.id)?t:[...t,e].sort((e,t)=>e.sequence-t.sequence))},[]);return(0,_.useMemo)(()=>({allSessions:m,selectedSessionId:f,sessionLogs:g,sessionLoadState:y,sessionLogLoadState:x,appendSessionLogEntry:A,clearSelectedSession:k,createSession:E,deleteSession:O,loadAllSessions:w,loadSession:D,loadSessionLogs:T,openSessionPath:c,setSelectedSessionId:p}),[m,A,k,E,O,w,D,T,c,f,y,x,g])}function qp(e,t){return!0}function Jp(e,t){return e}var Yp=document.getElementById(`anvia-ui`),Xp=Yp?.dataset.uiPath??`/ui`,Zp=Yp?.dataset.uiCompatPath??`/ui`,Qp=`${em(Xp)||em(Zp)||`/ui`}/assets/logo.png`,$p=`static-context`;function em(e){return e===`/`?``:e.replace(/\/+$/,``)}function tm(e){let{activePage:t,enabled:n,onError:r,onNavigateTracing:i,onOpenTrace:a,onOpenTraceIndex:o,onOpenTraceSession:c}=e,[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(()=>e.initialTraceId),[p,m]=(0,_.useState)(()=>e.initialTraceSessionId),[h,g]=(0,_.useState)(`idle`),v=(0,_.useCallback)(async()=>{if(!n){u([]);return}g(`loading`);try{let e=new URLSearchParams({include:`detail`,limit:`50`}),t=await fetch(`/traces?${e.toString()}`);if(!t.ok)throw Error(`Traces failed with HTTP ${t.status}`);let n=(await t.json()).traces;if(d.length>0&&!n.some(e=>e.id===d)){let e=await fetch(`/traces/${encodeURIComponent(d)}`);if(e.ok){u([await e.json(),...n]);return}}u(n)}catch(e){r(s(e))}finally{g(`idle`)}},[n,r,d]),y=(0,_.useCallback)(async(e,t={})=>{if(n){g(`loading`);try{let n=new URLSearchParams({include:`detail`,limit:`50`,sessionId:e}),r=await fetch(`/traces?${n.toString()}`);if(!r.ok)throw Error(`Session traces failed with HTTP ${r.status}`);let a=[...(await r.json()).traces].sort((e,t)=>Date.parse(e.startedAt)-Date.parse(t.startedAt));u(a);let o=a[0]?.id;if(o===void 0){f(``),m(e),t.updatePath!==!1&&c(e);return}i(),f(o),m(e),t.updatePath!==!1&&c(e)}catch(e){r(s(e))}finally{g(`idle`)}}},[n,r,i,c]),b=(0,_.useCallback)(async e=>{if(!n)return[];let t=new URLSearchParams({limit:`100`}),r=await fetch(`/sessions/${encodeURIComponent(e)}/traces?${t}`);return r.ok?(await r.json()).traces:[]},[n]);(0,_.useEffect)(()=>{t!==`tracing`||p!==void 0||v()},[t,v,p]);let x=(0,_.useCallback)((e,t)=>{f(e),m(t)},[]),S=(0,_.useCallback)(()=>{f(``),m(void 0)},[]),C=(0,_.useCallback)(e=>{if(i(),f(e),m(void 0),e.length===0){o();return}a(e)},[i,a,o]),w=(0,_.useCallback)(e=>{u(t=>t.filter(t=>t.sessionId!==e))},[]);return(0,_.useMemo)(()=>({traces:l,selectedTraceId:d,traceSessionDetailId:p,traceLoadState:h,clearTraceSelection:S,loadSessionTraceSummaries:b,loadTraces:v,removeSessionTraces:w,selectTrace:C,setTraceLocation:x,showSessionTraces:y}),[S,b,v,w,C,d,x,y,h,p,l])}var nm=(0,_.createContext)(void 0);function rm(){let e=(0,_.useContext)(nm);if(e===void 0)throw Error(`StudioConsoleContext is missing`);return e}var im=`modulepreload`,am=function(e){return`/ui/`+e},om={},sm=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=am(t,n),t in om)return;om[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:im,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},cm=(0,_.lazy)(()=>sm(()=>import(`./agents-page-B8Tw2e11.js`).then(e=>({default:e.AgentsPage})),__vite__mapDeps([0,1,2]))),lm=(0,_.lazy)(()=>sm(()=>import(`./evals-page-eIWZ_vsI.js`).then(e=>({default:e.EvalsPage})),__vite__mapDeps([3,1,4]))),um=(0,_.lazy)(()=>sm(()=>import(`./knowledge-page-C6WkzIFh.js`).then(e=>({default:e.KnowledgePage})),__vite__mapDeps([5,1,6,7,8,2]))),dm=(0,_.lazy)(()=>sm(()=>import(`./mcps-page-BJ4m_GoP.js`).then(e=>({default:e.McpsPage})),__vite__mapDeps([9,1,7,8,2]))),fm=(0,_.lazy)(()=>sm(()=>import(`./memory-page-BuerJ-04.js`).then(e=>({default:e.MemoryPage})),__vite__mapDeps([10,1,7,8,2]))),pm=(0,_.lazy)(()=>sm(()=>import(`./pipelines-page-Dx0uB0Dm.js`).then(e=>({default:e.PipelinesPage})),__vite__mapDeps([11,1,4,6,7,8,12]))),mm=(0,_.lazy)(()=>sm(()=>import(`./sessions-page-UdXui_Zk.js`).then(e=>({default:e.SessionsPage})),__vite__mapDeps([13,1,8]))),hm=(0,_.lazy)(()=>sm(()=>import(`./sessions-page-UdXui_Zk.js`).then(e=>({default:e.DeleteSessionDialog})),__vite__mapDeps([13,1,8]))),gm=(0,_.lazy)(()=>sm(()=>import(`./status-page-DC5pVW4o.js`).then(e=>({default:e.StatusPage})),__vite__mapDeps([14,1,7,8,2]))),_m=(0,_.lazy)(()=>sm(()=>import(`./tools-page-ByKfOqk3.js`).then(e=>({default:e.ToolsPage})),__vite__mapDeps([15,1,7,8,2]))),vm=(0,_.lazy)(()=>sm(()=>import(`./trace-browser-Dk7nD7KO.js`).then(e=>({default:e.TraceBrowser})),__vite__mapDeps([16,1,17,2,8])));function ym(){return(0,R.jsx)(`section`,{className:`grid h-full min-h-0 place-items-center bg-background/45 text-sm font-medium text-muted-foreground`,children:`Loading`})}var bm=[[`path`,{d:`M4.31802 19.682C3 18.364 3 16.2426 3 12C3 7.75736 3 5.63604 4.31802 4.31802C5.63604 3 7.75736 3 12 3C16.2426 3 18.364 3 19.682 4.31802C21 5.63604 21 7.75736 21 12C21 16.2426 21 18.364 19.682 19.682C18.364 21 16.2426 21 12 21C7.75736 21 5.63604 21 4.31802 19.682Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 14L9.79289 11.2071C10.1834 10.8166 10.8166 10.8166 11.2071 11.2071L12.7929 12.7929C13.1834 13.1834 13.8166 13.1834 14.2071 12.7929L17 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],xm=[[`path`,{d:`M13 2H11C7.22876 2 5.34315 2 4.17157 3.17157C3 4.34315 3 6.22876 3 10V14C3 17.7712 3 19.6569 4.17157 20.8284C5.34315 22 7.22876 22 11 22H13C16.7712 22 18.6569 22 19.8284 20.8284C21 19.6569 21 17.7712 21 14V10C21 6.22876 21 4.34315 19.8284 3.17157C18.6569 2 16.7712 2 13 2Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21 12H3`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M15 7H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M15 17H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}]],Sm=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Cm=[[`path`,{d:`M12 5.5V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 11C18 11 13.5811 5.00001 12 5C10.4188 4.99999 6 11 6 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],wm=[[`path`,{d:`M19.5 12.0001V13.5001C19.5 17.6422 16.1421 21.0001 12 21.0001C7.85786 21.0001 4.5 17.6422 4.5 13.5001V8C4.5 5.23858 6.73858 3 9.5 3C12.2614 3 14.5 5.23858 14.5 8V13.5C14.5 14.8807 13.3807 16 12 16C10.6193 16 9.5 14.8807 9.5 13.5V9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Tm=[[`path`,{d:`M18 6L6.00081 17.9992M17.9992 18L6 6.00085`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Em=[[`path`,{d:`M2 10.5C2 9.72921 2.01346 8.97679 2.03909 8.2503C2.12282 5.87683 2.16469 4.69009 3.13007 3.71745C4.09545 2.74481 5.3157 2.6926 7.7562 2.58819C9.09517 2.5309 10.5209 2.5 12 2.5C13.4791 2.5 14.9048 2.5309 16.2438 2.58819C18.6843 2.6926 19.9046 2.74481 20.8699 3.71745C21.8353 4.69009 21.8772 5.87683 21.9609 8.2503C21.9865 8.97679 22 9.72921 22 10.5C22 11.2708 21.9865 12.0232 21.9609 12.7497C21.8772 15.1232 21.8353 16.3099 20.8699 17.2826C19.9046 18.2552 18.6843 18.3074 16.2437 18.4118C15.5098 18.4432 14.7498 18.4667 13.9693 18.4815C13.2282 18.4955 12.8576 18.5026 12.532 18.6266C12.2064 18.7506 11.9325 18.9855 11.3845 19.4553L9.20503 21.3242C9.07273 21.4376 8.90419 21.5 8.72991 21.5C8.32679 21.5 8 21.1732 8 20.7701V18.4219C7.91842 18.4186 7.83715 18.4153 7.75619 18.4118C5.31569 18.3074 4.09545 18.2552 3.13007 17.2825C2.16469 16.3099 2.12282 15.1232 2.03909 12.7497C2.01346 12.0232 2 11.2708 2 10.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.1257 10.5H12.0007M8.125 10.5H8M16.125 10.5H16M12.2507 10.5C12.2507 10.6381 12.1388 10.75 12.0007 10.75C11.8627 10.75 11.7507 10.6381 11.7507 10.5C11.7507 10.3619 11.8627 10.25 12.0007 10.25C12.1388 10.25 12.2507 10.3619 12.2507 10.5ZM8.25 10.5C8.25 10.6381 8.13807 10.75 8 10.75C7.86193 10.75 7.75 10.6381 7.75 10.5C7.75 10.3619 7.86193 10.25 8 10.25C8.13807 10.25 8.25 10.3619 8.25 10.5ZM16.25 10.5C16.25 10.6381 16.1381 10.75 16 10.75C15.8619 10.75 15.75 10.6381 15.75 10.5C15.75 10.3619 15.8619 10.25 16 10.25C16.1381 10.25 16.25 10.3619 16.25 10.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Dm=[[`path`,{d:`M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17.0001 9.00004 17.0001C9.41425 17.0001 9.74759 16.6523 10.4143 15.9568L19 7.00006`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Om=[[`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 10.842C7.60158 11.0229 8.27434 11.1718 9 11.282`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20 12C20 13.6569 16.4183 15 12 15C7.58172 15 4 13.6569 4 12`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M7 17.842C7.60158 18.0229 8.27434 18.1718 9 18.282`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M20 5V19C20 20.6569 16.4183 22 12 22C7.58172 22 4 20.6569 4 19V5`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],km=[[`path`,{d:`M15 3H18C19.4142 3 20.1213 3 20.5607 3.43934C21 3.87868 21 4.58579 21 6V9M20 4L11 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20 13C20 16.7712 20 18.6569 18.8284 19.8284C17.6569 21 15.7712 21 12 21H11C7.22876 21 5.34315 21 4.17157 19.8284C3 18.6569 3 16.7712 3 13V12C3 8.22876 3 6.34315 4.17157 5.17157C5.34315 4 7.22876 4 11 4`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],Am=[[`circle`,{cx:`12`,cy:`14`,r:`2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20.0007 20C21.2561 18.3287 22 16.2512 22 14C22 12.5778 21.7031 11.2249 21.1679 10M3.99927 20C2.74389 18.3287 2 16.2512 2 14C2 8.47715 6.47715 4 12 4C13.4222 4 14.7751 4.2969 16 4.83209`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13.5 12.5L19 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],jm=[[`path`,{d:`M2 11.4C2 10.2417 2.24173 10 3.4 10H20.6C21.7583 10 22 10.2417 22 11.4V12.6C22 13.7583 21.7583 14 20.6 14H3.4C2.24173 14 2 13.7583 2 12.6V11.4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2 3.4C2 2.24173 2.24173 2 3.4 2H20.6C21.7583 2 22 2.24173 22 3.4V4.6C22 5.75827 21.7583 6 20.6 6H3.4C2.24173 6 2 5.75827 2 4.6V3.4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2 19.4C2 18.2417 2.24173 18 3.4 18H20.6C21.7583 18 22 18.2417 22 19.4V20.6C22 21.7583 21.7583 22 20.6 22H3.4C2.24173 22 2 21.7583 2 20.6V19.4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}]],Mm=[[`path`,{d:`M21.5 14.0784C20.3003 14.7189 18.9301 15.0821 17.4751 15.0821C12.7491 15.0821 8.91792 11.2509 8.91792 6.52485C8.91792 5.06986 9.28105 3.69968 9.92163 2.5C5.66765 3.49698 2.5 7.31513 2.5 11.8731C2.5 17.1899 6.8101 21.5 12.1269 21.5C16.6849 21.5 20.503 18.3324 21.5 14.0784Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Nm=[[`path`,{d:`M15.5 2V6M8.5 6V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.00446 7.61331C5.93719 6.74273 6.63957 6 7.53014 6H16.4699C17.3604 6 18.0628 6.74273 17.9955 7.61331L17.8117 9.99197C17.6796 11.7019 17.1011 13.3498 16.132 14.7773L15.5312 15.6622C14.9638 16.4979 14.0077 17 12.9838 17H11.0162C9.99228 17 9.03617 16.4979 8.46881 15.6622L7.86803 14.7773C6.89885 13.3498 6.32041 11.7019 6.18827 9.99197L6.00446 7.61331Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 17V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11 9H13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Pm=[[`path`,{d:`M12 4V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20 22C20 17.5817 16.4183 14 12 14C7.58172 14 4 17.5817 4 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.375 8.25H9.25M9.5 8.25C9.5 8.38807 9.38807 8.5 9.25 8.5C9.11193 8.5 9 8.38807 9 8.25C9 8.11193 9.11193 8 9.25 8C9.38807 8 9.5 8.11193 9.5 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M14.875 8.25H14.75M15 8.25C15 8.38807 14.8881 8.5 14.75 8.5C14.6119 8.5 14.5 8.38807 14.5 8.25C14.5 8.11193 14.6119 8 14.75 8C14.8881 8 15 8.11193 15 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M15.1538 4H8.84615C7.59095 4 6.96334 4 6.47397 4.22025C5.91693 4.47095 5.47095 4.91693 5.22025 5.47397C5 5.96334 5 6.59095 5 7.84615C5 9.85448 5 10.8586 5.3524 11.6417C5.75353 12.5329 6.46709 13.2465 7.35835 13.6476C8.14135 14 9.14552 14 11.1538 14H12.8462C14.8545 14 15.8586 14 16.6417 13.6476C17.5329 13.2465 18.2465 12.5329 18.6476 11.6417C19 10.8586 19 9.85448 19 7.84615C19 6.59095 19 5.96334 18.7797 5.47397C18.529 4.91693 18.0831 4.47095 17.526 4.22025C17.0367 4 16.4091 4 15.1538 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],Fm=[[`path`,{d:`M18.7088 3.49534C16.8165 2.55382 14.5009 2 12 2C9.4991 2 7.1835 2.55382 5.29116 3.49534C4.36318 3.95706 3.89919 4.18792 3.4496 4.91378C3 5.63965 3 6.34248 3 7.74814V11.2371C3 16.9205 7.54236 20.0804 10.173 21.4338C10.9067 21.8113 11.2735 22 12 22C12.7265 22 13.0933 21.8113 13.8269 21.4338C16.4576 20.0804 21 16.9205 21 11.2371L21 7.74814C21 6.34249 21 5.63966 20.5504 4.91378C20.1008 4.18791 19.6368 3.95706 18.7088 3.49534Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Im=[[`path`,{d:`M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2C11.6227 2.33333 11.0945 3.2 12 4M12 20C12.3773 20.3333 12.9055 21.2 12 22M19.5 4.50271C18.9685 4.46982 17.9253 4.72293 18.0042 5.99847M5.49576 17.5C5.52865 18.0315 5.27555 19.0747 4 18.9958M5.00271 4.5C4.96979 5.03202 5.22315 6.0763 6.5 5.99729M18 17.5026C18.5315 17.4715 19.5747 17.7108 19.4958 18.9168M22 12C21.6667 11.6227 20.8 11.0945 20 12M4 11.5C3.66667 11.8773 2.8 12.4055 2 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],Lm=[[`path`,{d:`M6 5.5C6 4.56538 6 4.09808 6.20096 3.75C6.33261 3.52197 6.52197 3.33261 6.75 3.20096C7.09808 3 7.56538 3 8.5 3H11.5C12.4346 3 12.9019 3 13.25 3.20096C13.478 3.33261 13.6674 3.52197 13.799 3.75C14 4.09808 14 4.56538 14 5.5C14 6.43462 14 6.90192 13.799 7.25C13.6674 7.47803 13.478 7.66739 13.25 7.79904C12.9019 8 12.4346 8 11.5 8H8.5C7.56538 8 7.09808 8 6.75 7.79904C6.52197 7.66739 6.33261 7.47803 6.20096 7.25C6 6.90192 6 6.43462 6 5.5Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6 15.5C6 14.5654 6 14.0981 6.20096 13.75C6.33261 13.522 6.52197 13.3326 6.75 13.201C7.09808 13 7.56538 13 8.5 13H11.5C12.4346 13 12.9019 13 13.25 13.201C13.478 13.3326 13.6674 13.522 13.799 13.75C14 14.0981 14 14.5654 14 15.5C14 16.4346 14 16.9019 13.799 17.25C13.6674 17.478 13.478 17.6674 13.25 17.799C12.9019 18 12.4346 18 11.5 18H8.5C7.56538 18 7.09808 18 6.75 17.799C6.52197 17.6674 6.33261 17.478 6.20096 17.25C6 16.9019 6 16.4346 6 15.5Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20.8398 17.1408C21.6133 16.3673 22 15.9806 22 15.5C22 15.0194 21.6133 14.6327 20.8398 13.8592L20.6408 13.6602C19.8673 12.8867 19.4806 12.5 19 12.5C18.5194 12.5 18.1327 12.8867 17.3592 13.6602L17.1602 13.8592C16.3867 14.6327 16 15.0194 16 15.5C16 15.9806 16.3867 16.3673 17.1602 17.1408L17.3592 17.3398C18.1327 18.1133 18.5194 18.5 19 18.5C19.4806 18.5 19.8673 18.1133 20.6408 17.3398L20.8398 17.1408Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M6.006 5.5H2.00781M2.00781 5.5V2M2.00781 5.5V12C2.00781 13.1037 1.85651 14.4679 2.89627 15.1629C3.40049 15.5 4.1024 15.5 5.50623 15.5M14.0024 15.5H16.0015M19.0001 12.5V9.5C19.0001 7.61438 19.0001 6.67157 18.4146 6.08579C17.8291 5.5 16.8867 5.5 15.0019 5.5H14.0024`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M22.0001 22C21.0682 22 20.6023 22 20.2348 21.8695C19.7447 21.6955 19.3554 21.3618 19.1524 20.9417C19.0001 20.6267 19.0001 20.2273 19.0001 19.4286V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],Rm=[[`path`,{d:`M20.3584 13.3567C19.1689 14.546 16.9308 14.4998 13.4992 14.4998C11.2914 14.4998 9.50138 12.7071 9.50024 10.4993C9.50024 7.07001 9.454 4.83065 10.6435 3.64138C11.8329 2.45212 12.3583 2.50027 17.6274 2.50027C18.1366 2.49809 18.3929 3.11389 18.0329 3.47394L15.3199 6.18714C14.6313 6.87582 14.6294 7.99233 15.3181 8.68092C16.0068 9.36952 17.1234 9.36959 17.8122 8.68109L20.5259 5.96855C20.886 5.60859 21.5019 5.86483 21.4997 6.37395C21.4997 11.6422 21.5479 12.1675 20.3584 13.3567Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M13.5 14.5L7.32842 20.6716C6.22386 21.7761 4.433 21.7761 3.32843 20.6716C2.22386 19.567 2.22386 17.7761 3.32843 16.6716L9.5 10.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5.50896 18.5H5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,key:`2`}]];function zm(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Bm(...e){return t=>{let n=!1,r=e.map(e=>{let r=zm(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():zm(e[t],null)}}}}function Vm(...e){return _.useCallback(Bm(...e),e)}function Hm(e){let t=_.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Xm(r)&&typeof eh==`function`&&(r=eh(r._payload)),_.Children.forEach(r,e=>{if(Jm(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Xm(n)&&typeof eh==`function`&&(n=eh(n._payload)),a=Gm(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=_.cloneElement(a,void 0,s):!o&&_.Children.count(r)===1&&_.isValidElement(r)&&(a=r);let c=a?qm(a):void 0,l=Vm(n,c);if(!a){if(r||r===0)throw Error(o?$m(e):Qm(e));return r}let u=Km(i,a.props??{});return a.type!==_.Fragment&&(u.ref=n?l:c),_.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Um=Hm(`Slot`),Wm=Symbol.for(`radix.slottable`),Gm=(e,t)=>{if(`child`in e.props){let t=e.props.child;return _.isValidElement(t)?_.cloneElement(t,void 0,e.props.children(t.props.children)):null}return _.isValidElement(t)?t:null};function Km(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qm(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jm(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Wm}var Ym=Symbol.for(`react.lazy`);function Xm(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ym&&`_payload`in e&&Zm(e._payload)}function Zm(e){return typeof e==`object`&&!!e&&`then`in e}var Qm=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,$m=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,eh=_.use,th=n(`inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-semibold shadow-none transition duration-200 ease-out active:translate-y-px disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:ring-offset-0 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`border border-foreground/45 bg-foreground text-background hover:bg-foreground/90`,ghost:`border border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,destructive:`border border-destructive bg-destructive text-destructive-foreground hover:bg-destructive/90`,secondary:`border border-border/80 bg-secondary text-secondary-foreground hover:border-muted-foreground/45 hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 px-3`,icon:`h-8 w-8 p-0`,sm:`h-8 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}});function nh({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,R.jsx)(r?Um:`button`,{className:a(th({variant:t,size:n,className:e})),...i})}var rh={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`},ih=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n,absoluteStrokeWidth:r=!1,className:i=``,altIcon:a,showAlt:o=!1,icon:s,primaryColor:c,secondaryColor:l,disableSecondaryOpacity:u=!1,...d},f)=>{let p=n===void 0?void 0:r?Number(n)*24/Number(t):n,m=p===void 0?{}:{strokeWidth:p,stroke:`currentColor`};return(0,_.createElement)(`svg`,{ref:f,...rh,width:t,height:t,color:c||e,className:i,...m,...d},[...o&&a?a:s].sort(([,e],[,t])=>{let n=e.opacity!==void 0;return t.opacity===void 0?n?-1:0:1}).map(([t,n])=>{let r=n.opacity!==void 0,i=r&&!u?n.opacity:void 0,a=l?{...n.stroke===void 0?{fill:r?l:c||e}:{stroke:r?l:c||e}}:{};return(0,_.createElement)(t,{...n,...m,...a,opacity:i,key:n.key})}))});ih.displayName=`HugeiconsIcon`;function ah({color:e=`currentColor`,strokeWidth:t=1.5,...n}){return(0,R.jsx)(ih,{color:e,strokeWidth:t,...n})}function oh(e){let t=sh(e.icon);return(0,R.jsxs)(nh,{className:a(`h-8 min-h-8 w-full justify-start gap-3 rounded-lg bg-transparent px-2.5 text-sm font-medium text-sidebar-foreground/62 shadow-none transition duration-200 hover:bg-sidebar-accent/80 hover:text-sidebar-foreground active:translate-y-px [&_svg]:h-3.5 [&_svg]:w-3.5`,e.active&&`bg-sidebar-accent text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`),variant:`ghost`,type:`button`,disabled:e.disabled,onClick:e.onClick,children:[(0,R.jsx)(ah,{icon:t}),(0,R.jsx)(`span`,{children:e.label})]})}function sh(e){switch(e){case`activity`:return bm;case`bot`:return Pm;case`database`:return Om;case`gauge`:return Am;case`list`:return jm;case`message`:return Em;case`plug`:return Nm;case`shield`:return Fm;case`wrench`:return Rm;case`workflow`:return Lm}}function ch(e){return(0,R.jsxs)(`aside`,{className:`flex h-[100dvh] min-h-0 flex-col overflow-hidden bg-sidebar text-sidebar-foreground`,children:[(0,R.jsx)(`div`,{className:`flex h-15 items-center px-4`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.jsx)(`img`,{className:`h-7 w-7 shrink-0 object-contain`,src:Qp,alt:``}),(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,R.jsx)(`span`,{className:`anvia-wordmark text-lg font-semibold tracking-normal text-sidebar-foreground`,children:`Anvia Studio`})})]})}),(0,R.jsxs)(`nav`,{className:`grid gap-0.5 px-3 py-3`,"aria-label":`Main`,children:[(0,R.jsx)(`div`,{className:`px-2.5 pb-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:`Workspace`}),(0,R.jsx)(oh,{active:e.activePage===`playground`,icon:`message`,label:`Chat`,onClick:()=>e.onNavigate(`playground`)}),(0,R.jsx)(oh,{active:e.activePage===`pipelines`,icon:`workflow`,label:`Pipelines`,onClick:()=>e.onNavigate(`pipelines`)}),(0,R.jsx)(oh,{active:e.activePage===`evals`,icon:`gauge`,label:`Evals`,onClick:()=>e.onNavigate(`evals`)}),(0,R.jsx)(oh,{active:e.activePage===`sessions`,icon:`list`,label:`Sessions`,onClick:()=>e.onNavigate(`sessions`)}),(0,R.jsx)(oh,{active:e.activePage===`tracing`,icon:`activity`,label:`Traces`,onClick:()=>e.onNavigate(`tracing`)})]}),(0,R.jsxs)(`nav`,{className:`grid gap-0.5 px-3 py-3`,"aria-label":`Studio`,children:[(0,R.jsx)(`div`,{className:`px-2.5 pb-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:`Inspect`}),(0,R.jsx)(oh,{active:e.activePage===`agents`,icon:`bot`,label:`Studio`,onClick:()=>e.onNavigate(`agents`)}),(0,R.jsx)(oh,{active:e.activePage===`tools`,icon:`wrench`,label:`Tools`,onClick:()=>e.onNavigate(`tools`)}),(0,R.jsx)(oh,{active:e.activePage===`mcps`,icon:`plug`,label:`MCPs`,onClick:()=>e.onNavigate(`mcps`)}),(0,R.jsx)(oh,{active:e.activePage===`knowledge`,icon:`database`,label:`Knowledge`,onClick:()=>e.onNavigate(`knowledge`)}),(0,R.jsx)(oh,{active:e.activePage===`memory`,icon:`database`,label:`Memory`,onClick:()=>e.onNavigate(`memory`)}),(0,R.jsx)(oh,{active:e.activePage===`status`,icon:`gauge`,label:`Status`,onClick:()=>e.onNavigate(`status`)})]}),(0,R.jsxs)(`nav`,{className:`grid min-h-0 gap-0.5 overflow-auto px-3 py-3`,"aria-label":`Recent sessions`,children:[(0,R.jsx)(`div`,{className:`px-2.5 pb-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:`Recent`}),e.allSessions.slice(0,8).map(t=>(0,R.jsxs)(`div`,{className:a(`group grid min-h-7 min-w-0 grid-cols-[minmax(0,1fr)_36px] items-center gap-1 rounded-lg pr-1 transition duration-200 hover:bg-sidebar-accent/80 focus-within:bg-sidebar-accent/80`,t.id===e.selectedSessionId&&`bg-sidebar-accent`),children:[(0,R.jsx)(nh,{className:a(`grid h-auto min-h-7 min-w-0 justify-start rounded-lg border-0 bg-transparent px-2.5 py-0.5 text-left text-sidebar-foreground/72 shadow-none hover:bg-transparent hover:text-sidebar-foreground`,t.id===e.selectedSessionId&&`text-sidebar-accent-foreground`),type:`button`,variant:`ghost`,onClick:()=>e.onLoadSession(t.id),children:(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:t.title??`Untitled chat`})}),(0,R.jsxs)(`div`,{className:`relative grid h-7 min-w-0 place-items-end`,children:[(0,R.jsx)(`time`,{className:`grid h-6 min-w-6 place-items-center self-center justify-self-end rounded-lg px-1.5 text-sm font-medium tabular-nums text-muted-foreground group-hover:opacity-0 group-focus-within:opacity-0`,children:l(t.updatedAt)}),(0,R.jsx)(nh,{"aria-label":`Delete ${t.title??`Untitled chat`}`,className:`absolute right-0 top-1/2 hidden h-6 min-h-6 w-6 -translate-y-1/2 border-0 bg-transparent p-0 text-muted-foreground opacity-70 shadow-none hover:bg-transparent hover:text-destructive hover:opacity-100 group-hover:grid group-focus-within:grid [&_svg]:h-3.5 [&_svg]:w-3.5`,size:`icon`,type:`button`,variant:`ghost`,disabled:e.runState===`running`,onClick:()=>e.onDeleteSession(t),children:(0,R.jsx)(ah,{icon:xm,"aria-hidden":`true`})})]})]},t.id))]}),(0,R.jsxs)(`div`,{className:`mt-auto px-3 py-3`,children:[(0,R.jsx)(`nav`,{className:`grid gap-1`,"aria-label":`Anvia links`,children:(0,R.jsx)(uh,{href:`https://anvia.dev/docs`,label:`Anvia Docs`})}),(0,R.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:e.status})]})]})}function lh(e){return(0,R.jsx)(`header`,{className:`grid min-h-13 bg-background/88 backdrop-blur`,children:(0,R.jsxs)(`div`,{className:`grid min-h-13 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 py-0 pl-0 pr-6`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium`,children:[(0,R.jsx)(`span`,{className:`text-foreground`,children:e.activePage===`playground`?`Agents`:`Studio`}),(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.selectedAgentLabel})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(nh,{"aria-label":e.theme===`dark`?`Switch to light theme`:`Switch to dark theme`,className:`h-8 min-h-8 w-8 border-0 bg-transparent p-0 text-muted-foreground shadow-none hover:bg-muted/45 hover:text-foreground`,title:e.theme===`dark`?`Switch to light theme`:`Switch to dark theme`,type:`button`,variant:`ghost`,size:`icon`,onClick:e.onToggleTheme,children:e.theme===`dark`?(0,R.jsx)(ah,{icon:Im,"aria-hidden":`true`}):(0,R.jsx)(ah,{icon:Mm,"aria-hidden":`true`})}),(0,R.jsx)(nh,{className:`h-8 min-h-8 rounded-lg border border-white bg-white px-3 text-xs text-black shadow-none [box-shadow:none] hover:border-white hover:bg-white/90 hover:text-black focus-visible:ring-0 active:bg-white/85 disabled:bg-muted disabled:text-muted-foreground`,type:`button`,variant:`ghost`,disabled:!e.sessionsEnabled,onClick:e.onNewSession,children:`New session`})]})]})})}function uh(e){return(0,R.jsxs)(`a`,{className:`flex h-8 min-h-8 items-center justify-between rounded-lg px-2 text-xs font-semibold text-sidebar-foreground/62 transition duration-200 hover:bg-sidebar-accent hover:text-sidebar-foreground`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[(0,R.jsx)(`span`,{children:e.label}),(0,R.jsx)(ah,{icon:km,"aria-hidden":`true`,className:`h-3 w-3 text-muted-foreground`})]})}function dh(){let e=rm();return(0,R.jsxs)(`div`,{className:`grid h-[100dvh] min-h-0 overflow-hidden bg-background text-foreground lg:grid-cols-[228px_minmax(0,1fr)]`,children:[(0,R.jsx)(ch,{activePage:e.activePage,allSessions:e.sessions.allSessions,evalsEnabled:e.evalsEnabled,hasAgents:e.hasAgents,knowledgeEnabled:e.knowledgeEnabled,mcpsEnabled:e.mcpsEnabled,memoryEnabled:e.memoryEnabled,pipelinesEnabled:e.pipelinesEnabled,runState:e.runState,selectedSessionId:e.sessions.selectedSessionId,sessionsEnabled:e.sessionsEnabled,status:e.status,statusEnabled:e.statusEnabled,toolsEnabled:e.toolsEnabled,tracesEnabled:e.tracesEnabled,onDeleteSession:e.setDeleteCandidate,onLoadSession:t=>void e.sessions.loadSession(t),onNavigate:e.navigatePage}),(0,R.jsxs)(`main`,{className:`grid h-[100dvh] min-w-0 grid-rows-[52px_minmax(0,1fr)] overflow-hidden bg-background/80`,children:[(0,R.jsx)(lh,{activePage:e.activePage,selectedAgentLabel:e.selectedAgent?.name??e.selectedAgent?.id??`Agent`,sessionsEnabled:e.sessionsEnabled,theme:e.theme,onNavigate:e.navigatePage,onNewSession:()=>e.startNewChat(),onToggleTheme:e.toggleTheme}),(0,R.jsx)(Fr,{})]}),(0,R.jsx)(_.Suspense,{fallback:null,children:(0,R.jsx)(hm,{session:e.deleteCandidate,onOpenChange:t=>{t||e.setDeleteCandidate(void 0)},onConfirm:t=>{e.sessions.deleteSession(t).finally(()=>{e.setDeleteCandidate(void 0)})}})})]})}function fh(e){let t=rm(),{activateRoute:n}=t;return(0,_.useEffect)(()=>{n(e)},[n,e]),t}function ph(e){switch(e){case`dynamic-context`:case`dynamic-tools`:case`retrieval-log`:case`static-context`:return e;default:return`static-context`}}function mh(){let e=fh(`agents`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(cm,{agents:e.agents,selectedAgentId:e.selectedAgentId})})}function hh(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)(`idle`);async function c(){let n=t||e.evals[0]?.id||``;if(!(n.length===0||a===`running`)){o(`running`),i(void 0),e.onError(``);try{let t=await fetch(`/evals/${encodeURIComponent(n)}/runs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({})});if(!t.ok)throw Error(await pp(t,`Eval run failed`));i(await t.json()),e.onStatus(`Connected`)}catch(t){e.onError(s(t))}finally{o(`idle`)}}}return(0,R.jsx)(lm,{evals:e.evals,selectedEvalId:t,enabled:e.enabled,runState:a,result:r,onSelectEval:e=>{n(e),i(void 0)},onRun:()=>void c()})}function gh(){let e=fh(`evals`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(hh,{evals:e.evals,enabled:e.evalsEnabled,onError:e.setError,onStatus:e.setStatus})})}function _h(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)(`idle`),c=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0){i(void 0);return}o(`loading`);try{let e=await fetch(`/agents/${encodeURIComponent(t)}/tools`);if(!e.ok)throw Error(`Tools failed with HTTP ${e.status}`);i(await e.json())}catch(t){e.onError(s(t)),i(void 0)}finally{o(`idle`)}},[e.enabled,e.onError]);return(0,_.useEffect)(()=>{e.active&&c(t||e.selectedAgentId)},[e.active,c,e.selectedAgentId,t]),(0,R.jsx)(_m,{agents:e.agents,selectedAgentId:t||e.selectedAgentId,summary:r,enabled:e.enabled,loading:a===`loading`,onSelectAgent:e=>{n(e),c(e)}})}function vh(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)(`idle`),c=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0){i(void 0);return}o(`loading`);try{let e=await fetch(`/agents/${encodeURIComponent(t)}/mcps`);if(!e.ok)throw Error(`MCPs failed with HTTP ${e.status}`);i(await e.json())}catch(t){e.onError(s(t)),i(void 0)}finally{o(`idle`)}},[e.enabled,e.onError]);return(0,_.useEffect)(()=>{e.active&&c(t||e.selectedAgentId)},[e.active,c,t,e.selectedAgentId]),(0,R.jsx)(dm,{agents:e.agents,selectedAgentId:t||e.selectedAgentId,summary:r,enabled:e.enabled,loading:a===`loading`,onSelectAgent:e=>{n(e),c(e)}})}function yh(e){let[t,n]=(0,_.useState)(),[r,i]=(0,_.useState)(`idle`),a=(0,_.useCallback)(async()=>{if(!e.enabled){n(void 0);return}i(`loading`);try{let e=await fetch(`/knowledge?limit=25`);if(!e.ok)throw Error(`Knowledge failed with HTTP ${e.status}`);n(await e.json())}catch(t){e.onError(s(t))}finally{i(`idle`)}},[e.enabled,e.onError]);return(0,_.useEffect)(()=>{e.active&&a()},[e.active,a]),(0,R.jsx)(um,{activeTab:e.activeTab,enabled:e.enabled,summary:t,loading:r===`loading`,onOpenTrace:e.onOpenTrace,onRefresh:()=>void a(),onSelectTab:e.onSelectTab})}function bh(){let e=fh(`knowledge`),{setKnowledgeTab:t}=e,n=ph(nr({strict:!1}).tab);return(0,_.useEffect)(()=>{t(n)},[t,n]),(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(yh,{active:!0,activeTab:n,enabled:e.knowledgeEnabled,onError:e.setError,onOpenTrace:e.traces.selectTrace,onSelectTab:e.navigateKnowledgeTab})})}function xh(){let e=fh(`mcps`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(vh,{active:!0,agents:e.agents,enabled:e.mcpsEnabled,selectedAgentId:e.selectedAgent?.id||e.selectedAgentId,onError:e.setError})})}function Sh(){let e=fh(`memory`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(fm,{agents:e.agents,enabled:e.memoryEnabled})})}function Ch(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)([]),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(`"Hello from Studio"`),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(`idle`),[y,b]=(0,_.useState)(`idle`),[x,S]=(0,_.useState)(`idle`),[C,w]=(0,_.useState)(`idle`),T=(0,_.useRef)(0),E=(0,_.useRef)(0),D=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0)return E.current+=1,o([]),[];let n=E.current+1;E.current=n,b(`loading`);try{let e=new URLSearchParams({limit:`1000`}),r=await fetch(`/pipelines/${encodeURIComponent(t)}/logs?${e}`);if(!r.ok)throw Error(`Pipeline logs failed with HTTP ${r.status}`);let i=await r.json();return E.current===n&&o(i.logs),i.logs}catch(t){return E.current===n&&(e.onError(s(t)),o([])),[]}finally{E.current===n&&b(`idle`)}},[e.enabled,e.onError]),O=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0)return l([]),[];S(`loading`);try{let e=new URLSearchParams({limit:`50`}),n=await fetch(`/pipelines/${encodeURIComponent(t)}/runs?${e}`);if(!n.ok)throw Error(`Pipeline runs failed with HTTP ${n.status}`);let r=await n.json();return l(r.runs),r.runs}catch(t){return e.onError(s(t)),l([]),[]}finally{S(`idle`)}},[e.enabled,e.onError]),k=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0){T.current+=1,i(void 0),o([]),l([]);return}let r=T.current+1;T.current=r,v(`loading`),e.onError(``);try{let e=await fetch(`/pipelines/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`Pipeline load failed with HTTP ${e.status}`);let a=await e.json();if(T.current!==r)return;n(t),i(a),await Promise.all([D(t),O(t)])}catch(t){T.current===r&&(e.onError(s(t)),i(void 0))}finally{T.current===r&&v(`idle`)}},[D,O,e.enabled,e.onError]);(0,_.useEffect)(()=>{if(!e.active)return;let n=t||e.pipelines[0]?.id||``;n.length>0&&k(n)},[e.active,e.pipelines,k,t]);async function A(e){await Op(e,async e=>{if(qr(e)){e.log.runId!==void 0&&h(t=>t||e.log.runId||``),ne(e.log),await kp();return}if(Jr(e)){p(wh(e.output)),await kp();return}if(Yr(e))throw Error(JSON.stringify(e.error))})}async function ee(){let n=t||e.pipelines[0]?.id||``;if(n.length===0||C===`running`)return;let r;try{r=JSON.parse(u)}catch{e.onError(`Pipeline input must be valid JSON`);return}w(`running`),p(``),h(``),e.onError(``);try{let t=await fetch(`/pipelines/${encodeURIComponent(n)}/runs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({input:r,stream:!0,metadata:{source:`anvia-studio`}})});if(!t.ok||t.body===null)throw Error(await pp(t,`Pipeline run failed`));await A(t.body),await Promise.all([D(n),O(n)]),e.onStatus(`Connected`)}catch(t){e.onError(s(t))}finally{w(`idle`)}}async function j(n){let r=t||e.pipelines[0]?.id||``;if(!(r.length===0||n.length===0||C===`running`)){w(`running`),p(``),h(``),e.onError(``);try{let t=await fetch(`/pipelines/${encodeURIComponent(r)}/runs/${encodeURIComponent(n)}/replay`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({stream:!0,metadata:{source:`anvia-studio`}})});if(!t.ok||t.body===null)throw Error(await pp(t,`Pipeline replay failed`));await A(t.body),await Promise.all([D(r),O(r)]),e.onStatus(`Connected`)}catch(t){e.onError(s(t))}finally{w(`idle`)}}}function te(e){n(e),p(``),h(``),k(e)}function ne(e){o(t=>t.some(t=>t.id===e.id)?t:[...t,e].sort((e,t)=>e.sequence-t.sequence))}return{selectedPipelineId:t,pipelineDetail:r,pipelineLogs:a,pipelineRuns:c,activePipelineRunId:m,pipelineRunInput:u,pipelineRunOutput:f,pipelineDetailLoadState:g,pipelineLogLoadState:y,pipelineRunLoadState:x,pipelineRunState:C,setPipelineRunInput:d,selectPipeline:te,runPipeline:ee,replayPipelineRun:j}}function wh(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function Th(e){let t=Ch({active:e.active,enabled:e.enabled,pipelines:e.pipelines,onError:e.onError,onStatus:e.onStatus});return(0,R.jsx)(pm,{pipelines:e.pipelines,selectedPipelineId:t.selectedPipelineId,detail:t.pipelineDetail,logs:t.pipelineLogs,activeRunId:t.activePipelineRunId,runs:t.pipelineRuns,enabled:e.enabled,detailLoading:t.pipelineDetailLoadState===`loading`,logsLoading:t.pipelineLogLoadState===`loading`,runsLoading:t.pipelineRunLoadState===`loading`,runState:t.pipelineRunState,runInput:t.pipelineRunInput,runOutput:t.pipelineRunOutput,theme:e.theme,activeTab:e.activeTab,onSelectPipeline:t.selectPipeline,onRunInputChange:t.setPipelineRunInput,onRun:()=>void t.runPipeline(),onTabChange:e.onTabChange,onReplayRun:e=>void t.replayPipelineRun(e)})}function Eh(){let e=fh(`pipelines`),[t,n]=(0,_.useState)(()=>Dh());(0,_.useEffect)(()=>{function e(){n(Dh())}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let r=(0,_.useCallback)(e=>{n(e);let t=new URL(window.location.href);t.searchParams.set(`tab`,e);let r=`${t.pathname}${t.search}${t.hash}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==r&&window.history.pushState(null,``,r)},[]);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(Th,{active:!0,activeTab:t,pipelines:e.pipelines,enabled:e.pipelinesEnabled,theme:e.theme,onError:e.setError,onStatus:e.setStatus,onTabChange:r})})}function Dh(){return Oh(window.location.search)}function Oh(e){let t=new URLSearchParams(e).get(`tab`);return t===`metadata`||t===`runs`||t===`logs`?t:`input`}function kh(e,[t,n]){return Math.min(n,Math.max(t,e))}typeof window<`u`&&window.document&&window.document.createElement;function Ah(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function jh(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,R.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Mh(i,...t)]}function Mh(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Nh(e){let t=e+`CollectionProvider`,[n,r]=jh(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Hm(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,R.jsx)(c,{ref:Vm(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Hm(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=Vm(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Ph=_.createContext(void 0);function Fh(e){let t=_.useContext(Ph);return e||t||`ltr`}var Ih=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Hm(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,R.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lh(e,t){e&&sr.flushSync(()=>e.dispatchEvent(t))}function Rh(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>((...e)=>t.current?.(...e)),[])}function zh(e,t=globalThis?.document){let n=Rh(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Bh=`DismissableLayer`,Vh=`dismissableLayer.update`,Hh=`dismissableLayer.pointerDownOutside`,Uh=`dismissableLayer.focusOutside`,Wh,Gh=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Kh=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=_.useContext(Gh),[d,f]=_.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=_.useState({}),h=Vm(t,e=>f(e)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(v),b=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=_.useRef(!1),w=Xh(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!S||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces}),T=Zh(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p);return zh(e=>{b===u.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),_.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Wh=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Qh(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Wh))}},[d,p,n,u]),_.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Qh())},[d,u]),_.useEffect(()=>{let e=()=>m({});return document.addEventListener(Vh,e),()=>document.removeEventListener(Vh,e)},[]),(0,R.jsx)(Ih.div,{...l,ref:h,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:Ah(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Ah(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ah(e.onPointerDownCapture,w.onPointerDownCapture)})});Kh.displayName=Bh;var qh=`DismissableLayerBranch`,Jh=_.forwardRef((e,t)=>{let n=_.useContext(Gh),r=_.useRef(null),i=Vm(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,R.jsx)(Ih.div,{...e,ref:i})});Jh.displayName=qh;function Yh(){let e=_.useContext(Gh),[t,n]=_.useState(null);return _.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Xh(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=Rh(e),s=_.useRef(!1),c=_.useRef(!1),l=_.useRef(new Map),u=_.useRef(()=>{});return _.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||$h(Hh,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function Zh(e,t=globalThis?.document){let n=Rh(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&$h(Uh,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Qh(){let e=new CustomEvent(Vh);document.dispatchEvent(e)}function $h(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lh(i,a):i.dispatchEvent(a)}var eg=0,tg=null;function ng(){_.useEffect(()=>{tg||={start:rg(),end:rg()};let{start:e,end:t}=tg;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),eg++,()=>{eg===1&&(tg?.start.remove(),tg?.end.remove(),tg=null),eg=Math.max(0,eg-1)}},[])}function rg(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var ig=`focusScope.autoFocusOnMount`,ag=`focusScope.autoFocusOnUnmount`,og={bubbles:!1,cancelable:!0},sg=`FocusScope`,cg=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Rh(i),u=Rh(a),d=_.useRef(null),f=Vm(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:hg(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||hg(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&hg(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){gg.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ig,og);s.addEventListener(ig,l),s.dispatchEvent(t),t.defaultPrevented||(lg(yg(dg(s)),{select:!0}),document.activeElement===e&&hg(s))}return()=>{s.removeEventListener(ig,l),setTimeout(()=>{let t=new CustomEvent(ag,og);s.addEventListener(ag,u),s.dispatchEvent(t),t.defaultPrevented||hg(e??document.body,{select:!0}),s.removeEventListener(ag,u),gg.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ug(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&hg(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&hg(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,R.jsx)(Ih.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});cg.displayName=sg;function lg(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(hg(r,{select:t}),document.activeElement!==n)return}function ug(e){let t=dg(e);return[fg(t,e),fg(t.reverse(),e)]}function dg(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fg(e,t){for(let n of e)if(!pg(n,{upTo:t}))return n}function pg(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function mg(e){return e instanceof HTMLInputElement&&`select`in e}function hg(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mg(e)&&t&&e.select()}}var gg=_g();function _g(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=vg(e,t),e.unshift(t)},remove(t){e=vg(e,t),e[0]?.resume()}}}function vg(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yg(e){return e.filter(e=>e.tagName!==`A`)}var bg=globalThis?.document?_.useLayoutEffect:()=>{},xg=_.useId||(()=>void 0),Sg=0;function Cg(e){let[t,n]=_.useState(xg());return bg(()=>{e||n(e=>e??String(Sg++))},[e]),e||(t?`radix-${t}`:``)}var wg=[`top`,`right`,`bottom`,`left`],Tg=Math.min,Eg=Math.max,Dg=Math.round,Og=Math.floor,kg=e=>({x:e,y:e}),Ag={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function jg(e,t,n){return Eg(e,Tg(t,n))}function Mg(e,t){return typeof e==`function`?e(t):e}function Ng(e){return e.split(`-`)[0]}function Pg(e){return e.split(`-`)[1]}function Fg(e){return e===`x`?`y`:`x`}function Ig(e){return e===`y`?`height`:`width`}function Lg(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Rg(e){return Fg(Lg(e))}function zg(e,t,n){n===void 0&&(n=!1);let r=Pg(e),i=Rg(e),a=Ig(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Jg(o)),[o,Jg(o)]}function Bg(e){let t=Jg(e);return[Vg(e),t,Vg(t)]}function Vg(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Hg=[`left`,`right`],Ug=[`right`,`left`],Wg=[`top`,`bottom`],Gg=[`bottom`,`top`];function Kg(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ug:Hg:t?Hg:Ug;case`left`:case`right`:return t?Wg:Gg;default:return[]}}function qg(e,t,n,r){let i=Pg(e),a=Kg(Ng(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Vg)))),a}function Jg(e){let t=Ng(e);return Ag[t]+e.slice(t.length)}function Yg(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xg(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Yg(e)}function Zg(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Qg(e,t,n){let{reference:r,floating:i}=e,a=Lg(t),o=Rg(t),s=Ig(o),c=Ng(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Pg(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function $g(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Mg(t,e),p=Xg(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Zg(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Zg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var e_=50,t_=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$g},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Qg(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<e_&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Qg(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},n_=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Mg(e,t)||{};if(l==null)return{};let d=Xg(u),f={x:n,y:r},p=Rg(i),m=Ig(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Tg(d[_],T),D=Tg(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,ee=jg(O,A,k),j=!c.arrow&&Pg(i)!=null&&A!==ee&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,te=j?A<O?A-O:A-k:0;return{[p]:f[p]+te,data:{[p]:ee,centerOffset:A-ee-te,...j&&{alignmentOffset:te}},reset:j}}}),r_=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Mg(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ng(r),_=Lg(o),v=Ng(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Jg(o)]:Bg(o)),x=p!==`none`;!d&&x&&b.push(...qg(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=zg(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Lg(t))||T.every(e=>Lg(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Lg(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function i_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function a_(e){return wg.some(t=>e[t]>=0)}var o_=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Mg(e,t);switch(i){case`referenceHidden`:{let e=i_(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:a_(e)}}}case`escaped`:{let e=i_(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:a_(e)}}}default:return{}}}}},s_=new Set([`left`,`top`]);async function c_(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ng(n),s=Pg(n),c=Lg(n)===`y`,l=s_.has(o)?-1:1,u=a&&c?-1:1,d=Mg(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var l_=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await c_(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},u_=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Mg(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Lg(Ng(i)),p=Fg(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=jg(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=jg(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},d_=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Mg(e,t),u={x:n,y:r},d=Lg(i),f=Fg(d),p=u[f],m=u[d],h=Mg(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=s_.has(Ng(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},f_=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Mg(e,t),u=await o.detectOverflow(t,l),d=Ng(i),f=Pg(i),p=Lg(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Tg(h-u[g],v),x=Tg(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Eg(u.left,0),t=Eg(u.right,0),n=Eg(u.top,0),r=Eg(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Eg(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Eg(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function p_(){return typeof window<`u`}function m_(e){return __(e)?(e.nodeName||``).toLowerCase():`#document`}function h_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function g_(e){return((__(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function __(e){return p_()?e instanceof Node||e instanceof h_(e).Node:!1}function v_(e){return p_()?e instanceof Element||e instanceof h_(e).Element:!1}function y_(e){return p_()?e instanceof HTMLElement||e instanceof h_(e).HTMLElement:!1}function b_(e){return!p_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof h_(e).ShadowRoot}function x_(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=M_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function S_(e){return/^(table|td|th)$/.test(m_(e))}function C_(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var w_=/transform|translate|scale|rotate|perspective|filter/,T_=/paint|layout|strict|content/,E_=e=>!!e&&e!==`none`,D_;function O_(e){let t=v_(e)?M_(e):e;return E_(t.transform)||E_(t.translate)||E_(t.scale)||E_(t.rotate)||E_(t.perspective)||!A_()&&(E_(t.backdropFilter)||E_(t.filter))||w_.test(t.willChange||``)||T_.test(t.contain||``)}function k_(e){let t=P_(e);for(;y_(t)&&!j_(t);){if(O_(t))return t;if(C_(t))return null;t=P_(t)}return null}function A_(){return D_??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),D_}function j_(e){return/^(html|body|#document)$/.test(m_(e))}function M_(e){return h_(e).getComputedStyle(e)}function N_(e){return v_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function P_(e){if(m_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||b_(e)&&e.host||g_(e);return b_(t)?t.host:t}function F_(e){let t=P_(e);return j_(t)?e.ownerDocument?e.ownerDocument.body:e.body:y_(t)&&x_(t)?t:F_(t)}function I_(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=F_(e),i=r===e.ownerDocument?.body,a=h_(r);if(i){let e=L_(a);return t.concat(a,a.visualViewport||[],x_(r)?r:[],e&&n?I_(e):[])}else return t.concat(r,I_(r,[],n))}function L_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function R_(e){let t=M_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=y_(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Dg(n)!==a||Dg(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function z_(e){return v_(e)?e:e.contextElement}function B_(e){let t=z_(e);if(!y_(t))return kg(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=R_(t),o=(a?Dg(n.width):n.width)/r,s=(a?Dg(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var V_=kg(0);function H_(e){let t=h_(e);return!A_()||!t.visualViewport?V_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function U_(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==h_(e)?!1:t}function W_(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=z_(e),o=kg(1);t&&(r?v_(r)&&(o=B_(r)):o=B_(e));let s=U_(a,n,r)?H_(a):kg(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=h_(a),t=r&&v_(r)?h_(r):r,n=e,i=L_(n);for(;i&&r&&t!==n;){let e=B_(i),t=i.getBoundingClientRect(),r=M_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=h_(i),i=L_(n)}}return Zg({width:u,height:d,x:c,y:l})}function G_(e,t){let n=N_(e).scrollLeft;return t?t.left+n:W_(g_(e)).left+n}function K_(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-G_(e,n),y:n.top+t.scrollTop}}function q_(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=g_(r),s=t?C_(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=kg(1),u=kg(0),d=y_(r);if((d||!d&&!a)&&((m_(r)!==`body`||x_(o))&&(c=N_(r)),d)){let e=W_(r);l=B_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?K_(o,c):kg(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function J_(e){return Array.from(e.getClientRects())}function Y_(e){let t=g_(e),n=N_(e),r=e.ownerDocument.body,i=Eg(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Eg(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+G_(e),s=-n.scrollTop;return M_(r).direction===`rtl`&&(o+=Eg(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var X_=25;function Z_(e,t){let n=h_(e),r=g_(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=A_();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=G_(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=X_&&(a-=o)}else l<=X_&&(a+=l);return{width:a,height:o,x:s,y:c}}function Q_(e,t){let n=W_(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=y_(e)?B_(e):kg(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function $_(e,t,n){let r;if(t===`viewport`)r=Z_(e,n);else if(t===`document`)r=Y_(g_(e));else if(v_(t))r=Q_(t,n);else{let n=H_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Zg(r)}function ev(e,t){let n=P_(e);return n===t||!v_(n)||j_(n)?!1:M_(n).position===`fixed`||ev(n,t)}function tv(e,t){let n=t.get(e);if(n)return n;let r=I_(e,[],!1).filter(e=>v_(e)&&m_(e)!==`body`),i=null,a=M_(e).position===`fixed`,o=a?P_(e):e;for(;v_(o)&&!j_(o);){let t=M_(o),n=O_(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||x_(o)&&!n&&ev(e,o))?r=r.filter(e=>e!==o):i=t,o=P_(o)}return t.set(e,r),r}function nv(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?C_(t)?[]:tv(t,this._c):[].concat(n),r],o=$_(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=$_(t,a[e],i);s=Eg(n.top,s),c=Tg(n.right,c),l=Tg(n.bottom,l),u=Eg(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function rv(e){let{width:t,height:n}=R_(e);return{width:t,height:n}}function iv(e,t,n){let r=y_(t),i=g_(t),a=n===`fixed`,o=W_(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=kg(0);function l(){c.x=G_(i)}if(r||!r&&!a)if((m_(t)!==`body`||x_(i))&&(s=N_(t)),r){let e=W_(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?K_(i,s):kg(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function av(e){return M_(e).position===`static`}function ov(e,t){if(!y_(e)||M_(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return g_(e)===n&&(n=n.ownerDocument.body),n}function sv(e,t){let n=h_(e);if(C_(e))return n;if(!y_(e)){let t=P_(e);for(;t&&!j_(t);){if(v_(t)&&!av(t))return t;t=P_(t)}return n}let r=ov(e,t);for(;r&&S_(r)&&av(r);)r=ov(r,t);return r&&j_(r)&&av(r)&&!O_(r)?n:r||k_(e)||n}var cv=async function(e){let t=this.getOffsetParent||sv,n=this.getDimensions,r=await n(e.floating);return{reference:iv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lv(e){return M_(e).direction===`rtl`}var uv={convertOffsetParentRelativeRectToViewportRelativeRect:q_,getDocumentElement:g_,getClippingRect:nv,getOffsetParent:sv,getElementRects:cv,getClientRects:J_,getDimensions:rv,getScale:B_,isElement:v_,isRTL:lv};function dv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fv(e,t){let n=null,r,i=g_(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Og(d),h=Og(i.clientWidth-(u+f)),g=Og(i.clientHeight-(d+p)),_=Og(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Eg(0,Tg(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!dv(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function pv(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=z_(e),u=i||a?[...l?I_(l):[],...t?I_(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?fv(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?W_(e):null;c&&g();function g(){let t=W_(e);h&&!dv(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var mv=l_,hv=u_,gv=r_,_v=f_,vv=o_,yv=n_,bv=d_,xv=(e,t,n)=>{let r=new Map,i={platform:uv,...n},a={...i.platform,_c:r};return t_(e,t,{...i,platform:a})},Sv=typeof document<`u`?_.useLayoutEffect:function(){};function Cv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Cv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Cv(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function wv(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tv(e,t){let n=wv(e);return Math.round(t*n)/n}function Ev(e){let t=_.useRef(e);return Sv(()=>{t.current=e}),t}function Dv(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Cv(f,r)||p(r);let[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=_.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||g,C=_.useRef(null),w=_.useRef(null),T=_.useRef(u),E=c!=null,D=Ev(c),O=Ev(i),k=Ev(l),A=_.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),xv(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};ee.current&&!Cv(T.current,t)&&(T.current=t,sr.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Sv(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=_.useRef(!1);Sv(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Sv(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let j=_.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),te=_.useMemo(()=>({reference:x,floating:S}),[x,S]),ne=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Tv(te.floating,u.x),r=Tv(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...wv(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:A,refs:j,elements:te,floatingStyles:ne}),[u,A,j,te,ne])}var Ov=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:yv({element:r.current,padding:i}).fn(n):r?yv({element:r,padding:i}).fn(n):{}}}},kv=(e,t)=>{let n=mv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Av=(e,t)=>{let n=hv(e);return{name:n.name,fn:n.fn,options:[e,t]}},jv=(e,t)=>({fn:bv(e).fn,options:[e,t]}),Mv=(e,t)=>{let n=gv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nv=(e,t)=>{let n=_v(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pv=(e,t)=>{let n=vv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fv=(e,t)=>{let n=Ov(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iv=`Arrow`,Lv=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,R.jsx)(Ih.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,R.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Lv.displayName=Iv;var Rv=Lv;function zv(e){let[t,n]=_.useState(void 0);return bg(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Bv=`Popper`,[Vv,Hv]=jh(Bv),[Uv,Wv]=Vv(Bv),Gv=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null),[a,o]=_.useState(void 0);return(0,R.jsx)(Uv,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Gv.displayName=Bv;var Kv=`PopperAnchor`,qv=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Wv(Kv,n),o=_.useRef(null),s=a.onAnchorChange,c=Vm(t,_.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=_.useRef(null);_.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&ry(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(Ih.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});qv.displayName=Kv;var Jv=`PopperContent`,[Yv,Xv]=Vv(Jv),Zv=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Wv(Jv,n),[v,y]=_.useState(null),b=Vm(t,e=>y(e)),[x,S]=_.useState(null),C=zv(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(ty),altBoundary:k},{refs:ee,floatingStyles:j,placement:te,isPositioned:ne,middlewareData:M}=Dv({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>pv(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[kv({mainAxis:i+T,alignmentAxis:o}),c&&Av({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?jv():void 0,...A}),c&&Mv({...A}),Nv({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Fv({element:x,padding:s}),ny({arrowWidth:w,arrowHeight:T}),f&&Pv({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),N=g.setPlacementState;bg(()=>(N(te),()=>{N(void 0)}),[te,N]);let[P,re]=ry(te),ie=Rh(m);bg(()=>{ne&&ie?.()},[ne,ie]);let ae=M.arrow?.x,oe=M.arrow?.y,F=M.arrow?.centerOffset!==0,[I,se]=_.useState();return bg(()=>{v&&se(window.getComputedStyle(v).zIndex)},[v]),(0,R.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:ne?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(Yv,{scope:n,placedSide:P,placedAlign:re,onArrowChange:S,arrowX:ae,arrowY:oe,shouldHideArrow:F,children:(0,R.jsx)(Ih.div,{"data-side":P,"data-align":re,...h,ref:b,style:{...h.style,animation:ne?void 0:`none`}})})})});Zv.displayName=Jv;var Qv=`PopperArrow`,$v={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ey=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Xv(Qv,n),a=$v[i.placedSide];return(0,R.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,R.jsx)(Rv,{...r,ref:t,style:{...r.style,display:`block`}})})});ey.displayName=Qv;function ty(e){return e!==null}var ny=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ry(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function ry(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var iy=Gv,ay=qv,oy=Zv,sy=ey,cy=`Portal`,ly=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);bg(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?sr.createPortal((0,R.jsx)(Ih.div,{...r,ref:t}),o):null});ly.displayName=cy;function uy(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var dy=e=>{let{present:t,children:n}=e,r=fy(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=my(r.ref,gy(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};dy.displayName=`Presence`;function fy(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=uy(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=hy(r.current);a.current=o===`mounted`?e:`none`},[o]),bg(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=hy(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),bg(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=hy(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=hy(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function py(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function my(...e){let t=_.useRef(e);return t.current=e,_.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=py(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():py(n[e],null)}}},[])}function hy(e){return e?.animationName||`none`}function gy(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _y=_.useInsertionEffect||bg;function vy({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=yy({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=by(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function yy({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return _y(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function by(e){return typeof e==`function`}function xy(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Sy=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Cy=`VisuallyHidden`,wy=_.forwardRef((e,t)=>(0,R.jsx)(Ih.span,{...e,ref:t,style:{...Sy,...e.style}}));wy.displayName=Cy;var Ty=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ey=new WeakMap,Dy=new WeakMap,Oy={},ky=0,Ay=function(e){return e&&(e.host||Ay(e.parentNode))},jy=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ay(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},My=function(e,t,n,r){var i=jy(t,Array.isArray(e)?e:[e]);Oy[n]||(Oy[n]=new WeakMap);var a=Oy[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Ey.get(e)||0)+1,l=(a.get(e)||0)+1;Ey.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Dy.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ky++,function(){o.forEach(function(e){var t=Ey.get(e)-1,i=a.get(e)-1;Ey.set(e,t),a.set(e,i),t||(Dy.has(e)||e.removeAttribute(r),Dy.delete(e)),i||e.removeAttribute(n)}),ky--,ky||(Ey=new WeakMap,Ey=new WeakMap,Dy=new WeakMap,Oy={})}},Ny=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ty(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),My(r,i,n,`aria-hidden`)):function(){return null}},Py=function(){return Py=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Py.apply(this,arguments)};function Fy(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Iy(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ly=`right-scroll-bar-position`,Ry=`width-before-scroll-bar`,zy=`with-scroll-bars-hidden`,By=`--removed-body-scroll-bar-size`;function Vy(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Hy(e,t){var n=(0,_.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Uy=typeof window<`u`?_.useLayoutEffect:_.useEffect,Wy=new WeakMap;function Gy(e,t){var n=Hy(t||null,function(t){return e.forEach(function(e){return Vy(e,t)})});return Uy(function(){var t=Wy.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Vy(e,null)}),i.forEach(function(e){r.has(e)||Vy(e,a)})}Wy.set(n,e)},[e]),n}function Ky(e){return e}function qy(e,t){t===void 0&&(t=Ky);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Jy(e){e===void 0&&(e={});var t=qy(null);return t.options=Py({async:!0,ssr:!1},e),t}var Yy=function(e){var t=e.sideCar,n=Fy(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return _.createElement(r,Py({},n))};Yy.isSideCarExport=!0;function Xy(e,t){return e.useMedium(t),Yy}var Zy=Jy(),Qy=function(){},$y=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:Qy,onWheelCapture:Qy,onTouchMoveCapture:Qy}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Fy(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Gy([n,t]),w=Py(Py({},x),i);return _.createElement(_.Fragment,null,u&&_.createElement(S,{sideCar:Zy,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?_.cloneElement(_.Children.only(s),Py(Py({},w),{ref:C})):_.createElement(y,Py({},w,{className:c,ref:C}),s))});$y.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$y.classNames={fullWidth:Ry,zeroRight:Ly};var eb,tb=function(){if(eb)return eb;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nb(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=tb();return t&&e.setAttribute(`nonce`,t),e}function rb(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ib(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ab=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nb())&&(rb(t,n),ib(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ob=function(){var e=ab();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sb=function(){var e=ob();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},cb={left:0,top:0,right:0,gap:0},lb=function(e){return parseInt(e||``,10)||0},ub=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[lb(n),lb(r),lb(i)]},db=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return cb;var t=ub(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},fb=sb(),pb=`data-scroll-locked`,mb=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
114
|
-
.${
|
|
109
|
+
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function Od({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=qu(t(r),e);n.push(i.trimStart())}}function kd(e,t){let n=X(t)?t.value:t;for(let r of e)if(hu(r)&&(r.key===t||r.key===n||X(r.key)&&r.key.value===n))return r}var Ad=class extends Gu{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(su,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Cd(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=hu(e)?e:!e||typeof e!=`object`||!(`key`in e)?new wd(e,e?.value):new wd(e.key,e.value);let r=kd(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);X(r.value)&&zu(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=kd(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=kd(this.items,e)?.value;return(!t&&X(n)?n.value:n)??void 0}has(e){return!!kd(this.items,e)}set(e,t){this.add(new wd(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)xd(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!hu(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Td(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},jd={collection:`map`,default:!0,nodeClass:Ad,tag:`tag:yaml.org,2002:map`,resolve(e,t){return mu(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Ad.from(e,t,n)},Md=class extends Gu{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(uu,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=$(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=$(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&X(r)?r.value:r}has(e){let t=$(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=$(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];X(r)&&zu(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Fu(e,String(r++),t));return n}toString(e,t,n){return e?Td(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Uu(a,void 0,n))}}return i}};function $(e){let t=X(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Nd={collection:`seq`,default:!0,nodeClass:Md,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return gu(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Md.from(e,t,n)};function Pd(e){return typeof e==`bigint`||Number.isInteger(e)}var Fd=({value:e})=>JSON.stringify(e),Id=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Fd},{identify:e=>e==null,createNode:()=>new Bu(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Fd},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Fd},{identify:Pd,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Pd(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Fd}];[jd,Nd].concat(Id,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Ld(e,t,n){let{replacer:r}=n,i=new Md(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Cd(o,s,n))}return i}var Rd=class e extends Md{constructor(){super(),this.add=Ad.prototype.add.bind(this),this.delete=Ad.prototype.delete.bind(this),this.get=Ad.prototype.get.bind(this),this.has=Ad.prototype.has.bind(this),this.set=Ad.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(hu(e)?(r=Fu(e.key,``,t),i=Fu(e.value,r,t)):r=Fu(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Ld(e,t,n),i=new this;return i.items=r.items,i}};Rd.tag=`tag:yaml.org,2002:omap`;var zd=class e extends Ad{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=hu(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new wd(e.key,null):new wd(e,null),kd(this.items,t.key)||this.items.push(t)}get(e,t){let n=kd(this.items,e);return!t&&hu(n)?X(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=kd(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new wd(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Cd(e,null,n));return i}};zd.tag=`tag:yaml.org,2002:set`;var Bd=Symbol(`break visit`),Vd=Symbol(`skip children`),Hd=Symbol(`remove item`);function Ud(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Wd(Object.freeze([]),e,t)}Ud.BREAK=Bd,Ud.SKIP=Vd,Ud.REMOVE=Hd,Ud.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Ud.parentCollection=(e,t)=>{let n=Ud.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Wd(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Wd(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Bd)return Bd;else r===Hd&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var Gd={text(e){return{type:`text`,text:e}},imageUrl(e,t={}){let n={type:`image`,source:{type:`url`,url:e}};return t.detail!==void 0&&(n.detail=t.detail),n},imageBase64(e,t,n={}){let r={type:`image`,source:{type:`base64`,data:e,mediaType:t}};return n.detail!==void 0&&(r.detail=n.detail),r},documentUrl(e,t,n={}){return{type:`document`,source:n.filename===void 0?{type:`url`,url:e,mediaType:t}:{type:`url`,url:e,mediaType:t,filename:n.filename}}},documentBase64(e,t,n={}){return{type:`document`,source:n.filename===void 0?{type:`base64`,data:e,mediaType:t}:{type:`base64`,data:e,mediaType:t,filename:n.filename}}},documentText(e){return{type:`text`,text:e}}},Kd={toolResult(e,t,n){let r=typeof t==`string`?[{type:`text`,text:t}]:t;return n===void 0?{type:`tool_result`,id:e,content:r}:{type:`tool_result`,id:e,callId:n,content:r}}};function qd(e){if(typeof e==`string`)return e;try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}function Jd(e){return Array.isArray(e)&&e.length>0&&e.every(e=>typeof e!=`object`||!e||!(`type`in e)?!1:e.type===`text`?`text`in e&&typeof e.text==`string`:e.type===`image`?`data`in e&&typeof e.data==`string`&&(!(`mediaType`in e)||e.mediaType===void 0||typeof e.mediaType==`string`):!1)}var Yd={text(e){return{type:`text`,text:e}},imageUrl(e,t={}){let n={type:`image`,source:{type:`url`,url:e}};return t.detail!==void 0&&(n.detail=t.detail),n},imageBase64(e,t,n={}){let r={type:`image`,source:{type:`base64`,data:e,mediaType:t}};return n.detail!==void 0&&(r.detail=n.detail),r},reasoning(e,t){return t===void 0?{type:`reasoning`,text:e}:{type:`reasoning`,text:e,id:t}},reasoningFromContent(e,t){let n={type:`reasoning`,text:Xd(e),content:e};return t===void 0?n:{...n,id:t}},reasoningSummary(e,t){return Yd.reasoningFromContent([{type:`summary`,text:e}],t)},reasoningEncrypted(e,t){return Yd.reasoningFromContent([{type:`encrypted`,data:e}],t)},reasoningRedacted(e,t){return Yd.reasoningFromContent([{type:`redacted`,data:e}],t)},toolCall(e,t,n,r){let i={type:`tool_call`,id:e,function:{name:t,arguments:n}};return r===void 0?i:{...i,callId:r}}};function Xd(e){let t=Array.isArray(e)?e:e.content;return t===void 0?Array.isArray(e)?``:e.text:t.flatMap(e=>e.type===`text`||e.type===`summary`?[e.text]:[]).join(``)}var Zd={system(e){return{role:`system`,content:e}},user(e){return{role:`user`,content:typeof e==`string`?[Gd.text(e)]:e}},assistant(e,t){let n=typeof e==`string`?[Yd.text(e)]:e;return t===void 0?{role:`assistant`,content:n}:{role:`assistant`,id:t,content:n}},tool(e){return{role:`tool`,content:Array.isArray(e)?e:[e]}},toolResult(e,t,n={}){let r=Jd(t)?t:qd(t);return Zd.tool(Kd.toolResult(e,r,n.callId))}};function Qd(e){let t=[];for(let n of e){let e=$d(n.parts);if(n.role===`system`){e.length>0&&t.push(Zd.system(e));continue}if(n.role===`user`){let e=[];for(let t of n.parts){if(t.type===`text`){e.push(Gd.text(t.text));continue}if(t.type===`data`&&tf(t.data)){e.push(t.data);continue}throw TypeError(`User UI messages can only be converted from text parts or image/document data parts.`)}e.length>0&&t.push(Zd.user(e));continue}if(n.role===`assistant`){let e=[],r=[];for(let t of n.parts){if(t.type===`text`&&t.text.length>0){e.push(Yd.text(t.text));continue}if(t.type===`reasoning`&&t.text.length>0){e.push(Yd.reasoning(t.text,t.reasoningId));continue}t.type===`tool`&&(t.state===`input-streaming`||t.state===`input-available`||t.state===`output-available`)&&(e.push(Yd.toolCall(t.toolCallId,t.toolName,t.input??{},t.callId)),t.state===`output-available`&&r.push(Kd.toolResult(t.toolCallId,ef(t.output),t.callId)))}e.length>0&&t.push(Zd.assistant(e,n.id)),r.length>0&&t.push(Zd.tool(r));continue}let r=[];for(let e of n.parts)e.type!==`tool`||e.state!==`output-available`||r.push(Kd.toolResult(e.toolCallId,ef(e.output),e.callId));r.length>0&&t.push(Zd.tool(r))}return t}function $d(e){return e.flatMap(e=>e.type===`text`?[e.text]:[]).join(``)}function ef(e){return[{type:`text`,text:qd(e??null)}]}function tf(e){return af(e)?e.type===`text`?typeof e.text==`string`:e.type===`image`?nf(e):e.type===`document`?rf(e):!1:!1}function nf(e){return af(e.source)?e.source.type===`url`?typeof e.source.url==`string`:e.source.type===`base64`?typeof e.source.data==`string`&&typeof e.source.mediaType==`string`:!1:!1}function rf(e){return af(e.source)?e.source.type===`url`?typeof e.source.url==`string`&&typeof e.source.mediaType==`string`:e.source.type===`base64`?typeof e.source.data==`string`&&typeof e.source.mediaType==`string`:e.source.type===`text`?typeof e.source.text==`string`&&(e.source.mediaType===void 0||typeof e.source.mediaType==`string`):!1:!1}function af(e){return typeof e==`object`&&!!e}Nl({thought:al().describe(`A thought to record while reasoning through a task.`)});function of(e={}){return{action:`allow`,...e}}function sf(e){return{action:`block`,...e}}var cf={allow:of,block:sf};({...cf}),{...cf},{...cf},{...cf};async function*lf(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let e=await t.read();if(e.done===!0)break;r+=n.decode(e.value,{stream:!0});let i=r.split(/\r?\n/);r=i.pop()??``;for(let e of i){let t=e.trim();t.length>0&&(yield JSON.parse(t))}}r+=n.decode();let e=r.trim();e.length>0&&(yield JSON.parse(e))}finally{t.releaseLock()}}async function*uf(e){let t=e.getReader(),n=new TextDecoder,r=``,i=df();try{for(;;){let e=await t.read();if(e.done===!0)break;r+=n.decode(e.value,{stream:!0});let a=r.split(/\r?\n/);r=a.pop()??``;for(let e of a){let t=ff(e,i);i=t.event,t.complete===!0&&t.data!==void 0&&(yield JSON.parse(t.data))}}if(r+=n.decode(),r.length>0){let e=ff(r,i);i=e.event,e.complete===!0&&e.data!==void 0&&(yield JSON.parse(e.data))}let e=pf(i);e!==void 0&&(yield JSON.parse(e))}finally{t.releaseLock()}}function df(){return{data:[]}}function ff(e,t){if(e===``){let e=pf(t);return e===void 0?{event:df(),complete:!0}:{event:df(),complete:!0,data:e}}if(e.startsWith(`:`))return{event:t};let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1).replace(/^ /,``);return r===`data`&&t.data.push(i),{event:t}}function pf(e){if(e.data.length!==0)return e.data.join(`
|
|
110
|
+
`)}var mf=class extends Error{constructor(e,t){super(`Event stream request failed with status ${e.status}`),this.response=e,this.body=t,this.name=`EventStreamHttpError`}response;body};async function*hf(e,t={}){let n=t.fetch??globalThis.fetch;if(n===void 0)throw Error(`fetchEventStream requires a fetch implementation`);let r=await n(e,gf(t));if(!r.ok)throw new mf(r,await r.text());if(r.body===null)throw Error(`Event stream response does not include a body`);if((t.format??_f(r.headers.get(`content-type`)))===`sse`){yield*uf(r.body);return}yield*lf(r.body)}function gf(e){let{format:t,fetch:n,...r}=e;return r}function _f(e){return e?.toLowerCase().includes(`text/event-stream`)?`sse`:`jsonl`}function vf(e){if(kf(e)&&!(e.type!==`tool_approval_request`&&e.type!==`tool_approval_result`))return Df(e.approval)?e.approval:void 0}function yf(e){if(kf(e)&&!(e.type!==`tool_question_request`&&e.type!==`tool_question_result`))return Of(e.question)?e.question:void 0}async function bf(e,t){let n=Cf(t.endpoint,`decideApproval`),r=t.fetch??globalThis.fetch;if(r===void 0)throw Error(`humanInput approval decisions require a fetch implementation`);let i=await r(wf(n,`approvals/${e.approvalId}/decision`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({approved:e.approved,...e.reason===void 0?{}:{reason:e.reason}})});if(!i.ok)throw Error(`Tool approval decision failed with status ${i.status}`);return Ef(i)}async function xf(e,t){let n=Cf(t.endpoint,`answerQuestion`),r=t.fetch??globalThis.fetch;if(r===void 0)throw Error(`humanInput question answers require a fetch implementation`);let i=await r(wf(n,`questions/${e.questionId}/answer`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({answers:e.answers})});if(!i.ok)throw Error(`Tool question answer failed with status ${i.status}`);return Ef(i)}function Sf(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=[...e];return r[n]=t,r}function Cf(e,t){if(e===void 0)throw Error(`humanInput.${t} requires endpoint or a custom handler`);return e}function wf(e,t){let n=t.replace(/^\/+/,``);if(e instanceof URL){let t=new URL(e.toString());return t.pathname=Tf(t.pathname,n),t}if(/^[a-z][a-z\d+\-.]*:\/\//i.test(e)){let t=new URL(e);return t.pathname=Tf(t.pathname,n),t.toString()}return Tf(e,n)}function Tf(e,t){let n=e.replace(/\/+$/,``),r=t.replace(/^\/+/,``);return n.length===0?`/${r}`:`${n}/${r}`}async function Ef(e){let t=await e.text();if(t.trim().length!==0)return JSON.parse(t)}function Df(e){return kf(e)&&typeof e.id==`string`&&typeof e.toolName==`string`&&typeof e.status==`string`}function Of(e){return kf(e)&&typeof e.id==`string`&&typeof e.toolName==`string`&&typeof e.status==`string`&&Array.isArray(e.questions)}function kf(e){return typeof e==`object`&&!!e}function Af(e){return{async*send(t,n={}){let r=typeof e.endpoint==`function`?e.endpoint(t):e.endpoint,i=Ff(await Mf(e.headers,t),n.headers),a=e.method??`POST`,o=await Nf(e.body,t,i,a),s={...e.init??{},method:a,headers:i,format:e.format??`jsonl`};o!==void 0&&(s.body=o),n.signal!==void 0&&(s.signal=n.signal),e.fetch!==void 0&&(s.fetch=e.fetch);for await(let t of hf(r,s))yield e.mapEvent===void 0?t:e.mapEvent(t)}}}function jf(e){return Af(e)}async function Mf(e,t){return typeof e==`function`?e(t):e}async function Nf(e,t,n,r){if(e!==void 0)return e(t);if(Pf(r))return n.has(`content-type`)||n.set(`content-type`,`application/json`),JSON.stringify(t)}function Pf(e){let t=e.toUpperCase();return t!==`GET`&&t!==`HEAD`}function Ff(...e){let t=new Headers;for(let n of e)n!==void 0&&new Headers(n).forEach((e,n)=>{t.set(n,e)});return t}function If(e){if($f(e))return e;let t=typeof e==`string`?e:e.text;if(t.trim().length!==0)return{id:typeof e==`string`||e.id===void 0?Qf(`msg`):e.id,role:`user`,parts:[{id:Qf(`part`),type:`text`,text:t}],...typeof e==`string`||e.metadata===void 0?{}:{metadata:e.metadata}}}function Lf(e,t){if(t.type===`message_start`){let n=e.findIndex(e=>e.id===t.message.id);if(n===-1)return[...e,t.message];let r=[...e];return r[n]=t.message,r}if(t.type===`text_delta`)return Wf(e,t.messageId,{id:t.partId,type:`text`,text:t.delta});if(t.type===`reasoning_delta`)return Wf(e,t.messageId,{id:t.partId,type:`reasoning`,text:t.delta});if(t.type===`tool_update`)return Wf(e,t.messageId,t.part);if(t.type===`error`){let n=Qf(`msg`);return[...e,{id:n,role:`assistant`,parts:[{id:Qf(`part`),type:`error`,error:t.error}]}]}if(t.type===`message_end`){let{metadata:n}=t;return n===void 0?e:e.map(e=>e.id===t.messageId?{...e,metadata:n}:e)}return e}function Rf(e,t){let n=ep(t);if(n!==void 0)return Lf(e,n);if(!(!fp(t)||typeof t.type!=`string`)){if(t.type===`text_delta`&&typeof t.delta==`string`)return Vf(e,t.delta);if(t.type===`reasoning_delta`&&typeof t.delta==`string`)return Hf(e,t.delta,typeof t.id==`string`?t.id:void 0);if(t.type===`tool_call_delta`&&typeof t.id==`string`)return Gf(e,{id:dp(t.id),type:`tool`,toolName:typeof t.name==`string`?t.name:``,toolCallId:t.id,...typeof t.callId==`string`?{callId:t.callId}:{},state:`input-streaming`,...typeof t.argumentsDelta==`string`?{input:t.argumentsDelta}:{}});if(t.type===`tool_call`&&ip(t.toolCall))return Gf(e,{id:dp(t.toolCall.id),type:`tool`,toolName:t.toolCall.function.name,toolCallId:t.toolCall.id,...typeof t.toolCall.callId==`string`?{callId:t.toolCall.callId}:{},state:`input-available`,input:t.toolCall.function.arguments});if(t.type===`tool_result`){let n=typeof t.internalCallId==`string`?t.internalCallId:typeof t.toolCallId==`string`?t.toolCallId:void 0;return n===void 0||typeof t.toolName!=`string`?void 0:Gf(e,{id:dp(n),type:`tool`,toolName:t.toolName,toolCallId:n,...typeof t.toolCallId==`string`?{callId:t.toolCallId}:{},state:`output-available`,output:`structuredResult`in t&&t.structuredResult!==void 0?cp(t.structuredResult):cp(t.result)})}if(t.type===`message_id`&&typeof t.id==`string`)return Jf(e,{providerMessageId:t.id});if(t.type===`final`){if(fp(t.response)&&Array.isArray(t.response.choice)){let n=ap(t.response.choice),r=n.length>0?Uf(e,n):e,i=t.response.messageId;return typeof i==`string`?Jf(r,{providerMessageId:i}):r}if(typeof t.output==`string`){let n=t.output.length>0?Uf(e,t.output):e;return typeof t.runId==`string`?Jf(n,{runId:t.runId}):n}}if(t.type===`error`&&`error`in t)return qf(e,op(t.error))}}function zf(e){let t=[...e].reverse().find(e=>e.role===`assistant`);return t===void 0?``:Bf(t)}function Bf(e){return e.parts.flatMap(e=>e.type===`text`?[e.text]:[]).join(``)}function Vf(e,t){let n=Xf(e),r=n[n.length-1];return r===void 0?n:Wf(n,r.id,{id:`${r.id}_text`,type:`text`,text:t})}function Hf(e,t,n){let r=Xf(e),i=r[r.length-1];if(i===void 0)return r;let a=n===void 0?`${i.id}_reasoning`:`${i.id}_reasoning_${n}`;return Wf(r,i.id,{id:a,type:`reasoning`,text:t,...n===void 0?{}:{reasoningId:n}})}function Uf(e,t){let n=Xf(e),r=n[n.length-1];return r===void 0?n:n.map(e=>e.id===r.id?{...e,parts:Yf(e,t)}:e)}function Wf(e,t,n){return(e.find(e=>e.id===t)===void 0?[...e,{id:t,role:`assistant`,parts:[]}]:e).map(e=>{if(e.id!==t)return e;let r=e.parts.findIndex(e=>e.id===n.id);if(r===-1)return{...e,parts:[...e.parts,n]};let i=[...e.parts],a=i[r];return a?.type===`text`&&n.type===`text`||a?.type===`reasoning`&&n.type===`reasoning`?i[r]={...a,text:`${a.text}${n.text}`}:a?.type===`tool`&&n.type===`tool`?i[r]=Kf(a,n):i[r]=n,{...e,parts:i}})}function Gf(e,t){let n=Xf(e),r=n[n.length-1];return r===void 0?n:Wf(n,r.id,t)}function Kf(e,t){let n={...e,...t};return t.toolName.length===0&&(n.toolName=e.toolName),t.callId===void 0&&e.callId!==void 0&&(n.callId=e.callId),t.input===void 0&&e.input!==void 0?n.input=e.input:typeof e.input==`string`&&typeof t.input==`string`&&(n.input=`${e.input}${t.input}`),t.output===void 0&&e.output!==void 0&&(n.output=e.output),t.error===void 0&&e.error!==void 0&&(n.error=e.error),n}function qf(e,t){let n=Qf(`msg`);return[...e,{id:n,role:`assistant`,parts:[{id:Qf(`part`),type:`error`,error:t}]}]}function Jf(e,t){let n=Xf(e),r=n[n.length-1];return r===void 0?n:n.map(e=>e.id===r.id?{...e,metadata:lp(e.metadata,t)}:e)}function Yf(e,t){let n=e.parts.findIndex(e=>e.type===`text`);if(n===-1)return[...e.parts,{id:`${e.id}_text`,type:`text`,text:t}];let r=[...e.parts],i=r[n];return i?.type===`text`&&(r[n]={...i,text:t}),r}function Xf(e){return e.at(-1)?.role===`assistant`?e:[...e,{id:Qf(`msg`),role:`assistant`,parts:[]}]}var Zf=0;function Qf(e){let t=globalThis.crypto?.randomUUID?.();return t===void 0?(Zf+=1,`${e}_${Zf.toString(36)}`):`${e}_${t}`}function $f(e){return typeof e!=`string`&&`role`in e&&Array.isArray(e.parts)}function ep(e){if(!(!fp(e)||typeof e.type!=`string`)&&(e.type===`message_start`&&tp(e.message)||(e.type===`text_delta`||e.type===`reasoning_delta`)&&typeof e.messageId==`string`&&typeof e.partId==`string`&&typeof e.delta==`string`||e.type===`tool_update`&&typeof e.messageId==`string`&&typeof e.partId==`string`&&np(e.part)||e.type===`message_end`&&typeof e.messageId==`string`||e.type===`error`&&rp(e.error)))return e}function tp(e){return fp(e)&&typeof e.id==`string`&&typeof e.role==`string`&&Array.isArray(e.parts)}function np(e){return fp(e)&&typeof e.id==`string`&&typeof e.type==`string`}function rp(e){return fp(e)&&typeof e.message==`string`}function ip(e){return fp(e)&&typeof e.id==`string`&&fp(e.function)&&typeof e.function.name==`string`&&`arguments`in e.function}function ap(e){return e.flatMap(e=>fp(e)&&e.type===`text`&&typeof e.text==`string`?[e.text]:[]).join(`
|
|
111
|
+
`)}function op(e){return e instanceof Error?{name:e.name,message:e.message}:{message:typeof e==`string`?e:sp(e)}}function sp(e){try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}function cp(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)||fp(e)?e:sp(e)}function lp(e,t){return up(e)&&up(t)?{...e,...t}:t}function up(e){return fp(e)&&!Array.isArray(e)}function dp(e){return`tool_${e}`}function fp(e){return typeof e==`object`&&!!e}function pp(e={}){let[t,n]=(0,_.useState)(()=>[...e.initialMessages??[]]),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(`idle`),[s,c]=(0,_.useState)(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)([]),[p,m]=(0,_.useState)(()=>new Set),[h,g]=(0,_.useState)(()=>new Set),v=(0,_.useRef)(void 0),y=(0,_.useRef)(t),b=(0,_.useRef)(l),x=(0,_.useRef)(d),S=(0,_.useRef)(p),C=(0,_.useRef)(h),w=(0,_.useRef)(0);(0,_.useEffect)(()=>{y.current=t},[t]),(0,_.useEffect)(()=>{b.current=l},[l]),(0,_.useEffect)(()=>{x.current=d},[d]),(0,_.useEffect)(()=>{S.current=p},[p]),(0,_.useEffect)(()=>{C.current=h},[h]),(0,_.useEffect)(()=>()=>{v.current?.abort()},[]);let T=(0,_.useMemo)(()=>{if(e.transport!==void 0)return e.transport;if(e.endpoint!==void 0)return jf({endpoint:e.endpoint,format:e.format??`jsonl`})},[e.transport,e.endpoint,e.format]),E=(0,_.useCallback)(e=>{let t=typeof e==`function`?e(y.current):e;y.current=t,n(t)},[]),D=(0,_.useCallback)(e=>{u(t=>{let n=Sf(t,e);return b.current=n,n})},[]),O=(0,_.useCallback)(e=>{f(t=>{let n=Sf(t,e);return x.current=n,n})},[]),k=(0,_.useCallback)(()=>{w.current+=1,b.current=[],x.current=[],S.current=new Set,C.current=new Set,u([]),f([]),m(new Set),g(new Set)},[]),A=(0,_.useCallback)(t=>{let n=e.eventToUIEvent?.(t);if(n!==void 0){E(e=>Lf(e,n));return}if(!(e.eventToUIEvent!==void 0||e.eventToDelta!==void 0||e.eventToFinal!==void 0)){let e=!1;if(E(n=>{let r=Rf(n,t);return r===void 0?n:(e=!0,r)}),e)return}let r=e.eventToDelta?.(t);r!==void 0&&r.length>0&&E(e=>Vf(e,r));let i=e.eventToFinal?.(t);i!==void 0&&E(e=>Uf(e,i))},[e,E]),ee=(0,_.useCallback)(t=>{let n=e.humanInput;if(n===void 0)return;let r=(n.eventToApproval??vf)(t);r!==void 0&&D(r);let i=(n.eventToQuestion??yf)(t);i!==void 0&&O(i)},[e.humanInput,D,O]),j=(0,_.useCallback)(async t=>{if(T===void 0)throw Error(`useChat requires either transport or endpoint`);v.current?.abort();let n=new AbortController;v.current=n;let r=e.createRequest??(e=>({messages:e.coreMessages,stream:!0}));E(t),i([]),c(void 0),k(),o(`streaming`);try{let a=r({messages:t,uiMessages:t,coreMessages:Qd(t)});for await(let t of T.send(a,{signal:n.signal})){if(v.current!==n||n.signal.aborted||(i(e=>[...e,t]),ee(t),e.onEvent?.(t),v.current!==n||n.signal.aborted))return;A(t)}v.current===n&&!n.signal.aborted&&o(`idle`)}catch(t){if(hp(t)){v.current===n&&o(`idle`);return}if(v.current!==n)return;c(t),o(`error`),e.onError?.(t)}finally{v.current===n&&(v.current=void 0)}},[A,ee,k,e,E,T]),te=(0,_.useCallback)(async e=>{let t=If(e);if(t===void 0)return;let n=y.current;await j([...v.current!==void 0&&n.at(-1)?.role===`assistant`?n.slice(0,-1):n,t])},[j]),ne=(0,_.useCallback)(async(e=``)=>{await te(e)},[te]),M=(0,_.useCallback)(async()=>{let e=mp(y.current);e!==-1&&await j(y.current.slice(0,e+1))},[j]),N=(0,_.useCallback)(()=>{v.current?.abort(),v.current=void 0,o(`idle`)},[]),P=(0,_.useCallback)(async(t,n,r)=>{let i=e.humanInput;if(i===void 0)throw Error(`useChat humanInput is not configured`);if(S.current.has(t))return;let a=w.current,o=new Set(S.current).add(t);S.current=o,m(o);try{let e=b.current.find(e=>e.id===t),o={approvalId:t,approved:n,...r===void 0?{}:{reason:r},...e===void 0?{}:{approval:e}},s=i.decideApproval===void 0?await bf(o,i):await i.decideApproval(o);s!==void 0&&w.current===a&&D(s)}finally{if(w.current===a){let e=new Set(S.current);e.delete(t),S.current=e,m(e)}}},[e.humanInput,D]),re=(0,_.useCallback)(async(e,t)=>{await P(e,!0,t)},[P]),ie=(0,_.useCallback)(async(e,t)=>{await P(e,!1,t)},[P]),ae=(0,_.useCallback)(async(t,n)=>{let r=e.humanInput;if(r===void 0)throw Error(`useChat humanInput is not configured`);if(C.current.has(t))return;let i=w.current,a=new Set(C.current).add(t);C.current=a,g(a);try{let e=x.current.find(e=>e.id===t),a={questionId:t,answers:n,...e===void 0?{}:{question:e}},o=r.answerQuestion===void 0?await xf(a,r):await r.answerQuestion(a);o!==void 0&&w.current===i&&O(o)}finally{if(w.current===i){let e=new Set(C.current);e.delete(t),C.current=e,g(e)}}},[e.humanInput,O]);return{messages:t,events:r,setMessages:E,sendMessage:te,send:ne,regenerate:M,stop:N,reset:(0,_.useCallback)((e=[])=>{v.current?.abort(),v.current=void 0,E(e),i([]),k(),c(void 0),o(`idle`)},[k,E]),status:a,error:s,text:zf(t),humanInput:{approvals:{all:l,pending:l.filter(e=>e.status===`pending`)},questions:{all:d,pending:d.filter(e=>e.status===`pending`)}},decidingApprovals:new Set(p),answeringQuestions:new Set(h),approveTool:re,rejectTool:ie,answerToolQuestion:ae}}function mp(e){for(let t=e.length-1;t>=0;--t)if(e[t]?.role===`user`)return t;return-1}function hp(e){return e instanceof DOMException&&e.name===`AbortError`}async function gp(e,t){let n=``;try{let t=await e.json();typeof t==`object`&&t&&`error`in t&&typeof t.error==`object`&&t.error!==null&&`message`in t.error&&typeof t.error.message==`string`&&(n=`: ${t.error.message}`)}catch{}return`${t} with HTTP ${e.status}${n}`}function _p(e){return e instanceof mf?e.response.status===401?`Authentication required`:`Run failed with HTTP ${e.response.status}`:s(e)}function vp(e){if(typeof e==`string`)return e;if(e instanceof Error)return e.message;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}var yp=0;function bp(e){yp=e}function xp(){yp=0}function Sp(e){return e.filter(e=>e.kind===`message`&&e.text.trim().length>0).map(e=>({role:e.role,content:[{type:`text`,text:e.text}]}))}function Cp(e){return e.currentTarget.value}function wp(e){e!==null&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)}function Tp(){let e=yp;return yp+=1,e}function Ep(e){return e.reduce((e,t)=>Math.max(e,t.entryId+1),0)}function Dp(e,t,n){for(let r=e.length-1;r>=0;--r){let i=e[r];if(i!==void 0&&!(i.kind!==`tool`||i.toolName!==t||i.result!==void 0)&&(n===void 0||i.callId===n))return r}return-1}function Op(e,t,n){for(let r=e.length-1;r>=0;--r){let i=e[r];if(i!==void 0&&!(i.kind!==`tool`||i.toolName!==t)&&(n===void 0||i.callId===n))return r}return-1}function kp(e){return typeof e==`string`?e:c(e)?typeof e.text==`string`?e.text:typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(Ap).filter(Boolean).join(`
|
|
112
|
+
`):``:``}function Ap(e){return typeof e==`string`?e:c(e)?typeof e.text==`string`?e.text:e.type===`tool_call`&&c(e.function)?`${String(e.function.name??`tool`)}(${u(e.function.arguments)})`:e.type===`tool_result`&&Array.isArray(e.content)?e.content.map(Ap).filter(Boolean).join(`
|
|
113
|
+
`):typeof e.type==`string`?e.type:``:``}async function jp(e,t){for await(let n of lf(e))await t(n)}function Mp(){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})})}function Np(e){let{attachments:t,messages:n,onActivePageChange:r,onAttachmentsChange:i,onBeforeRun:a,onError:c,onPromptChange:l,onRunStateChange:d,onStatus:f,promptRef:p,runState:m,selectedAgent:h,selectedAgentId:g,selectedModelRef:v,sessions:y,sessionsEnabled:b,traces:x,transcript:S}=e,C=(0,_.useRef)(void 0),w=(0,_.useRef)(void 0),T=(0,_.useRef)(Promise.resolve()),E=pp({transport:jf({endpoint:e=>`/agents/${encodeURIComponent(e.agentId)}/runs`,method:`POST`,format:`jsonl`,headers:{"content-type":`application/json`},body:e=>{let{agentId:t,...n}=e;return JSON.stringify(n)},mapEvent:e=>e}),createRequest:()=>{let e=C.current;if(e===void 0)throw Error(`Missing playground run request`);return e},eventToDelta:()=>void 0,eventToFinal:()=>void 0,onEvent(e){O(e)&&(T.current=T.current.then(Mp))},onError(e){w.current=e;let t=_p(e);c(t),S.appendAssistantError(t)}});(0,_.useEffect)(()=>{d(E.status===`streaming`?`running`:`idle`)},[d,E.status]);async function D(e){let u=e.trim(),_=t,D=h?.id??g;if(u.length===0&&_.length===0||D.length===0||m===`running`||E.status===`streaming`)return;d(`running`),a(),r(`playground`),c(``),l(``),i([]),requestAnimationFrame(()=>wp(p.current));let O=_.length===0?u:ri(u,_);S.setMessages(e=>[...e,{entryId:Tp(),kind:`message`,role:`user`,text:u,..._.length===0?{}:{attachments:ii(_)}},{entryId:Tp(),kind:`message`,role:`assistant`,text:``,tone:`pending`}]);try{let e=b&&y.selectedSessionId.length===0,t=e?(await y.createSession(o(u),{updatePath:!1})).id:y.selectedSessionId,r=b?void 0:Sp(n);if(w.current=void 0,T.current=Promise.resolve(),C.current={agentId:D,message:O,...t.length===0?{}:{sessionId:t},...r===void 0?{}:{history:r},...v.length===0?{}:{model:v},stream:!0,metadata:{source:`anvia-studio`,...v.length===0?{}:{studioModel:v}}},await E.send(u),await T.current,w.current===void 0){if(await y.loadAllSessions(),t.length>0){y.setSelectedSessionId(t);let[n]=await Promise.all([x.loadSessionTraceSummaries(t),y.loadSessionLogs(t)]);S.setMessages(e=>Zr(e,n)),e&&y.openSessionPath(t)}f(`Connected`)}}catch(e){let t=s(e);c(t),S.appendAssistantError(t)}finally{C.current=void 0,E.reset(),d(`idle`)}}function O(e){if(e.type===`text_delta`)return S.appendAssistantText(e.delta),!0;if(e.type===`reasoning_delta`)return S.appendReasoningText(e.delta,e.id),!0;if(e.type===`tool_call`)return S.appendToolCall(e.toolCall.function.name,u(e.toolCall.function.arguments),e.toolCall.callId??e.toolCall.id),!0;if(e.type===`tool_result`)return S.appendToolResult({toolName:e.toolName,callId:e.toolCallId,args:e.args,result:e.result,...e.structuredResult===void 0?{}:{structuredResult:e.structuredResult}}),!0;if(e.type===`agent_tool_event`)return S.appendAgentToolEvent(e),!0;if(e.type===`tool_approval_request`||e.type===`tool_approval_result`)return S.updateToolApproval(e.approval),!0;if(e.type===`tool_question_request`||e.type===`tool_question_result`)return S.updateToolQuestion(e.question),!0;if(e.type===`session_log`)return y.appendSessionLogEntry(e.log),!0;if(e.type===`final`)return e.trace?.traceId!==void 0&&S.assignAssistantTraceId(e.trace.traceId),S.clearPendingAssistant(),!0;if(e.type===`error`){let t=vp(e.error);return w.current=e.error,c(t),S.appendAssistantError(t),!0}return!1}return{runPrompt:D}}function Pp(){let[e,t]=(0,_.useState)([]);return{messages:e,setMessages:t,appendAgentToolEvent:e=>t(t=>Up(t,e)),appendAssistantError:e=>t(t=>Ip(t,e)),appendAssistantText:e=>t(t=>Fp(t,e)),appendReasoningText:(e,n)=>t(t=>Bp(t,e,n)),appendToolCall:(e,n,r)=>t(t=>Vp(t,e,n,r)),appendToolResult:e=>t(t=>Hp(t,e)),assignAssistantTraceId:e=>t(t=>Lp(t,e)),clearPendingAssistant:()=>t(e=>Wp(e)),updateToolApproval:e=>t(t=>Rp(t,e)),updateToolQuestion:e=>t(t=>zp(t,e))}}function Fp(e,t){let n=[...e],r=n.at(-1);if(r?.kind===`message`&&r.role===`assistant`)if(r.tone===`pending`){let{tone:e,...i}=r;n[n.length-1]={...i,text:t}}else n[n.length-1]={...r,text:`${r.text}${t}`};else n.push({entryId:Tp(),kind:`message`,role:`assistant`,text:t});return n}function Ip(e,t){let n=[...e],r=n.at(-1),i={entryId:r?.kind===`message`&&r.role===`assistant`&&r.tone===`pending`?r.entryId:Tp(),kind:`message`,role:`assistant`,text:t,tone:`error`};return r?.kind===`message`&&r.role===`assistant`&&r.tone===`pending`?(n[n.length-1]=i,n):[...n,i]}function Lp(e,t){let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r?.kind===`message`&&r.role===`assistant`){n[e]={...r,traceId:t};break}}return n}function Rp(e,t){let n=Wp(e),r=Op(n,t.toolName,t.callId);if(r<0)return n.push({entryId:Tp(),kind:`tool`,toolName:t.toolName,...t.callId===void 0?{}:{callId:t.callId},approval:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.resolvedAt===void 0?{}:{resolvedAt:t.resolvedAt},...t.reason===void 0?{}:{reason:t.reason}}}),n;let i=n[r];return i!==void 0&&i.kind===`tool`&&(n[r]={...i,approval:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.resolvedAt===void 0?{}:{resolvedAt:t.resolvedAt},...t.reason===void 0?{}:{reason:t.reason}}}),n}function zp(e,t){let n=Wp(e),r=Op(n,t.toolName,t.callId);if(r<0)return n.push({entryId:Tp(),kind:`tool`,toolName:t.toolName,...t.callId===void 0?{}:{callId:t.callId},question:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.answeredAt===void 0?{}:{answeredAt:t.answeredAt},questions:t.questions,...t.answers===void 0?{}:{answers:t.answers}}}),n;let i=n[r];return i!==void 0&&i.kind===`tool`&&(n[r]={...i,question:{id:t.id,status:t.status,requestedAt:t.requestedAt,...t.answeredAt===void 0?{}:{answeredAt:t.answeredAt},questions:t.questions,...t.answers===void 0?{}:{answers:t.answers}}}),n}function Bp(e,t,n){let r=Wp(e),i=r.at(-1);return i?.kind===`reasoning`&&(i.reasoningId??``)===(n??``)?r[r.length-1]={...i,text:`${i.text}${t}`}:r.push({entryId:Tp(),kind:`reasoning`,...n===void 0?{}:{reasoningId:n},text:t}),r}function Vp(e,t,n,r){return[...Wp(e),{entryId:Tp(),kind:`tool`,toolName:t,...r===void 0?{}:{callId:r},...n.length===0?{}:{args:n}}]}function Hp(e,t){let n=Wp(e),r=Dp(n,t.toolName,t.callId);if(r>=0){let e=n[r];if(e!==void 0&&e.kind===`tool`)return n[r]={...e,args:e.args??t.args,result:t.result,...t.structuredResult===void 0?{}:{structuredResult:t.structuredResult}},n}return n.push({entryId:Tp(),kind:`tool`,toolName:t.toolName,...t.callId===void 0?{}:{callId:t.callId},args:t.args,result:t.result,...t.structuredResult===void 0?{}:{structuredResult:t.structuredResult}}),n}function Up(e,t){let n=Gp(t);if(n===void 0)return e;let r=Wp(e),i=Dp(r,t.toolName,t.toolCallId);if(i<0)return r.push({entryId:Tp(),kind:`tool`,toolName:t.toolName,...t.toolCallId===void 0?{}:{callId:t.toolCallId},childEvents:[n]}),r;let a=r[i];if(a===void 0||a.kind!==`tool`)return r;let o=[...a.childEvents??[]];return Kp(o,n),r[i]={...a,childEvents:o},r}function Wp(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.kind===`message`&&n.role===`assistant`&&n.tone===`pending`&&n.text.trim().length===0)return e.filter((e,n)=>n!==t)}return[...e]}function Gp(e){let t=e.event;if(t.type===`text_delta`)return{kind:`message`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},text:t.delta};if(t.type===`reasoning_delta`)return{kind:`reasoning`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},...t.id===void 0?{}:{reasoningId:t.id},text:t.delta};if(t.type===`tool_call`)return{kind:`tool`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},toolName:t.toolCall.function.name,...t.toolCall.callId===void 0&&t.toolCall.id===void 0?{}:{callId:t.toolCall.callId??t.toolCall.id},args:u(t.toolCall.function.arguments)};if(t.type===`tool_result`)return{kind:`tool`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},toolName:t.toolName,...t.toolCallId===void 0?{}:{callId:t.toolCallId},args:t.args,result:t.result,...t.structuredResult===void 0?{}:{structuredResult:t.structuredResult}};if(t.type===`error`)return{kind:`message`,agentId:e.agentId,...e.agentName===void 0?{}:{agentName:e.agentName},text:`Error: ${s(t.error)}`}}function Kp(e,t){if(t.kind===`message`){let n=e.at(-1);n?.kind===`message`&&n.agentId===t.agentId?e[e.length-1]={...n,text:`${n.text}${t.text}`}:e.push(t);return}if(t.kind===`reasoning`){let n=e.at(-1);n?.kind===`reasoning`&&n.agentId===t.agentId&&(n.reasoningId??``)===(t.reasoningId??``)?e[e.length-1]={...n,text:`${n.text}${t.text}`}:e.push(t);return}let n=qp(e,t);if(n<0){e.push(t);return}let r=e[n];r?.kind===`tool`&&(e[n]={...r,...r.args!==void 0||t.args===void 0?{}:{args:t.args},...t.result===void 0?{}:{result:t.result}})}function qp(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(!(r?.kind!==`tool`||r.agentId!==t.agentId||r.toolName!==t.toolName||r.result!==void 0)&&(t.callId===void 0||r.callId===t.callId))return n}return-1}function Jp(e){let[t,n]=(0,_.useState)(()=>new Set),[r,i]=(0,_.useState)(()=>new Set);async function a(r,i){if(!t.has(r)){n(e=>new Set(e).add(r)),e.onError(``);try{let t=await fetch(`/approvals/${encodeURIComponent(r)}/decision`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({approved:i})});if(!t.ok)throw Error(`Approval decision failed with HTTP ${t.status}`);e.onToolApprovalUpdate(await t.json())}catch(t){e.onError(s(t))}finally{n(e=>{let t=new Set(e);return t.delete(r),t})}}}async function o(t,n){if(!r.has(t)){i(e=>new Set(e).add(t)),e.onError(``);try{let r=await fetch(`/questions/${encodeURIComponent(t)}/answer`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({answers:n})});if(!r.ok)throw Error(`Question answer failed with HTTP ${r.status}`);e.onToolQuestionUpdate(await r.json())}catch(t){e.onError(s(t))}finally{i(e=>{let n=new Set(e);return n.delete(t),n})}}}return{answeringQuestions:r,decidingApprovals:t,answerToolQuestion:o,decideToolApproval:a}}function Yp(e){let{currentAgentId:t,enabled:n,loadSessionTraceSummaries:r,runState:i,selectedModelRef:a,onError:o,onSessionCreated:c,onSessionDeleted:l,onSessionLoaded:u,onStatus:d}=e,[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)([]),[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(`idle`),[x,S]=(0,_.useState)(`idle`),C=(0,_.useRef)(``),w=(0,_.useCallback)(async()=>{if(!n){h([]);return}try{let e=await fetch(`/sessions?limit=100`);if(!e.ok)throw Error(`Sessions failed with HTTP ${e.status}`);h((await e.json()).sessions)}catch(e){o(s(e))}},[n,o]);(0,_.useEffect)(()=>{w()},[w]);let T=(0,_.useCallback)(async e=>{if(!n)return v([]),[];S(`loading`);try{let t=new URLSearchParams({limit:`1000`}),n=await fetch(`/sessions/${encodeURIComponent(e)}/logs?${t}`);if(!n.ok)throw Error(`Session logs failed with HTTP ${n.status}`);let r=await n.json();return v(r.logs),r.logs}catch(e){return o(s(e)),v([]),[]}finally{S(`idle`)}},[n,o]),E=(0,_.useCallback)(async(e,n={})=>{let r=await fetch(`/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agentId:t,title:e,metadata:{source:`anvia-studio`,...a.length===0?{}:{[Gr]:a}}})});if(!r.ok)throw Error(await gp(r,`Session create failed`));let i=await r.json();return p(i.id),h(e=>[i,...e.filter(e=>e.id!==i.id)]),n.updatePath!==!1&&c(i.id),await T(i.id),i},[t,T,c,a]),D=(0,_.useCallback)(async(e,t={})=>{if(i!==`running`){C.current=e,b(`loading`),o(``);try{let n=await fetch(`/sessions/${encodeURIComponent(e)}`);if(!n.ok)throw Error(`Session load failed with HTTP ${n.status}`);let i=await n.json(),[a]=await Promise.all([r(i.id),T(i.id)]);if(C.current!==e)return;p(i.id),u(i,a,t),d(`Connected`)}catch(t){C.current===e&&o(s(t))}finally{C.current===e&&b(`idle`)}}},[T,r,o,u,d,i]),O=(0,_.useCallback)(async e=>{if(i!==`running`){o(``);try{let t=await fetch(`/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`});if(!t.ok)throw Error(`Session delete failed with HTTP ${t.status}`);let n=f===e.id;h(t=>t.filter(t=>t.id!==e.id)),n&&(p(``),v([])),l(e.id,n),d(`Connected`)}catch(e){o(s(e))}}},[o,l,d,i,f]),k=(0,_.useCallback)(()=>{p(``),v([])},[]),A=(0,_.useCallback)(e=>{v(t=>t.some(t=>t.id===e.id)?t:[...t,e].sort((e,t)=>e.sequence-t.sequence))},[]);return(0,_.useMemo)(()=>({allSessions:m,selectedSessionId:f,sessionLogs:g,sessionLoadState:y,sessionLogLoadState:x,appendSessionLogEntry:A,clearSelectedSession:k,createSession:E,deleteSession:O,loadAllSessions:w,loadSession:D,loadSessionLogs:T,openSessionPath:c,setSelectedSessionId:p}),[m,A,k,E,O,w,D,T,c,f,y,x,g])}function Xp(e,t){return!0}function Zp(e,t){return e}var Qp=document.getElementById(`anvia-ui`),$p=Qp?.dataset.uiPath??`/ui`,em=Qp?.dataset.uiCompatPath??`/ui`,tm=`${rm($p)||rm(em)||`/ui`}/assets/logo.png`,nm=`static-context`;function rm(e){return e===`/`?``:e.replace(/\/+$/,``)}function im(e){let{activePage:t,enabled:n,onError:r,onNavigateTracing:i,onOpenTrace:a,onOpenTraceIndex:o,onOpenTraceSession:c}=e,[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(()=>e.initialTraceId),[p,m]=(0,_.useState)(()=>e.initialTraceSessionId),[h,g]=(0,_.useState)(`idle`),v=(0,_.useCallback)(async()=>{if(!n){u([]);return}g(`loading`);try{let e=new URLSearchParams({include:`detail`,limit:`50`}),t=await fetch(`/traces?${e.toString()}`);if(!t.ok)throw Error(`Traces failed with HTTP ${t.status}`);let n=(await t.json()).traces;if(d.length>0&&!n.some(e=>e.id===d)){let e=await fetch(`/traces/${encodeURIComponent(d)}`);if(e.ok){u([await e.json(),...n]);return}}u(n)}catch(e){r(s(e))}finally{g(`idle`)}},[n,r,d]),y=(0,_.useCallback)(async(e,t={})=>{if(n){g(`loading`);try{let n=new URLSearchParams({include:`detail`,limit:`50`,sessionId:e}),r=await fetch(`/traces?${n.toString()}`);if(!r.ok)throw Error(`Session traces failed with HTTP ${r.status}`);let a=[...(await r.json()).traces].sort((e,t)=>Date.parse(e.startedAt)-Date.parse(t.startedAt));u(a);let o=a[0]?.id;if(o===void 0){f(``),m(e),t.updatePath!==!1&&c(e);return}i(),f(o),m(e),t.updatePath!==!1&&c(e)}catch(e){r(s(e))}finally{g(`idle`)}}},[n,r,i,c]),b=(0,_.useCallback)(async e=>{if(!n)return[];let t=new URLSearchParams({limit:`100`}),r=await fetch(`/sessions/${encodeURIComponent(e)}/traces?${t}`);return r.ok?(await r.json()).traces:[]},[n]);(0,_.useEffect)(()=>{t!==`tracing`||p!==void 0||v()},[t,v,p]);let x=(0,_.useCallback)((e,t)=>{f(e),m(t)},[]),S=(0,_.useCallback)(()=>{f(``),m(void 0)},[]),C=(0,_.useCallback)(e=>{if(i(),f(e),m(void 0),e.length===0){o();return}a(e)},[i,a,o]),w=(0,_.useCallback)(e=>{u(t=>t.filter(t=>t.sessionId!==e))},[]);return(0,_.useMemo)(()=>({traces:l,selectedTraceId:d,traceSessionDetailId:p,traceLoadState:h,clearTraceSelection:S,loadSessionTraceSummaries:b,loadTraces:v,removeSessionTraces:w,selectTrace:C,setTraceLocation:x,showSessionTraces:y}),[S,b,v,w,C,d,x,y,h,p,l])}var am=(0,_.createContext)(void 0);function om(){let e=(0,_.useContext)(am);if(e===void 0)throw Error(`StudioConsoleContext is missing`);return e}var sm=`modulepreload`,cm=function(e){return`/ui/`+e},lm={},um=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=cm(t,n),t in lm)return;lm[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:sm,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},dm=(0,_.lazy)(()=>um(()=>import(`./agents-page-B8Tw2e11.js`).then(e=>({default:e.AgentsPage})),__vite__mapDeps([0,1,2]))),fm=(0,_.lazy)(()=>um(()=>import(`./evals-page-w-gdHmQ3.js`).then(e=>({default:e.EvalsPage})),__vite__mapDeps([3,1,4]))),pm=(0,_.lazy)(()=>um(()=>import(`./knowledge-page-Diqg4sSt.js`).then(e=>({default:e.KnowledgePage})),__vite__mapDeps([5,1,6,7,8,2]))),mm=(0,_.lazy)(()=>um(()=>import(`./mcps-page-XTpTg88A.js`).then(e=>({default:e.McpsPage})),__vite__mapDeps([9,1,7,8,2]))),hm=(0,_.lazy)(()=>um(()=>import(`./memory-page-DXesSt0M.js`).then(e=>({default:e.MemoryPage})),__vite__mapDeps([10,1,7,8,2]))),gm=(0,_.lazy)(()=>um(()=>import(`./pipelines-page-Bk0Qm7db.js`).then(e=>({default:e.PipelinesPage})),__vite__mapDeps([11,1,4,6,7,8,12]))),_m=(0,_.lazy)(()=>um(()=>import(`./sessions-page-CmDz8RxM.js`).then(e=>({default:e.SessionsPage})),__vite__mapDeps([13,1,8]))),vm=(0,_.lazy)(()=>um(()=>import(`./sessions-page-CmDz8RxM.js`).then(e=>({default:e.DeleteSessionDialog})),__vite__mapDeps([13,1,8]))),ym=(0,_.lazy)(()=>um(()=>import(`./status-page-oWsYfXZZ.js`).then(e=>({default:e.StatusPage})),__vite__mapDeps([14,1,7,8,2]))),bm=(0,_.lazy)(()=>um(()=>import(`./tools-page-C-ht7C6S.js`).then(e=>({default:e.ToolsPage})),__vite__mapDeps([15,1,7,8,2]))),xm=(0,_.lazy)(()=>um(()=>import(`./trace-browser-DaE4vnXd.js`).then(e=>({default:e.TraceBrowser})),__vite__mapDeps([16,1,17,2,8])));function Sm(){return(0,R.jsx)(`section`,{className:`grid h-full min-h-0 place-items-center bg-background/45 text-sm font-medium text-muted-foreground`,children:`Loading`})}var Cm=[[`path`,{d:`M4.31802 19.682C3 18.364 3 16.2426 3 12C3 7.75736 3 5.63604 4.31802 4.31802C5.63604 3 7.75736 3 12 3C16.2426 3 18.364 3 19.682 4.31802C21 5.63604 21 7.75736 21 12C21 16.2426 21 18.364 19.682 19.682C18.364 21 16.2426 21 12 21C7.75736 21 5.63604 21 4.31802 19.682Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 14L9.79289 11.2071C10.1834 10.8166 10.8166 10.8166 11.2071 11.2071L12.7929 12.7929C13.1834 13.1834 13.8166 13.1834 14.2071 12.7929L17 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],wm=[[`path`,{d:`M13 2H11C7.22876 2 5.34315 2 4.17157 3.17157C3 4.34315 3 6.22876 3 10V14C3 17.7712 3 19.6569 4.17157 20.8284C5.34315 22 7.22876 22 11 22H13C16.7712 22 18.6569 22 19.8284 20.8284C21 19.6569 21 17.7712 21 14V10C21 6.22876 21 4.34315 19.8284 3.17157C18.6569 2 16.7712 2 13 2Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21 12H3`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M15 7H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M15 17H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}]],Tm=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Em=[[`path`,{d:`M12 5.5V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 11C18 11 13.5811 5.00001 12 5C10.4188 4.99999 6 11 6 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Dm=[[`path`,{d:`M19.5 12.0001V13.5001C19.5 17.6422 16.1421 21.0001 12 21.0001C7.85786 21.0001 4.5 17.6422 4.5 13.5001V8C4.5 5.23858 6.73858 3 9.5 3C12.2614 3 14.5 5.23858 14.5 8V13.5C14.5 14.8807 13.3807 16 12 16C10.6193 16 9.5 14.8807 9.5 13.5V9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Om=[[`path`,{d:`M18 6L6.00081 17.9992M17.9992 18L6 6.00085`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],km=[[`path`,{d:`M2 10.5C2 9.72921 2.01346 8.97679 2.03909 8.2503C2.12282 5.87683 2.16469 4.69009 3.13007 3.71745C4.09545 2.74481 5.3157 2.6926 7.7562 2.58819C9.09517 2.5309 10.5209 2.5 12 2.5C13.4791 2.5 14.9048 2.5309 16.2438 2.58819C18.6843 2.6926 19.9046 2.74481 20.8699 3.71745C21.8353 4.69009 21.8772 5.87683 21.9609 8.2503C21.9865 8.97679 22 9.72921 22 10.5C22 11.2708 21.9865 12.0232 21.9609 12.7497C21.8772 15.1232 21.8353 16.3099 20.8699 17.2826C19.9046 18.2552 18.6843 18.3074 16.2437 18.4118C15.5098 18.4432 14.7498 18.4667 13.9693 18.4815C13.2282 18.4955 12.8576 18.5026 12.532 18.6266C12.2064 18.7506 11.9325 18.9855 11.3845 19.4553L9.20503 21.3242C9.07273 21.4376 8.90419 21.5 8.72991 21.5C8.32679 21.5 8 21.1732 8 20.7701V18.4219C7.91842 18.4186 7.83715 18.4153 7.75619 18.4118C5.31569 18.3074 4.09545 18.2552 3.13007 17.2825C2.16469 16.3099 2.12282 15.1232 2.03909 12.7497C2.01346 12.0232 2 11.2708 2 10.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.1257 10.5H12.0007M8.125 10.5H8M16.125 10.5H16M12.2507 10.5C12.2507 10.6381 12.1388 10.75 12.0007 10.75C11.8627 10.75 11.7507 10.6381 11.7507 10.5C11.7507 10.3619 11.8627 10.25 12.0007 10.25C12.1388 10.25 12.2507 10.3619 12.2507 10.5ZM8.25 10.5C8.25 10.6381 8.13807 10.75 8 10.75C7.86193 10.75 7.75 10.6381 7.75 10.5C7.75 10.3619 7.86193 10.25 8 10.25C8.13807 10.25 8.25 10.3619 8.25 10.5ZM16.25 10.5C16.25 10.6381 16.1381 10.75 16 10.75C15.8619 10.75 15.75 10.6381 15.75 10.5C15.75 10.3619 15.8619 10.25 16 10.25C16.1381 10.25 16.25 10.3619 16.25 10.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Am=[[`path`,{d:`M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17.0001 9.00004 17.0001C9.41425 17.0001 9.74759 16.6523 10.4143 15.9568L19 7.00006`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],jm=[[`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 10.842C7.60158 11.0229 8.27434 11.1718 9 11.282`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20 12C20 13.6569 16.4183 15 12 15C7.58172 15 4 13.6569 4 12`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M7 17.842C7.60158 18.0229 8.27434 18.1718 9 18.282`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M20 5V19C20 20.6569 16.4183 22 12 22C7.58172 22 4 20.6569 4 19V5`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],Mm=[[`path`,{d:`M15 3H18C19.4142 3 20.1213 3 20.5607 3.43934C21 3.87868 21 4.58579 21 6V9M20 4L11 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20 13C20 16.7712 20 18.6569 18.8284 19.8284C17.6569 21 15.7712 21 12 21H11C7.22876 21 5.34315 21 4.17157 19.8284C3 18.6569 3 16.7712 3 13V12C3 8.22876 3 6.34315 4.17157 5.17157C5.34315 4 7.22876 4 11 4`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],Nm=[[`circle`,{cx:`12`,cy:`14`,r:`2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20.0007 20C21.2561 18.3287 22 16.2512 22 14C22 12.5778 21.7031 11.2249 21.1679 10M3.99927 20C2.74389 18.3287 2 16.2512 2 14C2 8.47715 6.47715 4 12 4C13.4222 4 14.7751 4.2969 16 4.83209`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13.5 12.5L19 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Pm=[[`path`,{d:`M2 11.4C2 10.2417 2.24173 10 3.4 10H20.6C21.7583 10 22 10.2417 22 11.4V12.6C22 13.7583 21.7583 14 20.6 14H3.4C2.24173 14 2 13.7583 2 12.6V11.4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2 3.4C2 2.24173 2.24173 2 3.4 2H20.6C21.7583 2 22 2.24173 22 3.4V4.6C22 5.75827 21.7583 6 20.6 6H3.4C2.24173 6 2 5.75827 2 4.6V3.4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2 19.4C2 18.2417 2.24173 18 3.4 18H20.6C21.7583 18 22 18.2417 22 19.4V20.6C22 21.7583 21.7583 22 20.6 22H3.4C2.24173 22 2 21.7583 2 20.6V19.4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}]],Fm=[[`path`,{d:`M21.5 14.0784C20.3003 14.7189 18.9301 15.0821 17.4751 15.0821C12.7491 15.0821 8.91792 11.2509 8.91792 6.52485C8.91792 5.06986 9.28105 3.69968 9.92163 2.5C5.66765 3.49698 2.5 7.31513 2.5 11.8731C2.5 17.1899 6.8101 21.5 12.1269 21.5C16.6849 21.5 20.503 18.3324 21.5 14.0784Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Im=[[`path`,{d:`M15.5 2V6M8.5 6V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.00446 7.61331C5.93719 6.74273 6.63957 6 7.53014 6H16.4699C17.3604 6 18.0628 6.74273 17.9955 7.61331L17.8117 9.99197C17.6796 11.7019 17.1011 13.3498 16.132 14.7773L15.5312 15.6622C14.9638 16.4979 14.0077 17 12.9838 17H11.0162C9.99228 17 9.03617 16.4979 8.46881 15.6622L7.86803 14.7773C6.89885 13.3498 6.32041 11.7019 6.18827 9.99197L6.00446 7.61331Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 17V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11 9H13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Lm=[[`path`,{d:`M12 4V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20 22C20 17.5817 16.4183 14 12 14C7.58172 14 4 17.5817 4 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.375 8.25H9.25M9.5 8.25C9.5 8.38807 9.38807 8.5 9.25 8.5C9.11193 8.5 9 8.38807 9 8.25C9 8.11193 9.11193 8 9.25 8C9.38807 8 9.5 8.11193 9.5 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M14.875 8.25H14.75M15 8.25C15 8.38807 14.8881 8.5 14.75 8.5C14.6119 8.5 14.5 8.38807 14.5 8.25C14.5 8.11193 14.6119 8 14.75 8C14.8881 8 15 8.11193 15 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M15.1538 4H8.84615C7.59095 4 6.96334 4 6.47397 4.22025C5.91693 4.47095 5.47095 4.91693 5.22025 5.47397C5 5.96334 5 6.59095 5 7.84615C5 9.85448 5 10.8586 5.3524 11.6417C5.75353 12.5329 6.46709 13.2465 7.35835 13.6476C8.14135 14 9.14552 14 11.1538 14H12.8462C14.8545 14 15.8586 14 16.6417 13.6476C17.5329 13.2465 18.2465 12.5329 18.6476 11.6417C19 10.8586 19 9.85448 19 7.84615C19 6.59095 19 5.96334 18.7797 5.47397C18.529 4.91693 18.0831 4.47095 17.526 4.22025C17.0367 4 16.4091 4 15.1538 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],Rm=[[`path`,{d:`M18.7088 3.49534C16.8165 2.55382 14.5009 2 12 2C9.4991 2 7.1835 2.55382 5.29116 3.49534C4.36318 3.95706 3.89919 4.18792 3.4496 4.91378C3 5.63965 3 6.34248 3 7.74814V11.2371C3 16.9205 7.54236 20.0804 10.173 21.4338C10.9067 21.8113 11.2735 22 12 22C12.7265 22 13.0933 21.8113 13.8269 21.4338C16.4576 20.0804 21 16.9205 21 11.2371L21 7.74814C21 6.34249 21 5.63966 20.5504 4.91378C20.1008 4.18791 19.6368 3.95706 18.7088 3.49534Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],zm=[[`path`,{d:`M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2C11.6227 2.33333 11.0945 3.2 12 4M12 20C12.3773 20.3333 12.9055 21.2 12 22M19.5 4.50271C18.9685 4.46982 17.9253 4.72293 18.0042 5.99847M5.49576 17.5C5.52865 18.0315 5.27555 19.0747 4 18.9958M5.00271 4.5C4.96979 5.03202 5.22315 6.0763 6.5 5.99729M18 17.5026C18.5315 17.4715 19.5747 17.7108 19.4958 18.9168M22 12C21.6667 11.6227 20.8 11.0945 20 12M4 11.5C3.66667 11.8773 2.8 12.4055 2 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],Bm=[[`path`,{d:`M6 5.5C6 4.56538 6 4.09808 6.20096 3.75C6.33261 3.52197 6.52197 3.33261 6.75 3.20096C7.09808 3 7.56538 3 8.5 3H11.5C12.4346 3 12.9019 3 13.25 3.20096C13.478 3.33261 13.6674 3.52197 13.799 3.75C14 4.09808 14 4.56538 14 5.5C14 6.43462 14 6.90192 13.799 7.25C13.6674 7.47803 13.478 7.66739 13.25 7.79904C12.9019 8 12.4346 8 11.5 8H8.5C7.56538 8 7.09808 8 6.75 7.79904C6.52197 7.66739 6.33261 7.47803 6.20096 7.25C6 6.90192 6 6.43462 6 5.5Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6 15.5C6 14.5654 6 14.0981 6.20096 13.75C6.33261 13.522 6.52197 13.3326 6.75 13.201C7.09808 13 7.56538 13 8.5 13H11.5C12.4346 13 12.9019 13 13.25 13.201C13.478 13.3326 13.6674 13.522 13.799 13.75C14 14.0981 14 14.5654 14 15.5C14 16.4346 14 16.9019 13.799 17.25C13.6674 17.478 13.478 17.6674 13.25 17.799C12.9019 18 12.4346 18 11.5 18H8.5C7.56538 18 7.09808 18 6.75 17.799C6.52197 17.6674 6.33261 17.478 6.20096 17.25C6 16.9019 6 16.4346 6 15.5Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20.8398 17.1408C21.6133 16.3673 22 15.9806 22 15.5C22 15.0194 21.6133 14.6327 20.8398 13.8592L20.6408 13.6602C19.8673 12.8867 19.4806 12.5 19 12.5C18.5194 12.5 18.1327 12.8867 17.3592 13.6602L17.1602 13.8592C16.3867 14.6327 16 15.0194 16 15.5C16 15.9806 16.3867 16.3673 17.1602 17.1408L17.3592 17.3398C18.1327 18.1133 18.5194 18.5 19 18.5C19.4806 18.5 19.8673 18.1133 20.6408 17.3398L20.8398 17.1408Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M6.006 5.5H2.00781M2.00781 5.5V2M2.00781 5.5V12C2.00781 13.1037 1.85651 14.4679 2.89627 15.1629C3.40049 15.5 4.1024 15.5 5.50623 15.5M14.0024 15.5H16.0015M19.0001 12.5V9.5C19.0001 7.61438 19.0001 6.67157 18.4146 6.08579C17.8291 5.5 16.8867 5.5 15.0019 5.5H14.0024`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M22.0001 22C21.0682 22 20.6023 22 20.2348 21.8695C19.7447 21.6955 19.3554 21.3618 19.1524 20.9417C19.0001 20.6267 19.0001 20.2273 19.0001 19.4286V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],Vm=[[`path`,{d:`M20.3584 13.3567C19.1689 14.546 16.9308 14.4998 13.4992 14.4998C11.2914 14.4998 9.50138 12.7071 9.50024 10.4993C9.50024 7.07001 9.454 4.83065 10.6435 3.64138C11.8329 2.45212 12.3583 2.50027 17.6274 2.50027C18.1366 2.49809 18.3929 3.11389 18.0329 3.47394L15.3199 6.18714C14.6313 6.87582 14.6294 7.99233 15.3181 8.68092C16.0068 9.36952 17.1234 9.36959 17.8122 8.68109L20.5259 5.96855C20.886 5.60859 21.5019 5.86483 21.4997 6.37395C21.4997 11.6422 21.5479 12.1675 20.3584 13.3567Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M13.5 14.5L7.32842 20.6716C6.22386 21.7761 4.433 21.7761 3.32843 20.6716C2.22386 19.567 2.22386 17.7761 3.32843 16.6716L9.5 10.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5.50896 18.5H5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,key:`2`}]];function Hm(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Um(...e){return t=>{let n=!1,r=e.map(e=>{let r=Hm(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Hm(e[t],null)}}}}function Wm(...e){return _.useCallback(Um(...e),e)}function Gm(e){let t=_.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];$m(r)&&typeof rh==`function`&&(r=rh(r._payload)),_.Children.forEach(r,e=>{if(Zm(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;$m(n)&&typeof rh==`function`&&(n=rh(n._payload)),a=Jm(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=_.cloneElement(a,void 0,s):!o&&_.Children.count(r)===1&&_.isValidElement(r)&&(a=r);let c=a?Xm(a):void 0,l=Wm(n,c);if(!a){if(r||r===0)throw Error(o?nh(e):th(e));return r}let u=Ym(i,a.props??{});return a.type!==_.Fragment&&(u.ref=n?l:c),_.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Km=Gm(`Slot`),qm=Symbol.for(`radix.slottable`),Jm=(e,t)=>{if(`child`in e.props){let t=e.props.child;return _.isValidElement(t)?_.cloneElement(t,void 0,e.props.children(t.props.children)):null}return _.isValidElement(t)?t:null};function Ym(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Xm(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Zm(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===qm}var Qm=Symbol.for(`react.lazy`);function $m(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Qm&&`_payload`in e&&eh(e._payload)}function eh(e){return typeof e==`object`&&!!e&&`then`in e}var th=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,nh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,rh=_.use,ih=n(`inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-semibold shadow-none transition duration-200 ease-out active:translate-y-px disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:ring-offset-0 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`border border-foreground/45 bg-foreground text-background hover:bg-foreground/90`,ghost:`border border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,destructive:`border border-destructive bg-destructive text-destructive-foreground hover:bg-destructive/90`,secondary:`border border-border/80 bg-secondary text-secondary-foreground hover:border-muted-foreground/45 hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 px-3`,icon:`h-8 w-8 p-0`,sm:`h-8 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}});function ah({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,R.jsx)(r?Km:`button`,{className:a(ih({variant:t,size:n,className:e})),...i})}var oh={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`},sh=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n,absoluteStrokeWidth:r=!1,className:i=``,altIcon:a,showAlt:o=!1,icon:s,primaryColor:c,secondaryColor:l,disableSecondaryOpacity:u=!1,...d},f)=>{let p=n===void 0?void 0:r?Number(n)*24/Number(t):n,m=p===void 0?{}:{strokeWidth:p,stroke:`currentColor`};return(0,_.createElement)(`svg`,{ref:f,...oh,width:t,height:t,color:c||e,className:i,...m,...d},[...o&&a?a:s].sort(([,e],[,t])=>{let n=e.opacity!==void 0;return t.opacity===void 0?n?-1:0:1}).map(([t,n])=>{let r=n.opacity!==void 0,i=r&&!u?n.opacity:void 0,a=l?{...n.stroke===void 0?{fill:r?l:c||e}:{stroke:r?l:c||e}}:{};return(0,_.createElement)(t,{...n,...m,...a,opacity:i,key:n.key})}))});sh.displayName=`HugeiconsIcon`;function ch({color:e=`currentColor`,strokeWidth:t=1.5,...n}){return(0,R.jsx)(sh,{color:e,strokeWidth:t,...n})}function lh(e){let t=uh(e.icon);return(0,R.jsxs)(ah,{className:a(`h-8 min-h-8 w-full justify-start gap-3 rounded-lg bg-transparent px-2.5 text-sm font-medium text-sidebar-foreground/62 shadow-none transition duration-200 hover:bg-sidebar-accent/80 hover:text-sidebar-foreground active:translate-y-px [&_svg]:h-3.5 [&_svg]:w-3.5`,e.active&&`bg-sidebar-accent text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`),variant:`ghost`,type:`button`,disabled:e.disabled,onClick:e.onClick,children:[(0,R.jsx)(ch,{icon:t}),(0,R.jsx)(`span`,{children:e.label})]})}function uh(e){switch(e){case`activity`:return Cm;case`bot`:return Lm;case`database`:return jm;case`gauge`:return Nm;case`list`:return Pm;case`message`:return km;case`plug`:return Im;case`shield`:return Rm;case`wrench`:return Vm;case`workflow`:return Bm}}function dh(e){return(0,R.jsxs)(`aside`,{className:`flex h-[100dvh] min-h-0 flex-col overflow-hidden bg-sidebar text-sidebar-foreground`,children:[(0,R.jsx)(`div`,{className:`flex h-15 items-center px-4`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.jsx)(`img`,{className:`h-7 w-7 shrink-0 object-contain`,src:tm,alt:``}),(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,R.jsx)(`span`,{className:`anvia-wordmark text-lg font-semibold tracking-normal text-sidebar-foreground`,children:`Anvia Studio`})})]})}),(0,R.jsxs)(`nav`,{className:`grid gap-0.5 px-3 py-3`,"aria-label":`Main`,children:[(0,R.jsx)(`div`,{className:`px-2.5 pb-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:`Workspace`}),(0,R.jsx)(lh,{active:e.activePage===`playground`,icon:`message`,label:`Chat`,onClick:()=>e.onNavigate(`playground`)}),(0,R.jsx)(lh,{active:e.activePage===`pipelines`,icon:`workflow`,label:`Pipelines`,onClick:()=>e.onNavigate(`pipelines`)}),(0,R.jsx)(lh,{active:e.activePage===`evals`,icon:`gauge`,label:`Evals`,onClick:()=>e.onNavigate(`evals`)}),(0,R.jsx)(lh,{active:e.activePage===`sessions`,icon:`list`,label:`Sessions`,onClick:()=>e.onNavigate(`sessions`)}),(0,R.jsx)(lh,{active:e.activePage===`tracing`,icon:`activity`,label:`Traces`,onClick:()=>e.onNavigate(`tracing`)})]}),(0,R.jsxs)(`nav`,{className:`grid gap-0.5 px-3 py-3`,"aria-label":`Studio`,children:[(0,R.jsx)(`div`,{className:`px-2.5 pb-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:`Inspect`}),(0,R.jsx)(lh,{active:e.activePage===`agents`,icon:`bot`,label:`Studio`,onClick:()=>e.onNavigate(`agents`)}),(0,R.jsx)(lh,{active:e.activePage===`tools`,icon:`wrench`,label:`Tools`,onClick:()=>e.onNavigate(`tools`)}),(0,R.jsx)(lh,{active:e.activePage===`mcps`,icon:`plug`,label:`MCPs`,onClick:()=>e.onNavigate(`mcps`)}),(0,R.jsx)(lh,{active:e.activePage===`knowledge`,icon:`database`,label:`Knowledge`,onClick:()=>e.onNavigate(`knowledge`)}),(0,R.jsx)(lh,{active:e.activePage===`memory`,icon:`database`,label:`Memory`,onClick:()=>e.onNavigate(`memory`)}),(0,R.jsx)(lh,{active:e.activePage===`status`,icon:`gauge`,label:`Status`,onClick:()=>e.onNavigate(`status`)})]}),(0,R.jsxs)(`nav`,{className:`grid min-h-0 gap-0.5 overflow-auto px-3 py-3`,"aria-label":`Recent sessions`,children:[(0,R.jsx)(`div`,{className:`px-2.5 pb-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:`Recent`}),e.allSessions.slice(0,8).map(t=>(0,R.jsxs)(`div`,{className:a(`group grid min-h-7 min-w-0 grid-cols-[minmax(0,1fr)_36px] items-center gap-1 rounded-lg pr-1 transition duration-200 hover:bg-sidebar-accent/80 focus-within:bg-sidebar-accent/80`,t.id===e.selectedSessionId&&`bg-sidebar-accent`),children:[(0,R.jsx)(ah,{className:a(`grid h-auto min-h-7 min-w-0 justify-start rounded-lg border-0 bg-transparent px-2.5 py-0.5 text-left text-sidebar-foreground/72 shadow-none hover:bg-transparent hover:text-sidebar-foreground`,t.id===e.selectedSessionId&&`text-sidebar-accent-foreground`),type:`button`,variant:`ghost`,onClick:()=>e.onLoadSession(t.id),children:(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:t.title??`Untitled chat`})}),(0,R.jsxs)(`div`,{className:`relative grid h-7 min-w-0 place-items-end`,children:[(0,R.jsx)(`time`,{className:`grid h-6 min-w-6 place-items-center self-center justify-self-end rounded-lg px-1.5 text-sm font-medium tabular-nums text-muted-foreground group-hover:opacity-0 group-focus-within:opacity-0`,children:l(t.updatedAt)}),(0,R.jsx)(ah,{"aria-label":`Delete ${t.title??`Untitled chat`}`,className:`absolute right-0 top-1/2 hidden h-6 min-h-6 w-6 -translate-y-1/2 border-0 bg-transparent p-0 text-muted-foreground opacity-70 shadow-none hover:bg-transparent hover:text-destructive hover:opacity-100 group-hover:grid group-focus-within:grid [&_svg]:h-3.5 [&_svg]:w-3.5`,size:`icon`,type:`button`,variant:`ghost`,disabled:e.runState===`running`,onClick:()=>e.onDeleteSession(t),children:(0,R.jsx)(ch,{icon:wm,"aria-hidden":`true`})})]})]},t.id))]}),(0,R.jsxs)(`div`,{className:`mt-auto px-3 py-3`,children:[(0,R.jsx)(`nav`,{className:`grid gap-1`,"aria-label":`Anvia links`,children:(0,R.jsx)(ph,{href:`https://anvia.dev/docs`,label:`Anvia Docs`})}),(0,R.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:e.status})]})]})}function fh(e){return(0,R.jsx)(`header`,{className:`grid min-h-13 bg-background/88 backdrop-blur`,children:(0,R.jsxs)(`div`,{className:`grid min-h-13 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 py-0 pl-0 pr-6`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium`,children:[(0,R.jsx)(`span`,{className:`text-foreground`,children:e.activePage===`playground`?`Agents`:`Studio`}),(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.selectedAgentLabel})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(ah,{"aria-label":e.theme===`dark`?`Switch to light theme`:`Switch to dark theme`,className:`h-8 min-h-8 w-8 border-0 bg-transparent p-0 text-muted-foreground shadow-none hover:bg-muted/45 hover:text-foreground`,title:e.theme===`dark`?`Switch to light theme`:`Switch to dark theme`,type:`button`,variant:`ghost`,size:`icon`,onClick:e.onToggleTheme,children:e.theme===`dark`?(0,R.jsx)(ch,{icon:zm,"aria-hidden":`true`}):(0,R.jsx)(ch,{icon:Fm,"aria-hidden":`true`})}),(0,R.jsx)(ah,{className:`h-8 min-h-8 rounded-lg border border-white bg-white px-3 text-xs text-black shadow-none [box-shadow:none] hover:border-white hover:bg-white/90 hover:text-black focus-visible:ring-0 active:bg-white/85 disabled:bg-muted disabled:text-muted-foreground`,type:`button`,variant:`ghost`,disabled:!e.sessionsEnabled,onClick:e.onNewSession,children:`New session`})]})]})})}function ph(e){return(0,R.jsxs)(`a`,{className:`flex h-8 min-h-8 items-center justify-between rounded-lg px-2 text-xs font-semibold text-sidebar-foreground/62 transition duration-200 hover:bg-sidebar-accent hover:text-sidebar-foreground`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[(0,R.jsx)(`span`,{children:e.label}),(0,R.jsx)(ch,{icon:Mm,"aria-hidden":`true`,className:`h-3 w-3 text-muted-foreground`})]})}function mh(){let e=om();return(0,R.jsxs)(`div`,{className:`grid h-[100dvh] min-h-0 overflow-hidden bg-background text-foreground lg:grid-cols-[228px_minmax(0,1fr)]`,children:[(0,R.jsx)(dh,{activePage:e.activePage,allSessions:e.sessions.allSessions,evalsEnabled:e.evalsEnabled,hasAgents:e.hasAgents,knowledgeEnabled:e.knowledgeEnabled,mcpsEnabled:e.mcpsEnabled,memoryEnabled:e.memoryEnabled,pipelinesEnabled:e.pipelinesEnabled,runState:e.runState,selectedSessionId:e.sessions.selectedSessionId,sessionsEnabled:e.sessionsEnabled,status:e.status,statusEnabled:e.statusEnabled,toolsEnabled:e.toolsEnabled,tracesEnabled:e.tracesEnabled,onDeleteSession:e.setDeleteCandidate,onLoadSession:t=>void e.sessions.loadSession(t),onNavigate:e.navigatePage}),(0,R.jsxs)(`main`,{className:`grid h-[100dvh] min-w-0 grid-rows-[52px_minmax(0,1fr)] overflow-hidden bg-background/80`,children:[(0,R.jsx)(fh,{activePage:e.activePage,selectedAgentLabel:e.selectedAgent?.name??e.selectedAgent?.id??`Agent`,sessionsEnabled:e.sessionsEnabled,theme:e.theme,onNavigate:e.navigatePage,onNewSession:()=>e.startNewChat(),onToggleTheme:e.toggleTheme}),(0,R.jsx)(Fr,{})]}),(0,R.jsx)(_.Suspense,{fallback:null,children:(0,R.jsx)(vm,{session:e.deleteCandidate,onOpenChange:t=>{t||e.setDeleteCandidate(void 0)},onConfirm:t=>{e.sessions.deleteSession(t).finally(()=>{e.setDeleteCandidate(void 0)})}})})]})}function hh(e){let t=om(),{activateRoute:n}=t;return(0,_.useEffect)(()=>{n(e)},[n,e]),t}function gh(e){switch(e){case`dynamic-context`:case`dynamic-tools`:case`retrieval-log`:case`static-context`:return e;default:return`static-context`}}function _h(){let e=hh(`agents`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(dm,{agents:e.agents,selectedAgentId:e.selectedAgentId})})}function vh(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)(`idle`);async function c(){let n=t||e.evals[0]?.id||``;if(!(n.length===0||a===`running`)){o(`running`),i(void 0),e.onError(``);try{let t=await fetch(`/evals/${encodeURIComponent(n)}/runs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({})});if(!t.ok)throw Error(await gp(t,`Eval run failed`));i(await t.json()),e.onStatus(`Connected`)}catch(t){e.onError(s(t))}finally{o(`idle`)}}}return(0,R.jsx)(fm,{evals:e.evals,selectedEvalId:t,enabled:e.enabled,runState:a,result:r,onSelectEval:e=>{n(e),i(void 0)},onRun:()=>void c()})}function yh(){let e=hh(`evals`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(vh,{evals:e.evals,enabled:e.evalsEnabled,onError:e.setError,onStatus:e.setStatus})})}function bh(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)(`idle`),c=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0){i(void 0);return}o(`loading`);try{let e=await fetch(`/agents/${encodeURIComponent(t)}/tools`);if(!e.ok)throw Error(`Tools failed with HTTP ${e.status}`);i(await e.json())}catch(t){e.onError(s(t)),i(void 0)}finally{o(`idle`)}},[e.enabled,e.onError]);return(0,_.useEffect)(()=>{e.active&&c(t||e.selectedAgentId)},[e.active,c,e.selectedAgentId,t]),(0,R.jsx)(bm,{agents:e.agents,selectedAgentId:t||e.selectedAgentId,summary:r,enabled:e.enabled,loading:a===`loading`,onSelectAgent:e=>{n(e),c(e)}})}function xh(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)(`idle`),c=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0){i(void 0);return}o(`loading`);try{let e=await fetch(`/agents/${encodeURIComponent(t)}/mcps`);if(!e.ok)throw Error(`MCPs failed with HTTP ${e.status}`);i(await e.json())}catch(t){e.onError(s(t)),i(void 0)}finally{o(`idle`)}},[e.enabled,e.onError]);return(0,_.useEffect)(()=>{e.active&&c(t||e.selectedAgentId)},[e.active,c,t,e.selectedAgentId]),(0,R.jsx)(mm,{agents:e.agents,selectedAgentId:t||e.selectedAgentId,summary:r,enabled:e.enabled,loading:a===`loading`,onSelectAgent:e=>{n(e),c(e)}})}function Sh(e){let[t,n]=(0,_.useState)(),[r,i]=(0,_.useState)(`idle`),a=(0,_.useCallback)(async()=>{if(!e.enabled){n(void 0);return}i(`loading`);try{let e=await fetch(`/knowledge?limit=25`);if(!e.ok)throw Error(`Knowledge failed with HTTP ${e.status}`);n(await e.json())}catch(t){e.onError(s(t))}finally{i(`idle`)}},[e.enabled,e.onError]);return(0,_.useEffect)(()=>{e.active&&a()},[e.active,a]),(0,R.jsx)(pm,{activeTab:e.activeTab,enabled:e.enabled,summary:t,loading:r===`loading`,onOpenTrace:e.onOpenTrace,onRefresh:()=>void a(),onSelectTab:e.onSelectTab})}function Ch(){let e=hh(`knowledge`),{setKnowledgeTab:t}=e,n=gh(nr({strict:!1}).tab);return(0,_.useEffect)(()=>{t(n)},[t,n]),(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(Sh,{active:!0,activeTab:n,enabled:e.knowledgeEnabled,onError:e.setError,onOpenTrace:e.traces.selectTrace,onSelectTab:e.navigateKnowledgeTab})})}function wh(){let e=hh(`mcps`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(xh,{active:!0,agents:e.agents,enabled:e.mcpsEnabled,selectedAgentId:e.selectedAgent?.id||e.selectedAgentId,onError:e.setError})})}function Th(){let e=hh(`memory`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(hm,{agents:e.agents,enabled:e.memoryEnabled})})}function Eh(e){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(),[a,o]=(0,_.useState)([]),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(`"Hello from Studio"`),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(`idle`),[y,b]=(0,_.useState)(`idle`),[x,S]=(0,_.useState)(`idle`),[C,w]=(0,_.useState)(`idle`),T=(0,_.useRef)(0),E=(0,_.useRef)(0),D=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0)return E.current+=1,o([]),[];let n=E.current+1;E.current=n,b(`loading`);try{let e=new URLSearchParams({limit:`1000`}),r=await fetch(`/pipelines/${encodeURIComponent(t)}/logs?${e}`);if(!r.ok)throw Error(`Pipeline logs failed with HTTP ${r.status}`);let i=await r.json();return E.current===n&&o(i.logs),i.logs}catch(t){return E.current===n&&(e.onError(s(t)),o([])),[]}finally{E.current===n&&b(`idle`)}},[e.enabled,e.onError]),O=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0)return l([]),[];S(`loading`);try{let e=new URLSearchParams({limit:`50`}),n=await fetch(`/pipelines/${encodeURIComponent(t)}/runs?${e}`);if(!n.ok)throw Error(`Pipeline runs failed with HTTP ${n.status}`);let r=await n.json();return l(r.runs),r.runs}catch(t){return e.onError(s(t)),l([]),[]}finally{S(`idle`)}},[e.enabled,e.onError]),k=(0,_.useCallback)(async t=>{if(!e.enabled||t.length===0){T.current+=1,i(void 0),o([]),l([]);return}let r=T.current+1;T.current=r,v(`loading`),e.onError(``);try{let e=await fetch(`/pipelines/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`Pipeline load failed with HTTP ${e.status}`);let a=await e.json();if(T.current!==r)return;n(t),i(a),await Promise.all([D(t),O(t)])}catch(t){T.current===r&&(e.onError(s(t)),i(void 0))}finally{T.current===r&&v(`idle`)}},[D,O,e.enabled,e.onError]);(0,_.useEffect)(()=>{if(!e.active)return;let n=t||e.pipelines[0]?.id||``;n.length>0&&k(n)},[e.active,e.pipelines,k,t]);async function A(e){await jp(e,async e=>{if(qr(e)){e.log.runId!==void 0&&h(t=>t||e.log.runId||``),ne(e.log),await Mp();return}if(Jr(e)){p(Dh(e.output)),await Mp();return}if(Yr(e))throw Error(JSON.stringify(e.error))})}async function ee(){let n=t||e.pipelines[0]?.id||``;if(n.length===0||C===`running`)return;let r;try{r=JSON.parse(u)}catch{e.onError(`Pipeline input must be valid JSON`);return}w(`running`),p(``),h(``),e.onError(``);try{let t=await fetch(`/pipelines/${encodeURIComponent(n)}/runs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({input:r,stream:!0,metadata:{source:`anvia-studio`}})});if(!t.ok||t.body===null)throw Error(await gp(t,`Pipeline run failed`));await A(t.body),await Promise.all([D(n),O(n)]),e.onStatus(`Connected`)}catch(t){e.onError(s(t))}finally{w(`idle`)}}async function j(n){let r=t||e.pipelines[0]?.id||``;if(!(r.length===0||n.length===0||C===`running`)){w(`running`),p(``),h(``),e.onError(``);try{let t=await fetch(`/pipelines/${encodeURIComponent(r)}/runs/${encodeURIComponent(n)}/replay`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({stream:!0,metadata:{source:`anvia-studio`}})});if(!t.ok||t.body===null)throw Error(await gp(t,`Pipeline replay failed`));await A(t.body),await Promise.all([D(r),O(r)]),e.onStatus(`Connected`)}catch(t){e.onError(s(t))}finally{w(`idle`)}}}function te(e){n(e),p(``),h(``),k(e)}function ne(e){o(t=>t.some(t=>t.id===e.id)?t:[...t,e].sort((e,t)=>e.sequence-t.sequence))}return{selectedPipelineId:t,pipelineDetail:r,pipelineLogs:a,pipelineRuns:c,activePipelineRunId:m,pipelineRunInput:u,pipelineRunOutput:f,pipelineDetailLoadState:g,pipelineLogLoadState:y,pipelineRunLoadState:x,pipelineRunState:C,setPipelineRunInput:d,selectPipeline:te,runPipeline:ee,replayPipelineRun:j}}function Dh(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function Oh(e){let t=Eh({active:e.active,enabled:e.enabled,pipelines:e.pipelines,onError:e.onError,onStatus:e.onStatus});return(0,R.jsx)(gm,{pipelines:e.pipelines,selectedPipelineId:t.selectedPipelineId,detail:t.pipelineDetail,logs:t.pipelineLogs,activeRunId:t.activePipelineRunId,runs:t.pipelineRuns,enabled:e.enabled,detailLoading:t.pipelineDetailLoadState===`loading`,logsLoading:t.pipelineLogLoadState===`loading`,runsLoading:t.pipelineRunLoadState===`loading`,runState:t.pipelineRunState,runInput:t.pipelineRunInput,runOutput:t.pipelineRunOutput,theme:e.theme,activeTab:e.activeTab,onSelectPipeline:t.selectPipeline,onRunInputChange:t.setPipelineRunInput,onRun:()=>void t.runPipeline(),onTabChange:e.onTabChange,onReplayRun:e=>void t.replayPipelineRun(e)})}function kh(){let e=hh(`pipelines`),[t,n]=(0,_.useState)(()=>Ah());(0,_.useEffect)(()=>{function e(){n(Ah())}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let r=(0,_.useCallback)(e=>{n(e);let t=new URL(window.location.href);t.searchParams.set(`tab`,e);let r=`${t.pathname}${t.search}${t.hash}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==r&&window.history.pushState(null,``,r)},[]);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(Oh,{active:!0,activeTab:t,pipelines:e.pipelines,enabled:e.pipelinesEnabled,theme:e.theme,onError:e.setError,onStatus:e.setStatus,onTabChange:r})})}function Ah(){return jh(window.location.search)}function jh(e){let t=new URLSearchParams(e).get(`tab`);return t===`metadata`||t===`runs`||t===`logs`?t:`input`}function Mh(e,[t,n]){return Math.min(n,Math.max(t,e))}typeof window<`u`&&window.document&&window.document.createElement;function Nh(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Ph(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,R.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Fh(i,...t)]}function Fh(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Ih(e){let t=e+`CollectionProvider`,[n,r]=Ph(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Gm(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,R.jsx)(c,{ref:Wm(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Gm(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=Wm(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Lh=_.createContext(void 0);function Rh(e){let t=_.useContext(Lh);return e||t||`ltr`}var zh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Gm(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,R.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Bh(e,t){e&&sr.flushSync(()=>e.dispatchEvent(t))}function Vh(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>((...e)=>t.current?.(...e)),[])}function Hh(e,t=globalThis?.document){let n=Vh(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Uh=`DismissableLayer`,Wh=`dismissableLayer.update`,Gh=`dismissableLayer.pointerDownOutside`,Kh=`dismissableLayer.focusOutside`,qh,Jh=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Yh=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=_.useContext(Jh),[d,f]=_.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=_.useState({}),h=Wm(t,e=>f(e)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(v),b=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=_.useRef(!1),w=$h(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!S||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces}),T=eg(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p);return Hh(e=>{b===u.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),_.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(qh=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tg(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=qh))}},[d,p,n,u]),_.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tg())},[d,u]),_.useEffect(()=>{let e=()=>m({});return document.addEventListener(Wh,e),()=>document.removeEventListener(Wh,e)},[]),(0,R.jsx)(zh.div,{...l,ref:h,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:Nh(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Nh(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Nh(e.onPointerDownCapture,w.onPointerDownCapture)})});Yh.displayName=Uh;var Xh=`DismissableLayerBranch`,Zh=_.forwardRef((e,t)=>{let n=_.useContext(Jh),r=_.useRef(null),i=Wm(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,R.jsx)(zh.div,{...e,ref:i})});Zh.displayName=Xh;function Qh(){let e=_.useContext(Jh),[t,n]=_.useState(null);return _.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function $h(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=Vh(e),s=_.useRef(!1),c=_.useRef(!1),l=_.useRef(new Map),u=_.useRef(()=>{});return _.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||ng(Gh,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function eg(e,t=globalThis?.document){let n=Vh(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&ng(Kh,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tg(){let e=new CustomEvent(Wh);document.dispatchEvent(e)}function ng(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Bh(i,a):i.dispatchEvent(a)}var rg=0,ig=null;function ag(){_.useEffect(()=>{ig||={start:og(),end:og()};let{start:e,end:t}=ig;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),rg++,()=>{rg===1&&(ig?.start.remove(),ig?.end.remove(),ig=null),rg=Math.max(0,rg-1)}},[])}function og(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var sg=`focusScope.autoFocusOnMount`,cg=`focusScope.autoFocusOnUnmount`,lg={bubbles:!1,cancelable:!0},ug=`FocusScope`,dg=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Vh(i),u=Vh(a),d=_.useRef(null),f=Wm(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:vg(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||vg(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&vg(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){yg.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(sg,lg);s.addEventListener(sg,l),s.dispatchEvent(t),t.defaultPrevented||(fg(Sg(mg(s)),{select:!0}),document.activeElement===e&&vg(s))}return()=>{s.removeEventListener(sg,l),setTimeout(()=>{let t=new CustomEvent(cg,lg);s.addEventListener(cg,u),s.dispatchEvent(t),t.defaultPrevented||vg(e??document.body,{select:!0}),s.removeEventListener(cg,u),yg.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=pg(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&vg(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&vg(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,R.jsx)(zh.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});dg.displayName=ug;function fg(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(vg(r,{select:t}),document.activeElement!==n)return}function pg(e){let t=mg(e);return[hg(t,e),hg(t.reverse(),e)]}function mg(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hg(e,t){for(let n of e)if(!gg(n,{upTo:t}))return n}function gg(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function _g(e){return e instanceof HTMLInputElement&&`select`in e}function vg(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_g(e)&&t&&e.select()}}var yg=bg();function bg(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=xg(e,t),e.unshift(t)},remove(t){e=xg(e,t),e[0]?.resume()}}}function xg(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Sg(e){return e.filter(e=>e.tagName!==`A`)}var Cg=globalThis?.document?_.useLayoutEffect:()=>{},wg=_.useId||(()=>void 0),Tg=0;function Eg(e){let[t,n]=_.useState(wg());return Cg(()=>{e||n(e=>e??String(Tg++))},[e]),e||(t?`radix-${t}`:``)}var Dg=[`top`,`right`,`bottom`,`left`],Og=Math.min,kg=Math.max,Ag=Math.round,jg=Math.floor,Mg=e=>({x:e,y:e}),Ng={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Pg(e,t,n){return kg(e,Og(t,n))}function Fg(e,t){return typeof e==`function`?e(t):e}function Ig(e){return e.split(`-`)[0]}function Lg(e){return e.split(`-`)[1]}function Rg(e){return e===`x`?`y`:`x`}function zg(e){return e===`y`?`height`:`width`}function Bg(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Vg(e){return Rg(Bg(e))}function Hg(e,t,n){n===void 0&&(n=!1);let r=Lg(e),i=Vg(e),a=zg(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Zg(o)),[o,Zg(o)]}function Ug(e){let t=Zg(e);return[Wg(e),t,Wg(t)]}function Wg(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Gg=[`left`,`right`],Kg=[`right`,`left`],qg=[`top`,`bottom`],Jg=[`bottom`,`top`];function Yg(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Kg:Gg:t?Gg:Kg;case`left`:case`right`:return t?qg:Jg;default:return[]}}function Xg(e,t,n,r){let i=Lg(e),a=Yg(Ig(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Wg)))),a}function Zg(e){let t=Ig(e);return Ng[t]+e.slice(t.length)}function Qg(e){return{top:0,right:0,bottom:0,left:0,...e}}function $g(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Qg(e)}function e_(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function t_(e,t,n){let{reference:r,floating:i}=e,a=Bg(t),o=Vg(t),s=zg(o),c=Ig(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Lg(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function n_(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Fg(t,e),p=$g(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=e_(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=e_(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var r_=50,i_=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:n_},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=t_(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<r_&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=t_(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},a_=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Fg(e,t)||{};if(l==null)return{};let d=$g(u),f={x:n,y:r},p=Vg(i),m=zg(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Og(d[_],T),D=Og(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,ee=Pg(O,A,k),j=!c.arrow&&Lg(i)!=null&&A!==ee&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,te=j?A<O?A-O:A-k:0;return{[p]:f[p]+te,data:{[p]:ee,centerOffset:A-ee-te,...j&&{alignmentOffset:te}},reset:j}}}),o_=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Fg(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ig(r),_=Bg(o),v=Ig(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Zg(o)]:Ug(o)),x=p!==`none`;!d&&x&&b.push(...Xg(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Hg(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Bg(t))||T.every(e=>Bg(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Bg(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function s_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function c_(e){return Dg.some(t=>e[t]>=0)}var l_=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Fg(e,t);switch(i){case`referenceHidden`:{let e=s_(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:c_(e)}}}case`escaped`:{let e=s_(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:c_(e)}}}default:return{}}}}},u_=new Set([`left`,`top`]);async function d_(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ig(n),s=Lg(n),c=Bg(n)===`y`,l=u_.has(o)?-1:1,u=a&&c?-1:1,d=Fg(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var f_=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await d_(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},p_=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Fg(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Bg(Ig(i)),p=Rg(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Pg(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Pg(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},m_=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Fg(e,t),u={x:n,y:r},d=Bg(i),f=Rg(d),p=u[f],m=u[d],h=Fg(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=u_.has(Ig(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},h_=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Fg(e,t),u=await o.detectOverflow(t,l),d=Ig(i),f=Lg(i),p=Bg(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Og(h-u[g],v),x=Og(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=kg(u.left,0),t=kg(u.right,0),n=kg(u.top,0),r=kg(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:kg(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:kg(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function g_(){return typeof window<`u`}function __(e){return b_(e)?(e.nodeName||``).toLowerCase():`#document`}function v_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function y_(e){return((b_(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function b_(e){return g_()?e instanceof Node||e instanceof v_(e).Node:!1}function x_(e){return g_()?e instanceof Element||e instanceof v_(e).Element:!1}function S_(e){return g_()?e instanceof HTMLElement||e instanceof v_(e).HTMLElement:!1}function C_(e){return!g_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof v_(e).ShadowRoot}function w_(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=F_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function T_(e){return/^(table|td|th)$/.test(__(e))}function E_(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var D_=/transform|translate|scale|rotate|perspective|filter/,O_=/paint|layout|strict|content/,k_=e=>!!e&&e!==`none`,A_;function j_(e){let t=x_(e)?F_(e):e;return k_(t.transform)||k_(t.translate)||k_(t.scale)||k_(t.rotate)||k_(t.perspective)||!N_()&&(k_(t.backdropFilter)||k_(t.filter))||D_.test(t.willChange||``)||O_.test(t.contain||``)}function M_(e){let t=L_(e);for(;S_(t)&&!P_(t);){if(j_(t))return t;if(E_(t))return null;t=L_(t)}return null}function N_(){return A_??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),A_}function P_(e){return/^(html|body|#document)$/.test(__(e))}function F_(e){return v_(e).getComputedStyle(e)}function I_(e){return x_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function L_(e){if(__(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||C_(e)&&e.host||y_(e);return C_(t)?t.host:t}function R_(e){let t=L_(e);return P_(t)?e.ownerDocument?e.ownerDocument.body:e.body:S_(t)&&w_(t)?t:R_(t)}function z_(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=R_(e),i=r===e.ownerDocument?.body,a=v_(r);if(i){let e=B_(a);return t.concat(a,a.visualViewport||[],w_(r)?r:[],e&&n?z_(e):[])}else return t.concat(r,z_(r,[],n))}function B_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function V_(e){let t=F_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=S_(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ag(n)!==a||Ag(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function H_(e){return x_(e)?e:e.contextElement}function U_(e){let t=H_(e);if(!S_(t))return Mg(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=V_(t),o=(a?Ag(n.width):n.width)/r,s=(a?Ag(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var W_=Mg(0);function G_(e){let t=v_(e);return!N_()||!t.visualViewport?W_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function K_(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==v_(e)?!1:t}function q_(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=H_(e),o=Mg(1);t&&(r?x_(r)&&(o=U_(r)):o=U_(e));let s=K_(a,n,r)?G_(a):Mg(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=v_(a),t=r&&x_(r)?v_(r):r,n=e,i=B_(n);for(;i&&r&&t!==n;){let e=U_(i),t=i.getBoundingClientRect(),r=F_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=v_(i),i=B_(n)}}return e_({width:u,height:d,x:c,y:l})}function J_(e,t){let n=I_(e).scrollLeft;return t?t.left+n:q_(y_(e)).left+n}function Y_(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-J_(e,n),y:n.top+t.scrollTop}}function X_(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=y_(r),s=t?E_(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Mg(1),u=Mg(0),d=S_(r);if((d||!d&&!a)&&((__(r)!==`body`||w_(o))&&(c=I_(r)),d)){let e=q_(r);l=U_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Y_(o,c):Mg(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Z_(e){return Array.from(e.getClientRects())}function Q_(e){let t=y_(e),n=I_(e),r=e.ownerDocument.body,i=kg(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=kg(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+J_(e),s=-n.scrollTop;return F_(r).direction===`rtl`&&(o+=kg(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var $_=25;function ev(e,t){let n=v_(e),r=y_(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=N_();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=J_(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=$_&&(a-=o)}else l<=$_&&(a+=l);return{width:a,height:o,x:s,y:c}}function tv(e,t){let n=q_(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=S_(e)?U_(e):Mg(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function nv(e,t,n){let r;if(t===`viewport`)r=ev(e,n);else if(t===`document`)r=Q_(y_(e));else if(x_(t))r=tv(t,n);else{let n=G_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return e_(r)}function rv(e,t){let n=L_(e);return n===t||!x_(n)||P_(n)?!1:F_(n).position===`fixed`||rv(n,t)}function iv(e,t){let n=t.get(e);if(n)return n;let r=z_(e,[],!1).filter(e=>x_(e)&&__(e)!==`body`),i=null,a=F_(e).position===`fixed`,o=a?L_(e):e;for(;x_(o)&&!P_(o);){let t=F_(o),n=j_(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||w_(o)&&!n&&rv(e,o))?r=r.filter(e=>e!==o):i=t,o=L_(o)}return t.set(e,r),r}function av(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?E_(t)?[]:iv(t,this._c):[].concat(n),r],o=nv(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=nv(t,a[e],i);s=kg(n.top,s),c=Og(n.right,c),l=Og(n.bottom,l),u=kg(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ov(e){let{width:t,height:n}=V_(e);return{width:t,height:n}}function sv(e,t,n){let r=S_(t),i=y_(t),a=n===`fixed`,o=q_(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Mg(0);function l(){c.x=J_(i)}if(r||!r&&!a)if((__(t)!==`body`||w_(i))&&(s=I_(t)),r){let e=q_(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Y_(i,s):Mg(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function cv(e){return F_(e).position===`static`}function lv(e,t){if(!S_(e)||F_(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return y_(e)===n&&(n=n.ownerDocument.body),n}function uv(e,t){let n=v_(e);if(E_(e))return n;if(!S_(e)){let t=L_(e);for(;t&&!P_(t);){if(x_(t)&&!cv(t))return t;t=L_(t)}return n}let r=lv(e,t);for(;r&&T_(r)&&cv(r);)r=lv(r,t);return r&&P_(r)&&cv(r)&&!j_(r)?n:r||M_(e)||n}var dv=async function(e){let t=this.getOffsetParent||uv,n=this.getDimensions,r=await n(e.floating);return{reference:sv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fv(e){return F_(e).direction===`rtl`}var pv={convertOffsetParentRelativeRectToViewportRelativeRect:X_,getDocumentElement:y_,getClippingRect:av,getOffsetParent:uv,getElementRects:dv,getClientRects:Z_,getDimensions:ov,getScale:U_,isElement:x_,isRTL:fv};function mv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hv(e,t){let n=null,r,i=y_(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=jg(d),h=jg(i.clientWidth-(u+f)),g=jg(i.clientHeight-(d+p)),_=jg(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:kg(0,Og(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!mv(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function gv(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=H_(e),u=i||a?[...l?z_(l):[],...t?z_(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?hv(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?q_(e):null;c&&g();function g(){let t=q_(e);h&&!mv(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var _v=f_,vv=p_,yv=o_,bv=h_,xv=l_,Sv=a_,Cv=m_,wv=(e,t,n)=>{let r=new Map,i={platform:pv,...n},a={...i.platform,_c:r};return i_(e,t,{...i,platform:a})},Tv=typeof document<`u`?_.useLayoutEffect:function(){};function Ev(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ev(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ev(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Dv(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ov(e,t){let n=Dv(e);return Math.round(t*n)/n}function kv(e){let t=_.useRef(e);return Tv(()=>{t.current=e}),t}function Av(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Ev(f,r)||p(r);let[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=_.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||g,C=_.useRef(null),w=_.useRef(null),T=_.useRef(u),E=c!=null,D=kv(c),O=kv(i),k=kv(l),A=_.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),wv(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};ee.current&&!Ev(T.current,t)&&(T.current=t,sr.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Tv(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=_.useRef(!1);Tv(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Tv(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let j=_.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),te=_.useMemo(()=>({reference:x,floating:S}),[x,S]),ne=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Ov(te.floating,u.x),r=Ov(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Dv(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:A,refs:j,elements:te,floatingStyles:ne}),[u,A,j,te,ne])}var jv=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Sv({element:r.current,padding:i}).fn(n):r?Sv({element:r,padding:i}).fn(n):{}}}},Mv=(e,t)=>{let n=_v(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nv=(e,t)=>{let n=vv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pv=(e,t)=>({fn:Cv(e).fn,options:[e,t]}),Fv=(e,t)=>{let n=yv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iv=(e,t)=>{let n=bv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lv=(e,t)=>{let n=xv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rv=(e,t)=>{let n=jv(e);return{name:n.name,fn:n.fn,options:[e,t]}},zv=`Arrow`,Bv=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,R.jsx)(zh.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,R.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Bv.displayName=zv;var Vv=Bv;function Hv(e){let[t,n]=_.useState(void 0);return Cg(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Uv=`Popper`,[Wv,Gv]=Ph(Uv),[Kv,qv]=Wv(Uv),Jv=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null),[a,o]=_.useState(void 0);return(0,R.jsx)(Kv,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Jv.displayName=Uv;var Yv=`PopperAnchor`,Xv=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=qv(Yv,n),o=_.useRef(null),s=a.onAnchorChange,c=Wm(t,_.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=_.useRef(null);_.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&oy(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(zh.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});Xv.displayName=Yv;var Zv=`PopperContent`,[Qv,$v]=Wv(Zv),ey=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=qv(Zv,n),[v,y]=_.useState(null),b=Wm(t,e=>y(e)),[x,S]=_.useState(null),C=Hv(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(iy),altBoundary:k},{refs:ee,floatingStyles:j,placement:te,isPositioned:ne,middlewareData:M}=Av({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>gv(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Mv({mainAxis:i+T,alignmentAxis:o}),c&&Nv({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Pv():void 0,...A}),c&&Fv({...A}),Iv({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Rv({element:x,padding:s}),ay({arrowWidth:w,arrowHeight:T}),f&&Lv({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),N=g.setPlacementState;Cg(()=>(N(te),()=>{N(void 0)}),[te,N]);let[P,re]=oy(te),ie=Vh(m);Cg(()=>{ne&&ie?.()},[ne,ie]);let ae=M.arrow?.x,oe=M.arrow?.y,F=M.arrow?.centerOffset!==0,[I,se]=_.useState();return Cg(()=>{v&&se(window.getComputedStyle(v).zIndex)},[v]),(0,R.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:ne?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(Qv,{scope:n,placedSide:P,placedAlign:re,onArrowChange:S,arrowX:ae,arrowY:oe,shouldHideArrow:F,children:(0,R.jsx)(zh.div,{"data-side":P,"data-align":re,...h,ref:b,style:{...h.style,animation:ne?void 0:`none`}})})})});ey.displayName=Zv;var ty=`PopperArrow`,ny={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ry=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=$v(ty,n),a=ny[i.placedSide];return(0,R.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,R.jsx)(Vv,{...r,ref:t,style:{...r.style,display:`block`}})})});ry.displayName=ty;function iy(e){return e!==null}var ay=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=oy(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function oy(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var sy=Jv,cy=Xv,ly=ey,uy=ry,dy=`Portal`,fy=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);Cg(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?sr.createPortal((0,R.jsx)(zh.div,{...r,ref:t}),o):null});fy.displayName=dy;function py(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var my=e=>{let{present:t,children:n}=e,r=hy(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=_y(r.ref,yy(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};my.displayName=`Presence`;function hy(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=py(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=vy(r.current);a.current=o===`mounted`?e:`none`},[o]),Cg(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=vy(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Cg(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=vy(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=vy(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function gy(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function _y(...e){let t=_.useRef(e);return t.current=e,_.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=gy(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():gy(n[e],null)}}},[])}function vy(e){return e?.animationName||`none`}function yy(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var by=_.useInsertionEffect||Cg;function xy({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Sy({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=Cy(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Sy({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return by(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Cy(e){return typeof e==`function`}function wy(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ty=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Ey=`VisuallyHidden`,Dy=_.forwardRef((e,t)=>(0,R.jsx)(zh.span,{...e,ref:t,style:{...Ty,...e.style}}));Dy.displayName=Ey;var Oy=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ky=new WeakMap,Ay=new WeakMap,jy={},My=0,Ny=function(e){return e&&(e.host||Ny(e.parentNode))},Py=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ny(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Fy=function(e,t,n,r){var i=Py(t,Array.isArray(e)?e:[e]);jy[n]||(jy[n]=new WeakMap);var a=jy[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ky.get(e)||0)+1,l=(a.get(e)||0)+1;ky.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ay.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),My++,function(){o.forEach(function(e){var t=ky.get(e)-1,i=a.get(e)-1;ky.set(e,t),a.set(e,i),t||(Ay.has(e)||e.removeAttribute(r),Ay.delete(e)),i||e.removeAttribute(n)}),My--,My||(ky=new WeakMap,ky=new WeakMap,Ay=new WeakMap,jy={})}},Iy=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Oy(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Fy(r,i,n,`aria-hidden`)):function(){return null}},Ly=function(){return Ly=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ly.apply(this,arguments)};function Ry(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function zy(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var By=`right-scroll-bar-position`,Vy=`width-before-scroll-bar`,Hy=`with-scroll-bars-hidden`,Uy=`--removed-body-scroll-bar-size`;function Wy(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Gy(e,t){var n=(0,_.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ky=typeof window<`u`?_.useLayoutEffect:_.useEffect,qy=new WeakMap;function Jy(e,t){var n=Gy(t||null,function(t){return e.forEach(function(e){return Wy(e,t)})});return Ky(function(){var t=qy.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Wy(e,null)}),i.forEach(function(e){r.has(e)||Wy(e,a)})}qy.set(n,e)},[e]),n}function Yy(e){return e}function Xy(e,t){t===void 0&&(t=Yy);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Zy(e){e===void 0&&(e={});var t=Xy(null);return t.options=Ly({async:!0,ssr:!1},e),t}var Qy=function(e){var t=e.sideCar,n=Ry(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return _.createElement(r,Ly({},n))};Qy.isSideCarExport=!0;function $y(e,t){return e.useMedium(t),Qy}var eb=Zy(),tb=function(){},nb=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:tb,onWheelCapture:tb,onTouchMoveCapture:tb}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Ry(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Jy([n,t]),w=Ly(Ly({},x),i);return _.createElement(_.Fragment,null,u&&_.createElement(S,{sideCar:eb,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?_.cloneElement(_.Children.only(s),Ly(Ly({},w),{ref:C})):_.createElement(y,Ly({},w,{className:c,ref:C}),s))});nb.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nb.classNames={fullWidth:Vy,zeroRight:By};var rb,ib=function(){if(rb)return rb;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ab(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ib();return t&&e.setAttribute(`nonce`,t),e}function ob(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sb(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var cb=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ab())&&(ob(t,n),sb(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lb=function(){var e=cb();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ub=function(){var e=lb();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},db={left:0,top:0,right:0,gap:0},fb=function(e){return parseInt(e||``,10)||0},pb=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[fb(n),fb(r),fb(i)]},mb=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return db;var t=pb(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hb=ub(),gb=`data-scroll-locked`,_b=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
114
|
+
.${Hy} {
|
|
115
115
|
overflow: hidden ${r};
|
|
116
116
|
padding-right: ${s}px ${r};
|
|
117
117
|
}
|
|
118
|
-
body[${
|
|
118
|
+
body[${gb}] {
|
|
119
119
|
overflow: hidden ${r};
|
|
120
120
|
overscroll-behavior: contain;
|
|
121
121
|
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
@@ -128,27 +128,27 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
128
128
|
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
.${
|
|
131
|
+
.${By} {
|
|
132
132
|
right: ${s}px ${r};
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
.${
|
|
135
|
+
.${Vy} {
|
|
136
136
|
margin-right: ${s}px ${r};
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.${
|
|
139
|
+
.${By} .${By} {
|
|
140
140
|
right: 0 ${r};
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
.${
|
|
143
|
+
.${Vy} .${Vy} {
|
|
144
144
|
margin-right: 0 ${r};
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
body[${
|
|
148
|
-
${
|
|
147
|
+
body[${gb}] {
|
|
148
|
+
${Uy}: ${s}px;
|
|
149
149
|
}
|
|
150
|
-
`},
|
|
150
|
+
`},vb=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},yb=function(){_.useEffect(function(){return document.body.setAttribute(gb,(vb()+1).toString()),function(){var e=vb()-1;e<=0?document.body.removeAttribute(gb):document.body.setAttribute(gb,e.toString())}},[])},bb=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;yb();var a=_.useMemo(function(){return mb(i)},[i]);return _.createElement(hb,{styles:_b(a,!t,i,n?``:`!important`)})},xb=!1;if(typeof window<`u`)try{var Sb=Object.defineProperty({},`passive`,{get:function(){return xb=!0,!0}});window.addEventListener(`test`,Sb,Sb),window.removeEventListener(`test`,Sb,Sb)}catch{xb=!1}var Cb=xb?{passive:!1}:!1,wb=function(e){return e.tagName===`TEXTAREA`},Tb=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!wb(e)&&n[t]===`visible`)},Eb=function(e){return Tb(e,`overflowY`)},Db=function(e){return Tb(e,`overflowX`)},Ob=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),jb(e,r)){var i=Mb(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kb=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ab=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},jb=function(e,t){return e===`v`?Eb(t):Db(t)},Mb=function(e,t){return e===`v`?kb(t):Ab(t)},Nb=function(e,t){return e===`h`&&t===`rtl`?-1:1},Pb=function(e,t,n,r,i){var a=Nb(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Mb(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&jb(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Fb=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ib=function(e){return[e.deltaX,e.deltaY]},Lb=function(e){return e&&`current`in e?e.current:e},Rb=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zb=function(e){return`
|
|
151
151
|
.block-interactivity-${e} {pointer-events: none;}
|
|
152
152
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
153
|
-
`},Lb=0,Rb=[];function zb(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(Lb++)[0],a=_.useState(sb)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Iy([e.lockRef.current],(e.shards||[]).map(Pb),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Mb(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Tb(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Tb(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return jb(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!Rb.length||Rb[Rb.length-1]!==a)){var r=`deltaY`in n?Nb(n):Mb(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Fb(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Pb).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Bb(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=Mb(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,Nb(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,Mb(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return Rb.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bb),document.addEventListener(`touchmove`,c,bb),document.addEventListener(`touchstart`,u,bb),function(){Rb=Rb.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bb),document.removeEventListener(`touchmove`,c,bb),document.removeEventListener(`touchstart`,u,bb)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:Ib(i)}):null,p?_.createElement(_b,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bb(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Vb=Xy(Zy,zb),Hb=_.forwardRef(function(e,t){return _.createElement($y,Py({},e,{ref:t,sideCar:Vb}))});Hb.classNames=$y.classNames;var Ub=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Wb=[` `,`Enter`],Gb=`Select`,[Kb,qb,Jb]=Nh(Gb),[Yb,Xb]=jh(Gb,[Jb,Hv]),Zb=Hv(),[Qb,$b]=Yb(Gb),[ex,tx]=Yb(Gb),nx=`SelectProvider`;function rx(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Zb(t),[v,y]=_.useState(null),[b,x]=_.useState(null),[S,C]=_.useState(!1),w=Fh(l),[T,E]=vy({prop:r,defaultProp:i??!1,onChange:a,caller:Gb}),[D,O]=vy({prop:o,defaultProp:s,onChange:c,caller:Gb}),k=_.useRef(null),A=v?!!m||!!v.closest(`form`):!0,[ee,j]=_.useState(new Set),te=Cg(),ne=Array.from(ee).map(e=>e.props.value).join(`;`),M=_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),N=_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),P={required:p,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:te,value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:ee,nativeSelectKey:ne,isFormControl:A};return(0,R.jsx)(iy,{...g,children:(0,R.jsx)(Qb,{scope:t,...P,children:(0,R.jsx)(Kb.Provider,{scope:t,children:(0,R.jsx)(ex,{scope:t,onNativeOptionAdd:M,onNativeOptionRemove:N,children:rS(h)?h(P):n})})})})}rx.displayName=nx;var ix=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,R.jsx)(rx,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[n,e?(0,R.jsx)(nS,{__scopeSelect:t}):null]})})};ix.displayName=Gb;var ax=`SelectTrigger`,ox=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Zb(n),o=$b(ax,n),s=o.disabled||r,c=Vm(t,o.onTriggerChange),l=qb(n),u=_.useRef(`touch`),[d,f,p]=aS(e=>{let t=l().filter(e=>!e.disabled),n=oS(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,R.jsx)(ay,{asChild:!0,...a,children:(0,R.jsx)(Ih.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":iS(o.value)?``:void 0,...i,ref:c,onClick:Ah(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:Ah(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:Ah(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Ub.includes(e.key)&&(m(),e.preventDefault())})})})});ox.displayName=ax;var sx=`SelectValue`,cx=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=$b(sx,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Vm(t,c.onValueNodeChange);bg(()=>{l(u)},[l,u]);let f=iS(c.value);return(0,R.jsx)(Ih.span,{...s,asChild:f?!1:s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,R.jsx)(_.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});cx.displayName=sx;var lx=`SelectIcon`,ux=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,R.jsx)(Ih.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ux.displayName=lx;var dx=`SelectPortal`,[fx,px]=Yb(dx,{forceMount:void 0}),mx=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,R.jsx)(fx,{scope:e.__scopeSelect,forceMount:n,children:(0,R.jsx)(ly,{asChild:!0,...r})})};mx.displayName=dx;var hx=`SelectContent`,gx=_.forwardRef((e,t)=>{let n=px(hx,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=$b(hx,e.__scopeSelect),[o,s]=_.useState();return bg(()=>{s(new DocumentFragment)},[]),(0,R.jsx)(dy,{present:r||a.open,children:({present:e})=>e?(0,R.jsx)(Cx,{...i,ref:t}):(0,R.jsx)(_x,{...i,fragment:o})})});gx.displayName=hx;var _x=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?sr.createPortal((0,R.jsx)(yx,{scope:n,children:(0,R.jsx)(Kb.Slot,{scope:n,children:(0,R.jsx)(`div`,{ref:t,children:r})})}),i):null});_x.displayName=`SelectContentFragment`;var vx=10,[yx,bx]=Yb(hx),xx=`SelectContentImpl`,Sx=Hm(`SelectContent.RemoveScroll`),Cx=_.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=$b(hx,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=Vm(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=qb(n),[A,ee]=_.useState(!1),j=_.useRef(!1);_.useEffect(()=>{if(b)return Ny(b)},[b]),ng();let te=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),ne=_.useCallback(()=>te([T,b]),[te,T,b]);_.useEffect(()=>{A&&ne()},[A,ne]);let{onOpenChange:M,triggerPointerDownPosRef:N}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,M,N]),_.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[P,re]=aS(e=>{let t=k().filter(e=>!e.disabled),n=oS(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=_.useCallback((e,t,n)=>{let r=!j.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(j.current=!0))},[y.value]),ae=_.useCallback(()=>b?.focus(),[b]),oe=_.useCallback((e,t,n)=>{let r=!j.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),F=r===`popper`?Dx:Tx,I=F===Dx?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,R.jsx)(yx,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ie,selectedItem:T,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:ne,selectedItemText:D,position:r,isPositioned:A,searchRef:P,children:(0,R.jsx)(Hb,{as:Sx,allowPinchZoom:!0,children:(0,R.jsx)(cg,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Ah(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(Kh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,R.jsx)(F,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...I,onPlaced:()=>ee(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:Ah(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>te(t)),e.preventDefault()}})})})})})})});Cx.displayName=xx;var wx=`SelectItemAlignedPosition`,Tx=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=$b(hx,n),o=bx(hx,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Vm(t,e=>u(e)),f=qb(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-vx,d=kh(a,[vx,Math.max(vx,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-vx,d=kh(a,[vx,Math.max(vx,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-vx*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-vx,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,ee=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${vx}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);bg(()=>b(),[b]);let[x,S]=_.useState();return bg(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,R.jsx)(Ox,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,R.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,R.jsx)(Ih.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Tx.displayName=wx;var Ex=`SelectPopperPosition`,Dx=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=vx,...a}=e,o=Zb(n);return(0,R.jsx)(oy,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Dx.displayName=Ex;var[Ox,kx]=Yb(hx,{}),Ax=`SelectViewport`,jx=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=bx(Ax,n),o=kx(Ax,n),s=Vm(t,a.onViewportChange),c=_.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,R.jsx)(Kb.Slot,{scope:n,children:(0,R.jsx)(Ih.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:Ah(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-vx*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});jx.displayName=Ax;var Mx=`SelectGroup`,[Nx,Px]=Yb(Mx),Fx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Cg();return(0,R.jsx)(Nx,{scope:n,id:i,children:(0,R.jsx)(Ih.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Fx.displayName=Mx;var Ix=`SelectLabel`,Lx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Px(Ix,n);return(0,R.jsx)(Ih.div,{id:i.id,...r,ref:t})});Lx.displayName=Ix;var Rx=`SelectItem`,[zx,Bx]=Yb(Rx),Vx=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=$b(Rx,n),c=bx(Rx,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=Vm(t,e=>c.itemRefCallback?.(e,r,i)),h=Cg(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,R.jsx)(zx,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(Kb.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,R.jsx)(Ih.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:Ah(o.onFocus,()=>p(!0)),onBlur:Ah(o.onBlur,()=>p(!1)),onClick:Ah(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:Ah(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:Ah(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:Ah(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ah(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Ah(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Wb.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});Vx.displayName=Rx;var Hx=`SelectItemText`,Ux=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=$b(Hx,n),s=bx(Hx,n),c=Bx(Hx,n),l=tx(Hx,n),[u,d]=_.useState(null),f=Vm(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,R.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return bg(()=>(h(m),()=>g(m)),[h,g,m]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ih.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!iS(o.value)?sr.createPortal(a.children,o.valueNode):null]})});Ux.displayName=Hx;var Wx=`SelectItemIndicator`,Gx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Bx(Wx,n).isSelected?(0,R.jsx)(Ih.span,{"aria-hidden":!0,...r,ref:t}):null});Gx.displayName=Wx;var Kx=`SelectScrollUpButton`,qx=_.forwardRef((e,t)=>{let n=bx(Kx,e.__scopeSelect),r=kx(Kx,e.__scopeSelect),[i,a]=_.useState(!1),o=Vm(t,r.onScrollButtonChange);return bg(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Xx,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});qx.displayName=Kx;var Jx=`SelectScrollDownButton`,Yx=_.forwardRef((e,t)=>{let n=bx(Jx,e.__scopeSelect),r=kx(Jx,e.__scopeSelect),[i,a]=_.useState(!1),o=Vm(t,r.onScrollButtonChange);return bg(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Xx,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Yx.displayName=Jx;var Xx=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=bx(`SelectScrollButton`,n),o=_.useRef(null),s=qb(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),bg(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,R.jsx)(Ih.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Ah(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Ah(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Ah(i.onPointerLeave,()=>{c()})})}),Zx=`SelectSeparator`,Qx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,R.jsx)(Ih.div,{"aria-hidden":!0,...r,ref:t})});Qx.displayName=Zx;var $x=`SelectArrow`,eS=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Zb(n);return bx($x,n).position===`popper`?(0,R.jsx)(sy,{...i,...r,ref:t}):null});eS.displayName=$x;var tS=`SelectBubbleInput`,nS=_.forwardRef(({__scopeSelect:e,...t},n)=>{let r=$b(tS,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=_.useRef(null),m=Vm(n,p),h=i??``,g=xy(h),v=Array.from(d).some(e=>(e.props.value??``)===``);return _.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,R.jsxs)(Ih.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Sy,...t.style},ref:m,defaultValue:h,children:[iS(i)&&!v?(0,R.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});nS.displayName=tS;function rS(e){return typeof e==`function`}function iS(e){return e===``||e===void 0}function aS(e){let t=Rh(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function oS(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=sS(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sS(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var cS=ix,lS=cx;function uS({className:e,children:t,...n}){return(0,R.jsxs)(ox,{className:a(`flex h-9 w-full items-center justify-between rounded-lg border border-input bg-card/90 px-3 text-sm text-foreground outline-none transition duration-200 hover:border-muted-foreground/45 focus:border-muted-foreground/60 focus:ring-2 focus:ring-muted-foreground/20 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:[t,(0,R.jsx)(ux,{asChild:!0,children:(0,R.jsx)(ah,{icon:Sm,className:`h-4 w-4 opacity-60`})})]})}function dS({className:e,children:t,position:n=`popper`,...r}){return(0,R.jsx)(mx,{children:(0,R.jsx)(gx,{position:n,className:a(`z-50 max-h-80 min-w-[8rem] overflow-hidden rounded-xl border border-border/90 bg-popover/98 text-popover-foreground shadow-xl shadow-black/45 backdrop-blur`,e),...r,children:(0,R.jsx)(jx,{className:`p-1`,children:t})})})}function fS({className:e,children:t,...n}){return(0,R.jsxs)(Vx,{className:a(`relative flex min-h-8 cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-sm outline-none transition data-[disabled]:pointer-events-none data-[highlighted]:bg-muted/65 data-[highlighted]:text-foreground data-[disabled]:opacity-50`,e),...n,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,R.jsx)(Gx,{children:(0,R.jsx)(ah,{icon:Dm,className:`h-4 w-4`})})}),(0,R.jsx)(Ux,{children:t})]})}function pS({className:e,...t}){return(0,R.jsx)(`section`,{className:a(`grid h-full min-h-0 min-w-0 max-h-full max-w-full overflow-hidden bg-background/45`,e),...t})}function mS({className:e,...t}){return(0,R.jsx)(`div`,{className:a(`min-h-0 min-w-0 overflow-hidden rounded-2xl border border-border/80 bg-card/70`,e),...t})}function hS(e){return(0,R.jsxs)(`div`,{className:a(`grid gap-1 rounded-xl border border-border/80 bg-card/45 p-4`,e.className),children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:e.label}),(0,R.jsx)(`span`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:e.value})]})}function gS(e){return(0,R.jsx)(`div`,{className:a(`grid min-h-80 place-items-center rounded-xl border border-dashed border-border/80 bg-card/35 px-6 text-center`,e.className),children:(0,R.jsxs)(`div`,{className:`grid max-w-md gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-base font-semibold text-foreground`,children:e.title}),(0,R.jsx)(`p`,{className:`m-0 text-sm leading-6 text-muted-foreground`,children:e.text})]})})}function _S({className:e,...t}){return(0,R.jsx)(`span`,{className:a(`inline-flex items-center rounded-lg border border-border/80 bg-muted/55 px-2 py-1 text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground`,e),...t})}function vS({className:e,...t}){return(0,R.jsx)(`div`,{className:a(`grid gap-1 rounded-xl border border-border/80 bg-background p-1`,e),...t})}function yS({className:e,...t}){return(0,R.jsx)(`textarea`,{className:a(`min-h-9 w-full resize-none rounded-lg border border-input bg-card/90 px-3 py-2.5 leading-6 text-foreground outline-none transition duration-200 placeholder:text-muted-foreground/65 focus:border-muted-foreground/60 focus:ring-2 focus:ring-muted-foreground/20`,e),...t})}function bS(e){let t=SS(e.metadata,e.limit),n=TS(e.metadata);return t.length===0&&!n?null:(0,R.jsxs)(`div`,{className:`grid min-w-0 gap-1 text-xs leading-5 text-muted-foreground`,children:[t.length===0?null:(0,R.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-x-2 gap-y-1`,children:t.map(e=>(0,R.jsxs)(`span`,{className:a(`min-w-0 break-words`,e.tone===`error`?`text-destructive/85`:`text-muted-foreground/85`),children:[(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.key,`=`]}),e.value]},e.key))}),n?(0,R.jsxs)(`details`,{className:`group min-w-0 rounded-lg border border-black/[0.06] bg-black/[0.03] px-2 py-1 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer select-none text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground transition group-open:text-foreground`,children:`Details`}),(0,R.jsx)(`pre`,{className:`m-0 mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs leading-4 text-muted-foreground`,children:ES(e.metadata)})]}):null]})}function xS(e,t){return SS(e,t).map(e=>`${e.key}=${e.value}`).join(` `)}function SS(e,t=6){return Object.entries(e??{}).map(([e,t])=>{let n=e===`error`?`error`:`default`;return{key:e,value:CS(e,t),tone:n}}).filter(e=>e.value.length>0).slice(0,t)}function CS(e,t){return t===null?`null`:typeof t==`string`||typeof t==`number`||typeof t==`boolean`?String(t):Array.isArray(t)?`[${t.length}]`:OS(t)?e===`error`?wS(t):DS(t):``}function wS(e){let t=typeof e.name==`string`&&e.name.length>0?e.name:void 0,n=typeof e.message==`string`&&e.message.length>0?e.message:void 0;return t!==void 0&&n!==void 0?`${t}: ${n}`:n===void 0?DS(e):n}function TS(e){return Object.values(e??{}).some(e=>Array.isArray(e)||OS(e))}function ES(e){if(e===void 0)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function DS(e){try{return JSON.stringify(e)}catch{return String(e)}}function OS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kS(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(!0);(0,_.useEffect)(()=>{let e=t.current;e===null||!n.current||(e.scrollTop=e.scrollHeight)});function r(){let e=t.current;e!==null&&(n.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)}return(0,R.jsxs)(`aside`,{className:`grid h-full min-h-0 min-w-0 max-h-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden bg-background/70 max-xl:hidden`,children:[(0,R.jsxs)(`header`,{className:`grid min-h-12 min-w-0 gap-1 py-3 pl-0 pr-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-sm font-semibold leading-tight text-foreground`,children:`Session logs`}),(0,R.jsx)(`span`,{className:` text-xs font-semibold tabular-nums text-muted-foreground`,children:e.logs.length})]}),(0,R.jsx)(`p`,{className:`m-0 truncate text-xs font-medium text-muted-foreground`,children:e.selectedSessionId.length===0?`No active session`:e.selectedSessionId})]}),(0,R.jsxs)(`div`,{className:`min-h-0 min-w-0 overflow-y-auto overflow-x-hidden`,ref:t,onScroll:r,children:[e.selectedSessionId.length===0?(0,R.jsx)(`div`,{className:`grid h-full min-h-80 place-items-center text-center text-sm font-medium text-muted-foreground`,children:`Start or open a session to view runtime logs.`}):null,e.selectedSessionId.length>0&&e.loading&&e.logs.length===0?(0,R.jsx)(`div`,{className:`py-3 pl-0 pr-2 text-sm font-medium text-muted-foreground`,children:`Loading logs`}):null,e.selectedSessionId.length>0&&!e.loading&&e.logs.length===0?(0,R.jsx)(`div`,{className:`py-3 pl-0 pr-2 text-sm font-medium text-muted-foreground`,children:`No logs yet`}):null,(0,R.jsx)(`div`,{className:`grid min-w-0 gap-1 py-2 pl-0 pr-2 `,children:e.logs.map(e=>(0,R.jsx)(AS,{log:e},e.id))})]})]})}function AS(e){let t=xS(e.log.metadata);return(0,R.jsxs)(`article`,{className:`grid min-w-0 gap-1 rounded-lg px-3 py-2 text-xs leading-5 transition duration-200 hover:bg-black/[0.04] dark:hover:bg-white/[0.04]`,title:[jS(e.log.timestamp),e.log.level.toUpperCase().padEnd(5,` `),e.log.message,`${e.log.category}/${e.log.event}`,t].filter(e=>e.trim().length>0).join(` `),children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,R.jsx)(`time`,{className:`shrink-0 text-muted-foreground`,children:jS(e.log.timestamp)}),(0,R.jsx)(`span`,{className:a(`shrink-0 font-semibold`,MS(e.log.level)),children:e.log.level.toUpperCase()}),(0,R.jsx)(`span`,{className:`min-w-0 break-words font-medium text-foreground`,children:e.log.message})]}),(0,R.jsxs)(`div`,{className:`min-w-0 break-words text-muted-foreground/80`,children:[e.log.category,`/`,e.log.event]}),(0,R.jsx)(bS,{metadata:e.log.metadata})]})}function jS(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function MS(e){switch(e){case`error`:return`text-destructive`;case`warn`:return`text-yellow-500`;case`debug`:return`text-muted-foreground`;case`info`:return`text-foreground`}}var NS=(0,_.lazy)(()=>sm(()=>import(`./transcript-item-DbtXMj-E.js`).then(e=>({default:e.TranscriptItem})),__vite__mapDeps([18,1,17,7,8,2])));function PS(e){return(0,R.jsxs)(pS,{className:`grid-cols-[minmax(0,1fr)_minmax(0,460px)] max-xl:grid-cols-1`,children:[(0,R.jsx)(`div`,{className:`grid min-h-0 min-w-0 pb-6 pr-6`,children:(0,R.jsxs)(mS,{className:`grid h-full grid-rows-[minmax(0,1fr)_auto] p-2`,children:[(0,R.jsx)(`section`,{className:`min-h-0 overflow-y-auto overflow-x-hidden px-4 py-4 [scrollbar-gutter:stable]`,ref:e.transcriptScrollerRef,onScroll:e.onTranscriptScroll,children:(0,R.jsxs)(`div`,{className:`mx-auto grid min-h-full w-full max-w-235 content-start items-start gap-6 pb-8`,children:[e.hasMessages?null:(0,R.jsx)(`div`,{className:`grid min-h-96 place-items-center text-sm font-medium text-muted-foreground`,children:(0,R.jsxs)(`div`,{className:`grid max-w-xl gap-4 text-center`,children:[(0,R.jsx)(`div`,{className:`mx-auto h-px w-28 bg-muted/55`}),(0,R.jsx)(`h1`,{className:`m-0 text-4xl font-semibold leading-tight text-foreground text-balance`,children:`What should this agent work on?`}),(0,R.jsx)(`p`,{className:`m-0 text-base leading-7 text-muted-foreground text-pretty`,children:`Choose a prompt below or write a task. Studio will stream the response, tool calls, approvals, and trace data here.`})]})}),(0,R.jsx)(_.Suspense,{fallback:null,children:e.messages.map(t=>(0,R.jsx)(NS,{entry:t,decidingApprovals:e.decidingApprovals,answeringQuestions:e.answeringQuestions,onApprovalDecision:e.onApprovalDecision,onQuestionAnswer:e.onQuestionAnswer,onOpenTrace:e.onOpenTrace},t.entryId))})]})}),(0,R.jsxs)(`form`,{className:`grid gap-3 bg-gradient-to-t from-card via-card/95 to-card/0 px-4 pb-4 pt-2`,onSubmit:t=>{t.preventDefault(),e.onRunPrompt(e.prompt)},children:[e.hasMessages||e.selectedAgentQuickPrompts.length===0?null:(0,R.jsx)(`div`,{className:`mx-auto grid w-full max-w-235 grid-cols-3 gap-2 max-md:grid-cols-1`,children:e.selectedAgentQuickPrompts.map(t=>(0,R.jsx)(nh,{className:`h-auto min-h-16 justify-start whitespace-normal rounded-lg border border-border/80 bg-card/85 px-3 py-2.5 text-left text-sm font-medium leading-5 text-foreground shadow-sm hover:border-border/80 hover:bg-muted/45 hover:text-foreground`,type:`button`,variant:`ghost`,disabled:e.runState===`running`||e.selectedAgentId.length===0,onClick:()=>e.onRunPrompt(t),children:(0,R.jsx)(`span`,{className:`min-w-0 whitespace-normal wrap-break-words`,children:t})},t))}),(0,R.jsxs)(`div`,{className:`mx-auto grid w-full max-w-235 gap-2 rounded-xl border border-border/80 bg-card/95 p-2.5 backdrop-blur`,children:[(0,R.jsx)(yS,{className:`min-h-16 min-w-0 resize-none rounded-lg border-0 bg-transparent px-3 py-3 text-sm leading-7 text-foreground shadow-none outline-none ring-0 placeholder:text-muted-foreground/70 focus:border-transparent focus:ring-0`,ref:e.promptRef,rows:1,value:e.prompt,onChange:e.onPromptChange,onKeyDown:e.onPromptKeyDown,placeholder:`Ask anything...`}),e.attachments.length===0?null:(0,R.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 px-2`,children:e.attachments.map(t=>(0,R.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-lg border border-border/80 bg-muted/55 px-2 py-1 text-xs font-medium text-muted-foreground`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 truncate`,children:[t.kind===`image`?`Image`:`Doc`,` / `,t.name]}),(0,R.jsx)(nh,{"aria-label":`Remove ${t.name}`,className:`h-5 min-h-5 w-5 rounded-md border-0 bg-transparent p-0 text-muted-foreground shadow-none hover:bg-accent hover:text-foreground [&_svg]:h-3 [&_svg]:w-3`,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>e.onRemovePromptAttachment(t.id),children:(0,R.jsx)(ah,{icon:Tm,"aria-hidden":`true`})})]},t.id))}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`input`,{ref:e.attachmentInputRef,className:`hidden`,type:`file`,multiple:!0,accept:Kr,onChange:e.onAddPromptAttachments}),(0,R.jsx)(nh,{"aria-label":`Attach image or document`,className:`h-8 min-h-8 w-8 border-0 bg-transparent p-0 text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground`,size:`icon`,type:`button`,variant:`ghost`,disabled:e.runState===`running`,onClick:()=>e.attachmentInputRef.current?.click(),children:(0,R.jsx)(ah,{icon:wm,"aria-hidden":`true`})})]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.selectedAgentModels.length===0?null:(0,R.jsxs)(cS,{value:e.selectedModelRef,onValueChange:e.onSelectModel,disabled:e.runState===`running`,children:[(0,R.jsx)(uS,{"aria-label":`Select model`,className:`flex h-8 min-h-8 w-auto max-w-44 gap-2 border-0 bg-transparent px-2 py-1 text-xs font-medium text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground sm:max-w-72`,children:(0,R.jsx)(lS,{placeholder:`Model`})}),(0,R.jsx)(dS,{align:`end`,children:e.selectedAgentModels.map(e=>(0,R.jsx)(fS,{value:e.ref,children:ei(e)},e.ref))})]}),e.agents.length>1?(0,R.jsxs)(cS,{value:e.selectedAgent?.id??e.selectedAgentId,onValueChange:e.onSelectAgent,disabled:e.runState===`running`,children:[(0,R.jsx)(uS,{"aria-label":`Select agent`,className:`flex h-8 min-h-8 w-auto max-w-64 gap-2 border-0 bg-transparent px-2 py-1 text-xs font-medium text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground`,children:(0,R.jsx)(lS,{placeholder:`Agent`})}),(0,R.jsx)(dS,{align:`end`,children:e.agents.map(e=>(0,R.jsx)(fS,{value:e.id,children:e.name??e.id},e.id))})]}):null,(0,R.jsx)(nh,{"aria-label":e.runState===`running`?`Running`:`Send message`,className:`h-9 min-h-9 w-9 rounded-full border-white bg-white text-black hover:bg-white/90`,size:`icon`,type:`submit`,disabled:e.runState===`running`||e.selectedAgentId.length===0,children:(0,R.jsx)(ah,{icon:Cm})})]})]})]})]})]})}),(0,R.jsx)(kS,{logs:e.sessionLogs,selectedSessionId:e.selectedSessionId,loading:e.sessionLogLoadState===`loading`})]})}function FS(){let e=fh(`playground`),t=nr({strict:!1}).sessionId,n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(n.current!==t&&e.pageEnabled(`playground`)){if(e.runState===`running`){n.current=t;return}if(t===void 0){n.current=t,e.startNewChat({updatePath:!1});return}e.sessionsEnabled&&(n.current=t,t!==e.sessions.selectedSessionId&&e.sessions.loadSession(t,{updatePath:!1}))}},[t,e]),(0,R.jsx)(PS,{agents:e.agents,answeringQuestions:e.answeringQuestions,attachments:e.attachments,decidingApprovals:e.decidingApprovals,hasMessages:e.hasMessages,messages:e.messages,prompt:e.prompt,runState:e.runState,selectedAgent:e.selectedAgent,selectedAgentId:e.selectedAgentId,selectedAgentModels:e.selectedAgentModels,selectedAgentQuickPrompts:e.selectedAgentQuickPrompts,selectedModelRef:e.selectedModelRef,selectedSessionId:e.sessions.selectedSessionId,sessionLogLoadState:e.sessions.sessionLogLoadState,sessionLogs:e.sessions.sessionLogs,attachmentInputRef:e.attachmentInputRef,promptRef:e.promptRef,transcriptScrollerRef:e.transcriptScrollerRef,onAddPromptAttachments:e.addPromptAttachments,onApprovalDecision:e.decideToolApproval,onOpenTrace:e.traces.selectTrace,onPromptChange:e.updatePrompt,onPromptKeyDown:e.handlePromptKeyDown,onQuestionAnswer:e.answerToolQuestion,onRemovePromptAttachment:e.removePromptAttachment,onRunPrompt:e.runPrompt,onSelectAgent:e.selectPlaygroundAgent,onSelectModel:e.setSelectedModelRef,onTranscriptScroll:e.updateTranscriptStickiness})}function IS(){let e=fh(`sessions`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(mm,{agents:e.agents,sessions:e.sessions.allSessions,sessionsEnabled:e.sessionsEnabled,sessionLoadState:e.sessions.sessionLoadState,selectedSessionId:e.sessions.selectedSessionId,onOpenSession:t=>void e.sessions.loadSession(t),onViewSessionTracing:t=>void e.traces.showSessionTraces(t),onDeleteSession:e.setDeleteCandidate})})}function LS(){let e=fh(`status`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(gm,{enabled:e.statusEnabled})})}function RS(){let e=fh(`tools`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(_h,{active:!0,agents:e.agents,enabled:e.toolsEnabled,selectedAgentId:e.selectedAgent?.id||e.selectedAgentId,onError:e.setError})})}function zS(){let e=fh(`tracing`),t=nr({strict:!1}),n=(0,_.useRef)(``);return(0,_.useEffect)(()=>{let r=t.sessionId===void 0?`trace:${t.traceId??``}`:`session:${t.sessionId}`;if(n.current!==r&&e.pageEnabled(`tracing`)){if(n.current=r,t.sessionId!==void 0){e.traces.showSessionTraces(t.sessionId,{updatePath:!1});return}e.traces.setTraceLocation(t.traceId??``,void 0)}},[t.sessionId,t.traceId,e]),(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(ym,{}),children:(0,R.jsx)(vm,{agents:e.agents,traces:e.traces.traces,tracesEnabled:e.tracesEnabled,traceLoadState:e.traces.traceLoadState,selectedTraceId:e.traces.selectedTraceId,traceSessionDetailId:e.traces.traceSessionDetailId,onRefresh:()=>void e.traces.loadTraces(),onSelectTrace:e.traces.selectTrace,onShowSessionTraces:t=>void e.traces.showSessionTraces(t)})})}var BS=wr({component:dh}),VS=Sr({getParentRoute:()=>BS,path:`/`,component:()=>(0,R.jsx)(ar,{to:`/playground`,replace:!0})}),HS=Sr({getParentRoute:()=>BS,path:`playground`,component:FS}),US=Sr({getParentRoute:()=>BS,path:`playground/$sessionId`,component:FS}),WS=Sr({getParentRoute:()=>BS,path:`tracing`,component:zS}),GS=Sr({getParentRoute:()=>BS,path:`tracing/$traceId`,component:zS}),KS=Sr({getParentRoute:()=>BS,path:`tracing/sessions/$sessionId`,component:zS}),qS=Sr({getParentRoute:()=>BS,path:`sessions`,component:IS}),JS=Sr({getParentRoute:()=>BS,path:`agents`,component:mh}),YS=Sr({getParentRoute:()=>BS,path:`tools`,component:RS}),XS=Sr({getParentRoute:()=>BS,path:`mcps`,component:xh}),ZS=Sr({getParentRoute:()=>BS,path:`pipelines`,component:Eh}),QS=Sr({getParentRoute:()=>BS,path:`evals`,component:gh}),$S=Sr({getParentRoute:()=>BS,path:`knowledge`,component:bh}),eC=Sr({getParentRoute:()=>BS,path:`knowledge/$tab`,component:bh}),tC=Sr({getParentRoute:()=>BS,path:`memory`,component:Sh}),nC=Sr({getParentRoute:()=>BS,path:`status`,component:LS}),rC=Br({routeTree:BS.addChildren([VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC])});function iC(){let[e,t]=(0,_.useState)(),[n,r]=(0,_.useState)(``),i=jp(),{messages:a,setMessages:o,updateToolApproval:c,updateToolQuestion:l}=i,[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(`playground`),{theme:g,toggleTheme:v}=fi(),[y,b]=(0,_.useState)($p),[x,S]=(0,_.useState)(),[C,w]=(0,_.useState)(`Loading`),[,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(`idle`),O=Gp({onError:T,onToolApprovalUpdate:c,onToolQuestionUpdate:l}),k=(0,_.useRef)(null),A=(0,_.useRef)(null),ee=(0,_.useRef)(null),j=(0,_.useRef)(!0);function te(){let e=ee.current;e!==null&&(j.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)}(0,_.useEffect)(()=>{if(m!==`playground`||a.length===0||!j.current)return;let e=window.requestAnimationFrame(()=>{let e=ee.current;e!==null&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[m,a]);let ne=(0,_.useCallback)(async()=>{w(`Loading`),T(``);try{let e=await fetch(`/config`);if(e.status===401){w(`Authentication required`);return}if(!e.ok)throw Error(`Config failed with HTTP ${e.status}`);let n=await e.json();t(n),r(e=>e||n.agents[0]?.id||``),w(`Connected`)}catch(e){T(s(e)),w(`Config error`)}},[]);(0,_.useEffect)(()=>{ne()},[ne]);let M=e?.capabilities.sessions?.enabled===!0,N=e?.capabilities.traces?.enabled===!0,P=e?.capabilities.knowledge?.enabled===!0,re=e?.capabilities.mcps?.enabled===!0,ie=e?.capabilities.tools?.enabled===!0,ae=e?.capabilities.pipelines?.enabled===!0,oe=e?.capabilities.evals?.enabled===!0,F=e?.capabilities.memory?.enabled===!0,I=e?.capabilities.status?.enabled===!0,se=e?.agents??[],ce=e?.pipelines??[],le=e?.evals??[],L=se.length>0,ue=(0,_.useCallback)(()=>{h(`tracing`)},[]),de=(0,_.useCallback)(e=>{if(e===void 0){rC.navigate({to:`/playground`});return}rC.navigate({to:`/playground/$sessionId`,params:{sessionId:e}})},[]),fe=(0,_.useCallback)(()=>{rC.navigate({to:`/tracing`})},[]),pe=tm({activePage:m,enabled:N,initialTraceId:``,initialTraceSessionId:void 0,onError:T,onNavigateTracing:ue,onOpenTrace:(0,_.useCallback)(e=>{rC.navigate({to:`/tracing/$traceId`,params:{traceId:e}})},[]),onOpenTraceIndex:fe,onOpenTraceSession:(0,_.useCallback)(e=>{rC.navigate({to:`/tracing/sessions/$sessionId`,params:{sessionId:e}})},[])}),me=(0,_.useMemo)(()=>({hasAgents:L,sessionsEnabled:M,tracesEnabled:N,toolsEnabled:ie,mcpsEnabled:re,pipelinesEnabled:ae,evalsEnabled:oe,memoryEnabled:F,statusEnabled:I,knowledgeEnabled:P}),[L,M,N,ie,re,ae,oe,F,I,P]),he=se.find(e=>e.id===n)??se[0]??void 0,ge=he?.id,_e=he?.quickPrompts??[],{selectedAgentModels:ve,selectedModelRef:ye,setSelectedModelRef:be}=pi({enabled:e?.models!==void 0,selectedAgentId:ge,onError:T}),xe=a.length>0,Se=(0,_.useCallback)((e,t,n)=>{_p(Cp(e.transcript)),r(e.agentId),be(Qr(e)),o(Zr(e.transcript,t)),p([]),n.updatePath!==!1&&(h(`playground`),de(e.id))},[de,o,be]),Ce=(0,_.useCallback)((e,t)=>{pe.removeSessionTraces(e),t&&(vp(),o([]),d(``),p([]),m===`playground`&&de(void 0))},[m,de,o,pe]),we=Kp({activePage:m,currentAgentId:he?.id??n,enabled:M,loadSessionTraceSummaries:pe.loadSessionTraceSummaries,runState:E,selectedModelRef:ye,onError:T,onSessionCreated:de,onSessionDeleted:Ce,onSessionLoaded:Se,onStatus:w}),{runPrompt:Te}=Ap({attachments:f,messages:a,promptRef:k,runState:E,selectedAgent:he,selectedAgentId:n,selectedModelRef:ye,sessions:we,sessionsEnabled:M,traces:pe,transcript:i,onActivePageChange:h,onAttachmentsChange:p,onBeforeRun:()=>{j.current=!0},onError:T,onPromptChange:d,onRunStateChange:D,onStatus:w}),Ee=(0,_.useCallback)((e={})=>{E!==`running`&&(vp(),we.clearSelectedSession(),o([]),d(``),p([]),h(`playground`),T(``),e.updatePath!==!1&&de(void 0),requestAnimationFrame(()=>xp(k.current)))},[de,E,we,o]),De=(0,_.useCallback)(e=>{E===`running`||e===n||(r(e),be(``),vp(),we.clearSelectedSession(),o([]),d(``),p([]),h(`playground`),T(``),de(void 0),requestAnimationFrame(()=>xp(k.current)))},[de,E,n,we,o,be]);function Oe(e){d(bp(e)),xp(e.currentTarget)}async function ke(e){let t=Array.from(e.currentTarget.files??[]);if(e.currentTarget.value=``,t.length!==0)try{let e=await Promise.all(t.map(ti));p(t=>[...t,...e])}catch(e){T(s(e))}}function Ae(e){p(t=>t.filter(t=>t.id!==e))}function je(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),Te(u))}let Me=(0,_.useCallback)(e=>qp(e,me),[me]),Ne=(0,_.useCallback)(e=>{if(qp(e,me)){if(h(e),e===`tracing`){pe.clearTraceSelection(),rC.navigate({to:`/tracing`});return}if(e===`knowledge`){pe.clearTraceSelection(),rC.navigate({to:`/knowledge/$tab`,params:{tab:y}});return}if(pe.clearTraceSelection(),e===`playground`&&we.selectedSessionId.length>0){de(we.selectedSessionId);return}rC.navigate({to:`/${e}`})}},[y,de,me,we.selectedSessionId,pe]),Pe=(0,_.useCallback)(e=>{Ne(Jp(e,me))},[Ne,me]);function Fe(e){h(`knowledge`),b(e),pe.clearTraceSelection(),rC.navigate({to:`/knowledge/$tab`,params:{tab:e}})}let Ie=(0,_.useCallback)(e=>{if(!qp(e,me)){Pe(e);return}h(e),e!==`tracing`&&pe.clearTraceSelection()},[Pe,me,pe]),Le={activePage:m,agents:se,answeringQuestions:O.answeringQuestions,attachments:f,decidingApprovals:O.decidingApprovals,deleteCandidate:x,evals:le,evalsEnabled:oe,hasAgents:L,hasMessages:xe,knowledgeEnabled:P,knowledgeTab:y,mcpsEnabled:re,memoryEnabled:F,messages:a,pageEnabled:Me,pipelines:ce,pipelinesEnabled:ae,prompt:u,runState:E,selectedAgent:he,selectedAgentId:n,selectedAgentModels:ve,selectedAgentQuickPrompts:_e,selectedModelRef:ye,sessions:we,sessionsEnabled:M,status:C,statusEnabled:I,theme:g,toolsEnabled:ie,traces:pe,tracesEnabled:N,attachmentInputRef:A,promptRef:k,transcriptScrollerRef:ee,activateRoute:Ie,navigateFallback:Pe,navigatePage:Ne,navigateKnowledgeTab:Fe,setDeleteCandidate:S,setError:T,setKnowledgeTab:b,setSelectedModelRef:be,setStatus:w,startNewChat:Ee,selectPlaygroundAgent:De,addPromptAttachments:ke,decideToolApproval:O.decideToolApproval,updatePrompt:Oe,handlePromptKeyDown:je,answerToolQuestion:O.answerToolQuestion,removePromptAttachment:Ae,runPrompt:Te,toggleTheme:v,updateTranscriptStickiness:te};return(0,R.jsx)(nm.Provider,{value:Le,children:(0,R.jsx)(Ur,{router:rC})})}var aC=document.getElementById(`anvia-ui`);aC!==null&&(0,Wr.createRoot)(aC).render((0,R.jsx)(iC,{}));export{Ah as A,bm as B,ng as C,Ih as D,Rh as E,Vm as F,qn as H,Rm as I,Pm as L,ah as M,nh as N,Fh as O,Hm as P,Em as R,cg as S,Yh as T,m as U,Ep as V,vy as _,hS as a,Cg as b,mS as c,dS as d,fS as f,Ny as g,Hb as h,gS as i,kh as j,jh as k,vS as l,lS as m,xS as n,pS as o,uS as p,yS as r,_S as s,bS as t,cS as u,dy as v,Kh as w,bg as x,ly as y,Sm as z};
|
|
154
|
-
//# sourceMappingURL=index-
|
|
153
|
+
`},Bb=0,Vb=[];function Hb(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(Bb++)[0],a=_.useState(ub)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=zy([e.lockRef.current],(e.shards||[]).map(Lb),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Fb(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Ob(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ob(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Pb(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!Vb.length||Vb[Vb.length-1]!==a)){var r=`deltaY`in n?Ib(n):Fb(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Rb(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Lb).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ub(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=Fb(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,Ib(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,Fb(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return Vb.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Cb),document.addEventListener(`touchmove`,c,Cb),document.addEventListener(`touchstart`,u,Cb),function(){Vb=Vb.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Cb),document.removeEventListener(`touchmove`,c,Cb),document.removeEventListener(`touchstart`,u,Cb)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:zb(i)}):null,p?_.createElement(bb,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ub(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Wb=$y(eb,Hb),Gb=_.forwardRef(function(e,t){return _.createElement(nb,Ly({},e,{ref:t,sideCar:Wb}))});Gb.classNames=nb.classNames;var Kb=[` `,`Enter`,`ArrowUp`,`ArrowDown`],qb=[` `,`Enter`],Jb=`Select`,[Yb,Xb,Zb]=Ih(Jb),[Qb,$b]=Ph(Jb,[Zb,Gv]),ex=Gv(),[tx,nx]=Qb(Jb),[rx,ix]=Qb(Jb),ax=`SelectProvider`;function ox(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=ex(t),[v,y]=_.useState(null),[b,x]=_.useState(null),[S,C]=_.useState(!1),w=Rh(l),[T,E]=xy({prop:r,defaultProp:i??!1,onChange:a,caller:Jb}),[D,O]=xy({prop:o,defaultProp:s,onChange:c,caller:Jb}),k=_.useRef(null),A=v?!!m||!!v.closest(`form`):!0,[ee,j]=_.useState(new Set),te=Eg(),ne=Array.from(ee).map(e=>e.props.value).join(`;`),M=_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),N=_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),P={required:p,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:te,value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:ee,nativeSelectKey:ne,isFormControl:A};return(0,R.jsx)(sy,{...g,children:(0,R.jsx)(tx,{scope:t,...P,children:(0,R.jsx)(Yb.Provider,{scope:t,children:(0,R.jsx)(rx,{scope:t,onNativeOptionAdd:M,onNativeOptionRemove:N,children:oS(h)?h(P):n})})})})}ox.displayName=ax;var sx=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,R.jsx)(ox,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[n,e?(0,R.jsx)(aS,{__scopeSelect:t}):null]})})};sx.displayName=Jb;var cx=`SelectTrigger`,lx=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=ex(n),o=nx(cx,n),s=o.disabled||r,c=Wm(t,o.onTriggerChange),l=Xb(n),u=_.useRef(`touch`),[d,f,p]=cS(e=>{let t=l().filter(e=>!e.disabled),n=lS(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,R.jsx)(cy,{asChild:!0,...a,children:(0,R.jsx)(zh.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":sS(o.value)?``:void 0,...i,ref:c,onClick:Nh(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:Nh(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:Nh(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Kb.includes(e.key)&&(m(),e.preventDefault())})})})});lx.displayName=cx;var ux=`SelectValue`,dx=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=nx(ux,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Wm(t,c.onValueNodeChange);Cg(()=>{l(u)},[l,u]);let f=sS(c.value);return(0,R.jsx)(zh.span,{...s,asChild:f?!1:s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,R.jsx)(_.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});dx.displayName=ux;var fx=`SelectIcon`,px=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,R.jsx)(zh.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});px.displayName=fx;var mx=`SelectPortal`,[hx,gx]=Qb(mx,{forceMount:void 0}),_x=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,R.jsx)(hx,{scope:e.__scopeSelect,forceMount:n,children:(0,R.jsx)(fy,{asChild:!0,...r})})};_x.displayName=mx;var vx=`SelectContent`,yx=_.forwardRef((e,t)=>{let n=gx(vx,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=nx(vx,e.__scopeSelect),[o,s]=_.useState();return Cg(()=>{s(new DocumentFragment)},[]),(0,R.jsx)(my,{present:r||a.open,children:({present:e})=>e?(0,R.jsx)(Ex,{...i,ref:t}):(0,R.jsx)(bx,{...i,fragment:o})})});yx.displayName=vx;var bx=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?sr.createPortal((0,R.jsx)(Sx,{scope:n,children:(0,R.jsx)(Yb.Slot,{scope:n,children:(0,R.jsx)(`div`,{ref:t,children:r})})}),i):null});bx.displayName=`SelectContentFragment`;var xx=10,[Sx,Cx]=Qb(vx),wx=`SelectContentImpl`,Tx=Gm(`SelectContent.RemoveScroll`),Ex=_.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=nx(vx,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=Wm(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=Xb(n),[A,ee]=_.useState(!1),j=_.useRef(!1);_.useEffect(()=>{if(b)return Iy(b)},[b]),ag();let te=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),ne=_.useCallback(()=>te([T,b]),[te,T,b]);_.useEffect(()=>{A&&ne()},[A,ne]);let{onOpenChange:M,triggerPointerDownPosRef:N}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,M,N]),_.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[P,re]=cS(e=>{let t=k().filter(e=>!e.disabled),n=lS(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=_.useCallback((e,t,n)=>{let r=!j.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(j.current=!0))},[y.value]),ae=_.useCallback(()=>b?.focus(),[b]),oe=_.useCallback((e,t,n)=>{let r=!j.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),F=r===`popper`?Ax:Ox,I=F===Ax?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,R.jsx)(Sx,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ie,selectedItem:T,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:ne,selectedItemText:D,position:r,isPositioned:A,searchRef:P,children:(0,R.jsx)(Gb,{as:Tx,allowPinchZoom:!0,children:(0,R.jsx)(dg,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Nh(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(Yh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,R.jsx)(F,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...I,onPlaced:()=>ee(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:Nh(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>te(t)),e.preventDefault()}})})})})})})});Ex.displayName=wx;var Dx=`SelectItemAlignedPosition`,Ox=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=nx(vx,n),o=Cx(vx,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Wm(t,e=>u(e)),f=Xb(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xx,d=Mh(a,[xx,Math.max(xx,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xx,d=Mh(a,[xx,Math.max(xx,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-xx*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-xx,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,ee=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${xx}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);Cg(()=>b(),[b]);let[x,S]=_.useState();return Cg(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,R.jsx)(jx,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,R.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,R.jsx)(zh.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Ox.displayName=Dx;var kx=`SelectPopperPosition`,Ax=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=xx,...a}=e,o=ex(n);return(0,R.jsx)(ly,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Ax.displayName=kx;var[jx,Mx]=Qb(vx,{}),Nx=`SelectViewport`,Px=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Cx(Nx,n),o=Mx(Nx,n),s=Wm(t,a.onViewportChange),c=_.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,R.jsx)(Yb.Slot,{scope:n,children:(0,R.jsx)(zh.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:Nh(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-xx*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Px.displayName=Nx;var Fx=`SelectGroup`,[Ix,Lx]=Qb(Fx),Rx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Eg();return(0,R.jsx)(Ix,{scope:n,id:i,children:(0,R.jsx)(zh.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Rx.displayName=Fx;var zx=`SelectLabel`,Bx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Lx(zx,n);return(0,R.jsx)(zh.div,{id:i.id,...r,ref:t})});Bx.displayName=zx;var Vx=`SelectItem`,[Hx,Ux]=Qb(Vx),Wx=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=nx(Vx,n),c=Cx(Vx,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=Wm(t,e=>c.itemRefCallback?.(e,r,i)),h=Eg(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,R.jsx)(Hx,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(Yb.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,R.jsx)(zh.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:Nh(o.onFocus,()=>p(!0)),onBlur:Nh(o.onBlur,()=>p(!1)),onClick:Nh(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:Nh(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:Nh(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:Nh(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Nh(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Nh(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(qb.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});Wx.displayName=Vx;var Gx=`SelectItemText`,Kx=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=nx(Gx,n),s=Cx(Gx,n),c=Ux(Gx,n),l=ix(Gx,n),[u,d]=_.useState(null),f=Wm(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,R.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Cg(()=>(h(m),()=>g(m)),[h,g,m]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(zh.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!sS(o.value)?sr.createPortal(a.children,o.valueNode):null]})});Kx.displayName=Gx;var qx=`SelectItemIndicator`,Jx=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ux(qx,n).isSelected?(0,R.jsx)(zh.span,{"aria-hidden":!0,...r,ref:t}):null});Jx.displayName=qx;var Yx=`SelectScrollUpButton`,Xx=_.forwardRef((e,t)=>{let n=Cx(Yx,e.__scopeSelect),r=Mx(Yx,e.__scopeSelect),[i,a]=_.useState(!1),o=Wm(t,r.onScrollButtonChange);return Cg(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)($x,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Xx.displayName=Yx;var Zx=`SelectScrollDownButton`,Qx=_.forwardRef((e,t)=>{let n=Cx(Zx,e.__scopeSelect),r=Mx(Zx,e.__scopeSelect),[i,a]=_.useState(!1),o=Wm(t,r.onScrollButtonChange);return Cg(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)($x,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Qx.displayName=Zx;var $x=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Cx(`SelectScrollButton`,n),o=_.useRef(null),s=Xb(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),Cg(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,R.jsx)(zh.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Nh(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Nh(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Nh(i.onPointerLeave,()=>{c()})})}),eS=`SelectSeparator`,tS=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,R.jsx)(zh.div,{"aria-hidden":!0,...r,ref:t})});tS.displayName=eS;var nS=`SelectArrow`,rS=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ex(n);return Cx(nS,n).position===`popper`?(0,R.jsx)(uy,{...i,...r,ref:t}):null});rS.displayName=nS;var iS=`SelectBubbleInput`,aS=_.forwardRef(({__scopeSelect:e,...t},n)=>{let r=nx(iS,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=_.useRef(null),m=Wm(n,p),h=i??``,g=wy(h),v=Array.from(d).some(e=>(e.props.value??``)===``);return _.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,R.jsxs)(zh.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Ty,...t.style},ref:m,defaultValue:h,children:[sS(i)&&!v?(0,R.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});aS.displayName=iS;function oS(e){return typeof e==`function`}function sS(e){return e===``||e===void 0}function cS(e){let t=Vh(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function lS(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=uS(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function uS(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var dS=sx,fS=dx;function pS({className:e,children:t,...n}){return(0,R.jsxs)(lx,{className:a(`flex h-9 w-full items-center justify-between rounded-lg border border-input bg-card/90 px-3 text-sm text-foreground outline-none transition duration-200 hover:border-muted-foreground/45 focus:border-muted-foreground/60 focus:ring-2 focus:ring-muted-foreground/20 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:[t,(0,R.jsx)(px,{asChild:!0,children:(0,R.jsx)(ch,{icon:Tm,className:`h-4 w-4 opacity-60`})})]})}function mS({className:e,children:t,position:n=`popper`,...r}){return(0,R.jsx)(_x,{children:(0,R.jsx)(yx,{position:n,className:a(`z-50 max-h-80 min-w-[8rem] overflow-hidden rounded-xl border border-border/90 bg-popover/98 text-popover-foreground shadow-xl shadow-black/45 backdrop-blur`,e),...r,children:(0,R.jsx)(Px,{className:`p-1`,children:t})})})}function hS({className:e,children:t,...n}){return(0,R.jsxs)(Wx,{className:a(`relative flex min-h-8 cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-sm outline-none transition data-[disabled]:pointer-events-none data-[highlighted]:bg-muted/65 data-[highlighted]:text-foreground data-[disabled]:opacity-50`,e),...n,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,R.jsx)(Jx,{children:(0,R.jsx)(ch,{icon:Am,className:`h-4 w-4`})})}),(0,R.jsx)(Kx,{children:t})]})}function gS({className:e,...t}){return(0,R.jsx)(`section`,{className:a(`grid h-full min-h-0 min-w-0 max-h-full max-w-full overflow-hidden bg-background/45`,e),...t})}function _S({className:e,...t}){return(0,R.jsx)(`div`,{className:a(`min-h-0 min-w-0 overflow-hidden rounded-2xl border border-border/80 bg-card/70`,e),...t})}function vS(e){return(0,R.jsxs)(`div`,{className:a(`grid gap-1 rounded-xl border border-border/80 bg-card/45 p-4`,e.className),children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:e.label}),(0,R.jsx)(`span`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:e.value})]})}function yS(e){return(0,R.jsx)(`div`,{className:a(`grid min-h-80 place-items-center rounded-xl border border-dashed border-border/80 bg-card/35 px-6 text-center`,e.className),children:(0,R.jsxs)(`div`,{className:`grid max-w-md gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-base font-semibold text-foreground`,children:e.title}),(0,R.jsx)(`p`,{className:`m-0 text-sm leading-6 text-muted-foreground`,children:e.text})]})})}function bS({className:e,...t}){return(0,R.jsx)(`span`,{className:a(`inline-flex items-center rounded-lg border border-border/80 bg-muted/55 px-2 py-1 text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground`,e),...t})}function xS({className:e,...t}){return(0,R.jsx)(`div`,{className:a(`grid gap-1 rounded-xl border border-border/80 bg-background p-1`,e),...t})}function SS({className:e,...t}){return(0,R.jsx)(`textarea`,{className:a(`min-h-9 w-full resize-none rounded-lg border border-input bg-card/90 px-3 py-2.5 leading-6 text-foreground outline-none transition duration-200 placeholder:text-muted-foreground/65 focus:border-muted-foreground/60 focus:ring-2 focus:ring-muted-foreground/20`,e),...t})}function CS(e){let t=TS(e.metadata,e.limit),n=OS(e.metadata);return t.length===0&&!n?null:(0,R.jsxs)(`div`,{className:`grid min-w-0 gap-1 text-xs leading-5 text-muted-foreground`,children:[t.length===0?null:(0,R.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-x-2 gap-y-1`,children:t.map(e=>(0,R.jsxs)(`span`,{className:a(`min-w-0 break-words`,e.tone===`error`?`text-destructive/85`:`text-muted-foreground/85`),children:[(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.key,`=`]}),e.value]},e.key))}),n?(0,R.jsxs)(`details`,{className:`group min-w-0 rounded-lg border border-black/[0.06] bg-black/[0.03] px-2 py-1 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer select-none text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground transition group-open:text-foreground`,children:`Details`}),(0,R.jsx)(`pre`,{className:`m-0 mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs leading-4 text-muted-foreground`,children:kS(e.metadata)})]}):null]})}function wS(e,t){return TS(e,t).map(e=>`${e.key}=${e.value}`).join(` `)}function TS(e,t=6){return Object.entries(e??{}).map(([e,t])=>{let n=e===`error`?`error`:`default`;return{key:e,value:ES(e,t),tone:n}}).filter(e=>e.value.length>0).slice(0,t)}function ES(e,t){return t===null?`null`:typeof t==`string`||typeof t==`number`||typeof t==`boolean`?String(t):Array.isArray(t)?`[${t.length}]`:jS(t)?e===`error`?DS(t):AS(t):``}function DS(e){let t=typeof e.name==`string`&&e.name.length>0?e.name:void 0,n=typeof e.message==`string`&&e.message.length>0?e.message:void 0;return t!==void 0&&n!==void 0?`${t}: ${n}`:n===void 0?AS(e):n}function OS(e){return Object.values(e??{}).some(e=>Array.isArray(e)||jS(e))}function kS(e){if(e===void 0)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function AS(e){try{return JSON.stringify(e)}catch{return String(e)}}function jS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function MS(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(!0);(0,_.useEffect)(()=>{let e=t.current;e===null||!n.current||(e.scrollTop=e.scrollHeight)});function r(){let e=t.current;e!==null&&(n.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)}return(0,R.jsxs)(`aside`,{className:`grid h-full min-h-0 min-w-0 max-h-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden bg-background/70 max-xl:hidden`,children:[(0,R.jsxs)(`header`,{className:`grid min-h-12 min-w-0 gap-1 py-3 pl-0 pr-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-sm font-semibold leading-tight text-foreground`,children:`Session logs`}),(0,R.jsx)(`span`,{className:` text-xs font-semibold tabular-nums text-muted-foreground`,children:e.logs.length})]}),(0,R.jsx)(`p`,{className:`m-0 truncate text-xs font-medium text-muted-foreground`,children:e.selectedSessionId.length===0?`No active session`:e.selectedSessionId})]}),(0,R.jsxs)(`div`,{className:`min-h-0 min-w-0 overflow-y-auto overflow-x-hidden`,ref:t,onScroll:r,children:[e.selectedSessionId.length===0?(0,R.jsx)(`div`,{className:`grid h-full min-h-80 place-items-center text-center text-sm font-medium text-muted-foreground`,children:`Start or open a session to view runtime logs.`}):null,e.selectedSessionId.length>0&&e.loading&&e.logs.length===0?(0,R.jsx)(`div`,{className:`py-3 pl-0 pr-2 text-sm font-medium text-muted-foreground`,children:`Loading logs`}):null,e.selectedSessionId.length>0&&!e.loading&&e.logs.length===0?(0,R.jsx)(`div`,{className:`py-3 pl-0 pr-2 text-sm font-medium text-muted-foreground`,children:`No logs yet`}):null,(0,R.jsx)(`div`,{className:`grid min-w-0 gap-1 py-2 pl-0 pr-2 `,children:e.logs.map(e=>(0,R.jsx)(NS,{log:e},e.id))})]})]})}function NS(e){let t=wS(e.log.metadata);return(0,R.jsxs)(`article`,{className:`grid min-w-0 gap-1 rounded-lg px-3 py-2 text-xs leading-5 transition duration-200 hover:bg-black/[0.04] dark:hover:bg-white/[0.04]`,title:[PS(e.log.timestamp),e.log.level.toUpperCase().padEnd(5,` `),e.log.message,`${e.log.category}/${e.log.event}`,t].filter(e=>e.trim().length>0).join(` `),children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,R.jsx)(`time`,{className:`shrink-0 text-muted-foreground`,children:PS(e.log.timestamp)}),(0,R.jsx)(`span`,{className:a(`shrink-0 font-semibold`,FS(e.log.level)),children:e.log.level.toUpperCase()}),(0,R.jsx)(`span`,{className:`min-w-0 break-words font-medium text-foreground`,children:e.log.message})]}),(0,R.jsxs)(`div`,{className:`min-w-0 break-words text-muted-foreground/80`,children:[e.log.category,`/`,e.log.event]}),(0,R.jsx)(CS,{metadata:e.log.metadata})]})}function PS(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function FS(e){switch(e){case`error`:return`text-destructive`;case`warn`:return`text-yellow-500`;case`debug`:return`text-muted-foreground`;case`info`:return`text-foreground`}}var IS=(0,_.lazy)(()=>um(()=>import(`./transcript-item-BqGgawoe.js`).then(e=>({default:e.TranscriptItem})),__vite__mapDeps([18,1,17,7,8,2])));function LS(e){return(0,R.jsxs)(gS,{className:`grid-cols-[minmax(0,1fr)_minmax(0,460px)] max-xl:grid-cols-1`,children:[(0,R.jsx)(`div`,{className:`grid min-h-0 min-w-0 pb-6 pr-6`,children:(0,R.jsxs)(_S,{className:`grid h-full grid-rows-[minmax(0,1fr)_auto] p-2`,children:[(0,R.jsx)(`section`,{className:`min-h-0 overflow-y-auto overflow-x-hidden px-4 py-4 [scrollbar-gutter:stable]`,ref:e.transcriptScrollerRef,onScroll:e.onTranscriptScroll,children:(0,R.jsxs)(`div`,{className:`mx-auto grid min-h-full w-full max-w-235 content-start items-start gap-6 pb-8`,children:[e.hasMessages?null:(0,R.jsx)(`div`,{className:`grid min-h-96 place-items-center text-sm font-medium text-muted-foreground`,children:(0,R.jsxs)(`div`,{className:`grid max-w-xl gap-4 text-center`,children:[(0,R.jsx)(`div`,{className:`mx-auto h-px w-28 bg-muted/55`}),(0,R.jsx)(`h1`,{className:`m-0 text-4xl font-semibold leading-tight text-foreground text-balance`,children:`What should this agent work on?`}),(0,R.jsx)(`p`,{className:`m-0 text-base leading-7 text-muted-foreground text-pretty`,children:`Choose a prompt below or write a task. Studio will stream the response, tool calls, approvals, and trace data here.`})]})}),(0,R.jsx)(_.Suspense,{fallback:null,children:e.messages.map(t=>(0,R.jsx)(IS,{entry:t,decidingApprovals:e.decidingApprovals,answeringQuestions:e.answeringQuestions,onApprovalDecision:e.onApprovalDecision,onQuestionAnswer:e.onQuestionAnswer,onOpenTrace:e.onOpenTrace},t.entryId))})]})}),(0,R.jsxs)(`form`,{className:`grid gap-3 bg-gradient-to-t from-card via-card/95 to-card/0 px-4 pb-4 pt-2`,onSubmit:t=>{t.preventDefault(),e.onRunPrompt(e.prompt)},children:[e.hasMessages||e.selectedAgentQuickPrompts.length===0?null:(0,R.jsx)(`div`,{className:`mx-auto grid w-full max-w-235 grid-cols-3 gap-2 max-md:grid-cols-1`,children:e.selectedAgentQuickPrompts.map(t=>(0,R.jsx)(ah,{className:`h-auto min-h-16 justify-start whitespace-normal rounded-lg border border-border/80 bg-card/85 px-3 py-2.5 text-left text-sm font-medium leading-5 text-foreground shadow-sm hover:border-border/80 hover:bg-muted/45 hover:text-foreground`,type:`button`,variant:`ghost`,disabled:e.runState===`running`||e.selectedAgentId.length===0,onClick:()=>e.onRunPrompt(t),children:(0,R.jsx)(`span`,{className:`min-w-0 whitespace-normal wrap-break-words`,children:t})},t))}),(0,R.jsxs)(`div`,{className:`mx-auto grid w-full max-w-235 gap-2 rounded-xl border border-border/80 bg-card/95 p-2.5 backdrop-blur`,children:[(0,R.jsx)(SS,{className:`min-h-16 min-w-0 resize-none rounded-lg border-0 bg-transparent px-3 py-3 text-sm leading-7 text-foreground shadow-none outline-none ring-0 placeholder:text-muted-foreground/70 focus:border-transparent focus:ring-0`,ref:e.promptRef,rows:1,value:e.prompt,onChange:e.onPromptChange,onKeyDown:e.onPromptKeyDown,placeholder:`Ask anything...`}),e.attachments.length===0?null:(0,R.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 px-2`,children:e.attachments.map(t=>(0,R.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-lg border border-border/80 bg-muted/55 px-2 py-1 text-xs font-medium text-muted-foreground`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 truncate`,children:[t.kind===`image`?`Image`:`Doc`,` / `,t.name]}),(0,R.jsx)(ah,{"aria-label":`Remove ${t.name}`,className:`h-5 min-h-5 w-5 rounded-md border-0 bg-transparent p-0 text-muted-foreground shadow-none hover:bg-accent hover:text-foreground [&_svg]:h-3 [&_svg]:w-3`,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>e.onRemovePromptAttachment(t.id),children:(0,R.jsx)(ch,{icon:Om,"aria-hidden":`true`})})]},t.id))}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`input`,{ref:e.attachmentInputRef,className:`hidden`,type:`file`,multiple:!0,accept:Kr,onChange:e.onAddPromptAttachments}),(0,R.jsx)(ah,{"aria-label":`Attach image or document`,className:`h-8 min-h-8 w-8 border-0 bg-transparent p-0 text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground`,size:`icon`,type:`button`,variant:`ghost`,disabled:e.runState===`running`,onClick:()=>e.attachmentInputRef.current?.click(),children:(0,R.jsx)(ch,{icon:Dm,"aria-hidden":`true`})})]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.selectedAgentModels.length===0?null:(0,R.jsxs)(dS,{value:e.selectedModelRef,onValueChange:e.onSelectModel,disabled:e.runState===`running`,children:[(0,R.jsx)(pS,{"aria-label":`Select model`,className:`flex h-8 min-h-8 w-auto max-w-44 gap-2 border-0 bg-transparent px-2 py-1 text-xs font-medium text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground sm:max-w-72`,children:(0,R.jsx)(fS,{placeholder:`Model`})}),(0,R.jsx)(mS,{align:`end`,children:e.selectedAgentModels.map(e=>(0,R.jsx)(hS,{value:e.ref,children:ei(e)},e.ref))})]}),e.agents.length>1?(0,R.jsxs)(dS,{value:e.selectedAgent?.id??e.selectedAgentId,onValueChange:e.onSelectAgent,disabled:e.runState===`running`,children:[(0,R.jsx)(pS,{"aria-label":`Select agent`,className:`flex h-8 min-h-8 w-auto max-w-64 gap-2 border-0 bg-transparent px-2 py-1 text-xs font-medium text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground`,children:(0,R.jsx)(fS,{placeholder:`Agent`})}),(0,R.jsx)(mS,{align:`end`,children:e.agents.map(e=>(0,R.jsx)(hS,{value:e.id,children:e.name??e.id},e.id))})]}):null,(0,R.jsx)(ah,{"aria-label":e.runState===`running`?`Running`:`Send message`,className:`h-9 min-h-9 w-9 rounded-full border-white bg-white text-black hover:bg-white/90`,size:`icon`,type:`submit`,disabled:e.runState===`running`||e.selectedAgentId.length===0,children:(0,R.jsx)(ch,{icon:Em})})]})]})]})]})]})}),(0,R.jsx)(MS,{logs:e.sessionLogs,selectedSessionId:e.selectedSessionId,loading:e.sessionLogLoadState===`loading`})]})}function RS(){let e=hh(`playground`),t=nr({strict:!1}).sessionId,n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(n.current!==t&&e.pageEnabled(`playground`)){if(e.runState===`running`){n.current=t;return}if(t===void 0){n.current=t,e.startNewChat({updatePath:!1});return}e.sessionsEnabled&&(n.current=t,t!==e.sessions.selectedSessionId&&e.sessions.loadSession(t,{updatePath:!1}))}},[t,e]),(0,R.jsx)(LS,{agents:e.agents,answeringQuestions:e.answeringQuestions,attachments:e.attachments,decidingApprovals:e.decidingApprovals,hasMessages:e.hasMessages,messages:e.messages,prompt:e.prompt,runState:e.runState,selectedAgent:e.selectedAgent,selectedAgentId:e.selectedAgentId,selectedAgentModels:e.selectedAgentModels,selectedAgentQuickPrompts:e.selectedAgentQuickPrompts,selectedModelRef:e.selectedModelRef,selectedSessionId:e.sessions.selectedSessionId,sessionLogLoadState:e.sessions.sessionLogLoadState,sessionLogs:e.sessions.sessionLogs,attachmentInputRef:e.attachmentInputRef,promptRef:e.promptRef,transcriptScrollerRef:e.transcriptScrollerRef,onAddPromptAttachments:e.addPromptAttachments,onApprovalDecision:e.decideToolApproval,onOpenTrace:e.traces.selectTrace,onPromptChange:e.updatePrompt,onPromptKeyDown:e.handlePromptKeyDown,onQuestionAnswer:e.answerToolQuestion,onRemovePromptAttachment:e.removePromptAttachment,onRunPrompt:e.runPrompt,onSelectAgent:e.selectPlaygroundAgent,onSelectModel:e.setSelectedModelRef,onTranscriptScroll:e.updateTranscriptStickiness})}function zS(){let e=hh(`sessions`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(_m,{agents:e.agents,sessions:e.sessions.allSessions,sessionsEnabled:e.sessionsEnabled,sessionLoadState:e.sessions.sessionLoadState,selectedSessionId:e.sessions.selectedSessionId,onOpenSession:t=>void e.sessions.loadSession(t),onViewSessionTracing:t=>void e.traces.showSessionTraces(t),onDeleteSession:e.setDeleteCandidate})})}function BS(){let e=hh(`status`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(ym,{enabled:e.statusEnabled})})}function VS(){let e=hh(`tools`);return(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(bh,{active:!0,agents:e.agents,enabled:e.toolsEnabled,selectedAgentId:e.selectedAgent?.id||e.selectedAgentId,onError:e.setError})})}function HS(){let e=hh(`tracing`),t=nr({strict:!1}),n=(0,_.useRef)(``);return(0,_.useEffect)(()=>{let r=t.sessionId===void 0?`trace:${t.traceId??``}`:`session:${t.sessionId}`;if(n.current!==r&&e.pageEnabled(`tracing`)){if(n.current=r,t.sessionId!==void 0){e.traces.showSessionTraces(t.sessionId,{updatePath:!1});return}e.traces.setTraceLocation(t.traceId??``,void 0)}},[t.sessionId,t.traceId,e]),(0,R.jsx)(_.Suspense,{fallback:(0,R.jsx)(Sm,{}),children:(0,R.jsx)(xm,{agents:e.agents,traces:e.traces.traces,tracesEnabled:e.tracesEnabled,traceLoadState:e.traces.traceLoadState,selectedTraceId:e.traces.selectedTraceId,traceSessionDetailId:e.traces.traceSessionDetailId,onRefresh:()=>void e.traces.loadTraces(),onSelectTrace:e.traces.selectTrace,onShowSessionTraces:t=>void e.traces.showSessionTraces(t)})})}var US=wr({component:mh}),WS=Sr({getParentRoute:()=>US,path:`/`,component:()=>(0,R.jsx)(ar,{to:`/playground`,replace:!0})}),GS=Sr({getParentRoute:()=>US,path:`playground`,component:RS}),KS=Sr({getParentRoute:()=>US,path:`playground/$sessionId`,component:RS}),qS=Sr({getParentRoute:()=>US,path:`tracing`,component:HS}),JS=Sr({getParentRoute:()=>US,path:`tracing/$traceId`,component:HS}),YS=Sr({getParentRoute:()=>US,path:`tracing/sessions/$sessionId`,component:HS}),XS=Sr({getParentRoute:()=>US,path:`sessions`,component:zS}),ZS=Sr({getParentRoute:()=>US,path:`agents`,component:_h}),QS=Sr({getParentRoute:()=>US,path:`tools`,component:VS}),$S=Sr({getParentRoute:()=>US,path:`mcps`,component:wh}),eC=Sr({getParentRoute:()=>US,path:`pipelines`,component:kh}),tC=Sr({getParentRoute:()=>US,path:`evals`,component:yh}),nC=Sr({getParentRoute:()=>US,path:`knowledge`,component:Ch}),rC=Sr({getParentRoute:()=>US,path:`knowledge/$tab`,component:Ch}),iC=Sr({getParentRoute:()=>US,path:`memory`,component:Th}),aC=Sr({getParentRoute:()=>US,path:`status`,component:BS}),oC=Br({routeTree:US.addChildren([WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC])});function sC(){let[e,t]=(0,_.useState)(),[n,r]=(0,_.useState)(``),i=Pp(),{messages:a,setMessages:o,updateToolApproval:c,updateToolQuestion:l}=i,[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(`playground`),{theme:g,toggleTheme:v}=fi(),[y,b]=(0,_.useState)(nm),[x,S]=(0,_.useState)(),[C,w]=(0,_.useState)(`Loading`),[,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(`idle`),O=Jp({onError:T,onToolApprovalUpdate:c,onToolQuestionUpdate:l}),k=(0,_.useRef)(null),A=(0,_.useRef)(null),ee=(0,_.useRef)(null),j=(0,_.useRef)(!0);function te(){let e=ee.current;e!==null&&(j.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)}(0,_.useEffect)(()=>{if(m!==`playground`||a.length===0||!j.current)return;let e=window.requestAnimationFrame(()=>{let e=ee.current;e!==null&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[m,a]);let ne=(0,_.useCallback)(async()=>{w(`Loading`),T(``);try{let e=await fetch(`/config`);if(e.status===401){w(`Authentication required`);return}if(!e.ok)throw Error(`Config failed with HTTP ${e.status}`);let n=await e.json();t(n),r(e=>e||n.agents[0]?.id||``),w(`Connected`)}catch(e){T(s(e)),w(`Config error`)}},[]);(0,_.useEffect)(()=>{ne()},[ne]);let M=e?.capabilities.sessions?.enabled===!0,N=e?.capabilities.traces?.enabled===!0,P=e?.capabilities.knowledge?.enabled===!0,re=e?.capabilities.mcps?.enabled===!0,ie=e?.capabilities.tools?.enabled===!0,ae=e?.capabilities.pipelines?.enabled===!0,oe=e?.capabilities.evals?.enabled===!0,F=e?.capabilities.memory?.enabled===!0,I=e?.capabilities.status?.enabled===!0,se=e?.agents??[],ce=e?.pipelines??[],le=e?.evals??[],L=se.length>0,ue=(0,_.useCallback)(()=>{h(`tracing`)},[]),de=(0,_.useCallback)(e=>{if(e===void 0){oC.navigate({to:`/playground`});return}oC.navigate({to:`/playground/$sessionId`,params:{sessionId:e}})},[]),fe=(0,_.useCallback)(()=>{oC.navigate({to:`/tracing`})},[]),pe=im({activePage:m,enabled:N,initialTraceId:``,initialTraceSessionId:void 0,onError:T,onNavigateTracing:ue,onOpenTrace:(0,_.useCallback)(e=>{oC.navigate({to:`/tracing/$traceId`,params:{traceId:e}})},[]),onOpenTraceIndex:fe,onOpenTraceSession:(0,_.useCallback)(e=>{oC.navigate({to:`/tracing/sessions/$sessionId`,params:{sessionId:e}})},[])}),me=(0,_.useMemo)(()=>({hasAgents:L,sessionsEnabled:M,tracesEnabled:N,toolsEnabled:ie,mcpsEnabled:re,pipelinesEnabled:ae,evalsEnabled:oe,memoryEnabled:F,statusEnabled:I,knowledgeEnabled:P}),[L,M,N,ie,re,ae,oe,F,I,P]),he=se.find(e=>e.id===n)??se[0]??void 0,ge=he?.id,_e=he?.quickPrompts??[],{selectedAgentModels:ve,selectedModelRef:ye,setSelectedModelRef:be}=pi({enabled:e?.models!==void 0,selectedAgentId:ge,onError:T}),xe=a.length>0,Se=(0,_.useCallback)((e,t,n)=>{bp(Ep(e.transcript)),r(e.agentId),be(Qr(e)),o(Zr(e.transcript,t)),p([]),n.updatePath!==!1&&(h(`playground`),de(e.id))},[de,o,be]),Ce=(0,_.useCallback)((e,t)=>{pe.removeSessionTraces(e),t&&(xp(),o([]),d(``),p([]),m===`playground`&&de(void 0))},[m,de,o,pe]),we=Yp({activePage:m,currentAgentId:he?.id??n,enabled:M,loadSessionTraceSummaries:pe.loadSessionTraceSummaries,runState:E,selectedModelRef:ye,onError:T,onSessionCreated:de,onSessionDeleted:Ce,onSessionLoaded:Se,onStatus:w}),{runPrompt:Te}=Np({attachments:f,messages:a,promptRef:k,runState:E,selectedAgent:he,selectedAgentId:n,selectedModelRef:ye,sessions:we,sessionsEnabled:M,traces:pe,transcript:i,onActivePageChange:h,onAttachmentsChange:p,onBeforeRun:()=>{j.current=!0},onError:T,onPromptChange:d,onRunStateChange:D,onStatus:w}),Ee=(0,_.useCallback)((e={})=>{E!==`running`&&(xp(),we.clearSelectedSession(),o([]),d(``),p([]),h(`playground`),T(``),e.updatePath!==!1&&de(void 0),requestAnimationFrame(()=>wp(k.current)))},[de,E,we,o]),De=(0,_.useCallback)(e=>{E===`running`||e===n||(r(e),be(``),xp(),we.clearSelectedSession(),o([]),d(``),p([]),h(`playground`),T(``),de(void 0),requestAnimationFrame(()=>wp(k.current)))},[de,E,n,we,o,be]);function Oe(e){d(Cp(e)),wp(e.currentTarget)}async function ke(e){let t=Array.from(e.currentTarget.files??[]);if(e.currentTarget.value=``,t.length!==0)try{let e=await Promise.all(t.map(ti));p(t=>[...t,...e])}catch(e){T(s(e))}}function Ae(e){p(t=>t.filter(t=>t.id!==e))}function je(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),Te(u))}let Me=(0,_.useCallback)(e=>Xp(e,me),[me]),Ne=(0,_.useCallback)(e=>{if(Xp(e,me)){if(h(e),e===`tracing`){pe.clearTraceSelection(),oC.navigate({to:`/tracing`});return}if(e===`knowledge`){pe.clearTraceSelection(),oC.navigate({to:`/knowledge/$tab`,params:{tab:y}});return}if(pe.clearTraceSelection(),e===`playground`&&we.selectedSessionId.length>0){de(we.selectedSessionId);return}oC.navigate({to:`/${e}`})}},[y,de,me,we.selectedSessionId,pe]),Pe=(0,_.useCallback)(e=>{Ne(Zp(e,me))},[Ne,me]);function Fe(e){h(`knowledge`),b(e),pe.clearTraceSelection(),oC.navigate({to:`/knowledge/$tab`,params:{tab:e}})}let Ie=(0,_.useCallback)(e=>{if(!Xp(e,me)){Pe(e);return}h(e),e!==`tracing`&&pe.clearTraceSelection()},[Pe,me,pe]),Le={activePage:m,agents:se,answeringQuestions:O.answeringQuestions,attachments:f,decidingApprovals:O.decidingApprovals,deleteCandidate:x,evals:le,evalsEnabled:oe,hasAgents:L,hasMessages:xe,knowledgeEnabled:P,knowledgeTab:y,mcpsEnabled:re,memoryEnabled:F,messages:a,pageEnabled:Me,pipelines:ce,pipelinesEnabled:ae,prompt:u,runState:E,selectedAgent:he,selectedAgentId:n,selectedAgentModels:ve,selectedAgentQuickPrompts:_e,selectedModelRef:ye,sessions:we,sessionsEnabled:M,status:C,statusEnabled:I,theme:g,toolsEnabled:ie,traces:pe,tracesEnabled:N,attachmentInputRef:A,promptRef:k,transcriptScrollerRef:ee,activateRoute:Ie,navigateFallback:Pe,navigatePage:Ne,navigateKnowledgeTab:Fe,setDeleteCandidate:S,setError:T,setKnowledgeTab:b,setSelectedModelRef:be,setStatus:w,startNewChat:Ee,selectPlaygroundAgent:De,addPromptAttachments:ke,decideToolApproval:O.decideToolApproval,updatePrompt:Oe,handlePromptKeyDown:je,answerToolQuestion:O.answerToolQuestion,removePromptAttachment:Ae,runPrompt:Te,toggleTheme:v,updateTranscriptStickiness:te};return(0,R.jsx)(am.Provider,{value:Le,children:(0,R.jsx)(Ur,{router:oC})})}var cC=document.getElementById(`anvia-ui`);cC!==null&&(0,Wr.createRoot)(cC).render((0,R.jsx)(sC,{}));export{Nh as A,Cm as B,ag as C,zh as D,Vh as E,Wm as F,qn as H,Vm as I,Lm as L,ch as M,ah as N,Rh as O,Gm as P,km as R,dg as S,Qh as T,m as U,kp as V,xy as _,vS as a,Eg as b,_S as c,mS as d,hS as f,Iy as g,Gb as h,yS as i,Mh as j,Ph as k,xS as l,fS as m,wS as n,gS as o,pS as p,SS as r,bS as s,CS as t,dS as u,my as v,Yh as w,Cg as x,fy as y,Tm as z};
|
|
154
|
+
//# sourceMappingURL=index-BImv2lI7.js.map
|