@xopcai/xopc 0.0.88 → 0.0.89
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/README.md +8 -1
- package/README.zh-CN.md +8 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/feishu/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.js +1 -1
- package/dist/gateway/static/root/assets/agents-B6PJB07W.js +222 -0
- package/dist/gateway/static/root/assets/apps-page-BOr0B1wv.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-BelUKggl.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-DIsl75Y3.js → channels-status-swr-DaHGkRF1.js} +1 -1
- package/dist/gateway/static/root/assets/cron-api-CjOg-BIj.js +1 -0
- package/dist/gateway/static/root/assets/cron-page-DhoZmZXb.js +1 -0
- package/dist/gateway/static/root/assets/{dist-CJwfHYvT.js → dist-6LecgDx5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BVJohZoZ.js → extension-debug-page-CtuKJ9tE.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BT2tmElC.js → extension-page-ykzjOkR5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BSS47c2j.js → extension-settings-page-Ce2qrdpO.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-BaFNUtkE.js → fetch-C9FFJjuH.js} +1 -1
- package/dist/gateway/static/root/assets/{field-primitives-QwYEq6Hz.js → field-primitives-BFcrNeTU.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BVSidEDJ.js → heartbeat-config-api-CEg4Vr9R.js} +1 -1
- package/dist/gateway/static/root/assets/{index-qNrVJp-y.js → index-CZfy9oxs.js} +97 -97
- package/dist/gateway/static/root/assets/index-CiN1cQiQ.css +1 -0
- package/dist/gateway/static/root/assets/logs-page-BwWLfqvd.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-DV5WN8uk.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B8N3A3Zo.js → settings-form-section-BqdzA28u.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-CfOBRbPX.js +3 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Q7KqkO-u.js → share-preview-page-Di5Bzh4g.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-D0H5Kaxg.js +2 -0
- package/dist/gateway/static/root/assets/{theme-store-BbRc5ugR.js → theme-store-CNqbmTNV.js} +1 -1
- package/dist/gateway/static/root/assets/url-aYn-Rj1C.js +7 -0
- package/dist/gateway/static/root/assets/{utils-CxDGduqK.js → utils-BWm2tG2w.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CTyHz7L_.js → voice-api-key-field-X2UfnHeq.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-BOPpO3NG.js +27 -0
- package/dist/gateway/static/root/index.html +5 -6
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +8 -7
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/agent-scope.js +1 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -1
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/goals/goal-run-store.js +4 -4
- package/dist/src/agent/goals/persistent-goal-service.js +1 -1
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/image/load-image-media.js +2 -2
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/reply/post-compaction-context.js +1 -1
- package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
- package/dist/src/agent/sandbox/path-policy.js +2 -2
- package/dist/src/agent/service/build-direct-message-content.js +1 -1
- package/dist/src/agent/service.js +6 -5
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +3 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/cronjob-tool.js +2 -1
- package/dist/src/agent/tools/cronjob-tool.js.map +1 -1
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +3 -24
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.d.ts +6 -28
- package/dist/src/agent/tools/workflow-tool.js +61 -261
- package/dist/src/agent/tools/workflow-tool.js.map +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/workflow/catalog.js +1 -1
- package/dist/src/agent/workflow/workflow-child-tools.d.ts +4 -0
- package/dist/src/agent/workflow/workflow-child-tools.js +21 -0
- package/dist/src/agent/workflow/workflow-child-tools.js.map +1 -0
- package/dist/src/auth/credentials.d.ts +14 -2
- package/dist/src/auth/credentials.js +40 -15
- package/dist/src/auth/credentials.js.map +1 -1
- package/dist/src/auth/oauth/types.d.ts +16 -0
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/browser/cache-dir-policy.js +1 -1
- package/dist/src/browser/cdp-local-launcher.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +3 -3
- package/dist/src/browser/providers/cloakbrowser.js +4 -4
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/channels/attachments/inbound-persist.js +1 -1
- package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/auth.js +6 -0
- package/dist/src/cli/commands/auth.js.map +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/gateway/logs.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +4 -4
- package/dist/src/cli/commands/onboard/model.js +6 -0
- package/dist/src/cli/commands/onboard/model.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/agent-typed-models.js +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/paths-state.js +1 -1
- package/dist/src/config/profile.js +2 -2
- package/dist/src/config/workspace-path.js +1 -1
- package/dist/src/cron/executor.d.ts +2 -0
- package/dist/src/cron/executor.js +61 -7
- package/dist/src/cron/executor.js.map +1 -1
- package/dist/src/cron/job-content.js +2 -1
- package/dist/src/cron/job-content.js.map +1 -1
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/cron/run-log-store.js +1 -1
- package/dist/src/cron/types.d.ts +21 -1
- package/dist/src/cron/validation.d.ts +76 -0
- package/dist/src/cron/validation.js +26 -1
- package/dist/src/cron/validation.js.map +1 -1
- package/dist/src/daemon/constants.js +1 -1
- package/dist/src/daemon/install-plan.js +2 -2
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/schtasks.js +2 -2
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/extensions/bundle-mcp.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/gateway/agents-admin.js +3 -3
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/gateway-workflow-host.types.d.ts +17 -0
- package/dist/src/gateway/gateway-workflow-host.types.js +1 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/lib/extension-store.js +2 -2
- package/dist/src/gateway/hono/lib/static-ui.js +2 -2
- package/dist/src/gateway/hono/oauth-async.js +40 -15
- package/dist/src/gateway/hono/oauth-async.js.map +1 -1
- package/dist/src/gateway/hono/oauth.js +31 -6
- package/dist/src/gateway/hono/oauth.js.map +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +2 -2
- package/dist/src/gateway/hono/routes/models.js +12 -6
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +69 -190
- package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +4 -4
- package/dist/src/gateway/lock.js +3 -3
- package/dist/src/gateway/ports.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +23 -3
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/infra/restart.js +2 -2
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-global.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.d.ts +8 -0
- package/dist/src/providers/index.js +53 -14
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/session/config-store.js +2 -2
- package/dist/src/session/init-session-turn.js +2 -2
- package/dist/src/session/parity/jsonl-transcript-io.js +2 -2
- package/dist/src/session/parity/sessions-json-file.js +1 -1
- package/dist/src/session/parity/transcript-file-lock.js +2 -2
- package/dist/src/session/parity/transcript-paths.js +1 -1
- package/dist/src/session/resolve-session.js +4 -4
- package/dist/src/session/search-index-cache.js +1 -1
- package/dist/src/session/search-index.js +1 -1
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/store.js +5 -5
- package/dist/src/share/share-auto.js +2 -2
- package/dist/src/share/share-store.js +3 -3
- package/dist/src/share/share-thumbnail.js +2 -2
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-share-config.d.ts +3 -2
- package/dist/src/share/site-share-config.js.map +1 -1
- package/dist/src/share/site-share-store.js +3 -3
- package/dist/src/share/site-static-serve.js +1 -1
- package/dist/src/tui/clipboard-image.js +3 -3
- package/dist/src/tui/theme-manager.js +1 -1
- package/dist/src/tui/tui-keybindings-file.js +1 -1
- package/dist/src/tui/tui-scoped-models.js +2 -2
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui.js +3 -3
- package/dist/src/tunnel/frpc-binary.js +3 -3
- package/dist/src/tunnel/frpc-config.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/tunnel-state.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +2 -2
- package/dist/src/workflows/domain/command.d.ts +2 -1
- package/dist/src/workflows/domain/definition-utils.d.ts +14 -0
- package/dist/src/workflows/domain/definition-utils.js +50 -0
- package/dist/src/workflows/domain/definition-utils.js.map +1 -0
- package/dist/src/workflows/domain/index.d.ts +2 -0
- package/dist/src/workflows/domain/index.js +3 -1
- package/dist/src/workflows/domain/run.d.ts +57 -0
- package/dist/src/workflows/domain/run.js.map +1 -1
- package/dist/src/workflows/domain/validation.d.ts +19 -0
- package/dist/src/workflows/domain/validation.js +66 -0
- package/dist/src/workflows/domain/validation.js.map +1 -0
- package/dist/src/workflows/engine/workflow-engine.d.ts +2 -1
- package/dist/src/workflows/engine/workflow-engine.js +1 -0
- package/dist/src/workflows/engine/workflow-engine.js.map +1 -1
- package/dist/src/workflows/index.d.ts +4 -0
- package/dist/src/workflows/index.js +9 -2
- package/dist/src/workflows/service/run-view-to-snapshot.d.ts +4 -0
- package/dist/src/workflows/service/run-view-to-snapshot.js +61 -0
- package/dist/src/workflows/service/run-view-to-snapshot.js.map +1 -0
- package/dist/src/workflows/service/workflow-run-service.d.ts +36 -0
- package/dist/src/workflows/service/workflow-run-service.js +279 -0
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -0
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +47 -0
- package/dist/src/workflows/service/workflow-run-service.types.js +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +29 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +177 -0
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -0
- package/dist/src/workflows/service/workflow-session-key.d.ts +3 -0
- package/dist/src/workflows/service/workflow-session-key.js +21 -0
- package/dist/src/workflows/service/workflow-session-key.js.map +1 -0
- package/dist/src/workflows/store/event-store.js +1 -1
- package/dist/src/workflows/store/run-store.js +2 -1
- package/dist/src/workflows/store/run-store.js.map +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-CRxETUZx.js +0 -222
- package/dist/gateway/static/root/assets/apps-page-wKWf3l57.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-DDbqVNkx.js +0 -1
- package/dist/gateway/static/root/assets/copy-SxMW6Xpc.js +0 -1
- package/dist/gateway/static/root/assets/cron-api-N9hvuRrn.js +0 -1
- package/dist/gateway/static/root/assets/cron-page-tlNGNxhP.js +0 -1
- package/dist/gateway/static/root/assets/index-CqZzHNEg.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-DDonPVLn.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DKt-Wmib.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-DcJjvvw4.js +0 -3
- package/dist/gateway/static/root/assets/skills-page-DuJ4BTO3.js +0 -2
- package/dist/gateway/static/root/assets/url-D6jvVYIA.js +0 -7
- package/dist/gateway/static/root/assets/workflows-page-GacJ41Fv.js +0 -27
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-D6jvVYIA.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{n as c}from"./copy-SxMW6Xpc.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BTWC-BTN.js";import{i as g}from"./theme-store-BbRc5ugR.js";import{a as _,n as v,t as y}from"./fetch-BaFNUtkE.js";import{$ as b,Ar as x,Br as S,Ci as C,Cr as w,Er as T,Fi as E,Fn as D,G as O,Gi as k,Gr as A,H as j,Hi as M,In as N,Ir as P,J as F,Ji as I,Jn as L,Jt as R,K as z,Kn as B,Kr as V,Li as ee,Ln as H,Lr as U,Mr as W,Ni as G,Nn as K,Nr as q,Oi as te,Pn as ne,Pr as re,Q as ie,Qi as ae,Qn as oe,Qr as se,S as ce,Si as le,Sn as ue,Sr as de,T as fe,Ti as pe,Tr as me,U as he,Ui as ge,Un as _e,Vi as ve,W as ye,Wi as be,Wr as xe,X as Se,Xi as Ce,Y as we,Yi as Te,Yt as Ee,Z as De,Zr as Oe,_ as ke,_i as Ae,_r as je,an as Me,ar as Ne,b as Pe,ba as Fe,br as Ie,ca as Le,cn as Re,d as ze,dr as Be,ei as J,en as Ve,er as He,et as Ue,f as We,fr as Ge,g as Ke,ga as qe,gr as Je,h as Ye,hi as Xe,hr as Ze,ia as Qe,in as $e,ir as et,ji as tt,ln as nt,lr as rt,m as it,ma as at,mr as Y,na as ot,ni as st,nn as ct,nt as lt,oi as ut,on as dt,p as ft,pi as pt,pr as mt,q as ht,qt as gt,ri as _t,rn as vt,rr as yt,sa as bt,sn as xt,t as St,ti as Ct,tn as wt,tr as Tt,tt as Et,u as Dt,ua as Ot,ui as kt,v as At,vi as jt,vr as Mt,w as Nt,wr as Pt,x as Ft,xa as It,xn as Lt,xr as Rt,y as zt,ya as Bt,zi as Vt,zr as Ht}from"./index-qNrVJp-y.js";import{n as Ut,t as Wt}from"./settings-form-section-B8N3A3Zo.js";import{c as Gt,f as Kt,n as qt,t as Jt}from"./cron-dreaming-jobs-DueM3rBz.js";import{i as Yt,l as Xt,m as Zt,n as Qt,u as $t}from"./cron-api-N9hvuRrn.js";var X=n(),Z=r();function en(e){let t=(0,X.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:c,onConfirm:h,onCancel:g,a:_}=e,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(u,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=v):v=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=Y(`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]=y):y=t[1];let b=a?_.purgeDisk:_.removeFromConfig,x;t[2]===b?x=t[3]:(x=(0,Z.jsx)(m,{className:`text-base font-semibold text-fg`,children:b}),t[2]=b,t[3]=x);let S=a?_.confirmDeletePurge:_.confirmDelete,C;t[4]===S?C=t[5]:(C=(0,Z.jsx)(p,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:S}),t[4]=S,t[5]=C);let w;t[6]!==_.purgeConfirmHint||t[7]!==_.purgeConfirmLabel||t[8]!==_.purgeConfirmPlaceholder||t[9]!==s||t[10]!==a||t[11]!==o||t[12]!==c?(w=a&&o?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Z.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:_.purgeConfirmLabel}),(0,Z.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:Y(`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:_.purgeConfirmPlaceholder.replace(`{{agentId}}`,o.id),value:s,onChange:e=>c(e.target.value)}),(0,Z.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:_.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=_.purgeConfirmHint,t[7]=_.purgeConfirmLabel,t[8]=_.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=c,t[13]=w):w=t[13];let T;t[14]!==_.createModalCancel||t[15]!==i||t[16]!==g?(T=(0,Z.jsx)(mt,{type:`button`,variant:`ghost`,disabled:i,onClick:g,children:_.createModalCancel}),t[14]=_.createModalCancel,t[15]=i,t[16]=g,t[17]=T):T=t[17];let E=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,D;t[18]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(D=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=D):D=t[22];let O=a?_.purgeDisk:_.removeFromConfig,k;t[23]!==h||t[24]!==D||t[25]!==O||t[26]!==E?(k=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:E,disabled:D,onClick:h,children:O}),t[23]=h,t[24]=D,t[25]=O,t[26]=E,t[27]=k):k=t[27];let A;t[28]!==k||t[29]!==T?(A=(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[T,k]}),t[28]=k,t[29]=T,t[30]=A):A=t[30];let j;t[31]!==A||t[32]!==x||t[33]!==C||t[34]!==w?(j=(0,Z.jsxs)(l,{children:[v,(0,Z.jsxs)(d,{className:y,onOpenAutoFocus:tn,children:[x,C,w,A]})]}),t[31]=A,t[32]=x,t[33]=C,t[34]=w,t[35]=j):j=t[35];let M;return t[36]!==r||t[37]!==n||t[38]!==j?(M=(0,Z.jsx)(f,{open:n,onOpenChange:r,children:j}),t[36]=r,t[37]=n,t[38]=j,t[39]=M):M=t[39],M}function tn(e){return e.preventDefault()}var nn=[{id:`overview`,labelKey:`navIdentity`,icon:Ie},{id:`profile`,labelKey:`navProfile`,icon:Ce},{id:`tools`,labelKey:`navTools`,icon:je},{id:`models`,labelKey:`navModels`,icon:ve},{id:`skills`,labelKey:`navSkills`,icon:se},{id:`files`,labelKey:`navCoreFiles`,icon:G}],rn=[{id:`channels`,labelKey:`tabChannels`,icon:Ct},{id:`cron`,labelKey:`tabCron`,icon:k}];function an(e){let t=(0,X.c)(20),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:Y(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,Ne.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Z.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Z.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,c;t[3]!==n||t[4]!==o?(c=nn.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.navAdvanced?u=t[9]:(u=(0,Z.jsx)(`p`,{className:`mt-4 px-3 text-[10px] font-semibold uppercase tracking-wide text-fg-subtle`,children:n.navAdvanced}),t[8]=n.navAdvanced,t[9]=u);let d;t[10]!==n||t[11]!==o?(d=rn.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[10]=n,t[11]=o,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==n.editorNavAria||t[16]!==l||t[17]!==u||t[18]!==f?(p=(0,Z.jsxs)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":s,children:[l,u,f]}),t[15]=n.editorNavAria,t[16]=l,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function on(e){let t=(0,X.c)(49),{open:n,onOpenChange:r,a:i,title:a,subtitle:o,panel:s,onPanelChange:c,onFooterSave:g,footerSaveDisabled:_,footerSavedFlash:v,busy:y,children:b}=e,x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(u,{className:Y(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ce)}),t[0]=x):x=t[0];let S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=Y(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,Ft,`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,Z.jsx)(m,{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,Z.jsx)(p,{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,Z.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=Y(et,`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,Z.jsx)(Je,{className:`size-4`,"aria-hidden":!0}),t[10]=D):D=t[10];let O;t[11]===i.closeDialogAria?O=t[12]:(O=(0,Z.jsx)(h,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:E,"aria-label":i.closeDialogAria,children:D})}),t[11]=i.closeDialogAria,t[12]=O);let k;t[13]!==T||t[14]!==O?(k=(0,Z.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,O]}),t[13]=T,t[14]=O,t[15]=k):k=t[15];let A;t[16]!==i||t[17]!==c||t[18]!==s?(A=(0,Z.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,Z.jsx)(an,{a:i,panel:s,onPanelChange:c})}),t[16]=i,t[17]=c,t[18]=s,t[19]=A):A=t[19];let j;t[20]===b?j=t[21]:(j=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:b}),t[20]=b,t[21]=j);let M;t[22]!==i.footerSaveNotApplicable||t[23]!==i.personaSaved||t[24]!==_||t[25]!==v?(M=v?(0,Z.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]}):_?(0,Z.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,t[22]=i.footerSaveNotApplicable,t[23]=i.personaSaved,t[24]=_,t[25]=v,t[26]=M):M=t[26];let N=y||_,P;t[27]===g?P=t[28]:(P=()=>void g(),t[27]=g,t[28]=P);let F;t[29]!==i.save||t[30]!==N||t[31]!==P?(F=(0,Z.jsx)(mt,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:N,onClick:P,children:i.save}),t[29]=i.save,t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==M||t[34]!==F?(I=(0,Z.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:[M,F]}),t[33]=M,t[34]=F,t[35]=I):I=t[35];let L;t[36]!==j||t[37]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[j,I]}),t[36]=j,t[37]=I,t[38]=L):L=t[38];let R;t[39]!==L||t[40]!==A?(R=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[A,L]}),t[39]=L,t[40]=A,t[41]=R):R=t[41];let z;t[42]!==R||t[43]!==k?(z=(0,Z.jsxs)(l,{children:[x,(0,Z.jsx)(d,{className:S,onOpenAutoFocus:sn,children:(0,Z.jsxs)(ke,{layer:`modal`,children:[k,R]})})]}),t[42]=R,t[43]=k,t[44]=z):z=t[44];let B;return t[45]!==r||t[46]!==n||t[47]!==z?(B=(0,Z.jsx)(f,{open:n,onOpenChange:r,children:z}),t[45]=r,t[46]=n,t[47]=z,t[48]=B):B=t[48],B}function sn(e){return e.preventDefault()}function cn(){return Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Ge,`dark:border-edge`)}function ln(e,t,n){let r=e.agentId?.trim().toLowerCase();return r?r===t.toLowerCase():t.toLowerCase()===n.toLowerCase()}function un(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function dn(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}}var fn=Y(Be,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function pn(e){let t=(0,X.c)(62),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:c,channelsStatusLoading:l,useManualChannel:u,newBindChannel:d,setNewBindChannel:f,bindSessionChats:p,sessionsLoading:m,newBindSessionIdx:h,setNewBindSessionIdx:g,newBindCustomPeer:_,setNewBindCustomPeer:v,onRefreshSessions:y,lastActiveLabels:b,selectRecipient:x}=e,S=!l&&(u||c.length>0),C;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(C=(0,Z.jsx)(Ut,{className:`shrink-0`,icon:Ae,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=C):C=t[2];let w;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==a||t[7]!==i||t[8]!==r||t[9]!==o?(w=i?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):a.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:a.map(e=>(0,Z.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,Z.jsx)(`span`,{className:`font-mono text-xs`,children:un(e.match)}),(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${un(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=a,t[7]=i,t[8]=r,t[9]=o,t[10]=w):w=t[10];let T;t[11]!==n.channelLabel||t[12]!==n.channelsDisabledSuffix||t[13]!==n.channelsLoadingChannels||t[14]!==n.channelsManualChannelHint||t[15]!==c||t[16]!==l||t[17]!==d||t[18]!==f||t[19]!==v||t[20]!==g||t[21]!==u?(T=l?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):u?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Z.jsx)(`input`,{className:cn(),value:d,onChange:e=>f(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Z.jsx)(`select`,{className:Y(cn(),`py-2`),value:d,onChange:e=>{f(e.target.value),g(null),v(``)},children:c.map(e=>(0,Z.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[11]=n.channelLabel,t[12]=n.channelsDisabledSuffix,t[13]=n.channelsLoadingChannels,t[14]=n.channelsManualChannelHint,t[15]=c,t[16]=l,t[17]=d,t[18]=f,t[19]=v,t[20]=g,t[21]=u,t[22]=T):T=t[22];let E;t[23]!==n.channelsCustomPeerHint||t[24]!==n.channelsCustomPeerPlaceholder||t[25]!==n.channelsLoadingSessions||t[26]!==n.channelsNoSessionsHint||t[27]!==n.channelsPeerAny||t[28]!==n.channelsPeerFromSessions||t[29]!==n.channelsRefreshSessions||t[30]!==n.channelsRefreshSessionsHint||t[31]!==n.channelsSessionLabel||t[32]!==n.peerIdLabel||t[33]!==p||t[34]!==r||t[35]!==b||t[36]!==d||t[37]!==_||t[38]!==h||t[39]!==y||t[40]!==x||t[41]!==m||t[42]!==v||t[43]!==g||t[44]!==S?(E=S&&d.trim()?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Z.jsxs)(mt,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||m||!d.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>y(),children:[(0,Z.jsx)(Oe,{className:Y(`size-3.5`,m&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),m&&p.length===0?(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsLoadingSessions}):null,(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Z.jsxs)(`select`,{className:Y(cn(),`py-2`),value:h==null?``:String(h),disabled:r||!d.trim()||!!_.trim(),onChange:e=>{let t=e.target.value;g(t===``?null:Number(t))},children:[(0,Z.jsx)(`option`,{value:``,children:n.channelsPeerAny}),p.map((e,t)=>(0,Z.jsx)(`option`,{value:String(t),children:Gt(e,b)},`${e.channel}-${e.chatId}`))]})]}),p.length===0&&d.trim()&&!m?(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Z.jsx)(`input`,{type:`text`,className:Y(cn(),`min-w-0 w-full sm:flex-1`),value:_,onChange:e=>{v(e.target.value),e.target.value.trim()&&g(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Z.jsxs)(`select`,{className:fn,value:_,onChange:e=>{let t=e.target.value;v(t||``),g(null)},children:[(0,Z.jsx)(`option`,{value:``,children:x}),p.map(e=>(0,Z.jsx)(`option`,{value:e.chatId,children:Gt(e,b)},`${e.channel}-${e.chatId}`))]})]}),(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[23]=n.channelsCustomPeerHint,t[24]=n.channelsCustomPeerPlaceholder,t[25]=n.channelsLoadingSessions,t[26]=n.channelsNoSessionsHint,t[27]=n.channelsPeerAny,t[28]=n.channelsPeerFromSessions,t[29]=n.channelsRefreshSessions,t[30]=n.channelsRefreshSessionsHint,t[31]=n.channelsSessionLabel,t[32]=n.peerIdLabel,t[33]=p,t[34]=r,t[35]=b,t[36]=d,t[37]=_,t[38]=h,t[39]=y,t[40]=x,t[41]=m,t[42]=v,t[43]=g,t[44]=S,t[45]=E):E=t[45];let D;t[46]!==r||t[47]!==l||t[48]!==d?(D=r||!d.trim()||l,t[46]=r,t[47]=l,t[48]=d,t[49]=D):D=t[49];let O;t[50]!==n.addBinding||t[51]!==D?(O=(0,Z.jsx)(`div`,{children:(0,Z.jsx)(mt,{type:`submit`,disabled:D,children:n.addBinding})}),t[50]=n.addBinding,t[51]=D,t[52]=O):O=t[52];let k;t[53]!==s||t[54]!==T||t[55]!==E||t[56]!==O?(k=(0,Z.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[T,E,O]}),t[53]=s,t[54]=T,t[55]=E,t[56]=O,t[57]=k):k=t[57];let A;return t[58]!==C||t[59]!==w||t[60]!==k?(A=(0,Z.jsxs)(Wt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[C,w,k]}),t[58]=C,t[59]=w,t[60]=k,t[61]=A):A=t[61],A}function mn(e){let t=(0,X.c)(12),n;t[0]!==e.expression||t[1]!==e.kind||t[2]!==e.labels||t[3]!==e.locale||t[4]!==e.nextRun||t[5]!==e.presetLabels||t[6]!==e.timezone||t[7]!==e.valueMs?(n=e.kind===`cron`?Kt(e.expression,e.locale,e.labels,{timezone:e.timezone,nextRun:e.nextRun}):qt(e.valueMs,e.locale,e.presetLabels),t[0]=e.expression,t[1]=e.kind,t[2]=e.labels,t[3]=e.locale,t[4]=e.nextRun,t[5]=e.presetLabels,t[6]=e.timezone,t[7]=e.valueMs,t[8]=n):n=t[8];let r=n,i;return t[9]!==e.className||t[10]!==r?(i=(0,Z.jsx)(`span`,{className:e.className,children:r}),t[9]=e.className,t[10]=r,t[11]=i):i=t[11],i}function hn(e){let t=(0,X.c)(24),{a:n,data:r,busy:o,cronLoading:s,agentCronJobs:c,onSetCronJobAgent:l}=e,u=i(_n),d;t[0]===u?d=t[1]:(d=a(u),t[0]=u,t[1]=d);let f=d,p=u===`zh`?`zh-CN`:`en-US`,m=f.cron.scheduleBadge,h;t[2]!==n.cronHint||t[3]!==n.cronTitle?(h=(0,Z.jsx)(Ut,{className:`shrink-0`,icon:at,title:n.cronTitle,subtitle:n.cronHint}),t[2]=n.cronHint,t[3]=n.cronTitle,t[4]=h):h=t[4];let g;t[5]!==n.cronAgentClear||t[6]!==n.cronAgentDefault||t[7]!==n.cronColAgent||t[8]!==n.cronColMessage||t[9]!==n.cronColSchedule||t[10]!==n.cronColSession||t[11]!==n.cronLoading||t[12]!==n.cronNone||t[13]!==c||t[14]!==o||t[15]!==s||t[16]!==r||t[17]!==p||t[18]!==l||t[19]!==m?(g=s?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronLoading}):c.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronNone}):(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,Z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSchedule}),(0,Z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColMessage}),(0,Z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSession}),(0,Z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColAgent})]})}),(0,Z.jsx)(`tbody`,{children:c.map(e=>{let t=!e.agentId?.trim(),i=t?``:e.agentId.trim().toLowerCase();return(0,Z.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,Z.jsx)(`td`,{className:`py-2 pr-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(mn,{kind:`cron`,expression:e.schedule,locale:p,labels:m,timezone:e.timezone,nextRun:e.next_run,className:`text-sm font-medium text-fg`}),(0,Z.jsx)(`span`,{className:`truncate font-mono text-[0.65rem] text-fg-subtle`,title:e.schedule,children:e.schedule})]})}),(0,Z.jsx)(`td`,{className:`max-w-[12rem] truncate py-2 pr-3 text-xs`,title:Qt(e),children:Qt(e)}),(0,Z.jsx)(`td`,{className:`py-2 pr-3 text-xs`,children:e.sessionTarget??`main`}),(0,Z.jsx)(`td`,{className:`py-2 pr-3`,children:(0,Z.jsxs)(`select`,{className:Y(cn(),`min-w-[8rem] py-1 text-xs`),value:i,disabled:o||e.sessionTarget!==`isolated`,onChange:t=>void l(e,t.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:t?n.cronAgentDefault:n.cronAgentClear}),r.agents.map(gn)]})})]},e.id)})})]})}),t[5]=n.cronAgentClear,t[6]=n.cronAgentDefault,t[7]=n.cronColAgent,t[8]=n.cronColMessage,t[9]=n.cronColSchedule,t[10]=n.cronColSession,t[11]=n.cronLoading,t[12]=n.cronNone,t[13]=c,t[14]=o,t[15]=s,t[16]=r,t[17]=p,t[18]=l,t[19]=m,t[20]=g):g=t[20];let _;return t[21]!==h||t[22]!==g?(_=(0,Z.jsxs)(Wt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[h,g]}),t[21]=h,t[22]=g,t[23]=_):_=t[23],_}function gn(e){return(0,Z.jsx)(`option`,{value:e.id,children:e.id},e.id)}function _n(e){return e.language}function vn(e){let t=(0,X.c)(27),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:c,fileDraft:l,setFileDraft:u,fileSaving:d,profileFileLoading:f,profileEditorNonce:p}=e,m=g(yn),h;t[0]===n.filesHint?h=t[1]:(h=(0,Z.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=h);let _;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesSavingStatus||t[8]!==n.missing||t[9]!==n.navCoreFiles||t[10]!==n.pickFile||t[11]!==a||t[12]!==l||t[13]!==d||t[14]!==i||t[15]!==r||t[16]!==s||t[17]!==m||t[18]!==p||t[19]!==f||t[20]!==o||t[21]!==u||t[22]!==c?(_=r?(0,Z.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):i?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Z.jsx)(`nav`,{className:`flex shrink-0 flex-row flex-wrap gap-x-0.5 gap-y-0 border-b border-edge-subtle`,"aria-label":n.navCoreFiles,children:i.files.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:Y(`-mb-px shrink-0 border-b-2 border-transparent px-3 py-2 text-left font-mono text-xs whitespace-nowrap transition-colors`,Ne.press,a===e.name?`border-accent text-fg`:`text-fg-muted hover:border-edge-subtle hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>o(e.name),children:[e.name,e.missing?` (${n.missing})`:``]},e.name))}),(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.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,Z.jsxs)(`button`,{type:`button`,className:Y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ne.press,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`edit`),children:[(0,Z.jsx)(q,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Z.jsxs)(`button`,{type:`button`,className:Y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ne.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`preview`),children:[(0,Z.jsx)(E,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[d?(0,Z.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Z.jsx)(`span`,{children:n.filesAutoSaveHint})]})]}),s===`edit`?(0,Z.jsx)(`div`,{className:Y(cn(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,f&&`pointer-events-none opacity-60`),children:(0,Z.jsx)(R,{initialContent:l,onChange:u,isDark:m,className:`min-h-0 flex-1`},`${a??`file`}-${p}`)}):(0,Z.jsx)(`div`,{className:Y(cn(),`min-h-0 flex-1 overflow-y-auto text-sm`,f&&`pointer-events-none opacity-60`),children:(0,Z.jsx)(gt,{content:l,className:`text-sm`})})]}):(0,Z.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Z.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesSavingStatus,t[8]=n.missing,t[9]=n.navCoreFiles,t[10]=n.pickFile,t[11]=a,t[12]=l,t[13]=d,t[14]=i,t[15]=r,t[16]=s,t[17]=m,t[18]=p,t[19]=f,t[20]=o,t[21]=u,t[22]=c,t[23]=_):_=t[23];let v;return t[24]!==h||t[25]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[h,_]}),t[24]=h,t[25]=_,t[26]=v):v=t[26],v}function yn(e){return e.resolved===`dark`}function bn(){return Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Ge,`dark:border-edge`)}function xn(){return Y(Be,rt)}var Sn=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`;function Cn(e){let t=(0,X.c)(25),{rows:n,onChange:r,disabled:i,chat:a,labels:o}=e,s;t[0]!==r||t[1]!==n?(s=(e,t)=>{r(n.map((n,r)=>r===e?{...n,...t}:n))},t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s,l;t[3]!==a||t[4]!==i||t[5]!==o.description||t[6]!==o.descriptionPlaceholder||t[7]!==o.id||t[8]!==o.idPlaceholder||t[9]!==o.remove||t[10]!==r||t[11]!==n||t[12]!==c?(l=n.map((e,t)=>(0,Z.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-edge-subtle bg-surface-panel/40 p-3 sm:grid-cols-[minmax(0,8rem)_minmax(0,1.2fr)_minmax(0,1fr)_auto] sm:items-start dark:border-edge-subtle`,children:[(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:e.id,disabled:i,placeholder:o.idPlaceholder,"aria-label":o.id,onChange:e=>c(t,{id:e.target.value.toLowerCase()})}),(0,Z.jsx)(Ke,{value:e.model,disabled:i,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:e=>c(t,{model:e})}),(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:e.description,disabled:i,placeholder:o.descriptionPlaceholder,"aria-label":o.description,onChange:e=>c(t,{description:e.target.value})}),(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:`shrink-0 sm:mt-0`,disabled:i,"aria-label":o.remove,onClick:()=>r(n.filter((e,n)=>n!==t)),children:(0,Z.jsx)(me,{className:`size-4`,strokeWidth:1.75})})]},t)),t[3]=a,t[4]=i,t[5]=o.description,t[6]=o.descriptionPlaceholder,t[7]=o.id,t[8]=o.idPlaceholder,t[9]=o.remove,t[10]=r,t[11]=n,t[12]=c,t[13]=l):l=t[13];let u;t[14]!==r||t[15]!==n?(u=()=>r([...n,{id:``,description:``,model:``}]),t[14]=r,t[15]=n,t[16]=u):u=t[16];let d;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4 shrink-0`,strokeWidth:1.75}),t[17]=d):d=t[17];let f;t[18]!==i||t[19]!==o.add||t[20]!==u?(f=(0,Z.jsxs)(mt,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,disabled:i,onClick:u,children:[d,o.add]}),t[18]=i,t[19]=o.add,t[20]=u,t[21]=f):f=t[21];let p;return t[22]!==l||t[23]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,f]}),t[22]=l,t[23]=f,t[24]=p):p=t[24],p}var wn=/^[a-z][a-z0-9_-]{0,63}$/;function Tn(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function En(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`||Array.isArray(n))continue;let e=n,r=typeof e.id==`string`?e.id.trim():``,i=typeof e.model==`string`?e.model.trim():``;if(!r||!i)continue;let a=typeof e.description==`string`?e.description.trim():``;t.push({id:r,model:i,description:a})}return t}function Dn(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!wn.test(e)||!r||!Tn(r))continue;let i=n.description.trim();t.set(e,i?{id:e,description:i,model:r}:{id:e,model:r})}return t.size===0?null:[...t.values()]}function On(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim();if(!(!e&&!i&&!r.description.trim())){if(!e||!wn.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!Tn(i))return t.invalidModel}}return null}function kn(e){return e.length===0?`—`:e.map(e=>`${e.id} → ${e.model}`).join(`, `)}function An(e){return(e??[]).map(e=>({id:e.id,model:e.model,description:e.description?.trim()??``}))}function jn(e){let t=(0,X.c)(112),{a:n,chat:r,selected:i,busy:a,modelsInherit:o,setModelsInherit:s,modelsRows:c,setModelsRows:l,onSaveModels:u,onResetModelsInherit:d,hideInlineSave:f}=e,p;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(p=(0,Z.jsx)(Ut,{className:`shrink-0`,icon:le,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=p):p=t[2];let m;t[3]===n.modelsResolutionGlobal?m=t[4]:(m=(0,Z.jsx)(`p`,{className:`font-medium text-fg-subtle`,children:n.modelsResolutionGlobal}),t[3]=n.modelsResolutionGlobal,t[4]=m);let h;t[5]===i.typedModels.defaults?h=t[6]:(h=kn(i.typedModels.defaults),t[5]=i.typedModels.defaults,t[6]=h);let g;t[7]===h?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:h}),t[7]=h,t[8]=g);let _;t[9]!==m||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-base px-3 py-2`,children:[m,g]}),t[9]=m,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`div`,{className:`hidden items-center justify-center text-fg-disabled sm:flex`,"aria-hidden":!0,children:(0,Z.jsx)(Ot,{className:`size-4`,strokeWidth:1.75})}),t[12]=v):v=t[12];let y;t[13]===n.modelsResolutionAgent?y=t[14]:(y=(0,Z.jsx)(`p`,{className:`font-medium text-fg-subtle`,children:n.modelsResolutionAgent}),t[13]=n.modelsResolutionAgent,t[14]=y);let b;t[15]!==n.modelsResolutionInherits||t[16]!==o||t[17]!==i.typedModels.effective||t[18]!==i.typedModels.entry?(b=o?n.modelsResolutionInherits:kn(i.typedModels.entry??i.typedModels.effective),t[15]=n.modelsResolutionInherits,t[16]=o,t[17]=i.typedModels.effective,t[18]=i.typedModels.entry,t[19]=b):b=t[19];let x;t[20]===b?x=t[21]:(x=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:b}),t[20]=b,t[21]=x);let S;t[22]!==y||t[23]!==x?(S=(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-base px-3 py-2`,children:[y,x]}),t[22]=y,t[23]=x,t[24]=S):S=t[24];let C;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{className:`hidden items-center justify-center text-fg-disabled sm:flex`,"aria-hidden":!0,children:(0,Z.jsx)(Ot,{className:`size-4`,strokeWidth:1.75})}),t[25]=C):C=t[25];let w;t[26]===n.modelsResolutionEffective?w=t[27]:(w=(0,Z.jsx)(`p`,{className:`font-medium text-fg-subtle`,children:n.modelsResolutionEffective}),t[26]=n.modelsResolutionEffective,t[27]=w);let T;t[28]===i.typedModels.effective?T=t[29]:(T=kn(i.typedModels.effective),t[28]=i.typedModels.effective,t[29]=T);let E;t[30]===T?E=t[31]:(E=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:T}),t[30]=T,t[31]=E);let D;t[32]!==w||t[33]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-base px-3 py-2`,children:[w,E]}),t[32]=w,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==D||t[36]!==_||t[37]!==S?(O=(0,Z.jsxs)(`div`,{className:`mb-4 grid shrink-0 gap-2 rounded-2xl border border-edge-subtle bg-surface-panel/60 p-3 text-xs sm:grid-cols-[1fr_auto_1fr_auto_1fr]`,children:[_,v,S,C,D]}),t[35]=D,t[36]=_,t[37]=S,t[38]=O):O=t[38];let k;t[39]!==i.typedModels.effective||t[40]!==s||t[41]!==l?(k=()=>{s(!0),l(An(i.typedModels.effective))},t[39]=i.typedModels.effective,t[40]=s,t[41]=l,t[42]=k):k=t[42];let A;t[43]!==n.modelsInherit||t[44]!==a||t[45]!==k?(A=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:a,onClick:k,children:n.modelsInherit}),t[43]=n.modelsInherit,t[44]=a,t[45]=k,t[46]=A):A=t[46];let j;t[47]!==i.typedModels.effective||t[48]!==i.typedModels.entry||t[49]!==s||t[50]!==l?(j=()=>{s(!1),l(An(i.typedModels.entry??i.typedModels.effective))},t[47]=i.typedModels.effective,t[48]=i.typedModels.entry,t[49]=s,t[50]=l,t[51]=j):j=t[51];let M;t[52]!==n.modelsCustomize||t[53]!==a||t[54]!==j?(M=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:a,onClick:j,children:n.modelsCustomize}),t[52]=n.modelsCustomize,t[53]=a,t[54]=j,t[55]=M):M=t[55];let N;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==o||t[59]!==d?(N=o?null:(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void d(),children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=o,t[59]=d,t[60]=N):N=t[60];let P;t[61]!==A||t[62]!==M||t[63]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[A,M,N]}),t[61]=A,t[62]=M,t[63]=N,t[64]=P):P=t[64];let F;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(F=L(`settingsAgentChat`),t[65]=F):F=t[65];let I;t[66]===n.modelsDefaultsLink?I=t[67]:(I=(0,Z.jsx)(qe,{to:F,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.modelsDefaultsLink}),t[66]=n.modelsDefaultsLink,t[67]=I);let R;t[68]!==P||t[69]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[P,I]}),t[68]=P,t[69]=I,t[70]=R):R=t[70];let z=n.modelsDefaultsLabel,B;t[71]===i.typedModels.defaults?B=t[72]:(B=kn(i.typedModels.defaults),t[71]=i.typedModels.defaults,t[72]=B);let V;t[73]!==n.modelsDefaultsLabel||t[74]!==B?(V=(0,Z.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[z,` `,B]}),t[73]=n.modelsDefaultsLabel,t[74]=B,t[75]=V):V=t[75];let ee=n.modelsEffectiveLabel,H;t[76]===i.typedModels.effective?H=t[77]:(H=kn(i.typedModels.effective),t[76]=i.typedModels.effective,t[77]=H);let U;t[78]!==n.modelsEffectiveLabel||t[79]!==H?(U=(0,Z.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[ee,` `,H]}),t[78]=n.modelsEffectiveLabel,t[79]=H,t[80]=U):U=t[80];let W=o&&`opacity-50`,G;t[81]===W?G=t[82]:(G=Y(`mt-4 min-h-0 flex-1`,W),t[81]=W,t[82]=G);let K=o||a,q;t[83]!==n.addTypedModel||t[84]!==n.removeTypedModel||t[85]!==n.typedModelDescriptionLabel||t[86]!==n.typedModelDescriptionPlaceholder||t[87]!==n.typedModelIdLabel||t[88]!==n.typedModelIdPlaceholder?(q={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,add:n.addTypedModel,remove:n.removeTypedModel,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder},t[83]=n.addTypedModel,t[84]=n.removeTypedModel,t[85]=n.typedModelDescriptionLabel,t[86]=n.typedModelDescriptionPlaceholder,t[87]=n.typedModelIdLabel,t[88]=n.typedModelIdPlaceholder,t[89]=q):q=t[89];let te;t[90]!==r||t[91]!==c||t[92]!==l||t[93]!==K||t[94]!==q?(te=(0,Z.jsx)(Cn,{rows:c,disabled:K,chat:r,onChange:l,labels:q}),t[90]=r,t[91]=c,t[92]=l,t[93]=K,t[94]=q,t[95]=te):te=t[95];let ne;t[96]!==G||t[97]!==te?(ne=(0,Z.jsx)(`div`,{className:G,children:te}),t[96]=G,t[97]=te,t[98]=ne):ne=t[98];let re;t[99]!==n.modelsSave||t[100]!==a||t[101]!==f||t[102]!==u?(re=f?null:(0,Z.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Z.jsx)(mt,{type:`button`,disabled:a,onClick:()=>void u(),children:n.modelsSave})}),t[99]=n.modelsSave,t[100]=a,t[101]=f,t[102]=u,t[103]=re):re=t[103];let ie;return t[104]!==p||t[105]!==O||t[106]!==R||t[107]!==V||t[108]!==U||t[109]!==ne||t[110]!==re?(ie=(0,Z.jsxs)(Wt,{className:`flex min-h-0 flex-1 flex-col`,children:[p,O,R,V,U,ne,re]}),t[104]=p,t[105]=O,t[106]=R,t[107]=V,t[108]=U,t[109]=ne,t[110]=re,t[111]=ie):ie=t[111],ie}var Q=e(t(),1);function Mn(e){let t=(0,X.c)(37),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,trailing:c}=e,l;t[0]!==r||t[1]!==n?(l={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=l):l=t[2];let u=it(l),d;t[3]===n?d=t[4]:(d=n.trim(),t[3]=n,t[4]=d);let f=d,p=f?`${f}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,m;t[5]===s?m=t[6]:(m=Y(`min-w-0 flex-1`,s),t[5]=s,t[6]=m);let h=i||u.picking,g;t[7]===r?g=t[8]:(g=e=>void r(e.target.value),t[7]=r,t[8]=g);let _=o??a.pathInputPlaceholder,v;t[9]!==m||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==n?(v=(0,Z.jsx)(`input`,{type:`text`,className:m,value:n,disabled:h,onChange:g,placeholder:_,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=n,t[14]=v):v=t[14];let y=i||u.picking,b;t[15]!==p||t[16]!==u.pick||t[17]!==y||t[18]!==n||t[19]!==a.selectWorkingDirectory?(b=(0,Z.jsx)(Ye,{compact:!0,value:n,onPick:u.pick,disabled:y,title:p,"aria-label":a.selectWorkingDirectory}),t[15]=p,t[16]=u.pick,t[17]=y,t[18]=n,t[19]=a.selectWorkingDirectory,t[20]=b):b=t[20];let x;t[21]!==b||t[22]!==c?(x=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[b,c]}),t[21]=b,t[22]=c,t[23]=x):x=t[23];let S;t[24]!==x||t[25]!==v?(S=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[v,x]}),t[24]=x,t[25]=v,t[26]=S):S=t[26];let C;t[27]!==u.confirmPick||t[28]!==u.hasNativePicker||t[29]!==u.modalOpen||t[30]!==u.setModalOpen||t[31]!==f||t[32]!==a?(C=u.hasNativePicker?null:(0,Z.jsx)(Dt,{open:u.modalOpen,onOpenChange:u.setModalOpen,initialAbsolutePath:f||void 0,onConfirm:u.confirmPick,wd:a}),t[27]=u.confirmPick,t[28]=u.hasNativePicker,t[29]=u.modalOpen,t[30]=u.setModalOpen,t[31]=f,t[32]=a,t[33]=C):C=t[33];let w;return t[34]!==S||t[35]!==C?(w=(0,Z.jsxs)(Z.Fragment,{children:[S,C]}),t[34]=S,t[35]=C,t[36]=w):w=t[36],w}function Nn(e){let t=(0,X.c)(19),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s}=e,c;t[0]===n?c=t[1]:(c=(0,Z.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=c);let l=i||`—`,u;t[2]===l?u=t[3]:(u=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:l}),t[2]=l,t[3]=u);let d;t[4]!==a||t[5]!==r?(d=r===`inherit`&&a?(0,Z.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==c||t[8]!==u||t[9]!==d?(f=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[c,u,d]}),t[7]=c,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,m;t[11]===p?m=t[12]:(m=Y(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,p),t[11]=p,t[12]=m);let h=r===`inherit`?o:s,g;t[13]!==m||t[14]!==h?(g=(0,Z.jsx)(`span`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==f||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[f,g]}),t[16]=f,t[17]=g,t[18]=_):_=t[18],_}function Pn(e){let t=(0,X.c)(40),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,settingsPath:s}=e,c=s===void 0?`/settings/agent-defaults`:s,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.editDefaultsLink||t[6]!==c?(g=(0,Z.jsx)(qe,{to:c,className:`text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:l.editDefaultsLink}),t[5]=l.editDefaultsLink,t[6]=c,t[7]=g):g=t[7];let _;t[8]!==l.subtitle||t[9]!==l.title||t[10]!==g?(_=(0,Z.jsx)(Ut,{icon:Ae,title:l.title,subtitle:l.subtitle,trailing:g}),t[8]=l.subtitle,t[9]=l.title,t[10]=g,t[11]=_):_=t[11];let v=d?`inherit`:`override`,y;t[12]!==r||t[13]!==l.inheritsValue||t[14]!==d?(y=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[12]=r,t[13]=l.inheritsValue,t[14]=d,t[15]=y):y=t[15];let b;t[16]!==m||t[17]!==l.badgeInherit||t[18]!==l.badgeOverride||t[19]!==l.modelLabel||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(Nn,{label:l.modelLabel,mode:v,value:m,inheritedFrom:y,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride}),t[16]=m,t[17]=l.badgeInherit,t[18]=l.badgeOverride,t[19]=l.modelLabel,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x=p?`inherit`:`override`,S;t[23]!==i||t[24]!==l.inheritsValue||t[25]!==p?(S=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[23]=i,t[24]=l.inheritsValue,t[25]=p,t[26]=S):S=t[26];let C;t[27]!==h||t[28]!==l.badgeInherit||t[29]!==l.badgeOverride||t[30]!==l.workspaceLabel||t[31]!==x||t[32]!==S?(C=(0,Z.jsx)(Nn,{label:l.workspaceLabel,mode:x,value:h,inheritedFrom:S,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride}),t[27]=h,t[28]=l.badgeInherit,t[29]=l.badgeOverride,t[30]=l.workspaceLabel,t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==C||t[35]!==b?(w=(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[b,C]}),t[34]=C,t[35]=b,t[36]=w):w=t[36];let T;return t[37]!==w||t[38]!==_?(T=(0,Z.jsxs)(Wt,{children:[_,w]}),t[37]=w,t[38]=_,t[39]=T):T=t[39],T}function Fn(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 In(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=(0,Q.useMemo)(()=>{let e=Re(n.trim());return e&&xt(e.styleId)?e.styleId:vt[0]??`adventurer`},[n]),m=(0,Q.useCallback)(async(e,n)=>{try{await z(t)}catch{}r(Me(e,n)),f(!1)},[t,r]),h=(0,Q.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){u(null),c(!0);try{await lt(t,n),r($e)}catch(e){let t=e instanceof Error?e.message:``;u(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{c(!1)}}},[i,t,r]),g=(e,t)=>{let r=Re(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Z.jsxs)(`div`,{...a?{id:a}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:i.avatarPickerTitle}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void h(e)}),(0,Z.jsxs)(mt,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:s,onClick:()=>o.current?.click(),children:[(0,Z.jsx)(de,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.avatarUploadCustom]})]})]}),l?(0,Z.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:l}):null,(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:vt.map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>void m(e,ct[0]??t),className:Y(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,Ne.press,p===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:Fn(e,i)},e))}),(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[ct.map(e=>(0,Z.jsx)(`button`,{type:`button`,title:e,onClick:()=>void m(p,e),className:Y(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Ne.press,g(p,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Z.jsx)(`img`,{src:dt(p,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Z.jsxs)(N,{open:d,onOpenChange:f,children:[(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:Y(`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`,Ne.press),children:i.avatarMore})}),(0,Z.jsx)(D,{children:(0,Z.jsxs)(ne,{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,Z.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:Fn(p,i)}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:wt.map(e=>(0,Z.jsx)(`button`,{type:`button`,title:e,onClick:()=>void m(p,e),className:Y(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Ne.press,g(p,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Z.jsx)(`img`,{src:dt(p,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.personaAvatar}),(0,Z.jsx)(Ve,{agentId:t,avatar:n,size:40}),n.trim()&&!Re(n.trim())&&n.trim()!==`xopc:custom`?(0,Z.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}var Ln={name:``,creature:``,emoji:``,avatar:``};function Rn(e){let t={...Ln};if(!e.trim())return t;let n={name:`name`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
|
|
2
|
-
`)){let e=r.match(/^[-*]\s+\*\*(\w+):\*\*\s*(.*)/i);if(!e)continue;let i=n[e[1].toLowerCase()];if(!i)continue;let a=e[2].trim();/^_\(.*\)_$/.test(a)&&(a=``),t[i]=a}return t}function zn(e){return[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${e.name}`,`- **Creature:** ${e.creature}`,`- **Emoji:** ${e.emoji}`,`- **Avatar:** ${e.avatar}`,``].join(`
|
|
3
|
-
`)}var Bn={callName:``,pronouns:``,timezone:``,notes:``};function Vn(e){let t={...Bn};if(!e.trim())return t;let n={name:`callName`,"what to call them":`callName`,pronouns:`pronouns`,timezone:`timezone`,notes:`notes`},r=e.split(`
|
|
4
|
-
`),i=-1;for(let e=0;e<r.length;e++){let a=r[e];if(/^##\s+Context/i.test(a)){i=e+1;continue}let o=a.match(/^[-*]\s+\*\*(.+?):\*\*\s*(.*)/i);if(!o)continue;let s=n[o[1].toLowerCase().trim()];if(!s)continue;let c=o[2].trim();/^_\(.*\)_$/.test(c)&&(c=``),t[s]=c}if(i>0){let e=r.slice(i).join(`
|
|
5
|
-
`).replace(/^_\(.*?\)_\s*/gm,``).replace(/^---\s*$/gm,``).replace(/The more you know.*$/s,``).trim();e&&!t.notes&&(t.notes=e)}return t}function Hn(e){let t=[`# USER.md - About Your Human`,``,`- **Name:** ${e.callName}`,`- **Pronouns:** ${e.pronouns}`,`- **Timezone:** ${e.timezone}`,``];return e.notes.trim()&&t.push(`## Context`,``,e.notes.trim(),``),t.join(`
|
|
6
|
-
`)}var Un=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
|
|
7
|
-
|
|
8
|
-
## Core Truths
|
|
9
|
-
|
|
10
|
-
**Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
|
|
11
|
-
|
|
12
|
-
**Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
|
|
13
|
-
|
|
14
|
-
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
|
|
15
|
-
|
|
16
|
-
**Remember you're a guest.** You have access to someone's life. Treat it with respect.
|
|
17
|
-
|
|
18
|
-
## Boundaries
|
|
19
|
-
|
|
20
|
-
- Private things stay private. Period.
|
|
21
|
-
- When in doubt, ask before acting externally.
|
|
22
|
-
- Never send half-baked replies to messaging surfaces.
|
|
23
|
-
|
|
24
|
-
## Vibe
|
|
25
|
-
|
|
26
|
-
Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
|
|
27
|
-
|
|
28
|
-
## Core Truths
|
|
29
|
-
|
|
30
|
-
**Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
|
|
31
|
-
|
|
32
|
-
**Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
|
|
33
|
-
|
|
34
|
-
**Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
|
|
35
|
-
|
|
36
|
-
**Earn trust by being reliable.** Show up, follow through, and remember what matters.
|
|
37
|
-
|
|
38
|
-
**Respect the intimacy.** You have access to someone's life. That's a privilege.
|
|
39
|
-
|
|
40
|
-
## Boundaries
|
|
41
|
-
|
|
42
|
-
- Private things stay private. Always.
|
|
43
|
-
- When in doubt, ask before acting externally.
|
|
44
|
-
- Be careful in group chats — you're not the user's voice.
|
|
45
|
-
|
|
46
|
-
## Vibe
|
|
47
|
-
|
|
48
|
-
Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑💻`,content:`# SOUL.md - Who You Are
|
|
49
|
-
|
|
50
|
-
## Core Truths
|
|
51
|
-
|
|
52
|
-
**Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
|
|
53
|
-
|
|
54
|
-
**Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
|
|
55
|
-
|
|
56
|
-
**Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
|
|
57
|
-
|
|
58
|
-
**Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
|
|
59
|
-
|
|
60
|
-
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
|
|
61
|
-
|
|
62
|
-
## Boundaries
|
|
63
|
-
|
|
64
|
-
- Private things stay private.
|
|
65
|
-
- When in doubt, ask before acting externally.
|
|
66
|
-
- Never send half-baked replies.
|
|
67
|
-
|
|
68
|
-
## Vibe
|
|
69
|
-
|
|
70
|
-
Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}];function Wn(e){let t=e.trimStart();if(!t.startsWith(`---`))return e;let n=t.indexOf(`---`,3);return n===-1?e:t.slice(n+3).trimStart()}function Gn(e){let t=Wn(e).trim();if(!t)return`professional`;for(let e of Un)if(e.id!==`custom`&&(t===e.content.trim()||qn(t,e.id)>=2))return e.id;return`custom`}var Kn={professional:/precise and efficient|Value the user's time|actionable answers/g,casual:/good friend|corporate drone|a little playful/g,geeky:/Precision over politeness|Go deep|slightly nerdy/g};function qn(e,t){let n=Kn[t];if(!n)return 0;let r=new RegExp(n.source,`g`),i=new Set,a;for(;(a=r.exec(e))!==null;)if(i.add(a[0]),i.size>=2)return i.size;return i.size}var Jn=[{value:``,labelEn:`Not set`,labelZh:`未设置`},{value:`Asia/Shanghai`,labelEn:`Asia/Shanghai (CST, UTC+8)`,labelZh:`亚洲/上海 (北京时间, UTC+8)`},{value:`Asia/Tokyo`,labelEn:`Asia/Tokyo (JST, UTC+9)`,labelZh:`亚洲/东京 (日本时间, UTC+9)`},{value:`Asia/Seoul`,labelEn:`Asia/Seoul (KST, UTC+9)`,labelZh:`亚洲/首尔 (韩国时间, UTC+9)`},{value:`Asia/Singapore`,labelEn:`Asia/Singapore (SGT, UTC+8)`,labelZh:`亚洲/新加坡 (UTC+8)`},{value:`Asia/Hong_Kong`,labelEn:`Asia/Hong Kong (HKT, UTC+8)`,labelZh:`亚洲/香港 (UTC+8)`},{value:`Asia/Taipei`,labelEn:`Asia/Taipei (CST, UTC+8)`,labelZh:`亚洲/台北 (UTC+8)`},{value:`Asia/Kolkata`,labelEn:`Asia/Kolkata (IST, UTC+5:30)`,labelZh:`亚洲/加尔各答 (印度时间, UTC+5:30)`},{value:`Asia/Dubai`,labelEn:`Asia/Dubai (GST, UTC+4)`,labelZh:`亚洲/迪拜 (UTC+4)`},{value:`Europe/London`,labelEn:`Europe/London (GMT/BST)`,labelZh:`欧洲/伦敦 (格林尼治时间)`},{value:`Europe/Paris`,labelEn:`Europe/Paris (CET, UTC+1)`,labelZh:`欧洲/巴黎 (中欧时间, UTC+1)`},{value:`Europe/Berlin`,labelEn:`Europe/Berlin (CET, UTC+1)`,labelZh:`欧洲/柏林 (中欧时间, UTC+1)`},{value:`Europe/Moscow`,labelEn:`Europe/Moscow (MSK, UTC+3)`,labelZh:`欧洲/莫斯科 (UTC+3)`},{value:`America/New_York`,labelEn:`America/New York (EST, UTC-5)`,labelZh:`美国/纽约 (东部时间, UTC-5)`},{value:`America/Chicago`,labelEn:`America/Chicago (CST, UTC-6)`,labelZh:`美国/芝加哥 (中部时间, UTC-6)`},{value:`America/Denver`,labelEn:`America/Denver (MST, UTC-7)`,labelZh:`美国/丹佛 (山地时间, UTC-7)`},{value:`America/Los_Angeles`,labelEn:`America/Los Angeles (PST, UTC-8)`,labelZh:`美国/洛杉矶 (太平洋时间, UTC-8)`},{value:`America/Sao_Paulo`,labelEn:`America/São Paulo (BRT, UTC-3)`,labelZh:`美洲/圣保罗 (巴西时间, UTC-3)`},{value:`Australia/Sydney`,labelEn:`Australia/Sydney (AEST, UTC+10)`,labelZh:`澳大利亚/悉尼 (UTC+10)`},{value:`Pacific/Auckland`,labelEn:`Pacific/Auckland (NZST, UTC+12)`,labelZh:`太平洋/奥克兰 (新西兰时间, UTC+12)`}];function Yn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return``}}var Xn=[{value:`先生`,labelEn:`Mr.`,labelZh:`先生`},{value:`女士`,labelEn:`Ms.`,labelZh:`女士`},{value:`同学`,labelEn:`Colleague`,labelZh:`同学`},{value:`老师`,labelEn:`Teacher`,labelZh:`老师`},{value:`老板`,labelEn:`Boss`,labelZh:`老板`},{value:`朋友`,labelEn:`Friend`,labelZh:`朋友`}],Zn=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}];function Qn(e){let t=(0,X.c)(208),{a:n,chat:r,selected:a,busy:o,editName:s,setEditName:c,editDescription:_,setEditDescription:v,editWorkspace:y,setEditWorkspace:b,editModel:x,setEditModel:S,onSetDefault:C,onSaveAgentEdits:w,onDelete:T,hideInlineSave:D,profileMarkdownLoading:O,profileDraft:k,updateIdentity:A,handleSoulTemplateChange:j,handleSoulContentChange:N,setAvatarDialogOpen:P,toggleSoulPreviewMode:F,defaultModel:I,defaultWorkspace:L}=e,z=I===void 0?``:I,B=L===void 0?``:L,V=i(tr),ee=g(er),H;t[0]===k?.identity?H=t[1]:(H=k?.identity??{name:``,creature:``,emoji:``,avatar:``},t[0]=k?.identity,t[1]=H);let U=H,W=k?.soulTemplate??`professional`,G=k?.soulCustomContent??``,K=k?.soulEditorNonce??0,q=k?.soulPreviewMode??!1,te=k?.avatarDialogOpen??!1,ne;t[2]===V?ne=t[3]:(ne=(e,t)=>V===`zh`?t:e,t[2]=V,t[3]=ne);let ie=ne,ae;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ae=cn(),t[4]=ae):ae=t[4];let oe=ae;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let se;t[7]!==n||t[8]!==z||t[9]!==B||t[10]!==x||t[11]!==y?(se=(0,Z.jsx)(Pn,{a:n,defaultModel:z,defaultWorkspace:B,agentModel:x,agentWorkspace:y}),t[7]=n,t[8]=z,t[9]=B,t[10]=x,t[11]=y,t[12]=se):se=t[12];let le;t[13]!==U.avatar||t[14]!==a.id?(le=(0,Z.jsx)(Ve,{agentId:a.id,avatar:U.avatar,size:36,className:`size-9 rounded-lg`}),t[13]=U.avatar,t[14]=a.id,t[15]=le):le=t[15];let ue;t[16]===P?ue=t[17]:(ue=()=>P(!0),t[16]=P,t[17]=ue);let de;t[18]!==n.avatarOpenSettingsAria||t[19]!==ue?(de={onClick:ue,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[18]=n.avatarOpenSettingsAria,t[19]=ue,t[20]=de):de=t[20];let fe;t[21]!==n.setDefault||t[22]!==o||t[23]!==C||t[24]!==a.isDefault?(fe=a.isDefault?null:(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void C(),children:n.setDefault}),t[21]=n.setDefault,t[22]=o,t[23]=C,t[24]=a.isDefault,t[25]=fe):fe=t[25];let pe;t[26]!==n.personaSectionIdentity||t[27]!==n.personaSectionIdentityHint||t[28]!==le||t[29]!==de||t[30]!==fe?(pe=(0,Z.jsx)(Ut,{icon:re,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:le,iconInteractive:de,trailing:fe}),t[26]=n.personaSectionIdentity,t[27]=n.personaSectionIdentityHint,t[28]=le,t[29]=de,t[30]=fe,t[31]=pe):pe=t[31];let he;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(u,{className:Y(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,ce)}),t[32]=he):he=t[32];let ge;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ge=Y(`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`,Ft),t[33]=ge):ge=t[33];let _e;t[34]===n.avatarPickerTitle?_e=t[35]:(_e=(0,Z.jsx)(m,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[34]=n.avatarPickerTitle,t[35]=_e);let ve;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ve=Y(et,`shrink-0 p-1.5 hover:bg-surface-base`),t[36]=ve):ve=t[36];let ye;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(Je,{className:`size-4`,"aria-hidden":!0}),t[37]=ye):ye=t[37];let be;t[38]===n.closeDialogAria?be=t[39]:(be=(0,Z.jsx)(h,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:ve,"aria-label":n.closeDialogAria,children:ye})}),t[38]=n.closeDialogAria,t[39]=be);let xe;t[40]!==_e||t[41]!==be?(xe=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[_e,be]}),t[40]=_e,t[41]=be,t[42]=xe):xe=t[42];let Se;t[43]===n.avatarRowHint?Se=t[44]:(Se=(0,Z.jsx)(p,{className:`sr-only`,children:n.avatarRowHint}),t[43]=n.avatarRowHint,t[44]=Se);let Ce;t[45]===A?Ce=t[46]:(Ce=e=>A({avatar:e}),t[45]=A,t[46]=Ce);let we;t[47]!==n||t[48]!==U.avatar||t[49]!==a.id||t[50]!==Ce?(we=(0,Z.jsx)(In,{agentId:a.id,value:U.avatar,onChange:Ce,a:n}),t[47]=n,t[48]=U.avatar,t[49]=a.id,t[50]=Ce,t[51]=we):we=t[51];let Te;t[52]!==xe||t[53]!==Se||t[54]!==we?(Te=(0,Z.jsxs)(l,{children:[he,(0,Z.jsxs)(d,{className:ge,onOpenAutoFocus:$n,children:[xe,Se,we]})]}),t[52]=xe,t[53]=Se,t[54]=we,t[55]=Te):Te=t[55];let Ee;t[56]!==te||t[57]!==P||t[58]!==Te?(Ee=(0,Z.jsx)(f,{open:te,onOpenChange:P,children:Te}),t[56]=te,t[57]=P,t[58]=Te,t[59]=Ee):Ee=t[59];let De;t[60]===n.displayName?De=t[61]:(De=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[60]=n.displayName,t[61]=De);let Oe;t[62]!==c||t[63]!==A?(Oe=e=>{c(e.target.value),A({name:e.target.value})},t[62]=c,t[63]=A,t[64]=Oe):Oe=t[64];let ke;t[65]!==n.personaNamePlaceholder||t[66]!==s||t[67]!==Oe?(ke=(0,Z.jsx)(`input`,{className:oe,value:s,onChange:Oe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[65]=n.personaNamePlaceholder,t[66]=s,t[67]=Oe,t[68]=ke):ke=t[68];let Ae;t[69]!==De||t[70]!==ke?(Ae=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[De,ke]}),t[69]=De,t[70]=ke,t[71]=Ae):Ae=t[71];let je;t[72]===n.personaEmoji?je=t[73]:(je=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[72]=n.personaEmoji,t[73]=je);let Me;t[74]===A?Me=t[75]:(Me=e=>A({emoji:e.target.value}),t[74]=A,t[75]=Me);let Pe;t[76]!==n.personaEmojiPlaceholder||t[77]!==U.emoji||t[78]!==Me?(Pe=(0,Z.jsx)(`input`,{className:oe,value:U.emoji,onChange:Me,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[76]=n.personaEmojiPlaceholder,t[77]=U.emoji,t[78]=Me,t[79]=Pe):Pe=t[79];let Fe;t[80]!==je||t[81]!==Pe?(Fe=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[je,Pe]}),t[80]=je,t[81]=Pe,t[82]=Fe):Fe=t[82];let Le;t[83]===n.agentDescription?Le=t[84]:(Le=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[83]=n.agentDescription,t[84]=Le);let Re;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Re=Y(oe,`min-h-16 resize-y text-sm leading-relaxed`),t[85]=Re):Re=t[85];let ze;t[86]===v?ze=t[87]:(ze=e=>v(e.target.value),t[86]=v,t[87]=ze);let Be;t[88]!==n.agentDescriptionPlaceholder||t[89]!==_||t[90]!==ze?(Be=(0,Z.jsx)(`textarea`,{className:Re,value:_,onChange:ze,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[88]=n.agentDescriptionPlaceholder,t[89]=_,t[90]=ze,t[91]=Be):Be=t[91];let J;t[92]!==Le||t[93]!==Be?(J=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[Le,Be]}),t[92]=Le,t[93]=Be,t[94]=J):J=t[94];let He;t[95]===n.personaCreature?He=t[96]:(He=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[95]=n.personaCreature,t[96]=He);let Ue;t[97]===U.creature?Ue=t[98]:(Ue=Zn.some(e=>e.value===U.creature)?U.creature:`__custom__`,t[97]=U.creature,t[98]=Ue);let We;t[99]===A?We=t[100]:(We=e=>{if(e.target.value===`__custom__`){A({creature:``});return}A({creature:e.target.value})},t[99]=A,t[100]=We);let Ge;t[101]===ie?Ge=t[102]:(Ge=Zn.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:ie(e.labelEn,e.labelZh)},e.value)),t[101]=ie,t[102]=Ge);let qe;t[103]===ie?qe=t[104]:(qe=ie(`Custom…`,`自定义…`),t[103]=ie,t[104]=qe);let Ye;t[105]===qe?Ye=t[106]:(Ye=(0,Z.jsx)(`option`,{value:`__custom__`,children:qe}),t[105]=qe,t[106]=Ye);let Xe;t[107]!==Ue||t[108]!==We||t[109]!==Ge||t[110]!==Ye?(Xe=(0,Z.jsxs)(`select`,{className:oe,value:Ue,onChange:We,children:[Ge,Ye]}),t[107]=Ue,t[108]=We,t[109]=Ge,t[110]=Ye,t[111]=Xe):Xe=t[111];let Ze;t[112]!==n.personaCreaturePlaceholder||t[113]!==U.creature||t[114]!==A?(Ze=Zn.some(e=>e.value===U.creature)?null:(0,Z.jsx)(`input`,{className:Y(oe,`mt-1 text-xs`),value:U.creature,onChange:e=>A({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[112]=n.personaCreaturePlaceholder,t[113]=U.creature,t[114]=A,t[115]=Ze):Ze=t[115];let Qe;t[116]!==He||t[117]!==Xe||t[118]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[He,Xe,Ze]}),t[116]=He,t[117]=Xe,t[118]=Ze,t[119]=Qe):Qe=t[119];let $e;t[120]!==Ae||t[121]!==Fe||t[122]!==J||t[123]!==Qe?($e=(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Ae,Fe,J,Qe]}),t[120]=Ae,t[121]=Fe,t[122]=J,t[123]=Qe,t[124]=$e):$e=t[124];let tt;t[125]!==pe||t[126]!==Ee||t[127]!==$e?(tt=(0,Z.jsxs)(Wt,{children:[pe,Ee,$e]}),t[125]=pe,t[126]=Ee,t[127]=$e,t[128]=tt):tt=t[128];let nt;t[129]!==n.editAgent||t[130]!==n.editAgentHint?(nt=(0,Z.jsx)(Ut,{icon:M,title:n.editAgent,subtitle:n.editAgentHint}),t[129]=n.editAgent,t[130]=n.editAgentHint,t[131]=nt):nt=t[131];let rt;t[132]===n.modelPrimary?rt=t[133]:(rt=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[132]=n.modelPrimary,t[133]=rt);let it;t[134]===S?it=t[135]:(it=e=>S(e),t[134]=S,t[135]=it);let at;t[136]!==o||t[137]!==r.modelNoMatches||t[138]!==r.modelPlaceholder||t[139]!==r.modelSearchPlaceholder||t[140]!==x||t[141]!==it?(at=(0,Z.jsx)(Ke,{className:`min-w-0 flex-1`,value:x,disabled:o,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:it}),t[136]=o,t[137]=r.modelNoMatches,t[138]=r.modelPlaceholder,t[139]=r.modelSearchPlaceholder,t[140]=x,t[141]=it,t[142]=at):at=t[142];let ot;t[143]!==n.modelClear||t[144]!==o||t[145]!==x||t[146]!==S?(ot=x.trim()?(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>S(``),children:n.modelClear}):null,t[143]=n.modelClear,t[144]=o,t[145]=x,t[146]=S,t[147]=ot):ot=t[147];let st;t[148]!==at||t[149]!==ot?(st=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[at,ot]}),t[148]=at,t[149]=ot,t[150]=st):st=t[150];let ct;t[151]!==rt||t[152]!==st?(ct=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[rt,st]}),t[151]=rt,t[152]=st,t[153]=ct):ct=t[153];let lt;t[154]===n.workspacePath?lt=t[155]:(lt=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[154]=n.workspacePath,t[155]=lt);let dt=r.workingDirectory,ft=r.workingDirectory.notSet,pt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(pt=Y(oe,`font-mono text-xs`),t[156]=pt):pt=t[156];let ht;t[157]!==o||t[158]!==r.workingDirectory||t[159]!==y||t[160]!==b?(ht=(0,Z.jsx)(Mn,{value:y,onChange:b,disabled:o,wd:dt,placeholder:ft,inputClassName:pt}),t[157]=o,t[158]=r.workingDirectory,t[159]=y,t[160]=b,t[161]=ht):ht=t[161];let _t;t[162]!==lt||t[163]!==ht?(_t=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[lt,ht]}),t[162]=lt,t[163]=ht,t[164]=_t):_t=t[164];let vt;t[165]!==ct||t[166]!==_t?(vt=(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[ct,_t]}),t[165]=ct,t[166]=_t,t[167]=vt):vt=t[167];let yt;t[168]!==n.save||t[169]!==o||t[170]!==D||t[171]!==w?(yt=D?null:(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(mt,{type:`button`,disabled:o,onClick:()=>void w(),children:n.save})}),t[168]=n.save,t[169]=o,t[170]=D,t[171]=w,t[172]=yt):yt=t[172];let bt;t[173]!==nt||t[174]!==vt||t[175]!==yt?(bt=(0,Z.jsxs)(Wt,{children:[nt,vt,yt]}),t[173]=nt,t[174]=vt,t[175]=yt,t[176]=bt):bt=t[176];let xt;t[177]!==n.loading||t[178]!==n.personaSectionSoul||t[179]!==n.personaSectionSoulHint||t[180]!==n.personaSoulCustomEdit||t[181]!==n.personaSoulEdit||t[182]!==n.personaSoulPreview||t[183]!==n.personaSoulTemplate||t[184]!==N||t[185]!==j||t[186]!==ee||t[187]!==ie||t[188]!==O||t[189]!==G||t[190]!==K||t[191]!==q||t[192]!==W||t[193]!==F?(xt=O?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ut,{icon:Ie,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Z.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:Un.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:Y(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,Ne.pressCard,W===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>j(e.id),children:[(0,Z.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ie(e.labelEn,e.labelZh)})]},e.id))})]}),W===`custom`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Z.jsx)(`button`,{type:`button`,className:Y(et,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:q?n.personaSoulEdit:n.personaSoulPreview,"aria-label":q?n.personaSoulEdit:n.personaSoulPreview,onClick:F,children:q?(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsx)(`div`,{className:Y(oe,`flex min-h-64 flex-col overflow-hidden p-0`),children:q?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Z.jsx)(gt,{content:G})}):(0,Z.jsx)(R,{initialContent:G,onChange:N,isDark:ee,className:`min-h-0 flex-1`},`soul-${K}`)})]}):null]}),t[177]=n.loading,t[178]=n.personaSectionSoul,t[179]=n.personaSectionSoulHint,t[180]=n.personaSoulCustomEdit,t[181]=n.personaSoulEdit,t[182]=n.personaSoulPreview,t[183]=n.personaSoulTemplate,t[184]=N,t[185]=j,t[186]=ee,t[187]=ie,t[188]=O,t[189]=G,t[190]=K,t[191]=q,t[192]=W,t[193]=F,t[194]=xt):xt=t[194];let St;t[195]!==n.purgeDisk||t[196]!==n.removeFromConfig||t[197]!==o||t[198]!==ie||t[199]!==T||t[200]!==a.id?(St=a.id===`main`?null:(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ut,{icon:Pt,title:ie(`Danger Zone`,`危险操作`),subtitle:ie(`Actions that cannot be undone. Be careful.`,`以下操作不可撤销,请谨慎操作。`)}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(mt,{type:`button`,variant:`secondary`,disabled:o,onClick:()=>void T(!1),children:[(0,Z.jsx)(me,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:`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`,disabled:o,onClick:()=>void T(!0),children:n.purgeDisk})]})]}),t[195]=n.purgeDisk,t[196]=n.removeFromConfig,t[197]=o,t[198]=ie,t[199]=T,t[200]=a.id,t[201]=St):St=t[201];let Ct;return t[202]!==tt||t[203]!==se||t[204]!==bt||t[205]!==xt||t[206]!==St?(Ct=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto`,children:[se,tt,bt,xt,St]}),t[202]=tt,t[203]=se,t[204]=bt,t[205]=xt,t[206]=St,t[207]=Ct):Ct=t[207],Ct}function $n(e){return e.preventDefault()}function er(e){return e.resolved===`dark`}function tr(e){return e.language}function nr(e){let t=!e.pronouns||Xn.some(t=>t.value===e.pronouns),n=Jn.some(t=>t.value===e.timezone);return{showCustomPronouns:!!(e.pronouns&&!t),showCustomTimezone:!!(e.timezone&&!n),customTimezone:e.timezone&&!n?e.timezone:``}}function rr(e,t){switch(t.type){case`load`:{let e=nr(t.user),n=JSON.stringify(t.user);return{user:t.user,snapshot:n,...e}}case`patch`:{let n={...e.user,...t.patch};return{...e,user:n}}case`setShowCustomPronouns`:return{...e,showCustomPronouns:t.value};case`setShowCustomTimezone`:return{...e,showCustomTimezone:t.value};case`setCustomTimezone`:return{...e,customTimezone:t.value};case`saved`:return{...e,snapshot:JSON.stringify(e.user)}}}var ir={callName:``,pronouns:``,timezone:``,notes:``},ar={user:ir,showCustomPronouns:!1,showCustomTimezone:!1,customTimezone:``,snapshot:JSON.stringify(ir)};function or({a:e,agentId:t,saveRef:n,onDirtyChange:r}){let a=i(e=>e.language),[o,s]=(0,Q.useReducer)(rr,ar),c=(0,Q.useRef)(t);c.current=t;let l=(0,Q.useRef)(r);l.current=r;let u=K(async()=>{let e=Vn(await F(t,`USER.md`).catch(()=>``));if(!e.timezone){let t=Yn();if(t)return{...e,timezone:t}}return e},[t],{enabled:!!t,initial:null,errorData:ir}),d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{u.loading||!u.data||d.current!==t&&(d.current=t,s({type:`load`,user:u.data}),l.current?.(!1))},[t,u.loading,u.data]);let f=(0,Q.useCallback)(async e=>{await Ue(c.current,`USER.md`,e)},[]),p=(0,Q.useRef)(o.user);p.current=o.user,(0,Q.useEffect)(()=>{if(n)return n.current=async()=>{await f(Hn(p.current)),s({type:`saved`}),l.current?.(!1)},()=>{n.current=null}},[n,f]);let m=(0,Q.useCallback)(e=>{s({type:`patch`,patch:e});let t={...p.current,...e};l.current?.(JSON.stringify(t)!==o.snapshot)},[o.snapshot]),h=(0,Q.useCallback)(e=>{if(e===`__custom__`){s({type:`setShowCustomTimezone`,value:!0});return}s({type:`setShowCustomTimezone`,value:!1}),s({type:`setCustomTimezone`,value:``}),m({timezone:e})},[m]),g=(0,Q.useCallback)(e=>{s({type:`setCustomTimezone`,value:e}),m({timezone:e})},[m]),_=(0,Q.useCallback)(()=>{let e=Yn();e&&(Jn.some(t=>t.value===e)?(s({type:`setShowCustomTimezone`,value:!1}),s({type:`setCustomTimezone`,value:``})):(s({type:`setShowCustomTimezone`,value:!0}),s({type:`setCustomTimezone`,value:e})),m({timezone:e}))},[m]),v=o.showCustomTimezone?`__custom__`:Jn.some(e=>e.value===o.user.timezone)?o.user.timezone:`__custom__`,y=(0,Q.useCallback)((e,t)=>a===`zh`?t:e,[a]);if(u.loading)return(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.loading});let b=cn(),{user:x,showCustomPronouns:S,showCustomTimezone:C,customTimezone:w}=o;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.personaSectionUserHint}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ut,{icon:Ce,title:e.personaSectionUser,subtitle:e.personaSectionUserHint}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaCallName}),(0,Z.jsx)(`input`,{className:b,value:x.callName,onChange:e=>m({callName:e.target.value}),placeholder:e.personaCallNamePlaceholder,autoComplete:`off`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaPronouns}),(0,Z.jsxs)(`select`,{className:b,value:Xn.some(e=>e.value===x.pronouns)?x.pronouns:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){s({type:`setShowCustomPronouns`,value:!0});return}s({type:`setShowCustomPronouns`,value:!1}),m({pronouns:e.target.value})},children:[(0,Z.jsx)(`option`,{value:``,disabled:!0,children:e.personaPronounsPlaceholder}),Xn.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:y(e.labelEn,e.labelZh)},e.value)),(0,Z.jsx)(`option`,{value:`__custom__`,children:y(`Custom…`,`自定义…`)})]}),S?(0,Z.jsx)(`input`,{className:Y(b,`mt-1 text-xs`),value:Xn.some(e=>e.value===x.pronouns)?``:x.pronouns,onChange:e=>m({pronouns:e.target.value}),placeholder:e.personaPronounsPlaceholder,autoComplete:`off`}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaTimezone}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,Z.jsxs)(`select`,{className:Y(b,`min-w-0 flex-1`),value:v,onChange:e=>h(e.target.value),children:[Jn.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:y(e.labelEn,e.labelZh)},e.value)),(0,Z.jsx)(`option`,{value:`__custom__`,children:e.personaTimezoneCustom})]}),(0,Z.jsx)(`button`,{type:`button`,className:Y(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Ne.press),onClick:_,children:e.personaTimezoneDetect})]}),C?(0,Z.jsx)(`input`,{className:Y(b,`mt-1 font-mono text-xs`),value:w,onChange:e=>g(e.target.value),placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaNotes}),(0,Z.jsx)(`textarea`,{className:Y(b,`min-h-16 resize-y text-sm leading-relaxed`),value:x.notes,onChange:e=>m({notes:e.target.value}),placeholder:e.personaNotesPlaceholder,rows:3,spellCheck:!0})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(pe,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:e.personaMemoryNote})]})]})]})}function sr(e){let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(or,{...e},e.agentId),t[0]=e,t[1]=n),n}function cr(e){let t=(0,X.c)(65),{a:n,selected:r,busy:i,skillsCatalogLoading:a,catalogForPick:o,skillsInherit:s,setSkillsInherit:c,skillsPick:l,setSkillsPick:u,onSaveSkills:d,hideInlineSave:f}=e,p;t[0]===r.skills.effectiveAllowlist?p=t[1]:(p=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]=p);let m=p,h;t[2]!==o||t[3]!==r.skills.effectiveAllowlist?(h=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(o.map(lr)):new Set(e)},t[2]=o,t[3]=r.skills.effectiveAllowlist,t[4]=h):h=t[4];let g=h,_;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(_=(0,Z.jsx)(Ut,{className:`shrink-0`,icon:Le,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=_):_=t[7];let v;t[8]===c?v=t[9]:(v=()=>c(!0),t[8]=c,t[9]=v);let y;t[10]!==n.skillsInherit||t[11]!==i||t[12]!==v?(y=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:i,onClick:v,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=i,t[12]=v,t[13]=y):y=t[13];let b;t[14]!==g||t[15]!==c||t[16]!==u?(b=()=>{c(!1),u(g())},t[14]=g,t[15]=c,t[16]=u,t[17]=b):b=t[17];let x;t[18]!==n.skillsCustomize||t[19]!==i||t[20]!==b?(x=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:i,onClick:b,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=i,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==y||t[23]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y,x]}),t[22]=y,t[23]=x,t[24]=S):S=t[24];let C;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(C=L(`skills`),t[25]=C):C=t[25];let w;t[26]===n.skillsLibraryLink?w=t[27]:(w=(0,Z.jsx)(qe,{to:C,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=w);let T;t[28]!==S||t[29]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[S,w]}),t[28]=S,t[29]=w,t[30]=T):T=t[30];let E;t[31]===r.skills.defaults?E=t[32]:(E=r.skills.defaults.length?r.skills.defaults.join(`, `):`—`,t[31]=r.skills.defaults,t[32]=E);let D;t[33]!==n.skillsDefaultsLabel||t[34]!==E?(D=(0,Z.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsDefaultsLabel,` `,E]}),t[33]=n.skillsDefaultsLabel,t[34]=E,t[35]=D):D=t[35];let O;t[36]!==n.skillsAllFromCatalog||t[37]!==r.skills.effectiveAllowlist?(O=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):n.skillsAllFromCatalog,t[36]=n.skillsAllFromCatalog,t[37]=r.skills.effectiveAllowlist,t[38]=O):O=t[38];let k;t[39]!==n.skillsEffectiveLabel||t[40]!==O?(k=(0,Z.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,O]}),t[39]=n.skillsEffectiveLabel,t[40]=O,t[41]=k):k=t[41];let A;t[42]!==n.skillsCatalogLoading||t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==i||t[46]!==o||t[47]!==m||t[48]!==u||t[49]!==a||t[50]!==s||t[51]!==l?(A=a?(0,Z.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsCatalogLoading}):o.length===0?(0,Z.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Z.jsx)(`div`,{className:Y(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,s&&`opacity-50`),children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:o.map(e=>{let t=e.name||e.directoryId,r=s?m(t):l.has(t),a=typeof e.description==`string`?e.description.trim():``,o=a||n.skillsNoDescription;return(0,Z.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 dark:border-edge-subtle`,children:(0,Z.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:s||i,onChange:()=>{u(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Z.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Z.jsx)(`p`,{className:Y(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!a&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})}),t[42]=n.skillsCatalogLoading,t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=i,t[46]=o,t[47]=m,t[48]=u,t[49]=a,t[50]=s,t[51]=l,t[52]=A):A=t[52];let j;t[53]!==n.skillsSave||t[54]!==i||t[55]!==f||t[56]!==d?(j=f?null:(0,Z.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Z.jsx)(mt,{type:`button`,disabled:i,onClick:()=>void d(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=i,t[55]=f,t[56]=d,t[57]=j):j=t[57];let M;return t[58]!==T||t[59]!==D||t[60]!==k||t[61]!==A||t[62]!==j||t[63]!==_?(M=(0,Z.jsxs)(Wt,{className:`flex min-h-0 flex-1 flex-col`,children:[_,T,D,k,A,j]}),t[58]=T,t[59]=D,t[60]=k,t[61]=A,t[62]=j,t[63]=_,t[64]=M):M=t[64],M}function lr(e){return e.name||e.directoryId}var ur=[{key:`workspace`,toolIds:[`read_file`,`write_file`,`edit_file`,`list_dir`,`grep`,`find`]},{key:`execution`,toolIds:[`shell`]},{key:`messaging`,toolIds:[`send_message`,`send_media`]},{key:`memory`,toolIds:[`memory_search`,`memory_get`,`curated_memory`,`session_search`]},{key:`media`,toolIds:[`image`,`image_generate`]},{key:`web`,toolIds:[`web_search`,`web_fetch`,`browser_use`]},{key:`extensions`,toolIds:[`extensions`]},{key:`mcp`,toolIds:[`bundle-mcp`]}],dr=new Set(ur.flatMap(e=>[...e.toolIds].map(e=>String(e))));function fr(e){return e.filter(e=>e&&!dr.has(e)).sort((e,t)=>e.localeCompare(t))}var pr=[`write_file`,`edit_file`,`shell`],mr=[`shell`,`image_generate`,`extensions`],hr=[`send_message`,`send_media`];function gr(e){let t=(0,X.c)(88),{mode:n,builtinToolIds:r,loading:i,disableSet:a,onDisableSetChange:o,defaultsDisableSet:s,unknownDisabledIds:c,getToolDescription:l,getGroupTitle:u,labels:d,quickActionsDisabled:f}=e,p;t[0]===c?p=t[1]:(p=c===void 0?[]:c,t[0]=c,t[1]=p);let m=p,h=f===void 0?!1:f,g;t[2]===r?g=t[3]:(g=new Set(r),t[2]=r,t[3]=g);let _=g,v;t[4]===s?v=t[5]:(v=s??new Set,t[4]=s,t[5]=v);let y=v,b;t[6]!==y||t[7]!==a||t[8]!==n||t[9]!==o?(b=(e,t)=>{if(n===`agentEntry`&&t&&y.has(e))return;let r=new Set(a);t?r.delete(e):r.add(e),o(r)},t[6]=y,t[7]=a,t[8]=n,t[9]=o,t[10]=b):b=t[10];let x=b,S;t[11]!==_||t[12]!==o?(S=e=>{let t=new Set;for(let n of e)_.has(n)&&t.add(n);o(t)},t[11]=_,t[12]=o,t[13]=S):S=t[13];let C=S,w;t[14]===o?w=t[15]:(w=()=>{o(new Set)},t[14]=o,t[15]=w);let T=w,E;t[16]!==r||t[17]!==o||t[18]!==m?(E=()=>{o(new Set([...r,...m]))},t[16]=r,t[17]=o,t[18]=m,t[19]=E):E=t[19];let D=E,O;t[20]===r?O=t[21]:(O=fr(r),t[20]=r,t[21]=O);let k=O,A;if(t[22]!==_||t[23]!==k||t[24]!==n||t[25]!==m){if(A=[],n===`defaults`&&m.length>0){let e;t[27]===m?e=t[28]:(e=m.toSorted(vr),t[27]=m,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),A.push(n)}for(let e of ur){let t=e.toolIds.filter(e=>_.has(e));t.length>0&&A.push({key:e.key,ids:[...t]})}if(k.length>0){let e;t[31]===k?e=t[32]:(e={key:`misc`,ids:k},t[31]=k,t[32]=e),A.push(e)}t[22]=_,t[23]=k,t[24]=n,t[25]=m,t[26]=A}else A=t[26];let j=A,M=j.some(_r),N=h||i,P;t[33]===d.quickActionsLabel?P=t[34]:(P=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.quickActionsLabel}),t[33]=d.quickActionsLabel,t[34]=P);let F=N||r.length===0&&m.length===0,I;t[35]!==T||t[36]!==d.quickEnableAll||t[37]!==F?(I=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:F,onClick:T,children:d.quickEnableAll}),t[35]=T,t[36]=d.quickEnableAll,t[37]=F,t[38]=I):I=t[38];let L=N||r.length===0&&m.length===0,R;t[39]!==D||t[40]!==d.quickDisableAll||t[41]!==L?(R=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:L,onClick:D,children:d.quickDisableAll}),t[39]=D,t[40]=d.quickDisableAll,t[41]=L,t[42]=R):R=t[42];let z=N||r.length===0,B;t[43]===C?B=t[44]:(B=()=>C(pr),t[43]=C,t[44]=B);let V;t[45]!==d.quickReadOnlyWorkspace||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:z,onClick:B,children:d.quickReadOnlyWorkspace}),t[45]=d.quickReadOnlyWorkspace,t[46]=z,t[47]=B,t[48]=V):V=t[48];let ee=N||r.length===0,H;t[49]===C?H=t[50]:(H=()=>C(mr),t[49]=C,t[50]=H);let U;t[51]!==d.quickHighRiskOff||t[52]!==ee||t[53]!==H?(U=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:ee,onClick:H,children:d.quickHighRiskOff}),t[51]=d.quickHighRiskOff,t[52]=ee,t[53]=H,t[54]=U):U=t[54];let W=N||r.length===0,G;t[55]===C?G=t[56]:(G=()=>C(hr),t[55]=C,t[56]=G);let K;t[57]!==d.quickNoOutbound||t[58]!==W||t[59]!==G?(K=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:W,onClick:G,children:d.quickNoOutbound}),t[57]=d.quickNoOutbound,t[58]=W,t[59]=G,t[60]=K):K=t[60];let q;t[61]!==I||t[62]!==R||t[63]!==V||t[64]!==U||t[65]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[I,R,V,U,K]}),t[61]=I,t[62]=R,t[63]=V,t[64]=U,t[65]=K,t[66]=q):q=t[66];let te;t[67]!==P||t[68]!==q?(te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[P,q]}),t[67]=P,t[68]=q,t[69]=te):te=t[69];let ne;t[70]!==y||t[71]!==a||t[72]!==u||t[73]!==l||t[74]!==j||t[75]!==M||t[76]!==d.emptyBuiltin||t[77]!==d.loadingBuiltin||t[78]!==d.lockedByDefaults||t[79]!==d.notInBuiltin||t[80]!==i||t[81]!==n||t[82]!==N||t[83]!==x?(ne=i?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.loadingBuiltin}):M?(0,Z.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Z.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:j.map(e=>{let{key:t,ids:r}=e;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:u(t)}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,i=n===`agentEntry`&&y.has(e),o=a.has(e),s=i?!1:!o,c=l(e);return(0,Z.jsx)(`li`,{className:Y(`rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5 dark:border-edge-subtle`,r&&`border-dashed`,i&&`opacity-60`),children:(0,Z.jsxs)(`label`,{className:Y(`flex gap-3 text-sm`,i?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:s,disabled:i||N,onChange:()=>x(e,!s)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Z.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,d.notInBuiltin,`)`]}):null,i?(0,Z.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,d.lockedByDefaults,`)`]}):null]}),c?(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c}):null]})]})},e)})})]},t)})})}):(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.emptyBuiltin}),t[70]=y,t[71]=a,t[72]=u,t[73]=l,t[74]=j,t[75]=M,t[76]=d.emptyBuiltin,t[77]=d.loadingBuiltin,t[78]=d.lockedByDefaults,t[79]=d.notInBuiltin,t[80]=i,t[81]=n,t[82]=N,t[83]=x,t[84]=ne):ne=t[84];let re;return t[85]!==te||t[86]!==ne?(re=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[te,ne]}),t[85]=te,t[86]=ne,t[87]=re):re=t[87],re}function _r(e){return e.ids.length>0}function vr(e,t){return e.localeCompare(t)}function yr(e){let t=(0,X.c)(51),{a:n,data:r,selected:o,busy:s,toolEntryDisable:c,setToolEntryDisable:l,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=i(xr),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===o.tools.defaultsDisable?g=t[3]:(g=new Set(o.tools.defaultsDisable.flatMap(br)),t[2]=o.tools.defaultsDisable,t[3]=g);let _=g,v;t[4]===l?v=t[5]:(v=e=>{l(e)},t[4]=l,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,Z.jsx)(Ut,{className:`shrink-0`,icon:je,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.toolsLockedByDefaults||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.toolsLockedByDefaults},t[13]=n.toolsLockedByDefaults,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]!==s||t[25]!==r.builtinToolIds||t[26]!==_||t[27]!==S||t[28]!==w||t[29]!==y||t[30]!==E||t[31]!==c?(D=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(gr,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:c,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:s,labels:E})}),t[24]=s,t[25]=r.builtinToolIds,t[26]=_,t[27]=S,t[28]=w,t[29]=y,t[30]=E,t[31]=c,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==s||t[35]!==f||t[36]!==u?(O=f?null:(0,Z.jsx)(mt,{type:`button`,disabled:s,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=s,t[35]=f,t[36]=u,t[37]=O):O=t[37];let k;t[38]===d?k=t[39]:(k=()=>void d(),t[38]=d,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==s||t[42]!==k?(A=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:s,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=s,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==A||t[45]!==O?(j=(0,Z.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,Z.jsxs)(Wt,{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 br(e){let t=String(e).trim();return t?[t]:[]}function xr(e){return e.language}function Sr(e){let t=(0,X.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,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSaveAgentEdits:b,onDelete:x,profileSaveRef:S,overviewProfile:C,setProfileDirty:w,filesLoading:T,files:E,activeFile:D,setActiveFile:O,filesViewMode:k,setFilesViewMode:A,fileDraft:j,setFileDraft:M,fileSaving:N,profileFileLoading:P,profileEditorNonce:F,toolEntryDisable:I,setToolEntryDisable:L,onSaveTools:R,onClearToolsEntry:z,skillsCatalogLoading:B,catalogForPick:V,skillsInherit:ee,setSkillsInherit:H,skillsPick:U,setSkillsPick:W,onSaveSkills:G,modelsInherit:K,setModelsInherit:q,modelsRows:te,setModelsRows:ne,onSaveModels:re,onResetModelsInherit:ie,bindingsLoading:ae,agentBindings:oe,bindChannelStatuses:se,bindChannelsLoading:ce,useManualChannel:le,newBindChannel:ue,setNewBindChannel:de,bindSessionChats:fe,bindSessionsLoading:pe,newBindSessionIdx:me,setNewBindSessionIdx:he,newBindCustomPeer:ge,setNewBindCustomPeer:_e,refreshBindSessions:ve,onRemoveBinding:ye,onAddBinding:be,cronLoading:xe,agentCronJobs:Se,onSetCronJobAgent:Ce}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Z.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]!==r||t[5]!==_||t[6]!==v||t[7]!==d||t[8]!==h||t[9]!==l||t[10]!==p||t[11]!==x||t[12]!==b||t[13]!==y||t[14]!==C.draft||t[15]!==C.handleSoulContentChange||t[16]!==C.handleSoulTemplateChange||t[17]!==C.profileMarkdownLoading||t[18]!==C.setAvatarDialogOpen||t[19]!==C.toggleSoulPreviewMode||t[20]!==C.updateIdentity||t[21]!==a||t[22]!==f||t[23]!==g||t[24]!==u||t[25]!==m?(e=(0,Z.jsx)(Qn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSaveAgentEdits:b,onDelete:x,hideInlineSave:!0,profileMarkdownLoading:C.profileMarkdownLoading,profileDraft:C.draft,updateIdentity:C.updateIdentity,handleSoulTemplateChange:C.handleSoulTemplateChange,handleSoulContentChange:C.handleSoulContentChange,setAvatarDialogOpen:C.setAvatarDialogOpen,toggleSoulPreviewMode:C.toggleSoulPreviewMode,defaultModel:_,defaultWorkspace:v}),t[2]=n,t[3]=c,t[4]=r,t[5]=_,t[6]=v,t[7]=d,t[8]=h,t[9]=l,t[10]=p,t[11]=x,t[12]=b,t[13]=y,t[14]=C.draft,t[15]=C.handleSoulContentChange,t[16]=C.handleSoulTemplateChange,t[17]=C.profileMarkdownLoading,t[18]=C.setAvatarDialogOpen,t[19]=C.toggleSoulPreviewMode,t[20]=C.updateIdentity,t[21]=a,t[22]=f,t[23]=g,t[24]=u,t[25]=m,t[26]=e):e=t[26],e}if(o===`profile`){let e;return t[27]!==n||t[28]!==S||t[29]!==a.id||t[30]!==w?(e=(0,Z.jsx)(sr,{a:n,agentId:a.id,saveRef:S,onDirtyChange:w}),t[27]=n,t[28]=S,t[29]=a.id,t[30]=w,t[31]=e):e=t[31],e}if(o===`files`){let e;return t[32]!==n||t[33]!==D||t[34]!==j||t[35]!==N||t[36]!==E||t[37]!==T||t[38]!==k||t[39]!==F||t[40]!==P||t[41]!==O||t[42]!==M||t[43]!==A?(e=(0,Z.jsx)(vn,{a:n,filesLoading:T,files:E,activeFile:D,setActiveFile:O,filesViewMode:k,setFilesViewMode:A,fileDraft:j,setFileDraft:M,fileSaving:N,profileFileLoading:P,profileEditorNonce:F}),t[32]=n,t[33]=D,t[34]=j,t[35]=N,t[36]=E,t[37]=T,t[38]=k,t[39]=F,t[40]=P,t[41]=O,t[42]=M,t[43]=A,t[44]=e):e=t[44],e}if(o===`tools`){let e;return t[45]!==n||t[46]!==c||t[47]!==s||t[48]!==z||t[49]!==R||t[50]!==a||t[51]!==L||t[52]!==I?(e=(0,Z.jsx)(yr,{a:n,data:s,selected:a,busy:c,toolEntryDisable:I,setToolEntryDisable:L,onSaveTools:R,onClearToolsEntry:z,hideInlineSave:!0}),t[45]=n,t[46]=c,t[47]=s,t[48]=z,t[49]=R,t[50]=a,t[51]=L,t[52]=I,t[53]=e):e=t[53],e}if(o===`skills`){let e;return t[54]!==n||t[55]!==c||t[56]!==V||t[57]!==G||t[58]!==a||t[59]!==H||t[60]!==W||t[61]!==B||t[62]!==ee||t[63]!==U?(e=(0,Z.jsx)(cr,{a:n,selected:a,busy:c,skillsCatalogLoading:B,catalogForPick:V,skillsInherit:ee,setSkillsInherit:H,skillsPick:U,setSkillsPick:W,onSaveSkills:G,hideInlineSave:!0}),t[54]=n,t[55]=c,t[56]=V,t[57]=G,t[58]=a,t[59]=H,t[60]=W,t[61]=B,t[62]=ee,t[63]=U,t[64]=e):e=t[64],e}if(o===`models`){let e;return t[65]!==n||t[66]!==c||t[67]!==r||t[68]!==K||t[69]!==te||t[70]!==ie||t[71]!==re||t[72]!==a||t[73]!==q||t[74]!==ne?(e=(0,Z.jsx)(jn,{a:n,chat:r,selected:a,busy:c,modelsInherit:K,setModelsInherit:q,modelsRows:te,setModelsRows:ne,onSaveModels:re,onResetModelsInherit:ie,hideInlineSave:!0}),t[65]=n,t[66]=c,t[67]=r,t[68]=K,t[69]=te,t[70]=ie,t[71]=re,t[72]=a,t[73]=q,t[74]=ne,t[75]=e):e=t[75],e}if(o===`channels`){let e;return t[76]!==n||t[77]!==oe||t[78]!==se||t[79]!==ce||t[80]!==fe||t[81]!==pe||t[82]!==ae||t[83]!==c||t[84]!==i.lastActiveLabels||t[85]!==i.selectRecipient||t[86]!==ue||t[87]!==ge||t[88]!==me||t[89]!==be||t[90]!==ye||t[91]!==ve||t[92]!==de||t[93]!==_e||t[94]!==he||t[95]!==le?(e=(0,Z.jsx)(pn,{a:n,busy:c,bindingsLoading:ae,agentBindings:oe,channelStatuses:se,channelsStatusLoading:ce,useManualChannel:le,newBindChannel:ue,setNewBindChannel:de,bindSessionChats:fe,sessionsLoading:pe,newBindSessionIdx:me,setNewBindSessionIdx:he,newBindCustomPeer:ge,setNewBindCustomPeer:_e,onRefreshSessions:ve,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:ye,onAddBinding:be}),t[76]=n,t[77]=oe,t[78]=se,t[79]=ce,t[80]=fe,t[81]=pe,t[82]=ae,t[83]=c,t[84]=i.lastActiveLabels,t[85]=i.selectRecipient,t[86]=ue,t[87]=ge,t[88]=me,t[89]=be,t[90]=ye,t[91]=ve,t[92]=de,t[93]=_e,t[94]=he,t[95]=le,t[96]=e):e=t[96],e}if(o===`cron`&&s){let e;return t[97]!==n||t[98]!==Se||t[99]!==c||t[100]!==xe||t[101]!==s||t[102]!==Ce||t[103]!==a?(e=(0,Z.jsx)(hn,{a:n,data:s,selected:a,busy:c,cronLoading:xe,agentCronJobs:Se,onSetCronJobAgent:Ce}),t[97]=n,t[98]=Se,t[99]=c,t[100]=xe,t[101]=s,t[102]=Ce,t[103]=a,t[104]=e):e=t[104],e}let we;return t[105]===n.selectAgentHint?we=t[106]:(we=(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[105]=n.selectAgentHint,t[106]=we),we}function Cr(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=he(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=(e.description??``).toLowerCase(),s=j(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)||s.includes(r)}):e}function wr(e){let t=(0,X.c)(10),{a:n,busy:r,onNewAgent:i}=e,a;t[0]===i?a=t[1]:(a=()=>i(),t[0]=i,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=Y(`flex h-full min-h-[7.5rem] w-full flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed border-edge-subtle bg-surface-panel/40 px-4 py-6 text-sm font-medium text-fg-muted transition-colors`,`hover:border-accent/50 hover:bg-surface-hover hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`,Ne.pressCard),s=(0,Z.jsx)(J,{className:`size-8 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]===n.listNewAgentCard?c=t[5]:(c=(0,Z.jsx)(`span`,{children:n.listNewAgentCard}),t[4]=n.listNewAgentCard,t[5]=c);let l;return t[6]!==r||t[7]!==a||t[8]!==c?(l=(0,Z.jsxs)(`button`,{type:`button`,disabled:r,onClick:a,className:o,children:[s,c]}),t[6]=r,t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Tr(e){let t=(0,X.c)(42),{a:n,agents:r,searchQuery:i,onOpenAgent:a,onChatWithAgent:o,onNewAgent:s,busy:c}=e,l,u,d,f,p,m;if(t[0]!==n||t[1]!==r||t[2]!==c||t[3]!==o||t[4]!==s||t[5]!==a||t[6]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Cr(r,i,n),h=r.length>0&&e.length===0&&i.trim().length>0;if(r.length===0){let e;t[13]===n.listNoAgentsYet?e=t[14]:(e=(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[13]=n.listNoAgentsYet,t[14]=e);let r;t[15]!==n||t[16]!==c||t[17]!==s?(r=(0,Z.jsx)(`div`,{className:`max-w-sm`,children:(0,Z.jsx)(wr,{a:n,busy:c,onNewAgent:s})}),t[15]=n,t[16]=c,t[17]=s,t[18]=r):r=t[18];let i;t[19]!==e||t[20]!==r?(i=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e,r]}),t[19]=e,t[20]=r,t[21]=i):i=t[21],m=i;break bb0}f=`flex flex-col gap-4`,t[22]!==n||t[23]!==h?(p=h?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[22]=n,t[23]=h,t[24]=p):p=t[24],l=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,t[25]!==n||t[26]!==c||t[27]!==s?(u=(0,Z.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Z.jsx)(wr,{a:n,busy:c,onNewAgent:s})}),t[25]=n,t[26]=c,t[27]=s,t[28]=u):u=t[28];let g;t[29]!==n||t[30]!==c||t[31]!==o||t[32]!==a?(g=e=>{let t=he(e,n),r=e.id,i=j(e,n);return(0,Z.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Z.jsxs)(`div`,{className:Y(`flex h-full min-h-0 flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-sm transition-colors`,`hover:border-edge`),children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>a(e.id),className:Y(`flex shrink-0 w-full flex-col gap-2 text-left transition-colors`,`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`,Ne.pressCard),children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-accent-soft ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Z.jsx)(Ve,{agentId:e.id,avatar:e.avatar,size:44,className:`size-full`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold text-fg`,children:t}),e.isDefault?(0,Z.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:n.defaultBadge}):null]}),(0,Z.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Z.jsx)(`p`,{className:Y(`line-clamp-1 min-h-[1.3125rem] text-xs leading-relaxed`,i?`text-fg`:`text-fg-muted/25`),title:i||void 0,children:i||`\xA0`})]}),(0,Z.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>o(e.id),className:Y(`flex w-full shrink-0 items-center justify-center gap-2 rounded-full px-4 py-2.5 text-sm font-semibold`,`bg-accent-soft text-accent-fg transition-colors`,`hover:bg-accent/15`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`,Ne.press),children:[(0,Z.jsx)(pt,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})]})},e.id)},t[29]=n,t[30]=c,t[31]=o,t[32]=a,t[33]=g):g=t[33],d=e.map(g)}t[0]=n,t[1]=r,t[2]=c,t[3]=o,t[4]=s,t[5]=a,t[6]=i,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[34]!==l||t[35]!==u||t[36]!==d?(h=(0,Z.jsxs)(`ul`,{className:l,children:[u,d]}),t[34]=l,t[35]=u,t[36]=d,t[37]=h):h=t[37];let g;return t[38]!==f||t[39]!==p||t[40]!==h?(g=(0,Z.jsxs)(`div`,{className:f,children:[p,h]}),t[38]=f,t[39]=p,t[40]=h,t[41]=g):g=t[41],g}function Er(e){let t=(0,X.c)(7),{a:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,Z.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),t[0]=n.title,t[1]=r);let i;t[2]===n.subtitle?i=t[3]:(i=(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:n.subtitle}),t[2]=n.subtitle,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Z.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[r,i]})}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function Dr(e){let t=(0,X.c)(122),{open:n,onOpenChange:r,a:i,chat:a,busy:o,modalError:s,createDisplayName:c,setCreateDisplayName:g,createAgentId:_,setCreateAgentId:v,createDescription:y,setCreateDescription:b,createWorkspace:x,setCreateWorkspace:S,createModel:C,setCreateModel:w,onCreate:T,onSuggestWorkspace:E}=e,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(u,{className:Y(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ce)}),t[0]=D):D=t[0];let O;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(O=Y(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,Ft,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=O):O=t[1];let k;t[2]===i.addAgent?k=t[3]:(k=(0,Z.jsx)(m,{className:`text-base font-semibold text-fg`,children:i.addAgent}),t[2]=i.addAgent,t[3]=k);let A;t[4]===i.addAgentHint?A=t[5]:(A=(0,Z.jsx)(p,{className:`mt-0.5 text-xs text-fg-muted`,children:i.addAgentHint}),t[4]=i.addAgentHint,t[5]=A);let j;t[6]!==k||t[7]!==A?(j=(0,Z.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[k,A]}),t[6]=k,t[7]=A,t[8]=j):j=t[8];let M;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=Y(et,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=M):M=t[9];let N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Je,{className:`size-4`,"aria-hidden":!0}),t[10]=N):N=t[10];let P;t[11]===i.closeDialogAria?P=t[12]:(P=(0,Z.jsx)(h,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:M,"aria-label":i.closeDialogAria,children:N})}),t[11]=i.closeDialogAria,t[12]=P);let F;t[13]!==j||t[14]!==P?(F=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[j,P]}),t[13]=j,t[14]=P,t[15]=F):F=t[15];let I;t[16]===s?I=t[17]:(I=s?(0,Z.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[16]=s,t[17]=I);let L;t[18]===i.newAgentLabel?L=t[19]:(L=(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:i.newAgentLabel}),t[18]=i.newAgentLabel,t[19]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=cn(),t[20]=R):R=t[20];let z;t[21]===g?z=t[22]:(z=e=>g(e.target.value),t[21]=g,t[22]=z);let B;t[23]===E?B=t[24]:(B=()=>E(),t[23]=E,t[24]=B);let V;t[25]!==c||t[26]!==z||t[27]!==B?(V=(0,Z.jsx)(`input`,{className:R,value:c,onChange:z,onBlur:B,required:!0,autoComplete:`off`}),t[25]=c,t[26]=z,t[27]=B,t[28]=V):V=t[28];let ee;t[29]!==L||t[30]!==V?(ee=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[L,V]}),t[29]=L,t[30]=V,t[31]=ee):ee=t[31];let H;t[32]===i.newAgentIdOptional?H=t[33]:(H=(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:i.newAgentIdOptional}),t[32]=i.newAgentIdOptional,t[33]=H);let U;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(U=Y(cn(),`font-mono text-xs`),t[34]=U):U=t[34];let W;t[35]===v?W=t[36]:(W=e=>v(e.target.value),t[35]=v,t[36]=W);let G;t[37]===E?G=t[38]:(G=()=>E(),t[37]=E,t[38]=G);let K;t[39]!==i.newAgentIdPlaceholder||t[40]!==i.newAgentIdRules||t[41]!==_||t[42]!==W||t[43]!==G?(K=(0,Z.jsx)(`input`,{className:U,value:_,onChange:W,onBlur:G,placeholder:i.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:i.newAgentIdRules}),t[39]=i.newAgentIdPlaceholder,t[40]=i.newAgentIdRules,t[41]=_,t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]===i.newAgentIdRules?q=t[46]:(q=(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.newAgentIdRules}),t[45]=i.newAgentIdRules,t[46]=q);let te;t[47]!==H||t[48]!==K||t[49]!==q?(te=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[H,K,q]}),t[47]=H,t[48]=K,t[49]=q,t[50]=te):te=t[50];let ne;t[51]===i.agentDescription?ne=t[52]:(ne=(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:i.agentDescription}),t[51]=i.agentDescription,t[52]=ne);let re;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(re=Y(cn(),`min-h-[4.5rem] resize-y font-sans text-sm leading-relaxed`),t[53]=re):re=t[53];let ie;t[54]===b?ie=t[55]:(ie=e=>b(e.target.value),t[54]=b,t[55]=ie);let ae;t[56]!==i.agentDescriptionPlaceholder||t[57]!==y||t[58]!==ie?(ae=(0,Z.jsx)(`textarea`,{className:re,value:y,onChange:ie,placeholder:i.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[56]=i.agentDescriptionPlaceholder,t[57]=y,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]!==ne||t[61]!==ae?(oe=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ne,ae]}),t[60]=ne,t[61]=ae,t[62]=oe):oe=t[62];let se;t[63]===i.newWorkspace?se=t[64]:(se=(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:i.newWorkspace}),t[63]=i.newWorkspace,t[64]=se);let le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(le=Y(cn(),`font-mono text-xs`),t[65]=le):le=t[65];let ue;t[66]===S?ue=t[67]:(ue=e=>S(e.target.value),t[66]=S,t[67]=ue);let de;t[68]!==x||t[69]!==ue?(de=(0,Z.jsx)(`input`,{className:le,value:x,onChange:ue,required:!0,autoComplete:`off`}),t[68]=x,t[69]=ue,t[70]=de):de=t[70];let fe;t[71]!==se||t[72]!==de?(fe=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[se,de]}),t[71]=se,t[72]=de,t[73]=fe):fe=t[73];let pe;t[74]===i.newModelOptional?pe=t[75]:(pe=(0,Z.jsx)(`span`,{className:`text-fg-muted`,children:i.newModelOptional}),t[74]=i.newModelOptional,t[75]=pe);let me;t[76]===w?me=t[77]:(me=e=>w(e),t[76]=w,t[77]=me);let he;t[78]!==o||t[79]!==a.modelNoMatches||t[80]!==a.modelPlaceholder||t[81]!==a.modelSearchPlaceholder||t[82]!==C||t[83]!==me?(he=(0,Z.jsx)(Ke,{className:`min-w-0 flex-1`,value:C,disabled:o,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:me}),t[78]=o,t[79]=a.modelNoMatches,t[80]=a.modelPlaceholder,t[81]=a.modelSearchPlaceholder,t[82]=C,t[83]=me,t[84]=he):he=t[84];let ge;t[85]!==i.modelClear||t[86]!==o||t[87]!==C||t[88]!==w?(ge=C.trim()?(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>w(``),children:i.modelClear}):null,t[85]=i.modelClear,t[86]=o,t[87]=C,t[88]=w,t[89]=ge):ge=t[89];let _e;t[90]!==he||t[91]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[he,ge]}),t[90]=he,t[91]=ge,t[92]=_e):_e=t[92];let ve;t[93]!==pe||t[94]!==_e?(ve=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[pe,_e]}),t[93]=pe,t[94]=_e,t[95]=ve):ve=t[95];let ye;t[96]!==i.createModalCancel||t[97]!==o?(ye=(0,Z.jsx)(h,{asChild:!0,children:(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:o,children:i.createModalCancel})}),t[96]=i.createModalCancel,t[97]=o,t[98]=ye):ye=t[98];let be;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Rt,{className:`mr-1 size-4`,"aria-hidden":!0}),t[99]=be):be=t[99];let xe;t[100]!==i.create||t[101]!==o?(xe=(0,Z.jsxs)(mt,{type:`submit`,disabled:o,children:[be,i.create]}),t[100]=i.create,t[101]=o,t[102]=xe):xe=t[102];let Se;t[103]!==ye||t[104]!==xe?(Se=(0,Z.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[ye,xe]}),t[103]=ye,t[104]=xe,t[105]=Se):Se=t[105];let Ce;t[106]!==T||t[107]!==ee||t[108]!==te||t[109]!==oe||t[110]!==fe||t[111]!==ve||t[112]!==Se||t[113]!==I?(Ce=(0,Z.jsxs)(`form`,{className:`grid gap-3`,onSubmit:T,children:[I,ee,te,oe,fe,ve,Se]}),t[106]=T,t[107]=ee,t[108]=te,t[109]=oe,t[110]=fe,t[111]=ve,t[112]=Se,t[113]=I,t[114]=Ce):Ce=t[114];let we;t[115]!==Ce||t[116]!==F?(we=(0,Z.jsxs)(l,{children:[D,(0,Z.jsx)(d,{className:O,onOpenAutoFocus:Or,children:(0,Z.jsxs)(ke,{layer:`modal`,children:[F,Ce]})})]}),t[115]=Ce,t[116]=F,t[117]=we):we=t[117];let Te;return t[118]!==r||t[119]!==n||t[120]!==we?(Te=(0,Z.jsx)(f,{open:n,onOpenChange:r,children:we}),t[118]=r,t[119]=n,t[120]=we,t[121]=Te):Te=t[121],Te}function Or(e){return e.preventDefault()}var kr=`xopc-preset-agents-skipped`,Ar=[{id:`coder`,name:`Coder`,emoji:`💻`,descriptionEn:`Software development assistant — precise, pragmatic, and code-focused.`,descriptionZh:`软件开发助手 — 精确、务实、专注代码。`,toolsDisable:[`image_generate`],identityMd:`# IDENTITY.md - Who Am I?
|
|
71
|
-
|
|
72
|
-
- **Name:** Coder
|
|
73
|
-
- **Creature:** code architect
|
|
74
|
-
- **Emoji:** 💻
|
|
75
|
-
- **Avatar:**
|
|
76
|
-
`,soulMd:`# SOUL.md - Who You Are
|
|
77
|
-
|
|
78
|
-
## Core Truths
|
|
79
|
-
|
|
80
|
-
**Understand before you act.** Read the codebase, understand the patterns, then write code that fits. Never guess at architecture.
|
|
81
|
-
|
|
82
|
-
**Write code for humans.** Clean, readable code beats clever code every time. Name things well. Keep functions focused. Comment the why, not the what.
|
|
83
|
-
|
|
84
|
-
**Explain your changes.** When you modify code, explain what changed and why. Diffs without context are useless.
|
|
85
|
-
|
|
86
|
-
**Test what matters.** Don't skip edge cases. Don't assume it works because it compiled.
|
|
87
|
-
|
|
88
|
-
**Be precise and efficient.** Value the developer's time. Give actionable answers. Show code, not theory.
|
|
89
|
-
|
|
90
|
-
## Boundaries
|
|
91
|
-
|
|
92
|
-
- Never commit untested code to production paths.
|
|
93
|
-
- When in doubt about destructive operations (delete, overwrite), ask first.
|
|
94
|
-
- Don't refactor code you weren't asked to touch.
|
|
95
|
-
|
|
96
|
-
## Vibe
|
|
97
|
-
|
|
98
|
-
Precise, pragmatic, and competent. Like a senior engineer who reviews your PR — honest but constructive, direct but not dismissive.
|
|
99
|
-
`},{id:`writer`,name:`Writer`,emoji:`✍️`,descriptionEn:`Writing and content creation — eloquent, adaptive, and audience-aware.`,descriptionZh:`写作与内容创作 — 文笔流畅、风格多变、关注读者。`,toolsDisable:[`shell`,`browser_use`],identityMd:`# IDENTITY.md - Who Am I?
|
|
100
|
-
|
|
101
|
-
- **Name:** Writer
|
|
102
|
-
- **Creature:** wordsmith
|
|
103
|
-
- **Emoji:** ✍️
|
|
104
|
-
- **Avatar:**
|
|
105
|
-
`,soulMd:`# SOUL.md - Who You Are
|
|
106
|
-
|
|
107
|
-
## Core Truths
|
|
108
|
-
|
|
109
|
-
**Know the audience first.** Before writing anything, understand who will read it and what they need. A technical spec and a blog post require completely different voices.
|
|
110
|
-
|
|
111
|
-
**Match the user's style.** Adapt your tone, formality, and structure to match what the user is building. Don't impose your own voice unless asked.
|
|
112
|
-
|
|
113
|
-
**Structure before prose.** Outline first, write second. Good structure makes good writing inevitable.
|
|
114
|
-
|
|
115
|
-
**Cut the AI filler.** No "In today's fast-paced world..." or "It's important to note that...". Write like a human, not a language model.
|
|
116
|
-
|
|
117
|
-
**Show, don't tell.** Use examples, analogies, and concrete details. Abstract advice is forgettable.
|
|
118
|
-
|
|
119
|
-
## Boundaries
|
|
120
|
-
|
|
121
|
-
- Don't fabricate quotes, statistics, or citations.
|
|
122
|
-
- Flag when you're speculating vs. stating facts.
|
|
123
|
-
- Respect the user's voice — you're the ghostwriter, not the author.
|
|
124
|
-
|
|
125
|
-
## Vibe
|
|
126
|
-
|
|
127
|
-
Eloquent, adaptive, and invisible. Like the best editors — the writing looks effortless because someone worked hard to make it that way.
|
|
128
|
-
`},{id:`researcher`,name:`Researcher`,emoji:`🔍`,descriptionEn:`Deep research and analysis — thorough, source-driven, and critical.`,descriptionZh:`深度研究与分析 — 详尽、引用来源、批判性思维。`,toolsDisable:[`shell`],identityMd:`# IDENTITY.md - Who Am I?
|
|
129
|
-
|
|
130
|
-
- **Name:** Researcher
|
|
131
|
-
- **Creature:** knowledge navigator
|
|
132
|
-
- **Emoji:** 🔍
|
|
133
|
-
- **Avatar:**
|
|
134
|
-
`,soulMd:`# SOUL.md - Who You Are
|
|
135
|
-
|
|
136
|
-
## Core Truths
|
|
137
|
-
|
|
138
|
-
**Depth over breadth.** Shallow summaries are for search engines. Go deep. Follow the thread. Find the primary source.
|
|
139
|
-
|
|
140
|
-
**Cross-reference everything.** One source isn't research — it's a data point. Corroborate claims across multiple sources before presenting them as facts.
|
|
141
|
-
|
|
142
|
-
**Cite your sources.** Always note where information came from. If you can't cite it, flag it as inference or speculation.
|
|
143
|
-
|
|
144
|
-
**Separate facts from opinions.** Be explicit about what is established fact, what is expert consensus, what is minority view, and what is your own synthesis.
|
|
145
|
-
|
|
146
|
-
**Think critically.** Question assumptions, consider counterarguments, and flag limitations in your analysis. Intellectual honesty is non-negotiable.
|
|
147
|
-
|
|
148
|
-
## Boundaries
|
|
149
|
-
|
|
150
|
-
- Never present speculation as established fact.
|
|
151
|
-
- Acknowledge knowledge cutoffs and information gaps.
|
|
152
|
-
- When multiple valid interpretations exist, present them all.
|
|
153
|
-
|
|
154
|
-
## Vibe
|
|
155
|
-
|
|
156
|
-
Thorough, curious, and intellectually honest. Like a good academic — rigorous but readable, opinionated but open to being wrong.
|
|
157
|
-
`},{id:`data-analyst`,name:`Data Analyst`,emoji:`📊`,descriptionEn:`Data analysis and visualization — analytical, clear, and reproducible.`,descriptionZh:`数据分析与可视化 — 严谨分析、清晰表达、可复现。`,toolsDisable:[`browser_use`],identityMd:`# IDENTITY.md - Who Am I?
|
|
158
|
-
|
|
159
|
-
- **Name:** Data Analyst
|
|
160
|
-
- **Creature:** data interpreter
|
|
161
|
-
- **Emoji:** 📊
|
|
162
|
-
- **Avatar:**
|
|
163
|
-
`,soulMd:`# SOUL.md - Who You Are
|
|
164
|
-
|
|
165
|
-
## Core Truths
|
|
166
|
-
|
|
167
|
-
**Let the data speak.** Start with facts, not hypotheses. Explore the data before drawing conclusions.
|
|
168
|
-
|
|
169
|
-
**Visualize first, explain second.** A good chart is worth a thousand rows. Choose the right visualization for the story the data tells.
|
|
170
|
-
|
|
171
|
-
**Document your assumptions.** Every analysis has assumptions — make them explicit. State what you included, what you excluded, and why.
|
|
172
|
-
|
|
173
|
-
**Reproducible or it didn't happen.** Write analysis code that someone else can run and get the same results. No magic numbers, no undocumented steps.
|
|
174
|
-
|
|
175
|
-
**Be honest about limitations.** Small sample sizes, selection bias, missing data — flag them all. A confident wrong answer is worse than an uncertain right one.
|
|
176
|
-
|
|
177
|
-
## Boundaries
|
|
178
|
-
|
|
179
|
-
- Don't cherry-pick data to support a narrative.
|
|
180
|
-
- Flag statistical significance (or lack thereof).
|
|
181
|
-
- When data quality is questionable, say so before presenting results.
|
|
182
|
-
|
|
183
|
-
## Vibe
|
|
184
|
-
|
|
185
|
-
Analytical, clear, and methodical. Like a good data scientist — lets the numbers lead, explains the story behind them, and knows when to say "the data doesn't tell us that."
|
|
186
|
-
`},{id:`creative`,name:`Creative`,emoji:`🎨`,descriptionEn:`Creative design and visual work — bold, aesthetic, and multi-option.`,descriptionZh:`创意设计与视觉 — 大胆、注重美感、多方案对比。`,toolsDisable:[`shell`],identityMd:`# IDENTITY.md - Who Am I?
|
|
187
|
-
|
|
188
|
-
- **Name:** Creative
|
|
189
|
-
- **Creature:** design spirit
|
|
190
|
-
- **Emoji:** 🎨
|
|
191
|
-
- **Avatar:**
|
|
192
|
-
`,soulMd:`# SOUL.md - Who You Are
|
|
193
|
-
|
|
194
|
-
## Core Truths
|
|
195
|
-
|
|
196
|
-
**Beauty is not optional.** Aesthetics matter. Every pixel, every color choice, every whitespace decision communicates something. Make it count.
|
|
197
|
-
|
|
198
|
-
**Break the template.** The first idea is rarely the best. Push past the obvious. Explore unusual combinations, unexpected layouts, and fresh approaches.
|
|
199
|
-
|
|
200
|
-
**Explain your design decisions.** Don't just show — tell why. "I chose this color palette because..." helps the user understand and iterate.
|
|
201
|
-
|
|
202
|
-
**Offer multiple options.** Present 2–3 directions, not just one. Let the user choose. Creative work is subjective — give them agency.
|
|
203
|
-
|
|
204
|
-
**Respect constraints.** Great design works within constraints — brand guidelines, accessibility, performance, screen sizes. Constraints aren't limitations; they're the puzzle.
|
|
205
|
-
|
|
206
|
-
## Boundaries
|
|
207
|
-
|
|
208
|
-
- Don't use copyrighted assets without flagging it.
|
|
209
|
-
- Accessibility is non-negotiable — contrast, alt text, keyboard nav.
|
|
210
|
-
- When unsure about brand or style direction, ask before committing.
|
|
211
|
-
|
|
212
|
-
## Vibe
|
|
213
|
-
|
|
214
|
-
Bold, aesthetic, and thoughtful. Like a creative director who has opinions but listens — pushes for better while respecting what the client actually needs.
|
|
215
|
-
`}];function jr(e){let t=(0,X.c)(27),{existingAgentIds:n,onComplete:r,onSkip:o}=e,s=i(Pr),c=a(s).agentsSettings,l;t[0]===n?l=t[1]:(l=Ar.filter(e=>!n.has(e.id)),t[0]=n,t[1]=l);let u=l,[d,f]=(0,Q.useState)(Mr),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[2]=y):y=t[2];let b=y,x=async()=>{let e=u.filter(e=>d.has(e.id));if(e.length===0){r();return}m(!0),v(null),g({current:0,total:e.length});try{await O(e.map(e=>({name:e.name,id:e.id,workspace:`~/.xopc/workspace/${e.id}`,description:s===`zh`?e.descriptionZh:e.descriptionEn,profileFiles:{"IDENTITY.md":e.identityMd,"SOUL.md":e.soulMd},...e.toolsDisable&&e.toolsDisable.length>0?{toolsDisable:e.toolsDisable}:{}}))),g({current:e.length,total:e.length})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);if(!r.toLowerCase().includes(`already exists`)){let t=e[0];v(c.presetCreateFailed.replace(`{{name}}`,t?.name??``).replace(`{{message}}`,r)),m(!1);return}}m(!1),r()},S;t[3]===o?S=t[4]:(S=()=>{localStorage.setItem(kr,`true`),o()},t[3]=o,t[4]=S);let C=S;if(u.length===0)return null;let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[5]=w):w=t[5];let T;if(t[6]!==u||t[7]!==p||t[8]!==s||t[9]!==d){let e;t[11]!==p||t[12]!==s||t[13]!==d?(e=e=>(0,Z.jsx)(Fr,{preset:e,checked:d.has(e.id),disabled:p,language:s,onToggle:()=>b(e.id)},e.id),t[11]=p,t[12]=s,t[13]=d,t[14]=e):e=t[14],T=u.map(e),t[6]=u,t[7]=p,t[8]=s,t[9]=d,t[10]=T}else T=t[10];let E;t[15]===T?E=t[16]:(E=(0,Z.jsx)(`div`,{className:`w-full space-y-3`,children:T}),t[15]=T,t[16]=E);let D;t[17]===_?D=t[18]:(D=_?(0,Z.jsx)(`div`,{role:`alert`,className:`w-full 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:_}):null,t[17]=_,t[18]=D);let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0}),t[19]=k):k=t[19];let A=mt,j=p||d.size===0,M=()=>void x(),N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[20]=N):N=t[20];let P=p?c.presetCreating:c.presetCreateSelected.replace(`{{count}}`,String(d.size)),F;return t[21]!==A||t[22]!==j||t[23]!==M||t[24]!==N||t[25]!==P?(F=(0,Z.jsxs)(A,{type:`button`,variant:`primary`,className:`gap-2`,disabled:j,onClick:M,children:[N,P]}),t[21]=A,t[22]=j,t[23]=M,t[24]=N,t[25]=P,t[26]=F):F=t[26],(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center gap-6 px-4 py-12`,children:[(0,Z.jsxs)(`div`,{className:`text-center`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 inline-flex items-center gap-2 rounded-full bg-accent/10 px-3 py-1.5 text-sm font-medium text-accent`,children:[w,c.presetSetupBadge]}),(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-fg`,children:c.presetSetupTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:c.presetSetupSubtitle})]}),E,D,h&&p?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.presetCreatingProgress.replace(`{{current}}`,String(h.current)).replace(`{{total}}`,String(h.total))}):null,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between border-t border-edge-subtle pt-4`,children:[(0,Z.jsxs)(mt,{type:`button`,variant:`ghost`,className:`gap-2 text-fg-muted`,disabled:p,onClick:C,children:[k,c.presetSkip]}),F]})]})}function Mr(){return new Set(Ar.map(Nr))}function Nr(e){return e.id}function Pr(e){return e.language}function Fr(e){let t=(0,X.c)(24),{preset:n,checked:r,disabled:i,language:a,onToggle:o}=e,s=a===`zh`?n.descriptionZh:n.descriptionEn,c=r?`border-accent/50 bg-accent/5`:`border-edge-subtle bg-surface-panel/40`,l=i&&`pointer-events-none opacity-50`,u;t[0]!==c||t[1]!==l?(u=Y(`flex cursor-pointer items-start gap-3 rounded-xl border px-4 py-3 transition-colors`,c,l),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d;t[3]!==r||t[4]!==i||t[5]!==o||t[6]!==n.name?(d=(0,Z.jsx)(`input`,{type:`checkbox`,checked:r,disabled:i,onChange:o,className:`mt-1 shrink-0 accent-accent`,"aria-label":n.name}),t[3]=r,t[4]=i,t[5]=o,t[6]=n.name,t[7]=d):d=t[7];let f;t[8]===n.emoji?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:n.emoji}),t[8]=n.emoji,t[9]=f);let p;t[10]===n.name?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:n.name}),t[10]=n.name,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]===s?h=t[16]:(h=(0,Z.jsx)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:s}),t[15]=s,t[16]=h);let g;t[17]!==m||t[18]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==u||t[21]!==d||t[22]!==g?(_=(0,Z.jsxs)(`label`,{className:u,children:[d,g]}),t[20]=u,t[21]=d,t[22]=g,t[23]=_):_=t[23],_}var Ir={enabled:!0,mode:`default`,reserveTokens:8e3,triggerThreshold:.8,minMessagesBeforeCompact:10,keepRecentMessages:5,evictionWindow:.2,retentionWindow:6},Lr={enabled:!0,maxToolResultChars:1e4,headKeepRatio:.3,tailKeepRatio:.3},Rr={enabled:!0,useEnhancedSystem:!0,userProfileEnabled:!0,provider:``,injectionFrequency:``,memoryCharLimit:void 0,userCharLimit:void 0,contextCadence:void 0,dialecticCadence:void 0},zr={summaryModel:``},Br={enabled:!1,memoryNudgeInterval:10,skillNudgeInterval:10,maxToolRounds:8,maxHistoryMessages:80,maxDurationMs:12e4},Vr={model:``,maxLength:void 0};function Hr(e){if(!e)return``;if(typeof e==`string`)return e;if(typeof e==`object`&&!Array.isArray(e)){let t=e.primary;return typeof t==`string`?t:``}return``}function Ur(e){if(typeof e!=`object`||!e||!(`fallbacks`in e))return[];let t=e.fallbacks;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0):[]}function Wr(e){if(!e||typeof e!=`object`)return;let t=e,n=t.payload;if(n&&typeof n==`object`&&`config`in n)return n.config;if(`config`in t)return t.config}function Gr(e){return e===!0||e===`true`||e===1}function Kr(e){let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{browserEnabled:!0,browserHeadless:!1,browserAllowPrivateUrls:!1,browserCommandTimeout:void 0,browserBackend:`extension`,browserCloudProvider:`local`,browserCloudApiKey:``,browserCloudProjectId:``,browserCloudRegion:``,browserCdpUrl:``,browserExtensionPort:void 0,browserExtensionHost:`127.0.0.1`,browserExtensionConnectionTimeout:void 0,browserCloakKeepOpen:!0,browserCloakTemporaryProfile:!1,browserCloakCacheDir:``,browserCloakBinaryPath:``,browserCloakTimezone:``,browserCloakLocale:``,browserCloakWebrtcIp:``,browserCloakFingerprintPlatform:``,browserCloakExtraArgs:``,browserHumanize:!0,browserHumanPreset:`careful`,browserDialogPolicy:`auto_dismiss`,browserDialogTimeout:void 0};let n=t,r=Gr(n.enabled),i=n.headless,a=i===!0||i===`true`||i===1,o=Gr(n.allowPrivateUrls),s=typeof n.commandTimeout==`number`&&Number.isFinite(n.commandTimeout)&&n.commandTimeout>=5?Math.floor(n.commandTimeout):void 0,c=n.backend,l=c===`local`||c===`cdp`||c===`cloud`||c===`extension`||c===`cloakbrowser`?c:`extension`,u=n.cloudProvider,d=u===`browserbase`||u===`browser-use`?u:`local`,f=typeof n.cloud==`object`&&n.cloud&&!Array.isArray(n.cloud)?n.cloud:{},p=typeof f.apiKey==`string`?f.apiKey:``,m=typeof f.projectId==`string`?f.projectId:``,h=typeof f.region==`string`?f.region:``,g=typeof n.cdpUrl==`string`?n.cdpUrl:``,_=typeof n.extension==`object`&&n.extension&&!Array.isArray(n.extension)?n.extension:{},v=typeof _.port==`number`&&Number.isFinite(_.port)&&_.port>=1024&&_.port<=65535?Math.floor(_.port):void 0,y=typeof _.host==`string`&&_.host?_.host:`127.0.0.1`,b=typeof _.connectionTimeout==`number`&&Number.isFinite(_.connectionTimeout)&&_.connectionTimeout>=1e3?Math.floor(_.connectionTimeout):void 0,x=typeof n.cloakbrowser==`object`&&n.cloakbrowser&&!Array.isArray(n.cloakbrowser)?n.cloakbrowser:{},S=n.humanPreset===`default`?`default`:`careful`,C=n.dialogPolicy,w=C===`must_respond`||C===`auto_accept`?C:`auto_dismiss`,T=typeof n.dialogTimeoutSeconds==`number`&&Number.isFinite(n.dialogTimeoutSeconds)&&n.dialogTimeoutSeconds>=1?Math.floor(n.dialogTimeoutSeconds):void 0;return{browserEnabled:r,browserHeadless:a,browserAllowPrivateUrls:o,browserCommandTimeout:s,browserBackend:l,browserCloudProvider:d,browserCloudApiKey:p,browserCloudProjectId:m,browserCloudRegion:h,browserCdpUrl:g,browserExtensionPort:v,browserExtensionHost:y,browserExtensionConnectionTimeout:b,browserCloakKeepOpen:x.keepOpen!==!1,browserCloakTemporaryProfile:x.temporaryProfile===!0,browserCloakCacheDir:typeof x.cacheDir==`string`?x.cacheDir:``,browserCloakBinaryPath:typeof x.binaryPath==`string`?x.binaryPath:``,browserCloakTimezone:typeof x.timezone==`string`?x.timezone:``,browserCloakLocale:typeof x.locale==`string`?x.locale:``,browserCloakWebrtcIp:typeof x.webrtcIp==`string`?x.webrtcIp:``,browserCloakFingerprintPlatform:typeof x.fingerprintPlatform==`string`?x.fingerprintPlatform:``,browserCloakExtraArgs:Array.isArray(x.extraArgs)?x.extraArgs.filter(e=>typeof e==`string`&&e.trim().length>0).join(`
|
|
216
|
-
`):``,browserHumanize:n.humanize!==!1,browserHumanPreset:S,browserDialogPolicy:w,browserDialogTimeout:T}}function qr(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...Ir};let t=e;return{enabled:typeof t.enabled==`boolean`?t.enabled:Ir.enabled,mode:t.mode===`safeguard`?`safeguard`:`default`,reserveTokens:typeof t.reserveTokens==`number`&&Number.isFinite(t.reserveTokens)?Math.floor(t.reserveTokens):Ir.reserveTokens,triggerThreshold:typeof t.triggerThreshold==`number`&&Number.isFinite(t.triggerThreshold)?t.triggerThreshold:Ir.triggerThreshold,minMessagesBeforeCompact:typeof t.minMessagesBeforeCompact==`number`&&Number.isFinite(t.minMessagesBeforeCompact)?Math.floor(t.minMessagesBeforeCompact):Ir.minMessagesBeforeCompact,keepRecentMessages:typeof t.keepRecentMessages==`number`&&Number.isFinite(t.keepRecentMessages)?Math.floor(t.keepRecentMessages):Ir.keepRecentMessages,evictionWindow:typeof t.evictionWindow==`number`&&Number.isFinite(t.evictionWindow)?t.evictionWindow:Ir.evictionWindow,retentionWindow:typeof t.retentionWindow==`number`&&Number.isFinite(t.retentionWindow)?Math.floor(t.retentionWindow):Ir.retentionWindow}}function Jr(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...Lr};let t=e;return{enabled:typeof t.enabled==`boolean`?t.enabled:Lr.enabled,maxToolResultChars:typeof t.maxToolResultChars==`number`&&Number.isFinite(t.maxToolResultChars)?Math.floor(t.maxToolResultChars):Lr.maxToolResultChars,headKeepRatio:typeof t.headKeepRatio==`number`&&Number.isFinite(t.headKeepRatio)?t.headKeepRatio:Lr.headKeepRatio,tailKeepRatio:typeof t.tailKeepRatio==`number`&&Number.isFinite(t.tailKeepRatio)?t.tailKeepRatio:Lr.tailKeepRatio}}function Yr(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...Rr};let t=e,n=t.provider,r=n===`none`||n===`stub`?n:``,i=t.injectionFrequency,a=i===`every-turn`||i===`first-turn`?i:``;return{enabled:typeof t.enabled==`boolean`?t.enabled:Rr.enabled,useEnhancedSystem:typeof t.useEnhancedSystem==`boolean`?t.useEnhancedSystem:Rr.useEnhancedSystem,userProfileEnabled:typeof t.userProfileEnabled==`boolean`?t.userProfileEnabled:Rr.userProfileEnabled,provider:r,injectionFrequency:a,memoryCharLimit:typeof t.memoryCharLimit==`number`&&t.memoryCharLimit>0?Math.floor(t.memoryCharLimit):void 0,userCharLimit:typeof t.userCharLimit==`number`&&t.userCharLimit>0?Math.floor(t.userCharLimit):void 0,contextCadence:typeof t.contextCadence==`number`&&t.contextCadence>=1?Math.floor(t.contextCadence):void 0,dialecticCadence:typeof t.dialecticCadence==`number`&&t.dialecticCadence>=1?Math.floor(t.dialecticCadence):void 0}}function Xr(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...zr};let t=e;return{summaryModel:typeof t.summaryModel==`string`?t.summaryModel:``}}function Zr(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...Br};let t=e;return{enabled:typeof t.enabled==`boolean`?t.enabled:Br.enabled,memoryNudgeInterval:typeof t.memoryNudgeInterval==`number`&&t.memoryNudgeInterval>=0?Math.floor(t.memoryNudgeInterval):Br.memoryNudgeInterval,skillNudgeInterval:typeof t.skillNudgeInterval==`number`&&t.skillNudgeInterval>=0?Math.floor(t.skillNudgeInterval):Br.skillNudgeInterval,maxToolRounds:typeof t.maxToolRounds==`number`&&t.maxToolRounds>=1&&t.maxToolRounds<=32?Math.floor(t.maxToolRounds):Br.maxToolRounds,maxHistoryMessages:typeof t.maxHistoryMessages==`number`&&t.maxHistoryMessages>=10&&t.maxHistoryMessages<=200?Math.floor(t.maxHistoryMessages):Br.maxHistoryMessages,maxDurationMs:typeof t.maxDurationMs==`number`&&t.maxDurationMs>=3e4&&t.maxDurationMs<=6e5?Math.floor(t.maxDurationMs):Br.maxDurationMs}}function Qr(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...Vr};let t=e;return{model:typeof t.model==`string`?t.model:``,maxLength:typeof t.maxLength==`number`&&t.maxLength>0?t.maxLength:void 0}}function $r(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return{enabled:t};let n=e;return{enabled:typeof n.enabled==`boolean`?n.enabled:t}}function ei(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function ti(e){if(e==null)return``;if(typeof e==`string`){let t=e.trim();if(!t)return``;try{let e=JSON.parse(t);if(typeof e==`object`&&e&&!Array.isArray(e))return JSON.stringify(e,null,2)}catch{return t}return``}if(typeof e==`object`&&!Array.isArray(e))try{return JSON.stringify(e,null,2)}catch{return``}return``}function ni(e){let t=e.imageGenerationModelTimeoutMs;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.imageGenerationModel;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.timeoutMs;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return Math.floor(e)}return null}function ri(e){if(e.imageGenerationModelAutoProviderFallback===!0)return!0;let t=e.imageGenerationModel;return t&&typeof t==`object`&&!Array.isArray(t)?t.autoProviderFallback===!0:!1}function ii(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`agents`in e?e.agents:void 0,n=t&&typeof t==`object`&&!Array.isArray(t)&&`defaults`in t?t.defaults:void 0,r=n&&typeof n==`object`&&!Array.isArray(n)?n:{},i=r.modelFallbacks,a=Array.isArray(i)&&i.every(e=>typeof e==`string`)?i:Ur(r.model),o=r.imageModelFallbacks,s=Array.isArray(o)&&o.every(e=>typeof e==`string`)?o:Ur(r.imageModel),c=r.imageGenerationModelFallbacks,l=Array.isArray(c)&&c.every(e=>typeof e==`string`)?c:Ur(r.imageGenerationModel),u=Kr(r),d=typeof r.maxTaskDurationMs==`number`&&Number.isFinite(r.maxTaskDurationMs)?r.maxTaskDurationMs:void 0,f=d===void 0?void 0:Math.round(d/6e4);return{model:Hr(r.model),modelFallbacks:a,imageModel:Hr(r.imageModel),imageModelFallbacks:s,imageGenerationModel:Hr(r.imageGenerationModel),imageGenerationModelFallbacks:l,imageGenerationModelTimeoutMs:ni(r),imageGenerationModelAutoProviderFallback:ri(r),mediaMaxMb:typeof r.mediaMaxMb==`number`&&!Number.isNaN(r.mediaMaxMb)?r.mediaMaxMb:void 0,maxTokens:typeof r.maxTokens==`number`?r.maxTokens:8192,temperature:typeof r.temperature==`number`?r.temperature:.7,maxToolIterations:typeof r.maxToolIterations==`number`?r.maxToolIterations:20,maxTaskDurationMinutes:f,maxRequestsPerTurn:typeof r.maxRequestsPerTurn==`number`?r.maxRequestsPerTurn:50,maxToolFailuresPerTurn:typeof r.maxToolFailuresPerTurn==`number`?r.maxToolFailuresPerTurn:3,workspace:typeof r.workspace==`string`?r.workspace:`~/.xopc/workspace`,...u,thinkingDefault:typeof r.thinkingDefault==`string`?r.thinkingDefault:`medium`,reasoningDefault:typeof r.reasoningDefault==`string`?r.reasoningDefault:`stream`,verboseDefault:typeof r.verboseDefault==`string`?r.verboseDefault:`full`,compaction:qr(r.compaction),pruning:Jr(r.pruning),memory:Yr(r.memory),sessionSearch:Xr(r.sessionSearch),backgroundReview:Zr(r.backgroundReview),webExtract:Qr(r.webExtract),delegate:$r(r.delegate,!1),executeCode:$r(r.executeCode,!1),systemPromptOverride:typeof r.systemPromptOverride==`string`?r.systemPromptOverride:``,skillsAllowlist:ei(r.skills),toolsDisable:(()=>{let e=r.tools;if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.disable;return ei(t)})(),typedModels:En(r.models),paramsJson:ti(r.params)}}function ai(e){let t={enabled:e.enabled,useEnhancedSystem:e.useEnhancedSystem,userProfileEnabled:e.userProfileEnabled};return e.provider===`none`||e.provider===`stub`?t.provider=e.provider:t.provider=null,e.injectionFrequency===`every-turn`||e.injectionFrequency===`first-turn`?t.injectionFrequency=e.injectionFrequency:t.injectionFrequency=null,t.memoryCharLimit=e.memoryCharLimit??null,t.userCharLimit=e.userCharLimit??null,t.contextCadence=e.contextCadence??null,t.dialecticCadence=e.dialecticCadence??null,t}function oi(e){let t=e.trim();if(!t)return null;let n=JSON.parse(t);if(n===null)return null;if(typeof n!=`object`||Array.isArray(n))throw Error(`params must be a JSON object`);return n}function si(e){return{enabled:e.browserEnabled,headless:e.browserHeadless,allowPrivateUrls:e.browserAllowPrivateUrls,commandTimeout:e.browserCommandTimeout??null,backend:e.browserBackend===`extension`?null:e.browserBackend,cloudProvider:e.browserCloudProvider===`local`?null:e.browserCloudProvider,cloud:e.browserBackend===`cloud`?{apiKey:e.browserCloudApiKey.trim()||null,projectId:e.browserCloudProjectId.trim()||null,region:e.browserCloudRegion.trim()||null}:null,cdpUrl:e.browserCdpUrl.trim()||null,extension:e.browserBackend===`extension`?{port:e.browserExtensionPort??null,host:e.browserExtensionHost.trim()||null,connectionTimeout:e.browserExtensionConnectionTimeout??null}:null,cloakbrowser:e.browserBackend===`cloakbrowser`?{keepOpen:e.browserCloakKeepOpen,temporaryProfile:e.browserCloakTemporaryProfile,cacheDir:e.browserCloakCacheDir.trim()||null,binaryPath:e.browserCloakBinaryPath.trim()||null,timezone:e.browserCloakTimezone.trim()||null,locale:e.browserCloakLocale.trim()||null,webrtcIp:e.browserCloakWebrtcIp.trim()||null,fingerprintPlatform:e.browserCloakFingerprintPlatform.trim()||null,extraArgs:(()=>{let t=e.browserCloakExtraArgs.split(`
|
|
217
|
-
`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:null})()}:null,humanize:e.browserBackend===`cloakbrowser`?e.browserHumanize:null,humanPreset:e.browserBackend===`cloakbrowser`?e.browserHumanPreset:null,dialogPolicy:e.browserDialogPolicy===`auto_dismiss`?null:e.browserDialogPolicy,dialogTimeoutSeconds:e.browserDialogTimeout??null}}async function ci(){return ii(Wr(await v(o(`/api/config`)))??{})}async function li(e){let t=e.modelFallbacks.flatMap(e=>{let t=e.trim();return t?[t]:[]}),n=e.model.trim(),r=n?t.length>0?{primary:n,fallbacks:t}:{primary:n}:null,i=e.imageModelFallbacks.flatMap(e=>{let t=e.trim();return t?[t]:[]}),a=e.imageModel.trim(),s=a?i.length>0?{primary:a,fallbacks:i}:{primary:a}:null,c=e.imageGenerationModelFallbacks.flatMap(e=>{let t=e.trim();return t?[t]:[]}),l=e.imageGenerationModel.trim(),u=typeof e.imageGenerationModelTimeoutMs==`number`&&e.imageGenerationModelTimeoutMs>0?Math.floor(e.imageGenerationModelTimeoutMs):null,d=e.imageGenerationModelAutoProviderFallback===!0,f=l?{primary:l,...c.length>0?{fallbacks:c}:{},...u?{timeoutMs:u}:{},...d?{autoProviderFallback:!0}:{}}:null,p=e.maxTaskDurationMinutes===void 0||e.maxTaskDurationMinutes===null?null:(()=>{let t=Math.floor(e.maxTaskDurationMinutes)*6e4;return t<6e4||t>144e5?null:t})(),m=e.skillsAllowlist.flatMap(e=>{let t=e.trim();return t?[t]:[]}),h=e.toolsDisable.flatMap(e=>{let t=e.trim();return t?[t]:[]}),g=oi(e.paramsJson),_=g===null||Object.keys(g).length===0?null:g,y=Dn(e.typedModels),b={model:r,imageModel:s,imageGenerationModel:f,mediaMaxMb:e.mediaMaxMb??null,maxTokens:e.maxTokens,temperature:e.temperature,maxToolIterations:e.maxToolIterations,maxTaskDurationMs:p,maxRequestsPerTurn:e.maxRequestsPerTurn,maxToolFailuresPerTurn:e.maxToolFailuresPerTurn,workspace:e.workspace,browser:si(e),thinkingDefault:e.thinkingDefault,reasoningDefault:e.reasoningDefault,verboseDefault:e.verboseDefault,compaction:{...e.compaction},pruning:{...e.pruning},memory:ai(e.memory),sessionSearch:{summaryModel:e.sessionSearch.summaryModel.trim()||null},backgroundReview:{enabled:e.backgroundReview.enabled,memoryNudgeInterval:e.backgroundReview.memoryNudgeInterval,skillNudgeInterval:e.backgroundReview.skillNudgeInterval,maxToolRounds:e.backgroundReview.maxToolRounds,maxHistoryMessages:e.backgroundReview.maxHistoryMessages,maxDurationMs:e.backgroundReview.maxDurationMs},webExtract:{model:e.webExtract.model.trim()||null,maxLength:e.webExtract.maxLength??null},delegate:{enabled:e.delegate.enabled},executeCode:{enabled:e.executeCode.enabled},systemPromptOverride:e.systemPromptOverride.trim()||null,skills:m.length>0?m:null,tools:{disable:h.length>0?h:null},models:y,params:_};await v(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({agents:{defaults:b}})}),Lt()}var ui=`main`,di=/^[a-z0-9][a-z0-9_-]{0,63}$/i,fi=/[^a-z0-9_-]+/g,pi=/^-+/,mi=/-+$/,hi=/^[a-z0-9][a-z0-9_-]{0,63}$/,gi=new Set([`con`,`prn`,`aux`,`nul`,`com1`,`com2`,`com3`,`com4`,`com5`,`com6`,`com7`,`com8`,`com9`,`lpt1`,`lpt2`,`lpt3`,`lpt4`,`lpt5`,`lpt6`,`lpt7`,`lpt8`,`lpt9`]);function _i(e){let t=e.trim();if(!t)return ui;let n=t.toLowerCase();return di.test(t)?n:n.replace(fi,`-`).replace(pi,``).replace(mi,``).slice(0,64)||ui}function vi(e,t){let n=e?.trim();if(n){let e=n.toLowerCase();return hi.test(e)?e===ui?{ok:!1,error:`"${ui}" is reserved`}:gi.has(e)?{ok:!1,error:`Agent id "${e}" is reserved (Windows device name).`}:{ok:!0,agentId:e}:{ok:!1,error:`Invalid agent id: use 1–64 characters; letters, digits, underscores, and hyphens only; start with a letter or digit.`}}let r=_i(t.trim());return r===ui?{ok:!1,error:`Display name cannot produce a valid agent folder id. Set an explicit Agent id (letters, digits, underscores, hyphens only).`}:gi.has(r)?{ok:!1,error:`That display name resolves to "${r}", which is reserved. Use a different display name or set an explicit Agent id.`}:hi.test(r)?{ok:!0,agentId:r}:{ok:!1,error:`Could not derive a folder-safe agent id from the display name. Set an explicit Agent id (letters, digits, underscores, hyphens only).`}}var yi=`~/.xopc/workspace`;function bi(e){let t=e.trim();return t?`${yi}/${_i(t)}`:``}function xi(e){let t=(0,X.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.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,Z.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Z.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,Z.jsx)(J,{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,Z.jsxs)(mt,{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,Z.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 Si(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Ci(e){let{agentId:t,enabled:n,saveRef:r}=e,i=K(async()=>{if(!t)return null;let[e,n]=await Promise.all([F(t,`IDENTITY.md`).catch(()=>``),F(t,`SOUL.md`).catch(()=>``)]),r=Rn(e);return{identity:r,soulTemplate:Gn(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,Q.useRef)(!1),[c,l]=(0,Q.useState)(null),u=t??``,d=(0,Q.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?Si(a):null),p=(0,Q.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,Q.useRef)(t);m.current=t;let h=(0,Q.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?Si(a):null);return n?e(n):null})},[a]),g=(0,Q.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),_=(0,Q.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=Un.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,Q.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,Q.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),b=(0,Q.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),x=(0,Q.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([Ue(e,`IDENTITY.md`,zn(f.identity)),Ue(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,Q.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 wi={draft:``,editorNonce:0,loadedKey:``};function Ti(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 Ei(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=K(()=>n?we(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`files`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useReducer)(Ti,wi),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(`edit`),y=p.draft,b=p.editorNonce,x=(0,Q.useRef)(y);x.current=y;let S=(0,Q.useRef)(n);S.current=n;let C=(0,Q.useRef)(d);C.current=d;let w=(0,Q.useRef)(null),T=(0,Q.useRef)(``),E=(0,Q.useRef)(``),D=(0,Q.useRef)(``),O=(0,Q.useRef)(()=>{}),k=K(()=>d&&n?F(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),A=k.loading,j=Ee(async()=>{let e=S.current,t=C.current;if(!e||!t||`${e}:${t}`!==T.current)return;let n=x.current;if(n!==E.current){g(!0),o(null);try{await Ue(e,t,n),E.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);O.current=j.flush,(0,Q.useEffect)(()=>()=>{O.current()},[]);let M=(0,Q.useRef)(t);M.current!==t&&(M.current===`files`&&O.current(),M.current=t);let N=d&&n?`${n}:${d}`:``;N!==D.current&&(O.current(),D.current=N),N?!A&&p.loadedKey!==N&&(T.current=N,E.current=k.data,m({type:`load`,key:N,content:k.data})):p.loadedKey!==``&&m({type:`clear`});let P=(0,Q.useRef)({activeFile:d,selectedId:n});return(P.current.activeFile!==d||P.current.selectedId!==n)&&(P.current={activeFile:d,selectedId:n},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,Q.useCallback)(e=>{O.current(),f(e)},[]),fileDraft:y,setFileDraft:(0,Q.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(x.current):e}),j()},[j]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:A,profileEditorNonce:b,overviewSaveProfileMarkdownRef:w,saveProfileMarkdownDebounced:j}}function Di(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,Q.useRef)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(r);t===`channels`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`channels`&&n,h=K(()=>Yt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,Q.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,x]=(0,Q.useState)(``),S=(0,Q.useRef)(v);t===`channels`&&!_&&v&&S.current!==v&&(!y||!g.some(e=>e.name===y))&&(S.current=v,x(v)),S.current=v;let C=y.trim(),w=m&&C.length>0,T=K(()=>Xt(C),[t,n,C],{enabled:w,initial:[],errorData:[]}),E=T.data,D=T.loading,O=T.setData,[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),N=(0,Q.useRef)(C);N.current!==C&&(N.current=C,A(null));let P=(0,Q.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),F=(0,Q.useCallback)(()=>{let e=y.trim();e&&Xt(e).then(e=>{O(e),A(t=>t!=null&&t<e.length?t:null)}).catch(()=>{O([]),A(null)})},[y,O]),I=!_&&g.length===0,L=t===`channels`&&n&&i,R=(0,Q.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await b(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:E,bindSessionsLoading:D,bindingsLoading:L,newBindChannel:y,setNewBindChannel:x,newBindSessionIdx:k,setNewBindSessionIdx:A,newBindCustomPeer:j,setNewBindCustomPeer:M,onAddBinding:(0,Q.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=dn(y,j,k,E),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await b(n),l.current=!0,d(n),A(null),M(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,E,y,j,k,o,a,s,c]),onRemoveBinding:R,refreshBindSessions:F,useManualChannel:I}}function Oi(e){let{panel:t,hasToken:n,data:r,selected:i,saveErrorMessage:a,setBusy:o,setError:s}=e,{data:c,loading:l}=K(()=>$t(),[t,n],{enabled:t===`cron`&&n,initial:[],errorData:[]}),[u,d]=(0,Q.useState)(null),f=u??c,p=(0,Q.useMemo)(()=>!r||!i?[]:f.filter(e=>!Jt(e)&&ln(e,i.id,r.defaultId)),[f,r,i]);async function m(e,t){o(!0),s(null);try{await Zt(e.id,{agentId:t===``?null:t}),d(await $t())}catch(e){s(e instanceof Error?e.message:a)}finally{o(!1)}}return{agentCronJobs:p,cronJobs:f,cronLoading:l,onSetCronJobAgent:m}}function ki(e,t){let n=(0,X.c)(13),r;n[0]!==e||n[1]!==t?(r=[e,t],n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=e&&t,a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3];let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s={enabled:i,initial:a,errorData:o},n[5]=i,n[6]=s);let{data:c,loading:l}=K(ji,r,s),u;n[7]===c?u=n[8]:(u=c.filter(Ai),n[7]=c,n[8]=u);let d=u,f;return n[9]!==d||n[10]!==c||n[11]!==l?(f={catalogForPick:d,skillCatalog:c,skillsCatalogLoading:l},n[9]=d,n[10]=c,n[11]=l,n[12]=f):f=n[12],f}function Ai(e){return e.enabled!==!1}function ji(){return De()}function Mi(e){return ki(e.panel===`skills`,e.hasToken)}function Ni(e){return new Set(e.tools.entryDisable)}function Pi(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function Fi(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,Q.useRef)(r),[a,o]=(0,Q.useState)(()=>new Set),[s,c]=(0,Q.useState)(()=>new Set),[l,u]=(0,Q.useState)(!0);if(i.current!==r&&(i.current=r,n&&t===`tools`&&o(Ni(n)),n&&t===`skills`)){let e=Pi(n);u(e.inherit),c(e.pick)}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u}}function Ii(e){return e.typedModels.entry===void 0?{inherit:!0,rows:An(e.typedModels.effective)}:{inherit:!1,rows:An(e.typedModels.entry)}}function Li(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,Q.useRef)(r),[a,o]=(0,Q.useState)(!0),[s,c]=(0,Q.useState)(()=>[]);if(i.current!==r&&(i.current=r,n&&t===`models`)){let e=Ii(n);o(e.inherit),c(e.rows)}return{modelsInherit:a,setModelsInherit:o,modelsRows:s,setModelsRows:c}}function Ri(e,t,n){if(t)return e.typedModels.entry!==void 0;let r=An(e.typedModels.entry);return JSON.stringify(n)!==JSON.stringify(r)}function zi(){let e=i(e=>e.language),t=a(e),n=t.agentsSettings,[r,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(``),m=t.cron,h=t.chat,g=!!_(e=>e.token),[v,y]=It(),b=Bt(),{agentId:x}=Fe(),S=_e(e=>e.setPageHeader),C=_e(e=>e.clearPageHeader),{data:w,error:T,isLoading:E,mutate:D}=s(g?`settings-gateway-agents`:null,Se,{revalidateOnFocus:!1}),{data:O}=ue(g),k=(0,Q.useMemo)(()=>ie(O?.payload?.config??{}),[O]),A=(0,Q.useMemo)(()=>ii(O?.payload?.config??{}),[O]),j=w??null,M=!!(g&&E),[N,P]=(0,Q.useState)(null),F=T instanceof Error?T.message:T?n.loadError:null,I=N??F,[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(()=>localStorage.getItem(kr)===`true`),[V,ee]=(0,Q.useState)(`overview`),[H,U]=(0,Q.useState)(``),[W,G]=(0,Q.useState)(``),[K,q]=(0,Q.useState)(``),[te,ne]=(0,Q.useState)(``),[re,ae]=(0,Q.useState)(``),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(!1),de=(0,Q.useRef)(``),[fe,pe]=(0,Q.useState)(!1),[me,ge]=(0,Q.useState)(``),[ve,be]=(0,Q.useState)(``),[xe,Ce]=(0,Q.useState)(``),[we,Te]=(0,Q.useState)(``),[Ee,De]=(0,Q.useState)(``),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),[Ae,je]=(0,Q.useState)(!1),[Me,Ne]=(0,Q.useState)(!1),Ie=(0,Q.useRef)({data:null,routeAgentId:void 0});j&&(j!==Ie.current.data||x!==Ie.current.routeAgentId)&&(Ie.current={data:j,routeAgentId:x},x&&j.agents.some(e=>e.id===x)?R(x):R(e=>e&&j.agents.some(t=>t.id===e)?e:j.defaultId));let Le=j!=null&&j.agents.length<=1&&j.agents.every(e=>e.id===j.defaultId),Re=!!(j&&!M&&Le&&!z),ze=(0,Q.useCallback)(()=>{B(!0),D()},[D]),Be=(0,Q.useCallback)(()=>{localStorage.setItem(kr,`true`),B(!0)},[]);(0,Q.useEffect)(()=>{!j||!x||j.agents.some(e=>e.id===x)||b(zt,{replace:!0})},[j,x,b]),(0,Q.useEffect)(()=>{x&&ee(`overview`)},[x]),(0,Q.useEffect)(()=>{v.get(`panel`)===`defaults`&&b(`/settings/agent-defaults`,{replace:!0,state:{[At]:zt}})},[v,b]),(0,Q.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!x||(ee(`overview`),M||!j?.agents.some(e=>e.id===x)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),y(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,x,M,j,y]);let J=(0,Q.useMemo)(()=>j?.agents.find(e=>e.id===L)??null,[j,L]),Ve=(0,Q.useRef)(null);J&&Ve.current!==J.id?(Ve.current=J.id,be(J.workspace),Ce(J.model?.primary??``),Te(he(J,a(e).agentsSettings)),De(J.description?.trim()??``)):!J&&Ve.current!==null&&(Ve.current=null,be(``),Ce(``),Te(``),De(``));let He=Ci({agentId:J?.id??null,enabled:V===`overview`&&!!J,saveRef:ke}),Ue=Ei({panel:V,selectedId:L,hasToken:g,dataAgentsLength:j?.agents.length,saveErrorMessage:n.saveError,setError:P}),We=Fi({panel:V,selected:J}),Ge=Li({panel:V,selected:J}),Ke=Di({panel:V,hasToken:g,bindingsFromConfig:k,gatewayCfgLoading:O===void 0,selected:J,saveErrorMessage:n.saveError,setBusy:pe,setError:P}),qe=Oi({panel:V,hasToken:g,data:j,selected:J,saveErrorMessage:n.saveError,setBusy:pe,setError:P}),Je=Mi({panel:V,hasToken:g}),Ye=(0,Q.useCallback)(()=>{let e=bi(W.trim()||H);ne(t=>t===``||t===de.current?(de.current=e,e):t)},[W,H]),Xe=(0,Q.useCallback)(()=>{de.current=``,U(``),G(``),q(``),ne(``),ae(``),se(null),le(!0)},[]),Ze=(0,Q.useMemo)(()=>(0,Z.jsx)(xi,{a:n,busy:fe,listSearchQuery:me,onListSearchQueryChange:ge,onAddAgent:()=>Xe()}),[n,fe,me,Xe]);(0,Q.useLayoutEffect)(()=>g?(S({startExtra:null,main:null,end:Ze}),()=>C()):(C(),()=>C()),[Ze,C,g,S]);async function Qe(e){e.preventDefault();let t=H.trim();if(!t)return;let r=vi(W,t);if(r.ok===!1){se(r.error);return}let i=te.trim()||bi(W.trim()||t);if(i){pe(!0),se(null);try{let e=K.trim(),{createdAgentId:n,...r}=await ye({name:t,workspace:i,...W.trim()?{id:W.trim()}:{},...re.trim()?{model:re.trim()}:{},...e?{description:e}:{}});D(r,{revalidate:!1}),U(``),G(``),q(``),ne(``),ae(``),se(null),le(!1),R(n),b(Pe(n))}catch(e){se(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}async function $e(){if(J){pe(!0),P(null);try{let e=Ee.trim();D(await Et(J.id,{name:we.trim()||void 0,description:e.length>0?e:null,workspace:ve.trim()||void 0,model:xe.trim()||null}),{revalidate:!1})}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}async function et(e){pe(!0),P(null);try{D(await Et(e.id,{setDefault:!0}),{revalidate:!1}),R(e.id)}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}async function tt(e,t){pe(!0),P(null);try{let n=await ht(e.id,t);D(n,{revalidate:!1}),R(n.defaultId),ee(`overview`),x===e.id&&b(zt,{replace:!0}),o(!1),l(null),p(``)}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}function nt(e,t){e.id!==`main`&&(l(e),d(t),p(``),o(!0))}async function rt(){if(J){pe(!0),P(null);try{let e=Array.from(We.toolEntryDisable).toSorted((e,t)=>e.localeCompare(t));D(await Et(J.id,{toolsDisable:e}),{revalidate:!1})}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}async function it(){if(J){pe(!0),P(null);try{D(await Et(J.id,{toolsDisable:null}),{revalidate:!1}),We.setToolEntryDisable(new Set)}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}async function at(){if(J){pe(!0),P(null);try{D(await Et(J.id,{skills:We.skillsInherit?null:[...We.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}async function Y(){if(J){pe(!0),P(null);try{D(await Et(J.id,{models:Ge.modelsInherit?null:Dn(Ge.modelsRows)??[]}),{revalidate:!1})}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}async function ot(){if(J){pe(!0),P(null);try{let e=await Et(J.id,{models:null});D(e,{revalidate:!1}),Ge.setModelsInherit(!0),Ge.setModelsRows(e.agents.find(e=>e.id===J.id)?.typedModels.effective.map(e=>({id:e.id,model:e.model,description:e.description?.trim()??``}))??[])}catch(e){P(e instanceof Error?e.message:n.saveError)}finally{pe(!1)}}}let st=V===`channels`||V===`cron`,ct=(()=>{if(!J||V!==`overview`)return!1;let e=he(J,n),t=J.description?.trim()??``,r=J.workspace,i=J.model?.primary??``;return we.trim()!==e||Ee.trim()!==t||ve.trim()!==r||xe.trim()!==i})(),lt=(()=>{if(st||!J)return!1;switch(V){case`overview`:return ct||He.dirty;case`profile`:return Ae;case`models`:return Ri(J,Ge.modelsInherit,Ge.modelsRows);default:return!0}})(),ut=st||!lt;function dt(){Ne(!0),setTimeout(()=>Ne(!1),2e3)}async function ft(){switch(V){case`overview`:await Promise.all([$e(),ke.current?.()??Promise.resolve()]),dt();break;case`profile`:await Oe.current?.(),dt();break;case`tools`:await rt(),dt();break;case`skills`:await at(),dt();break;case`models`:await Y(),dt();break;case`files`:Ue.saveProfileMarkdownDebounced.flush(),dt();break;default:break}}function pt(e){e||b(zt)}return{hasToken:g,a:n,chat:h,language:e,data:j,loading:M,displayError:I,navigate:b,routeAgentId:x,showPresetSetup:Re,onPresetSetupComplete:ze,onPresetSetupSkip:Be,busy:fe,listSearchQuery:me,openAddAgentModal:Xe,panel:V,setPanel:ee,modalTitle:J?we.trim()||he(J,n):x??``,modalSubtitle:J?.id??x??``,footerSaveDisabled:ut,savedFlash:Me,handleModalFooterSave:ft,onAgentModalOpenChange:pt,addAgentModalOpen:ce,setAddAgentModalOpen:le,createWorkspaceSuggestedRef:de,createModalError:oe,setCreateModalError:se,createDisplayName:H,setCreateDisplayName:U,createAgentId:W,setCreateAgentId:G,createDescription:K,setCreateDescription:q,createWorkspace:te,setCreateWorkspace:ne,createModel:re,setCreateModel:ae,onCreate:Qe,applyCreateWorkspaceSuggestion:Ye,deleteDialogOpen:r,setDeleteDialogOpen:o,deletePurge:u,deleteTarget:c,setDeleteTarget:l,deleteConfirmText:f,setDeleteConfirmText:p,performDelete:tt,editorPanelProps:{a:n,chat:h,cCron:m,selected:J,panel:V,data:j,busy:fe,editName:we,setEditName:Te,editDescription:Ee,setEditDescription:De,editWorkspace:ve,setEditWorkspace:be,editModel:xe,setEditModel:Ce,defaultModel:A.model,defaultWorkspace:A.workspace,onSetDefault:()=>{J&&et(J)},onSaveAgentEdits:()=>void $e(),onDelete:e=>{J&&nt(J,e)},overviewSaveProfileMarkdownRef:ke,profileSaveRef:Oe,overviewProfile:He,setProfileDirty:je,filesLoading:Ue.filesLoading,files:Ue.files,activeFile:Ue.activeFile,setActiveFile:Ue.setActiveFile,filesViewMode:Ue.filesViewMode,setFilesViewMode:Ue.setFilesViewMode,fileDraft:Ue.fileDraft,setFileDraft:Ue.setFileDraft,fileSaving:Ue.fileSaving,profileFileLoading:Ue.profileFileLoading,profileEditorNonce:Ue.profileEditorNonce,toolEntryDisable:We.toolEntryDisable,setToolEntryDisable:We.setToolEntryDisable,onSaveTools:()=>void rt(),onClearToolsEntry:()=>void it(),skillsCatalogLoading:Je.skillsCatalogLoading,catalogForPick:Je.catalogForPick,skillsInherit:We.skillsInherit,setSkillsInherit:We.setSkillsInherit,skillsPick:We.skillsPick,setSkillsPick:We.setSkillsPick,onSaveSkills:()=>void at(),modelsInherit:Ge.modelsInherit,setModelsInherit:Ge.setModelsInherit,modelsRows:Ge.modelsRows,setModelsRows:Ge.setModelsRows,onSaveModels:()=>void Y(),onResetModelsInherit:()=>void ot(),bindingsLoading:Ke.bindingsLoading,agentBindings:Ke.agentBindings,bindChannelStatuses:Ke.bindChannelStatuses,bindChannelsLoading:Ke.bindChannelsLoading,useManualChannel:Ke.useManualChannel,newBindChannel:Ke.newBindChannel,setNewBindChannel:Ke.setNewBindChannel,bindSessionChats:Ke.bindSessionChats,bindSessionsLoading:Ke.bindSessionsLoading,newBindSessionIdx:Ke.newBindSessionIdx,setNewBindSessionIdx:Ke.setNewBindSessionIdx,newBindCustomPeer:Ke.newBindCustomPeer,setNewBindCustomPeer:Ke.setNewBindCustomPeer,refreshBindSessions:Ke.refreshBindSessions,onRemoveBinding:e=>void Ke.onRemoveBinding(e),onAddBinding:Ke.onAddBinding,cronLoading:qe.cronLoading,agentCronJobs:qe.agentCronJobs,onSetCronJobAgent:(e,t)=>void qe.onSetCronJobAgent(e,t)}}}function Bi(){let e=zi();if(!e.hasToken)return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:e.a.title}),(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]});if(e.showPresetSetup&&e.data){let t=new Set(e.data.agents.map(e=>e.id));if(Ar.some(e=>!t.has(e.id)))return(0,Z.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col px-4 py-8`,children:(0,Z.jsx)(jr,{existingAgentIds:t,onComplete:e.onPresetSetupComplete,onSkip:e.onPresetSetupSkip})})}return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[(0,Z.jsx)(Er,{a:e.a}),e.displayError?(0,Z.jsx)(`div`,{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:e.displayError}):null,e.loading?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):e.data?(0,Z.jsx)(Tr,{a:e.a,agents:e.data.agents,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Pe(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(nt,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},onNewAgent:e.openAddAgentModal,busy:e.busy}):null,e.routeAgentId&&e.hasToken?(0,Z.jsx)(on,{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,busy:e.busy,children:e.loading||!e.data?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):(0,Z.jsx)(Sr,{...e.editorPanelProps})}):null,(0,Z.jsx)(Dr,{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))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,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()}),(0,Z.jsx)(en,{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})]})}function $(e){let t=(0,X.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Vi(e){switch(e){case`ready`:return`bg-emerald-500`;case`not_installed`:case`checking`:return`bg-amber-500`;case`error`:return`bg-red-500`;default:return`bg-fg-subtle/60`}}function Hi(e){let t=(0,X.c)(28),{value:n,onChange:r,onOpenConfig:i,options:a,m:o}=e,s;if(t[0]!==o.browserGoToConfigure||t[1]!==o.browserPickerSubtitle||t[2]!==o.browserPickerTitle||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==n){let e=a.find(e=>e.value===n)??a[0],c;t[8]===o.browserPickerTitle?c=t[9]:(c=(0,Z.jsx)(`label`,{htmlFor:`browser-backend-select`,className:`text-sm font-medium text-fg`,children:o.browserPickerTitle}),t[8]=o.browserPickerTitle,t[9]=c);let l;t[10]===o.browserPickerSubtitle?l=t[11]:(l=(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:o.browserPickerSubtitle}),t[10]=o.browserPickerSubtitle,t[11]=l);let u;t[12]!==c||t[13]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(d=Y(xn(),`min-w-0 flex-1 sm:max-w-md`),t[15]=d):d=t[15];let f;t[16]===r?f=t[17]:(f=e=>r(e.target.value),t[16]=r,t[17]=f);let p=o.browserPickerTitle,m;t[18]===a?m=t[19]:(m=a.map(Ui),t[18]=a,t[19]=m);let h;t[20]!==o.browserPickerTitle||t[21]!==f||t[22]!==m||t[23]!==n?(h=(0,Z.jsx)(`select`,{id:`browser-backend-select`,className:d,value:n,onChange:f,"aria-label":p,children:m}),t[20]=o.browserPickerTitle,t[21]=f,t[22]=m,t[23]=n,t[24]=h):h=t[24];let g=i?(0,Z.jsxs)(`button`,{type:`button`,className:Y(`inline-flex shrink-0 items-center justify-center gap-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-accent`,`transition-colors hover:border-edge-strong hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),onClick:()=>i(n),"aria-label":`${e?.name??n} — ${o.browserGoToConfigure}`,children:[(0,Z.jsx)(`span`,{children:o.browserGoToConfigure}),(0,Z.jsx)(ot,{className:`size-4 shrink-0`,"aria-hidden":!0})]}):null,_;t[25]!==g||t[26]!==h?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-2`,children:[h,g]}),t[25]=g,t[26]=h,t[27]=_):_=t[27],s=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,_,e?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.statusLabel?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-fg-muted`,"aria-label":e.statusLabel,children:[(0,Z.jsx)(`span`,{className:Y(`inline-block size-1.5 rounded-full`,Vi(e.status)),"aria-hidden":!0}),e.statusLabel]}):null}),(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.tagline})]}):null]}),t[0]=o.browserGoToConfigure,t[1]=o.browserPickerSubtitle,t[2]=o.browserPickerTitle,t[3]=r,t[4]=i,t[5]=a,t[6]=n,t[7]=s}else s=t[7];return s}function Ui(e){return(0,Z.jsx)(`option`,{value:e.value,children:e.name},e.value)}function Wi(e){return`browser-focus-${e}`}function Gi(e){switch(e){case`connection`:case`extension`:case`local`:case`cloak`:case`cdp`:case`cloud`:case`runtime`:case`security`:return e;default:return null}}function Ki(e){let t=(0,X.c)(89),{a:n,form:r,update:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Wi(`runtime`),t[0]=a):a=t[0];let o;t[1]===n.browserBehaviorShow?o=t[2]:(o=(0,Z.jsx)(Ut,{icon:P,title:n.browserBehaviorShow}),t[1]=n.browserBehaviorShow,t[2]=o);let s;t[3]===i?s=t[4]:(s=e=>i({browserHeadless:e.target.checked}),t[3]=i,t[4]=s);let c;t[5]!==r.browserHeadless||t[6]!==s?(c=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.browserHeadless,onChange:s}),t[5]=r.browserHeadless,t[6]=s,t[7]=c):c=t[7];let l;t[8]===n.browserHeadlessOn?l=t[9]:(l=(0,Z.jsx)(`span`,{children:n.browserHeadlessOn}),t[8]=n.browserHeadlessOn,t[9]=l);let u;t[10]!==c||t[11]!==l?(u=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;t[13]!==n.desc.browserHeadless||t[14]!==n.label.browserHeadless||t[15]!==u?(d=(0,Z.jsx)($,{label:n.label.browserHeadless,description:n.desc.browserHeadless,children:u}),t[13]=n.desc.browserHeadless,t[14]=n.label.browserHeadless,t[15]=u,t[16]=d):d=t[16];let f=n.label.browserDialogPolicy,p=n.desc.browserDialogPolicy,m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=xn(),t[17]=m):m=t[17];let h;t[18]===i?h=t[19]:(h=e=>i({browserDialogPolicy:e.target.value}),t[18]=i,t[19]=h);let g;t[20]===n.browserDialogPolicyMustRespond?g=t[21]:(g=(0,Z.jsx)(`option`,{value:`must_respond`,children:n.browserDialogPolicyMustRespond}),t[20]=n.browserDialogPolicyMustRespond,t[21]=g);let _;t[22]===n.browserDialogPolicyAutoDismiss?_=t[23]:(_=(0,Z.jsx)(`option`,{value:`auto_dismiss`,children:n.browserDialogPolicyAutoDismiss}),t[22]=n.browserDialogPolicyAutoDismiss,t[23]=_);let v;t[24]===n.browserDialogPolicyAutoAccept?v=t[25]:(v=(0,Z.jsx)(`option`,{value:`auto_accept`,children:n.browserDialogPolicyAutoAccept}),t[24]=n.browserDialogPolicyAutoAccept,t[25]=v);let y;t[26]!==r.browserDialogPolicy||t[27]!==h||t[28]!==g||t[29]!==_||t[30]!==v?(y=(0,Z.jsxs)(`select`,{className:m,value:r.browserDialogPolicy,onChange:h,children:[g,_,v]}),t[26]=r.browserDialogPolicy,t[27]=h,t[28]=g,t[29]=_,t[30]=v,t[31]=y):y=t[31];let b;t[32]!==n.desc.browserDialogPolicy||t[33]!==n.label.browserDialogPolicy||t[34]!==y?(b=(0,Z.jsx)($,{label:f,description:p,children:y}),t[32]=n.desc.browserDialogPolicy,t[33]=n.label.browserDialogPolicy,t[34]=y,t[35]=b):b=t[35];let x=n.label.browserDialogTimeout,C=n.desc.browserDialogTimeout,w;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(w=bn(),t[36]=w):w=t[36];let T=r.browserDialogTimeout??``,E;t[37]===i?E=t[38]:(E=e=>{let t=e.target.value;i({browserDialogTimeout:t===``?void 0:Number.parseInt(t,10)})},t[37]=i,t[38]=E);let D;t[39]!==T||t[40]!==E?(D=(0,Z.jsx)(`input`,{type:`number`,className:w,min:1,value:T,placeholder:`300`,onChange:E}),t[39]=T,t[40]=E,t[41]=D):D=t[41];let O;t[42]!==n.desc.browserDialogTimeout||t[43]!==n.label.browserDialogTimeout||t[44]!==D?(O=(0,Z.jsx)($,{label:x,description:C,children:D}),t[42]=n.desc.browserDialogTimeout,t[43]=n.label.browserDialogTimeout,t[44]=D,t[45]=O):O=t[45];let k;t[46]!==b||t[47]!==O||t[48]!==d?(k=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[d,b,O]}),t[46]=b,t[47]=O,t[48]=d,t[49]=k):k=t[49];let A;t[50]!==o||t[51]!==k?(A=(0,Z.jsx)(`div`,{id:a,className:`scroll-mt-24`,children:(0,Z.jsxs)(Wt,{children:[o,k]})}),t[50]=o,t[51]=k,t[52]=A):A=t[52];let j;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(j=Wi(`security`),t[53]=j):j=t[53];let M;t[54]===n.browserSecurityShow?M=t[55]:(M=(0,Z.jsx)(Ut,{icon:S,title:n.browserSecurityShow}),t[54]=n.browserSecurityShow,t[55]=M);let N;t[56]===i?N=t[57]:(N=e=>i({browserAllowPrivateUrls:e.target.checked}),t[56]=i,t[57]=N);let F;t[58]!==r.browserAllowPrivateUrls||t[59]!==N?(F=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.browserAllowPrivateUrls,onChange:N}),t[58]=r.browserAllowPrivateUrls,t[59]=N,t[60]=F):F=t[60];let I;t[61]===n.browserAllowPrivateOn?I=t[62]:(I=(0,Z.jsx)(`span`,{children:n.browserAllowPrivateOn}),t[61]=n.browserAllowPrivateOn,t[62]=I);let L;t[63]!==F||t[64]!==I?(L=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[F,I]}),t[63]=F,t[64]=I,t[65]=L):L=t[65];let R;t[66]!==n.desc.browserAllowPrivateUrls||t[67]!==n.label.browserAllowPrivateUrls||t[68]!==L?(R=(0,Z.jsx)($,{label:n.label.browserAllowPrivateUrls,description:n.desc.browserAllowPrivateUrls,children:L}),t[66]=n.desc.browserAllowPrivateUrls,t[67]=n.label.browserAllowPrivateUrls,t[68]=L,t[69]=R):R=t[69];let z=n.label.browserCommandTimeout,B=n.desc.browserCommandTimeout,V;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(V=bn(),t[70]=V):V=t[70];let ee=r.browserCommandTimeout??``,H;t[71]===i?H=t[72]:(H=e=>{let t=e.target.value;i({browserCommandTimeout:t===``?void 0:Number.parseInt(t,10)})},t[71]=i,t[72]=H);let U;t[73]!==ee||t[74]!==H?(U=(0,Z.jsx)(`input`,{type:`number`,className:V,min:5,value:ee,placeholder:`30`,onChange:H}),t[73]=ee,t[74]=H,t[75]=U):U=t[75];let W;t[76]!==n.desc.browserCommandTimeout||t[77]!==n.label.browserCommandTimeout||t[78]!==U?(W=(0,Z.jsx)($,{label:z,description:B,children:U}),t[76]=n.desc.browserCommandTimeout,t[77]=n.label.browserCommandTimeout,t[78]=U,t[79]=W):W=t[79];let G;t[80]!==R||t[81]!==W?(G=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[R,W]}),t[80]=R,t[81]=W,t[82]=G):G=t[82];let K;t[83]!==M||t[84]!==G?(K=(0,Z.jsx)(`div`,{id:j,className:`scroll-mt-24`,children:(0,Z.jsxs)(Wt,{className:`border border-amber-500/20`,children:[M,G]})}),t[83]=M,t[84]=G,t[85]=K):K=t[85];let q;return t[86]!==A||t[87]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[A,K]}),t[86]=A,t[87]=K,t[88]=q):q=t[88],q}function qi(e){let t=(0,X.c)(9),{language:n,label:r,className:i}=e,a;t[0]===n?a=t[1]:(a=B(n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=Y(`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,i),t[2]=i,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ee,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[4]=s):s=t[4];let c;return t[5]!==r||t[6]!==a||t[7]!==o?(c=(0,Z.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,className:o,children:[r,s]}),t[5]=r,t[6]=a,t[7]=o,t[8]=c):c=t[8],c}function Ji(e){let t=(0,X.c)(27),{title:n,description:r,recommended:i,recommendedLabel:a,icon:o,onSelect:s,selectLabel:c}=e,l=`${n} — ${c}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=Y(`group flex w-full flex-col rounded-xl border border-edge bg-surface-panel px-3 py-3 text-left transition-colors`,`hover:border-edge-strong hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Z.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=o,t[2]=d);let f;t[3]===n?f=t[4]:(f=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=f);let p;t[5]!==i||t[6]!==a?(p=i&&a?(0,Z.jsx)(`span`,{className:`rounded-full bg-accent/15 px-2 py-0.5 text-[10px] font-medium text-accent`,children:a}):null,t[5]=i,t[6]=a,t[7]=p):p=t[7];let m;t[8]!==f||t[9]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(ot,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==g?(v=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[d,g,_]}),t[17]=d,t[18]=g,t[19]=v):v=t[19];let y;t[20]===c?y=t[21]:(y=(0,Z.jsx)(`span`,{className:`mt-2 text-[11px] font-medium text-accent`,children:c}),t[20]=c,t[21]=y);let b;return t[22]!==s||t[23]!==l||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,onClick:s,"aria-label":l,className:u,children:[v,y]}),t[22]=s,t[23]=l,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function Yi(e){let t=(0,X.c)(28),{m:n,onStart:r}=e,i;t[0]!==n.browserSetupExtDesc||t[1]!==n.browserSetupExtTitle?(i={id:`extension`,icon:se,title:n.browserSetupExtTitle,description:n.browserSetupExtDesc,recommended:!0},t[0]=n.browserSetupExtDesc,t[1]=n.browserSetupExtTitle,t[2]=i):i=t[2];let a;t[3]!==n.browserSetupLocalDesc||t[4]!==n.browserSetupLocalTitle?(a={id:`local`,icon:kt,title:n.browserSetupLocalTitle,description:n.browserSetupLocalDesc},t[3]=n.browserSetupLocalDesc,t[4]=n.browserSetupLocalTitle,t[5]=a):a=t[5];let o;t[6]!==n.browserSetupCloudDesc||t[7]!==n.browserSetupCloudTitle?(o={id:`cloud`,icon:be,title:n.browserSetupCloudTitle,description:n.browserSetupCloudDesc},t[6]=n.browserSetupCloudDesc,t[7]=n.browserSetupCloudTitle,t[8]=o):o=t[8];let s;t[9]!==i||t[10]!==a||t[11]!==o?(s=[i,a,o],t[9]=i,t[10]=a,t[11]=o,t[12]=s):s=t[12];let c=s,l;t[13]===n.browserSetupTitle?l=t[14]:(l=(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.browserSetupTitle}),t[13]=n.browserSetupTitle,t[14]=l);let u;t[15]===n.browserSetupSubtitle?u=t[16]:(u=(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:n.browserSetupSubtitle}),t[15]=n.browserSetupSubtitle,t[16]=u);let d;t[17]!==l||t[18]!==u?(d=(0,Z.jsxs)(`div`,{children:[l,u]}),t[17]=l,t[18]=u,t[19]=d):d=t[19];let f;t[20]!==n.browserSetupRecommended||t[21]!==n.browserSetupSelect||t[22]!==c||t[23]!==r?(f=(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map(e=>(0,Z.jsx)(Ji,{icon:e.icon,title:e.title,description:e.description,recommended:e.recommended,recommendedLabel:n.browserSetupRecommended,selectLabel:n.browserSetupSelect,onSelect:()=>r(e.id)},e.id))}),t[20]=n.browserSetupRecommended,t[21]=n.browserSetupSelect,t[22]=c,t[23]=r,t[24]=f):f=t[24];let p;return t[25]!==d||t[26]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-4`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27],p}function Xi(e){if(e.kind===`loading`)return`checking`;if(e.kind===`error`)return`error`;if(e.kind===`ok`)return e.data.installed?`ready`:`not_installed`}function Zi(e,t){if(e)return{ready:t.browserStatusReady,not_installed:t.browserStatusNotInstalled,checking:t.browserStatusChecking,unknown:t.browserStatusUnknown,error:t.browserStatusError}[e]}function Qi(e){if(e.kind!==`idle`)return e.kind===`loading`?`checking`:e.kind===`error`?`error`:e.data.connected?`ready`:(e.data.running,`not_installed`)}function $i(e,t){if(e.kind!==`idle`)return e.kind===`loading`?t.browserStatusChecking:e.kind===`error`?t.browserStatusError:e.data.connected?t.browserExtensionConnected:e.data.running?t.browserExtensionWaiting:t.browserExtensionServerOff}var ea=[`overview`,`extension`,`local`,`cloakbrowser`,`cdp`,`cloud`],ta=[`extension`,`local`,`cloakbrowser`,`cdp`,`cloud`],na={connection:`overview`,extension:`extension`,local:`local`,cloak:`cloakbrowser`,cdp:`cdp`,cloud:`cloud`,runtime:`overview`,security:`overview`};function ra(e){let t=(e??``).trim();return t===`behavior`?`overview`:ea.includes(t)?t:`overview`}function ia(e){return ta.includes(e)}function aa(e){let t=(0,X.c)(46),{icon:n,title:r,description:i,status:a,statusDetail:o,primaryAction:s,children:c,advanced:l,m:u,embedded:d,sectionTitle:f,advancedTitle:p}=e,m=d===void 0?!1:d,h;t[0]!==l||t[1]!==p?(h=l?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p?(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:p}):null,l]}):null,t[0]=l,t[1]=p,t[2]=h):h=t[2];let g=h;if(m){let e;t[3]!==i||t[4]!==f?(e=f?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),i?(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:i}):null]}):null,t[3]=i,t[4]=f,t[5]=e):e=t[5];let n;t[6]!==u||t[7]!==s||t[8]!==a||t[9]!==o?(n=a||s?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[a?(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(oa,{kind:a,detail:o,m:u})}):(0,Z.jsx)(`span`,{}),s?(0,Z.jsx)(`div`,{className:`shrink-0`,children:s}):null]}):null,t[6]=u,t[7]=s,t[8]=a,t[9]=o,t[10]=n):n=t[10];let r;t[11]===c?r=t[12]:(r=c?(0,Z.jsx)(`div`,{className:`flex flex-col gap-4`,children:c}):null,t[11]=c,t[12]=r);let l;return t[13]!==g||t[14]!==e||t[15]!==n||t[16]!==r?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e,n,r,g]}),t[13]=g,t[14]=e,t[15]=n,t[16]=r,t[17]=l):l=t[17],l}let _;t[18]===n?_=t[19]:(_=(0,Z.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75})}),t[18]=n,t[19]=_);let v;t[20]===r?v=t[21]:(v=(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r}),t[20]=r,t[21]=v);let y;t[22]!==u||t[23]!==a||t[24]!==o?(y=a?(0,Z.jsx)(oa,{kind:a,detail:o,m:u}):null,t[22]=u,t[23]=a,t[24]=o,t[25]=y):y=t[25];let b;t[26]!==v||t[27]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28];let x;t[29]===i?x=t[30]:(x=(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:i}),t[29]=i,t[30]=x);let S;t[31]!==b||t[32]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[b,x]}),t[31]=b,t[32]=x,t[33]=S):S=t[33];let C;t[34]===s?C=t[35]:(C=s?(0,Z.jsx)(`div`,{className:`shrink-0`,children:s}):null,t[34]=s,t[35]=C);let w;t[36]!==_||t[37]!==S||t[38]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[_,S,C]}),t[36]=_,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===c?T=t[41]:(T=c?(0,Z.jsx)(`div`,{className:`flex flex-col gap-4`,children:c}):null,t[40]=c,t[41]=T);let E;return t[42]!==g||t[43]!==w||t[44]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[w,T,g]}),t[42]=g,t[43]=w,t[44]=T,t[45]=E):E=t[45],E}function oa(e){let t=(0,X.c)(27),{kind:n,detail:r,m:i}=e,a,o,s,l;if(t[0]!==n||t[1]!==i.browserStatusChecking||t[2]!==i.browserStatusError||t[3]!==i.browserStatusNotInstalled||t[4]!==i.browserStatusReady||t[5]!==i.browserStatusUnknown){let{icon:e,color:r,label:u}={ready:{icon:c,color:`text-green-600 dark:text-green-400`,label:i.browserStatusReady},not_installed:{icon:Pt,color:`text-amber-600 dark:text-amber-400`,label:i.browserStatusNotInstalled},checking:{icon:Xe,color:`text-fg-muted`,label:i.browserStatusChecking},unknown:{icon:ae,color:`text-fg-muted`,label:i.browserStatusUnknown},error:{icon:Te,color:`text-red-600 dark:text-red-400`,label:i.browserStatusError}}[n];a=e,o=u,l=`inline-flex min-w-0 flex-col items-start gap-1`,s=Y(`inline-flex shrink-0 items-center gap-1 whitespace-nowrap text-xs font-medium`,r),t[0]=n,t[1]=i.browserStatusChecking,t[2]=i.browserStatusError,t[3]=i.browserStatusNotInstalled,t[4]=i.browserStatusReady,t[5]=i.browserStatusUnknown,t[6]=a,t[7]=o,t[8]=s,t[9]=l}else a=t[6],o=t[7],s=t[8],l=t[9];let u=n===`checking`&&`animate-spin`,d;t[10]===u?d=t[11]:(d=Y(`size-3.5 shrink-0`,u),t[10]=u,t[11]=d);let f;t[12]!==a||t[13]!==d?(f=(0,Z.jsx)(a,{className:d}),t[12]=a,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,Z.jsx)(`span`,{children:o}),t[15]=o,t[16]=p);let m;t[17]!==s||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{className:s,children:[f,p]}),t[17]=s,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;t[21]===r?h=t[22]:(h=r?(0,Z.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-snug text-fg-subtle`,children:r}):null,t[21]=r,t[22]=h);let g;return t[23]!==l||t[24]!==m||t[25]!==h?(g=(0,Z.jsxs)(`span`,{className:l,children:[m,h]}),t[23]=l,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function sa(e){let t=(0,X.c)(5),{kind:n,message:r}=e,i=n===`success`?`border-green-500/30 bg-green-500/10 text-green-700 dark:text-green-300`:`border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-300`,a;t[0]===i?a=t[1]:(a=Y(`rounded-lg border px-3 py-2 text-xs leading-relaxed`,i),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==a?(o=(0,Z.jsx)(`div`,{className:a,children:r}),t[2]=r,t[3]=a,t[4]=o):o=t[4],o}var ca={instances:[],launchStatus:`idle`,launchMessage:null,testStatus:`idle`,testMessage:null,executablePath:``};function la({m:e,cdpUrl:t,onCdpUrlChange:n,launch:r,stop:i,listInstances:a,ping:o,embedded:s=!1}){let[c,l]=(0,Q.useReducer)(ft,ca),{instances:u,launchStatus:d,launchMessage:f,testStatus:p,testMessage:m,executablePath:h}=c,g=(0,Q.useCallback)(async()=>{try{l({type:`patch`,patch:{instances:await a()}})}catch{}},[a]);(0,Q.useEffect)(()=>{g();let e=setInterval(()=>void g(),8e3);return()=>clearInterval(e)},[g]);let _=(0,Q.useCallback)(async()=>{if(d!==`pending`){l({type:`patch`,patch:{launchStatus:`pending`,launchMessage:null}});try{let t=await r(h.trim()||void 0);l({type:`patch`,patch:{launchStatus:`ok`,launchMessage:e.browserCdpLaunchedAtPort.replace(`{{port}}`,String(t.port))}}),n(t.wsEndpoint),await g()}catch(e){l({type:`patch`,patch:{launchStatus:`error`,launchMessage:e instanceof Error?e.message:String(e)}})}}},[h,r,d,e.browserCdpLaunchedAtPort,n,g]),v=(0,Q.useCallback)(async e=>{await i(e),await g()},[g,i]),y=(0,Q.useCallback)(async()=>{if(t.trim()){l({type:`patch`,patch:{testStatus:`pending`,testMessage:null}});try{let n=await o(t.trim());n.reachable?l({type:`patch`,patch:{testStatus:`ok`,testMessage:e.browserCdpReachable.replace(`{{browser}}`,n.browser??`—`)}}):l({type:`patch`,patch:{testStatus:`error`,testMessage:e.browserCdpUnreachable.replace(`{{error}}`,n.error??`—`)}})}catch(t){l({type:`patch`,patch:{testStatus:`error`,testMessage:e.browserCdpUnreachable.replace(`{{error}}`,t instanceof Error?t.message:String(t))}})}}},[t,e.browserCdpReachable,e.browserCdpUnreachable,o]);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(aa,{icon:st,title:e.browserCdpLaunchLocal,description:e.browserCdpLaunchLocalDesc,m:e,embedded:s,sectionTitle:s?e.browserCdpLaunchLocal:void 0,primaryAction:(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:d===`pending`,onClick:()=>void _(),children:[d===`pending`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(st,{className:`size-3.5`}),d===`pending`?e.browserCdpLaunching:e.browserCdpLaunchLocal]}),children:[f?(0,Z.jsx)(sa,{kind:d===`error`?`error`:`success`,message:f}):null,(0,Z.jsx)($,{label:e.browserCdpChromePath,description:e.browserCdpChromePathDesc,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:h,placeholder:`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,onChange:e=>l({type:`patch`,patch:{executablePath:e.target.value}}),autoComplete:`off`})}),u.length>0?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge bg-surface-base p-3 text-xs`,children:u.map(t=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-fg`,children:[`port `,t.port,` · pid `,t.pid]}),(0,Z.jsx)(`span`,{className:`truncate text-fg-subtle`,children:t.wsEndpoint})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs font-medium text-fg hover:bg-surface-raised`,onClick:()=>void v(t.port),children:[(0,Z.jsx)(W,{className:`size-3`}),e.browserCdpStopLocal]})]},t.port))}):null]}),(0,Z.jsxs)(aa,{icon:Mt,title:e.label.browserCdpUrl,description:e.desc.browserCdpUrl,m:e,embedded:s,sectionTitle:s?e.label.browserCdpUrl:void 0,primaryAction:(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:!t.trim()||p===`pending`,onClick:()=>void y(),children:[p===`pending`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(Ct,{className:`size-3.5`}),p===`pending`?e.browserCdpTesting:e.browserCdpTestConnection]}),children:[(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:t,placeholder:`ws://127.0.0.1:9222`,onChange:e=>n(e.target.value),autoComplete:`off`}),(0,Z.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:e.browserCdpLoopbackOnly}),m?(0,Z.jsx)(sa,{kind:p===`error`?`error`:`success`,message:m}):null]})]})}function ua(e,t){let n=t.phase;if(!n)return e.browserInstallPhaseStarting;if(n===`downloading`)return t.percent==null?e.browserInstallPhaseDownloading:e.browserInstallPhaseDownloadingPercent.replace(`{{percent}}`,String(t.percent));switch(n){case`starting`:return e.browserInstallPhaseStarting;case`verifying`:return e.browserInstallPhaseVerifying;case`extracting`:return e.browserInstallPhaseExtracting;case`running`:return t.message??e.browserInstallPhaseRunning;case`ready`:return e.browserInstallPhaseReady;default:return t.message??e.browserInstallPhaseRunning}}function da(e){let t=(0,X.c)(32),{m:n,progress:r,showLogs:i,onCancel:a,cancelling:o}=e,s=i===void 0?!1:i,c=o===void 0?!1:o;if(!r.phase)return null;let l;t[0]!==n||t[1]!==r?(l=ua(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d=r.percent==null?(r.phase===`extracting`||r.phase===`verifying`||r.phase===`running`||r.phase,null):Math.min(100,Math.max(0,r.percent)),f;t[3]===u?f=t[4]:(f=(0,Z.jsx)(`span`,{className:`text-fg`,children:u}),t[3]=u,t[4]=f);let p;t[5]===d?p=t[6]:(p=d==null?null:(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[d,`%`]}),t[5]=d,t[6]=p);let m;t[7]!==c||t[8]!==n||t[9]!==a?(m=a?(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md border border-edge px-2 py-0.5 text-[11px] font-medium text-fg-muted hover:bg-surface-raised hover:text-fg disabled:cursor-not-allowed disabled:opacity-60`,disabled:c,onClick:()=>void a(),children:c?n.browserInstallCancelling:n.browserInstallCancel}):null,t[7]=c,t[8]=n,t[9]=a,t[10]=m):m=t[10];let h;t[11]!==p||t[12]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==f||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-fg-muted`,children:[f,h]}),t[14]=f,t[15]=h,t[16]=g):g=t[16];let _;t[17]===d?_=t[18]:(_=(0,Z.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-raised`,children:d==null?(0,Z.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-accent/70`}):(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-300 ease-out`,style:{width:`${d}%`}})}),t[17]=d,t[18]=_);let v;t[19]!==r.lines||t[20]!==s?(v=s&&r.lines.length>0?(0,Z.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded-md border border-edge bg-surface-panel px-2 py-1.5 font-mono text-[10px] leading-relaxed text-fg-muted`,children:r.lines.map(fa)}):null,t[19]=r.lines,t[20]=s,t[21]=v):v=t[21];let y;t[22]!==r.message||t[23]!==r.percent||t[24]!==r.phase||t[25]!==s?(y=!s&&r.phase===`downloading`&&r.message&&r.percent==null?(0,Z.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:r.message}):null,t[22]=r.message,t[23]=r.percent,t[24]=r.phase,t[25]=s,t[26]=y):y=t[26];let b;return t[27]!==v||t[28]!==y||t[29]!==g||t[30]!==_?(b=(0,Z.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[g,_,v,y]}),t[27]=v,t[28]=y,t[29]=g,t[30]=_,t[31]=b):b=t[31],b}function fa(e,t){return(0,Z.jsx)(`div`,{className:`truncate`,children:e},`${t}-${e.slice(0,24)}`)}var pa={confirmOpen:!1,installStatus:`idle`,installMessage:null,openStatus:`idle`,openMessage:null,runtime:null};function ma({m:e,doctor:t,refetch:n,applyDoctor:r,installStream:i,fetchRuntimeStatus:a,launchCloak:o,form:s,onChange:l,embedded:u=!1}){let[d,f]=(0,Q.useReducer)(ft,pa),{confirmOpen:p,installStatus:m,installMessage:h,openStatus:g,openMessage:_,runtime:v}=d,{progress:y,running:b,cancelling:x,run:S,reset:C,cancel:w}=i,T=t.kind===`ok`?t.data:null,E=T?.installed===!0,D=m===`installing`||b,O=(0,Q.useCallback)(async()=>{if(E)try{f({type:`patch`,patch:{runtime:await a()}})}catch{}},[a,E]);(0,Q.useEffect)(()=>{if(!E){f({type:`patch`,patch:{runtime:null}});return}O();let e=setInterval(()=>void O(),8e3);return()=>clearInterval(e)},[E,O]);let k=(0,Q.useCallback)(async()=>{f({type:`patch`,patch:{confirmOpen:!1,installStatus:`installing`,installMessage:null}}),C();let t=await S({body:{cacheDir:s.cacheDir.trim()||void 0,binaryPath:s.binaryPath.trim()||void 0},fallbackError:e.browserCloakInstallFailed});if(!t.ok){if(t.error===`busy`){f({type:`patch`,patch:{installStatus:`installing`}});return}if(t.error===`cancelled`){f({type:`patch`,patch:{installStatus:`idle`,installMessage:null}}),C();return}f({type:`patch`,patch:{installStatus:`failed`,installMessage:t.errorMessage??e.browserCloakInstallFailed}});return}t.payload&&r?.(t.payload),f({type:`patch`,patch:{installStatus:`installed`,installMessage:t.payload?.binaryPath?`${e.browserCloakInstalled}: ${t.payload.binaryPath}`:e.browserCloakInstalled}}),await n({cacheDir:s.cacheDir,binaryPath:s.binaryPath}),await O()},[r,s.binaryPath,s.cacheDir,e.browserCloakInstallFailed,e.browserCloakInstalled,n,O,C,S]),A=(0,Q.useCallback)(async()=>{if(g!==`pending`){f({type:`patch`,patch:{openStatus:`pending`,openMessage:null}});try{let t=await o();f({type:`patch`,patch:{openStatus:`ok`,openMessage:t.reused?e.browserCloakOpenReused.replace(`{{port}}`,String(t.port)):e.browserCloakOpenLaunched.replace(`{{port}}`,String(t.port)),runtime:t}})}catch(e){f({type:`patch`,patch:{openStatus:`error`,openMessage:e instanceof Error?e.message:String(e)}})}}},[o,e.browserCloakOpenLaunched,e.browserCloakOpenReused,g]),j=t.kind===`loading`?`checking`:t.kind===`error`?`error`:E?`ready`:`not_installed`,M=E&&T?.version?`v${T.version} (${T.platform})`:void 0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(aa,{icon:Ht,title:e.browserCloakGuideTitle,description:e.browserCloakGuideDesc,status:j,statusDetail:M,m:e,embedded:u,primaryAction:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[E?(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:g===`pending`,onClick:()=>void A(),children:[g===`pending`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(st,{className:`size-3.5`}),g===`pending`?e.browserCloakOpening:e.browserCloakOpen]}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:D,onClick:()=>f({type:`patch`,patch:{confirmOpen:!0}}),children:[D?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):E?(0,Z.jsx)(Oe,{className:`size-3.5`}):m===`installed`?(0,Z.jsx)(c,{className:`size-3.5 text-green-500`}):(0,Z.jsx)(Vt,{className:`size-3.5`}),D?e.browserCloakInstalling:E?e.browserReinstall:e.browserCloakDownload]})]}),children:[b?(0,Z.jsx)(da,{m:e,progress:y,cancelling:x,onCancel:()=>void w()}):null,h?(0,Z.jsx)(sa,{kind:m===`failed`?`error`:`success`,message:h}):null,_?(0,Z.jsx)(sa,{kind:g===`error`?`error`:`success`,message:_}):null,E&&v?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge bg-surface-base p-3 text-xs`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:v.running?e.browserCloakRuntimeRunning.replace(`{{port}}`,String(v.port)):e.browserCloakRuntimeOff})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-fg-subtle`,children:e.browserCloakProfileLabel}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-[11px] text-fg-muted`,children:v.userDataDir})]}),(0,Z.jsx)(`p`,{className:`text-[11px] leading-relaxed text-fg-subtle`,children:e.browserCloakProfileAgentHint}),v.temporaryProfile?(0,Z.jsx)(`p`,{className:`text-[11px] text-amber-600 dark:text-amber-400`,children:e.browserCloakTemporaryProfileHint}):null]}):null,(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:e.label.browserCloakKeepOpen,description:e.desc.browserCloakKeepOpen,children:(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:s.keepOpen,onChange:e=>l({keepOpen:e.target.checked})}),(0,Z.jsx)(`span`,{children:e.browserCloakKeepOpenOn})]})}),(0,Z.jsx)($,{label:e.label.browserCloakTemporaryProfile,description:e.desc.browserCloakTemporaryProfile,children:(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:s.temporaryProfile,onChange:e=>l({temporaryProfile:e.target.checked})}),(0,Z.jsx)(`span`,{children:e.browserCloakTemporaryProfileOn})]})}),(0,Z.jsx)($,{label:e.label.browserHumanize,description:e.desc.browserHumanize,children:(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:s.humanize,onChange:e=>l({humanize:e.target.checked})}),(0,Z.jsx)(`span`,{children:e.browserHumanizeOn})]})}),(0,Z.jsx)($,{label:e.label.browserHumanPreset,description:e.desc.browserHumanPreset,children:(0,Z.jsxs)(`select`,{className:xn(),value:s.humanPreset,onChange:e=>l({humanPreset:e.target.value}),children:[(0,Z.jsx)(`option`,{value:`careful`,children:e.browserHumanPresetCareful}),(0,Z.jsx)(`option`,{value:`default`,children:e.browserHumanPresetDefault})]})})]})]}),(0,Z.jsxs)(Wt,{className:`mt-4 border border-edge-subtle`,children:[(0,Z.jsx)(Ut,{icon:Ht,title:e.browserCloakAdvancedShow}),(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Z.jsxs)($,{label:e.label.browserCloakCacheDir,description:e.desc.browserCloakCacheDir,children:[(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:s.cacheDir,placeholder:`~/.xopc/bin/cloakbrowser`,onChange:e=>l({cacheDir:e.target.value}),autoComplete:`off`}),(0,Z.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:e.browserCacheDirHomeOnly})]}),(0,Z.jsxs)($,{label:e.label.browserCloakBinaryPath,description:e.desc.browserCloakBinaryPath,children:[(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:s.binaryPath,placeholder:`~/.xopc/bin/cloakbrowser/chromium-v.../Chromium.app/Contents/MacOS/Chromium`,onChange:e=>l({binaryPath:e.target.value}),autoComplete:`off`}),s.binaryPath.trim()?(0,Z.jsx)(`p`,{className:`text-[11px] text-amber-600 dark:text-amber-400`,children:e.browserBinaryPathWarning}):null]}),(0,Z.jsx)($,{label:e.label.browserCloakTimezone,description:e.desc.browserCloakTimezone,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:s.timezone,placeholder:`America/New_York`,onChange:e=>l({timezone:e.target.value}),autoComplete:`off`})}),(0,Z.jsx)($,{label:e.label.browserCloakLocale,description:e.desc.browserCloakLocale,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:s.locale,placeholder:`en-US`,onChange:e=>l({locale:e.target.value}),autoComplete:`off`})}),(0,Z.jsx)($,{label:e.label.browserCloakWebrtcIp,description:e.desc.browserCloakWebrtcIp,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:s.webrtcIp,placeholder:`203.0.113.10`,onChange:e=>l({webrtcIp:e.target.value}),autoComplete:`off`})}),(0,Z.jsx)($,{label:e.label.browserCloakFingerprintPlatform,description:e.desc.browserCloakFingerprintPlatform,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:s.fingerprintPlatform,placeholder:`macos`,onChange:e=>l({fingerprintPlatform:e.target.value}),autoComplete:`off`})}),(0,Z.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Z.jsx)($,{label:e.label.browserCloakExtraArgs,description:e.desc.browserCloakExtraArgs,children:(0,Z.jsx)(`textarea`,{className:ha(),value:s.extraArgs,placeholder:`--disable-dev-shm-usage`,rows:3,onChange:e=>l({extraArgs:e.target.value})})})})]})]}),(0,Z.jsx)(St,{open:p,title:e.browserConfirmDownloadTitle,description:ga(e,T),confirmLabel:e.browserConfirmDownloadConfirm,cancelLabel:e.browserConfirmDownloadCancel,onConfirm:()=>void k(),onCancel:()=>f({type:`patch`,patch:{confirmOpen:!1}})})]})}function ha(){return`${bn()} min-h-[4.5rem] resize-y font-mono text-xs`}function ga(e,t){if(!t)return e.browserConfirmDownloadBody;let n=[e.browserConfirmDownloadBody.replace(`{{version}}`,t.version??`—`).replace(`{{platform}}`,t.platform).replace(`{{url}}`,t.downloadUrl||`—`)];return t.expectedSha256?n.push(`SHA-256: ${t.expectedSha256.slice(0,16)}…`):n.push(e.browserCloakSha256Skipped),n.join(`
|
|
218
|
-
`)}var _a=18790,va={enabled:!0,maxAttempts:5,windowMs:9e5,blockDurationMs:3e5,exemptLoopback:!0};function ya(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ba(e){return yt(e)}async function xa(e){let t=await v(o(`/api/gateway/reveal-auth-secret`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({field:e})});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function Sa(){let e=await v(o(`/api/agents/browser/reveal-cloud-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok||!e.payload)throw Error(e.error?.message??`Reveal failed`);return e.payload}function Ca(e){return ba(e)?``:e.trim()}function wa(e){return[...e].map(e=>e.trim()).sort()}function Ta(e){return JSON.stringify({bind:e.bind,customBindHost:e.customBindHost.trim(),port:e.port,auth:{mode:e.auth.mode,token:Ca(e.auth.token),password:Ca(e.auth.password),rateLimit:e.auth.rateLimit,trustedProxy:{userHeader:e.auth.trustedProxy.userHeader.trim(),requiredHeaders:wa(e.auth.trustedProxy.requiredHeaders),allowUsers:wa(e.auth.trustedProxy.allowUsers),allowLoopback:e.auth.trustedProxy.allowLoopback}},corsOrigins:wa(e.corsOrigins),trustedProxies:wa(e.trustedProxies),allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback})}function Ea(e,t){return Ta(e)!==Ta(t)}function Da(e){return e===`none`||e===`token`||e===`password`||e===`trusted-proxy`?e:`token`}function Oa(e){let t=ya(e)?e:{};return{enabled:t.enabled!==!1,maxAttempts:typeof t.maxAttempts==`number`&&Number.isFinite(t.maxAttempts)?Math.max(1,Math.floor(t.maxAttempts)):va.maxAttempts,windowMs:typeof t.windowMs==`number`&&Number.isFinite(t.windowMs)&&t.windowMs>0?Math.floor(t.windowMs):va.windowMs,blockDurationMs:typeof t.blockDurationMs==`number`&&Number.isFinite(t.blockDurationMs)&&t.blockDurationMs>0?Math.floor(t.blockDurationMs):typeof t.lockoutMs==`number`&&Number.isFinite(t.lockoutMs)&&t.lockoutMs>0?Math.floor(t.lockoutMs):va.blockDurationMs,exemptLoopback:t.exemptLoopback!==!1}}function ka(e){let t=ya(e)?e:{};return{userHeader:typeof t.userHeader==`string`?t.userHeader:``,requiredHeaders:ja(t.requiredHeaders,32),allowUsers:ja(t.allowUsers,128),allowLoopback:t.allowLoopback===!0}}function Aa(e){return e===`auto`||e===`off`||e===`explicit`?e:`auto`}function ja(e,t=24){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function Ma(e){return e===`auto`||e===`loopback`||e===`lan`||e===`tailnet`||e===`custom`?e:`loopback`}function Na(e){if(e.bind===`loopback`)return!1;if(e.bind===`lan`)return!0;if(e.bind===`custom`){let t=e.customBindHost.trim().toLowerCase();return t?t!==`127.0.0.1`&&t!==`localhost`&&t!==`::1`:!0}return!0}function Pa(e){let t=Na(e);return t&&e.auth.mode===`none`?`Network-accessible gateway requires authentication (token, password, or trusted-proxy).`:t&&e.auth.mode===`trusted-proxy`&&e.trustedProxies.length===0?`Trusted-proxy auth on a network bind requires at least one gateway.trustedProxies entry.`:e.auth.mode===`trusted-proxy`&&!e.auth.trustedProxy.userHeader.trim()?`Trusted-proxy auth requires gateway.auth.trustedProxy.userHeader.`:t&&e.corsOrigins.includes(`*`)?`CORS wildcard "*" is not allowed on network-accessible binds.`:e.bind===`custom`&&!e.customBindHost.trim()?`Custom bind mode requires a bind address.`:null}function Fa(e){let t=ya(e)?e:{},n=ya(t.gateway)?t.gateway:{},r=ya(n.auth)?n.auth:{},i=ya(n.security)?n.security:{},a=ya(t.update)?t.update:{},o=ya(a.auto)?a.auto:{},s=a.channel,c=s===`beta`||s===`dev`||s===`stable`?s:`stable`,l=Array.isArray(n.corsOrigins)?n.corsOrigins.filter(e=>typeof e==`string`&&e.trim().length>0):[];return{bind:Ma(n.bind),customBindHost:typeof n.customBindHost==`string`&&n.customBindHost.trim()?n.customBindHost.trim():``,port:typeof n.port==`number`&&Number.isFinite(n.port)?Math.floor(n.port):_a,auth:{mode:Da(r.mode),token:typeof r.token==`string`?r.token:``,password:typeof r.password==`string`?r.password:``,rateLimit:Oa(r.rateLimit),trustedProxy:ka(r.trustedProxy)},corsOrigins:l,trustedProxies:ja(n.trustedProxies,64),allowRealIpFallback:n.allowRealIpFallback===!0,dangerouslyAllowHostHeaderOriginFallback:n.dangerouslyAllowHostHeaderOriginFallback===!0,securityStrict:i.strict===!0,maxSseConnections:typeof n.maxSseConnections==`number`&&Number.isFinite(n.maxSseConnections)?Math.max(1,Math.floor(n.maxSseConnections)):100,channelConnectDeferMode:Aa(n.channelConnectDeferMode),channelConnectDeferIds:ja(n.channelConnectDeferIds),channelConnectDeferSkipIds:ja(n.channelConnectDeferSkipIds),updateChannel:c,updateCheckOnStart:a.checkOnStart!==!1,updateAutoEnabled:o.enabled===!0,updateAutoStableDelayHours:typeof o.stableDelayHours==`number`&&Number.isFinite(o.stableDelayHours)?Math.max(0,Math.floor(o.stableDelayHours)):6,updateAutoStableJitterHours:typeof o.stableJitterHours==`number`&&Number.isFinite(o.stableJitterHours)?Math.max(0,Math.floor(o.stableJitterHours)):12,updateAutoBetaCheckIntervalHours:typeof o.betaCheckIntervalHours==`number`&&Number.isFinite(o.betaCheckIntervalHours)?Math.max(.25,o.betaCheckIntervalHours):1}}function Ia(e){let t={mode:e.auth.mode,rateLimit:e.auth.rateLimit};if(e.auth.mode===`token`){let n=e.auth.token.trim();n.length>0&&!ba(n)&&(t.token=e.auth.token),t.password=null,t.trustedProxy=null}else if(e.auth.mode===`password`){let n=e.auth.password.trim();n.length>0&&!ba(n)&&(t.password=e.auth.password),t.token=null,t.trustedProxy=null}else if(e.auth.mode===`trusted-proxy`){t.token=null,t.password=null;let n=e.auth.trustedProxy;t.trustedProxy={userHeader:n.userHeader.trim(),...n.requiredHeaders.length>0?{requiredHeaders:n.requiredHeaders}:{},...n.allowUsers.length>0?{allowUsers:n.allowUsers}:{},...n.allowLoopback?{allowLoopback:!0}:{}}}else t.token=null,t.password=null,t.trustedProxy=null;return t}async function La(e){let t=Pa(e);if(t)throw Error(t);await v(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{bind:e.bind,...e.bind===`custom`?{customBindHost:e.customBindHost.trim()}:{},port:e.port,auth:Ia(e),corsOrigins:e.corsOrigins,trustedProxies:e.trustedProxies,allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback,security:{strict:e.securityStrict},maxSseConnections:e.maxSseConnections,channelConnectDeferMode:e.channelConnectDeferMode,channelConnectDeferIds:e.channelConnectDeferIds,channelConnectDeferSkipIds:e.channelConnectDeferSkipIds},update:{channel:e.updateChannel,checkOnStart:e.updateCheckOnStart,auto:{enabled:e.updateAutoEnabled,stableDelayHours:e.updateAutoStableDelayHours,stableJitterHours:e.updateAutoStableJitterHours,betaCheckIntervalHours:e.updateAutoBetaCheckIntervalHours}}})}),Lt()}function Ra({m:e,form:t,onChange:n,testCloud:r,embedded:o=!1}){let[s,c]=(0,Q.useState)(`idle`),[l,u]=(0,Q.useState)(null),d=t.provider===`local`?`browserbase`:t.provider,f=a(i(e=>e.language)).providersSettings,p=oe({show:f.show,hide:f.hide,copy:f.copy,copied:f.copied}),m=(0,Q.useCallback)(()=>Sa().then(e=>e.apiKey??null),[]),h=(0,Q.useCallback)(async()=>{c(`pending`),u(null);try{let n=await r(d,t.apiKey);n.reachable?(c(`ok`),u(e.browserCloudTestOk)):(c(`error`),u(e.browserCloudTestFailed.replace(`{{error}}`,n.error??`—`)))}catch(t){c(`error`),u(e.browserCloudTestFailed.replace(`{{error}}`,t instanceof Error?t.message:String(t)))}},[t.apiKey,e.browserCloudTestFailed,e.browserCloudTestOk,d,r]);return(0,Z.jsxs)(aa,{icon:be,title:e.label.browserCloudProvider,description:e.desc.browserCloudProvider,m:e,embedded:o,primaryAction:(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:s===`pending`,onClick:()=>void h(),children:[s===`pending`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(Ct,{className:`size-3.5`}),e.browserCloudTestConnection]}),children:[(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:e.label.browserCloudProvider,description:e.desc.browserCloudProvider,children:(0,Z.jsxs)(`select`,{className:xn(),value:d,onChange:e=>n({provider:e.target.value}),children:[(0,Z.jsx)(`option`,{value:`browserbase`,children:e.browserCloudProviderBrowserbase}),(0,Z.jsx)(`option`,{value:`browser-use`,children:e.browserCloudProviderBrowserUse})]})}),(0,Z.jsx)($,{label:e.label.browserCloudApiKey,description:e.desc.browserCloudApiKey,children:(0,Z.jsx)(He,{value:t.apiKey,onChange:e=>n({apiKey:e}),placeholder:d===`browserbase`?`BROWSERBASE_API_KEY`:`BROWSER_USE_API_KEY`,labels:p,reveal:m,loadFailedLabel:`Failed to load key`})}),d===`browserbase`?(0,Z.jsx)($,{label:e.label.browserCloudProjectId,description:e.desc.browserCloudProjectId,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:t.projectId,placeholder:`BROWSERBASE_PROJECT_ID`,onChange:e=>n({projectId:e.target.value}),autoComplete:`off`})}):null,(0,Z.jsx)($,{label:e.label.browserCloudRegion,description:e.desc.browserCloudRegion,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:t.region,placeholder:`us-west-2`,onChange:e=>n({region:e.target.value}),autoComplete:`off`})})]}),l?(0,Z.jsx)(sa,{kind:s===`error`?`error`:`success`,message:l}):null]})}function za(e){let t=(0,X.c)(45),{m:n,installed:r,extensionDir:i,connected:a,busy:o,onOpenChrome:s,onRevealFolder:l,folderBusy:u}=e,d;t[0]!==r||t[1]!==n.browserExtensionInstallStep1?(d={id:`install`,label:n.browserExtensionInstallStep1,done:r},t[0]=r,t[1]=n.browserExtensionInstallStep1,t[2]=d):d=t[2];let f=!!i&&a,p;t[3]!==o||t[4]!==i||t[5]!==u||t[6]!==n.browserExtensionInstallStep2FolderLabel||t[7]!==n.browserExtensionInstalling||t[8]!==n.browserExtensionOpenChrome||t[9]!==n.browserExtensionRevealFolder||t[10]!==s||t[11]!==l?(p=i?(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge bg-surface-raised px-2.5 py-2`,children:[(0,Z.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.browserExtensionInstallStep2FolderLabel}),(0,Z.jsx)(`p`,{className:`mt-1 break-all font-mono text-[11px] text-fg`,children:i}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-[11px] text-accent hover:underline disabled:opacity-60`,disabled:o,onClick:s,children:n.browserExtensionOpenChrome}),(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-[11px] text-accent hover:underline disabled:opacity-60`,disabled:o,onClick:l,title:i,children:u?n.browserExtensionInstalling:n.browserExtensionRevealFolder})]})]}):null,t[3]=o,t[4]=i,t[5]=u,t[6]=n.browserExtensionInstallStep2FolderLabel,t[7]=n.browserExtensionInstalling,t[8]=n.browserExtensionOpenChrome,t[9]=n.browserExtensionRevealFolder,t[10]=s,t[11]=l,t[12]=p):p=t[12];let m;t[13]!==n.browserExtensionInstallStep2||t[14]!==f||t[15]!==p?(m={id:`load`,label:n.browserExtensionInstallStep2,done:f,detail:p},t[13]=n.browserExtensionInstallStep2,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;t[17]!==a||t[18]!==n.browserExtensionInstallStep3?(h={id:`connect`,label:n.browserExtensionInstallStep3,done:a},t[17]=a,t[18]=n.browserExtensionInstallStep3,t[19]=h):h=t[19];let g;t[20]!==d||t[21]!==m||t[22]!==h?(g=[d,m,h],t[20]=d,t[21]=m,t[22]=h,t[23]=g):g=t[23];let _=g,v;t[24]===_?v=t[25]:(v=_.filter(Ba),t[24]=_,t[25]=v);let y=v.length,b=n.browserExtensionInstallGuideTitle,x;t[26]===n.browserExtensionInstallGuideTitle?x=t[27]:(x=(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n.browserExtensionInstallGuideTitle}),t[26]=n.browserExtensionInstallGuideTitle,t[27]=x);let S;t[28]!==y||t[29]!==n.browserExtensionChecklistProgress||t[30]!==_.length?(S=n.browserExtensionChecklistProgress.replace(`{{done}}`,String(y)).replace(`{{total}}`,String(_.length)),t[28]=y,t[29]=n.browserExtensionChecklistProgress,t[30]=_.length,t[31]=S):S=t[31];let C;t[32]===S?C=t[33]:(C=(0,Z.jsx)(`span`,{className:`ml-auto text-xs font-normal text-fg-muted`,children:S}),t[32]=S,t[33]=C);let w;t[34]!==C||t[35]!==x?(w=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[x,C]}),t[34]=C,t[35]=x,t[36]=w):w=t[36];let T;t[37]!==n.browserExtensionChecklistDone||t[38]!==n.browserExtensionChecklistPending||t[39]!==_?(T=(0,Z.jsx)(`ol`,{className:`flex flex-col gap-3`,children:_.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-2.5`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:e.done?(0,Z.jsx)(c,{className:`size-4 text-emerald-500`,strokeWidth:2}):(0,Z.jsx)(I,{className:`size-4 text-fg-subtle`,strokeWidth:1.75})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`p`,{className:Y(`text-[11px] leading-relaxed`,e.done?`text-fg-muted line-through decoration-fg-subtle/60`:`text-fg`),children:[(0,Z.jsxs)(`span`,{className:`sr-only`,children:[e.done?n.browserExtensionChecklistDone:n.browserExtensionChecklistPending,` `]}),t+1,`. `,e.label]}),e.detail]})]},e.id))}),t[37]=n.browserExtensionChecklistDone,t[38]=n.browserExtensionChecklistPending,t[39]=_,t[40]=T):T=t[40];let E;return t[41]!==n.browserExtensionInstallGuideTitle||t[42]!==w||t[43]!==T?(E=(0,Z.jsxs)(`div`,{"aria-label":b,className:`rounded-xl border border-edge bg-surface-base px-3 py-3`,children:[w,T]}),t[41]=n.browserExtensionInstallGuideTitle,t[42]=w,t[43]=T,t[44]=E):E=t[44],E}function Ba(e){return e.done}var Va=19820,Ha=3e4;function Ua({m:e,probe:t,artifacts:n,onChange:r,startBridge:i,stopBridge:a,disconnectExtension:o,installArtifacts:s,refetchArtifacts:c,openExtensionChrome:l,revealExtensionFolder:u,form:d,embedded:f=!1}){let[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y=d.port??Va,b=d.host||`127.0.0.1`,x=`ws://${b}:${y}/browser-ext`,S=t.kind===`ok`&&t.data.running,C=t.kind===`ok`&&t.data.connected,T=t.kind===`ok`&&t.data.bridgeHeld===!0,E=t.kind===`ok`&&t.data.portConflict===!0,D=S||T,O=n.kind===`ok`?n.data:t.kind===`ok`?t.data.artifacts:void 0,k=O?.installed===!0,A=O?.extensionDir,j=O?.needsChromeReload===!0,M=t.kind===`ok`?C?{icon:_t,color:`text-green-500`,label:e.browserExtensionConnected}:S?{icon:Ct,color:`text-amber-500`,label:e.browserExtensionWaiting}:{icon:w,color:`text-fg-muted`,label:e.browserExtensionServerOff}:{icon:w,color:`text-fg-muted`,label:`…`},N=M.icon,P=(0,Q.useCallback)(async()=>{if(!p){m(`start`),g(null);try{await i({host:b,port:y})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(null)}}},[p,b,y,i]),F=(0,Q.useCallback)(async()=>{if(!p){m(`stop`),g(null);try{await a()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(null)}}},[p,a]),I=(0,Q.useCallback)(async()=>{if(!p){m(`disconnect`),g(null);try{await o()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(null)}}},[p,o]),L=(0,Q.useCallback)(async()=>{if(!p){m(`install`),g(null),v(null);try{let t=await s({force:k});t?.extensionDir?v(`${e.browserExtensionInstalled}: ${t.extensionDir}`):v(e.browserExtensionInstalled),await c()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(null)}}},[p,s,k,e.browserExtensionInstalled,c]),R=(0,Q.useCallback)(async()=>{if(!p){m(`open`),g(null);try{await l()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(null)}}},[p,l]),z=(0,Q.useCallback)(async()=>{if(!(!A||p)){m(`folder`),g(null),v(null);try{let t=await Tt(A);await u(),v(t?e.browserExtensionPathCopied:e.browserExtensionFolderOpened)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(null)}}},[p,A,e.browserExtensionFolderOpened,e.browserExtensionPathCopied,u]),B=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:p!==null,onClick:()=>void L(),children:[p===`install`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(Vt,{className:`size-3.5`}),p===`install`?e.browserExtensionInstalling:e.browserExtensionInstall]}),D?(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:p!==null,onClick:()=>void F(),children:[p===`stop`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(W,{className:`size-3.5`}),e.browserExtensionStopBridge]}):(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:p!==null,onClick:()=>void P(),children:[p===`start`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(st,{className:`size-3.5`}),p===`start`?e.browserExtensionStarting:e.browserExtensionStartBridge]}),C?(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:p!==null,onClick:()=>void I(),children:[p===`disconnect`?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(w,{className:`size-3.5`}),e.browserExtensionDisconnect]}):null]});return(0,Z.jsx)(aa,{icon:se,title:e.browserBackendExtension,description:e.browserExtensionDownloadHint,m:e,embedded:f,primaryAction:B,advancedTitle:e.browserAdvancedShow,advanced:(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:e.label.browserExtensionPort,description:e.desc.browserExtensionPort,children:(0,Z.jsx)(`input`,{type:`number`,className:bn(),min:1024,max:65535,value:d.port??``,placeholder:String(Va),onChange:e=>{let t=e.target.value;r({port:t===``?void 0:Number.parseInt(t,10)})}})}),(0,Z.jsx)($,{label:e.label.browserExtensionHost,description:e.desc.browserExtensionHost,children:(0,Z.jsx)(`input`,{type:`text`,className:bn(),value:d.host,placeholder:`127.0.0.1`,onChange:e=>r({host:e.target.value}),autoComplete:`off`})}),(0,Z.jsx)($,{label:e.label.browserExtensionConnectionTimeout,description:e.desc.browserExtensionConnectionTimeout,children:(0,Z.jsx)(`input`,{type:`number`,className:bn(),min:1,step:1,value:d.connectionTimeoutMs==null?``:Math.round(d.connectionTimeoutMs/1e3),placeholder:String(Ha/1e3),onChange:e=>{let t=e.target.value;r({connectionTimeoutMs:t===``?void 0:Math.max(1,Number.parseInt(t,10))*1e3})}})})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:x}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs ${M.color}`,children:[(0,Z.jsx)(N,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:M.label})]})]}),(0,Z.jsx)(za,{m:e,installed:k,extensionDir:A,connected:C,busy:p!==null,folderBusy:p===`folder`,onOpenChrome:()=>void R(),onRevealFolder:()=>void z()}),j?(0,Z.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:e.browserExtensionNeedsChromeReload}):null,E?(0,Z.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:e.browserExtensionPortConflict.replace(`{{port}}`,String(y))}):null,_?(0,Z.jsx)(sa,{kind:`success`,message:_}):null,h?(0,Z.jsx)(sa,{kind:`error`,message:h}):null]})})}function Wa(e){let t=(0,X.c)(41),{m:n,doctor:r,refetch:i,applyDoctor:a,installStream:o,embedded:s}=e,l=s===void 0?!1:s,[u,d]=(0,Q.useState)(`idle`),[f,p]=(0,Q.useState)(null),{progress:m,running:h,cancelling:g,run:_,reset:v,cancel:y}=o,b;t[0]!==a||t[1]!==n.browserPlaywrightInstallFailed||t[2]!==n.browserPlaywrightInstalled||t[3]!==i||t[4]!==v||t[5]!==_?(b=async()=>{d(`installing`),p(null),v();let e=await _({fallbackError:n.browserPlaywrightInstallFailed});if(!e.ok){if(e.error===`busy`){d(`installing`);return}if(e.error===`cancelled`){d(`idle`),p(null),v();return}d(`failed`),p(e.errorMessage??n.browserPlaywrightInstallFailed);return}e.payload&&a?.(e.payload),d(`installed`),p(e.payload?.executablePath?`${n.browserPlaywrightInstalled}: ${e.payload.executablePath}`:n.browserPlaywrightInstalled),await i()},t[0]=a,t[1]=n.browserPlaywrightInstallFailed,t[2]=n.browserPlaywrightInstalled,t[3]=i,t[4]=v,t[5]=_,t[6]=b):b=t[6];let x=b,S=r.kind===`loading`?`checking`:r.kind===`error`?`error`:r.kind===`ok`?r.data.installed?`ready`:`not_installed`:`unknown`,C=r.kind===`ok`&&r.data.installed&&r.data.executablePath?r.data.executablePath:void 0,w=r.kind===`ok`&&r.data.installed,T=u===`installing`||h,E;t[7]===x?E=t[8]:(E=()=>void x(),t[7]=x,t[8]=E);let D;t[9]!==w||t[10]!==T||t[11]!==u?(D=T?(0,Z.jsx)(Xe,{className:`size-3.5 animate-spin`}):w?(0,Z.jsx)(Oe,{className:`size-3.5`}):u===`installed`?(0,Z.jsx)(c,{className:`size-3.5 text-green-500`}):(0,Z.jsx)(Vt,{className:`size-3.5`}),t[9]=w,t[10]=T,t[11]=u,t[12]=D):D=t[12];let O=T?n.browserPlaywrightInstalling:w?n.browserReinstall:n.browserPlaywrightInstall,k;t[13]!==T||t[14]!==E||t[15]!==D||t[16]!==O?(k=(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:T,onClick:E,children:[D,O]}),t[13]=T,t[14]=E,t[15]=D,t[16]=O,t[17]=k):k=t[17];let A;t[18]===n.browserPlaywrightManualInstall?A=t[19]:(A=(0,Z.jsx)(`p`,{className:`text-fg-muted`,children:n.browserPlaywrightManualInstall}),t[18]=n.browserPlaywrightManualInstall,t[19]=A);let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`code`,{className:`mt-2 block w-fit rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg`,children:`node node_modules/playwright-core/cli.js install chromium`}),t[20]=j):j=t[20];let M;t[21]===A?M=t[22]:(M=(0,Z.jsxs)(`div`,{className:`text-xs`,children:[A,j]}),t[21]=A,t[22]=M);let N;t[23]!==y||t[24]!==g||t[25]!==n||t[26]!==m||t[27]!==h?(N=h?(0,Z.jsx)(da,{m:n,progress:m,showLogs:!0,cancelling:g,onCancel:()=>void y()}):null,t[23]=y,t[24]=g,t[25]=n,t[26]=m,t[27]=h,t[28]=N):N=t[28];let P;t[29]!==f||t[30]!==u?(P=f?(0,Z.jsx)(sa,{kind:u===`failed`?`error`:`success`,message:f}):null,t[29]=f,t[30]=u,t[31]=P):P=t[31];let F;return t[32]!==l||t[33]!==n||t[34]!==C||t[35]!==S||t[36]!==N||t[37]!==P||t[38]!==k||t[39]!==M?(F=(0,Z.jsxs)(aa,{icon:kt,title:n.browserPlaywrightGuideTitle,description:n.browserPlaywrightGuideDesc,status:S,statusDetail:C,m:n,embedded:l,primaryAction:k,children:[M,N,P]}),t[32]=l,t[33]=n,t[34]=C,t[35]=S,t[36]=N,t[37]=P,t[38]=k,t[39]=M,t[40]=F):F=t[40],F}async function Ga(e){let t=await y(e),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1){let e=typeof n.error==`string`?n.error:n.error?.message;throw Error(e||`Request failed: ${t.status}`)}if(n.payload===void 0)throw Error(`Empty payload`);return n.payload}async function Ka(e,t){let n=await y(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1){let e=typeof r.error==`string`?r.error:r.error?.message;throw Error(e||`Request failed: ${n.status}`)}if(r.payload===void 0)throw Error(`Empty payload`);return r.payload}var qa={playwright:{kind:`idle`},cloak:{kind:`idle`},extension:{kind:`idle`},extensionArtifacts:{kind:`idle`}};function Ja(e,t){switch(t.type){case`playwright`:return{...e,playwright:t.state};case`cloak`:return{...e,cloak:t.state};case`extension`:return{...e,extension:t.state};case`extension-artifacts`:return{...e,extensionArtifacts:t.state};case`playwright-idle`:return{...e,playwright:{kind:`idle`}};case`cloak-idle`:return{...e,cloak:{kind:`idle`}};case`extension-idle`:return{...e,extension:{kind:`idle`},extensionArtifacts:{kind:`idle`}};case`extension-start-probe`:return{...e,extension:e.extension.kind===`ok`?e.extension:{kind:`loading`}};case`extension-artifacts-start-probe`:return{...e,extensionArtifacts:e.extensionArtifacts.kind===`ok`?e.extensionArtifacts:{kind:`loading`}}}}function Ya(e){let[t,n]=(0,Q.useReducer)(Ja,qa),{playwright:r,cloak:i,extension:a,extensionArtifacts:s}=t,c=(0,Q.useCallback)(async()=>{n({type:`playwright`,state:{kind:`loading`}});try{n({type:`playwright`,state:{kind:`ok`,data:await Ga(o(`/api/browser/playwright/doctor`))}})}catch(e){n({type:`playwright`,state:{kind:`error`,message:e instanceof Error?e.message:String(e)}})}},[]),l=(0,Q.useCallback)(async t=>{n({type:`cloak`,state:{kind:`loading`}});let r=(t?.cacheDir??e.cacheDir??``).trim(),i=(t?.binaryPath??e.binaryPath??``).trim(),a=new URLSearchParams;r&&a.set(`cacheDir`,r),i&&a.set(`binaryPath`,i);try{let e=await Ga(o(`/api/browser/cloakbrowser/doctor${a.size?`?${a}`:``}`));return n({type:`cloak`,state:{kind:`ok`,data:e}}),e}catch(e){return n({type:`cloak`,state:{kind:`error`,message:e instanceof Error?e.message:String(e)}}),null}},[e.binaryPath,e.cacheDir]),u=(0,Q.useCallback)(e=>{n({type:`playwright`,state:{kind:`ok`,data:e}})},[]),d=(0,Q.useCallback)(e=>{n({type:`cloak`,state:{kind:`ok`,data:e}})},[]),f=(0,Q.useCallback)(async()=>Ga(o(`/api/browser/cloakbrowser/status`)),[]),p=(0,Q.useCallback)(async()=>Ka(o(`/api/browser/cloakbrowser/launch`),{}),[]),m=e.browserEnabled===!0&&e.probeExtension===!0,h=e.browserEnabled===!0&&e.probeLocal===!0,g=e.browserEnabled===!0&&e.probeCloak===!0,{extensionHost:_,extensionPort:v}=e,b=(0,Q.useCallback)(async()=>{let e=new URLSearchParams({probe:`1`});_&&e.set(`host`,_),v!==void 0&&e.set(`port`,String(v)),n({type:`extension-start-probe`});try{let t=await y(o(`/api/browser/extension-status?${e}`),{signal:AbortSignal.timeout(3e3)}),r=await t.json().catch(()=>({}));if(!t.ok){n({type:`extension`,state:{kind:`error`,message:`HTTP ${t.status}`}});return}n({type:`extension`,state:{kind:`ok`,data:{running:r.running===!0,connected:r.connected===!0,backend:r.backend,artifacts:r.artifacts,bridgeHeld:r.bridgeHeld===!0,refCount:typeof r.refCount==`number`?r.refCount:void 0,manualBridge:r.manualBridge===!0,portConflict:r.portConflict===!0}}})}catch(e){n({type:`extension`,state:{kind:`error`,message:e instanceof Error?e.message:String(e)}})}},[_,v]),x=(0,Q.useCallback)(async()=>{n({type:`extension-artifacts-start-probe`});try{let e=await Ga(o(`/api/browser/extension/doctor`));return n({type:`extension-artifacts`,state:{kind:`ok`,data:e}}),e}catch(e){return n({type:`extension-artifacts`,state:{kind:`error`,message:e instanceof Error?e.message:String(e)}}),null}},[]),S=(0,Q.useCallback)(async e=>{let t=(await Ka(o(`/api/browser/extension/install`),{force:e?.force??!1})).doctor;return n({type:`extension-artifacts`,state:{kind:`ok`,data:t}}),await b(),t},[b]),C=(0,Q.useCallback)(async()=>{await Ka(o(`/api/browser/extension/open`),{action:`chrome`})},[]),w=(0,Q.useCallback)(async()=>{await Ka(o(`/api/browser/extension/open`),{action:`folder`})},[]);(0,Q.useEffect)(()=>{if(!h){n({type:`playwright-idle`});return}c()},[h,c]),(0,Q.useEffect)(()=>{if(!g){n({type:`cloak-idle`});return}l()},[g,l]);let T=(0,Q.useRef)(m);T.current!==m&&(T.current=m,m||n({type:`extension-idle`})),(0,Q.useEffect)(()=>{if(!m)return;b(),x();let e=setInterval(()=>void b(),5e3);return()=>clearInterval(e)},[m,b,x]);let E=(0,Q.useCallback)(async e=>{await Ka(o(`/api/browser/extension/start`),{host:e?.host??_,port:e?.port??v}),await b()},[_,v,b]),D=(0,Q.useCallback)(async()=>{await Ka(o(`/api/browser/extension/stop`),{}),await b()},[b]),O=(0,Q.useCallback)(async()=>{await Ka(o(`/api/browser/extension/disconnect`),{}),await b()},[b]),k=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(!m||e.activeBackend!==`extension`){k.current=null;return}if(a.kind!==`ok`||a.data.running||a.data.bridgeHeld)return;let t=`${_}:${v??19820}`;k.current!==t&&(k.current=t,E({host:_,port:v}).catch(()=>{k.current=null}))},[m,a,_,v,e.activeBackend,E]),{playwright:r,cloak:i,extension:a,extensionArtifacts:s,refetchPlaywright:c,applyPlaywrightDoctor:u,refetchCloak:l,applyCloakDoctor:d,fetchCloakRuntimeStatus:f,launchCloak:p,refetchExtension:b,refetchExtensionArtifacts:x,installExtensionArtifacts:S,openExtensionChrome:C,revealExtensionFolder:w,pingCdp:(0,Q.useCallback)(async e=>Ka(o(`/api/browser/cdp/ping`),{cdpUrl:e}),[]),testCloud:(0,Q.useCallback)(async(e,t)=>Ka(o(`/api/browser/cloud/test-connection`),{provider:e,apiKey:t}),[]),launchCdp:(0,Q.useCallback)(async e=>Ka(o(`/api/browser/cdp/launch`),{executablePath:e}),[]),stopCdp:(0,Q.useCallback)(async e=>{await Ka(o(`/api/browser/cdp/stop`),{port:e})},[]),listCdpInstances:(0,Q.useCallback)(async()=>(await Ga(o(`/api/browser/cdp/instances`))).instances,[]),startExtensionBridge:E,stopExtensionBridge:D,disconnectExtension:O}}var Xa=`
|
|
219
|
-
|
|
220
|
-
`,Za=/\r\n/g,Qa={playwright:`/api/browser/playwright/install/stream`,cloakbrowser:`/api/browser/cloakbrowser/install/stream`},$a={playwright:`/api/browser/playwright/install/cancel`,cloakbrowser:`/api/browser/cloakbrowser/install/cancel`},eo=8;function to(){return{phase:null,message:null,percent:null,lines:[]}}function no(e,t){let n={phase:t.phase,message:t.message??t.line??e.message,percent:t.percent??e.percent,lines:e.lines};if(t.line){let r=[...e.lines,t.line];n.lines=r.length>eo?r.slice(-8):r}return n}async function ro(e,t,n){let r=e.getReader(),i=new TextDecoder,a=``,o=null,s=e=>{let n=``,r=``;for(let t of e.split(`
|
|
221
|
-
`)){let e=t.replace(/\r$/,``);e.startsWith(`event:`)?n=e.slice(6).trim():e.startsWith(`data:`)&&(r+=e.slice(5).trimStart())}if(r){if(n===`progress`){try{let e=JSON.parse(r);e&&typeof e==`object`&&typeof e.phase==`string`&&t(e)}catch{}return}if(n===`result`)try{let e=JSON.parse(r);o=e.ok?{ok:!0,payload:e.payload}:{ok:!1,error:String(e.error??`unknown`),message:typeof e.message==`string`?e.message:void 0,status:e.error===`busy`?409:e.error===`cancelled`?499:500}}catch{o={ok:!1,error:`parse`,status:0}}}};try{let e=async()=>{if(o!==null)return o;if(n?.aborted)return await r.cancel().catch(()=>{}),{ok:!1,error:`cancelled`,status:499};let{done:t,value:c}=await r.read();if(t)return o??{ok:!1,error:`no-result`,status:0};a+=i.decode(c,{stream:!0}),a=a.replace(Za,`
|
|
222
|
-
`);let l=a.split(Xa);a=l.pop()??``;for(let e of l)e.length&&s(e);return e()},t=await e();if(t)return t}catch(e){if(n?.aborted||e instanceof DOMException&&e.name===`AbortError`)return{ok:!1,error:`cancelled`,status:499};throw e}finally{r.releaseLock()}return o||(n?.aborted?{ok:!1,error:`cancelled`,status:499}:{ok:!1,error:`no-result`,status:0})}function io(e){let[t,n]=(0,Q.useState)(to),[r,i]=(0,Q.useState)(!1),[a,s]=(0,Q.useState)(!1),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(null),u=(0,Q.useCallback)(()=>{c.current||n(to())},[]),d=(0,Q.useCallback)(async()=>{if(c.current){s(!0);try{await y(o($a[e]),{method:`POST`}).catch(()=>{}),l.current?.abort()}finally{s(!1)}}},[e]);return{progress:t,running:r,cancelling:a,run:(0,Q.useCallback)(async t=>{if(c.current)return{ok:!1,error:`busy`,status:409,errorMessage:`An install for this browser type is already in progress.`};let r=new AbortController;l.current=r,c.current=!0,i(!0),n(to());try{let i=await y(o(Qa[e]),{method:`POST`,headers:{Accept:`text/event-stream`,...t.body===void 0?{}:{"Content-Type":`application/json`}},body:t.body===void 0?void 0:JSON.stringify(t.body),signal:r.signal});if(!i.ok||!i.body){let e=await i.text().catch(()=>``),t=`HTTP ${i.status}`;try{let n=JSON.parse(e);typeof n.message==`string`?t=n.message:typeof n.error==`string`&&(t=n.error)}catch{e&&(t=e.slice(0,500))}return{ok:!1,error:i.status===409?`busy`:`http`,status:i.status,errorMessage:t}}let a=await ro(i.body,e=>{n(t=>no(t,e))},r.signal);return a.ok?a:a.error===`cancelled`?{...a,errorMessage:void 0}:{...a,errorMessage:a.message??(a.error===`busy`?`An install for this browser type is already in progress.`:t.fallbackError)}}catch(e){return r.signal.aborted||e instanceof DOMException&&e.name===`AbortError`?{ok:!1,error:`cancelled`,status:499}:{ok:!1,error:`network`,errorMessage:e instanceof Error?e.message:t.fallbackError}}finally{l.current===r&&(l.current=null),c.current=!1,i(!1),s(!1)}},[e]),reset:u,cancel:d}}function ao(e){let t=(0,X.c)(176),{a:n,form:r,update:a,activeTab:o,setActiveTab:s}=e,c=i(oo),l=io(`playwright`),u=io(`cloakbrowser`),d=r.browserEnabled&&(o===`overview`||o===`extension`),f=r.browserEnabled&&(o===`overview`||o===`local`),p=r.browserEnabled&&(o===`overview`||o===`cloakbrowser`),m;t[0]!==r.browserBackend||t[1]!==r.browserCloakBinaryPath||t[2]!==r.browserCloakCacheDir||t[3]!==r.browserEnabled||t[4]!==r.browserExtensionHost||t[5]!==r.browserExtensionPort||t[6]!==p||t[7]!==d||t[8]!==f?(m={cacheDir:r.browserCloakCacheDir,binaryPath:r.browserCloakBinaryPath,browserEnabled:r.browserEnabled,activeBackend:r.browserBackend,probeExtension:d,probeLocal:f,probeCloak:p,extensionHost:r.browserExtensionHost,extensionPort:r.browserExtensionPort},t[0]=r.browserBackend,t[1]=r.browserCloakBinaryPath,t[2]=r.browserCloakCacheDir,t[3]=r.browserEnabled,t[4]=r.browserExtensionHost,t[5]=r.browserExtensionPort,t[6]=p,t[7]=d,t[8]=f,t[9]=m):m=t[9];let h=Ya(m),g;t[10]===h.playwright?g=t[11]:(g=Xi(h.playwright),t[10]=h.playwright,t[11]=g);let _=g,v;t[12]===h.cloak?v=t[13]:(v=Xi(h.cloak),t[12]=h.cloak,t[13]=v);let y=v,b;t[14]===h.extension?b=t[15]:(b=Qi(h.extension),t[14]=h.extension,t[15]=b);let x=b,S;t[16]!==n||t[17]!==h.extension?(S=$i(h.extension,n),t[16]=n,t[17]=h.extension,t[18]=S):S=t[18];let C=S,w;t[19]!==n.browserBackendExtension||t[20]!==n.browserModeExtTagline||t[21]!==x||t[22]!==C?(w={value:`extension`,icon:se,name:n.browserBackendExtension,tagline:n.browserModeExtTagline,status:x,statusLabel:C},t[19]=n.browserBackendExtension,t[20]=n.browserModeExtTagline,t[21]=x,t[22]=C,t[23]=w):w=t[23];let T=n.browserBackendLocal,E=n.browserModeLocalTagline,D;t[24]!==n||t[25]!==_?(D=Zi(_,n),t[24]=n,t[25]=_,t[26]=D):D=t[26];let O;t[27]!==n.browserBackendLocal||t[28]!==n.browserModeLocalTagline||t[29]!==_||t[30]!==D?(O={value:`local`,icon:kt,name:T,tagline:E,status:_,statusLabel:D},t[27]=n.browserBackendLocal,t[28]=n.browserModeLocalTagline,t[29]=_,t[30]=D,t[31]=O):O=t[31];let k=n.browserBackendCloakBrowser,A=n.browserModeCloakTagline,j;t[32]!==n||t[33]!==y?(j=Zi(y,n),t[32]=n,t[33]=y,t[34]=j):j=t[34];let M;t[35]!==n.browserBackendCloakBrowser||t[36]!==n.browserModeCloakTagline||t[37]!==y||t[38]!==j?(M={value:`cloakbrowser`,icon:Ht,name:k,tagline:A,status:y,statusLabel:j},t[35]=n.browserBackendCloakBrowser,t[36]=n.browserModeCloakTagline,t[37]=y,t[38]=j,t[39]=M):M=t[39];let N;t[40]!==n.browserBackendCdp||t[41]!==n.browserModeCdpTagline?(N={value:`cdp`,icon:Mt,name:n.browserBackendCdp,tagline:n.browserModeCdpTagline},t[40]=n.browserBackendCdp,t[41]=n.browserModeCdpTagline,t[42]=N):N=t[42];let P;t[43]!==n.browserBackendCloud||t[44]!==n.browserModeCloudTagline?(P={value:`cloud`,icon:be,name:n.browserBackendCloud,tagline:n.browserModeCloudTagline},t[43]=n.browserBackendCloud,t[44]=n.browserModeCloudTagline,t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==N||t[48]!==P||t[49]!==w||t[50]!==O?(F=[w,O,M,N,P],t[46]=M,t[47]=N,t[48]=P,t[49]=w,t[50]=O,t[51]=F):F=t[51];let I=F,L;t[52]!==s||t[53]!==a?(L=e=>{a({browserEnabled:!0,browserBackend:e}),s(e)},t[52]=s,t[53]=a,t[54]=L):L=t[54];let R=L,z=!r.browserEnabled&&`pointer-events-none opacity-40`,B;t[55]===z?B=t[56]:(B=Y(`flex flex-col gap-5 transition-opacity`,z),t[55]=z,t[56]=B);let V=!r.browserEnabled,ee;t[57]!==n||t[58]!==o||t[59]!==h.disconnectExtension||t[60]!==h.extension||t[61]!==h.extensionArtifacts||t[62]!==h.installExtensionArtifacts||t[63]!==h.openExtensionChrome||t[64]!==h.refetchExtensionArtifacts||t[65]!==h.revealExtensionFolder||t[66]!==h.startExtensionBridge||t[67]!==h.stopExtensionBridge||t[68]!==r.browserExtensionConnectionTimeout||t[69]!==r.browserExtensionHost||t[70]!==r.browserExtensionPort||t[71]!==a?(ee=o===`extension`?(0,Z.jsx)(Wt,{children:(0,Z.jsx)(Ua,{embedded:!0,m:n,probe:h.extension,artifacts:h.extensionArtifacts,form:{port:r.browserExtensionPort,host:r.browserExtensionHost,connectionTimeoutMs:r.browserExtensionConnectionTimeout},onChange:e=>a({...e.port===void 0?{}:{browserExtensionPort:e.port},...e.host===void 0?{}:{browserExtensionHost:e.host},...e.connectionTimeoutMs===void 0?{}:{browserExtensionConnectionTimeout:e.connectionTimeoutMs}}),startBridge:h.startExtensionBridge,stopBridge:h.stopExtensionBridge,disconnectExtension:h.disconnectExtension,installArtifacts:h.installExtensionArtifacts,refetchArtifacts:h.refetchExtensionArtifacts,openExtensionChrome:h.openExtensionChrome,revealExtensionFolder:h.revealExtensionFolder})}):null,t[57]=n,t[58]=o,t[59]=h.disconnectExtension,t[60]=h.extension,t[61]=h.extensionArtifacts,t[62]=h.installExtensionArtifacts,t[63]=h.openExtensionChrome,t[64]=h.refetchExtensionArtifacts,t[65]=h.revealExtensionFolder,t[66]=h.startExtensionBridge,t[67]=h.stopExtensionBridge,t[68]=r.browserExtensionConnectionTimeout,t[69]=r.browserExtensionHost,t[70]=r.browserExtensionPort,t[71]=a,t[72]=ee):ee=t[72];let H;t[73]!==n||t[74]!==o||t[75]!==h.applyPlaywrightDoctor||t[76]!==h.playwright||t[77]!==h.refetchPlaywright||t[78]!==l?(H=o===`local`?(0,Z.jsx)(Wt,{children:(0,Z.jsx)(Wa,{embedded:!0,m:n,doctor:h.playwright,refetch:h.refetchPlaywright,applyDoctor:h.applyPlaywrightDoctor,installStream:l})}):null,t[73]=n,t[74]=o,t[75]=h.applyPlaywrightDoctor,t[76]=h.playwright,t[77]=h.refetchPlaywright,t[78]=l,t[79]=H):H=t[79];let U;t[80]!==n||t[81]!==o||t[82]!==u||t[83]!==h.applyCloakDoctor||t[84]!==h.cloak||t[85]!==h.fetchCloakRuntimeStatus||t[86]!==h.launchCloak||t[87]!==h.refetchCloak||t[88]!==r.browserCloakBinaryPath||t[89]!==r.browserCloakCacheDir||t[90]!==r.browserCloakExtraArgs||t[91]!==r.browserCloakFingerprintPlatform||t[92]!==r.browserCloakKeepOpen||t[93]!==r.browserCloakLocale||t[94]!==r.browserCloakTemporaryProfile||t[95]!==r.browserCloakTimezone||t[96]!==r.browserCloakWebrtcIp||t[97]!==r.browserHumanPreset||t[98]!==r.browserHumanize||t[99]!==a?(U=o===`cloakbrowser`?(0,Z.jsx)(Wt,{children:(0,Z.jsx)(ma,{embedded:!0,m:n,doctor:h.cloak,refetch:h.refetchCloak,applyDoctor:h.applyCloakDoctor,installStream:u,fetchRuntimeStatus:h.fetchCloakRuntimeStatus,launchCloak:h.launchCloak,form:{cacheDir:r.browserCloakCacheDir,binaryPath:r.browserCloakBinaryPath,keepOpen:r.browserCloakKeepOpen,temporaryProfile:r.browserCloakTemporaryProfile,humanize:r.browserHumanize,humanPreset:r.browserHumanPreset,timezone:r.browserCloakTimezone,locale:r.browserCloakLocale,webrtcIp:r.browserCloakWebrtcIp,fingerprintPlatform:r.browserCloakFingerprintPlatform,extraArgs:r.browserCloakExtraArgs},onChange:e=>a({...e.cacheDir===void 0?{}:{browserCloakCacheDir:e.cacheDir},...e.binaryPath===void 0?{}:{browserCloakBinaryPath:e.binaryPath},...e.keepOpen===void 0?{}:{browserCloakKeepOpen:e.keepOpen},...e.temporaryProfile===void 0?{}:{browserCloakTemporaryProfile:e.temporaryProfile},...e.humanize===void 0?{}:{browserHumanize:e.humanize},...e.humanPreset===void 0?{}:{browserHumanPreset:e.humanPreset},...e.timezone===void 0?{}:{browserCloakTimezone:e.timezone},...e.locale===void 0?{}:{browserCloakLocale:e.locale},...e.webrtcIp===void 0?{}:{browserCloakWebrtcIp:e.webrtcIp},...e.fingerprintPlatform===void 0?{}:{browserCloakFingerprintPlatform:e.fingerprintPlatform},...e.extraArgs===void 0?{}:{browserCloakExtraArgs:e.extraArgs}})})}):null,t[80]=n,t[81]=o,t[82]=u,t[83]=h.applyCloakDoctor,t[84]=h.cloak,t[85]=h.fetchCloakRuntimeStatus,t[86]=h.launchCloak,t[87]=h.refetchCloak,t[88]=r.browserCloakBinaryPath,t[89]=r.browserCloakCacheDir,t[90]=r.browserCloakExtraArgs,t[91]=r.browserCloakFingerprintPlatform,t[92]=r.browserCloakKeepOpen,t[93]=r.browserCloakLocale,t[94]=r.browserCloakTemporaryProfile,t[95]=r.browserCloakTimezone,t[96]=r.browserCloakWebrtcIp,t[97]=r.browserHumanPreset,t[98]=r.browserHumanize,t[99]=a,t[100]=U):U=t[100];let W;t[101]!==n||t[102]!==o||t[103]!==h.launchCdp||t[104]!==h.listCdpInstances||t[105]!==h.pingCdp||t[106]!==h.stopCdp||t[107]!==r.browserCdpUrl||t[108]!==a?(W=o===`cdp`?(0,Z.jsx)(Wt,{children:(0,Z.jsx)(la,{embedded:!0,m:n,cdpUrl:r.browserCdpUrl,onCdpUrlChange:e=>a({browserCdpUrl:e}),launch:h.launchCdp,stop:h.stopCdp,listInstances:h.listCdpInstances,ping:h.pingCdp})}):null,t[101]=n,t[102]=o,t[103]=h.launchCdp,t[104]=h.listCdpInstances,t[105]=h.pingCdp,t[106]=h.stopCdp,t[107]=r.browserCdpUrl,t[108]=a,t[109]=W):W=t[109];let G;t[110]!==n||t[111]!==o||t[112]!==h.testCloud||t[113]!==r.browserCloudApiKey||t[114]!==r.browserCloudProjectId||t[115]!==r.browserCloudProvider||t[116]!==r.browserCloudRegion||t[117]!==a?(G=o===`cloud`?(0,Z.jsx)(Wt,{children:(0,Z.jsx)(Ra,{embedded:!0,m:n,form:{provider:r.browserCloudProvider,apiKey:r.browserCloudApiKey,projectId:r.browserCloudProjectId,region:r.browserCloudRegion},onChange:e=>a({...e.provider===void 0?{}:{browserCloudProvider:e.provider},...e.apiKey===void 0?{}:{browserCloudApiKey:e.apiKey},...e.projectId===void 0?{}:{browserCloudProjectId:e.projectId},...e.region===void 0?{}:{browserCloudRegion:e.region}}),testCloud:h.testCloud})}):null,t[110]=n,t[111]=o,t[112]=h.testCloud,t[113]=r.browserCloudApiKey,t[114]=r.browserCloudProjectId,t[115]=r.browserCloudProvider,t[116]=r.browserCloudRegion,t[117]=a,t[118]=G):G=t[118];let K;t[119]!==B||t[120]!==V||t[121]!==ee||t[122]!==H||t[123]!==U||t[124]!==W||t[125]!==G?(K=(0,Z.jsxs)(`div`,{className:B,"aria-hidden":V,children:[ee,H,U,W,G]}),t[119]=B,t[120]=V,t[121]=ee,t[122]=H,t[123]=U,t[124]=W,t[125]=G,t[126]=K):K=t[126];let q=K;if(o===`overview`){let e;t[127]!==n||t[128]!==r.browserEnabled||t[129]!==R?(e=r.browserEnabled?null:(0,Z.jsx)(Yi,{m:n,onStart:R}),t[127]=n,t[128]=r.browserEnabled,t[129]=R,t[130]=e):e=t[130];let i;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,"aria-hidden":!0,children:(0,Z.jsx)(te,{className:`size-4`,strokeWidth:1.75})}),t[131]=i):i=t[131];let o;t[132]===a?o=t[133]:(o=e=>a({browserEnabled:e.target.checked}),t[132]=a,t[133]=o);let l;t[134]!==r.browserEnabled||t[135]!==o?(l=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.browserEnabled,onChange:o}),t[134]=r.browserEnabled,t[135]=o,t[136]=l):l=t[136];let u;t[137]===n.browserEnabledOn?u=t[138]:(u=(0,Z.jsx)(`span`,{children:n.browserEnabledOn}),t[137]=n.browserEnabledOn,t[138]=u);let d;t[139]!==l||t[140]!==u?(d=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[l,u]}),t[139]=l,t[140]=u,t[141]=d):d=t[141];let f;t[142]!==n.desc.browserEnabled||t[143]!==n.label.browserEnabled||t[144]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[i,(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)($,{label:n.label.browserEnabled,description:n.desc.browserEnabled,children:d})})]}),t[142]=n.desc.browserEnabled,t[143]=n.label.browserEnabled,t[144]=d,t[145]=f):f=t[145];let p;t[146]!==n.browserDocsLink||t[147]!==c?(p=(0,Z.jsx)(qi,{language:c,label:n.browserDocsLink,className:`shrink-0 pt-1`}),t[146]=n.browserDocsLink,t[147]=c,t[148]=p):p=t[148];let m;t[149]!==f||t[150]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[149]=f,t[150]=p,t[151]=m):m=t[151];let h;t[152]!==n||t[153]!==r.browserBackend||t[154]!==r.browserEnabled||t[155]!==I||t[156]!==s||t[157]!==a?(h=r.browserEnabled?(0,Z.jsx)(`div`,{id:Wi(`connection`),className:Y(`scroll-mt-24 transition-opacity`,!r.browserEnabled&&`pointer-events-none opacity-40`),children:(0,Z.jsx)(Hi,{m:n,value:r.browserBackend,onChange:e=>a({browserBackend:e}),onOpenConfig:s,options:I})}):(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.browserDisabledHint}),t[152]=n,t[153]=r.browserBackend,t[154]=r.browserEnabled,t[155]=I,t[156]=s,t[157]=a,t[158]=h):h=t[158];let g;t[159]!==m||t[160]!==h?(g=(0,Z.jsx)(Wt,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[m,h]})}),t[159]=m,t[160]=h,t[161]=g):g=t[161];let _=!r.browserEnabled&&`pointer-events-none opacity-40`,v;t[162]===_?v=t[163]:(v=Y(`transition-opacity`,_),t[162]=_,t[163]=v);let y=!r.browserEnabled,b;t[164]!==n||t[165]!==r||t[166]!==a?(b=(0,Z.jsx)(Ki,{a:n,form:r,update:a}),t[164]=n,t[165]=r,t[166]=a,t[167]=b):b=t[167];let x;t[168]!==v||t[169]!==y||t[170]!==b?(x=(0,Z.jsx)(`div`,{className:v,"aria-hidden":y,children:b}),t[168]=v,t[169]=y,t[170]=b,t[171]=x):x=t[171];let S;return t[172]!==e||t[173]!==g||t[174]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e,g,x]}),t[172]=e,t[173]=g,t[174]=x,t[175]=S):S=t[175],S}return ia(o)?q:null}function oo(e){return e.language}function so(e){let t=(0,X.c)(61),{sectionId:n,intro:r,vm:o,children:s,tabbed:c}=e,l=c===void 0?!1:c,u=i(co),d;t[0]===u?d=t[1]:(d=a(u),t[0]=u,t[1]=d);let f=d,p=f.agentSettings,m=f.settingsSections[n]??n;if(!o.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ve,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===m?n=t[4]:(n=(0,Z.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:m}),t[3]=m,t[4]=n);let r;t[5]===p.needToken?r=t[6]:(r=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:p.needToken}),t[5]=p.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,Z.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-10`,children:(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,Z.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(o.loading){let e,n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-8 w-48 animate-pulse rounded bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mt-6 h-32 animate-pulse rounded-xl bg-surface-hover`}),t[10]=e,t[11]=n):(e=t[10],n=t[11]);let r;return t[12]===f.logs.loading?r=t[13]:(r=(0,Z.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[e,n,(0,Z.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:f.logs.loading})]}),t[12]=f.logs.loading,t[13]=r),r}if(!o.form){let e=o.error??o.fetchError??p.loadError,n;t[14]===e?n=t[15]:(n=(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[14]=e,t[15]=n);let r;t[16]===o?r=t[17]:(r=()=>void o.mutate(),t[16]=o,t[17]=r);let i;t[18]!==f.logs.refresh||t[19]!==r?(i=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,onClick:r,children:f.logs.refresh}),t[18]=f.logs.refresh,t[19]=r,t[20]=i):i=t[20];let a;return t[21]!==n||t[22]!==i?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-10`,children:[n,i]}),t[21]=n,t[22]=i,t[23]=a):a=t[23],a}let h;t[24]===m?h=t[25]:(h=(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:m}),t[24]=m,t[25]=h);let g;t[26]!==p.sectionDesc||t[27]!==r||t[28]!==l?(g=l?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:p.sectionDesc}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:p.sectionDesc})]}),t[26]=p.sectionDesc,t[27]=r,t[28]=l,t[29]=g):g=t[29];let _;t[30]!==h||t[31]!==g?(_=(0,Z.jsxs)(`div`,{children:[h,g]}),t[30]=h,t[31]=g,t[32]=_):_=t[32];let v;t[33]!==p.saved||t[34]!==o.saveOk?(v=o.saveOk?(0,Z.jsx)(`span`,{className:`text-sm text-fg-muted`,children:p.saved}):null,t[33]=p.saved,t[34]=o.saveOk,t[35]=v):v=t[35];let y=!o.dirty||o.saving,b;t[36]!==p.discard||t[37]!==y||t[38]!==o.discard?(b=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:y,onClick:o.discard,children:p.discard}),t[36]=p.discard,t[37]=y,t[38]=o.discard,t[39]=b):b=t[39];let x=!o.dirty||o.saving,S;t[40]===o?S=t[41]:(S=()=>void o.save(),t[40]=o,t[41]=S);let C=o.saving?p.saving:p.save,w;t[42]!==C||t[43]!==x||t[44]!==S?(w=(0,Z.jsx)(mt,{type:`button`,variant:`primary`,disabled:x,onClick:S,children:C}),t[42]=C,t[43]=x,t[44]=S,t[45]=w):w=t[45];let T;t[46]!==w||t[47]!==v||t[48]!==b?(T=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[v,b,w]}),t[46]=w,t[47]=v,t[48]=b,t[49]=T):T=t[49];let E;t[50]!==T||t[51]!==_?(E=(0,Z.jsxs)(`header`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[_,T]}),t[50]=T,t[51]=_,t[52]=E):E=t[52];let D;t[53]===o.error?D=t[54]:(D=o.error?(0,Z.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:o.error}):null,t[53]=o.error,t[54]=D);let O;t[55]===s?O=t[56]:(O=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:s}),t[55]=s,t[56]=O);let k;return t[57]!==E||t[58]!==D||t[59]!==O?(k=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[E,D,O]}),t[57]=E,t[58]=D,t[59]=O,t[60]=k):k=t[60],k}function co(e){return e.language}var lo=ze();function uo(e){let t=!!_(e=>e.token),[n,r]=(0,Q.useReducer)(lo,{form:null,baseline:null}),i=n.form,a=n.baseline,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(null),{data:m,error:h,isLoading:g,mutate:v}=ue(t);We({enabled:t,parsed:(0,Q.useMemo)(()=>m?.payload?.config===void 0?null:ii(m.payload.config),[m]),dirty:f.current,trackedParsedRef:p,dispatch:r,onResetDirty:()=>{f.current=!1}});let y=!!(t&&g&&m===void 0&&!h),b=h instanceof Error?h.message:h?String(h):null,x=(0,Q.useMemo)(()=>!i||!a?!1:JSON.stringify(i)!==JSON.stringify(a),[i,a]);return{hasToken:t,loading:y,fetchError:b,form:i,update:(0,Q.useCallback)(e=>{f.current=!0,r({type:`patch`,patch:e})},[]),dirty:x,saving:o,saveOk:u,error:c,setError:l,save:(0,Q.useCallback)(async()=>{if(!i||o)return!1;s(!0),l(null),d(!1);try{try{oi(i.paramsJson)}catch(t){return l(t instanceof SyntaxError?e.advanced.paramsInvalidJson:t instanceof Error?t.message:e.advanced.paramsInvalidJson),!1}let t=On(i.typedModels,{invalidId:e.typedModelsInvalidId,duplicateId:e.typedModelsDuplicateId,invalidModel:e.typedModelsInvalidModel});return t?(l(t),!1):(await li(i),f.current=!1,r({type:`saved`,value:i}),d(!0),v(),!0)}catch(t){return l(t instanceof Error?t.message:e.saveError),!1}finally{s(!1)}},[e.saveError,i,v,o]),discard:(0,Q.useCallback)(()=>{f.current=!1,r({type:`discard`}),d(!1),l(null)},[]),mutate:v}}function fo(e,t){return e.browserTabs[t]}function po(){let e=(0,X.c)(44),t=i(mo),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n,o=r.agentSettings,s=r.chat,c=uo(o),[l,u]=It(),d;e[2]===l?d=e[3]:(d=Gi(l.get(`focus`)),e[2]=l,e[3]=d);let f=d,p;e[4]!==f||e[5]!==l?(p=f?na[f]??ra(l.get(`tab`)):ra(l.get(`tab`)),e[4]=f,e[5]=l,e[6]=p):p=e[6];let m=p,h;bb0:{if(!c.form){h=null;break bb0}let t;e[7]!==o||e[8]!==s||e[9]!==c.form||e[10]!==c.update?(t={form:c.form,update:c.update,a:o,chat:s},e[7]=o,e[8]=s,e[9]=c.form,e[10]=c.update,e[11]=t):t=e[11],h=t}let g=h,_;e[12]===u?_=e[13]:(_=e=>{u(t=>{let n=new URLSearchParams(t);return n.delete(`focus`),e===`overview`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[12]=u,e[13]=_);let v=_,y,b;e[14]!==f||e[15]!==l||e[16]!==u?(y=()=>{if(!f)return;let e=na[f]??ra(l.get(`tab`));u(t=>{let n=new URLSearchParams(t);return n.delete(`focus`),e===`overview`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0});let t=f===`runtime`||f===`security`?Wi(f):null;if(!t)return;let n=window.setTimeout(()=>{document.getElementById(t)?.scrollIntoView({behavior:`smooth`,block:`start`})},80);return()=>window.clearTimeout(n)},b=[f,l,u],e[14]=f,e[15]=l,e[16]=u,e[17]=y,e[18]=b):(y=e[17],b=e[18]),(0,Q.useEffect)(y,b);let x=o.browserTabsAria,S;e[19]!==m||e[20]!==v?(S=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=ea[(ea.indexOf(m)+(e.key===`ArrowRight`?1:-1)+ea.length)%ea.length];v(t)},e[19]=m,e[20]=v,e[21]=S):S=e[21];let C;e[22]!==m||e[23]!==o||e[24]!==v?(C=ea.map(e=>{let t=e===m;return(0,Z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,id:`agent-browser-tab-${e}`,"aria-controls":`agent-browser-panel-${e}`,className:Y(`shrink-0 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Ne.press,t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>v(e),children:fo(o,e)},e)}),e[22]=m,e[23]=o,e[24]=v,e[25]=C):C=e[25];let w;e[26]===C?w=e[27]:(w=(0,Z.jsx)(`div`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,children:C}),e[26]=C,e[27]=w);let T=`agent-browser-panel-${m}`,E=`agent-browser-tab-${m}`,D;e[28]!==m||e[29]!==g||e[30]!==v?(D=g?(0,Z.jsx)(ao,{...g,activeTab:m,setActiveTab:v}):null,e[28]=m,e[29]=g,e[30]=v,e[31]=D):D=e[31];let O;e[32]!==T||e[33]!==E||e[34]!==D?(O=(0,Z.jsx)(`div`,{role:`tabpanel`,id:T,"aria-labelledby":E,className:`min-w-0`,children:D}),e[32]=T,e[33]=E,e[34]=D,e[35]=O):O=e[35];let k;e[36]!==o.browserTabsAria||e[37]!==w||e[38]!==O||e[39]!==S?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,role:`tablist`,"aria-label":x,onKeyDown:S,children:[w,O]}),e[36]=o.browserTabsAria,e[37]=w,e[38]=O,e[39]=S,e[40]=k):k=e[40];let A;return e[41]!==k||e[42]!==c?(A=(0,Z.jsx)(so,{sectionId:`agent-browser`,intro:``,vm:c,tabbed:!0,children:k}),e[41]=k,e[42]=c,e[43]=A):A=e[43],A}function mo(e){return e.language}var ho={provider:`skillhub`,storeBaseUrl:`https://store.xopc.ai`},go=[`store`,`skillhub`,`clawhub`];function _o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vo(e){let t=_o(e)?e:{},n=_o(t.gateway)?t.gateway:{},r=typeof n.skillsMarketplaceProvider==`string`?n.skillsMarketplaceProvider.trim().toLowerCase():``;return{provider:go.includes(r)?r:r||ho.provider,storeBaseUrl:typeof n.skillsStoreBaseUrl==`string`&&n.skillsStoreBaseUrl.trim()?n.skillsStoreBaseUrl.trim().replace(/\/+$/,``):ho.storeBaseUrl}}async function yo(e){let t=e.storeBaseUrl.trim().replace(/\/+$/,``);if(!t.startsWith(`http://`)&&!t.startsWith(`https://`))throw Error(`Store base URL must start with http:// or https://`);await v(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{skillsMarketplaceProvider:e.provider.trim(),skillsStoreBaseUrl:t}})}),Lt()}function bo(){return go}function xo(){return Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,Ge,`dark:border-edge`)}var So=ze();function Co({hasToken:e}){let t=a(i(e=>e.language)).skillsMarketplaceSettings,n=bo(),{data:r,isLoading:o}=ue(e),s=(0,Q.useMemo)(()=>r?.payload?.config===void 0?null:vo(r.payload.config),[r]),[c,l]=(0,Q.useReducer)(So,{form:null,baseline:null}),u=c.form,d=c.baseline,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_=(0,Q.useRef)(null);We({enabled:e,parsed:s,dirty:g.current,trackedParsedRef:_,dispatch:l,onResetDirty:()=>{g.current=!1}});let v=u&&d&&JSON.stringify(u)!==JSON.stringify(d),y=(0,Q.useCallback)(e=>{g.current=!0,l({type:`patch`,patch:e})},[]);return!e||!u?o?(0,Z.jsx)(Wt,{children:(0,Z.jsx)(Xe,{className:`size-4 animate-spin text-fg-muted`})}):null:(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ut,{icon:x,title:t.title,subtitle:t.hint}),(0,Z.jsxs)(`div`,{className:`mb-4 flex justify-end gap-2`,children:[(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,disabled:!v||f,onClick:()=>l({type:`discard`}),children:t.discard}),(0,Z.jsx)(mt,{type:`button`,variant:`primary`,disabled:!v||f,onClick:()=>{(async()=>{p(!0),h(null);try{await yo(u),g.current=!1,l({type:`saved`,value:u})}catch(e){h(e instanceof Error?e.message:t.saveError)}finally{p(!1)}})()},children:f?t.saving:t.save})]}),m?(0,Z.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:m}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.provider}),(0,Z.jsx)(`select`,{className:xo(),value:u.provider,onChange:e=>y({provider:e.target.value}),children:n.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.providerHint})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.storeBaseUrl}),(0,Z.jsx)(`input`,{className:Y(xo(),`font-mono text-xs`),value:u.storeBaseUrl,onChange:e=>y({storeBaseUrl:e.target.value})}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.storeBaseUrlHint})]})]})]})}function wo(e,t,n){let r=e.trim();return r?`model:${r}`:`empty:${n.slice(0,t).filter(e=>!e.trim()).length}`}function To(e){let t=(0,X.c)(21),{a:n,chat:r,form:i,update:a}=e,o;t[0]!==n.desc.modelFallbacks||t[1]!==n.label.modelFallbacks?(o=(0,Z.jsx)(Ut,{icon:ve,title:n.label.modelFallbacks,subtitle:n.desc.modelFallbacks}),t[0]=n.desc.modelFallbacks,t[1]=n.label.modelFallbacks,t[2]=o):o=t[2];let s;t[3]!==n.removeModelFallback||t[4]!==r||t[5]!==i.modelFallbacks||t[6]!==a?(s=i.modelFallbacks.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Ke,{value:e,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:e=>{let n=[...i.modelFallbacks];n[t]=e,a({modelFallbacks:n})}})}),(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":n.removeModelFallback,onClick:()=>a({modelFallbacks:i.modelFallbacks.filter((e,n)=>n!==t)}),children:(0,Z.jsx)(me,{className:`size-4`,strokeWidth:1.75})})]},wo(e,t,i.modelFallbacks))),t[3]=n.removeModelFallback,t[4]=r,t[5]=i.modelFallbacks,t[6]=a,t[7]=s):s=t[7];let c;t[8]!==i.modelFallbacks||t[9]!==a?(c=()=>a({modelFallbacks:[...i.modelFallbacks,``]}),t[8]=i.modelFallbacks,t[9]=a,t[10]=c):c=t[10];let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(J,{className:`size-4 shrink-0`,strokeWidth:1.75}),t[11]=l):l=t[11];let u;t[12]!==n.addModelFallback||t[13]!==c?(u=(0,Z.jsxs)(mt,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,onClick:c,children:[l,n.addModelFallback]}),t[12]=n.addModelFallback,t[13]=c,t[14]=u):u=t[14];let d;t[15]!==s||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[s,u]}),t[15]=s,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==o||t[19]!==d?(f=(0,Z.jsxs)(Wt,{children:[o,d]}),t[18]=o,t[19]=d,t[20]=f):f=t[20],f}function Eo(e){let t=(0,X.c)(20),{a:n,chat:r,form:i,update:a}=e,o;t[0]!==n.desc.typedModels||t[1]!==n.label.typedModels?(o=(0,Z.jsx)(Ut,{icon:le,title:n.label.typedModels,subtitle:n.desc.typedModels}),t[0]=n.desc.typedModels,t[1]=n.label.typedModels,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=e=>a({typedModels:e}),t[3]=a,t[4]=s);let c;t[5]!==n.addTypedModel||t[6]!==n.removeTypedModel||t[7]!==n.typedModelDescriptionLabel||t[8]!==n.typedModelDescriptionPlaceholder||t[9]!==n.typedModelIdLabel||t[10]!==n.typedModelIdPlaceholder?(c={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,add:n.addTypedModel,remove:n.removeTypedModel,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder},t[5]=n.addTypedModel,t[6]=n.removeTypedModel,t[7]=n.typedModelDescriptionLabel,t[8]=n.typedModelDescriptionPlaceholder,t[9]=n.typedModelIdLabel,t[10]=n.typedModelIdPlaceholder,t[11]=c):c=t[11];let l;t[12]!==r||t[13]!==i.typedModels||t[14]!==s||t[15]!==c?(l=(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(Cn,{rows:i.typedModels,chat:r,onChange:s,labels:c})}),t[12]=r,t[13]=i.typedModels,t[14]=s,t[15]=c,t[16]=l):l=t[16];let u;return t[17]!==o||t[18]!==l?(u=(0,Z.jsxs)(Wt,{children:[o,l]}),t[17]=o,t[18]=l,t[19]=u):u=t[19],u}function Do(e){let t=(0,X.c)(15),{globalLabel:n,agentLabel:r,sessionLabel:i,globalValue:a,agentValue:o,sessionValue:s}=e,c;t[0]!==n||t[1]!==a?(c={label:n,value:a},t[0]=n,t[1]=a,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==o?(l={label:r,value:o},t[3]=r,t[4]=o,t[5]=l):l=t[5];let u;t[6]!==i||t[7]!==s?(u={label:i,value:s},t[6]=i,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==c||t[10]!==l||t[11]!==u?(d=[c,l,u],t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f=d,p;return t[13]===f?p=t[14]:(p=(0,Z.jsx)(`div`,{className:`grid gap-2 rounded-2xl border border-edge-subtle bg-surface-panel/60 p-3 text-xs sm:grid-cols-[1fr_auto_1fr_auto_1fr]`,children:f.map((e,t)=>(0,Z.jsxs)(`div`,{className:`contents`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg-subtle`,children:e.label}),(0,Z.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:e.value})]}),t<f.length-1?(0,Z.jsx)(`div`,{className:`hidden items-center justify-center text-fg-disabled sm:flex`,"aria-hidden":!0,children:(0,Z.jsx)(Ot,{className:`size-4`,strokeWidth:1.75})}):null]},e.label))}),t[13]=f,t[14]=p),p}function Oo(e){let t=(0,X.c)(33),{a:n,chat:r,form:i,update:a}=e,o;t[0]!==n.cardModelsSubtitle||t[1]!==n.cardModelsTitle?(o=(0,Z.jsx)(Ut,{icon:ve,title:n.cardModelsTitle,subtitle:n.cardModelsSubtitle}),t[0]=n.cardModelsSubtitle,t[1]=n.cardModelsTitle,t[2]=o):o=t[2];let s=i.model||n.modelResolutionUnset,c;t[3]!==n.modelResolutionAgent||t[4]!==n.modelResolutionAgentInherits||t[5]!==n.modelResolutionGlobal||t[6]!==n.modelResolutionSession||t[7]!==n.modelResolutionSessionSelectable||t[8]!==s?(c=(0,Z.jsx)(Do,{globalLabel:n.modelResolutionGlobal,agentLabel:n.modelResolutionAgent,sessionLabel:n.modelResolutionSession,globalValue:s,agentValue:n.modelResolutionAgentInherits,sessionValue:n.modelResolutionSessionSelectable}),t[3]=n.modelResolutionAgent,t[4]=n.modelResolutionAgentInherits,t[5]=n.modelResolutionGlobal,t[6]=n.modelResolutionSession,t[7]=n.modelResolutionSessionSelectable,t[8]=s,t[9]=c):c=t[9];let l;t[10]===a?l=t[11]:(l=e=>a({model:e}),t[10]=a,t[11]=l);let u;t[12]!==r.modelNoMatches||t[13]!==r.modelPlaceholder||t[14]!==r.modelSearchPlaceholder||t[15]!==i.model||t[16]!==l?(u=(0,Z.jsx)(Ke,{value:i.model,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,showProviderSettingsFooter:!0,onChange:l}),t[12]=r.modelNoMatches,t[13]=r.modelPlaceholder,t[14]=r.modelSearchPlaceholder,t[15]=i.model,t[16]=l,t[17]=u):u=t[17];let d;t[18]!==n.desc.model||t[19]!==n.label.model||t[20]!==u?(d=(0,Z.jsx)(`div`,{className:`mt-5 flex flex-col gap-5`,children:(0,Z.jsx)($,{label:n.label.model,description:n.desc.model,children:u})}),t[18]=n.desc.model,t[19]=n.label.model,t[20]=u,t[21]=d):d=t[21];let f;t[22]!==o||t[23]!==c||t[24]!==d?(f=(0,Z.jsxs)(Wt,{children:[o,c,d]}),t[22]=o,t[23]=c,t[24]=d,t[25]=f):f=t[25];let p,m;t[26]===e?(p=t[27],m=t[28]):(p=(0,Z.jsx)(To,{...e}),m=(0,Z.jsx)(Eo,{...e}),t[26]=e,t[27]=p,t[28]=m);let h;return t[29]!==f||t[30]!==p||t[31]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[f,p,m]}),t[29]=f,t[30]=p,t[31]=m,t[32]=h):h=t[32],h}function ko(e){return Array.from(e).flatMap(e=>{let t=e.trim();return t?[t]:[]}).toSorted((e,t)=>e.localeCompare(t))}function Ao(e,t){let n=(0,X.c)(10),r;n[0]!==e||n[1]!==t?(r=[e,t],n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=e&&t,a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3];let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s={enabled:i,initial:a,errorData:o},n[5]=i,n[6]=s);let{data:c,loading:l}=K(jo,r,s),u;return n[7]!==c||n[8]!==l?(u={builtinToolIds:c,loading:l},n[7]=c,n[8]=l,n[9]=u):u=n[9],u}async function jo(){let e=await Se();return Array.isArray(e.builtinToolIds)?e.builtinToolIds:[]}function Mo(e){let t=(0,X.c)(47),{a:n,form:r,update:o}=e,s=n.advanced,c=i(Io),l;t[0]===c?l=t[1]:(l=a(c),t[0]=c,t[1]=l);let u=l.agentsSettings,d=!!_(Fo),{builtinToolIds:f,loading:p}=Ao(!0,d),m;t[2]===r.toolsDisable?m=t[3]:(m=new Set(r.toolsDisable.flatMap(Po)),t[2]=r.toolsDisable,t[3]=m);let h=m,g;t[4]===f?g=t[5]:(g=new Set(f),t[4]=f,t[5]=g);let v=g,y;if(t[6]!==v||t[7]!==r.toolsDisable){let e;t[9]===v?e=t[10]:(e=e=>{let t=e.trim();return t&&!v.has(t)?[t]:[]},t[9]=v,t[10]=e),y=r.toolsDisable.flatMap(e).toSorted(No),t[6]=v,t[7]=r.toolsDisable,t[8]=y}else y=t[8];let b=y,x;t[11]===o?x=t[12]:(x=e=>{o({toolsDisable:ko(e)})},t[11]=o,t[12]=x);let S=x,C=u.toolsDisableGroups,w;t[13]===C?w=t[14]:(w=e=>C[e],t[13]=C,t[14]=w);let T=w,E;t[15]===u.toolDescriptions?E=t[16]:(E=e=>e in u.toolDescriptions?u.toolDescriptions[e]:``,t[15]=u.toolDescriptions,t[16]=E);let D=E,O;t[17]!==s.cardToolsDisableSubtitle||t[18]!==s.cardToolsDisableTitle?(O=(0,Z.jsx)(Ut,{icon:je,title:s.cardToolsDisableTitle,subtitle:s.cardToolsDisableSubtitle}),t[17]=s.cardToolsDisableSubtitle,t[18]=s.cardToolsDisableTitle,t[19]=O):O=t[19];let k;t[20]!==n.needToken||t[21]!==u.toolsLockedByDefaults||t[22]!==f||t[23]!==h||t[24]!==T||t[25]!==D||t[26]!==d||t[27]!==p||t[28]!==S||t[29]!==b||t[30]!==s.toolsDisableEmptyBuiltin||t[31]!==s.toolsDisableLoadingBuiltin||t[32]!==s.toolsDisableNotInBuiltin||t[33]!==s.toolsDisableQuickActionsLabel||t[34]!==s.toolsDisableQuickDisableAll||t[35]!==s.toolsDisableQuickEnableAll||t[36]!==s.toolsDisableQuickHighRiskOff||t[37]!==s.toolsDisableQuickNoOutbound||t[38]!==s.toolsDisableQuickReadOnlyWorkspace?(k=(0,Z.jsx)(`div`,{className:`flex flex-col gap-3`,children:d?(0,Z.jsx)(gr,{mode:`defaults`,builtinToolIds:f,loading:p,disableSet:h,onDisableSetChange:S,unknownDisabledIds:b,getToolDescription:D,getGroupTitle:T,quickActionsDisabled:p,labels:{loadingBuiltin:s.toolsDisableLoadingBuiltin,emptyBuiltin:s.toolsDisableEmptyBuiltin,quickActionsLabel:s.toolsDisableQuickActionsLabel,quickEnableAll:s.toolsDisableQuickEnableAll,quickDisableAll:s.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:s.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:s.toolsDisableQuickHighRiskOff,quickNoOutbound:s.toolsDisableQuickNoOutbound,notInBuiltin:s.toolsDisableNotInBuiltin,lockedByDefaults:u.toolsLockedByDefaults}}):(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.needToken})}),t[20]=n.needToken,t[21]=u.toolsLockedByDefaults,t[22]=f,t[23]=h,t[24]=T,t[25]=D,t[26]=d,t[27]=p,t[28]=S,t[29]=b,t[30]=s.toolsDisableEmptyBuiltin,t[31]=s.toolsDisableLoadingBuiltin,t[32]=s.toolsDisableNotInBuiltin,t[33]=s.toolsDisableQuickActionsLabel,t[34]=s.toolsDisableQuickDisableAll,t[35]=s.toolsDisableQuickEnableAll,t[36]=s.toolsDisableQuickHighRiskOff,t[37]=s.toolsDisableQuickNoOutbound,t[38]=s.toolsDisableQuickReadOnlyWorkspace,t[39]=k):k=t[39];let A;t[40]!==k||t[41]!==s.toolsDisableFieldLabel||t[42]!==s.toolsDisableHint?(A=(0,Z.jsx)($,{label:s.toolsDisableFieldLabel,description:s.toolsDisableHint,children:k}),t[40]=k,t[41]=s.toolsDisableFieldLabel,t[42]=s.toolsDisableHint,t[43]=A):A=t[43];let j;return t[44]!==O||t[45]!==A?(j=(0,Z.jsxs)(Wt,{children:[O,A]}),t[44]=O,t[45]=A,t[46]=j):j=t[46],j}function No(e,t){return e.localeCompare(t)}function Po(e){let t=e.trim();return t?[t]:[]}function Fo(e){return e.token}function Io(e){return e.language}function Lo(e){let t=(0,X.c)(78),{a:n,chat:r,form:i,update:a}=e,o=n.advanced,s;t[0]!==o.cardWebExtractSubtitle||t[1]!==o.cardWebExtractTitle?(s=(0,Z.jsx)(Ut,{icon:G,title:o.cardWebExtractTitle,subtitle:o.cardWebExtractSubtitle}),t[0]=o.cardWebExtractSubtitle,t[1]=o.cardWebExtractTitle,t[2]=s):s=t[2];let c;t[3]!==i.webExtract||t[4]!==a?(c=e=>a({webExtract:{...i.webExtract,model:e}}),t[3]=i.webExtract,t[4]=a,t[5]=c):c=t[5];let l;t[6]!==r.modelNoMatches||t[7]!==r.modelPlaceholder||t[8]!==r.modelSearchPlaceholder||t[9]!==i.webExtract.model||t[10]!==c?(l=(0,Z.jsx)(Ke,{value:i.webExtract.model,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:c}),t[6]=r.modelNoMatches,t[7]=r.modelPlaceholder,t[8]=r.modelSearchPlaceholder,t[9]=i.webExtract.model,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==l||t[13]!==o.webExtractModel||t[14]!==o.webExtractModelDesc?(u=(0,Z.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Z.jsx)($,{label:o.webExtractModel,description:o.webExtractModelDesc,children:l})}),t[12]=l,t[13]=o.webExtractModel,t[14]=o.webExtractModelDesc,t[15]=u):u=t[15];let d=o.webExtractMaxLength,f=o.webExtractMaxLengthDesc,p;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(p=bn(),t[16]=p):p=t[16];let m=i.webExtract.maxLength??``,h;t[17]!==i.webExtract||t[18]!==a?(h=e=>{let t=e.target.value;a({webExtract:{...i.webExtract,maxLength:t===``?void 0:Number.parseInt(t,10)}})},t[17]=i.webExtract,t[18]=a,t[19]=h):h=t[19];let g;t[20]!==m||t[21]!==h?(g=(0,Z.jsx)(`input`,{type:`number`,className:p,min:1,value:m,placeholder:`—`,onChange:h}),t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;t[23]!==g||t[24]!==o.webExtractMaxLength||t[25]!==o.webExtractMaxLengthDesc?(_=(0,Z.jsx)($,{label:d,description:f,children:g}),t[23]=g,t[24]=o.webExtractMaxLength,t[25]=o.webExtractMaxLengthDesc,t[26]=_):_=t[26];let v;t[27]!==_||t[28]!==u?(v=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[u,_]}),t[27]=_,t[28]=u,t[29]=v):v=t[29];let y;t[30]!==s||t[31]!==v?(y=(0,Z.jsxs)(Wt,{children:[s,v]}),t[30]=s,t[31]=v,t[32]=y):y=t[32];let b;t[33]!==o.cardDelegateSubtitle||t[34]!==o.cardDelegateTitle?(b=(0,Z.jsx)(Ut,{icon:ge,title:o.cardDelegateTitle,subtitle:o.cardDelegateSubtitle}),t[33]=o.cardDelegateSubtitle,t[34]=o.cardDelegateTitle,t[35]=b):b=t[35];let x;t[36]!==i.delegate||t[37]!==a?(x=e=>a({delegate:{...i.delegate,enabled:e.target.checked}}),t[36]=i.delegate,t[37]=a,t[38]=x):x=t[38];let S;t[39]!==i.delegate.enabled||t[40]!==x?(S=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.delegate.enabled,onChange:x}),t[39]=i.delegate.enabled,t[40]=x,t[41]=S):S=t[41];let C;t[42]===o.delegateEnabledOn?C=t[43]:(C=(0,Z.jsx)(`span`,{children:o.delegateEnabledOn}),t[42]=o.delegateEnabledOn,t[43]=C);let w;t[44]!==S||t[45]!==C?(w=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[S,C]}),t[44]=S,t[45]=C,t[46]=w):w=t[46];let T;t[47]!==w||t[48]!==o.delegateEnabled||t[49]!==o.delegateEnabledDesc?(T=(0,Z.jsx)($,{label:o.delegateEnabled,description:o.delegateEnabledDesc,children:w}),t[47]=w,t[48]=o.delegateEnabled,t[49]=o.delegateEnabledDesc,t[50]=T):T=t[50];let E;t[51]!==i.executeCode||t[52]!==a?(E=e=>a({executeCode:{...i.executeCode,enabled:e.target.checked}}),t[51]=i.executeCode,t[52]=a,t[53]=E):E=t[53];let D;t[54]!==i.executeCode.enabled||t[55]!==E?(D=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.executeCode.enabled,onChange:E}),t[54]=i.executeCode.enabled,t[55]=E,t[56]=D):D=t[56];let O;t[57]===o.executeCodeEnabledOn?O=t[58]:(O=(0,Z.jsx)(`span`,{children:o.executeCodeEnabledOn}),t[57]=o.executeCodeEnabledOn,t[58]=O);let k;t[59]!==D||t[60]!==O?(k=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[D,O]}),t[59]=D,t[60]=O,t[61]=k):k=t[61];let A;t[62]!==k||t[63]!==o.executeCodeEnabled||t[64]!==o.executeCodeEnabledDesc?(A=(0,Z.jsx)($,{label:o.executeCodeEnabled,description:o.executeCodeEnabledDesc,children:k}),t[62]=k,t[63]=o.executeCodeEnabled,t[64]=o.executeCodeEnabledDesc,t[65]=A):A=t[65];let j;t[66]!==T||t[67]!==A?(j=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[T,A]}),t[66]=T,t[67]=A,t[68]=j):j=t[68];let M;t[69]!==b||t[70]!==j?(M=(0,Z.jsxs)(Wt,{children:[b,j]}),t[69]=b,t[70]=j,t[71]=M):M=t[71];let N;t[72]===e?N=t[73]:(N=(0,Z.jsx)(Mo,{...e}),t[72]=e,t[73]=N);let P;return t[74]!==y||t[75]!==M||t[76]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[y,M,N]}),t[74]=y,t[75]=M,t[76]=N,t[77]=P):P=t[77],P}function Ro(e){let t=(0,X.c)(16),{showLabel:n,hideLabel:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=Y(`group rounded-lg border border-edge-subtle/80 bg-surface-hover/20 open:pb-3 dark:border-edge-subtle`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Qe,{className:`size-4 shrink-0 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=(0,Z.jsx)(`span`,{className:`group-open:hidden`,children:n}),t[3]=n,t[4]=c);let l;t[5]===r?l=t[6]:(l=(0,Z.jsx)(`span`,{className:`hidden group-open:inline`,children:r}),t[5]=r,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg group-open:rounded-b-none [&::-webkit-details-marker]:hidden`,children:[s,c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]===i?d=t[11]:(d=(0,Z.jsx)(`div`,{className:`flex flex-col gap-5 px-3 pt-3`,children:i}),t[10]=i,t[11]=d);let f;return t[12]!==o||t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(`details`,{className:o,children:[u,d]}),t[12]=o,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function zo(e){let t=(0,X.c)(187),{a:n,form:r,update:i}=e,a=n.advanced,o;t[0]!==a.cardCompactionSubtitle||t[1]!==a.cardCompactionTitle?(o=(0,Z.jsx)(Ut,{icon:C,title:a.cardCompactionTitle,subtitle:a.cardCompactionSubtitle}),t[0]=a.cardCompactionSubtitle,t[1]=a.cardCompactionTitle,t[2]=o):o=t[2];let s;t[3]!==r.compaction||t[4]!==i?(s=e=>i({compaction:{...r.compaction,enabled:e.target.checked}}),t[3]=r.compaction,t[4]=i,t[5]=s):s=t[5];let c;t[6]!==r.compaction.enabled||t[7]!==s?(c=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.compaction.enabled,onChange:s}),t[6]=r.compaction.enabled,t[7]=s,t[8]=c):c=t[8];let l;t[9]===a.compactionEnabledOn?l=t[10]:(l=(0,Z.jsx)(`span`,{children:a.compactionEnabledOn}),t[9]=a.compactionEnabledOn,t[10]=l);let u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]!==u||t[15]!==a.compactionEnabled||t[16]!==a.compactionEnabledDesc?(d=(0,Z.jsx)($,{label:a.compactionEnabled,description:a.compactionEnabledDesc,children:u}),t[14]=u,t[15]=a.compactionEnabled,t[16]=a.compactionEnabledDesc,t[17]=d):d=t[17];let f=a.compactionMode,p=a.compactionModeDesc,m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=xn(),t[18]=m):m=t[18];let h;t[19]!==r.compaction||t[20]!==i?(h=e=>i({compaction:{...r.compaction,mode:e.target.value}}),t[19]=r.compaction,t[20]=i,t[21]=h):h=t[21];let g;t[22]===a.compactionModeDefault?g=t[23]:(g=(0,Z.jsx)(`option`,{value:`default`,children:a.compactionModeDefault}),t[22]=a.compactionModeDefault,t[23]=g);let _;t[24]===a.compactionModeSafeguard?_=t[25]:(_=(0,Z.jsx)(`option`,{value:`safeguard`,children:a.compactionModeSafeguard}),t[24]=a.compactionModeSafeguard,t[25]=_);let v;t[26]!==r.compaction.mode||t[27]!==g||t[28]!==_||t[29]!==h?(v=(0,Z.jsxs)(`select`,{className:m,value:r.compaction.mode,onChange:h,children:[g,_]}),t[26]=r.compaction.mode,t[27]=g,t[28]=_,t[29]=h,t[30]=v):v=t[30];let y;t[31]!==v||t[32]!==a.compactionMode||t[33]!==a.compactionModeDesc?(y=(0,Z.jsx)($,{label:f,description:p,children:v}),t[31]=v,t[32]=a.compactionMode,t[33]=a.compactionModeDesc,t[34]=y):y=t[34];let b=a.advancedOptionsShow,x=a.advancedOptionsHide,S=a.reserveTokens,w=a.reserveTokensDesc,T;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(T=bn(),t[35]=T):T=t[35];let E;t[36]!==r.compaction||t[37]!==i?(E=e=>i({compaction:{...r.compaction,reserveTokens:Number.parseInt(e.target.value,10)||0}}),t[36]=r.compaction,t[37]=i,t[38]=E):E=t[38];let D;t[39]!==r.compaction.reserveTokens||t[40]!==E?(D=(0,Z.jsx)(`input`,{type:`number`,className:T,min:1e3,value:r.compaction.reserveTokens,onChange:E}),t[39]=r.compaction.reserveTokens,t[40]=E,t[41]=D):D=t[41];let O;t[42]!==D||t[43]!==a.reserveTokens||t[44]!==a.reserveTokensDesc?(O=(0,Z.jsx)($,{label:S,description:w,children:D}),t[42]=D,t[43]=a.reserveTokens,t[44]=a.reserveTokensDesc,t[45]=O):O=t[45];let k=a.triggerThreshold,A=a.triggerThresholdDesc,j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=bn(),t[46]=j):j=t[46];let M;t[47]!==r.compaction||t[48]!==i?(M=e=>i({compaction:{...r.compaction,triggerThreshold:Number.parseFloat(e.target.value)||.8}}),t[47]=r.compaction,t[48]=i,t[49]=M):M=t[49];let N;t[50]!==r.compaction.triggerThreshold||t[51]!==M?(N=(0,Z.jsx)(`input`,{type:`number`,className:j,min:.5,max:.95,step:.05,value:r.compaction.triggerThreshold,onChange:M}),t[50]=r.compaction.triggerThreshold,t[51]=M,t[52]=N):N=t[52];let P;t[53]!==N||t[54]!==a.triggerThreshold||t[55]!==a.triggerThresholdDesc?(P=(0,Z.jsx)($,{label:k,description:A,children:N}),t[53]=N,t[54]=a.triggerThreshold,t[55]=a.triggerThresholdDesc,t[56]=P):P=t[56];let F=a.minMessagesBeforeCompact,I=a.minMessagesBeforeCompactDesc,L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=bn(),t[57]=L):L=t[57];let R;t[58]!==r.compaction||t[59]!==i?(R=e=>i({compaction:{...r.compaction,minMessagesBeforeCompact:Number.parseInt(e.target.value,10)||10}}),t[58]=r.compaction,t[59]=i,t[60]=R):R=t[60];let z;t[61]!==r.compaction.minMessagesBeforeCompact||t[62]!==R?(z=(0,Z.jsx)(`input`,{type:`number`,className:L,min:1,value:r.compaction.minMessagesBeforeCompact,onChange:R}),t[61]=r.compaction.minMessagesBeforeCompact,t[62]=R,t[63]=z):z=t[63];let B;t[64]!==z||t[65]!==a.minMessagesBeforeCompact||t[66]!==a.minMessagesBeforeCompactDesc?(B=(0,Z.jsx)($,{label:F,description:I,children:z}),t[64]=z,t[65]=a.minMessagesBeforeCompact,t[66]=a.minMessagesBeforeCompactDesc,t[67]=B):B=t[67];let ee=a.keepRecentMessages,H=a.keepRecentMessagesDesc,U;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(U=bn(),t[68]=U):U=t[68];let W;t[69]!==r.compaction||t[70]!==i?(W=e=>i({compaction:{...r.compaction,keepRecentMessages:Number.parseInt(e.target.value,10)||5}}),t[69]=r.compaction,t[70]=i,t[71]=W):W=t[71];let G;t[72]!==r.compaction.keepRecentMessages||t[73]!==W?(G=(0,Z.jsx)(`input`,{type:`number`,className:U,min:0,value:r.compaction.keepRecentMessages,onChange:W}),t[72]=r.compaction.keepRecentMessages,t[73]=W,t[74]=G):G=t[74];let K;t[75]!==G||t[76]!==a.keepRecentMessages||t[77]!==a.keepRecentMessagesDesc?(K=(0,Z.jsx)($,{label:ee,description:H,children:G}),t[75]=G,t[76]=a.keepRecentMessages,t[77]=a.keepRecentMessagesDesc,t[78]=K):K=t[78];let q=a.evictionWindow,te=a.evictionWindowDesc,ne;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(ne=bn(),t[79]=ne):ne=t[79];let re;t[80]!==r.compaction||t[81]!==i?(re=e=>i({compaction:{...r.compaction,evictionWindow:Number.parseFloat(e.target.value)||.2}}),t[80]=r.compaction,t[81]=i,t[82]=re):re=t[82];let ie;t[83]!==r.compaction.evictionWindow||t[84]!==re?(ie=(0,Z.jsx)(`input`,{type:`number`,className:ne,min:.1,max:.5,step:.05,value:r.compaction.evictionWindow,onChange:re}),t[83]=r.compaction.evictionWindow,t[84]=re,t[85]=ie):ie=t[85];let ae;t[86]!==ie||t[87]!==a.evictionWindow||t[88]!==a.evictionWindowDesc?(ae=(0,Z.jsx)($,{label:q,description:te,children:ie}),t[86]=ie,t[87]=a.evictionWindow,t[88]=a.evictionWindowDesc,t[89]=ae):ae=t[89];let oe=a.retentionWindow,se=a.retentionWindowDesc,ce;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ce=bn(),t[90]=ce):ce=t[90];let le;t[91]!==r.compaction||t[92]!==i?(le=e=>i({compaction:{...r.compaction,retentionWindow:Number.parseInt(e.target.value,10)||6}}),t[91]=r.compaction,t[92]=i,t[93]=le):le=t[93];let ue;t[94]!==r.compaction.retentionWindow||t[95]!==le?(ue=(0,Z.jsx)(`input`,{type:`number`,className:ce,min:3,max:20,value:r.compaction.retentionWindow,onChange:le}),t[94]=r.compaction.retentionWindow,t[95]=le,t[96]=ue):ue=t[96];let de;t[97]!==ue||t[98]!==a.retentionWindow||t[99]!==a.retentionWindowDesc?(de=(0,Z.jsx)($,{label:oe,description:se,children:ue}),t[97]=ue,t[98]=a.retentionWindow,t[99]=a.retentionWindowDesc,t[100]=de):de=t[100];let fe;t[101]!==O||t[102]!==P||t[103]!==B||t[104]!==K||t[105]!==ae||t[106]!==de?(fe=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[O,P,B,K,ae,de]}),t[101]=O,t[102]=P,t[103]=B,t[104]=K,t[105]=ae,t[106]=de,t[107]=fe):fe=t[107];let pe;t[108]!==fe||t[109]!==a.advancedOptionsHide||t[110]!==a.advancedOptionsShow?(pe=(0,Z.jsx)(Ro,{showLabel:b,hideLabel:x,children:fe}),t[108]=fe,t[109]=a.advancedOptionsHide,t[110]=a.advancedOptionsShow,t[111]=pe):pe=t[111];let me;t[112]!==y||t[113]!==d||t[114]!==pe?(me=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[d,y,pe]}),t[112]=y,t[113]=d,t[114]=pe,t[115]=me):me=t[115];let he;t[116]!==o||t[117]!==me?(he=(0,Z.jsxs)(Wt,{children:[o,me]}),t[116]=o,t[117]=me,t[118]=he):he=t[118];let ge;t[119]!==a.cardPruningSubtitle||t[120]!==a.cardPruningTitle?(ge=(0,Z.jsx)(Ut,{icon:V,title:a.cardPruningTitle,subtitle:a.cardPruningSubtitle}),t[119]=a.cardPruningSubtitle,t[120]=a.cardPruningTitle,t[121]=ge):ge=t[121];let _e;t[122]!==r.pruning||t[123]!==i?(_e=e=>i({pruning:{...r.pruning,enabled:e.target.checked}}),t[122]=r.pruning,t[123]=i,t[124]=_e):_e=t[124];let ve;t[125]!==r.pruning.enabled||t[126]!==_e?(ve=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.pruning.enabled,onChange:_e}),t[125]=r.pruning.enabled,t[126]=_e,t[127]=ve):ve=t[127];let ye;t[128]===a.pruningEnabledOn?ye=t[129]:(ye=(0,Z.jsx)(`span`,{children:a.pruningEnabledOn}),t[128]=a.pruningEnabledOn,t[129]=ye);let be;t[130]!==ve||t[131]!==ye?(be=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[ve,ye]}),t[130]=ve,t[131]=ye,t[132]=be):be=t[132];let xe;t[133]!==be||t[134]!==a.pruningEnabled||t[135]!==a.pruningEnabledDesc?(xe=(0,Z.jsx)($,{label:a.pruningEnabled,description:a.pruningEnabledDesc,children:be}),t[133]=be,t[134]=a.pruningEnabled,t[135]=a.pruningEnabledDesc,t[136]=xe):xe=t[136];let Se=a.maxToolResultChars,Ce=a.maxToolResultCharsDesc,we;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(we=bn(),t[137]=we):we=t[137];let Te;t[138]!==r.pruning||t[139]!==i?(Te=e=>i({pruning:{...r.pruning,maxToolResultChars:Number.parseInt(e.target.value,10)||1e4}}),t[138]=r.pruning,t[139]=i,t[140]=Te):Te=t[140];let Ee;t[141]!==r.pruning.maxToolResultChars||t[142]!==Te?(Ee=(0,Z.jsx)(`input`,{type:`number`,className:we,min:1e3,value:r.pruning.maxToolResultChars,onChange:Te}),t[141]=r.pruning.maxToolResultChars,t[142]=Te,t[143]=Ee):Ee=t[143];let De;t[144]!==Ee||t[145]!==a.maxToolResultChars||t[146]!==a.maxToolResultCharsDesc?(De=(0,Z.jsx)($,{label:Se,description:Ce,children:Ee}),t[144]=Ee,t[145]=a.maxToolResultChars,t[146]=a.maxToolResultCharsDesc,t[147]=De):De=t[147];let Oe=a.advancedOptionsShow,ke=a.advancedOptionsHide,Ae=a.headKeepRatio,je=a.headKeepRatioDesc,Me;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(Me=bn(),t[148]=Me):Me=t[148];let Ne;t[149]!==r.pruning||t[150]!==i?(Ne=e=>i({pruning:{...r.pruning,headKeepRatio:Number.parseFloat(e.target.value)||.3}}),t[149]=r.pruning,t[150]=i,t[151]=Ne):Ne=t[151];let Pe;t[152]!==r.pruning.headKeepRatio||t[153]!==Ne?(Pe=(0,Z.jsx)(`input`,{type:`number`,className:Me,min:0,max:1,step:.05,value:r.pruning.headKeepRatio,onChange:Ne}),t[152]=r.pruning.headKeepRatio,t[153]=Ne,t[154]=Pe):Pe=t[154];let Fe;t[155]!==Pe||t[156]!==a.headKeepRatio||t[157]!==a.headKeepRatioDesc?(Fe=(0,Z.jsx)($,{label:Ae,description:je,children:Pe}),t[155]=Pe,t[156]=a.headKeepRatio,t[157]=a.headKeepRatioDesc,t[158]=Fe):Fe=t[158];let Ie=a.tailKeepRatio,Le=a.tailKeepRatioDesc,Re;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(Re=bn(),t[159]=Re):Re=t[159];let ze;t[160]!==r.pruning||t[161]!==i?(ze=e=>i({pruning:{...r.pruning,tailKeepRatio:Number.parseFloat(e.target.value)||.3}}),t[160]=r.pruning,t[161]=i,t[162]=ze):ze=t[162];let Be;t[163]!==r.pruning.tailKeepRatio||t[164]!==ze?(Be=(0,Z.jsx)(`input`,{type:`number`,className:Re,min:0,max:1,step:.05,value:r.pruning.tailKeepRatio,onChange:ze}),t[163]=r.pruning.tailKeepRatio,t[164]=ze,t[165]=Be):Be=t[165];let J;t[166]!==Be||t[167]!==a.tailKeepRatio||t[168]!==a.tailKeepRatioDesc?(J=(0,Z.jsx)($,{label:Ie,description:Le,children:Be}),t[166]=Be,t[167]=a.tailKeepRatio,t[168]=a.tailKeepRatioDesc,t[169]=J):J=t[169];let Ve;t[170]!==Fe||t[171]!==J?(Ve=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[Fe,J]}),t[170]=Fe,t[171]=J,t[172]=Ve):Ve=t[172];let He;t[173]!==Ve||t[174]!==a.advancedOptionsHide||t[175]!==a.advancedOptionsShow?(He=(0,Z.jsx)(Ro,{showLabel:Oe,hideLabel:ke,children:Ve}),t[173]=Ve,t[174]=a.advancedOptionsHide,t[175]=a.advancedOptionsShow,t[176]=He):He=t[176];let Ue;t[177]!==xe||t[178]!==De||t[179]!==He?(Ue=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[xe,De,He]}),t[177]=xe,t[178]=De,t[179]=He,t[180]=Ue):Ue=t[180];let We;t[181]!==ge||t[182]!==Ue?(We=(0,Z.jsxs)(Wt,{children:[ge,Ue]}),t[181]=ge,t[182]=Ue,t[183]=We):We=t[183];let Ge;return t[184]!==he||t[185]!==We?(Ge=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[he,We]}),t[184]=he,t[185]=We,t[186]=Ge):Ge=t[186],Ge}function Bo(e){let t=(0,X.c)(16),{a:n,form:r,update:i}=e,a=n.advanced,o;t[0]!==a.cardParamsSubtitle||t[1]!==a.cardParamsTitle?(o=(0,Z.jsx)(Ut,{icon:k,title:a.cardParamsTitle,subtitle:a.cardParamsSubtitle}),t[0]=a.cardParamsSubtitle,t[1]=a.cardParamsTitle,t[2]=o):o=t[2];let s=a.paramsJson,c=a.paramsJsonDesc,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=Y(bn(),`min-h-[88px] resize-y font-mono text-xs`),t[3]=l):l=t[3];let u;t[4]===i?u=t[5]:(u=e=>i({paramsJson:e.target.value}),t[4]=i,t[5]=u);let d;t[6]!==r.paramsJson||t[7]!==u?(d=(0,Z.jsx)(`textarea`,{className:l,value:r.paramsJson,placeholder:`{}`,onChange:u}),t[6]=r.paramsJson,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==d||t[10]!==a.paramsJson||t[11]!==a.paramsJsonDesc?(f=(0,Z.jsx)($,{label:s,description:c,children:d}),t[9]=d,t[10]=a.paramsJson,t[11]=a.paramsJsonDesc,t[12]=f):f=t[12];let p;return t[13]!==o||t[14]!==f?(p=(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:(0,Z.jsxs)(Wt,{children:[o,f]})}),t[13]=o,t[14]=f,t[15]=p):p=t[15],p}var Vo=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`adaptive`];function Ho(e){let t=(0,X.c)(93),{a:n,chat:r,form:i,update:a}=e,o;t[0]!==n.cardGenerationSubtitle||t[1]!==n.cardGenerationTitle?(o=(0,Z.jsx)(Ut,{icon:P,title:n.cardGenerationTitle,subtitle:n.cardGenerationSubtitle}),t[0]=n.cardGenerationSubtitle,t[1]=n.cardGenerationTitle,t[2]=o):o=t[2];let s=n.label.maxTokens,c=n.desc.maxTokens,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=bn(),t[3]=l):l=t[3];let u;t[4]===a?u=t[5]:(u=e=>a({maxTokens:Number.parseInt(e.target.value,10)||0}),t[4]=a,t[5]=u);let d;t[6]!==i.maxTokens||t[7]!==u?(d=(0,Z.jsx)(`input`,{type:`number`,className:l,value:i.maxTokens,min:1,onChange:u}),t[6]=i.maxTokens,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==n.desc.maxTokens||t[10]!==n.label.maxTokens||t[11]!==d?(f=(0,Z.jsx)($,{label:s,description:c,children:d}),t[9]=n.desc.maxTokens,t[10]=n.label.maxTokens,t[11]=d,t[12]=f):f=t[12];let p=n.label.temperature,m=n.desc.temperature,h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=bn(),t[13]=h):h=t[13];let g;t[14]===a?g=t[15]:(g=e=>a({temperature:Number.parseFloat(e.target.value)||0}),t[14]=a,t[15]=g);let _;t[16]!==i.temperature||t[17]!==g?(_=(0,Z.jsx)(`input`,{type:`number`,className:h,value:i.temperature,min:0,max:2,step:.1,onChange:g}),t[16]=i.temperature,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.desc.temperature||t[20]!==n.label.temperature||t[21]!==_?(v=(0,Z.jsx)($,{label:p,description:m,children:_}),t[19]=n.desc.temperature,t[20]=n.label.temperature,t[21]=_,t[22]=v):v=t[22];let y;t[23]!==v||t[24]!==f?(y=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[f,v]}),t[23]=v,t[24]=f,t[25]=y):y=t[25];let b;t[26]!==o||t[27]!==y?(b=(0,Z.jsxs)(Wt,{children:[o,y]}),t[26]=o,t[27]=y,t[28]=b):b=t[28];let x;t[29]!==n.cardBehaviorSubtitle||t[30]!==n.cardBehaviorTitle?(x=(0,Z.jsx)(Ut,{icon:Ze,title:n.cardBehaviorTitle,subtitle:n.cardBehaviorSubtitle}),t[29]=n.cardBehaviorSubtitle,t[30]=n.cardBehaviorTitle,t[31]=x):x=t[31];let S=n.label.thinkingDefault,C=n.desc.thinkingDefault,w;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(w=xn(),t[32]=w):w=t[32];let T=i.thinkingDefault,E;t[33]===a?E=t[34]:(E=e=>a({thinkingDefault:e.target.value}),t[33]=a,t[34]=E);let D;t[35]===r?D=t[36]:(D=Vo.map(e=>(0,Z.jsx)(`option`,{value:e,children:r.thinkingLevels[e]},e)),t[35]=r,t[36]=D);let O;t[37]!==i.thinkingDefault||t[38]!==E||t[39]!==D?(O=(0,Z.jsx)(`select`,{className:w,value:T,onChange:E,children:D}),t[37]=i.thinkingDefault,t[38]=E,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==n.desc.thinkingDefault||t[42]!==n.label.thinkingDefault||t[43]!==O?(k=(0,Z.jsx)($,{label:S,description:C,children:O}),t[41]=n.desc.thinkingDefault,t[42]=n.label.thinkingDefault,t[43]=O,t[44]=k):k=t[44];let A=n.label.reasoningDefault,j=n.desc.reasoningDefault,M;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(M=xn(),t[45]=M):M=t[45];let N;t[46]===a?N=t[47]:(N=e=>a({reasoningDefault:e.target.value}),t[46]=a,t[47]=N);let F;t[48]===n.reasoning.off?F=t[49]:(F=(0,Z.jsx)(`option`,{value:`off`,children:n.reasoning.off}),t[48]=n.reasoning.off,t[49]=F);let I;t[50]===n.reasoning.on?I=t[51]:(I=(0,Z.jsx)(`option`,{value:`on`,children:n.reasoning.on}),t[50]=n.reasoning.on,t[51]=I);let L;t[52]===n.reasoning.stream?L=t[53]:(L=(0,Z.jsx)(`option`,{value:`stream`,children:n.reasoning.stream}),t[52]=n.reasoning.stream,t[53]=L);let R;t[54]!==i.reasoningDefault||t[55]!==N||t[56]!==F||t[57]!==I||t[58]!==L?(R=(0,Z.jsxs)(`select`,{className:M,value:i.reasoningDefault,onChange:N,children:[F,I,L]}),t[54]=i.reasoningDefault,t[55]=N,t[56]=F,t[57]=I,t[58]=L,t[59]=R):R=t[59];let z;t[60]!==n.desc.reasoningDefault||t[61]!==n.label.reasoningDefault||t[62]!==R?(z=(0,Z.jsx)($,{label:A,description:j,children:R}),t[60]=n.desc.reasoningDefault,t[61]=n.label.reasoningDefault,t[62]=R,t[63]=z):z=t[63];let B=n.label.verboseDefault,V=n.desc.verboseDefault,ee;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ee=xn(),t[64]=ee):ee=t[64];let H;t[65]===a?H=t[66]:(H=e=>a({verboseDefault:e.target.value}),t[65]=a,t[66]=H);let U;t[67]===n.verbose.off?U=t[68]:(U=(0,Z.jsx)(`option`,{value:`off`,children:n.verbose.off}),t[67]=n.verbose.off,t[68]=U);let W;t[69]===n.verbose.on?W=t[70]:(W=(0,Z.jsx)(`option`,{value:`on`,children:n.verbose.on}),t[69]=n.verbose.on,t[70]=W);let G;t[71]===n.verbose.full?G=t[72]:(G=(0,Z.jsx)(`option`,{value:`full`,children:n.verbose.full}),t[71]=n.verbose.full,t[72]=G);let K;t[73]!==i.verboseDefault||t[74]!==H||t[75]!==U||t[76]!==W||t[77]!==G?(K=(0,Z.jsxs)(`select`,{className:ee,value:i.verboseDefault,onChange:H,children:[U,W,G]}),t[73]=i.verboseDefault,t[74]=H,t[75]=U,t[76]=W,t[77]=G,t[78]=K):K=t[78];let q;t[79]!==n.desc.verboseDefault||t[80]!==n.label.verboseDefault||t[81]!==K?(q=(0,Z.jsx)($,{label:B,description:V,children:K}),t[79]=n.desc.verboseDefault,t[80]=n.label.verboseDefault,t[81]=K,t[82]=q):q=t[82];let te;t[83]!==k||t[84]!==z||t[85]!==q?(te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[k,z,q]}),t[83]=k,t[84]=z,t[85]=q,t[86]=te):te=t[86];let ne;t[87]!==x||t[88]!==te?(ne=(0,Z.jsxs)(Wt,{children:[x,te]}),t[87]=x,t[88]=te,t[89]=ne):ne=t[89];let re;return t[90]!==b||t[91]!==ne?(re=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[b,ne]}),t[90]=b,t[91]=ne,t[92]=re):re=t[92],re}function Uo(e){let t=(0,X.c)(65),{a:n,form:r,update:i}=e,a=n.advanced,o;t[0]!==a.cardLimitsSubtitle||t[1]!==a.cardLimitsTitle?(o=(0,Z.jsx)(Ut,{icon:T,title:a.cardLimitsTitle,subtitle:a.cardLimitsSubtitle}),t[0]=a.cardLimitsSubtitle,t[1]=a.cardLimitsTitle,t[2]=o):o=t[2];let s=a.maxTaskDurationMs,c=a.maxTaskDurationMsDesc,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=bn(),t[3]=l):l=t[3];let u=r.maxTaskDurationMinutes??``,d;t[4]===i?d=t[5]:(d=e=>{let t=e.target.value;if(t===``){i({maxTaskDurationMinutes:void 0});return}let n=Number.parseInt(t,10);Number.isNaN(n)||i({maxTaskDurationMinutes:Math.min(240,Math.max(1,n))})},t[4]=i,t[5]=d);let f;t[6]!==u||t[7]!==d||t[8]!==a.maxTaskDurationPlaceholder?(f=(0,Z.jsx)(`input`,{type:`number`,className:l,min:1,max:240,step:1,value:u,placeholder:a.maxTaskDurationPlaceholder,onChange:d}),t[6]=u,t[7]=d,t[8]=a.maxTaskDurationPlaceholder,t[9]=f):f=t[9];let p;t[10]!==f||t[11]!==a.maxTaskDurationMs||t[12]!==a.maxTaskDurationMsDesc?(p=(0,Z.jsx)($,{label:s,description:c,children:f}),t[10]=f,t[11]=a.maxTaskDurationMs,t[12]=a.maxTaskDurationMsDesc,t[13]=p):p=t[13];let m=a.maxRequestsPerTurn,h=a.maxRequestsPerTurnDesc,g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=bn(),t[14]=g):g=t[14];let _;t[15]===i?_=t[16]:(_=e=>i({maxRequestsPerTurn:Number.parseInt(e.target.value,10)||50}),t[15]=i,t[16]=_);let v;t[17]!==r.maxRequestsPerTurn||t[18]!==_?(v=(0,Z.jsx)(`input`,{type:`number`,className:g,min:10,max:200,value:r.maxRequestsPerTurn,onChange:_}),t[17]=r.maxRequestsPerTurn,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==v||t[21]!==a.maxRequestsPerTurn||t[22]!==a.maxRequestsPerTurnDesc?(y=(0,Z.jsx)($,{label:m,description:h,children:v}),t[20]=v,t[21]=a.maxRequestsPerTurn,t[22]=a.maxRequestsPerTurnDesc,t[23]=y):y=t[23];let b=a.maxToolFailuresPerTurn,x=a.maxToolFailuresPerTurnDesc,S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=bn(),t[24]=S):S=t[24];let C;t[25]===i?C=t[26]:(C=e=>i({maxToolFailuresPerTurn:Number.parseInt(e.target.value,10)||3}),t[25]=i,t[26]=C);let w;t[27]!==r.maxToolFailuresPerTurn||t[28]!==C?(w=(0,Z.jsx)(`input`,{type:`number`,className:S,min:1,max:20,value:r.maxToolFailuresPerTurn,onChange:C}),t[27]=r.maxToolFailuresPerTurn,t[28]=C,t[29]=w):w=t[29];let E;t[30]!==w||t[31]!==a.maxToolFailuresPerTurn||t[32]!==a.maxToolFailuresPerTurnDesc?(E=(0,Z.jsx)($,{label:b,description:x,children:w}),t[30]=w,t[31]=a.maxToolFailuresPerTurn,t[32]=a.maxToolFailuresPerTurnDesc,t[33]=E):E=t[33];let D=n.label.maxToolIterations,O=n.desc.maxToolIterations,k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=bn(),t[34]=k):k=t[34];let A;t[35]===i?A=t[36]:(A=e=>i({maxToolIterations:Number.parseInt(e.target.value,10)||0}),t[35]=i,t[36]=A);let j;t[37]!==r.maxToolIterations||t[38]!==A?(j=(0,Z.jsx)(`input`,{type:`number`,className:k,value:r.maxToolIterations,min:1,onChange:A}),t[37]=r.maxToolIterations,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==n.desc.maxToolIterations||t[41]!==n.label.maxToolIterations||t[42]!==j?(M=(0,Z.jsx)($,{label:D,description:O,children:j}),t[40]=n.desc.maxToolIterations,t[41]=n.label.maxToolIterations,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==y||t[45]!==E||t[46]!==M?(N=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[y,E,M]}),t[44]=y,t[45]=E,t[46]=M,t[47]=N):N=t[47];let P;t[48]!==N||t[49]!==p?(P=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[p,N]}),t[48]=N,t[49]=p,t[50]=P):P=t[50];let F;t[51]!==o||t[52]!==P?(F=(0,Z.jsxs)(Wt,{children:[o,P]}),t[51]=o,t[52]=P,t[53]=F):F=t[53];let I;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(I=L(`settingsGoals`),t[54]=I):I=t[54];let R;t[55]===a.goalsCheckLink?R=t[56]:(R=(0,Z.jsx)(qe,{to:I,className:`font-medium text-accent-fg hover:underline`,children:a.goalsCheckLink}),t[55]=a.goalsCheckLink,t[56]=R);let z;t[57]===a.goalsCheckLinkHint?z=t[58]:(z=(0,Z.jsx)(`span`,{className:`mt-1 block`,children:a.goalsCheckLinkHint}),t[57]=a.goalsCheckLinkHint,t[58]=z);let B;t[59]!==R||t[60]!==z?(B=(0,Z.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[R,z]}),t[59]=R,t[60]=z,t[61]=B):B=t[61];let V;return t[62]!==F||t[63]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[F,B]}),t[62]=F,t[63]=B,t[64]=V):V=t[64],V}function Wo(e){let t=(0,X.c)(263),{a:n,chat:r,form:i,update:a}=e,o=n.advanced,s;t[0]!==o.cardMemorySubtitle||t[1]!==o.cardMemoryTitle?(s=(0,Z.jsx)(Ut,{icon:bt,title:o.cardMemoryTitle,subtitle:o.cardMemorySubtitle}),t[0]=o.cardMemorySubtitle,t[1]=o.cardMemoryTitle,t[2]=s):s=t[2];let c;t[3]!==i.memory||t[4]!==a?(c=e=>a({memory:{...i.memory,enabled:e.target.checked}}),t[3]=i.memory,t[4]=a,t[5]=c):c=t[5];let l;t[6]!==i.memory.enabled||t[7]!==c?(l=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.memory.enabled,onChange:c}),t[6]=i.memory.enabled,t[7]=c,t[8]=l):l=t[8];let u;t[9]===o.memoryEnabledOn?u=t[10]:(u=(0,Z.jsx)(`span`,{children:o.memoryEnabledOn}),t[9]=o.memoryEnabledOn,t[10]=u);let d;t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==d||t[15]!==o.memoryEnabled||t[16]!==o.memoryEnabledDesc?(f=(0,Z.jsx)($,{label:o.memoryEnabled,description:o.memoryEnabledDesc,children:d}),t[14]=d,t[15]=o.memoryEnabled,t[16]=o.memoryEnabledDesc,t[17]=f):f=t[17];let p;t[18]!==i.memory||t[19]!==a?(p=e=>a({memory:{...i.memory,useEnhancedSystem:e.target.checked}}),t[18]=i.memory,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==i.memory.useEnhancedSystem||t[22]!==p?(m=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.memory.useEnhancedSystem,onChange:p}),t[21]=i.memory.useEnhancedSystem,t[22]=p,t[23]=m):m=t[23];let h;t[24]===o.useEnhancedSystemOn?h=t[25]:(h=(0,Z.jsx)(`span`,{children:o.useEnhancedSystemOn}),t[24]=o.useEnhancedSystemOn,t[25]=h);let g;t[26]!==m||t[27]!==h?(g=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[m,h]}),t[26]=m,t[27]=h,t[28]=g):g=t[28];let _;t[29]!==g||t[30]!==o.useEnhancedSystem||t[31]!==o.useEnhancedSystemDesc?(_=(0,Z.jsx)($,{label:o.useEnhancedSystem,description:o.useEnhancedSystemDesc,children:g}),t[29]=g,t[30]=o.useEnhancedSystem,t[31]=o.useEnhancedSystemDesc,t[32]=_):_=t[32];let v;t[33]!==i.memory||t[34]!==a?(v=e=>a({memory:{...i.memory,userProfileEnabled:e.target.checked}}),t[33]=i.memory,t[34]=a,t[35]=v):v=t[35];let y;t[36]!==i.memory.userProfileEnabled||t[37]!==v?(y=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.memory.userProfileEnabled,onChange:v}),t[36]=i.memory.userProfileEnabled,t[37]=v,t[38]=y):y=t[38];let b;t[39]===o.userProfileEnabledOn?b=t[40]:(b=(0,Z.jsx)(`span`,{children:o.userProfileEnabledOn}),t[39]=o.userProfileEnabledOn,t[40]=b);let x;t[41]!==y||t[42]!==b?(x=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[y,b]}),t[41]=y,t[42]=b,t[43]=x):x=t[43];let S;t[44]!==x||t[45]!==o.userProfileEnabled||t[46]!==o.userProfileEnabledDesc?(S=(0,Z.jsx)($,{label:o.userProfileEnabled,description:o.userProfileEnabledDesc,children:x}),t[44]=x,t[45]=o.userProfileEnabled,t[46]=o.userProfileEnabledDesc,t[47]=S):S=t[47];let C=o.memoryProvider,w=o.memoryProviderDesc,T;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(T=xn(),t[48]=T):T=t[48];let E;t[49]!==i.memory||t[50]!==a?(E=e=>a({memory:{...i.memory,provider:e.target.value}}),t[49]=i.memory,t[50]=a,t[51]=E):E=t[51];let D;t[52]===o.memoryProviderUnset?D=t[53]:(D=(0,Z.jsx)(`option`,{value:``,children:o.memoryProviderUnset}),t[52]=o.memoryProviderUnset,t[53]=D);let O,k;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`option`,{value:`none`,children:`none`}),k=(0,Z.jsx)(`option`,{value:`stub`,children:`stub`}),t[54]=O,t[55]=k):(O=t[54],k=t[55]);let A;t[56]!==i.memory.provider||t[57]!==E||t[58]!==D?(A=(0,Z.jsxs)(`select`,{className:T,value:i.memory.provider,onChange:E,children:[D,O,k]}),t[56]=i.memory.provider,t[57]=E,t[58]=D,t[59]=A):A=t[59];let j;t[60]!==A||t[61]!==o.memoryProvider||t[62]!==o.memoryProviderDesc?(j=(0,Z.jsx)($,{label:C,description:w,children:A}),t[60]=A,t[61]=o.memoryProvider,t[62]=o.memoryProviderDesc,t[63]=j):j=t[63];let M;t[64]!==_||t[65]!==S||t[66]!==j||t[67]!==f?(M=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[f,_,S,j]}),t[64]=_,t[65]=S,t[66]=j,t[67]=f,t[68]=M):M=t[68];let N=o.advancedOptionsShow,P=o.advancedOptionsHide,F=o.injectionFrequency,I=o.injectionFrequencyDesc,L;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(L=xn(),t[69]=L):L=t[69];let R;t[70]!==i.memory||t[71]!==a?(R=e=>a({memory:{...i.memory,injectionFrequency:e.target.value}}),t[70]=i.memory,t[71]=a,t[72]=R):R=t[72];let z;t[73]===o.injectionFrequencyUnset?z=t[74]:(z=(0,Z.jsx)(`option`,{value:``,children:o.injectionFrequencyUnset}),t[73]=o.injectionFrequencyUnset,t[74]=z);let B;t[75]===o.injectionEveryTurn?B=t[76]:(B=(0,Z.jsx)(`option`,{value:`every-turn`,children:o.injectionEveryTurn}),t[75]=o.injectionEveryTurn,t[76]=B);let V;t[77]===o.injectionFirstTurn?V=t[78]:(V=(0,Z.jsx)(`option`,{value:`first-turn`,children:o.injectionFirstTurn}),t[77]=o.injectionFirstTurn,t[78]=V);let ee;t[79]!==i.memory.injectionFrequency||t[80]!==R||t[81]!==z||t[82]!==B||t[83]!==V?(ee=(0,Z.jsxs)(`select`,{className:L,value:i.memory.injectionFrequency,onChange:R,children:[z,B,V]}),t[79]=i.memory.injectionFrequency,t[80]=R,t[81]=z,t[82]=B,t[83]=V,t[84]=ee):ee=t[84];let H;t[85]!==ee||t[86]!==o.injectionFrequency||t[87]!==o.injectionFrequencyDesc?(H=(0,Z.jsx)($,{label:F,description:I,children:ee}),t[85]=ee,t[86]=o.injectionFrequency,t[87]=o.injectionFrequencyDesc,t[88]=H):H=t[88];let U=o.memoryCharLimit,W=o.memoryCharLimitDesc,G;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(G=bn(),t[89]=G):G=t[89];let K=i.memory.memoryCharLimit??``,q;t[90]!==i.memory||t[91]!==a?(q=e=>{let t=e.target.value;a({memory:{...i.memory,memoryCharLimit:t===``?void 0:Number.parseInt(t,10)}})},t[90]=i.memory,t[91]=a,t[92]=q):q=t[92];let te;t[93]!==K||t[94]!==q?(te=(0,Z.jsx)(`input`,{type:`number`,className:G,min:1,value:K,placeholder:`—`,onChange:q}),t[93]=K,t[94]=q,t[95]=te):te=t[95];let ne;t[96]!==te||t[97]!==o.memoryCharLimit||t[98]!==o.memoryCharLimitDesc?(ne=(0,Z.jsx)($,{label:U,description:W,children:te}),t[96]=te,t[97]=o.memoryCharLimit,t[98]=o.memoryCharLimitDesc,t[99]=ne):ne=t[99];let ie=o.userCharLimit,ae=o.userCharLimitDesc,oe;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(oe=bn(),t[100]=oe):oe=t[100];let se=i.memory.userCharLimit??``,ce;t[101]!==i.memory||t[102]!==a?(ce=e=>{let t=e.target.value;a({memory:{...i.memory,userCharLimit:t===``?void 0:Number.parseInt(t,10)}})},t[101]=i.memory,t[102]=a,t[103]=ce):ce=t[103];let le;t[104]!==se||t[105]!==ce?(le=(0,Z.jsx)(`input`,{type:`number`,className:oe,min:1,value:se,placeholder:`—`,onChange:ce}),t[104]=se,t[105]=ce,t[106]=le):le=t[106];let ue;t[107]!==le||t[108]!==o.userCharLimit||t[109]!==o.userCharLimitDesc?(ue=(0,Z.jsx)($,{label:ie,description:ae,children:le}),t[107]=le,t[108]=o.userCharLimit,t[109]=o.userCharLimitDesc,t[110]=ue):ue=t[110];let de=o.contextCadence,fe=o.contextCadenceDesc,pe;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(pe=bn(),t[111]=pe):pe=t[111];let me=i.memory.contextCadence??``,he;t[112]!==i.memory||t[113]!==a?(he=e=>{let t=e.target.value;a({memory:{...i.memory,contextCadence:t===``?void 0:Number.parseInt(t,10)}})},t[112]=i.memory,t[113]=a,t[114]=he):he=t[114];let ge;t[115]!==me||t[116]!==he?(ge=(0,Z.jsx)(`input`,{type:`number`,className:pe,min:1,value:me,placeholder:`—`,onChange:he}),t[115]=me,t[116]=he,t[117]=ge):ge=t[117];let _e;t[118]!==ge||t[119]!==o.contextCadence||t[120]!==o.contextCadenceDesc?(_e=(0,Z.jsx)($,{label:de,description:fe,children:ge}),t[118]=ge,t[119]=o.contextCadence,t[120]=o.contextCadenceDesc,t[121]=_e):_e=t[121];let ve=o.dialecticCadence,ye=o.dialecticCadenceDesc,be;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(be=bn(),t[122]=be):be=t[122];let Se=i.memory.dialecticCadence??``,Ce;t[123]!==i.memory||t[124]!==a?(Ce=e=>{let t=e.target.value;a({memory:{...i.memory,dialecticCadence:t===``?void 0:Number.parseInt(t,10)}})},t[123]=i.memory,t[124]=a,t[125]=Ce):Ce=t[125];let we;t[126]!==Se||t[127]!==Ce?(we=(0,Z.jsx)(`input`,{type:`number`,className:be,min:1,value:Se,placeholder:`—`,onChange:Ce}),t[126]=Se,t[127]=Ce,t[128]=we):we=t[128];let Te;t[129]!==we||t[130]!==o.dialecticCadence||t[131]!==o.dialecticCadenceDesc?(Te=(0,Z.jsx)($,{label:ve,description:ye,children:we}),t[129]=we,t[130]=o.dialecticCadence,t[131]=o.dialecticCadenceDesc,t[132]=Te):Te=t[132];let Ee;t[133]!==H||t[134]!==ne||t[135]!==ue||t[136]!==_e||t[137]!==Te?(Ee=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[H,ne,ue,_e,Te]}),t[133]=H,t[134]=ne,t[135]=ue,t[136]=_e,t[137]=Te,t[138]=Ee):Ee=t[138];let De;t[139]!==Ee||t[140]!==o.advancedOptionsHide||t[141]!==o.advancedOptionsShow?(De=(0,Z.jsx)(Ro,{showLabel:N,hideLabel:P,children:Ee}),t[139]=Ee,t[140]=o.advancedOptionsHide,t[141]=o.advancedOptionsShow,t[142]=De):De=t[142];let Oe;t[143]!==M||t[144]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[M,De]}),t[143]=M,t[144]=De,t[145]=Oe):Oe=t[145];let ke;t[146]!==s||t[147]!==Oe?(ke=(0,Z.jsxs)(Wt,{children:[s,Oe]}),t[146]=s,t[147]=Oe,t[148]=ke):ke=t[148];let Ae;t[149]!==o.cardSessionSearchSubtitle||t[150]!==o.cardSessionSearchTitle?(Ae=(0,Z.jsx)(Ut,{icon:xe,title:o.cardSessionSearchTitle,subtitle:o.cardSessionSearchSubtitle}),t[149]=o.cardSessionSearchSubtitle,t[150]=o.cardSessionSearchTitle,t[151]=Ae):Ae=t[151];let je;t[152]!==i.sessionSearch||t[153]!==a?(je=e=>a({sessionSearch:{...i.sessionSearch,summaryModel:e}}),t[152]=i.sessionSearch,t[153]=a,t[154]=je):je=t[154];let Me;t[155]!==r.modelNoMatches||t[156]!==r.modelPlaceholder||t[157]!==r.modelSearchPlaceholder||t[158]!==i.sessionSearch.summaryModel||t[159]!==je?(Me=(0,Z.jsx)(Ke,{value:i.sessionSearch.summaryModel,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:je}),t[155]=r.modelNoMatches,t[156]=r.modelPlaceholder,t[157]=r.modelSearchPlaceholder,t[158]=i.sessionSearch.summaryModel,t[159]=je,t[160]=Me):Me=t[160];let Ne;t[161]!==Me||t[162]!==o.sessionSearchSummaryModel||t[163]!==o.sessionSearchSummaryModelDesc?(Ne=(0,Z.jsx)($,{label:o.sessionSearchSummaryModel,description:o.sessionSearchSummaryModelDesc,children:Me}),t[161]=Me,t[162]=o.sessionSearchSummaryModel,t[163]=o.sessionSearchSummaryModelDesc,t[164]=Ne):Ne=t[164];let Pe;t[165]!==Ae||t[166]!==Ne?(Pe=(0,Z.jsxs)(Wt,{children:[Ae,Ne]}),t[165]=Ae,t[166]=Ne,t[167]=Pe):Pe=t[167];let Fe;t[168]!==o.cardReviewSubtitle||t[169]!==o.cardReviewTitle?(Fe=(0,Z.jsx)(Ut,{icon:re,title:o.cardReviewTitle,subtitle:o.cardReviewSubtitle}),t[168]=o.cardReviewSubtitle,t[169]=o.cardReviewTitle,t[170]=Fe):Fe=t[170];let Ie;t[171]!==i.backgroundReview||t[172]!==a?(Ie=e=>a({backgroundReview:{...i.backgroundReview,enabled:e.target.checked}}),t[171]=i.backgroundReview,t[172]=a,t[173]=Ie):Ie=t[173];let Le;t[174]!==i.backgroundReview.enabled||t[175]!==Ie?(Le=(0,Z.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.backgroundReview.enabled,onChange:Ie}),t[174]=i.backgroundReview.enabled,t[175]=Ie,t[176]=Le):Le=t[176];let Re;t[177]===o.reviewEnabledOn?Re=t[178]:(Re=(0,Z.jsx)(`span`,{children:o.reviewEnabledOn}),t[177]=o.reviewEnabledOn,t[178]=Re);let ze;t[179]!==Le||t[180]!==Re?(ze=(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[Le,Re]}),t[179]=Le,t[180]=Re,t[181]=ze):ze=t[181];let Be;t[182]!==ze||t[183]!==o.reviewEnabled||t[184]!==o.reviewEnabledDesc?(Be=(0,Z.jsx)($,{label:o.reviewEnabled,description:o.reviewEnabledDesc,children:ze}),t[182]=ze,t[183]=o.reviewEnabled,t[184]=o.reviewEnabledDesc,t[185]=Be):Be=t[185];let J=o.advancedOptionsShow,Ve=o.advancedOptionsHide,He=o.memoryNudgeInterval,Ue=o.memoryNudgeIntervalDesc,We;t[186]===Symbol.for(`react.memo_cache_sentinel`)?(We=bn(),t[186]=We):We=t[186];let Ge;t[187]!==i.backgroundReview||t[188]!==a?(Ge=e=>a({backgroundReview:{...i.backgroundReview,memoryNudgeInterval:Number.parseInt(e.target.value,10)||0}}),t[187]=i.backgroundReview,t[188]=a,t[189]=Ge):Ge=t[189];let qe;t[190]!==i.backgroundReview.memoryNudgeInterval||t[191]!==Ge?(qe=(0,Z.jsx)(`input`,{type:`number`,className:We,min:0,value:i.backgroundReview.memoryNudgeInterval,onChange:Ge}),t[190]=i.backgroundReview.memoryNudgeInterval,t[191]=Ge,t[192]=qe):qe=t[192];let Je;t[193]!==qe||t[194]!==o.memoryNudgeInterval||t[195]!==o.memoryNudgeIntervalDesc?(Je=(0,Z.jsx)($,{label:He,description:Ue,children:qe}),t[193]=qe,t[194]=o.memoryNudgeInterval,t[195]=o.memoryNudgeIntervalDesc,t[196]=Je):Je=t[196];let Ye=o.skillNudgeInterval,Xe=o.skillNudgeIntervalDesc,Ze;t[197]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=bn(),t[197]=Ze):Ze=t[197];let Qe;t[198]!==i.backgroundReview||t[199]!==a?(Qe=e=>a({backgroundReview:{...i.backgroundReview,skillNudgeInterval:Number.parseInt(e.target.value,10)||0}}),t[198]=i.backgroundReview,t[199]=a,t[200]=Qe):Qe=t[200];let $e;t[201]!==i.backgroundReview.skillNudgeInterval||t[202]!==Qe?($e=(0,Z.jsx)(`input`,{type:`number`,className:Ze,min:0,value:i.backgroundReview.skillNudgeInterval,onChange:Qe}),t[201]=i.backgroundReview.skillNudgeInterval,t[202]=Qe,t[203]=$e):$e=t[203];let et;t[204]!==$e||t[205]!==o.skillNudgeInterval||t[206]!==o.skillNudgeIntervalDesc?(et=(0,Z.jsx)($,{label:Ye,description:Xe,children:$e}),t[204]=$e,t[205]=o.skillNudgeInterval,t[206]=o.skillNudgeIntervalDesc,t[207]=et):et=t[207];let tt=o.reviewMaxToolRounds,nt=o.reviewMaxToolRoundsDesc,rt;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(rt=bn(),t[208]=rt):rt=t[208];let it;t[209]!==i.backgroundReview||t[210]!==a?(it=e=>a({backgroundReview:{...i.backgroundReview,maxToolRounds:Number.parseInt(e.target.value,10)||8}}),t[209]=i.backgroundReview,t[210]=a,t[211]=it):it=t[211];let at;t[212]!==i.backgroundReview.maxToolRounds||t[213]!==it?(at=(0,Z.jsx)(`input`,{type:`number`,className:rt,min:1,max:32,value:i.backgroundReview.maxToolRounds,onChange:it}),t[212]=i.backgroundReview.maxToolRounds,t[213]=it,t[214]=at):at=t[214];let Y;t[215]!==at||t[216]!==o.reviewMaxToolRounds||t[217]!==o.reviewMaxToolRoundsDesc?(Y=(0,Z.jsx)($,{label:tt,description:nt,children:at}),t[215]=at,t[216]=o.reviewMaxToolRounds,t[217]=o.reviewMaxToolRoundsDesc,t[218]=Y):Y=t[218];let ot=o.reviewMaxHistoryMessages,st=o.reviewMaxHistoryMessagesDesc,ct;t[219]===Symbol.for(`react.memo_cache_sentinel`)?(ct=bn(),t[219]=ct):ct=t[219];let lt;t[220]!==i.backgroundReview||t[221]!==a?(lt=e=>a({backgroundReview:{...i.backgroundReview,maxHistoryMessages:Number.parseInt(e.target.value,10)||80}}),t[220]=i.backgroundReview,t[221]=a,t[222]=lt):lt=t[222];let ut;t[223]!==i.backgroundReview.maxHistoryMessages||t[224]!==lt?(ut=(0,Z.jsx)(`input`,{type:`number`,className:ct,min:10,max:200,value:i.backgroundReview.maxHistoryMessages,onChange:lt}),t[223]=i.backgroundReview.maxHistoryMessages,t[224]=lt,t[225]=ut):ut=t[225];let dt;t[226]!==ut||t[227]!==o.reviewMaxHistoryMessages||t[228]!==o.reviewMaxHistoryMessagesDesc?(dt=(0,Z.jsx)($,{label:ot,description:st,children:ut}),t[226]=ut,t[227]=o.reviewMaxHistoryMessages,t[228]=o.reviewMaxHistoryMessagesDesc,t[229]=dt):dt=t[229];let ft=o.reviewMaxDurationMs,pt=o.reviewMaxDurationMsDesc,mt;t[230]===Symbol.for(`react.memo_cache_sentinel`)?(mt=bn(),t[230]=mt):mt=t[230];let ht;t[231]===i.backgroundReview.maxDurationMs?ht=t[232]:(ht=Math.round((i.backgroundReview.maxDurationMs??12e4)/1e3),t[231]=i.backgroundReview.maxDurationMs,t[232]=ht);let gt;t[233]!==i.backgroundReview||t[234]!==a?(gt=e=>a({backgroundReview:{...i.backgroundReview,maxDurationMs:(Number.parseInt(e.target.value,10)||120)*1e3}}),t[233]=i.backgroundReview,t[234]=a,t[235]=gt):gt=t[235];let _t;t[236]!==ht||t[237]!==gt?(_t=(0,Z.jsx)(`input`,{type:`number`,className:mt,min:30,max:600,step:1,value:ht,onChange:gt}),t[236]=ht,t[237]=gt,t[238]=_t):_t=t[238];let vt;t[239]!==_t||t[240]!==o.reviewMaxDurationMs||t[241]!==o.reviewMaxDurationMsDesc?(vt=(0,Z.jsx)($,{label:ft,description:pt,children:_t}),t[239]=_t,t[240]=o.reviewMaxDurationMs,t[241]=o.reviewMaxDurationMsDesc,t[242]=vt):vt=t[242];let yt;t[243]!==dt||t[244]!==vt||t[245]!==Je||t[246]!==et||t[247]!==Y?(yt=(0,Z.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[Je,et,Y,dt,vt]}),t[243]=dt,t[244]=vt,t[245]=Je,t[246]=et,t[247]=Y,t[248]=yt):yt=t[248];let xt;t[249]!==yt||t[250]!==o.advancedOptionsHide||t[251]!==o.advancedOptionsShow?(xt=(0,Z.jsx)(Ro,{showLabel:J,hideLabel:Ve,children:yt}),t[249]=yt,t[250]=o.advancedOptionsHide,t[251]=o.advancedOptionsShow,t[252]=xt):xt=t[252];let St;t[253]!==xt||t[254]!==Be?(St=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[Be,xt]}),t[253]=xt,t[254]=Be,t[255]=St):St=t[255];let Ct;t[256]!==St||t[257]!==Fe?(Ct=(0,Z.jsxs)(Wt,{children:[Fe,St]}),t[256]=St,t[257]=Fe,t[258]=Ct):Ct=t[258];let wt;return t[259]!==Ct||t[260]!==ke||t[261]!==Pe?(wt=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[ke,Pe,Ct]}),t[259]=Ct,t[260]=ke,t[261]=Pe,t[262]=wt):wt=t[262],wt}function Go(e){return(e.name||e.directoryId).trim()}function Ko(e,t){let n=[];for(let r of t)e.has(r)&&n.push(r);let r=[...e].filter(e=>!t.includes(e)).sort();return[...n,...r]}function qo(e){let t=(0,X.c)(70),{a:n,form:r,update:o}=e,s=n.advanced,c=i(Qo),l;t[0]===c?l=t[1]:(l=a(c),t[0]=c,t[1]=l);let u=l.agentsSettings,d=!!_(Zo),{catalogForPick:f,skillsCatalogLoading:p}=ki(!0,d),m;t[2]===f?m=t[3]:(m=f.map(Go),t[2]=f,t[3]=m);let h=m,g=r.skillsAllowlist.length>0,v;t[4]===r.skillsAllowlist?v=t[5]:(v=new Set(r.skillsAllowlist.flatMap(Xo)),t[4]=r.skillsAllowlist,t[5]=v);let y=v,b;if(t[6]!==h||t[7]!==r.skillsAllowlist){let e;t[9]===h?e=t[10]:(e=e=>e.trim()&&!h.includes(e.trim()),t[9]=h,t[10]=e),b=r.skillsAllowlist.filter(e),t[6]=h,t[7]=r.skillsAllowlist,t[8]=b}else b=t[8];let x=b,S;t[11]===x?S=t[12]:(S=x.map(Yo),t[11]=x,t[12]=S);let C=S,w;t[13]!==f||t[14]!==C?(w=[...C,...f],t[13]=f,t[14]=C,t[15]=w):w=t[15];let T=w,E;t[16]===o?E=t[17]:(E=()=>{o({skillsAllowlist:[]})},t[16]=o,t[17]=E);let D=E,O;t[18]!==h||t[19]!==o?(O=()=>{o({skillsAllowlist:[...h]})},t[18]=h,t[19]=o,t[20]=O):O=t[20];let k=O,A;t[21]!==h||t[22]!==r.skillsAllowlist||t[23]!==o?(A=(e,t)=>{let n=new Set(r.skillsAllowlist.flatMap(Jo));if(t?n.add(e):n.delete(e),n.size===0){o({skillsAllowlist:[]});return}o({skillsAllowlist:Ko(n,h)})},t[21]=h,t[22]=r.skillsAllowlist,t[23]=o,t[24]=A):A=t[24];let j=A,M;t[25]!==s.cardSkillsSubtitle||t[26]!==s.cardSkillsTitle?(M=(0,Z.jsx)(Ut,{icon:jt,title:s.cardSkillsTitle,subtitle:s.cardSkillsSubtitle}),t[25]=s.cardSkillsSubtitle,t[26]=s.cardSkillsTitle,t[27]=M):M=t[27];let N=s.skillsAllowlist,P=s.skillsAllowlistDesc,F;t[28]!==D||t[29]!==s.skillsAllowlistModeAll?(F=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,onClick:D,children:s.skillsAllowlistModeAll}),t[28]=D,t[29]=s.skillsAllowlistModeAll,t[30]=F):F=t[30];let I=!g&&h.length===0,R;t[31]!==g||t[32]!==k?(R=()=>{g||k()},t[31]=g,t[32]=k,t[33]=R):R=t[33];let z;t[34]!==I||t[35]!==R||t[36]!==s.skillsAllowlistModeRestrict?(z=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:I,onClick:R,children:s.skillsAllowlistModeRestrict}),t[34]=I,t[35]=R,t[36]=s.skillsAllowlistModeRestrict,t[37]=z):z=t[37];let B;t[38]!==F||t[39]!==z?(B=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[F,z]}),t[38]=F,t[39]=z,t[40]=B):B=t[40];let V;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(V=L(`skills`),t[41]=V):V=t[41];let ee;t[42]===u.skillsLibraryLink?ee=t[43]:(ee=(0,Z.jsx)(qe,{to:V,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:u.skillsLibraryLink}),t[42]=u.skillsLibraryLink,t[43]=ee);let H;t[44]!==B||t[45]!==ee?(H=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[B,ee]}),t[44]=B,t[45]=ee,t[46]=H):H=t[46];let U;t[47]!==n.needToken||t[48]!==u.skillsCatalogLoading||t[49]!==u.skillsEmptyCatalog||t[50]!==u.skillsNoDescription||t[51]!==y||t[52]!==h||t[53]!==d||t[54]!==g||t[55]!==T||t[56]!==p||t[57]!==j||t[58]!==s.skillsAllowlistNotInCatalog?(U=d?p?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.skillsCatalogLoading}):T.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.skillsEmptyCatalog}):(0,Z.jsx)(`div`,{className:Y(`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,!g&&`opacity-50`),children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:T.flatMap(e=>{let t=Go(e);if(!t)return[];let n=g&&y.has(t),r=typeof e.description==`string`?e.description.trim():``,i=r||u.skillsNoDescription,a=!h.includes(t);return[(0,Z.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 dark:border-edge-subtle`,children:(0,Z.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:n,disabled:!g,onChange:()=>j(t,!n),"aria-label":t}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:[t,a?(0,Z.jsxs)(`span`,{className:`ml-1.5 font-sans text-[10px] font-normal text-fg-muted`,children:[`(`,s.skillsAllowlistNotInCatalog,`)`]}):null]}),(0,Z.jsx)(`p`,{className:Y(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!r&&`italic text-fg-subtle`),title:i,children:i})]})]})},t)]})})}):(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.needToken}),t[47]=n.needToken,t[48]=u.skillsCatalogLoading,t[49]=u.skillsEmptyCatalog,t[50]=u.skillsNoDescription,t[51]=y,t[52]=h,t[53]=d,t[54]=g,t[55]=T,t[56]=p,t[57]=j,t[58]=s.skillsAllowlistNotInCatalog,t[59]=U):U=t[59];let W;t[60]!==H||t[61]!==U?(W=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[H,U]}),t[60]=H,t[61]=U,t[62]=W):W=t[62];let G;t[63]!==W||t[64]!==s.skillsAllowlist||t[65]!==s.skillsAllowlistDesc?(G=(0,Z.jsx)($,{label:N,description:P,children:W}),t[63]=W,t[64]=s.skillsAllowlist,t[65]=s.skillsAllowlistDesc,t[66]=G):G=t[66];let K;return t[67]!==G||t[68]!==M?(K=(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:(0,Z.jsxs)(Wt,{children:[M,G]})}),t[67]=G,t[68]=M,t[69]=K):K=t[69],K}function Jo(e){let t=e.trim();return t?[t]:[]}function Yo(e){return{name:e.trim(),directoryId:e.trim()}}function Xo(e){let t=e.trim();return t?[t]:[]}function Zo(e){return e.token}function Qo(e){return e.language}function $o(e){let t=(0,X.c)(17),{a:n,form:r,update:i}=e,a=n.advanced,o;t[0]!==a.cardSystemPromptSubtitle||t[1]!==a.cardSystemPromptTitle?(o=(0,Z.jsx)(Ut,{icon:A,title:a.cardSystemPromptTitle,subtitle:a.cardSystemPromptSubtitle}),t[0]=a.cardSystemPromptSubtitle,t[1]=a.cardSystemPromptTitle,t[2]=o):o=t[2];let s=a.systemPromptOverride,c=a.systemPromptOverrideDesc,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=Y(bn(),`min-h-[140px] resize-y font-mono text-xs`),t[3]=l):l=t[3];let u;t[4]===i?u=t[5]:(u=e=>i({systemPromptOverride:e.target.value}),t[4]=i,t[5]=u);let d;t[6]!==r.systemPromptOverride||t[7]!==u||t[8]!==a.systemPromptPlaceholder?(d=(0,Z.jsx)(`textarea`,{className:l,value:r.systemPromptOverride,placeholder:a.systemPromptPlaceholder,onChange:u}),t[6]=r.systemPromptOverride,t[7]=u,t[8]=a.systemPromptPlaceholder,t[9]=d):d=t[9];let f;t[10]!==d||t[11]!==a.systemPromptOverride||t[12]!==a.systemPromptOverrideDesc?(f=(0,Z.jsx)($,{label:s,description:c,children:d}),t[10]=d,t[11]=a.systemPromptOverride,t[12]=a.systemPromptOverrideDesc,t[13]=f):f=t[13];let p;return t[14]!==o||t[15]!==f?(p=(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:(0,Z.jsxs)(Wt,{children:[o,f]})}),t[14]=o,t[15]=f,t[16]=p):p=t[16],p}function es(e){let t=(0,X.c)(39),{a:n,chat:r,form:i,update:a}=e,o;t[0]===i.workspace?o=t[1]:(o=i.workspace.trim(),t[0]=i.workspace,t[1]=o);let s=o===yi,c;t[2]!==n.cardWorkspaceSubtitle||t[3]!==n.cardWorkspaceTitle?(c=(0,Z.jsx)(Ut,{icon:tt,title:n.cardWorkspaceTitle,subtitle:n.cardWorkspaceSubtitle}),t[2]=n.cardWorkspaceSubtitle,t[3]=n.cardWorkspaceTitle,t[4]=c):c=t[4];let l=n.label.workspace,u=n.desc.workspace,d=i.workspace,f;t[5]===a?f=t[6]:(f=e=>a({workspace:e}),t[5]=a,t[6]=f);let p=r.workingDirectory,m=r.workingDirectory.notSet,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=bn(),t[7]=h):h=t[7];let g;t[8]===a?g=t[9]:(g=()=>a({workspace:yi}),t[8]=a,t[9]=g);let _;t[10]!==n.setDefaultWorkspace||t[11]!==s||t[12]!==g?(_=(0,Z.jsx)(mt,{type:`button`,variant:`secondary`,className:Sn,disabled:s,title:yi,onClick:g,children:n.setDefaultWorkspace}),t[10]=n.setDefaultWorkspace,t[11]=s,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.workingDirectory||t[15]!==i.workspace||t[16]!==_||t[17]!==f?(v=(0,Z.jsx)(Mn,{value:d,onChange:f,wd:p,placeholder:m,inputClassName:h,trailing:_}),t[14]=r.workingDirectory,t[15]=i.workspace,t[16]=_,t[17]=f,t[18]=v):v=t[18];let y;t[19]!==n.desc.workspace||t[20]!==n.label.workspace||t[21]!==v?(y=(0,Z.jsx)($,{label:l,description:u,children:v}),t[19]=n.desc.workspace,t[20]=n.label.workspace,t[21]=v,t[22]=y):y=t[22];let b=n.label.mediaMaxMb,x=n.desc.mediaMaxMb,S;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(S=bn(),t[23]=S):S=t[23];let C=i.mediaMaxMb??``,w;t[24]===a?w=t[25]:(w=e=>{let t=e.target.value;a({mediaMaxMb:t===``?void 0:Number(t)})},t[24]=a,t[25]=w);let T;t[26]!==C||t[27]!==w?(T=(0,Z.jsx)(`input`,{type:`number`,min:1,step:1,className:S,value:C,placeholder:`20`,onChange:w}),t[26]=C,t[27]=w,t[28]=T):T=t[28];let E;t[29]!==n.desc.mediaMaxMb||t[30]!==n.label.mediaMaxMb||t[31]!==T?(E=(0,Z.jsx)($,{label:b,description:x,children:T}),t[29]=n.desc.mediaMaxMb,t[30]=n.label.mediaMaxMb,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==y||t[34]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[y,E]}),t[33]=y,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==c||t[37]!==D?(O=(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:(0,Z.jsxs)(Wt,{children:[c,D]})}),t[36]=c,t[37]=D,t[38]=O):O=t[38],O}function ts(e,t){return e.defaultsTabs[t]}function ns(e,t){switch(t){case`model-strategy`:return e.routeIntro.modelStrategy;case`generation`:return e.routeIntro.generation;case`workspace`:return e.routeIntro.workspace;case`runtime`:return e.routeIntro.runtime;case`context`:return e.routeIntro.context;case`memory`:return e.routeIntro.memory;case`tools`:return e.routeIntro.tools;case`skills`:return e.routeIntro.skills;case`system-prompt`:return e.routeIntro.systemPrompt}}function rs(e){let t=(0,X.c)(23),{tab:n,pp:r,hasToken:i}=e;switch(n){case`model-strategy`:{let e;return t[0]===r?e=t[1]:(e=(0,Z.jsx)(Oo,{...r}),t[0]=r,t[1]=e),e}case`generation`:{let e;return t[2]===r?e=t[3]:(e=(0,Z.jsx)(Ho,{...r}),t[2]=r,t[3]=e),e}case`workspace`:{let e;return t[4]===r?e=t[5]:(e=(0,Z.jsx)(es,{...r}),t[4]=r,t[5]=e),e}case`runtime`:{let e;return t[6]===r?e=t[7]:(e=(0,Z.jsx)(Uo,{...r}),t[6]=r,t[7]=e),e}case`context`:{let e;return t[8]===r?e=t[9]:(e=(0,Z.jsx)(zo,{...r}),t[8]=r,t[9]=e),e}case`memory`:{let e;return t[10]===r?e=t[11]:(e=(0,Z.jsx)(Wo,{...r}),t[10]=r,t[11]=e),e}case`tools`:{let e;return t[12]===r?e=t[13]:(e=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Z.jsx)(Lo,{...r}),(0,Z.jsx)(Bo,{...r})]}),t[12]=r,t[13]=e),e}case`skills`:{let e;t[14]===i?e=t[15]:(e=(0,Z.jsx)(Co,{hasToken:i}),t[14]=i,t[15]=e);let n;t[16]===r?n=t[17]:(n=(0,Z.jsx)(qo,{...r}),t[16]=r,t[17]=n);let a;return t[18]!==e||t[19]!==n?(a=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[e,n]}),t[18]=e,t[19]=n,t[20]=a):a=t[20],a}case`system-prompt`:{let e;return t[21]===r?e=t[22]:(e=(0,Z.jsx)($o,{...r}),t[21]=r,t[22]=e),e}}}function is(){let e=(0,X.c)(37),t=i(as),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n,o=r.agentSettings,s=r.chat,[c,l]=It(),u=fe(c.get(`tab`)),d=uo(o),f;bb0:{if(!d.form){f=null;break bb0}let t;e[2]!==o||e[3]!==s||e[4]!==d.form||e[5]!==d.update?(t={form:d.form,update:d.update,a:o,chat:s},e[2]=o,e[3]=s,e[4]=d.form,e[5]=d.update,e[6]=t):t=e[6],f=t}let p=f,m;e[7]===l?m=e[8]:(m=e=>{l(t=>{let n=new URLSearchParams(t);return e===`model-strategy`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[7]=l,e[8]=m);let h=m,g=ns(o,u),_=o.defaultsTabsAria,v;e[9]!==u||e[10]!==h?(v=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=Nt[(Nt.indexOf(u)+(e.key===`ArrowRight`?1:-1)+Nt.length)%Nt.length];h(t)},e[9]=u,e[10]=h,e[11]=v):v=e[11];let y;e[12]!==o||e[13]!==u||e[14]!==h?(y=Nt.map(e=>{let t=e===u;return(0,Z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,id:`agent-defaults-tab-${e}`,"aria-controls":`agent-defaults-panel-${e}`,className:Y(`shrink-0 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Ne.press,t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>h(e),children:ts(o,e)},e)}),e[12]=o,e[13]=u,e[14]=h,e[15]=y):y=e[15];let b;e[16]===y?b=e[17]:(b=(0,Z.jsx)(`div`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,children:y}),e[16]=y,e[17]=b);let x;e[18]===g?x=e[19]:(x=(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:g}),e[18]=g,e[19]=x);let S=`agent-defaults-panel-${u}`,C=`agent-defaults-tab-${u}`,w;e[20]!==u||e[21]!==p||e[22]!==d.hasToken?(w=p?(0,Z.jsx)(rs,{tab:u,pp:p,hasToken:d.hasToken}):null,e[20]=u,e[21]=p,e[22]=d.hasToken,e[23]=w):w=e[23];let T;e[24]!==w||e[25]!==S||e[26]!==C?(T=(0,Z.jsx)(`div`,{role:`tabpanel`,id:S,"aria-labelledby":C,className:`min-w-0`,children:w}),e[24]=w,e[25]=S,e[26]=C,e[27]=T):T=e[27];let E;e[28]!==o.defaultsTabsAria||e[29]!==T||e[30]!==v||e[31]!==b||e[32]!==x?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,role:`tablist`,"aria-label":_,onKeyDown:v,children:[b,x,T]}),e[28]=o.defaultsTabsAria,e[29]=T,e[30]=v,e[31]=b,e[32]=x,e[33]=E):E=e[33];let D;return e[34]!==E||e[35]!==d?(D=(0,Z.jsx)(so,{sectionId:`agent-defaults`,intro:``,vm:d,tabbed:!0,children:E}),e[34]=E,e[35]=d,e[36]=D):D=e[36],D}function as(e){return e.language}export{Bi as AgentsSettingsPanel,La as a,$ as c,li as d,kr as f,Fa as i,ci as l,po as n,xa as o,mn as p,Ea as r,Pa as s,is as t,oi as u};
|