@aidotnet/server-win32-x64 0.14.3112 → 0.14.3114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/bin/astra-server.exe +2 -2
  2. package/bin/wwwroot/assets/ClientsPage-BhnTX0ew.js +11 -0
  3. package/bin/wwwroot/assets/{KeyPage-Db9tYWgA.js → KeyPage-D8xcW85A.js} +1 -1
  4. package/bin/wwwroot/assets/LibraryPage-BO51S5vR.js +2 -0
  5. package/bin/wwwroot/assets/McpPage-BFav-GE-.js +9 -0
  6. package/bin/wwwroot/assets/ModelDetailPage-CRE3OFy5.js +1 -0
  7. package/bin/wwwroot/assets/{ModelsPage-Dc1KK7-3.js → ModelsPage-BsRk0_yk.js} +1 -1
  8. package/bin/wwwroot/assets/PluginsPage-blIrwXbf.js +2 -0
  9. package/bin/wwwroot/assets/{PrivacyPage-Dsaaw5Ko.js → PrivacyPage-bKxw2Y54.js} +1 -1
  10. package/bin/wwwroot/assets/ProviderDetailPage-3YGtfo9v.js +3 -0
  11. package/bin/wwwroot/assets/ProvidersPage-B0XULeAs.js +3 -0
  12. package/bin/wwwroot/assets/{RoutingGroupsPage-B-7FNn_B.js → RoutingGroupsPage-Dz-TTq1a.js} +3 -3
  13. package/bin/wwwroot/assets/SettingsPage-CFVirZNv.js +2 -0
  14. package/bin/wwwroot/assets/{SkillsPage-BdZSd_hw.js → SkillsPage-DI61DG2m.js} +1 -1
  15. package/bin/wwwroot/assets/SmartRoutingPage-CpchDlXC.js +2 -0
  16. package/bin/wwwroot/assets/TokenDetailPage-PqVFcudk.js +1 -0
  17. package/bin/wwwroot/assets/{TokenPoolEditor-CISTyNzC.js → TokenPoolEditor-IS5Zwuqf.js} +1 -1
  18. package/bin/wwwroot/assets/TokensPage-CXK5_J6v.js +1 -0
  19. package/bin/wwwroot/assets/ToolsPage-B_JZpB1h.js +1 -0
  20. package/bin/wwwroot/assets/{TracesPage-f3hY7JcZ.js → TracesPage-CgbFQFzA.js} +3 -3
  21. package/bin/wwwroot/assets/{TrayPanelPage-HGV5ST-e.js → TrayPanelPage-Z4vWiyK-.js} +1 -1
  22. package/bin/wwwroot/assets/{TrayPanelView-BhyK24F_.js → TrayPanelView-Cauh6r_o.js} +1 -1
  23. package/bin/wwwroot/assets/TrayTitleSource-B98nYas3.js +41 -0
  24. package/bin/wwwroot/assets/{checkbox-CZ-rG7I2.js → checkbox-29lSW_6h.js} +1 -1
  25. package/bin/wwwroot/assets/confirm-morph-DpNjlFyg.js +1 -0
  26. package/bin/wwwroot/assets/{format-CmXxTS5M.js → format-CskGUFYy.js} +4 -4
  27. package/bin/wwwroot/assets/{index-BW8keTkg.js → index-D2siu6xk.js} +16 -16
  28. package/bin/wwwroot/assets/{radio-cards-BTn8kpAx.js → radio-cards-CNQWIuu8.js} +1 -1
  29. package/bin/wwwroot/assets/{sortable.esm-Cj5-STJU.js → sortable.esm-BvMId5KB.js} +1 -1
  30. package/bin/wwwroot/assets/use-transform-BPiFWEVF.js +1 -0
  31. package/bin/wwwroot/index.html +4 -4
  32. package/package.json +1 -1
  33. package/bin/wwwroot/assets/ClientsPage-CE9QdKbh.js +0 -11
  34. package/bin/wwwroot/assets/LibraryPage-Djro5zZa.js +0 -2
  35. package/bin/wwwroot/assets/McpPage-BJ7D5vt6.js +0 -9
  36. package/bin/wwwroot/assets/ModelDetailPage-DuyD1_Ei.js +0 -1
  37. package/bin/wwwroot/assets/PluginsPage-Dn1IYmlm.js +0 -2
  38. package/bin/wwwroot/assets/ProviderDetailPage-C5YbB46r.js +0 -3
  39. package/bin/wwwroot/assets/ProvidersPage-BzICHtxh.js +0 -3
  40. package/bin/wwwroot/assets/SettingsPage-CCOHxf9s.js +0 -2
  41. package/bin/wwwroot/assets/SmartRoutingPage-DIkU4HND.js +0 -2
  42. package/bin/wwwroot/assets/TokenDetailPage-DA6q9gbd.js +0 -1
  43. package/bin/wwwroot/assets/TokensPage-CUJXAz7I.js +0 -1
  44. package/bin/wwwroot/assets/ToolsPage-DOHJoH86.js +0 -1
  45. package/bin/wwwroot/assets/TrayTitleSource-DN10ruw2.js +0 -41
  46. package/bin/wwwroot/assets/confirm-morph-Cakq9Lho.js +0 -1
  47. package/bin/wwwroot/assets/use-transform-BcmlojQJ.js +0 -1
