nextclaw 0.17.3 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/ui-dist/assets/{ChannelsList-uKmkpD25.js → ChannelsList-DZWam3Ob.js} +1 -1
- package/ui-dist/assets/{ChatPage-CslhBPfT.js → ChatPage-YBL7iJ1X.js} +27 -27
- package/ui-dist/assets/{MarketplacePage-DE0QjYVv.js → MarketplacePage-2tWWgwAb.js} +1 -1
- package/ui-dist/assets/MarketplacePage-BorWJftJ.js +1 -0
- package/ui-dist/assets/{McpMarketplacePage-CeLvv1xy.js → McpMarketplacePage-N-fB4HID.js} +1 -1
- package/ui-dist/assets/{ModelConfig-D1JtGtQv.js → ModelConfig-DvsBTUiE.js} +1 -1
- package/ui-dist/assets/{ProviderScopedModelInput-SAJH6nkC.js → ProviderScopedModelInput-D9woCARc.js} +1 -1
- package/ui-dist/assets/{ProvidersList-1rKi3aQT.js → ProvidersList-D-qPGgC4.js} +1 -1
- package/ui-dist/assets/{RemoteAccessPage-bIAKxDky.js → RemoteAccessPage-COnjm8_x.js} +1 -1
- package/ui-dist/assets/{RuntimeConfig-BTk9319O.js → RuntimeConfig-BHpqcaHm.js} +1 -1
- package/ui-dist/assets/{SearchConfig-EjeszXbv.js → SearchConfig-DIT6M65Q.js} +1 -1
- package/ui-dist/assets/{SecretsConfig-cnAXvREZ.js → SecretsConfig-Cefg1LFJ.js} +1 -1
- package/ui-dist/assets/{SessionsConfig-BIXiDaK2.js → SessionsConfig-BZnmVTIu.js} +1 -1
- package/ui-dist/assets/{index-8XNPYwJu.js → index-DHmCjcxq.js} +2 -2
- package/ui-dist/assets/{security-config-CGazBahs.js → security-config-DEgOD4VX.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-D6HxybcM.js → useConfirmDialog-CuQqiPx7.js} +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/assets/MarketplacePage-BZQW70ti.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-DQjtSsY3.js","assets/DocBrowser-C7-1sXqo.js","assets/i18n-hM3v-3YG.js","assets/createLucideIcon-C7MmdIX3.js","assets/book-open-DvWqOode.js","assets/external-link-U86Acd1t.js","assets/plus-CrkO1kob.js","assets/search-EX-Papzl.js","assets/x-B4sxJkGY.js","assets/DocBrowserContext-DN5tjUoS.js","assets/ModelConfig-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-DQjtSsY3.js","assets/DocBrowser-C7-1sXqo.js","assets/i18n-hM3v-3YG.js","assets/createLucideIcon-C7MmdIX3.js","assets/book-open-DvWqOode.js","assets/external-link-U86Acd1t.js","assets/plus-CrkO1kob.js","assets/search-EX-Papzl.js","assets/x-B4sxJkGY.js","assets/DocBrowserContext-DN5tjUoS.js","assets/ModelConfig-DvsBTUiE.js","assets/dist-RWNFhxvR.js","assets/ProviderScopedModelInput-D9woCARc.js","assets/select-DF-AUoie.js","assets/loader-circle-C8cpaL0w.js","assets/page-layout-Z1klaUFW.js","assets/label-CHJ1ATds.js","assets/skeleton-B0mmt1vo.js","assets/config-hints-WtpHP_DW.js","assets/ChatPage-YBL7iJ1X.js","assets/chunk-JZWAC4HX-CxfKRD7X.js","assets/popover-xWbqMnIN.js","assets/dist-B6VMuIQN.js","assets/MarketplacePage-2tWWgwAb.js","assets/useMutation-DBTWPbTg.js","assets/marketplace-localization-CxSTG9wr.js","assets/useConfirmDialog-CuQqiPx7.js","assets/tabs-custom-CLksZ2bO.js","assets/react-3YE87-lE.js","assets/logos-U1_qDA3U.js","assets/refresh-ccw-JQh1lwq-.js","assets/chat-session-display-D4bYa0b8.js","assets/trash-2-VV8jvziy.js","assets/config-BeGwf2Ao.js","assets/LogoBadge-DDS1sU_U.js","assets/SearchConfig-DIT6M65Q.js","assets/config-layout-LQ10ozRC.js","assets/ProvidersList-D-qPGgC4.js","assets/status-dot-Bq_8Ojvv.js","assets/switch-D7JF_RZ-.js","assets/ChannelsList-DZWam3Ob.js","assets/hash-D-OVfV3Z.js","assets/RuntimeConfig-BHpqcaHm.js","assets/save-4VRlzkii.js","assets/security-config-DEgOD4VX.js","assets/SessionsConfig-BZnmVTIu.js","assets/SecretsConfig-Cefg1LFJ.js","assets/RemoteAccessPage-COnjm8_x.js","assets/MarketplacePage-BorWJftJ.js","assets/McpMarketplacePage-N-fB4HID.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{_ as e,a as t,c as n,h as r,i,l as a,m as o,n as s,o as c,p as l,s as u,u as d}from"./i18n-hM3v-3YG.js";import{N as ee,c as f,i as te,l as ne,n as p,o as m,r as h,t as re,u as g}from"./dist-RWNFhxvR.js";import{a as _,i as v,l as y,n as ie,o as ae,r as b,t as oe}from"./chunk-JZWAC4HX-CxfKRD7X.js";import{n as x,t as S}from"./react-3YE87-lE.js";import{t as C}from"./useMutation-DBTWPbTg.js";import{A as se,B as w,F as ce,G as T,H as le,I as E,L as ue,M as de,N as fe,P as pe,U as me,W as D,i as he,j as ge,n as _e,r as ve,t as ye,z as be}from"./select-DF-AUoie.js";import{t as O}from"./dist-B6VMuIQN.js";import{t as k}from"./createLucideIcon-C7MmdIX3.js";import{n as xe}from"./DocBrowser-C7-1sXqo.js";import{t as Se}from"./book-open-DvWqOode.js";import{t as Ce}from"./search-EX-Papzl.js";import{t as we}from"./x-B4sxJkGY.js";import{C as Te,D as Ee,E as De,O as Oe,S as ke,T as Ae,_ as je,a as Me,b as Ne,c as Pe,f as Fe,g as Ie,h as Le,i as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as Ge,t as Ke,u as qe,v as Je,w as Ye,x as Xe,y as Ze}from"./config-BeGwf2Ao.js";import{i as Qe,n as $e,r as et}from"./DocBrowserContext-DN5tjUoS.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var tt=r((e=>{var t=ee();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),A=e(o(),1),j=l(),M=`Dialog`,[nt,rt]=me(M),[it,N]=nt(M),at=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=A.useRef(null),c=A.useRef(null),[l,u]=be({prop:r,defaultProp:i??!1,onChange:a,caller:M});return(0,j.jsx)(it,{scope:t,triggerRef:s,contentRef:c,contentId:w(),titleId:w(),descriptionId:w(),open:l,onOpenChange:u,onOpenToggle:A.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};at.displayName=M;var ot=`DialogTrigger`,st=A.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=N(ot,n),a=D(t,i.triggerRef);return(0,j.jsx)(E.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":wt(i.open),...r,ref:a,onClick:T(e.onClick,i.onOpenToggle)})});st.displayName=ot;var P=`DialogPortal`,[ct,lt]=nt(P,{forceMount:void 0}),ut=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=N(P,t);return(0,j.jsx)(ct,{scope:t,forceMount:n,children:A.Children.map(r,e=>(0,j.jsx)(O,{present:n||a.open,children:(0,j.jsx)(fe,{asChild:!0,container:i,children:e})}))})};ut.displayName=P;var F=`DialogOverlay`,dt=A.forwardRef((e,t)=>{let n=lt(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=N(F,e.__scopeDialog);return a.modal?(0,j.jsx)(O,{present:r||a.open,children:(0,j.jsx)(pt,{...i,ref:t})}):null});dt.displayName=F;var ft=ue(`DialogOverlay.RemoveScroll`),pt=A.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=N(F,n);return(0,j.jsx)(ge,{as:ft,allowPinchZoom:!0,shards:[i.contentRef],children:(0,j.jsx)(E.div,{"data-state":wt(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),I=`DialogContent`,mt=A.forwardRef((e,t)=>{let n=lt(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=N(I,e.__scopeDialog);return(0,j.jsx)(O,{present:r||a.open,children:a.modal?(0,j.jsx)(ht,{...i,ref:t}):(0,j.jsx)(gt,{...i,ref:t})})});mt.displayName=I;var ht=A.forwardRef((e,t)=>{let n=N(I,e.__scopeDialog),r=A.useRef(null),i=D(t,n.contentRef,r);return A.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,j.jsx)(_t,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:T(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:T(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:T(e.onFocusOutside,e=>e.preventDefault())})}),gt=A.forwardRef((e,t)=>{let n=N(I,e.__scopeDialog),r=A.useRef(!1),i=A.useRef(!1);return(0,j.jsx)(_t,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),_t=A.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=N(I,n),c=A.useRef(null),l=D(t,c);return de(),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(pe,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,j.jsx)(ce,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":wt(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ot,{titleId:s.titleId}),(0,j.jsx)(At,{contentRef:c,descriptionId:s.descriptionId})]})]})}),vt=`DialogTitle`,yt=A.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=N(vt,n);return(0,j.jsx)(E.h2,{id:i.titleId,...r,ref:t})});yt.displayName=vt;var bt=`DialogDescription`,xt=A.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=N(bt,n);return(0,j.jsx)(E.p,{id:i.descriptionId,...r,ref:t})});xt.displayName=bt;var St=`DialogClose`,Ct=A.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=N(St,n);return(0,j.jsx)(E.button,{type:`button`,...r,ref:t,onClick:T(e.onClick,()=>i.onOpenChange(!1))})});Ct.displayName=St;function wt(e){return e?`open`:`closed`}var Tt=`DialogTitleWarning`,[Et,Dt]=le(Tt,{contentName:I,titleName:vt,docsSlug:`dialog`}),Ot=({titleId:e})=>{let t=Dt(Tt),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
3
3
|
|
|
4
4
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
5
5
|
|
|
6
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return A.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kt=`DialogDescriptionWarning`,At=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Dt(kt).contentName}}.`;return A.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},jt=at,Mt=ut,Nt=dt,Pt=mt,Ft=yt,It=xt,Lt=Ct,Rt=k(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),zt=k(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Bt=k(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),Vt=k(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Ht=k(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Ut=k(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),L=k(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Wt=k(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Gt=k(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),Kt=k(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),qt=k(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Jt=k(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Yt=k(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Xt=k(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Zt=k(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Qt=k(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),$t=k(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),en=k(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),tn=k(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),nn=jt,rn=Mt,an=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(Nt,{ref:n,className:d(`fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));an.displayName=Nt.displayName;var R=A.forwardRef(({className:e,children:t,...n},r)=>(0,j.jsxs)(rn,{children:[(0,j.jsx)(an,{}),(0,j.jsxs)(Pt,{ref:r,className:d(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-2xl`,e),...n,children:[t,(0,j.jsxs)(Lt,{className:`absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none`,children:[(0,j.jsx)(we,{className:`h-4 w-4 text-gray-500`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));R.displayName=Pt.displayName;var on=({className:e,...t})=>(0,j.jsx)(`div`,{className:d(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});on.displayName=`DialogHeader`;var sn=({className:e,...t})=>(0,j.jsx)(`div`,{className:d(`flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3`,e),...t});sn.displayName=`DialogFooter`;var cn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(Ft,{ref:n,className:d(`text-lg font-semibold leading-tight tracking-tight text-gray-900`,e),...t}));cn.displayName=Ft.displayName;var ln=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(It,{ref:n,className:d(`text-sm text-gray-500 leading-relaxed`,e),...t}));ln.displayName=It.displayName;async function un(){let e=await h.get(`/api/remote/status`);if(!e.ok)throw Error(e.error.message);return e.data}async function dn(){let e=await h.get(`/api/remote/doctor`);if(!e.ok)throw Error(e.error.message);return e.data}async function fn(e){let t=await h.post(`/api/remote/auth/start`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function pn(e){let t=await h.post(`/api/remote/auth/poll`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function mn(){let e=await h.post(`/api/remote/logout`,{});if(!e.ok)throw Error(e.error.message);return e.data}async function hn(e){let t=await h.put(`/api/remote/settings`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function z(e){let t=await h.post(`/api/remote/service/${e}`,{});if(!t.ok)throw Error(t.error.message);return t.data}var gn=[`remote-status`],_n=`https://platform.nextclaw.io`,vn=`https://nextclaw-platform-console.pages.dev`,B=async()=>await x.fetchQuery({queryKey:gn,queryFn:un,staleTime:5e3}),V=async()=>(await x.invalidateQueries({queryKey:gn}),await B()),yn=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function H(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return _n;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return vn}var bn=e=>H(e?.account.apiBase)||H(e?.settings.platformApiBase)||H(e?.platformBase)||H(e?.account.platformBase)||void 0;function U(){return f({queryKey:gn,queryFn:un,staleTime:5e3,refetchOnWindowFocus:!0})}var W=S(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})})),xn=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{W.getState().openPanel()},this.closeAccountPanel=()=>{W.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),W.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await B();return t.account.loggedIn?!0:(e?.pendingAction&&W.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let t=e?.status??await B();e?.pendingAction&&W.getState().setPendingAction(e.pendingAction);let n=await fn({apiBase:yn(t,e?.apiBase)});W.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:i(`remoteBrowserAuthWaiting`)}),window.open(n.verificationUri,`_blank`,`noopener,noreferrer`)||W.getState().setAuthStatusMessage(i(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:i(`remoteBrowserAuthStartFailed`);p.error(`${i(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=()=>{let e=W.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await mn(),W.getState().clearPendingAction(),W.getState().clearBrowserAuth(),await V(),p.success(i(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:i(`remoteLogoutFailed`);p.error(`${i(`remoteLogoutFailed`)}: ${t}`)}},this.openNextClawWeb=async()=>{let e=bn(await B());if(!e){p.error(i(`remoteOpenWebUnavailable`));return}window.open(e,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=W.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=W.getState();if(e.authSessionId)try{let t=await B(),n=await pn({sessionId:e.authSessionId,apiBase:yn(t)});if(n.status===`pending`){W.getState().updateBrowserAuth({statusMessage:i(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),W.getState().clearBrowserAuth(),p.error(n.message||i(`remoteBrowserAuthExpired`));return}W.getState().setAuthStatusMessage(i(`remoteBrowserAuthCompleted`));let r=await V(),{pendingAction:a}=W.getState();this.clearPollTimer(),W.getState().clearBrowserAuth(),p.success(i(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,r),W.getState().clearPendingAction()}catch(e){this.clearPollTimer(),W.getState().clearBrowserAuth();let t=e instanceof Error?e.message:i(`remoteBrowserAuthPollFailed`);p.error(`${i(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=W.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?s(e.authExpiresAt):`-`}}}},G=S(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),Sn=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=G.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{G.getState().setEnabled(e)},this.setDeviceName=e=>{G.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{G.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{G.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await V(),n=G.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await V();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await V();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let n=t.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:i(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await z(n);let e=await V();this.hydrateDraftFromStatus(e)},successMessage:i(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await V();await this.accountManager?.startBrowserSignIn({status:t,apiBase:G.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let t=e??await V(),n=G.getState();await this.runManagedAction({actionLabel:i(`remoteActionSavingAdvanced`),job:async()=>{await hn({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await V();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?i(`remoteSettingsSaved`):i(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:i(`remoteDoctorRunning`),job:async()=>{let e=await dn();G.getState().setDoctor(e)},successMessage:i(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,i(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,i(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,i(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,t)=>{let n=G.getState();await this.runManagedAction({actionLabel:i(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await hn({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await V();this.hydrateDraftFromStatus(r),e?await z(r.service.running?`restart`:`start`):t.service.running&&await z(`restart`);let i=await V();this.hydrateDraftFromStatus(i)},successMessage:i(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await z(e),n=await V();this.hydrateDraftFromStatus(n),p.success(t.message)}})},this.hydrateDraftFromStatus=e=>{G.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{G.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&p.success(e.successMessage)}catch(e){let t=e instanceof Error?e.message:i(`error`);throw p.error(t),e}finally{G.getState().finishAction()}}}},K=new class{constructor(){this.accountManager=new xn,this.remoteAccessManager=new Sn}};K.accountManager.bindSignedInContinuation(K.remoteAccessManager.resumePendingActionAfterSignIn),K.remoteAccessManager.bindAccountManager(K.accountManager);var Cn=(0,A.createContext)(null);function wn({children:e}){return(0,j.jsx)(Cn.Provider,{value:K,children:e})}function Tn(){let e=(0,A.useContext)(Cn);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function q(e){return(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,j.jsx)(`span`,{className:`text-gray-500`,children:e.label}),(0,j.jsx)(`span`,{className:`text-right text-gray-900`,children:e.value?.trim()||`-`})]})}function En(){let e=Tn(),t=U(),n=W(e=>e.panelOpen),r=W(e=>e.authSessionId),a=W(e=>e.authVerificationUri),o=W(e=>e.authExpiresAt),c=W(e=>e.authStatusMessage),l=t.data;return(0,A.useEffect)(()=>{e.accountManager.syncRemoteStatus(l)},[e,l]),(0,j.jsx)(nn,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,j.jsxs)(R,{className:`max-w-xl`,children:[(0,j.jsxs)(on,{children:[(0,j.jsxs)(cn,{className:`flex items-center gap-2`,children:[(0,j.jsx)(L,{className:`h-5 w-5 text-primary`}),i(`accountPanelTitle`)]}),(0,j.jsx)(ln,{children:i(`accountPanelDescription`)})]}),l?.account.loggedIn?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium text-emerald-800`,children:i(`accountPanelSignedInTitle`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:i(`accountPanelSignedInDescription`)})]}),(0,j.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3`,children:[(0,j.jsx)(q,{label:i(`remoteAccountEmail`),value:l.account.email}),(0,j.jsx)(q,{label:i(`remoteAccountRole`),value:l.account.role})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,j.jsxs)(m,{onClick:()=>void e.accountManager.openNextClawWeb(),children:[(0,j.jsx)($t,{className:`mr-2 h-4 w-4`}),i(`remoteOpenDeviceList`)]}),(0,j.jsxs)(m,{variant:`outline`,onClick:()=>void e.accountManager.logout(),children:[(0,j.jsx)(Gt,{className:`mr-2 h-4 w-4`}),i(`remoteLogout`)]})]})]}):(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:i(`accountPanelSignedOutTitle`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:i(`accountPanelSignedOutDescription`)}),r?(0,j.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,j.jsx)(q,{label:i(`remoteBrowserAuthSession`),value:r}),(0,j.jsx)(q,{label:i(`remoteBrowserAuthExpiresAt`),value:o?s(o):`-`})]}):null]}),c?(0,j.jsx)(`p`,{className:`text-sm text-gray-600`,children:c}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,j.jsx)(m,{onClick:()=>void e.accountManager.startBrowserSignIn(),children:i(r?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),a?(0,j.jsx)(m,{variant:`outline`,onClick:()=>e.accountManager.resumeBrowserSignIn(),children:i(`remoteBrowserAuthResume`)}):null]})]})]})})}var Dn=A.forwardRef(({className:e,hover:t=!0,...n},r)=>(0,j.jsx)(`div`,{ref:r,className:d(`rounded-2xl border border-gray-200/50 bg-white text-card-foreground shadow-card transition-all duration-base`,t&&`hover:shadow-card-hover hover:border-gray-200`,e),...n}));Dn.displayName=`Card`;var On=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`div`,{ref:n,className:d(`flex flex-col space-y-1.5 p-6`,e),...t}));On.displayName=`CardHeader`;var kn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`h3`,{ref:n,className:d(`text-[15px] font-semibold leading-tight tracking-tight text-gray-900`,e),...t}));kn.displayName=`CardTitle`;var An=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`p`,{ref:n,className:d(`text-[13px] text-gray-400 leading-relaxed`,e),...t}));An.displayName=`CardDescription`;var jn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`div`,{ref:n,className:d(`p-6 pt-0`,e),...t}));jn.displayName=`CardContent`;var Mn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`div`,{ref:n,className:d(`flex items-center justify-between p-6 pt-0`,e),...t}));Mn.displayName=`CardFooter`;var J=A.forwardRef(({className:e,type:t,...n},r)=>(0,j.jsx)(`input`,{type:t,className:d(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));J.displayName=`Input`;var Nn=40,Pn=400;function Fn(e){if(!(e instanceof Error))return!1;let t=e.message.trim().toLowerCase();return t?t.includes(`failed to fetch`)||t.includes(`networkerror`)||t.includes(`network request failed`)||t.includes(`load failed`)||t.includes(`request timed out`)||t.includes(`timed out waiting for remote request response`)||t.includes(`remote transport connection closed`):!1}function In(e,t){return e>=Nn?!1:Fn(t)}function Ln(){let[e,t]=(0,A.useState)(!1),n=f({queryKey:[`auth-status`],queryFn:()=>He({timeoutMs:e?5e3:Pn}),staleTime:5e3,retry:In,retryDelay:250,refetchOnWindowFocus:!0});return(0,A.useEffect)(()=>{n.isSuccess&&!e&&t(!0)},[e,n.isSuccess]),n}function Y(e){return Promise.all([e.invalidateQueries({queryKey:[`auth-status`]}),e.invalidateQueries({queryKey:[`app-meta`]}),e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),e.invalidateQueries({queryKey:[`config-schema`]}),e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`session-history`]}),e.invalidateQueries({queryKey:[`chat-runs`]}),e.invalidateQueries({queryKey:[`cron-jobs`]})])}function Rn(){let e=g();return C({mutationFn:Je,onSuccess:async()=>{await Y(e),p.success(i(`authSetupSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function zn(){let e=g();return C({mutationFn:Ue,onSuccess:async()=>{await Y(e),p.success(i(`authLoginSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Bn(){let e=g();return C({mutationFn:Be,onSuccess:async()=>{await Y(e),p.success(i(`authLogoutSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Vn(){let e=g();return C({mutationFn:ke,onSuccess:async()=>{await Y(e),p.success(i(`authPasswordUpdated`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Hn(){let e=g();return C({mutationFn:Xe,onSuccess:async(t,n)=>{await Y(e),p.success(n.enabled?i(`authEnabledSuccess`):i(`authDisabledSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Un({username:e}){let t=zn(),[n,r]=(0,A.useState)(e??``),[a,o]=(0,A.useState)(``),s=n.trim().length>0&&a.length>0&&!t.isPending;return(0,j.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,j.jsxs)(Dn,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,j.jsxs)(On,{children:[(0,j.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:i(`authBrand`)}),(0,j.jsx)(kn,{className:`text-2xl`,children:i(`authLoginTitle`)}),(0,j.jsx)(An,{children:i(`authLoginDescription`)})]}),(0,j.jsx)(jn,{children:(0,j.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),s&&t.mutate({username:n.trim(),password:a})},children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:i(`authUsername`)}),(0,j.jsx)(J,{value:n,onChange:e=>r(e.target.value),placeholder:i(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:i(`authPassword`)}),(0,j.jsx)(J,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:i(`authPasswordPlaceholder`)})]}),(0,j.jsx)(m,{type:`submit`,className:`w-full`,disabled:!s,children:t.isPending?i(`authLoggingIn`):i(`authLoginAction`)})]})})]})})}var Wn=`nextclaw.ui.theme`,Gn=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],X=`warm`,Kn=!1,Z=new Set;function qn(e){return e===`warm`||e===`cool`}function Jn(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Yn(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(Wn);if(qn(e))return e}catch{}return`warm`}function Xn(){return Kn||=(X=Yn(),Jn(X),!0),X}function Zn(){return Kn?X:Xn()}function Qn(e){if(Xn(),e!==X){if(X=e,Jn(X),typeof window<`u`)try{window.localStorage.setItem(Wn,X)}catch{}Z.forEach(e=>e(X))}}function $n(e){return Z.add(e),()=>{Z.delete(e)}}function er(){let e=Qe();(0,A.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;et(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}function tr(e){return[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function nr(e,t){let n=t.updatedAt.localeCompare(e.updatedAt);return n>0?!0:n<0?!1:e.status===t.status?!0:t.status===`idle`}function rr(e,t){if(!e)return e;let n=e.sessions.findIndex(e=>e.sessionId===t.sessionId),r=tr(n>=0?e.sessions.map((e,r)=>r===n&&nr(e,t)?t:e):[...e.sessions,t]);return{...e,sessions:r,total:r.length}}function ir(e,t){if(!e)return e;let n=t.trim();if(!n)return e;let r=e.sessions.filter(e=>e.sessionId!==n);return r.length===e.sessions.length?e:{...e,sessions:r,total:r.length}}function ar(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>rr(e,t))}function or(e,t){if(!e)return e;let n=t.sessionKey.trim();if(!n)return e;let r=!1,i=e.sessions.map(e=>e.sessionId!==n||e.status===t.status?e:(r=!0,{...e,status:t.status}));return r?{...e,sessions:i}:e}function sr(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>or(e,t))}function cr(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>ir(e,t))}function lr(e,t){if(t.type===`session.run-status`){sr(e,t.payload);return}if(t.type===`session.summary.upsert`){ar(e,t.payload.summary);return}cr(e,t.payload.sessionKey)}async function ur(e){let t=new URLSearchParams;typeof e?.limit==`number`&&Number.isFinite(e.limit)&&t.set(`limit`,String(Math.max(1,Math.trunc(e.limit))));let n=t.toString(),r=await h.get(n?`/api/ncp/sessions?${n}`:`/api/ncp/sessions`);if(!r.ok)throw Error(r.error.message);return r.data}async function dr(e,t=200){let n=await h.get(`/api/ncp/sessions/${encodeURIComponent(e)}/messages?limit=${Math.max(1,Math.trunc(t))}`);if(!n.ok)throw Error(n.error.message);return n.data}async function fr(e,t){let n=new URLSearchParams,r=t?.projectRoot?.trim();r&&n.set(`projectRoot`,r);let i=n.toString(),a=await h.get(i?`/api/ncp/sessions/${encodeURIComponent(e)}/skills?${i}`:`/api/ncp/sessions/${encodeURIComponent(e)}/skills`);if(!a.ok)throw Error(a.error.message);return a.data}async function pr(e,t){let n=await h.put(`/api/ncp/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw Error(n.error.message);return n.data}async function mr(e){let t=await h.delete(`/api/ncp/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw Error(t.error.message);return t.data}function hr(){return f({queryKey:[`config`],queryFn:Ge,staleTime:3e4,refetchOnWindowFocus:!0})}function gr(){return f({queryKey:[`app-meta`],queryFn:Me,staleTime:1/0})}function _r(){return f({queryKey:[`config-meta`],queryFn:Pe,staleTime:1/0})}function vr(){return f({queryKey:[`config-schema`],queryFn:ze,staleTime:1/0})}function yr(){let e=g();return C({mutationFn:Ye,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function br(){let e=g();return C({mutationFn:({data:e})=>Ee(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function xr(){let e=g();return C({mutationFn:({provider:e,data:t})=>Ae(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Sr(){let e=g();return C({mutationFn:({data:e})=>Ke(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Cr(){let e=g();return C({mutationFn:({provider:e})=>We(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function wr(){return C({mutationFn:({provider:e,data:t})=>Ne(e,t)})}function Tr(){return C({mutationFn:({provider:e,data:t})=>Ze(e,t)})}function Er(){return C({mutationFn:({provider:e,data:t})=>Le(e,t)})}function Dr(){return C({mutationFn:({provider:e})=>Fe(e)})}function Or(){let e=g();return C({mutationFn:({channel:e,data:t})=>Te(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function kr(){let e=g();return C({mutationFn:({data:e})=>De(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Ar(){let e=g();return C({mutationFn:({data:e})=>Oe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function jr(){return C({mutationFn:({actionId:e,data:t})=>Re(e,t),onError:e=>{p.error(i(`error`)+`: `+e.message)}})}function Mr(e){return f({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>ur(e),staleTime:5e3,retry:!1})}function Nr(e,t=200){return f({queryKey:[`ncp-session-messages`,e,t],queryFn:()=>dr(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Pr(e){return f({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>fr(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Fr(){let e=g();return C({mutationFn:({sessionId:e})=>mr(e),onSuccess:(t,n)=>{cr(e,n.sessionId),e.removeQueries({queryKey:[`ncp-session-messages`,n.sessionId]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Ir(){let e=g();return C({mutationFn:({sessionId:e,data:t})=>pr(e,t),onSuccess:t=>{ar(e,t),e.invalidateQueries({queryKey:[`ncp-session-skills`,t.sessionId]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Lr(e={all:!0}){return f({queryKey:[`cron`,e],queryFn:()=>qe(e),staleTime:1e4})}function Rr(){let e=g();return C({mutationFn:({id:e})=>Ve(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function zr(){let e=g();return C({mutationFn:({id:e,enabled:t})=>je(e,{enabled:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Br(){let e=g();return C({mutationFn:({id:e,force:t})=>Ie(e,{force:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Vr({className:e,suffix:t}){let{data:n}=gr(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim();return(0,j.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,j.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,j.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,j.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,j.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),i?(0,j.jsxs)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:[`v`,i]}):null,t?(0,j.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:t}):null]})]})}var Hr={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function Ur(e){return Hr[e]}function Wr({to:e,label:t,icon:n,density:r=`default`,className:i}){let a=Ur(r);return(0,j.jsx)(ie,{to:e,className:({isActive:e})=>d(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,a.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(n,{className:d(a.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function Gr({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:a,trailing:o,trailingClassName:s,testId:c,trailingTestId:l}){let u=Ur(r);return(0,j.jsxs)(`button`,{type:`button`,onClick:n,className:d(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,u.row,i),"data-testid":c,children:[(0,j.jsx)(t,{className:d(u.icon,`shrink-0 text-gray-400`)}),(0,j.jsx)(`span`,{className:d(`min-w-0 flex-1 text-left`,a),children:e}),o?(0,j.jsx)(`span`,{className:d(`shrink-0 text-gray-500`,u.value,s),"data-testid":l,children:o}):null]})}function Kr({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:a=`default`,children:o}){let s=Ur(a);return(0,j.jsxs)(ye,{value:n,onValueChange:i,children:[(0,j.jsxs)(he,{className:d(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,s.row),children:[(0,j.jsxs)(`div`,{className:d(`flex min-w-0 items-center`,s.gap),children:[(0,j.jsx)(t,{className:d(s.icon,`text-gray-400`)}),(0,j.jsx)(`span`,{className:`text-left`,children:e})]}),(0,j.jsx)(`span`,{className:d(`ml-auto text-gray-500`,s.value),children:r})]}),(0,j.jsx)(_e,{children:o})]})}var qr=(0,A.createContext)(null);function Jr({children:e}){let[t,r]=(0,A.useState)(()=>u());(0,A.useEffect)(()=>a(e=>{r(e)}),[]);let i=(0,A.useCallback)(e=>{n(e),r(c())},[]),o=(0,A.useCallback)(()=>{i(t===`en`?`zh`:`en`)},[t,i]),s=(0,A.useMemo)(()=>({language:t,setLanguage:i,toggleLanguage:o}),[t,i,o]);return(0,j.jsx)(qr.Provider,{value:s,children:e})}function Yr(){let e=(0,A.useContext)(qr);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:i}}var Xr=(0,A.createContext)(null);function Zr({children:e}){let[t,n]=(0,A.useState)(()=>Xn());(0,A.useEffect)(()=>$n(e=>{n(e)}),[]);let r=(0,A.useCallback)(e=>{Qn(e),n(Zn())},[]),i=(0,A.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,j.jsx)(Xr.Provider,{value:i,children:e})}function Qr(){let e=(0,A.useContext)(Xr);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function $r({mode:e}){let n=Tn(),r=Qe(),a=U(),{language:o,setLanguage:s}=Yr(),{theme:c,setTheme:l}=Qr(),u=e===`settings`,ee=t.find(e=>e.value===o)?.label??o,f=i(Gn.find(e=>e.value===c)?.labelKey??`themeWarm`),te=a.data?.account.email?.trim(),ne=!!a.data?.account.loggedIn,p=e=>{o!==e&&(s(e),window.location.reload())},m=e=>{c!==e&&l(e)},h=[{target:`/chat`,label:i(`chat`),icon:Kt},{target:`/chat/cron`,label:i(`cron`),icon:Rt},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:Bt},{target:`/agents`,label:i(`agentsPageTitle`),icon:zt}],re=[{target:`/model`,label:i(`model`),icon:Vt},{target:`/providers`,label:i(`providers`),icon:Qt},{target:`/search`,label:i(`searchChannels`),icon:Ce},{target:`/channels`,label:i(`channels`),icon:qt},{target:`/runtime`,label:i(`runtime`),icon:Ht},{target:`/remote`,label:i(`remote`),icon:en},{target:`/security`,label:i(`security`),icon:Zt},{target:`/sessions`,label:i(`sessions`),icon:Ut},{target:`/secrets`,label:i(`secrets`),icon:L},{target:`/marketplace/plugins`,label:i(`marketplaceFilterPlugins`),icon:Yt},{target:`/marketplace/mcp`,label:i(`marketplaceFilterMcp`),icon:tn}],g=u?re:h,_=u?`compact`:`default`;return(0,j.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[u?(0,j.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,j.jsxs)(ie,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,j.jsx)(xe,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,j.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,j.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,j.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,j.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,j.jsx)(Vr,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,j.jsx)(`ul`,{className:d(u?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:g.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(Wr,{to:e.target,label:e.label,icon:e.icon,density:_})},e.target))})}),(0,j.jsxs)(`div`,{className:d(`shrink-0 border-t border-[#dde0ea] bg-secondary`,u?`mt-2 pt-3`:`mt-3 pt-3`),children:[u?(0,j.jsx)(Gr,{onClick:()=>n.accountManager.openAccountPanel(),icon:L,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:ne?te||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,j.jsx)(`div`,{className:`mb-2`,children:(0,j.jsx)(Wr,{to:`/settings`,label:i(`settings`),icon:Xt})}),(0,j.jsx)(`div`,{className:`mb-2`,children:(0,j.jsx)(Kr,{value:c,onValueChange:e=>m(e),icon:Jt,label:i(`theme`),valueLabel:f,density:_,children:Gn.map(e=>(0,j.jsx)(ve,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,j.jsx)(`div`,{className:`mb-2`,children:(0,j.jsx)(Kr,{value:o,onValueChange:e=>p(e),icon:Wt,label:i(`language`),valueLabel:ee,density:_,children:t.map(e=>(0,j.jsx)(ve,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,j.jsx)(Gr,{onClick:()=>r.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:Se,label:i(`docBrowserHelp`),density:_})]})]})]})}var ei=`NextClaw`,ti=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/plugins`,key:`marketplacePluginsPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/sessions`,key:`sessionsPageTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function ni(e,t){return e===t||e.startsWith(`${t}/`)}function ri(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of ti)if(ni(t,e))return i(n);return i(`settings`)}function ii(e){return`${ei} - ${ri(e)}`}var ai=(0,A.lazy)(async()=>({default:(await y(async()=>{let{DocBrowser:e}=await import(`./DocBrowser-DQjtSsY3.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function oi(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function si(e){let t=e.toLowerCase();return t===`/channels`||t.startsWith(`/channels/`)}function ci({children:e}){let{isOpen:t,mode:n}=Qe();er();let{pathname:r}=ae(),{language:i}=Yr(),a=oi(r),o=si(r);return(0,A.useEffect)(()=>{document.title=ii(r)},[r,i]),(0,j.jsxs)(`div`,{className:`h-screen flex bg-background font-sans text-foreground`,children:[!a&&(0,j.jsx)($r,{mode:`settings`}),(0,j.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,j.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:a?(0,j.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:e}):(0,j.jsx)(`main`,{className:d(`flex-1 custom-scrollbar p-8`,o?`overflow-auto xl:overflow-hidden`:`overflow-auto`),children:(0,j.jsx)(`div`,{className:d(`max-w-6xl mx-auto animate-fade-in h-full`,o&&`min-h-0 xl:overflow-hidden`),children:e})})}),t&&n===`docked`&&(0,j.jsx)(A.Suspense,{fallback:null,children:(0,j.jsx)(ai,{})})]}),t&&n===`floating`&&(0,j.jsx)(A.Suspense,{fallback:null,children:(0,j.jsx)(ai,{})})]})}function li({children:e}){return(0,j.jsx)($e,{children:(0,j.jsx)(ci,{children:e})})}var ui=S(e=>({connectionStatus:`disconnected`,setConnectionStatus:t=>e({connectionStatus:t}),channelModal:{open:!1},openChannelModal:t=>e({channelModal:{open:!0,channel:t}}),closeChannelModal:()=>e({channelModal:{open:!1}})}));function di(e){let t=e.trim().toLowerCase();return t?!(t.startsWith(`plugins`)||t.startsWith(`skills`)):!0}function fi(e,t){t.startsWith(`plugins`)&&(e?.invalidateQueries({queryKey:[`ncp-session-types`]}),e?.invalidateQueries({queryKey:[`marketplace-installed`,`plugin`]}),e?.invalidateQueries({queryKey:[`marketplace-items`]})),t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function pi(e,t){e&&di(t)&&e.invalidateQueries({queryKey:[`config`]}),fi(e,t)}function mi(e,t,n,r){if(r.type===`connection.open`){t(`connected`),n.current&&(n.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}));return}if(r.type===`connection.close`||r.type===`connection.error`){t(`disconnected`),n.current=!0;return}if(r.type===`config.updated`){pi(e,typeof r.payload?.path==`string`?r.payload.path:``);return}if(r.type===`session.run-status`||r.type===`session.summary.upsert`||r.type===`session.summary.delete`){lr(e,r);return}r.type===`error`&&console.error(`Realtime transport error:`,r.payload.message)}function hi(e){let{setConnectionStatus:t}=ui(),n=(0,A.useRef)(!1);(0,A.useEffect)(()=>(t(`connecting`),te.subscribe(r=>mi(e,t,n,r))),[e,t])}var gi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ModelConfig:e}=await import(`./ModelConfig-D1JtGtQv.js`);return{ModelConfig:e}},__vite__mapDeps([10,2,11,4,3,12,13,14,9,15,16,17,18]))).ModelConfig})),Q=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ChatPage:e}=await import(`./ChatPage-CslhBPfT.js`);return{ChatPage:e}},__vite__mapDeps([19,2,20,13,11,3,21,22,23,24,9,15,25,26,17,27,28,1,4,5,6,7,8,12,29,14,30,31,32,33,34,16]))).ChatPage})),_i=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SearchConfig:e}=await import(`./SearchConfig-EjeszXbv.js`);return{SearchConfig:e}},__vite__mapDeps([35,2,13,11,3,5,7,36,15,16]))).SearchConfig})),vi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ProvidersList:e}=await import(`./ProvidersList-1rKi3aQT.js`);return{ProvidersList:e}},__vite__mapDeps([37,2,13,11,3,21,22,6,7,32,8,34,36,15,16,38,39,27,18]))).ProvidersList})),yi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ChannelsList:e}=await import(`./ChannelsList-uKmkpD25.js`);return{ChannelsList:e}},__vite__mapDeps([40,2,13,11,3,24,4,5,29,41,14,7,8,34,36,15,16,38,39,27,18]))).ChannelsList})),bi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{RuntimeConfig:e}=await import(`./RuntimeConfig-BTk9319O.js`);return{RuntimeConfig:e}},__vite__mapDeps([42,2,13,11,3,6,43,32,15,39,18]))).RuntimeConfig})),xi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SecurityConfig:e}=await import(`./security-config-CGazBahs.js`);return{SecurityConfig:e}},__vite__mapDeps([44,2,11,15,16,39]))).SecurityConfig})),Si=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SessionsConfig:e}=await import(`./SessionsConfig-BIXiDaK2.js`);return{SessionsConfig:e}},__vite__mapDeps([45,2,13,11,3,41,31,14,7,15,26]))).SessionsConfig})),Ci=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SecretsConfig:e}=await import(`./SecretsConfig-cnAXvREZ.js`);return{SecretsConfig:e}},__vite__mapDeps([46,2,13,11,3,6,43,32,15,16,39]))).SecretsConfig})),wi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{RemoteAccessPage:e}=await import(`./RemoteAccessPage-bIAKxDky.js`);return{RemoteAccessPage:e}},__vite__mapDeps([47,2,11,3,30,15,38]))).RemoteAccessPage})),Ti=(0,A.lazy)(async()=>({default:(await y(async()=>{let{MarketplacePage:e}=await import(`./MarketplacePage-BZQW70ti.js`);return{MarketplacePage:e}},__vite__mapDeps([48,23,2,20,13,11,3,22,24,9,15,25,26,17,27]))).MarketplacePage})),Ei=(0,A.lazy)(async()=>({default:(await y(async()=>{let{McpMarketplacePage:e}=await import(`./McpMarketplacePage-CeLvv1xy.js`);return{McpMarketplacePage:e}},__vite__mapDeps([49,2,13,11,3,24,9,15,25,26,17,39,27]))).McpMarketplacePage}));function Di(){return(0,j.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function $({children:e}){return(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(Di,{}),children:e})}function Oi(){return hi(x),(0,j.jsxs)(wn,{children:[(0,j.jsx)(li,{children:(0,j.jsx)(`div`,{className:`w-full h-full`,children:(0,j.jsxs)(_,{children:[(0,j.jsx)(v,{path:`/chat/skills`,element:(0,j.jsx)(b,{to:`/skills`,replace:!0})}),(0,j.jsx)(v,{path:`/chat/cron`,element:(0,j.jsx)(b,{to:`/cron`,replace:!0})}),(0,j.jsx)(v,{path:`/chat/agents`,element:(0,j.jsx)(b,{to:`/agents`,replace:!0})}),(0,j.jsx)(v,{path:`/chat/:sessionId?`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`chat`})})}),(0,j.jsx)(v,{path:`/agents`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`agents`})})}),(0,j.jsx)(v,{path:`/skills`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`skills`})})}),(0,j.jsx)(v,{path:`/cron`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`cron`})})}),(0,j.jsx)(v,{path:`/model`,element:(0,j.jsx)($,{children:(0,j.jsx)(gi,{})})}),(0,j.jsx)(v,{path:`/search`,element:(0,j.jsx)($,{children:(0,j.jsx)(_i,{})})}),(0,j.jsx)(v,{path:`/providers`,element:(0,j.jsx)($,{children:(0,j.jsx)(vi,{})})}),(0,j.jsx)(v,{path:`/channels`,element:(0,j.jsx)($,{children:(0,j.jsx)(yi,{})})}),(0,j.jsx)(v,{path:`/runtime`,element:(0,j.jsx)($,{children:(0,j.jsx)(bi,{})})}),(0,j.jsx)(v,{path:`/remote`,element:(0,j.jsx)($,{children:(0,j.jsx)(wi,{})})}),(0,j.jsx)(v,{path:`/security`,element:(0,j.jsx)($,{children:(0,j.jsx)(xi,{})})}),(0,j.jsx)(v,{path:`/sessions`,element:(0,j.jsx)($,{children:(0,j.jsx)(Si,{})})}),(0,j.jsx)(v,{path:`/secrets`,element:(0,j.jsx)($,{children:(0,j.jsx)(Ci,{})})}),(0,j.jsx)(v,{path:`/settings`,element:(0,j.jsx)(b,{to:`/model`,replace:!0})}),(0,j.jsx)(v,{path:`/marketplace/skills`,element:(0,j.jsx)(b,{to:`/skills`,replace:!0})}),(0,j.jsx)(v,{path:`/marketplace`,element:(0,j.jsx)(b,{to:`/marketplace/plugins`,replace:!0})}),(0,j.jsx)(v,{path:`/marketplace/mcp`,element:(0,j.jsx)($,{children:(0,j.jsx)(Ei,{})})}),(0,j.jsx)(v,{path:`/marketplace/:type`,element:(0,j.jsx)($,{children:(0,j.jsx)(Ti,{})})}),(0,j.jsx)(v,{path:`/`,element:(0,j.jsx)(b,{to:`/chat`,replace:!0})}),(0,j.jsx)(v,{path:`*`,element:(0,j.jsx)(b,{to:`/chat`,replace:!0})})]})})}),(0,j.jsx)(En,{})]})}function ki(){let e=Ln(),t=e.isError&&Fn(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,j.jsx)(Oi,{}):e.data?.enabled&&!e.data.authenticated?(0,j.jsx)(Un,{username:e.data.username}):(0,j.jsx)(Oi,{})}function Ai(){return(0,j.jsxs)(ne,{client:x,children:[(0,j.jsx)(ki,{}),(0,j.jsx)(re,{position:`top-right`,richColors:!0})]})}(0,tt.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(Zr,{children:(0,j.jsx)(Jr,{children:(0,j.jsx)(oe,{children:(0,j.jsx)(Ai,{})})})})}));export{bn as $,kr as A,Bn as B,Tr as C,yr as D,Or as E,pr as F,Dn as G,Hn as H,cr as I,On as J,jn as K,ar as L,Ar as M,mr as N,Ir as O,dr as P,U as Q,Gn as R,Br as S,zr as T,Vn as U,Rn as V,J as W,Tn as X,kn as Y,G as Z,Dr as _,Rt as _t,Wr as a,cn as at,Mr as b,hr as c,Qt as ct,Sr as d,qt as dt,nn as et,Lr as f,Kt as ft,jr as g,zt as gt,Cr as h,Bt as ht,Gr as i,on as it,br as j,xr as k,_r as l,Xt as lt,Fr as m,L as mt,Qr as n,ln as nt,Kr as o,tn as ot,Rr as p,Wt as pt,An as q,Yr as r,sn as rt,Vr as s,$t as st,ui as t,R as tt,vr as u,Jt as ut,Nr as v,wr as w,Er as x,Pr as y,Ln as z};
|
|
6
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return A.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kt=`DialogDescriptionWarning`,At=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Dt(kt).contentName}}.`;return A.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},jt=at,Mt=ut,Nt=dt,Pt=mt,Ft=yt,It=xt,Lt=Ct,Rt=k(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),zt=k(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Bt=k(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),Vt=k(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Ht=k(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Ut=k(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),L=k(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Wt=k(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Gt=k(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),Kt=k(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),qt=k(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Jt=k(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Yt=k(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Xt=k(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Zt=k(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Qt=k(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),$t=k(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),en=k(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),tn=k(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),nn=jt,rn=Mt,an=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(Nt,{ref:n,className:d(`fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));an.displayName=Nt.displayName;var R=A.forwardRef(({className:e,children:t,...n},r)=>(0,j.jsxs)(rn,{children:[(0,j.jsx)(an,{}),(0,j.jsxs)(Pt,{ref:r,className:d(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-2xl`,e),...n,children:[t,(0,j.jsxs)(Lt,{className:`absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none`,children:[(0,j.jsx)(we,{className:`h-4 w-4 text-gray-500`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));R.displayName=Pt.displayName;var on=({className:e,...t})=>(0,j.jsx)(`div`,{className:d(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});on.displayName=`DialogHeader`;var sn=({className:e,...t})=>(0,j.jsx)(`div`,{className:d(`flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3`,e),...t});sn.displayName=`DialogFooter`;var cn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(Ft,{ref:n,className:d(`text-lg font-semibold leading-tight tracking-tight text-gray-900`,e),...t}));cn.displayName=Ft.displayName;var ln=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(It,{ref:n,className:d(`text-sm text-gray-500 leading-relaxed`,e),...t}));ln.displayName=It.displayName;async function un(){let e=await h.get(`/api/remote/status`);if(!e.ok)throw Error(e.error.message);return e.data}async function dn(){let e=await h.get(`/api/remote/doctor`);if(!e.ok)throw Error(e.error.message);return e.data}async function fn(e){let t=await h.post(`/api/remote/auth/start`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function pn(e){let t=await h.post(`/api/remote/auth/poll`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function mn(){let e=await h.post(`/api/remote/logout`,{});if(!e.ok)throw Error(e.error.message);return e.data}async function hn(e){let t=await h.put(`/api/remote/settings`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function z(e){let t=await h.post(`/api/remote/service/${e}`,{});if(!t.ok)throw Error(t.error.message);return t.data}var gn=[`remote-status`],_n=`https://platform.nextclaw.io`,vn=`https://nextclaw-platform-console.pages.dev`,B=async()=>await x.fetchQuery({queryKey:gn,queryFn:un,staleTime:5e3}),V=async()=>(await x.invalidateQueries({queryKey:gn}),await B()),yn=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function H(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return _n;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return vn}var bn=e=>H(e?.account.apiBase)||H(e?.settings.platformApiBase)||H(e?.platformBase)||H(e?.account.platformBase)||void 0;function U(){return f({queryKey:gn,queryFn:un,staleTime:5e3,refetchOnWindowFocus:!0})}var W=S(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})})),xn=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{W.getState().openPanel()},this.closeAccountPanel=()=>{W.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),W.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await B();return t.account.loggedIn?!0:(e?.pendingAction&&W.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let t=e?.status??await B();e?.pendingAction&&W.getState().setPendingAction(e.pendingAction);let n=await fn({apiBase:yn(t,e?.apiBase)});W.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:i(`remoteBrowserAuthWaiting`)}),window.open(n.verificationUri,`_blank`,`noopener,noreferrer`)||W.getState().setAuthStatusMessage(i(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:i(`remoteBrowserAuthStartFailed`);p.error(`${i(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=()=>{let e=W.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await mn(),W.getState().clearPendingAction(),W.getState().clearBrowserAuth(),await V(),p.success(i(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:i(`remoteLogoutFailed`);p.error(`${i(`remoteLogoutFailed`)}: ${t}`)}},this.openNextClawWeb=async()=>{let e=bn(await B());if(!e){p.error(i(`remoteOpenWebUnavailable`));return}window.open(e,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=W.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=W.getState();if(e.authSessionId)try{let t=await B(),n=await pn({sessionId:e.authSessionId,apiBase:yn(t)});if(n.status===`pending`){W.getState().updateBrowserAuth({statusMessage:i(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),W.getState().clearBrowserAuth(),p.error(n.message||i(`remoteBrowserAuthExpired`));return}W.getState().setAuthStatusMessage(i(`remoteBrowserAuthCompleted`));let r=await V(),{pendingAction:a}=W.getState();this.clearPollTimer(),W.getState().clearBrowserAuth(),p.success(i(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,r),W.getState().clearPendingAction()}catch(e){this.clearPollTimer(),W.getState().clearBrowserAuth();let t=e instanceof Error?e.message:i(`remoteBrowserAuthPollFailed`);p.error(`${i(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=W.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?s(e.authExpiresAt):`-`}}}},G=S(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),Sn=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=G.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{G.getState().setEnabled(e)},this.setDeviceName=e=>{G.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{G.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{G.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await V(),n=G.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await V();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await V();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let n=t.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:i(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await z(n);let e=await V();this.hydrateDraftFromStatus(e)},successMessage:i(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await V();await this.accountManager?.startBrowserSignIn({status:t,apiBase:G.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let t=e??await V(),n=G.getState();await this.runManagedAction({actionLabel:i(`remoteActionSavingAdvanced`),job:async()=>{await hn({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await V();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?i(`remoteSettingsSaved`):i(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:i(`remoteDoctorRunning`),job:async()=>{let e=await dn();G.getState().setDoctor(e)},successMessage:i(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,i(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,i(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,i(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,t)=>{let n=G.getState();await this.runManagedAction({actionLabel:i(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await hn({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await V();this.hydrateDraftFromStatus(r),e?await z(r.service.running?`restart`:`start`):t.service.running&&await z(`restart`);let i=await V();this.hydrateDraftFromStatus(i)},successMessage:i(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await z(e),n=await V();this.hydrateDraftFromStatus(n),p.success(t.message)}})},this.hydrateDraftFromStatus=e=>{G.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{G.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&p.success(e.successMessage)}catch(e){let t=e instanceof Error?e.message:i(`error`);throw p.error(t),e}finally{G.getState().finishAction()}}}},K=new class{constructor(){this.accountManager=new xn,this.remoteAccessManager=new Sn}};K.accountManager.bindSignedInContinuation(K.remoteAccessManager.resumePendingActionAfterSignIn),K.remoteAccessManager.bindAccountManager(K.accountManager);var Cn=(0,A.createContext)(null);function wn({children:e}){return(0,j.jsx)(Cn.Provider,{value:K,children:e})}function Tn(){let e=(0,A.useContext)(Cn);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function q(e){return(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,j.jsx)(`span`,{className:`text-gray-500`,children:e.label}),(0,j.jsx)(`span`,{className:`text-right text-gray-900`,children:e.value?.trim()||`-`})]})}function En(){let e=Tn(),t=U(),n=W(e=>e.panelOpen),r=W(e=>e.authSessionId),a=W(e=>e.authVerificationUri),o=W(e=>e.authExpiresAt),c=W(e=>e.authStatusMessage),l=t.data;return(0,A.useEffect)(()=>{e.accountManager.syncRemoteStatus(l)},[e,l]),(0,j.jsx)(nn,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,j.jsxs)(R,{className:`max-w-xl`,children:[(0,j.jsxs)(on,{children:[(0,j.jsxs)(cn,{className:`flex items-center gap-2`,children:[(0,j.jsx)(L,{className:`h-5 w-5 text-primary`}),i(`accountPanelTitle`)]}),(0,j.jsx)(ln,{children:i(`accountPanelDescription`)})]}),l?.account.loggedIn?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium text-emerald-800`,children:i(`accountPanelSignedInTitle`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:i(`accountPanelSignedInDescription`)})]}),(0,j.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3`,children:[(0,j.jsx)(q,{label:i(`remoteAccountEmail`),value:l.account.email}),(0,j.jsx)(q,{label:i(`remoteAccountRole`),value:l.account.role})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,j.jsxs)(m,{onClick:()=>void e.accountManager.openNextClawWeb(),children:[(0,j.jsx)($t,{className:`mr-2 h-4 w-4`}),i(`remoteOpenDeviceList`)]}),(0,j.jsxs)(m,{variant:`outline`,onClick:()=>void e.accountManager.logout(),children:[(0,j.jsx)(Gt,{className:`mr-2 h-4 w-4`}),i(`remoteLogout`)]})]})]}):(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:i(`accountPanelSignedOutTitle`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:i(`accountPanelSignedOutDescription`)}),r?(0,j.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,j.jsx)(q,{label:i(`remoteBrowserAuthSession`),value:r}),(0,j.jsx)(q,{label:i(`remoteBrowserAuthExpiresAt`),value:o?s(o):`-`})]}):null]}),c?(0,j.jsx)(`p`,{className:`text-sm text-gray-600`,children:c}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,j.jsx)(m,{onClick:()=>void e.accountManager.startBrowserSignIn(),children:i(r?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),a?(0,j.jsx)(m,{variant:`outline`,onClick:()=>e.accountManager.resumeBrowserSignIn(),children:i(`remoteBrowserAuthResume`)}):null]})]})]})})}var Dn=A.forwardRef(({className:e,hover:t=!0,...n},r)=>(0,j.jsx)(`div`,{ref:r,className:d(`rounded-2xl border border-gray-200/50 bg-white text-card-foreground shadow-card transition-all duration-base`,t&&`hover:shadow-card-hover hover:border-gray-200`,e),...n}));Dn.displayName=`Card`;var On=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`div`,{ref:n,className:d(`flex flex-col space-y-1.5 p-6`,e),...t}));On.displayName=`CardHeader`;var kn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`h3`,{ref:n,className:d(`text-[15px] font-semibold leading-tight tracking-tight text-gray-900`,e),...t}));kn.displayName=`CardTitle`;var An=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`p`,{ref:n,className:d(`text-[13px] text-gray-400 leading-relaxed`,e),...t}));An.displayName=`CardDescription`;var jn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`div`,{ref:n,className:d(`p-6 pt-0`,e),...t}));jn.displayName=`CardContent`;var Mn=A.forwardRef(({className:e,...t},n)=>(0,j.jsx)(`div`,{ref:n,className:d(`flex items-center justify-between p-6 pt-0`,e),...t}));Mn.displayName=`CardFooter`;var J=A.forwardRef(({className:e,type:t,...n},r)=>(0,j.jsx)(`input`,{type:t,className:d(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));J.displayName=`Input`;var Nn=40,Pn=400;function Fn(e){if(!(e instanceof Error))return!1;let t=e.message.trim().toLowerCase();return t?t.includes(`failed to fetch`)||t.includes(`networkerror`)||t.includes(`network request failed`)||t.includes(`load failed`)||t.includes(`request timed out`)||t.includes(`timed out waiting for remote request response`)||t.includes(`remote transport connection closed`):!1}function In(e,t){return e>=Nn?!1:Fn(t)}function Ln(){let[e,t]=(0,A.useState)(!1),n=f({queryKey:[`auth-status`],queryFn:()=>He({timeoutMs:e?5e3:Pn}),staleTime:5e3,retry:In,retryDelay:250,refetchOnWindowFocus:!0});return(0,A.useEffect)(()=>{n.isSuccess&&!e&&t(!0)},[e,n.isSuccess]),n}function Y(e){return Promise.all([e.invalidateQueries({queryKey:[`auth-status`]}),e.invalidateQueries({queryKey:[`app-meta`]}),e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),e.invalidateQueries({queryKey:[`config-schema`]}),e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`session-history`]}),e.invalidateQueries({queryKey:[`chat-runs`]}),e.invalidateQueries({queryKey:[`cron-jobs`]})])}function Rn(){let e=g();return C({mutationFn:Je,onSuccess:async()=>{await Y(e),p.success(i(`authSetupSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function zn(){let e=g();return C({mutationFn:Ue,onSuccess:async()=>{await Y(e),p.success(i(`authLoginSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Bn(){let e=g();return C({mutationFn:Be,onSuccess:async()=>{await Y(e),p.success(i(`authLogoutSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Vn(){let e=g();return C({mutationFn:ke,onSuccess:async()=>{await Y(e),p.success(i(`authPasswordUpdated`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Hn(){let e=g();return C({mutationFn:Xe,onSuccess:async(t,n)=>{await Y(e),p.success(n.enabled?i(`authEnabledSuccess`):i(`authDisabledSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Un({username:e}){let t=zn(),[n,r]=(0,A.useState)(e??``),[a,o]=(0,A.useState)(``),s=n.trim().length>0&&a.length>0&&!t.isPending;return(0,j.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,j.jsxs)(Dn,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,j.jsxs)(On,{children:[(0,j.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:i(`authBrand`)}),(0,j.jsx)(kn,{className:`text-2xl`,children:i(`authLoginTitle`)}),(0,j.jsx)(An,{children:i(`authLoginDescription`)})]}),(0,j.jsx)(jn,{children:(0,j.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),s&&t.mutate({username:n.trim(),password:a})},children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:i(`authUsername`)}),(0,j.jsx)(J,{value:n,onChange:e=>r(e.target.value),placeholder:i(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:i(`authPassword`)}),(0,j.jsx)(J,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:i(`authPasswordPlaceholder`)})]}),(0,j.jsx)(m,{type:`submit`,className:`w-full`,disabled:!s,children:t.isPending?i(`authLoggingIn`):i(`authLoginAction`)})]})})]})})}var Wn=`nextclaw.ui.theme`,Gn=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],X=`warm`,Kn=!1,Z=new Set;function qn(e){return e===`warm`||e===`cool`}function Jn(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Yn(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(Wn);if(qn(e))return e}catch{}return`warm`}function Xn(){return Kn||=(X=Yn(),Jn(X),!0),X}function Zn(){return Kn?X:Xn()}function Qn(e){if(Xn(),e!==X){if(X=e,Jn(X),typeof window<`u`)try{window.localStorage.setItem(Wn,X)}catch{}Z.forEach(e=>e(X))}}function $n(e){return Z.add(e),()=>{Z.delete(e)}}function er(){let e=Qe();(0,A.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;et(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}function tr(e){return[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function nr(e,t){let n=t.updatedAt.localeCompare(e.updatedAt);return n>0?!0:n<0?!1:e.status===t.status?!0:t.status===`idle`}function rr(e,t){if(!e)return e;let n=e.sessions.findIndex(e=>e.sessionId===t.sessionId),r=tr(n>=0?e.sessions.map((e,r)=>r===n&&nr(e,t)?t:e):[...e.sessions,t]);return{...e,sessions:r,total:r.length}}function ir(e,t){if(!e)return e;let n=t.trim();if(!n)return e;let r=e.sessions.filter(e=>e.sessionId!==n);return r.length===e.sessions.length?e:{...e,sessions:r,total:r.length}}function ar(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>rr(e,t))}function or(e,t){if(!e)return e;let n=t.sessionKey.trim();if(!n)return e;let r=!1,i=e.sessions.map(e=>e.sessionId!==n||e.status===t.status?e:(r=!0,{...e,status:t.status}));return r?{...e,sessions:i}:e}function sr(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>or(e,t))}function cr(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>ir(e,t))}function lr(e,t){if(t.type===`session.run-status`){sr(e,t.payload);return}if(t.type===`session.summary.upsert`){ar(e,t.payload.summary);return}cr(e,t.payload.sessionKey)}async function ur(e){let t=new URLSearchParams;typeof e?.limit==`number`&&Number.isFinite(e.limit)&&t.set(`limit`,String(Math.max(1,Math.trunc(e.limit))));let n=t.toString(),r=await h.get(n?`/api/ncp/sessions?${n}`:`/api/ncp/sessions`);if(!r.ok)throw Error(r.error.message);return r.data}async function dr(e,t=200){let n=await h.get(`/api/ncp/sessions/${encodeURIComponent(e)}/messages?limit=${Math.max(1,Math.trunc(t))}`);if(!n.ok)throw Error(n.error.message);return n.data}async function fr(e,t){let n=new URLSearchParams,r=t?.projectRoot?.trim();r&&n.set(`projectRoot`,r);let i=n.toString(),a=await h.get(i?`/api/ncp/sessions/${encodeURIComponent(e)}/skills?${i}`:`/api/ncp/sessions/${encodeURIComponent(e)}/skills`);if(!a.ok)throw Error(a.error.message);return a.data}async function pr(e,t){let n=await h.put(`/api/ncp/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw Error(n.error.message);return n.data}async function mr(e){let t=await h.delete(`/api/ncp/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw Error(t.error.message);return t.data}function hr(){return f({queryKey:[`config`],queryFn:Ge,staleTime:3e4,refetchOnWindowFocus:!0})}function gr(){return f({queryKey:[`app-meta`],queryFn:Me,staleTime:1/0})}function _r(){return f({queryKey:[`config-meta`],queryFn:Pe,staleTime:1/0})}function vr(){return f({queryKey:[`config-schema`],queryFn:ze,staleTime:1/0})}function yr(){let e=g();return C({mutationFn:Ye,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function br(){let e=g();return C({mutationFn:({data:e})=>Ee(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function xr(){let e=g();return C({mutationFn:({provider:e,data:t})=>Ae(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Sr(){let e=g();return C({mutationFn:({data:e})=>Ke(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Cr(){let e=g();return C({mutationFn:({provider:e})=>We(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function wr(){return C({mutationFn:({provider:e,data:t})=>Ne(e,t)})}function Tr(){return C({mutationFn:({provider:e,data:t})=>Ze(e,t)})}function Er(){return C({mutationFn:({provider:e,data:t})=>Le(e,t)})}function Dr(){return C({mutationFn:({provider:e})=>Fe(e)})}function Or(){let e=g();return C({mutationFn:({channel:e,data:t})=>Te(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function kr(){let e=g();return C({mutationFn:({data:e})=>De(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Ar(){let e=g();return C({mutationFn:({data:e})=>Oe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function jr(){return C({mutationFn:({actionId:e,data:t})=>Re(e,t),onError:e=>{p.error(i(`error`)+`: `+e.message)}})}function Mr(e){return f({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>ur(e),staleTime:5e3,retry:!1})}function Nr(e,t=200){return f({queryKey:[`ncp-session-messages`,e,t],queryFn:()=>dr(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Pr(e){return f({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>fr(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Fr(){let e=g();return C({mutationFn:({sessionId:e})=>mr(e),onSuccess:(t,n)=>{cr(e,n.sessionId),e.removeQueries({queryKey:[`ncp-session-messages`,n.sessionId]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Ir(){let e=g();return C({mutationFn:({sessionId:e,data:t})=>pr(e,t),onSuccess:t=>{ar(e,t),e.invalidateQueries({queryKey:[`ncp-session-skills`,t.sessionId]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Lr(e={all:!0}){return f({queryKey:[`cron`,e],queryFn:()=>qe(e),staleTime:1e4})}function Rr(){let e=g();return C({mutationFn:({id:e})=>Ve(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function zr(){let e=g();return C({mutationFn:({id:e,enabled:t})=>je(e,{enabled:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Br(){let e=g();return C({mutationFn:({id:e,force:t})=>Ie(e,{force:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Vr({className:e,suffix:t}){let{data:n}=gr(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim();return(0,j.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,j.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,j.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,j.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,j.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),i?(0,j.jsxs)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:[`v`,i]}):null,t?(0,j.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:t}):null]})]})}var Hr={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function Ur(e){return Hr[e]}function Wr({to:e,label:t,icon:n,density:r=`default`,className:i}){let a=Ur(r);return(0,j.jsx)(ie,{to:e,className:({isActive:e})=>d(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,a.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(n,{className:d(a.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function Gr({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:a,trailing:o,trailingClassName:s,testId:c,trailingTestId:l}){let u=Ur(r);return(0,j.jsxs)(`button`,{type:`button`,onClick:n,className:d(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,u.row,i),"data-testid":c,children:[(0,j.jsx)(t,{className:d(u.icon,`shrink-0 text-gray-400`)}),(0,j.jsx)(`span`,{className:d(`min-w-0 flex-1 text-left`,a),children:e}),o?(0,j.jsx)(`span`,{className:d(`shrink-0 text-gray-500`,u.value,s),"data-testid":l,children:o}):null]})}function Kr({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:a=`default`,children:o}){let s=Ur(a);return(0,j.jsxs)(ye,{value:n,onValueChange:i,children:[(0,j.jsxs)(he,{className:d(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,s.row),children:[(0,j.jsxs)(`div`,{className:d(`flex min-w-0 items-center`,s.gap),children:[(0,j.jsx)(t,{className:d(s.icon,`text-gray-400`)}),(0,j.jsx)(`span`,{className:`text-left`,children:e})]}),(0,j.jsx)(`span`,{className:d(`ml-auto text-gray-500`,s.value),children:r})]}),(0,j.jsx)(_e,{children:o})]})}var qr=(0,A.createContext)(null);function Jr({children:e}){let[t,r]=(0,A.useState)(()=>u());(0,A.useEffect)(()=>a(e=>{r(e)}),[]);let i=(0,A.useCallback)(e=>{n(e),r(c())},[]),o=(0,A.useCallback)(()=>{i(t===`en`?`zh`:`en`)},[t,i]),s=(0,A.useMemo)(()=>({language:t,setLanguage:i,toggleLanguage:o}),[t,i,o]);return(0,j.jsx)(qr.Provider,{value:s,children:e})}function Yr(){let e=(0,A.useContext)(qr);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:i}}var Xr=(0,A.createContext)(null);function Zr({children:e}){let[t,n]=(0,A.useState)(()=>Xn());(0,A.useEffect)(()=>$n(e=>{n(e)}),[]);let r=(0,A.useCallback)(e=>{Qn(e),n(Zn())},[]),i=(0,A.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,j.jsx)(Xr.Provider,{value:i,children:e})}function Qr(){let e=(0,A.useContext)(Xr);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function $r({mode:e}){let n=Tn(),r=Qe(),a=U(),{language:o,setLanguage:s}=Yr(),{theme:c,setTheme:l}=Qr(),u=e===`settings`,ee=t.find(e=>e.value===o)?.label??o,f=i(Gn.find(e=>e.value===c)?.labelKey??`themeWarm`),te=a.data?.account.email?.trim(),ne=!!a.data?.account.loggedIn,p=e=>{o!==e&&(s(e),window.location.reload())},m=e=>{c!==e&&l(e)},h=[{target:`/chat`,label:i(`chat`),icon:Kt},{target:`/chat/cron`,label:i(`cron`),icon:Rt},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:Bt},{target:`/agents`,label:i(`agentsPageTitle`),icon:zt}],re=[{target:`/model`,label:i(`model`),icon:Vt},{target:`/providers`,label:i(`providers`),icon:Qt},{target:`/search`,label:i(`searchChannels`),icon:Ce},{target:`/channels`,label:i(`channels`),icon:qt},{target:`/runtime`,label:i(`runtime`),icon:Ht},{target:`/remote`,label:i(`remote`),icon:en},{target:`/security`,label:i(`security`),icon:Zt},{target:`/sessions`,label:i(`sessions`),icon:Ut},{target:`/secrets`,label:i(`secrets`),icon:L},{target:`/marketplace/plugins`,label:i(`marketplaceFilterPlugins`),icon:Yt},{target:`/marketplace/mcp`,label:i(`marketplaceFilterMcp`),icon:tn}],g=u?re:h,_=u?`compact`:`default`;return(0,j.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[u?(0,j.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,j.jsxs)(ie,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,j.jsx)(xe,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,j.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,j.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,j.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,j.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,j.jsx)(Vr,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,j.jsx)(`ul`,{className:d(u?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:g.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(Wr,{to:e.target,label:e.label,icon:e.icon,density:_})},e.target))})}),(0,j.jsxs)(`div`,{className:d(`shrink-0 border-t border-[#dde0ea] bg-secondary`,u?`mt-2 pt-3`:`mt-3 pt-3`),children:[u?(0,j.jsx)(Gr,{onClick:()=>n.accountManager.openAccountPanel(),icon:L,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:ne?te||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,j.jsx)(`div`,{className:`mb-2`,children:(0,j.jsx)(Wr,{to:`/settings`,label:i(`settings`),icon:Xt})}),(0,j.jsx)(`div`,{className:`mb-2`,children:(0,j.jsx)(Kr,{value:c,onValueChange:e=>m(e),icon:Jt,label:i(`theme`),valueLabel:f,density:_,children:Gn.map(e=>(0,j.jsx)(ve,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,j.jsx)(`div`,{className:`mb-2`,children:(0,j.jsx)(Kr,{value:o,onValueChange:e=>p(e),icon:Wt,label:i(`language`),valueLabel:ee,density:_,children:t.map(e=>(0,j.jsx)(ve,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,j.jsx)(Gr,{onClick:()=>r.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:Se,label:i(`docBrowserHelp`),density:_})]})]})]})}var ei=`NextClaw`,ti=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/plugins`,key:`marketplacePluginsPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/sessions`,key:`sessionsPageTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function ni(e,t){return e===t||e.startsWith(`${t}/`)}function ri(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of ti)if(ni(t,e))return i(n);return i(`settings`)}function ii(e){return`${ei} - ${ri(e)}`}var ai=(0,A.lazy)(async()=>({default:(await y(async()=>{let{DocBrowser:e}=await import(`./DocBrowser-DQjtSsY3.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function oi(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function si(e){let t=e.toLowerCase();return t===`/channels`||t.startsWith(`/channels/`)}function ci({children:e}){let{isOpen:t,mode:n}=Qe();er();let{pathname:r}=ae(),{language:i}=Yr(),a=oi(r),o=si(r);return(0,A.useEffect)(()=>{document.title=ii(r)},[r,i]),(0,j.jsxs)(`div`,{className:`h-screen flex bg-background font-sans text-foreground`,children:[!a&&(0,j.jsx)($r,{mode:`settings`}),(0,j.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,j.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:a?(0,j.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:e}):(0,j.jsx)(`main`,{className:d(`flex-1 custom-scrollbar p-8`,o?`overflow-auto xl:overflow-hidden`:`overflow-auto`),children:(0,j.jsx)(`div`,{className:d(`max-w-6xl mx-auto animate-fade-in h-full`,o&&`min-h-0 xl:overflow-hidden`),children:e})})}),t&&n===`docked`&&(0,j.jsx)(A.Suspense,{fallback:null,children:(0,j.jsx)(ai,{})})]}),t&&n===`floating`&&(0,j.jsx)(A.Suspense,{fallback:null,children:(0,j.jsx)(ai,{})})]})}function li({children:e}){return(0,j.jsx)($e,{children:(0,j.jsx)(ci,{children:e})})}var ui=S(e=>({connectionStatus:`disconnected`,setConnectionStatus:t=>e({connectionStatus:t}),channelModal:{open:!1},openChannelModal:t=>e({channelModal:{open:!0,channel:t}}),closeChannelModal:()=>e({channelModal:{open:!1}})}));function di(e){let t=e.trim().toLowerCase();return t?!(t.startsWith(`plugins`)||t.startsWith(`skills`)):!0}function fi(e,t){t.startsWith(`plugins`)&&(e?.invalidateQueries({queryKey:[`ncp-session-types`]}),e?.invalidateQueries({queryKey:[`marketplace-installed`,`plugin`]}),e?.invalidateQueries({queryKey:[`marketplace-items`]})),t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function pi(e,t){e&&di(t)&&e.invalidateQueries({queryKey:[`config`]}),fi(e,t)}function mi(e,t,n,r){if(r.type===`connection.open`){t(`connected`),n.current&&(n.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}));return}if(r.type===`connection.close`||r.type===`connection.error`){t(`disconnected`),n.current=!0;return}if(r.type===`config.updated`){pi(e,typeof r.payload?.path==`string`?r.payload.path:``);return}if(r.type===`session.run-status`||r.type===`session.summary.upsert`||r.type===`session.summary.delete`){lr(e,r);return}r.type===`error`&&console.error(`Realtime transport error:`,r.payload.message)}function hi(e){let{setConnectionStatus:t}=ui(),n=(0,A.useRef)(!1);(0,A.useEffect)(()=>(t(`connecting`),te.subscribe(r=>mi(e,t,n,r))),[e,t])}var gi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ModelConfig:e}=await import(`./ModelConfig-DvsBTUiE.js`);return{ModelConfig:e}},__vite__mapDeps([10,2,11,4,3,12,13,14,9,15,16,17,18]))).ModelConfig})),Q=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ChatPage:e}=await import(`./ChatPage-YBL7iJ1X.js`);return{ChatPage:e}},__vite__mapDeps([19,2,20,13,11,3,21,22,23,24,9,15,25,26,17,27,28,1,4,5,6,7,8,12,29,14,30,31,32,33,34,16]))).ChatPage})),_i=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SearchConfig:e}=await import(`./SearchConfig-DIT6M65Q.js`);return{SearchConfig:e}},__vite__mapDeps([35,2,13,11,3,5,7,36,15,16]))).SearchConfig})),vi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ProvidersList:e}=await import(`./ProvidersList-D-qPGgC4.js`);return{ProvidersList:e}},__vite__mapDeps([37,2,13,11,3,21,22,6,7,32,8,34,36,15,16,38,39,27,18]))).ProvidersList})),yi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{ChannelsList:e}=await import(`./ChannelsList-DZWam3Ob.js`);return{ChannelsList:e}},__vite__mapDeps([40,2,13,11,3,24,4,5,29,41,14,7,8,34,36,15,16,38,39,27,18]))).ChannelsList})),bi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{RuntimeConfig:e}=await import(`./RuntimeConfig-BHpqcaHm.js`);return{RuntimeConfig:e}},__vite__mapDeps([42,2,13,11,3,6,43,32,15,39,18]))).RuntimeConfig})),xi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SecurityConfig:e}=await import(`./security-config-DEgOD4VX.js`);return{SecurityConfig:e}},__vite__mapDeps([44,2,11,15,16,39]))).SecurityConfig})),Si=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SessionsConfig:e}=await import(`./SessionsConfig-BZnmVTIu.js`);return{SessionsConfig:e}},__vite__mapDeps([45,2,13,11,3,41,31,14,7,15,26]))).SessionsConfig})),Ci=(0,A.lazy)(async()=>({default:(await y(async()=>{let{SecretsConfig:e}=await import(`./SecretsConfig-Cefg1LFJ.js`);return{SecretsConfig:e}},__vite__mapDeps([46,2,13,11,3,6,43,32,15,16,39]))).SecretsConfig})),wi=(0,A.lazy)(async()=>({default:(await y(async()=>{let{RemoteAccessPage:e}=await import(`./RemoteAccessPage-COnjm8_x.js`);return{RemoteAccessPage:e}},__vite__mapDeps([47,2,11,3,30,15,38]))).RemoteAccessPage})),Ti=(0,A.lazy)(async()=>({default:(await y(async()=>{let{MarketplacePage:e}=await import(`./MarketplacePage-BorWJftJ.js`);return{MarketplacePage:e}},__vite__mapDeps([48,23,2,20,13,11,3,22,24,9,15,25,26,17,27]))).MarketplacePage})),Ei=(0,A.lazy)(async()=>({default:(await y(async()=>{let{McpMarketplacePage:e}=await import(`./McpMarketplacePage-N-fB4HID.js`);return{McpMarketplacePage:e}},__vite__mapDeps([49,2,13,11,3,24,9,15,25,26,17,39,27]))).McpMarketplacePage}));function Di(){return(0,j.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function $({children:e}){return(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(Di,{}),children:e})}function Oi(){return hi(x),(0,j.jsxs)(wn,{children:[(0,j.jsx)(li,{children:(0,j.jsx)(`div`,{className:`w-full h-full`,children:(0,j.jsxs)(_,{children:[(0,j.jsx)(v,{path:`/chat/skills`,element:(0,j.jsx)(b,{to:`/skills`,replace:!0})}),(0,j.jsx)(v,{path:`/chat/cron`,element:(0,j.jsx)(b,{to:`/cron`,replace:!0})}),(0,j.jsx)(v,{path:`/chat/agents`,element:(0,j.jsx)(b,{to:`/agents`,replace:!0})}),(0,j.jsx)(v,{path:`/chat/:sessionId?`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`chat`})})}),(0,j.jsx)(v,{path:`/agents`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`agents`})})}),(0,j.jsx)(v,{path:`/skills`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`skills`})})}),(0,j.jsx)(v,{path:`/cron`,element:(0,j.jsx)($,{children:(0,j.jsx)(Q,{view:`cron`})})}),(0,j.jsx)(v,{path:`/model`,element:(0,j.jsx)($,{children:(0,j.jsx)(gi,{})})}),(0,j.jsx)(v,{path:`/search`,element:(0,j.jsx)($,{children:(0,j.jsx)(_i,{})})}),(0,j.jsx)(v,{path:`/providers`,element:(0,j.jsx)($,{children:(0,j.jsx)(vi,{})})}),(0,j.jsx)(v,{path:`/channels`,element:(0,j.jsx)($,{children:(0,j.jsx)(yi,{})})}),(0,j.jsx)(v,{path:`/runtime`,element:(0,j.jsx)($,{children:(0,j.jsx)(bi,{})})}),(0,j.jsx)(v,{path:`/remote`,element:(0,j.jsx)($,{children:(0,j.jsx)(wi,{})})}),(0,j.jsx)(v,{path:`/security`,element:(0,j.jsx)($,{children:(0,j.jsx)(xi,{})})}),(0,j.jsx)(v,{path:`/sessions`,element:(0,j.jsx)($,{children:(0,j.jsx)(Si,{})})}),(0,j.jsx)(v,{path:`/secrets`,element:(0,j.jsx)($,{children:(0,j.jsx)(Ci,{})})}),(0,j.jsx)(v,{path:`/settings`,element:(0,j.jsx)(b,{to:`/model`,replace:!0})}),(0,j.jsx)(v,{path:`/marketplace/skills`,element:(0,j.jsx)(b,{to:`/skills`,replace:!0})}),(0,j.jsx)(v,{path:`/marketplace`,element:(0,j.jsx)(b,{to:`/marketplace/plugins`,replace:!0})}),(0,j.jsx)(v,{path:`/marketplace/mcp`,element:(0,j.jsx)($,{children:(0,j.jsx)(Ei,{})})}),(0,j.jsx)(v,{path:`/marketplace/:type`,element:(0,j.jsx)($,{children:(0,j.jsx)(Ti,{})})}),(0,j.jsx)(v,{path:`/`,element:(0,j.jsx)(b,{to:`/chat`,replace:!0})}),(0,j.jsx)(v,{path:`*`,element:(0,j.jsx)(b,{to:`/chat`,replace:!0})})]})})}),(0,j.jsx)(En,{})]})}function ki(){let e=Ln(),t=e.isError&&Fn(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,j.jsx)(Oi,{}):e.data?.enabled&&!e.data.authenticated?(0,j.jsx)(Un,{username:e.data.username}):(0,j.jsx)(Oi,{})}function Ai(){return(0,j.jsxs)(ne,{client:x,children:[(0,j.jsx)(ki,{}),(0,j.jsx)(re,{position:`top-right`,richColors:!0})]})}(0,tt.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(Zr,{children:(0,j.jsx)(Jr,{children:(0,j.jsx)(oe,{children:(0,j.jsx)(Ai,{})})})})}));export{bn as $,kr as A,Bn as B,Tr as C,yr as D,Or as E,pr as F,Dn as G,Hn as H,cr as I,On as J,jn as K,ar as L,Ar as M,mr as N,Ir as O,dr as P,U as Q,Gn as R,Br as S,zr as T,Vn as U,Rn as V,J as W,Tn as X,kn as Y,G as Z,Dr as _,Rt as _t,Wr as a,cn as at,Mr as b,hr as c,Qt as ct,Sr as d,qt as dt,nn as et,Lr as f,Kt as ft,jr as g,zt as gt,Cr as h,Bt as ht,Gr as i,on as it,br as j,xr as k,_r as l,Xt as lt,Fr as m,L as mt,Qr as n,ln as nt,Kr as o,tn as ot,Rr as p,Wt as pt,An as q,Yr as r,sn as rt,Vr as s,$t as st,ui as t,R as tt,vr as u,Jt as ut,Nr as v,wr as w,Er as x,Pr as y,Ln as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r}from"./i18n-hM3v-3YG.js";import{n as i,o as a}from"./dist-RWNFhxvR.js";import{B as o,G as s,H as c,J as l,K as u,U as d,V as f,W as p,Y as m,q as h,z as g}from"./index-
|
|
1
|
+
import{_ as e,i as t,m as n,p as r}from"./i18n-hM3v-3YG.js";import{n as i,o as a}from"./dist-RWNFhxvR.js";import{B as o,G as s,H as c,J as l,K as u,U as d,V as f,W as p,Y as m,q as h,z as g}from"./index-DHmCjcxq.js";import{t as _}from"./label-CHJ1ATds.js";import{n as v,t as y}from"./page-layout-Z1klaUFW.js";import{t as b}from"./switch-D7JF_RZ-.js";var x=e(n(),1),S=r(),C=8;function w(e){return e.trim().length>=C}function T(e,n){return e===n?!0:(i.error(t(`authPasswordMismatch`)),!1)}function E(){let e=g(),n=f(),r=c(),i=d(),v=o(),[y,C]=(0,x.useState)(``),[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(``),[A,j]=(0,x.useState)(``),[M,N]=(0,x.useState)(``),P=e.data,F=y.trim().length>0&&w(E)&&E===O&&!n.isPending,I=w(A)&&A===M&&!i.isPending,L=async()=>{if(T(E,O))try{await n.mutateAsync({username:y.trim(),password:E}),D(``),k(``)}catch{}},R=async()=>{if(T(A,M))try{await i.mutateAsync({password:A}),j(``),N(``)}catch{}},z=async e=>{try{await r.mutateAsync({enabled:e})}catch{}},B=async()=>{try{await v.mutateAsync()}catch{}};return e.isLoading&&!P?(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsx)(u,{className:`text-sm text-gray-500`,children:t(`loading`)})]}):e.isError||!P?(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(u,{className:`space-y-4`,children:[(0,S.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`authStatusLoadFailed`)}),(0,S.jsx)(a,{variant:`outline`,onClick:()=>{e.refetch()},children:t(`authRetryStatus`)})]})]}):P.configured?(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(u,{className:`space-y-6`,children:[(0,S.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-start md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authStatusLabel`)}),(0,S.jsx)(`p`,{className:`text-sm text-gray-600`,children:t(`authStatusConfiguredUser`).replace(`{username}`,P.username??``)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authUsernameFixedHelp`)})]}),(0,S.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:P.enabled?t(`enabled`):t(`disabled`)})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4 border-t border-gray-200 pt-4 md:flex-row md:items-center md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authEnableLabel`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:P.enabled?t(`authEnableOnHelp`):t(`authEnableOffHelp`)})]}),(0,S.jsx)(b,{checked:P.enabled,disabled:r.isPending,onCheckedChange:e=>{z(e)}})]})]}),(0,S.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-4 space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authPasswordSectionTitle`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authPasswordSectionDescription`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-password-next`,children:t(`authPassword`)}),(0,S.jsx)(p,{id:`auth-password-next`,type:`password`,value:A,onChange:e=>j(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-password-confirm`,children:t(`authConfirmPassword`)}),(0,S.jsx)(p,{id:`auth-password-confirm`,type:`password`,value:M,onChange:e=>N(e.target.value),placeholder:t(`authConfirmPasswordPlaceholder`)})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,S.jsx)(a,{type:`button`,disabled:!I,onClick:()=>void R(),children:i.isPending?t(`authPasswordUpdating`):t(`authPasswordAction`)}),P.enabled&&P.authenticated?(0,S.jsx)(a,{type:`button`,variant:`outline`,disabled:v.isPending,onClick:()=>void B(),children:v.isPending?t(`authLoggingOut`):t(`authLogoutAction`)}):null]}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authSessionMemoryNotice`)})]})]})]}):(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(u,{className:`space-y-5`,children:[(0,S.jsxs)(`div`,{className:`rounded-xl border border-dashed border-gray-200 bg-gray-50/70 p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authSetupTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t(`authSetupDescription`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-setup-username`,children:t(`authUsername`)}),(0,S.jsx)(p,{id:`auth-setup-username`,value:y,onChange:e=>C(e.target.value),placeholder:t(`authUsernamePlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-setup-password`,children:t(`authPassword`)}),(0,S.jsx)(p,{id:`auth-setup-password`,type:`password`,value:E,onChange:e=>D(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-setup-confirm`,children:t(`authConfirmPassword`)}),(0,S.jsx)(p,{id:`auth-setup-confirm`,type:`password`,value:O,onChange:e=>k(e.target.value),placeholder:t(`authConfirmPasswordPlaceholder`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authPasswordMinLengthHint`)})]}),(0,S.jsx)(a,{type:`button`,disabled:!F,onClick:()=>void L(),children:n.isPending?t(`authSettingUp`):t(`authSetupAction`)})]})]})}function D(){return(0,S.jsxs)(v,{className:`space-y-6`,children:[(0,S.jsx)(y,{title:t(`authSecurityTitle`),description:t(`authSecurityDescription`)}),(0,S.jsx)(E,{})]})}export{D as SecurityConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r}from"./i18n-hM3v-3YG.js";import{o as i}from"./dist-RWNFhxvR.js";import{at as a,et as o,it as s,nt as c,rt as l,tt as u}from"./index-
|
|
1
|
+
import{_ as e,i as t,m as n,p as r}from"./i18n-hM3v-3YG.js";import{o as i}from"./dist-RWNFhxvR.js";import{at as a,et as o,it as s,nt as c,rt as l,tt as u}from"./index-DHmCjcxq.js";var d=e(n(),1),f=r(),p=({open:e,onOpenChange:n,title:r,description:d,confirmLabel:p=t(`confirm`),cancelLabel:m=t(`cancel`),variant:h=`default`,onConfirm:g,onCancel:_})=>(0,f.jsx)(o,{open:e,onOpenChange:n,children:(0,f.jsxs)(u,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,f.jsxs)(s,{children:[(0,f.jsx)(a,{children:r}),d?(0,f.jsx)(c,{children:d}):null]}),(0,f.jsxs)(l,{className:`gap-2 sm:gap-0`,children:[(0,f.jsx)(i,{type:`button`,variant:`outline`,onClick:()=>{_(),n(!1)},children:m}),(0,f.jsx)(i,{type:`button`,variant:h===`destructive`?`destructive`:`default`,onClick:()=>{g(),n(!1)},children:p})]})]})}),m={open:!1,title:``,description:``,confirmLabel:t(`confirm`),cancelLabel:t(`cancel`),variant:`default`,resolve:null};function h(){let[e,n]=(0,d.useState)(m),r=(0,d.useCallback)(e=>new Promise(r=>{n({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??t(`confirm`),cancelLabel:e.cancelLabel??t(`cancel`),variant:e.variant??`default`,resolve:e=>{r(e),n(e=>({...e,open:!1,resolve:null}))}})}),[]),i=(0,d.useCallback)(e=>{n(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:r,ConfirmDialog:(0,d.useCallback)(()=>(0,f.jsx)(p,{open:e.open,onOpenChange:i,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,i])}}export{h as t};
|
package/ui-dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>NextClaw</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-DHmCjcxq.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/i18n-hM3v-3YG.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/chunk-JZWAC4HX-CxfKRD7X.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/dist-RWNFhxvR.js">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./MarketplacePage-DE0QjYVv.js";export{e as MarketplacePage};
|