@xopcai/xopc 0.0.161 → 0.0.162
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-o7GRljfD.js → activity-store-hpcNv9MZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-Zf9UQEmQ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +2 -0
- package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-Dnatri09.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-BBTR9wJP.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-C2zpLCHD.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-9eR_ODY1.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-DPuWYUeX.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-Dw49OJRl.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-BdkJpDFm.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-CAi7SXYU.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-Dx6wkGz1.js +1 -0
- package/dist/gateway/static/root/assets/browser-workflows-page-Skertc-A.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-CNFl7dM3.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-DYQyGDw4.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-Bng6kxYF.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-Bpf6oegd.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-BVUyefSd.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-DjSZAPz_.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CAZk2AM4.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-C2F6vTTd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-AnIt4bn4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DKA9-lyP.js → extension-settings-page-CLSc6682.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-DLFyZv33.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-DnQAA-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-DbzLyJ3R.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-REmr3QCr.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Dz0F3uRO.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-CQFY5gYs.js} +1 -1
- package/dist/gateway/static/root/assets/index-C8JkTS6d.js +199 -0
- package/dist/gateway/static/root/assets/index-hmrG55qg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-BnOQXU5k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-KsOtWOyM.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-0lpYdNDr.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CyYCBqym.js → logs-page-CwLPgrWh.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-D5GRg10r.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-C1ryULGs.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CIeZ1_DT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-Caj1-E_X.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-DKwEce-9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B90ZskkN.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +1 -0
- package/dist/gateway/static/root/assets/save-bar-controls-BDYt53uQ.js +1 -0
- package/dist/gateway/static/root/assets/{schedule-field-TkqUL3wm.js → schedule-field-Bcdni4Pj.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D7oCARF7.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-Dpqth3oA.js → settings-collapsible-section-6eNF8Jey.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-CARTHCxH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DEwYqESe.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-B6vVdHeQ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-D3srt5Bi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Ck9SxiXw.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-DLBUQSk2.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-C1oaqeD2.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib-Divbg_C4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CP9a_rAf.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-DbDPYQwB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/client-error-format.js +3 -3
- package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
- package/dist/src/agent/outcomes/task-evaluation.js +48 -0
- package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/task-verifier.js +71 -0
- package/dist/src/agent/prompt/memory/index.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
- package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
- package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
- package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/automations/domain/types.d.ts +13 -0
- package/dist/src/automations/domain/validation.d.ts +44 -24
- package/dist/src/automations/domain/validation.js +27 -18
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +22 -0
- package/dist/src/browser/index.d.ts +0 -1
- package/dist/src/browser/index.js +1 -2
- package/dist/src/browser/pipeline/runner.d.ts +9 -2
- package/dist/src/browser/pipeline/runner.js +151 -105
- package/dist/src/browser/pipeline/schema.d.ts +21 -15
- package/dist/src/browser/pipeline/schema.js +93 -99
- package/dist/src/browser/recipes/index.d.ts +3 -0
- package/dist/src/browser/recipes/index.js +3 -0
- package/dist/src/browser/recipes/repository.d.ts +13 -0
- package/dist/src/browser/recipes/repository.js +81 -0
- package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
- package/dist/src/browser/recipes/runtime-service.js +30 -0
- package/dist/src/browser/recipes/service.d.ts +36 -0
- package/dist/src/browser/recipes/service.js +186 -0
- package/dist/src/browser/recipes/types.d.ts +36 -0
- package/dist/src/browser/recipes/types.js +1 -0
- package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
- package/dist/src/cli/commands/browser.js +4 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +3 -3
- package/dist/src/config/schema.js +21 -21
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
- package/dist/src/gateway/hono/routes/home.js +1 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
- package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/memory.js +33 -4
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
- package/dist/src/gateway/hono/routes/you.d.ts +10 -2
- package/dist/src/gateway/hono/routes/you.js +184 -28
- package/dist/src/gateway/service/run-gateway-agent.js +84 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +14 -0
- package/dist/src/proactive/insight-repository.d.ts +2 -0
- package/dist/src/proactive/insight-repository.js +5 -2
- package/dist/src/proactive/run-processor.js +22 -1
- package/dist/src/proactive/types.d.ts +2 -0
- package/dist/src/proactive/value-score.d.ts +13 -0
- package/dist/src/proactive/value-score.js +30 -0
- package/dist/src/share/share-types.js +5 -5
- package/dist/src/share/site-share-types.d.ts +1 -1
- package/dist/src/share/site-share-types.js +5 -5
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +46 -0
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
- package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
- package/dist/src/user-context/interaction-state.d.ts +13 -0
- package/dist/src/user-context/interaction-state.js +69 -0
- package/dist/src/user-context/memory-use-audit.d.ts +10 -0
- package/dist/src/user-context/memory-use-audit.js +25 -0
- package/dist/src/user-context/personal-playbook.d.ts +11 -0
- package/dist/src/user-context/personal-playbook.js +41 -0
- package/dist/src/user-context/projection.d.ts +4 -0
- package/dist/src/user-context/projection.js +5 -1
- package/dist/src/user-context/relationship-continuity.d.ts +14 -0
- package/dist/src/user-context/relationship-continuity.js +51 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
- package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
- package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
- package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
- package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
- package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
- package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
- package/dist/src/browser/pipeline/source.d.ts +0 -9
- package/dist/src/browser/pipeline/source.js +0 -77
|
@@ -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{d as i,l as a,t as o,u as s}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BwQ3WssU.js";import{l as u,n as d}from"./locale-store-0lpYdNDr.js";import{i as f}from"./theme-store-C1oaqeD2.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{Ac as m,Bo as h,Br as g,Bs as _,C as v,Cs as y,Cu as b,Ds as x,Du as S,Fi as C,Fr as w,Fs as T,Gr as E,Hi as D,Ho as O,Hr as k,Ii as A,Il as j,Ir as M,Is as N,It as P,Kr as F,Li as I,Ll as L,Lr as R,Mr as ee,Ni as z,Nr as B,Ns as te,Os as ne,Pi as V,Pl as re,Pr as ie,Qa as H,Qs as U,Ri as W,Ro as ae,Rr as G,Rt as oe,Sa as se,Ss as K,Ua as ce,Uc as le,Uo as ue,Ur as de,Vo as fe,Vr as pe,Wo as me,Wr as he,Yo as ge,Za as _e,Zo as ve,_a as ye,_c as be,_s as xe,_u as Se,as as Ce,ba as we,bn as Te,bo as Ee,cl as De,cs as Oe,ds as ke,ec as q,fu as Ae,ga as je,ha as Me,hn as Ne,is as Pe,jr as Fe,kl as Ie,ls as Le,ma as Re,mu as ze,n as Be,nc as Ve,nl as He,os as Ue,pn as We,r as Ge,rs as Ke,sc as qe,ss as Je,tl as J,ts as Ye,uc as Xe,us as Ze,va as Qe,vn as $e,vs as et,w as tt,wc as nt,wl as Y,ws as X,xa as rt,xc as it,ya as at,yn as ot,yo as st,yu as ct,zi as lt,zo as ut,zr as dt,zs as ft}from"./index-C8JkTS6d.js";import{t as pt}from"./markdown-editor-BvUebh3C.js";import{n as mt,r as ht}from"./settings-page-layout-D3srt5Bi.js";import{r as gt,t as _t}from"./settings-loading-skeleton-DEwYqESe.js";import{n as vt,t as yt}from"./settings-form-section-CARTHCxH.js";import{t as bt}from"./page-tabs-Caj1-E_X.js";import{n as xt}from"./agent-avatar-dicebear-Zf9UQEmQ.js";import{a as St,o as Ct,r as wt,s as Tt}from"./capability-presets-api-CNFl7dM3.js";import{a as Et,i as Dt,n as Ot,o as kt,t as At}from"./typed-models-lib-Divbg_C4.js";import{n as jt,r as Mt,t as Nt}from"./channel-recipient-api-DYQyGDw4.js";import{t as Pt}from"./directory-picker-path-field-DjSZAPz_.js";var Z=n(),Q=r();function Ft(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(O,{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=c(`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 g=a?f.purgeDisk:f.removeFromConfig,_;t[2]===g?_=t[3]:(_=(0,Q.jsx)(me,{className:`text-base font-semibold text-fg`,children:g}),t[2]=g,t[3]=_);let v=a?f.confirmDeletePurge:f.confirmDelete,y;t[4]===v?y=t[5]:(y=(0,Q.jsx)(fe,{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]!==s||t[10]!==a||t[11]!==o||t[12]!==l?(b=a&&o?(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:c(`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}}`,o.id),value:s,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==f.createModalCancel||t[15]!==i||t[16]!==d?(x=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,disabled:i,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=i,t[16]=d,t[17]=x):x=t[17];let S=a?`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]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(C=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=C):C=t[22];let w=a?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 D;t[31]!==E||t[32]!==_||t[33]!==y||t[34]!==b?(D=(0,Q.jsxs)(ue,{children:[p,(0,Q.jsxs)(h,{className:m,onOpenAutoFocus:It,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=D):D=t[35];let k;return t[36]!==r||t[37]!==n||t[38]!==D?(k=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=k):k=t[39],k}function It(e){return e.preventDefault()}var $=e(t(),1),Lt=[{id:`overview`,labelKey:`navOverview`,icon:Y},{id:`profile`,labelKey:`navProfile`,icon:q},{id:`capabilities`,labelKey:`navCapabilities`,icon:Se},{id:`runtime`,labelKey:`navRuntime`,icon:qe},{id:`connections`,labelKey:`navConnections`,icon:Ae},{id:`advanced`,labelKey:`navAdvanced`,icon:Ve},{id:`dangerZone`,labelKey:`navDangerZone`,icon:ft}];function Rt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:c(`flex w-auto shrink-0 items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors sm:w-full`,et.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]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s=n.editorNavAria,l;t[3]!==n||t[4]!==o?(l=Lt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex gap-1 pb-1 sm:flex-col sm:gap-0.5 sm:pb-0`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`w-full overflow-x-auto sm:overflow-visible`,"aria-label":s,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function zt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a:i,title:a,subtitle:o,panel:s,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:g}=e,_=p===void 0?!0:p,[v,y]=(0,$.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(O,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Ue)}),t[0]=b):b=t[0];let S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=c(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,Ce,`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]===a?C=t[3]:(C=(0,Q.jsx)(me,{className:`text-base font-semibold leading-snug text-fg`,children:a}),t[2]=a,t[3]=C);let w;t[4]===o?w=t[5]:(w=(0,Q.jsx)(fe,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o}),t[4]=o,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=c(xe,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=E):E=t[9];let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t[10]=D):D=t[10];let k;t[11]===i.closeDialogAria?k=t[12]:(k=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:E,"aria-label":i.closeDialogAria,children:D})}),t[11]=i.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]!==i||t[17]!==l||t[18]!==s?(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)(Rt,{a:i,panel:s,onPanelChange:l})}),t[16]=i,t[17]=l,t[18]=s,t[19]=j):j=t[19];let M;t[20]===g?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:g}),t[20]=g,t[21]=M);let N;t[22]!==i.footerSaveNotApplicable||t[23]!==i.personaSaved||t[24]!==i.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:[`✓ `,i.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:i.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:i.save})]}):null,t[22]=i.footerSaveNotApplicable,t[23]=i.personaSaved,t[24]=i.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]!==v||t[38]!==F||t[39]!==A?(I=(0,Q.jsxs)(ue,{children:[b,(0,Q.jsx)(h,{ref:y,className:S,onOpenAutoFocus:Bt,children:(0,Q.jsxs)(Pe,{layer:`modal`,portalContainer:v,children:[A,F]})})]}),t[37]=v,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)(ae,{open:n,onOpenChange:r,children:I}),t[41]=r,t[42]=n,t[43]=I,t[44]=L):L=t[44],L}function Bt(e){return e.preventDefault()}function Vt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s,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=i||`—`,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]!==a||t[5]!==r?(p=r===`inherit`&&a?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,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=c(`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`?o:s,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=c(`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 Ht(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)(vt,{icon:He,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)(Vt,{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)(Vt,{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)(yt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Ut(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Wt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),i=n.startsWith(`agent:`);r=c(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,i&&`bg-surface-base text-fg-muted`,!e&&!i&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let i;return t[2]!==n||t[3]!==r?(i=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function Gt(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`,i;t[2]===r?i=t[3]:(i=c(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=i);let a;t[4]!==e.value||t[5]!==i?(a=(0,Q.jsx)(`div`,{className:i,children:e.value}),t[4]=e.value,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.source?o=t[8]:(o=(0,Q.jsx)(Wt,{source:e.source}),t[7]=e.source,t[8]=o);let s;return t[9]!==n||t[10]!==a||t[11]!==o?(s=(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,a,o]}),t[9]=n,t[10]=a,t[11]=o,t[12]=s):s=t[12],s}function Kt(e,t){return e&&e.length>0?e.join(`, `):t}function qt(e){let t=(0,Z.c)(29),{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=()=>G(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}=p(i,a,o),u=s?.manifest,d;t[5]!==s?.presetChain||t[6]!==u?.extends?(d=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=d):d=t[7];let f=d,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveModelsTitle||t[14]!==n.effectiveNoPresets||t[15]!==n.effectiveNoToolPolicies||t[16]!==n.effectivePresetChain||t[17]!==n.effectiveSkillsTitle||t[18]!==n.effectiveTitle||t[19]!==n.effectiveToolsTitle||t[20]!==s?.sources||t[21]!==c||t[22]!==l||t[23]!==u||t[24]!==f){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Yt),i=Object.entries(u?.tools?.builtin??{}).sort(Jt),a=u?.skills,o=u?.boundaries,d;t[26]!==n.effectiveHint||t[27]!==n.effectiveTitle?(d=(0,Q.jsx)(vt,{icon:J,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[26]=n.effectiveHint,t[27]=n.effectiveTitle,t[28]=d):d=t[28],m=(0,Q.jsxs)(yt,{children:[d,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:f.length?f.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)(Gt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Ut(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Gt,{name:n,value:r.model,monoValue:!0,source:Ut(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)(Gt,{name:n,value:r.mode,source:Ut(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)(Gt,{name:`mode`,value:a?.mode??`all`,source:Ut(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Gt,{name:`allow`,value:Kt(a.allow,`—`),source:Ut(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Gt,{name:`deny`,value:Kt(a.deny,`—`),source:Ut(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.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Gt,{name:`requiresConfirmation`,value:Kt(o?.requiresConfirmation,`—`),source:Ut(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Gt,{name:`forbidden`,value:Kt(o?.forbidden,`—`),source:Ut(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Gt,{name:`escalation`,value:Kt(o?.escalation,`—`),source:Ut(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.effectiveModelsTitle,t[14]=n.effectiveNoPresets,t[15]=n.effectiveNoToolPolicies,t[16]=n.effectivePresetChain,t[17]=n.effectiveSkillsTitle,t[18]=n.effectiveTitle,t[19]=n.effectiveToolsTitle,t[20]=s?.sources,t[21]=c,t[22]=l,t[23]=u,t[24]=f,t[25]=m}else m=t[25];return m}function Jt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Yt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Xt(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 Zt(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 Qt(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)(Zt,{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)(Zt,{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)(Zt,{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)($t,{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)(en,{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)(rn,{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 $t(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)(Xt,{children:(0,Q.jsx)(Ht,{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 en(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(nn)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=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]=f):f=t[6];let p=f,m,h,g,v,y;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]!==p.description||t[21]!==p.id||t[22]!==p.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(tn).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;h=Xt,m=yt;let x;t[34]===c?x=t[35]:(x=()=>c(``),t[34]=c,t[35]=x);let C;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(L,{className:`size-3.5`,"aria-hidden":!0}),t[36]=C):C=t[36];let w;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==x?(w=(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:x,children:[C,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=x,t[40]=w):w=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==w?(g=(0,Q.jsx)(vt,{icon:q,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:w}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=w,t[44]=g):g=t[44];let T;t[45]!==p.id||t[46]!==c?(T=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=T):T=t[47];let E=p.name||n.capabilityPresetsGlobalDefault,D;t[48]===E?D=t[49]:(D=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:E}),t[48]=E,t[49]=D);let O;t[50]===n.capabilityPresetsGlobalDefault?O=t[51]:(O=(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]=O);let k;t[52]!==D||t[53]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D,O]}),t[52]=D,t[53]=O,t[54]=k):k=t[54];let A;t[55]===p.id?A=t[56]:(A=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=A);let j=p.description||n.capabilityPresetsGlobalDefaultHint,M;t[57]===j?M=t[58]:(M=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:j}),t[57]=j,t[58]=M);let N;t[59]!==T||t[60]!==k||t[61]!==A||t[62]!==M?(N=(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:T,children:[k,A,M]})}),t[59]=T,t[60]=k,t[61]=A,t[62]=M,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,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)(b,{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)(S,{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)(_,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 p-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),y=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)(Ye,{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:f,children:u.map(e=>(0,Q.jsx)(Ke,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(nt,{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]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=h,t[29]=g,t[30]=v,t[31]=y}else m=t[27],h=t[28],g=t[29],v=t[30],y=t[31];let x;t[64]!==m||t[65]!==g||t[66]!==v||t[67]!==y?(x=(0,Q.jsxs)(m,{children:[g,v,y]}),t[64]=m,t[65]=g,t[66]=v,t[67]=y,t[68]=x):x=t[68];let C;return t[69]!==h||t[70]!==x?(C=(0,Q.jsx)(h,{children:x}),t[69]=h,t[70]=x,t[71]=C):C=t[71],C}function tn(e){return e.id}function nn(e){return[e.id,e]}function rn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(Xt,{children:(0,Q.jsx)(qt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function an(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)(Xt,{children:r.id===`main`?(0,Q.jsx)(yt,{children:(0,Q.jsx)(vt,{icon:ft,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(yt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(vt,{icon:ft,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)(_,{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}function on(){return c(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,y,`dark:border-edge`)}function sn(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function cn(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}function ln(e){let t=(0,Z.c)(31),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:l,fileDraft:u,setFileDraft:d,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=f(un),v;t[0]!==n.missing||t[1]!==i?.files?(v=i?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=i?.files,t[2]=v):v=t[2];let y=v,b;t[3]===n.filesHint?b=t[4]:(b=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=b);let x;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesMarkdownEdit||t[8]!==n.filesMarkdownPreview||t[9]!==n.filesNavAria||t[10]!==n.filesSavingStatus||t[11]!==n.pickFile||t[12]!==n.tryInChat||t[13]!==a||t[14]!==u||t[15]!==p||t[16]!==y||t[17]!==i||t[18]!==r||t[19]!==s||t[20]!==_||t[21]!==g||t[22]!==h||t[23]!==m||t[24]!==o||t[25]!==d||t[26]!==l?(x=r?(0,Q.jsx)(_t,{rows:3}):i?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(bt,{items:y,activeTab:a??``,onChange:o,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:a?(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:c(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,et.press,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(U,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:c(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,et.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(j,{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)(le,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),s===`edit`?(0,Q.jsx)(`div`,{className:c(on(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(pt,{initialContent:u,onChange:d,isDark:_,className:`min-h-0 flex-1`},`${a??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:c(on(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(D,{content:u,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.filesMarkdownEdit,t[8]=n.filesMarkdownPreview,t[9]=n.filesNavAria,t[10]=n.filesSavingStatus,t[11]=n.pickFile,t[12]=n.tryInChat,t[13]=a,t[14]=u,t[15]=p,t[16]=y,t[17]=i,t[18]=r,t[19]=s,t[20]=_,t[21]=g,t[22]=h,t[23]=m,t[24]=o,t[25]=d,t[26]=l,t[27]=x):x=t[27];let S;return t[28]!==b||t[29]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[b,x]}),t[28]=b,t[29]=x,t[30]=S):S=t[30],S}function un(e){return e.resolved===`dark`}function dn(e){let t=(0,Z.c)(44),[n,r]=(0,$.useState)(`files`),{a:i}=e,a;t[0]===i.advancedHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.advancedHint}),t[0]=i.advancedHint,t[1]=a);let o;t[2]===i.advancedFilesTab?o=t[3]:(o={id:`files`,label:i.advancedFilesTab,icon:re},t[2]=i.advancedFilesTab,t[3]=o);let s;t[4]===i.advancedConfigTab?s=t[5]:(s={id:`config`,label:i.advancedConfigTab,icon:Ve},t[4]=i.advancedConfigTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.advancedNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(bt,{items:c,activeTab:n,onChange:r,ariaLabel:i.advancedNavAria,tabIdPrefix:`agent-advanced-tab`,panelIdPrefix:`agent-advanced-panel`}),t[9]=i.advancedNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.activeFile||t[19]!==e.agentModel||t[20]!==e.agentWorkspace||t[21]!==e.busy||t[22]!==e.capabilityPresets||t[23]!==e.defaultModel||t[24]!==e.defaultPresetId||t[25]!==e.defaultWorkspace||t[26]!==e.fileDraft||t[27]!==e.fileSaving||t[28]!==e.files||t[29]!==e.filesLoading||t[30]!==e.filesViewMode||t[31]!==e.onOpenCapabilityPreset||t[32]!==e.onTryInChat||t[33]!==e.onUpdateAgentExtends||t[34]!==e.profileEditorNonce||t[35]!==e.profileFileLoading||t[36]!==e.selected||t[37]!==e.setActiveFile||t[38]!==e.setFileDraft||t[39]!==e.setFilesViewMode?(d=n===`files`?(0,Q.jsx)(ln,{a:i,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,onTryInChat:e.onTryInChat}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-xs leading-5 text-fg-muted`,children:i.advancedRuntimeCoverageHint}),(0,Q.jsx)(Qt,{a:i,selected:e.selected,busy:e.busy,defaultModel:e.defaultModel,defaultWorkspace:e.defaultWorkspace,agentModel:e.agentModel,agentWorkspace:e.agentWorkspace,capabilityPresets:e.capabilityPresets,defaultPresetId:e.defaultPresetId,onUpdateAgentExtends:e.onUpdateAgentExtends,onOpenCapabilityPreset:e.onOpenCapabilityPreset})]}),t[16]=i,t[17]=n,t[18]=e.activeFile,t[19]=e.agentModel,t[20]=e.agentWorkspace,t[21]=e.busy,t[22]=e.capabilityPresets,t[23]=e.defaultModel,t[24]=e.defaultPresetId,t[25]=e.defaultWorkspace,t[26]=e.fileDraft,t[27]=e.fileSaving,t[28]=e.files,t[29]=e.filesLoading,t[30]=e.filesViewMode,t[31]=e.onOpenCapabilityPreset,t[32]=e.onTryInChat,t[33]=e.onUpdateAgentExtends,t[34]=e.profileEditorNonce,t[35]=e.profileFileLoading,t[36]=e.selected,t[37]=e.setActiveFile,t[38]=e.setFileDraft,t[39]=e.setFilesViewMode,t[40]=d):d=t[40];let f;return t[41]!==u||t[42]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[41]=u,t[42]=d,t[43]=f):f=t[43],f}function fn(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:i,skillsCatalogLoading:a,catalogForPick:s,skillsInherit:l,setSkillsInherit:u,skillsPick:d,setSkillsPick:f,onSaveSkills:p,hideInlineSave:m}=e,h;t[0]===r.skills.effectiveAllowlist?h=t[1]:(h=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]=h);let g=h,_;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(_=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(pn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=_):_=t[4];let v=_,y;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(y=(0,Q.jsx)(vt,{className:`shrink-0`,icon:ct,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=y):y=t[7];let b;t[8]===u?b=t[9]:(b=()=>u(!0),t[8]=u,t[9]=b);let x;t[10]!==n.skillsInherit||t[11]!==i||t[12]!==b?(x=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:i,onClick:b,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=i,t[12]=b,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==u||t[16]!==f?(S=()=>{u(!1),f(v())},t[14]=v,t[15]=u,t[16]=f,t[17]=S):S=t[17];let C;t[18]!==n.skillsCustomize||t[19]!==i||t[20]!==S?(C=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:i,onClick:S,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=i,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==x||t[23]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x,C]}),t[22]=x,t[23]=C,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=ve(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(o,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==w||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[w,E]}),t[28]=w,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==l?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):l?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=l,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==i||t[46]!==s||t[47]!==g||t[48]!==f||t[49]!==a||t[50]!==l||t[51]!==d?(M=a?(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:c(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,l&&`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=l?g(t):d.has(t),a=typeof e.description==`string`?e.description.trim():``,o=a||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:l||i,onChange:()=>{f(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:c(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!a&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=i,t[46]=s,t[47]=g,t[48]=f,t[49]=a,t[50]=l,t[51]=d,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==i||t[55]!==m||t[56]!==p?(N=m?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(X,{type:`button`,disabled:i,onClick:()=>void p(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=i,t[55]=m,t[56]=p,t[57]=N):N=t[57];let P;return t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==y?(P=(0,Q.jsxs)(yt,{className:`flex min-h-0 flex-1 flex-col`,children:[y,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=y,t[64]=P):P=t[64],P}function pn(e){return e.name||e.directoryId}var mn=[`write_file`,`apply_patch`,`exec_command`],hn=[`exec_command`,`image_generate`,`extensions`],gn=[`send_message`,`send_media`];function _n(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:i,disableSet:a,onDisableSetChange:o,defaultsDisableSet:s,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]===s?y=t[5]:(y=s??new Set,t[4]=s,t[5]=y);let b=y,x;t[6]!==b||t[7]!==a||t[8]!==n||t[9]!==o?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(a);t?r.delete(e):r.add(e),o(r)},t[6]=b,t[7]=a,t[8]=n,t[9]=o,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==o?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);o(t)},t[11]=v,t[12]=o,t[13]=C):C=t[13];let w=C,T;t[14]===o?T=t[15]:(T=()=>{o(new Set)},t[14]=o,t[15]=T);let E=T,D;t[16]!==r||t[17]!==o||t[18]!==h?(D=()=>{o(new Set([...r,...h]))},t[16]=r,t[17]=o,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=Tt(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(yn),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 Ct){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(vn),P=g||i,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:kt,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=L):L=t[38];let R=P||r.length===0&&h.length===0,ee;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==R?(ee=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:kt,disabled:R,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=R,t[42]=ee):ee=t[42];let z=P||r.length===0,B;t[43]===w?B=t[44]:(B=()=>w(mn),t[43]=w,t[44]=B);let te;t[45]!==f.quickReadOnlyWorkspace||t[46]!==z||t[47]!==B?(te=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:kt,disabled:z,onClick:B,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=z,t[47]=B,t[48]=te):te=t[48];let ne=P||r.length===0,V;t[49]===w?V=t[50]:(V=()=>w(hn),t[49]=w,t[50]=V);let re;t[51]!==f.quickHighRiskOff||t[52]!==ne||t[53]!==V?(re=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:kt,disabled:ne,onClick:V,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ne,t[53]=V,t[54]=re):re=t[54];let ie=P||r.length===0,H;t[55]===w?H=t[56]:(H=()=>w(gn),t[55]=w,t[56]=H);let U;t[57]!==f.quickNoOutbound||t[58]!==ie||t[59]!==H?(U=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:kt,disabled:ie,onClick:H,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ie,t[59]=H,t[60]=U):U=t[60];let W;t[61]!==L||t[62]!==ee||t[63]!==te||t[64]!==re||t[65]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,ee,te,re,U]}),t[61]=L,t[62]=ee,t[63]=te,t[64]=re,t[65]=U,t[66]=W):W=t[66];let ae;t[67]!==F||t[68]!==W?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,W]}),t[67]=F,t[68]=W,t[69]=ae):ae=t[69];let G;t[70]!==b||t[71]!==a||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]!==i||t[80]!==n||t[81]!==P||t[82]!==S?(G=i?(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`,i=n===`agentEntry`&&b.has(e),o=a.has(e),s=i?!1:!o,l=u(e);return(0,Q.jsx)(`li`,{className:c(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,i&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:c(`flex gap-3 text-sm`,i?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:s,disabled:i||P,onChange:()=>S(e,!s)}),(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,i?(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]=a,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]=i,t[80]=n,t[81]=P,t[82]=S,t[83]=G):G=t[83];let oe;return t[84]!==ae||t[85]!==G?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[ae,G]}),t[84]=ae,t[85]=G,t[86]=oe):oe=t[86],oe}function vn(e){return e.ids.length>0}function yn(e,t){return e.localeCompare(t)}function bn(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:a,toolEntryDisable:o,setToolEntryDisable:s,onSaveTools:c,onClearToolsEntry:u,hideInlineSave:f}=e,p=d(Sn),m;t[0]===p?m=t[1]:(m=l(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(xn)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===s?v=t[5]:(v=e=>{s(e)},t[4]=s,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)(vt,{className:`shrink-0`,icon:ne,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]!==a||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==w||t[28]!==y||t[29]!==_||t[30]!==E||t[31]!==o?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(_n,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:o,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:a,labels:E})}),t[24]=a,t[25]=r.builtinToolIds,t[26]=S,t[27]=w,t[28]=y,t[29]=_,t[30]=E,t[31]=o,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==a||t[35]!==f||t[36]!==c?(O=f?null:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void c(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=a,t[35]=f,t[36]=c,t[37]=O):O=t[37];let k;t[38]===u?k=t[39]:(k=()=>void u(),t[38]=u,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==a||t[42]!==k?(A=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=a,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)(yt,{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 xn(e){let t=String(e).trim();return t?[t]:[]}function Sn(e){return e.language}function Cn(e){let t=(0,Z.c)(36),[n,r]=(0,$.useState)(`tools`),{a:i}=e,a;t[0]===i.capabilitiesHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.capabilitiesHint}),t[0]=i.capabilitiesHint,t[1]=a);let o;t[2]===i.capabilitiesToolsTab?o=t[3]:(o={id:`tools`,label:i.capabilitiesToolsTab,icon:ne},t[2]=i.capabilitiesToolsTab,t[3]=o);let s;t[4]===i.capabilitiesSkillsTab?s=t[5]:(s={id:`skills`,label:i.capabilitiesSkillsTab,icon:it},t[4]=i.capabilitiesSkillsTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.capabilitiesNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(bt,{items:c,activeTab:n,onChange:r,ariaLabel:i.capabilitiesNavAria,tabIdPrefix:`agent-capabilities-tab`,panelIdPrefix:`agent-capabilities-panel`}),t[9]=i.capabilitiesNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.busy||t[19]!==e.catalogForPick||t[20]!==e.data||t[21]!==e.onClearToolsEntry||t[22]!==e.onSaveSkills||t[23]!==e.onSaveTools||t[24]!==e.selected||t[25]!==e.setSkillsInherit||t[26]!==e.setSkillsPick||t[27]!==e.setToolEntryDisable||t[28]!==e.skillsCatalogLoading||t[29]!==e.skillsInherit||t[30]!==e.skillsPick||t[31]!==e.toolEntryDisable?(d=n===`tools`?(0,Q.jsx)(bn,{a:i,data:e.data,selected:e.selected,busy:e.busy,toolEntryDisable:e.toolEntryDisable,setToolEntryDisable:e.setToolEntryDisable,onSaveTools:e.onSaveTools,onClearToolsEntry:e.onClearToolsEntry}):(0,Q.jsx)(fn,{a:i,selected:e.selected,busy:e.busy,skillsCatalogLoading:e.skillsCatalogLoading,catalogForPick:e.catalogForPick,skillsInherit:e.skillsInherit,setSkillsInherit:e.setSkillsInherit,skillsPick:e.skillsPick,setSkillsPick:e.setSkillsPick,onSaveSkills:e.onSaveSkills}),t[16]=i,t[17]=n,t[18]=e.busy,t[19]=e.catalogForPick,t[20]=e.data,t[21]=e.onClearToolsEntry,t[22]=e.onSaveSkills,t[23]=e.onSaveTools,t[24]=e.selected,t[25]=e.setSkillsInherit,t[26]=e.setSkillsPick,t[27]=e.setToolEntryDisable,t[28]=e.skillsCatalogLoading,t[29]=e.skillsInherit,t[30]=e.skillsPick,t[31]=e.toolEntryDisable,t[32]=d):d=t[32];let f;return t[33]!==u||t[34]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[33]=u,t[34]=d,t[35]=f):f=t[35],f}var wn=c(K,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function Tn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:m,sessionsLoading:h,newBindSessionIdx:g,setNewBindSessionIdx:_,newBindCustomPeer:v,setNewBindCustomPeer:y,onRefreshSessions:b,lastActiveLabels:x,selectRecipient:S}=e,C=!u&&(d||l.length>0),w;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(w=(0,Q.jsx)(vt,{className:`shrink-0`,icon:He,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=w):w=t[2];let T;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==a||t[6]!==i||t[7]!==r||t[8]!==o?(T=i?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(En)}):a.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:a.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:sn(e.match)}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${sn(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=a,t[6]=i,t[7]=r,t[8]=o,t[9]=T):T=t[9];let E;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p||t[17]!==y||t[18]!==_||t[19]!==d?(E=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(H,{className:`h-4 w-24`}),(0,Q.jsx)(H,{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:on(),value:f,onChange:e=>p(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)(Ye,{className:c(on(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(Ke,{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]=f,t[16]=p,t[17]=y,t[18]=_,t[19]=d,t[20]=E):E=t[20];let D;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]!==m||t[31]!==r||t[32]!==x||t[33]!==f||t[34]!==v||t[35]!==g||t[36]!==b||t[37]!==S||t[38]!==h||t[39]!==y||t[40]!==_||t[41]!==C?(D=C&&f.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||h||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,Q.jsx)(be,{className:c(`size-3.5`,h&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),h&&m.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(H,{className:`h-4 w-32`}),(0,Q.jsx)(H,{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)(Ye,{className:c(on(),`py-2`),value:g==null?``:String(g),disabled:r||!f.trim()||!!v.trim(),onChange:e=>{let t=e.target.value;_(t===``?null:Number(t))},children:[(0,Q.jsx)(Ke,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(Ke,{value:String(t),children:Nt(e,x)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!h?(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:c(on(),`min-w-0 w-full sm:flex-1`),value:v,onChange:e=>{y(e.target.value),e.target.value.trim()&&_(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(Ye,{className:wn,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(Ke,{value:``,children:S}),m.map(e=>(0,Q.jsx)(Ke,{value:e.chatId,children:Nt(e,x)},`${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]=m,t[31]=r,t[32]=x,t[33]=f,t[34]=v,t[35]=g,t[36]=b,t[37]=S,t[38]=h,t[39]=y,t[40]=_,t[41]=C,t[42]=D):D=t[42];let O;t[43]!==r||t[44]!==u||t[45]!==f?(O=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=O):O=t[46];let k;t[47]!==n.addBinding||t[48]!==O?(k=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(X,{type:`submit`,disabled:O,children:n.addBinding})}),t[47]=n.addBinding,t[48]=O,t[49]=k):k=t[49];let A;t[50]!==s||t[51]!==E||t[52]!==D||t[53]!==k?(A=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[E,D,k]}),t[50]=s,t[51]=E,t[52]=D,t[53]=k,t[54]=A):A=t[54];let j;return t[55]!==w||t[56]!==T||t[57]!==A?(j=(0,Q.jsxs)(yt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[w,T,A]}),t[55]=w,t[56]=T,t[57]=A,t[58]=j):j=t[58],j}function En(e,t){return(0,Q.jsx)(H,{className:`h-10 rounded-lg`},t)}function Dn(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 On(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,$.useRef)(null),[s,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=rt(n.trim());return e&&we(e.styleId)?e.styleId:ye[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await ie(t)}catch{}r(at(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 F(t,n),se(t),r(Qe)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{l(!1)}}},[i,t,r]),_=(e,t)=>{let r=rt(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...a?{id:a}:{},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:i.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:o,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:s,onClick:()=>o.current?.click(),children:[(0,Q.jsx)(N,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.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:ye.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,je[0]??t),className:c(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,et.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:Dn(e,i)},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:[je.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:c(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,et.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:xt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(Ze,{open:f,onOpenChange:p,children:[(0,Q.jsx)(ke,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:c(`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`,et.press),children:i.avatarMore})}),(0,Q.jsx)(Le,{children:(0,Q.jsxs)(Oe,{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:Dn(m,i)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Me.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:c(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,et.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:xt(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:i.personaAvatar}),(0,Q.jsx)(Re,{agentId:t,avatar:n,size:40}),n.trim()&&!rt(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 kn(e){let t=(0,Z.c)(180),{a:n,selected:r,busy:i,editName:a,setEditName:s,editDescription:l,setEditDescription:u,profileMarkdownLoading:p,profileDraft:g,updateIdentity:_,handleSoulTemplateChange:v,handleSoulContentChange:y,setAvatarDialogOpen:b,toggleSoulPreviewMode:S}=e,C=d(Mn),w=f(jn),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=on(),t[0]=T):T=t[0];let E=T,k;t[1]===C?k=t[2]:(k=(e,t)=>C===`zh`?t:e,t[1]=C,t[2]=k);let A=k;if(!r){let e;return t[3]===n.selectAgentHint?e=t[4]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[3]=n.selectAgentHint,t[4]=e),e}if(p||!g){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(_t,{rows:4}),t[5]=e):e=t[5],e}let M=g.identity,N=g.soulTemplate,P=g.soulCustomContent,F=g.soulEditorNonce,I=g.soulPreviewMode,R=g.avatarDialogOpen,ee;t[6]!==M.avatar||t[7]!==r.id?(ee=(0,Q.jsx)(Re,{agentId:r.id,avatar:M.avatar,size:36,className:`size-9 rounded-lg`}),t[6]=M.avatar,t[7]=r.id,t[8]=ee):ee=t[8];let z;t[9]===b?z=t[10]:(z=()=>b(!0),t[9]=b,t[10]=z);let B;t[11]!==n.avatarOpenSettingsAria||t[12]!==z?(B={onClick:z,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[11]=n.avatarOpenSettingsAria,t[12]=z,t[13]=B):B=t[13];let ne;t[14]!==n.personaSectionIdentity||t[15]!==n.personaSectionIdentityHint||t[16]!==ee||t[17]!==B?(ne=(0,Q.jsx)(vt,{icon:q,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:ee,iconInteractive:B}),t[14]=n.personaSectionIdentity,t[15]=n.personaSectionIdentityHint,t[16]=ee,t[17]=B,t[18]=ne):ne=t[18];let V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(O,{className:c(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,Ue)}),t[19]=V):V=t[19];let re;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(re=c(`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`,Ce),t[20]=re):re=t[20];let ie;t[21]===n.avatarPickerTitle?ie=t[22]:(ie=(0,Q.jsx)(me,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[21]=n.avatarPickerTitle,t[22]=ie);let H;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=c(xe,`shrink-0 p-1.5 hover:bg-surface-base`),t[23]=H):H=t[23];let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t[24]=U):U=t[24];let W;t[25]===n.closeDialogAria?W=t[26]:(W=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:H,"aria-label":n.closeDialogAria,children:U})}),t[25]=n.closeDialogAria,t[26]=W);let G;t[27]!==W||t[28]!==ie?(G=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[ie,W]}),t[27]=W,t[28]=ie,t[29]=G):G=t[29];let oe;t[30]===n.avatarRowHint?oe=t[31]:(oe=(0,Q.jsx)(fe,{className:`sr-only`,children:n.avatarRowHint}),t[30]=n.avatarRowHint,t[31]=oe);let se;t[32]===_?se=t[33]:(se=e=>_({avatar:e}),t[32]=_,t[33]=se);let K;t[34]!==n||t[35]!==M.avatar||t[36]!==r.id||t[37]!==se?(K=(0,Q.jsx)(On,{agentId:r.id,value:M.avatar,onChange:se,a:n}),t[34]=n,t[35]=M.avatar,t[36]=r.id,t[37]=se,t[38]=K):K=t[38];let ce;t[39]!==G||t[40]!==oe||t[41]!==K?(ce=(0,Q.jsxs)(ue,{children:[V,(0,Q.jsxs)(h,{className:re,onOpenAutoFocus:An,children:[G,oe,K]})]}),t[39]=G,t[40]=oe,t[41]=K,t[42]=ce):ce=t[42];let le;t[43]!==R||t[44]!==b||t[45]!==ce?(le=(0,Q.jsx)(ae,{open:R,onOpenChange:b,children:ce}),t[43]=R,t[44]=b,t[45]=ce,t[46]=le):le=t[46];let de;t[47]===n.displayName?de=t[48]:(de=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[47]=n.displayName,t[48]=de);let pe;t[49]!==s||t[50]!==_?(pe=e=>{s(e.target.value),_({name:e.target.value})},t[49]=s,t[50]=_,t[51]=pe):pe=t[51];let he;t[52]!==n.personaNamePlaceholder||t[53]!==a||t[54]!==pe?(he=(0,Q.jsx)(`input`,{className:E,value:a,onChange:pe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[52]=n.personaNamePlaceholder,t[53]=a,t[54]=pe,t[55]=he):he=t[55];let ge;t[56]!==de||t[57]!==he?(ge=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[de,he]}),t[56]=de,t[57]=he,t[58]=ge):ge=t[58];let _e;t[59]===n.personaEmoji?_e=t[60]:(_e=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[59]=n.personaEmoji,t[60]=_e);let ve;t[61]===_?ve=t[62]:(ve=e=>_({emoji:e.target.value}),t[61]=_,t[62]=ve);let ye;t[63]!==n.personaEmojiPlaceholder||t[64]!==M.emoji||t[65]!==ve?(ye=(0,Q.jsx)(`input`,{className:E,value:M.emoji,onChange:ve,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[63]=n.personaEmojiPlaceholder,t[64]=M.emoji,t[65]=ve,t[66]=ye):ye=t[66];let be;t[67]!==_e||t[68]!==ye?(be=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[_e,ye]}),t[67]=_e,t[68]=ye,t[69]=be):be=t[69];let Se;t[70]===n.agentDescription?Se=t[71]:(Se=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[70]=n.agentDescription,t[71]=Se);let we;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(we=c(E,`min-h-16 resize-y text-sm leading-relaxed`),t[72]=we):we=t[72];let Te;t[73]!==u||t[74]!==_?(Te=e=>{u(e.target.value),_({description:e.target.value})},t[73]=u,t[74]=_,t[75]=Te):Te=t[75];let Ee;t[76]!==n.agentDescriptionPlaceholder||t[77]!==l||t[78]!==Te?(Ee=(0,Q.jsx)(`textarea`,{className:we,value:l,onChange:Te,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[76]=n.agentDescriptionPlaceholder,t[77]=l,t[78]=Te,t[79]=Ee):Ee=t[79];let De;t[80]!==Se||t[81]!==Ee?(De=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[Se,Ee]}),t[80]=Se,t[81]=Ee,t[82]=De):De=t[82];let Oe;t[83]===n.personaCreature?Oe=t[84]:(Oe=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[83]=n.personaCreature,t[84]=Oe);let ke=We.some(e=>e.value===M.creature)?M.creature:`__custom__`,Ae;t[85]===_?Ae=t[86]:(Ae=e=>{if(e.target.value===`__custom__`){_({creature:``});return}_({creature:e.target.value})},t[85]=_,t[86]=Ae);let je;t[87]===A?je=t[88]:(je=We.map(e=>(0,Q.jsx)(Ke,{value:e.value,children:A(e.labelEn,e.labelZh)},e.value)),t[87]=A,t[88]=je);let Me;t[89]===A?Me=t[90]:(Me=A(`Custom…`,`自定义…`),t[89]=A,t[90]=Me);let Pe;t[91]===Me?Pe=t[92]:(Pe=(0,Q.jsx)(Ke,{value:`__custom__`,children:Me}),t[91]=Me,t[92]=Pe);let Fe;t[93]!==ke||t[94]!==Ae||t[95]!==je||t[96]!==Pe?(Fe=(0,Q.jsxs)(Ye,{className:E,value:ke,onChange:Ae,children:[je,Pe]}),t[93]=ke,t[94]=Ae,t[95]=je,t[96]=Pe,t[97]=Fe):Fe=t[97];let Ie;t[98]!==n.personaCreaturePlaceholder||t[99]!==M.creature||t[100]!==_?(Ie=We.some(e=>e.value===M.creature)?null:(0,Q.jsx)(`input`,{className:c(E,`mt-1 text-xs`),value:M.creature,onChange:e=>_({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[98]=n.personaCreaturePlaceholder,t[99]=M.creature,t[100]=_,t[101]=Ie):Ie=t[101];let Le;t[102]!==Oe||t[103]!==Fe||t[104]!==Ie?(Le=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Oe,Fe,Ie]}),t[102]=Oe,t[103]=Fe,t[104]=Ie,t[105]=Le):Le=t[105];let Be;t[106]!==ge||t[107]!==be||t[108]!==De||t[109]!==Le?(Be=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[ge,be,De,Le]}),t[106]=ge,t[107]=be,t[108]=De,t[109]=Le,t[110]=Be):Be=t[110];let Ve;t[111]!==le||t[112]!==Be||t[113]!==ne?(Ve=(0,Q.jsxs)(yt,{children:[ne,le,Be]}),t[111]=le,t[112]=Be,t[113]=ne,t[114]=Ve):Ve=t[114];let He;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsx)(ze,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[115]=He):He=t[115];let Ge;t[116]===n.sharedUserContextTitle?Ge=t[117]:(Ge=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.sharedUserContextTitle}),t[116]=n.sharedUserContextTitle,t[117]=Ge);let qe;t[118]===n.sharedUserContextHint?qe=t[119]:(qe=(0,Q.jsx)(`p`,{className:`mt-0.5 max-w-[68ch] text-xs leading-5 text-fg-muted`,children:n.sharedUserContextHint}),t[118]=n.sharedUserContextHint,t[119]=qe);let Je;t[120]!==Ge||t[121]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Ge,qe]}),t[120]=Ge,t[121]=qe,t[122]=Je):Je=t[122];let J;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(L,{className:`size-3`,"aria-hidden":!0}),t[123]=J):J=t[123];let Xe;t[124]===n.sharedUserContextLink?Xe=t[125]:(Xe=(0,Q.jsxs)(o,{to:`/you`,className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.sharedUserContextLink,J]}),t[124]=n.sharedUserContextLink,t[125]=Xe);let Ze;t[126]!==Je||t[127]!==Xe?(Ze=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[He,Je,Xe]}),t[126]=Je,t[127]=Xe,t[128]=Ze):Ze=t[128];let Qe;t[129]!==n.personaSectionSoul||t[130]!==n.personaSectionSoulHint?(Qe=(0,Q.jsx)(vt,{icon:te,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),t[129]=n.personaSectionSoul,t[130]=n.personaSectionSoulHint,t[131]=Qe):Qe=t[131];let $e;t[132]===n.personaSoulTemplate?$e=t[133]:($e=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),t[132]=n.personaSoulTemplate,t[133]=$e);let et;t[134]===v?et=t[135]:(et=e=>v(e.target.value),t[134]=v,t[135]=et);let tt;t[136]===A?tt=t[137]:(tt=Ne.map(e=>(0,Q.jsxs)(Ke,{value:e.id,children:[e.emoji,` `,A(e.labelEn,e.labelZh)]},e.id)),t[136]=A,t[137]=tt);let nt;t[138]!==i||t[139]!==N||t[140]!==et||t[141]!==tt?(nt=(0,Q.jsx)(Ye,{className:E,value:N,onChange:et,disabled:i,children:tt}),t[138]=i,t[139]=N,t[140]=et,t[141]=tt,t[142]=nt):nt=t[142];let Y;t[143]===n.personaTemplateHint?Y=t[144]:(Y=(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.personaTemplateHint}),t[143]=n.personaTemplateHint,t[144]=Y);let X;t[145]!==$e||t[146]!==nt||t[147]!==Y?(X=(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:max-w-sm`,children:[$e,nt,Y]}),t[145]=$e,t[146]=nt,t[147]=Y,t[148]=X):X=t[148];let rt;t[149]===n.personaBehaviorEditorLabel?rt=t[150]:(rt=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaBehaviorEditorLabel}),t[149]=n.personaBehaviorEditorLabel,t[150]=rt);let it;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(it=c(xe,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),t[151]=it):it=t[151];let at=I?n.personaSoulEdit:n.personaSoulPreview,ot=I?n.personaSoulEdit:n.personaSoulPreview,st;t[152]===I?st=t[153]:(st=I?(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t[152]=I,t[153]=st);let ct;t[154]!==at||t[155]!==ot||t[156]!==st||t[157]!==S?(ct=(0,Q.jsx)(`button`,{type:`button`,className:it,title:at,"aria-label":ot,onClick:S,children:st}),t[154]=at,t[155]=ot,t[156]=st,t[157]=S,t[158]=ct):ct=t[158];let lt;t[159]!==rt||t[160]!==ct?(lt=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[rt,ct]}),t[159]=rt,t[160]=ct,t[161]=lt):lt=t[161];let dt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(dt=c(E,`flex min-h-64 flex-col overflow-hidden p-0`),t[162]=dt):dt=t[162];let ft;t[163]!==y||t[164]!==w||t[165]!==P||t[166]!==F||t[167]!==I?(ft=(0,Q.jsx)(`div`,{className:dt,children:I?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(D,{content:P})}):(0,Q.jsx)(pt,{initialContent:P,onChange:y,isDark:w,className:`min-h-0 flex-1`},`soul-${F}`)}),t[163]=y,t[164]=w,t[165]=P,t[166]=F,t[167]=I,t[168]=ft):ft=t[168];let mt;t[169]!==lt||t[170]!==ft?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[lt,ft]}),t[169]=lt,t[170]=ft,t[171]=mt):mt=t[171];let ht;t[172]!==Qe||t[173]!==X||t[174]!==mt?(ht=(0,Q.jsxs)(yt,{children:[Qe,X,mt]}),t[172]=Qe,t[173]=X,t[174]=mt,t[175]=ht):ht=t[175];let gt;return t[176]!==Ve||t[177]!==Ze||t[178]!==ht?(gt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[Ve,Ze,ht]}),t[176]=Ve,t[177]=Ze,t[178]=ht,t[179]=gt):gt=t[179],gt}function An(e){return e.preventDefault()}function jn(e){return e.resolved===`dark`}function Mn(e){return e.language}function Nn(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 Pn(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 Fn(e){let t=(0,Z.c)(117),{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=ee(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=Fe(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)(Re,{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 j;t[36]!==A||t[37]!==w?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[w,A]}),t[36]=A,t[37]=w,t[38]=j):j=t[38];let M;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(M=d?(0,Q.jsxs)(X,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(le,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=M):M=t[42];let N;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(N=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]=N):N=t[47];let P;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(P=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]=P):P=t[52];let F;t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[M,N,P]}),t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==j||t[58]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[j,F]}),t[57]=j,t[58]=F,t[59]=I):I=t[59];let L;t[60]===h?L=t[61]:(L=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=L);let R;t[62]!==I||t[63]!==L?(R=(0,Q.jsx)(yt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[I,L]})}),t[62]=I,t[63]=L,t[64]=R):R=t[64];let z;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(z=(0,Q.jsx)(vt,{icon:q,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=z):z=t[67];let B;t[68]!==n.modelPrimary||t[69]!==b||t[70]!==_?(B=(0,Q.jsx)(Nn,{label:n.modelPrimary,value:_,badge:b,mono:!0}),t[68]=n.modelPrimary,t[69]=b,t[70]=_,t[71]=B):B=t[71];let te;t[72]!==n.workspacePath||t[73]!==x||t[74]!==y?(te=(0,Q.jsx)(Nn,{label:n.workspacePath,value:y,badge:x,mono:!0}),t[72]=n.workspacePath,t[73]=x,t[74]=y,t[75]=te):te=t[75];let V;t[76]!==B||t[77]!==te?(V=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[B,te]}),t[76]=B,t[77]=te,t[78]=V):V=t[78];let re;t[79]!==z||t[80]!==V?(re=(0,Q.jsxs)(yt,{children:[z,V]}),t[79]=z,t[80]=V,t[81]=re):re=t[81];let ie;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(ie=(0,Q.jsx)(vt,{icon:Se,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=ie):ie=t[84];let H;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==S?(H=S>0?n.listToolsDisabledCount.replace(`{{count}}`,String(S)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=S,t[88]=H):H=t[88];let U;t[89]!==n.listToolsLabel||t[90]!==H?(U=(0,Q.jsx)(Pn,{icon:ne,label:n.listToolsLabel,value:H}),t[89]=n.listToolsLabel,t[90]=H,t[91]=U):U=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 ae;t[96]!==n.listSkillsLabel||t[97]!==W?(ae=(0,Q.jsx)(Pn,{icon:q,label:n.listSkillsLabel,value:W}),t[96]=n.listSkillsLabel,t[97]=W,t[98]=ae):ae=t[98];let G;t[99]!==n.connectionsTitle||t[100]!==n.overviewConnectionsManaged?(G=(0,Q.jsx)(Pn,{icon:Ae,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[99]=n.connectionsTitle,t[100]=n.overviewConnectionsManaged,t[101]=G):G=t[101];let oe;t[102]!==n.overviewSharedMemoryLabel||t[103]!==n.overviewSharedMemoryValue?(oe=(0,Q.jsx)(Pn,{icon:ze,label:n.overviewSharedMemoryLabel,value:n.overviewSharedMemoryValue}),t[102]=n.overviewSharedMemoryLabel,t[103]=n.overviewSharedMemoryValue,t[104]=oe):oe=t[104];let se;t[105]!==U||t[106]!==ae||t[107]!==G||t[108]!==oe?(se=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[U,ae,G,oe]}),t[105]=U,t[106]=ae,t[107]=G,t[108]=oe,t[109]=se):se=t[109];let K;t[110]!==ie||t[111]!==se?(K=(0,Q.jsxs)(yt,{children:[ie,se]}),t[110]=ie,t[111]=se,t[112]=K):K=t[112];let ce;return t[113]!==R||t[114]!==re||t[115]!==K?(ce=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[R,re,K]}),t[113]=R,t[114]=re,t[115]=K,t[116]=ce):ce=t[116],ce}function In(e){let t=(0,Z.c)(73),{a:n,chat:r,selected:i,busy:a,modelRows:s,setModelRows:c,onSaveModels:l,onClearModelsEntry:u,hideInlineSave:d}=e,f;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(f=(0,Q.jsx)(vt,{className:`shrink-0`,icon:De,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=f):f=t[2];let p;t[3]===n.modelsPresetLabel?p=t[4]:(p=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=p);let m;t[5]===i.typedModels.preset?m=t[6]:(m=Ot(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=m);let h;t[7]!==p||t[8]!==m?(h=(0,Q.jsxs)(`div`,{children:[p,` `,m]}),t[7]=p,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.modelsEffectiveLabel?g=t[11]:(g=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=g);let _;t[12]===i.typedModels.effective?_=t[13]:(_=Ot(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=_);let v;t[14]!==g||t[15]!==_?(v=(0,Q.jsxs)(`div`,{children:[g,` `,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==h||t[18]!==v?(y=(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:[h,v]}),t[17]=h,t[18]=v,t[19]=y):y=t[19];let b;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]!==n.typedModelVisionAutoHint||t[40]!==n.typedModelVisionBadge?(b={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,visionBadge:n.typedModelVisionBadge,visionAutoHint:n.typedModelVisionAutoHint,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]=n.typedModelVisionAutoHint,t[40]=n.typedModelVisionBadge,t[41]=b):b=t[41];let x;t[42]!==a||t[43]!==r||t[44]!==s||t[45]!==i.typedModels.defaultRole||t[46]!==c||t[47]!==b?(x=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(St,{rows:s,onChange:c,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:b})}),t[42]=a,t[43]=r,t[44]=s,t[45]=i.typedModels.defaultRole,t[46]=c,t[47]=b,t[48]=x):x=t[48];let S;t[49]!==n.modelsSave||t[50]!==a||t[51]!==d||t[52]!==l?(S=d?null:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void l(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=d,t[52]=l,t[53]=S):S=t[53];let C;t[54]===u?C=t[55]:(C=()=>void u(),t[54]=u,t[55]=C);let w;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==C?(w=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:C,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=C,t[59]=w):w=t[59];let T,E;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(T=ge(`models`),E=(0,Q.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),t[60]=T,t[61]=E):(T=t[60],E=t[61]);let D;t[62]===n.modelsDefaultsLink?D=t[63]:(D=(0,Q.jsx)(X,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(o,{to:T,children:[E,n.modelsDefaultsLink]})}),t[62]=n.modelsDefaultsLink,t[63]=D);let O;t[64]!==S||t[65]!==w||t[66]!==D?(O=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[S,w,D]}),t[64]=S,t[65]=w,t[66]=D,t[67]=O):O=t[67];let k;return t[68]!==f||t[69]!==O||t[70]!==y||t[71]!==x?(k=(0,Q.jsxs)(yt,{className:`flex min-h-0 flex-1 flex-col`,children:[f,y,x,O]}),t[68]=f,t[69]=O,t[70]=y,t[71]=x,t[72]=k):k=t[72],k}function Ln(e){let t=(0,Z.c)(29),{a:n,chat:r,selected:i,busy:a,editWorkspace:o,setEditWorkspace:s,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f}=e,p;t[0]!==n.runtimeWorkspaceHint||t[1]!==n.runtimeWorkspaceTitle?(p=(0,Q.jsx)(vt,{icon:Ie,title:n.runtimeWorkspaceTitle,subtitle:n.runtimeWorkspaceHint}),t[0]=n.runtimeWorkspaceHint,t[1]=n.runtimeWorkspaceTitle,t[2]=p):p=t[2];let m;t[3]===n.workspacePath?m=t[4]:(m=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[3]=n.workspacePath,t[4]=m);let h=r.workingDirectory,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=c(on(),`font-mono text-xs`),t[5]=g):g=t[5];let _;t[6]!==a||t[7]!==r.workingDirectory||t[8]!==o||t[9]!==s?(_=(0,Q.jsx)(Pt,{value:o,onChange:s,disabled:a,wd:h,inputClassName:g}),t[6]=a,t[7]=r.workingDirectory,t[8]=o,t[9]=s,t[10]=_):_=t[10];let v;t[11]!==m||t[12]!==_?(v=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[m,_]}),t[11]=m,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==v?(y=(0,Q.jsxs)(yt,{children:[p,v]}),t[14]=p,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==n||t[18]!==a||t[19]!==r||t[20]!==l||t[21]!==f||t[22]!==d||t[23]!==i||t[24]!==u?(b=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(In,{a:n,chat:r,selected:i,busy:a,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f,hideInlineSave:!0})}),t[17]=n,t[18]=a,t[19]=r,t[20]=l,t[21]=f,t[22]=d,t[23]=i,t[24]=u,t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function Rn(e){let t=(0,Z.c)(107),{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,defaultModel:g,defaultWorkspace:_,onSetDefault:v,onSetTuiDefault:y,isTuiDefault:b,isTuiDefaultInherited:x,onDelete:S,capabilityPresets:C,defaultPresetId:w,onUpdateAgentExtends:T,onOpenCapabilityPreset:E,overviewProfile:D,filesLoading:O,files:k,activeFile:A,setActiveFile:j,filesViewMode:M,setFilesViewMode:N,fileDraft:P,setFileDraft:F,fileSaving:I,profileFileLoading:L,profileEditorNonce:R,toolEntryDisable:ee,setToolEntryDisable:z,onSaveTools:B,onClearToolsEntry:te,modelRows:ne,setModelRows:V,onSaveModels:re,onClearModelsEntry:ie,skillsCatalogLoading:H,catalogForPick:U,skillsInherit:W,setSkillsInherit:ae,skillsPick:G,setSkillsPick:oe,onSaveSkills:se,bindingsLoading:K,agentBindings:ce,bindChannelStatuses:le,bindChannelsLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Se,onTryInChat:Ce}=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]!==g||t[5]!==_||t[6]!==b||t[7]!==x||t[8]!==v||t[9]!==y||t[10]!==Ce||t[11]!==a?(e=(0,Q.jsx)(Fn,{a:n,selected:a,defaultModel:g,defaultWorkspace:_,isTuiDefault:b,isTuiDefaultInherited:x,busy:c,onSetDefault:v,onSetTuiDefault:y,onTryInChat:Ce}),t[2]=n,t[3]=c,t[4]=g,t[5]=_,t[6]=b,t[7]=x,t[8]=v,t[9]=y,t[10]=Ce,t[11]=a,t[12]=e):e=t[12],e}if(o===`profile`){let e;return t[13]!==n||t[14]!==c||t[15]!==d||t[16]!==l||t[17]!==D.draft||t[18]!==D.handleSoulContentChange||t[19]!==D.handleSoulTemplateChange||t[20]!==D.profileMarkdownLoading||t[21]!==D.setAvatarDialogOpen||t[22]!==D.toggleSoulPreviewMode||t[23]!==D.updateIdentity||t[24]!==a||t[25]!==f||t[26]!==u?(e=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Q.jsx)(kn,{a:n,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,profileMarkdownLoading:D.profileMarkdownLoading,profileDraft:D.draft,updateIdentity:D.updateIdentity,handleSoulTemplateChange:D.handleSoulTemplateChange,handleSoulContentChange:D.handleSoulContentChange,setAvatarDialogOpen:D.setAvatarDialogOpen,toggleSoulPreviewMode:D.toggleSoulPreviewMode})}),t[13]=n,t[14]=c,t[15]=d,t[16]=l,t[17]=D.draft,t[18]=D.handleSoulContentChange,t[19]=D.handleSoulTemplateChange,t[20]=D.profileMarkdownLoading,t[21]=D.setAvatarDialogOpen,t[22]=D.toggleSoulPreviewMode,t[23]=D.updateIdentity,t[24]=a,t[25]=f,t[26]=u,t[27]=e):e=t[27],e}if(o===`capabilities`){let e;return t[28]!==n||t[29]!==c||t[30]!==U||t[31]!==s||t[32]!==te||t[33]!==se||t[34]!==B||t[35]!==a||t[36]!==ae||t[37]!==oe||t[38]!==z||t[39]!==H||t[40]!==W||t[41]!==G||t[42]!==ee?(e=(0,Q.jsx)(Cn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:ee,setToolEntryDisable:z,onSaveTools:B,onClearToolsEntry:te,skillsCatalogLoading:H,catalogForPick:U,skillsInherit:W,setSkillsInherit:ae,skillsPick:G,setSkillsPick:oe,onSaveSkills:se}),t[28]=n,t[29]=c,t[30]=U,t[31]=s,t[32]=te,t[33]=se,t[34]=B,t[35]=a,t[36]=ae,t[37]=oe,t[38]=z,t[39]=H,t[40]=W,t[41]=G,t[42]=ee,t[43]=e):e=t[43],e}if(o===`runtime`){let e;return t[44]!==n||t[45]!==c||t[46]!==r||t[47]!==p||t[48]!==ne||t[49]!==ie||t[50]!==re||t[51]!==a||t[52]!==m||t[53]!==V?(e=(0,Q.jsx)(Ln,{a:n,chat:r,selected:a,busy:c,editWorkspace:p,setEditWorkspace:m,modelRows:ne,setModelRows:V,onSaveModels:re,onClearModelsEntry:ie}),t[44]=n,t[45]=c,t[46]=r,t[47]=p,t[48]=ne,t[49]=ie,t[50]=re,t[51]=a,t[52]=m,t[53]=V,t[54]=e):e=t[54],e}if(o===`connections`){let e;return t[55]!==n||t[56]!==ce||t[57]!==le||t[58]!==ue||t[59]!==me||t[60]!==he||t[61]!==K||t[62]!==c||t[63]!==i.lastActiveLabels||t[64]!==i.selectRecipient||t[65]!==fe||t[66]!==ve||t[67]!==ge||t[68]!==Se||t[69]!==xe||t[70]!==be||t[71]!==pe||t[72]!==ye||t[73]!==_e||t[74]!==de?(e=(0,Q.jsx)(Tn,{a:n,busy:c,bindingsLoading:K,agentBindings:ce,channelStatuses:le,channelsStatusLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,sessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Se}),t[55]=n,t[56]=ce,t[57]=le,t[58]=ue,t[59]=me,t[60]=he,t[61]=K,t[62]=c,t[63]=i.lastActiveLabels,t[64]=i.selectRecipient,t[65]=fe,t[66]=ve,t[67]=ge,t[68]=Se,t[69]=xe,t[70]=be,t[71]=pe,t[72]=ye,t[73]=_e,t[74]=de,t[75]=e):e=t[75],e}if(o===`advanced`){let e;return t[76]!==n||t[77]!==A||t[78]!==c||t[79]!==C||t[80]!==g||t[81]!==w||t[82]!==_||t[83]!==h||t[84]!==p||t[85]!==P||t[86]!==I||t[87]!==k||t[88]!==O||t[89]!==M||t[90]!==E||t[91]!==Ce||t[92]!==T||t[93]!==R||t[94]!==L||t[95]!==a||t[96]!==j||t[97]!==F||t[98]!==N?(e=(0,Q.jsx)(dn,{a:n,selected:a,busy:c,defaultModel:g,defaultWorkspace:_,agentModel:h,agentWorkspace:p,capabilityPresets:C,defaultPresetId:w,onUpdateAgentExtends:T,onOpenCapabilityPreset:E,filesLoading:O,files:k,activeFile:A,setActiveFile:j,filesViewMode:M,setFilesViewMode:N,fileDraft:P,setFileDraft:F,fileSaving:I,profileFileLoading:L,profileEditorNonce:R,onTryInChat:Ce}),t[76]=n,t[77]=A,t[78]=c,t[79]=C,t[80]=g,t[81]=w,t[82]=_,t[83]=h,t[84]=p,t[85]=P,t[86]=I,t[87]=k,t[88]=O,t[89]=M,t[90]=E,t[91]=Ce,t[92]=T,t[93]=R,t[94]=L,t[95]=a,t[96]=j,t[97]=F,t[98]=N,t[99]=e):e=t[99],e}if(o===`dangerZone`){let e;return t[100]!==n||t[101]!==c||t[102]!==S||t[103]!==a?(e=(0,Q.jsx)(an,{a:n,selected:a,busy:c,onDelete:S}),t[100]=n,t[101]=c,t[102]=S,t[103]=a,t[104]=e):e=t[104],e}let we;return t[105]===n.selectAgentHint?we=t[106]:(we=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[105]=n.selectAgentHint,t[106]=we),we}function zn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=ee(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=Fe(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Bn(e,t){return e.replace(`{{count}}`,String(t))}function Vn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Bn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Bn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Hn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Bn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Bn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Un(e){let t=(0,Z.c)(11),{text:n,children:r,className:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(W,{asChild:!0,children:(0,Q.jsx)(`span`,{className:i,title:n,children:r})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=c(`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`,Je),t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(z,{className:`fill-surface-panel`}),t[5]=s):s=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(C,{children:(0,Q.jsxs)(V,{side:`top`,align:`start`,sideOffset:6,className:o,children:[n,s]})}),t[6]=n,t[7]=l);let u;return t[8]!==a||t[9]!==l?(u=(0,Q.jsx)(A,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(I,{children:[a,l]})}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function Wn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:i,tuiDefaultAgentId:a,tuiDefaultInherited:o,searchQuery:s,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==i||t[4]!==u||t[5]!==l||t[6]!==s||t[7]!==a||t[8]!==o){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=zn(r,s,n),_=r.length>0&&e.length===0&&s.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]!==i||t[22]!==u||t[23]!==l||t[24]!==a||t[25]!==o?(v=e=>{let t=ee(e,n),r=e.id,s=Fe(e,n),f=Vn(e,n),p=Hn(e,n),m=e.id===i||e.isDefault,h=e.id===a,g=h&&o,_=h&&!o;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:c(`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`,et.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)(Re,{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 p-3`,children:(0,Q.jsx)(`p`,{className:c(`line-clamp-2 text-sm leading-5`,s?`text-fg`:`text-fg-muted`),title:s||void 0,children:s||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Gn)})]}),(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)(le,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=i,t[22]=u,t[23]=l,t[24]=a,t[25]=o,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=i,t[4]=u,t[5]=l,t[6]=s,t[7]=a,t[8]=o,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 Gn(e){return(0,Q.jsx)(Un,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Kn(e){let t=(0,Z.c)(163),{open:n,onOpenChange:r,a:i,chat:a,busy:o,modalError:s,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,setCreateDescription:g,createWorkspace:_,setCreateWorkspace:v,createModel:y,setCreateModel:b,onCreate:S,onSuggestWorkspace:C,agents:w,duplicateSourceId:E,onSelectDuplicateSource:D,capabilityPlans:k,defaultPresetId:A,selectedCapabilityPlanIds:j,onSelectedCapabilityPlanIdsChange:M}=e,[N,F]=(0,$.useState)(null),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(O,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Ue)}),t[0]=I):I=t[0];let L;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(L=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,680px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,Ce,`overflow-hidden rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=L):L=t[1];let R;t[2]===i.addAgent?R=t[3]:(R=(0,Q.jsx)(me,{className:`text-base font-semibold text-fg`,children:i.addAgent}),t[2]=i.addAgent,t[3]=R);let z;t[4]===i.addAgentHint?z=t[5]:(z=(0,Q.jsx)(fe,{className:`mt-0.5 text-xs text-fg-muted`,children:i.addAgentHint}),t[4]=i.addAgentHint,t[5]=z);let B;t[6]!==R||t[7]!==z?(B=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[R,z]}),t[6]=R,t[7]=z,t[8]=B):B=t[8];let te;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(te=c(xe,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=te):te=t[9];let ne;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t[10]=ne):ne=t[10];let V;t[11]===i.closeDialogAria?V=t[12]:(V=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:te,"aria-label":i.closeDialogAria,children:ne})}),t[11]=i.closeDialogAria,t[12]=V);let re;t[13]!==B||t[14]!==V?(re=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[B,V]}),t[13]=B,t[14]=V,t[15]=re):re=t[15];let ie;t[16]!==i||t[17]!==w||t[18]!==E||t[19]!==D?(ie=w.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.copyFromExistingAgent}),(0,Q.jsxs)(Ye,{className:c(on(),`bg-surface-panel`),value:E??``,onChange:e=>D(e.target.value||null),children:[(0,Q.jsx)(Ke,{value:``,children:i.copyFromExistingAgentNone}),w.map(e=>(0,Q.jsxs)(Ke,{value:e.id,children:[ee(e,i),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.duplicateAgentHint})]}):null,t[16]=i,t[17]=w,t[18]=E,t[19]=D,t[20]=ie):ie=t[20];let H;t[21]===i.createCapabilityPlansTitle?H=t[22]:(H=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:i.createCapabilityPlansTitle}),t[21]=i.createCapabilityPlansTitle,t[22]=H);let U;t[23]===i.createCapabilityPlansHint?U=t[24]:(U=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:i.createCapabilityPlansHint}),t[23]=i.createCapabilityPlansHint,t[24]=U);let W;t[25]!==i.capabilityPresetsGlobalDefault||t[26]!==k||t[27]!==A?(W=k.find(e=>e.id===A)?.name??i.capabilityPresetsGlobalDefault,t[25]=i.capabilityPresetsGlobalDefault,t[26]=k,t[27]=A,t[28]=W):W=t[28];let G;t[29]===W?G=t[30]:(G=(0,Q.jsx)(`div`,{className:`mt-2 rounded-md bg-accent/5 px-2.5 py-2 text-xs text-fg-muted`,children:W}),t[29]=W,t[30]=G);let oe;if(t[31]!==o||t[32]!==k||t[33]!==A||t[34]!==M||t[35]!==j){let e;t[37]===A?e=t[38]:(e=e=>e.id!==A,t[37]=A,t[38]=e);let n;t[39]!==o||t[40]!==M||t[41]!==j?(n=e=>{let t=j.includes(e.id);return(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-panel px-2.5 py-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:o,onChange:()=>M(t?j.filter(t=>t!==e.id):[...j,e.id])}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)},t[39]=o,t[40]=M,t[41]=j,t[42]=n):n=t[42],oe=k.filter(e).map(n),t[31]=o,t[32]=k,t[33]=A,t[34]=M,t[35]=j,t[36]=oe}else oe=t[36];let se;t[43]===oe?se=t[44]:(se=(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:oe}),t[43]=oe,t[44]=se);let K;t[45]!==H||t[46]!==U||t[47]!==G||t[48]!==se?(K=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-3 dark:border-edge`,children:[H,U,G,se]}),t[45]=H,t[46]=U,t[47]=G,t[48]=se,t[49]=K):K=t[49];let ce;t[50]===s?ce=t[51]:(ce=s?(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:s}):null,t[50]=s,t[51]=ce);let le;t[52]!==i.newAgentLabel||t[53]!==l?(le=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.newAgentLabel,` (`,l,`)`]}),t[52]=i.newAgentLabel,t[53]=l,t[54]=le):le=t[54];let de;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(de=on(),t[55]=de):de=t[55];let pe;t[56]===d?pe=t[57]:(pe=e=>d(e.target.value),t[56]=d,t[57]=pe);let he;t[58]===C?he=t[59]:(he=()=>C(),t[58]=C,t[59]=he);let ge;t[60]!==u||t[61]!==pe||t[62]!==he?(ge=(0,Q.jsx)(`input`,{className:de,value:u,onChange:pe,onBlur:he,required:!0,autoComplete:`off`}),t[60]=u,t[61]=pe,t[62]=he,t[63]=ge):ge=t[63];let _e;t[64]!==le||t[65]!==ge?(_e=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[le,ge]}),t[64]=le,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]===i.newAgentIdOptional?ve=t[68]:(ve=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newAgentIdOptional}),t[67]=i.newAgentIdOptional,t[68]=ve);let ye;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ye=c(on(),`font-mono text-xs`),t[69]=ye):ye=t[69];let be;t[70]===p?be=t[71]:(be=e=>p(e.target.value),t[70]=p,t[71]=be);let Se;t[72]===C?Se=t[73]:(Se=()=>C(),t[72]=C,t[73]=Se);let we;t[74]!==i.newAgentIdPlaceholder||t[75]!==i.newAgentIdRules||t[76]!==f||t[77]!==be||t[78]!==Se?(we=(0,Q.jsx)(`input`,{className:ye,value:f,onChange:be,onBlur:Se,placeholder:i.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:i.newAgentIdRules}),t[74]=i.newAgentIdPlaceholder,t[75]=i.newAgentIdRules,t[76]=f,t[77]=be,t[78]=Se,t[79]=we):we=t[79];let Te;t[80]===i.newAgentIdRules?Te=t[81]:(Te=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.newAgentIdRules}),t[80]=i.newAgentIdRules,t[81]=Te);let Ee;t[82]!==ve||t[83]!==we||t[84]!==Te?(Ee=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ve,we,Te]}),t[82]=ve,t[83]=we,t[84]=Te,t[85]=Ee):Ee=t[85];let De;t[86]!==i.agentDescription||t[87]!==l?(De=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.agentDescription,` (`,l,`)`]}),t[86]=i.agentDescription,t[87]=l,t[88]=De):De=t[88];let Oe;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=c(on(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[89]=Oe):Oe=t[89];let ke;t[90]===g?ke=t[91]:(ke=e=>g(e.target.value),t[90]=g,t[91]=ke);let q;t[92]!==i.agentDescriptionPlaceholder||t[93]!==m||t[94]!==ke?(q=(0,Q.jsx)(`textarea`,{className:Oe,value:m,onChange:ke,placeholder:i.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[92]=i.agentDescriptionPlaceholder,t[93]=m,t[94]=ke,t[95]=q):q=t[95];let Ae;t[96]!==De||t[97]!==q?(Ae=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[De,q]}),t[96]=De,t[97]=q,t[98]=Ae):Ae=t[98];let je;t[99]===i.newWorkspace?je=t[100]:(je=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newWorkspace}),t[99]=i.newWorkspace,t[100]=je);let Me;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(Me=c(on(),`font-mono text-xs`),t[101]=Me):Me=t[101];let Ne;t[102]===v?Ne=t[103]:(Ne=e=>v(e.target.value),t[102]=v,t[103]=Ne);let Fe;t[104]!==_||t[105]!==Ne?(Fe=(0,Q.jsx)(`input`,{className:Me,value:_,onChange:Ne,required:!0,autoComplete:`off`}),t[104]=_,t[105]=Ne,t[106]=Fe):Fe=t[106];let Ie;t[107]!==je||t[108]!==Fe?(Ie=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[je,Fe]}),t[107]=je,t[108]=Fe,t[109]=Ie):Ie=t[109];let Le;t[110]===i.newModelOptional?Le=t[111]:(Le=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newModelOptional}),t[110]=i.newModelOptional,t[111]=Le);let Re;t[112]===b?Re=t[113]:(Re=e=>b(e),t[112]=b,t[113]=Re);let ze;t[114]!==o||t[115]!==a.modelNoMatches||t[116]!==a.modelPlaceholder||t[117]!==a.modelSearchPlaceholder||t[118]!==y||t[119]!==Re?(ze=(0,Q.jsx)(P,{className:`min-w-0 flex-1`,value:y,disabled:o,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:Re}),t[114]=o,t[115]=a.modelNoMatches,t[116]=a.modelPlaceholder,t[117]=a.modelSearchPlaceholder,t[118]=y,t[119]=Re,t[120]=ze):ze=t[120];let Be;t[121]!==i.modelClear||t[122]!==o||t[123]!==y||t[124]!==b?(Be=y.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>b(``),children:i.modelClear}):null,t[121]=i.modelClear,t[122]=o,t[123]=y,t[124]=b,t[125]=Be):Be=t[125];let Ve;t[126]!==ze||t[127]!==Be?(Ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ze,Be]}),t[126]=ze,t[127]=Be,t[128]=Ve):Ve=t[128];let He;t[129]!==Le||t[130]!==Ve?(He=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Le,Ve]}),t[129]=Le,t[130]=Ve,t[131]=He):He=t[131];let We;t[132]!==K||t[133]!==ce||t[134]!==_e||t[135]!==Ee||t[136]!==Ae||t[137]!==Ie||t[138]!==He||t[139]!==ie?(We=(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-y-auto pr-1`,children:[ie,K,ce,_e,Ee,Ae,Ie,He]}),t[132]=K,t[133]=ce,t[134]=_e,t[135]=Ee,t[136]=Ae,t[137]=Ie,t[138]=He,t[139]=ie,t[140]=We):We=t[140];let Ge;t[141]!==i.createModalCancel||t[142]!==o?(Ge=(0,Q.jsx)(ut,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:o,children:i.createModalCancel})}),t[141]=i.createModalCancel,t[142]=o,t[143]=Ge):Ge=t[143];let qe;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Q.jsx)(T,{className:`mr-1 size-4`,"aria-hidden":!0}),t[144]=qe):qe=t[144];let Je;t[145]!==i.create||t[146]!==o?(Je=(0,Q.jsxs)(X,{type:`submit`,disabled:o,children:[qe,i.create]}),t[145]=i.create,t[146]=o,t[147]=Je):Je=t[147];let J;t[148]!==Ge||t[149]!==Je?(J=(0,Q.jsxs)(`div`,{className:`mt-3 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ge,Je]}),t[148]=Ge,t[149]=Je,t[150]=J):J=t[150];let Xe;t[151]!==S||t[152]!==We||t[153]!==J?(Xe=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:S,children:[We,J]}),t[151]=S,t[152]=We,t[153]=J,t[154]=Xe):Xe=t[154];let Ze;t[155]!==N||t[156]!==Xe||t[157]!==re?(Ze=(0,Q.jsxs)(ue,{children:[I,(0,Q.jsx)(h,{ref:F,className:L,onOpenAutoFocus:qn,children:(0,Q.jsxs)(Pe,{layer:`modal`,portalContainer:N,children:[re,Xe]})})]}),t[155]=N,t[156]=Xe,t[157]=re,t[158]=Ze):Ze=t[158];let Qe;return t[159]!==r||t[160]!==n||t[161]!==Ze?(Qe=(0,Q.jsx)(ae,{open:n,onOpenChange:r,children:Ze}),t[159]=r,t[160]=n,t[161]=Ze,t[162]=Qe):Qe=t[162],Qe}function qn(e){return e.preventDefault()}var Jn=`~/.xopc/workspace`;function Yn(e){let t=e.trim();return t?`${Jn}/${v(t)}`:``}function Xn(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)(Xe,{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)(nt,{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 Zn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Qn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=st(async()=>{if(!t)return null;let[e,n]=await Promise.all([M(t,`IDENTITY.md`).catch(()=>``),M(t,`SOUL.md`).catch(()=>``)]),r=ot(e);return{identity:r,soulTemplate:$e(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?Zn(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?Zn(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=Ne.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([he(e,`IDENTITY.md`,Te(f.identity)),he(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 $n={draft:``,editorNonce:0,loadedKey:``};function er(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 tr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=st(()=>n?R(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`advanced`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(er,$n),[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=st(()=>d&&n?M(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),j=A.loading,N=lt(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 he(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===`advanced`&&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 nr(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=st(()=>jt(),[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=st(()=>Mt(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(``),N=(0,$.useRef)(S);N.current!==S&&(N.current=S,A(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&&Mt(e).then(e=>{D(e),A(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),A(null)})},[y,D]),I=!_&&g.length===0,L=t===`connections`&&n&&i,R=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await k(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:A,newBindCustomPeer:j,setNewBindCustomPeer:M,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=cn(y,j,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await k(n),l.current=!0,d(n),A(null),M(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,j,O,o,a,s,c]),onRemoveBinding:R,refreshBindSessions:F,useManualChannel:I}}function rr(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(or)};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}=st(ar,s,d),m;n[10]===f?m=n[11]:(m=f.filter(ir),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 ir(e){return e.enabled!==!1}function ar(){return g()}function or(e){return e+1}function sr(e){return rr(e.panel===`capabilities`,e.hasToken)}function cr(e){return new Set(e.tools.entryDisable)}function lr(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function ur(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)(()=>[]),[p,m]=(0,$.useState)(!1);if(i.current!==r){if(i.current=r,n&&t===`capabilities`){o(cr(n));let e=lr(n);u(e.inherit),c(e.pick)}n&&t===`runtime`&&(f(Dt(n.typedModels.effective)),m(!1))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:e=>{m(!1),f(e)},replaceModelRows:f,modelsResetRequested:p,setModelsResetRequested:m}}function dr(e){let t=Dt(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Dt(e.typedModels.effective)}function fr(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 pr(){let e=d(e=>e.language),t=l(e),n=t.agentsSettings,[r,o]=(0,$.useState)(!1),[c,f]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),v=t.cron,y=t.chat,b=!!u(e=>e.token),[x,S]=i(),C=a(),{agentId:T}=s(),D=Ee(e=>e.setPageHeader),O=Ee(e=>e.clearPageHeader),{data:k,error:A,isLoading:j,mutate:M}=p(b?`settings-gateway-agents`:null,dt,{revalidateOnFocus:!1}),{data:N,mutate:P}=p(b?`settings-capability-presets`:null,wt,{revalidateOnFocus:!1}),F=_e(b),{data:I}=F,L=(0,$.useMemo)(()=>pe(I?.payload?.config??{}),[I]),R=k??null,z=(0,$.useMemo)(()=>R?R.agents.find(e=>e.id===R.defaultId)??R.agents[0]??null:null,[R]),te=!!(b&&j),[ne,V]=(0,$.useState)(null),re=A instanceof Error?A.message:A?n.loadError:null,ie=ne??re,[H,U]=(0,$.useState)(null),[W,ae]=(0,$.useState)(`overview`),[G,se]=(0,$.useState)(``),[K,le]=(0,$.useState)(``),[ue,fe]=(0,$.useState)(``),[me,he]=(0,$.useState)(``),[ge,ve]=(0,$.useState)(``),[ye,be]=(0,$.useState)(null),[xe,Se]=(0,$.useState)(!1),Ce=(0,$.useRef)(``),[we,Te]=(0,$.useState)(null),[De,Oe]=(0,$.useState)([]),[ke,q]=(0,$.useState)(!1),[Ae,je]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),[Pe,Ie]=(0,$.useState)(``),[Le,Re]=(0,$.useState)(``),[ze,Ve]=(0,$.useState)(``),[He,Ue]=(0,$.useState)(``),We=(0,$.useRef)(null),[Ke,qe]=(0,$.useState)(!1),Je=(0,$.useRef)({data:null,routeAgentId:void 0});R&&(R!==Je.current.data||T!==Je.current.routeAgentId)&&(Je.current={data:R,routeAgentId:T},T&&R.agents.some(e=>e.id===T)?U(T):U(e=>e&&R.agents.some(t=>t.id===e)?e:R.defaultId)),(0,$.useEffect)(()=>{!R||!T||R.agents.some(e=>e.id===T)||C(Be,{replace:!0})},[R,T,C]),(0,$.useEffect)(()=>{T&&ae(`overview`)},[T]),(0,$.useEffect)(()=>{x.get(`panel`)===`defaults`&&C(T?Ge(T):Be,{replace:!0,state:{[oe]:T?Ge(T):Be}})},[x,T,C]),(0,$.useEffect)(()=>{if(x.get(`focus`)!==`avatar`||!T||(ae(`profile`),te||!R?.agents.some(e=>e.id===T)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),S(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[x,T,te,R,S]);let J=(0,$.useMemo)(()=>R?.agents.find(e=>e.id===H)??null,[R,H]),Ye=(0,$.useMemo)(()=>{let e=I?.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():``},[I]),Xe=(0,$.useMemo)(()=>!R||Ye&&R.agents.some(e=>e.id===Ye)?Ye:R.defaultId||R.agents[0]?.id||Ye,[R,Ye]),Ze=!!(R&&Ye&&!R.agents.some(e=>e.id===Ye));(0,$.useEffect)(()=>{Ne(Ze?``:Ye)},[Ye,Ze]);let Qe=(0,$.useRef)(null),$e=J?J.id:null;J&&Qe.current!==$e?(Qe.current=$e,Ie(J.workspace),Re(J.model?.primary??``),Ve(ee(J,l(e).agentsSettings)),Ue(Fe(J,l(e).agentsSettings))):!J&&Qe.current!==null&&(Qe.current=null,Ie(``),Re(``),Ve(``),Ue(``));let et=Qn({agentId:J?.id??null,enabled:W===`profile`&&!!J,saveRef:We}),nt=tr({panel:W,selectedId:H,hasToken:b,dataAgentsLength:R?.agents.length,saveErrorMessage:n.saveError,setError:V}),Y=ur({panel:W,selected:J}),X=nr({panel:W,hasToken:b,bindingsFromConfig:L,gatewayCfgLoading:I===void 0,selected:J,saveErrorMessage:n.saveError,setBusy:q,setError:V}),rt=sr({panel:W,hasToken:b}),it=(0,$.useCallback)(()=>{let e=Yn(K.trim()||G);he(t=>t===``||t===Ce.current?(Ce.current=e,e):t)},[K,G]),at=(0,$.useCallback)(()=>{Ce.current=``,se(``),le(``),fe(``),he(``),ve(``),be(null),Te(null),Oe([]),Se(!0)},[]),ot=(0,$.useCallback)(e=>{let t=new Set(R?.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,R]),st=(0,$.useCallback)(e=>{if(Te(e),!e){Oe([]);return}let t=R?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=ot(t.id),o=t.description??``;Ce.current=``,se(i),le(a),fe(o),he(t.workspace),ve(t.model?.primary??``),Oe([...t.extends]),be(null)},[n.duplicateName,R,ot]),ct=(0,$.useCallback)(e=>{st(e),Se(!0)},[st]),lt=(0,$.useMemo)(()=>(0,Q.jsx)(Xn,{a:n,busy:ke,listSearchQuery:Ae,onListSearchQueryChange:je,onAddAgent:()=>at()}),[n,ke,Ae,at]);(0,$.useLayoutEffect)(()=>b?(D({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:lt}),()=>O()):(O(),()=>O()),[n.title,lt,O,b,D]);async function ut(t){t.preventDefault();let r=G.trim();if(!r)return;let i=tt(K,r);if(i.ok===!1){be(i.error);return}let a=me.trim()||Yn(K.trim()||r);if(a){q(!0),be(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${ue.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
+
`),{createdAgentId:n,...i}=await B({workspace:a,...K.trim()?{id:K.trim()}:{},...ge.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:ge.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...we?{cloneFrom:we}:{},extends:De});M(i,{revalidate:!1}),se(``),le(``),fe(``),he(``),ve(``),be(null),Se(!1),U(n),C(Ge(n))}catch(e){be(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function ft(e){q(!0),V(null);try{M(await E(e.id,{setDefault:!0}),{revalidate:!1}),U(e.id)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function pt(){let e=Me.trim().toLowerCase();if(e&&!R?.agents.some(t=>t.id===e)){V(n.tuiDefaultAgentInvalid);return}q(!0),V(null);try{await de(e||null),await F.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function mt(e){q(!0),V(null);try{await de(e.id),Ne(e.id),await F.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function ht(){q(!0),V(null);try{await de(null),Ne(``),await F.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function gt(e,t){q(!0),V(null);try{let n=await w(e.id,t);M(n,{revalidate:!1}),U(n.defaultId),ae(`overview`),T===e.id&&C(Be,{replace:!0}),o(!1),f(null),_(``)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}function _t(e,t){e.id!==`main`&&(f(e),h(t),_(``),o(!0))}async function vt(){if(J){q(!0),V(null);try{M(await E(J.id,{tools:{builtin:fr(Y.toolEntryDisable)}}),{revalidate:!1})}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function yt(){if(J){q(!0),V(null);try{M(await E(J.id,{tools:null}),{revalidate:!1}),Y.setToolEntryDisable(new Set)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function bt(){if(!J)return;let e=Et(Y.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){V(e);return}q(!0),V(null);try{M(await E(J.id,{models:{roles:At(Y.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function xt(){if(!J)return!1;let e=Et(Y.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e)return V(e),!1;q(!0),V(null);try{let e=At(Dt(J.typedModels.effective))?.roles??{},t=At(Y.modelRows)?.roles??{},n=JSON.stringify(t)!==JSON.stringify(e);return M(await E(J.id,{workspace:Pe.trim()||void 0,...Y.modelsResetRequested?{models:null}:n?{models:{roles:t}}:{}}),{revalidate:!1}),Y.setModelsResetRequested(!1),!0}catch(e){return V(e instanceof Error?e.message:n.saveError),!1}finally{q(!1)}}function St(){if(!J)return;let e=dr(J);V(null),Y.replaceModelRows(e),Y.setModelsResetRequested(!0)}async function Ct(){if(J){q(!0),V(null);try{M(await E(J.id,{skills:Y.skillsInherit?null:[...Y.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function Tt(e){if(J){q(!0),V(null);try{M(await E(J.id,{extends:e}),{revalidate:!1}),P()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}let Ot=W!==`profile`&&W!==`runtime`,kt=(()=>{if(!J||W!==`runtime`)return!1;let e=At(Dt(J.typedModels.effective))?.roles??{},t=At(Y.modelRows)?.roles??{};return Y.modelsResetRequested||Pe.trim()!==J.workspace||JSON.stringify(t)!==JSON.stringify(e)})(),jt=(()=>{if(Ot||!J)return!1;switch(W){case`profile`:return et.dirty;case`runtime`:return kt;default:return!0}})(),Mt=Ot||!jt;function Nt(){qe(!0),setTimeout(()=>qe(!1),2e3)}async function Pt(){switch(W){case`profile`:q(!0),V(null);try{return await(We.current?.()??Promise.resolve()),await M(),Nt(),!0}catch(e){return V(e instanceof Error?e.message:n.saveError),!1}finally{q(!1)}case`runtime`:return await xt()?(Nt(),!0):!1;default:return!0}}function Z(e){e||C(Be)}let Ft=J?ze.trim()||ee(J,n):T??``,It=J?.id??T??``,Lt=(0,$.useCallback)(async()=>{if(J&&await Pt()){nt.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(ce,J.id)}catch{}C(`/chat/new`,{state:{agentId:J.id,fromAgentEditor:!0}})}},[J,Pt,nt.saveProfileMarkdownDebounced,C]),Rt={a:n,chat:y,cCron:v,selected:J,panel:W,data:R,busy:ke,editName:ze,setEditName:Ve,editDescription:He,setEditDescription:Ue,editWorkspace:Pe,setEditWorkspace:Ie,editModel:Le,defaultModel:z?.model?.primary??``,defaultWorkspace:z?.workspace??``,onSetDefault:()=>{J&&ft(J)},onSetTuiDefault:()=>{J&&mt(J)},isTuiDefault:!!(J&&J.id===Xe),isTuiDefaultInherited:!!(J&&J.id===Xe&&(!Ye||Ze)),onDelete:e=>{J&&_t(J,e)},onTryInChat:()=>void Lt(),capabilityPresets:N?.presets??[],defaultPresetId:N?.defaultPresetId,onUpdateAgentExtends:e=>void Tt(e),onOpenCapabilityPreset:e=>{C(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewProfile:et,filesLoading:nt.filesLoading,files:nt.files,activeFile:nt.activeFile,setActiveFile:nt.setActiveFile,filesViewMode:nt.filesViewMode,setFilesViewMode:nt.setFilesViewMode,fileDraft:nt.fileDraft,setFileDraft:nt.setFileDraft,fileSaving:nt.fileSaving,profileFileLoading:nt.profileFileLoading,profileEditorNonce:nt.profileEditorNonce,toolEntryDisable:Y.toolEntryDisable,setToolEntryDisable:Y.setToolEntryDisable,onSaveTools:()=>void vt(),onClearToolsEntry:()=>void yt(),modelRows:Y.modelRows,setModelRows:Y.setModelRows,onSaveModels:()=>void bt(),onClearModelsEntry:St,skillsCatalogLoading:rt.skillsCatalogLoading,catalogForPick:rt.catalogForPick,skillsInherit:Y.skillsInherit,setSkillsInherit:Y.setSkillsInherit,skillsPick:Y.skillsPick,setSkillsPick:Y.setSkillsPick,onSaveSkills:()=>void Ct(),bindingsLoading:X.bindingsLoading,agentBindings:X.agentBindings,bindChannelStatuses:X.bindChannelStatuses,bindChannelsLoading:X.bindChannelsLoading,useManualChannel:X.useManualChannel,newBindChannel:X.newBindChannel,setNewBindChannel:X.setNewBindChannel,bindSessionChats:X.bindSessionChats,bindSessionsLoading:X.bindSessionsLoading,newBindSessionIdx:X.newBindSessionIdx,setNewBindSessionIdx:X.setNewBindSessionIdx,newBindCustomPeer:X.newBindCustomPeer,setNewBindCustomPeer:X.setNewBindCustomPeer,refreshBindSessions:X.refreshBindSessions,onRemoveBinding:e=>void X.onRemoveBinding(e),onAddBinding:X.onAddBinding};return{hasToken:b,a:n,chat:y,language:e,data:R,savedTuiDefaultAgentId:Ye,effectiveTuiDefaultAgentId:Xe,tuiDefaultAgentDraft:Me,setTuiDefaultAgentDraft:Ne,tuiDefaultAgentUnavailable:Ze,onSaveTuiDefaultAgent:pt,onSetTuiDefaultAgent:mt,onClearTuiDefaultAgent:ht,onSetDefaultAgent:ft,loading:te,displayError:ie,navigate:C,routeAgentId:T,busy:ke,listSearchQuery:Ae,openAddAgentModal:at,openDuplicateAgentModal:ct,duplicateSourceId:we,createPresetIds:De,setCreatePresetIds:Oe,onSelectDuplicateSource:st,panel:W,setPanel:ae,modalTitle:Ft,modalSubtitle:It,footerSaveDisabled:Mt,savedFlash:Ke,handleModalFooterSave:Pt,onAgentModalOpenChange:Z,addAgentModalOpen:xe,setAddAgentModalOpen:Se,createWorkspaceSuggestedRef:Ce,createModalError:ye,setCreateModalError:be,createDisplayName:G,setCreateDisplayName:se,createAgentId:K,setCreateAgentId:le,createDescription:ue,setCreateDescription:fe,createWorkspace:me,setCreateWorkspace:he,createModel:ge,setCreateModel:ve,onCreate:ut,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:it,deleteDialogOpen:r,setDeleteDialogOpen:o,deletePurge:m,deleteTarget:c,setDeleteTarget:f,deleteConfirmText:g,setDeleteConfirmText:_,performDelete:gt,editorPanelProps:Rt}}function mr(){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)(H,{className:`h-5 w-40`}),(0,Q.jsx)(H,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(H,{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(hr)})]}),e[1]=n):n=e[1],n}function hr(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)(H,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(H,{className:`h-4 w-2/3`}),(0,Q.jsx)(H,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(H,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(H,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(H,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(H,{className:`h-6 w-20 rounded-full`})]})]},t)}function gr(){let e=pr();return e.hasToken?(0,Q.jsxs)(ht,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(mt,{title:e.a.title,subtitle:e.a.subtitle,actions:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,onClick:()=>e.navigate(`/settings/capability-presets`),children:[(0,Q.jsx)(De,{className:`size-4`,"aria-hidden":!0}),e.a.capabilityPresetsManage]}),(0,Q.jsxs)(X,{type:`button`,onClick:e.openAddAgentModal,disabled:e.busy,children:[(0,Q.jsx)(T,{className:`size-4`,"aria-hidden":!0}),e.a.addAgent]})]})}),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)(mr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Wn,{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(Ge(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(ce,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(zt,{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===`profile`||e.panel===`runtime`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(mr,{}):(0,Q.jsx)(Rn,{...e.editorPanelProps})}):null,(0,Q.jsx)(Kn,{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),e.setCreatePresetIds([]))},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,capabilityPlans:e.editorPanelProps.capabilityPresets,defaultPresetId:e.editorPanelProps.defaultPresetId??`default`,selectedCapabilityPlanIds:e.createPresetIds,onSelectedCapabilityPlanIdsChange:e.setCreatePresetIds}),(0,Q.jsx)(Ft,{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)(ht,{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)(mt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{gr as AgentsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,s as t}from"./locale-store-
|
|
1
|
+
import{r as e,s as t}from"./locale-store-0lpYdNDr.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
|
|
@@ -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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-CxySDn9d.js";import{n as s,r as c,s as l}from"./locale-store-Dar-xqQr.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{Bo as d,Go as f,Ho as p,Nc as m,Nt as h,Ro as g,Ss as _,Uo as v,Vl as y,Vo as b,Wo as x,Xa as S,gs as C,is as w,rs as T}from"./index-vq_cJZJC.js";import{n as E,r as D}from"./settings-page-layout-DWvNgISx.js";import{t as O}from"./settings-loading-skeleton-DkvwitK_.js";import{r as k,t as A}from"./settings-form-section-CNqF6IwY.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,o]=(0,M.useReducer)(h,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:f,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&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)(m,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):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,s.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:s.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(s.appPath,`app`),children:[(0,N.jsx)(y,{className:`size-3`,"aria-hidden":!0}),u===`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:s.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(s.dataPath,`data`),children:[(0,N.jsx)(y,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.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:()=>{o({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:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(g,{open:f,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,w)}),(0,N.jsxs)(d,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`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)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(b,{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:S,onChange:e=>o({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=>o({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)(_,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(_,{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)(g,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(p,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,w)}),(0,N.jsxs)(d,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`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)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(b,{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=>o({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)(_,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(_,{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 l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){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)(S,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(S,{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)(_,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),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=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!f()||!a){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 c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);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:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|
|
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-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-BwQ3WssU.js";import{n as s,r as c,s as l}from"./locale-store-0lpYdNDr.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{Bo as d,Fc as f,Go as p,Ho as m,Nt as h,Qa as g,Ro as _,Uo as v,Vo as y,Wl as b,Wo as x,as as S,os as C,vs as w,ws as T}from"./index-C8JkTS6d.js";import{n as E,r as D}from"./settings-page-layout-D3srt5Bi.js";import{t as O}from"./settings-loading-skeleton-DEwYqESe.js";import{r as k,t as A}from"./settings-form-section-CARTHCxH.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,o]=(0,M.useReducer)(h,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:p,clearConfirmChecked:g,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=g&&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)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):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,s.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:s.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`,w.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(b,{className:`size-3`,"aria-hidden":!0}),u===`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:s.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`,w.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(b,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.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`,w.press),onClick:()=>{o({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`,w.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(_,{open:p,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(m,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),(0,N.jsxs)(d,{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)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(y,{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:g,onChange:e=>o({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=>o({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)(T,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(T,{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)(_,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(v,{children:[(0,N.jsx)(m,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),(0,N.jsxs)(d,{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)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(y,{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=>o({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)(T,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(T,{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 l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){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)(g,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(g,{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)(T,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),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=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!p()||!a){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 c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);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:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,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-JdwAhgNB.js";import{t as r}from"./messages-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-BwQ3WssU.js";import{n as i}from"./locale-store-0lpYdNDr.js";import{i as a}from"./theme-store-C1oaqeD2.js";import{$o as o,lt as s,vs as c}from"./index-C8JkTS6d.js";import{n as l,r as u}from"./settings-page-layout-D3srt5Bi.js";import{t as d}from"./settings-advanced-gate-CDY3ZI1K.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 p-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{d as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-BwQ3WssU.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-0lpYdNDr.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Ar as g,Bo as _,Bs as v,Ds as y,Eu as b,Fc as x,Hi as S,Ho as C,Jc as w,Ll as T,Nt as E,Qa as D,Ro as O,Uo as ee,Vo as k,Wo as A,bo as j,eo as M,gu as N,ic as te,io as P,no as F,oc as I,ro as L,su as R,to as z,uc as B,wc as V,ws as H,zs as ne}from"./index-C8JkTS6d.js";import{t as U}from"./page-tabs-Caj1-E_X.js";var W=e(t(),1),G=n();function K(e){return e===`builtin`||e===`user`?e:`marketplace`}async function q(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 re(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/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 q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function X(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Z=r();function ie(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Q={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function $({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=z(),{mutate:i}=m(),[a,o]=(0,W.useReducer)(E,Q),{q:d,debounced:_,detailPkg:y,rowBusy:b,actionError:S,restartHint:C}=a,T=n?`marketplace-${_}`:null;(0,W.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:O,isLoading:ee,error:k}=h(T,async()=>p(_.length>0?f(`/api/marketplace?q=${encodeURIComponent(_)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),A=(0,W.useCallback)(()=>{i(`gateway-extensions-list`),g()},[i]),j=(0,W.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await J({name:e,overwrite:n});A(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,A]),M=(0,W.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await X(e);A(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,A]),N=O?.extensions??[];return(0,Z.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(B,{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,Z.jsx)(`input`,{type:`search`,value:d,onChange:e=>o({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`})]}),k?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:t.marketplaceLoadFailed}):null,S?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S}):null,C?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C}):null,ee&&!O?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Z.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Z.jsx)(D,{className:`h-5 w-40`}),(0,Z.jsx)(D,{className:`h-4 w-full max-w-xl`}),(0,Z.jsx)(D,{className:`h-4 w-2/3 max-w-md`})]}),(0,Z.jsx)(D,{className:`h-8 w-20`})]})},e))}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:N.length===0?(0,Z.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):N.map(e=>{let n=ie(r,e.id),i=b===e.id;return(0,Z.jsx)(`li`,{className:`list-none`,children:(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:s(`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,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Z.jsx)(R,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Z.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,Z.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(x,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Z.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,Z.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&M(e.id).catch(()=>{})},className:s(`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:[i?(0,Z.jsx)(w,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(v,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),y?(0,Z.jsx)(ae,{packageName:y,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:j,onUninstall:M}):null]})}function ae(e){let t=(0,G.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,x;t[0]===n?x=t[1]:(x=async()=>re(n),t[0]=n,t[1]=x);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:E,error:k,isLoading:j}=h(g,x,T),M;t[3]!==i||t[4]!==n?(M=ie(i,n),t[3]=i,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,F=E?.manifest?.permissions,I,L,R,z,B,V,H,U,K,q,J;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==E||t[29]!==k||t[30]!==N||t[31]!==j||t[32]!==o||t[33]!==F||t[34]!==p){let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==E?(n=E?.readme?.trim()||(E?.description?.trim()?`### ${E.name}\n\n${E.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=E,t[48]=n):n=t[48];let i=n;R=O,z=!0,t[49]===o?B=t[50]:(B=e=>!e&&o(),t[49]=o,t[50]=B),L=ee,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=J):J=t[51],I=_,U=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] 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`,K=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(b,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Z.jsx)(`button`,{type:`button`,onClick:o,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:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,Z.jsx)(A,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(y,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,Z.jsx)(`button`,{type:`button`,onClick:o,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[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(q=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=q):q=t[65],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=j&&!E?(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Z.jsx)(D,{className:`h-6 w-48`}),(0,Z.jsx)(D,{className:`h-4 w-28`}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(D,{className:`h-12`}),(0,Z.jsx)(D,{className:`h-12`})]}),(0,Z.jsx)(D,{className:`h-28 w-full`}),(0,Z.jsx)(D,{className:`h-36 w-full`})]}):k?(0,Z.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:k instanceof Error?k.message:r.marketplaceLoadFailed})]}):E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:E.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:E.id})}),(0,Z.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Z.jsx)(`dd`,{children:E.author.username})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Z.jsx)(`dd`,{children:E.latestVersion.version})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Z.jsx)(`dd`,{children:E.downloads})]})]}),N===`bundled`?null:(0,Z.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[E.installability.available?(0,Z.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Z.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:E.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:E.installability.available?r.marketplaceCodeRisk:E.installability.reason??r.marketplaceUnavailableBody})]})]}),E.installability.available?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Z.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Z.jsx)(`dd`,{children:E.packageSummary?.dependencyCount??0})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,Z.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(E.packageSummary?.lifecycleScripts.length??0)>0?(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,E.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Z.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),E.readme?.trim()?(0,Z.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Z.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Z.jsx)(S,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=E,t[29]=k,t[30]=N,t[31]=j,t[32]=o,t[33]=F,t[34]=p,t[35]=I,t[36]=L,t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H,t[42]=U,t[43]=K,t[44]=q,t[45]=J}else I=t[35],L=t[36],R=t[37],z=t[38],B=t[39],V=t[40],H=t[41],U=t[42],K=t[43],q=t[44],J=t[45];let Y;t[66]!==V||t[67]!==H?(Y=(0,Z.jsx)(`div`,{className:V,children:H}),t[66]=V,t[67]=H,t[68]=Y):Y=t[68];let X;t[69]!==d||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==E||t[78]!==N||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==P?(X=E?(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Z.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:d||!E.installability.available||!p,onClick:()=>{P&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,P).catch(se).finally(()=>f(!1)))},className:s(`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:[d?(0,Z.jsx)(w,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?r.marketplaceReinstall:r.marketplaceInstall]}),P?(0,Z.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`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,Z.jsx)(v,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=E,t[78]=N,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=P,t[85]=X):X=t[85];let Q;t[86]!==I||t[87]!==Y||t[88]!==X||t[89]!==U||t[90]!==K||t[91]!==q?(Q=(0,Z.jsxs)(I,{className:U,onOpenAutoFocus:K,children:[q,Y,X]}),t[86]=I,t[87]=Y,t[88]=X,t[89]=U,t[90]=K,t[91]=q,t[92]=Q):Q=t[92];let $;t[93]!==L||t[94]!==Q||t[95]!==J?($=(0,Z.jsxs)(L,{children:[J,Q]}),t[93]=L,t[94]=Q,t[95]=J,t[96]=$):$=t[96];let ae;return t[97]!==R||t[98]!==z||t[99]!==B||t[100]!==$?(ae=(0,Z.jsx)(R,{defaultOpen:z,onOpenChange:B,children:$}),t[97]=R,t[98]=z,t[99]=B,t[100]=$,t[101]=ae):ae=t[101],ae}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,Z.jsxs)(`li`,{className:`break-words`,children:[(0,Z.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=j(e=>e.setPageHeader),r=j(e=>e.clearPageHeader),o=z(),s=F(),[l,d]=i(),f=K(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,W.useState)(f),[g,_]=(0,W.useState)(p),[v,y]=(0,W.useState)(null),b=l.toString(),x=(0,W.useRef)(b);if(x.current!==b){x.current=b;let e=K(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),_(e=>e===t?e:t)}(0,W.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=g.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,g,d]);let S=(0,W.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),C=(0,W.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),w=m===`builtin`?S:C,T=(0,W.useMemo)(()=>{let t=g.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,g,e]);if((0,W.useEffect)(()=>{y(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,W.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Z.jsx)(N,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Z.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps/new`,children:[(0,Z.jsx)(V,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,Z.jsx)(ye,{});let E=m!==`marketplace`&&w.length>0;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(U,{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:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),E?(0,Z.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Z.jsx)(B,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:g,onChange:e=>_(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]}),m===`marketplace`?(0,Z.jsx)($,{}):m===`builtin`&&S.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&C.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyUser}):T.length===0?(0,Z.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,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:T.map(e=>(0,Z.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>y(e)},e.id))})]}),v?(0,Z.jsx)(_e,{extension:v,copy:t.extensionsPage,onClose:()=>y(null)},v.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,G.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`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]=d):d=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,Z.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:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==l?(v=l?(0,Z.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,Z.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Z.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,Z.jsx)(V,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,Z.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,Z.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}):i?(0,Z.jsx)(`span`,{title:pe(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:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==m?(D=(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[m,E]}),t[39]=E,t[40]=m,t[41]=D):D=t[41];let O;return t[42]!==a||t[43]!==D?(O=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:d,children:D}),t[42]=a,t[43]=D,t[44]=O):O=t[44],O}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=m(),[i,o]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(!1),f=e.activationEligible===!0,p=(0,W.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await Y({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),g(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],x=e.ui?.contributions?.chatWidgets??[],S=e.ui?.contributions?.sidebarPanels??[],E=h.find(e=>e.showInNav)??h[0],D=v[0],j=E?M(e.id,E):null,N=D?`/settings/ext/${e.id}/${D.id}`:e.hasConfigSchema||L(e)?`/settings/ext/${e.id}`:null;return(0,Z.jsx)(O,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Z.jsxs)(ee,{children:[(0,Z.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Z.jsxs)(_,{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,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Z.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,Z.jsx)(b,{className:`size-5`})}),(0,Z.jsx)(A,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Z.jsxs)(k,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Z.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,Z.jsx)(y,{className:`size-5`})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.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,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Z.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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,Z.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Z.jsx)(H,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(w,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Z.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&&(h.length>0||v.length>0||x.length>0)?(0,Z.jsxs)(`section`,{className:`mt-8`,children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,Z.jsx)(ve,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,Z.jsx)(ve,{template:t.badgeWidgets,count:x.length,hidden:x.length===0}),(0,Z.jsx)(ve,{template:t.badgeSidebar,count:S.length,hidden:S.length===0})]})]}):null,P(e)&&(j||N)?(0,Z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,Z.jsxs)(a,{to:j,onClick:n,className:s(`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,Z.jsx)(T,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,N?(0,Z.jsxs)(a,{to:N,onClick:n,className:s(`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,Z.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Z.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,G.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,Z.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 ye(){let e=(0,G.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Z.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,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Z.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,Z.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,G.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.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,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-9eR_ODY1.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-BwQ3WssU.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-DKwEce-9.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-CP_Gaxt3.js → attachment-load-DPuWYUeX.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{qa as t}from"./index-C8JkTS6d.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};
|