@@ -1 +1 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Qs as n,Z as r,as as i,cs as a,os as o,ss as s}from"./format-CmXxTS5M.js";var c=e(t(),1),l={root:`_root_1pzzf_1`,ring:`_ring_1pzzf_31`,card:`_card_1pzzf_51`,label:`_label_1pzzf_91`,meta:`_meta_1pzzf_91`,indicator:`_indicator_1pzzf_95`,indicatorDot:`_indicatorDot_1pzzf_121`,body:`_body_1pzzf_127`,labelText:`_labelText_1pzzf_131`,icon:`_icon_1pzzf_133`,description:`_description_1pzzf_139`},u=n(),d=[...r.ease.standard],f=((e,t)=>{let n=2*Math.PI/(e*1.2);return{type:`spring`,stiffness:n*n,damping:2*(1-t)*n,mass:1}})(.42,.14),p=()=>()=>{};function m(){let e=(0,c.useSyncExternalStore)(p,()=>!0,()=>!1);return!!s()&&e}var h=(0,c.forwardRef)(function({options:e,value:t,defaultValue:n=null,onValueChange:s,layout:p=`grid`,density:h=`default`,minColumnWidth:g=180,name:_,required:v,disabled:y=!1,className:b,style:x,...S},C){let w=h===`compact`,T=m(),E=(0,c.useId)().replace(/[^a-zA-Z0-9_-]/g,``),D=(0,c.useRef)(null);(0,c.useImperativeHandle)(C,()=>D.current);let[O,k]=(0,c.useState)(n),A=t===void 0?O:t,j=e.findIndex(e=>e.value===A),M=e=>!y&&!e.disabled,N=j>=0&&M(e[j])?j:e.findIndex(M),P=e=>{e!==A&&(t===void 0&&k(e),s?.(e))},F=a(0),I=a(0),L=a(0),R=a(0),z=a(0),B=(0,c.useRef)(!1),V=(0,c.useCallback)(e=>{let t=j<0?null:D.current?.querySelector(`[data-card="${j}"]`);if(!t){z.set(0),B.current=!1;return}let n=[t.offsetLeft,t.offsetTop,t.offsetWidth,t.offsetHeight];if(!e||!B.current||T){F.jump(n[0]),I.jump(n[1]),L.jump(n[2]),R.jump(n[3]),!B.current&&!T&&e?(z.jump(0),o(z,1,{duration:r.duration.fast,ease:d})):z.jump(1),B.current=!0;return}o(F,n[0],f),o(I,n[1],f),o(L,n[2],f),o(R,n[3],f),z.set(1)},[R,z,T,j,L,F,I]),H=(0,c.useRef)(V);(0,c.useLayoutEffect)(()=>{H.current=V,V(!0)},[V]),(0,c.useLayoutEffect)(()=>{let e=D.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>H.current(!1));return t.observe(e),()=>t.disconnect()},[]);let U=()=>Array.from(D.current?.querySelectorAll(`[data-card]`)??[]),W=(t,n)=>{let r=t.key===`ArrowRight`||t.key===`ArrowDown`?1:t.key===`ArrowLeft`||t.key===`ArrowUp`?-1:0;if(t.key===` `||t.key===`Enter`){t.preventDefault(),M(e[n])&&P(e[n].value);return}if(!r&&t.key!==`Home`&&t.key!==`End`)return;t.preventDefault();let i=e.length,a=r&&(t.key===`ArrowLeft`||t.key===`ArrowRight`)&&getComputedStyle(t.currentTarget).direction===`rtl`?-1:1,o=t.key===`Home`?-1:t.key===`End`?i:n,s=t.key===`Home`?1:t.key===`End`?-1:r*a;for(let t=0;t<i;t++)if(o=(o+s+i)%i,M(e[o])){U()[o]?.focus(),P(e[o].value);return}};return(0,u.jsxs)(`div`,{ref:D,role:`radiogroup`,"aria-disabled":y||void 0,"aria-required":v||void 0,className:[l.root,b].filter(Boolean).join(` `),"data-layout":p,"data-density":h,style:{"--min-column":`${g}px`,...x},...S,children:[(0,u.jsx)(i.span,{className:l.ring,style:{x:F,y:I,width:L,height:R,opacity:z},"aria-hidden":`true`}),e.map((e,t)=>{let n=t===j,a=!M(e),o=`${E}-${t}-label`,s=`${E}-${t}-description`,c=a&&e.disabledReason?e.disabledReason:e.description,d=e.icon&&(0,u.jsx)(`span`,{className:l.icon,children:e.icon});return(0,u.jsxs)(`div`,{role:`radio`,"data-card":t,className:l.card,"aria-checked":n,"aria-disabled":a||void 0,"aria-labelledby":o,"aria-describedby":c?s:void 0,tabIndex:t===N?0:-1,"data-checked":n||void 0,onClick:()=>{a||P(e.value)},onKeyDown:e=>W(e,t),children:[w?d:(0,u.jsx)(`span`,{className:l.indicator,"aria-hidden":`true`,children:(0,u.jsx)(i.span,{className:l.indicatorDot,initial:!1,animate:{scale:+!!n},transition:T?{duration:0}:r.spring.snappy})}),(0,u.jsxs)(`span`,{className:l.body,children:[(0,u.jsxs)(`span`,{id:o,className:l.label,children:[!w&&d,(0,u.jsx)(`span`,{className:l.labelText,children:e.label})]}),c&&(0,u.jsx)(`span`,{id:s,className:l.description,children:c})]}),e.meta&&(0,u.jsx)(`span`,{className:l.meta,children:e.meta})]},e.value)}),_&&(0,u.jsx)(`input`,{type:`hidden`,name:_,value:A??``,required:v})]})});export{h as t};
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$s as n,Z as r,cs as i,ls as a,os as o,ss as s}from"./format-CskGUFYy.js";var c=e(t(),1),l={root:`_root_1pzzf_1`,ring:`_ring_1pzzf_31`,card:`_card_1pzzf_51`,label:`_label_1pzzf_91`,meta:`_meta_1pzzf_91`,indicator:`_indicator_1pzzf_95`,indicatorDot:`_indicatorDot_1pzzf_121`,body:`_body_1pzzf_127`,labelText:`_labelText_1pzzf_131`,icon:`_icon_1pzzf_133`,description:`_description_1pzzf_139`},u=n(),d=[...r.ease.standard],f=((e,t)=>{let n=2*Math.PI/(e*1.2);return{type:`spring`,stiffness:n*n,damping:2*(1-t)*n,mass:1}})(.42,.14),p=()=>()=>{};function m(){let e=(0,c.useSyncExternalStore)(p,()=>!0,()=>!1);return!!i()&&e}var h=(0,c.forwardRef)(function({options:e,value:t,defaultValue:n=null,onValueChange:i,layout:p=`grid`,density:h=`default`,minColumnWidth:g=180,name:_,required:v,disabled:y=!1,className:b,style:x,...S},C){let w=h===`compact`,T=m(),E=(0,c.useId)().replace(/[^a-zA-Z0-9_-]/g,``),D=(0,c.useRef)(null);(0,c.useImperativeHandle)(C,()=>D.current);let[O,k]=(0,c.useState)(n),A=t===void 0?O:t,j=e.findIndex(e=>e.value===A),M=e=>!y&&!e.disabled,N=j>=0&&M(e[j])?j:e.findIndex(M),P=e=>{e!==A&&(t===void 0&&k(e),i?.(e))},F=a(0),I=a(0),L=a(0),R=a(0),z=a(0),B=(0,c.useRef)(!1),V=(0,c.useCallback)(e=>{let t=j<0?null:D.current?.querySelector(`[data-card="${j}"]`);if(!t){z.set(0),B.current=!1;return}let n=[t.offsetLeft,t.offsetTop,t.offsetWidth,t.offsetHeight];if(!e||!B.current||T){F.jump(n[0]),I.jump(n[1]),L.jump(n[2]),R.jump(n[3]),!B.current&&!T&&e?(z.jump(0),s(z,1,{duration:r.duration.fast,ease:d})):z.jump(1),B.current=!0;return}s(F,n[0],f),s(I,n[1],f),s(L,n[2],f),s(R,n[3],f),z.set(1)},[R,z,T,j,L,F,I]),H=(0,c.useRef)(V);(0,c.useLayoutEffect)(()=>{H.current=V,V(!0)},[V]),(0,c.useLayoutEffect)(()=>{let e=D.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>H.current(!1));return t.observe(e),()=>t.disconnect()},[]);let U=()=>Array.from(D.current?.querySelectorAll(`[data-card]`)??[]),W=(t,n)=>{let r=t.key===`ArrowRight`||t.key===`ArrowDown`?1:t.key===`ArrowLeft`||t.key===`ArrowUp`?-1:0;if(t.key===` `||t.key===`Enter`){t.preventDefault(),M(e[n])&&P(e[n].value);return}if(!r&&t.key!==`Home`&&t.key!==`End`)return;t.preventDefault();let i=e.length,a=r&&(t.key===`ArrowLeft`||t.key===`ArrowRight`)&&getComputedStyle(t.currentTarget).direction===`rtl`?-1:1,o=t.key===`Home`?-1:t.key===`End`?i:n,s=t.key===`Home`?1:t.key===`End`?-1:r*a;for(let t=0;t<i;t++)if(o=(o+s+i)%i,M(e[o])){U()[o]?.focus(),P(e[o].value);return}};return(0,u.jsxs)(`div`,{ref:D,role:`radiogroup`,"aria-disabled":y||void 0,"aria-required":v||void 0,className:[l.root,b].filter(Boolean).join(` `),"data-layout":p,"data-density":h,style:{"--min-column":`${g}px`,...x},...S,children:[(0,u.jsx)(o.span,{className:l.ring,style:{x:F,y:I,width:L,height:R,opacity:z},"aria-hidden":`true`}),e.map((e,t)=>{let n=t===j,i=!M(e),a=`${E}-${t}-label`,s=`${E}-${t}-description`,c=i&&e.disabledReason?e.disabledReason:e.description,d=e.icon&&(0,u.jsx)(`span`,{className:l.icon,children:e.icon});return(0,u.jsxs)(`div`,{role:`radio`,"data-card":t,className:l.card,"aria-checked":n,"aria-disabled":i||void 0,"aria-labelledby":a,"aria-describedby":c?s:void 0,tabIndex:t===N?0:-1,"data-checked":n||void 0,onClick:()=>{i||P(e.value)},onKeyDown:e=>W(e,t),children:[w?d:(0,u.jsx)(`span`,{className:l.indicator,"aria-hidden":`true`,children:(0,u.jsx)(o.span,{className:l.indicatorDot,initial:!1,animate:{scale:+!!n},transition:T?{duration:0}:r.spring.snappy})}),(0,u.jsxs)(`span`,{className:l.body,children:[(0,u.jsxs)(`span`,{id:a,className:l.label,children:[!w&&d,(0,u.jsx)(`span`,{className:l.labelText,children:e.label})]}),c&&(0,u.jsx)(`span`,{id:s,className:l.description,children:c})]}),e.meta&&(0,u.jsx)(`span`,{className:l.meta,children:e.meta})]},e.value)}),_&&(0,u.jsx)(`input`,{type:`hidden`,name:_,value:A??``,required:v})]})});export{h as t};
@@ -1,4 +1,4 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{is as n}from"./format-CmXxTS5M.js";var r=e(n()),i=e(t());function a(){var e=[...arguments];return(0,i.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var o=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function s(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function c(e){return`nodeType`in e}function l(e){return e?s(e)?e:c(e)?e.ownerDocument?.defaultView??window:window:window}function u(e){let{Document:t}=l(e);return e instanceof t}function d(e){return!s(e)&&e instanceof l(e).HTMLElement}function f(e){return e instanceof l(e).SVGElement}function p(e){return e?s(e)?e.document:c(e)?u(e)?e:d(e)||f(e)?e.ownerDocument:document:document:document}var m=o?i.useLayoutEffect:i.useEffect;function h(e){let t=(0,i.useRef)(e);return m(()=>{t.current=e}),(0,i.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function g(){let e=(0,i.useRef)(null);return[(0,i.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,i.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function _(e,t){t===void 0&&(t=[e]);let n=(0,i.useRef)(e);return m(()=>{n.current!==e&&(n.current=e)},t),n}function v(e,t){let n=(0,i.useRef)();return(0,i.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function y(e){let t=h(e),n=(0,i.useRef)(null);return[n,(0,i.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function b(e){let t=(0,i.useRef)();return(0,i.useEffect)(()=>{t.current=e},[e]),t.current}var x={};function S(e,t){return(0,i.useMemo)(()=>{if(t)return t;let n=x[e]==null?0:x[e]+1;return x[e]=n,e+`-`+n},[e,t])}function C(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var w=C(1),T=C(-1);function E(e){return`clientX`in e&&`clientY`in e}function D(e){if(!e)return!1;let{KeyboardEvent:t}=l(e.target);return t&&e instanceof t}function ee(e){if(!e)return!1;let{TouchEvent:t}=l(e.target);return t&&e instanceof t}function te(e){if(ee(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return E(e)?{x:e.clientX,y:e.clientY}:null}var O=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[O.Translate.toString(e),O.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),k=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function A(e){return e.matches(k)?e:e.querySelector(k)}var ne={display:`none`};function re(e){let{id:t,value:n}=e;return i.createElement(`div`,{id:t,style:ne},n)}function j(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return i.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ie(){let[e,t]=(0,i.useState)(``);return{announce:(0,i.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ae=(0,i.createContext)(null);function M(e){let t=(0,i.useContext)(ae);(0,i.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function oe(){let[e]=(0,i.useState)(()=>new Set),t=(0,i.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,i.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var se={draggable:`
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{as as n}from"./format-CskGUFYy.js";var r=e(n()),i=e(t());function a(){var e=[...arguments];return(0,i.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var o=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function s(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function c(e){return`nodeType`in e}function l(e){return e?s(e)?e:c(e)?e.ownerDocument?.defaultView??window:window:window}function u(e){let{Document:t}=l(e);return e instanceof t}function d(e){return!s(e)&&e instanceof l(e).HTMLElement}function f(e){return e instanceof l(e).SVGElement}function p(e){return e?s(e)?e.document:c(e)?u(e)?e:d(e)||f(e)?e.ownerDocument:document:document:document}var m=o?i.useLayoutEffect:i.useEffect;function h(e){let t=(0,i.useRef)(e);return m(()=>{t.current=e}),(0,i.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function g(){let e=(0,i.useRef)(null);return[(0,i.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,i.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function _(e,t){t===void 0&&(t=[e]);let n=(0,i.useRef)(e);return m(()=>{n.current!==e&&(n.current=e)},t),n}function v(e,t){let n=(0,i.useRef)();return(0,i.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function y(e){let t=h(e),n=(0,i.useRef)(null);return[n,(0,i.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function b(e){let t=(0,i.useRef)();return(0,i.useEffect)(()=>{t.current=e},[e]),t.current}var x={};function S(e,t){return(0,i.useMemo)(()=>{if(t)return t;let n=x[e]==null?0:x[e]+1;return x[e]=n,e+`-`+n},[e,t])}function C(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var w=C(1),T=C(-1);function E(e){return`clientX`in e&&`clientY`in e}function D(e){if(!e)return!1;let{KeyboardEvent:t}=l(e.target);return t&&e instanceof t}function ee(e){if(!e)return!1;let{TouchEvent:t}=l(e.target);return t&&e instanceof t}function te(e){if(ee(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return E(e)?{x:e.clientX,y:e.clientY}:null}var O=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[O.Translate.toString(e),O.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),k=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function A(e){return e.matches(k)?e:e.querySelector(k)}var ne={display:`none`};function re(e){let{id:t,value:n}=e;return i.createElement(`div`,{id:t,style:ne},n)}function j(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return i.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ie(){let[e,t]=(0,i.useState)(``);return{announce:(0,i.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ae=(0,i.createContext)(null);function M(e){let t=(0,i.useContext)(ae);(0,i.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function oe(){let[e]=(0,i.useState)(()=>new Set),t=(0,i.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,i.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var se={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -0,0 +1 @@
1
+ import{Ss as e,_s as t,bs as n,ls as r,vs as i,xs as a,ys as o}from"./format-CskGUFYy.js";function s(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],a=e[1+n],o=e[2+n],s=e[3+n],c=i(a,o,s);return t?c(r):c}function c(e,t){let i=r(t()),s=()=>i.set(t());return s(),a(()=>{let t=()=>n.preRender(s,!1,!0),r=e.map(e=>e.on(`change`,t));return()=>{r.forEach(e=>e()),o(s)}}),i}function l(e){t.current=[],e();let n=c(t.current,e);return t.current=void 0,n}function u(e,t,n,r){if(typeof e==`function`)return l(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return f(e,t,n,r);let i=typeof t==`function`?t:s(t,n,r),a=Array.isArray(e)?d(e,i):d([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;if(o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1){let e=r?.ease;a.accelerate={...o,times:[0,...t,1],keyframes:[n[0],...n,n[n.length-1]],isTransformed:!0,...e?{ease:Array.isArray(e)?[e[0],...e]:e}:{}}}return a}function d(t,n){let r=e(()=>[]);return c(t,()=>{r.length=0;let e=t.length;for(let n=0;n<e;n++)r[n]=t[n].get();return n(r)})}function f(t,n,r,i){let a=e(()=>Object.keys(r)),o=e(()=>({}));for(let e of a)o[e]=u(t,n,r[e],i);return o}export{u as t};
@@ -7,7 +7,7 @@
7
7
  <link rel="icon" type="image/png" href="/favicon.png" />
8
8
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9
9
  <title>Astra</title>
10
- <script type="module" crossorigin src="/assets/index-BW8keTkg.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-D2siu6xk.js"></script>
11
11
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-7fjTeqBK.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/check-DKfsh0bQ.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/chevron-down-CQQqnJvT.js">
@@ -20,10 +20,10 @@
20
20
  <link rel="modulepreload" crossorigin href="/assets/search-NI5nOaOz.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/triangle-alert-DMn3ceGk.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/x-AFrW8zH7.js">
23
- <link rel="modulepreload" crossorigin href="/assets/format-CmXxTS5M.js">
23
+ <link rel="modulepreload" crossorigin href="/assets/format-CskGUFYy.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/chevron-up-BNvDpRa-.js">
25
- <link rel="modulepreload" crossorigin href="/assets/TrayTitleSource-DN10ruw2.js">
26
- <link rel="modulepreload" crossorigin href="/assets/use-transform-BcmlojQJ.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/TrayTitleSource-B98nYas3.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/use-transform-BPiFWEVF.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/app-window-C13qqwdi.js">
28
28
  <link rel="modulepreload" crossorigin href="/assets/arrow-right-qPGkuoiX.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/arrow-up-DE65OgjV.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidotnet/server-win32-x64",
3
- "version": "0.14.3112",
3
+ "version": "0.14.3114",
4
4
  "description": "Astra self-contained server binary for Windows (x64).",
5
5
  "license": "MIT",
6
6
  "os": [
@@ -1,11 +0,0 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$i as n,Ai as r,B as i,Bi as a,Ct as o,D as s,F as c,Gn as l,H as u,Hn as d,I as f,M as p,N as m,O as h,P as g,Qr as _,Qs as v,Qt as y,S as b,U as x,W as S,Wo as C,Wt as w,Xt as T,Za as E,Zn as ee,Zs as te,Zt as ne,aa as re,ca as ie,ci as D,d as O,da as ae,dt as k,go as A,hi as oe,kn as j,la as M,ln as se,nn as ce,o as N,r as le,s as P,si as ue,sn as de,tn as fe,ui as pe,un as F,w as I,wa as L,z as R}from"./format-CmXxTS5M.js";import{B as me,H as z,L as he,R as B,U as V,V as H,W as U}from"./TrayTitleSource-DN10ruw2.js";import{t as ge}from"./archive-CiVf7slo.js";import{t as W}from"./check-DKfsh0bQ.js";import{t as G}from"./chevron-right-Bgtn3ze-.js";import{t as _e}from"./circle-arrow-up-x7NR55Yx.js";import{t as ve}from"./copy-48gwhhDO.js";import{t as K}from"./ellipsis-CidyZaW2.js";import{t as ye}from"./external-link-D6jQM2CZ.js";import{t as be}from"./folder-open-z1RXMZa1.js";import{t as xe}from"./grip-vertical-DFI2_ajd.js";import{t as Se}from"./key-round-m9ps8ZDi.js";import{t as Ce}from"./layers-lBgMUT4n.js";import{t as we}from"./loader-circle-D-RkwQwX.js";import{t as Te}from"./plus-c3HzV6VX.js";import{t as Ee}from"./refresh-cw-CoLAai2c.js";import{t as De}from"./rotate-ccw-fsXoCwyv.js";import{t as q}from"./scroll-text-DjXe21uH.js";import{t as J}from"./shield-alert-psW-CN8y.js";import{t as Oe}from"./trash-BHBJn5GS.js";import{t as ke}from"./x-AFrW8zH7.js";import{a as Ae,c as je,d as Me,f as Ne,i as Pe,l as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be,u as Ve}from"./sortable.esm-Cj5-STJU.js";import{B as He,C as Ue,G as We,H as Ge,T as Y,W as Ke,i as qe,o as Je,v as Ye,w as Xe,x as Ze}from"./index-BW8keTkg.js";import{n as Qe}from"./ProvidersPage-BzICHtxh.js";var X=e(t(),1),Z=v(),$e=`astra claude`;function et(e){return e.reduce((e,t)=>({requests:e.requests+1,inputTokens:e.inputTokens+t.inputTokens,totalInputTokens:e.totalInputTokens+t.inputTokens+t.cacheReadTokens+t.cacheCreationTokens,outputTokens:e.outputTokens+t.outputTokens,failed:e.failed+ +(t.status===`error`),estimatedCostNanoUsd:e.estimatedCostNanoUsd+(t.estimatedCostNanoUsd??0)}),{requests:0,inputTokens:0,totalInputTokens:0,outputTokens:0,failed:0,estimatedCostNanoUsd:0})}var tt=e=>e.status===`active`&&e.enabled;function nt(e,t){let n=[e.name||e.id,e.email?`· ${e.email}`:null,e.plan?`· ${e.plan}`:null].filter(Boolean).join(` `);return tt(e)?n:`${n} · ${t}`}function rt({enabled:e,gatewayEnabled:t}){let{t:n}=I(),{toast:r}=U(),i=Ke(),a=fe(e),o=re(),[s,l]=(0,X.useState)(null),d=a.data?.mode??`gateway`,f=a.data?.accounts??[],p=a.data?.accountId??null??f.find(tt)?.id??null,g=f.find(e=>e.id===p),_=d===`direct`,v=t&&(_||a.data!=null),y=_&&g?.telemetryEnabled===!0,C=ce(y?g?.id:null,y),w=o.isPending,T=e=>o.mutate(e,{onError:e=>r(V(e),`error`)});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(c,{title:n(`clients.claudeDirect.modeTitle`),footer:n(`clients.claudeDirect.modeFooter`),children:[(0,Z.jsx)(R,{label:n(`clients.claudeDirect.mode`),detail:n(_?`clients.claudeDirect.directDetail`:`clients.claudeDirect.gatewayDetail`),children:(0,Z.jsx)(u,{ariaLabel:n(`clients.claudeDirect.mode`),value:d,onChange:e=>{if(e===d||w||!a.data)return;let t=p??f.find(tt)?.id??null;if(e===`direct`&&!t){r(n(`clients.claudeDirect.needAccountToast`),`error`);return}T({mode:e,accountId:t})},items:[{value:`gateway`,label:n(`clients.claudeDirect.gateway`)},{value:`direct`,label:n(`clients.claudeDirect.direct`)}]})}),(0,Z.jsx)(`p`,{className:`px-4 pb-2 text-[11px] text-[var(--text-muted)]`,children:n(`clients.claudeDirect.modeNote`)})]}),a.isLoading&&(0,Z.jsx)(x,{lines:3}),a.isError&&(0,Z.jsx)(`div`,{className:`mb-5`,children:(0,Z.jsx)(b,{tone:`danger`,title:n(`clients.claudeDirect.loadFailed`),children:V(a.error)})}),v&&(0,Z.jsx)(`div`,{className:`mb-5`,children:(0,Z.jsx)(b,{tone:`warning`,title:n(`clients.claudeDirect.gatewayOnTitle`),children:n(`clients.claudeDirect.gatewayOnDetail`)})}),a.data&&(0,Z.jsx)(c,{title:n(`clients.claudeDirect.accountsTitle`),footer:n(`clients.claudeDirect.accountsFooter`),children:f.length===0?(0,Z.jsx)(m,{title:n(`clients.claudeDirect.noAccount`),detail:n(`clients.claudeDirect.noAccountDetail`),action:(0,Z.jsx)(h,{variant:`primary`,onClick:()=>i(`/providers`),children:n(`clients.claudeDirect.goProviders`)})}):(0,Z.jsx)(R,{label:n(`clients.claudeDirect.account`),children:(0,Z.jsx)(H,{className:`max-w-[300px]`,ariaLabel:n(`clients.claudeDirect.account`),value:p,onChange:e=>{w||e===p||T({mode:d,accountId:e})},options:f.map(e=>({value:e.id,label:nt(e,n(`clients.claudeDirect.accountDisabledSuffix`,{status:n(`providers.subscription.status.${e.status}`)})),disabled:!tt(e)}))})})}),a.data&&_&&g&&(0,Z.jsx)(c,{title:n(`clients.claudeDirect.launchTitle`),footer:n(`clients.claudeDirect.launchNote`),children:(0,Z.jsx)(it,{command:$e,copied:s,onCopy:async e=>{await B.copy(e)&&(l(e),r(n(`common.copied`)))}})}),a.data&&_&&g&&(0,Z.jsxs)(c,{title:n(`clients.claudeDirect.statsTitle`),footer:n(`clients.claudeDirect.statsFooter`),children:[(0,Z.jsx)(R,{label:n(`clients.claudeDirect.statsConsent`),detail:n(`clients.claudeDirect.statsConsentDetail`),children:(0,Z.jsx)(S,{label:n(`clients.claudeDirect.statsConsent`),checked:g.telemetryEnabled,disabled:w,onChange:e=>{g&&!w&&T({mode:d,accountId:g.id,telemetryEnabled:e})}})}),y&&(0,Z.jsx)(at,{requests:C})]})]})}function it({command:e,copied:t,onCopy:n}){let{t:r}=I();return(0,Z.jsx)(R,{label:(0,Z.jsx)(`span`,{className:`font-mono text-[12px] break-all selectable`,children:e}),children:(0,Z.jsx)(h,{size:`sm`,icon:(0,Z.jsx)(ve,{className:`size-3`}),variant:t===e?`primary`:`glass`,"aria-label":r(`common.copy`),title:r(`common.copy`),onClick:()=>void n(e),children:r(t===e?`common.copied`:`common.copy`)})})}function at({requests:e}){let{t,locale:n}=I(),r=e.data??[],i=et(r);return e.isLoading?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(x,{lines:3})}):e.isError?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(b,{tone:`danger`,title:t(`clients.claudeDirect.statsFailed`),children:V(e.error)})}):r.length===0?(0,Z.jsx)(m,{icon:(0,Z.jsx)(Se,{className:`size-6`}),title:t(`clients.claudeDirect.statsEmpty`),detail:t(`clients.claudeDirect.statsEmptyDetail`)}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{label:t(`clients.claudeDirect.statsTotals`,{count:O(i.requests)}),detail:t(`clients.claudeDirect.statsInDetail`,{input:O(i.totalInputTokens),cache:O(r.reduce((e,t)=>e+t.cacheReadTokens,0)),output:O(i.outputTokens)})}),(0,Z.jsx)(R,{label:t(`clients.claudeDirect.statsCost`),detail:t(`clients.claudeDirect.statsCostDetail`),children:(0,Z.jsx)(`span`,{className:`num text-[13px]`,children:P(r.some(e=>e.estimatedCostNanoUsd!=null)?i.estimatedCostNanoUsd:null)})}),i.failed>0&&(0,Z.jsx)(R,{label:t(`clients.claudeDirect.statsFailedCount`,{count:O(i.failed)}),children:(0,Z.jsx)(s,{tone:`red`,children:t(`clients.claudeDirect.statusError`)})}),r.map(e=>(0,Z.jsx)(R,{label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.model}),e.status===`error`?(0,Z.jsx)(s,{tone:`red`,children:t(`clients.claudeDirect.statusError`)}):(0,Z.jsx)(s,{tone:`green`,children:t(`status.success`)})]}),detail:(0,Z.jsx)(`span`,{className:`num`,children:[le(e.occurredAtUtc,n),t(`clients.claudeDirect.tokensDetail`,{input:O(e.inputTokens),output:O(e.outputTokens)}),e.durationMs==null?null:N(e.durationMs),e.accountUuid??null].filter(Boolean).join(` · `)}),children:(0,Z.jsx)(`span`,{className:`num text-[13px]`,children:P(e.estimatedCostNanoUsd)})},e.id))]})}function ot({descriptors:e,values:t,onChange:n,enabled:r}){let{t:i}=I(),a=(e,r)=>{let i={...t};r===void 0||r===!1||r===0||r==="default"||r===``?delete i[e]:i[e]=r,n(i)};return(0,Z.jsx)(c,{title:i(`clients.options.title`),footer:i(r?`clients.options.footerEnabled`:`clients.options.footer`),children:e.map(e=>{let n=i(`clients.option.${e.key}`),r=i(`clients.option.${e.key}.hint`),o=t[e.key];return(0,Z.jsxs)(R,{label:n,detail:r,children:[e.type===`bool`&&(0,Z.jsx)(S,{label:n,checked:o===!0,onChange:t=>a(e.key,t)}),e.type===`int`&&(0,Z.jsx)(f,{className:`w-36`,mono:!0,inputMode:`numeric`,"aria-label":n,placeholder:i(`clients.options.unset`),value:typeof o==`number`?String(o):``,onChange:t=>{let n=Number.parseInt(t.target.value.replace(/\D/g,``),10);a(e.key,Number.isFinite(n)?n:void 0)}}),e.type===`enum`&&(0,Z.jsx)(H,{ariaLabel:n,value:typeof o==`string`?o:`default`,onChange:t=>a(e.key,t),options:(e.choices??[]).map(e=>({value:e,label:i(`clients.optionChoice.${e}`)})),className:`w-36`})]},e.key)})})}var st=[`openai-chat`,`openai-responses`,`anthropic`,`gemini`],ct=e=>typeof e==`string`&&st.includes(e);function lt(e){let t=e?.protocolOverrides,n={};if(!t||typeof t!=`object`)return n;for(let[e,r]of Object.entries(t))ct(r)&&(n[e]=r);return n}function ut(e){let t=e?.models;if(!t||typeof t!=`object`)return[];let n=[];for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let t=e;typeof t.id==`string`&&t.id&&!n.some(e=>e.id===t.id)&&n.push({id:t.id,name:typeof t.name==`string`&&t.name?t.name:t.id,native:Array.isArray(t.protocols)?t.protocols.filter(ct):[]})}return n}function dt(e,t){let n=e.native.find(e=>t.includes(e));return n?{protocol:n,translated:!1}:{protocol:t[0],translated:!0}}var ft=e=>Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`
2
- `),pt=`auto`,mt=e=>Qe.find(t=>t.value===e)?.label??e;function ht({models:e,supported:t,values:n,onChange:r,enabled:i}){let{t:a}=I(),o=(e,t)=>{let i={...n};t===pt?delete i[e]:i[e]=t,r(i)};return(0,Z.jsx)(c,{title:a(`clients.protocols.title`),footer:a(i?`clients.protocols.footerEnabled`:`clients.protocols.footer`),children:e.map(e=>{let r=dt(e,t),i=e.native.filter(e=>t.includes(e));return(0,Z.jsx)(R,{label:e.name,detail:i.length>0?a(`clients.protocols.native`,{protocols:i.map(mt).join(` · `)}):a(`clients.protocols.noNative`),children:(0,Z.jsx)(H,{ariaLabel:e.name,className:`w-60`,value:n[e.id]&&t.includes(n[e.id])?n[e.id]:pt,onChange:t=>o(e.id,t),options:[{value:pt,label:a(r.translated?`clients.protocols.autoTranslated`:`clients.protocols.auto`,{protocol:mt(r.protocol)})},...t.map(e=>({value:e,label:mt(e)}))]})},e.id)})})}function gt(e){let t=e?.modelShortlist;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function _t({client:e}){let{t}=I(),{toast:n}=U(),r=se(e.kind,!0,!0),a=ae(),o=gt(e.extras),s=o.join(`
3
- `),[l,u]=(0,X.useState)(o),[d,f]=(0,X.useState)(``);(0,X.useEffect)(()=>u(gt(e.extras)),[e.kind,s]);let p=(0,X.useMemo)(()=>r.data??[],[r.data]),m=(0,X.useMemo)(()=>[...p,...l.filter(e=>!p.includes(e))],[p,l]),g=m.filter(e=>e.toLowerCase().includes(d.trim().toLowerCase())),_=l.join(`
4
- `)!==s,v=(e,t)=>u(n=>t?[...n,e]:n.filter(t=>t!==e)),y=r=>a.mutate({kind:e.kind,models:r},{onSuccess:()=>n(t(`common.saved`),`success`),onError:e=>n(V(e),`error`)});return(0,Z.jsxs)(c,{title:t(`clients.shortlist.title`),footer:e.enabled?t(`clients.shortlist.footerEnabled`):t(`clients.shortlist.footer`),children:[(0,Z.jsxs)(R,{label:l.length===0?t(`clients.shortlist.empty`):t(`clients.shortlist.summary`,{count:l.length,total:m.length}),children:[l.length>0&&(0,Z.jsx)(h,{size:`sm`,onClick:()=>u([]),children:t(`clients.shortlist.clear`)}),_&&(0,Z.jsx)(h,{size:`sm`,variant:`primary`,loading:a.isPending,onClick:()=>y(l),children:t(`common.apply`)})]}),r.isLoading&&(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(x,{lines:2})}),m.length>8&&(0,Z.jsx)(`div`,{className:`px-4 py-2`,children:(0,Z.jsx)(i,{value:d,onChange:f,placeholder:t(`clients.shortlist.filter`)})}),(0,Z.jsx)(`div`,{className:`max-h-[320px] overflow-y-auto`,children:g.map(e=>(0,Z.jsx)(R,{label:(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:e}),detail:p.includes(e)?void 0:t(`clients.shortlist.missing`),children:(0,Z.jsx)(S,{checked:l.includes(e),onChange:t=>v(e,t),label:e})},e))})]})}var vt={enable:`green`,update:`accent`,disable:`orange`,store:`neutral`,unchanged:`neutral`,skipped:`orange`,failed:`red`};function yt(){let{t:e}=I(),{toast:t,confirm:r}=U(),i=D(),a=n(),o=A(),c=j(),l=i.data??[],u=l.find(e=>e.active),[d,p]=(0,X.useState)(``),m=l.find(e=>e.id===d)??u??l[0],[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(null),x=()=>{if(!_)return;let n=_.name.trim();if(!n)return;let r=n=>{v(null),p(n.id),t(e(`profiles.saved`,{name:n.name}),`success`)};_.id===null?a.mutate(n,{onSuccess:r,onError:e=>t(V(e),`error`)}):o.mutate({id:_.id,name:n},{onSuccess:r,onError:e=>t(V(e),`error`)})},S=async n=>{await r({title:e(`profiles.overwriteConfirm`,{name:n.name}),confirmLabel:e(`profiles.overwrite`)})&&o.mutate({id:n.id,overwrite:!0},{onSuccess:()=>t(e(`profiles.saved`,{name:n.name}),`success`),onError:e=>t(V(e),`error`)})},C=async n=>{await r({title:e(`profiles.deleteConfirm`,{name:n.name}),confirmLabel:e(`profiles.delete`),destructive:!0})&&c.mutate(n.id,{onSuccess:()=>p(``),onError:e=>t(V(e),`error`)})};return(0,Z.jsxs)(`div`,{className:`card mb-4 flex flex-wrap items-center gap-3 px-4 py-2.5`,children:[(0,Z.jsx)(Ce,{className:`size-4 text-[var(--text-secondary)]`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[13px] font-medium`,children:e(`profiles.title`)}),l.length===0?(0,Z.jsx)(`span`,{className:`text-[12px] text-[var(--text-secondary)]`,children:e(`profiles.none`)}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{className:`w-[220px]`,ariaLabel:e(`profiles.pick`),value:m?.id??``,onChange:p,options:l.map(t=>({value:t.id,label:t.name,detail:e(`profiles.clientCount`,{count:t.clients.length})}))}),m?.active&&!m.drifted&&(0,Z.jsx)(s,{tone:`green`,children:e(`profiles.active`)}),m?.active&&m.drifted&&(0,Z.jsxs)(s,{tone:`orange`,title:e(`profiles.driftedHint`),children:[e(`profiles.active`),` · `,e(`profiles.drifted`)]})]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[m&&(0,Z.jsx)(h,{variant:`primary`,size:`sm`,onClick:()=>b(m.id),children:e(`profiles.apply`)}),(0,Z.jsx)(h,{size:`sm`,onClick:()=>v({id:null,name:``}),children:e(`profiles.save`)}),m&&(0,Z.jsx)(me,{label:e(`profiles.title`),icon:(0,Z.jsx)(K,{className:`size-4`}),iconOnly:!0,items:[{id:`overwrite`,label:e(`profiles.overwrite`),onSelect:()=>void S(m)},{id:`rename`,label:e(`profiles.rename`),onSelect:()=>v({id:m.id,name:m.name})},{id:`delete`,label:e(`profiles.delete`),destructive:!0,separatorBefore:!0,onSelect:()=>void C(m)}]})]}),(0,Z.jsx)(z,{open:_!==null,onOpenChange:e=>!e&&v(null),width:420,title:_?.id===null?e(`profiles.saveTitle`):e(`profiles.rename`),description:_?.id===null?e(`profiles.subtitle`):void 0,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{onClick:()=>v(null),children:e(`common.cancel`)}),(0,Z.jsx)(h,{variant:`primary`,disabled:!_?.name.trim(),loading:a.isPending||o.isPending,onClick:x,children:e(`common.save`)})]}),children:(0,Z.jsx)(g,{label:e(`profiles.name`),children:(0,Z.jsx)(f,{autoFocus:!0,maxLength:64,value:_?.name??``,onChange:e=>v(t=>t&&{...t,name:e.target.value}),onKeyDown:e=>e.key===`Enter`&&x()})})}),(0,Z.jsx)(St,{profile:l.find(e=>e.id===y)??null,onClose:()=>b(null)})]})}function bt(e,t){let n=[];e.reason&&n.push(e.action===`failed`?e.reason:t(`profiles.reason.${e.reason}`)),e.changes.length>0&&n.push(e.changes.map(e=>e.keyPath).join(`, `));for(let r of e.notes)n.push(r.startsWith(`drifted:`)?t(`profiles.drift`,{key:r.slice(8)}):r);return n.join(` · `)}function xt(e,t){let n=e.what===`provider`?t(`profiles.drop.provider.${e.reason}`,{id:e.id}):t(`profiles.drop.${e.what}`,{id:e.id});return`${e.kind}: ${n}`}function St({profile:e,onClose:t}){let{t:n}=I(),{toast:r}=U(),i=ue(e?.id,e!==null),a=w(),o=(i.data?.steps??[]).filter(e=>e.action!==`unchanged`);return(0,Z.jsxs)(z,{open:e!==null,onOpenChange:e=>!e&&t(),width:620,title:n(`profiles.previewTitle`,{name:e?.name??``}),description:n(`profiles.previewDetail`),footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{onClick:t,children:n(`common.cancel`)}),(0,Z.jsx)(h,{variant:`primary`,disabled:!i.data,loading:a.isPending,onClick:()=>{e&&a.mutate(e.id,{onSuccess:i=>{let a=i.steps.filter(e=>e.action===`skipped`||e.action===`failed`).length;r(a>0?n(`profiles.appliedPartial`,{name:e.name,count:a}):n(`profiles.applied`,{name:e.name}),a>0?void 0:`success`),t()},onError:e=>r(V(e),`error`)})},children:n(`profiles.apply`)})]}),children:[i.isPending&&(0,Z.jsx)(x,{lines:4}),i.isError&&(0,Z.jsx)(b,{tone:`danger`,title:n(`common.error`),children:V(i.error)}),i.data&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.length===0&&(0,Z.jsx)(b,{tone:`info`,title:n(`profiles.nothing`)}),(0,Z.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:o.map(e=>(0,Z.jsx)(R,{label:e.name,detail:bt(e,n)||void 0,children:(0,Z.jsx)(s,{tone:vt[e.action],children:n(`profiles.action.${e.action}`)})},e.kind))}),i.data.dropped.length>0&&(0,Z.jsx)(b,{tone:`warning`,title:n(`profiles.dropped`),children:i.data.dropped.map((e,t)=>(0,Z.jsx)(`span`,{className:`block break-all`,children:xt(e,n)},t))})]})]})}function Ct(e,t){if(!(e instanceof C)||e.status!==409)return null;let n=e.details;return n?.providerName?{title:t(`clients.providerDisabledTitle`,{name:n.providerName}),hint:t(n.pluginOff?`clients.providerDisabledPluginHint`:`clients.providerDisabledHint`)}:null}function wt(e,t){let n=e?.options,r={};if(!n||typeof n!=`object`)return r;for(let e of t??[]){let t=n[e.key];e.type===`bool`&&t===!0?r[e.key]=!0:(e.type===`int`&&typeof t==`number`&&t>0||e.type===`enum`&&typeof t==`string`&&t!=="default"&&e.choices?.includes(t))&&(r[e.key]=t)}return r}var Tt=e=>Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`
5
- `),Et=[`ANTHROPIC_MODEL`,`ANTHROPIC_DEFAULT_FABLE_MODEL`,`ANTHROPIC_DEFAULT_OPUS_MODEL`,`ANTHROPIC_DEFAULT_SONNET_MODEL`,`ANTHROPIC_DEFAULT_HAIKU_MODEL`,`CLAUDE_CODE_SUBAGENT_MODEL`];function Dt(e){let t=e?.models,n={};if(!t||typeof t!=`object`)return n;for(let e of Et){let r=t[e];typeof r==`string`&&r.trim()&&(n[e]=r.trim())}return n}var Ot=e=>Et.map(t=>e[t]??``).join(`
6
- `),Q=[`sonnet`,`opus`,`haiku`];function kt(e){let t=e?.roleMap,n={};if(!t||typeof t!=`object`)return n;for(let e of Q){let r=t[e];typeof r==`string`&&r.trim()&&(n[e]=r.trim())}return n}var $=e=>Q.map(t=>e[t]??``).join(`
7
- `),At=/(^|[-_.:/\s])(haiku|flash|mini|lite|nano|small|fast|air)($|[-_.:/\s])/i;function jt(e){if(e.length===0)return{};let t=t=>e.find(e=>e.toLowerCase().includes(t)),n=e.find(e=>!At.test(e))??e[0],r=e.find(e=>At.test(e))??n;return{sonnet:t(`sonnet`)??n,opus:t(`opus`)??t(`sonnet`)??n,haiku:t(`haiku`)??r}}function Mt(){let{t:e}=I(),t=Ke(),{toast:n}=U(),r=We(),i=F(),a=y(),o=(0,X.useMemo)(()=>new Map((i.data??[]).map(e=>[e.kind,e])),[i.data]),s=Pt(i.data).includes(r.kind)?r.kind:`codex`,c=o.get(s);return(0,X.useEffect)(()=>a.mutate(!1),[]),(0,Z.jsx)(Ye,{title:e(`nav.clients`),subtitle:e(`clients.subtitle`),actions:(0,Z.jsx)(h,{icon:(0,Z.jsx)(Ee,{className:`size-3.5`}),loading:a.isPending,onClick:()=>a.mutate(!0,{onSuccess:t=>{let r=t.filter(e=>e.install?.updateAvailable&&e.install.blocker!==`shadowed`).length;n(r>0?e(`clients.updatesFound`,{count:r}):e(`clients.allUpToDate`),r>0?void 0:`success`)},onError:e=>n(V(e),`error`)}),children:e(`clients.checkUpdates`)}),children:(0,Z.jsxs)(`div`,{className:`@container mx-auto max-w-[1200px]`,children:[(0,Z.jsx)(yt,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start @3xl:gap-5`,children:[(0,Z.jsx)(zt,{clients:i.data,loading:i.isLoading,selected:s,onSelect:e=>t(`/clients/${e}`,{replace:!0})}),(0,Z.jsxs)(`div`,{className:`mx-auto w-full max-w-[760px] min-w-0 flex-1`,children:[i.isLoading&&(0,Z.jsx)(x,{lines:4}),i.isError&&(0,Z.jsx)(b,{tone:`danger`,title:e(`common.error`),children:V(i.error)}),c&&(0,Z.jsx)(Ut,{client:c}),c&&(0,Z.jsxs)(`div`,{className:`mt-6`,children:[(0,Z.jsx)(qe,{menu:`client.row`,args:{clientKind:c.kind}}),(0,Z.jsx)(Je,{name:`client.detail.sections`,params:{clientKind:c.kind}})]})]})]})]})})}var Nt=new Set(`opencode.pi.minimax-code.copilot-cli.vscode-copilot.crush.qwen-code.droid.kimi-code.zed.vscode-insiders.vscodium.omp.mimo-code.deepseek-harness.workbuddy.workbuddy-ai.nextcowork.paseo.zcode.tkcode.muse-code.codex.grok-build.hermes-agent.openchamber.deveco-code.stepcode.aside.omo.prime-agent.mu.mothx.penguin-harness.antigravity-cli.dim.command-code.fx.goose.zoo-code.jetbrains-air.air-ide.copilot-jetbrains.codebuddy.qoder.qoder-cn.t3code.pencil.openpencil.raycast.obsidian.reasonix.morph.jcode.vibe.empryo.nanobot.miniq.paimon.cline.grok-app.atomcode.snow.ante.craft-agents.tuanjie-cowork.liveagent.openmausbot.astrbot.qwenpaw.openclaw.openbot`.split(`.`));function Pt(e){let t=(e??[]).filter(e=>!Ze.includes(e.kind)).sort((e,t)=>e.name.localeCompare(t.name));return[...Ze,...t.map(e=>e.kind)]}var Ft=[`installed`,`notInstalled`,`comingSoon`],It=new Set([`notInstalled`]);function Lt(e){return e.availability===`coming_soon`?`comingSoon`:e.detection.installed||e.enabled||e.install?.installed?`installed`:`notInstalled`}function Rt(e){return e.install?.version??e.detection.version??null}function zt({clients:e,loading:t,selected:n,onSelect:r}){let{t:i}=I(),[a,o]=(0,X.useState)(new Set),s=new Map((e??[]).map(e=>[e.kind,e])),c=Ft.map(t=>({group:t,items:Pt(e).flatMap(e=>{let n=s.get(e);return n&&Lt(n)===t?[n]:[]})})).filter(e=>e.items.length>0);return(0,Z.jsxs)(`nav`,{"aria-label":i(`nav.clients`),className:`card shrink-0 p-1.5 @3xl:sticky @3xl:top-0 @3xl:w-[232px]`,children:[t&&(0,Z.jsx)(x,{lines:6,className:`p-2`}),(0,Z.jsx)(`div`,{className:`flex gap-1 overflow-x-auto @3xl:flex-col @3xl:gap-0 @3xl:overflow-visible`,children:c.map(({group:e,items:t})=>{let s=It.has(e),c=!s||a.has(e)||t.some(e=>e.kind===n),l=`${i(`clients.group.${e}`)} · ${t.length}`;return(0,Z.jsxs)(`div`,{className:`contents @3xl:block`,children:[s?(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-label":i(c?`clients.group.collapse`:`clients.group.expand`,{group:l}),onClick:()=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),className:`flex shrink-0 items-center gap-1 rounded-[var(--radius-control)] px-2.5 py-1.5 text-[11px] font-medium whitespace-nowrap text-[var(--text-muted)] hover:bg-[var(--surface-muted)] @3xl:w-full @3xl:pt-2 @3xl:pb-1`,children:[(0,Z.jsx)(G,{size:12,className:k(`transition-transform`,c&&`rotate-90`)}),l]}):(0,Z.jsx)(`h3`,{className:`hidden px-2.5 pt-2 pb-1 text-[11px] font-medium text-[var(--text-muted)] @3xl:block`,children:l}),c&&t.map(e=>(0,Z.jsx)(Bt,{client:e,active:e.kind===n,onSelect:()=>r(e.kind)},e.kind))]},e)})})]})}function Bt({client:e,active:t,onSelect:n}){let{t:r}=I(),i=Lt(e)!==`installed`,a=Rt(e),o=e.install?.blocker===`shadowed`,c=e.install?.updateAvailable&&!o?e.install.latestVersion:null;return(0,Z.jsxs)(`button`,{type:`button`,"aria-label":Y(e.kind,e.name),"aria-current":t?`page`:void 0,onClick:n,className:k(`flex shrink-0 items-center gap-2.5 rounded-[var(--radius-control)] px-2.5 py-1.5 text-left transition-colors @3xl:w-full`,t?`bg-[var(--accent-subtle)]`:`hover:bg-[var(--surface-muted)]`),children:[(0,Z.jsx)(`span`,{className:k(`inline-flex`,i&&!t&&`opacity-60`),children:(0,Z.jsx)(Ue,{kind:e.kind,size:24})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:k(`block truncate text-[13px] whitespace-nowrap`,t&&`font-medium`),children:Y(e.kind,e.name)}),a&&(0,Z.jsxs)(`span`,{className:`hidden truncate text-[11px] text-[var(--text-secondary)] @3xl:block`,children:[a,c&&(0,Z.jsxs)(`span`,{className:`text-[var(--warning)]`,children:[` → `,c]})]})]}),e.install?.busy&&(0,Z.jsx)(Vt,{}),c&&!e.install?.busy&&(0,Z.jsx)(s,{tone:`orange`,title:r(`clients.updateTo`,{version:c}),children:r(`clients.updateBadge`)}),o&&!e.install?.busy&&(0,Z.jsx)(s,{tone:`orange`,title:r(`clients.shadowed.title`,{version:e.install?.latestVersion??``}),children:r(`clients.shadowedBadge`)}),e.status===`drifted`?(0,Z.jsx)(`span`,{title:r(`clients.drifted`),"aria-label":r(`clients.drifted`),className:`inline-flex`,children:(0,Z.jsx)(p,{tone:`orange`})}):e.enabled?(0,Z.jsx)(W,{className:`size-3.5 shrink-0 text-[var(--success)]`,strokeWidth:2.5,"aria-label":r(`clients.enabled`)}):null]})}function Vt(){return(0,Z.jsx)(we,{className:`size-3.5 shrink-0 animate-spin text-[var(--text-secondary)] motion-reduce:animate-none`,"aria-hidden":!0})}function Ht(e,t){return e.availability===`coming_soon`?(0,Z.jsx)(s,{children:t(`clients.comingSoon`)}):e.status===`drifted`?(0,Z.jsx)(s,{tone:`orange`,children:t(`clients.drifted`)}):e.enabled?(0,Z.jsx)(s,{tone:`green`,children:t(`clients.enabled`)}):(0,Z.jsx)(s,{children:t(`clients.disabled`)})}function Ut({client:e}){let{t,locale:n}=I(),i=Ke(),{toast:a,confirm:o}=U(),l=oe(),u=ie(),f=d(),p=ee(),m=r(),g=E(),_=se(e.kind,!!e.providerId),[v,y]=(0,X.useState)(e.selectedModel??null),[S,C]=(0,X.useState)(e.accountId??``),w=e.tokenId??`default`,[T,te]=(0,X.useState)(w),ne=(g.data??[]).filter(e=>e.enabled||e.id===w).map(e=>({value:e.id,label:e.enabled?e.name:t(`clients.tokenDisabled`,{name:e.name}),disabled:!e.enabled})),[re,D]=(0,X.useState)(!1),[O,ae]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),j=e.availability===`coming_soon`,M=Y(e.kind,e.name),ce=(l.data??[]).filter(e=>e.enabled),N=e.detection.configPaths[0],P=ce.find(t=>t.id===e.providerId),ue=P?.authScheme===`oauth-subscription`||P?.authScheme===`plugin`,de=pe(P?.id,ue),F=e.kind===`claude-desktop`,L=e.kind===`claude-code`,me=fe(L),z=L&&me.data?.mode===`direct`,W=kt(e.extras),[G,_e]=(0,X.useState)(W),K=Q.some(e=>G[e]),ye=$(G)!==$(W),xe=Dt(e.extras),[Ce,we]=(0,X.useState)(xe),Te=(v??null)!==(e.selectedModel??null)||Ot(Ce)!==Ot(xe),Ee=L?Et.filter(e=>e!==`ANTHROPIC_MODEL`):[],De=L?e.enabled?t(`clients.modelSlotsFooterEnabled`):t(`clients.modelSlotsFooter`):e.enabled?t(`clients.modelFooterEnabled`):t(`clients.modelFooter`),q=e.options??[],J=wt(e.extras,q),[Oe,ke]=(0,X.useState)(J),Ae=Tt(Oe)!==Tt(J),je=e.protocols??[],Me=je.length>1?ut(e.extras):[],Ne=lt(e.extras),[Pe,Fe]=(0,X.useState)(Ne),Ie=ft(Pe)!==ft(Ne),Le=F?{...e.extras,roleMap:G}:L?{...e.extras,models:Ce,options:Oe}:q.length>0||je.length>1?{...e.extras,...q.length>0?{options:Oe}:{},...je.length>1?{protocolOverrides:Pe}:{}}:void 0;(0,X.useEffect)(()=>y(e.selectedModel??null),[e.kind,e.selectedModel]),(0,X.useEffect)(()=>C(e.accountId??``),[e.kind,e.providerId,e.accountId]),(0,X.useEffect)(()=>te(w),[e.kind,w]),(0,X.useEffect)(()=>_e(kt(e.extras)),[e.kind,$(W)]);let Re=(0,X.useRef)({});(0,X.useEffect)(()=>{if(!F||e.enabled||Q.some(e=>W[e]))return;let t=Re.current,n=jt(_.data??[]);Re.current=n,_e(e=>(!Q.some(t=>e[t])||$(e)===$(t))&&$(e)!==$(n)?n:e)},[e.kind,e.enabled,$(W),(_.data??[]).join(`
8
- `)]),(0,X.useEffect)(()=>we(Dt(e.extras)),[e.kind,Ot(xe)]),(0,X.useEffect)(()=>ke(wt(e.extras,e.options)),[e.kind,Tt(J)]),(0,X.useEffect)(()=>Fe(lt(e.extras)),[e.kind,ft(Ne)]);let ze=()=>{e.providerId&&u.mutate({kind:e.kind,providerId:e.providerId,accountId:S},{onSuccess:()=>a(t(`common.saved`),`success`),onError:e=>a(V(e),`error`)})},Be=async()=>{await o({title:t(`clients.disableConfirm`,{name:M}),detail:t(`clients.disableDetail`),confirmLabel:t(`clients.disable`)})&&f.mutate(e.kind,{onSuccess:async n=>{if(n.drifted.length===0){a(t(`clients.disabledToast`,{name:M}),`success`);return}await o({title:t(`clients.driftTitle`),detail:t(`clients.driftDetail`,{keys:n.drifted.join(`, `)}),confirmLabel:t(`clients.forceRestore`),destructive:!0})&&p.mutate(e.kind,{onSuccess:()=>a(t(`clients.disabledToast`,{name:M}),`success`),onError:e=>a(V(e),`error`)})},onError:e=>a(V(e),`error`)})},Ve=async()=>{N&&(B.canOpenPaths?await B.openPath(he(N)):await B.copy(N)&&a(t(`common.copied`)))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(c,{children:[(0,Z.jsxs)(R,{icon:(0,Z.jsx)(Ue,{kind:e.kind,size:36}),label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[15px] font-medium`,children:M}),z?(0,Z.jsx)(s,{children:t(`clients.claudeDirect.direct`)}):Ht(e,t)]}),detail:j?e.availabilityReason??t(`clients.comingSoonDetail`):[Lt(e)===`installed`?t(`clients.detected`,{version:Rt(e)??``}):t(`clients.notDetected`),z?null:N].filter(Boolean).join(` · `),className:`py-3`,children:[!j&&(0,Z.jsx)(Yt,{client:e,onOpen:A}),z?(0,Z.jsx)(h,{variant:`primary`,onClick:()=>document.getElementById(Zt)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:t(`clients.claudeDirect.configure`)}):e.enabled?(0,Z.jsx)(h,{onClick:()=>void Be(),loading:f.isPending,children:t(`clients.disableRestore`)}):(0,Z.jsx)(h,{variant:`primary`,disabled:j||!e.providerId||F&&!K,onClick:()=>D(!0),title:e.providerId?F&&!K?t(`clients.roleMapRequired`):void 0:t(`clients.pickProviderFirst`),children:t(`clients.enable`)})]}),!z&&e.appliedAt&&(0,Z.jsx)(R,{label:(0,Z.jsx)(`span`,{className:`text-[12px] text-[var(--text-secondary)]`,children:t(`clients.appliedAt`,{time:le(e.appliedAt,n)})})})]}),!j&&!e.enabled&&F&&e.providerId&&!K&&(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col items-start gap-2`,children:[(0,Z.jsx)(b,{tone:`info`,className:`self-stretch`,title:t(`clients.roleMapHint`)}),(0,Z.jsx)(h,{onClick:()=>document.getElementById(Qt)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:t(`clients.roleMapGoto`)})]}),(e.repairs?.length??0)>0&&(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col items-start gap-2`,children:[(0,Z.jsxs)(b,{tone:`danger`,className:`self-stretch`,title:t(`clients.repair.title`,{name:M}),children:[e.repairs?.map(e=>(0,Z.jsxs)(`span`,{className:`block break-all`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.file}),` — `,t(`clients.repair.problem.${e.problem}`,{line:e.line})]},e.file)),(0,Z.jsx)(`span`,{className:`block`,children:t(`clients.repair.hint`)})]}),(0,Z.jsx)(h,{variant:`primary`,loading:m.isPending,onClick:()=>m.mutate(e.kind,{onSuccess:()=>a(t(`clients.repair.done`,{name:M}),`success`),onError:e=>a(V(e),`error`)}),children:t(`clients.repair.action`)})]}),!z&&e.warnings.length>0&&(0,Z.jsx)(`div`,{className:`mb-5 flex flex-col gap-2`,children:e.warnings.map((e,t)=>(0,Z.jsx)(b,{tone:`warning`,title:e},t))}),!z&&(0,Z.jsx)(qt,{client:e,providers:l.data??[],loading:l.isLoading,soon:j}),!z&&ue&&(0,Z.jsx)(c,{title:t(`clients.accountTitle`),footer:t(`clients.accountFooter`),children:de.isLoading?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(x,{lines:2})}):(0,Z.jsxs)(R,{label:t(`clients.account`),children:[(0,Z.jsx)(H,{className:`max-w-[300px]`,ariaLabel:t(`clients.account`),value:S,onChange:C,options:[{value:``,label:t(`clients.accountDefault`)},...(de.data??[]).map(e=>({value:e.id,label:(e.displayName||e.id)+(e.status===`active`?``:` · ${t(`providers.subscription.status.${e.status}`)}`)}))]}),S!==(e.accountId??``)&&(0,Z.jsx)(h,{size:`sm`,variant:`primary`,loading:u.isPending,onClick:ze,children:t(`common.apply`)})]})}),!j&&!z&&(0,Z.jsxs)(c,{title:t(`clients.tokenTitle`),footer:e.enabled?t(`clients.tokenFooterEnabled`):t(`clients.tokenFooter`),children:[(0,Z.jsxs)(R,{label:t(`clients.token`),children:[(0,Z.jsx)(H,{className:`max-w-[300px]`,ariaLabel:t(`clients.token`),value:T,onChange:te,options:ne}),e.enabled&&T!==w&&(0,Z.jsx)(h,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})]}),(0,Z.jsx)(R,{icon:(0,Z.jsx)(Se,{className:`size-4 text-[var(--text-secondary)]`}),label:t(`clients.manageTokens`),onClick:()=>i(`/tokens`)})]}),!j&&!z&&e.providerId&&F&&(0,Z.jsx)(`div`,{id:Qt,children:(0,Z.jsxs)(c,{title:t(`clients.roleMapTitle`),footer:e.enabled?t(`clients.roleMapFooterEnabled`):t(`clients.roleMapFooter`),children:[Q.map(e=>(0,Z.jsx)(R,{label:t(`clients.role.${e}`),children:(0,Z.jsx)(H,{ariaLabel:t(`clients.role.${e}`),value:G[e]??``,onChange:t=>_e(n=>({...n,[e]:t||void 0})),placeholder:t(`clients.modelPlaceholder`),options:[{value:``,label:t(`clients.modelUnset`)},...(_.data??[]).map(e=>({value:e,label:e}))],className:`max-w-[300px]`})},e)),e.enabled&&ye&&(0,Z.jsx)(R,{label:K?``:(0,Z.jsx)(`span`,{className:`text-[12px] text-[var(--warning)]`,children:t(`clients.roleMapRequired`)}),children:(0,Z.jsx)(h,{size:`sm`,variant:`primary`,disabled:!K,onClick:()=>D(!0),children:t(`common.apply`)})})]})}),!j&&!z&&e.providerId&&!F&&(0,Z.jsxs)(c,{title:t(`clients.modelTitle`),footer:De,children:[(0,Z.jsx)(R,{label:t(`clients.defaultModel`),children:(0,Z.jsx)(H,{value:v??``,onChange:e=>y(e||null),placeholder:t(`clients.modelPlaceholder`),options:[{value:``,label:t(`clients.modelUnset`)},...(_.data??[]).map(e=>({value:e,label:e}))],className:`max-w-[300px]`})}),Ee.map(e=>(0,Z.jsx)(R,{label:t(`clients.modelSlot.${e}`),children:(0,Z.jsx)(H,{ariaLabel:t(`clients.modelSlot.${e}`),value:Ce[e]??``,onChange:t=>we(n=>({...n,[e]:t||void 0})),placeholder:t(`clients.modelPlaceholder`),options:[{value:``,label:t(`clients.modelUnset`)},...(_.data??[]).map(e=>({value:e,label:e}))],className:`max-w-[300px]`})},e)),e.enabled&&(L?Te:(v??null)!==(e.selectedModel??null))&&(0,Z.jsx)(R,{label:``,children:(0,Z.jsx)(h,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})})]}),!j&&!z&&e.providerId&&!F&&(0,Z.jsx)(_t,{client:e}),!j&&!z&&q.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ot,{descriptors:q,values:Oe,onChange:ke,enabled:e.enabled}),e.enabled&&Ae&&(0,Z.jsx)(`div`,{className:`-mt-3 mb-5 flex justify-end`,children:(0,Z.jsx)(h,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})})]}),!j&&Me.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ht,{models:Me,supported:je,values:Pe,onChange:Fe,enabled:e.enabled}),e.enabled&&Ie&&(0,Z.jsx)(`div`,{className:`-mt-3 mb-5 flex justify-end`,children:(0,Z.jsx)(h,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})})]}),!j&&e.install&&(0,Z.jsx)(en,{client:e,onShowLog:()=>A(`log`),onUninstall:()=>A(`uninstall`)}),L&&(0,Z.jsx)(`div`,{id:Zt,children:(0,Z.jsx)(rt,{enabled:L,gatewayEnabled:e.enabled})}),!j&&!z&&(0,Z.jsxs)(c,{title:t(`clients.maintenance`),children:[N&&(0,Z.jsx)(R,{icon:B.canOpenPaths?(0,Z.jsx)(be,{className:`size-4 text-[var(--text-secondary)]`}):(0,Z.jsx)(ve,{className:`size-4 text-[var(--text-secondary)]`}),label:B.canOpenPaths?t(`clients.openConfigDir`):t(`clients.copyConfigPath`),detail:N,onClick:()=>void Ve()}),(0,Z.jsx)(R,{icon:(0,Z.jsx)(ge,{className:`size-4 text-[var(--text-secondary)]`}),label:t(`clients.backups`),detail:t(`clients.backupsDetail`),onClick:()=>ae(!0)})]}),(0,Z.jsx)(nn,{open:re,onOpenChange:D,client:e,model:v,extras:Le,tokenId:T}),(0,Z.jsx)(on,{open:O,onOpenChange:ae,client:e}),(0,Z.jsx)(tn,{mode:k,onClose:()=>A(null),client:e})]})}var Wt={install:`clients.installTitle`,update:`clients.updateTitle`,uninstall:`clients.uninstallTitle`},Gt={install:`clients.installedToast`,update:`clients.updatedToast`,uninstall:`clients.uninstalledToast`};function Kt(e,t){return[e.priceKey??e.templateId,t(`providers.modelCount`,{count:e.modelCount}),e.priceMultiplier===1?null:`×${e.priceMultiplier}`].filter(Boolean).join(` · `)}function qt({client:e,providers:t,loading:n,soon:r}){let{t:i}=I(),{toast:a}=U(),o=M(),s=(0,X.useMemo)(()=>e.bindings??(e.providerId?[{providerId:e.providerId,accountId:e.accountId}]:[]),[e.bindings,e.providerId,e.accountId]),[l,u]=(0,X.useState)(s);(0,X.useEffect)(()=>u(s),[s]);let d=(0,X.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),f=l.flatMap(e=>{let t=d.get(e.providerId);return t?[{binding:e,provider:t}]:[]}),p=t.filter(e=>e.enabled&&!l.some(t=>t.providerId===e.id)),g=Me(Ve(je,{activationConstraint:{distance:4}}),Ve(ze,{coordinateGetter:Re})),_=r||o.isPending,v=(t,n)=>{let r=l;u(t),o.mutate({kind:e.kind,bindings:t},{onSuccess:()=>a(Nt.has(e.kind)&&e.enabled?i(`clients.providersModelsSynced`,{client:Y(e.kind,e.name)}):n),onError:e=>{u(r),a(V(e),`error`)}})},y=({active:e,over:t})=>{if(!t||e.id===t.id)return;let n=l.findIndex(t=>t.providerId===e.id),r=l.findIndex(e=>e.providerId===t.id);n<0||r<0||v(Ie(l,n,r),i(`clients.providerOrderSaved`))},b=e=>v([...l,{providerId:e.id}],i(`clients.providerAdded`,{provider:e.name})),S=e=>v(l.filter(t=>t.providerId!==e.id),i(`clients.providerRemoved`,{provider:e.name})),C=p.map(e=>(0,Z.jsx)(R,{icon:(0,Z.jsx)(Xe,{name:e.name,icon:e.icon,colorKey:e.templateId,size:24}),label:e.name,detail:Kt(e,i),onClick:_?void 0:()=>b(e),children:!r&&(0,Z.jsx)(Te,{className:`size-4 text-[var(--text-secondary)]`,"aria-label":i(`common.add`)})},e.id));return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(c,{title:i(`clients.providerTitle`),footer:i(`clients.providerFooter`),children:[n&&(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(x,{lines:2})}),!n&&f.length===0&&p.length===0&&(0,Z.jsx)(m,{title:i(`clients.noProviders`),detail:i(`clients.noProvidersDetail`),action:(0,Z.jsx)(Ge,{to:`/providers?new=1`,children:(0,Z.jsx)(h,{variant:`primary`,icon:(0,Z.jsx)(Te,{className:`size-3.5`}),children:i(`providers.add`)})})}),f.length>0&&(0,Z.jsx)(Le,{sensors:g,collisionDetection:Fe,onDragEnd:y,children:(0,Z.jsx)(Be,{items:f.map(e=>e.provider.id),strategy:Ae,children:f.map(({provider:e},t)=>(0,Z.jsx)(Jt,{provider:e,primary:t===0,disabled:_,onRemove:f.length>1?()=>S(e):void 0},e.id))})}),!n&&f.length===0&&C]}),f.length>0&&p.length>0&&(0,Z.jsx)(c,{title:i(`clients.moreProvidersTitle`),children:C})]})}function Jt({provider:e,primary:t,disabled:n,onRemove:r}){let{t:i}=I(),{attributes:a,listeners:o,setNodeRef:c,setActivatorNodeRef:l,transform:u,transition:d,isDragging:f}=Pe({id:e.id,disabled:n});return(0,Z.jsx)(`div`,{ref:c,style:{transform:Ne.Transform.toString(u),transition:d},className:k(f&&`relative z-10 bg-[var(--surface)] shadow-lg`),children:(0,Z.jsx)(R,{icon:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{ref:l,type:`button`,"aria-label":i(`clients.dragToReorder`,{provider:e.name}),title:i(`clients.dragToReorder`,{provider:e.name}),className:`-ml-1 inline-flex cursor-grab touch-none text-[var(--text-muted)] hover:text-[var(--text-secondary)] active:cursor-grabbing disabled:cursor-default disabled:opacity-50`,...a,...o,children:(0,Z.jsx)(xe,{className:`size-4`})}),(0,Z.jsx)(Xe,{name:e.name,icon:e.icon,colorKey:e.templateId,size:24})]}),label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),t&&(0,Z.jsx)(s,{tone:`accent`,children:i(`clients.primaryProvider`)}),!e.enabled&&(0,Z.jsx)(s,{tone:`orange`,children:i(`clients.providerDisabledBadge`)})]}),detail:Kt(e,i),children:r&&(0,Z.jsx)(h,{size:`sm`,variant:`plain`,icon:(0,Z.jsx)(ke,{className:`size-3.5`}),"aria-label":i(`clients.removeProvider`,{provider:e.name}),title:i(`clients.removeProvider`,{provider:e.name}),disabled:n,onClick:r})})})}function Yt({client:e,onOpen:t}){let{t:n}=I(),r=e.install;if(!r)return null;let i=r.needsAdmin?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-[var(--warning)]`,children:[(0,Z.jsx)(J,{className:`size-3`,"aria-hidden":!0}),n(`clients.admin.badge`)]}):null,a=r.needsAdmin?n(r.adminAvailable?`clients.admin.tip`:`clients.admin.tipManual`):void 0;return r.busy?(0,Z.jsx)(h,{icon:(0,Z.jsx)(Vt,{}),onClick:()=>t(`log`),children:n(`clients.installRunning`)}):r.updateAvailable&&r.updateCommand&&r.latestVersion?(0,Z.jsxs)(h,{icon:(0,Z.jsx)(_e,{className:`size-3.5`}),title:a,onClick:()=>t(`update`),children:[n(`clients.updateTo`,{version:r.latestVersion}),i]}):r.updateAvailable&&r.blocker===`shadowed`?(0,Z.jsx)(h,{icon:(0,Z.jsx)(J,{className:`size-3.5`}),onClick:()=>document.getElementById(Xt)?.scrollIntoView({behavior:`smooth`,block:`center`}),children:n(`clients.shadowedBadge`)}):!r.installed&&r.installCommand?(0,Z.jsxs)(h,{icon:(0,Z.jsx)(He,{className:`size-3.5`}),title:a,onClick:()=>t(`install`),children:[n(`clients.install`),i]}):!r.installed&&r.method===`manual`?(0,Z.jsx)(h,{icon:(0,Z.jsx)(ye,{className:`size-3.5`}),onClick:()=>window.open(r.homepageUrl,`_blank`,`noreferrer`),children:n(`clients.download`)}):null}var Xt=`client-shadowed-alert`,Zt=`claude-direct-panel`,Qt=`client-role-map`;function $t(e,t){return!e.installed||e.uninstallCommand?null:e.method===`npm`?t(`clients.uninstallExternal`,{path:e.executable??``}):e.method===`vscode-extension`?t(`clients.uninstallBuiltIn`):t(`clients.uninstallManual`)}function en({client:e,onShowLog:t,onUninstall:n}){let{t:r,locale:i}=I(),a=e.install,o=de(e.kind),l=(e,t=!1)=>(0,Z.jsx)(`span`,{className:k(`text-[13px] tabular-nums selectable`,t&&`text-[var(--text-secondary)]`),children:e}),u=a.blocker===`external-install`?r(`clients.blocker.external-install`,{path:a.executable??``}):a.blocker?r(`clients.blocker.${a.blocker}`):void 0,d=a.otherCopies??[],f=d.find(e=>e.newer);return(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(`div`,{id:Xt,className:`mb-3`,children:(0,Z.jsx)(b,{tone:`warning`,title:r(`clients.shadowed.title`,{version:f.version}),children:r(`clients.shadowed.detail`,{path:a.executable??``,version:a.version??``,other:f.path,dir:he(f.path)})})}),!f&&a.notOnPath&&a.executable&&(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(b,{tone:`warning`,title:r(`clients.notOnPath.title`),children:r(`clients.notOnPath.detail`,{dir:he(a.executable)})})}),(0,Z.jsxs)(c,{title:r(`clients.versionTitle`),footer:u,children:[(0,Z.jsx)(R,{label:r(`clients.currentVersion`),detail:a.installed?a.executable:void 0,children:a.installed?l(a.version??r(`clients.versionUnknown`),!a.version):l(r(`clients.notInstalled`),!0)}),d.map(e=>(0,Z.jsxs)(R,{label:r(`clients.otherCopy`),detail:e.path,children:[e.newer&&(0,Z.jsx)(s,{tone:`orange`,children:r(`clients.otherCopyNewer`)}),l(e.version,!e.newer)]},e.path)),(a.method===`npm`||a.method===`script`)&&(0,Z.jsxs)(R,{label:r(`clients.latestVersion`),detail:a.latestError??(a.latestCheckedAt?r(`clients.checkedAt`,{time:le(a.latestCheckedAt,i)}):void 0),children:[a.updateAvailable&&(0,Z.jsx)(s,{tone:`orange`,children:r(`clients.updateBadge`)}),l(a.latestVersion??r(`clients.latestUnknown`),!a.latestVersion)]}),(0,Z.jsx)(R,{label:r(`clients.installMethod`),detail:r(`clients.method.${a.method}`,{package:a.package??``}),children:(0,Z.jsx)(h,{size:`sm`,variant:`plain`,icon:(0,Z.jsx)(ye,{className:`size-3`}),onClick:()=>window.open(a.homepageUrl,`_blank`,`noreferrer`),children:r(`clients.homepage`)})}),a.installed&&(0,Z.jsx)(R,{label:r(`clients.uninstall`),detail:a.uninstallCommand??$t(a,r),children:a.uninstallCommand&&(0,Z.jsx)(h,{size:`sm`,variant:`destructive`,icon:(0,Z.jsx)(Oe,{className:`size-3`}),disabled:a.busy,onClick:n,children:r(`clients.uninstall`)})}),o.data&&(0,Z.jsx)(R,{icon:(0,Z.jsx)(q,{className:`size-4 text-[var(--text-secondary)]`}),label:r(`clients.installLog`),detail:`${o.data.command} · ${r(`clients.job.${o.data.state}`)}`,onClick:t})]})]})}function tn({mode:e,onClose:t,client:n}){let{t:r}=I(),{toast:i}=U(),a=te(),s=e!==null,c=de(n.kind,s||!!n.install?.busy),l=L(),u=ne(),[d,f]=(0,X.useState)(!1),p=(0,X.useRef)(null),g=(0,X.useRef)(void 0),_=Y(n.kind,n.name),v=n.install,y=e===`log`?null:e,S=y===`install`?v?.installCommand:y===`update`?v?.updateCommand:y===`uninstall`?v?.uninstallCommand:null,C=y===`uninstall`,w=c.data,T=y!==null&&!d&&w?.state!==`running`,E=!!v?.needsAdmin,ee=!!v?.adminAvailable,re=w?.state===`failed`&&w.hint===`permission-denied`&&!w.elevated&&ee;(0,X.useEffect)(()=>{s&&f(!1)},[s,e]),(0,X.useEffect)(()=>{let e=w?.state;g.current===`running`&&e&&e!==`running`&&(a.invalidateQueries({queryKey:o.clients}),e===`succeeded`&&w.hint?i(r(`clients.notEffectiveToast`,{name:_})):e===`succeeded`&&i(r(Gt[w.action],{name:_}),`success`)),g.current=e},[w?.state,w?.action,w?.hint,_,a,r,i]),(0,X.useEffect)(()=>{let e=p.current;e&&(e.scrollTop=e.scrollHeight)},[w?.log.length]);let ie=(e,t)=>l.mutate({kind:n.kind,action:e,elevated:t},{onSuccess:()=>f(!0),onError:e=>i(V(e),`error`)}),D=async e=>{await B.copy(e)&&i(r(`common.copied`))},O=r(Wt[y??w?.action??`install`],{name:_}),ae={running:`info`,succeeded:`success`,failed:`danger`,cancelled:`warning`},A=`rounded-[var(--radius-control)] border border-[var(--border)] bg-[var(--surface-muted)] px-3 py-2 font-mono text-[12px] break-all whitespace-pre-wrap selectable`,oe=v?.adminFixCommand?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-[11px] text-[var(--text-secondary)]`,children:r(`clients.admin.fixTip`)}),(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:k(A,`min-w-0 flex-1`),children:v.adminFixCommand}),(0,Z.jsx)(h,{size:`sm`,icon:(0,Z.jsx)(ve,{className:`size-3`}),"aria-label":r(`common.copy`),onClick:()=>void D(v.adminFixCommand)})]})]}):null;return(0,Z.jsx)(z,{open:s,onOpenChange:e=>!e&&t(),width:620,title:O,description:T?r(C?`clients.uninstallRunDetail`:`clients.installRunDetail`):void 0,footer:T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{onClick:t,children:r(`common.cancel`)}),E&&!ee?(0,Z.jsx)(h,{variant:`primary`,icon:(0,Z.jsx)(ve,{className:`size-3.5`}),disabled:!S,onClick:()=>void D(`sudo ${S}`),children:r(`clients.admin.copyCommand`)}):(0,Z.jsx)(h,{variant:C?`destructive`:`primary`,icon:E?(0,Z.jsx)(J,{className:`size-3.5`}):void 0,disabled:!S,loading:l.isPending,onClick:()=>y&&ie(y,E),children:r(E?`clients.admin.start`:C?`clients.uninstall`:`clients.installStart`)})]}):w?.state===`running`?(0,Z.jsxs)(Z.Fragment,{children:[!w.elevated&&(0,Z.jsx)(h,{variant:`destructive`,loading:u.isPending,onClick:()=>u.mutate(n.kind,{onError:e=>i(V(e),`error`)}),children:r(`clients.installStop`)}),(0,Z.jsx)(h,{onClick:t,children:r(`common.close`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{onClick:t,children:r(`common.done`)}),re&&(0,Z.jsx)(h,{variant:`primary`,icon:(0,Z.jsx)(J,{className:`size-3.5`}),loading:l.isPending,onClick:()=>ie(w.action,!0),children:r(`clients.admin.retry`)})]}),children:T?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C&&n.enabled&&(0,Z.jsx)(b,{tone:`warning`,title:r(`clients.uninstallRestoreTitle`),children:r(`clients.uninstallRestoreDetail`,{name:_})}),E&&(0,Z.jsx)(b,{tone:`warning`,title:r(`clients.admin.title`),children:r(ee?`clients.admin.prompt`:`clients.admin.manual`)}),S?(0,Z.jsx)(`pre`,{className:A,children:E?`sudo ${S}`:S}):(0,Z.jsx)(b,{tone:`warning`,title:r(`clients.installUnavailable`)}),C?(0,Z.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)]`,children:r(`clients.uninstallKeepsData`)}):v?.method===`npm`&&(0,Z.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)]`,children:r(`clients.installNpmNote`)}),E&&oe]}):w?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(b,{tone:w.state===`succeeded`&&w.hint?`warning`:ae[w.state],title:r(w.state===`succeeded`&&w.hint?`clients.job.notEffective`:`clients.job.${w.state}`),children:w.state===`running`&&w.elevated?r(`clients.admin.running`):w.hint?r(`clients.hint.${w.hint}`)+(re?r(`clients.admin.retryHint`):``):void 0}),(0,Z.jsx)(`pre`,{ref:p,className:`scroll max-h-[340px] min-h-[160px] rounded-[var(--radius-control)] border border-[var(--border)] bg-[var(--surface-muted)] px-3 py-2 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap selectable`,children:w.log.join(`
9
- `)}),w.hint===`permission-denied`&&oe]}):c.isLoading?(0,Z.jsx)(x,{lines:4}):(0,Z.jsx)(m,{icon:(0,Z.jsx)(q,{className:`size-6`}),title:r(`clients.noInstallLog`)})})}function nn({open:e,onOpenChange:t,client:n,model:r,extras:i,tokenId:a}){let{t:o}=I(),{toast:s}=U(),c=_(),u=l(),d=Y(n.kind,n.name),f=i?{providerId:n.providerId,model:r,extras:i,tokenId:a}:{providerId:n.providerId,model:r,tokenId:a};(0,X.useEffect)(()=>{e&&c.mutate({kind:n.kind,req:f})},[e]);let p=()=>u.mutate({kind:n.kind,req:f},{onSuccess:e=>{t(!1),s(e.requiresRestart?o(`clients.enabledRestart`,{name:d}):o(`clients.enabledToast`,{name:d}),`success`)},onError:e=>{let t=Ct(e,o);s(t?`${t.title} · ${t.hint}`:V(e),`error`)}}),m=c.isError?Ct(c.error,o):null;return(0,Z.jsxs)(z,{open:e,onOpenChange:t,width:620,title:o(`clients.enableTitle`,{name:d}),description:o(`clients.enableDetail`),footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{onClick:()=>t(!1),children:o(`common.cancel`)}),(0,Z.jsx)(h,{variant:`primary`,disabled:!c.data,loading:u.isPending,onClick:p,children:n.enabled?o(`common.apply`):o(`clients.enable`)})]}),children:[c.isPending&&(0,Z.jsx)(x,{lines:4}),m&&(0,Z.jsx)(b,{tone:`danger`,title:m.title,children:m.hint}),c.isError&&!m&&(0,Z.jsx)(b,{tone:`danger`,title:o(`common.error`),children:V(c.error)}),c.data&&(0,Z.jsx)(rn,{preview:c.data})]})}function rn({preview:e}){let{t}=I();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.warnings.map((e,t)=>(0,Z.jsx)(b,{tone:`warning`,title:e},t)),e.changes.length===0&&(0,Z.jsx)(b,{tone:`info`,title:t(`clients.noChanges`)}),e.diffs.map(e=>(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-2 font-mono text-[11px] text-[var(--text-secondary)]`,children:e.file}),(0,Z.jsx)(an,{diff:e.unifiedDiff})]},e.file))]})}function an({diff:e}){return(0,Z.jsx)(`pre`,{className:`scroll max-h-[300px] rounded-[var(--radius-control)] border border-[var(--border)] bg-[var(--surface-muted)] py-2 font-mono text-[11px] leading-relaxed selectable`,children:e.split(`
10
- `).map((e,t)=>(0,Z.jsx)(`div`,{className:k(`px-3 whitespace-pre-wrap break-all`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-[color-mix(in_oklab,var(--success)_12%,transparent)] text-[var(--success)]`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-[color-mix(in_oklab,var(--danger)_10%,transparent)] text-[var(--danger)]`,e.startsWith(`@@`)&&`text-[var(--text-muted)]`),children:e||` `},t))})}function on({open:e,onOpenChange:t,client:n}){let{t:r,locale:i}=I(),{toast:o,confirm:c}=U(),l=T(n.kind,e),u=a();return(0,Z.jsxs)(z,{open:e,onOpenChange:t,width:520,title:r(`clients.backups`),description:r(`clients.backupsDetail`),footer:(0,Z.jsx)(h,{onClick:()=>t(!1),children:r(`common.done`)}),children:[l.isLoading&&(0,Z.jsx)(x,{lines:3}),l.isError&&(0,Z.jsx)(b,{tone:`danger`,title:r(`common.error`),children:V(l.error)}),l.data?.length===0&&(0,Z.jsx)(m,{icon:(0,Z.jsx)(ge,{className:`size-6`}),title:r(`clients.noBackups`)}),(0,Z.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:l.data?.map(e=>(0,Z.jsx)(R,{label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[le(e.createdAt,i),e.firstWrite&&(0,Z.jsx)(s,{tone:`accent`,children:r(`clients.firstWrite`)})]}),detail:e.files.join(`, `),children:(0,Z.jsx)(h,{size:`sm`,icon:(0,Z.jsx)(De,{className:`size-3`}),loading:u.isPending&&u.variables?.id===e.id,onClick:async()=>{await c({title:r(`clients.restoreConfirm`),detail:e.files.join(`
11
- `),destructive:!0,confirmLabel:r(`clients.restore`)})&&u.mutate({kind:n.kind,id:e.id},{onSuccess:()=>o(r(`clients.restored`),`success`),onError:e=>o(V(e),`error`)})},children:r(`clients.restore`)})},e.id))})]})}export{Mt as ClientsPage};
@@ -1,2 +0,0 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{D as n,G as r,Gt as i,H as a,I as o,Mt as s,N as c,O as l,P as u,Pn as d,Qs as f,R as p,S as m,Si as h,U as g,W as _,hr as v,ta as y,w as b,z as x,zi as S}from"./format-CmXxTS5M.js";import{H as C,U as w,V as T,W as E}from"./TrayTitleSource-DN10ruw2.js";import{t as D}from"./folder-open-z1RXMZa1.js";import{t as O}from"./pencil-CpF9MxGZ.js";import{t as k}from"./plus-c3HzV6VX.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./trash-BHBJn5GS.js";import{v as M}from"./index-BW8keTkg.js";import{t as N}from"./checkbox-CZ-rG7I2.js";import{t as P}from"./clientNames-Bskc9G1M.js";var F=e(t(),1),I=f();function L(){let{t:e}=b(),{toast:t,confirm:r}=E(),i=v(),a=s(),u=h(),[d,f]=(0,F.useState)(``),p=()=>a.mutate({path:d.trim()},{onSuccess:n=>{f(``),t(e(`library.projects.added`,{name:n.name}),`success`)},onError:e=>t(w(e),`error`)}),_=async(n,i)=>{await r({title:e(`library.projects.forget.title`,{name:i}),detail:e(`library.projects.forget.detail`),confirmLabel:e(`library.projects.forget`)})&&u.mutate(n,{onError:e=>t(w(e),`error`)})};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`mb-3 text-[12px] text-[var(--text-secondary)]`,children:e(`library.projects.hint`)}),(0,I.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,I.jsx)(o,{mono:!0,className:`flex-1`,value:d,placeholder:`/Users/me/code/app`,onChange:e=>f(e.target.value),"aria-label":e(`library.projects.path`)}),(0,I.jsx)(l,{variant:`primary`,icon:(0,I.jsx)(k,{className:`size-4`}),disabled:d.trim()===``,loading:a.isPending,onClick:p,children:e(`library.projects.add`)})]}),i.isError&&(0,I.jsx)(m,{tone:`danger`,title:w(i.error)}),i.isLoading&&(0,I.jsx)(g,{lines:2}),i.data&&i.data.length===0&&(0,I.jsx)(c,{icon:(0,I.jsx)(D,{className:`size-6`}),title:e(`library.projects.empty`)}),i.data&&i.data.length>0&&(0,I.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:i.data.map(t=>(0,I.jsx)(x,{label:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:t.name}),!t.exists&&(0,I.jsx)(n,{tone:`orange`,children:e(`library.state.project-missing`)})]}),detail:(0,I.jsx)(`span`,{className:`font-mono text-[11px]`,children:t.path}),children:(0,I.jsx)(l,{size:`sm`,icon:(0,I.jsx)(j,{className:`size-3.5`}),"aria-label":e(`library.projects.forget`),onClick:()=>void _(t.path,t.name)})},t.path))})]})}var R={instructions:`instruction`,agents:`agent`,commands:`command`,hooks:`hook`,env:`env`},z=[`turn-end`,`after-tool`,`before-tool`,`prompt`,`session-start`],B={applied:`green`,drifted:`orange`,missing:`orange`,conflict:`red`,"project-missing":`orange`,unsupported:`neutral`,pending:`neutral`,off:`neutral`},V=e=>e.split(/[\\/]/).filter(Boolean).pop()??e;function H({segment:e}){let{t}=b(),{toast:n,confirm:r}=E(),a=R[e],o=S(e),s=i(e),u=d(e),[f,p]=(0,F.useState)(null),h=o.data,_=async(e,r)=>{try{await e(),r&&n(t(r),`success`)}catch(e){n(w(e),`error`)}},v=async(e,n)=>{(!n||await r({title:t(`library.confirm.force.title`,{name:e.name}),detail:t(`library.confirm.force.detail`),confirmLabel:t(`library.rewriteForce`),destructive:!0}))&&await _(()=>s.mutateAsync({id:e.id,force:n}),`library.toast.applied`)},y=async e=>{await r({title:t(`library.confirm.delete.title`,{name:e.name}),detail:t(`library.confirm.delete.detail`),confirmLabel:t(`common.delete`),destructive:!0})&&await _(async()=>{try{await u.mutateAsync({id:e.id})}catch(n){if(!await r({title:t(`library.confirm.deleteForce.title`,{name:e.name}),detail:`${w(n)}\n\n${t(`library.confirm.deleteForce.detail`)}`,confirmLabel:t(`common.delete`),destructive:!0}))return;await u.mutateAsync({id:e.id,force:!0})}},`library.toast.deleted`)};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`mb-3 flex items-center gap-3`,children:[(0,I.jsx)(`p`,{className:`min-w-0 flex-1 text-[12px] text-[var(--text-secondary)]`,children:t(`library.hint.${a}`)}),(0,I.jsx)(l,{variant:`primary`,icon:(0,I.jsx)(k,{className:`size-4`}),onClick:()=>p(`new`),disabled:h?.canWrite===!1,children:t(`library.add`)})]}),o.isError&&(0,I.jsx)(m,{tone:`danger`,title:`${t(`library.error.load`)}: ${w(o.error)}`}),o.isLoading&&(0,I.jsx)(g,{lines:3}),h&&h.canWrite===!1&&(0,I.jsx)(m,{tone:`info`,title:t(`library.localOnly`)}),h&&h.items.length===0&&(0,I.jsx)(c,{title:t(`library.empty.title`),detail:t(`library.empty.${a}`),action:h.canWrite?(0,I.jsx)(l,{variant:`primary`,onClick:()=>p(`new`),children:t(`library.add`)}):void 0}),h&&h.items.length>0&&(0,I.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:h.items.map(e=>(0,I.jsx)(U,{item:e,canWrite:h.canWrite,onEdit:()=>p(e),onDelete:()=>void y(e),onRewrite:t=>void v(e,t)},e.id))}),h&&(0,I.jsx)(G,{segment:e,library:h,item:f,onClose:()=>p(null)})]})}function U({item:e,canWrite:t,onEdit:r,onDelete:i,onRewrite:a}){let{t:o}=b(),s=e.targets.some(e=>e.state===`drifted`||e.state===`conflict`||e.state===`missing`),c=e.targets.some(e=>e.state===`drifted`||e.state===`conflict`),u=(e.kind===`hook`?`${e.event??``}${e.matcher?` · ${e.matcher}`:``} — `:``)+(e.description||e.body).split(`
2
- `)[0];return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(x,{label:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:e.name}),!e.enabled&&(0,I.jsx)(n,{children:o(`library.state.off`)})]}),detail:(0,I.jsx)(`span`,{className:`block truncate font-mono text-[11px]`,title:u,children:u}),children:[s&&t&&(0,I.jsx)(l,{size:`sm`,icon:(0,I.jsx)(A,{className:`size-3.5`}),onClick:()=>a(!1),children:o(`library.rewrite`)}),c&&t&&(0,I.jsx)(l,{size:`sm`,onClick:()=>a(!0),children:o(`library.rewriteForce`)}),(0,I.jsx)(l,{size:`sm`,icon:(0,I.jsx)(O,{className:`size-3.5`}),"aria-label":o(`common.edit`),onClick:r,disabled:!t}),(0,I.jsx)(l,{size:`sm`,icon:(0,I.jsx)(j,{className:`size-3.5`}),"aria-label":o(`common.delete`),onClick:i,disabled:!t})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 px-4 pb-3`,children:[e.targets.map(t=>(0,I.jsx)(W,{target:t,error:e.lastError?.[t.project?`${t.client}@${t.project}`:t.client]},t.client+t.project)),e.targets.length===0&&(0,I.jsx)(`span`,{className:`text-[11px] text-[var(--text-muted)]`,children:o(`library.noTargets`)})]})]})}function W({target:e,error:t}){let{t:r}=b(),i=t??e.message??void 0;return(0,I.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px]`,title:e.path??void 0,children:[P(e.client),e.project&&(0,I.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--text-muted)]`,title:e.project,children:V(e.project)}),(0,I.jsx)(n,{tone:B[e.state],children:r(`library.state.${e.state}`)})]}),i&&(0,I.jsx)(`span`,{className:`max-w-md whitespace-normal text-[11px] text-[var(--danger)]`,children:i})]})}function G({segment:e,library:t,item:i,onClose:a}){let{t:s}=b(),{toast:c}=E(),d=y(e),f=R[e],m=i&&i!==`new`?i:null,[h,g]=(0,F.useState)(``),[v,S]=(0,F.useState)(``),[D,O]=(0,F.useState)(``),[k,A]=(0,F.useState)(`turn-end`),[j,M]=(0,F.useState)(``),[L,B]=(0,F.useState)(null),[V,H]=(0,F.useState)(``),[U,W]=(0,F.useState)(!0),[G,K]=(0,F.useState)([]);(0,F.useEffect)(()=>{if(i===null)return;let e=i===`new`?null:i;g(e?.name??``),S(e?.description??``),O(e?.body??``),A(e?.event??`turn-end`),M(e?.matcher??``),B(e&&e.timeout>0?e.timeout:null),H(e?.model??``),W(e?.enabled??!0),K(e?e.targets.map(e=>({client:e.client,project:e.project})):[])},[i]);let q=(e,t)=>G.some(n=>n.client===e&&n.project===t),J=(e,t,n)=>K(r=>n?[...r.filter(n=>n.client!==e||n.project!==t),{client:e,project:t}]:r.filter(n=>n.client!==e||n.project!==t)),Y=f===`agent`,X=h.trim()!==``&&(f===`env`||D.trim()!==``)&&(!Y||v.trim()!==``),Z=k.includes(`:`),Q=f===`hook`&&(Z||k!==`turn-end`&&k!==`prompt`);return(0,I.jsx)(C,{open:i!==null,onOpenChange:e=>!e&&a(),width:580,title:m?s(`library.editTitle`,{name:m.name}):s(`library.addTitle.${f}`),footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(l,{onClick:a,children:s(`common.cancel`)}),(0,I.jsx)(l,{variant:`primary`,disabled:!X,loading:d.isPending,onClick:()=>{let e={name:h.trim(),body:D,enabled:U,targets:G};(f===`agent`||f===`command`||f===`hook`)&&(e.description=v.trim()),f===`agent`&&V.trim()!==``&&(e.model=V.trim()),f===`hook`&&(e.event=k,e.matcher=Q?j.trim():``,e.timeout=L??0),d.mutate({id:m?.id,body:e},{onSuccess:e=>{a(),e.targets.filter(e=>e.state===`conflict`||e.state===`drifted`).length>0||e.lastError&&Object.keys(e.lastError).length>0?c(s(`library.toast.savedWithProblems`),`error`):c(s(`library.toast.saved`,{name:e.name}),`success`)},onError:e=>c(w(e),`error`)})},children:s(`common.save`)})]}),children:(0,I.jsxs)(`div`,{className:`grid gap-4`,children:[(0,I.jsx)(u,{label:s(`library.field.name`),hint:s(`library.nameHint.${f}`),children:(0,I.jsx)(o,{mono:!0,value:h,maxLength:64,onChange:e=>g(e.target.value)})}),(f===`agent`||f===`command`||f===`hook`)&&(0,I.jsx)(u,{label:s(`library.field.description`),children:(0,I.jsx)(o,{value:v,maxLength:200,onChange:e=>S(e.target.value)})}),f===`hook`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(u,{label:s(`library.field.event`),hint:s(`library.field.eventHint`),children:[(0,I.jsx)(T,{value:Z?`__own__`:k,onChange:e=>A(e===`__own__`?`claude-code:PermissionRequest`:e),options:[...z.map(e=>({value:e,label:s(`library.event.${e}`)})),{value:`__own__`,label:s(`library.event.own`)}]}),Z&&(0,I.jsx)(o,{mono:!0,className:`mt-2`,value:k,onChange:e=>A(e.target.value),placeholder:`claude-code:PermissionRequest`})]}),Q&&(0,I.jsx)(u,{label:s(`library.field.matcher`),hint:s(Z?`library.field.matcherOwn`:k===`session-start`?`library.field.matcherStarts`:`library.field.matcherTools`),children:k===`session-start`||Z?(0,I.jsx)(o,{mono:!0,value:j,placeholder:`startup|resume`,onChange:e=>M(e.target.value)}):(0,I.jsx)(T,{value:j,onChange:M,options:[{value:``,label:s(`library.matcher.all`)},{value:`shell`,label:s(`library.matcher.shell`)},{value:`edit`,label:s(`library.matcher.edit`)}]})}),(0,I.jsx)(u,{label:s(`library.field.timeout`),children:(0,I.jsx)(p,{value:L,onChange:B,min:0,step:1})})]}),(0,I.jsx)(u,{label:s(`library.field.body.${f}`),hint:f===`command`?s(`library.field.commandArgsHint`):void 0,children:f===`hook`||f===`env`?(0,I.jsx)(o,{mono:!0,value:D,onChange:e=>O(e.target.value)}):(0,I.jsx)(r,{mono:!0,rows:f===`instruction`?8:6,value:D,onChange:e=>O(e.target.value)})}),f===`agent`&&(0,I.jsx)(u,{label:s(`library.field.model`),hint:s(`library.field.modelHint`),children:(0,I.jsx)(o,{mono:!0,value:V,onChange:e=>H(e.target.value),placeholder:`gpt-5`})}),(0,I.jsx)(u,{label:s(`library.targets`),hint:s(t.projects.length>0?`library.targetsHint`:`library.targetsHintNoProjects`),children:(0,I.jsx)(`div`,{className:`grid gap-1`,children:t.clients.map(e=>(0,I.jsx)(x,{label:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[P(e.kind),!e.detected&&(0,I.jsx)(n,{children:s(`library.undetected`)})]}),detail:e.path?(0,I.jsx)(`span`,{className:`font-mono text-[11px]`,title:e.path,children:e.path}):void 0,children:(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-x-3 gap-y-1`,children:[(0,I.jsx)(N,{label:s(`library.userWide`),checked:q(e.kind,``),onCheckedChange:t=>J(e.kind,``,t===!0)}),e.project&&t.projects.map(t=>(0,I.jsx)(N,{label:t.name,checked:q(e.kind,t.path),disabled:!t.exists,onCheckedChange:n=>J(e.kind,t.path,n===!0)},t.path))]})},e.kind))})}),(0,I.jsx)(x,{label:s(`library.enabled`),children:(0,I.jsx)(_,{checked:U,label:s(`library.enabled`),onChange:W})})]})})}function K(){let{t:e}=b(),[t,n]=(0,F.useState)(`instructions`);return(0,I.jsxs)(M,{title:e(`nav.library`),subtitle:e(`library.subtitle`),children:[(0,I.jsx)(`div`,{className:`mb-3`,children:(0,I.jsx)(a,{ariaLabel:e(`nav.library`),value:t,onChange:n,items:[{value:`instructions`,label:e(`library.tab.instruction`)},{value:`agents`,label:e(`library.tab.agent`)},{value:`commands`,label:e(`library.tab.command`)},{value:`hooks`,label:e(`library.tab.hook`)},{value:`env`,label:e(`library.tab.env`)},{value:`projects`,label:e(`library.tab.projects`)}]})}),t===`projects`?(0,I.jsx)(L,{}):(0,I.jsx)(H,{segment:t},t)]})}export{K as LibraryPage};
@@ -1,9 +0,0 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Ba as n,D as r,En as i,Er as a,F as o,G as s,H as c,Ht as l,I as u,N as d,O as f,P as p,Qn as m,Qs as h,R as g,S as _,Ta as v,Tn as y,Tr as b,U as x,Ut as S,W as C,Za as w,br as T,cn as E,do as D,fo as O,hn as k,hr as A,mn as j,o as M,r as N,sr as P,uo as F,w as I,wr as L,xi as R,yr as z,z as B}from"./format-CmXxTS5M.js";import{B as ee,H as V,R as te,U as H,V as U,W}from"./TrayTitleSource-DN10ruw2.js";import{t as G}from"./copy-48gwhhDO.js";import{t as K}from"./ellipsis-CidyZaW2.js";import{t as ne}from"./key-round-m9ps8ZDi.js";import{t as q}from"./pencil-CpF9MxGZ.js";import{t as J}from"./plug-DKn7uRWT.js";import{t as Y}from"./plus-c3HzV6VX.js";import{t as re}from"./shield-check-CD30JqBi.js";import{t as ie}from"./terminal-B-mEYDi0.js";import{t as X}from"./trash-BHBJn5GS.js";import{t as ae}from"./zap-BiWUNaKt.js";import{B as oe,W as se,v as ce}from"./index-BW8keTkg.js";var Z=e(t(),1),Q=h(),le=[{kind:`claude-code`,name:`Claude Code`},{kind:`codex`,name:`Codex`}],ue={missing:`neutral`,applied:`green`,drifted:`orange`,conflict:`red`};function de(){let{t:e}=I(),t=E(),n=w(),r=(n.data??[]).filter(e=>e.enabled&&(e.mcpServers?.length??0)>0);return(0,Q.jsxs)(o,{title:e(`mcp.clients.title`),footer:e(`mcp.clients.stdio`),children:[(0,Q.jsx)(`p`,{className:`px-4 pt-3 text-[12px] text-[var(--text-muted)]`,children:e(`mcp.clients.hint`)}),t.isLoading&&(0,Q.jsx)(x,{lines:2}),t.data&&r.length===0&&n.data&&(0,Q.jsx)(`p`,{className:`px-4 py-2 text-[12px] text-[var(--text-muted)]`,children:e(`mcp.clients.noToken`)}),t.data&&le.map(e=>{let n=t.data.find(t=>t.kind===e.kind);return n?(0,Q.jsx)(fe,{name:e.name,entry:n,tokens:r.map(e=>({value:e.id,label:e.name}))},e.kind):null})]})}function fe({name:e,entry:t,tokens:n}){let{t:i}=I(),{toast:a,confirm:o}=W(),s=l(),c=R(),[u,d]=(0,Z.useState)(null),p=u??(n.some(e=>e.value===t.tokenId)?t.tokenId??null:n[0]?.value??null),m=s.isPending||c.isPending,h=t.state===`applied`||t.state===`drifted`,g=n=>{p&&s.mutate({kind:t.kind,tokenId:p,force:n},{onSuccess:()=>a(i(`mcp.clients.applied`,{client:e}),`success`),onError:e=>a(H(e),`error`)})},v=async n=>{(!n||await o({title:i(`mcp.clients.forceRemove`),detail:t.file,destructive:!0,confirmLabel:i(`mcp.clients.forceRemove`)}))&&c.mutate({kind:t.kind,force:n},{onSuccess:()=>a(i(`mcp.clients.removed`,{client:e}),`success`),onError:e=>a(H(e),`error`)})},y=(0,Q.jsxs)(`span`,{className:`block whitespace-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px]`,title:t.file,children:t.file}),t.state===`applied`&&t.tokenName&&(0,Q.jsx)(`span`,{className:`block`,children:i(`mcp.clients.usesToken`,{name:t.tokenName})}),t.error&&(0,Q.jsx)(`span`,{className:`block text-[var(--danger)]`,children:i(`mcp.clients.unreadable`,{error:t.error})})]});return(0,Q.jsxs)(`div`,{className:`border-t border-[var(--border)] first:border-t-0`,children:[(0,Q.jsxs)(B,{label:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e,(0,Q.jsx)(r,{tone:ue[t.state],children:i(`mcp.clients.state.${t.state}`)})]}),detail:y,children:[n.length>0&&(0,Q.jsx)(U,{className:`w-44`,ariaLabel:`${e} ${i(`mcp.clients.token`)}`,placeholder:i(`mcp.clients.pickToken`),value:p,onChange:d,options:n,disabled:m}),(0,Q.jsx)(f,{variant:`primary`,disabled:m||!p||t.state===`conflict`,onClick:()=>g(!1),children:i(h?`mcp.clients.replace`:`mcp.clients.apply`)}),h&&(0,Q.jsx)(f,{disabled:m,onClick:()=>void v(t.state===`drifted`),children:t.state===`drifted`?i(`mcp.clients.forceRemove`):i(`mcp.clients.remove`)})]}),!t.gatewayEnabled&&t.state!==`missing`&&(0,Q.jsx)(_,{tone:`warning`,className:`mx-4 mb-3`,title:i(`mcp.clients.gatewayOff`)}),!t.gatewayEnabled&&t.state===`missing`&&(0,Q.jsx)(`p`,{className:`px-4 pb-2 text-[11px] text-[var(--text-muted)]`,children:i(`mcp.clients.gatewayOff`)}),t.state===`conflict`&&!t.error&&(0,Q.jsx)(_,{tone:`warning`,className:`mx-4 mb-3`,title:i(`mcp.clients.conflict`)}),t.state===`drifted`&&(0,Q.jsxs)(`div`,{className:`mx-4 mb-3 flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:i(`mcp.clients.drifted`)}),(0,Q.jsx)(f,{size:`sm`,disabled:m||!p,onClick:()=>g(!0),children:i(`mcp.clients.force`)})]})]})}var pe=[{kind:`claude-code`,name:`Claude Code`},{kind:`codex`,name:`Codex`},{kind:`gemini-cli`,name:`Gemini CLI`},{kind:`qwen-code`,name:`Qwen Code`},{kind:`opencode`,name:`OpenCode`},{kind:`droid`,name:`Droid`},{kind:`crush`,name:`Crush`},{kind:`copilot-cli`,name:`Copilot CLI`}],me=[`claude-code`,`codex`,`gemini-cli`,`qwen-code`,`opencode`,`droid`],he=[`claude-code`,`codex`,`gemini-cli`,`qwen-code`,`opencode`],ge={"project-missing":`orange`,missing:`neutral`,applied:`green`,drifted:`orange`,conflict:`red`},$=e=>pe.find(t=>t.kind===e)?.name??e,_e=e=>e.split(`
2
- `).map(e=>e.replace(/\r$/,``)).filter(e=>e.trim()!==``);function ve(e){let t={};for(let n of e.split(`
3
- `)){let e=n.replace(/\r$/,``);if(e.trim()===``)continue;let r=e.indexOf(`=`);if(r<=0)return null;t[e.slice(0,r).trim()]=e.slice(r+1)}return t}function ye(e){let t={};for(let n of e.split(`
4
- `)){let e=n.replace(/\r$/,``);if(e.trim()===``)continue;let r=e.indexOf(`:`);if(r<=0)return null;t[e.slice(0,r).trim()]=e.slice(r+1).trim()}return t}function be(){let{t:e}=I(),{toast:t,confirm:n}=W(),r=T(),i=S(),a=y(),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u=async r=>{await n({title:e(`mcp.local.deleteTitle`,{name:r.name}),detail:e(`mcp.local.deleteDetail`),destructive:!0,confirmLabel:e(`common.delete`)})&&a.mutate({id:r.id},{onSuccess:()=>t(e(`mcp.local.deleted`,{name:r.name}),`success`),onError:e=>t(H(e),`error`)})},p=(n,r)=>i.mutate({id:n.id,force:r},{onSuccess:()=>t(e(`mcp.local.applied`,{name:n.name}),`success`),onError:e=>t(H(e),`error`)});return(0,Q.jsxs)(`section`,{className:`mt-6`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 px-1`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold`,children:e(`mcp.local.title`)}),(0,Q.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:e(`mcp.local.hint`)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(f,{icon:(0,Q.jsx)(oe,{className:`size-4`}),onClick:()=>l(!0),children:e(`mcp.local.import`)}),(0,Q.jsx)(f,{variant:`primary`,icon:(0,Q.jsx)(Y,{className:`size-4`}),onClick:()=>s(`new`),children:e(`mcp.local.add`)})]})]}),r.isLoading?(0,Q.jsx)(x,{}):!r.data||r.data.length===0?(0,Q.jsx)(d,{icon:(0,Q.jsx)(ie,{className:`size-6`}),title:e(`mcp.local.emptyTitle`),detail:e(`mcp.local.emptyDetail`)}):(0,Q.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:r.data.map(e=>(0,Q.jsx)(xe,{server:e,busy:i.isPending||a.isPending,onEdit:()=>s(e),onDelete:()=>void u(e),onRewrite:t=>p(e,t)},e.id))}),(0,Q.jsx)(`p`,{className:`mt-2 px-1 text-[11px] text-[var(--text-muted)]`,children:e(`mcp.local.footer`)}),(0,Q.jsx)(Ce,{server:o,onClose:()=>s(null)}),(0,Q.jsx)(we,{open:c,onClose:()=>l(!1)})]})}function xe({server:e,busy:t,onEdit:n,onDelete:i,onRewrite:a}){let{t:o}=I(),s=e.transport===`http`,c=s?e.url:[e.command,...e.args].join(` `),l=s?e.headerNames.length:e.envNames.length,u=e.placements.some(e=>e.wanted&&e.state!==`applied`);return(0,Q.jsxs)(`div`,{className:`px-1`,children:[(0,Q.jsxs)(B,{label:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),!e.enabled&&(0,Q.jsx)(r,{tone:`neutral`,children:o(`mcp.local.off`)})]}),detail:(0,Q.jsxs)(`span`,{className:`block truncate font-mono text-[11px]`,title:c,children:[c,l>0&&(0,Q.jsxs)(`span`,{className:`text-[var(--text-muted)]`,children:[` · `,o(s?`mcp.local.headerCount`:`mcp.local.envCount`,{count:l})]})]}),children:[u&&(0,Q.jsx)(f,{size:`sm`,disabled:t,onClick:()=>a(!1),children:o(`mcp.local.rewrite`)}),(0,Q.jsx)(f,{size:`sm`,icon:(0,Q.jsx)(q,{className:`size-3.5`}),onClick:n,"aria-label":o(`common.edit`)}),(0,Q.jsx)(f,{size:`sm`,icon:(0,Q.jsx)(X,{className:`size-3.5`}),disabled:t,onClick:i,"aria-label":o(`common.delete`)})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-3 px-4 pb-3`,children:e.placements.map(e=>(0,Q.jsx)(Se,{placement:e,onForce:()=>a(!0)},e.kind+(e.project??``)))})]})}function Se({placement:e,onForce:t}){let{t:n}=I();return!e.wanted&&e.state===`missing`?null:(0,Q.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px]`,title:e.file,children:[$(e.kind),e.project&&(0,Q.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--text-muted)]`,children:e.project.split(/[\\/]/).filter(Boolean).pop()}),(0,Q.jsx)(r,{tone:ge[e.state],children:n(`mcp.local.state.${e.state}`)}),e.state===`drifted`&&e.wanted&&(0,Q.jsx)(f,{size:`sm`,onClick:t,children:n(`mcp.clients.force`)})]}),e.error&&(0,Q.jsx)(`span`,{className:`max-w-md whitespace-normal text-[11px] text-[var(--danger)]`,children:e.error})]})}function Ce({server:e,onClose:t}){let{t:n}=I(),{toast:r}=W(),i=j(),a=F(),o=e&&e!==`new`?e:null,[l,d]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[g,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`stdio`),[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)([]),[M,N]=(0,Z.useState)([]),P=A().data??[],[L,R]=(0,Z.useState)(!0);(0,Z.useEffect)(()=>{if(e===null)return;let t=e===`new`?null:e;d(t?.name??``),h(t?.command??``),v((t?.args??[]).join(`
5
- `)),b(``),D(``),S(t?.transport??`stdio`),T(t?.url??``),k(t?.clients??he),N(t?.projects??[]),R(t?.enabled??!0)},[e]);let z=x===`http`,ee=o?.transport===`stdio`&&x===`stdio`&&o.envNames.length>0,te=o?.transport===`http`&&x===`http`&&o.headerNames.length>0,U=ve(y),G=ye(E),K=i.isPending||a.isPending,ne=l.trim()!==``&&(z?w.trim()!==``&&G!==null:m.trim()!==``&&U!==null),q=()=>{let e=z?{name:l.trim(),transport:x,url:w.trim(),enabled:L,clients:O,projects:M}:{name:l.trim(),transport:x,command:m.trim(),args:_e(g),enabled:L,clients:O,projects:M},s=o?.transport===x;z&&G&&(E.trim()!==``||!s)&&(e.headers=G),!z&&U&&(y.trim()!==``||!s)&&(e.env=U);let c={onSuccess:e=>{t(),r(n(o?`mcp.local.saved`:`mcp.local.created`,{name:e.name}),`success`)},onError:e=>r(H(e),`error`)};o?a.mutate({id:o.id,body:e},c):i.mutate(e,c)},J=(e,t)=>k(n=>t?[...n.filter(t=>t!==e),e]:n.filter(t=>t!==e));return(0,Q.jsx)(V,{open:e!==null,onOpenChange:e=>!e&&t(),width:560,title:o?n(`mcp.local.editTitle`,{name:o.name}):n(`mcp.local.addTitle`),footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{onClick:t,children:n(`common.cancel`)}),(0,Q.jsx)(f,{variant:`primary`,disabled:!ne,loading:K,onClick:q,children:n(`common.save`)})]}),children:(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsx)(p,{label:n(`mcp.local.name`),hint:n(`mcp.local.nameHint`),children:(0,Q.jsx)(u,{mono:!0,value:l,maxLength:32,placeholder:`filesystem`,onChange:e=>d(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.local.transport`),children:(0,Q.jsx)(c,{ariaLabel:n(`mcp.local.transport`),value:x,onChange:S,items:[{value:`stdio`,label:n(`mcp.local.transport.stdio`)},{value:`http`,label:n(`mcp.local.transport.http`)}]})}),z?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{label:n(`mcp.local.url`),hint:n(`mcp.local.urlHint`),children:(0,Q.jsx)(u,{mono:!0,value:w,placeholder:`https://mcp.example.com/mcp`,onChange:e=>T(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.local.headers`),hint:te?n(`mcp.local.headersKept`,{names:o.headerNames.join(`, `)}):n(`mcp.local.headersHint`),children:(0,Q.jsx)(s,{mono:!0,rows:3,value:E,placeholder:`Authorization: Bearer ...`,onChange:e=>D(e.target.value)})}),G===null&&(0,Q.jsx)(_,{tone:`warning`,title:n(`mcp.local.headersInvalid`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{label:n(`mcp.local.command`),children:(0,Q.jsx)(u,{mono:!0,value:m,placeholder:`npx`,onChange:e=>h(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.local.args`),hint:n(`mcp.local.argsHint`),children:(0,Q.jsx)(s,{mono:!0,rows:4,value:g,placeholder:`-y
6
- @modelcontextprotocol/server-filesystem
7
- /Users/me/docs`,onChange:e=>v(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.local.env`),hint:ee?n(`mcp.local.envKept`,{names:o.envNames.join(`, `)}):n(`mcp.local.envHint`),children:(0,Q.jsx)(s,{mono:!0,rows:3,value:y,placeholder:`API_KEY=...`,onChange:e=>b(e.target.value)})}),U===null&&(0,Q.jsx)(_,{tone:`warning`,title:n(`mcp.local.envInvalid`)})]}),(0,Q.jsx)(p,{label:n(`mcp.local.clients`),hint:n(`mcp.local.clientsHint`),children:(0,Q.jsx)(`div`,{className:`grid gap-1`,children:pe.map(e=>(0,Q.jsx)(B,{label:e.name,children:(0,Q.jsx)(C,{checked:O.includes(e.kind),label:e.name,onChange:t=>J(e.kind,t)})},e.kind))})}),(P.length>0||M.length>0)&&(0,Q.jsx)(p,{label:n(`mcp.local.projects`),hint:n(`mcp.local.projectsHint`,{clients:me.map($).join(`, `)}),children:(0,Q.jsx)(`div`,{className:`grid gap-1`,children:[...P.map(e=>e.path),...M.filter(e=>!P.some(t=>t.path===e))].map(e=>(0,Q.jsx)(B,{label:(0,Q.jsx)(`span`,{className:`font-mono text-[12px]`,children:e}),children:(0,Q.jsx)(C,{checked:M.includes(e),label:e,onChange:t=>N(n=>t?[...n.filter(t=>t!==e),e]:n.filter(t=>t!==e))})},e))})}),(0,Q.jsx)(B,{label:n(`mcp.local.enabled`),children:(0,Q.jsx)(C,{checked:L,label:n(`mcp.local.enabled`),onChange:R})})]})})}function we({open:e,onClose:t}){let{t:n}=I(),{toast:i}=W(),a=z(e),o=P(),[s,c]=(0,Z.useState)(new Set),l=e=>`${e.kind}\u0000${e.name}`;(0,Z.useEffect)(()=>{e&&c(new Set)},[e]);let u=(a.data??[]).filter(e=>e.importable&&!e.taken),d=(e,t)=>c(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r});return(0,Q.jsx)(V,{open:e,onOpenChange:e=>!e&&t(),width:560,title:n(`mcp.local.importTitle`),description:n(`mcp.local.importHint`),footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{onClick:t,children:n(`common.cancel`)}),(0,Q.jsx)(f,{variant:`primary`,disabled:s.size===0,loading:o.isPending,onClick:()=>{let e=u.filter(e=>s.has(l(e))).map(e=>({kind:e.kind,name:e.name}));o.mutate(e,{onSuccess:e=>{let r=n(`mcp.local.importDone`,{count:e.imported.length});i(e.skipped.length>0?`${r} ${n(`mcp.local.importSkipped`,{count:e.skipped.length,reasons:[...new Set(e.skipped.map(e=>e.reason))].join(`; `)})}`:r,e.imported.length>0?`success`:`error`),t()},onError:e=>i(H(e),`error`)})},children:n(`mcp.local.importRun`)})]}),children:a.isLoading?(0,Q.jsx)(x,{}):!a.data||a.data.length===0?(0,Q.jsx)(`p`,{className:`text-[13px] text-[var(--text-muted)]`,children:n(`mcp.local.importEmpty`)}):(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[a.data.map(e=>{let t=l(e),i=!e.importable||e.taken;return(0,Q.jsx)(B,{label:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,Q.jsx)(r,{tone:`neutral`,children:$(e.kind)})]}),detail:(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px]`,title:e.summary,children:i?e.taken?n(`mcp.local.importTaken`):e.reason??``:e.summary}),children:(0,Q.jsx)(C,{checked:s.has(t),disabled:i,label:`${e.name} ${$(e.kind)}`,onChange:e=>d(t,e)})},t)}),(0,Q.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--text-muted)]`,children:n(`mcp.local.importSecrets`)})]})})}var Te={unknown:`neutral`,ok:`green`,needs_auth:`orange`,auth_error:`red`,unreachable:`red`,version_unsupported:`red`};function Ee(){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{}),(0,Q.jsx)(de,{}),(0,Q.jsx)(be,{}),(0,Q.jsx)(Oe,{}),(0,Q.jsx)(Me,{})]})}function De(){let{t:e}=I(),{toast:t}=W(),n=a(),r=O(),[i,c]=(0,Z.useState)(``),l=n.data?.allowedOrigins.join(`
8
- `)??``;if((0,Z.useEffect)(()=>c(l),[l]),!n.data)return(0,Q.jsx)(x,{});let u=n.data,d=n=>r.mutate(n,{onSuccess:()=>t(e(`common.saved`),`success`),onError:e=>t(H(e),`error`)});return(0,Q.jsxs)(o,{title:e(`mcp.gateway.title`),children:[(0,Q.jsx)(B,{label:e(`mcp.gateway.enable`),detail:e(`mcp.gateway.enableHint`),children:(0,Q.jsx)(C,{checked:u.enabled,disabled:r.isPending,label:e(`mcp.gateway.enable`),onChange:e=>d({enabled:e})})}),(0,Q.jsx)(B,{label:e(`mcp.gateway.remoteAdmin`),detail:e(`mcp.gateway.remoteAdminHint`),children:(0,Q.jsx)(C,{checked:u.allowRemoteAdmin,disabled:r.isPending,label:e(`mcp.gateway.remoteAdmin`),onChange:e=>d({allowRemoteAdmin:e})})}),(0,Q.jsxs)(B,{label:e(`mcp.gateway.endpoint`),detail:(0,Q.jsx)(`span`,{className:`block whitespace-normal`,children:e(`mcp.gateway.endpointHint`)}),children:[(0,Q.jsx)(`code`,{className:`max-w-[22rem] truncate rounded bg-[var(--surface-muted,transparent)] px-1.5 py-0.5 font-mono text-[12px]`,title:u.endpoint,children:u.endpoint}),(0,Q.jsx)(f,{size:`sm`,variant:`plain`,icon:(0,Q.jsx)(G,{className:`size-3.5`}),"aria-label":e(`mcp.gateway.copyEndpoint`),onClick:()=>void te.copy(u.endpoint).then(n=>n&&t(e(`mcp.gateway.copied`),`success`))})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2 px-4 py-3`,children:[(0,Q.jsx)(p,{label:e(`mcp.gateway.origins`),hint:e(`mcp.gateway.originsHint`),children:(0,Q.jsx)(s,{mono:!0,rows:3,value:i,placeholder:`https://app.example.com`,onChange:e=>c(e.target.value)})}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(f,{size:`sm`,disabled:i.trim()===l.trim()||r.isPending,onClick:()=>d({allowedOrigins:i.split(`
9
- `).map(e=>e.trim()).filter(Boolean)}),children:e(`mcp.gateway.originsSave`)})})]})]})}function Oe(){let{t:e}=I(),{toast:t,confirm:r}=W(),a=b(),o=n(),s=v(),c=m(),l=i(),[u,p]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),_=n=>o.mutate(n.id,{onSuccess:r=>{r.ok?g({server:n,result:r}):t(e(`mcp.server.testFailed`,{message:r.message??r.status}),`error`)},onError:e=>t(H(e),`error`)}),y=n=>s.mutate(n.id,{onSuccess:n=>{n.authorizationUrl?(window.open(n.authorizationUrl,`_blank`,`noopener`),t(e(`mcp.server.authorizeOpened`),`success`)):t(n.message??e(`mcp.server.authorizeNotNeeded`),`success`)},onError:e=>t(H(e),`error`)}),S=async n=>{await r({title:e(`mcp.server.forgetConfirm`,{name:n.name}),detail:e(`mcp.server.forgetDetail`),confirmLabel:e(`mcp.server.forget`),destructive:!0})&&c.mutate(n.id,{onSuccess:()=>t(e(`mcp.server.forgotten`),`success`),onError:e=>t(H(e),`error`)})},C=async n=>{await r({title:e(`mcp.server.deleteConfirm`,{name:n.name}),detail:e(`mcp.server.deleteDetail`),confirmLabel:e(`common.delete`),destructive:!0})&&l.mutate(n.id,{onSuccess:()=>t(e(`mcp.server.deleted`,{name:n.name}),`success`),onError:e=>t(H(e),`error`)})};return(0,Q.jsxs)(`section`,{className:`mb-5`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between px-1`,children:[(0,Q.jsx)(`h3`,{className:`text-[12px] font-medium text-[var(--text-secondary)]`,children:e(`mcp.servers.title`)}),(0,Q.jsx)(f,{size:`sm`,variant:`primary`,icon:(0,Q.jsx)(Y,{className:`size-3.5`}),onClick:()=>p(`new`),children:e(`mcp.servers.add`)})]}),a.data===void 0?(0,Q.jsx)(x,{}):a.data.length===0?(0,Q.jsx)(d,{icon:(0,Q.jsx)(J,{className:`size-6`}),title:e(`mcp.servers.emptyTitle`),detail:e(`mcp.servers.emptyDetail`)}):(0,Q.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:a.data.map(e=>(0,Q.jsx)(ke,{server:e,busy:o.isPending&&o.variables===e.id,onTest:()=>_(e),onEdit:()=>p(e),onAuthorize:()=>y(e),onForget:()=>void S(e),onDelete:()=>void C(e)},e.id))}),(0,Q.jsx)(`p`,{className:`mt-2 px-1 text-[11px] text-[var(--text-muted)]`,children:e(`mcp.servers.localOnly`)}),(0,Q.jsx)(je,{server:u,onClose:()=>p(null)}),(0,Q.jsx)(V,{open:h!==null,onOpenChange:e=>!e&&g(null),title:e(`mcp.server.testToolsTitle`,{name:h?.server.name??``}),description:h?e(`mcp.server.testOk`,{count:h.result.toolCount}):void 0,footer:(0,Q.jsx)(f,{onClick:()=>g(null),children:e(`common.close`)}),children:(0,Q.jsx)(`ul`,{className:`max-h-72 overflow-auto font-mono text-[12px] text-[var(--text-secondary)]`,children:h?.result.tools.map(e=>(0,Q.jsx)(`li`,{className:`truncate py-0.5`,children:e},e))})})]})}function ke({server:e,busy:t,onTest:n,onEdit:i,onAuthorize:a,onForget:o,onDelete:s}){let{t:c,locale:l}=I(),u=D(),d=e.id===`builtin-astra`,p=e.authType===`oauth`,m=e.oauth?.authorized===!0,h=[e.slug,e.protocolVersion?c(`mcp.server.protocol`,{version:e.protocolVersion}):null,c(`mcp.server.boundTokens`,{count:e.boundTokens}),e.checkedAt?N(e.checkedAt,l):null].filter(Boolean).join(` · `);return(0,Q.jsxs)(B,{label:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),d&&(0,Q.jsx)(r,{tone:`accent`,children:c(`mcp.server.builtIn`)}),(0,Q.jsx)(r,{tone:Te[e.status],title:e.statusMessage??void 0,children:c(`mcp.status.${e.status}`)}),!e.enabled&&(0,Q.jsx)(r,{children:c(`mcp.server.disabledBadge`)})]}),detail:(0,Q.jsxs)(`span`,{className:`block whitespace-normal`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.url}),(0,Q.jsx)(`span`,{className:`block`,children:h}),p&&m&&e.oauth?.issuer&&(0,Q.jsx)(`span`,{className:`block`,children:c(`mcp.server.authorizedBy`,{issuer:e.oauth.issuer})})]}),children:[d&&(0,Q.jsx)(Ae,{}),p&&(0,Q.jsx)(f,{size:`sm`,variant:m?`glass`:`primary`,icon:(0,Q.jsx)(re,{className:`size-3.5`}),onClick:a,children:c(m?`mcp.server.reauthorize`:`mcp.server.authorize`)}),!d&&(0,Q.jsx)(f,{size:`sm`,icon:(0,Q.jsx)(ae,{className:`size-3.5`}),loading:t,onClick:n,children:c(`mcp.server.test`)}),d?(0,Q.jsx)(C,{checked:e.enabled,label:e.name,onChange:t=>u.mutate({id:e.id,body:{enabled:t}})}):(0,Q.jsx)(ee,{label:e.name,iconOnly:!0,icon:(0,Q.jsx)(K,{className:`size-4`}),items:[{id:`edit`,label:c(`common.edit`),icon:(0,Q.jsx)(q,{className:`size-3.5`}),onSelect:i},...p&&m?[{id:`forget`,label:c(`mcp.server.forget`),icon:(0,Q.jsx)(ne,{className:`size-3.5`}),onSelect:o}]:[],{id:`delete`,label:c(`common.delete`),icon:(0,Q.jsx)(X,{className:`size-3.5`}),destructive:!0,separatorBefore:!0,onSelect:s}]})]})}function Ae(){let{t:e}=I(),t=se();return(0,Q.jsx)(f,{size:`sm`,onClick:()=>t(`/tools`),children:e(`mcp.server.builtInManage`)})}function je({server:e,onClose:t}){let{t:n}=I(),{toast:r}=W(),i=k(),a=D(),o=e&&e!==`new`?e:null,[s,l]=(0,Z.useState)(``),[d,m]=(0,Z.useState)(``),[h,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(`http`),[x,S]=(0,Z.useState)(`none`),[w,T]=(0,Z.useState)([]),[E,O]=(0,Z.useState)(60),[A,j]=(0,Z.useState)(!0);(0,Z.useEffect)(()=>{if(e===null)return;let t=e===`new`?null:e;l(t?.name??``),m(t?.slug??``),v(t?.url??``),b(t?.transport??`http`),S(t?.authType??`none`),T((t?.headerNames??[]).map(e=>({name:e,value:``,kept:!0}))),O(t?.timeoutSeconds??60),j(t?.enabled??!0)},[e]);let M=i.isPending||a.isPending,N=s.trim()!==``&&h.trim()!==``&&(x!==`header`||w.some(e=>e.name.trim()!==``&&(e.value!==``||e.kept))),P=()=>{let e={name:s.trim(),url:h.trim(),transport:y,authType:x,enabled:A,...E==null?{}:{timeoutSeconds:Math.floor(E)},...d.trim()?{slug:d.trim()}:{}};x===`header`&&(e.headers=Object.fromEntries(w.filter(e=>e.name.trim()!==``).map(e=>[e.name.trim(),e.kept&&e.value===``?null:e.value])));let c={onSuccess:e=>{t(),r(n(o?`mcp.server.saved`:`mcp.server.created`,{name:e.name}),`success`)},onError:e=>r(H(e),`error`)};o?a.mutate({id:o.id,body:e},c):i.mutate(e,c)},F=(e,t)=>T(n=>n.map((n,r)=>r===e?{...n,...t}:n));return(0,Q.jsx)(V,{open:e!==null,onOpenChange:e=>!e&&t(),width:560,title:o?n(`mcp.server.editTitle`,{name:o.name}):n(`mcp.server.addTitle`),footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{onClick:t,children:n(`common.cancel`)}),(0,Q.jsx)(f,{variant:`primary`,disabled:!N,loading:M,onClick:P,children:n(`common.save`)})]}),children:(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsx)(p,{label:n(`mcp.server.name`),children:(0,Q.jsx)(u,{value:s,maxLength:64,onChange:e=>l(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.server.url`),hint:n(`mcp.server.urlHint`),children:(0,Q.jsx)(u,{mono:!0,value:h,placeholder:`https://mcp.example.com/mcp`,onChange:e=>v(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.server.transport`),hint:n(`mcp.server.transportHint`),children:(0,Q.jsx)(c,{ariaLabel:n(`mcp.server.transport`),value:y,onChange:b,items:[{value:`http`,label:n(`mcp.server.transport.http`)},{value:`sse`,label:n(`mcp.server.transport.sse`)}]})}),(0,Q.jsx)(p,{label:n(`mcp.server.auth`),children:(0,Q.jsx)(c,{ariaLabel:n(`mcp.server.auth`),value:x,onChange:S,items:[{value:`none`,label:n(`mcp.server.auth.none`)},{value:`header`,label:n(`mcp.server.auth.header`)},{value:`oauth`,label:n(`mcp.server.auth.oauth`)}]})}),x===`oauth`&&(0,Q.jsx)(_,{tone:`warning`,title:n(`mcp.server.oauthNote`)}),x===`header`&&(0,Q.jsx)(p,{label:n(`mcp.server.headers`),hint:n(`mcp.server.headersHint`),children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[w.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(u,{className:`w-40`,mono:!0,label:n(`mcp.server.headerName`),placeholder:`Authorization`,value:e.name,readOnly:e.kept&&o!==null,onChange:e=>F(t,{name:e.target.value})}),(0,Q.jsx)(u,{className:`flex-1`,mono:!0,type:`password`,label:n(`mcp.server.headerValue`),placeholder:e.kept?n(`mcp.server.headerKept`):`Bearer …`,value:e.value,onChange:e=>F(t,{value:e.target.value})}),(0,Q.jsx)(f,{size:`sm`,variant:`plain`,icon:(0,Q.jsx)(X,{className:`size-3.5`}),"aria-label":n(`mcp.server.removeHeader`),onClick:()=>T(e=>e.filter((e,n)=>n!==t))})]},t)),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(f,{size:`sm`,icon:(0,Q.jsx)(Y,{className:`size-3.5`}),onClick:()=>T(e=>[...e,{name:``,value:``,kept:!1}]),children:n(`mcp.server.addHeader`)})})]})}),(0,Q.jsx)(p,{label:n(`mcp.server.slug`),hint:n(`mcp.server.slugHint`),children:(0,Q.jsx)(u,{mono:!0,value:d,maxLength:32,placeholder:o?``:`github`,onChange:e=>m(e.target.value)})}),(0,Q.jsx)(p,{label:n(`mcp.server.timeout`),hint:n(`mcp.server.timeoutHint`),children:(0,Q.jsx)(g,{value:E,min:1,step:1,label:n(`mcp.server.timeout`),onChange:O})}),(0,Q.jsx)(B,{label:n(`mcp.server.enabled`),children:(0,Q.jsx)(C,{checked:A,label:n(`mcp.server.enabled`),onChange:j})})]})})}function Me(){let{t:e,locale:t}=I(),n=L(50);return(0,Q.jsx)(o,{title:e(`mcp.calls.title`),footer:e(`mcp.calls.hint`),children:n.data===void 0?(0,Q.jsx)(`div`,{className:`p-4`,children:(0,Q.jsx)(x,{})}):n.data.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-6 text-center text-[12px] text-[var(--text-muted)]`,children:e(`mcp.calls.empty`)}):(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-left text-[12px]`,children:[(0,Q.jsx)(`thead`,{className:`text-[var(--text-muted)]`,children:(0,Q.jsx)(`tr`,{children:[`time`,`token`,`tool`,`duration`,`result`].map(t=>(0,Q.jsx)(`th`,{className:`px-4 py-2 font-normal`,children:e(`mcp.calls.${t}`)},t))})}),(0,Q.jsx)(`tbody`,{children:n.data.map(e=>(0,Q.jsx)(Ne,{call:e,locale:t},e.id))})]})})})}function Ne({call:e,locale:t}){let{t:n}=I();return(0,Q.jsxs)(`tr`,{className:`border-t border-[var(--border)]`,children:[(0,Q.jsx)(`td`,{className:`whitespace-nowrap px-4 py-1.5 text-[var(--text-secondary)]`,children:N(e.at,t)}),(0,Q.jsx)(`td`,{className:`px-4 py-1.5`,children:e.tokenName??e.tokenId}),(0,Q.jsxs)(`td`,{className:`px-4 py-1.5 font-mono`,children:[e.serverSlug,(0,Q.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`/`}),e.tool,e.frontEra&&(0,Q.jsx)(`span`,{className:`ml-2 text-[10.5px] text-[var(--text-muted)]`,children:n(`mcp.calls.era.${e.frontEra}`)})]}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap px-4 py-1.5 tabular-nums text-[var(--text-secondary)]`,children:M(e.durationMs)}),(0,Q.jsx)(`td`,{className:`px-4 py-1.5`,children:e.ok?(0,Q.jsx)(r,{tone:`green`,children:n(`mcp.calls.ok`)}):(0,Q.jsx)(r,{tone:`red`,children:n(`mcp.calls.error.${e.errorCategory??`protocol`}`)})})]})}function Pe(){let{t:e}=I();return(0,Q.jsx)(ce,{title:e(`nav.mcp`),subtitle:e(`mcp.subtitle`),children:(0,Q.jsx)(Ee,{})})}export{Pe as McpPage};
@@ -1 +0,0 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{D as n,Dn as r,F as i,I as a,Ii as o,Io as s,O as c,On as l,P as u,Qs as d,R as f,S as p,U as m,V as h,W as g,kr as _,po as v,r as ee,ti as y,w as b,y as x,z as S}from"./format-CmXxTS5M.js";import{H as C,U as w,V as T,W as E}from"./TrayTitleSource-DN10ruw2.js";import{t as D}from"./arrow-left-DhPqlXf4.js";import{t as O}from"./pencil-CpF9MxGZ.js";import{t as k}from"./plus-c3HzV6VX.js";import{t as A}from"./rotate-ccw-fsXoCwyv.js";import{t as j}from"./trash-BHBJn5GS.js";import{G as M,H as N,W as te,l as P,s as ne,v as F}from"./index-BW8keTkg.js";import{t as I}from"./checkbox-CZ-rG7I2.js";import{t as L}from"./confirm-morph-Cakq9Lho.js";var R=e(t(),1),z=d(),B=[{key:`vision`,label:`cap.vision`},{key:`tools`,label:`cap.tools`},{key:`reasoning`,label:`cap.reasoning`},{key:`promptCache`,label:`cap.promptCache`},{key:`audio`,label:`cap.audio`},{key:`pdf`,label:`cap.pdf`},{key:`structuredOutput`,label:`cap.structuredOutput`}];function V(e){return{displayName:e.displayName,vendor:e.vendor,family:e.family??null,aliases:e.aliases,contextWindow:e.contextWindow??null,maxOutputTokens:e.maxOutputTokens??null,capabilities:e.capabilities,pricing:e.pricing??null,enabled:e.enabled}}function H(){let{t:e,locale:t}=b(),s=te(),{id:l=``}=M(),u=decodeURIComponent(l),d=_(u),y=v(u),C=o(u),T=r(),{toast:O}=E(),k=(0,R.useMemo)(()=>d.data?V(d.data):null,[d.data]),[j,L]=(0,R.useState)(k),[H,G]=(0,R.useState)(``);(0,R.useEffect)(()=>{L(k),G(k?.aliases?.join(`, `)??``)},[k]);let q=(0,z.jsx)(c,{variant:`glass`,icon:(0,z.jsx)(D,{className:`size-4`}),"aria-label":e(`common.back`),onClick:()=>s(`/models`)});if(d.isError)return(0,z.jsx)(F,{title:e(`nav.models`),leading:q,children:(0,z.jsx)(p,{tone:`danger`,title:e(`common.error`),children:w(d.error)})});let J=d.data;if(!J||!j)return(0,z.jsx)(F,{title:``,leading:q,children:(0,z.jsx)(m,{lines:5,className:`mx-auto max-w-[1100px]`})});let Y=e=>L(t=>({...t,...e})),X={...j,aliases:H.split(/[,\n]/).map(e=>e.trim()).filter(Boolean)},Z=JSON.stringify(X)!==JSON.stringify(k),re=new Set(J.userModifiedFields),Q=J.source===`seed`,ie=()=>y.mutate(X,{onSuccess:()=>O(e(`common.saved`),`success`),onError:e=>O(w(e),`error`)}),$=t=>re.has(t)?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,z.jsx)(n,{tone:`orange`,children:e(`models.modified`)}),Q&&(0,z.jsx)(c,{size:`sm`,variant:`plain`,icon:(0,z.jsx)(A,{className:`size-3`}),title:e(`models.resetField`),"aria-label":e(`models.resetField`),onClick:()=>C.mutate(t,{onSuccess:()=>O(e(`models.fieldReset`)),onError:e=>O(w(e),`error`)})})]}):null;return(0,z.jsx)(F,{title:J.displayName,subtitle:`${J.id} · ${e(`models.source.${J.source}`)} · ${e(`models.updated`,{time:ee(J.updatedAt,t)})}`,leading:q,actions:(0,z.jsxs)(z.Fragment,{children:[J.source===`user`&&(0,z.jsx)(K,{label:e(`common.delete`),prompt:e(`models.deleteConfirm`,{id:J.id}),onConfirm:async()=>{await T.mutateAsync(J.id),s(`/models`)}}),Z&&(0,z.jsx)(c,{onClick:()=>{L(k),G(k?.aliases?.join(`, `)??``)},children:e(`common.revert`)}),(0,z.jsx)(c,{variant:`primary`,disabled:!Z,loading:y.isPending,onClick:ie,children:e(`common.save`)})]}),children:(0,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1100px] gap-x-6 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(i,{title:e(`models.section.basic`),footer:Q?e(`models.modifiedFooter`):void 0,children:[(0,z.jsx)(U,{label:e(`models.field.displayName`),marker:$(`displayName`),children:(0,z.jsx)(a,{className:`w-60`,"aria-label":e(`models.field.displayName`),value:j.displayName,onChange:e=>Y({displayName:e.target.value})})}),(0,z.jsx)(U,{label:e(`models.field.vendor`),children:(0,z.jsx)(a,{className:`w-60`,"aria-label":e(`models.field.vendor`),value:j.vendor,onChange:e=>Y({vendor:e.target.value})})}),(0,z.jsx)(U,{label:e(`models.field.family`),marker:$(`family`),children:(0,z.jsx)(a,{className:`w-60`,"aria-label":e(`models.field.family`),value:j.family??``,onChange:e=>Y({family:e.target.value||null})})}),(0,z.jsx)(U,{label:e(`models.field.aliases`),marker:$(`aliases`),children:(0,z.jsx)(a,{className:`w-60 font-mono`,"aria-label":e(`models.field.aliases`),value:H,onChange:e=>G(e.target.value),placeholder:`a, b, c`})}),(0,z.jsx)(U,{label:e(`models.field.contextWindow`),marker:$(`contextWindow`),children:(0,z.jsx)(f,{className:`w-36`,label:e(`models.field.contextWindow`),value:j.contextWindow,onChange:e=>Y({contextWindow:e})})}),(0,z.jsx)(U,{label:e(`models.field.maxOutputTokens`),marker:$(`maxOutputTokens`),children:(0,z.jsx)(f,{className:`w-36`,label:e(`models.field.maxOutputTokens`),value:j.maxOutputTokens,onChange:e=>Y({maxOutputTokens:e})})}),(0,z.jsx)(U,{label:e(`common.enabled`),children:(0,z.jsx)(g,{checked:j.enabled??!0,label:e(`common.enabled`),onChange:e=>Y({enabled:e})})})]}),(0,z.jsx)(i,{title:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[e(`models.section.capabilities`),` `,$(`capabilities`)]}),children:(0,z.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 px-4 py-4`,children:B.map(t=>(0,z.jsx)(I,{label:e(t.label),checked:!!j.capabilities?.[t.key],onCheckedChange:e=>Y({capabilities:{...j.capabilities,[t.key]:e===!0}})},t.key))})}),(0,z.jsx)(W,{model:J}),J.providerOverrides.length>0&&(0,z.jsx)(i,{title:e(`models.section.overrides`),footer:e(`models.overridesFooter`),children:J.providerOverrides.map(e=>(0,z.jsx)(S,{label:(0,z.jsx)(N,{className:`text-[var(--accent)]`,to:`/providers/${e.providerId}`,children:e.providerName}),detail:`${e.modelId} · ${x(e.pricing)}`},e.providerModelId))})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`section`,{className:`mb-5`,children:[(0,z.jsx)(h,{action:$(`pricing`),children:e(`models.section.pricing`)}),(0,z.jsx)(`p`,{className:`mb-3 px-1 text-[12px] text-[var(--text-secondary)]`,children:e(`models.pricingHint`)}),(0,z.jsx)(`div`,{className:`card p-4`,children:(0,z.jsx)(P,{value:j.pricing??null,onChange:e=>Y({pricing:e}),allowEmpty:!0})})]}),(0,z.jsxs)(`section`,{className:`mb-5`,children:[(0,z.jsx)(h,{children:e(`models.section.simulator`)}),(0,z.jsxs)(`div`,{className:`card p-4`,children:[(0,z.jsx)(ne,{modelId:Z?void 0:J.id,pricing:Z?X.pricing:null}),Z&&(0,z.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--text-muted)]`,children:e(`models.simulatorUnsaved`)})]})]})]})]})})}function U({label:e,marker:t,children:n}){return(0,z.jsx)(S,{label:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[e,t]}),children:n})}function W({model:e}){let{t}=b(),r=l(e.id),[a,o]=(0,R.useState)(null);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(i,{title:(0,z.jsxs)(`span`,{className:`flex items-center justify-between`,children:[t(`models.section.providerPrices`),(0,z.jsx)(c,{size:`sm`,variant:`plain`,icon:(0,z.jsx)(k,{className:`size-3.5`}),onClick:()=>o(`new`),children:t(`common.add`)})]}),footer:t(`models.providerPricesFooter`),children:[e.providerPrices.length===0&&(0,z.jsx)(S,{label:(0,z.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`models.noProviderPrices`)})}),e.providerPrices.map(e=>(0,z.jsxs)(S,{label:(0,z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.priceKey}),e.userModified&&(0,z.jsx)(n,{tone:`orange`,children:t(`models.modified`)})]}),detail:[x(e.pricing),e.upstreamModelId,e.pricing.time_windows?.length?t(`models.hasTimeWindows`):null,e.pricing.context_tiers?.length?t(`models.hasTiers`):null].filter(Boolean).join(` · `),children:[(0,z.jsx)(c,{size:`sm`,variant:`plain`,icon:(0,z.jsx)(O,{className:`size-3.5`}),"aria-label":t(`common.edit`),onClick:()=>o(e)}),(0,z.jsx)(K,{label:t(`common.delete`),prompt:t(`models.deletePrice`,{key:e.priceKey}),onConfirm:()=>r.mutateAsync(e.priceKey)})]},e.priceKey))]}),(0,z.jsx)(G,{model:e,editing:a,onClose:()=>o(null)})]})}function G({model:e,editing:t,onClose:n}){let{t:r}=b(),{toast:i}=E(),o=y(),l=s(e.id),d=t===`new`,[f,p]=(0,R.useState)(``),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(null);(0,R.useEffect)(()=>{t&&(t===`new`?(p(``),h(``),_(e.pricing?structuredClone(e.pricing):{currency:`USD`,unit:`per_1m_tokens`,base:{input:null,output:null}})):(p(t.priceKey),h(t.upstreamModelId??``),_(structuredClone(t.pricing))))},[t,e.pricing]);let v=new Set(e.providerPrices.map(e=>e.priceKey));return(0,z.jsx)(C,{open:t!==null,onOpenChange:e=>!e&&n(),width:680,title:d?r(`models.addPrice`):r(`models.editPrice`,{key:f}),description:r(`models.priceSheetDetail`),footer:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(c,{onClick:n,children:r(`common.cancel`)}),(0,z.jsx)(c,{variant:`primary`,disabled:!f||!g,loading:l.isPending,onClick:()=>l.mutate({priceKey:f,upstreamModelId:m||null,pricing:g},{onSuccess:()=>{i(r(`common.saved`),`success`),n()},onError:e=>i(w(e),`error`)}),children:r(`common.save`)})]}),children:(0,z.jsxs)(`div`,{className:`grid gap-4`,children:[(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,z.jsx)(u,{label:r(`providers.priceKey`),children:d?(0,z.jsx)(T,{value:f,onChange:p,placeholder:r(`models.pickPriceKey`),options:(o.data??[]).map(e=>({value:e.priceKey,label:e.label,detail:e.priceKey,disabled:v.has(e.priceKey)}))}):(0,z.jsx)(a,{value:f,disabled:!0,className:`font-mono`})}),(0,z.jsx)(u,{label:r(`models.upstreamId`),hint:r(`models.upstreamIdHint`),children:(0,z.jsx)(a,{className:`font-mono`,value:m,onChange:e=>h(e.target.value),placeholder:e.id})})]}),d&&(0,z.jsx)(a,{className:`font-mono`,"aria-label":r(`models.customPriceKey`),placeholder:r(`models.customPriceKey`),value:f,onChange:e=>p(e.target.value.trim())}),(0,z.jsx)(P,{value:g,onChange:_})]})})}function K({label:e,prompt:t,onConfirm:n}){let{t:r}=b();return(0,z.jsx)(L,{label:e,icon:(0,z.jsx)(j,{className:`size-4`}),prompt:t,confirmLabel:r(`common.delete`),cancelLabel:r(`common.cancel`),pendingLabel:r(`common.deleting`),doneLabel:r(`common.deleted`),errorLabel:r(`common.error`),retryLabel:r(`common.retry`),onConfirm:n})}export{H as ModelDetailPage};
@@ -1,2 +0,0 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{B as n,Ci as r,Cr as i,D as a,G as o,H as s,Hr as c,I as l,Jr as u,L as d,Lr as f,N as p,Nt as m,O as h,P as g,Qs as _,Rr as v,S as y,Ti as b,U as x,W as S,Zr as C,cr as w,dt as T,fr as E,jr as D,k as O,mo as k,r as A,w as j,zr as ee}from"./format-CmXxTS5M.js";import{B as M,H as N,U as P,W as F}from"./TrayTitleSource-DN10ruw2.js";import{t as te}from"./app-window-C13qqwdi.js";import{t as I}from"./arrow-down-Def8Fl70.js";import{t as ne}from"./arrow-up-DE65OgjV.js";import{t as re}from"./check-DKfsh0bQ.js";import{t as ie}from"./ellipsis-CidyZaW2.js";import{t as ae}from"./external-link-D6jQM2CZ.js";import{t as oe}from"./plus-c3HzV6VX.js";import{t as L}from"./puzzle-Eesuewfj.js";import{t as R}from"./refresh-cw-CoLAai2c.js";import{t as se}from"./settings-2-CSrxJ7TH.js";import{t as ce}from"./shield-check-CD30JqBi.js";import{t as z}from"./trash-BHBJn5GS.js";import{B,D as V,E as H,G as U,K as W,L as le,O as ue,W as G,k as K,v as de,w as fe}from"./index-BW8keTkg.js";var q=e(t(),1),J=_(),pe=/^(?:(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*|github:[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)$/,Y={provider:`plugins.kind.provider`,middleware:`plugins.kind.middleware`,agent:`plugins.kind.agent`,pi:`plugins.kind.pi`,v2:`plugins.kind.v2`,ui:`plugins.kind.ui`,hooks:`plugins.kind.hooks`},me={provider:`neutral`,middleware:`accent`,agent:`green`,pi:`orange`,v2:`accent`,ui:`neutral`,hooks:`accent`};function X({name:e,icon:t,kind:n,size:r=32}){let i=Math.round(r*.28);return t&&/^(https:|data:image\/)/i.test(t)?(0,J.jsx)(`img`,{src:t,alt:``,width:r,height:r,className:`shrink-0 object-contain`,style:{borderRadius:i},draggable:!1}):n===`middleware`||n===`agent`?(0,J.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex shrink-0 items-center justify-center text-white`,style:{width:r,height:r,borderRadius:i,background:n===`middleware`?`#0a84ff`:`#30b0a0`},children:(0,J.jsx)(n===`middleware`?ce:te,{className:`size-[55%]`,strokeWidth:1.75})}):(0,J.jsx)(fe,{name:e,icon:t,size:r})}function he(){let{t:e}=j(),t=G(),{tab:n}=U(),r=n===`market`||n===`runtime`?n:`installed`,i=u(),a=k(),{toast:o}=F(),[s,c]=(0,q.useState)(!1),[l,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(null);return(0,J.jsxs)(de,{title:e(`nav.plugins`),subtitle:e(`plugins.subtitle`),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{icon:(0,J.jsx)(R,{className:`size-3.5`}),onClick:()=>a.mutate(void 0,{onSuccess:e=>p(e.id),onError:e=>o(P(e),`error`)}),disabled:!i.data?.plugins.length,children:e(`plugins.updateAll`)}),(0,J.jsx)(h,{variant:`primary`,icon:(0,J.jsx)(oe,{className:`size-3.5`}),onClick:()=>c(!0),children:e(`plugins.add`)})]}),children:[(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[1100px] flex-col`,children:[i.data?.off&&(0,J.jsx)(y,{className:`mb-4`,tone:`warning`,title:e(`plugins.off`),children:e(`plugins.offDetail`)}),(0,J.jsxs)(H,{value:r,onValueChange:e=>t(e===`installed`?`/plugins`:`/plugins/${e}`,{replace:!0}),children:[(0,J.jsxs)(ue,{"aria-label":e(`nav.plugins`),children:[(0,J.jsxs)(K,{value:`installed`,children:[e(`plugins.tab.installed`),i.data&&i.data.plugins.length>0&&(0,J.jsx)(`span`,{className:`ml-1.5 tabular-nums opacity-60`,children:i.data.plugins.length})]}),(0,J.jsx)(K,{value:`market`,children:e(`plugins.tab.market`)}),(0,J.jsx)(K,{value:`runtime`,children:e(`plugins.tab.runtime`)})]}),(0,J.jsxs)(V,{value:`installed`,className:`pt-1`,children:[i.isLoading&&(0,J.jsx)(x,{lines:4}),i.isError&&(0,J.jsx)(y,{tone:`danger`,title:e(`common.error`),children:P(i.error)}),(0,J.jsx)(`div`,{className:`mb-4`,children:(0,J.jsx)(le,{onJob:p})}),i.data&&(0,J.jsx)(ge,{plugins:i.data.plugins.filter(e=>!e.kinds.includes(`v2`)),preferences:i.data.preferences,onJob:p,onBrowse:()=>t(`/plugins/market`),onImport:()=>d(!0)})]}),(0,J.jsx)(V,{value:`market`,className:`pt-1`,children:(0,J.jsx)(xe,{installed:i.data?.plugins??[],onJob:p})}),(0,J.jsx)(V,{value:`runtime`,className:`pt-1`,children:(0,J.jsx)(Se,{onJob:p})})]})]}),(0,J.jsx)(ve,{open:s,onOpenChange:c,onJob:p}),(0,J.jsx)(ye,{open:l,onOpenChange:d,onJob:p}),(0,J.jsx)(be,{id:f,onClose:()=>p(null)})]})}function ge({plugins:e,preferences:t,onJob:n,onBrowse:r,onImport:a}){let{t:o}=j(),s=f(e.some(e=>e.kinds.includes(`provider`)||e.kinds.includes(`pi`))),c=i(),l=b(),{toast:u}=F(),d=!!(c.data?.found&&c.data.plugins.some(e=>!e.installed))&&(0,J.jsxs)(`div`,{className:`card flex flex-wrap items-center gap-3 p-4`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:o(`plugins.magpie.banner`,{count:c.data.plugins.filter(e=>!e.installed).length})}),(0,J.jsx)(h,{size:`sm`,icon:(0,J.jsx)(B,{className:`size-3.5`}),onClick:a,children:o(`plugins.magpie.import`)})]});if(e.length===0)return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d,(0,J.jsx)(`div`,{className:`card p-6`,children:(0,J.jsx)(p,{icon:(0,J.jsx)(L,{className:`size-6`}),title:o(`plugins.empty`),detail:o(`plugins.emptyDetail`),action:(0,J.jsx)(h,{variant:`primary`,onClick:r,children:o(`plugins.browseMarket`)})})})]});let m=(t,n)=>{let r=e.map(e=>e.spec),[i]=r.splice(t,1);r.splice(t+n,0,i),l.mutate(r,{onError:e=>u(P(e),`error`)})};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d,(0,J.jsx)(`div`,{className:`card divide-y divide-[var(--border-subtle)] p-0`,children:e.map((r,i)=>(0,J.jsx)(_e,{plugin:r,host:s.data,preferences:t,onJob:n,onUp:i>0?()=>m(i,-1):void 0,onDown:i<e.length-1?()=>m(i,1):void 0},r.spec))}),e.some(e=>e.middleware)&&(0,J.jsx)(`p`,{className:`px-1 text-[12px] text-[var(--text-muted)]`,children:o(`plugins.orderHint`)})]})}function _e({plugin:e,host:t,preferences:n,onJob:i,onUp:o,onDown:s}){let{t:c}=j(),l=G(),{toast:u,confirm:d}=F(),f=D(),p=k(),m=r(),g=C(),[_,v]=(0,q.useState)(!1),b=t?.plugins.find(t=>t.spec===e.spec),x=e.middleware,w=e.kinds[0]??`provider`,E=async()=>{await d({title:c(`plugins.removeConfirm`,{name:e.shortName}),detail:c(`plugins.removeDetail`),confirmLabel:c(`common.delete`),destructive:!0})&&m.mutate(e.spec,{onSuccess:e=>i(e.id),onError:e=>u(P(e),`error`)})},O=[];return x&&!x.error&&O.push((0,J.jsxs)(Z,{label:c(`plugins.kind.middleware`),children:[c(`plugins.mw.stats`,{hooks:x.hooks.join(`, `),calls:x.calls,micros:x.avgMicros.toFixed(1),failures:x.failures}),x.lastError&&(0,J.jsx)(`span`,{className:`block text-[var(--danger)]`,children:c(`plugins.mw.lastError`,{error:x.lastError})})]},`mw`)),e.notice===`hooks-unsupported`&&O.push((0,J.jsx)(Z,{label:c(`plugins.kind.hooks`),children:c(`plugins.hooksUnsupported`)},`notice`)),e.agent?.kind&&O.push((0,J.jsx)(Z,{label:c(`plugins.kind.agent`),children:(0,J.jsx)(`button`,{type:`button`,className:`text-[var(--accent)] underline-offset-2 hover:underline`,onClick:()=>l(`/clients/${e.agent.kind}`),children:c(`plugins.agent.adds`,{name:e.agent.name??e.agent.id??``})})},`agent`)),b&&b.provides.length>0&&O.push((0,J.jsxs)(Z,{label:c(`plugins.kind.provider`),children:[(0,J.jsx)(`span`,{children:c(`plugins.provides`,{providers:b.provides.join(`, `)})}),(0,J.jsx)(`button`,{type:`button`,className:`ml-2 text-[var(--accent)] underline-offset-2 hover:underline`,onClick:()=>l(`/providers`),children:c(`plugins.openProviders`)}),Object.entries(b.servedBy).map(([t,n])=>(0,J.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[var(--warning)]`,children:[c(`plugins.servedBy`,{provider:t,other:n}),(0,J.jsx)(h,{size:`sm`,onClick:()=>g.mutate({spec:e.spec,provider:t},{onError:e=>u(P(e),`error`)}),children:c(`plugins.useFor`,{provider:t})})]},t)),b.provides.some(t=>n[t]===e.spec)&&(0,J.jsx)(`span`,{className:`block text-[var(--text-muted)]`,children:c(`plugins.picked`)})]},`provides`)),(0,J.jsxs)(`article`,{className:T(`flex gap-3 px-4 py-3.5`,!e.enabled&&`opacity-70`),children:[(0,J.jsx)(`div`,{className:T(`pt-0.5`,!e.enabled&&`grayscale`),children:(0,J.jsx)(X,{name:e.shortName,icon:e.icon,kind:w})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-56 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:e.shortName}),e.version&&(0,J.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--text-muted)]`,children:[`v`,e.version]}),e.kinds.map(e=>(0,J.jsx)(a,{tone:me[e],children:c(Y[e])},e)),e.isPath&&(0,J.jsx)(a,{tone:`orange`,children:c(`plugins.local`)})]}),(0,J.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--text-muted)]`,title:e.spec,children:e.spec})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[x&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{size:`sm`,variant:`plain`,"aria-label":c(`plugins.moveUp`),title:c(`plugins.moveUp`),disabled:!o,onClick:o,icon:(0,J.jsx)(ne,{className:`size-3.5`})}),(0,J.jsx)(h,{size:`sm`,variant:`plain`,"aria-label":c(`plugins.moveDown`),title:c(`plugins.moveDown`),disabled:!s,onClick:s,icon:(0,J.jsx)(I,{className:`size-3.5`})})]}),(0,J.jsx)(S,{checked:e.enabled,label:c(`plugins.enabled`),onChange:t=>f.mutate({spec:e.spec,enabled:t},{onError:e=>u(P(e),`error`)})}),(0,J.jsx)(M,{label:c(`common.more`),iconOnly:!0,icon:(0,J.jsx)(ie,{className:`size-4`}),items:[{id:`options`,label:c(`plugins.options`),icon:(0,J.jsx)(se,{className:`size-3.5`}),onSelect:()=>v(!0)},...e.isPath?[]:[{id:`update`,label:c(`plugins.update`),icon:(0,J.jsx)(R,{className:`size-3.5`}),onSelect:()=>p.mutate(e.spec,{onSuccess:e=>i(e.id),onError:e=>u(P(e),`error`)})}],{id:`remove`,label:c(`common.delete`),icon:(0,J.jsx)(z,{className:`size-3.5`}),destructive:!0,separatorBefore:!0,onSelect:()=>void E()}]})]})]}),e.error&&(0,J.jsx)(y,{tone:`danger`,title:c(`plugins.cantLoad`),children:e.error}),b?.error&&(0,J.jsx)(y,{tone:`danger`,title:c(`plugins.hostCantLoad`),children:b.error}),x?.error&&(0,J.jsx)(y,{tone:`danger`,title:c(`plugins.cantLoad`),children:c(`plugins.mw.error`,{error:x.error})}),e.agent?.error&&(0,J.jsx)(y,{tone:`danger`,title:c(`plugins.cantLoad`),children:c(`plugins.agent.error`,{error:e.agent.error})}),O.length>0&&(0,J.jsx)(`div`,{className:`flex flex-col gap-1.5 rounded-lg bg-[var(--surface-muted)] px-3 py-2`,children:O})]}),(0,J.jsx)(Q,{plugin:e,open:_,onOpenChange:v})]})}function Z({label:e,children:t}){return(0,J.jsxs)(`div`,{className:`flex gap-3 text-[12px]`,children:[(0,J.jsx)(`span`,{className:`w-14 shrink-0 text-[var(--text-muted)]`,children:e}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1 text-[var(--text-secondary)]`,children:t})]})}function Q({plugin:e,open:t,onOpenChange:n}){let{t:r}=j(),{toast:i}=F(),a=D(),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(null);(0,q.useEffect)(()=>{t&&(c(JSON.stringify(e.options??e.optionsExample??{},null,2)),u(null))},[t,e.options,e.optionsExample]);let d=t=>a.mutate({spec:e.spec,options:t},{onSuccess:()=>(i(r(`plugins.optionsSaved`)),n(!1)),onError:e=>i(P(e),`error`)});return(0,J.jsxs)(N,{open:t,onOpenChange:n,title:r(`plugins.optionsTitle`,{name:e.shortName}),description:e.options?void 0:e.optionsExample?r(`plugins.optionsExample`):r(`plugins.optionsNone`),width:560,footer:(0,J.jsxs)(J.Fragment,{children:[e.options&&(0,J.jsx)(h,{onClick:()=>d(null),children:r(`plugins.optionsClear`)}),(0,J.jsx)(h,{variant:`primary`,onClick:()=>{try{let e=JSON.parse(s||`{}`);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(r(`plugins.optionsObject`));d(e)}catch(e){u(e instanceof Error?e.message:String(e))}},disabled:a.isPending,children:r(`common.save`)})]}),children:[(0,J.jsx)(o,{mono:!0,rows:14,value:s,invalid:!!l,onChange:e=>(c(e.target.value),u(null)),label:r(`plugins.options`)}),l&&(0,J.jsx)(`p`,{className:`mt-2 text-[12px] text-[var(--danger)]`,children:l})]})}function ve({open:e,onOpenChange:t,onJob:n}){let{t:r}=j(),{toast:i}=F(),a=m(),[o,s]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e&&s(``)},[e]),(0,J.jsxs)(N,{open:e,onOpenChange:t,title:r(`plugins.addTitle`),description:r(`plugins.addDetail`),footer:(0,J.jsx)(h,{variant:`primary`,disabled:!o.trim()||a.isPending,onClick:()=>a.mutate({spec:o.trim()},{onSuccess:e=>(n(e.id),t(!1)),onError:e=>i(P(e),`error`)}),children:r(`plugins.install`)}),children:[(0,J.jsx)(g,{label:r(`plugins.spec`),hint:r(`plugins.specHint`),children:(0,J.jsx)(l,{mono:!0,value:o,onChange:e=>s(e.target.value),placeholder:`@astragate-community/middleware-word-guard`,autoFocus:!0})}),(0,J.jsx)(y,{tone:`warning`,title:r(`plugins.trustTitle`),className:`mt-4`,children:r(`plugins.trustDetail`)})]})}function ye({open:e,onOpenChange:t,onJob:n}){let{t:r}=j(),{toast:o}=F(),s=i(e),c=w(),[l,u]=(0,q.useState)(!1),d=s.data;return(0,J.jsxs)(N,{open:e,onOpenChange:t,title:r(`plugins.magpie.title`),description:d?.path,width:560,footer:(0,J.jsx)(h,{variant:`primary`,disabled:!d?.found||c.isPending,onClick:()=>c.mutate(l,{onSuccess:e=>(n(e.id),t(!1)),onError:e=>o(P(e),`error`)}),children:r(`plugins.magpie.import`)}),children:[s.isLoading&&(0,J.jsx)(x,{lines:3}),d?.error&&(0,J.jsx)(y,{tone:`danger`,title:r(`common.error`),children:d.error}),d&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(`div`,{className:`card divide-y divide-[var(--border-subtle)] p-0`,children:d.plugins.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[12px]`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.spec}),e.off&&(0,J.jsx)(a,{children:r(`plugins.magpie.off`)}),e.hasOptions&&(0,J.jsx)(a,{tone:`accent`,children:r(`plugins.options`)}),e.installed&&(0,J.jsx)(a,{tone:`green`,children:r(`plugins.installed`)})]},e.spec))}),d.signIns>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(S,{checked:l,onChange:u,label:r(`plugins.magpie.signIns`,{count:d.signIns})}),(0,J.jsx)(`p`,{className:`text-[12px] text-[var(--text-secondary)]`,children:r(`plugins.magpie.signInsDetail`)})]})]})]})}function be({id:e,onClose:t}){let{t:n}=j(),r=v(e).data;return(0,J.jsxs)(N,{open:!!e,onOpenChange:e=>!e&&t(),title:n(`plugins.job.title`),description:r?n(r.state===`running`?`plugins.job.running`:r.state===`succeeded`?`plugins.job.done`:`plugins.job.failed`,{target:r.target}):void 0,width:620,footer:(0,J.jsx)(h,{onClick:t,children:n(`common.close`)}),children:[!r&&(0,J.jsx)(x,{lines:3}),r&&(0,J.jsx)(O,{language:`text`,children:r.log.length?r.log.join(`
2
- `):`…`}),r?.state===`failed`&&r.error&&(0,J.jsx)(y,{tone:`danger`,title:n(`plugins.job.failedTitle`),className:`mt-3`,children:r.error})]})}function xe({installed:e,onJob:t}){let{t:r,locale:i}=j(),{toast:a,confirm:o}=F(),l=ee(),u=m(),[d,f]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(`all`);(0,q.useEffect)(()=>{let e=setTimeout(()=>g(d.trim()),400);return()=>clearTimeout(e)},[d]);let b=c(h),S=(0,q.useMemo)(()=>new Set(e.map(e=>e.name)),[e]),C=(t,n)=>S.has(n)||e.some(e=>e.spec===t),w=async(e,n)=>{await o({title:r(`plugins.installConfirm`,{name:e}),detail:r(`plugins.trustDetail`),confirmLabel:r(`plugins.install`)})&&u.mutate({spec:e,source:n},{onSuccess:e=>t(e.id),onError:e=>a(P(e),`error`)})},[T,E]=W(),D=T.get(`install`),O=(0,q.useRef)(null);(0,q.useEffect)(()=>{D&&O.current!==D&&(O.current=D,E({},{replace:!0}),pe.test(D)?w(D,`market`):a(r(`plugins.linkInvalid`),`error`))},[D]);let k=(l.data??[]).filter(e=>_===`all`||e.kind===_),A=e=>(l.data??[]).filter(t=>e===`all`||t.kind===e).length,M=h.length>=2;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(n,{className:`min-w-[220px] flex-1`,value:d,onChange:f,placeholder:r(`plugins.searchPlaceholder`)}),!M&&(0,J.jsx)(s,{ariaLabel:r(`plugins.kindFilter`),value:_,onChange:v,items:[`all`,`provider`,`middleware`,`agent`].map(e=>({value:e,label:`${r(e===`all`?`plugins.kind.all`:Y[e])} ${A(e)}`}))})]}),M?(0,J.jsxs)(J.Fragment,{children:[b.isLoading&&(0,J.jsx)(x,{lines:3}),b.data?.length===0&&(0,J.jsx)(`div`,{className:`card p-6`,children:(0,J.jsx)(p,{icon:(0,J.jsx)(L,{className:`size-6`}),title:r(`plugins.noResults`)})}),b.data&&b.data.length>0&&(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:b.data.map(e=>(0,J.jsx)($,{title:e.name,subtitle:e.spec,icon:(0,J.jsx)(X,{name:e.name,kind:e.kind}),detail:e.description??void 0,tags:[r(Y[e.kind]),e.source===`github`?`★ ${e.stars}`:e.version?`v${e.version}`:``,e.source===`astra`?r(`plugins.origin.astra`):``],installed:C(e.spec,e.name),onInstall:()=>void w(e.spec,e.source===`github`?`github`:e.source===`astra`?`market`:`npm`)},e.spec))}),(0,J.jsx)(`p`,{className:`px-1 text-[12px] text-[var(--text-muted)]`,children:r(`plugins.searchNote`)})]}):(0,J.jsxs)(J.Fragment,{children:[l.isLoading&&(0,J.jsx)(x,{lines:4}),l.isError&&(0,J.jsx)(y,{tone:`danger`,title:r(`common.error`),children:P(l.error)}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:k.map(e=>(0,J.jsx)($,{title:e.name,subtitle:e.package,icon:(0,J.jsx)(X,{name:e.name,icon:e.icon,kind:e.kind}),detail:e.summary[i]??e.summary.en??e.description??void 0,tags:[r(Y[e.kind]),e.latest?`v${e.latest}`:``,e.origin===`astra`?r(`plugins.origin.astra`):``,e.minAstraVersion?r(`plugins.minVersion`,{version:e.minAstraVersion}):``].filter(Boolean),installed:C(e.package,e.package),onInstall:()=>void w(e.package,`market`)},e.package))}),(0,J.jsx)(`p`,{className:`px-1 text-[12px] text-[var(--text-muted)]`,children:r(`plugins.marketNote`)})]})]})}function $({title:e,subtitle:t,icon:n,detail:r,tags:i,installed:o,onInstall:s}){let{t:c}=j();return(0,J.jsxs)(`div`,{className:`card flex flex-col gap-3 p-4 transition-colors hover:border-[var(--border)]`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[n,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e,children:e}),(0,J.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--text-muted)]`,title:t,children:t})]})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 min-h-[2lh] text-[12px] leading-relaxed text-[var(--text-secondary)]`,children:r??``}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-center gap-1.5`,children:[i.filter(Boolean).map(e=>(0,J.jsx)(a,{children:e},e)),(0,J.jsx)(`span`,{className:`flex-1`}),o?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-[var(--success)]`,children:[(0,J.jsx)(re,{className:`size-3.5`}),c(`plugins.installed`)]}):(0,J.jsx)(h,{size:`sm`,variant:`primary`,onClick:s,children:c(`plugins.install`)})]})]})}function Se({onJob:e}){let{t,locale:n}=j(),{toast:r}=F(),i=u(),o=f(),s=E(),c=i.data?.runtime;return(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,J.jsxs)(`section`,{className:`card flex flex-col gap-3 p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`flex-1 text-[14px] font-medium`,children:`Bun`}),c&&(0,J.jsx)(a,{tone:c.path?`green`:`neutral`,children:c.path?t(`plugins.bunReady`):t(`plugins.bunMissing`)})]}),(0,J.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--text-secondary)]`,children:t(`plugins.bunDetail`)}),c&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c.path&&(0,J.jsx)(d,{label:t(`plugins.bunPath`),mono:!0,children:c.path}),c.version&&(0,J.jsx)(d,{label:t(`plugins.bunVersion`),mono:!0,children:c.version}),(0,J.jsx)(d,{label:t(`plugins.bunTarget`),mono:!0,children:c.target??t(`plugins.bunNoBuild`)})]}),c?.error&&(0,J.jsx)(y,{tone:`danger`,title:t(`plugins.bunFailed`),children:c.error}),c&&!c.path&&(0,J.jsx)(`div`,{children:(0,J.jsx)(h,{variant:`primary`,disabled:c.downloading||s.isPending||!c.target,onClick:()=>s.mutate(void 0,{onSuccess:t=>e(t.id),onError:e=>r(P(e),`error`)}),children:c.downloading?t(`plugins.bunDownloading`):t(`plugins.bunDownload`,{version:c.version??``})})})]}),(0,J.jsxs)(`section`,{className:`card flex flex-col gap-3 p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`flex-1 text-[14px] font-medium`,children:t(`plugins.host`)}),o.data&&(0,J.jsx)(a,{tone:o.data.running?`green`:`neutral`,children:o.data.running?t(`plugins.hostRunning`):t(`plugins.hostStopped`)})]}),(0,J.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--text-secondary)]`,children:t(`plugins.hostDetail`)}),o.data?.startError&&(0,J.jsx)(y,{tone:`danger`,title:t(`plugins.hostStartFailed`),children:o.data.startError}),o.data?.goneReason&&(0,J.jsx)(y,{tone:`warning`,title:t(`plugins.hostGone`),children:o.data.goneReason}),o.data&&o.data.plugins.length>0&&(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.data.plugins.map(e=>(0,J.jsx)(d,{label:e.spec,mono:!0,children:e.error?t(`plugins.hostPluginError`,{error:e.error}):e.provides.join(`, `)||`—`},e.spec))}),o.data?.recent&&o.data.recent.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-[var(--border-subtle)] pt-3`,children:[(0,J.jsx)(`h4`,{className:`text-[12px] font-medium text-[var(--text-secondary)]`,children:t(`plugins.hostRecent`)}),o.data.recent.map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-start gap-2 text-[12px]`,children:[(0,J.jsx)(a,{tone:e.variant===`error`?`red`:e.variant===`warning`?`orange`:e.variant===`success`?`green`:`neutral`,children:A(e.at,n)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[e.title&&(0,J.jsxs)(`span`,{className:`font-medium`,children:[e.title,` `]}),e.message]})]},t))]})]}),(0,J.jsxs)(`a`,{className:`flex items-center gap-1 px-1 text-[12px] text-[var(--text-muted)] hover:text-[var(--accent)] lg:col-span-2`,href:`https://github.com/astragate-community/astra-gate-plugins`,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(ae,{className:`size-3`}),` astragate-community/astra-gate-plugins`]})]})}export{he as PluginsPage};