@xopcai/xopc 0.0.129 → 0.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/icons/icon-128.png +0 -0
- package/dist/browser-ext/icons/icon-16.png +0 -0
- package/dist/browser-ext/icons/icon-32.png +0 -0
- package/dist/browser-ext/icons/icon-48.png +0 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/apple-touch-icon.png +0 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DHzfg5D-.js → agent-avatar-dicebear-BJYeTxQ9.js} +1 -1
- package/dist/gateway/static/root/assets/agents-kVsY4Iz_.js +2 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-Bj8iJ-7d.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-bYeEj3IW.js → appearance-settings-6TjISbHB.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DC4YwXLL.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Dy6lsTHw.js → archive-plugin-2G62raBg.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-qOtBYR6Y.js → attachment-load-kLNJMEJh.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BFH-RfaV.js → automation-suggestion-card-CpcZSSD8.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-MZ8m4bYP.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DJvi_thc.js → binary-plugins-C_zSrWow.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DlMnizlt.js → block-editor-D_PMrT-l.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-C89wKfPd.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-CPFtajl7.js +1 -0
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dng8Grpv.js → capability-presets-settings-panel-DWw31-4v.js} +1 -1
- package/dist/gateway/static/root/assets/channel-recipient-api-BUi8syv2.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-DOYzcMAE.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DCE-PgQF.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-BYV16wez.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B-u63N4e.js → desktop-pet-settings-DGIaFqPR.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-8p1ehIHn.js → directory-picker-path-field-BEhDuShd.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-BIkgLFDH.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DJ1ABK95.js → extension-debug-page-BIjLZMAQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CP9P2lGM.js → extension-page-Cxv4Bgj5.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DNd0tRFl.js +1 -0
- package/dist/gateway/static/root/assets/fetch-Bl7zMnmd.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-BiqKIkkp.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D_Cvasqi.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CY5W2Pp4.js → gateway-startup-retry-CPOgTcpv.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-2lPbGfp3.js → goal-create-dialog-DZ68qzpm.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DF8QhTHH.js +4 -0
- package/dist/gateway/static/root/assets/goals-config-api-h26_-2Vm.js +1 -0
- package/dist/gateway/static/root/assets/goals-page-BzBKHZJg.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-BFG1uTI8.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-5vV8vTva.js +1 -0
- package/dist/gateway/static/root/assets/index-DOetFpTt.js +262 -0
- package/dist/gateway/static/root/assets/index-W4ogAiHt.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BrENZzM7.js → keyboard-shortcuts-settings-Dpx1ovO6.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-3QO3elfx.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-BYF4ReGM.js → markdown-split-Ba4EsPkV.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CpQDz-QJ.js → media-plugins-lA5rvtCq.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-YzjnURPJ.js → messages-Bq4REfIj.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-panel-BBG87CHZ.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-DrUGE-Hn.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-eAIE8iKV.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-RnYYOIWO.js → page-tabs-Cy7bX7Ce.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CTRt06Ri.js → preview-open-alternatives-B9_iql49.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cwct6pCV.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BXZlzV8t.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-C29EWM0P.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-c4pZeikq.js → save-bar-controls-nMloZ0mp.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cb6R7iuP.js → schedule-field-BuajpVNF.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BqET_hEP.js → schema-form-IeXV_yQk.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DHHVDqsy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-hDvmobsT.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-DuOvqNsI.js → settings-collapsible-section-ByixWwvu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DptSsbWd.js → settings-form-section-C-5-n-jM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BlVfBCb9.js → settings-loading-skeleton-CTA5Gje4.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DzqxeemF.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DVt69dJJ.js → settings-page-layout-DgFTf6nM.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-svpHcJ62.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-IOjU69FC.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-Ddg8gHPN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DcNOEJsK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DoonnYRs.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CW22OkZ4.js → system-settings-panel-BMDD7FXg.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BqpGAKxV.js → typed-models-lib-DayamJ56.js} +1 -1
- package/dist/gateway/static/root/assets/use-channel-catalog-ChYwFiqo.js +1 -0
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-CERVLuaW.js → user-profile-settings-panel-Dd0X3mPv.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-BnmysurA.js → utils-D9v9ZpK4.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-QXGvjTwa.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CP-5OUYI.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ci9GSPnS.js → workflow-run-setup-panel-IidqhbUI.js} +2 -2
- package/dist/gateway/static/root/assets/{workflow-start-dialog-BhDj8pqH.js → workflow-start-dialog-BQQkr8YD.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-DtVIjVSX.js +18 -0
- package/dist/gateway/static/root/favicon-16x16.png +0 -0
- package/dist/gateway/static/root/favicon-32x32.png +0 -0
- package/dist/gateway/static/root/favicon-icon.svg +23 -1
- package/dist/gateway/static/root/favicon.ico +0 -0
- package/dist/gateway/static/root/favicon.png +0 -0
- package/dist/gateway/static/root/favicon.svg +20 -24
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/gateway/static/root/logo-dark.svg +18 -23
- package/dist/gateway/static/root/logo.svg +18 -24
- package/dist/gateway/static/root/pwa-192x192.png +0 -0
- package/dist/gateway/static/root/pwa-512x512.png +0 -0
- package/dist/gateway/static/root/site.webmanifest +23 -0
- package/dist/package.js +1 -1
- package/dist/src/cli/commands/gateway/probe.js +6 -6
- package/dist/src/cli/commands/gateway/probe.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +2 -2
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/tui.js +11 -4
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/cli/utils/gateway-client-options.d.ts +3 -0
- package/dist/src/cli/utils/gateway-client-options.js +2 -1
- package/dist/src/cli/utils/gateway-client-options.js.map +1 -1
- package/dist/src/cli/utils/gateway-client.d.ts +6 -3
- package/dist/src/cli/utils/gateway-client.js +14 -8
- package/dist/src/cli/utils/gateway-client.js.map +1 -1
- package/dist/src/gateway/credential.d.ts +9 -0
- package/dist/src/gateway/credential.js +16 -0
- package/dist/src/gateway/credential.js.map +1 -0
- package/dist/src/gateway/hono/app.d.ts +0 -1
- package/dist/src/gateway/hono/app.js +2 -9
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/middleware/auth.d.ts +0 -2
- package/dist/src/gateway/hono/middleware/auth.js +46 -21
- package/dist/src/gateway/hono/middleware/auth.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +2 -27
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/server.js +1 -5
- package/dist/src/gateway/server.js.map +1 -1
- package/dist/src/mcp/channel-bridge.d.ts +2 -1
- package/dist/src/mcp/channel-bridge.js +10 -6
- package/dist/src/mcp/channel-bridge.js.map +1 -1
- package/dist/src/mcp/channel-server.d.ts +2 -1
- package/dist/src/mcp/channel-server.js +1 -1
- package/dist/src/mcp/channel-server.js.map +1 -1
- package/dist/src/mcp/gateway-http-client.d.ts +3 -2
- package/dist/src/mcp/gateway-http-client.js +9 -7
- package/dist/src/mcp/gateway-http-client.js.map +1 -1
- package/dist/src/tui/backends/gateway-sse-backend.d.ts +3 -2
- package/dist/src/tui/backends/gateway-sse-backend.js +45 -41
- package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +3 -2
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/tui/tui.js.map +1 -1
- package/package.json +5 -2
- package/dist/gateway/static/root/assets/agents-CMxKKFQD.js +0 -2
- package/dist/gateway/static/root/assets/app-management-settings-panel-ptk9c5BN.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DdZvDf5B.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-B8JTjkCr.js +0 -4
- package/dist/gateway/static/root/assets/browser-settings-page-slHLiZgi.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-D4q7vHVJ.js +0 -1
- package/dist/gateway/static/root/assets/channel-recipient-api-BrW5Kcgc.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-KIsISXw0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C5fx4Qs9.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-Jmdn6q47.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-CCkKP-I4.js +0 -3
- package/dist/gateway/static/root/assets/extension-settings-page-DnhU-tx0.js +0 -1
- package/dist/gateway/static/root/assets/fetch-BMjlW0g1.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-CjxDn46s.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-TING7224.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DHWVRafk.js +0 -4
- package/dist/gateway/static/root/assets/goals-config-api-BqhuxG8P.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-CMk-9ZYN.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-BHzOAU_l.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BQIm0P3V.js +0 -1
- package/dist/gateway/static/root/assets/index-C4k6QSXw.js +0 -257
- package/dist/gateway/static/root/assets/index-EKmpPvZj.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-BiL302Ve.js +0 -2
- package/dist/gateway/static/root/assets/models-hub-panel-CFPpl3Cq.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-BurgcdVZ.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-BAELRM_O.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-iXX1Ceo2.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-GDVTFAY7.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUrbUnwv.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CiOreA2k.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C-qvptlu.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-xQx2Pkg5.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DWB8VdLK.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-8m_ACH0z.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-CgxfhNxI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BBFUOxmf.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-bo695odu.js +0 -2
- package/dist/gateway/static/root/assets/url-DFGNSBNT.js +0 -1
- package/dist/gateway/static/root/assets/use-channel-catalog-CPdJ0o0i.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-Jr3jvPcB.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-B-8rex4u.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Brb3UGvs.js +0 -18
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{a as o,n as s,o as c}from"./fetch-Bl7zMnmd.js";import{n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$a as f,$n as p,$r as m,At as h,Ba as g,Dc as _,Do as v,Ec as y,El as b,Eo as x,Es as S,Fc as C,Fi as w,Fo as T,Ga as E,Ha as D,Ii as O,It as k,Jn as A,Kn as j,La as M,Li as N,Lt as P,Mi as F,Mo as I,Ni as L,Nt as ee,Oo as R,Ot as te,Pi as z,Po as ne,Qn as re,Qo as ie,Qr as B,Ra as V,Ri as H,Ro as U,S as ae,So as W,Tl as oe,Ua as se,Va as ce,Wa as le,Xn as ue,Xo as G,Xr as de,Xs as fe,Ya as pe,Yn as me,Ys as he,Zn as ge,Zr as _e,_o as ve,ai as ye,al as be,ao as xe,ar as Se,bs as Ce,co as K,cr as we,cs as Te,ei as Ee,er as De,es as Oe,gc as ke,gl as Ae,ha as q,io as je,ir as Me,ji as Ne,jt as Pe,ll as Fe,lo as Ie,lr as Le,ma as Re,ms as ze,n as Be,ni as Ve,no as He,oa as Ue,oo as J,or as We,pl as Ge,qn as Ke,rl as qe,ro as Je,rr as Ye,sl as Xe,so as Ze,t as Qe,tc as $e,ti as et,to as Y,tr as tt,vc as nt,vo as rt,wl as it,wo as X,x as at,xl as ot,za as st,zi as ct,zo as lt,zs as ut,zt as dt}from"./index-DOetFpTt.js";import{t as ft}from"./markdown-editor-jD1LPiP-.js";import{n as pt,t as mt}from"./settings-page-layout-DgFTf6nM.js";import{r as ht,t as gt}from"./settings-loading-skeleton-CTA5Gje4.js";import{n as _t,t as vt}from"./settings-form-section-C-5-n-jM.js";import{t as yt}from"./page-tabs-Cy7bX7Ce.js";import{n as bt}from"./agent-avatar-dicebear-BJYeTxQ9.js";import{n as xt,r as St,t as Ct}from"./channel-recipient-api-BUi8syv2.js";import{n as wt,r as Tt,t as Et}from"./utils-D9v9ZpK4.js";import{a as Dt,i as Ot,n as kt,o as At,t as jt}from"./typed-models-lib-DayamJ56.js";import{a as Mt,o as Nt,r as Pt,s as Ft}from"./capability-presets-api-CPFtajl7.js";import{t as It}from"./directory-picker-path-field-BEhDuShd.js";var Z=n(),Q=r();function Lt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ce,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=m):m=t[1];let h=o?f.purgeDisk:f.removeFromConfig,_;t[2]===h?_=t[3]:(_=(0,Q.jsx)(le,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=_);let v=o?f.confirmDeletePurge:f.confirmDelete,y;t[4]===v?y=t[5]:(y=(0,Q.jsx)(g,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(b=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(x=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=x):x=t[17];let S=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,C;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(C=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=C):C=t[22];let w=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:u,children:w}),t[23]=u,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let O;t[31]!==E||t[32]!==_||t[33]!==y||t[34]!==b?(O=(0,Q.jsxs)(D,{children:[p,(0,Q.jsxs)(st,{className:m,onOpenAutoFocus:Rt,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=O):O=t[35];let k;return t[36]!==r||t[37]!==n||t[38]!==O?(k=(0,Q.jsx)(se,{open:n,onOpenChange:r,children:O}),t[36]=r,t[37]=n,t[38]=O,t[39]=k):k=t[39],k}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=[{id:`overview`,labelKey:`navOverview`,icon:ke},{id:`behavior`,labelKey:`navBehavior`,icon:ie},{id:`tools`,labelKey:`navTools`,icon:R},{id:`skills`,labelKey:`navSkills`,icon:x},{id:`memory`,labelKey:`navMemory`,icon:be},{id:`connections`,labelKey:`navConnections`,icon:qe},{id:`config`,labelKey:`navConfig`,icon:Oe},{id:`dangerZone`,labelKey:`navDangerZone`,icon:U}];function Bt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,rt.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=zt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Vt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:h}=e,_=p===void 0?!0:p,[y,b]=(0,$.useState)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(ce,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,je)}),t[0]=x):x=t[0];let S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,Je,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=S):S=t[1];let C;t[2]===o?C=t[3]:(C=(0,Q.jsx)(le,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=C);let w;t[4]===s?w=t[5]:(w=(0,Q.jsx)(g,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=w);let T;t[6]!==C||t[7]!==w?(T=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[C,w]}),t[6]=C,t[7]=w,t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=i(ve,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=E):E=t[9];let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[10]=O):O=t[10];let k;t[11]===a.closeDialogAria?k=t[12]:(k=(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:E,"aria-label":a.closeDialogAria,children:O})}),t[11]=a.closeDialogAria,t[12]=k);let A;t[13]!==T||t[14]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[T,k]}),t[13]=T,t[14]=k,t[15]=A):A=t[15];let j;t[16]!==a||t[17]!==l||t[18]!==c?(j=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(Bt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=j):j=t[19];let M;t[20]===h?M=t[21]:(M=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=M);let N;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==_?(N=_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(X,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=_,t[30]=N):N=t[30];let P;t[31]!==M||t[32]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[M,N]}),t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;t[34]!==j||t[35]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[j,P]}),t[34]=j,t[35]=P,t[36]=F):F=t[36];let I;t[37]!==y||t[38]!==F||t[39]!==A?(I=(0,Q.jsxs)(D,{children:[x,(0,Q.jsx)(st,{ref:b,className:S,onOpenAutoFocus:Ht,children:(0,Q.jsxs)(He,{layer:`modal`,portalContainer:y,children:[A,F]})})]}),t[37]=y,t[38]=F,t[39]=A,t[40]=I):I=t[40];let L;return t[41]!==r||t[42]!==n||t[43]!==I?(L=(0,Q.jsx)(se,{open:n,onOpenChange:r,children:I}),t[41]=r,t[42]=n,t[43]=I,t[44]=L):L=t[44],L}function Ht(e){return e.preventDefault()}var Ut=e=>s(e);function Wt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Gt(e){let t=Wt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Kt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`article`,{className:`px-4 py-3`,"aria-hidden":`true`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(q,{className:`h-3 w-16`}),(0,Q.jsx)(q,{className:`h-3 w-20`}),(0,Q.jsx)(q,{className:`h-3 w-24`})]}),(0,Q.jsx)(q,{className:`mt-3 h-4 w-full`}),(0,Q.jsx)(q,{className:`mt-2 h-4 w-5/6`}),(0,Q.jsx)(q,{className:`mt-2 h-4 w-2/3`})]}),e[0]=t):t=e[0],t}function qt({embedded:e=!1,agentId:t}){let n=a(l(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[o,u]=(0,$.useState)(``),[p,m]=(0,$.useState)(``),[h,g]=(0,$.useState)({}),[_,v]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:y,isLoading:b}=d(c(`/api/memory/providers`),Ut),{data:x,isLoading:S,mutate:C}=d(c(`/api/memory/records?status=active&limit=80`),Ut),{data:w,isLoading:T,mutate:E}=d(c(`/api/memory/records?status=candidate&limit=80`),Ut),{data:D,isLoading:O}=d(c(`/api/memory/signals?limit=50`),Ut),{data:k,isLoading:A,mutate:j}=d(c(`/api/memory/traces?limit=80`),Ut),{data:M,isLoading:N}=d(c(`/api/memory/feedback-summary?limit=1000`),Ut),{data:P,isLoading:F,mutate:I}=d(c(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Ut),{data:L,isLoading:ee}=d(o?c(`/api/memory/search`):null,e=>s(e,{method:`POST`,body:JSON.stringify({query:o,maxResults:20})})),R=L?.results.map(e=>({...e.record,score:e.score}))??x?.records??[],te=y?.providers.length??0,z=x?.records.length??0,ne=w?.records.length??0,re=D?.signals.length??0,ie=k?.traces.length??0,B=M?.summaries??[],V=b||S||T||O||A||N||F,H=(0,$.useMemo)(()=>new Map(B.map(e=>[e.recordId,e])),[B]),U=B.reduce((e,t)=>e+t.total,0),ae=B.reduce((e,t)=>e+t.helpful,0),W=U>0?Math.round(ae/U*100):null,oe=(0,$.useMemo)(()=>[{label:n.providers,value:te},{label:n.records,value:z},{label:n.inbox,value:ne},{label:n.signals,value:re},{label:n.traceEvents,value:ie},{label:n.recallQuality,value:W==null?`—`:`${W}%`}],[ne,W,te,z,re,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,ie]);(0,$.useEffect)(()=>{let e=P?.memory.providerRouting;e&&v({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[P]);async function se(){if(P){m(n.saving);try{await s(c(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:P.agentId,memory:{...P.memory,providerRouting:_}})}),await I(),m(n.saved)}catch(e){m(e instanceof Error?e.message:n.saveFailed)}}}async function ce(e){g(t=>({...t,[e]:n.testing}));try{let t=(await s(c(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);g(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),j()}catch(t){g(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function le(e,t){await s(c(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([E(),C()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:oe.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),V?(0,Q.jsx)(q,{className:`mt-2 h-7 w-16`}):(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providerPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(f,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:_.searchStrategy,onChange:e=>v(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(f,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:_.writeStrategy,onChange:e=>v(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:_.allowExternalWrites,onChange:e=>v(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:b?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(q,{className:`h-10 w-28 rounded-md`},t)):(y?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:_.allowedProviderIds?.includes(e.id)??!1,onChange:t=>v(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`primary`,onClick:se,children:n.savePolicy}),p?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:p}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:ne})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[T?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(w?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`primary`,onClick:()=>le(e.id,`active`),children:n.approve}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>le(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>le(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),!T&&ne===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),u(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(X,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:o?`${n.searchResults}${ee?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[ee||S&&!o?Array.from({length:5}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):R.map(e=>{let t=H.get(e.id),r=Wt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Gt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),!S&&!ee&&R.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:b?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(y?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>ce(e.id),children:n.test}),h[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[N?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):B.slice(0,8).map(e=>{let t=(x?.records??[]).find(t=>t.id===e.recordId),r=Wt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Gt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),!N&&B.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:O?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(D?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:A?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(k?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Jt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Yt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,m=d?r||l.unset:a,h=p?i||l.unset:o,g;t[5]!==l.subtitle||t[6]!==l.title?(g=(0,Q.jsx)(_t,{icon:fe,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=g):g=t[7];let _=d?`inherit`:`override`,v;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(v=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=v):v=t[11];let y;t[12]!==m||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==_||t[18]!==v?(y=(0,Q.jsx)(Jt,{label:l.modelLabel,mode:_,value:m,inheritedFrom:v,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=m,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=p?`inherit`:`override`,x;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(x=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=x):x=t[23];let S;t[24]!==h||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==b||t[30]!==x?(S=(0,Q.jsx)(Jt,{label:l.workspaceLabel,mode:b,value:h,inheritedFrom:x,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=h,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=b,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==y||t[33]!==S?(C=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[y,S]}),t[32]=y,t[33]=S,t[34]=C):C=t[34];let w;return t[35]!==g||t[36]!==C?(w=(0,Q.jsxs)(vt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Xt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Zt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,a&&`bg-surface-base text-fg-muted`,!e&&!a&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function Qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Zt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function $t(e,t){return e&&e.length>0?e.join(`, `):t}function en(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>p(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let m=f,h;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==m){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(nn),i=Object.entries(u?.tools?.builtin??{}).sort(tn),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(_t,{icon:he,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],h=(0,Q.jsxs)(vt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:m.length?m.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Xt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.model,monoValue:!0,source:Xt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.mode,source:Xt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:a?.mode??`all`,source:Xt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Qt,{name:`allow`,value:$t(a.allow,`—`),source:Xt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Qt,{name:`deny`,value:$t(a.deny,`—`),source:Xt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:o?.mode??`off`,source:Xt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Qt,{name:`sources`,value:$t(o?.sources,`—`),source:Xt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`requiresConfirmation`,value:$t(d?.requiresConfirmation,`—`),source:Xt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`forbidden`,value:$t(d?.forbidden,`—`),source:Xt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`escalation`,value:$t(d?.escalation,`—`),source:Xt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=m,t[26]=h}else h=t[26];return h}function tn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function nn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function rn(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function an(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function on(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)(an,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)(an,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)(an,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(sn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(cn,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(dn,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function sn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(rn,{children:(0,Q.jsx)(Yt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function cn(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(un)),t[0]=a,t[1]=u);let d=u,p;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(p=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=p):p=t[6];let m=p,h,g,v,y,b;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==m.description||t[21]!==m.id||t[22]!==m.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(ln).filter(e=>e!==l&&!o.includes(e)),p=u[0]??``;g=rn,h=vt;let x;t[34]===c?x=t[35]:(x=()=>c(``),t[34]=c,t[35]=x);let S;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t[36]=S):S=t[36];let C;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==x?(C=(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:x,children:[S,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=x,t[40]=C):C=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==C?(v=(0,Q.jsx)(_t,{icon:ie,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:C}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=C,t[44]=v):v=t[44];let w;t[45]!==m.id||t[46]!==c?(w=()=>c(m.id),t[45]=m.id,t[46]=c,t[47]=w):w=t[47];let T=m.name||n.capabilityPresetsGlobalDefault,E;t[48]===T?E=t[49]:(E=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:T}),t[48]=T,t[49]=E);let D;t[50]===n.capabilityPresetsGlobalDefault?D=t[51]:(D=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=D);let O;t[52]!==E||t[53]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[E,D]}),t[52]=E,t[53]=D,t[54]=O):O=t[54];let k;t[55]===m.id?k=t[56]:(k=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:m.id}),t[55]=m.id,t[56]=k);let A=m.description||n.capabilityPresetsGlobalDefaultHint,j;t[57]===A?j=t[58]:(j=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:A}),t[57]=A,t[58]=j);let M;t[59]!==w||t[60]!==O||t[61]!==k||t[62]!==j?(M=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-accent-soft/20 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:w,children:[O,k,j]})}),t[59]=w,t[60]=O,t[61]=k,t[62]=j,t[63]=M):M=t[63],y=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[M,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(Ge,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),b=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(f,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:p,children:u.map(e=>(0,Q.jsx)(Y,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i||!p,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||p;t&&s([...o,t])},children:[(0,Q.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=m.description,t[21]=m.id,t[22]=m.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=h,t[28]=g,t[29]=v,t[30]=y,t[31]=b}else h=t[27],g=t[28],v=t[29],y=t[30],b=t[31];let x;t[64]!==h||t[65]!==v||t[66]!==y||t[67]!==b?(x=(0,Q.jsxs)(h,{children:[v,y,b]}),t[64]=h,t[65]=v,t[66]=y,t[67]=b,t[68]=x):x=t[68];let S;return t[69]!==g||t[70]!==x?(S=(0,Q.jsx)(g,{children:x}),t[69]=g,t[70]=x,t[71]=S):S=t[71],S}function ln(e){return e.id}function un(e){return[e.id,e]}function dn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(rn,{children:(0,Q.jsx)(en,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function fn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(rn,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:U,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(vt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(_t,{icon:U,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(lt,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var pn=i(W,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function mn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:p,setNewBindChannel:m,bindSessionChats:h,sessionsLoading:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:y,setNewBindCustomPeer:b,onRefreshSessions:x,lastActiveLabels:S,selectRecipient:C}=e,w=!u&&(d||l.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,Q.jsx)(_t,{className:`shrink-0`,icon:fe,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s?(E=a?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(hn)}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:Tt(e.match)}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${Tt(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=E):E=t[9];let D;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==p||t[16]!==m||t[17]!==b||t[18]!==v||t[19]!==d?(D=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(q,{className:`h-4 w-24`}),(0,Q.jsx)(q,{className:`h-10 w-full rounded-lg`})]}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Et(),value:p,onChange:e=>m(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(f,{className:i(Et(),`py-2`),value:p,onChange:e=>{m(e.target.value),v(null),b(``)},children:l.map(e=>(0,Q.jsxs)(Y,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[10]=n.channelLabel,t[11]=n.channelsDisabledSuffix,t[12]=n.channelsManualChannelHint,t[13]=l,t[14]=u,t[15]=p,t[16]=m,t[17]=b,t[18]=v,t[19]=d,t[20]=D):D=t[20];let O;t[21]!==n.channelsCustomPeerHint||t[22]!==n.channelsCustomPeerPlaceholder||t[23]!==n.channelsNoSessionsHint||t[24]!==n.channelsPeerAny||t[25]!==n.channelsPeerFromSessions||t[26]!==n.channelsRefreshSessions||t[27]!==n.channelsRefreshSessionsHint||t[28]!==n.channelsSessionLabel||t[29]!==n.peerIdLabel||t[30]!==h||t[31]!==r||t[32]!==S||t[33]!==p||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==C||t[38]!==g||t[39]!==b||t[40]!==v||t[41]!==w?(O=w&&p.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!p.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>x(),children:[(0,Q.jsx)(ze,{className:i(`size-3.5`,g&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),g&&h.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(q,{className:`h-4 w-32`}),(0,Q.jsx)(q,{className:`h-10 w-full rounded-lg`})]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(f,{className:i(Et(),`py-2`),value:_==null?``:String(_),disabled:r||!p.trim()||!!y.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(Y,{value:``,children:n.channelsPeerAny}),h.map((e,t)=>(0,Q.jsx)(Y,{value:String(t),children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),h.length===0&&p.trim()&&!g?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Et(),`min-w-0 w-full sm:flex-1`),value:y,onChange:e=>{b(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(f,{className:pn,value:y,onChange:e=>{let t=e.target.value;b(t||``),v(null)},children:[(0,Q.jsx)(Y,{value:``,children:C}),h.map(e=>(0,Q.jsx)(Y,{value:e.chatId,children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[21]=n.channelsCustomPeerHint,t[22]=n.channelsCustomPeerPlaceholder,t[23]=n.channelsNoSessionsHint,t[24]=n.channelsPeerAny,t[25]=n.channelsPeerFromSessions,t[26]=n.channelsRefreshSessions,t[27]=n.channelsRefreshSessionsHint,t[28]=n.channelsSessionLabel,t[29]=n.peerIdLabel,t[30]=h,t[31]=r,t[32]=S,t[33]=p,t[34]=y,t[35]=_,t[36]=x,t[37]=C,t[38]=g,t[39]=b,t[40]=v,t[41]=w,t[42]=O):O=t[42];let k;t[43]!==r||t[44]!==u||t[45]!==p?(k=r||!p.trim()||u,t[43]=r,t[44]=u,t[45]=p,t[46]=k):k=t[46];let A;t[47]!==n.addBinding||t[48]!==k?(A=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(X,{type:`submit`,disabled:k,children:n.addBinding})}),t[47]=n.addBinding,t[48]=k,t[49]=A):A=t[49];let j;t[50]!==c||t[51]!==D||t[52]!==O||t[53]!==A?(j=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[D,O,A]}),t[50]=c,t[51]=D,t[52]=O,t[53]=A,t[54]=j):j=t[54];let M;return t[55]!==T||t[56]!==E||t[57]!==j?(M=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,j]}),t[55]=T,t[56]=E,t[57]=j,t[58]=M):M=t[58],M}function hn(e,t){return(0,Q.jsx)(q,{className:`h-10 rounded-lg`},t)}function gn(e){let t=(0,Z.c)(32),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:s,filesViewMode:c,setFilesViewMode:l,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=u(_n),v;t[0]!==n.missing||t[1]!==a?.files?(v=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=v):v=t[2];let b=v,x;t[3]===n.filesHint?x=t[4]:(x=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=x);let S;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==b||t[18]!==a||t[19]!==r||t[20]!==c||t[21]!==_||t[22]!==g||t[23]!==h||t[24]!==m||t[25]!==s||t[26]!==f||t[27]!==l?(S=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:b,activeTab:o??``,onChange:s,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,rt.press,c===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(G,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,rt.press,c===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(y,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(ut,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),c===`edit`?(0,Q.jsx)(`div`,{className:i(Et(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Et(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ye,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=b,t[18]=a,t[19]=r,t[20]=c,t[21]=_,t[22]=g,t[23]=h,t[24]=m,t[25]=s,t[26]=f,t[27]=l,t[28]=S):S=t[28];let C;return t[29]!==x||t[30]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[x,S]}),t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function _n(e){return e.resolved===`dark`}function vn(e){let t=(0,Z.c)(66),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(_t,{className:`shrink-0`,icon:$e,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=kt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=kt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=y):y=t[39];let b;t[40]!==a||t[41]!==r||t[42]!==o||t[43]!==i.typedModels.defaultRole||t[44]!==s||t[45]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ft,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[40]=a,t[41]=r,t[42]=o,t[43]=i.typedModels.defaultRole,t[44]=s,t[45]=y,t[46]=b):b=t[46];let x;t[47]!==n.modelsSave||t[48]!==a||t[49]!==u||t[50]!==c?(x=u?null:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[47]=n.modelsSave,t[48]=a,t[49]=u,t[50]=c,t[51]=x):x=t[51];let S;t[52]===l?S=t[53]:(S=()=>void l(),t[52]=l,t[53]=S);let C;t[54]!==n.modelsResetInherit||t[55]!==a||t[56]!==S?(C=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[54]=n.modelsResetInherit,t[55]=a,t[56]=S,t[57]=C):C=t[57];let w;t[58]!==x||t[59]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[58]=x,t[59]=C,t[60]=w):w=t[60];let T;return t[61]!==d||t[62]!==w||t[63]!==v||t[64]!==b?(T=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,w]}),t[61]=d,t[62]=w,t[63]=v,t[64]=b,t[65]=T):T=t[65],T}function yn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function bn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=H(n.trim());return e&&N(e.styleId)?e.styleId:z[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await me(t)}catch{}r(O(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await Le(t,n),ct(t),r(w)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),_=(e,t)=>{let r=H(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void g(e)}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,L[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,rt.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:yn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[L.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,rt.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(K,{open:f,onOpenChange:p,children:[(0,Q.jsx)(Ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,rt.press),children:a.avatarMore})}),(0,Q.jsx)(Ze,{children:(0,Q.jsxs)(J,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:yn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:F.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,rt.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(Ne,{agentId:t,avatar:n,size:40}),n.trim()&&!H(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function xn(e){let t=(0,Z.c)(206),{a:n,chat:r,selected:a,busy:o,editName:s,setEditName:c,editDescription:d,setEditDescription:p,editWorkspace:m,setEditWorkspace:h,editModel:_,setEditModel:b,onSetDefault:x,onSetTuiDefault:w,isTuiDefault:T,isTuiDefaultInherited:E,onSaveAgentEdits:O,hideInlineSave:k,profileMarkdownLoading:A,profileDraft:j,updateIdentity:M,handleSoulTemplateChange:N,handleSoulContentChange:P,setAvatarDialogOpen:F,toggleSoulPreviewMode:L,onTryInChat:R}=e,z=l(wn),ne=u(Cn),re;t[0]===j?.identity?re=t[1]:(re=j?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=j?.identity,t[1]=re);let B=re,H=j?.soulTemplate??`professional`,U=j?.soulCustomContent??``,ae=j?.soulEditorNonce??0,W=j?.soulPreviewMode??!1,oe=j?.avatarDialogOpen??!1,ue;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ue=Et(),t[2]=ue):ue=t[2];let G=ue,de;t[3]===z?de=t[4]:(de=(e,t)=>z===`zh`?t:e,t[3]=z,t[4]=de);let fe=de;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let pe;t[7]!==B.avatar||t[8]!==a.id?(pe=(0,Q.jsx)(Ne,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=B.avatar,t[8]=a.id,t[9]=pe):pe=t[9];let me;t[10]===F?me=t[11]:(me=()=>F(!0),t[10]=F,t[11]=me);let he;t[12]!==n.avatarOpenSettingsAria||t[13]!==me?(he={onClick:me,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=me,t[14]=he):he=t[14];let ge;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==T||t[19]!==E||t[20]!==a.isDefault?(ge=a.isDefault||T?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,T?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:E?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=T,t[19]=E,t[20]=a.isDefault,t[21]=ge):ge=t[21];let _e;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==o||t[25]!==T||t[26]!==x||t[27]!==w||t[28]!==a.isDefault?(_e=!a.isDefault||!T?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void x(),children:n.setDefault}),T?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void w(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=o,t[25]=T,t[26]=x,t[27]=w,t[28]=a.isDefault,t[29]=_e):_e=t[29];let be;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==pe||t[33]!==he||t[34]!==ge||t[35]!==_e?(be=(0,Q.jsx)(_t,{icon:ie,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:pe,iconInteractive:he,titleAccessory:ge,trailing:_e}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=pe,t[33]=he,t[34]=ge,t[35]=_e,t[36]=be):be=t[36];let xe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(ce,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,je)}),t[37]=xe):xe=t[37];let Se;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Se=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,Je),t[38]=Se):Se=t[38];let Ce;t[39]===n.avatarPickerTitle?Ce=t[40]:(Ce=(0,Q.jsx)(le,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=Ce);let K;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(K=i(ve,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=K):K=t[41];let we;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[42]=we):we=t[42];let Te;t[43]===n.closeDialogAria?Te=t[44]:(Te=(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:K,"aria-label":n.closeDialogAria,children:we})}),t[43]=n.closeDialogAria,t[44]=Te);let Ee;t[45]!==Ce||t[46]!==Te?(Ee=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[Ce,Te]}),t[45]=Ce,t[46]=Te,t[47]=Ee):Ee=t[47];let De;t[48]===n.avatarRowHint?De=t[49]:(De=(0,Q.jsx)(g,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=De);let Oe;t[50]===M?Oe=t[51]:(Oe=e=>M({avatar:e}),t[50]=M,t[51]=Oe);let ke;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==Oe?(ke=(0,Q.jsx)(bn,{agentId:a.id,value:B.avatar,onChange:Oe,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=Oe,t[56]=ke):ke=t[56];let Ae;t[57]!==Ee||t[58]!==De||t[59]!==ke?(Ae=(0,Q.jsxs)(D,{children:[xe,(0,Q.jsxs)(st,{className:Se,onOpenAutoFocus:Sn,children:[Ee,De,ke]})]}),t[57]=Ee,t[58]=De,t[59]=ke,t[60]=Ae):Ae=t[60];let q;t[61]!==oe||t[62]!==F||t[63]!==Ae?(q=(0,Q.jsx)(se,{open:oe,onOpenChange:F,children:Ae}),t[61]=oe,t[62]=F,t[63]=Ae,t[64]=q):q=t[64];let Me;t[65]===n.displayName?Me=t[66]:(Me=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=Me);let Fe;t[67]!==c||t[68]!==M?(Fe=e=>{c(e.target.value),M({name:e.target.value})},t[67]=c,t[68]=M,t[69]=Fe):Fe=t[69];let Ie;t[70]!==n.personaNamePlaceholder||t[71]!==s||t[72]!==Fe?(Ie=(0,Q.jsx)(`input`,{className:G,value:s,onChange:Fe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=s,t[72]=Fe,t[73]=Ie):Ie=t[73];let Le;t[74]!==Me||t[75]!==Ie?(Le=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Me,Ie]}),t[74]=Me,t[75]=Ie,t[76]=Le):Le=t[76];let Re;t[77]===n.personaEmoji?Re=t[78]:(Re=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Re);let ze;t[79]===M?ze=t[80]:(ze=e=>M({emoji:e.target.value}),t[79]=M,t[80]=ze);let Be;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==ze?(Be=(0,Q.jsx)(`input`,{className:G,value:B.emoji,onChange:ze,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=ze,t[84]=Be):Be=t[84];let Ve;t[85]!==Re||t[86]!==Be?(Ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Re,Be]}),t[85]=Re,t[86]=Be,t[87]=Ve):Ve=t[87];let He;t[88]===n.agentDescription?He=t[89]:(He=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=He);let Ue;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=i(G,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Ue):Ue=t[90];let J;t[91]!==p||t[92]!==M?(J=e=>{p(e.target.value),M({description:e.target.value})},t[91]=p,t[92]=M,t[93]=J):J=t[93];let We;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==J?(We=(0,Q.jsx)(`textarea`,{className:Ue,value:d,onChange:J,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=J,t[97]=We):We=t[97];let Ge;t[98]!==He||t[99]!==We?(Ge=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[He,We]}),t[98]=He,t[99]=We,t[100]=Ge):Ge=t[100];let Ke;t[101]===n.personaCreature?Ke=t[102]:(Ke=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Ke);let qe;t[103]===B.creature?qe=t[104]:(qe=Pe.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=qe);let Ye;t[105]===M?Ye=t[106]:(Ye=e=>{if(e.target.value===`__custom__`){M({creature:``});return}M({creature:e.target.value})},t[105]=M,t[106]=Ye);let Xe;t[107]===fe?Xe=t[108]:(Xe=Pe.map(e=>(0,Q.jsx)(Y,{value:e.value,children:fe(e.labelEn,e.labelZh)},e.value)),t[107]=fe,t[108]=Xe);let Ze;t[109]===fe?Ze=t[110]:(Ze=fe(`Custom…`,`自定义…`),t[109]=fe,t[110]=Ze);let Qe;t[111]===Ze?Qe=t[112]:(Qe=(0,Q.jsx)(Y,{value:`__custom__`,children:Ze}),t[111]=Ze,t[112]=Qe);let $e;t[113]!==qe||t[114]!==Ye||t[115]!==Xe||t[116]!==Qe?($e=(0,Q.jsxs)(f,{className:G,value:qe,onChange:Ye,children:[Xe,Qe]}),t[113]=qe,t[114]=Ye,t[115]=Xe,t[116]=Qe,t[117]=$e):$e=t[117];let et;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==M?(et=Pe.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(G,`mt-1 text-xs`),value:B.creature,onChange:e=>M({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=M,t[121]=et):et=t[121];let tt;t[122]!==Ke||t[123]!==$e||t[124]!==et?(tt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ke,$e,et]}),t[122]=Ke,t[123]=$e,t[124]=et,t[125]=tt):tt=t[125];let nt;t[126]!==Le||t[127]!==Ve||t[128]!==Ge||t[129]!==tt?(nt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Le,Ve,Ge,tt]}),t[126]=Le,t[127]=Ve,t[128]=Ge,t[129]=tt,t[130]=nt):nt=t[130];let it;t[131]!==q||t[132]!==nt||t[133]!==be?(it=(0,Q.jsxs)(vt,{children:[be,q,nt]}),t[131]=q,t[132]=nt,t[133]=be,t[134]=it):it=t[134];let at;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(at=(0,Q.jsx)(_t,{icon:C,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=at):at=t[137];let ot;t[138]===n.modelPrimary?ot=t[139]:(ot=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=ot);let ct;t[140]===b?ct=t[141]:(ct=e=>b(e),t[140]=b,t[141]=ct);let lt;t[142]!==o||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==_||t[147]!==ct?(lt=(0,Q.jsx)(te,{className:`min-w-0 flex-1`,value:_,disabled:o,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:ct}),t[142]=o,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=_,t[147]=ct,t[148]=lt):lt=t[148];let dt;t[149]!==n.modelClear||t[150]!==o||t[151]!==_||t[152]!==b?(dt=_.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>b(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=o,t[151]=_,t[152]=b,t[153]=dt):dt=t[153];let pt;t[154]!==lt||t[155]!==dt?(pt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[lt,dt]}),t[154]=lt,t[155]=dt,t[156]=pt):pt=t[156];let mt;t[157]!==ot||t[158]!==pt?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ot,pt]}),t[157]=ot,t[158]=pt,t[159]=mt):mt=t[159];let gt;t[160]===n.workspacePath?gt=t[161]:(gt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=gt);let yt=r.workingDirectory,bt=r.workingDirectory.notSet,xt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(xt=i(G,`font-mono text-xs`),t[162]=xt):xt=t[162];let St;t[163]!==o||t[164]!==r.workingDirectory||t[165]!==m||t[166]!==h?(St=(0,Q.jsx)(It,{value:m,onChange:h,disabled:o,wd:yt,placeholder:bt,inputClassName:xt}),t[163]=o,t[164]=r.workingDirectory,t[165]=m,t[166]=h,t[167]=St):St=t[167];let Ct;t[168]!==gt||t[169]!==St?(Ct=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[gt,St]}),t[168]=gt,t[169]=St,t[170]=Ct):Ct=t[170];let wt;t[171]!==mt||t[172]!==Ct?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[mt,Ct]}),t[171]=mt,t[172]=Ct,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==o||t[177]!==k||t[178]!==O||t[179]!==R?(Tt=k?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,disabled:o,onClick:()=>void O(),children:n.save}),R?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:o,onClick:R,children:[(0,Q.jsx)(ut,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=o,t[177]=k,t[178]=O,t[179]=R,t[180]=Tt):Tt=t[180];let Dt;t[181]!==at||t[182]!==wt||t[183]!==Tt?(Dt=(0,Q.jsxs)(vt,{children:[at,wt,Tt]}),t[181]=at,t[182]=wt,t[183]=Tt,t[184]=Dt):Dt=t[184];let Ot;t[185]!==n.personaSectionSoul||t[186]!==n.personaSectionSoulHint||t[187]!==n.personaSoulCustomEdit||t[188]!==n.personaSoulEdit||t[189]!==n.personaSoulPreview||t[190]!==n.personaSoulTemplate||t[191]!==P||t[192]!==N||t[193]!==ne||t[194]!==fe||t[195]!==A||t[196]!==U||t[197]!==ae||t[198]!==W||t[199]!==H||t[200]!==L?(Ot=A?(0,Q.jsx)(ht,{rows:2}):(0,Q.jsxs)(vt,{children:[(0,Q.jsx)(_t,{icon:I,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:ee.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,rt.pressCard,H===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>N(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:fe(e.labelEn,e.labelZh)})]},e.id))})]}),H===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(ve,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:W?n.personaSoulEdit:n.personaSoulPreview,"aria-label":W?n.personaSoulEdit:n.personaSoulPreview,onClick:L,children:W?(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(y,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(G,`flex min-h-64 flex-col overflow-hidden p-0`),children:W?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(ye,{content:U})}):(0,Q.jsx)(ft,{initialContent:U,onChange:P,isDark:ne,className:`min-h-0 flex-1`},`soul-${ae}`)})]}):null]}),t[185]=n.personaSectionSoul,t[186]=n.personaSectionSoulHint,t[187]=n.personaSoulCustomEdit,t[188]=n.personaSoulEdit,t[189]=n.personaSoulPreview,t[190]=n.personaSoulTemplate,t[191]=P,t[192]=N,t[193]=ne,t[194]=fe,t[195]=A,t[196]=U,t[197]=ae,t[198]=W,t[199]=H,t[200]=L,t[201]=Ot):Ot=t[201];let kt;return t[202]!==it||t[203]!==Dt||t[204]!==Ot?(kt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[it,Dt,Ot]}),t[202]=it,t[203]=Dt,t[204]=Ot,t[205]=kt):kt=t[205],kt}function Sn(e){return e.preventDefault()}function Cn(e){return e.resolved===`dark`}function wn(e){return e.language}function Tn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function En(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Dn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=Ke(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=j(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,g;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(g=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=g):g=t[9];let _=g,v;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(v=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=v):v=t[13];let y=v,b=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,x=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.tools.effectiveDisable.length,C=r.skills.effectiveAllowlist?.length,w;t[14]!==r.avatar||t[15]!==r.id?(w=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(Ne,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=w):w=t[16];let T;t[17]===p?T=t[18]:(T=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=T);let E;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(E=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=E):E=t[21];let D;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(D=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=D):D=t[26];let O;t[27]!==T||t[28]!==E||t[29]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[T,E,D]}),t[27]=T,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k;t[31]===r.id?k=t[32]:(k=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=k);let A;t[33]!==k||t[34]!==O?(A=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[O,k]}),t[33]=k,t[34]=O,t[35]=A):A=t[35];let M;t[36]!==A||t[37]!==w?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[w,A]}),t[36]=A,t[37]=w,t[38]=M):M=t[38];let N;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(N=d?(0,Q.jsxs)(X,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=N):N=t[42];let P;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(P=r.isDefault?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=P):P=t[47];let F;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(F=o?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=F):F=t[52];let I;t[53]!==N||t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[N,P,F]}),t[53]=N,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==M||t[58]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[M,I]}),t[57]=M,t[58]=I,t[59]=L):L=t[59];let ee;t[60]===h?ee=t[61]:(ee=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=ee);let te;t[62]!==L||t[63]!==ee?(te=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[L,ee]})}),t[62]=L,t[63]=ee,t[64]=te):te=t[64];let z;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(z=(0,Q.jsx)(_t,{icon:ie,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=z):z=t[67];let ne;t[68]!==n.modelPrimary||t[69]!==b||t[70]!==_?(ne=(0,Q.jsx)(Tn,{label:n.modelPrimary,value:_,badge:b,mono:!0}),t[68]=n.modelPrimary,t[69]=b,t[70]=_,t[71]=ne):ne=t[71];let re;t[72]!==n.workspacePath||t[73]!==x||t[74]!==y?(re=(0,Q.jsx)(Tn,{label:n.workspacePath,value:y,badge:x,mono:!0}),t[72]=n.workspacePath,t[73]=x,t[74]=y,t[75]=re):re=t[75];let B;t[76]!==ne||t[77]!==re?(B=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ne,re]}),t[76]=ne,t[77]=re,t[78]=B):B=t[78];let V;t[79]!==z||t[80]!==B?(V=(0,Q.jsxs)(vt,{children:[z,B]}),t[79]=z,t[80]=B,t[81]=V):V=t[81];let H;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(H=(0,Q.jsx)(_t,{icon:Xe,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=H):H=t[84];let U;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==S?(U=S>0?n.listToolsDisabledCount.replace(`{{count}}`,String(S)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=S,t[88]=U):U=t[88];let ae;t[89]!==n.listToolsLabel||t[90]!==U?(ae=(0,Q.jsx)(En,{icon:R,label:n.listToolsLabel,value:U}),t[89]=n.listToolsLabel,t[90]=U,t[91]=ae):ae=t[91];let W;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==C?(W=C?n.listSkillsCount.replace(`{{count}}`,String(C)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=C,t[95]=W):W=t[95];let oe;t[96]!==n.listSkillsLabel||t[97]!==W?(oe=(0,Q.jsx)(En,{icon:ie,label:n.listSkillsLabel,value:W}),t[96]=n.listSkillsLabel,t[97]=W,t[98]=oe):oe=t[98];let se;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(se=(0,Q.jsx)(En,{icon:be,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=se):se=t[101];let ce;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(ce=(0,Q.jsx)(En,{icon:qe,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=ce):ce=t[104];let le;t[105]!==n.listWorkspaceLabel||t[106]!==y?(le=(0,Q.jsx)(En,{icon:nt,label:n.listWorkspaceLabel,value:y}),t[105]=n.listWorkspaceLabel,t[106]=y,t[107]=le):le=t[107];let ue;t[108]!==ae||t[109]!==oe||t[110]!==se||t[111]!==ce||t[112]!==le?(ue=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ae,oe,se,ce,le]}),t[108]=ae,t[109]=oe,t[110]=se,t[111]=ce,t[112]=le,t[113]=ue):ue=t[113];let G;t[114]!==H||t[115]!==ue?(G=(0,Q.jsxs)(vt,{children:[H,ue]}),t[114]=H,t[115]=ue,t[116]=G):G=t[116];let de;return t[117]!==te||t[118]!==V||t[119]!==G?(de=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[te,V,G]}),t[117]=te,t[118]=V,t[119]=G,t[120]=de):de=t[120],de}function On(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(kn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Fe,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=pe(`skills`),t[25]=w):w=t[25];let T;t[26]===n.skillsLibraryLink?T=t[27]:(T=(0,Q.jsx)(ot,{to:w,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=T);let E;t[28]!==C||t[29]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,T]}),t[28]=C,t[29]=T,t[30]=E):E=t[30];let D;t[31]===r.skills.preset?D=t[32]:(D=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=D);let O;t[33]!==n.skillsPresetLabel||t[34]!==D?(O=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,D]}),t[33]=n.skillsPresetLabel,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(k=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=k):k=t[39];let A;t[40]!==n.skillsEffectiveLabel||t[41]!==k?(A=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,k]}),t[40]=n.skillsEffectiveLabel,t[41]=k,t[42]=A):A=t[42];let j;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==a||t[46]!==s||t[47]!==h||t[48]!==d||t[49]!==o||t[50]!==c||t[51]!==u?(j=o?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(gt,{rows:4})}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=a,t[46]=s,t[47]=h,t[48]=d,t[49]=o,t[50]=c,t[51]=u,t[52]=j):j=t[52];let M;t[53]!==n.skillsSave||t[54]!==a||t[55]!==p||t[56]!==f?(M=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=a,t[55]=p,t[56]=f,t[57]=M):M=t[57];let N;return t[58]!==E||t[59]!==O||t[60]!==A||t[61]!==j||t[62]!==M||t[63]!==v?(N=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,E,O,A,j,M]}),t[58]=E,t[59]=O,t[60]=A,t[61]=j,t[62]=M,t[63]=v,t[64]=N):N=t[64],N}function kn(e){return e.name||e.directoryId}var An=[`write_file`,`apply_patch`,`exec_command`],jn=[`exec_command`,`image_generate`,`extensions`],Mn=[`send_message`,`send_media`];function Nn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let w=C,T;t[14]===s?T=t[15]:(T=()=>{s(new Set)},t[14]=s,t[15]=T);let E=T,D;t[16]!==r||t[17]!==s||t[18]!==h?(D=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=Nt(r),t[20]=r,t[21]=k);let A=k,j;if(t[22]!==v||t[23]!==A||t[24]!==n||t[25]!==h){if(j=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(Fn),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),j.push(n)}for(let e of Mt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&j.push({key:e.key,ids:[...t]})}if(A.length>0){let e;t[31]===A?e=t[32]:(e={key:`misc`,ids:A},t[31]=A,t[32]=e),j.push(e)}t[22]=v,t[23]=A,t[24]=n,t[25]=h,t[26]=j}else j=t[26];let M=j,N=M.some(Pn),P=g||a,F;t[33]===f.quickActionsLabel?F=t[34]:(F=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=F);let I=P||r.length===0&&h.length===0,L;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==I?(L=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:At,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=L):L=t[38];let ee=P||r.length===0&&h.length===0,R;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==ee?(R=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:At,disabled:ee,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=ee,t[42]=R):R=t[42];let te=P||r.length===0,z;t[43]===w?z=t[44]:(z=()=>w(An),t[43]=w,t[44]=z);let ne;t[45]!==f.quickReadOnlyWorkspace||t[46]!==te||t[47]!==z?(ne=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:At,disabled:te,onClick:z,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=te,t[47]=z,t[48]=ne):ne=t[48];let re=P||r.length===0,ie;t[49]===w?ie=t[50]:(ie=()=>w(jn),t[49]=w,t[50]=ie);let B;t[51]!==f.quickHighRiskOff||t[52]!==re||t[53]!==ie?(B=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:At,disabled:re,onClick:ie,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=re,t[53]=ie,t[54]=B):B=t[54];let V=P||r.length===0,H;t[55]===w?H=t[56]:(H=()=>w(Mn),t[55]=w,t[56]=H);let U;t[57]!==f.quickNoOutbound||t[58]!==V||t[59]!==H?(U=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:At,disabled:V,onClick:H,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=V,t[59]=H,t[60]=U):U=t[60];let ae;t[61]!==L||t[62]!==R||t[63]!==ne||t[64]!==B||t[65]!==U?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,ne,B,U]}),t[61]=L,t[62]=R,t[63]=ne,t[64]=B,t[65]=U,t[66]=ae):ae=t[66];let W;t[67]!==F||t[68]!==ae?(W=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,ae]}),t[67]=F,t[68]=ae,t[69]=W):W=t[69];let oe;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==M||t[75]!==N||t[76]!==f.emptyBuiltin||t[77]!==f.lockedByDefaults||t[78]!==f.notInBuiltin||t[79]!==a||t[80]!==n||t[81]!==P||t[82]!==S?(oe=a?(0,Q.jsx)(gt,{rows:4}):N?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:M.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||P,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=M,t[75]=N,t[76]=f.emptyBuiltin,t[77]=f.lockedByDefaults,t[78]=f.notInBuiltin,t[79]=a,t[80]=n,t[81]=P,t[82]=S,t[83]=oe):oe=t[83];let se;return t[84]!==W||t[85]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[W,oe]}),t[84]=W,t[85]=oe,t[86]=se):se=t[86],se}function Pn(e){return e.ids.length>0}function Fn(e,t){return e.localeCompare(t)}function In(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:o,toolEntryDisable:s,setToolEntryDisable:c,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=l(Rn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===i.tools.presetDenied?g=t[3]:(g=new Set(i.tools.presetDenied.flatMap(Ln)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===c?v=t[5]:(v=e=>{c(e)},t[4]=c,t[5]=v);let y=v,b=n.toolsDisableGroups,x;t[6]===b?x=t[7]:(x=e=>b[e],t[6]=b,t[7]=x);let S=x,C;t[8]===n.toolDescriptions?C=t[9]:(C=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=C);let w=C,T;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(T=(0,Q.jsx)(_t,{className:`shrink-0`,icon:R,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=T):T=t[12];let E;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(E={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=E):E=t[23];let D;t[24]!==o||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==w||t[28]!==y||t[29]!==_||t[30]!==E||t[31]!==s?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Nn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:s,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:o,labels:E})}),t[24]=o,t[25]=r.builtinToolIds,t[26]=S,t[27]=w,t[28]=y,t[29]=_,t[30]=E,t[31]=s,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==o||t[35]!==f||t[36]!==u?(O=f?null:(0,Q.jsx)(X,{type:`button`,disabled:o,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=o,t[35]=f,t[36]=u,t[37]=O):O=t[37];let k;t[38]===d?k=t[39]:(k=()=>void d(),t[38]=d,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==o||t[42]!==k?(A=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:o,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=o,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==A||t[45]!==O?(j=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[O,A]}),t[44]=A,t[45]=O,t[46]=j):j=t[46];let M;return t[47]!==j||t[48]!==T||t[49]!==D?(M=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[T,D,j]}),t[47]=j,t[48]=T,t[49]=D,t[50]=M):M=t[50],M}function Ln(e){let t=String(e).trim();return t?[t]:[]}function Rn(e){return e.language}function zn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:ee,profileFileLoading:R,profileEditorNonce:te,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U,skillsCatalogLoading:ae,catalogForPick:W,skillsInherit:oe,setSkillsInherit:se,skillsPick:ce,setSkillsPick:le,onSaveSkills:ue,bindingsLoading:G,agentBindings:de,bindChannelStatuses:fe,bindChannelsLoading:pe,useManualChannel:me,newBindChannel:he,setNewBindChannel:ge,bindSessionChats:_e,bindSessionsLoading:ve,newBindSessionIdx:ye,setNewBindSessionIdx:be,newBindCustomPeer:xe,setNewBindCustomPeer:Se,refreshBindSessions:Ce,onRemoveBinding:K,onAddBinding:we,onTryInChat:Te}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Te||t[11]!==a?(e=(0,Q.jsx)(Dn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Te}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Te,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Te||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(xn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Te}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Te,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==B||t[43]!==U||t[44]!==H||t[45]!==a||t[46]!==V?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(vn,{a:n,chat:r,selected:a,busy:c,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U})}),t[39]=n,t[40]=c,t[41]=r,t[42]=B,t[43]=U,t[44]=H,t[45]=a,t[46]=V,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==ee||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Te||t[56]!==te||t[57]!==R||t[58]!==N||t[59]!==L||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(gn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:ee,profileFileLoading:R,profileEditorNonce:te,onTryInChat:Te})}),t[48]=n,t[49]=M,t[50]=I,t[51]=ee,t[52]=j,t[53]=A,t[54]=P,t[55]=Te,t[56]=te,t[57]=R,t[58]=N,t[59]=L,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==ie||t[70]!==re||t[71]!==a||t[72]!==ne||t[73]!==z?(e=(0,Q.jsx)(In,{a:n,data:s,selected:a,busy:c,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie}),t[66]=n,t[67]=c,t[68]=s,t[69]=ie,t[70]=re,t[71]=a,t[72]=ne,t[73]=z,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==W||t[78]!==ue||t[79]!==a||t[80]!==se||t[81]!==le||t[82]!==ae||t[83]!==oe||t[84]!==ce?(e=(0,Q.jsx)(On,{a:n,selected:a,busy:c,skillsCatalogLoading:ae,catalogForPick:W,skillsInherit:oe,setSkillsInherit:se,skillsPick:ce,setSkillsPick:le,onSaveSkills:ue}),t[75]=n,t[76]=c,t[77]=W,t[78]=ue,t[79]=a,t[80]=se,t[81]=le,t[82]=ae,t[83]=oe,t[84]=ce,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(qt,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==de||t[90]!==fe||t[91]!==pe||t[92]!==_e||t[93]!==ve||t[94]!==G||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==he||t[99]!==xe||t[100]!==ye||t[101]!==we||t[102]!==K||t[103]!==Ce||t[104]!==ge||t[105]!==Se||t[106]!==be||t[107]!==me?(e=(0,Q.jsx)(mn,{a:n,busy:c,bindingsLoading:G,agentBindings:de,channelStatuses:fe,channelsStatusLoading:pe,useManualChannel:me,newBindChannel:he,setNewBindChannel:ge,bindSessionChats:_e,sessionsLoading:ve,newBindSessionIdx:ye,setNewBindSessionIdx:be,newBindCustomPeer:xe,setNewBindCustomPeer:Se,onRefreshSessions:Ce,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:K,onAddBinding:we}),t[88]=n,t[89]=de,t[90]=fe,t[91]=pe,t[92]=_e,t[93]=ve,t[94]=G,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=he,t[99]=xe,t[100]=ye,t[101]=we,t[102]=K,t[103]=Ce,t[104]=ge,t[105]=Se,t[106]=be,t[107]=me,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(on,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(fn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let Ee;return t[126]===n.selectAgentHint?Ee=t[127]:(Ee=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=Ee),Ee}function Bn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=Ke(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=j(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Vn(e,t){return e.replace(`{{count}}`,String(t))}function Hn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Un(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Wn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(et,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,xe),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(de,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(B,{children:(0,Q.jsxs)(_e,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(m,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(Ee,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Gn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Bn(r,c,n),_=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=Ke(e,n),r=e.id,c=j(e,n),f=Hn(e,n),p=Un(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,rt.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(Ne,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Kn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(ut,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}function Kn(e){return(0,Q.jsx)(Wn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function qn(e){let t=(0,Z.c)(131),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:p,setCreateAgentId:m,createDescription:h,setCreateDescription:_,createWorkspace:y,setCreateWorkspace:b,createModel:x,setCreateModel:S,onCreate:C,onSuggestWorkspace:w,agents:T,duplicateSourceId:E,onSelectDuplicateSource:O}=e,[k,A]=(0,$.useState)(null),j;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ce,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,je)}),t[0]=j):j=t[0];let M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,Je,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=M):M=t[1];let N;t[2]===a.addAgent?N=t[3]:(N=(0,Q.jsx)(le,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=N);let P;t[4]===a.addAgentHint?P=t[5]:(P=(0,Q.jsx)(g,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=P);let F;t[6]!==N||t[7]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[N,P]}),t[6]=N,t[7]=P,t[8]=F):F=t[8];let I;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=i(ve,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=I):I=t[9];let L;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[10]=L):L=t[10];let ee;t[11]===a.closeDialogAria?ee=t[12]:(ee=(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:I,"aria-label":a.closeDialogAria,children:L})}),t[11]=a.closeDialogAria,t[12]=ee);let R;t[13]!==F||t[14]!==ee?(R=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[F,ee]}),t[13]=F,t[14]=ee,t[15]=R):R=t[15];let z;t[16]!==a||t[17]!==T||t[18]!==E||t[19]!==O?(z=T.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(f,{className:i(Et(),`bg-surface-panel`),value:E??``,onChange:e=>O(e.target.value||null),children:[(0,Q.jsx)(Y,{value:``,children:a.copyFromExistingAgentNone}),T.map(e=>(0,Q.jsxs)(Y,{value:e.id,children:[Ke(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=T,t[18]=E,t[19]=O,t[20]=z):z=t[20];let re;t[21]===c?re=t[22]:(re=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=re);let ie;t[23]!==a.newAgentLabel||t[24]!==l?(ie=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=ie):ie=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=Et(),t[26]=B):B=t[26];let H;t[27]===d?H=t[28]:(H=e=>d(e.target.value),t[27]=d,t[28]=H);let U;t[29]===w?U=t[30]:(U=()=>w(),t[29]=w,t[30]=U);let ae;t[31]!==u||t[32]!==H||t[33]!==U?(ae=(0,Q.jsx)(`input`,{className:B,value:u,onChange:H,onBlur:U,required:!0,autoComplete:`off`}),t[31]=u,t[32]=H,t[33]=U,t[34]=ae):ae=t[34];let W;t[35]!==ie||t[36]!==ae?(W=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ie,ae]}),t[35]=ie,t[36]=ae,t[37]=W):W=t[37];let oe;t[38]===a.newAgentIdOptional?oe=t[39]:(oe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=oe);let ue;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ue=i(Et(),`font-mono text-xs`),t[40]=ue):ue=t[40];let G;t[41]===m?G=t[42]:(G=e=>m(e.target.value),t[41]=m,t[42]=G);let de;t[43]===w?de=t[44]:(de=()=>w(),t[43]=w,t[44]=de);let fe;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==p||t[48]!==G||t[49]!==de?(fe=(0,Q.jsx)(`input`,{className:ue,value:p,onChange:G,onBlur:de,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=p,t[48]=G,t[49]=de,t[50]=fe):fe=t[50];let pe;t[51]===a.newAgentIdRules?pe=t[52]:(pe=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=pe);let me;t[53]!==oe||t[54]!==fe||t[55]!==pe?(me=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[oe,fe,pe]}),t[53]=oe,t[54]=fe,t[55]=pe,t[56]=me):me=t[56];let he;t[57]!==a.agentDescription||t[58]!==l?(he=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=he):he=t[59];let ge;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ge=i(Et(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=ge):ge=t[60];let _e;t[61]===_?_e=t[62]:(_e=e=>_(e.target.value),t[61]=_,t[62]=_e);let ye;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==_e?(ye=(0,Q.jsx)(`textarea`,{className:ge,value:h,onChange:_e,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=_e,t[66]=ye):ye=t[66];let be;t[67]!==he||t[68]!==ye?(be=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[he,ye]}),t[67]=he,t[68]=ye,t[69]=be):be=t[69];let xe;t[70]===a.newWorkspace?xe=t[71]:(xe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=xe);let Se;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Se=i(Et(),`font-mono text-xs`),t[72]=Se):Se=t[72];let Ce;t[73]===b?Ce=t[74]:(Ce=e=>b(e.target.value),t[73]=b,t[74]=Ce);let K;t[75]!==y||t[76]!==Ce?(K=(0,Q.jsx)(`input`,{className:Se,value:y,onChange:Ce,required:!0,autoComplete:`off`}),t[75]=y,t[76]=Ce,t[77]=K):K=t[77];let we;t[78]!==xe||t[79]!==K?(we=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[xe,K]}),t[78]=xe,t[79]=K,t[80]=we):we=t[80];let Te;t[81]===a.newModelOptional?Te=t[82]:(Te=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=Te);let Ee;t[83]===S?Ee=t[84]:(Ee=e=>S(e),t[83]=S,t[84]=Ee);let De;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==x||t[90]!==Ee?(De=(0,Q.jsx)(te,{className:`min-w-0 flex-1`,value:x,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:Ee}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=x,t[90]=Ee,t[91]=De):De=t[91];let Oe;t[92]!==a.modelClear||t[93]!==s||t[94]!==x||t[95]!==S?(Oe=x.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>S(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=x,t[95]=S,t[96]=Oe):Oe=t[96];let ke;t[97]!==De||t[98]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[De,Oe]}),t[97]=De,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]!==Te||t[101]!==ke?(Ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Te,ke]}),t[100]=Te,t[101]=ke,t[102]=Ae):Ae=t[102];let q;t[103]!==a.createModalCancel||t[104]!==s?(q=(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=q):q=t[105];let Me;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Q.jsx)(ne,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=Me):Me=t[106];let Ne;t[107]!==a.create||t[108]!==s?(Ne=(0,Q.jsxs)(X,{type:`submit`,disabled:s,children:[Me,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ne):Ne=t[109];let Pe;t[110]!==q||t[111]!==Ne?(Pe=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[q,Ne]}),t[110]=q,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]!==C||t[114]!==re||t[115]!==W||t[116]!==me||t[117]!==be||t[118]!==we||t[119]!==Ae||t[120]!==Pe||t[121]!==z?(Fe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:C,children:[z,re,W,me,be,we,Ae,Pe]}),t[113]=C,t[114]=re,t[115]=W,t[116]=me,t[117]=be,t[118]=we,t[119]=Ae,t[120]=Pe,t[121]=z,t[122]=Fe):Fe=t[122];let Ie;t[123]!==k||t[124]!==Fe||t[125]!==R?(Ie=(0,Q.jsxs)(D,{children:[j,(0,Q.jsx)(st,{ref:A,className:M,onOpenAutoFocus:Jn,children:(0,Q.jsxs)(He,{layer:`modal`,portalContainer:k,children:[R,Fe]})})]}),t[123]=k,t[124]=Fe,t[125]=R,t[126]=Ie):Ie=t[126];let Le;return t[127]!==r||t[128]!==n||t[129]!==Ie?(Le=(0,Q.jsx)(se,{open:n,onOpenChange:r,children:Ie}),t[127]=r,t[128]=n,t[129]=Ie,t[130]=Le):Le=t[130],Le}function Jn(e){return e.preventDefault()}var Yn=`~/.xopc/workspace`;function Xn(e){let t=e.trim();return t?`${Yn}/${at(t)}`:``}function Zn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ce,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function Qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function $n(e){let{agentId:t,enabled:n,saveRef:r}=e,i=M(async()=>{if(!t)return null;let[e,n]=await Promise.all([ge(t,`IDENTITY.md`).catch(()=>``),ge(t,`SOUL.md`).catch(()=>``)]),r=P(e);return{identity:r,soulTemplate:k(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?Qn(a):null),p=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,$.useRef)(t);m.current=t;let h=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?Qn(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),_=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=ee.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),b=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),x=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([We(e,`IDENTITY.md`,dt(f.identity)),We(e,`SOUL.md`,f.soulCustomContent)]),s.current=!1,l(e=>{let t=e??f;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[f]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=x,()=>{r.current=null}},[x,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:_,handleSoulContentChange:v,setAvatarDialogOpen:y,toggleSoulPreviewMode:b}}var er={draft:``,editorNonce:0,loadedKey:``};function tr(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function nr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=M(()=>n?re(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(tr,er),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(`edit`),y=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==y.current&&(y.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let b=p.draft,x=p.editorNonce,S=(0,$.useRef)(b);S.current=b;let C=(0,$.useRef)(n);C.current=n;let w=(0,$.useRef)(d);w.current=d;let T=(0,$.useRef)(null),E=(0,$.useRef)(``),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(()=>{}),A=M(()=>d&&n?ge(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),j=A.loading,N=Ve(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==E.current)return;let n=S.current;if(n!==D.current){g(!0),o(null);try{await We(e,t,n),D.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);k.current=N.flush,(0,$.useEffect)(()=>()=>{k.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&k.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==O.current&&(k.current(),O.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){m({type:`clear`});return}j||(E.current=F,D.current=A.data,m({type:`load`,key:F,content:A.data}))},[F,j,A.data]);let I=(0,$.useRef)({activeFile:d,selectedId:n});return(I.current.activeFile!==d||I.current.selectedId!==n)&&(I.current={activeFile:d,selectedId:n},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{k.current(),f(e)},[]),fileDraft:b,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(S.current):e}),N()},[N]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:j,profileEditorNonce:x,overviewSaveProfileMarkdownRef:T,saveProfileMarkdownDebounced:N}}function rr(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=M(()=>xt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`connections`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=M(()=>St(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),N=(0,$.useRef)(S);N.current!==S&&(N.current=S,k(null));let P=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),F=(0,$.useCallback)(()=>{let e=y.trim();e&&St(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),I=!_&&g.length===0,L=t===`connections`&&n&&i,ee=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await Me(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:P,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:L,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=wt(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await Me(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:ee,refreshBindSessions:F,useManualChannel:I}}function ir(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(sr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=M(or,s,d),m;n[10]===f?m=n[11]:(m=f.filter(ar),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function ar(e){return e.enabled!==!1}function or(){return tt()}function sr(e){return e+1}function cr(e){return ir(e.panel===`skills`,e.hasToken)}function lr(e){return new Set(e.tools.entryDisable)}function ur(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function dr(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(lr(n)),n&&t===`skills`){let e=ur(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Ot(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function fr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function pr(e){let t=Ot(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Ot(e.typedModels.effective)}function mr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function hr(){let e=l(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),g=t.cron,_=t.chat,v=!!o(e=>e.token),[y,x]=b(),S=it(),{agentId:C}=oe(),w=E(e=>e.setPageHeader),T=E(e=>e.clearPageHeader),{data:D,error:O,isLoading:k,mutate:j}=d(v?`settings-gateway-agents`:null,De,{revalidateOnFocus:!1}),{data:M,mutate:N}=d(v?`settings-capability-presets`:null,Pt,{revalidateOnFocus:!1}),P=Re(v),{data:F}=P,I=(0,$.useMemo)(()=>Ye(F?.payload?.config??{}),[F]),L=D??null,ee=(0,$.useMemo)(()=>L?L.agents.find(e=>e.id===L.defaultId)??L.agents[0]??null:null,[L]),R=!!(v&&k),[te,z]=(0,$.useState)(null),ne=O instanceof Error?O.message:O?n.loadError:null,re=te??ne,[ie,B]=(0,$.useState)(null),[V,H]=(0,$.useState)(`overview`),[U,W]=(0,$.useState)(``),[se,ce]=(0,$.useState)(``),[le,G]=(0,$.useState)(``),[de,fe]=(0,$.useState)(``),[pe,me]=(0,$.useState)(``),[he,ge]=(0,$.useState)(null),[_e,ve]=(0,$.useState)(!1),ye=(0,$.useRef)(``),[be,xe]=(0,$.useState)(null),[Ce,K]=(0,$.useState)(!1),[Te,Ee]=(0,$.useState)(``),[Oe,ke]=(0,$.useState)(``),[Ae,q]=(0,$.useState)(``),[je,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(``),[Fe,Ie]=(0,$.useState)(``),Le=(0,$.useRef)(null),[ze,Ve]=(0,$.useState)(!1),He=(0,$.useRef)({data:null,routeAgentId:void 0});L&&(L!==He.current.data||C!==He.current.routeAgentId)&&(He.current={data:L,routeAgentId:C},C&&L.agents.some(e=>e.id===C)?B(C):B(e=>e&&L.agents.some(t=>t.id===e)?e:L.defaultId)),(0,$.useEffect)(()=>{!L||!C||L.agents.some(e=>e.id===C)||S(Qe,{replace:!0})},[L,C,S]),(0,$.useEffect)(()=>{C&&H(`overview`)},[C]),(0,$.useEffect)(()=>{y.get(`panel`)===`defaults`&&S(C?Be(C):Qe,{replace:!0,state:{[h]:C?Be(C):Qe}})},[y,C,S]),(0,$.useEffect)(()=>{if(y.get(`focus`)!==`avatar`||!C||(H(`overview`),R||!L?.agents.some(e=>e.id===C)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),x(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[y,C,R,L,x]);let J=(0,$.useMemo)(()=>L?.agents.find(e=>e.id===ie)??null,[L,ie]),We=(0,$.useMemo)(()=>{let e=F?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[F]),Ge=(0,$.useMemo)(()=>!L||We&&L.agents.some(e=>e.id===We)?We:L.defaultId||L.agents[0]?.id||We,[L,We]),qe=!!(L&&We&&!L.agents.some(e=>e.id===We));(0,$.useEffect)(()=>{ke(qe?``:We)},[We,qe]);let Je=(0,$.useRef)(null),Xe=J?J.id:null;J&&Je.current!==Xe?(Je.current=Xe,q(J.workspace),Me(J.model?.primary??``),Pe(Ke(J,a(e).agentsSettings)),Ie(J.description??``)):!J&&Je.current!==null&&(Je.current=null,q(``),Me(``),Pe(``),Ie(``));let Ze=$n({agentId:J?.id??null,enabled:V===`behavior`&&!!J,saveRef:Le}),$e=nr({panel:V,selectedId:ie,hasToken:v,dataAgentsLength:L?.agents.length,saveErrorMessage:n.saveError,setError:z}),et=dr({panel:V,selected:J}),Y=rr({panel:V,hasToken:v,bindingsFromConfig:I,gatewayCfgLoading:F===void 0,selected:J,saveErrorMessage:n.saveError,setBusy:K,setError:z}),tt=cr({panel:V,hasToken:v}),nt=(0,$.useCallback)(()=>{let e=Xn(se.trim()||U);fe(t=>t===``||t===ye.current?(ye.current=e,e):t)},[se,U]),rt=(0,$.useCallback)(()=>{ye.current=``,W(``),ce(``),G(``),fe(``),me(``),ge(null),xe(null),ve(!0)},[]),X=(0,$.useCallback)(e=>{let t=new Set(L?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,L]),at=(0,$.useCallback)(e=>{if(xe(e),!e)return;let t=L?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=X(t.id),o=t.description??``;ye.current=``,W(i),ce(a),G(o),fe(t.workspace),me(t.model?.primary??``),ge(null)},[n.duplicateName,L,X]),ot=(0,$.useCallback)(e=>{at(e),ve(!0)},[at]),st=(0,$.useMemo)(()=>(0,Q.jsx)(Zn,{a:n,busy:Ce,listSearchQuery:Te,onListSearchQueryChange:Ee,onAddAgent:()=>rt()}),[n,Ce,Te,rt]);(0,$.useLayoutEffect)(()=>v?(w({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:st}),()=>T()):(T(),()=>T()),[n.title,st,T,v,w]);async function ct(t){t.preventDefault();let r=U.trim();if(!r)return;let i=ae(se,r);if(i.ok===!1){ge(i.error);return}let a=de.trim()||Xn(se.trim()||r);if(a){K(!0),ge(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${le.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
+
`),{createdAgentId:n,...i}=await A({workspace:a,...se.trim()?{id:se.trim()}:{},...pe.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:pe.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...be?{cloneFrom:be}:{}});j(i,{revalidate:!1}),W(``),ce(``),G(``),fe(``),me(``),ge(null),ve(!1),B(n),S(Be(n))}catch(e){ge(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function lt(){if(J){K(!0),z(null);try{j(await we(J.id,{workspace:Ae.trim()||void 0,...je.trim()?{models:fr(J,je.trim())}:{}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function ut(e){K(!0),z(null);try{j(await we(e.id,{setDefault:!0}),{revalidate:!1}),B(e.id)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function dt(){let e=Oe.trim().toLowerCase();if(e&&!L?.agents.some(t=>t.id===e)){z(n.tuiDefaultAgentInvalid);return}K(!0),z(null);try{await Se(e||null),await P.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function ft(e){K(!0),z(null);try{await Se(e.id),ke(e.id),await P.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function pt(){K(!0),z(null);try{await Se(null),ke(``),await P.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function mt(e,t){K(!0),z(null);try{let n=await ue(e.id,t);j(n,{revalidate:!1}),B(n.defaultId),H(`overview`),C===e.id&&S(Qe,{replace:!0}),i(!1),c(null),m(``)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}function ht(e,t){e.id!==`main`&&(c(e),f(t),m(``),i(!0))}async function gt(){if(J){K(!0),z(null);try{j(await we(J.id,{tools:{builtin:mr(et.toolEntryDisable)}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function _t(){if(J){K(!0),z(null);try{j(await we(J.id,{tools:null}),{revalidate:!1}),et.setToolEntryDisable(new Set)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function vt(){if(!J)return;let e=Dt(et.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){z(e);return}K(!0),z(null);try{j(await we(J.id,{models:{roles:jt(et.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function yt(){if(!J)return;let e=pr(J),t=jt(e);if(!t?.roles?.[J.typedModels.defaultRole]){z(n.typedModelsInvalidModel);return}K(!0),z(null);try{j(await we(J.id,{models:{defaultRole:J.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),et.setModelRows(e)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}async function bt(){if(J){K(!0),z(null);try{j(await we(J.id,{skills:et.skillsInherit?null:[...et.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}async function xt(e){if(J){K(!0),z(null);try{j(await we(J.id,{extends:e}),{revalidate:!1}),N()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{K(!1)}}}let St=V!==`behavior`,Ct=(()=>{if(!J||V!==`behavior`)return!1;let e=J.workspace,t=J.model?.primary??``;return Ae.trim()!==e||je.trim()!==t})(),wt=(()=>{if(St||!J)return!1;switch(V){case`behavior`:return Ct||Ze.dirty;default:return!0}})(),Tt=St||!wt;function Et(){Ve(!0),setTimeout(()=>Ve(!1),2e3)}async function Ot(){switch(V){case`behavior`:await Promise.all([lt(),Le.current?.()??Promise.resolve()]),Et();break;default:break}}function kt(e){e||S(Qe)}let At=J?Ne.trim()||Ke(J,n):C??``,Mt=J?.id??C??``,Nt=(0,$.useCallback)(async()=>{if(J){await Ot(),$e.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(Ue,J.id)}catch{}S(`/chat/new`,{state:{agentId:J.id,fromAgentEditor:!0}})}},[J,Ot,$e.saveProfileMarkdownDebounced,S]),Ft={a:n,chat:_,cCron:g,selected:J,panel:V,data:L,busy:Ce,editName:Ne,setEditName:Pe,editDescription:Fe,setEditDescription:Ie,editWorkspace:Ae,setEditWorkspace:q,editModel:je,setEditModel:Me,defaultModel:ee?.model?.primary??``,defaultWorkspace:ee?.workspace??``,onSetDefault:()=>{J&&ut(J)},onSetTuiDefault:()=>{J&&ft(J)},isTuiDefault:!!(J&&J.id===Ge),isTuiDefaultInherited:!!(J&&J.id===Ge&&(!We||qe)),onSaveAgentEdits:()=>void lt(),onDelete:e=>{J&&ht(J,e)},onTryInChat:()=>void Nt(),capabilityPresets:M?.presets??[],defaultPresetId:M?.defaultPresetId,onUpdateAgentExtends:e=>void xt(e),onOpenCapabilityPreset:e=>{S(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Le,overviewProfile:Ze,filesLoading:$e.filesLoading,files:$e.files,activeFile:$e.activeFile,setActiveFile:$e.setActiveFile,filesViewMode:$e.filesViewMode,setFilesViewMode:$e.setFilesViewMode,fileDraft:$e.fileDraft,setFileDraft:$e.setFileDraft,fileSaving:$e.fileSaving,profileFileLoading:$e.profileFileLoading,profileEditorNonce:$e.profileEditorNonce,toolEntryDisable:et.toolEntryDisable,setToolEntryDisable:et.setToolEntryDisable,onSaveTools:()=>void gt(),onClearToolsEntry:()=>void _t(),modelRows:et.modelRows,setModelRows:et.setModelRows,onSaveModels:()=>void vt(),onClearModelsEntry:()=>void yt(),skillsCatalogLoading:tt.skillsCatalogLoading,catalogForPick:tt.catalogForPick,skillsInherit:et.skillsInherit,setSkillsInherit:et.setSkillsInherit,skillsPick:et.skillsPick,setSkillsPick:et.setSkillsPick,onSaveSkills:()=>void bt(),bindingsLoading:Y.bindingsLoading,agentBindings:Y.agentBindings,bindChannelStatuses:Y.bindChannelStatuses,bindChannelsLoading:Y.bindChannelsLoading,useManualChannel:Y.useManualChannel,newBindChannel:Y.newBindChannel,setNewBindChannel:Y.setNewBindChannel,bindSessionChats:Y.bindSessionChats,bindSessionsLoading:Y.bindSessionsLoading,newBindSessionIdx:Y.newBindSessionIdx,setNewBindSessionIdx:Y.setNewBindSessionIdx,newBindCustomPeer:Y.newBindCustomPeer,setNewBindCustomPeer:Y.setNewBindCustomPeer,refreshBindSessions:Y.refreshBindSessions,onRemoveBinding:e=>void Y.onRemoveBinding(e),onAddBinding:Y.onAddBinding};return{hasToken:v,a:n,chat:_,language:e,data:L,savedTuiDefaultAgentId:We,effectiveTuiDefaultAgentId:Ge,tuiDefaultAgentDraft:Oe,setTuiDefaultAgentDraft:ke,tuiDefaultAgentUnavailable:qe,onSaveTuiDefaultAgent:dt,onSetTuiDefaultAgent:ft,onClearTuiDefaultAgent:pt,onSetDefaultAgent:ut,loading:R,displayError:re,navigate:S,routeAgentId:C,busy:Ce,listSearchQuery:Te,openAddAgentModal:rt,openDuplicateAgentModal:ot,duplicateSourceId:be,onSelectDuplicateSource:at,panel:V,setPanel:H,modalTitle:At,modalSubtitle:Mt,footerSaveDisabled:Tt,savedFlash:ze,handleModalFooterSave:Ot,onAgentModalOpenChange:kt,addAgentModalOpen:_e,setAddAgentModalOpen:ve,createWorkspaceSuggestedRef:ye,createModalError:he,setCreateModalError:ge,createDisplayName:U,setCreateDisplayName:W,createAgentId:se,setCreateAgentId:ce,createDescription:le,setCreateDescription:G,createWorkspace:de,setCreateWorkspace:fe,createModel:pe,setCreateModel:me,onCreate:ct,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:nt,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:c,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:mt,editorPanelProps:Ft}}function gr(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(q,{className:`h-5 w-40`}),(0,Q.jsx)(q,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(q,{className:`h-9 w-28 rounded-lg`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:6}).map(_r)})]}),e[1]=n):n=e[1],n}function _r(e,t){return(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(q,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(q,{className:`h-4 w-2/3`}),(0,Q.jsx)(q,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(q,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(q,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(q,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(q,{className:`h-6 w-20 rounded-full`})]})]},t)}function vr(){let e=hr();return e.hasToken?(0,Q.jsxs)(mt,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 shadow-surface dark:text-red-300`,children:e.displayError}):null,e.loading?(0,Q.jsx)(gr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Gn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Be(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(Ue,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Vt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(gr,{}):(0,Q.jsx)(zn,{...e.editorPanelProps})}):null,(0,Q.jsx)(qn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Lt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(mt,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(pt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{vr as AgentsSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{n as o,o as s}from"./fetch-Bl7zMnmd.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Ba as u,Ha as d,Ka as f,Nc as p,Tt as m,Ua as h,Va as g,Wa as _,ha as v,io as y,js as b,mo as x,ro as S,vo as C,wo as w,za as T}from"./index-DOetFpTt.js";import{n as E,t as D}from"./settings-page-layout-DgFTf6nM.js";import{r as O}from"./settings-loading-skeleton-CTA5Gje4.js";import{r as k,t as A}from"./settings-form-section-C-5-n-jM.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(m,L),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:f,clearConfirmChecked:v,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await x(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,N.jsx)(O,{rows:2});let H=!o.packaged,U=j||o.pendingUpdate||H,W=!H&&o.uninstallMode!==`unsupported`,G=I(o,t),K=v&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(b,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.appPath,`app`),children:[(0,N.jsx)(p,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.dataPath,`data`),children:[(0,N.jsx)(p,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(o.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:f,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(d,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),(0,N.jsxs)(T,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(u,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:v,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(w,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(w,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(d,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),(0,N.jsxs)(T,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(u,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(w,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(w,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await o(s(`/api/migrations/status`))).payload}async function B(){await o(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function u(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(v,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(v,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(w,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!f()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-Bq4REfIj.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{Za as o,it as s,vo as c}from"./index-DOetFpTt.js";import{n as l,t as u}from"./settings-page-layout-DgFTf6nM.js";import{t as d}from"./settings-advanced-gate-hDvmobsT.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let s=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===s.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:s.colorSchemeTitle}),e[2]=s.colorSchemeTitle,e[3]=d);let m;e[4]===s.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.colorSchemeDescription}),e[4]=s.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==s||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,c.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:s[r]})]},t)}),e[9]=s,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 px-3 py-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]!==a.pageTitle||e[3]!==a.subtitle?(s=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=s):s=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(o,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==s||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[s,_,w,k]}),e[24]=s,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{a as o,n as s,o as c,t as l}from"./fetch-Bl7zMnmd.js";import{n as u}from"./locale-store-Ba72bFmP.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{Ba as p,Dc as m,Do as h,El as g,Ga as _,Gn as v,Ha as y,Tt as b,Ua as x,Us as S,Va as C,Wa as w,Zc as T,_a as E,ai as D,ba as O,bs as k,cs as A,hl as j,is as M,js as N,nl as P,va as F,wo as I,xa as L,xl as R,ya as z,za as B,zo as V}from"./index-DOetFpTt.js";import{t as H}from"./page-tabs-Cy7bX7Ce.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(e){let t=await l(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await l(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await l(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await l(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function Z(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var te={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function ne({className:e}){let t=a(u(e=>e.language)).extensionsPage,n=o(e=>!!e.token),r=F(),{mutate:l}=d(),[p,m]=(0,U.useReducer)(b,te),{q:h,debounced:g,detailPkg:_,rowBusy:y,actionError:x,restartHint:C}=p,w=n?`marketplace-${g}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>m({type:`patch`,patch:{debounced:h.trim()}}),300);return()=>window.clearTimeout(e)},[h]);let{data:E,isLoading:D,error:O}=f(w,async()=>s(g.length>0?c(`/api/marketplace?q=${encodeURIComponent(g)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),k=(0,U.useCallback)(()=>{l(`gateway-extensions-list`),v()},[l]),j=(0,U.useCallback)(async(e,n)=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});k(),r.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,k]),M=(0,U.useCallback)(async e=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);k(),n.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,k]),P=E?.extensions??[];return(0,X.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(A,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:h,onChange:e=>m({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),O?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O instanceof Error?O.message:t.marketplaceLoadFailed}):null,x?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,C?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C}):null,D&&!E?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:P.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):P.map(e=>{let n=Z(r,e.id),a=y===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>m({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(T,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(N,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&M(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,X.jsx)(S,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(V,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{j(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,X.jsx)(S,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),_?(0,X.jsx)(re,{packageName:_,copy:t,extensions:r,onClose:()=>m({type:`patch`,patch:{detailPkg:null}}),onInstall:j,onUninstall:M}):null]})}function re(e){let t=(0,W.c)(61),{packageName:n,copy:r,extensions:a,onClose:s,onInstall:c,onUninstall:l}=e,[u,d]=(0,U.useState)(!1),p=o(se)?`ext-mp-detail-${n}`:null,m;t[0]===n?m=t[1]:(m=async()=>ee(n),t[0]=n,t[1]=m);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[2]=g):g=t[2];let{data:_,error:v,isLoading:b}=f(p,m,g),T;t[3]!==a||t[4]!==n?(T=Z(a,n),t[3]=a,t[4]=n,t[5]=T):T=t[5];let E=T,O=E===`user`,k;t[6]!==r.marketplaceNoReadme||t[7]!==_?(k=_?.readme?.trim()||(_?.description?.trim()?`### ${_.name}\n\n${_.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=_,t[8]=k):k=t[8];let A=k,M;t[9]===s?M=t[10]:(M=e=>!e&&s(),t[9]=s,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=N):N=t[11];let P;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,X.jsx)(j,{className:`size-5`}),t[12]=P):P=t[12];let F;t[13]!==r.detailBack||t[14]!==s?(F=(0,X.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:P}),t[13]=r.detailBack,t[14]=s,t[15]=F):F=t[15];let I;t[16]===r.marketplaceDetailTitle?I=t[17]:(I=(0,X.jsx)(w,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=I);let L;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(h,{className:`size-5`}),t[18]=L):L=t[18];let z;t[19]!==r.detailClose||t[20]!==s?(z=(0,X.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:L}),t[19]=r.detailClose,t[20]=s,t[21]=z):z=t[21];let H;t[22]!==z||t[23]!==F||t[24]!==I?(H=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[F,I,z]}),t[22]=z,t[23]=F,t[24]=I,t[25]=H):H=t[25];let G;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==_||t[32]!==v||t[33]!==b||t[34]!==A?(G=b&&!_?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):v?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:_.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:_.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:_.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:_.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:_.downloads})]})]}),_.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(D,{content:A})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=_,t[32]=v,t[33]=b,t[34]=A,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:G}),t[36]=G,t[37]=K);let q;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==_||t[47]!==E||t[48]!==s||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==O?(q=_?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:E===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(R,{to:`/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{O&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,O).catch(ae).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,X.jsx)(S,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,O?r.marketplaceReinstall:r.marketplaceInstall]}),O?(0,X.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>s()).catch(ie).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(V,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=_,t[47]=E,t[48]=s,t[49]=c,t[50]=l,t[51]=n,t[52]=O,t[53]=q):q=t[53];let J;t[54]!==H||t[55]!==K||t[56]!==q?(J=(0,X.jsxs)(y,{children:[N,(0,X.jsxs)(B,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:oe,children:[H,K,q]})]}),t[54]=H,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Y;return t[58]!==J||t[59]!==M?(Y=(0,X.jsx)(x,{defaultOpen:!0,onOpenChange:M,children:J}),t[58]=J,t[59]=M,t[60]=Y):Y=t[60],Y}function ie(){}function ae(){}function oe(e){return e.preventDefault()}function se(e){return!!e.token}function ce(){let e=u(e=>e.language),t=a(e),n=_(e=>e.setPageHeader),r=_(e=>e.clearPageHeader),i=F(),o=z(),[s,c]=g(),l=G(s.get(`tab`)),d=s.get(`q`)??``,[f,p]=(0,U.useState)(l),[m,h]=(0,U.useState)(d),[v,y]=(0,U.useState)(null),b=s.toString(),x=(0,U.useRef)(b);if(x.current!==b){x.current=b;let e=G(s.get(`tab`)),t=s.get(`q`)??``;p(t=>t===e?t:e),h(e=>e===t?e:t)}(0,U.useEffect)(()=>{c(e=>{let t=new URLSearchParams(e),n=m.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,m,c]);let S=(0,U.useMemo)(()=>i.filter(e=>e.source===`bundled`),[i]),C=(0,U.useMemo)(()=>i.filter(e=>e.source!==`bundled`),[i]),w=f===`builtin`?S:C,T=(0,U.useMemo)(()=>{let t=m.trim().toLowerCase(),n=w;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[w,m,e]);if((0,U.useEffect)(()=>{y(e=>{if(!e)return e;let t=i.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[i]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:null}),()=>r()),[r,t.extensionsPage.title,n]),o&&f!==`marketplace`)return(0,X.jsx)(me,{});let E=f!==`marketplace`&&w.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base px-3 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:S.length},{id:`user`,label:t.extensionsPage.tabUser,count:C.length}],activeTab:f,onChange:p,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),E?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(A,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),f===`marketplace`?(0,X.jsx)(ne,{}):f===`builtin`&&S.length===0?(0,X.jsx)(ge,{message:t.extensionsPage.emptyBuiltin}):f===`user`&&C.length===0?(0,X.jsx)(ge,{message:t.extensionsPage.emptyUser}):T.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:T.map(e=>(0,X.jsx)(fe,{extension:e,copy:t.extensionsPage,showSourceBadge:f===`user`,onOpen:()=>y(e)},e.id))})]}),v?(0,X.jsx)(pe,{extension:v,copy:t.extensionsPage,onClose:()=>y(null)},v.id):null]})}function Q(e){return e.activationEligible??e.active}function le(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function ue(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function de(e,t){let n=Q(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function fe(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Q(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let g;t[11]!==m||t[12]!==h?(g=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==r.statusEnabled||t[15]!==c?(_=c?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(P,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(k,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=_):_=t[16];let v;t[17]!==g||t[18]!==_?(v=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==r.cardNoDescription||t[21]!==n.description?(y=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=y):y=t[22];let b;t[23]===y?b=t[24]:(b=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:y}),t[23]=y,t[24]=b);let x=n.hasUi?r.badgeKindUi:r.badgeKindBackend,S;t[25]!==x||t[26]!==l?(S=(0,X.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:x}),t[25]=x,t[26]=l,t[27]=S):S=t[27];let C;t[28]!==r||t[29]!==n||t[30]!==a?(C=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,X.jsx)(`span`,{title:le(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:ue(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=C):C=t[31];let w;t[32]!==S||t[33]!==C?(w=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[S,C]}),t[32]=S,t[33]=C,t[34]=w):w=t[34];let T;t[35]!==v||t[36]!==b||t[37]!==w?(T=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,b,w]}),t[35]=v,t[36]=b,t[37]=w,t[38]=T):T=t[38];let E;t[39]!==T||t[40]!==p?(E=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[p,T]}),t[39]=T,t[40]=p,t[41]=E):E=t[41];let D;return t[42]!==o||t[43]!==E?(D=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:u,children:E}),t[42]=o,t[43]=E,t[44]=D):D=t[44],D}function pe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),f=e.activationEligible===!0,g=(0,U.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),v(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),_=e.ui?.contributions?.pages??[],b=e.ui?.contributions?.settingsPanels??[],T=e.ui?.contributions?.chatWidgets??[],D=e.ui?.contributions?.sidebarPanels??[],k=_.find(e=>e.showInNav)??_[0],A=b[0],N=k?E(e.id,k):null,P=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||O(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(x,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(y,{children:[(0,X.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(B,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(j,{className:`size-5`})}),(0,X.jsx)(w,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(p,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(h,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,le(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:de(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(I,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(S,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(_.length>0||b.length>0||T.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)($,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,X.jsx)($,{template:t.badgeSettings,count:b.length,hidden:b.length===0}),(0,X.jsx)($,{template:t.badgeWidgets,count:T.length,hidden:T.length===0}),(0,X.jsx)($,{template:t.badgeSidebar,count:D.length,hidden:D.length===0})]})]}):null,L(e)&&(N||P)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,X.jsxs)(R,{to:N,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(m,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,X.jsxs)(R,{to:P,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(M,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function me(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(he)})]})}),e[4]=a):a=e[4],a}function he(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function ge(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{ce as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-Dy6lsTHw.js → archive-plugin-2G62raBg.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-Bq4REfIj.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-B9_iql49.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
|
package/dist/gateway/static/root/assets/{attachment-load-qOtBYR6Y.js → attachment-load-kLNJMEJh.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-RnGYy9bC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{
|
|
2
|
+
import{t as e}from"./preload-helper-zJ_50EbN.js";import{ua as t}from"./index-DOetFpTt.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-Bq4REfIj.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./vendor-swr-BIWyz7Rc.js";import{Qo as o,Xc as s,Zs as c,_ as l,g as u,v as d,wl as f,wo as p,y as m}from"./index-DOetFpTt.js";var h=e(),g=t();function _(e){let t=(0,h.c)(45),{title:m,description:_,prompt:x,coverage:S,className:C,variant:w}=e,T=w===void 0?`card`:w,E=i(b),D=r(E).automations.suggestions,O=r(E).automations,k=f(),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=A):A=t[0];let{data:j}=a(S?`automation-suggestion-coverage`:null,y,A),M=S?j?.automations.find(e=>d(e,S)):void 0,N=M?u(M,O):[];if(T===`titleAction`){if(M){let e;t[1]===C?e=t[2]:(e=n(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,C),t[1]=C,t[2]=e);let r;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,g.jsx)(s,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=r):r=t[3];let i;return t[4]===k?i=t[5]:(i=()=>k(`/automations`),t[4]=k,t[5]=i),(0,g.jsxs)(`section`,{className:e,children:[r,(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:D.coveredTitle}),(0,g.jsx)(p,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:i,children:D.manage})]})}let e;t[6]===C?e=t[7]:(e=n(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,C),t[6]=C,t[7]=e);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,g.jsx)(c,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=r):r=t[8];let i;t[9]!==_||t[10]!==m?(i=(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:_,children:m}),t[9]=_,t[10]=m,t[11]=i):i=t[11];let a;t[12]!==k||t[13]!==x?(a=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[12]=k,t[13]=x,t[14]=a):a=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,g.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,g.jsxs)(`section`,{className:e,children:[r,i,(0,g.jsxs)(p,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:a,children:[l,D.create]})]})}if(M){let e;t[16]===C?e=t[17]:(e=n(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,C),t[16]=C,t[17]=e);let r;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,g.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=r):r=t[18];let i;t[19]===k?i=t[20]:(i=()=>k(`/automations`),t[19]=k,t[20]=i);let a;return t[21]!==D||t[22]!==i?(a=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsx)(p,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:i,children:D.manage})}),t[21]=D,t[22]=i,t[23]=a):a=t[23],(0,g.jsxs)(`section`,{className:e,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:D.coveredTitle}),(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:l(D.coveredDescription,{name:M.name})})]})]}),(0,g.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:O.explain.whyCovered}),(0,g.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:N.map(v)})]}),a]})}let P;t[24]===C?P=t[25]:(P=n(`rounded-lg bg-surface-panel p-3 shadow-surface`,C),t[24]=C,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=F):F=t[26];let I;t[27]===m?I=t[28]:(I=(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:m}),t[27]=m,t[28]=I);let L;t[29]===_?L=t[30]:(L=(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:_}),t[29]=_,t[30]=L);let R;t[31]!==I||t[32]!==L?(R=(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[I,L]})]}),t[31]=I,t[32]=L,t[33]=R):R=t[33];let z;t[34]!==k||t[35]!==x?(z=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[34]=k,t[35]=x,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,g.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t[37]=B):B=t[37];let V;t[38]!==D.create||t[39]!==z?(V=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsxs)(p,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:z,children:[B,D.create]})}),t[38]=D.create,t[39]=z,t[40]=V):V=t[40];let H;return t[41]!==V||t[42]!==P||t[43]!==R?(H=(0,g.jsxs)(`section`,{className:P,children:[R,V]}),t[41]=V,t[42]=P,t[43]=R,t[44]=H):H=t[44],H}function v(e){return(0,g.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function y(){return m.list()}function b(e){return e.language}export{_ as t};
|