@xopcai/xopc 0.0.415 → 0.0.416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/_locales/en/messages.json +4 -1
- package/dist/browser-ext/_locales/zh_CN/messages.json +4 -1
- package/dist/browser-ext/dist/assets/{page-context-MuzjMBlJ.js → page-context-CVvmTWZb.js} +33 -9
- package/dist/browser-ext/dist/background.js +39 -10
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +22 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CJFwitU2.js → agent-avatar-dicebear-CufU7cqe.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHDAcss8.js +1 -0
- package/dist/gateway/static/root/assets/agents-BV3dAoa0.js +77 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DgwqNi5i.js → app-management-settings-panel-D4-n1uBg.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C0wJfFyz.js → appearance-settings-Cgn4eNsX.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BOYzD7Zz.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ch7wolHE.js → archive-plugin-B4btCsiV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DK7AU79v.js → automations-page-yb1EL_3N.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-J7LJ4RuV.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B4HcHYsC.js → binary-plugins-DQT9e258.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BQAWEZF-.js → block-editor-B50rU9tL.js} +4 -4
- package/dist/gateway/static/root/assets/browser-automations-page-BiQz6lJA.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-W9kuxBbE.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-page-iXe87MdG.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CRLSXe7Z.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-D4Yq35fD.js → capability-header-actions-BMnbzHms.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CrRJkOKX.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-zdMySdMm.js → chat-terminal-dock-Bd3af4gL.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-C5Z6Jr0p.js → computer-settings-page-DXfqy7xh.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Cxus0qrZ.js → connector-service-page-B-cw0CPU.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DbFxc0Fd.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-DuyyD6jz.js → date-picker-CqzXevH6.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BZN72rrk.js → dependency-picker-pgT4Gyaf.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BcyP7Z6v.js → desktop-pet-settings-Dy_-i2L8.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BtvTIDCi.js → desktop-pet-zICeqw9c.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-ByGbxqkg.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DOusKz-O.js → directory-picker-path-field-C-aQ7qoM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Bt4FwsFu.js → extension-debug-page-2NwpYkS5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-0vsxX3FB.js → extension-page-y9J0z7_Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-5Pt5_ELc.js → extension-settings-page-BtowusUh.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-C52ghnBK.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BYSKzUMR.js +1 -0
- package/dist/gateway/static/root/assets/highlight-code-Cz6eeDH5.js +1 -0
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-Cbk7eMlg.js → highlighted-body-KQOG7T2V-BiAa8HKC.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cd1BjYHj.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CAS8QVla.js → image-generation-api-gBFro48x.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BCLBYzV1.js → imports-page-BZQpXgjj.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cy16gQST.css +1 -0
- package/dist/gateway/static/root/assets/index-DRyGCING.js +710 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CM_kt5XN.js → keyboard-shortcuts-settings-CYunR34k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B_Ac1lly.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BTSOChhk.js → local-apps-page-w-J5bY02.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Dnjvvx2i.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-w1EDwgLW.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-DYQDjCVQ.js → media-plugins-CIx1koXw.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DISkHmEC.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CNkxMTFU.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D5GH2wuC.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-DZgKqFBG.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DVn_dU83.js → page-context-capture-button-DusR2Itk.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CR5JFkQ9.js +1 -0
- package/dist/gateway/static/root/assets/{personal-settings-panel-C16Iqe7X.js → personal-settings-panel-B7undvlr.js} +1 -1
- package/dist/gateway/static/root/assets/phone-model-picker-fWDltRUJ.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-CsOirAiy.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-BOBVIB3j.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RlHk76TI.js → preview-open-alternatives-CMxjsKSw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dh-HqLrE.js → product-open-page-CrlyJx5M.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-c3K-4DWc.js → product-preview-content-B-Jhzi7W.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DoYUbtcI.js +7 -0
- package/dist/gateway/static/root/assets/{projects-page-B8HAt9sD.js → projects-page-xGQd9oAZ.js} +1 -1
- package/dist/gateway/static/root/assets/refresh-cw-BRlGaq2w.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-Gs0Xkws9.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bwg7U7TR.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-CXO1B1k4.js → schema-form-ByzTNR_C.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-CA1NkTR_.js → session-manager-B_h0jlLb.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-XzK1ftbR.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D_8Mvnog.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BQxKmbbJ.js → settings-form-section-Brgd8IOV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DvVMpKiA.js → settings-page-B6Mv02eg.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-header-BWyxJKOG.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-B20AfmFG.js → settings-page-layout-DLHcS-0T.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DSCj5yis.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-XgZk8Oa1.js → share-preview-page-DF8Of0aZ.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DXNPe4Tl.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CV-WT2hj.js → skill-api-CKCDCHLq.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BH0WF6Br.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DFWMVRW4.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DB-ttubV.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BJY7c8wb.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-D-gGKNX9.js → task-result-evidence-B-vt1BgK.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CQw3G-FB.js → tracing-settings-page-Dt51Z_ws.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-B2HnCi0U.js → tunnel-api-Dok3t7Qe.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-lJym5G7F.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Dc0nwUpX.js → use-autosave-D4EMIB-V.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BXdNkITp.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BSWXZkGa.js → voice-api-key-field-CO3KuanA.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-H3cdwq3l.js → work-discovery-overlay-BJRtgQM3.js} +1 -1
- package/dist/gateway/static/root/assets/wrench-DFb4r8bH.js +1 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CS-_GxHV.js +1 -0
- package/dist/gateway/static/root/browser-setup-test.html +5 -0
- package/dist/gateway/static/root/browser-setup-test.js +7 -0
- package/dist/gateway/static/root/index.html +7 -4
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/browser-setup.js +6 -0
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/phone-setup.js +6 -0
- package/dist/packages/realtime-client/src/index.js +1 -0
- package/dist/packages/realtime-protocol/src/index.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +4 -0
- package/dist/src/agent/agent-manager.js +12 -1
- package/dist/src/agent/embedded/tool-search-extension.js +14 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
- package/dist/src/agent/tool-manuals/phone.js +1 -1
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -0
- package/dist/src/agent/tool-manuals/xopc-configuration.js +25 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +2 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +6 -2
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +11 -1
- package/dist/src/agent/tools/phone-use-tool.d.ts +1 -0
- package/dist/src/agent/tools/phone-use-tool.js +9 -1
- package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
- package/dist/src/agent/tools/tool-manual-tool.js +3 -1
- package/dist/src/agent/tools/toolExposure.js +3 -0
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +40 -2
- package/dist/src/browser/drivers/browser-driver.d.ts +2 -2
- package/dist/src/browser/drivers/extension-driver.d.ts +2 -2
- package/dist/src/browser/drivers/extension-driver.js +6 -3
- package/dist/src/browser/providers/browser-ext-install.js +2 -1
- package/dist/src/browser/runtime/browser-runtime.d.ts +4 -1
- package/dist/src/browser/runtime/browser-runtime.js +29 -17
- package/dist/src/browser/setup/repository.d.ts +5 -0
- package/dist/src/browser/setup/repository.js +42 -0
- package/dist/src/browser/setup/service.d.ts +152 -0
- package/dist/src/browser/setup/service.js +404 -0
- package/dist/src/browser/setup/types.d.ts +38 -0
- package/dist/src/browser/setup/types.js +1 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/connectors/connected-source-understanding.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/browser-setup.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-setup.js +114 -0
- package/dist/src/gateway/hono/routes/browser.d.ts +2 -1
- package/dist/src/gateway/hono/routes/browser.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +7 -7
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
- package/dist/src/gateway/hono/routes/phone-setup.d.ts +7 -0
- package/dist/src/gateway/hono/routes/phone-setup.js +162 -0
- package/dist/src/gateway/hono/routes/phone.js +3 -7
- package/dist/src/gateway/hono/routes/public-gateway.js +3 -1
- package/dist/src/gateway/provider-model-setup.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -0
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +57 -12
- package/dist/src/gateway/xopc-cloud-capability-setup.js +7 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +2 -0
- package/dist/src/phone/adb-driver.js +35 -17
- package/dist/src/phone/contracts.d.ts +40 -0
- package/dist/src/phone/contracts.js +17 -4
- package/dist/src/phone/model-adapter.d.ts +59 -2
- package/dist/src/phone/model-adapter.js +107 -13
- package/dist/src/phone/numeric-entry.d.ts +31 -0
- package/dist/src/phone/numeric-entry.js +126 -0
- package/dist/src/phone/planning.d.ts +27 -0
- package/dist/src/phone/planning.js +79 -0
- package/dist/src/phone/recovery.d.ts +37 -0
- package/dist/src/phone/recovery.js +81 -0
- package/dist/src/phone/repository.d.ts +1 -0
- package/dist/src/phone/repository.js +3 -0
- package/dist/src/phone/runtime.js +232 -54
- package/dist/src/phone/semantic-controls.d.ts +13 -0
- package/dist/src/phone/semantic-controls.js +76 -0
- package/dist/src/phone/setup/service.d.ts +148 -0
- package/dist/src/phone/setup/service.js +251 -0
- package/dist/src/providers/presentation.js +2 -2
- package/dist/src/providers/xopc-cloud-model-source.js +6 -2
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/260_browser_setup.sql +9 -0
- package/dist/src/user-context/sources/index.js +1 -1
- package/dist/src/work-discovery/service.js +2 -2
- package/package.json +6 -6
- package/skills/tools/configure-xopc/SKILL.md +47 -0
- package/skills/tools/configure-xopc/references/browser/acceptance.md +31 -0
- package/skills/tools/configure-xopc/references/browser/chrome-extension.md +19 -0
- package/skills/tools/configure-xopc/references/browser/overview.md +22 -0
- package/skills/tools/configure-xopc/references/browser/permissions.md +25 -0
- package/skills/tools/configure-xopc/references/browser/troubleshooting.md +24 -0
- package/skills/tools/configure-xopc/references/phone/acceptance.md +25 -0
- package/skills/tools/configure-xopc/references/phone/aliyun.md +29 -0
- package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -0
- package/skills/tools/configure-xopc/references/phone/local.md +19 -0
- package/skills/tools/configure-xopc/references/phone/models.md +18 -0
- package/skills/tools/configure-xopc/references/phone/overview.md +30 -0
- package/skills/tools/configure-xopc/references/phone/troubleshooting.md +24 -0
- package/skills/tools/configure-xopc/references/scene-index.md +12 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DclyJr1N.js +0 -1
- package/dist/gateway/static/root/assets/agents-jhErNtzi.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-C0LcnI4h.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CBxiV34x.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-vJIrTxdi.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-in5Roh_E.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-CiGx8wpQ.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-a8kqjzQu.js +0 -8
- package/dist/gateway/static/root/assets/channels-C_CxcjKT.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DCBO2CxK.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-Ctbgr50F.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DkWCHVzI.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BsVOcmV5.js +0 -1
- package/dist/gateway/static/root/assets/highlight-code-C8eS9949.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BZDZnmyc.js +0 -2
- package/dist/gateway/static/root/assets/index-Bys6njTY.js +0 -710
- package/dist/gateway/static/root/assets/index-Vsf0bj5e.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Dk87jtcc.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-D3gVdm8S.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQNYFE4J.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-ChweJKTv.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CYKwUCte.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-BTSZb9ZT.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-CJ5nhWfL.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DcW14lqn.js +0 -1
- package/dist/gateway/static/root/assets/phone-dependencies-card-D3l9uPFM.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-picker-DOv38vBn.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-DUHp1q_9.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-BpfgDlVa.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-GD8TxKad.js +0 -7
- package/dist/gateway/static/root/assets/remote-access-hub-D3el7lHK.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Dbskk6RG.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-07liaSHH.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BGjU8rfN.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-header-CYpuTXUW.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DKo_VTx-.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BODFqK8k.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ce6OUk2C.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-B7ehOIML.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CxJkZRT4.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CxRR0QuW.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-uUEkO38r.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-ICUutbKL.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CvT_W6YS.js +0 -1
package/dist/gateway/static/root/assets/{projects-page-B8HAt9sD.js → projects-page-xGQd9oAZ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as ee}from"./messages-BYq0cPbn.js";import{t as l}from"./cn-0WouolD0.js";import{n as u}from"./locale-store-B7s2Hb35.js";import{t as d}from"./button-aIC072nz.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{Al as p,Ba as m,Bc as h,Ea as g,Fa as _,Fl as v,Hc as y,Ia as b,Ic as x,Jc as S,Jd as C,Jl as te,La as w,Lc as T,Rc as E,Ta as D,Ul as O,Vc as k,Zd as A,ao as j,ba as M,da as N,ed as ne,ha as re,ql as P,zc as ie}from"./index-Bys6njTY.js";import{t as F}from"./date-formatters-DukWSVwc.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(f,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=u(V),c,l,f,p,m,h,g,_;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),u;t[20]===o?u=t[21]:(u=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=u);let d;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,R.jsx)(C,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=d):d=t[22];let v;t[23]===u?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,d]}),t[23]=u,t[24]=v),_=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,p=`min-w-0 text-xs text-fg-muted`,m=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,f=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let y;t[25]!==l||t[26]!==f?(y=(0,R.jsx)(`p`,{className:l,children:f}),t[25]=l,t[26]=f,t[27]=y):y=t[27];let b;t[28]!==p||t[29]!==m||t[30]!==y?(b=(0,R.jsxs)(`div`,{className:p,children:[m,y]}),t[28]=p,t[29]=m,t[30]=y,t[31]=b):b=t[31];let x=n.pinnedAt?c.unpin:c.pin,S=n.pinnedAt?c.unpin:c.pin,w;t[32]===n.pinnedAt?w=t[33]:(w=n.pinnedAt?(0,R.jsx)(P,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=w);let T;t[34]!==r||t[35]!==a||t[36]!==x||t[37]!==S||t[38]!==w?(T=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":x,title:S,children:w}),t[34]=r,t[35]=a,t[36]=x,t[37]=S,t[38]=w,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(A,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let k;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==O?(k=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:O}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=O,t[47]=k):k=t[47];let j;t[48]!==T||t[49]!==k?(j=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,k]}),t[48]=T,t[49]=k,t[50]=j):j=t[50];let M;t[51]!==j||t[52]!==h||t[53]!==b?(M=(0,R.jsxs)(`div`,{className:h,children:[b,j]}),t[51]=j,t[52]=h,t[53]=b,t[54]=M):M=t[54];let N;return t[55]!==M||t[56]!==g||t[57]!==_?(N=(0,R.jsxs)(`article`,{className:g,children:[_,M]}),t[55]=M,t[56]=g,t[57]=_,t[58]=N):N=t[58],N}function V(e){return e.language}function H(){let e=ee(u(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=j(e=>e.setPageHeader),f=j(e=>e.clearPageHeader),[v,C]=(0,L.useState)([]),[te,A]=(0,L.useState)(!0),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=re({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(A(!0),F(null));try{let e=await _({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&C(ae(e.items))}catch(n){!e&&t===Z.current&&F(n instanceof Error?n.message:String(n))}finally{t===Z.current&&A(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return v.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,v,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(d,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>f()),[f,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await g({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});C(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await m(e.id,e.version):await b(e.id,e.version):e.status===`archived`?await w(e.id,e.version):await D(e.id,e.version),C(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(x,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(k,{children:[(0,R.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(E,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(y,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(ie,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(c,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(s,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:l(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(M,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(T,{asChild:!0,children:(0,R.jsx)(d,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(d,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(N,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:l(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(p,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(p,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),P?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:P}),(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,te?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(ne,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as ee}from"./messages-BYq0cPbn.js";import{t as l}from"./cn-0WouolD0.js";import{n as u}from"./locale-store-B7s2Hb35.js";import{t as d}from"./button-aIC072nz.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{Ba as p,Bc as m,Ca as h,Gc as g,Hc as _,Jd as v,Jl as y,Ll as te,Ml as b,Oa as x,Ra as S,Ua as C,Uc as w,Vc as T,Wc as E,Wl as D,Yl as O,Zc as k,Zd as A,co as j,ed as ne,ka as M,ma as N,va as P,za as re,zc as ie}from"./index-DRyGCING.js";import{t as F}from"./date-formatters-DukWSVwc.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(f,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=u(V),c,l,f,p,m,h,g,_;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),u;t[20]===o?u=t[21]:(u=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=u);let d;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,R.jsx)(v,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=d):d=t[22];let y;t[23]===u?y=t[24]:(y=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,d]}),t[23]=u,t[24]=y),_=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,p=`min-w-0 text-xs text-fg-muted`,m=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,f=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let b;t[25]!==l||t[26]!==f?(b=(0,R.jsx)(`p`,{className:l,children:f}),t[25]=l,t[26]=f,t[27]=b):b=t[27];let x;t[28]!==p||t[29]!==m||t[30]!==b?(x=(0,R.jsxs)(`div`,{className:p,children:[m,b]}),t[28]=p,t[29]=m,t[30]=b,t[31]=x):x=t[31];let S=n.pinnedAt?c.unpin:c.pin,C=n.pinnedAt?c.unpin:c.pin,w;t[32]===n.pinnedAt?w=t[33]:(w=n.pinnedAt?(0,R.jsx)(y,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=w);let T;t[34]!==r||t[35]!==a||t[36]!==S||t[37]!==C||t[38]!==w?(T=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":S,title:C,children:w}),t[34]=r,t[35]=a,t[36]=S,t[37]=C,t[38]=w,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(A,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let j;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==k?(j=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:k}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=k,t[47]=j):j=t[47];let M;t[48]!==T||t[49]!==j?(M=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,j]}),t[48]=T,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==M||t[52]!==h||t[53]!==x?(N=(0,R.jsxs)(`div`,{className:h,children:[x,M]}),t[51]=M,t[52]=h,t[53]=x,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==g||t[57]!==_?(P=(0,R.jsxs)(`article`,{className:g,children:[_,N]}),t[55]=N,t[56]=g,t[57]=_,t[58]=P):P=t[58],P}function V(e){return e.language}function H(){let e=ee(u(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=j(e=>e.setPageHeader),f=j(e=>e.clearPageHeader),[v,y]=(0,L.useState)([]),[te,O]=(0,L.useState)(!0),[A,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=P({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(O(!0),F(null));try{let e=await S({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&y(ae(e.items))}catch(n){!e&&t===Z.current&&F(n instanceof Error?n.message:String(n))}finally{t===Z.current&&O(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return v.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,v,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(d,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>f()),[f,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await M({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});y(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await C(e.id,e.version):await re(e.id,e.version):e.status===`archived`?await p(e.id,e.version):await x(e.id,e.version),y(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(ie,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(E,{children:[(0,R.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(T,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(_,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(c,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(s,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:l(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(h,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(m,{asChild:!0,children:(0,R.jsx)(d,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(d,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(N,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:l(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(k,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(b,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),A?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:A}),(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,te?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(ne,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,t as a,u as o}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{t as l}from"./copy-Dv6d4Dvw.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./globe-DSSGFWFn.js";import{t as f}from"./loader-circle-CifKLtgG.js";import{t as p}from"./messages-BYq0cPbn.js";import{t as m}from"./cn-0WouolD0.js";import{l as h,n as g}from"./locale-store-B7s2Hb35.js";import{t as _}from"./copy-to-clipboard-HOJ79TWv.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-aIC072nz.js";import{n as b,r as x}from"./gateway-config-swr-fQKBHBi1.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Al as w,Ao as T,Bt as E,Gc as D,Hc as O,Hl as k,It as A,Iu as j,Jd as M,Ln as N,Md as P,Nt as F,Pt as I,Sl as L,So as R,T as z,Uc as B,Vc as V,Wc as H,_a as ee,aa as te,dl as U,f as ne,m as re,ol as ie,ou as W,p as ae,wd as oe,wl as G,zc as K,zi as q}from"./index-DRyGCING.js";import{n as J,t as se}from"./settings-page-header-BWyxJKOG.js";import{t as ce}from"./settings-page-layout-DLHcS-0T.js";import{n as Y,r as le,t as ue}from"./settings-form-section-Brgd8IOV.js";import{_ as X,a as de,b as fe,c as pe,h as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be,v as xe,y as Se}from"./tunnel-api-Dok3t7Qe.js";import{t as Ce}from"./settings-advanced-gate-D_8Mvnog.js";var Z=e(t(),1),Q=n(),$=r();function we(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Te(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=m(`inline-flex items-center gap-1.5 text-xs font-medium`,we(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=m(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Ee(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=g(Oe),i;t[0]===r?i=t[1]:(i=p(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!h(De),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=v(o?`exposure-status`:null,Se,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:u}=v(o?`tunnel-status`:null,ge,l),f=x(o);if(!o)return null;let _=c?.tailscale.active===!0,y=u?.state,b=u?.enabled&&y===`connected`,S=u?.enabled&&(y===`connecting`||y===`reconnecting`||!!u?.startProgress||!!u?.frpcDownload),C=f.data?.payload?.config,T=!!(C&&typeof C==`object`&&!Array.isArray(C)&&C.gateway?.publicUrl),E=_?`active`:`off`,D=_?a.statusActive:a.statusOff,O;t[4]!==a.tailscaleCardTitle||t[5]!==E||t[6]!==D?(O={tab:`tailscale`,icon:d,title:a.tailscaleCardTitle,kind:E,statusLabel:D},t[4]=a.tailscaleCardTitle,t[5]=E,t[6]=D,t[7]=O):O=t[7];let k=b?`active`:S?`connecting`:`off`,A=b?a.statusActive:S?a.statusConnecting:a.statusOff,j;t[8]!==a.publicCardTitle||t[9]!==k||t[10]!==A?(j={tab:`public`,icon:W,title:a.publicCardTitle,kind:k,statusLabel:A},t[8]=a.publicCardTitle,t[9]=k,t[10]=A,t[11]=j):j=t[11];let M=T?`active`:`off`,N=T?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==M||t[14]!==N?(P={tab:`reverse-proxy`,icon:G,title:a.reverseProxyCardTitle,kind:M,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=M,t[14]=N,t[15]=P):P=t[15];let F;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(F={tab:`ssh`,icon:U,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=F):F=t[18];let I;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(I={tab:`lan`,icon:w,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=I):I=t[21];let L;t[22]!==P||t[23]!==F||t[24]!==I||t[25]!==O||t[26]!==j?(L=[O,j,P,F,I],t[22]=P,t[23]=F,t[24]=I,t[25]=O,t[26]=j,t[27]=L):L=t[27];let R=L,z;return t[28]!==R||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:m(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Te,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=z):z=t[30],z}function De(e){return e.conversationId}function Oe(e){return e.language}function ke(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f;t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===r?p=t[12]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=p);let h;t[13]!==f||t[14]!==p?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(P,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==h?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,h,g]}),t[17]=o,t[18]=l,t[19]=h,t[20]=_):_=t[20],_}function Ae(e){let t=(0,Q.c)(78),{onOpenTab:n}=e,r=g(Ne),i;t[0]===r?i=t[1]:(i=p(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!h(Me),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=v(s?`exposure-status`:null,Se,c),u;t[3]===l?.conflicts?u=t[4]:(u=l?.conflicts??[],t[3]=l?.conflicts,t[4]=u);let f=u;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let m;t[7]===n?m=t[8]:(m=(0,$.jsx)(Ee,{onOpenTab:n}),t[7]=n,t[8]=m);let _;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(_=f.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:f.map(je)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=_):_=t[12];let y;t[13]===o.pickMethod?y=t[14]:(y=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=y);let b;t[15]===n?b=t[16]:(b=()=>n(`tailscale`),t[15]=n,t[16]=b);let x;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==b?(x=(0,$.jsx)(ke,{icon:d,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:b}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=b,t[21]=x):x=t[21];let S;t[22]===n?S=t[23]:(S=()=>n(`public`),t[22]=n,t[23]=S);let C;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==S?(C=(0,$.jsx)(ke,{icon:W,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:S}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=S,t[27]=C):C=t[27];let T;t[28]===n?T=t[29]:(T=()=>n(`reverse-proxy`),t[28]=n,t[29]=T);let E;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==T?(E=(0,$.jsx)(ke,{icon:G,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:T}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=T,t[33]=E):E=t[33];let D;t[34]===n?D=t[35]:(D=()=>n(`ssh`),t[34]=n,t[35]=D);let O;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==D?(O=(0,$.jsx)(ke,{icon:U,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:D}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=D,t[39]=O):O=t[39];let k;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==E||t[43]!==O?(k=(0,$.jsxs)(z,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[E,O]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=E,t[43]=O,t[44]=k):k=t[44];let A;t[45]===n?A=t[46]:(A=()=>n(`lan`),t[45]=n,t[46]=A);let j;t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==A?(j=(0,$.jsx)(ke,{icon:w,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:A}),t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=A,t[50]=j):j=t[50];let M;t[51]!==C||t[52]!==k||t[53]!==j||t[54]!==x?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[x,C,k,j]}),t[51]=C,t[52]=k,t[53]=j,t[54]=x,t[55]=M):M=t[55];let N;t[56]!==M||t[57]!==y?(N=(0,$.jsxs)(`div`,{children:[y,M]}),t[56]=M,t[57]=y,t[58]=N):N=t[58];let P;t[59]===o.oneAtATimeHint?P=t[60]:(P=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[59]=o.oneAtATimeHint,t[60]=P);let F;t[61]===a.advanced.proxyTitle?F=t[62]:(F=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[61]=a.advanced.proxyTitle,t[62]=F);let I;t[63]===a.advanced.proxyBody?I=t[64]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[63]=a.advanced.proxyBody,t[64]=I);let L;t[65]!==r||t[66]!==a.advanced.proxyDocs?(L=(0,$.jsx)(fe,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=L):L=t[67];let R;t[68]!==F||t[69]!==I||t[70]!==L?(R=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[F,I,L]}),t[68]=F,t[69]=I,t[70]=L,t[71]=R):R=t[71];let B;return t[72]!==N||t[73]!==P||t[74]!==R||t[75]!==m||t[76]!==_?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,_,N,P,R]}),t[72]=N,t[73]=P,t[74]=R,t[75]=m,t[76]=_,t[77]=B):B=t[77],B}function je(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Me(e){return e.conversationId}function Ne(e){return e.language}function Pe(){let e=(0,Q.c)(16),t=g(Fe),n;e[0]===t?n=e[1]:(n=p(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:w,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let o;e[5]===r.body?o=e[6]:(o=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=o);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(a,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let l;e[10]!==o||e[11]!==c?(l=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[o,c]}),e[10]=o,e[11]=c,e[12]=l):l=e[12];let d;return e[13]!==i||e[14]!==l?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,l]})}),e[13]=i,e[14]=l,e[15]=d):d=e[15],d}function Fe(e){return e.language}function Ie(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=g(Le),a;t[0]===i?a=t[1]:(a=p(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,c]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await _(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(c(!0),setTimeout(()=>c(!1),2e3))},t[2]=u):u=t[2];let d=u,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=f):f=t[3];let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),h=(0,$.jsx)(l,{className:`mr-1 size-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let v=s?o.copied:o.copy,b;t[6]===v?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(y,{type:`button`,variant:`ghost`,onClick:m,children:[h,v]})}),t[6]=v,t[7]=b);let x;t[8]!==r||t[9]!==o.hint?(x=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,$.jsxs)($.Fragment,{children:[f,b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C=S;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{icon:U,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===C?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:C}),t[17]=C,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ue,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let w;t[22]!==o.subtitle||t[23]!==o.title?(w=(0,$.jsx)(Y,{icon:U,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:C}),t[25]=C,t[26]=T);let E;return t[27]!==w||t[28]!==T?(E=(0,$.jsxs)(ue,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function Le(e){return e.language}function Re(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ie,{embedded:!0}),e[0]=t):t=e[0],t}var ze=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Be(e){return e&&ze.includes(e)?e:`guide`}function Ve(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:l,advancedOnly:u}=e,d=u===void 0?!1:u,[f,p]=(0,Z.useState)(l??!1),h;t[0]===s?h=t[1]:(h=m(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p(He),t[2]=g):g=t[2];let _=f&&`rotate-180`,v;t[3]===_?v=t[4]:(v=m(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,_),t[3]=_,t[4]=v);let y;t[5]===v?y=t[6]:(y=(0,$.jsx)(c,{className:v,"aria-hidden":!0}),t[5]=v,t[6]=y);let b;t[7]===i?b=t[8]:(b=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=b);let x=f?r:n,S;t[9]===x?S=t[10]:(S=(0,$.jsx)(`span`,{children:x}),t[9]=x,t[10]=S);let C;t[11]!==f||t[12]!==y||t[13]!==b||t[14]!==S?(C=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:g,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[y,b,S]}),t[11]=f,t[12]=y,t[13]=b,t[14]=S,t[15]=C):C=t[15];let w=f?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,T;t[16]===w?T=t[17]:(T=m(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,w),t[16]=w,t[17]=T);let E;t[18]===a?E=t[19]:(E=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=E);let D;t[20]!==o||t[21]!==E?(D=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[E,o]})}),t[20]=o,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==T||t[24]!==D?(O=(0,$.jsx)(`div`,{className:T,children:D}),t[23]=T,t[24]=D,t[25]=O):O=t[25];let k;t[26]!==C||t[27]!==O||t[28]!==h?(k=(0,$.jsxs)(`section`,{className:h,children:[C,O]}),t[26]=C,t[27]=O,t[28]=h,t[29]=k):k=t[29];let A=k;if(d){let e;return t[30]===A?e=t[31]:(e=(0,$.jsx)(Ce,{children:A}),t[30]=A,t[31]=e),e}return A}function He(e){return!e}function Ue(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,f]=(0,Z.useState)(!1),p;t[0]===u?p=t[1]:(p=e=>{e||(f(!1),u())},t[0]=u,t[1]=p);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(B,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=m(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`,S),t[3]=g):g=t[3];let _;t[4]===r?_=t[5]:(_=(0,$.jsx)(D,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=_);let v;t[6]===i?v=t[7]:(v=(0,$.jsx)(O,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=v);let b;t[8]===a?b=t[9]:(b=a.map(We),t[8]=a,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=x);let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>f(e.target.checked),t[12]=w):w=t[12];let T;t[13]===d?T=t[14]:(T=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:w}),t[13]=d,t[14]=T);let E;t[15]===o?E=t[16]:(E=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=E);let k;t[17]!==E||t[18]!==T?(k=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[T,E]}),t[17]=E,t[18]=T,t[19]=k):k=t[19];let A;t[20]!==c||t[21]!==u?(A=(0,$.jsx)(y,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=A):A=t[22];let j=!d,M;t[23]!==s||t[24]!==l||t[25]!==j?(M=(0,$.jsx)(y,{type:`button`,disabled:j,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=j,t[26]=M):M=t[26];let N;t[27]!==A||t[28]!==M?(N=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[A,M]}),t[27]=A,t[28]=M,t[29]=N):N=t[29];let P;t[30]!==k||t[31]!==N||t[32]!==_||t[33]!==v||t[34]!==x?(P=(0,$.jsxs)(H,{children:[h,(0,$.jsxs)(V,{className:g,onOpenAutoFocus:Ge,children:[_,v,x,k,N]})]}),t[30]=k,t[31]=N,t[32]=_,t[33]=v,t[34]=x,t[35]=P):P=t[35];let F;return t[36]!==n||t[37]!==p||t[38]!==P?(F=(0,$.jsx)(K,{open:n,onOpenChange:p,children:P}),t[36]=n,t[37]=p,t[38]=P,t[39]=F):F=t[39],F}function We(e){return(0,$.jsx)(`li`,{children:e},e)}function Ge(e){return e.preventDefault()}function Ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var qe=[`preparing_frpc`,`registering`,`starting_frpc`];function Je(e){return e?e===`reconnecting_frpc`?qe.indexOf(`starting_frpc`):qe.indexOf(e):-1}function Ye(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=qe.indexOf(e),i=Je(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Xe(e,t,n){let r=n.startProgress;return Ye(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ze(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Qe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function $e(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(et),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,d,p,h;if(t[6]!==n||t[7]!==r){let e=Qe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(d=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=d):d=t[19];let o=qe.map(e=>{let t=Ye(e,n),i=Xe(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(f,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(oe,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:m(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ze(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:m(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[Ke(n.frpcDownload.bytesReceived),` /`,` `,Ke(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?p=t[21]:(p=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=p),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=d,t[11]=p,t[12]=h}else l=t[8],u=t[9],d=t[10],p=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==d||t[27]!==p||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[d,p,h,g]}),t[25]=u,t[26]=d,t[27]=p,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function et(e){return e+1}function tt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function nt(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function rt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function it(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function at(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:u,startDisabledReason:p,stepLabel:h,onStart:g,onStop:_}=e,v=u===void 0?!1:u,b,x,S,C,w,T,E;t[0]!==r||t[1]!==o?(E=nt(r),b=r.enabled||o,x=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(le(),`space-y-4`),t[9]=T):T=t[9],w=`flex flex-wrap items-start justify-between gap-3`,C=`flex items-center gap-2`,S=m(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,rt(E)),t[0]=r,t[1]=o,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=E):(b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,A=E===`error`&&`bg-red-500`,j=E===`off`&&`bg-fg-subtle`,M;t[10]!==D||t[11]!==O||t[12]!==A||t[13]!==j?(M=m(`size-1.5 rounded-full`,D,O,A,j),t[10]=D,t[11]=O,t[12]=A,t[13]=j,t[14]=M):M=t[14];let N;t[15]===M?N=t[16]:(N=(0,$.jsx)(`span`,{className:M,"aria-hidden":!0}),t[15]=M,t[16]=N);let P;t[17]!==i||t[18]!==r||t[19]!==n?(P=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):tt(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=P):P=t[20];let F;t[21]!==N||t[22]!==P||t[23]!==S?(F=(0,$.jsxs)(`span`,{className:S,children:[N,P]}),t[21]=N,t[22]=P,t[23]=S,t[24]=F):F=t[24];let I;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(I=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,it(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=I):I=t[28];let L;t[29]!==F||t[30]!==I||t[31]!==C?(L=(0,$.jsxs)(`div`,{className:C,children:[F,I]}),t[29]=F,t[30]=I,t[31]=C,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(d,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=R):R=t[33];let z;t[34]!==L||t[35]!==w?(z=(0,$.jsxs)(`div`,{className:w,children:[L,R]}),t[34]=L,t[35]=w,t[36]=z):z=t[36];let B;t[37]===a?B=t[38]:(B=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=B);let V;t[39]!==c||t[40]!==n.consentExpiredBanner?(V=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=V):V=t[41];let H;t[42]!==b||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==x||t[47]!==r||t[48]!==v||t[49]!==p||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(H=b?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(q,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)($e,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(y,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(y,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(f,{className:`size-4 animate-spin`}):(0,$.jsx)(k,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:h}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),v&&p?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:p}):null,(0,$.jsxs)(y,{type:`button`,disabled:o||v,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(f,{className:`size-4 animate-spin`}):(0,$.jsx)(k,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=l,t[44]=g,t[45]=_,t[46]=x,t[47]=r,t[48]=v,t[49]=p,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=H):H=t[54];let ee;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==H||t[59]!==T?(ee=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,H]}),t[55]=z,t[56]=B,t[57]=V,t[58]=H,t[59]=T,t[60]=ee):ee=t[60],ee}var ot={reconfiguring:!1};function st(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:l,brokerSecretAuthorizationUrl:d,brokerSecretNotice:p,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:v,onClear:b,sectionRef:x}=e,S=(0,Z.useId)(),C=r,w=!C,[D,O]=(0,Z.useReducer)(ee,ot),{reconfiguring:k}=D,A;t[0]!==i||t[1]!==o||t[2]!==k?(A=i&&!k&&!o.trim(),t[0]=i,t[1]=o,t[2]=k,t[3]=A):A=t[3];let M=A,N;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(N={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=N):N=t[8];let P=N,F;t[9]===o?F=t[10]:(F=o.trim().length>0&&!E(o.trim()),t[9]=o,t[10]=F);let I=F,L;t[11]===g?L=t[12]:(L=()=>{O({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=L);let R=L,z=w&&`ring-1 ring-amber-500/30`,B;t[13]===z?B=t[14]:(B=m(z),t[13]=z,t[14]=B);let V=C?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:w?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,H;t[15]===V?H=t[16]:(H=m(`flex size-9 shrink-0 items-center justify-center rounded-lg`,V),t[15]=V,t[16]=H);let te;t[17]===C?te=t[18]:(te=C?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=te);let U;t[19]!==H||t[20]!==te?(U=(0,$.jsx)(`span`,{className:H,children:te}),t[19]=H,t[20]=te,t[21]=U):U=t[21];let ne=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,re;t[22]===ne?re=t[23]:(re=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:ne}),t[22]=ne,t[23]=re);let ie=C?n.brokerSecretReadyHint:n.brokerSecretHint,W;t[24]===ie?W=t[25]:(W=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ie}),t[24]=ie,t[25]=W);let ae;t[26]!==w||t[27]!==n.brokerSecretMissingHint?(ae=w?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=w,t[27]=n.brokerSecretMissingHint,t[28]=ae):ae=t[28];let oe;t[29]!==re||t[30]!==W||t[31]!==ae?(oe=(0,$.jsxs)(`div`,{children:[re,W,ae]}),t[29]=re,t[30]=W,t[31]=ae,t[32]=oe):oe=t[32];let G;t[33]!==l||t[34]!==w||t[35]!==v||t[36]!==k||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(G=w||k?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(y,{type:`button`,disabled:c||l,onClick:v,children:[l?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,l?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:be,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(u,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=l,t[34]=w,t[35]=v,t[36]=k,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=G):G=t[41];let K;t[42]!==l||t[43]!==d||t[44]!==n.brokerSecretOpenAuthorization?(K=l&&d?(0,$.jsxs)(`a`,{href:d,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(u,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=l,t[43]=d,t[44]=n.brokerSecretOpenAuthorization,t[45]=K):K=t[45];let q;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==I||t[50]!==R||t[51]!==h||t[52]!==S||t[53]!==w||t[54]!==b||t[55]!==g||t[56]!==_||t[57]!==k||t[58]!==c||t[59]!==P||t[60]!==M||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(q=M?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(T,{id:S,value:a,labels:P,reveal:ct,loadFailedLabel:h||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(y,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{O({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(y,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(T,{id:S,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:P,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(y,{type:`button`,disabled:c||!I,onClick:_,children:[c?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,w?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(y,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear}):null,k?(0,$.jsx)(y,{type:`button`,variant:`ghost`,disabled:c,onClick:R,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=I,t[50]=R,t[51]=h,t[52]=S,t[53]=w,t[54]=b,t[55]=g,t[56]=_,t[57]=k,t[58]=c,t[59]=P,t[60]=M,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=q):q=t[71];let J;t[72]===p?J=t[73]:(J=p?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:p}):null,t[72]=p,t[73]=J);let se;t[74]!==oe||t[75]!==G||t[76]!==K||t[77]!==q||t[78]!==J?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[oe,G,K,q,J]}),t[74]=oe,t[75]=G,t[76]=K,t[77]=q,t[78]=J,t[79]=se):se=t[79];let ce;t[80]!==U||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,se]}),t[80]=U,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==B?(Y=(0,$.jsx)(ue,{className:B,children:ce}),t[83]=ce,t[84]=B,t[85]=Y):Y=t[85];let le;return t[86]!==x||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=x,t[87]=Y,t[88]=le):le=t[88],le}function ct(){return _e().then(lt)}function lt(e){return e.registrationSecret??null}var ut={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function dt({embedded:e=!1}){let t=g(e=>e.language),n=p(t).tunnelSettings,r=!!h(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ee,ut),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:u,autoStartConfirmOpen:_,releaseConfirmOpen:S,releasing:C,brokerSecretDraft:w,savingBrokerSecret:T,authorizingBrokerSecret:D,brokerSecretAuthorizationUrl:O,brokerSecretNotice:k}=i,j=(0,Z.useRef)(null),{data:M}=x(r),{data:N,error:P,isLoading:L,mutate:R}=v(r?`tunnel-status`:null,ge,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),z=(0,Z.useMemo)(()=>{let e=M?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return N?.config?.autoStart===!0},[M,N?.config?.autoStart]),B=(0,Z.useMemo)(()=>{let e=M?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[M]),V=E(B),H=N?.registrationSecret?.configured??V;(0,Z.useEffect)(()=>{let e=()=>{R()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[R]);let U=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),ie=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await ye(),await R(),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[R]),W=(0,Z.useCallback)(()=>{if(!H){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),j.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(N?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}ie()},[H,N?.consentRequired,ie,n.brokerSecretRequiredBeforeStart]),oe=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await de(),await Promise.all([R(),ie()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[R,ie]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await pe(),await R(),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[R]),K=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ve({autoStart:e}),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),q=(0,Z.useCallback)(()=>{if(z){K(!1);return}if(N?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!N?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[K,N?.canAutoStart,N?.consentRequired,n,z]),J=(0,Z.useCallback)(async()=>{let e=w.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),b(),await R(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[w,R,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),b(),await R()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[R,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=re(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await A(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await I(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await ae(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await he(),await Promise.all([R(),b()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{ne(e),t&&F(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[R,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await pe({release:!0}),await R(),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[R]),le=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:p(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=N??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:z,brokerUrl:`https://frp.xopc.ai/api`}},me=N?.consentRequired&&(X.enabled||z||N?.consent?.acceptedAt),_e=(0,$.jsx)(st,{t:n,brokerSecretReady:H,brokerSecretConfiguredInConfig:V,brokerSecretMaskedValue:V?B:``,brokerSecretDraft:w,savingBrokerSecret:T,authorizingBrokerSecret:D,brokerSecretAuthorizationUrl:O,brokerSecretNotice:k,copyFailedLabel:p(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void J(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:j}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ue,{open:u,title:n.consentTitle,intro:n.consentIntro,bullets:U,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void oe(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},u?`consent-open`:`consent-closed`),(0,$.jsx)(te,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),K(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(te,{open:S,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void Y(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:L,statusErr:P,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void G()}),(0,$.jsxs)(Ve,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:m(`flex items-center gap-3 text-sm text-fg`,!z&&!N?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!N?.canAutoStart,onChange:q}),n.autoStart]}),!N?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(y,{type:`button`,variant:`secondary`,disabled:C||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[C?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Ve,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:L,statusErr:P,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void G()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(y,{type:`button`,variant:`secondary`,disabled:C||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[C?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ue,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:m(`flex items-center gap-3 text-sm text-fg`,!z&&!N?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:z,disabled:l||!z&&!N?.canAutoStart,onChange:q}),n.autoStart]}),!N?.canAutoStart&&!z?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ft(e,t){return e.tabs[t]}function pt(e,t){return e.tabIntro[t]}function mt(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function ht(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Ae,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xe,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(dt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Re,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Pe,{}),t[6]=e):e=t[6],e}}}function gt(){let e=(0,Q.c)(3),t=o(),n=g(vt),r=p(n).remoteAccess,a=!!h(_t),[s,c]=i(),l=N(),u=Be(s.get(`tab`)),d=s.get(`intent`)===`mobile-pairing`,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={refreshInterval:2e3},e[0]=f):f=e[0];let m=v(d?`device-pairing-readiness`:null,me,f),_;e[1]===c?_=e[2]:(_=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=_);let b=_,x=pt(r,u),S=ze.filter(e=>l||e!==`ssh`&&e!==`reverse-proxy`||e===u).map(e=>({id:e,label:ft(r,e)}));return(0,$.jsxs)(J,{children:[(0,$.jsx)(se,{title:r.pageTitle,meta:(0,$.jsx)(fe,{language:n,label:r.docsLink,section:mt(u),className:`mt-1`})}),a?(0,$.jsxs)($.Fragment,{children:[d?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(L,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:m.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(y,{variant:`primary`,disabled:!m.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[m.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(R,{items:S,activeTab:u,onChange:b,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ce,{id:u,activeTab:u,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ft(r,u),hint:u===`public`?void 0:x,showHeading:!1,framed:!1,children:(0,$.jsx)(ht,{tab:u,onOpenTab:b})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function _t(e){return e.conversationId}function vt(e){return e.language}export{gt as RemoteAccessHub};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DGKUpVsz.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./messages-BYq0cPbn.js";import{i as c,n as l}from"./locale-store-B7s2Hb35.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-aIC072nz.js";import{i as f,n as p,r as m}from"./runtime-tools-api-DesqGCnE.js";import{C as h,Cn as g,Ll as _,ia as v,jd as y}from"./index-DRyGCING.js";import{n as b,t as x}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{t as S}from"./settings-advanced-gate-D_8Mvnog.js";var C=e(t(),1);function w(e){return e?.trim()||void 0}function T(e,t,n){return e?.state===`ready`?w(t)!==w(n):!0}var E=n(),D=[`node`,`python`,`uv`];function O(){let e=s(l(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:w,mutate:O}=u(c(`/api/runtime-tools`)),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)({}),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(null),V=Object.values(F).some(Boolean);if((0,C.useEffect)(()=>{t?.payload.config&&A(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,E.jsxs)(b,{children:[(0,E.jsx)(x,{title:e.title,subtitle:e.loadError}),(0,E.jsx)(d,{onClick:()=>void O(),children:e.refresh})]});if(w||!k)return(0,E.jsx)(b,{children:(0,E.jsx)(g,{sections:3})});let H=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),U=(e,t)=>A(n=>n&&{...n,[e]:{...n[e],...t}}),W=async()=>{M(!0),B(null);try{await f(k),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}},G=async(e,t)=>{I(t=>({...t,[e]:!0})),B(null);try{await f(k),await m({runtime:e,action:t,version:e===`uv`?k.uv.version:k[e].version,onProgress:t=>R(n=>({...n,[e]:t}))}),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{I(t=>({...t,[e]:!1}))}},K=async()=>{P(!0),B(null);try{await p(),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{P(!1)}};return(0,E.jsxs)(b,{gap:`gap-6`,children:[(0,E.jsx)(x,{title:e.title,actions:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v,{className:`size-9 shrink-0 p-0`,disabled:V,label:e.refresh,onClick:async()=>{await O()}}),(0,E.jsx)(d,{onClick:()=>void K(),disabled:N||V,children:N?e.pruning:e.prune}),(0,E.jsx)(d,{variant:`primary`,onClick:()=>void W(),disabled:j||V,children:j?e.saving:e.save})]})}),z?(0,E.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:z}):null,(0,E.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,E.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,E.jsx)(`input`,{type:`checkbox`,checked:k.enabled,onChange:e=>A({...k,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,E.jsx)(S,{children:(0,E.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,E.jsxs)(r,{value:k.download.source,onChange:e=>A({...k,download:{...k.download,source:e.target.value}}),children:[(0,E.jsx)(i,{value:`auto`,children:e.downloadSources.auto}),(0,E.jsx)(i,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,E.jsx)(i,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,E.jsx)(`input`,{value:k.download.gatewayBaseUrl,disabled:k.download.source===`direct-only`,onChange:e=>A({...k,download:{...k.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,E.jsx)(`input`,{value:k.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>A({...k,download:{...k.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,E.jsx)(`input`,{value:k.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>A({...k,download:{...k.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,E.jsx)(h,{}),(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:D.map(n=>{let s=H.get(n),c=s?.state===`ready`,l=L[n],u=n===`uv`?k.uv:k[n],f=n===`uv`?t?.payload.config.uv:t?.payload.config[n],p=F[n]===!0,m=T(s,u.version,f?.version);return(0,E.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,E.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:s?.message??e.unknown})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c?(0,E.jsx)(a,{className:`size-5 shrink-0 text-success`}):(0,E.jsx)(y,{className:`size-5 shrink-0 text-warning`}),(0,E.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:u.enabled,onChange:e=>{n===`uv`?A({...k,uv:{...k.uv,enabled:e.target.checked}}):U(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,E.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,E.jsx)(`input`,{value:u.version??``,placeholder:s?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?A({...k,uv:{...k.uv,version:t}}):U(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,E.jsxs)(r,{value:k[n].preference,onChange:e=>U(n,{preference:e.target.value}),children:[(0,E.jsx)(i,{value:`managed-first`,children:e.preferences.managedFirst}),(0,E.jsx)(i,{value:`system-first`,children:e.preferences.systemFirst}),(0,E.jsx)(i,{value:`managed-only`,children:e.preferences.managedOnly}),(0,E.jsx)(i,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,E.jsxs)(r,{value:k[n].provision,onChange:e=>U(n,{provision:e.target.value}),children:[(0,E.jsx)(i,{value:`eager`,children:e.provisions.eager}),(0,E.jsx)(i,{value:`on-demand`,children:e.provisions.onDemand}),(0,E.jsx)(i,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),l&&p?(0,E.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[l.message,l.totalBytes&&l.downloadedBytes?` · ${Math.round(l.downloadedBytes/l.totalBytes*100)}%`:``]}):null,(0,E.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[m?(0,E.jsxs)(d,{variant:`primary`,disabled:!k.enabled||!u.enabled||p,onClick:()=>void G(n,`install`),children:[(0,E.jsx)(o,{className:`size-4`}),p?e.working:e.install]}):(0,E.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,E.jsx)(a,{className:`size-4`}),e.installed]}),s?.repairable?(0,E.jsxs)(d,{disabled:!k.enabled||!u.enabled||p,onClick:()=>void G(n,`repair`),children:[(0,E.jsx)(_,{className:`size-4`}),e.repair]}):null]}),(0,E.jsx)(S,{children:s?.resolved?.executable?(0,E.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:s.resolved.executable}):null})]})]},n)})})]})}export{O as RuntimeToolsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DGKUpVsz.js";import{t as a}from"./cn-0WouolD0.js";import{Do as o,wo as s}from"./index-Bys6njTY.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:i,value:a,onChange:c,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===c?o=t[3]:(o=e=>c(e.target.value),t[2]=c,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(v),t[4]=i.enum,t[5]=s);let l;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(l=(0,u.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==a?(n=(0,u.jsx)(o,{value:a,onChange:c,placeholder:p,labels:s,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(i,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DGKUpVsz.js";import{t as a}from"./cn-0WouolD0.js";import{Ao as o,Do as s}from"./index-DRyGCING.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:i,value:a,onChange:c,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===c?o=t[3]:(o=e=>c(e.target.value),t[2]=c,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(v),t[4]=i.enum,t[5]=s);let l;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(l=(0,u.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==a?(n=(0,u.jsx)(o,{value:a,onChange:c,placeholder:p,labels:s,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(i,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
|
package/dist/gateway/static/root/assets/{session-manager-CA1NkTR_.js → session-manager-B_h0jlLb.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./messages-BYq0cPbn.js";import{a as n,i as r,l as i,n as a,p as o,u as s}from"./locale-store-B7s2Hb35.js";import{d as c,g as l,l as u,p as d,r as f,s as ee,t as p,u as m}from"./schemas-CObaziC7.js";import{i as te,n as h}from"./constants-DeXt1mV-.js";import{_ as g,b as _,g as v,h as y,m as b,s as x,v as S,y as ne}from"./session-api-DdQnMwkl.js";import{_ as re,a as C,c as w,d as ie,f as ae,i as oe,l as T,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./local-session-drafts-iGX_6O0O.js";import{t as E}from"./tool-activity-BtJkgjFf.js";import{r as pe}from"./personal-proactivity-BJcZ3Yhi.js";import{a as me}from"./attachment-utils-core-BIOUBrpT.js";import{a as he}from"./gateway-realtime-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./messages-BYq0cPbn.js";import{a as n,i as r,l as i,n as a,p as o,u as s}from"./locale-store-B7s2Hb35.js";import{d as c,g as l,l as u,p as d,r as f,s as ee,t as p,u as m}from"./schemas-CObaziC7.js";import{i as te,n as h}from"./constants-DeXt1mV-.js";import{_ as g,b as _,g as v,h as y,m as b,s as x,v as S,y as ne}from"./session-api-DdQnMwkl.js";import{_ as re,a as C,c as w,d as ie,f as ae,i as oe,l as T,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./local-session-drafts-iGX_6O0O.js";import{t as E}from"./tool-activity-BtJkgjFf.js";import{r as pe}from"./personal-proactivity-BJcZ3Yhi.js";import{a as me}from"./attachment-utils-core-BIOUBrpT.js";import{a as he}from"./gateway-realtime-C52ghnBK.js";import{t as ge}from"./gateway-startup-retry-Cfwxof4k.js";import{n as _e}from"./registry-api-BcfoLEna.js";import{a as ve}from"./agents-admin-api-B1p-ghg9.js";var ye=[0,500,1500],be=1e4;function xe(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function Se(e){return e===408||e===429||e>=500}var Ce=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,we=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function Te(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Ee(e){return Ce.test(e)||e.startsWith(`<source_contexts>`)||we.some(t=>e.startsWith(`<${t}>`))}function De(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Oe(e){let t=e,n=Te(t.trimStart(),`xopc_task_execution`);n!==null&&Ee(n)&&(t=n),t=De(t);let r=t,i=!1;for(t=t.trimStart();;){let e=we.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=Te(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Ce.test(t)&&(t=r),t.replace(Ce,``)}function ke(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
|
|
2
2
|
|
|
3
3
|
`).trim()}var Ae=`@xopc-ref:`,je=`[A-Za-z0-9_-]{1,64}`,Me=RegExp(`${Ae}(${je})`,`g`);function Ne(e){if(!RegExp(`^${je}$`).test(e))throw Error(`Invalid context reference id`);return`${Ae}${e}`}function Pe(){return new RegExp(Me.source,`g`)}function Fe(e){let t=[],n=Pe(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function Ie(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function Le(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Re(e){return e.parts.map(e=>e.type===`text`?e.text:Ne(e.refId)).join(``)}function ze(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${je}$`).test(t.refId)})}var Be=8e3,Ve=m({interactionMode:p([`quick`,`compose`]).optional(),choiceDetails:f(m({id:d().min(1).max(160),label:d().trim().min(1).max(1e3),description:d().max(2e3).optional()}).strict()).min(2).max(10).optional(),recommendedChoiceId:d().min(1).max(160).optional(),approval:m({operation:d().min(1).max(1e3),target:d().max(2e3).optional(),impact:d().max(4e3).optional(),argumentsPreview:c(d(),l()).optional()}).strict().optional()}),He=m({response:m({choiceId:d().min(1).max(160).optional(),text:d().trim().max(Be).optional()}).strict().optional(),decision:p([`approve`,`deny`]).optional()}).strict();He.extend({action:p([`answer`,`agent_decide`,`cancel`]),expectedVersion:u().int().positive(),idempotencyKey:d().trim().min(1).max(256)}).strict();function Ue(e){let t=Ve.safeParse(e);return t.success?t.data:{}}function We(e,t){let n=He.parse(t);if(e.kind===`approval`){if(n.response||!n.decision)throw Error(`An explicit approval decision is required`);return{answer:n.decision,decision:n.decision}}if(n.decision||!n.response)throw Error(`A structured response is required`);let r=n.response.choiceId?e.choiceDetails?.find(e=>e.id===n.response.choiceId):void 0;if(n.response.choiceId&&!r)throw Error(`Unknown clarification choice`);let i=n.response.text?.trim()??``;if(!r&&!i)throw Error(`Answer is required`);return{answer:r&&i?`Choice: ${r.label}\nAdditional information: ${i}`:r?.label??i,response:{...r?{choiceId:r.id}:{},...i?{text:i}:{}}}}var Ge=m({version:ee(1),deliveryId:d().min(1),taskId:d().min(1),taskRunId:d().min(1),taskTitle:d().min(1).max(500),conversationId:d().min(1),originTranscriptId:d().min(1),requestInputId:d().optional(),assignmentEpoch:u().int().nonnegative(),resultRevision:u().int().positive().optional(),previousResultId:d().optional(),contractVersion:u().int().positive().optional(),instructionSequence:u().int().nonnegative().optional(),adoption:f(m({entryId:d(),sequence:u().int(),status:p([`applied`,`partially_applied`,`not_applied`,`superseded`]),verification:p([`passed`,`failed`,`unverified`]),claimIds:f(d()),note:d()})).optional(),outcome:h,text:d().optional(),createdAt:u()});function Ke(e){let t=Ge.safeParse(e);return t.success?t.data:void 0}function qe(e){return typeof e==`object`&&!!e&&`role`in e}function Je(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`tool_use`||t===`tool_call`||t===`toolCall`}function Ye(e){return typeof e==`object`&&!!e}function Xe(e){return typeof e.id==`string`&&e.id.length>0?e.id:crypto.randomUUID()}function Ze(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function Qe(e){return Ze(e.args??e.arguments??e.input??e.function?.arguments)??{}}function $e(e){if(typeof e==`string`){let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}return Date.now()}function et(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function tt(e){if(Array.isArray(e))return e.map(e=>nt(e))}function nt(e){if(!e||typeof e!=`object`)return{name:`file`,mimeType:`application/octet-stream`};let t=e,n=rt(t.uri),r=it(t.name),i=at(t.mimeType,r),a=typeof t.type==`string`?t.type:void 0,o=a===`photo`||a===`image`||i.startsWith(`image/`)?`image`:a===`voice`||a===`audio`||i.startsWith(`audio/`)?`voice`:a;return{id:typeof t.id==`string`?t.id:void 0,name:r,mimeType:i,type:o,size:typeof t.size==`number`?t.size:void 0,uri:n,bucket:typeof t.bucket==`string`?t.bucket:void 0,path:typeof t.path==`string`?t.path:void 0}}function rt(e){return typeof e==`string`&&e.trim().startsWith(`media://`)?e.trim():void 0}function it(e){return typeof e==`string`&&e.trim().length>0?e.trim():`file`}function at(e,t){if(typeof e==`string`&&e.trim().length>0){let t=e.trim();if(t.toLowerCase().split(`;`)[0]?.trim()!==`application/octet-stream`)return t}return me(t)??`application/octet-stream`}function ot(e){let t=e.uri?.trim();return t?`uri:${t}`:e.id?`id:${e.id}`:`name:${e.name??`file`}|${e.mimeType??``}`}function st(e){if(!e?.length)return;let t=[],n=new Set;for(let r of e){let e=ot(r);n.has(e)||(n.add(e),t.push(r))}return t.length?t:void 0}var ct=`[Startup context loaded by runtime]`,lt=`...[additional startup memory truncated]...`,ut=`END_QUOTED_NOTES`;function dt(...e){return e.filter(e=>e.length>0).join(`
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./folder-open-CyzJ19I9.js";import{t as l}from"./messages-BYq0cPbn.js";import{t as u}from"./cn-0WouolD0.js";import{i as d,l as f,n as p,o as m}from"./locale-store-B7s2Hb35.js";import{a as h,c as g,f as _,n as v,o as y,p as b,r as x,s as S,t as C}from"./session-api-DdQnMwkl.js";import{i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-aIC072nz.js";import{t as E}from"./skeleton-BI5TyibZ.js";import{n as D,r as O}from"./gateway-config-swr-fQKBHBi1.js";import{n as k,t as A}from"./registry-api-BcfoLEna.js";import{i as j,o as ee}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Au as M,Bc as N,Ea as P,Fo as F,Ga as I,Gc as te,Ja as L,Jl as R,Jt as z,Ml as ne,Ms as B,Ns as V,Nu as re,Ol as H,Qd as ie,Sa as ae,So as U,T as W,Ta as oe,Uc as se,Vc as ce,Wc as le,Wl as ue,Yl as de,Zc as G,Zd as fe,_a as pe,du as me,fd as he,ga as K,gd as ge,ha as _e,ju as ve,pu as ye,qt as be,si as xe,sl as Se,wd as Ce,zc as we}from"./index-DRyGCING.js";import{t as q}from"./number-input-DDeqHK-G.js";import{n as Te,t as Ee}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{n as De,t as J}from"./settings-form-section-Brgd8IOV.js";import{n as Oe,t as Y}from"./use-autosave-D4EMIB-V.js";import{t as ke}from"./settings-advanced-gate-D_8Mvnog.js";var X=e(t(),1),Ae=n(),Z=r();function je(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function Me(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Ne(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Pe(e){let t=(0,Ae.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:d}=e,f;t[0]!==i.unnamedSession||t[1]!==n.name?(f=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=f):f=t[2];let m=f,h=p(Re),g;t[3]!==h||t[4]!==n?(g=P(n,l(h).sidebar.sessionFilters),t[3]=h,t[4]=n,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=n.name?.trim(),t[6]=n.name,t[7]=v);let y=!!v,b=n.status===`archived`,x=n.status===`pinned`,S=n.usage,C;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==S?(C=S?.calls?S.costCompleteness===`unknown`?i.costUnknown:`${S.costCompleteness===`partial`?`≥ `:`≈ `}${Ne(S.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=S,t[11]=C):C=t[11];let w=C,T=S?.calls?S.costCompleteness===`partial`?i.costPartial:S.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,E=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,D;t[12]===E?D=t[13]:(D=u(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,E),t[12]=E,t[13]=D);let O;t[14]===c?O=t[15]:(O=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=O);let k=r===`list`&&`sm:py-3`,A;t[16]===k?A=t[17]:(A=u(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,k),t[16]=k,t[17]=A);let j;t[18]===n?j=t[19]:(j=(0,Z.jsx)(oe,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=j);let ee;t[20]===_?ee=t[21]:(ee=(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:_}),t[20]=_,t[21]=ee);let M;t[22]!==j||t[23]!==ee?(M=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[j,ee]}),t[22]=j,t[23]=ee,t[24]=M):M=t[24];let N;t[25]===x?N=t[26]:(N=x?(0,Z.jsx)(de,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=x,t[26]=N);let F;t[27]===n.updatedAt?F=t[28]:(F=je(n.updatedAt),t[27]=n.updatedAt,t[28]=F);let I;t[29]===F?I=t[30]:(I=(0,Z.jsx)(`span`,{children:F}),t[29]=F,t[30]=I);let te;t[31]!==N||t[32]!==I?(te=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[N,I]}),t[31]=N,t[32]=I,t[33]=te):te=t[33];let z;t[34]!==M||t[35]!==te||t[36]!==A?(z=(0,Z.jsxs)(`div`,{className:A,children:[M,te]}),t[34]=M,t[35]=te,t[36]=A,t[37]=z):z=t[37];let ne=r===`list`&&`sm:py-3`,V;t[38]===ne?V=t[39]:(V=u(`min-w-0 flex-1 px-3 py-2`,ne),t[38]=ne,t[39]=V);let re=r===`list`&&`sm:items-start`,H;t[40]===re?H=t[41]:(H=u(`flex gap-3`,re),t[40]=re,t[41]=H);let ae;t[42]!==o||t[43]!==a?(ae=(0,Z.jsx)(L,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ae):ae=t[44];let U;t[45]===m?U=t[46]:(U=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:m,children:m}),t[45]=m,t[46]=U);let W;t[47]!==n.key||t[48]!==y?(W=y?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=y,t[49]=W):W=t[49];let se;t[50]!==U||t[51]!==W?(se=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[U,W]}),t[50]=U,t[51]=W,t[52]=se):se=t[52];let ce;t[53]!==H||t[54]!==ae||t[55]!==se?(ce=(0,Z.jsxs)(`div`,{className:H,children:[ae,se]}),t[53]=H,t[54]=ae,t[55]=se,t[56]=ce):ce=t[56];let le;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(ye,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=le):le=t[57];let ue;t[58]===n.messageCount?ue=t[59]:(ue=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[le,n.messageCount]}),t[58]=n.messageCount,t[59]=ue);let G;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(he,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=G):G=t[60];let pe=S?.totalTokens??0,me;t[61]!==h||t[62]!==pe?(me=Me(pe,h),t[61]=h,t[62]=pe,t[63]=me):me=t[63];let K;t[64]!==i.tokens||t[65]!==me?(K=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[G,me,` `,i.tokens]}),t[64]=i.tokens,t[65]=me,t[66]=K):K=t[66];let _e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(ge,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=_e):_e=t[67];let ve;t[68]!==w||t[69]!==T?(ve=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:T,children:[_e,w]}),t[68]=w,t[69]=T,t[70]=ve):ve=t[70];let be;t[71]!==ue||t[72]!==K||t[73]!==ve?(be=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[ue,K,ve]}),t[71]=ue,t[72]=K,t[73]=ve,t[74]=be):be=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Le),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Ce;t[77]!==V||t[78]!==ce||t[79]!==be||t[80]!==xe?(Ce=(0,Z.jsxs)(`div`,{className:V,children:[ce,be,xe]}),t[77]=V,t[78]=ce,t[79]=be,t[80]=xe,t[81]=Ce):Ce=t[81];let we;t[82]===d?we=t[83]:(we=()=>d(`continue`),t[82]=d,t[83]=we);let q;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(ye,{className:`size-4`,strokeWidth:1.75}),t[84]=q):q=t[84];let Te;t[85]!==i.continueChat||t[86]!==we?(Te=(0,Z.jsx)(`button`,{type:`button`,className:B,title:i.continueChat,"aria-label":i.continueChat,onClick:we,children:q}),t[85]=i.continueChat,t[86]=we,t[87]=Te):Te=t[87];let Ee;t[88]!==b||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==d?(Ee=b?(0,Z.jsx)(`button`,{type:`button`,className:B,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>d(`unarchive`),children:(0,Z.jsx)(ie,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:B,title:i.archive,"aria-label":i.archive,onClick:()=>d(`archive`),children:(0,Z.jsx)(fe,{className:`size-4`,strokeWidth:1.75})}),t[88]=b,t[89]=i.archive,t[90]=i.unarchive,t[91]=d,t[92]=Ee):Ee=t[92];let De;t[93]!==x||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==d?(De=x?(0,Z.jsx)(`button`,{type:`button`,className:B,title:i.unpin,"aria-label":i.unpin,onClick:()=>d(`unpin`),children:(0,Z.jsx)(R,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:B,title:i.pin,"aria-label":i.pin,onClick:()=>d(`pin`),children:(0,Z.jsx)(de,{className:`size-4`,strokeWidth:1.75})}),t[93]=x,t[94]=i.pin,t[95]=i.unpin,t[96]=d,t[97]=De):De=t[97];let J;t[98]===d?J=t[99]:(J=()=>d(`export`),t[98]=d,t[99]=J);let Oe;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(s,{className:`size-4`,strokeWidth:1.75}),t[100]=Oe):Oe=t[100];let Y;t[101]!==i.export||t[102]!==J?(Y=(0,Z.jsx)(`button`,{type:`button`,className:B,title:i.export,"aria-label":i.export,onClick:J,children:Oe}),t[101]=i.export,t[102]=J,t[103]=Y):Y=t[103];let ke;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(ke=u(B,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=ke):ke=t[104];let X;t[105]===d?X=t[106]:(X=()=>d(`delete`),t[105]=d,t[106]=X);let Pe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(Se,{className:`size-4`,strokeWidth:1.75}),t[107]=Pe):Pe=t[107];let ze;t[108]!==i.delete||t[109]!==X?(ze=(0,Z.jsx)(`button`,{type:`button`,className:ke,title:i.delete,"aria-label":i.delete,onClick:X,children:Pe}),t[108]=i.delete,t[109]=X,t[110]=ze):ze=t[110];let Be;t[111]!==Te||t[112]!==Ee||t[113]!==De||t[114]!==Y||t[115]!==ze?(Be=(0,Z.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Ie,onKeyDown:Fe,children:[Te,Ee,De,Y,ze]}),t[111]=Te,t[112]=Ee,t[113]=De,t[114]=Y,t[115]=ze,t[116]=Be):Be=t[116];let Ve;return t[117]!==c||t[118]!==z||t[119]!==Ce||t[120]!==Be||t[121]!==D||t[122]!==O?(Ve=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:D,onClick:c,onKeyDown:O,children:[z,Ce,Be]}),t[117]=c,t[118]=z,t[119]=Ce,t[120]=Be,t[121]=D,t[122]=O,t[123]=Ve):Ve=t[123],Ve}function Fe(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Le(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Re(e){return e.language}function ze(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function Be(e,t){return t.find(t=>t.id===e)?.avatar}var Ve={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ue(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=He(e)?e:{},n=He(t.userContext)?t.userContext:{},r=He(n.contextPlanning)?n.contextPlanning:{},i=He(r.compaction)?r.compaction:{},a=Ve,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:Ue(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Q(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Q(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Q(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Q(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Q(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Q(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Q(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Q(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await D()}var Je=128e3,Ye={balanced:Ve,preserve:{...Ve,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Ve,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=_e();function Ze(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,F,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Ae.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(q,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,Ae.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=u(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let d;t[4]!==i||t[5]!==a||t[6]!==l?(d=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==d||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:c,children:[d,m]}),t[15]=c,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function nt({hasToken:e}){let t=l(p(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=O(e),{data:i=[],isLoading:a}=w(e?A:null,k,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[s,c]=(0,X.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,X.useState)(``),m=(0,X.useRef)(!1),h=(0,X.useRef)(s.form);h.current=s.form;let g=(0,X.useRef)(null);K({enabled:e,parsed:o,dirty:m.current,trackedParsedRef:g,dispatch:c,onResetDirty:()=>{m.current=!1}});let _=s.form,v=s.baseline,y=!!(_&&v&&JSON.stringify(_)!==JSON.stringify(v)),b=(0,X.useCallback)(e=>{m.current=!0,c({type:`patch`,patch:e})},[]),x=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),S=Y({value:_,dirty:y,onSave:(0,X.useCallback)(async e=>{try{await qe(e),c({type:`saved`,value:e}),m.current=!!(h.current&&JSON.stringify(h.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,x(n)):null}});if(!e||!_)return r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(E,{className:`h-5 w-48`}),(0,Z.jsx)(E,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(E,{className:`h-36 w-full rounded-xl`})]})}):null;let C=$e(_),D=Math.max(0,Je-_.reserveTokens),j=Math.min(Math.floor(Je*_.triggerThreshold),D),ee=Math.min(100,j/Je*100),M=Math.min(100,D/Je*100),N=_.model?i.find(e=>e.id===_.model):void 0,P=N?.contextWindow&&_.summaryChunkTokens+_.summaryMaxTokens+4096>N.contextWindow,F=_.keepRecentTokens+_.reserveTokens>j,I=Math.round(_.summaryTimeoutMs*(_.summaryRetries+1)/1e3),te=e=>{let t=Ye[e];b({...t,..._.model?{model:_.model}:{model:void 0},postCompactionSections:_.postCompactionSections})},L={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},R=()=>{let e=d.trim();!e||_.postCompactionSections.includes(e)||_.postCompactionSections.length>=12||(b({postCompactionSections:[..._.postCompactionSections,e]}),f(``))};return(0,Z.jsxs)(J,{onBlurCapture:S.onBlurCapture,children:[(0,Z.jsx)(De,{icon:me,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Oe,{status:S.status,error:S.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:_.enabled,onChange:e=>b({enabled:e.target.checked})}),_.enabled?t.enabled:t.disabled]})]})}),S.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:S.error}):null,_.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!_.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),C===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":C===e,className:u(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V.transition,V.focusRingPanel,C===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>te(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:L[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:L[e].hint})]},e))})]}),(0,Z.jsxs)(W,{title:t.advancedTitle,summary:C===`custom`?t.presetCustom:t.presetHint,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:et(j)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${ee}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:et(D)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${M}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((_.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>b({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(_.reserveTokens)),value:_.reserveTokens,min:1024,step:1024,onChange:e=>b({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:_.recentTurnsPreserve,min:1,max:12,onChange:e=>b({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(_.keepRecentTokens)),value:_.keepRecentTokens,min:1e3,step:1e3,onChange:e=>b({keepRecentTokens:Math.floor(e)})})]}),F?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):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.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(xe,{value:_.model??``,disabled:!_.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>b({model:e})}),_.model?(0,Z.jsx)(T,{type:`button`,variant:`secondary`,onClick:()=>b({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:_.qualityGuard,onChange:e=>b({qualityGuard:e})}),(0,Z.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:_.gapAudit,onChange:e=>b({gapAudit:e})})]}),_.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Z.jsx)(ke,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:_.minMessagesBeforeCompact,min:2,onChange:e=>b({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((_.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>b({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:_.summaryMaxTokens,min:256,step:256,onChange:e=>b({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:_.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>b({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(I)),value:_.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>b({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:_.summaryRetries,min:0,max:5,onChange:e=>b({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:_.minToolResultKeepChars,min:200,step:100,onChange:e=>b({minToolResultKeepChars:Math.floor(e)})})]}),P?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),_.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:u(`text-fg-muted hover:text-fg`,V.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>b({postCompactionSections:_.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(G,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:_.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),R())}}),(0,Z.jsxs)(T,{type:`button`,variant:`secondary`,disabled:!d.trim()||_.postCompactionSections.length>=12,onClick:R,children:[(0,Z.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),D()}function st(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,F,`dark:border-edge`)}var ct=_e();function lt({hasToken:e}){let t=l(p(e=>e.language)).sessions.config,{data:n,isLoading:r}=O(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[s,c]=(0,X.useReducer)(ct,{form:null,baseline:null}),u=s.form,d=s.baseline,f=(0,X.useRef)(!1),m=(0,X.useRef)(u);m.current=u;let h=(0,X.useRef)(null);K({enabled:e,parsed:i,dirty:f.current,trackedParsedRef:h,dispatch:c,onResetDirty:()=>{f.current=!1}});let g=!!(u&&d&&JSON.stringify(u)!==JSON.stringify(d)),_=(0,X.useCallback)(e=>{f.current=!0,c({type:`patch`,patch:e})},[]),v=Y({value:u,dirty:g,onSave:(0,X.useCallback)(async e=>{try{await ot(e),c({type:`saved`,value:e}),f.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!u?r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(E,{className:`h-5 w-40`}),(0,Z.jsx)(E,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(J,{onBlurCapture:v.onBlurCapture,children:[(0,Z.jsx)(De,{icon:he,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(Oe,{status:v.status,error:v.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(W,{title:t.dmScope,summary:u.dmScope,children:(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(a,{className:st(),value:u.dmScope,onChange:e=>_({dmScope:e.target.value}),children:[(0,Z.jsx)(o,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(o,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(o,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(o,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(q,{allowEmpty:!0,type:`number`,min:0,className:st(),value:u.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsx)(W,{title:t.maxEntries,summary:u.maxEntries??t.unsetPlaceholder,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(q,{allowEmpty:!0,type:`number`,min:1,className:st(),value:u.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,Ae.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:d,onPin:f,onUnpin:p,onExport:m,onDelete:h}=e,g=i?.status===`archived`,_=i?.status===`pinned`,v;t[0]===c?v=t[1]:(v=e=>!e&&c(),t[0]=c,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(se,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ee)}),t[2]=y):y=t[2];let b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=u(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,j,`dark:border-edge`),t[3]=b):b=t[3];let x;t[4]!==i||t[5]!==o||t[6]!==a?(x=i&&a?(0,Z.jsx)(L,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=x):x=t[7];let S;t[8]!==s.unnamedSession||t[9]!==i?.name?(S=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=S):S=t[10];let C;t[11]===S?C=t[12]:(C=(0,Z.jsx)(te,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:S}),t[11]=S,t[12]=C);let w;t[13]!==x||t[14]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[x,C]}),t[13]=x,t[14]=C,t[15]=w):w=t[15];let E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(G,{className:`size-5`,strokeWidth:1.75}),t[16]=E):E=t[16];let D;t[17]===s.close?D=t[18]:(D=(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:E})}),t[17]=s.close,t[18]=D);let O;t[19]!==w||t[20]!==D?(O=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[w,D]}),t[19]=w,t[20]=D,t[21]=O):O=t[21];let k;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(k=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=k):k=t[26];let A;t[27]===k?A=t[28]:(A=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:k}),t[27]=k,t[28]=A);let M;t[29]!==s.detailExport||t[30]!==m?(M=(0,Z.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:s.detailExport}),t[29]=s.detailExport,t[30]=m,t[31]=M):M=t[31];let P;t[32]!==g||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==d?(P=g?(0,Z.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.unarchive}):(0,Z.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=g,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=d,t[37]=P):P=t[37];let F;t[38]!==_||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==f||t[42]!==p?(F=_?(0,Z.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.unpin}):(0,Z.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:s.pin}),t[38]=_,t[39]=s.pin,t[40]=s.unpin,t[41]=f,t[42]=p,t[43]=F):F=t[43];let I;t[44]!==s.delete||t[45]!==h?(I=(0,Z.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:h,children:s.delete}),t[44]=s.delete,t[45]=h,t[46]=I):I=t[46];let R;t[47]!==M||t[48]!==P||t[49]!==F||t[50]!==I?(R=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[M,P,F,I]})}),t[47]=M,t[48]=P,t[49]=F,t[50]=I,t[51]=R):R=t[51];let z;t[52]!==O||t[53]!==A||t[54]!==R?(z=(0,Z.jsxs)(le,{children:[y,(0,Z.jsxs)(ce,{className:b,"aria-describedby":void 0,children:[O,A,R]})]}),t[52]=O,t[53]=A,t[54]=R,t[55]=z):z=t[55];let ne;return t[56]!==n||t[57]!==v||t[58]!==z?(ne=(0,Z.jsx)(we,{open:n,onOpenChange:v,children:z}),t[56]=n,t[57]=v,t[58]=z,t[59]=ne):ne=t[59],ne}function ft(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,Ae.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?re:H})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(U,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,Ae.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(p(e=>e.language)),t=e.sessions,n=f(e=>e.conversationId),r=!!n,{data:a,mutate:o}=w(r?[`gateway-chat-agents`,n]:null,ae,{revalidateOnFocus:!1}),s=a?.defaultId??`main`,d=a?.items??[],[m,E]=i(),D=vt(m.get(`tab`)),O=(0,X.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),E(t,{replace:!0})},[m,E]),[k,A]=(0,X.useReducer)(pe,m,Ct),{searchInput:N,debouncedSearch:P,statusFilter:F,viewMode:L,channelFilter:R,sessions:B,loading:H,error:ie,hasMore:U,stats:W,detailOpen:oe,detailLoading:ue,detailSession:G,confirmOpen:me,confirmKey:he}=k;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=N.trim();P!==e&&A({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[N,P]);let K=m.toString(),ge=(0,X.useRef)(K);if(ge.current!==K){ge.current=K;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();A({type:`patch`,patch:{...N===e?{}:{searchInput:e},...P===o?{}:{debouncedSearch:o},...F===i?{}:{statusFilter:i},...L===a?{}:{viewMode:a},...R===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(m),t=P.trim();t?e.set(`q`,t):e.delete(`q`),F===`all`?e.delete(`status`):e.set(`status`,F),L===`grid`?e.delete(`view`):e.set(`view`,L),R?e.set(`channel`,R):e.delete(`channel`),e.toString()!==m.toString()&&E(e,{replace:!0})},[P,m,E,F,L,R]),(0,X.useEffect)(()=>{if(!r||D!==`sessions`)return;let e=!1;return(async()=>{A({type:`patch`,patch:{loading:!0,error:null}});try{let t=await S({limit:pt,offset:0,...P?{search:P}:{},...F===`all`?{}:{status:F},...R?{channel:R}:{}});if(e)return;A({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||A({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||A({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,D,P,F,R,t.loadError]),(0,X.useEffect)(()=>{!r||D!==`sessions`||y().then(e=>A({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,D]),(0,X.useEffect)(()=>{if(!r||D!==`sessions`)return;let e=()=>void o();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,D,o]),(0,X.useEffect)(()=>{if(!r||D!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||A({type:`patch`,patch:{sessions:B.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:G&&G.key===t.key?{...G,name:t.name}:G}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,D,B,G]);let _e=(0,X.useCallback)(async()=>{if(!(!r||H||!U)){A({type:`patch`,patch:{loading:!0,error:null}});try{let e=await S({limit:pt,offset:B.length,...P?{search:P}:{},...F===`all`?{}:{status:F},...R?{channel:R}:{}});A({type:`patch`,patch:{sessions:[...B,...e.items],hasMore:e.hasMore}})}catch(e){A({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{A({type:`patch`,patch:{loading:!1}})}}},[r,H,U,B.length,P,F,R,t.loadError]),ye=(0,X.useCallback)((e,t)=>{A({type:`patch`,patch:{sessions:B.map(n=>n.key===e?{...n,status:t}:n),detailSession:G&&G.key===e?{...G,status:t}:G}})},[B,G]),xe=(0,X.useCallback)(async e=>{A({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{A({type:`patch`,patch:{detailSession:await h(e)}})}catch{A({type:`patch`,patch:{detailOpen:!1}})}finally{A({type:`patch`,patch:{detailLoading:!1}})}},[]),Se=e=>{xe(e)},q=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){A({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await C(e),ye(e,`archived`);break;case`unarchive`:await _(e),ye(e,`active`);break;case`pin`:await g(e),ye(e,`pinned`);break;case`unpin`:await b(e),ye(e,`active`);break;case`export`:{let t=await x(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}y().then(e=>A({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},De=async e=>{try{await v(e),A({type:`patch`,patch:{sessions:B.filter(t=>t.key!==e),detailSession:G?.key===e?null:G,...G?.key===e?{detailOpen:!1}:{}}}),y().then(e=>A({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},J={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Oe={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Y=[{key:`all`,label:t.filterAll,icon:re},{key:`active`,label:t.filterActive,icon:Ce},{key:`pinned`,label:t.filterPinned,icon:de},{key:`archived`,label:t.filterArchived,icon:fe}],ke=(()=>{let e=Object.entries(W?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(Te,{gap:`gap-6`,children:[(0,Z.jsx)(Ee,{title:t.title}),(0,Z.jsx)(xt,{s:t,activeTab:D,onChange:O}),(0,Z.jsx)(St,{s:t,id:`settings`,activeTab:D,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(nt,{hasToken:r}),(0,Z.jsx)(lt,{hasToken:r})]})}),(0,Z.jsxs)(St,{s:t,id:`sessions`,activeTab:D,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(I,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:Y.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":F===e,onClick:()=>A({type:`patch`,patch:{statusFilter:e}}),className:u(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,V.transition,V.focusRingPanel,F===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(ne,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:N,onChange:e=>A({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":P||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(I,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!R,onClick:()=>A({type:`patch`,patch:{channelFilter:``}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,V.transition,V.focusRingPanel,R?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),ke.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":R===e,onClick:()=>A({type:`patch`,patch:{channelFilter:e}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,V.transition,V.focusRingPanel,R===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,W?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:W.byChannel[e]})]},e))]}),W?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[W.totalSessions,t.totalSessions],[W.activeSessions,t.activeSessions],[W.pinnedSessions,t.pinnedSessions],[W.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,ie?(0,Z.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:ie}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:B.length})}),(0,Z.jsxs)(I,{className:z,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Z.jsx)(T,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":L===`grid`,onClick:()=>A({type:`patch`,patch:{viewMode:`grid`}}),className:u(be,`size-7 p-0`,L===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(ve,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(T,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":L===`list`,onClick:()=>A({type:`patch`,patch:{viewMode:`list`}}),className:u(be,`size-9 p-0`,L===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,L===`list`&&`text-accent-fg`),children:(0,Z.jsx)(M,{className:`size-3.5`,strokeWidth:1.5})})]})]}),H&&B.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):B.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(c,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(T,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:u(`grid min-w-0 gap-3`,L===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":P||void 0,children:B.map(e=>{let t=ze(e,s);return(0,Z.jsx)(Pe,{session:e,variant:L,labels:J,sessionAgentId:t,sessionAgentAvatar:Be(t,d),onOpen:()=>Se(e.key),onAction:t=>void q(e.key,t)},e.key)})}),U?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(T,{type:`button`,variant:`secondary`,disabled:H,onClick:()=>void _e(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(dt,{open:oe,loading:ue,session:G,sessionAgentId:G?ze(G,s):void 0,sessionAgentAvatar:G?Be(ze(G,s),d):void 0,labels:Oe,onClose:()=>{A({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>G&&void q(G.key,`archive`),onUnarchive:()=>G&&void q(G.key,`unarchive`),onPin:()=>G&&void q(G.key,`pin`),onUnpin:()=>G&&void q(G.key,`unpin`),onExport:()=>G&&void q(G.key,`export`),onDelete:()=>G&&A({type:`patch`,patch:{confirmKey:G.key,confirmOpen:!0}})}),(0,Z.jsx)(we,{open:me,onOpenChange:e=>A({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(le,{children:[(0,Z.jsx)(se,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ee)}),(0,Z.jsxs)(ce,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,j),children:[(0,Z.jsx)(te,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:he?mt(t.deleteSessionMessage,{name:B.find(e=>e.key===he)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(T,{type:`button`,variant:`secondary`,onClick:()=>A({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(T,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{he&&De(he),A({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ln as e}from"./index-DRyGCING.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Ns as r,Zl as i}from"./index-DRyGCING.js";var a=e();function o(){return`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(7),{children:r,className:i,id:c,onBlurCapture:l}=e,u;t[0]===i?u=t[1]:(u=n(o(),i),t[0]=i,t[1]=u);let d;return t[2]!==r||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,s.jsx)(`section`,{id:c,className:u,onBlurCapture:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6],d}var l=`mt-0.5 flex size-7 shrink-0 items-center justify-center text-fg-muted transition-colors`;function u(e){let t=(0,a.c)(27),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v,y;if(t[2]!==p||t[3]!==m||t[4]!==h||t[5]!==_){let e=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press),a=!!(m&&h);t[8]===p?v=t[9]:(v=n(`mb-4 flex items-start gap-2.5`,p),t[8]=p,t[9]=v),y=m?a?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(i,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[2]=p,t[3]=m,t[4]=h,t[5]=_,t[6]=v,t[7]=y}else v=t[6],y=t[7];let b;t[10]===c?b=t[11]:(b=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[10]=c,t[11]=b);let x;t[12]!==b||t[13]!==f?(x=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[b,f]}),t[12]=b,t[13]=f,t[14]=x):x=t[14];let S;t[15]===u?S=t[16]:(S=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[15]=u,t[16]=S);let C;t[17]!==x||t[18]!==S?(C=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===d?w=t[21]:(w=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[20]=d,t[21]=w);let T;return t[22]!==v||t[23]!==y||t[24]!==C||t[25]!==w?(T=(0,s.jsxs)(`div`,{className:v,children:[y,C,w]}),t[22]=v,t[23]=y,t[24]=C,t[25]=w,t[26]=T):T=t[26],T}export{u as n,o as r,c as t};
|
package/dist/gateway/static/root/assets/{settings-page-DvVMpKiA.js → settings-page-B6Mv02eg.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as o}from"./messages-BYq0cPbn.js";import{n as s}from"./locale-store-B7s2Hb35.js";import{_o as c,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as o}from"./messages-BYq0cPbn.js";import{n as s}from"./locale-store-B7s2Hb35.js";import{_o as c,bo as l,do as u,fo as d,go as f,ho as p,lo as m,mo as h,po as g,uo as _,vo as v,xo as y,yo as b}from"./index-DRyGCING.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>b().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>u().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>f().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>y().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>d().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>_().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>h().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>v().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>c().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>l().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>m().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>g().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=s(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(s===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(s===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(s===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(s===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(s===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(s===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(s===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(s===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(s===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./locale-store-B7s2Hb35.js";import{t as o}from"./button-aIC072nz.js";import{xl as s}from"./index-DRyGCING.js";var c=e(),l=t();function u(e){let t=(0,c.c)(14),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({children:n,className:r,gap:o,padding:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let u=o===void 0?`gap-5`:o,d=s===void 0?`px-4 py-6 sm:px-5 xl:px-6`:s,f;t[6]!==r||t[7]!==u||t[8]!==d?(f=i(`settings-page-frame mx-auto flex min-h-full w-full max-w-[56rem] flex-col`,u,d,r),t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==a||t[12]!==f?(p=(0,l.jsx)(`div`,{className:f,...a,children:n}),t[10]=n,t[11]=a,t[12]=f,t[13]=p):p=t[13],p}var d={phone:{scene:`configure-phone`,zh:`帮我配置 Phone Use,从模型、依赖、手机连接到验收。`,en:`Help configure Phone Use: model, dependencies, phone connection and verification.`},browser:{scene:`configure-xopc`,zh:`帮我配置 Browser Use,连接本机 Chrome 并完成验收。`,en:`Help me configure Browser Use with local Chrome and verify it.`}};function f(e){let t=(0,c.c)(8),{target:r}=e,i=a(p)===`zh`,u=d[r],f=i?u.zh:u.en,m;t[0]!==u.scene||t[1]!==f?(m=new URLSearchParams({skill:`configure-xopc`,scene:u.scene,draft:f,autoSend:`1`}),t[0]=u.scene,t[1]=f,t[2]=m):m=t[2];let h=`/chat/new?${m}`,g=i?`让 AI 帮我配置`:`Set up with AI`,_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,l.jsx)(s,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[3]=_):_=t[3];let v=i?`AI 配置`:`AI setup`,y;return t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,l.jsx)(o,{asChild:!0,className:`order-first whitespace-nowrap sm:order-last text-accent-fg shadow-none sm:shadow-none`,children:(0,l.jsxs)(n,{to:h,title:g,children:[_,v]})}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7],y}function p(e){return e.language}function m(e){let t=(0,c.c)(22),{title:n,subtitle:a,docsLink:o,docsLabel:s,meta:u,actions:d,aiSetup:p,className:m}=e,h=p?`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3`:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,g;t[0]!==m||t[1]!==h?(g=i(h,m),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=(0,l.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight sm:text-lg text-fg`,children:n}),t[3]=n,t[4]=_);let v;t[5]===a?v=t[6]:(v=a?(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:a}):null,t[5]=a,t[6]=v);let y;t[7]!==s||t[8]!==o?(y=o&&s?(0,l.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:`touch-target mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[s,(0,l.jsx)(r,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[7]=s,t[8]=o,t[9]=y):y=t[9];let b;t[10]!==u||t[11]!==_||t[12]!==v||t[13]!==y?(b=(0,l.jsxs)(`div`,{className:`min-w-0`,children:[_,v,y,u]}),t[10]=u,t[11]=_,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]!==d||t[16]!==p?(x=d||p?(0,l.jsxs)(`div`,{className:i(`flex shrink-0 items-center gap-2`,p?`min-w-0 max-w-[50vw] flex-col items-end sm:flex-row sm:justify-end`:`flex-wrap justify-start sm:justify-end`),children:[d,p&&(0,l.jsx)(f,{target:p})]}):null,t[15]=d,t[16]=p,t[17]=x):x=t[17];let S;return t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,l.jsxs)(`header`,{className:g,children:[b,x]}),t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}export{u as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import"./settings-page-header-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import"./settings-page-header-BWyxJKOG.js";var r=e(),i=t();function a(e){let t=(0,r.c)(13),{id:a,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0?!0:d,g=f===void 0?!0:f;if(o!==a)return null;let _=`${c}-${a}`,v=`${s}-${a}`,y=g&&`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,i.jsxs)(`div`,{className:`mb-5`,children:[l?(0,i.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,i.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,i.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./refresh-cw-BRlGaq2w.js";import{t as c}from"./messages-BYq0cPbn.js";import{t as l}from"./cn-0WouolD0.js";import{i as u,l as d,n as f,o as p}from"./locale-store-B7s2Hb35.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{t as h}from"./button-aIC072nz.js";import{t as g}from"./skeleton-BI5TyibZ.js";import{r as _}from"./gateway-config-swr-fQKBHBi1.js";import{n as v}from"./gateway-realtime-store-Bx9KCID-.js";import{n as y,t as b}from"./registry-api-BcfoLEna.js";import{n as x}from"./electron-env-Dit0bHgy.js";import{r as S,t as C}from"./runtime-tools-api-DesqGCnE.js";import{$d as w,Cn as T,Md as E,Ns as D,Ru as O,Td as k,di as A,hl as j,jo as M,ol as N,wd as P,zt as F}from"./index-DRyGCING.js";import{n as I,t as L}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";import{n as R,t as z}from"./settings-form-section-Brgd8IOV.js";import{t as ee}from"./settings-advanced-gate-D_8Mvnog.js";var B=n(),V=e(t(),1),H=r();function U(){let e=f(e=>e.language)===`zh`,t=c(e?`zh`:`en`).runtimeToolsSettings,{data:n,error:r,mutate:i}=m(u(`/api/runtime-tools`),C),[a,o]=(0,V.useState)(),[s,l]=(0,V.useState)(),d=n?.payload.statuses??[],p=d.some(e=>![`ready`,`disabled`,`unsupported`].includes(e.state));async function _(t,r){o(t),l(void 0);try{await S({runtime:t,action:r?`repair`:`install`,version:n?.payload.config[t].version,onProgress:e=>l(e.message)}),await i(),l(e?`操作完成,已刷新执行环境状态。`:`Completed and refreshed environment status.`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(void 0)}}return(0,H.jsxs)(`details`,{open:p||void 0,className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[e?`执行环境状态`:`Execution environment status`,n?` · ${d.filter(e=>e.state===`ready`).length}/${d.length}`:``]}),r?(0,H.jsxs)(`div`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[t.loadError,(0,H.jsx)(h,{variant:`ghost`,onClick:()=>void i(),children:t.refresh})]}):n?(0,H.jsx)(`div`,{className:`mt-3 space-y-3`,children:d.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg`,children:t.runtimeNames[e.runtime]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.message})]}),n.payload.config.enabled&&n.payload.config[e.runtime].enabled&&![`ready`,`disabled`,`unsupported`,`installing`].includes(e.state)?(0,H.jsx)(h,{disabled:!!a,onClick:()=>void _(e.runtime,e.repairable),children:a===e.runtime?t.working:e.repairable?t.repair:t.install}):null]},e.runtime))}):(0,H.jsx)(g,{className:`mt-3 h-20`}),s?(0,H.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-fg-muted`,children:s}):null]})}function W(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&M(e)).length}function G(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function K(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function q(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function J(e){return e?`pass`:`fail`}function te(e){if(e===`tool-runtimes`)return`/settings/runtimes`;if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/capabilities/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/capabilities/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function Y(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function X(e,t){let n=e.match(/^Run(?::|\s)(.*)$/i);if(n?.[1])return t.runCommand(n[1].trim());let r=e.match(/^Install(?::|\s)(.*)$/i);if(r?.[1])return t.installCommand(r[1].trim());let i=e.match(/^Start(?::|\s)(.*)$/i);return i?.[1]?t.startCommand(i[1].trim()):e}function Z(e,t){if(!t)return e;let n=e.message;if(e.id===`tool-runtimes`){let r=e.message.match(/^(.*) runtime is not installed\.$/),i=e.message.match(/^(.*) runtime installation is invalid\.$/);r?.[1]?n=t.runtimeMissing(r[1]):i?.[1]&&(n=t.runtimeInvalid(i[1]))}else if(e.id===`gateway-service`)if(e.message===`Gateway is not installed as a system service.`)n=t.gatewayNotInstalled;else{let r=e.message.match(/^Service backend unavailable: (.*)$/),i=e.message.match(/^Gateway service is installed but not running \(status: (.*)\)\.$/);r?.[1]?n=t.gatewayUnavailable(r[1]):i?.[1]&&(n=t.gatewayNotRunning(i[1]))}else e.id===`provider-auth`&&e.message===`No API keys detected for configured providers.`&&(n=t.providerAuthMissing);return{...e,label:t.labels[e.id]??e.label,message:n,hints:e.hints.map(e=>X(e,t))}}function ne(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=Z(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:te(n.id),source:`doctor`}}).toSorted((e,t)=>Y(t.status)-Y(e.status)||e.label.localeCompare(t.label))}function re(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let r of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let i=t.get(r);if(i){let t=Z(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:te(t.id)})}}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:e.copy?.labels[`logs-health`]??`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.copy?e.logsHealth.shuttingDown?e.copy.logsShuttingDown:t>0?e.copy.logsErrors(t):e.copy.logsHealthy:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[]){let r=t.message;if(e.copy){r={"Local Chromium is installed.":e.copy.chromiumInstalled,"Local Chromium is not installed.":e.copy.chromiumNotInstalled,"Chrome extension bridge is connected.":e.copy.extensionConnected,"Chrome extension needs refresh.":e.copy.extensionNeedsRefresh,"Chrome extension is installed but not connected.":e.copy.extensionNotConnected,"Chrome extension is not installed.":e.copy.extensionNotInstalled}[t.message]??t.message;let n=t.message.match(/^Browser driver "(.*)" is configured\.$/);n?.[1]&&(r=e.copy.browserDriverConfigured(n[1]))}n.push({...t,label:e.copy?.labels[t.id]??t.label,message:r})}return n}function ie(e){let t=W(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=G(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=K(e.config),l=e.skillCount>0,u=(e.doctorChecks??[]).filter(t=>!e.isElectron||t.id!==`gateway-service`),d=ne(u,e.labels.diagnostics),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:J(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:J(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:J(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=re({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics,copy:e.labels.diagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ae(e){return q(e)}function oe(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function se(){return u(`/api/doctor`)}async function ce(){return((await p(se())).checks??[]).map(oe).filter(e=>e!==null)}function le(){return u(`/api/logs/health`)}async function ue(){return p(le())}function Q(e){return e?`pass`:`warn`}function de(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function fe(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await p(u(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:Q(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await p(u(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function $(){let e=(0,B.c)(95),t=d(ve),n=f(_e),r;e[0]===n?r=e[1]:(r=c(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=i.setupStatus.diagnostics,s=v(ge),{data:l,error:u,isLoading:p,mutate:h}=_(!!t),g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},e[2]=g):g=e[2];let{data:S,error:C,isLoading:w,mutate:T}=m(t?`setup-checklist-skills`:null,he,g),E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},e[3]=E):E=e[3];let{data:D,error:O,isLoading:k,mutate:A}=m(t?`setup-checklist-provider-meta`:null,F,E),j;e[4]===t?j=e[5]:(j=t?se():null,e[4]=t,e[5]=j);let M;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(M={revalidateOnFocus:!1},e[6]=M):M=e[6];let{data:N,error:P,isLoading:I,mutate:L}=m(j,ce,M),R;e[7]===t?R=e[8]:(R=t?le():null,e[7]=t,e[8]=R);let z;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[9]=z):z=e[9];let{data:ee,isLoading:V,mutate:H}=m(R,ue,z);l?.payload?.config;let U=l?.payload?.config,W;e[10]===U?W=e[11]:(W=ae(U),e[10]=U,e[11]=W);let G=t?W:null,K;e[12]===G?K=e[13]:(K=de(G),e[12]=G,e[13]=K);let q;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[14]=q):q=e[14];let{data:J,isLoading:te,mutate:Y}=m(K,me,q),X;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(X={revalidateOnFocus:!1},e[15]=X):X=e[15],m(t?b:null,y,X);let Z=!t||!p&&!w&&!k&&!I&&!V&&!te,ne=!!(u||C||O||P),re;bb0:{if(!t||!Z){re=null;break bb0}let n=S?.catalog?.length??0,r;if(e[16]!==J||e[17]!==l?.payload?.config||e[18]!==o.browserDriverConfigured||e[19]!==o.chromiumInstalled||e[20]!==o.chromiumNotInstalled||e[21]!==o.extensionConnected||e[22]!==o.extensionNeedsRefresh||e[23]!==o.extensionNotConnected||e[24]!==o.extensionNotInstalled||e[25]!==o.gatewayNotInstalled||e[26]!==o.gatewayNotRunning||e[27]!==o.gatewayUnavailable||e[28]!==o.installCommand||e[29]!==o.labels||e[30]!==o.logsErrors||e[31]!==o.logsHealthy||e[32]!==o.logsShuttingDown||e[33]!==o.providerAuthMissing||e[34]!==o.runCommand||e[35]!==o.runtimeInvalid||e[36]!==o.runtimeMissing||e[37]!==o.startCommand||e[38]!==N||e[39]!==a.channelConfigured||e[40]!==a.channelMissing||e[41]!==a.gatewayOffline||e[42]!==a.gatewayOnline||e[43]!==a.modelConfigured||e[44]!==a.modelMissing||e[45]!==a.providersConfigured||e[46]!==a.providersMetaReady||e[47]!==a.providersMissing||e[48]!==a.skillsConfigured||e[49]!==a.skillsMissing||e[50]!==ee||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==D||e[53]!==s||e[54]!==n||e[55]!==t){let c=D?.filter(pe).length??0,u=D?.length??0,d;e[57]===a.providersConfigured?d=e[58]:(d=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[57]=a.providersConfigured,e[58]=d);let f;e[59]===a.providersMetaReady?f=e[60]:(f=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[59]=a.providersMetaReady,e[60]=f);let p;e[61]===a.modelConfigured?p=e[62]:(p=e=>a.modelConfigured.replace(`{{model}}`,e),e[61]=a.modelConfigured,e[62]=p);let m;e[63]===a.skillsConfigured?m=e[64]:(m=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[63]=a.skillsConfigured,e[64]=m);let h;e[65]===o.runtimeMissing?h=e[66]:(h=e=>o.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=o.runtimeMissing,e[66]=h);let g;e[67]===o.runtimeInvalid?g=e[68]:(g=e=>o.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=o.runtimeInvalid,e[68]=g);let _;e[69]===o.gatewayUnavailable?_=e[70]:(_=e=>o.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=o.gatewayUnavailable,e[70]=_);let v;e[71]===o.gatewayNotRunning?v=e[72]:(v=e=>o.gatewayNotRunning.replace(`{{status}}`,e),e[71]=o.gatewayNotRunning,e[72]=v);let y;e[73]===o.runCommand?y=e[74]:(y=e=>o.runCommand.replace(`{{command}}`,e),e[73]=o.runCommand,e[74]=y);let b;e[75]===o.installCommand?b=e[76]:(b=e=>o.installCommand.replace(`{{command}}`,e),e[75]=o.installCommand,e[76]=b);let S;e[77]===o.startCommand?S=e[78]:(S=e=>o.startCommand.replace(`{{command}}`,e),e[77]=o.startCommand,e[78]=S);let C;e[79]===o.logsErrors?C=e[80]:(C=e=>o.logsErrors.replace(`{{count}}`,String(e)),e[79]=o.logsErrors,e[80]=C);let w;e[81]===o.browserDriverConfigured?w=e[82]:(w=e=>o.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=o.browserDriverConfigured,e[82]=w),r=ie({isElectron:x(),hasToken:!!t,realtimeConnected:s,config:l?.payload?.config,skillCount:n,providerMeta:u>0?{configured:c,total:u}:null,doctorChecks:N,logsHealth:ee,browserDiagnostics:J,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:d,providersMetaReady:f,providersMissing:a.providersMissing,modelConfigured:p,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:m,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage,diagnostics:{labels:o.labels,runtimeMissing:h,runtimeInvalid:g,gatewayNotInstalled:o.gatewayNotInstalled,gatewayUnavailable:_,gatewayNotRunning:v,providerAuthMissing:o.providerAuthMissing,runCommand:y,installCommand:b,startCommand:S,logsHealthy:o.logsHealthy,logsShuttingDown:o.logsShuttingDown,logsErrors:C,chromiumInstalled:o.chromiumInstalled,chromiumNotInstalled:o.chromiumNotInstalled,extensionConnected:o.extensionConnected,extensionNeedsRefresh:o.extensionNeedsRefresh,extensionNotConnected:o.extensionNotConnected,extensionNotInstalled:o.extensionNotInstalled,browserDriverConfigured:w}}}),e[16]=J,e[17]=l?.payload?.config,e[18]=o.browserDriverConfigured,e[19]=o.chromiumInstalled,e[20]=o.chromiumNotInstalled,e[21]=o.extensionConnected,e[22]=o.extensionNeedsRefresh,e[23]=o.extensionNotConnected,e[24]=o.extensionNotInstalled,e[25]=o.gatewayNotInstalled,e[26]=o.gatewayNotRunning,e[27]=o.gatewayUnavailable,e[28]=o.installCommand,e[29]=o.labels,e[30]=o.logsErrors,e[31]=o.logsHealthy,e[32]=o.logsShuttingDown,e[33]=o.providerAuthMissing,e[34]=o.runCommand,e[35]=o.runtimeInvalid,e[36]=o.runtimeMissing,e[37]=o.startCommand,e[38]=N,e[39]=a.channelConfigured,e[40]=a.channelMissing,e[41]=a.gatewayOffline,e[42]=a.gatewayOnline,e[43]=a.modelConfigured,e[44]=a.modelMissing,e[45]=a.providersConfigured,e[46]=a.providersMetaReady,e[47]=a.providersMissing,e[48]=a.skillsConfigured,e[49]=a.skillsMissing,e[50]=ee,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=D,e[53]=s,e[54]=n,e[55]=t,e[56]=r}else r=e[56];re=r}let oe=re,Q;e[83]!==Y||e[84]!==h||e[85]!==L||e[86]!==H||e[87]!==A||e[88]!==T?(Q=async()=>{await Promise.all([h(),T(),A(),L(),H(),Y()])},e[83]=Y,e[84]=h,e[85]=L,e[86]=H,e[87]=A,e[88]=T,e[89]=Q):Q=e[89];let fe=Q,$;return e[90]!==ne||e[91]!==Z||e[92]!==fe||e[93]!==oe?($={ready:Z,error:ne,snapshot:oe,refresh:fe},e[90]=ne,e[91]=Z,e[92]=fe,e[93]=oe,e[94]=$):$=e[94],$}function pe(e){return e.configured}function me(e){let[,t]=e;return fe(t)}function he(){return A()}function ge(e){return e.connectionState===`connected`}function _e(e){return e.language}function ve(e){return e.conversationId}function ye(e){return e===`pass`?`bg-success-soft text-success`:e===`warn`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-surface-hover text-fg-muted`}function be(e){return e===`pass`?a:e===`warn`?N:e===`fail`?k:O}function xe(e,t){return e===`blocked`?{icon:k,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:N,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:P,className:`bg-surface-hover/50 text-fg`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Se(e){let t=(0,B.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:u,doctorRunning:d,doctorRunState:p}=e,m=f(Ce),h,g,_,v,y,b,x,S,C;if(t[0]!==r||t[1]!==m||t[2]!==n){g=c(m).setupStatus;let e=xe(n,g),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,s=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;h=o?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,H.jsx)(E,{className:`size-4`,"aria-hidden":!0})]}):(0,H.jsxs)(i,{to:s,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,H.jsx)(E,{className:`size-4`,"aria-hidden":!0})]}),C=l(`rounded-xl p-4`,e.className),S=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,b=`flex min-w-0 gap-3`,x=(0,H.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),_=`min-w-0`,v=(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),y=r>0?(0,H.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:g.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=m,t[2]=n,t[3]=h,t[4]=g,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x,t[10]=S,t[11]=C}else h=t[3],g=t[4],_=t[5],v=t[6],y=t[7],b=t[8],x=t[9],S=t[10],C=t[11];let w;t[12]!==_||t[13]!==v||t[14]!==y?(w=(0,H.jsxs)(`div`,{className:_,children:[v,y]}),t[12]=_,t[13]=v,t[14]=y,t[15]=w):w=t[15];let T;t[16]!==b||t[17]!==x||t[18]!==w?(T=(0,H.jsxs)(`div`,{className:b,children:[x,w]}),t[16]=b,t[17]=x,t[18]=w,t[19]=T):T=t[19];let O;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=l(`inline-flex items-center gap-2 rounded-lg bg-surface-base/70 px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,D.press),t[20]=O):O=t[20];let k=!u||d,A;t[21]===d?A=t[22]:(A=d?(0,H.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,H.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[21]=d,t[22]=A);let j=d?g.health.runDoctorRunning:g.health.runDoctor,M;t[23]!==d||t[24]!==a||t[25]!==k||t[26]!==A||t[27]!==j?(M=(0,H.jsxs)(`button`,{type:`button`,className:O,onClick:a,disabled:k,"aria-busy":d,children:[A,j]}),t[23]=d,t[24]=a,t[25]=k,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==M?(N=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[h,M]}),t[29]=h,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==S||t[34]!==T?(P=(0,H.jsxs)(`div`,{className:S,children:[T,N]}),t[32]=N,t[33]=S,t[34]=T,t[35]=P):P=t[35];let F;t[36]!==p||t[37]!==d||t[38]!==g.health.doctorCompleteMessage||t[39]!==g.health.doctorFailedMessage||t[40]!==g.health.doctorRunningMessage?(F=d||p!==`idle`?(0,H.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:d?g.health.doctorRunningMessage:p===`success`?g.health.doctorCompleteMessage:g.health.doctorFailedMessage}):null,t[36]=p,t[37]=d,t[38]=g.health.doctorCompleteMessage,t[39]=g.health.doctorFailedMessage,t[40]=g.health.doctorRunningMessage,t[41]=F):F=t[41];let I;return t[42]!==P||t[43]!==F||t[44]!==C?(I=(0,H.jsxs)(`section`,{className:C,children:[P,F]}),t[42]=P,t[43]=F,t[44]=C,t[45]=I):I=t[45],I}function Ce(e){return e.language}function we(e){let t=(0,B.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,H.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,H.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,H.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]===n.hints[0]?u=t[9]:(u=n.hints[0]?(0,H.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[8]=n.hints[0],t[9]=u);let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n.path?(f=n.path?(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,H.jsx)(E,{className:`size-4`,"aria-hidden":!0})]}):null,t[14]=r,t[15]=n.path,t[16]=f):f=t[16];let p;t[17]!==s||t[18]!==d||t[19]!==f?(p=(0,H.jsxs)(H.Fragment,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m=p;if(n.path){let e;return t[21]!==m||t[22]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex items-start gap-3 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m}),t[21]=m,t[22]=n.path,t[23]=e):e=t[23],e}let h;return t[24]===m?h=t[25]:(h=(0,H.jsx)(`div`,{className:`flex items-start gap-3 px-1 py-3`,children:m}),t[24]=m,t[25]=h),h}function Te(e){let t=(0,B.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s=r[n.id]??n.title,c;t[2]===n.status?c=t[3]:(c=l(`flex size-7 shrink-0 items-center justify-center rounded-full`,ye(n.status)),t[2]=n.status,t[3]=c);let u;t[4]===o?u=t[5]:(u=(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,H.jsx)(`span`,{className:c,children:u}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f;t[9]===s?f=t[10]:(f=(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:s}),t[9]=s,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,H.jsx)(E,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,H.jsxs)(H.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,H.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function Ee(e){let t=(0,B.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,H.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==r||t[12]!==n.path?(d=n.path?(0,H.jsx)(`span`,{className:`sr-only`,children:r}):null,t[11]=r,t[12]=n.path,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==u||t[16]!==d?(f=(0,H.jsxs)(H.Fragment,{children:[s,u,d]}),t[14]=s,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p=f;if(n.path){let e;return t[18]!==p||t[19]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p}),t[18]=p,t[19]=n.path,t[20]=e):e=t[20],e}let m;return t[21]===p?m=t[22]:(m=(0,H.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 px-1 py-3`,children:p}),t[21]=p,t[22]=m),m}function De(){let e=c(f(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=$(),[a,o]=(0,V.useState)(!1),[s,l]=(0,V.useState)(`idle`),u=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],d=async()=>{if(!(a||!t)){o(!0),l(`idle`);try{await i(),l(`success`)}catch{l(`error`)}finally{o(!1)}}};return(0,H.jsxs)(I,{gap:`gap-6`,children:[(0,H.jsx)(L,{title:e.title}),n?(0,H.jsx)(`p`,{className:`rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,H.jsx)(T,{sections:2}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Se,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void d(),doctorRunning:a,doctorRunState:s}),(0,H.jsxs)(z,{id:`next-steps`,children:[(0,H.jsx)(R,{icon:r.issues.length?N:w,title:e.nextStepsTitle}),r.issues.length?(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:r.issues.slice(0,8).map(t=>(0,H.jsx)(we,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:bg-surface-base/45`,children:r.readiness.map(t=>(0,H.jsx)(Te,{item:t,labels:e.readinessLabels},t.id))})]}),(0,H.jsx)(U,{}),(0,H.jsx)(ee,{children:(0,H.jsxs)(z,{children:[(0,H.jsx)(R,{icon:j,title:e.diagnosticsTitle}),u.length?(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:u.map(t=>(0,H.jsx)(Ee,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,H.jsx)(`p`,{className:`mt-3 py-2 text-sm text-fg-muted`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{De as SetupStatusPanel};
|