tarsk 0.6.87 → 0.6.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -24
- package/dist/bundled-skills/email-me/SKILL.md +15 -0
- package/dist/bundled-skills/email-me/scripts/__tests__/email_me.test.js +64 -0
- package/dist/bundled-skills/email-me/scripts/email_me.js +45 -0
- package/dist/bundled-skills/handoff/SKILL.md +19 -0
- package/dist/bundled-skills/tarsk-agent/SKILL.md +372 -0
- package/dist/bundled-skills/tarsk-ask-user/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-ask-user/scripts/ask_user.js +101 -0
- package/dist/bundled-skills/tarsk-bash/SKILL.md +17 -0
- package/dist/bundled-skills/tarsk-bash/scripts/bash.js +248 -0
- package/dist/bundled-skills/tarsk-browser/SKILL.md +17 -0
- package/dist/bundled-skills/tarsk-browser/scripts/browser.js +252 -0
- package/dist/bundled-skills/tarsk-chat-title/SKILL.md +14 -0
- package/dist/bundled-skills/tarsk-chat-title/scripts/chat_title.js +37 -0
- package/dist/bundled-skills/tarsk-connect-mcp/SKILL.md +23 -0
- package/dist/bundled-skills/tarsk-connect-mcp/scripts/__tests__/connect_mcp.test.js +68 -0
- package/dist/bundled-skills/tarsk-connect-mcp/scripts/connect_mcp.js +119 -0
- package/dist/bundled-skills/tarsk-create-project/SKILL.md +25 -0
- package/dist/bundled-skills/tarsk-create-project/scripts/__tests__/create_project.test.js +94 -0
- package/dist/bundled-skills/tarsk-create-project/scripts/create_project.js +88 -0
- package/dist/bundled-skills/tarsk-edit/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-edit/scripts/edit.js +118 -0
- package/dist/bundled-skills/tarsk-execute-skill-script/SKILL.md +19 -0
- package/dist/bundled-skills/tarsk-execute-skill-script/scripts/execute_skill_script.js +77 -0
- package/dist/bundled-skills/tarsk-fetch/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-fetch/scripts/fetch.js +38 -0
- package/dist/bundled-skills/tarsk-find/SKILL.md +16 -0
- package/dist/bundled-skills/tarsk-find/scripts/find.js +78 -0
- package/dist/bundled-skills/tarsk-find-images/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-find-images/scripts/find_images.js +78 -0
- package/dist/bundled-skills/tarsk-generate-image/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-generate-image/scripts/generate_image.js +55 -0
- package/dist/bundled-skills/tarsk-get-observation/SKILL.md +19 -0
- package/dist/bundled-skills/tarsk-get-observation/scripts/get_observation.js +293 -0
- package/dist/bundled-skills/tarsk-grep/SKILL.md +16 -0
- package/dist/bundled-skills/tarsk-grep/scripts/grep.js +174 -0
- package/dist/bundled-skills/tarsk-history/SKILL.md +15 -0
- package/dist/bundled-skills/tarsk-history/scripts/history.js +68 -0
- package/dist/bundled-skills/tarsk-improve/SKILL.md +232 -0
- package/dist/bundled-skills/tarsk-improve/references/signals.md +16 -0
- package/dist/bundled-skills/tarsk-improve/scripts/durable-runs.ts +635 -0
- package/dist/bundled-skills/tarsk-improve/scripts/ensure-exported.ts +238 -0
- package/dist/bundled-skills/tarsk-improve/scripts/export-tool-skills-lib.ts +299 -0
- package/dist/bundled-skills/tarsk-improve/scripts/summarize-session.ts +126 -0
- package/dist/bundled-skills/tarsk-jobs/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-jobs/scripts/job_kill.js +45 -0
- package/dist/bundled-skills/tarsk-jobs/scripts/job_list.js +64 -0
- package/dist/bundled-skills/tarsk-jobs/scripts/job_output.js +66 -0
- package/dist/bundled-skills/tarsk-notes/SKILL.md +17 -0
- package/dist/bundled-skills/tarsk-notes/scripts/notes.js +86 -0
- package/dist/bundled-skills/tarsk-projects/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-projects/scripts/projects.js +54 -0
- package/dist/bundled-skills/tarsk-prompt-project/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-prompt-project/scripts/prompt_project.js +58 -0
- package/dist/bundled-skills/tarsk-propose-branch/SKILL.md +16 -0
- package/dist/bundled-skills/tarsk-propose-branch/scripts/propose_branch.js +45 -0
- package/dist/bundled-skills/tarsk-read/SKILL.md +17 -0
- package/dist/bundled-skills/tarsk-read/scripts/read.js +331 -0
- package/dist/bundled-skills/tarsk-read-skill/SKILL.md +16 -0
- package/dist/bundled-skills/tarsk-read-skill/scripts/read_skill.js +37 -0
- package/dist/bundled-skills/tarsk-read-skill-reference/SKILL.md +19 -0
- package/dist/bundled-skills/tarsk-read-skill-reference/scripts/read_skill_reference.js +60 -0
- package/dist/bundled-skills/tarsk-run-js/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-run-js/scripts/run_js.js +192 -0
- package/dist/bundled-skills/tarsk-tasks/SKILL.md +18 -0
- package/dist/bundled-skills/tarsk-tasks/scripts/tasks.js +96 -0
- package/dist/bundled-skills/tarsk-todo/SKILL.md +16 -0
- package/dist/bundled-skills/tarsk-todo/scripts/todo.js +165 -0
- package/dist/bundled-skills/tarsk-web-search/SKILL.md +15 -0
- package/dist/bundled-skills/tarsk-web-search/scripts/web_search.js +120 -0
- package/dist/bundled-skills/tarsk-write/SKILL.md +16 -0
- package/dist/bundled-skills/tarsk-write/scripts/write.js +57 -0
- package/dist/index.js +217754 -211927
- package/dist/public/assets/{alert-dialog-DVaEQlVa.js → alert-dialog-BcZULJsX.js} +1 -1
- package/dist/public/assets/api-8Rp2LlXt.js +1 -0
- package/dist/public/assets/api-Cp9I7CxD.js +2 -0
- package/dist/public/assets/{async-error-boundary-DH6Sqgmt.js → async-error-boundary-CFVUPiuG.js} +1 -1
- package/dist/public/assets/browser-tab-CPPorbL6.js +12 -0
- package/dist/public/assets/button-DDaJhJP1.js +1 -0
- package/dist/public/assets/{card-BkOGFps5.js → card-DAc45J1v.js} +1 -1
- package/dist/public/assets/chat-dock-context-DbiJNr3O.js +1 -0
- package/dist/public/assets/chat-handlers-context-DYU2LQ5V.js +9 -0
- package/dist/public/assets/commit-dialog-DPaci3dp.js +1 -0
- package/dist/public/assets/{commit-error-dialog-D3S6kRVr.js → commit-error-dialog-Dnlkgb_H.js} +1 -1
- package/dist/public/assets/{commit-method-fields-BEKfSRyW.js → commit-method-fields-Xt3vbwUg.js} +1 -1
- package/dist/public/assets/conversation-history-view-CqIugfyO.js +1 -0
- package/dist/public/assets/{create-project-dialog-nquqlloK.js → create-project-dialog-DStWPoDE.js} +2 -2
- package/dist/public/assets/{create-project-workspace-C4tXAUWJ.js → create-project-workspace-CJ94yHAB.js} +2 -2
- package/dist/public/assets/create-repo-dialog-B_QiEz-v.js +1 -0
- package/dist/public/assets/{delete-confirm-dialog-SpYpU1AX.js → delete-confirm-dialog-D1N86piR.js} +1 -1
- package/dist/public/assets/dialog-D_12AsZd.js +1 -0
- package/dist/public/assets/diff-view-4koPcOcE.js +4 -0
- package/dist/public/assets/{dist-NcyjV9Gu.js → dist-2xH_pFmV.js} +1 -1
- package/dist/public/assets/{dist-BTu7PDzc.js → dist-AbkJBHH5.js} +1 -1
- package/dist/public/assets/{dist-lFBinzor.js → dist-B-h6Wj39.js} +1 -1
- package/dist/public/assets/dist-CgbWuuq4.js +1 -0
- package/dist/public/assets/{dist-f54JuzFV.js → dist-DOz2WXwX.js} +1 -1
- package/dist/public/assets/{dist-CqrmQxmV.js → dist-DfnQ9YJh.js} +1 -1
- package/dist/public/assets/{dist-BOfRC57H.js → dist-JGbQ_EJY.js} +1 -1
- package/dist/public/assets/{dist-ButPmyjr.js → dist-pCVg1Jdl.js} +1 -1
- package/dist/public/assets/dist-v_MvKS2-.js +2 -0
- package/dist/public/assets/{es2015-CE7VcoOH.js → es2015-eNVkKfFF.js} +1 -1
- package/dist/public/assets/{explorer-file-drop-CEbBlDEp.js → explorer-file-drop-DAP7ha-E.js} +1 -1
- package/dist/public/assets/{explorer-monaco-editor-Bgo9Y1cP.js → explorer-monaco-editor-ChJZBFy5.js} +1 -1
- package/dist/public/assets/explorer-tab-view-Bt9hRZUm.js +2 -0
- package/dist/public/assets/explorer-tree-CAs89lPz.js +1 -0
- package/dist/public/assets/{explorer-view-BuTa_0Uq.js → explorer-view-B1JuejkU.js} +3 -3
- package/dist/public/assets/git-history-dialog-Dqj1p35g.js +1 -0
- package/dist/public/assets/index-CcAwxnT5.js +97 -0
- package/dist/public/assets/index-dNrgKdYv.css +1 -0
- package/dist/public/assets/{label-C31qF5zZ.js → label-BCs5CZEs.js} +1 -1
- package/dist/public/assets/markdown-renderer-DQONI6WG.js +10 -0
- package/dist/public/assets/{mcp-manager-C3K_62H2.js → mcp-manager-D2FG-h2e.js} +1 -1
- package/dist/public/assets/{minus-l6BdrAEk.js → minus-CgQcbBQT.js} +1 -1
- package/dist/public/assets/{model-list-controls-DwW8S18v.js → model-list-controls-B6ofHWh3.js} +1 -1
- package/dist/public/assets/onboarding-dialog-DAut3X4K.js +1 -0
- package/dist/public/assets/{pill-tabs-CmvvHdKG.js → pill-tabs-BAhOHad7.js} +1 -1
- package/dist/public/assets/progress-indicator-hJ74ac5W.js +1 -0
- package/dist/public/assets/project-coding-view-B2FpHeiO.js +1 -0
- package/dist/public/assets/{project-danger-zone-view-D18k4pUF.js → project-danger-zone-view-BqP1dcRT.js} +1 -1
- package/dist/public/assets/{project-env-vars-view-BWFqoaFD.js → project-env-vars-view-zhigkQFG.js} +1 -1
- package/dist/public/assets/project-model-aliases-view-APAVFfym.js +1 -0
- package/dist/public/assets/project-settings-view-FnK-LRsv.js +1 -0
- package/dist/public/assets/project-tools-view-Dmp5ViRC.js +1 -0
- package/dist/public/assets/providers-list-view-Clbp73Hh.js +1 -0
- package/dist/public/assets/pull-request-dialog-D40BQPMk.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-pkXK-VP2.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-DH91JHEC.js +1 -0
- package/dist/public/assets/query-keys-CcnonAAG.js +1 -0
- package/dist/public/assets/remote-media-url-C-GdJb-D.js +1 -0
- package/dist/public/assets/{scroll-area-BWc4OPsj.js → scroll-area-DGF9wUqQ.js} +1 -1
- package/dist/public/assets/{select-B6RizwDW.js → select-DMcNYwgt.js} +1 -1
- package/dist/public/assets/settings-general-tabs-view-DBZQbihJ.js +2 -0
- package/dist/public/assets/settings-general-view-0dhBET2R.js +1 -0
- package/dist/public/assets/{settings-list-D35rpAof.js → settings-list-Co3JPr9w.js} +1 -1
- package/dist/public/assets/settings-logs-view-DvHXUDko.js +5 -0
- package/dist/public/assets/settings-mcp-servers-view-414Dt5py.js +5 -0
- package/dist/public/assets/settings-models-view-ByeR7Enb.js +1 -0
- package/dist/public/assets/settings-plugins-view-8te2MPyh.js +2 -0
- package/dist/public/assets/settings-providers-view-BAuv9gam.js +2 -0
- package/dist/public/assets/settings-remote-machines-view-CHyywazU.js +1 -0
- package/dist/public/assets/settings-setup-view-Btp46Vh_.js +2 -0
- package/dist/public/assets/settings-skills-view-BNVx4bZl.js +2 -0
- package/dist/public/assets/{settings-slack-view-DkclyaBc.js → settings-slack-view-Caly5yGt.js} +1 -1
- package/dist/public/assets/settings-slash-commands-view-m6mp1knu.js +1 -0
- package/dist/public/assets/{settings-statistics-view-B03ZZjEy.js → settings-statistics-view-BnOxr4sZ.js} +1 -1
- package/dist/public/assets/settings-storage-view-Dg8xfpTG.js +1 -0
- package/dist/public/assets/settings-subagents-view-CucwEk2A.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-CEDU2saT.js +1 -0
- package/dist/public/assets/{settings-tab-bar-ajzyt79U.js → settings-tab-bar-CdIbQ0WI.js} +1 -1
- package/dist/public/assets/settings-view-XcJhRclT.js +2 -0
- package/dist/public/assets/{slug-utils-D2jhPz-o.js → slug-utils-CO6nui1C.js} +1 -1
- package/dist/public/assets/square-CtxvwmM2.js +1 -0
- package/dist/public/assets/store-W78TGOIO.js +8 -0
- package/dist/public/assets/{table-C3Hc0Gwy.js → table-CQMqIW_-.js} +1 -1
- package/dist/public/assets/task-utils-Cnq9Eszt.js +1 -0
- package/dist/public/assets/tasks-view-B8_jkq_a.js +1 -0
- package/dist/public/assets/{terminal-panel-DCKqScJu.js → terminal-panel-xoLVfA-h.js} +2 -2
- package/dist/public/assets/{toggle-group-DqSxGqvP.js → toggle-group-CPmseZfb.js} +1 -1
- package/dist/public/assets/{tooltip-CJKJfu0l.js → tooltip-CqwCZ7wt.js} +1 -1
- package/dist/public/assets/{use-account-settings-query-AUeOqKvo.js → use-account-settings-query-D_qL1I4w.js} +1 -1
- package/dist/public/assets/{use-active-dock-panel-instance-BvAhUd_V.js → use-active-dock-panel-instance-kmJOnmL7.js} +1 -1
- package/dist/public/assets/use-browser-overlay-block-CO1pUEAZ.js +1 -0
- package/dist/public/assets/{use-git-check-B_5Jak2s.js → use-git-check-BD9gdXpK.js} +1 -1
- package/dist/public/assets/{use-installed-ai-files-iy_AB0dN.js → use-installed-ai-files-Nn-sN_V2.js} +1 -1
- package/dist/public/assets/use-open-chat-dock-panel-CXzpgxVs.js +1 -0
- package/dist/public/assets/{use-projects-BmhAMgxB.js → use-projects-B0xTjTaA.js} +2 -2
- package/dist/public/assets/utils-CqsIXqSC.js +1 -0
- package/dist/public/assets/web-BNWoiS4w.js +1 -0
- package/dist/public/assets/web-C1tBQoCB.js +1 -0
- package/dist/public/assets/web-Dlo3GwCf.js +1 -0
- package/dist/public/assets/web-cJXG33sT.js +1 -0
- package/dist/public/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2 +0 -0
- package/dist/public/fonts/schibsted-grotesk-latin-wght-normal.woff2 +0 -0
- package/dist/public/index.html +46 -46
- package/package.json +9 -9
- package/dist/public/assets/account-view-5q3pHEHY.js +0 -1
- package/dist/public/assets/ai-spinner-DHwhlk4j.js +0 -1
- package/dist/public/assets/api-BdebJfuN.js +0 -1
- package/dist/public/assets/api-COO2LfdU.js +0 -2
- package/dist/public/assets/browser-overlay-block-CiDtkfup.js +0 -1
- package/dist/public/assets/browser-tab-CVdYLmW5.js +0 -12
- package/dist/public/assets/button-Dp5XDZNR.js +0 -1
- package/dist/public/assets/chat-dock-context-ymLoO90X.js +0 -1
- package/dist/public/assets/checkbox-D-BV8-Z_.js +0 -1
- package/dist/public/assets/commit-dialog-CEbCFh1x.js +0 -1
- package/dist/public/assets/conversation-history-view-CVMD8hUU.js +0 -1
- package/dist/public/assets/create-repo-dialog-B5IE3pUJ.js +0 -1
- package/dist/public/assets/dialog-pHPeIGaB.js +0 -1
- package/dist/public/assets/diff-view-Cy6nPdX-.js +0 -4
- package/dist/public/assets/dist-D5vgS4RP.js +0 -2
- package/dist/public/assets/explorer-tab-view-C-8QZO9S.js +0 -2
- package/dist/public/assets/explorer-tree-HrLSFgcI.js +0 -1
- package/dist/public/assets/git-history-dialog-ClfF5IOn.js +0 -1
- package/dist/public/assets/index-BBLA5zVt.css +0 -1
- package/dist/public/assets/index-CalVAwXj.js +0 -104
- package/dist/public/assets/markdown-renderer-DXRBG7uP.js +0 -10
- package/dist/public/assets/onboarding-dialog-BtLy0wjC.js +0 -1
- package/dist/public/assets/progress-indicator-4zQXqOqP.js +0 -1
- package/dist/public/assets/project-coding-view-CyJwnJes.js +0 -1
- package/dist/public/assets/project-model-aliases-view-D3tYNkkM.js +0 -1
- package/dist/public/assets/project-settings-view-0oN9vFvD.js +0 -1
- package/dist/public/assets/project-tools-view-DT87KPjE.js +0 -1
- package/dist/public/assets/providers-list-view-DCnh0W-5.js +0 -1
- package/dist/public/assets/pull-request-dialog-BdJxYQwu.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-Do9x9neW.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-C-9z2O0-.js +0 -1
- package/dist/public/assets/query-keys-BwswkbMn.js +0 -1
- package/dist/public/assets/remote-media-url-B8OFqxOM.js +0 -1
- package/dist/public/assets/settings-general-tabs-view-Dcek-ysB.js +0 -2
- package/dist/public/assets/settings-general-view-DhA2N6G5.js +0 -1
- package/dist/public/assets/settings-logs-view-eEUTIMeb.js +0 -5
- package/dist/public/assets/settings-mcp-servers-view-_oeuVkUe.js +0 -5
- package/dist/public/assets/settings-models-view-DW-ZmVup.js +0 -1
- package/dist/public/assets/settings-plugins-view-DTooco_c.js +0 -2
- package/dist/public/assets/settings-providers-view-CEeJkhg9.js +0 -2
- package/dist/public/assets/settings-remote-machines-view--UB8GlCK.js +0 -1
- package/dist/public/assets/settings-setup-view-DFL6DlYS.js +0 -2
- package/dist/public/assets/settings-skills-view-xS569-Kb.js +0 -2
- package/dist/public/assets/settings-slash-commands-view-DrCiayfq.js +0 -1
- package/dist/public/assets/settings-storage-view-CQnaVOt_.js +0 -1
- package/dist/public/assets/settings-subagents-view-DIctUJcE.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-BMDbrFRR.js +0 -1
- package/dist/public/assets/settings-view-8M6sbGiX.js +0 -2
- package/dist/public/assets/store-CxUwqrZ5.js +0 -8
- package/dist/public/assets/task-utils-WAei2PDi.js +0 -1
- package/dist/public/assets/tasks-view-DKyqgGdE.js +0 -1
- package/dist/public/assets/use-browser-overlay-block-z9imTmiZ.js +0 -1
- package/dist/public/assets/use-open-chat-dock-panel-w3hc5Vxn.js +0 -1
- package/dist/public/assets/utils-mYB1USG6.js +0 -1
- package/dist/public/assets/web-C6Gm4nQ0.js +0 -1
- package/dist/public/assets/web-DFlyNg8o.js +0 -1
- package/dist/public/assets/web-DlEPs8Xe.js +0 -1
- package/dist/public/assets/web-Gx3xReQH.js +0 -1
- package/dist/public/backgrounds/arctic-tundra.avif +0 -0
- package/dist/public/backgrounds/autumn-leaves.avif +0 -0
- package/dist/public/backgrounds/coastal-cliff.avif +0 -0
- package/dist/public/backgrounds/floating-waterfall.avif +0 -0
- package/dist/public/backgrounds/forest-path.avif +0 -0
- package/dist/public/backgrounds/garden-path.avif +0 -0
- package/dist/public/backgrounds/glow-marsh.avif +0 -0
- package/dist/public/backgrounds/golden-wheat.avif +0 -0
- package/dist/public/backgrounds/moon-desert.avif +0 -0
- package/dist/public/backgrounds/night-pond.avif +0 -0
- package/dist/public/backgrounds/prairie-grassland.avif +0 -0
- package/dist/public/backgrounds/river-winding.avif +0 -0
- package/dist/public/backgrounds/salt-flat.avif +0 -0
- package/dist/public/backgrounds/salt-marsh.avif +0 -0
- package/dist/public/backgrounds/sandy-beach.avif +0 -0
- package/dist/public/backgrounds/snow-river.avif +0 -0
- package/dist/public/backgrounds/sunset-pond.avif +0 -0
- package/dist/public/fonts/plus-jakarta-sans-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/public/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2 +0 -0
- package/dist/public/fonts/plus-jakarta-sans-latin-wght-normal.woff2 +0 -0
- package/dist/public/fonts/plus-jakarta-sans-vietnamese-wght-normal.woff2 +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{l as i}from"./chunk-QFMPRPBF-Cy-_pFSM.js";import{a,i as o}from"./use-account-settings-query-D_qL1I4w.js";import{S as s,U as c,v as l,x as u,y as d}from"./dist-v_MvKS2-.js";import{Xr as f,Zn as p,f as m}from"./api-Cp9I7CxD.js";import{t as h}from"./utils-CqsIXqSC.js";import{t as g}from"./check-skFQ1X72.js";import{t as _}from"./copy-bi9iX3xn.js";import{t as v}from"./loader-circle-CrqRIqdA.js";import{t as y}from"./button-DDaJhJP1.js";import{i as b,n as x,r as S,t as C}from"./tooltip-CqwCZ7wt.js";import{r as w}from"./scroll-area-DGF9wUqQ.js";import{t as T}from"./use-toast-CKgZ8YeP.js";import{G as E,Tt as D,at as O,gn as k,nt as A,pt as j}from"./index-CcAwxnT5.js";import{n as M,t as N}from"./toggle-group-CPmseZfb.js";var P=e(n(),1),F=t(),I=r();function L(e){let t=(0,F.c)(11),{enabled:n,isEnvConfigured:r,ingestingHost:i,isLoading:a,isSaving:o,onChange:s}=e,l=a||o,u;t[0]!==n||t[1]!==s||t[2]!==l?(u=(0,I.jsx)(E,{value:n,onChange:s,disabled:l,ariaLabel:`Enabled`}),t[0]=n,t[1]=s,t[2]=l,t[3]=u):u=t[3];let d;t[4]!==n||t[5]!==i||t[6]!==r?(d=n&&r&&i?(0,I.jsxs)(`p`,{className:`${c.bodyMuted} mt-3`,children:[`Also sending logs to Better Stack at`,` `,(0,I.jsx)(`span`,{className:c.mono,children:i})]}):null,t[4]=n,t[5]=i,t[6]=r,t[7]=d):d=t[7];let f;return t[8]!==u||t[9]!==d?(f=(0,I.jsx)(A,{title:`Enabled`,description:`Write verbose logs locally`,controlLayout:`row-end`,action:u,children:d}),t[8]=u,t[9]=d,t[10]=f):f=t[10],f}var R=u(`app.use-logging.hook`);function z(){let e=(0,F.c)(9),{data:t,isLoading:n}=o(),r=a(),i;e[0]===r?i=e[1]:(i=async function(e){try{await r.mutateAsync({loggingEnabled:e})}catch(e){let t=e;throw R.error(`Failed to update logging setting:`,t),t}},e[0]=r,e[1]=i);let s=i,c=t?.betterStackIngestingHost??null,l=t?.loggingEnabled??!1,u=t?.betterStackEnvConfigured??!1,d;return e[2]!==n||e[3]!==c||e[4]!==l||e[5]!==u||e[6]!==s||e[7]!==r.isPending?(d={ingestingHost:c,isEnabled:l,isEnvConfigured:u,isLoading:n,isSaving:r.isPending,updateIsEnabled:s},e[2]=n,e[3]=c,e[4]=l,e[5]=u,e[6]=s,e[7]=r.isPending,e[8]=d):d=e[8],d}function B(e,t){let n=[...e,t];return n.length>5e3?n.slice(n.length-l):n}function V(e,t){if(e.type!==`ping`){if(e.type===`snapshot`){t(e.entries);return}if(e.type===`cleared`){t([]);return}t(t=>B(t,e.entry))}}function H(e,t){if(t.isCancelled()||t.isAborted())return;let n=e instanceof Error?e.message:String(e);if(f(n)||t.sawSuccessfulStream){t.scheduleReconnect();return}t.setConnecting(!1),t.reportHardFailure(n),t.scheduleReconnect()}function U(e,t,n){let r=(t+e).split(`
|
|
2
|
+
`),i=r.pop()??``;for(let e of r){let t=e.trim();if(!t)continue;let r;try{r=JSON.parse(t)}catch{continue}n(r)}return i}var W=1e3,G=[d.INFO,d.WARN,d.ERROR],ee=[...G],K=`inline-flex h-11 shrink-0 rounded-full border bg-muted/40 p-2`,q=h(c.compact,`h-7 min-w-0 rounded-full border-0 px-2.5 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`),J=`group grid list-none grid-cols-[minmax(0,1fr)_1.75rem] items-start gap-2 px-3 py-2 hover:bg-muted/40 select-text`,te=h(`flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm hover:bg-background`,`transition-[opacity,color,background-color] focus-visible:opacity-100 focus-visible:pointer-events-auto`,`can-hover:pointer-events-none can-hover:opacity-0 can-hover:group-hover:pointer-events-auto can-hover:group-hover:opacity-100`);function ne(e,t){return!t||[e.event,e.message,X(e.level),e.data===void 0?``:Z(e.data)].join(` `).toLowerCase().includes(t)}function Y(e){let t=typeof e==`number`?e:Number(e);return t===d.DEBUG||t===d.INFO||t===d.WARN||t===d.ERROR?t:null}function X(e){let t=Y(e);return t===null?String(e):s(t)}function re(e,t){let n=Y(e.level);return n!==null&&t.has(n)}function Z(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function ie(e){switch(Y(e)??e){case d.ERROR:return`text-destructive`;case d.WARN:return`text-amber-600 dark:text-amber-400`;case d.INFO:return`text-foreground`;default:return`text-muted-foreground`}}function ae(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Q(e){let t=[`${e.ts} ${X(e.level)} ${e.event}`,e.message];return e.data!==void 0&&t.push(Z(e.data)),t.join(`
|
|
3
|
+
`)}var oe=(0,P.memo)(function(e){let t=(0,F.c)(42),{entry:n,copied:r,onCopy:i}=e,a;t[0]===n.ts?a=t[1]:(a=ae(n.ts),t[0]=n.ts,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,I.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:a}),t[2]=a,t[3]=o);let s;t[4]===n.level?s=t[5]:(s=h(`font-semibold`,ie(n.level)),t[4]=n.level,t[5]=s);let c;t[6]===n.level?c=t[7]:(c=X(n.level),t[6]=n.level,t[7]=c);let l;t[8]!==s||t[9]!==c?(l=(0,I.jsx)(`span`,{className:s,children:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u;t[11]===n.event?u=t[12]:(u=(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:n.event}),t[11]=n.event,t[12]=u);let d;t[13]!==o||t[14]!==l||t[15]!==u?(d=(0,I.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[o,l,u]}),t[13]=o,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f;t[17]===n.message?f=t[18]:(f=(0,I.jsx)(`p`,{className:`mt-0.5 whitespace-pre-wrap break-words text-foreground`,children:n.message}),t[17]=n.message,t[18]=f);let p;t[19]===n.data?p=t[20]:(p=n.data===void 0?null:(0,I.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words text-muted-foreground`,children:Z(n.data)}),t[19]=n.data,t[20]=p);let m;t[21]!==d||t[22]!==f||t[23]!==p?(m=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[d,f,p]}),t[21]=d,t[22]=f,t[23]=p,t[24]=m):m=t[24];let v;t[25]!==n||t[26]!==i?(v=()=>i(n),t[25]=n,t[26]=i,t[27]=v):v=t[27];let y;t[28]===r?y=t[29]:(y=r?(0,I.jsx)(g,{className:`h-3.5 w-3.5 text-brand`}):(0,I.jsx)(_,{className:`h-3.5 w-3.5`}),t[28]=r,t[29]=y);let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,I.jsx)(`span`,{className:`sr-only`,children:`Copy log entry`}),t[30]=S):S=t[30];let w;t[31]!==v||t[32]!==y?(w=(0,I.jsx)(b,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:v,className:te,children:[y,S]})}),t[31]=v,t[32]=y,t[33]=w):w=t[33];let T=r?`Copied!`:`Copy to clipboard`,E;t[34]===T?E=t[35]:(E=(0,I.jsx)(x,{children:T}),t[34]=T,t[35]=E);let D;t[36]!==w||t[37]!==E?(D=(0,I.jsxs)(C,{children:[w,E]}),t[36]=w,t[37]=E,t[38]=D):D=t[38];let O;return t[39]!==m||t[40]!==D?(O=(0,I.jsxs)(`li`,{className:J,children:[m,D]}),t[39]=m,t[40]=D,t[41]=O):O=t[41],O});function se(e,t){let n=(0,F.c)(4),r,i;n[0]!==e||n[1]!==t?(r=()=>{let n=!1,r=null,i=null,a=new AbortController,o=!1,s=!1,c=function(){n||i||(t(!0),i=setTimeout(()=>{i=null,d()},W))},l=function(t){V(t,e)},u=function(e){H(e,{isCancelled:()=>n,isAborted:()=>a.signal.aborted,sawSuccessfulStream:o,scheduleReconnect:c,setConnecting:t,reportHardFailure:e=>{s||(s=!0,T({title:`Failed to connect to log feed`,description:e,variant:`destructive`}))}})};async function d(){if(!n){t(!0);try{let e=await p({signal:a.signal});if(!e||n){e&&n&&e.cancel().catch(le);return}r=e.getReader();let i=new TextDecoder,s=``;for(o=!0,t(!1);!n;){let{done:e,value:t}=await r.read();if(e)break;s=U(i.decode(t,{stream:!0}),s,l)}n||c()}catch(e){u(e)}}}return d(),()=>{n=!0,a.abort(),i&&clearTimeout(i),r?.cancel().catch(ce)}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,P.useEffect)(r,i)}function ce(){}function le(){}function ue(){let e=(0,F.c)(7),[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(!1),a=(0,P.useRef)(null),o=(0,P.useRef)(null),s,c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>()=>{a.current&&clearTimeout(a.current),o.current&&clearTimeout(o.current)},c=[],e[0]=s,e[1]=c):(s=e[0],c=e[1]),(0,P.useEffect)(s,c);let l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=async e=>{try{await navigator.clipboard.writeText(Q(e)),n(e.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{n(null),a.current=null},1500)}catch(e){let t=e;T({title:`Failed to copy log entry`,description:t instanceof Error?t.message:String(t),variant:`destructive`})}},e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=async function(e){if(e.length!==0)try{await navigator.clipboard.writeText(e.map(de).join(`
|
|
4
|
+
|
|
5
|
+
`)),i(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{i(!1),o.current=null},1500)}catch(e){let t=e;T({title:`Failed to copy logs`,description:t instanceof Error?t.message:String(t),variant:`destructive`})}},e[3]=d):d=e[3];let f=d,p;return e[4]!==r||e[5]!==t?(p={copiedEntryId:t,copiedAll:r,handleCopyEntry:u,handleCopyVisibleEntries:f},e[4]=r,e[5]=t,e[6]=p):p=e[6],p}function de(e){return Q(e)}function fe(){let[e,t]=(0,P.useState)(!1);async function n(){t(!0);try{await m()}catch(e){T({title:`Failed to clear logs`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{t(!1)}}return{isClearing:e,handleClear:n}}function $(){let e=(0,F.c)(51),[t]=i(),n;e[0]===t?n=e[1]:(n=t.get(`q`)??``,e[0]=t,e[1]=n);let r=n,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],e[2]=a):a=e[2];let[o,s]=(0,P.useState)(a),[c,l]=(0,P.useState)(r),[u,d]=(0,P.useState)(ee),[f,p]=(0,P.useState)(!0),[m,h]=(0,P.useState)(null),{isClearing:g,handleClear:_}=fe(),{copiedEntryId:v,copiedAll:y,handleCopyEntry:b,handleCopyVisibleEntries:x}=ue(),{isEnabled:S,isEnvConfigured:C,ingestingHost:w,isLoading:T,isSaving:E,updateIsEnabled:D}=z(),O,k;e[3]===r?(O=e[4],k=e[5]):(O=()=>{r&&l(r)},k=[r],e[3]=r,e[4]=O,e[5]=k),(0,P.useEffect)(O,k),se(s,p);let A,M,N;if(e[6]!==v||e[7]!==u||e[8]!==o||e[9]!==b||e[10]!==c){let t=c.trim().toLowerCase(),n=new Set(u);N=o.filter(e=>re(e,n)&&ne(e,t));let r;e[14]!==v||e[15]!==b?(r=(e,t)=>(0,I.jsx)(oe,{entry:t,copied:v===t.id,onCopy:b}),e[14]=v,e[15]=b,e[16]=r):r=e[16],A=r,M=pe(u.length,t,o.length),e[6]=v,e[7]=u,e[8]=o,e[9]=b,e[10]=c,e[11]=A,e[12]=M,e[13]=N}else A=e[11],M=e[12],N=e[13];let R=M,B=o.length>0,V;e[17]!==_||e[18]!==g||e[19]!==B?(V=(0,I.jsx)(me,{isClearing:g,hasEntries:B,onClear:_}),e[17]=_,e[18]=g,e[19]=B,e[20]=V):V=e[20];let H;e[21]===D?H=e[22]:(H=e=>{D(e)},e[21]=D,e[22]=H);let U;e[23]!==w||e[24]!==C||e[25]!==T||e[26]!==E||e[27]!==S||e[28]!==H?(U=(0,I.jsx)(`div`,{className:`border-b border-divider pb-4`,children:(0,I.jsx)(L,{enabled:S,isEnvConfigured:C,ingestingHost:w,isLoading:T,isSaving:E,onChange:H})}),e[23]=w,e[24]=C,e[25]=T,e[26]=E,e[27]=S,e[28]=H,e[29]=U):U=e[29];let W;e[30]!==x||e[31]!==N?(W=()=>void x(N),e[30]=x,e[31]=N,e[32]=W):W=e[32];let G;e[33]!==y||e[34]!==u||e[35]!==c||e[36]!==W||e[37]!==N?(G=(0,I.jsx)(he,{search:c,onSearchChange:l,enabledLevels:u,onEnabledLevelsChange:d,visibleEntries:N,copiedAll:y,onCopyVisible:W}),e[33]=y,e[34]=u,e[35]=c,e[36]=W,e[37]=N,e[38]=G):G=e[38];let K=o.length>0,q;e[39]!==R||e[40]!==f||e[41]!==A||e[42]!==m||e[43]!==K||e[44]!==N?(q=(0,I.jsx)(ve,{isConnecting:f,hasEntries:K,visibleEntries:N,emptyMessage:R,scrollParent:m,onScrollParentChange:h,renderLogEntryRow:A}),e[39]=R,e[40]=f,e[41]=A,e[42]=m,e[43]=K,e[44]=N,e[45]=q):q=e[45];let J;return e[46]!==G||e[47]!==q||e[48]!==V||e[49]!==U?(J=(0,I.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col`,children:(0,I.jsxs)(j,{className:`flex w-full max-w-none min-w-0 min-h-0 flex-1 flex-col pb-0 pt-0`,children:[V,U,G,q]})}),e[46]=G,e[47]=q,e[48]=V,e[49]=U,e[50]=J):J=e[50],J}function pe(e,t,n){return e===0?`No log levels selected.`:t?`No logs match this search.`:n===0?`No logs in the buffer yet.`:`No logs match the selected levels.`}function me(e){let t=(0,F.c)(8),{isClearing:n,hasEntries:r,onClear:i}=e,a;t[0]===i?a=t[1]:(a=()=>void i(),t[0]=i,t[1]=a);let o=n||!r,s;t[2]===n?s=t[3]:(s=n?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(v,{className:`mr-2 h-4 w-4 animate-spin`}),`Clearing...`]}):`Clear`,t[2]=n,t[3]=s);let c;return t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,I.jsx)(O,{title:`Logs`,description:`Live in memory feed of events`,action:(0,I.jsx)(y,{type:`button`,onClick:a,disabled:o,children:s})}),t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function he(e){let t=(0,F.c)(29),{search:n,onSearchChange:r,enabledLevels:i,onEnabledLevelsChange:a,visibleEntries:o,copiedAll:c,onCopyVisible:l}=e,u;t[0]===r?u=t[1]:(u=e=>r(e.target.value),t[0]=r,t[1]=u);let d;t[2]!==n||t[3]!==u?(d=(0,I.jsx)(k,{value:n,onChange:u,placeholder:`Search`,className:`min-w-0 flex-1`,"aria-label":`Search logs`}),t[2]=n,t[3]=u,t[4]=d):d=t[4];let f;t[5]===i?f=t[6]:(f=i.map(_e),t[5]=i,t[6]=f);let p;t[7]===a?p=t[8]:(p=e=>{a(G.filter(t=>e.includes(s(t))))},t[7]=a,t[8]=p);let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=G.map(ge),t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==p?(h=(0,I.jsx)(N,{type:`multiple`,value:f,onValueChange:p,"aria-label":`Log levels`,variant:`outline`,size:`sm`,className:K,children:m}),t[10]=f,t[11]=p,t[12]=h):h=t[12];let v=o.length===0,w;t[13]===c?w=t[14]:(w=c?(0,I.jsx)(g,{className:`h-3.5 w-3.5 text-brand`}):(0,I.jsx)(_,{className:`h-3.5 w-3.5`}),t[13]=c,t[14]=w);let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,I.jsx)(`span`,{className:`sr-only`,children:`Copy visible logs`}),t[15]=T):T=t[15];let E;t[16]!==l||t[17]!==v||t[18]!==w?(E=(0,I.jsx)(b,{asChild:!0,children:(0,I.jsxs)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:l,disabled:v,children:[w,T]})}),t[16]=l,t[17]=v,t[18]=w,t[19]=E):E=t[19];let D=c?`Copied!`:`Copy visible logs to clipboard`,O;t[20]===D?O=t[21]:(O=(0,I.jsx)(x,{children:D}),t[20]=D,t[21]=O);let A;t[22]!==E||t[23]!==O?(A=(0,I.jsx)(S,{children:(0,I.jsxs)(C,{children:[E,O]})}),t[22]=E,t[23]=O,t[24]=A):A=t[24];let j;return t[25]!==A||t[26]!==d||t[27]!==h?(j=(0,I.jsxs)(`div`,{className:`mb-4 mt-4 flex w-full min-w-0 items-center gap-3 electrobun-webkit-app-region-no-drag`,children:[d,h,A]}),t[25]=A,t[26]=d,t[27]=h,t[28]=j):j=t[28],j}function ge(e){return(0,I.jsx)(M,{value:s(e),"aria-label":s(e),className:q,children:s(e)},e)}function _e(e){return s(e)}function ve(e){let t=(0,F.c)(10),{isConnecting:n,hasEntries:r,visibleEntries:i,emptyMessage:a,scrollParent:o,onScrollParentChange:s,renderLogEntryRow:l}=e,u;t[0]!==a||t[1]!==r||t[2]!==n||t[3]!==l||t[4]!==o||t[5]!==i?(u=n&&!r?(0,I.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-muted-foreground`,children:[(0,I.jsx)(v,{className:`h-4 w-4 animate-spin`}),`Connecting…`]}):i.length===0?(0,I.jsx)(`p`,{className:h(c.bodyMuted,`p-4 font-sans`),children:a}):(0,I.jsx)(S,{children:(0,I.jsx)(D,{data:i,computeItemKey:be,customScrollParent:o??void 0,itemContent:l,followOutput:ye,overscan:500,className:`w-full min-w-0`})}),t[0]=a,t[1]=r,t[2]=n,t[3]=l,t[4]=o,t[5]=i,t[6]=u):u=t[6];let d;return t[7]!==s||t[8]!==u?(d=(0,I.jsx)(w,{viewportRef:s,className:`mb-6 w-full min-h-0 min-w-0 flex-1 rounded-md border bg-background font-mono text-xs`,children:u}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function ye(e){return e?`auto`:!1}function be(e,t){return t.id}export{$ as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{U as i}from"./dist-v_MvKS2-.js";import{r as a}from"./store-W78TGOIO.js";import{En as o,i as s,on as c,vt as l}from"./api-Cp9I7CxD.js";import{c as u,t as d}from"./utils-CqsIXqSC.js";import{t as f}from"./check-skFQ1X72.js";import{t as p}from"./chevron-down-Bpo4ncEN.js";import{t as m}from"./external-link-Dcikmdm_.js";import{r as h,t as g}from"./dialog-D_12AsZd.js";import{t as _}from"./plus-DoMzejDu.js";import{t as v}from"./x-ByOPrz5I.js";import{t as y}from"./button-DDaJhJP1.js";import{g as b,h as x,t as S,u as C}from"./dist-AbkJBHH5.js";import{o as w}from"./dist-2xH_pFmV.js";import{i as T,n as E,r as D,t as O}from"./tooltip-CqwCZ7wt.js";import{t as k}from"./use-toast-CKgZ8YeP.js";import{n as A}from"./explorer-tab-context-BwR8CM8l.js";import{t as j}from"./use-open-chat-dock-panel-CXzpgxVs.js";import{t as M}from"./dist-CkGJjZXY.js";import{a as N,n as P,o as F,r as I,t as L}from"./select-DMcNYwgt.js";import{a as R,i as z,n as B,o as ee,s as V,t as H}from"./mcp-manager-D2FG-h2e.js";import{$t as U,Bn as te,Cn as ne,Fn as re,Gn as ie,Qt as W,Zt as G,at as K,cn as ae,en as q,ft as oe,gn as J,gt as se,hn as ce,ht as le,in as ue,ln as de,lt as fe,nt as Y,on as pe,pt as me,rn as he,sn as ge,tn as _e,tt as ve,un as ye}from"./index-CcAwxnT5.js";import{t as be}from"./delete-confirm-dialog-D1N86piR.js";import{t as xe}from"./use-settings-page-loading-B5WU5d1c.js";import{n as Se}from"./settings-list-Co3JPr9w.js";var X=t(),Z=e(n(),1),Q=r(),Ce=`Switch`,[we,Te]=x(Ce),[Ee,De]=we(Ce),Oe=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:d,...f}=e,[p,m]=Z.useState(null),h=u(t,e=>m(e)),g=Z.useRef(!1),_=!p||d||!!p.closest(`form`),[v,y]=S({prop:i,defaultProp:a??!1,onChange:l,caller:Ce});return(0,Q.jsxs)(Ee,{scope:n,checked:v,disabled:s,children:[(0,Q.jsx)(C.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Ne(v),"data-disabled":s?``:void 0,disabled:s,value:c,...f,ref:h,onClick:b(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,Q.jsx)(Me,{control:p,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:d,style:{transform:`translateX(-100%)`}})]})});Oe.displayName=Ce;var ke=`SwitchThumb`,Ae=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=De(ke,n);return(0,Q.jsx)(C.span,{"data-state":Ne(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Ae.displayName=ke;var je=`SwitchBubbleInput`,Me=Z.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Z.useRef(null),s=u(o,a),c=M(n),l=w(t);return Z.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Q.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Me.displayName=je;function Ne(e){return e?`checked`:`unchecked`}var Pe=Oe,Fe=Ae,Ie=Z.forwardRef((e,t)=>{let n=(0,X.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(Fe,{className:d(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,Q.jsx)(Pe,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Ie.displayName=Pe.displayName;function Le(e){let t=(0,X.c)(6),{defer:n,onDeferChange:r}=e,i=n?`Tool definitions load on demand via tool_search to keep the initial prompt small.`:`Tool definitions are always injected into the initial prompt, even when not used. Useful when this server's tools are needed in nearly every conversation, but they consume context.`,a;t[0]!==n||t[1]!==r?(a=(0,Q.jsx)(Ie,{id:`defer-tools`,checked:n,onCheckedChange:r,"aria-label":`Deferred`}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,Q.jsx)(Y,{title:`Deferred`,description:i,controlLayout:`stack`,className:`pt-6`,action:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function Re(e){let t=(0,X.c)(15),{entries:n,emptyMessage:r,keyPlaceholder:a,valuePlaceholder:o,onUpdate:s,onRemove:c}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(`p`,{className:i.caption,children:r}),t[0]=r,t[1]=e),e}let l;if(t[2]!==n||t[3]!==a||t[4]!==c||t[5]!==s||t[6]!==o){let e;t[8]!==a||t[9]!==c||t[10]!==s||t[11]!==o?(e=(e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(J,{placeholder:a,value:e.key,onChange:e=>s(t,{key:e.target.value}),className:`font-mono w-[35%]`}),(0,Q.jsx)(J,{placeholder:o,value:e.value,onChange:e=>s(t,{value:e.target.value}),className:`font-mono flex-1`}),(0,Q.jsx)(y,{variant:`ghost`,size:`icon`,onClick:()=>c(t),className:`h-9 w-9 flex-shrink-0`,"aria-label":`Remove entry`,children:(0,Q.jsx)(v,{className:`h-3.5 w-3.5`})})]},t),t[8]=a,t[9]=c,t[10]=s,t[11]=o,t[12]=e):e=t[12],l=n.map(e),t[2]=n,t[3]=a,t[4]=c,t[5]=s,t[6]=o,t[7]=l}else l=t[7];let u;return t[13]===l?u=t[14]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:l}),t[13]=l,t[14]=u),u}function ze(e){let t=(0,X.c)(16),{title:n,description:r,actionLabel:i,emptyMessage:a,keyPlaceholder:o,valuePlaceholder:s,entries:c,onAdd:l,onRemove:u,onUpdate:d}=e,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(_,{className:`h-3 w-3 mr-1`}),t[0]=f):f=t[0];let p;t[1]!==i||t[2]!==l?(p=(0,Q.jsxs)(y,{variant:`ghost`,size:`sm`,onClick:l,children:[f,i]}),t[1]=i,t[2]=l,t[3]=p):p=t[3];let m;t[4]!==a||t[5]!==c||t[6]!==o||t[7]!==u||t[8]!==d||t[9]!==s?(m=(0,Q.jsx)(Re,{entries:c,emptyMessage:a,keyPlaceholder:o,valuePlaceholder:s,onUpdate:d,onRemove:u}),t[4]=a,t[5]=c,t[6]=o,t[7]=u,t[8]=d,t[9]=s,t[10]=m):m=t[10];let h;return t[11]!==r||t[12]!==p||t[13]!==m||t[14]!==n?(h=(0,Q.jsx)(Y,{title:n,description:r,controlLayout:`stack`,className:`pt-6`,action:p,children:m}),t[11]=r,t[12]=p,t[13]=m,t[14]=n,t[15]=h):h=t[15],h}function Be(e){let t=(0,X.c)(6),{serverType:n,entries:r,onAdd:i,onRemove:a,onUpdate:o}=e,s=n===`remote`?`Optional metadata for local tooling.`:void 0,c;return t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==s?(c=(0,Q.jsx)(ze,{title:`Environment variables`,description:s,actionLabel:`Add variable`,emptyMessage:`No environment variables configured`,keyPlaceholder:`KEY`,valuePlaceholder:`value`,entries:r,onAdd:i,onRemove:a,onUpdate:o}),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5],c}function Ve(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsx)(`p`,{className:i.bodyMuted,children:`Loading server configuration...`})}),e[0]=t):t=e[0],t}function He(e){let t=(0,X.c)(7),{isEditing:n,busy:r,deleting:i,onDelete:a}=e;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{}),t[0]=e):e=t[0],e}let o;t[1]===a?o=t[2]:(o=()=>void a(),t[1]=a,t[2]=o);let s=i?`Removing...`:`Remove`,c;return t[3]!==r||t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(y,{variant:`destructive`,onClick:o,disabled:r,children:s}),t[3]=r,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function Ue(e,t){return e?t?`Saving...`:`Adding...`:t?`Save`:`Add`}function We(e){let t=(0,X.c)(9),{busy:n,hasChanges:r,saving:i,isEditing:a,onSave:o}=e,s;t[0]===o?s=t[1]:(s=()=>void o(),t[0]=o,t[1]=s);let c=n||!r,l;t[2]!==a||t[3]!==i?(l=Ue(i,a),t[2]=a,t[3]=i,t[4]=l):l=t[4];let u;return t[5]!==s||t[6]!==c||t[7]!==l?(u=(0,Q.jsx)(y,{onClick:s,disabled:c,children:l}),t[5]=s,t[6]=c,t[7]=l,t[8]=u):u=t[8],u}function Ge(e){let t=(0,X.c)(14),{isEditing:n,busy:r,saving:i,deleting:a,hasChanges:o,onSave:s,onDelete:c}=e,l;t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==c?(l=(0,Q.jsx)(He,{isEditing:n,busy:r,deleting:a,onDelete:c}),t[0]=r,t[1]=a,t[2]=n,t[3]=c,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==i?(u=(0,Q.jsx)(We,{busy:r,hasChanges:o,saving:i,isEditing:n,onSave:s}),t[5]=r,t[6]=o,t[7]=n,t[8]=s,t[9]=i,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(`div`,{className:`mt-6 border-t pt-4 flex items-center justify-between`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Ke(e){let t=(0,X.c)(9),{isEditing:n,name:r,onNameChange:i}=e,a=n?`Server name cannot be changed`:void 0,o;t[0]===i?o=t[1]:(o=e=>i(e.target.value),t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==o?(s=(0,Q.jsx)(J,{id:`server-name`,placeholder:`e.g. filesystem`,value:r,onChange:o,disabled:n}),t[2]=n,t[3]=r,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==s?(c=(0,Q.jsx)(Y,{title:`Server name`,description:a,controlLayout:`stack`,className:`pt-6`,children:s}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function qe(e){let t=(0,X.c)(13),{form:n,onFormChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>r({command:e.target.value}),t[0]=r,t[1]=i);let a;t[2]!==n.command||t[3]!==i?(a=(0,Q.jsx)(Y,{title:`Command`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsx)(J,{id:`server-command`,placeholder:`e.g. npx`,value:n.command,onChange:i})}),t[2]=n.command,t[3]=i,t[4]=a):a=t[4];let o;t[5]===r?o=t[6]:(o=e=>r({argsText:e.target.value}),t[5]=r,t[6]=o);let s;t[7]!==n.argsText||t[8]!==o?(s=(0,Q.jsx)(Y,{title:`Arguments`,description:`One argument per line`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsx)(ce,{id:`server-args`,placeholder:`-y
|
|
2
|
+
@modelcontextprotocol/server-filesystem
|
|
3
|
+
/path/to/dir`,value:n.argsText,onChange:o,className:`font-mono min-h-[80px] resize-none`})}),t[7]=n.argsText,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,Q.jsxs)(Q.Fragment,{children:[a,s]}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function Je(e){let t=(0,X.c)(19),{form:n,onFormChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>r({oauthClientId:e.target.value}),t[0]=r,t[1]=i);let a;t[2]!==n.oauthClientId||t[3]!==i?(a=(0,Q.jsx)(J,{id:`oauth-client-id`,placeholder:`Client ID`,value:n.oauthClientId,onChange:i,className:`font-mono`}),t[2]=n.oauthClientId,t[3]=i,t[4]=a):a=t[4];let o;t[5]===r?o=t[6]:(o=e=>r({oauthClientSecret:e.target.value}),t[5]=r,t[6]=o);let s;t[7]!==n.oauthClientSecret||t[8]!==o?(s=(0,Q.jsx)(J,{id:`oauth-client-secret`,placeholder:`Client secret`,type:`password`,value:n.oauthClientSecret,onChange:o,className:`font-mono`}),t[7]=n.oauthClientSecret,t[8]=o,t[9]=s):s=t[9];let c;t[10]===r?c=t[11]:(c=e=>r({oauthCallbackPort:e.target.value}),t[10]=r,t[11]=c);let l;t[12]!==n.oauthCallbackPort||t[13]!==c?(l=(0,Q.jsx)(J,{id:`oauth-callback-port`,placeholder:`Callback port (e.g. 3118)`,value:n.oauthCallbackPort,onChange:c,className:`font-mono`}),t[12]=n.oauthCallbackPort,t[13]=c,t[14]=l):l=t[14];let u;return t[15]!==a||t[16]!==s||t[17]!==l?(u=(0,Q.jsx)(Y,{title:`OAuth client`,description:`Required for servers without dynamic client registration (e.g. GitHub Copilot MCP). Create an OAuth App, set callback to http://localhost:<port>/callback, then Sign in.`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,s,l]})}),t[15]=a,t[16]=s,t[17]=l,t[18]=u):u=t[18],u}function Ye(e){let t=(0,X.c)(25),{form:n,onFormChange:r,headerEntries:i,onHeaderAdd:a,onHeaderRemove:o,onHeaderUpdate:s}=e,c;t[0]===r?c=t[1]:(c=e=>r({serverUrl:e.target.value}),t[0]=r,t[1]=c);let l;t[2]!==n.serverUrl||t[3]!==c?(l=(0,Q.jsx)(Y,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsx)(J,{id:`server-url`,placeholder:`https://example.com/mcp`,value:n.serverUrl,onChange:c,className:`font-mono`})}),t[2]=n.serverUrl,t[3]=c,t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=e=>r({transport:e}),t[5]=r,t[6]=u);let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(N,{children:(0,Q.jsx)(F,{})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(P,{children:[(0,Q.jsx)(I,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,Q.jsx)(I,{value:`streamableHttp`,children:`Streamable HTTP`})]}),t[8]=f):f=t[8];let p;t[9]!==n.transport||t[10]!==u?(p=(0,Q.jsx)(Y,{title:`Transport`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsxs)(L,{value:n.transport,onValueChange:u,children:[d,f]})}),t[9]=n.transport,t[10]=u,t[11]=p):p=t[11];let m;t[12]!==n||t[13]!==r?(m=(0,Q.jsx)(Je,{form:n,onFormChange:r}),t[12]=n,t[13]=r,t[14]=m):m=t[14];let h;t[15]!==i||t[16]!==a||t[17]!==o||t[18]!==s?(h=(0,Q.jsx)(ze,{title:`HTTP headers`,description:`Optional headers for authentication.`,actionLabel:`Add header`,emptyMessage:`No headers configured`,keyPlaceholder:`Authorization`,valuePlaceholder:`Bearer ...`,entries:i,onAdd:a,onRemove:o,onUpdate:s}),t[15]=i,t[16]=a,t[17]=o,t[18]=s,t[19]=h):h=t[19];let g;return t[20]!==l||t[21]!==p||t[22]!==m||t[23]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[l,p,m,h]}),t[20]=l,t[21]=p,t[22]=m,t[23]=h,t[24]=g):g=t[24],g}function Xe(e){let t=(0,X.c)(18),{form:n,onFormChange:r,headerEntries:i,onHeaderAdd:a,onHeaderRemove:o,onHeaderUpdate:s}=e,c;t[0]===r?c=t[1]:(c=e=>r({serverType:e}),t[0]=r,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsxs)(U,{className:`grid w-full grid-cols-2`,children:[(0,Q.jsx)(q,{value:`local`,children:`Local (stdio)`}),(0,Q.jsx)(q,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),t[2]=l):l=t[2];let u;t[3]!==n||t[4]!==r?(u=(0,Q.jsx)(W,{value:`local`,children:(0,Q.jsx)(qe,{form:n,onFormChange:r})}),t[3]=n,t[4]=r,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==i||t[8]!==r||t[9]!==a||t[10]!==o||t[11]!==s?(d=(0,Q.jsx)(W,{value:`remote`,children:(0,Q.jsx)(Ye,{form:n,onFormChange:r,headerEntries:i,onHeaderAdd:a,onHeaderRemove:o,onHeaderUpdate:s})}),t[6]=n,t[7]=i,t[8]=r,t[9]=a,t[10]=o,t[11]=s,t[12]=d):d=t[12];let f;return t[13]!==n.serverType||t[14]!==c||t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(G,{value:n.serverType,onValueChange:c,className:`w-full pt-6`,children:[l,u,d]}),t[13]=n.serverType,t[14]=c,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}var Ze={key:``,value:``},Qe={serverType:`local`,name:``,command:``,argsText:``,serverUrl:``,transport:`sse`,oauthClientId:``,oauthClientSecret:``,oauthCallbackPort:``,defer:!0},$e=[e=>e.name,e=>e.command,e=>e.argsText,e=>e.serverUrl,e=>e.oauthClientId,e=>e.oauthClientSecret,e=>e.oauthCallbackPort];function $(e,t){return e??t}function et(e){return e?.url?`remote`:`local`}function tt(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function nt(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function rt(e){return(e??[]).join(`
|
|
4
|
+
`)}function it(e){return e.split(`
|
|
5
|
+
`).map(e=>e.trim()).filter(Boolean)}function at(e){return e===void 0?``:String(e)}function ot(e){return{oauthClientId:$(e?.clientId,``),oauthClientSecret:$(e?.clientSecret,``),oauthCallbackPort:at(e?.callbackPort)}}function st(e,t){return{...Qe,name:e,serverType:et(t),command:$(t.command,``),argsText:rt(t.args),serverUrl:$(t.url,``),transport:$(t.transport,`sse`),...ot(t.oauth),defer:t.defer!==!1}}function ct(e,t,n){return JSON.stringify({name:e,type:t,config:n})}function lt(e){if(!e)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}function ut(e){let t={};for(let[n,r]of Object.entries(e))r!==``&&r!==void 0&&(t[n]=r);return t}function dt(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function ft(e,t,n){return e!==``||t!==``||n!==void 0}function pt(e){let t=e.oauthClientId.trim(),n=e.oauthClientSecret.trim(),r=lt(e.oauthCallbackPort.trim());if(!ft(t,n,r))return;let i=ut({clientId:t,clientSecret:n,callbackPort:r});if(Object.keys(i).length!==0)return i}function mt(e,t,n){return dt({url:e.serverUrl.trim(),transport:e.transport,headers:nt(n),env:nt(t),oauth:pt(e),defer:e.defer?void 0:!1})}function ht(e,t){return dt({command:e.command.trim(),args:it(e.argsText),env:nt(t),defer:e.defer?void 0:!1})}function gt(e,t,n){return e.serverType===`remote`?mt(e,t,n):ht(e,t)}function _t(e){let t=e.trim();if(!t)return`Server URL is required`;try{new URL(t)}catch{return`Server URL must be a valid URL`}return null}function vt(e){if(!e.trim())return null;let t=Number.parseInt(e.trim(),10);return Number.isInteger(t)&&t>0?null:`OAuth callback port must be a positive integer`}function yt(e){return e.oauthClientSecret.trim()&&!e.oauthClientId.trim()?`OAuth client ID is required when a client secret is set`:null}function bt(e){return _t(e.serverUrl)??vt(e.oauthCallbackPort)??yt(e)}function xt(e){return e.trim()?null:`Command is required`}function St(e,t){return t.name.trim()?e===`remote`?bt(t):xt(t.command):`Server name is required`}function Ct(e,t,n){return $e.some(t=>t(e).trim()!==``)||t.length>0||n.length>0||!e.defer}function wt(e){return e.isEditing?e.currentSnapshot!==e.originalSnapshot:Ct(e.form,e.envEntries,e.headerEntries)}function Tt(e){if(e.isEditing&&e.serverName)return e.installedServers.find(t=>t.name===e.serverName);if(e.initialConfig)return{name:$(e.initialName,``),config:e.initialConfig}}function Et(e,t){return e instanceof Error?e.message:t}function Dt(e,t){return e?`MCP server saved · ${B(t.catalog)}`:`MCP server added · ${B(t.catalog)}`}function Ot(e,t){return{title:e?t:`Add MCP Server`,description:e?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}}function kt(){let e=(0,X.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={env:[],header:[]},e[0]=t):t=e[0];let[n,r]=(0,Z.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=function(e,t){r(n=>({...n,[e]:t(n[e])}))},e[1]=i):i=e[1];let a=i,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=function(e){a(e,At)},e[2]=o):o=e[2];let s=o,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=function(e,t){a(e,e=>e.filter((e,n)=>n!==t))},e[3]=c):c=e[3];let l=c,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e,t,n){a(e,e=>e.map((e,r)=>r===t?{...e,...n}:e))},e[4]=u):u=e[4];let d=u,f;return e[5]===n?f=e[6]:(f={lists:n,setEntryLists:r,addEntry:s,removeEntry:l,updateEntry:d},e[5]=n,e[6]=f),f}function At(e){return[...e,Ze]}function jt(e){async function t(){if(!e.projectPath)throw Error(`No project path`);let t=await R(e.projectPath,e.originalName||e.form.name.trim(),gt(e.form,e.envEntries,e.headerEntries));k({title:`Success`,description:Dt(e.isEditing,t)}),e.onBack()}async function n(){e.setError(null);let n=St(e.form.serverType,e.form);if(n){e.setError(n);return}e.setSaving(!0);try{await t()}catch(t){e.setError(Et(t,`Failed to save server`))}finally{e.setSaving(!1)}}async function r(){if(e.projectPath){e.setDeleting(!0);try{await H(e.projectPath,e.originalName),k({title:`Success`,description:`MCP server removed`}),e.onBack()}catch(t){e.setError(Et(t,`Failed to delete server`))}finally{e.setDeleting(!1)}}}return{handleSave:n,handleDelete:r}}function Mt(e){let{installedServers:t}=V(e.projectPath),n=!!e.serverName,[r,i]=(0,Z.useState)(Qe),{lists:a,setEntryLists:o,addEntry:s,removeEntry:c,updateEntry:l}=kt(),[u,d]=(0,Z.useState)({name:``,snapshot:``}),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(n);(0,Z.useEffect)(()=>{let r=Tt({isEditing:n,serverName:e.serverName,initialName:e.initialName,initialConfig:e.initialConfig,installedServers:t});r&&(i(st(r.name,r.config)),o({env:tt(r.config.env),header:tt(r.config.headers)}),d({name:r.name,snapshot:ct(r.name,et(r.config),r.config)})),(!n||r)&&y(!1)},[t,e.serverName,e.initialName,e.initialConfig,o,n]);function b(e){i(t=>({...t,...e}))}let x=jt({projectPath:e.projectPath,isEditing:n,form:r,envEntries:a.env,headerEntries:a.header,originalName:u.name,onBack:e.onBack,setError:_,setSaving:p,setDeleting:h});return{form:r,patchForm:b,lists:a,addEntry:s,removeEntry:c,updateEntry:l,saving:f,deleting:m,error:g,loading:v,isEditing:n,busy:f||m,hasChanges:wt({isEditing:n,currentSnapshot:ct(r.name.trim(),r.serverType,gt(r,a.env,a.header)),originalSnapshot:u.snapshot,form:r,envEntries:a.env,headerEntries:a.header}),header:Ot(n,r.name),actions:x}}function Nt(e){let t=(0,X.c)(65),{projectPath:n,serverName:r,initialName:a,initialConfig:o,onBack:s}=e,c;t[0]!==o||t[1]!==a||t[2]!==s||t[3]!==n||t[4]!==r?(c={projectPath:n,serverName:r,initialName:a,initialConfig:o,onBack:s},t[0]=o,t[1]=a,t[2]=s,t[3]=n,t[4]=r,t[5]=c):c=t[5];let{form:l,patchForm:u,lists:d,addEntry:f,removeEntry:p,updateEntry:m,saving:h,deleting:g,error:_,loading:v,isEditing:y,busy:b,hasChanges:x,header:S,actions:C}=Mt(c);if(v){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ve,{}),t[6]=e):e=t[6],e}let w;t[7]===S?w=t[8]:(w=(0,Q.jsx)(K,{...S,sticky:!0,className:`pr-10`}),t[7]=S,t[8]=w);let T;t[9]===u?T=t[10]:(T=e=>u({name:e}),t[9]=u,t[10]=T);let E;t[11]!==l.name||t[12]!==y||t[13]!==T?(E=(0,Q.jsx)(Ke,{isEditing:y,name:l.name,onNameChange:T}),t[11]=l.name,t[12]=y,t[13]=T,t[14]=E):E=t[14];let D;t[15]===f?D=t[16]:(D=()=>f(`header`),t[15]=f,t[16]=D);let O;t[17]===p?O=t[18]:(O=e=>p(`header`,e),t[17]=p,t[18]=O);let k;t[19]===m?k=t[20]:(k=(e,t)=>m(`header`,e,t),t[19]=m,t[20]=k);let A;t[21]!==l||t[22]!==d.header||t[23]!==u||t[24]!==D||t[25]!==O||t[26]!==k?(A=(0,Q.jsx)(Xe,{form:l,onFormChange:u,headerEntries:d.header,onHeaderAdd:D,onHeaderRemove:O,onHeaderUpdate:k}),t[21]=l,t[22]=d.header,t[23]=u,t[24]=D,t[25]=O,t[26]=k,t[27]=A):A=t[27];let j;t[28]===u?j=t[29]:(j=e=>u({defer:e}),t[28]=u,t[29]=j);let M;t[30]!==l.defer||t[31]!==j?(M=(0,Q.jsx)(Le,{defer:l.defer,onDeferChange:j}),t[30]=l.defer,t[31]=j,t[32]=M):M=t[32];let N;t[33]===f?N=t[34]:(N=()=>f(`env`),t[33]=f,t[34]=N);let P;t[35]===p?P=t[36]:(P=e=>p(`env`,e),t[35]=p,t[36]=P);let F;t[37]===m?F=t[38]:(F=(e,t)=>m(`env`,e,t),t[37]=m,t[38]=F);let I;t[39]!==l.serverType||t[40]!==d.env||t[41]!==N||t[42]!==P||t[43]!==F?(I=(0,Q.jsx)(Be,{serverType:l.serverType,entries:d.env,onAdd:N,onRemove:P,onUpdate:F}),t[39]=l.serverType,t[40]=d.env,t[41]=N,t[42]=P,t[43]=F,t[44]=I):I=t[44];let L;t[45]===_?L=t[46]:(L=_?(0,Q.jsx)(`p`,{className:i.error,children:_}):null,t[45]=_,t[46]=L);let R;t[47]!==C.handleDelete||t[48]!==C.handleSave||t[49]!==b||t[50]!==g||t[51]!==x||t[52]!==y||t[53]!==h?(R=(0,Q.jsx)(Ge,{isEditing:y,busy:b,saving:h,deleting:g,hasChanges:x,onSave:C.handleSave,onDelete:C.handleDelete}),t[47]=C.handleDelete,t[48]=C.handleSave,t[49]=b,t[50]=g,t[51]=x,t[52]=y,t[53]=h,t[54]=R):R=t[54];let z;t[55]!==M||t[56]!==I||t[57]!==L||t[58]!==R||t[59]!==E||t[60]!==A?(z=(0,Q.jsxs)(`div`,{children:[E,A,M,I,L,R]}),t[55]=M,t[56]=I,t[57]=L,t[58]=R,t[59]=E,t[60]=A,t[61]=z):z=t[61];let B;return t[62]!==z||t[63]!==w?(B=(0,Q.jsx)(le,{children:(0,Q.jsxs)(ve,{children:[w,z]})}),t[62]=z,t[63]=w,t[64]=B):B=t[64],B}function Pt(e){if(!e)return null;let t=new Date(e).getTime();if(Number.isNaN(t))return null;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:new Date(e).toLocaleDateString()}function Ft(e){if(!e||e.state===`missing`||e.state===`stale`)return`Refresh to load tools`;if(e.state===`needs_auth`)return`Sign in required`;if(e.state===`error`)return e.error??`Could not load tools`;let t=e.tools.length,n=t===1?`1 tool`:`${t} tools`,r=Pt(e.refreshedAt);return r?`${n} · refreshed ${r}`:n}function It(e){let t=(0,X.c)(69),{name:n,config:r,catalog:a,remote:o,authorized:s,oauthBusy:c,refreshing:l,onEdit:u,onRefresh:f,onDelete:m,onSignIn:h,onSignOut:g}=e,[_,v]=(0,Z.useState)(!1),b;if(t[0]!==s||t[1]!==a||t[2]!==r.args||t[3]!==r.command||t[4]!==r.url||t[5]!==_||t[6]!==n||t[7]!==c||t[8]!==m||t[9]!==u||t[10]!==f||t[11]!==h||t[12]!==g||t[13]!==l||t[14]!==o){let e=a?.state===`ok`?a.tools.map(zt):[],x;t[16]!==r.args||t[17]!==r.command||t[18]!==r.url?(x=r.url?r.url:`${r.command??``} ${r.args?.join(` `)??``}`.trim(),t[16]=r.args,t[17]=r.command,t[18]=r.url,t[19]=x):x=t[19];let S=x,C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=d(i.body,`truncate`),t[20]=C):C=t[20];let w;t[21]===n?w=t[22]:(w=(0,Q.jsx)(`div`,{className:C,children:n}),t[21]=n,t[22]=w);let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=d(i.compact,`truncate text-muted-foreground font-mono`),t[23]=k):k=t[23];let A;t[24]===S?A=t[25]:(A=(0,Q.jsx)(`div`,{className:k,children:S}),t[24]=S,t[25]=A);let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=d(i.caption,`truncate text-muted-foreground`),t[26]=j):j=t[26];let M;t[27]===a?M=t[28]:(M=Ft(a),t[27]=a,t[28]=M);let N;t[29]===M?N=t[30]:(N=(0,Q.jsx)(`div`,{className:j,children:M}),t[29]=M,t[30]=N);let P;t[31]!==u||t[32]!==w||t[33]!==A||t[34]!==N?(P=(0,Q.jsxs)(`button`,{type:`button`,onClick:u,className:`min-w-0 text-left`,children:[w,A,N]}),t[31]=u,t[32]=w,t[33]=A,t[34]=N,t[35]=P):P=t[35];let F;t[36]!==s||t[37]!==c||t[38]!==h||t[39]!==g||t[40]!==o?(F=o&&(0,Q.jsx)(y,{type:`button`,variant:s?`outline`:`secondary`,size:`sm`,disabled:c,onClick:()=>{s?g():h()},children:c?`Working…`:s?`Sign out`:`Sign in`}),t[36]=s,t[37]=c,t[38]=h,t[39]=g,t[40]=o,t[41]=F):F=t[41];let I=`Refresh ${n} tools`,L=l&&`animate-spin`,R;t[42]===L?R=t[43]:(R=d(`h-4 w-4`,L),t[42]=L,t[43]=R);let z;t[44]===R?z=t[45]:(z=(0,Q.jsx)(te,{className:R}),t[44]=R,t[45]=z);let B;t[46]!==f||t[47]!==l||t[48]!==I||t[49]!==z?(B=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:l,onClick:f,"aria-label":I,children:z})}),t[46]=f,t[47]=l,t[48]=I,t[49]=z,t[50]=B):B=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(E,{children:`Refresh tools`}),t[51]=ee):ee=t[51];let V;t[52]===B?V=t[53]:(V=(0,Q.jsx)(D,{children:(0,Q.jsxs)(O,{children:[B,ee]})}),t[52]=B,t[53]=V);let H=e.length>0&&(0,Q.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-expanded":_,"aria-label":_?`Hide tools`:`Show tools`,onClick:()=>v(Rt),children:(0,Q.jsx)(p,{className:d(`h-4 w-4 transition-transform`,_&&`rotate-180`)})}),U;t[54]!==F||t[55]!==V||t[56]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[F,V,H]}),t[54]=F,t[55]=V,t[56]=H,t[57]=U):U=t[57];let re=`Delete ${n}`,ie;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(ne,{className:`h-4 w-4`}),t[58]=ie):ie=t[58];let W;t[59]!==m||t[60]!==re?(W=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:m,"aria-label":re,children:ie})}),t[59]=m,t[60]=re,t[61]=W):W=t[61];let G;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(E,{children:`Remove this MCP server from the project`}),t[62]=G):G=t[62];let K;t[63]===W?K=t[64]:(K=(0,Q.jsx)(D,{children:(0,Q.jsxs)(O,{children:[W,G]})}),t[63]=W,t[64]=K);let ae;t[65]!==P||t[66]!==U||t[67]!==K?(ae=(0,Q.jsxs)(`div`,{className:`grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3`,children:[P,U,K]}),t[65]=P,t[66]=U,t[67]=K,t[68]=ae):ae=t[68],b=(0,Q.jsxs)(`div`,{className:`group px-3 py-3 hover:bg-muted/30`,children:[ae,_&&e.length>0&&(0,Q.jsx)(`ul`,{className:d(i.caption,`mt-2 space-y-1 pl-1 text-muted-foreground`),children:e.map(Lt)})]}),t[0]=s,t[1]=a,t[2]=r.args,t[3]=r.command,t[4]=r.url,t[5]=_,t[6]=n,t[7]=c,t[8]=m,t[9]=u,t[10]=f,t[11]=h,t[12]=g,t[13]=l,t[14]=o,t[15]=b}else b=t[15];return b}function Lt(e){return(0,Q.jsx)(`li`,{className:`font-mono truncate`,children:e},e)}function Rt(e){return!e}function zt(e){return e.name}function Bt(e){return Object.keys(e.env??{}).length>0?{env:e.env}:{}}function Vt(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function Ht(e,t){let n=Vt(e);return t.some(function(t){return t.name===n||t.name===e.id})}function Ut(e){let t=Vt(e),n=Bt(e);if(e.url!==void 0){let r={url:e.url,transport:e.transport??`sse`,...n};return e.url.trim()?{kind:`automatic`,name:t,config:r}:{kind:`manual`,prefill:{name:t,config:r}}}return e.command?{kind:`automatic`,name:t,config:{command:e.command,args:e.args??[],...n}}:{kind:`invalid`}}async function Wt(e){let t=await R(e.projectPath,e.serverName,e.config);return await e.loadInstalledServers(),e.triggerExplorerRefresh(),t.catalog}function Gt(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}function Kt(){k({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`})}function qt(e){let t=(0,X.c)(15),{projectPath:n,installedServers:r,loadInstalledServers:i,triggerExplorerRefresh:a}=e,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(){s(!1),l(null)},t[0]=u):u=t[0];let d=u,f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(){l(null),s(!0)},t[1]=f):f=t[1];let p=f,m;t[2]!==i||t[3]!==a?(m=function(){d(),i(),a()},t[2]=i,t[3]=a,t[4]=m):m=t[4];let h=m,g;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==a?(g=async function(e){if(!n||Ht(e,r))return;let t=Ut(e);if(t.kind===`manual`){l(t.prefill),s(!0);return}if(t.kind===`invalid`){Kt();return}try{let r=await Wt({projectPath:n,serverName:t.name,config:t.config,loadInstalledServers:i,triggerExplorerRefresh:a});k({title:`MCP server installed`,description:`${e.name} · ${B(r)}`})}catch(e){Gt(e)}},t[5]=r,t[6]=i,t[7]=n,t[8]=a,t[9]=g):g=t[9];let _=g,v;return t[10]!==h||t[11]!==_||t[12]!==c||t[13]!==o?(v={showAddDialog:o,prefillServer:c,installPopularServer:_,openManualAddDialog:p,closeAddDialog:d,completeServerEdit:h},t[10]=h,t[11]=_,t[12]=c,t[13]=o,t[14]=v):v=t[14],v}var Jt=`https://tarsk.io/skills/mcp/`;function Yt(e){return typeof e.url==`string`&&e.url.trim().length>0}function Xt(e,t,n,r,i,a){let[c,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)({}),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),x=(0,Z.useCallback)(async()=>{if(!e){g({});return}let n=t.filter(e=>Yt(e.config));if(n.length===0){g({});return}let r=await Promise.all(n.map(async t=>{try{let n=await l(e,t.name);return[t.name,n.authorized]}catch{return[t.name,!1]}}));g(Object.fromEntries(r))},[e,t]);return(0,Z.useEffect)(()=>{x()},[x]),{editingServer:c,setEditingServer:u,deleteConfirm:d,setDeleteConfirm:f,deleting:p,oauthAuthorized:h,oauthBusy:_,refreshing:y,handleDelete:(0,Z.useCallback)(async t=>{if(e){m(!0);try{await H(e,t),await n(),r(),k({title:`MCP server removed`,description:t}),f(null)}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{m(!1)}}},[e,n,r]),handleOAuthSignIn:(0,Z.useCallback)(async t=>{if(e){v(t);try{let r=await s(e,t);await x(),await n(),k({title:`Signed in`,description:r.catalog?`${t} · ${B(r.catalog)}`:`Connected to ${t}`})}catch(e){k({title:`Sign in failed`,description:e instanceof Error?e.message:`OAuth authorization failed`,variant:`destructive`})}finally{v(null)}}},[e,x,n]),handleOAuthSignOut:(0,Z.useCallback)(async t=>{if(e){v(t);try{await o(e,t),await x(),await n(),k({title:`Signed out`,description:t})}catch(e){k({title:`Sign out failed`,description:e instanceof Error?e.message:`Failed to revoke OAuth credentials`,variant:`destructive`})}finally{v(null)}}},[e,x,n]),handleRefreshCatalog:(0,Z.useCallback)(async t=>{if(e){b(t??`all`);try{let r=await z(e,t);await n();let i=Object.values(r.catalog),[a]=i;if(a)k({title:`Tools refreshed`,description:`${a.serverName} · ${B(a)}`});else{let e=i.filter(e=>e.state===`ok`).length;k({title:`Tools refreshed`,description:`${e}/${i.length} servers loaded`})}}catch(e){k({title:`Refresh failed`,description:e instanceof Error?e.message:`Could not refresh MCP tools`,variant:`destructive`})}finally{b(null)}}},[e,n]),handleOpenInExplorer:(0,Z.useCallback)(()=>{i(`.agents/mcp.json`),a(`explorer`)},[i,a])}}function Zt(){let e=(0,X.c)(102),t=a(tn),n=a(en),r;if(e[0]!==n||e[1]!==t){let i;e[3]===t?i=e[4]:(i=e=>e.projectId===t,e[3]=t,e[4]=i),r=n.find(i),e[0]=n,e[1]=t,e[2]=r}else r=e[2];let o=r?.projectPath,{installedServers:s,catalog:c,loadingConfig:l,loadInstalledServers:u}=V(o),{popularServers:_,loadingPopular:v}=ee(),{openChatDockPanel:b}=j(),{setPendingExplorerPath:x,triggerExplorerRefresh:S}=A(),{editingServer:C,setEditingServer:w,deleteConfirm:k,setDeleteConfirm:M,deleting:N,oauthAuthorized:P,oauthBusy:F,refreshing:I,handleDelete:L,handleOAuthSignIn:R,handleOAuthSignOut:z,handleRefreshCatalog:B,handleOpenInExplorer:H}=Xt(o,s,u,S,x,b),U;e[5]!==s||e[6]!==u||e[7]!==o||e[8]!==S?(U={projectPath:o,installedServers:s,loadInstalledServers:u,triggerExplorerRefresh:S},e[5]=s,e[6]=u,e[7]=o,e[8]=S,e[9]=U):U=e[9];let{showAddDialog:ne,prefillServer:W,installPopularServer:G,openManualAddDialog:q,closeAddDialog:J,completeServerEdit:ce}=qt(U),le;e[10]!==l||e[11]!==v?(le=[l,v],e[10]=l,e[11]=v,e[12]=le):le=e[12];let Y=xe(t,le);if(!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(oe,{children:`Select a project to manage MCP servers.`}),e[13]=t):t=e[13],t}let ve;e[14]===H?ve=e[15]:(ve=(0,Q.jsx)(y,{variant:`ghost`,onClick:H,children:`Config`}),e[14]=H,e[15]=ve);let Z;e[16]!==B||e[17]!==s.length||e[18]!==I?(Z=s.length>=2&&(0,Q.jsxs)(y,{variant:`ghost`,className:`gap-1`,disabled:I!==null,onClick:()=>void B(),children:[(0,Q.jsx)(te,{className:d(`h-4 w-4`,I===`all`&&`animate-spin`)}),`Refresh all`]}),e[16]=B,e[17]=s.length,e[18]=I,e[19]=Z):Z=e[19];let Ce;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsxs)(y,{className:`gap-1`,children:[`Add Server`,(0,Q.jsx)(p,{className:`h-4 w-4 opacity-70`})]})}),e[20]=Ce):Ce=e[20];let we;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(we=d(i.body,`gap-2`),e[21]=we):we=e[21];let Te;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Q.jsx)(ie,{className:`h-4 w-4 shrink-0`}),e[22]=Te):Te=e[22];let Ee;e[23]===q?Ee=e[24]:(Ee=(0,Q.jsxs)(ue,{className:we,onSelect:q,children:[Te,`Manual Entry`]}),e[23]=q,e[24]=Ee);let De;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsxs)(de,{className:d(i.body,`gap-2`),children:[(0,Q.jsx)(re,{className:`h-4 w-4 shrink-0`}),`Popular`]}),e[25]=De):De=e[25];let Oe;e[26]!==G||e[27]!==s||e[28]!==v||e[29]!==_?(Oe=v?(0,Q.jsx)(ue,{disabled:!0,className:i.bodyMuted,children:`Loading…`}):_.length===0?(0,Q.jsx)(ue,{disabled:!0,className:i.bodyMuted,children:`No available servers`}):[..._].sort($t).map(e=>{let t=Ht(e,s);return(0,Q.jsx)(D,{children:(0,Q.jsxs)(O,{children:[(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsxs)(ue,{className:d(i.body,`gap-2`,t&&`opacity-50 cursor-not-allowed`),onSelect:()=>{t||G(e)},children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),t&&(0,Q.jsx)(f,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,Q.jsx)(E,{side:`right`,className:`max-w-64`,children:e.description})]})},e.id)}),e[26]=G,e[27]=s,e[28]=v,e[29]=_,e[30]=Oe):Oe=e[30];let ke;e[31]===Oe?ke=e[32]:(ke=(0,Q.jsxs)(ge,{children:[De,(0,Q.jsx)(ae,{className:`w-80 max-h-80 overflow-y-auto`,children:Oe})]}),e[31]=Oe,e[32]=ke);let Ae;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Q.jsx)(pe,{}),e[33]=Ae):Ae=e[33];let je;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(je=d(i.body,`gap-2`),e[34]=je):je=e[34];let Me;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Q.jsxs)(ue,{className:je,onSelect:Qt,children:[(0,Q.jsx)(m,{className:`h-4 w-4 shrink-0`}),`Marketplace`]}),e[35]=Me):Me=e[35];let Ne;e[36]!==ke||e[37]!==Ee?(Ne=(0,Q.jsxs)(_e,{children:[Ce,(0,Q.jsxs)(he,{align:`end`,className:`w-56`,children:[Ee,ke,Ae,Me]})]}),e[36]=ke,e[37]=Ee,e[38]=Ne):Ne=e[38];let Pe;e[39]!==Ne||e[40]!==ve||e[41]!==Z?(Pe=(0,Q.jsx)(K,{title:`Installed MCP Servers`,description:`MCP servers configured for this project.`,action:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ve,Z,Ne]}),sticky:!1}),e[39]=Ne,e[40]=ve,e[41]=Z,e[42]=Pe):Pe=e[42];let Fe;e[43]!==c||e[44]!==R||e[45]!==z||e[46]!==B||e[47]!==s||e[48]!==P||e[49]!==F||e[50]!==I||e[51]!==M||e[52]!==w?(Fe=(0,Q.jsx)(me,{className:`pt-6`,children:s.length===0?(0,Q.jsx)(Se,{icon:re,title:`Connect your agent to tools, APIs, and data sources`,bordered:!1}):(0,Q.jsx)(`div`,{className:`divide-y divide-table-border`,children:s.map(e=>(0,Q.jsx)(It,{name:e.name,config:e.config,catalog:c[e.name],remote:Yt(e.config),authorized:P[e.name]===!0,oauthBusy:F===e.name,refreshing:I===e.name||I===`all`,onEdit:()=>w(e.name),onRefresh:()=>void B(e.name),onDelete:()=>M(e.name),onSignIn:()=>void R(e.name),onSignOut:()=>void z(e.name)},e.name))})}),e[43]=c,e[44]=R,e[45]=z,e[46]=B,e[47]=s,e[48]=P,e[49]=F,e[50]=I,e[51]=M,e[52]=w,e[53]=Fe):Fe=e[53];let Ie;e[54]!==Pe||e[55]!==Fe?(Ie=(0,Q.jsxs)(se,{className:`shrink-0`,children:[Pe,Fe]}),e[54]=Pe,e[55]=Fe,e[56]=Ie):Ie=e[56];let Le;e[57]!==Y||e[58]!==Ie?(Le=(0,Q.jsx)(fe,{loading:Y,children:Ie}),e[57]=Y,e[58]=Ie,e[59]=Le):Le=e[59];let Re;e[60]!==J||e[61]!==q?(Re=e=>{e?q():J()},e[60]=J,e[61]=q,e[62]=Re):Re=e[62];let ze=W?.name,Be=W?.config,Ve;e[63]!==ce||e[64]!==o||e[65]!==ze||e[66]!==Be?(Ve=(0,Q.jsx)(h,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Q.jsx)(Nt,{projectPath:o,initialName:ze,initialConfig:Be,onBack:ce})}),e[63]=ce,e[64]=o,e[65]=ze,e[66]=Be,e[67]=Ve):Ve=e[67];let He;e[68]!==ne||e[69]!==Re||e[70]!==Ve?(He=(0,Q.jsx)(g,{open:ne,onOpenChange:Re,children:Ve}),e[68]=ne,e[69]=Re,e[70]=Ve,e[71]=He):He=e[71];let Ue=C!==null,We;e[72]===w?We=e[73]:(We=e=>{e||w(null)},e[72]=w,e[73]=We);let Ge=C??void 0,Ke;e[74]!==u||e[75]!==w||e[76]!==S?(Ke=()=>{w(null),u(),S()},e[74]=u,e[75]=w,e[76]=S,e[77]=Ke):Ke=e[77];let qe;e[78]!==o||e[79]!==Ge||e[80]!==Ke?(qe=(0,Q.jsx)(h,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Q.jsx)(Nt,{projectPath:o,serverName:Ge,onBack:Ke})}),e[78]=o,e[79]=Ge,e[80]=Ke,e[81]=qe):qe=e[81];let Je;e[82]!==Ue||e[83]!==We||e[84]!==qe?(Je=(0,Q.jsx)(g,{open:Ue,onOpenChange:We,children:qe}),e[82]=Ue,e[83]=We,e[84]=qe,e[85]=Je):Je=e[85];let Ye=k!==null,Xe;e[86]===M?Xe=e[87]:(Xe=e=>!e&&M(null),e[86]=M,e[87]=Xe);let Ze=`Are you sure you want to delete the server "${k}"? This action cannot be undone.`,Qe;e[88]!==k||e[89]!==L?(Qe=()=>{k&&L(k)},e[88]=k,e[89]=L,e[90]=Qe):Qe=e[90];let $e;e[91]!==N||e[92]!==Ye||e[93]!==Xe||e[94]!==Ze||e[95]!==Qe?($e=(0,Q.jsx)(be,{open:Ye,onOpenChange:Xe,title:`Delete MCP Server`,description:Ze,onConfirm:Qe,confirming:N}),e[91]=N,e[92]=Ye,e[93]=Xe,e[94]=Ze,e[95]=Qe,e[96]=$e):$e=e[96];let $;return e[97]!==Le||e[98]!==He||e[99]!==Je||e[100]!==$e?($=(0,Q.jsxs)(Q.Fragment,{children:[Le,He,Je,$e]}),e[97]=Le,e[98]=He,e[99]=Je,e[100]=$e,e[101]=$):$=e[101],$}function Qt(){c(Jt)}function $t(e,t){return e.name.localeCompare(t.name)}function en(e){return e.projects}function tn(e){return e.selectedProjectId}export{Zt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{U as i}from"./dist-v_MvKS2-.js";import{Z as a,n as o}from"./store-W78TGOIO.js";import{B as s,H as c,It as l,U as u,q as d,z as f}from"./api-Cp9I7CxD.js";import{r as p,t as m}from"./utils-CqsIXqSC.js";import{t as h}from"./button-DDaJhJP1.js";import{r as g}from"./tooltip-CqwCZ7wt.js";import{t as _}from"./progress-indicator-hJ74ac5W.js";import{n as v}from"./suspense-resource-DzlMlIgR.js";import{t as y}from"./use-suspense-resource-uCX26gOk.js";import{G as b,Qt as x,Zt as S,at as ee,et as C,ft as te,gt as w,it as ne,lt as re,pt as ie,vt as T,wt as E}from"./index-CcAwxnT5.js";import{i as D,n as O,o as k,r as A,t as j}from"./table-CQMqIW_-.js";import{n as M,t as ae}from"./toggle-group-CPmseZfb.js";import{n as N,t as oe}from"./commit-method-fields-Xt3vbwUg.js";import{t as P}from"./async-error-boundary-CFVUPiuG.js";import{t as se}from"./sorting-DqwxPMRN.js";import{c as F,o as ce}from"./settings-list-Co3JPr9w.js";import{t as le}from"./use-deferred-search-xgS_2fMW.js";import{n as ue,r as I,t as L}from"./model-list-controls-B6ofHWh3.js";var R=t(),z=e(n(),1);function B(e){let t=(0,R.c)(5),[n,r]=(0,z.useState)(e),i;t[0]===n?i=t[1]:(i=async function(e,t,i,a){if(n[e]?.has(t)){await a(e,t),r(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}});return}await i(e,t),r(n=>({...n,[e]:new Set([...n[e]||[],t])}))},t[0]=n,t[1]=i);let a=i,o;return t[2]!==n||t[3]!==a?(o={enabledByProvider:n,toggleModel:a},t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function de(){let e=(0,R.c)(5),t=o(),n;e[0]===t?n=e[1]:(n=function(e){T(),t({type:a.ConfigUpdated}),e(`Model preferences saved successfully`),setTimeout(()=>e(``),3e3)},e[0]=t,e[1]=n);let r=n,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=function(e,t){e(t instanceof Error?t.message:`Failed to save model changes`)},e[2]=i):i=e[2];let s=i,c;return e[3]===r?c=e[4]:(c={markSaved:r,markFailed:s},e[3]=r,e[4]=c),c}function V(e){let t=(0,R.c)(8),n=o(),r;t[0]!==n||t[1]!==e?(r=function(){n({type:a.ConfigUpdated}),e(`Model preferences saved successfully`)},t[0]=n,t[1]=e,t[2]=r):r=t[2];let i=r,s;t[3]===e?s=t[4]:(s=function(t){e(t instanceof Error?t.message:`Failed to save model changes`)},t[3]=e,t[4]=s);let c=s,l;return t[5]!==c||t[6]!==i?(l={markSaved:i,markFailed:c},t[5]=c,t[6]=i,t[7]=l):l=t[7],l}function fe(e){return`settings-models:coding:${e}`}function H(e){return`settings-models:image:${e}`}async function U(){let e=(await l()).filter(e=>e.apiKey),t=await d(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function W(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await d(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var G=r();function pe(e){let t=(0,R.c)(3),{label:n,large:r}=e,i=r!==void 0&&r?`lg`:`sm`,a;return t[0]!==n||t[1]!==i?(a=(0,G.jsx)(_,{centered:!0,containerClassName:`py-12`,label:n,size:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}var K=`table-fixed`,q=`h-9`,J=m(i.body,`py-1.5`),Y=`w-10 py-1.5`,X=`w-24 py-1.5 text-right`,Z=m(i.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),Q=m(i.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),$=`h-9 w-24 bg-transparent py-2 text-right`,me=`h-9 w-20 bg-transparent py-2 text-right`,he=`h-9 w-48 bg-transparent py-2 text-right`;function ge(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${p(e.prompt??0)} in | $${p(e.completion??0)} out`}function _e(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function ve(e){let t=(0,R.c)(9),{showIntelligence:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=m(`w-full caption-bottom`,K,i.body),t[0]=r):r=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(D,{className:`h-9 w-10 bg-transparent py-2`}),o=(0,G.jsx)(D,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===n?s=t[4]:(s=n?(0,G.jsx)(D,{className:$,children:`Intelligence`}):null,t[3]=n,t[4]=s);let c,l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,G.jsx)(D,{className:me,children:`TPS`}),l=(0,G.jsx)(D,{className:he,children:`Pricing`}),t[5]=c,t[6]=l):(c=t[5],l=t[6]);let u;return t[7]===s?u=t[8]:(u=(0,G.jsx)(`table`,{className:r,children:(0,G.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,G.jsxs)(`tr`,{children:[a,o,s,c,l]})})}),t[7]=s,t[8]=u),u}function ye(e){let t=(0,R.c)(15),{models:n,enabledIds:r,checkboxIdPrefix:a,showIntelligence:o,getModelDisplayName:s,onToggleModel:c}=e,l;if(t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==c||t[5]!==o){let e;t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==c||t[11]!==o?(e=e=>{let t=`${a}${e.id}`,n=r.has(e.id);return(0,G.jsxs)(k,{className:q,children:[(0,G.jsx)(A,{className:Y,children:(0,G.jsx)(b,{id:t,value:n,onChange:()=>c(e.id),ariaLabel:`${s(e)} ${n?`enabled`:`disabled`}`})}),(0,G.jsx)(A,{className:J,children:(0,G.jsx)(`label`,{htmlFor:t,className:m(i.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:s(e)})}),o?(0,G.jsx)(A,{className:X,children:(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(I,{codingIndex:e.coding_index,modelName:s(e)})})}):null,(0,G.jsx)(A,{className:Z,children:_e(e.avgTPS)}),(0,G.jsx)(A,{className:Q,children:ge(e.pricing)})]},e.id)},t[7]=a,t[8]=r,t[9]=s,t[10]=c,t[11]=o,t[12]=e):e=t[12],l=n.map(e),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=c,t[5]=o,t[6]=l}else l=t[6];let u;return t[13]===l?u=t[14]:(u=(0,G.jsx)(j,{className:K,children:(0,G.jsx)(O,{children:l})}),t[13]=l,t[14]=u),u}function be(e){let t=(0,R.c)(25),{providerName:n,providerSlug:r,action:a,tableHeader:o,children:s}=e,c;t[0]!==n||t[1]!==r?(c=(0,G.jsx)(C,{provider:{name:n,slug:r}}),t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=m(i.sectionTitle,`truncate`),t[3]=l):l=t[3];let u;t[4]===n?u=t[5]:(u=(0,G.jsx)(`h2`,{className:l,children:n}),t[4]=n,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f;t[9]===a?f=t[10]:(f=a?(0,G.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:a}):null,t[9]=a,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let h;t[14]===o?h=t[15]:(h=o?(0,G.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:o}):null,t[14]=o,t[15]=h);let g=o?`pt-0`:`pt-6`,_;t[16]===g?_=t[17]:(_=m(`px-6 pb-6`,g),t[16]=g,t[17]=_);let v;t[18]!==s||t[19]!==_?(v=(0,G.jsx)(`div`,{className:_,children:s}),t[18]=s,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==p||t[23]!==h?(y=(0,G.jsxs)(w,{className:`shrink-0`,children:[p,h,v]}),t[21]=v,t[22]=p,t[23]=h,t[24]=y):y=t[24],y}function xe(e){let t=(0,R.c)(23),{provider:n,filteredAndSortedModels:r,enabledIds:i,globalSearchQuery:a,getModelDisplayName:o,selectAllId:s,checkboxIdPrefix:c,showIntelligence:l,noModelsMessage:u,onToggleAll:d,onToggleModel:f}=e;if(r.length===0&&a)return null;let p;t[0]!==i||t[1]!==r||t[2]!==d||t[3]!==s?(p=r.length>0?(0,G.jsx)(L,{id:s,checked:r.every(e=>i.has(e.id)),onChange:d}):null,t[0]=i,t[1]=r,t[2]=d,t[3]=s,t[4]=p):p=t[4];let m;t[5]!==r.length||t[6]!==l?(m=r.length>0?(0,G.jsx)(ve,{showIntelligence:l}):void 0,t[5]=r.length,t[6]=l,t[7]=m):m=t[7];let h;t[8]!==c||t[9]!==i||t[10]!==r||t[11]!==o||t[12]!==a||t[13]!==u||t[14]!==f||t[15]!==l?(h=r.length===0?(0,G.jsx)(F,{message:a?`No models matching your search.`:u}):(0,G.jsx)(g,{children:(0,G.jsx)(ye,{models:r,enabledIds:i,checkboxIdPrefix:c,showIntelligence:l,getModelDisplayName:o,onToggleModel:f})}),t[8]=c,t[9]=i,t[10]=r,t[11]=o,t[12]=a,t[13]=u,t[14]=f,t[15]=l,t[16]=h):h=t[16];let _;return t[17]!==n.name||t[18]!==n.slug||t[19]!==p||t[20]!==m||t[21]!==h?(_=(0,G.jsx)(be,{providerName:n.name,providerSlug:n.slug,action:p,tableHeader:m,children:h},n.slug),t[17]=n.name,t[18]=n.slug,t[19]=p,t[20]=m,t[21]=h,t[22]=_):_=t[22],_}function Se(e){let t=(0,R.c)(31),{providers:n,globalSearchQuery:r,modelSortBy:i,filterAndSortModels:a,getModelDisplayName:o,onSaveStatus:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=H(0),t[0]=l):l=t[0];let u;t[1]===n?u=t[2]:(u=()=>W(n),t[1]=n,t[2]=u);let d=y(l,u),[p]=(0,z.useState)(d.allImageModels),m=B(d.enabledImageModelIds),h=V(s),g;t[3]!==h||t[4]!==m?(g=async function(e,t){try{await m.toggleModel(e,t,c,f),h.markSaved()}catch(e){let t=e;h.markFailed(t)}},t[3]=h,t[4]=m,t[5]=g):g=t[5];let _=g,v;t[6]!==p||t[7]!==_||t[8]!==m?(v=async function(e,t){let n=p[e];if(!n)return;let r=m.enabledByProvider[e];for(let i of n)r?.has(i.id)!==t&&await _(e,i.id)},t[6]=p,t[7]=_,t[8]=m,t[9]=v):v=t[9];let b=v,x;if(t[10]!==p||t[11]!==a||t[12]!==o||t[13]!==r||t[14]!==b||t[15]!==_||t[16]!==m||t[17]!==i||t[18]!==n){let e;t[20]!==p||t[21]!==a||t[22]!==o||t[23]!==r||t[24]!==b||t[25]!==_||t[26]!==m||t[27]!==i?(e=e=>{let t=p[e.slug]||[],n=m.enabledByProvider[e.slug]||new Set,s=a(t,n,i);return(0,G.jsx)(xe,{provider:e,filteredAndSortedModels:s,enabledIds:n,globalSearchQuery:r,getModelDisplayName:o,selectAllId:`select-all-image-${e.slug}`,checkboxIdPrefix:`image-`,showIntelligence:!1,noModelsMessage:`No image models available for this provider.`,onToggleAll:t=>void b(e.slug,t),onToggleModel:t=>void _(e.slug,t)},e.slug)},t[20]=p,t[21]=a,t[22]=o,t[23]=r,t[24]=b,t[25]=_,t[26]=m,t[27]=i,t[28]=e):e=t[28],x=n.filter(Ce).map(e),t[10]=p,t[11]=a,t[12]=o,t[13]=r,t[14]=b,t[15]=_,t[16]=m,t[17]=i,t[18]=n,t[19]=x}else x=t[19];let S;return t[29]===x?S=t[30]:(S=(0,G.jsx)(G.Fragment,{children:x}),t[29]=x,t[30]=S),S}function Ce(e){return e.name.toLowerCase()===`openrouter`}function we(e){let t=(0,R.c)(66),{loadVersion:n}=e,r;t[0]===n?r=t[1]:(r=fe(n),t[0]=n,t[1]=r);let a=y(r,De),o=a.providers,[c]=(0,z.useState)(a.allModels),l=B(a.enabledModelIds),d=de(),[f,p]=(0,z.useState)(`coding`),{query:h,setQuery:g,deferredQuery:_}=le(),[v,b]=(0,z.useState)(`alphabetical`),[C,T]=(0,z.useState)(``),E=Ee,D;t[2]!==d||t[3]!==l?(D=async function(e,t){try{await l.toggleModel(e,t,u,s),d.markSaved(T)}catch(e){let t=e;d.markFailed(T,t)}},t[2]=d,t[3]=l,t[4]=D):D=t[4];let O=D,k;t[5]!==c||t[6]!==l||t[7]!==O?(k=async function(e,t){let n=c[e];if(!n)return;let r=l.enabledByProvider[e];for(let i of n)r?.has(i.id)!==t&&await O(e,i.id)},t[5]=c,t[6]=l,t[7]=O,t[8]=k):k=t[8];let A=k,j;t[9]===_?j=t[10]:(j=(e,t,n)=>se({models:e,query:_,sortBy:n,getDisplayName:E,getPriority:e=>+!t.has(e.id)}),t[9]=_,t[10]=j);let P=j;if(o.length===0){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(te,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}),t[11]=e):e=t[11],e}let F;t[12]===o?F=t[13]:(F=o.some(Te),t[12]=o,t[13]=F);let I=F,L;t[14]!==h||t[15]!==g?(L=(0,G.jsx)(ee,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,G.jsx)(ce,{placeholder:`Search`,value:h,onChange:g,className:`mb-0 w-64`}),sticky:!1}),t[14]=h,t[15]=g,t[16]=L):L=t[16];let V;t[17]!==f||t[18]!==g||t[19]!==I?(V=I?(0,G.jsxs)(ae,{type:`single`,value:f,onValueChange:e=>{(e===`coding`||e===`image`)&&(p(e),g(``))},"aria-label":`Model type`,className:m(oe,`shrink-0`),children:[(0,G.jsx)(M,{value:`coding`,"aria-label":`Coding`,className:m(i.body,N),children:`Coding`}),(0,G.jsx)(M,{value:`image`,"aria-label":`Image`,className:m(i.body,N),children:`Image`})]}):null,t[17]=f,t[18]=g,t[19]=I,t[20]=V):V=t[20];let H;t[21]===C?H=t[22]:(H=C?(0,G.jsx)(ne,{variant:C.includes(`error`)||C.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:C}):null,t[21]=C,t[22]=H);let U=f===`coding`,W=f===`coding`,K;t[23]!==v||t[24]!==W||t[25]!==U?(K=(0,G.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,G.jsx)(ue,{sortBy:v,showCodingIndex:U,showIntelligenceByPrice:W,onSortByChange:b})}),t[23]=v,t[24]=W,t[25]=U,t[26]=K):K=t[26];let q;t[27]!==K||t[28]!==V||t[29]!==H?(q=(0,G.jsx)(ie,{className:`max-w-none pt-6`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[V,H,K]})}),t[27]=K,t[28]=V,t[29]=H,t[30]=q):q=t[30];let J;t[31]!==q||t[32]!==L?(J=(0,G.jsxs)(w,{className:`shrink-0`,children:[L,q]}),t[31]=q,t[32]=L,t[33]=J):J=t[33];let Y;if(t[34]!==c||t[35]!==l||t[36]!==P||t[37]!==h||t[38]!==A||t[39]!==O||t[40]!==v||t[41]!==o){let e;t[43]!==c||t[44]!==l||t[45]!==P||t[46]!==h||t[47]!==A||t[48]!==O||t[49]!==v?(e=e=>{let t=c[e.slug]||[],n=l.enabledByProvider[e.slug]||new Set,r=P(t,n,v);return(0,G.jsx)(xe,{provider:e,filteredAndSortedModels:r,enabledIds:n,globalSearchQuery:h,getModelDisplayName:E,selectAllId:`select-all-${e.slug}`,checkboxIdPrefix:``,showIntelligence:v===`coding-index`||v===`intelligence-by-price`,noModelsMessage:`No models available for this provider.`,onToggleAll:t=>void A(e.slug,t),onToggleModel:t=>void O(e.slug,t)},e.slug)},t[43]=c,t[44]=l,t[45]=P,t[46]=h,t[47]=A,t[48]=O,t[49]=v,t[50]=e):e=t[50],Y=o.map(e),t[34]=c,t[35]=l,t[36]=P,t[37]=h,t[38]=A,t[39]=O,t[40]=v,t[41]=o,t[42]=Y}else Y=t[42];let X;t[51]===Y?X=t[52]:(X=(0,G.jsx)(x,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:Y}),t[51]=Y,t[52]=X);let Z;t[53]!==P||t[54]!==h||t[55]!==v||t[56]!==f||t[57]!==o?(Z=f===`image`?(0,G.jsx)(z.Suspense,{fallback:(0,G.jsx)(pe,{}),children:(0,G.jsx)(Se,{providers:o,globalSearchQuery:h,modelSortBy:v,filterAndSortModels:P,getModelDisplayName:E,onSaveStatus:e=>{T(e),e.includes(`Failed`)||setTimeout(()=>T(``),3e3)}})}):null,t[53]=P,t[54]=h,t[55]=v,t[56]=f,t[57]=o,t[58]=Z):Z=t[58];let Q;t[59]===Z?Q=t[60]:(Q=(0,G.jsx)(x,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:Z}),t[59]=Z,t[60]=Q);let $;return t[61]!==f||t[62]!==J||t[63]!==X||t[64]!==Q?($=(0,G.jsx)(re,{loading:!1,children:(0,G.jsxs)(S,{value:f,className:`flex flex-col gap-2.5`,children:[J,X,Q]})}),t[61]=f,t[62]=J,t[63]=X,t[64]=Q,t[65]=$):$=t[65],$}function Te(e){return e.name.toLowerCase()===`openrouter`}function Ee(e){return E(e.id)}function De(){return U()}function Oe(){let e=(0,R.c)(8),[t,n]=(0,z.useState)(0),r;e[0]===t?r=e[1]:(r=function(){v(fe(t)),n(Ae)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(pe,{label:`Loading models...`,large:!0}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,G.jsx)(z.Suspense,{fallback:a,children:(0,G.jsx)(we,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,G.jsx)(`div`,{className:`h-full min-h-0`,children:(0,G.jsx)(P,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ke,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ke(e,t){return(0,G.jsx)(te,{title:`Failed to load models`,action:(0,G.jsx)(h,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Ae(e){return e+1}export{Oe as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-skills-view-BNVx4bZl.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-vendor-D61Uve5n.js","assets/dist-v_MvKS2-.js","assets/store-W78TGOIO.js","assets/utils-CqsIXqSC.js","assets/api-Cp9I7CxD.js","assets/markdown-renderer-DQONI6WG.js","assets/useQuery-DWt09r77.js","assets/useBaseQuery-yghQO052.js","assets/QueryClientProvider-CYXTUmYo.js","assets/explorer-media-CRzhs0NW.js","assets/check-skFQ1X72.js","assets/createLucideIcon-2A3hmV_e.js","assets/copy-bi9iX3xn.js","assets/download-CWhQNGlF.js","assets/external-link-Dcikmdm_.js","assets/minus-CgQcbBQT.js","assets/dialog-D_12AsZd.js","assets/x-ByOPrz5I.js","assets/dist-DfnQ9YJh.js","assets/dist-AbkJBHH5.js","assets/es2015-eNVkKfFF.js","assets/use-browser-overlay-block-CO1pUEAZ.js","assets/play-Dn1mbRpD.js","assets/plus-DoMzejDu.js","assets/rotate-ccw-Dthg8Pv6.js","assets/button-DDaJhJP1.js","assets/tooltip-CqwCZ7wt.js","assets/dist-2xH_pFmV.js","assets/use-toast-CKgZ8YeP.js","assets/explorer-tab-context-BwR8CM8l.js","assets/use-open-chat-dock-panel-CXzpgxVs.js","assets/chunk-QFMPRPBF-Cy-_pFSM.js","assets/chat-dock-context-DbiJNr3O.js","assets/random-uuid-Dc3UrwVo.js","assets/main-tab-context-Dsp4OYi9.js","assets/terminal-output-activity-D_FxlE-L.js","assets/query-keys-CcnonAAG.js","assets/remote-media-url-C-GdJb-D.js","assets/chevron-down-Bpo4ncEN.js","assets/loader-circle-CrqRIqdA.js","assets/label-BCs5CZEs.js","assets/dist-B-h6Wj39.js","assets/progress-indicator-hJ74ac5W.js","assets/alert-dialog-BcZULJsX.js","assets/select-DMcNYwgt.js","assets/chevron-up-BxgjX7B3.js","assets/dist-DOz2WXwX.js","assets/dist-Dx8OsX8-.js","assets/scroll-area-DGF9wUqQ.js","assets/dist-CkGJjZXY.js","assets/index-CcAwxnT5.js","assets/useInfiniteQuery-BpKy1sCq.js","assets/use-account-settings-query-D_qL1I4w.js","assets/chat-handlers-context-DYU2LQ5V.js","assets/create-project-workspace-CJ94yHAB.js","assets/task-utils-Cnq9Eszt.js","assets/suspense-resource-DzlMlIgR.js","assets/dist-CgbWuuq4.js","assets/chevron-right-Dga3q1bZ.js","assets/circle-alert-CC2eO3yt.js","assets/circle-DQwOli2u.js","assets/grip-vertical-_jCIw8Mw.js","assets/square-CtxvwmM2.js","assets/dist-pCVg1Jdl.js","assets/dist-JGbQ_EJY.js","assets/use-projects-B0xTjTaA.js","assets/use-suspense-resource-uCX26gOk.js","assets/explorer-file-drop-DAP7ha-E.js","assets/api-8Rp2LlXt.js","assets/mcp-manager-D2FG-h2e.js","assets/index-dNrgKdYv.css","assets/delete-confirm-dialog-D1N86piR.js","assets/use-settings-page-loading-B5WU5d1c.js","assets/settings-list-Co3JPr9w.js","assets/card-DAc45J1v.js","assets/use-deferred-search-xgS_2fMW.js","assets/slug-utils-CO6nui1C.js","assets/use-installed-ai-files-Nn-sN_V2.js","assets/settings-mcp-servers-view-414Dt5py.js","assets/settings-system-prompt-view-CEDU2saT.js","assets/project-tools-view-Dmp5ViRC.js","assets/settings-slash-commands-view-m6mp1knu.js","assets/settings-subagents-view-CucwEk2A.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,r,t as i}from"./react-vendor-D61Uve5n.js";import{o as a,s as o}from"./chunk-QFMPRPBF-Cy-_pFSM.js";import"./dist-v_MvKS2-.js";import{t as s}from"./progress-indicator-hJ74ac5W.js";import{t as c}from"./settings-tab-bar-CdIbQ0WI.js";import{n as l,r as u}from"./settings-view-XcJhRclT.js";var d=t(),f=e(n(),1),p=i(),m=(0,f.lazy)(function(){return r(()=>import(`./settings-skills-view-BNVx4bZl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79]))}),h=(0,f.lazy)(function(){return r(()=>import(`./settings-mcp-servers-view-414Dt5py.js`),__vite__mapDeps([80,1,2,3,4,5,6,12,13,40,16,18,19,20,21,22,23,25,27,29,28,30,31,32,33,34,35,36,37,51,46,47,48,49,50,71,52,9,10,53,54,8,38,55,56,57,58,39,59,7,11,14,15,17,24,26,60,61,62,63,41,64,43,42,65,66,44,45,67,68,69,70,72,73,74,75,76]))}),g=(0,f.lazy)(function(){return r(()=>import(`./settings-system-prompt-view-CEDU2saT.js`),__vite__mapDeps([81,1,2,3,4,5,6,41,13,27,28,21,29,30,45,20,22,23,52,33,9,10,53,54,8,38,55,56,37,57,58,35,39,32,34,31,36,59,7,11,12,14,15,16,17,18,19,24,25,26,40,60,47,61,62,63,64,43,42,49,65,48,66,50,44,67,68,69,70,51,46,71,72,74]))}),_=(0,f.lazy)(function(){return r(()=>import(`./project-tools-view-Dmp5ViRC.js`),__vite__mapDeps([82,1,2,33,3,6,5,41,13,27,30,52,9,10,53,54,8,38,4,55,56,37,57,58,35,39,32,34,31,36,59,7,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,40,60,47,61,62,63,64,43,42,49,65,48,66,50,44,45,67,68,69,70,51,46,71,72,74]))}),v=(0,f.lazy)(function(){return r(()=>import(`./settings-slash-commands-view-m6mp1knu.js`),__vite__mapDeps([83,1,2,3,4,5,6,62,13,18,19,20,21,22,23,27,29,42,43,49,65,48,30,31,32,33,34,35,36,37,51,52,9,10,53,54,8,38,55,56,57,58,39,59,7,11,12,14,15,16,17,24,25,26,28,40,60,47,61,63,41,64,66,50,44,45,67,68,69,70,46,71,72,73,74,75,76,78]))}),y=(0,f.lazy)(function(){return r(()=>import(`./settings-subagents-view-CucwEk2A.js`),__vite__mapDeps([84,1,2,3,6,5,18,13,19,20,21,22,23,27,30,52,33,9,10,53,54,8,38,4,55,56,37,57,58,35,39,32,34,31,36,59,7,11,12,14,15,16,17,24,25,26,28,29,40,60,47,61,62,63,41,64,43,42,49,65,48,66,50,44,45,67,68,69,70,51,46,71,72,73,74,75,76,78,79]))});function b(e){let t=(0,d.c)(35),{projectId:n,fallbackTab:r,onProjectUpdated:i}=e,b=r===void 0?`skills`:r,x=a(),S=o(),C;t[0]!==b||t[1]!==x?(C=b===`skills`?u(x.pathname)??b:b,t[0]=b,t[1]=x,t[2]=C):C=t[2];let w=C,T;t[3]!==S||t[4]!==n?(T=function(e){if(n){S(`/settings/project/${n}/plugins/${e}`);return}S(`/settings/plugins/${e}`)},t[3]=S,t[4]=n,t[5]=T):T=t[5];let E=T,D;t[6]!==w||t[7]!==E?(D=(0,p.jsx)(c,{value:w,onValueChange:E,options:l}),t[6]=w,t[7]=E,t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(s,{centered:!0,label:`Loading plugin settings...`}),t[9]=O):O=t[9];let k;t[10]!==w||t[11]!==x?(k=w===`skills`&&(0,p.jsx)(m,{},x.key),t[10]=w,t[11]=x,t[12]=k):k=t[12];let A;t[13]===w?A=t[14]:(A=w===`mcp-servers`&&(0,p.jsx)(h,{}),t[13]=w,t[14]=A);let j;t[15]===w?j=t[16]:(j=w===`system-prompt`&&(0,p.jsx)(g,{}),t[15]=w,t[16]=j);let M;t[17]!==w||t[18]!==i||t[19]!==n?(M=w===`tools`&&(0,p.jsx)(_,{projectId:n,onProjectUpdated:i}),t[17]=w,t[18]=i,t[19]=n,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=w===`slash-commands`&&(0,p.jsx)(v,{}),t[21]=w,t[22]=N);let P;t[23]===w?P=t[24]:(P=w===`subagents`&&(0,p.jsx)(y,{}),t[23]=w,t[24]=P);let F;t[25]!==N||t[26]!==P||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(F=(0,p.jsx)(`div`,{className:`min-h-0 flex-1`,role:`region`,"aria-label":`Plugin settings`,children:(0,p.jsxs)(f.Suspense,{fallback:O,children:[k,A,j,M,N,P]})}),t[25]=N,t[26]=P,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=F):F=t[31];let I;return t[32]!==F||t[33]!==D?(I=(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[D,F]}),t[32]=F,t[33]=D,t[34]=I):I=t[34],I}export{b as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/providers-list-view-Clbp73Hh.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-vendor-D61Uve5n.js","assets/chunk-QFMPRPBF-Cy-_pFSM.js","assets/dist-v_MvKS2-.js","assets/store-W78TGOIO.js","assets/utils-CqsIXqSC.js","assets/api-Cp9I7CxD.js","assets/loader-circle-CrqRIqdA.js","assets/createLucideIcon-2A3hmV_e.js","assets/x-ByOPrz5I.js","assets/button-DDaJhJP1.js","assets/tooltip-CqwCZ7wt.js","assets/dist-AbkJBHH5.js","assets/dist-2xH_pFmV.js","assets/progress-indicator-hJ74ac5W.js","assets/suspense-resource-DzlMlIgR.js","assets/use-suspense-resource-uCX26gOk.js","assets/index-CcAwxnT5.js","assets/useBaseQuery-yghQO052.js","assets/QueryClientProvider-CYXTUmYo.js","assets/useInfiniteQuery-BpKy1sCq.js","assets/use-account-settings-query-D_qL1I4w.js","assets/useQuery-DWt09r77.js","assets/query-keys-CcnonAAG.js","assets/chat-handlers-context-DYU2LQ5V.js","assets/create-project-workspace-CJ94yHAB.js","assets/terminal-output-activity-D_FxlE-L.js","assets/task-utils-Cnq9Eszt.js","assets/random-uuid-Dc3UrwVo.js","assets/use-toast-CKgZ8YeP.js","assets/remote-media-url-C-GdJb-D.js","assets/use-open-chat-dock-panel-CXzpgxVs.js","assets/chat-dock-context-DbiJNr3O.js","assets/explorer-tab-context-BwR8CM8l.js","assets/main-tab-context-Dsp4OYi9.js","assets/dist-CgbWuuq4.js","assets/markdown-renderer-DQONI6WG.js","assets/explorer-media-CRzhs0NW.js","assets/check-skFQ1X72.js","assets/copy-bi9iX3xn.js","assets/download-CWhQNGlF.js","assets/external-link-Dcikmdm_.js","assets/minus-CgQcbBQT.js","assets/dialog-D_12AsZd.js","assets/dist-DfnQ9YJh.js","assets/es2015-eNVkKfFF.js","assets/use-browser-overlay-block-CO1pUEAZ.js","assets/play-Dn1mbRpD.js","assets/plus-DoMzejDu.js","assets/rotate-ccw-Dthg8Pv6.js","assets/chevron-down-Bpo4ncEN.js","assets/chevron-right-Dga3q1bZ.js","assets/chevron-up-BxgjX7B3.js","assets/circle-alert-CC2eO3yt.js","assets/circle-DQwOli2u.js","assets/grip-vertical-_jCIw8Mw.js","assets/square-CtxvwmM2.js","assets/dist-B-h6Wj39.js","assets/label-BCs5CZEs.js","assets/dist-Dx8OsX8-.js","assets/dist-pCVg1Jdl.js","assets/dist-DOz2WXwX.js","assets/dist-JGbQ_EJY.js","assets/scroll-area-DGF9wUqQ.js","assets/alert-dialog-BcZULJsX.js","assets/use-projects-B0xTjTaA.js","assets/explorer-file-drop-DAP7ha-E.js","assets/api-8Rp2LlXt.js","assets/dist-CkGJjZXY.js","assets/select-DMcNYwgt.js","assets/mcp-manager-D2FG-h2e.js","assets/index-dNrgKdYv.css","assets/async-error-boundary-CFVUPiuG.js","assets/card-DAc45J1v.js","assets/sorting-DqwxPMRN.js","assets/pending-changes-Bn-0ak1d.js","assets/settings-list-Co3JPr9w.js","assets/use-deferred-search-xgS_2fMW.js","assets/model-list-controls-B6ofHWh3.js","assets/settings-models-view-ByeR7Enb.js","assets/table-CQMqIW_-.js","assets/toggle-group-CPmseZfb.js","assets/commit-method-fields-Xt3vbwUg.js","assets/project-model-aliases-view-APAVFfym.js","assets/use-settings-page-loading-B5WU5d1c.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,r,t as i}from"./react-vendor-D61Uve5n.js";import{o as a,s as o}from"./chunk-QFMPRPBF-Cy-_pFSM.js";import"./dist-v_MvKS2-.js";import{t as s}from"./progress-indicator-hJ74ac5W.js";import{t as c}from"./settings-tab-bar-CdIbQ0WI.js";import{o as l,s as u}from"./settings-view-XcJhRclT.js";var d=t(),f=e(n(),1),p=i(),m=(0,f.lazy)(function(){return r(()=>import(`./providers-list-view-Clbp73Hh.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79]))}),h=(0,f.lazy)(function(){return r(()=>import(`./settings-models-view-ByeR7Enb.js`),__vite__mapDeps([80,1,2,4,5,6,7,11,12,13,14,15,16,17,18,3,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,9,40,41,42,43,44,10,45,46,47,48,49,50,51,52,53,54,55,56,8,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,81,82,83,73,74,75,77,78,79]))}),g=(0,f.lazy)(function(){return r(()=>import(`./project-model-aliases-view-APAVFfym.js`),__vite__mapDeps([84,1,2,22,19,20,23,4,7,24,6,11,30,70,39,9,51,53,13,14,12,46,62,60,64,69,18,3,21,5,25,26,27,28,16,29,31,32,33,34,35,36,37,38,40,41,42,43,44,10,45,47,48,49,50,52,54,55,56,8,57,58,59,61,63,15,65,66,17,67,68,71,72,81,85]))});function _(e){let t=(0,d.c)(22),{fallbackTab:n}=e,r=n===void 0?`providers`:n,i=a(),_=o(),v;t[0]!==r||t[1]!==i?(v=r===`providers`?u(i.pathname)??r:r,t[0]=r,t[1]=i,t[2]=v):v=t[2];let y=v,b;t[3]===_?b=t[4]:(b=function(e){_(`/settings/${e}`)},t[3]=_,t[4]=b);let x=b,S;t[5]!==y||t[6]!==x?(S=(0,p.jsx)(c,{value:y,onValueChange:x,options:l}),t[5]=y,t[6]=x,t[7]=S):S=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(s,{centered:!0,label:`Loading provider settings...`}),t[8]=C):C=t[8];let w;t[9]===y?w=t[10]:(w=y===`providers`&&(0,p.jsx)(m,{}),t[9]=y,t[10]=w);let T;t[11]===y?T=t[12]:(T=y===`models`&&(0,p.jsx)(h,{}),t[11]=y,t[12]=T);let E;t[13]===y?E=t[14]:(E=y===`model-aliases`&&(0,p.jsx)(g,{}),t[13]=y,t[14]=E);let D;t[15]!==w||t[16]!==T||t[17]!==E?(D=(0,p.jsx)(`div`,{className:`min-h-0 flex-1`,role:`region`,"aria-label":`Provider settings`,children:(0,p.jsxs)(f.Suspense,{fallback:C,children:[w,T,E]})}),t[15]=w,t[16]=T,t[17]=E,t[18]=D):D=t[18];let O;return t[19]!==S||t[20]!==D?(O=(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[S,D]}),t[19]=S,t[20]=D,t[21]=O):O=t[21],O}export{_ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{a as i,i as a,l as o,n as s,o as c,t as l}from"./use-account-settings-query-D_qL1I4w.js";import{n as u}from"./QueryClientProvider-CYXTUmYo.js";import{U as d,x as f}from"./dist-v_MvKS2-.js";import{P as p,Vi as m,fa as h,ha as g,in as _,mr as v,on as y,sa as b,si as x,t as S}from"./api-Cp9I7CxD.js";import{t as C}from"./utils-CqsIXqSC.js";import{t as w}from"./check-skFQ1X72.js";import{t as T}from"./copy-bi9iX3xn.js";import{t as E}from"./loader-circle-CrqRIqdA.js";import{a as D,i as O,o as k,r as A,s as j,t as M}from"./dialog-D_12AsZd.js";import{t as N}from"./plus-DoMzejDu.js";import{t as P}from"./x-ByOPrz5I.js";import{t as F}from"./button-DDaJhJP1.js";import{i as I,n as ee,t as L}from"./tooltip-CqwCZ7wt.js";import{t as R}from"./label-BCs5CZEs.js";import{t as te}from"./use-toast-CKgZ8YeP.js";import{a as z,c as ne,i as B,n as V,o as H,r as U,s as W,t as G}from"./alert-dialog-BcZULJsX.js";import{Ar as K,Bt as q,G as re,Ht as J,Qn as Y,Un as ie,Vt as ae,at as oe,dn as se,dt as ce,fn as le,gn as X,gt as ue,j as de,lt as fe,mn as pe,nt as me,o as he,pn as ge,pt as _e}from"./index-CcAwxnT5.js";import{t as ve}from"./use-settings-page-loading-B5WU5d1c.js";var Z=t(),Q=e(n(),1),ye=f(`app.use-local-machine-name.hook`);function be(){let e=(0,Z.c)(12),{data:t,isLoading:n}=a(),r=i(),o=t?.machineName??``,[s,c]=(0,Q.useState)(``),l,u;e[0]===o?(l=e[1],u=e[2]):(l=function(){o&&c(o)},u=[o],e[0]=o,e[1]=l,e[2]=u),(0,Q.useEffect)(l,u);let d;e[3]!==s||e[4]!==o||e[5]!==r?(d=async function(){let e=s.trim();if(!e||e===o){c(o);return}try{let t=await r.mutateAsync({machineName:e});c(t.machineName)}catch(e){let t=e;throw ye.error(`Failed to update machine name:`,t),c(o),t}},e[3]=s,e[4]=o,e[5]=r,e[6]=d):d=e[6];let f=d,p;return e[7]!==s||e[8]!==n||e[9]!==f||e[10]!==r.isPending?(p={draftMachineName:s,isLoading:n,isSaving:r.isPending,setDraftMachineName:c,saveDraftMachineName:f},e[7]=s,e[8]=n,e[9]=f,e[10]=r.isPending,e[11]=p):p=e[11],p}var xe=f(`app.use-remote-machines.hook`);function Se(e){return[...e].sort(function(e,t){let n=e.machineName.localeCompare(t.machineName,void 0,{sensitivity:`base`});return n===0?e.publicUrl.localeCompare(t.publicUrl):n})}function Ce(e){let t={};for(let n of e)t[n.id]=n.machineName;return t}function we(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)({}),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(()=>new Set);(0,Q.useEffect)(()=>{let e=!1;async function n(){try{let n=await _();e||(t(n.remoteMachines),r(Ce(n.remoteMachines)))}catch(e){xe.error(`Failed to load remote machines:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);async function c(e){let n=(await S(e)).remoteMachine;return t(e=>Se([...e,n])),r(e=>({...e,[n.id]:n.machineName})),n}async function l(e){await p(e),t(t=>t.filter(t=>t.id!==e)),r(t=>{let n={...t};return delete n[e],n})}function u(e,t){r(n=>({...n,[e]:t}))}async function d(r){let i=e.find(e=>e.id===r),a=(n[r]??``).trim();if(i){if(!a||a===i.machineName){u(r,i.machineName);return}s(e=>new Set(e).add(r));try{let e=await v(r,a);t(t=>Se(t.map(t=>t.id===r?e.remoteMachine:t))),u(r,e.remoteMachine.machineName)}catch(e){throw xe.error(`Failed to update remote machine name:`,e),u(r,i.machineName),e}finally{s(e=>{let t=new Set(e);return t.delete(r),t})}}}function f(e){return o.has(e)}return{addMachine:c,draftNames:n,isLoading:i,isSavingId:f,remoteMachines:e,removeMachine:l,saveDraftName:d,setDraftName:u}}var Te=f(`app.use-server-bind-mode.hook`),Ee=`local`,De=`tarsk-server-bind-mode-changed`;function Oe(e){b(e)}function ke(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(De)===`true`}catch{return!1}}function Ae(e){if(typeof window<`u`)try{e?sessionStorage.setItem(De,`true`):sessionStorage.removeItem(De)}catch{}}function je(e){let t=(0,Z.c)(4),[n,r]=(0,Q.useState)(null),i,a;return t[0]!==n||t[1]!==e?(i=function(){e!==void 0&&n===null&&r(e)},a=[n,e],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a),n}function Me(e,t){let n=(0,Z.c)(4),r,i;n[0]!==t||n[1]!==e?(r=function(){e!==void 0&&t!==void 0&&Oe({networkAddresses:t,serverBindMode:e})},i=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,Q.useEffect)(r,i)}function Ne(e,t){let{serverBindMode:n=Ee}=t??{},{serverBindMode:r=n}=e??{};return r}function Pe(e,t){let{networkAddresses:n=[]}=t??{},{networkAddresses:r=n}=e??{};return r}function Fe(e){let{tunnelUrl:t=null,tunnelStatus:n=`off`,tunnelError:r=null}=e??{};return{tunnelUrl:t,tunnelStatus:n,tunnelError:r}}function Ie(e,t,n,r){return{serverBindMode:Ne(e,t),networkAddresses:Pe(e,t),...Fe(e),isLoading:n||r&&t===null}}function Le(e){let t=(0,Z.c)(8),n=(0,Q.useSyncExternalStore)(ae,q,Re),r=J(),i=r&&n,a,o;t[0]!==r||t[1]!==e?(a=function(){if(r)return de(function(t){t===`tunnel`&&s(e).catch(function(){})})},o=[r,e],t[0]=r,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Q.useEffect)(a,o);let c,u;return t[4]!==e||t[5]!==i?(c=function(){if(i)return he(function(t){if(!g(t.status))return;let n=t.status;e.getQueryData(l())?e.setQueryData(l(),function(e){return e&&{...e,tunnelError:t.error,tunnelStatus:n,tunnelUrl:t.url}}):s(e).catch(function(){})})},u=[e,i],t[4]=e,t[5]=i,t[6]=c,t[7]=u):(c=t[6],u=t[7]),(0,Q.useEffect)(c,u),i}function Re(){return!1}function ze(e,t,n,r){let i=(0,Z.c)(6),a,o;i[0]!==t||i[1]!==e||i[2]!==r||i[3]!==n?(a=function(){if(t||!n||r)return;let i=0,a=!1,o=setInterval(function(){if(i+=1,i>20){clearInterval(o);return}s(e).catch(function(){}).finally(function(){a&&clearInterval(o)})},2e3);return function(){a=!0,clearInterval(o)}},o=[t,e,r,n],i[0]=t,i[1]=e,i[2]=r,i[3]=n,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}function Be(){let e=(0,Z.c)(17),t=u(),{isLoading:n}=c(),{data:r,isLoading:o}=a(),s=i(),[l,d]=(0,Q.useState)(ke),f;e[0]!==n||e[1]!==r||e[2]!==o?(f=Ie(r,m(),n,o),e[0]=n,e[1]=r,e[2]=o,e[3]=f):f=e[3];let p=f,h=r?.serverBindMode,g=je(h);Me(h,r?.networkAddresses);let _;e[4]===s?_=e[5]:(_=async function(e){try{let t=await s.mutateAsync({serverBindMode:e});Oe({networkAddresses:t.networkAddresses,serverBindMode:t.serverBindMode}),d(!0),Ae(!0)}catch(e){let t=e;throw Te.error(`Failed to update server bind mode:`,t),te({title:`Could not update network access`,description:t instanceof Error?t.message:`Could not update network access.`,variant:`destructive`}),t}},e[4]=s,e[5]=_);let v=_,y=g!==null&&p.serverBindMode!==g,b=y||l,x=p.serverBindMode===`network`&&(p.tunnelStatus===`starting`||p.tunnelStatus===`off`&&!b),S=Le(t);ze(t,p.isLoading,x,S);let C;return e[6]!==y||e[7]!==b||e[8]!==v||e[9]!==s.isPending||e[10]!==p.isLoading||e[11]!==p.networkAddresses||e[12]!==p.serverBindMode||e[13]!==p.tunnelError||e[14]!==p.tunnelStatus||e[15]!==p.tunnelUrl?(C={defaultServerBindMode:Ee,hasServerBindModeChanged:y,isLoading:p.isLoading,isSaving:s.isPending,needsRestart:b,networkAddresses:p.networkAddresses,serverBindMode:p.serverBindMode,tunnelError:p.tunnelError,tunnelStatus:p.tunnelStatus,tunnelUrl:p.tunnelUrl,updateServerBindMode:v},e[6]=y,e[7]=b,e[8]=v,e[9]=s.isPending,e[10]=p.isLoading,e[11]=p.networkAddresses,e[12]=p.serverBindMode,e[13]=p.tunnelError,e[14]=p.tunnelStatus,e[15]=p.tunnelUrl,e[16]=C):C=e[16],C}var $=r();function Ve({open:e,onOpenChange:t,onSave:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1);function l(){i(``),o(null),c(!1)}function u(e){e||l(),t(e)}async function f(){let e=r.trim();if(!e){o(`Enter a Tarsk public address.`);return}c(!0),o(null);try{await n(e),u(!1)}catch(e){let t=e instanceof Error?e.message:`Could not add that Remote Machine.`;o(t)}finally{c(!1)}}return(0,$.jsx)(M,{open:e,onOpenChange:u,children:(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[(0,$.jsxs)(k,{children:[(0,$.jsx)(j,{children:`Add Machine`}),(0,$.jsxs)(O,{children:[`Enter the public id or full address for another Tarsk on `,h,`.`,` `,K]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(R,{htmlFor:`remote-machine-address`,children:`Public address`}),(0,$.jsx)(X,{id:`remote-machine-address`,value:r,onChange:e=>{i(e.target.value),o(null)},placeholder:`rsawt2ud3n`,disabled:s,"aria-invalid":a!=null,className:`font-mono`}),a?(0,$.jsx)(`p`,{className:d.bodyMuted,children:a}):null]}),(0,$.jsxs)(D,{children:[(0,$.jsx)(F,{type:`button`,variant:`outline`,onClick:()=>u(!1),disabled:s,children:`Cancel`}),(0,$.jsx)(F,{type:`button`,onClick:()=>{f()},disabled:s,children:s?(0,$.jsx)(E,{className:`h-4 w-4 animate-spin`}):`Save`})]})]})})}var He=Object.defineProperty,Ue=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ke=(e,t,n)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qe=(e,t)=>{for(var n in t||={})We.call(t,n)&&Ke(e,n,t[n]);if(Ue)for(var n of Ue(t))Ge.call(t,n)&&Ke(e,n,t[n]);return e},Je=(e,t)=>{var n={};for(var r in e)We.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ue)for(var r of Ue(e))t.indexOf(r)<0&&Ge.call(e,r)&&(n[r]=e[r]);return n},Ye;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(!(a>>>15));for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(!(t>>>18));for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(!(n>>>8)),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return!!(e>>>t&1)}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i=0;for(;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Ye||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Ye||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Ye||={});var Xe=Ye,Ze={L:Xe.QrCode.Ecc.LOW,M:Xe.QrCode.Ecc.MEDIUM,Q:Xe.QrCode.Ecc.QUARTILE,H:Xe.QrCode.Ecc.HIGH},Qe=128,$e=`L`,et=`#FFFFFF`,tt=`#000000`,nt=!1,rt=1,it=4,at=0,ot=.1;function st(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ct(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function lt(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*ot),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ut(e,t){return t==null?e?it:at:Math.max(Math.floor(t),0)}function dt({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Q.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Xe.QrSegment.makeSegments(t)),e),[]);return Xe.QrCode.encodeSegments(r,Ze[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Q.useMemo(()=>{let e=c.getModules(),t=ut(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:lt(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var ft=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),pt=Q.forwardRef(function(e,t){let n=e,{value:r,size:i=Qe,level:a=$e,bgColor:o=et,fgColor:s=tt,includeMargin:c=nt,minVersion:l=rt,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Je(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Je(p,[`style`]),g=f?.src,_=Q.useRef(null),v=Q.useRef(null),y=Q.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Q.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=dt({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Q.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ct(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,ft?t.fill(new Path2D(st(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Q.useEffect(()=>{x(!1)},[g]);let E=qe({height:i,width:i},m),D=null;return g!=null&&(D=Q.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Q.createElement(Q.Fragment,null,Q.createElement(`canvas`,qe({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});pt.displayName=`QRCodeCanvas`;var mt=Q.forwardRef(function(e,t){let n=e,{value:r,size:i=Qe,level:a=$e,bgColor:o=et,fgColor:s=tt,includeMargin:c=nt,minVersion:l=rt,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Je(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=dt({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ct(g,v.excavation)),b=Q.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=st(y,h);return Q.createElement(`svg`,qe({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Q.createElement(`title`,null,d),Q.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Q.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});mt.displayName=`QRCodeSVG`;function ht(e){let t=(0,Z.c)(8),{inputId:n,value:r,disabled:i,onChange:a,onBlur:o}=e,s=n===void 0?`machine-name`:n,c;t[0]===a?c=t[1]:(c=e=>{a(e.target.value)},t[0]=a,t[1]=c);let l;return t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==c||t[6]!==r?(l=(0,$.jsx)(me,{title:`Machine name`,controlLayout:`row-end`,className:`mt-3`,action:(0,$.jsx)(X,{id:s,value:r,onChange:c,onBlur:o,disabled:i,"aria-label":`Machine name`,className:`w-64 font-mono`})}),t[2]=i,t[3]=s,t[4]=o,t[5]=c,t[6]=r,t[7]=l):l=t[7],l}function gt(e){let t=(0,Z.c)(15),{copied:n,label:r,onCopy:i}=e,a;t[0]===i?a=t[1]:(a=function(){i()},t[0]=i,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=n?(0,$.jsx)(w,{className:`h-3.5 w-3.5 text-brand`}):(0,$.jsx)(T,{className:`h-3.5 w-3.5`}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,$.jsx)(`span`,{className:`sr-only`,children:r}),t[4]=r,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:`inline-flex h-7 w-7 align-middle items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background`,children:[s,c]})}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=n?`Copied!`:`Copy to clipboard`,d;t[10]===u?d=t[11]:(d=(0,$.jsx)(ee,{children:u}),t[10]=u,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,$.jsxs)(L,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}function _t(e){let t=(0,Z.c)(18),{email:n,url:r,copied:i,onCopy:a}=e,o=n??`your account`,s;t[0]===o?s=t[1]:(s=(0,$.jsxs)(`p`,{className:d.bodyMuted,children:[`You can access this machine by signing in as `,o,` to:`]}),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`span`,{className:`${d.mono} break-all`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==i||t[5]!==a?(l=(0,$.jsx)(gt,{copied:i,label:`Copy public address`,onCopy:a}),t[4]=i,t[5]=a,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(`p`,{className:d.bodyMuted,children:[c,` `,l,` in a browser or in the Tarsk mobile app by scanning this QR Code`]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let f;t[10]!==s||t[11]!==u?(f=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=f):f=t[12];let p;t[13]===r?p=t[14]:(p=(0,$.jsx)(`div`,{className:`w-fit rounded-lg bg-background p-3`,children:(0,$.jsx)(mt,{value:r,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`})}),t[13]=r,t[14]=p);let m;return t[15]!==f||t[16]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,p]}),t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function vt(e){let t=(0,Z.c)(14),{accountEmail:n,bindMode:r,tunnelUrl:i,tunnelStatus:a,tunnelError:o,copiedTunnelUrl:s,onCopyTunnelUrl:c}=e,l=r===`network`,u=l&&!i&&a===`starting`,f=l&&a===`error`&&!!o,p;t[0]!==n||t[1]!==s||t[2]!==c||t[3]!==i?(p=i?(0,$.jsx)(_t,{email:n,url:i,copied:s,onCopy:c}):null,t[0]=n,t[1]=s,t[2]=c,t[3]=i,t[4]=p):p=t[4];let m;t[5]===u?m=t[6]:(m=u?(0,$.jsx)(`p`,{className:d.bodyMuted,children:`Starting a public address…`}):null,t[5]=u,t[6]=m);let h;t[7]!==f||t[8]!==o?(h=f?(0,$.jsx)(`p`,{className:d.bodyMuted,children:o}):null,t[7]=f,t[8]=o,t[9]=h):h=t[9];let g;return t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[p,m,h]}),t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13],g}function yt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`Log in before turning this on.`}),e[0]=t):t=e[0],t}function bt(e){let t=(0,Z.c)(2),{bindMode:n,tunnelUrl:r}=e,i=n===`network`&&!r?` The public address appears after restart.`:``,a;return t[0]===i?a=t[1]:(a=(0,$.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`You will need to restart for this setting to take effect.`,i]}),t[0]=i,t[1]=a),a}function xt(e){let t=(0,Z.c)(25),{accountEmail:n,bindMode:r,signedIn:i,isLoading:a,isSaving:o,needsRestart:s,tunnelUrl:c,tunnelStatus:l,tunnelError:u,copiedTunnelUrl:d,localMachineName:f,isLocalMachineNameLoading:p,isLocalMachineNameSaving:m,onCopyTunnelUrl:h,onLocalMachineNameChange:g,onLocalMachineNameBlur:_}=e,v=!!(c||l===`starting`||u),y=!i&&r!==`network`,b;t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==h||t[4]!==v||t[5]!==u||t[6]!==l||t[7]!==c?(b=v?(0,$.jsx)(vt,{accountEmail:n,bindMode:r,tunnelUrl:c,tunnelStatus:l,tunnelError:u,copiedTunnelUrl:d,onCopyTunnelUrl:h}):null,t[0]=n,t[1]=r,t[2]=d,t[3]=h,t[4]=v,t[5]=u,t[6]=l,t[7]=c,t[8]=b):b=t[8];let x;t[9]===y?x=t[10]:(x=y?(0,$.jsx)(yt,{}):null,t[9]=y,t[10]=x);let S;t[11]!==r||t[12]!==s||t[13]!==c?(S=s?(0,$.jsx)(bt,{bindMode:r,tunnelUrl:c}):null,t[11]=r,t[12]=s,t[13]=c,t[14]=S):S=t[14];let C=a||o||p||m,w;t[15]!==f||t[16]!==_||t[17]!==g||t[18]!==C?(w=(0,$.jsx)(ht,{inputId:`local-machine-name`,value:f,disabled:C,onChange:g,onBlur:_}),t[15]=f,t[16]=_,t[17]=g,t[18]=C,t[19]=w):w=t[19];let T;return t[20]!==b||t[21]!==x||t[22]!==S||t[23]!==w?(T=(0,$.jsxs)($.Fragment,{children:[b,x,S,w]}),t[20]=b,t[21]=x,t[22]=S,t[23]=w,t[24]=T):T=t[24],T}function St(e,t,n){switch(e){case`success`:return{title:`Signed in`,description:`This computer is now authorized to clone from ${n}.`};case`code`:return{title:`Check your email`,description:`We sent a 6-digit code to ${t}.`};default:return{title:`Sign in to Remote Machine`,description:`Sign in to ${n} to authorize remote cloning. Saving a bookmark does not grant access.`}}}function Ct(e){return e.step===`email`?e.busy?`Sending…`:`Next`:e.busy?`Verifying…`:`Sign in`}function wt({form:e}){if(e.step===`email`)return(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(R,{htmlFor:`remote-machine-email`,children:`Email`}),(0,$.jsx)(X,{id:`remote-machine-email`,type:`email`,autoComplete:`email`,required:!0,value:e.email,disabled:e.busy,onChange:function(t){e.setEmail(t.target.value)}})]});function t(t){t.preventDefault(),e.codeInputRef.current?.focus()}function n(e){return e.replace(/\\D/g,``)}function r(t){e.busy||e.setCode(t)}return(0,$.jsx)(`div`,{className:`flex justify-center py-2`,onMouseDown:t,children:(0,$.jsx)(se,{ref:e.codeInputRef,maxLength:6,pattern:pe,pasteTransformer:n,value:e.code,"aria-label":`Verification code`,"aria-invalid":!!e.error,onChange:r,children:(0,$.jsxs)(le,{children:[(0,$.jsx)(ge,{index:0}),(0,$.jsx)(ge,{index:1}),(0,$.jsx)(ge,{index:2}),(0,$.jsx)(ge,{index:3}),(0,$.jsx)(ge,{index:4}),(0,$.jsx)(ge,{index:5})]})})})}function Tt(e){let t=(0,Z.c)(22),{form:n}=e,r;t[0]!==n.busy||t[1]!==n.code||t[2]!==n.email||t[3]!==n.step?(r=n.busy||(n.step===`email`?!n.email.trim():n.code.length!==6),t[0]=n.busy,t[1]=n.code,t[2]=n.email,t[3]=n.step,t[4]=r):r=t[4];let i=r,a;t[5]!==n.busy||t[6]!==n.onClose?(a=(0,$.jsx)(F,{type:`button`,variant:`outline`,disabled:n.busy,onClick:n.onClose,children:`Cancel`}),t[5]=n.busy,t[6]=n.onClose,t[7]=a):a=t[7];let o;t[8]!==n.busy||t[9]!==n.onBack||t[10]!==n.step?(o=n.step===`code`&&(0,$.jsx)(F,{type:`button`,variant:`ghost`,disabled:n.busy,onClick:n.onBack,children:`Back`}),t[8]=n.busy,t[9]=n.onBack,t[10]=n.step,t[11]=o):o=t[11];let s=n.busy,c;t[12]===n?c=t[13]:(c=Ct(n),t[12]=n,t[13]=c);let l;t[14]!==n.busy||t[15]!==i||t[16]!==c?(l=(0,$.jsx)(F,{type:`submit`,disabled:i,"aria-busy":s,children:c}),t[14]=n.busy,t[15]=i,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==o||t[20]!==l?(u=(0,$.jsxs)(D,{children:[a,o,l]}),t[18]=a,t[19]=o,t[20]=l,t[21]=u):u=t[21],u}function Et(e){let t=(0,Z.c)(11),{form:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(wt,{form:n}),t[0]=n,t[1]=r);let i;t[2]===n.error?i=t[3]:(i=n.error?(0,$.jsx)(`p`,{className:C(d.body,`text-destructive`),role:`alert`,children:n.error.message}):null,t[2]=n.error,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,$.jsx)(Tt,{form:n}),t[4]=n,t[5]=a);let o;return t[6]!==n.onSubmit||t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`form`,{onSubmit:n.onSubmit,className:`grid gap-4 py-2`,children:[r,i,a]}),t[6]=n.onSubmit,t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function Dt(e){let t=(0,Z.c)(63),{machine:n,onClose:r}=e,[i,a]=(0,Q.useState)(`email`),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=`api/account/remote-machines/${encodeURIComponent(n.id)}`,m;t[0]===p?m=t[1]:(m=async function(e){if(!(await x(`${p}/request-code`,{email:e})).success)throw Error(`Could not send the verification code. Try again.`)},t[0]=p,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e,t){c(t),u(``),a(`code`)},t[2]=h):h=t[2];let g;t[3]===m?g=t[4]:(g={mutationFn:m,onSuccess:h},t[3]=m,t[4]=g);let _=o(g),v;t[5]!==l||t[6]!==s||t[7]!==p?(v=async function(){if(!(await x(`${p}/verify`,{email:s,code:l})).success)throw Error(`That code didn't work. Try again.`)},t[5]=l,t[6]=s,t[7]=p,t[8]=v):v=t[8];let y,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){u(``),a(`success`)},b=function(){u(``)},t[9]=y,t[10]=b):(y=t[9],b=t[10]);let S;t[11]===v?S=t[12]:(S={mutationFn:v,onSuccess:y,onError:b},t[11]=v,t[12]=S);let w=o(S),T=_.isPending||w.isPending,E=i===`email`?_.error:w.error,N,P;t[13]===i?(N=t[14],P=t[15]):(N=function(){if(i!==`code`)return;f.current?.focus();let e=requestAnimationFrame(function(){f.current?.focus()});return function(){cancelAnimationFrame(e)}},P=[i],t[13]=i,t[14]=N,t[15]=P),(0,Q.useEffect)(N,P);let I;t[16]!==T||t[17]!==l||t[18]!==s||t[19]!==_||t[20]!==i||t[21]!==w?(I=function(e){if(e.preventDefault(),!T){if(i===`email`){let e=s.trim().toLowerCase();e&&_.mutate(e)}else i===`code`&&l.length===6&&w.mutate()}},t[16]=T,t[17]=l,t[18]=s,t[19]=_,t[20]=i,t[21]=w,t[22]=I):I=t[22];let ee=I,L;t[23]!==_||t[24]!==w?(L=function(){a(`email`),u(``),_.reset(),w.reset()},t[23]=_,t[24]=w,t[25]=L):L=t[25];let R=L,te=i===`code`?`code`:`email`,z;t[26]!==R||t[27]!==T||t[28]!==l||t[29]!==s||t[30]!==E||t[31]!==ee||t[32]!==r||t[33]!==te?(z={step:te,email:s,code:l,busy:T,error:E,codeInputRef:f,setEmail:c,setCode:u,onSubmit:ee,onClose:r,onBack:R},t[26]=R,t[27]=T,t[28]=l,t[29]=s,t[30]=E,t[31]=ee,t[32]=r,t[33]=te,t[34]=z):z=t[34];let ne=z,B;t[35]!==s||t[36]!==n.machineName||t[37]!==i?(B=St(i,s,n.machineName),t[35]=s,t[36]=n.machineName,t[37]=i,t[38]=B):B=t[38];let V=B,H;t[39]!==T||t[40]!==r?(H=function(e){!e&&!T&&r()},t[39]=T,t[40]=r,t[41]=H):H=t[41];let U;t[42]===V.title?U=t[43]:(U=(0,$.jsx)(j,{children:V.title}),t[42]=V.title,t[43]=U);let W;t[44]===V.description?W=t[45]:(W=(0,$.jsx)(O,{children:V.description}),t[44]=V.description,t[45]=W);let G;t[46]!==U||t[47]!==W?(G=(0,$.jsxs)(k,{children:[U,W]}),t[46]=U,t[47]=W,t[48]=G):G=t[48];let K;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(K=C(d.compact,`break-all font-mono text-muted-foreground`),t[49]=K):K=t[49];let q;t[50]===n.publicUrl?q=t[51]:(q=(0,$.jsx)(`p`,{className:K,children:n.publicUrl}),t[50]=n.publicUrl,t[51]=q);let re;t[52]!==ne||t[53]!==r||t[54]!==i?(re=i===`success`?(0,$.jsx)(D,{children:(0,$.jsx)(F,{onClick:r,children:`Done`})}):(0,$.jsx)(Et,{form:ne}),t[52]=ne,t[53]=r,t[54]=i,t[55]=re):re=t[55];let J;t[56]!==G||t[57]!==q||t[58]!==re?(J=(0,$.jsxs)(A,{className:`max-w-md`,children:[G,q,re]}),t[56]=G,t[57]=q,t[58]=re,t[59]=J):J=t[59];let Y;return t[60]!==H||t[61]!==J?(Y=(0,$.jsx)(M,{open:!0,onOpenChange:H,children:J}),t[60]=H,t[61]=J,t[62]=Y):Y=t[62],Y}function Ot(e){let t=(0,Z.c)(13),{label:n,disabled:r,onClick:i,className:a,children:o}=e,s;t[0]===a?s=t[1]:(s=C(`shrink-0`,a),t[0]=a,t[1]=s);let c;t[2]!==o||t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==s?(c=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,size:`icon-sm`,className:s,onClick:i,disabled:r,"aria-label":n,children:o})}),t[2]=o,t[3]=r,t[4]=n,t[5]=i,t[6]=s,t[7]=c):c=t[7];let l;t[8]===n?l=t[9]:(l=(0,$.jsx)(ee,{children:n}),t[8]=n,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(L,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function kt(e){let t=(0,Z.c)(41),{machine:n,draftName:r,disabled:i,onDraftNameChange:a,onDraftNameBlur:o,onRemove:s,onSignIn:c}=e,[l,u]=(0,Q.useState)(!1),f=(0,Q.useRef)(null),p,m;t[0]===l?(p=t[1],m=t[2]):(p=()=>{l&&(f.current?.focus(),f.current?.select())},m=[l],t[0]=l,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h;t[3]===o?h=t[4]:(h=function(){o(),u(!1)},t[3]=o,t[4]=h);let g=h,_;t[5]!==n.machineName||t[6]!==a?(_=function(){a(n.machineName),u(!1)},t[5]=n.machineName,t[6]=a,t[7]=_):_=t[7];let v=_,b;t[8]===n.publicUrl?b=t[9]:(b=function(e){e.preventDefault(),y(n.publicUrl)},t[8]=n.publicUrl,t[9]=b);let x=b,S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Y,{className:`h-10 w-10 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[10]=S):S=t[10];let w;t[11]!==v||t[12]!==i||t[13]!==r||t[14]!==g||t[15]!==n.id||t[16]!==n.machineName||t[17]!==a||t[18]!==l?(w=(0,$.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:l?(0,$.jsx)(X,{ref:f,id:`remote-machine-name-${n.id}`,value:r,onChange:e=>{a(e.target.value)},onBlur:g,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.currentTarget.blur()),e.key===`Escape`&&(e.preventDefault(),v())},disabled:i,"aria-label":`Machine name`,className:`h-8 max-w-md`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:C(d.label,`min-w-0 truncate`),children:n.machineName}),(0,$.jsx)(Ot,{label:`Rename`,disabled:i,className:`pointer-events-none opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,onClick:()=>{u(!0)},children:(0,$.jsx)(ie,{className:`h-4 w-4`})})]})}),t[11]=v,t[12]=i,t[13]=r,t[14]=g,t[15]=n.id,t[16]=n.machineName,t[17]=a,t[18]=l,t[19]=w):w=t[19];let T=n.publicUrl,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=C(d.compact,`mt-1 block truncate font-mono text-muted-foreground hover:underline`),t[20]=E):E=t[20];let D;t[21]!==n.publicUrl||t[22]!==x?(D=(0,$.jsx)(`a`,{href:T,onClick:x,className:E,children:n.publicUrl}),t[21]=n.publicUrl,t[22]=x,t[23]=D):D=t[23];let O;t[24]!==D||t[25]!==w?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[24]=D,t[25]=w,t[26]=O):O=t[26];let k;t[27]!==i||t[28]!==c?(k=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`outline`,disabled:i,onClick:c,children:`Sign in`})}),t[27]=i,t[28]=c,t[29]=k):k=t[29];let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(ee,{children:`Authorize cloning from this Remote Machine`}),t[30]=A):A=t[30];let j;t[31]===k?j=t[32]:(j=(0,$.jsxs)(L,{children:[k,A]}),t[31]=k,t[32]=j);let M;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(P,{className:`h-4 w-4`}),t[33]=M):M=t[33];let N;t[34]!==i||t[35]!==s?(N=(0,$.jsx)(Ot,{label:`Remove`,disabled:i,onClick:s,children:M}),t[34]=i,t[35]=s,t[36]=N):N=t[36];let R;return t[37]!==O||t[38]!==j||t[39]!==N?(R=(0,$.jsxs)(`div`,{className:`group flex items-center gap-4 rounded-lg border border-border/60 bg-background/40 p-4`,children:[S,O,j,N]}),t[37]=O,t[38]=j,t[39]=N,t[40]=R):R=t[40],R}function At({remoteMachines:e,draftNames:t,isLoading:n,isSavingId:r,onDraftNameChange:i,onDraftNameBlur:a,onRemoveMachine:o}){let[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1);async function g(){if(l){h(!0),p(null);try{await o(l.id),u(null)}catch(e){p(e instanceof Error?e.message:`Could not remove that Remote Machine.`)}finally{h(!1)}}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:d.bodyMuted,children:K}),n?(0,$.jsx)(`p`,{className:d.bodyMuted,children:`Loading Remote Machines…`}):e.length===0?(0,$.jsx)(`p`,{className:d.bodyMuted,children:`No Remote Machines yet.`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>{let o=r(e.id);return(0,$.jsx)(kt,{machine:e,draftName:t[e.id]??e.machineName,disabled:n||o||m,onDraftNameChange:t=>{i(e.id,t)},onDraftNameBlur:()=>{a(e.id)},onSignIn:function(){c(e)},onRemove:()=>{p(null),u(e)}},e.id)})}),s?(0,$.jsx)(Dt,{machine:s,onClose:function(){c(null)}},s.id):null,(0,$.jsx)(G,{open:l!=null,onOpenChange:e=>{!e&&!m&&(u(null),p(null))},children:(0,$.jsxs)(B,{children:[(0,$.jsxs)(W,{children:[(0,$.jsx)(ne,{children:`Remove Remote Machine?`}),(0,$.jsx)(z,{children:l?`Remove ${l.machineName} from this list? This only deletes the bookmark on this computer.`:null})]}),f?(0,$.jsx)(`p`,{className:C(d.bodyMuted,`text-destructive`),children:f}):null,(0,$.jsxs)(H,{children:[(0,$.jsx)(U,{disabled:m,children:`Cancel`}),(0,$.jsx)(V,{disabled:m,onClick:e=>{e.preventDefault(),g()},children:`Remove`})]})]})})]})}function jt(){let e=(0,Z.c)(65),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(!1),{session:a,isLoading:o}=c(),{isLoading:s,isSaving:l,needsRestart:u,serverBindMode:d,tunnelError:f,tunnelStatus:p,tunnelUrl:m,updateServerBindMode:h}=Be(),{draftMachineName:g,isLoading:_,isSaving:v,setDraftMachineName:y,saveDraftMachineName:b}=be(),{addMachine:x,draftNames:S,isLoading:C,isSavingId:w,remoteMachines:T,removeMachine:E,saveDraftName:D,setDraftName:O}=we(),k;e[0]!==_||e[1]!==C||e[2]!==s?(k=[s,_,C],e[0]=_,e[1]=C,e[2]=s,e[3]=k):k=e[3];let A=ve(`remote-machines`,k),j;e[4]===m?j=e[5]:(j=async function(){if(m)try{await navigator.clipboard.writeText(m),i(!0),te({title:`Copied`,description:`Public address copied to clipboard.`}),window.setTimeout(function(){i(!1)},1500)}catch(e){let t=e;te({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the address.`,variant:`destructive`})}},e[4]=m,e[5]=j);let M=j,P=!o&&a!==null,R=d===`network`,z;e[6]===h?z=e[7]:(z=e=>{h(e?`network`:`local`)},e[6]=h,e[7]=z);let ne=s||l,B=!P,V;e[8]!==R||e[9]!==z||e[10]!==ne||e[11]!==B?(V=(0,$.jsx)(oe,{title:`Mobile & Network Access`,className:`[&>div:first-child]:py-2`,sticky:!1,action:(0,$.jsx)(re,{value:R,onChange:z,disabled:ne,disableOn:B,ariaLabel:`Mobile & Network Access`})}),e[8]=R,e[9]=z,e[10]=ne,e[11]=B,e[12]=V):V=e[12];let H=a?.email??null,U;e[13]===b?U=e[14]:(U=()=>{b()},e[13]=b,e[14]=U);let W;e[15]!==r||e[16]!==g||e[17]!==M||e[18]!==_||e[19]!==v||e[20]!==s||e[21]!==l||e[22]!==u||e[23]!==d||e[24]!==y||e[25]!==P||e[26]!==H||e[27]!==U||e[28]!==f||e[29]!==p||e[30]!==m?(W=(0,$.jsx)(_e,{className:`max-w-none pt-0`,children:(0,$.jsx)(ce,{children:(0,$.jsx)(xt,{accountEmail:H,bindMode:d,signedIn:P,isLoading:s,isSaving:l,needsRestart:u,tunnelUrl:m,tunnelStatus:p,tunnelError:f,copiedTunnelUrl:r,localMachineName:g,isLocalMachineNameLoading:_,isLocalMachineNameSaving:v,onCopyTunnelUrl:M,onLocalMachineNameChange:y,onLocalMachineNameBlur:U})})}),e[15]=r,e[16]=g,e[17]=M,e[18]=_,e[19]=v,e[20]=s,e[21]=l,e[22]=u,e[23]=d,e[24]=y,e[25]=P,e[26]=H,e[27]=U,e[28]=f,e[29]=p,e[30]=m,e[31]=W):W=e[31];let G;e[32]!==V||e[33]!==W?(G=(0,$.jsxs)(ue,{className:`shrink-0`,children:[V,W]}),e[32]=V,e[33]=W,e[34]=G):G=e[34];let K;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>n(!0),e[35]=K):K=e[35];let q;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(N,{className:`h-4 w-4`}),e[36]=q):q=e[36];let J;e[37]===C?J=e[38]:(J=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:K,disabled:C,"aria-label":`Add Machine`,children:q})}),e[37]=C,e[38]=J);let Y;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(ee,{children:`Add Machine`}),e[39]=Y):Y=e[39];let ie;e[40]===J?ie=e[41]:(ie=(0,$.jsx)(oe,{title:`Remote Machines`,className:`[&>div:first-child]:py-2`,sticky:!1,action:(0,$.jsxs)(L,{children:[J,Y]})}),e[40]=J,e[41]=ie);let ae;e[42]!==S||e[43]!==C||e[44]!==w||e[45]!==T||e[46]!==E||e[47]!==D||e[48]!==O?(ae=(0,$.jsx)(_e,{className:`max-w-none pt-0`,children:(0,$.jsx)(ce,{children:(0,$.jsx)(At,{remoteMachines:T,draftNames:S,isLoading:C,isSavingId:w,onDraftNameChange:O,onDraftNameBlur:D,onRemoveMachine:E})})}),e[42]=S,e[43]=C,e[44]=w,e[45]=T,e[46]=E,e[47]=D,e[48]=O,e[49]=ae):ae=e[49];let se;e[50]!==ie||e[51]!==ae?(se=(0,$.jsxs)(ue,{className:`shrink-0 pt-6`,children:[ie,ae]}),e[50]=ie,e[51]=ae,e[52]=se):se=e[52];let le;e[53]!==G||e[54]!==se?(le=(0,$.jsxs)(`div`,{className:`divide-y divide-table-border [&>*]:rounded-none`,children:[G,se]}),e[53]=G,e[54]=se,e[55]=le):le=e[55];let X;e[56]===x?X=e[57]:(X=async function(e){await x(e)},e[56]=x,e[57]=X);let de;e[58]!==t||e[59]!==X?(de=(0,$.jsx)(Ve,{open:t,onOpenChange:n,onSave:X}),e[58]=t,e[59]=X,e[60]=de):de=e[60];let pe;return e[61]!==A||e[62]!==le||e[63]!==de?(pe=(0,$.jsxs)(fe,{loading:A,children:[le,de]}),e[61]=A,e[62]=le,e[63]=de,e[64]=pe):pe=e[64],pe}export{jt as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-coding-view-B2FpHeiO.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-vendor-D61Uve5n.js","assets/chunk-QFMPRPBF-Cy-_pFSM.js","assets/dist-v_MvKS2-.js","assets/store-W78TGOIO.js","assets/utils-CqsIXqSC.js","assets/api-Cp9I7CxD.js","assets/loader-circle-CrqRIqdA.js","assets/createLucideIcon-2A3hmV_e.js","assets/button-DDaJhJP1.js","assets/tooltip-CqwCZ7wt.js","assets/dist-AbkJBHH5.js","assets/dist-2xH_pFmV.js","assets/use-toast-CKgZ8YeP.js","assets/progress-indicator-hJ74ac5W.js","assets/index-CcAwxnT5.js","assets/useBaseQuery-yghQO052.js","assets/QueryClientProvider-CYXTUmYo.js","assets/useInfiniteQuery-BpKy1sCq.js","assets/use-account-settings-query-D_qL1I4w.js","assets/useQuery-DWt09r77.js","assets/query-keys-CcnonAAG.js","assets/chat-handlers-context-DYU2LQ5V.js","assets/create-project-workspace-CJ94yHAB.js","assets/terminal-output-activity-D_FxlE-L.js","assets/task-utils-Cnq9Eszt.js","assets/suspense-resource-DzlMlIgR.js","assets/random-uuid-Dc3UrwVo.js","assets/remote-media-url-C-GdJb-D.js","assets/use-open-chat-dock-panel-CXzpgxVs.js","assets/chat-dock-context-DbiJNr3O.js","assets/explorer-tab-context-BwR8CM8l.js","assets/main-tab-context-Dsp4OYi9.js","assets/dist-CgbWuuq4.js","assets/markdown-renderer-DQONI6WG.js","assets/explorer-media-CRzhs0NW.js","assets/check-skFQ1X72.js","assets/copy-bi9iX3xn.js","assets/download-CWhQNGlF.js","assets/external-link-Dcikmdm_.js","assets/minus-CgQcbBQT.js","assets/dialog-D_12AsZd.js","assets/x-ByOPrz5I.js","assets/dist-DfnQ9YJh.js","assets/es2015-eNVkKfFF.js","assets/use-browser-overlay-block-CO1pUEAZ.js","assets/play-Dn1mbRpD.js","assets/plus-DoMzejDu.js","assets/rotate-ccw-Dthg8Pv6.js","assets/chevron-down-Bpo4ncEN.js","assets/chevron-right-Dga3q1bZ.js","assets/chevron-up-BxgjX7B3.js","assets/circle-alert-CC2eO3yt.js","assets/circle-DQwOli2u.js","assets/grip-vertical-_jCIw8Mw.js","assets/square-CtxvwmM2.js","assets/dist-B-h6Wj39.js","assets/label-BCs5CZEs.js","assets/dist-Dx8OsX8-.js","assets/dist-pCVg1Jdl.js","assets/dist-DOz2WXwX.js","assets/dist-JGbQ_EJY.js","assets/scroll-area-DGF9wUqQ.js","assets/alert-dialog-BcZULJsX.js","assets/use-projects-B0xTjTaA.js","assets/use-suspense-resource-uCX26gOk.js","assets/explorer-file-drop-DAP7ha-E.js","assets/api-8Rp2LlXt.js","assets/dist-CkGJjZXY.js","assets/select-DMcNYwgt.js","assets/mcp-manager-D2FG-h2e.js","assets/index-dNrgKdYv.css","assets/commit-method-fields-Xt3vbwUg.js","assets/toggle-group-CPmseZfb.js","assets/use-settings-page-loading-B5WU5d1c.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,r,t as i}from"./react-vendor-D61Uve5n.js";import{o as a,s as o}from"./chunk-QFMPRPBF-Cy-_pFSM.js";import"./dist-v_MvKS2-.js";import{Z as s,n as c,r as l}from"./store-W78TGOIO.js";import{t as u}from"./progress-indicator-hJ74ac5W.js";import{M as d,at as f,gt as p,pt as m}from"./index-CcAwxnT5.js";import{t as h}from"./settings-tab-bar-CdIbQ0WI.js";var g=[{value:`setup`,label:`Setup`},{value:`commands`,label:`Commands`}];function _(e){let t=e.replace(/\/+$/,``);return/^\/settings\/project\/[^/]+\/coding$/.test(t)?`setup`:/^\/settings\/project\/[^/]+\/coding\/commands$/.test(t)?`commands`:null}var v=e(n(),1),y=t(),b=i();function x(e){let t=(0,y.c)(9),{projectId:n}=e,r=c(),i;t[0]===n?i=t[1]:(i=function(e){return e.projects.find(e=>e.projectId===n)?.commands??[]},t[0]=n,t[1]=i);let a=l(i),o;t[2]===r?o=t[3]:(o=function(){r({type:s.ConfigUpdated})},t[2]=r,t[3]=o);let u=o,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,b.jsx)(f,{title:`Project Commands`,description:`Create and manage reusable commands for this project.`}),t[4]=h):h=t[4];let g;return t[5]!==a||t[6]!==u||t[7]!==n?(g=(0,b.jsx)(p,{className:`shrink-0`,children:(0,b.jsxs)(m,{children:[h,(0,b.jsx)(d,{embedded:!0,open:!0,projectId:n,commands:a,onRefresh:u})]})}),t[5]=a,t[6]=u,t[7]=n,t[8]=g):g=t[8],g}var S=(0,v.lazy)(function(){return r(()=>import(`./project-coding-view-B2FpHeiO.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75]))});function C(e){let t=(0,y.c)(22),{projectId:n,onProjectUpdated:r}=e,i=a(),s=o(),c;t[0]===i.pathname?c=t[1]:(c=_(i.pathname)??`setup`,t[0]=i.pathname,t[1]=c);let l=c,d;t[2]!==s||t[3]!==n?(d=function(e){s(e===`setup`?`/settings/project/${n}/coding`:`/settings/project/${n}/coding/${e}`)},t[2]=s,t[3]=n,t[4]=d):d=t[4];let f=d,p;t[5]!==l||t[6]!==f?(p=(0,b.jsx)(h,{value:l,onValueChange:f,options:g}),t[5]=l,t[6]=f,t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,b.jsx)(u,{centered:!0,label:`Loading project setup...`}),t[8]=m):m=t[8];let C;t[9]!==l||t[10]!==r||t[11]!==n?(C=l===`setup`&&(0,b.jsx)(S,{projectId:n,onProjectUpdated:r}),t[9]=l,t[10]=r,t[11]=n,t[12]=C):C=t[12];let w;t[13]!==l||t[14]!==n?(w=l===`commands`&&(0,b.jsx)(x,{projectId:n}),t[13]=l,t[14]=n,t[15]=w):w=t[15];let T;t[16]!==C||t[17]!==w?(T=(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,role:`region`,"aria-label":`Project setup`,children:(0,b.jsxs)(v.Suspense,{fallback:m,children:[C,w]})}),t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;return t[19]!==p||t[20]!==T?(E=(0,b.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[p,T]}),t[19]=p,t[20]=T,t[21]=E):E=t[21],E}export{C as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{U as i}from"./dist-v_MvKS2-.js";import{r as a,rt as o}from"./store-W78TGOIO.js";import{Bi as s,Ci as c,Cr as l,Er as u,Hn as d,In as f,Ni as p,O as m,Or as h,Tr as g,Ui as _,Wn as v,_r as y,kr as b,la as x,oa as S,on as C,vr as w,wi as T,wr as E,xr as D,yr as O}from"./api-Cp9I7CxD.js";import{t as k}from"./markdown-renderer-DQONI6WG.js";import{p as A,t as j}from"./utils-CqsIXqSC.js";import{t as M}from"./chevron-down-Bpo4ncEN.js";import{t as ee}from"./download-CWhQNGlF.js";import{t as N}from"./external-link-Dcikmdm_.js";import{t as P}from"./loader-circle-CrqRIqdA.js";import{a as F,i as I,o as L,r as R,s as te,t as z}from"./dialog-D_12AsZd.js";import{t as ne}from"./plus-DoMzejDu.js";import{t as B}from"./button-DDaJhJP1.js";import{i as V,n as H,r as U,t as W}from"./tooltip-CqwCZ7wt.js";import{t as G}from"./label-BCs5CZEs.js";import{t as K}from"./use-toast-CKgZ8YeP.js";import{t as re}from"./progress-indicator-hJ74ac5W.js";import{a as ie,c as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./alert-dialog-BcZULJsX.js";import{a as fe,n as pe,o as me,r as he,t as ge}from"./select-DMcNYwgt.js";import{Un as _e,Ut as ve,Vn as ye,Wn as be,at as q,ft as xe,gn as J,gt as Se,hn as Ce,ht as we,i as Te,in as Y,it as Ee,lt as De,nt as Oe,on as ke,pt as Ae,rn as je,rr as Me,tn as Ne,tt as Pe,un as Fe,ur as Ie,vn as Le}from"./index-CcAwxnT5.js";import{t as Re}from"./delete-confirm-dialog-D1N86piR.js";import{t as ze}from"./use-settings-page-loading-B5WU5d1c.js";import{a as Be,o as Ve,r as He}from"./settings-list-Co3JPr9w.js";import{t as Ue}from"./use-deferred-search-xgS_2fMW.js";import{i as We,n as Ge,r as Ke,t as qe}from"./slug-utils-CO6nui1C.js";import{i as Je,n as Ye,r as Xe,t as Ze}from"./use-installed-ai-files-Nn-sN_V2.js";var Qe=`custom-`;function $e(e){return e.startsWith(Qe)}var X=t(),Z=e(n(),1),Q=r();function et({threadId:e,onSkillCreated:t}){let[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),l=Ke(n),u=Ge(l),d=async()=>{if(u&&a.trim()&&e){c(!0);try{let n=await m(e,l,a.trim());K({title:`Skill created`,description:`Skill '${l}' was created successfully.`}),r(``),o(``),t?.(n.path,`SKILL.md`)}catch(e){K({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{c(!1)}}};return e?(0,Q.jsx)(we,{children:(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(q,{title:`Add Skill`,description:`Saved as SKILL.md in .agents/skills.`,sticky:!0,className:`pr-10`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(Oe,{title:`Skill Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,Q.jsx)(J,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:s}),n?(0,Q.jsxs)(`p`,{className:j(i.caption,`mt-2`),children:[`Folder name: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:l||`...`})]}):null]}),(0,Q.jsx)(Oe,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsx)(Ce,{id:`skillDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:s})}),(0,Q.jsx)(We,{onContinue:()=>void d(),disabled:!u||!a.trim(),creating:s})]})]})}):(0,Q.jsx)(xe,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}var tt=`.agents/skills`;function nt(e){return`${tt}/${e}`}function rt(e){return`${nt(e)}/SKILL.md`}function it(e,t){let n=t.trim();if(!n)return e;let r=n.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(r)||e.description.toLowerCase().includes(r))}function at(e){let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];return e.allowedTools&&t.push(`allowed-tools: ${e.allowedTools}`),e.license&&t.push(`license: ${e.license}`),t.push(`---`,``,e.instructions??``),t.join(`
|
|
2
|
+
`)}function ot(e,t,n){return it(e,t).filter(e=>!n.has(rt(e.id)))}function st(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function ct(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function lt(e,t){let n=e?.sourceId??t;if(n&&n!=="default")return n}function ut(e,t,n){let[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),h=lt(t,n),g=!!h;return(0,Z.useEffect)(()=>{if(!e||!t)return;let r=t,a=lt(r,n),s=!1;async function l(){u(!0),m(null),i([]),o(null),c(``);try{if(a){let e=await O(a,r.id);if(s)return;i(e.files),o(ct(e.files))}else{if(s)return;i([`SKILL.md`]),o(`SKILL.md`),c(at(r))}}catch(e){if(s)return;m(e instanceof Error?e.message:`Failed to load skill files`)}finally{s||u(!1)}}return l(),()=>{s=!0}},[e,t,n]),(0,Z.useEffect)(()=>{if(!e||!t||!a||!g||!h)return;let n=t,r=a,i=!1;async function o(){f(!0),m(null);try{let e=await w(h,n.id,r);if(i)return;c(e.content)}catch(e){if(i)return;m(e instanceof Error?e.message:`Failed to load file`),c(``)}finally{i||f(!1)}}return o(),()=>{i=!0}},[e,t,a,g,h]),{files:r,selectedFile:a,setSelectedFile:o,fileContent:s,loadingFiles:l,contentLoading:l||g&&d,loadError:p,isCatalogSkill:g,effectiveSourceId:h}}function dt({open:e,onOpenChange:t,skill:n,catalogSourceId:r,onInstall:a}){let[o,s]=(0,Z.useState)(!1),{files:c,selectedFile:l,setSelectedFile:u,fileContent:d,loadingFiles:f,contentLoading:p,loadError:m,effectiveSourceId:h}=ut(e,n,r),g=(0,Z.useCallback)(async()=>{if(!n)return;let e=h?{...n,sourceId:h}:n;s(!0);try{await a(e),t(!1)}finally{s(!1)}},[n,h,a,t]),_=l?st(l):!1,v=(0,Z.useMemo)(()=>c.map(e=>(0,Q.jsxs)(ve,{selected:e===l,onClick:()=>u(e),className:`gap-2 cursor-pointer`,children:[(0,Q.jsx)(Ie,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:j(i.caption,`truncate`),children:e})]},e)),[c,l]);return(0,Q.jsx)(z,{open:e,onOpenChange:t,children:(0,Q.jsxs)(R,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,Q.jsxs)(L,{className:`border-b border-border px-6 py-4`,children:[(0,Q.jsx)(te,{children:n?.name??`Review skill`}),n?.description?(0,Q.jsx)(I,{children:n.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,Q.jsx)(`div`,{className:j(i.labelMuted,`px-3 py-2`),children:`Files`}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:f?(0,Q.jsx)(re,{centered:!0,containerClassName:`py-8`,label:`Loading files...`}):c.length===0?(0,Q.jsx)(`p`,{className:j(i.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):v})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:m?(0,Q.jsx)(`p`,{className:j(i.body,`text-destructive`),children:m}):p?(0,Q.jsx)(re,{centered:!0,containerClassName:`py-12`,label:`Loading preview...`}):_?(0,Q.jsx)(k,{content:d,enableMermaid:!1}):(0,Q.jsx)(`pre`,{className:j(i.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:d})})]}),(0,Q.jsxs)(F,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,Q.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(B,{type:`button`,onClick:()=>void g(),disabled:o||!n,children:o?`Installing...`:`Install`})]})]})})}function ft({open:e,onOpenChange:t,editingSource:n,onSourceAdded:r,onSourceUpdated:a,onSourceDeleted:o}){let[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),[v,x]=(0,Z.useState)(!1),S=n!=null;function C(){c(``),u(``),f(null),m(!1),_(!1),x(!1)}function w(e){e||C(),t(e)}(0,Z.useEffect)(()=>{if(e){if(n){c(n.title),u(n.url),f(null);return}c(``),u(``),f(null)}},[e,n]);async function T(){let e=s.trim(),t=l.trim();if(!e||!t){f(`Title and URL are required.`);return}m(!0),f(null);try{if(S&&n){let r=await h(n.id,e,t);a?.(r.source)}else r((await b(e,t)).source);w(!1)}catch(e){f(e instanceof Error?e.message:`Failed to verify skill source`)}finally{m(!1)}}async function E(){if(n){_(!0),f(null);try{await y(n.id),o?.(n.id),x(!1),w(!1)}catch(e){f(e instanceof Error?e.message:`Failed to delete skill source`),x(!1)}finally{_(!1)}}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{open:e,onOpenChange:w,children:(0,Q.jsxs)(R,{className:`sm:max-w-lg`,children:[(0,Q.jsxs)(L,{children:[(0,Q.jsx)(te,{children:S?`Edit Skill Source`:`Add Skill Source`}),(0,Q.jsx)(I,{children:S?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(G,{htmlFor:`skill-source-title`,children:`Title`}),(0,Q.jsx)(J,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:s,onChange:e=>c(e.target.value),disabled:p||g,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(G,{htmlFor:`skill-source-url`,children:`URL`}),(0,Q.jsx)(J,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:l,onChange:e=>u(e.target.value),disabled:p||g})]}),d?(0,Q.jsx)(`p`,{className:j(i.caption,`text-destructive`),children:d}):null]}),(0,Q.jsxs)(F,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[S?(0,Q.jsx)(B,{type:`button`,variant:`destructive`,onClick:()=>x(!0),disabled:p||g,children:`Delete`}):(0,Q.jsx)(`div`,{className:`hidden sm:block`}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,Q.jsx)(B,{variant:`outline`,onClick:()=>w(!1),disabled:p||g,children:`Cancel`}),(0,Q.jsx)(B,{onClick:()=>void T(),disabled:p||g||!s.trim()||!l.trim(),children:p?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):S?`Save Changes`:`Add Source`})]})]})]})}),(0,Q.jsx)(de,{open:v,onOpenChange:x,children:(0,Q.jsxs)(oe,{children:[(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(ae,{children:`Delete Skill Source`}),(0,Q.jsxs)(ie,{children:[`Are you sure you want to delete "`,n?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(le,{disabled:g,children:`Cancel`}),(0,Q.jsx)(se,{onClick:()=>void E(),disabled:g,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:g?`Deleting...`:`Delete`})]})]})})]})}function pt(e){let t=e.trim();if(!t)return null;if(/^https?:\/\//i.test(t))try{return new URL(t),t}catch{return null}if(t.startsWith(`tarsk://`))try{let e=new URL(`https://tarsk.invalid/${t.slice(8)}`);if(e.pathname===`/skill-install`&&e.searchParams.get(`url`))return e.searchParams.get(`url`)}catch{return null}return null}function mt(e){let t=(0,X.c)(40),{open:n,onOpenChange:r,onSubmit:a}=e,[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(){s(``),l(null)},t[0]=u):u=t[0];let d=u,f;t[1]===r?f=t[2]:(f=function(e){e||d(),r(e)},t[1]=r,t[2]=f);let p=f,m,h;t[3]===n?(m=t[4],h=t[5]):(m=()=>{n&&d()},h=[n],t[3]=n,t[4]=m,t[5]=h),(0,Z.useEffect)(m,h);let g;t[6]!==p||t[7]!==a||t[8]!==o?(g=function(){let e=pt(o);if(!e){l(`Enter a valid http(s) URL for the plugin archive or paste a tarsk:// install link.`);return}a(e),p(!1)},t[6]=p,t[7]=a,t[8]=o,t[9]=g):g=t[9];let _=g,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsxs)(L,{children:[(0,Q.jsx)(te,{children:`Add Skill via URL`}),(0,Q.jsx)(I,{children:`Paste the URL of a plugin archive. Its skills and MCP servers are installed into this project.`})]}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(G,{htmlFor:`add-skill-url`,children:`URL`}),t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>s(e.target.value),t[12]=b):b=t[12];let x;t[13]===_?x=t[14]:(x=e=>{e.key===`Enter`&&(e.preventDefault(),_())},t[13]=_,t[14]=x);let S;t[15]!==x||t[16]!==o?(S=(0,Q.jsx)(J,{id:`add-skill-url`,placeholder:`https://example.com/my-plugin.zip`,value:o,onChange:b,autoFocus:!0,onKeyDown:x}),t[15]=x,t[16]=o,t[17]=S):S=t[17];let C;t[18]===c?C=t[19]:(C=c?(0,Q.jsx)(`p`,{className:j(i.caption,`text-destructive`),children:c}):null,t[18]=c,t[19]=C);let w;t[20]!==S||t[21]!==C?(w=(0,Q.jsx)(`div`,{className:`grid gap-4 py-2`,children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[y,S,C]})}),t[20]=S,t[21]=C,t[22]=w):w=t[22];let T;t[23]===p?T=t[24]:(T=(0,Q.jsx)(B,{variant:`outline`,onClick:()=>p(!1),children:`Cancel`}),t[23]=p,t[24]=T);let E;t[25]===o?E=t[26]:(E=o.trim(),t[25]=o,t[26]=E);let D=!E,O;t[27]!==_||t[28]!==D?(O=(0,Q.jsx)(B,{onClick:_,disabled:D,children:`Continue`}),t[27]=_,t[28]=D,t[29]=O):O=t[29];let k;t[30]!==T||t[31]!==O?(k=(0,Q.jsxs)(F,{children:[T,O]}),t[30]=T,t[31]=O,t[32]=k):k=t[32];let A;t[33]!==w||t[34]!==k?(A=(0,Q.jsxs)(R,{className:`sm:max-w-lg`,children:[v,w,k]}),t[33]=w,t[34]=k,t[35]=A):A=t[35];let M;return t[36]!==p||t[37]!==n||t[38]!==A?(M=(0,Q.jsx)(z,{open:n,onOpenChange:p,children:A}),t[36]=p,t[37]=n,t[38]=A,t[39]=M):M=t[39],M}function ht(e){let t=(0,X.c)(7),{items:n,onPreview:r}=e,a;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=e=>{let t=qe(e.name);return(0,Q.jsxs)(`div`,{className:`group flex min-h-13 items-center gap-3 px-3 py-2`,role:`button`,tabIndex:0,onClick:()=>r(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))},children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:j(i.label,`truncate`),children:t}),(0,Q.jsx)(`p`,{className:j(i.caption,`truncate`),children:e.description})]}),(0,Q.jsx)(U,{delayDuration:300,children:(0,Q.jsxs)(W,{children:[(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto`,"aria-label":`Install ${t}`,onClick:t=>{t.stopPropagation(),r(e)},children:(0,Q.jsx)(ee,{className:`h-4 w-4`})})}),(0,Q.jsx)(H,{children:`Install skill`})]})})]},e.id)},t[3]=r,t[4]=e),a=n.map(e),t[0]=n,t[1]=r,t[2]=a}else a=t[2];let o;return t[5]===a?o=t[6]:(o=(0,Q.jsx)(`div`,{className:`divide-y divide-table-border`,children:a}),t[5]=a,t[6]=o),o}function gt(e){let t=(0,X.c)(11),{searchQuery:n,isLoadingCatalog:r,isDefaultSource:i,availablePopular:a,availableCatalog:o,onPreviewPopular:s,onPreviewCatalog:c}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(re,{centered:!0,containerClassName:`py-12`,label:`Loading skills...`}),t[0]=e):e=t[0],e}if(i){if(a.length===0){let e;return t[1]===n?e=t[2]:(e=(0,Q.jsx)(Be,{searchQuery:n,emptyLabel:`No available skills found.`}),t[1]=n,t[2]=e),e}let e;return t[3]!==a||t[4]!==s?(e=(0,Q.jsx)(ht,{items:a,onPreview:s}),t[3]=a,t[4]=s,t[5]=e):e=t[5],e}if(o.length===0){let e;return t[6]===n?e=t[7]:(e=(0,Q.jsx)(Be,{searchQuery:n,emptyLabel:`No available skills found.`}),t[6]=n,t[7]=e),e}let l;return t[8]!==o||t[9]!==c?(l=(0,Q.jsx)(ht,{items:o,onPreview:c}),t[8]=o,t[9]=c,t[10]=l):l=t[10],l}function _t(e){return e?{ariaLabel:`Edit skill source`,tooltip:`Edit this custom skill source`,icon:_e}:{ariaLabel:`Add skill source`,tooltip:`Add a custom skill source`,icon:ne}}function vt(e){let t=(0,X.c)(42),{availableSearch:n,onSearchChange:r,selectedSourceId:i,onSourceChange:a,sources:o,selectedCustomSource:s,availableCatalogLoading:c,isDefaultSource:l,availablePopular:u,availableCatalog:d,onPreviewPopular:f,onPreviewCatalog:p,onAddSource:m}=e,h;t[0]===s?h=t[1]:(h=_t(s),t[0]=s,t[1]=h);let g=h,_=g.icon,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(U,{children:(0,Q.jsxs)(W,{children:[(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`cursor-help`,children:`Available Skills`})}),(0,Q.jsx)(H,{children:`Browse and install skills from the catalog.`})]})}),t[2]=v):v=t[2];let y;t[3]!==n||t[4]!==r?(y=(0,Q.jsx)(Ve,{placeholder:`Search`,value:n,onChange:r,className:`mb-0 w-64`}),t[3]=n,t[4]=r,t[5]=y):y=t[5];let b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(fe,{className:`w-40`,"aria-label":`Skill source`,children:(0,Q.jsx)(me,{placeholder:`Default`})}),t[6]=b):b=t[6];let x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(he,{value:`default`,children:`Default`}),t[7]=x):x=t[7];let S;t[8]===o?S=t[9]:(S=o.map(yt),t[8]=o,t[9]=S);let C;t[10]===S?C=t[11]:(C=(0,Q.jsxs)(pe,{children:[x,S]}),t[10]=S,t[11]=C);let w;t[12]!==a||t[13]!==i||t[14]!==C?(w=(0,Q.jsxs)(ge,{value:i,onValueChange:a,children:[b,C]}),t[12]=a,t[13]=i,t[14]=C,t[15]=w):w=t[15];let T;t[16]===_?T=t[17]:(T=(0,Q.jsx)(_,{className:`h-4 w-4`}),t[16]=_,t[17]=T);let E;t[18]!==m||t[19]!==g.ariaLabel||t[20]!==T?(E=(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsx)(B,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:m,"aria-label":g.ariaLabel,children:T})}),t[18]=m,t[19]=g.ariaLabel,t[20]=T,t[21]=E):E=t[21];let D;t[22]===g.tooltip?D=t[23]:(D=(0,Q.jsx)(H,{children:g.tooltip}),t[22]=g.tooltip,t[23]=D);let O;t[24]!==E||t[25]!==D?(O=(0,Q.jsx)(U,{children:(0,Q.jsxs)(W,{children:[E,D]})}),t[24]=E,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==O||t[28]!==y||t[29]!==w?(k=(0,Q.jsx)(q,{title:v,action:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,w,O]}),sticky:!1}),t[27]=O,t[28]=y,t[29]=w,t[30]=k):k=t[30];let A;t[31]!==d||t[32]!==c||t[33]!==u||t[34]!==n||t[35]!==l||t[36]!==p||t[37]!==f?(A=(0,Q.jsx)(Ae,{className:`pt-6`,children:(0,Q.jsx)(gt,{searchQuery:n,isLoadingCatalog:c,isDefaultSource:l,availablePopular:u,availableCatalog:d,onPreviewPopular:f,onPreviewCatalog:p})}),t[31]=d,t[32]=c,t[33]=u,t[34]=n,t[35]=l,t[36]=p,t[37]=f,t[38]=A):A=t[38];let j;return t[39]!==k||t[40]!==A?(j=(0,Q.jsxs)(Se,{className:`shrink-0`,children:[k,A]}),t[39]=k,t[40]=A,t[41]=j):j=t[41],j}function yt(e){return(0,Q.jsx)(he,{value:e.id,children:e.title},e.id)}var bt=`https://tarsk.io/skills/list/`;function xt(e){let t=(0,X.c)(20),{onSelectMode:n,manualDisabled:r}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Fe,{asChild:!0,children:(0,Q.jsxs)(B,{className:`gap-1`,children:[`Add Skill`,(0,Q.jsx)(M,{className:`h-4 w-4 opacity-70`})]})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=j(i.body,`gap-2`),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=()=>n(`manual`),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(be,{className:`h-4 w-4 shrink-0`}),t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==s?(l=(0,Q.jsxs)(Y,{className:o,disabled:r,onSelect:s,children:[c,`Manually Enter`]}),t[5]=r,t[6]=s,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=j(i.body,`gap-2`),t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=()=>n(`url`),t[9]=n,t[10]=d);let f;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Me,{className:`h-4 w-4 shrink-0`}),t[11]=f):f=t[11];let p;t[12]===d?p=t[13]:(p=(0,Q.jsxs)(Y,{className:u,onSelect:d,children:[f,`Via URL`]}),t[12]=d,t[13]=p);let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(ke,{}),t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=j(i.body,`gap-2`),t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsxs)(Y,{className:h,onSelect:St,children:[(0,Q.jsx)(N,{className:`h-4 w-4 shrink-0`}),`Marketplace`]}),t[16]=g):g=t[16];let _;return t[17]!==l||t[18]!==p?(_=(0,Q.jsxs)(Ne,{children:[a,(0,Q.jsxs)(je,{align:`end`,className:`w-44`,children:[l,p,m,g]})]}),t[17]=l,t[18]=p,t[19]=_):_=t[19],_}function St(){C(bt)}var Ct=`This skill uses no additional context as it is manually invoked`;function wt(e){return e.builtIn?`text-muted-foreground/50`:e.disableModelInvocation?`text-brand`:`text-foreground`}function Tt(e){return e.disableModelInvocation?Ct:`≈${o(e.description)} tokens of context`}function Et(e){let t=(0,X.c)(22),n,r,i,a,o,s;if(t[0]!==e){let{onClick:c,ariaLabel:l,...u}=e,d=(0,Q.jsx)(ye,{className:j(`h-4 w-4 shrink-0`,wt(u)),"aria-hidden":`true`});i=U,s=300,r=W,t[7]!==l||t[8]!==d||t[9]!==c?(o=(0,Q.jsx)(V,{asChild:!0,children:c?(0,Q.jsx)(`button`,{type:`button`,"aria-label":l,className:`shrink-0 cursor-pointer rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:e=>{e.stopPropagation(),c()},onKeyDown:Dt,children:d}):d}),t[7]=l,t[8]=d,t[9]=c,t[10]=o):o=t[10],n=H,a=Tt(u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6];let c;t[11]!==n||t[12]!==a?(c=(0,Q.jsx)(n,{children:a}),t[11]=n,t[12]=a,t[13]=c):c=t[13];let l;t[14]!==r||t[15]!==o||t[16]!==c?(l=(0,Q.jsxs)(r,{children:[o,c]}),t[14]=r,t[15]=o,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==i||t[19]!==s||t[20]!==l?(u=(0,Q.jsx)(i,{delayDuration:s,children:l}),t[18]=i,t[19]=s,t[20]=l,t[21]=u):u=t[21],u}function Dt(e){(e.key===`Enter`||e.key===` `)&&e.stopPropagation()}function Ot(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...Ot(n.children))}return t}function kt(e){return`${e.disableModelInvocation?`Enable`:`Disable`} model invocation for ${e.name}`}function At(e){return e?{title:`MCP server installed`,description:`Its MCP servers were added to this project.`}:{title:`Plugin installed`,description:`Its skills and MCP servers were added to this project.`}}function jt(e){return e?.disableModelInvocation?{title:`Enable model invocation?`,description:`"${e.name}" will be offered to the model automatically again, so its description counts towards the context window.`,actionLabel:`Enable`,nextDisableModelInvocation:!1}:{title:`Disable model invocation?`,description:`"${e?.name}" will no longer be offered to the model automatically, so its description stops counting towards the context window. Invoke it manually with /${e?.name}.`,actionLabel:`Disable`,nextDisableModelInvocation:!0}}function Mt(e){let t=(0,X.c)(24),{skills:n,threadId:r,onOpenSkill:a,onDelete:o,onAddManual:s,onAddUrl:c,onChangeModelInvocation:l}=e,u=!r,d;t[0]!==s||t[1]!==c?(d=e=>{e===`manual`?s():c()},t[0]=s,t[1]=c,t[2]=d):d=t[2];let f;t[3]!==u||t[4]!==d?(f=(0,Q.jsx)(q,{title:`Installed Skills`,description:`Reusable instruction sets that guide agent behavior in this project.`,action:(0,Q.jsx)(xt,{manualDisabled:u,onSelectMode:d}),sticky:!1}),t[3]=u,t[4]=d,t[5]=f):f=t[5];let p;t[6]===r?p=t[7]:(p=!r&&(0,Q.jsx)(Ee,{children:`Select a thread to add or install skills.`}),t[6]=r,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m={icon:Le,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`},t[8]=m):m=t[8];let h;t[9]===l?h=t[10]:(h=e=>(0,Q.jsxs)(`span`,{className:j(i.body,`flex min-w-0 items-center gap-2 text-left`),children:[(0,Q.jsx)(Et,{description:e.description,disableModelInvocation:e.disableModelInvocation,builtIn:e.virtual,onClick:e.virtual?void 0:()=>l(e),ariaLabel:kt(e)}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]}),t[9]=l,t[10]=h);let g;t[11]===a?g=t[12]:(g=e=>a(e.path),t[11]=a,t[12]=g);let _;t[13]!==o||t[14]!==n||t[15]!==h||t[16]!==g?(_=(0,Q.jsx)(He,{showHeader:!1,compact:!0,loading:!1,items:n,emptyState:m,getKey:Ft,renderContent:h,onItemClick:g,itemClickLabel:Pt,onDelete:o,deleteAriaLabel:Nt,deleteTooltip:`Remove this skill from the project`}),t[13]=o,t[14]=n,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==p||t[19]!==_?(v=(0,Q.jsxs)(Ae,{className:`pt-6`,children:[p,_]}),t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==f||t[22]!==v?(y=(0,Q.jsxs)(Se,{className:`shrink-0`,children:[f,v]}),t[21]=f,t[22]=v,t[23]=y):y=t[23],y}function Nt(e){return`Delete ${e.name}`}function Pt(e){return`Open ${e.name} in Files`}function Ft(e){return e.id}function It(e){let t=(0,X.c)(24),{open:n,onOpenChange:r,skill:i,onConfirm:a}=e,o;t[0]===i?o=t[1]:(o=jt(i),t[0]=i,t[1]=o);let s=o,c;t[2]===s.title?c=t[3]:(c=(0,Q.jsx)(ae,{children:s.title}),t[2]=s.title,t[3]=c);let l;t[4]===s.description?l=t[5]:(l=(0,Q.jsx)(ie,{children:s.description}),t[4]=s.description,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(ue,{children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(le,{children:`Cancel`}),t[9]=d):d=t[9];let f;t[10]!==s.nextDisableModelInvocation||t[11]!==a||t[12]!==i?(f=()=>{i&&a(i,s.nextDisableModelInvocation)},t[10]=s.nextDisableModelInvocation,t[11]=a,t[12]=i,t[13]=f):f=t[13];let p;t[14]!==s.actionLabel||t[15]!==f?(p=(0,Q.jsxs)(ce,{children:[d,(0,Q.jsx)(se,{onClick:f,children:s.actionLabel})]}),t[14]=s.actionLabel,t[15]=f,t[16]=p):p=t[16];let m;t[17]!==u||t[18]!==p?(m=(0,Q.jsxs)(oe,{children:[u,p]}),t[17]=u,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==r||t[21]!==n||t[22]!==m?(h=(0,Q.jsx)(de,{open:n,onOpenChange:r,children:m}),t[20]=r,t[21]=n,t[22]=m,t[23]=h):h=t[23],h}function Lt(){let e=(0,X.c)(10),[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(!1),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e){f(e),m(!0)},e[0]=h):h=e[0];let g=h,_;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){e||u(null)},e[1]=_):_=e[1];let v=_,y;return e[2]!==d||e[3]!==s||e[4]!==l||e[5]!==t||e[6]!==a||e[7]!==p||e[8]!==r?(y={showAddDialog:t,setShowAddDialog:n,showUrlDialog:r,setShowUrlDialog:i,showAddSourceDialog:a,setShowAddSourceDialog:o,pluginImportUrl:s,setPluginImportUrl:c,previewSkill:l,setPreviewSkill:u,invocationSkill:d,showInvocationDialog:p,setShowInvocationDialog:m,openInvocationDialog:g,handlePreviewDialogOpenChange:v},e[2]=d,e[3]=s,e[4]=l,e[5]=t,e[6]=a,e[7]=p,e[8]=r,e[9]=y):y=e[9],y}var Rt=`skills:popular`;function zt(e){return e.map(e=>`${e.id}~${e.name}~${e.description}`).join(`|`)}function Bt(){let e=(0,X.c)(5),[t,n]=(0,Z.useState)(Ut),[r,i]=(0,Z.useState)(Ht),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{D().then(e=>{Je(Rt,e),n(t=>zt(t)===zt(e)?t:e)}).catch(Vt).finally(()=>i(!1))},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Z.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={popularSkills:t,loadingPopularSkills:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Vt(){}function Ht(){return!Ye(Rt)}function Ut(){return Xe(Rt)??[]}var $=new Map;function Wt(e){let t=$.get(e);if(t)return t;let n=l(e).finally(()=>{$.delete(e)});return $.set(e,n),n}function Gt(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function Kt(){let e=(0,X.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Z.useState)(t),[i,a]=(0,Z.useState)(s),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[1]=o):o=e[1];let[l,u]=(0,Z.useState)(o),[d,f]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),v;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=async()=>{try{let e=await E();r(e)}catch{r([])}},e[2]=v):v=e[2];let y=v,b,C;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{(async function(){let e=p();if(e.length>0)try{await g(e),c()}catch{}await y()})()},C=[y],e[3]=b,e[4]=C):(b=e[3],C=e[4]),(0,Z.useEffect)(b,C);let w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{a(e),S(e)},e[5]=w):w=e[5];let D=w,O;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(Jt)),D(e.id)},e[6]=O):O=e[6];let k=O,A;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(qt)),T(e.id)},e[7]=A):A=e[7];let j=A,M;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{r(t=>t.filter(t=>t.id!==e)),T(e),a(t=>t===e?(S(`default`),`default`):t)},e[8]=M):M=e[8];let ee=M,N,P;e[9]===i?(N=e[10],P=e[11]):(P=()=>{if(i==="default"){u([]),f(!1),h(!1);return}let e=_(i);e?.skills?(u(Gt(i,e.skills)),f(!1)):(u([]),f(!0));let t=!1;return h(!!e?.skills),Wt(i).then(e=>{if(t)return;let n=Gt(i,e);u(n),x(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||u([]),K({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(f(!1),h(!1))}),()=>{t=!0}},N=[i],e[9]=i,e[10]=N,e[11]=P),(0,Z.useEffect)(P,N);let F;return e[12]!==l||e[13]!==d||e[14]!==m||e[15]!==i||e[16]!==n?(F={sources:n,selectedSourceId:i,setSelectedSourceId:D,addSource:k,updateSource:j,removeSource:ee,reloadSources:y,catalogSkills:l,isLoadingCatalog:d,isRefreshingCatalog:m},e[12]=l,e[13]=d,e[14]=m,e[15]=i,e[16]=n,e[17]=F):F=e[17],F}function qt(e,t){return e.title.localeCompare(t.title)}function Jt(e,t){return e.title.localeCompare(t.title)}function Yt(e){let t=(0,X.c)(26),{popularSkills:n,loadingPopularSkills:r}=Bt(),{sources:i,selectedSourceId:a,setSelectedSourceId:o,addSource:s,updateSource:c,removeSource:l,catalogSkills:u,isLoadingCatalog:d}=Kt(),{query:f,setQuery:p,deferredQuery:m}=Ue(),h=a==="default",g;t[0]!==a||t[1]!==i?(g=$e(a)?i.find(e=>e.id===a)??null:null,t[0]=a,t[1]=i,t[2]=g):g=t[2];let _=g,v=!h&&d&&u.length===0,y;t[3]!==m||t[4]!==e||t[5]!==n?(y=ot(n,m,e),t[3]=m,t[4]=e,t[5]=n,t[6]=y):y=t[6];let b=y,x;t[7]!==u||t[8]!==m||t[9]!==e?(x=ot(u,m,e),t[7]=u,t[8]=m,t[9]=e,t[10]=x):x=t[10];let S=x,C;return t[11]!==s||t[12]!==S||t[13]!==v||t[14]!==b||t[15]!==f||t[16]!==h||t[17]!==r||t[18]!==l||t[19]!==_||t[20]!==a||t[21]!==p||t[22]!==o||t[23]!==i||t[24]!==c?(C={availableSearch:f,setAvailableSearch:p,availablePopular:b,availableCatalog:S,availableCatalogLoading:v,isDefaultSource:h,selectedCustomSource:_,sources:i,selectedSourceId:a,setSelectedSourceId:o,addSource:s,updateSource:c,removeSource:l,loadingPopularSkills:r},t[11]=s,t[12]=S,t[13]=v,t[14]=b,t[15]=f,t[16]=h,t[17]=r,t[18]=l,t[19]=_,t[20]=a,t[21]=p,t[22]=o,t[23]=i,t[24]=c,t[25]=C):C=t[25],C}async function Xt(e,t){let n=rt(t.id);if(!e.threadId||e.installedFilePaths.has(n))return;let r=t.sourceId??(e.selectedSourceId==="default"?void 0:e.selectedSourceId);try{r?await u(e.threadId,r,t.id,nt(t.id)):await f(e.threadId,n,at(t)),e.setInstalledFilePaths(e=>new Set(e).add(n)),e.triggerExplorerRefresh(),e.reloadSkills(),K({title:`Skill installed`,description:t.name})}catch(e){throw K({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}}async function Zt(e,t,n){if(e.projectId)try{try{await d(e.projectId,t.name,n)}catch{if(!e.threadId)throw Error(`No thread selected to update this skill`);await v(e.threadId,t.name,n)}e.triggerExplorerRefresh(),await e.reloadSkills(),K({title:n?`Model invocation disabled`:`Model invocation enabled`,description:n?`${t.name} is now invoked manually with /${t.name}.`:`${t.name} is offered to the model again.`})}catch(e){K({title:`Error`,description:e instanceof Error?e.message:`Failed to update skill`,variant:`destructive`})}}function Qt(){let e=(0,X.c)(34),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={findItems:Ot,installedPathSuffix:`/SKILL.md`,explorerPathSuffix:`/SKILL.md`,sortByName:!0,removedToastTitle:`Skill removed`},e[0]=t):t=e[0];let n=Ze(t),r=a($t),i=r.find(e=>e.projectId===n.selectedProjectId)??null,o=Lt(),s=Yt(n.installedFilePaths),c;e[1]!==s.loadingPopularSkills||e[2]!==n.loading?(c=[n.loading,s.loadingPopularSkills],e[1]=s.loadingPopularSkills,e[2]=n.loading,e[3]=c):c=e[3];let l=ze(n.selectedProjectId?`${n.selectedProjectId}:${n.selectedThreadId??``}`:null,c),u;e[4]!==s.selectedSourceId||e[5]!==n.installedFilePaths||e[6]!==n.loadItems||e[7]!==n.selectedThreadId||e[8]!==n.setInstalledFilePaths||e[9]!==n.triggerExplorerRefresh?(u=function(e){return Xt({threadId:n.selectedThreadId,selectedSourceId:s.selectedSourceId,installedFilePaths:n.installedFilePaths,setInstalledFilePaths:n.setInstalledFilePaths,triggerExplorerRefresh:n.triggerExplorerRefresh,reloadSkills:n.loadItems},e)},e[4]=s.selectedSourceId,e[5]=n.installedFilePaths,e[6]=n.loadItems,e[7]=n.selectedThreadId,e[8]=n.setInstalledFilePaths,e[9]=n.triggerExplorerRefresh,e[10]=u):u=e[10];let d=u,f;e[11]!==n.loadItems||e[12]!==n.selectedProjectId||e[13]!==n.selectedThreadId||e[14]!==n.triggerExplorerRefresh?(f=function(e,t){return Zt({projectId:n.selectedProjectId,threadId:n.selectedThreadId,triggerExplorerRefresh:n.triggerExplorerRefresh,reloadSkills:n.loadItems},e,t)},e[11]=n.loadItems,e[12]=n.selectedProjectId,e[13]=n.selectedThreadId,e[14]=n.triggerExplorerRefresh,e[15]=f):f=e[15];let p=f,m;e[16]===n?m=e[17]:(m=function(e){e||n.setDeleteConfirm(null)},e[16]=n,e[17]=m);let h=m,g;e[18]===n?g=e[19]:(g=function(){n.deleteConfirm&&n.handleDelete(n.deleteConfirm)},e[18]=n,e[19]=g);let _=g,v;e[20]===n?v=e[21]:(v=function(e){n.loadItems(),n.triggerExplorerRefresh(),K(At(e))},e[20]=n,e[21]=v);let y=v,b=i?A(i):null,x;return e[22]!==s||e[23]!==o||e[24]!==p||e[25]!==_||e[26]!==h||e[27]!==d||e[28]!==y||e[29]!==n||e[30]!==l||e[31]!==r||e[32]!==b?(x={installed:n,projects:r,selectedProjectName:b,dialogs:o,available:s,pageLoading:l,handleInstallPreviewSkill:d,handleConfirmModelInvocation:p,handleDeleteDialogOpenChange:h,handleDeleteConfirm:_,handlePluginInstalled:y},e[22]=s,e[23]=o,e[24]=p,e[25]=_,e[26]=h,e[27]=d,e[28]=y,e[29]=n,e[30]=l,e[31]=r,e[32]=b,e[33]=x):x=e[33],x}function $t(e){return e.projects}function en(){let e=(0,X.c)(101),t=Qt(),{installed:n,dialogs:r,available:i}=t;if(!n.selectedProjectId){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(xe,{children:`Select a project to manage skills.`}),e[0]=t):t=e[0],t}let a,o;e[1]===r?(a=e[2],o=e[3]):(a=()=>r.setShowAddDialog(!0),o=()=>r.setShowUrlDialog(!0),e[1]=r,e[2]=a,e[3]=o);let s;e[4]!==r.openInvocationDialog||e[5]!==n.handleOpenInExplorer||e[6]!==n.items||e[7]!==n.selectedThreadId||e[8]!==n.setDeleteConfirm||e[9]!==a||e[10]!==o?(s=(0,Q.jsx)(Mt,{skills:n.items,threadId:n.selectedThreadId,onOpenSkill:n.handleOpenInExplorer,onDelete:n.setDeleteConfirm,onAddManual:a,onAddUrl:o,onChangeModelInvocation:r.openInvocationDialog}),e[4]=r.openInvocationDialog,e[5]=n.handleOpenInExplorer,e[6]=n.items,e[7]=n.selectedThreadId,e[8]=n.setDeleteConfirm,e[9]=a,e[10]=o,e[11]=s):s=e[11];let c;e[12]===r?c=e[13]:(c=e=>r.setPreviewSkill(e),e[12]=r,e[13]=c);let l;e[14]!==i.selectedSourceId||e[15]!==r?(l=e=>r.setPreviewSkill({...e,sourceId:e.sourceId??i.selectedSourceId}),e[14]=i.selectedSourceId,e[15]=r,e[16]=l):l=e[16];let u;e[17]===r?u=e[18]:(u=()=>r.setShowAddSourceDialog(!0),e[17]=r,e[18]=u);let d;e[19]!==i.availableCatalog||e[20]!==i.availableCatalogLoading||e[21]!==i.availablePopular||e[22]!==i.availableSearch||e[23]!==i.isDefaultSource||e[24]!==i.selectedCustomSource||e[25]!==i.selectedSourceId||e[26]!==i.setAvailableSearch||e[27]!==i.setSelectedSourceId||e[28]!==i.sources||e[29]!==c||e[30]!==l||e[31]!==u?(d=(0,Q.jsx)(vt,{availableSearch:i.availableSearch,onSearchChange:i.setAvailableSearch,selectedSourceId:i.selectedSourceId,onSourceChange:i.setSelectedSourceId,sources:i.sources,selectedCustomSource:i.selectedCustomSource,availableCatalogLoading:i.availableCatalogLoading,isDefaultSource:i.isDefaultSource,availablePopular:i.availablePopular,availableCatalog:i.availableCatalog,onPreviewPopular:c,onPreviewCatalog:l,onAddSource:u}),e[19]=i.availableCatalog,e[20]=i.availableCatalogLoading,e[21]=i.availablePopular,e[22]=i.availableSearch,e[23]=i.isDefaultSource,e[24]=i.selectedCustomSource,e[25]=i.selectedSourceId,e[26]=i.setAvailableSearch,e[27]=i.setSelectedSourceId,e[28]=i.sources,e[29]=c,e[30]=l,e[31]=u,e[32]=d):d=e[32];let f;e[33]!==t.pageLoading||e[34]!==s||e[35]!==d?(f=(0,Q.jsxs)(De,{loading:t.pageLoading,children:[s,d]}),e[33]=t.pageLoading,e[34]=s,e[35]=d,e[36]=f):f=e[36];let p=r.previewSkill!==null,m=i.isDefaultSource?void 0:i.selectedSourceId,h;e[37]!==r.handlePreviewDialogOpenChange||e[38]!==r.previewSkill||e[39]!==t.handleInstallPreviewSkill||e[40]!==p||e[41]!==m?(h=(0,Q.jsx)(dt,{open:p,onOpenChange:r.handlePreviewDialogOpenChange,skill:r.previewSkill,catalogSourceId:m,onInstall:t.handleInstallPreviewSkill}),e[37]=r.handlePreviewDialogOpenChange,e[38]=r.previewSkill,e[39]=t.handleInstallPreviewSkill,e[40]=p,e[41]=m,e[42]=h):h=e[42];let g;e[43]!==r.invocationSkill||e[44]!==r.setShowInvocationDialog||e[45]!==r.showInvocationDialog||e[46]!==t.handleConfirmModelInvocation?(g=(0,Q.jsx)(It,{open:r.showInvocationDialog,onOpenChange:r.setShowInvocationDialog,skill:r.invocationSkill,onConfirm:t.handleConfirmModelInvocation}),e[43]=r.invocationSkill,e[44]=r.setShowInvocationDialog,e[45]=r.showInvocationDialog,e[46]=t.handleConfirmModelInvocation,e[47]=g):g=e[47];let _,v,y;e[48]===i?(_=e[49],v=e[50],y=e[51]):(_=e=>{i.addSource(e),K({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},v=e=>{i.updateSource(e),K({title:`Skill source updated`,description:`${e.title} has been saved.`})},y=e=>{i.removeSource(e),K({title:`Skill source removed`,description:`The custom source has been deleted.`})},e[48]=i,e[49]=_,e[50]=v,e[51]=y);let b;e[52]!==i.selectedCustomSource||e[53]!==r.setShowAddSourceDialog||e[54]!==r.showAddSourceDialog||e[55]!==_||e[56]!==v||e[57]!==y?(b=(0,Q.jsx)(ft,{open:r.showAddSourceDialog,onOpenChange:r.setShowAddSourceDialog,editingSource:i.selectedCustomSource,onSourceAdded:_,onSourceUpdated:v,onSourceDeleted:y}),e[52]=i.selectedCustomSource,e[53]=r.setShowAddSourceDialog,e[54]=r.showAddSourceDialog,e[55]=_,e[56]=v,e[57]=y,e[58]=b):b=e[58];let x;e[59]!==r||e[60]!==n?(x=()=>{r.setShowAddDialog(!1),n.loadItems(),n.triggerExplorerRefresh()},e[59]=r,e[60]=n,e[61]=x):x=e[61];let S;e[62]!==n.selectedThreadId||e[63]!==x?(S=(0,Q.jsx)(R,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Q.jsx)(et,{threadId:n.selectedThreadId,onSkillCreated:x})}),e[62]=n.selectedThreadId,e[63]=x,e[64]=S):S=e[64];let C;e[65]!==r.setShowAddDialog||e[66]!==r.showAddDialog||e[67]!==S?(C=(0,Q.jsx)(z,{open:r.showAddDialog,onOpenChange:r.setShowAddDialog,children:S}),e[65]=r.setShowAddDialog,e[66]=r.showAddDialog,e[67]=S,e[68]=C):C=e[68];let w;e[69]===r?w=e[70]:(w=e=>r.setPluginImportUrl(e),e[69]=r,e[70]=w);let T;e[71]!==r.setShowUrlDialog||e[72]!==r.showUrlDialog||e[73]!==w?(T=(0,Q.jsx)(mt,{open:r.showUrlDialog,onOpenChange:r.setShowUrlDialog,onSubmit:w}),e[71]=r.setShowUrlDialog,e[72]=r.showUrlDialog,e[73]=w,e[74]=T):T=e[74];let E;e[75]===r?E=e[76]:(E=()=>r.setPluginImportUrl(null),e[75]=r,e[76]=E);let D;e[77]===t?D=e[78]:(D=e=>{let{mcpOnly:n}=e;t.handlePluginInstalled(n)},e[77]=t,e[78]=D);let O;e[79]!==r.pluginImportUrl||e[80]!==n.selectedProjectId||e[81]!==t.projects||e[82]!==t.selectedProjectName||e[83]!==E||e[84]!==D?(O=(0,Q.jsx)(Te,{url:r.pluginImportUrl,projectId:n.selectedProjectId,projectName:t.selectedProjectName,projects:t.projects,onSelectProject:tn,onClose:E,onInstalled:D}),e[79]=r.pluginImportUrl,e[80]=n.selectedProjectId,e[81]=t.projects,e[82]=t.selectedProjectName,e[83]=E,e[84]=D,e[85]=O):O=e[85];let k=n.deleteConfirm!==null,A=`Are you sure you want to delete the skill "${n.deleteConfirm?.name}"? This action cannot be undone.`,j;e[86]!==n.deleting||e[87]!==t.handleDeleteConfirm||e[88]!==t.handleDeleteDialogOpenChange||e[89]!==k||e[90]!==A?(j=(0,Q.jsx)(Re,{open:k,onOpenChange:t.handleDeleteDialogOpenChange,title:`Delete Skill`,description:A,onConfirm:t.handleDeleteConfirm,confirming:n.deleting}),e[86]=n.deleting,e[87]=t.handleDeleteConfirm,e[88]=t.handleDeleteDialogOpenChange,e[89]=k,e[90]=A,e[91]=j):j=e[91];let M;return e[92]!==h||e[93]!==g||e[94]!==b||e[95]!==C||e[96]!==T||e[97]!==O||e[98]!==j||e[99]!==f?(M=(0,Q.jsxs)(Q.Fragment,{children:[f,h,g,b,C,T,O,j]}),e[92]=h,e[93]=g,e[94]=b,e[95]=C,e[96]=T,e[97]=O,e[98]=j,e[99]=f,e[100]=M):M=e[100],M}function tn(){}export{en as SettingsSkillsView,en as default};
|
package/dist/public/assets/{settings-slack-view-DkclyaBc.js → settings-slack-view-Caly5yGt.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{V as i}from"./dist-D5vgS4RP.js";import{F as a,Ht as o,Mt as s,Un as c,Vt as l,m as u,w as d}from"./api-COO2LfdU.js";import{t as f}from"./utils-mYB1USG6.js";import{t as p}from"./copy-bi9iX3xn.js";import{t as m}from"./download-CWhQNGlF.js";import{t as h}from"./loader-circle-CrqRIqdA.js";import{t as g}from"./button-Dp5XDZNR.js";import{t as _}from"./use-toast-CKgZ8YeP.js";import{a as v,n as y,o as b,r as x,t as S}from"./select-B6RizwDW.js";import{Cn as C,ht as w,jn as T,ot as E,ut as D,vt as O}from"./index-CalVAwXj.js";var k=t(),A=r();function j(e){return e.configured?[e.botUsername?`@${e.botUsername}`:e.botTokenPreview,`Bridge ${e.bridgeRunning?`running`:`stopped`}`,e.teamName].filter(Boolean).join(` · `):`Not configured`}function M(e){let t=(0,k.c)(51),{settings:n,drafts:r,isSavingTokens:a,onDraftChange:o,onSaveTokens:s,onClearTokens:c,onCopyManifest:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,A.jsx)(D,{title:`Slack App`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=()=>l(),t[1]=l,t[2]=d);let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,A.jsx)(p,{className:`mr-2 h-4 w-4`}),t[3]=_):_=t[3];let v;t[4]===d?v=t[5]:(v=(0,A.jsxs)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:d,children:[_,`Copy app manifest`]}),t[4]=d,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,A.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,asChild:!0,children:(0,A.jsxs)(`a`,{href:`/slack-app-icon.png`,download:`tarsk-slack-app-icon.png`,children:[(0,A.jsx)(m,{className:`mr-2 h-4 w-4`}),`Download app icon`]})}),t[6]=y):y=t[6];let b;t[7]===v?b=t[8]:(b=(0,A.jsx)(E,{title:`App Manifest`,description:`Create a Slack app from this manifest, enable Socket Mode, then paste the Bot and App-Level tokens below. The Slack manifest cannot include an app icon — download the Tarsk logo and upload it under Basic Information after creating the app.`,controlLayout:`row-end`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[v,y]})}),t[7]=v,t[8]=b);let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=f(`text-muted-foreground`,i.bodyMuted),t[9]=x):x=t[9];let S;t[10]===n?S=t[11]:(S=j(n),t[10]=n,t[11]=S);let T;t[12]===S?T=t[13]:(T=(0,A.jsx)(E,{title:`Status`,description:`Bot identity and Socket Mode bridge status.`,children:(0,A.jsx)(`span`,{className:x,children:S})}),t[12]=S,t[13]=T);let O=n.botTokenPreview||`xoxb-…`,M;t[14]===o?M=t[15]:(M=e=>o(`botToken`,e.target.value),t[14]=o,t[15]=M);let N;t[16]!==r.botToken||t[17]!==O||t[18]!==M?(N=(0,A.jsx)(E,{title:`Bot Token`,description:`Bot User OAuth Token from your Slack app (starts with xoxb-).`,children:(0,A.jsx)(C,{id:`slack-bot-token`,type:`password`,autoComplete:`off`,placeholder:O,value:r.botToken,onChange:M})}),t[16]=r.botToken,t[17]=O,t[18]=M,t[19]=N):N=t[19];let P=n.appTokenPreview||`xapp-…`,F;t[20]===o?F=t[21]:(F=e=>o(`appToken`,e.target.value),t[20]=o,t[21]=F);let I;t[22]!==r.appToken||t[23]!==P||t[24]!==F?(I=(0,A.jsx)(E,{title:`App-Level Token`,description:`App-Level Token with connections:write for Socket Mode (starts with xapp-).`,children:(0,A.jsx)(C,{id:`slack-app-token`,type:`password`,autoComplete:`off`,placeholder:P,value:r.appToken,onChange:F})}),t[22]=r.appToken,t[23]=P,t[24]=F,t[25]=I):I=t[25];let L;t[26]===s?L=t[27]:(L=()=>s(),t[26]=s,t[27]=L);let R;t[28]!==r.appToken||t[29]!==r.botToken||t[30]!==a?(R=a||!r.botToken.trim()||!r.appToken.trim(),t[28]=r.appToken,t[29]=r.botToken,t[30]=a,t[31]=R):R=t[31];let z;t[32]===a?z=t[33]:(z=a?(0,A.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`}):null,t[32]=a,t[33]=z);let B;t[34]!==L||t[35]!==R||t[36]!==z?(B=(0,A.jsxs)(g,{type:`button`,onClick:L,disabled:R,children:[z,`Save`]}),t[34]=L,t[35]=R,t[36]=z,t[37]=B):B=t[37];let V;t[38]!==a||t[39]!==c||t[40]!==n.configured?(V=n.configured?(0,A.jsx)(g,{type:`button`,variant:`outline`,onClick:()=>c(),disabled:a,children:`Clear`}):null,t[38]=a,t[39]=c,t[40]=n.configured,t[41]=V):V=t[41];let H;t[42]!==B||t[43]!==V?(H=(0,A.jsx)(E,{title:`Tokens`,description:`Save both tokens to start the bridge, or clear them to disconnect.`,controlLayout:`row-end`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[B,V]})}),t[42]=B,t[43]=V,t[44]=H):H=t[44];let U;return t[45]!==N||t[46]!==I||t[47]!==H||t[48]!==b||t[49]!==T?(U=(0,A.jsxs)(`div`,{children:[u,(0,A.jsxs)(w,{children:[b,T,N,I,H]})]}),t[45]=N,t[46]=I,t[47]=H,t[48]=b,t[49]=T,t[50]=U):U=t[50],U}function N(e,t){return t.find(t=>t.projectId===e.projectId)?.name||e.projectId}function P(e){let t=(0,k.c)(20),{binding:n,projects:r,onDelete:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=f(i.compact),t[0]=o):o=t[0];let s=n.slackChannelName||n.slackChannelId,c;t[1]===s?c=t[2]:(c=(0,A.jsx)(`div`,{className:`font-medium`,children:s}),t[1]=s,t[2]=c);let l;t[3]!==n||t[4]!==r?(l=N(n,r),t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,A.jsx)(`div`,{className:`text-muted-foreground`,children:l}),t[6]=l,t[7]=u);let d;t[8]!==c||t[9]!==u?(d=(0,A.jsxs)(`div`,{className:o,children:[c,u]}),t[8]=c,t[9]=u,t[10]=d):d=t[10];let p;t[11]!==n||t[12]!==a?(p=()=>a(n),t[11]=n,t[12]=a,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,A.jsx)(T,{className:`h-4 w-4`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,A.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,onClick:p,"aria-label":`Remove binding`,children:m}),t[15]=p,t[16]=h);let _;return t[17]!==d||t[18]!==h?(_=(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[d,h]}),t[17]=d,t[18]=h,t[19]=_):_=t[19],_}function F(e){let t=(0,k.c)(45),{settings:n,projects:r,drafts:a,isSavingBinding:o,onDraftChange:s,onAddBinding:c,onDeleteBinding:l}=e,u=n.channels.length>0,d=r.length>0,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,A.jsx)(D,{title:`Channel Bindings`}),t[0]=p):p=t[0];let m;t[1]!==a.channelId||t[2]!==u||t[3]!==s||t[4]!==n.channels?(m=(0,A.jsx)(E,{title:`Slack Channel`,description:`Invite the bot to the channel first. Only channels the bot can see are listed.`,children:u?(0,A.jsxs)(S,{value:a.channelId||void 0,onValueChange:e=>s(`channelId`,e),children:[(0,A.jsx)(v,{id:`slack-channel`,"aria-label":`Slack Channel`,children:(0,A.jsx)(b,{placeholder:`Select a channel…`})}),(0,A.jsx)(y,{children:n.channels.map(L)})]}):(0,A.jsx)(C,{id:`slack-channel`,placeholder:`Channel ID (C…)`,value:a.channelId,onChange:e=>s(`channelId`,e.target.value)})}),t[1]=a.channelId,t[2]=u,t[3]=s,t[4]=n.channels,t[5]=m):m=t[5];let _=a.projectId||void 0,x;t[6]===s?x=t[7]:(x=e=>s(`projectId`,e),t[6]=s,t[7]=x);let T=!d,O=d?`Select a project…`:`No projects`,j;t[8]===O?j=t[9]:(j=(0,A.jsx)(v,{id:`slack-project`,"aria-label":`Tarsk Project`,children:(0,A.jsx)(b,{placeholder:O})}),t[8]=O,t[9]=j);let M;t[10]===r?M=t[11]:(M=r.map(I),t[10]=r,t[11]=M);let N;t[12]===M?N=t[13]:(N=(0,A.jsx)(y,{children:M}),t[12]=M,t[13]=N);let F;t[14]!==_||t[15]!==x||t[16]!==T||t[17]!==j||t[18]!==N?(F=(0,A.jsx)(E,{title:`Tarsk Project`,description:`Each Slack channel maps to one Tarsk project.`,children:(0,A.jsxs)(S,{value:_,onValueChange:x,disabled:T,children:[j,N]})}),t[14]=_,t[15]=x,t[16]=T,t[17]=j,t[18]=N,t[19]=F):F=t[19];let R;t[20]===c?R=t[21]:(R=()=>c(),t[20]=c,t[21]=R);let z;t[22]!==a.channelId||t[23]!==a.projectId||t[24]!==o?(z=o||!a.channelId.trim()||!a.projectId,t[22]=a.channelId,t[23]=a.projectId,t[24]=o,t[25]=z):z=t[25];let B;t[26]===o?B=t[27]:(B=o?(0,A.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`}):null,t[26]=o,t[27]=B);let V;t[28]!==R||t[29]!==z||t[30]!==B?(V=(0,A.jsx)(E,{title:`Bind`,description:`Create a channel ↔ project binding.`,controlLayout:`row-end`,action:(0,A.jsxs)(g,{type:`button`,onClick:R,disabled:z,children:[B,`Bind channel`]})}),t[28]=R,t[29]=z,t[30]=B,t[31]=V):V=t[31];let H;t[32]!==F||t[33]!==V||t[34]!==m?(H=(0,A.jsxs)(w,{children:[m,F,V]}),t[32]=F,t[33]=V,t[34]=m,t[35]=H):H=t[35];let U;t[36]!==l||t[37]!==r||t[38]!==n.bindings?(U=n.bindings.length===0?(0,A.jsx)(`p`,{className:f(`text-muted-foreground`,i.compact),children:`No bindings yet.`}):n.bindings.map(e=>(0,A.jsx)(P,{binding:e,projects:r,onDelete:l},`${e.slackTeamId}:${e.slackChannelId}`)),t[36]=l,t[37]=r,t[38]=n.bindings,t[39]=U):U=t[39];let W;t[40]===U?W=t[41]:(W=(0,A.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:U}),t[40]=U,t[41]=W);let G;return t[42]!==H||t[43]!==W?(G=(0,A.jsxs)(`div`,{children:[p,H,W]}),t[42]=H,t[43]=W,t[44]=G):G=t[44],G}function I(e){return(0,A.jsx)(x,{value:e.projectId,children:e.name},e.projectId)}function L(e){return(0,A.jsx)(x,{value:e.id,children:e.name},e.id)}var R=e(n(),1),z={botToken:``,appToken:``,channelId:``,projectId:``},B={tokens:!1,binding:!1};function V(e,t){_({title:e,description:t instanceof Error?t.message:String(t),variant:`destructive`})}function H(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)([]),[i,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(z),[h,g]=(0,R.useState)(!0),[v,y]=(0,R.useState)(B),b=(0,R.useCallback)(async()=>{let[e,n]=await Promise.all([o(),s()]);t(e),r(n.projects)},[]);(0,R.useEffect)(()=>{let e=!1;async function n(){g(!0);try{let[n,i,a]=await Promise.all([o(),s(),l()]);e||(t(n),r(i.projects),f(a.manifest),i.projects[0]&&m(e=>e.projectId?e:{...e,projectId:i.projects[0].projectId}))}catch(t){e||V(`Failed to load Slack settings`,t)}finally{e||g(!1)}}return n(),()=>{e=!0}},[]);function x(e,t){m(n=>({...n,[e]:t}))}function S(e,t){y(n=>({...n,[e]:t}))}async function C(){let e=p.botToken.trim(),t=p.appToken.trim();if(e&&t){S(`tokens`,!0);try{await c({botToken:e,appToken:t}),m(e=>({...e,botToken:``,appToken:``})),await b(),_({title:`Slack tokens saved`})}catch(e){V(`Failed to save tokens`,e)}finally{S(`tokens`,!1)}}}async function w(){S(`tokens`,!0);try{await u(),await b(),_({title:`Slack tokens cleared`})}catch(e){V(`Failed to clear tokens`,e)}finally{S(`tokens`,!1)}}async function T(){let t=p.channelId.trim();if(t&&p.projectId){S(`binding`,!0);try{let n=e?.channels.find(e=>e.id===t);await d({slackChannelId:t,projectId:p.projectId,...n?{slackChannelName:n.name}:{}}),m(e=>({...e,channelId:``})),await b(),_({title:`Channel bound`})}catch(e){V(`Failed to bind channel`,e)}finally{S(`binding`,!1)}}}async function E(e){try{await a(e.slackTeamId,e.slackChannelId),await b(),_({title:`Binding removed`})}catch(e){V(`Failed to remove binding`,e)}}async function D(){try{await navigator.clipboard.writeText(i||(await l()).manifest),_({title:`Manifest copied`})}catch(e){V(`Failed to copy manifest`,e)}}return{settings:e,projects:n,manifest:i,drafts:p,isLoading:h,saving:v,setDraft:x,saveTokens:C,clearTokens:w,addBinding:T,deleteBinding:E,copyManifest:D}}function U(){let e=(0,k.c)(20),t=H();if(t.isLoading||!t.settings){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,A.jsx)(O,{title:`Slack`,description:`Loading Slack settings…`,children:(0,A.jsxs)(`div`,{className:f(`flex items-center gap-2 text-muted-foreground`,i.compact),children:[(0,A.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Loading Slack settings…`]})}),e[0]=t):t=e[0],t}let n;e[1]!==t.clearTokens||e[2]!==t.copyManifest||e[3]!==t.drafts||e[4]!==t.saveTokens||e[5]!==t.saving.tokens||e[6]!==t.setDraft||e[7]!==t.settings?(n=(0,A.jsx)(M,{settings:t.settings,drafts:t.drafts,isSavingTokens:t.saving.tokens,onDraftChange:t.setDraft,onSaveTokens:t.saveTokens,onClearTokens:t.clearTokens,onCopyManifest:t.copyManifest}),e[1]=t.clearTokens,e[2]=t.copyManifest,e[3]=t.drafts,e[4]=t.saveTokens,e[5]=t.saving.tokens,e[6]=t.setDraft,e[7]=t.settings,e[8]=n):n=e[8];let r;e[9]!==t.addBinding||e[10]!==t.deleteBinding||e[11]!==t.drafts||e[12]!==t.projects||e[13]!==t.saving.binding||e[14]!==t.setDraft||e[15]!==t.settings?(r=(0,A.jsx)(F,{settings:t.settings,projects:t.projects,drafts:t.drafts,isSavingBinding:t.saving.binding,onDraftChange:t.setDraft,onAddBinding:t.addBinding,onDeleteBinding:t.deleteBinding}),e[9]=t.addBinding,e[10]=t.deleteBinding,e[11]=t.drafts,e[12]=t.projects,e[13]=t.saving.binding,e[14]=t.setDraft,e[15]=t.settings,e[16]=r):r=e[16];let a;return e[17]!==n||e[18]!==r?(a=(0,A.jsx)(O,{title:`Slack`,description:`Connect a Slack app (Socket Mode) and bind channels to Tarsk projects.`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[n,r]})}),e[17]=n,e[18]=r,e[19]=a):a=e[19],a}export{U as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{U as i}from"./dist-v_MvKS2-.js";import{F as a,Ht as o,Mt as s,Un as c,Vt as l,m as u,w as d}from"./api-Cp9I7CxD.js";import{t as f}from"./utils-CqsIXqSC.js";import{t as p}from"./copy-bi9iX3xn.js";import{t as m}from"./download-CWhQNGlF.js";import{t as h}from"./loader-circle-CrqRIqdA.js";import{t as g}from"./button-DDaJhJP1.js";import{t as _}from"./use-toast-CKgZ8YeP.js";import{a as v,n as y,o as b,r as x,t as S}from"./select-DMcNYwgt.js";import{Cn as C,dt as w,gn as T,mt as E,nt as D,ot as O}from"./index-CcAwxnT5.js";var k=t(),A=r();function j(e){return e.configured?[e.botUsername?`@${e.botUsername}`:e.botTokenPreview,`Bridge ${e.bridgeRunning?`running`:`stopped`}`,e.teamName].filter(Boolean).join(` · `):`Not configured`}function M(e){let t=(0,k.c)(51),{settings:n,drafts:r,isSavingTokens:a,onDraftChange:o,onSaveTokens:s,onClearTokens:c,onCopyManifest:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,A.jsx)(O,{title:`Slack App`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=()=>l(),t[1]=l,t[2]=d);let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,A.jsx)(p,{className:`mr-2 h-4 w-4`}),t[3]=_):_=t[3];let v;t[4]===d?v=t[5]:(v=(0,A.jsxs)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:d,children:[_,`Copy app manifest`]}),t[4]=d,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,A.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,asChild:!0,children:(0,A.jsxs)(`a`,{href:`/slack-app-icon.png`,download:`tarsk-slack-app-icon.png`,children:[(0,A.jsx)(m,{className:`mr-2 h-4 w-4`}),`Download app icon`]})}),t[6]=y):y=t[6];let b;t[7]===v?b=t[8]:(b=(0,A.jsx)(D,{title:`App Manifest`,description:`Create a Slack app from this manifest, enable Socket Mode, then paste the Bot and App-Level tokens below. The Slack manifest cannot include an app icon — download the Tarsk logo and upload it under Basic Information after creating the app.`,controlLayout:`row-end`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[v,y]})}),t[7]=v,t[8]=b);let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=f(`text-muted-foreground`,i.bodyMuted),t[9]=x):x=t[9];let S;t[10]===n?S=t[11]:(S=j(n),t[10]=n,t[11]=S);let C;t[12]===S?C=t[13]:(C=(0,A.jsx)(D,{title:`Status`,description:`Bot identity and Socket Mode bridge status.`,children:(0,A.jsx)(`span`,{className:x,children:S})}),t[12]=S,t[13]=C);let E=n.botTokenPreview||`xoxb-…`,M;t[14]===o?M=t[15]:(M=e=>o(`botToken`,e.target.value),t[14]=o,t[15]=M);let N;t[16]!==r.botToken||t[17]!==E||t[18]!==M?(N=(0,A.jsx)(D,{title:`Bot Token`,description:`Bot User OAuth Token from your Slack app (starts with xoxb-).`,children:(0,A.jsx)(T,{id:`slack-bot-token`,type:`password`,autoComplete:`off`,placeholder:E,value:r.botToken,onChange:M})}),t[16]=r.botToken,t[17]=E,t[18]=M,t[19]=N):N=t[19];let P=n.appTokenPreview||`xapp-…`,F;t[20]===o?F=t[21]:(F=e=>o(`appToken`,e.target.value),t[20]=o,t[21]=F);let I;t[22]!==r.appToken||t[23]!==P||t[24]!==F?(I=(0,A.jsx)(D,{title:`App-Level Token`,description:`App-Level Token with connections:write for Socket Mode (starts with xapp-).`,children:(0,A.jsx)(T,{id:`slack-app-token`,type:`password`,autoComplete:`off`,placeholder:P,value:r.appToken,onChange:F})}),t[22]=r.appToken,t[23]=P,t[24]=F,t[25]=I):I=t[25];let L;t[26]===s?L=t[27]:(L=()=>s(),t[26]=s,t[27]=L);let R;t[28]!==r.appToken||t[29]!==r.botToken||t[30]!==a?(R=a||!r.botToken.trim()||!r.appToken.trim(),t[28]=r.appToken,t[29]=r.botToken,t[30]=a,t[31]=R):R=t[31];let z;t[32]===a?z=t[33]:(z=a?(0,A.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`}):null,t[32]=a,t[33]=z);let B;t[34]!==L||t[35]!==R||t[36]!==z?(B=(0,A.jsxs)(g,{type:`button`,onClick:L,disabled:R,children:[z,`Save`]}),t[34]=L,t[35]=R,t[36]=z,t[37]=B):B=t[37];let V;t[38]!==a||t[39]!==c||t[40]!==n.configured?(V=n.configured?(0,A.jsx)(g,{type:`button`,variant:`outline`,onClick:()=>c(),disabled:a,children:`Clear`}):null,t[38]=a,t[39]=c,t[40]=n.configured,t[41]=V):V=t[41];let H;t[42]!==B||t[43]!==V?(H=(0,A.jsx)(D,{title:`Tokens`,description:`Save both tokens to start the bridge, or clear them to disconnect.`,controlLayout:`row-end`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[B,V]})}),t[42]=B,t[43]=V,t[44]=H):H=t[44];let U;return t[45]!==N||t[46]!==I||t[47]!==H||t[48]!==b||t[49]!==C?(U=(0,A.jsxs)(`div`,{children:[u,(0,A.jsxs)(w,{children:[b,C,N,I,H]})]}),t[45]=N,t[46]=I,t[47]=H,t[48]=b,t[49]=C,t[50]=U):U=t[50],U}function N(e,t){return t.find(t=>t.projectId===e.projectId)?.name||e.projectId}function P(e){let t=(0,k.c)(20),{binding:n,projects:r,onDelete:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=f(i.compact),t[0]=o):o=t[0];let s=n.slackChannelName||n.slackChannelId,c;t[1]===s?c=t[2]:(c=(0,A.jsx)(`div`,{className:`font-medium`,children:s}),t[1]=s,t[2]=c);let l;t[3]!==n||t[4]!==r?(l=N(n,r),t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,A.jsx)(`div`,{className:`text-muted-foreground`,children:l}),t[6]=l,t[7]=u);let d;t[8]!==c||t[9]!==u?(d=(0,A.jsxs)(`div`,{className:o,children:[c,u]}),t[8]=c,t[9]=u,t[10]=d):d=t[10];let p;t[11]!==n||t[12]!==a?(p=()=>a(n),t[11]=n,t[12]=a,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,A.jsx)(C,{className:`h-4 w-4`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,A.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,onClick:p,"aria-label":`Remove binding`,children:m}),t[15]=p,t[16]=h);let _;return t[17]!==d||t[18]!==h?(_=(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[d,h]}),t[17]=d,t[18]=h,t[19]=_):_=t[19],_}function F(e){let t=(0,k.c)(45),{settings:n,projects:r,drafts:a,isSavingBinding:o,onDraftChange:s,onAddBinding:c,onDeleteBinding:l}=e,u=n.channels.length>0,d=r.length>0,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,A.jsx)(O,{title:`Channel Bindings`}),t[0]=p):p=t[0];let m;t[1]!==a.channelId||t[2]!==u||t[3]!==s||t[4]!==n.channels?(m=(0,A.jsx)(D,{title:`Slack Channel`,description:`Invite the bot to the channel first. Only channels the bot can see are listed.`,children:u?(0,A.jsxs)(S,{value:a.channelId||void 0,onValueChange:e=>s(`channelId`,e),children:[(0,A.jsx)(v,{id:`slack-channel`,"aria-label":`Slack Channel`,children:(0,A.jsx)(b,{placeholder:`Select a channel…`})}),(0,A.jsx)(y,{children:n.channels.map(L)})]}):(0,A.jsx)(T,{id:`slack-channel`,placeholder:`Channel ID (C…)`,value:a.channelId,onChange:e=>s(`channelId`,e.target.value)})}),t[1]=a.channelId,t[2]=u,t[3]=s,t[4]=n.channels,t[5]=m):m=t[5];let _=a.projectId||void 0,x;t[6]===s?x=t[7]:(x=e=>s(`projectId`,e),t[6]=s,t[7]=x);let C=!d,E=d?`Select a project…`:`No projects`,j;t[8]===E?j=t[9]:(j=(0,A.jsx)(v,{id:`slack-project`,"aria-label":`Tarsk Project`,children:(0,A.jsx)(b,{placeholder:E})}),t[8]=E,t[9]=j);let M;t[10]===r?M=t[11]:(M=r.map(I),t[10]=r,t[11]=M);let N;t[12]===M?N=t[13]:(N=(0,A.jsx)(y,{children:M}),t[12]=M,t[13]=N);let F;t[14]!==_||t[15]!==x||t[16]!==C||t[17]!==j||t[18]!==N?(F=(0,A.jsx)(D,{title:`Tarsk Project`,description:`Each Slack channel maps to one Tarsk project.`,children:(0,A.jsxs)(S,{value:_,onValueChange:x,disabled:C,children:[j,N]})}),t[14]=_,t[15]=x,t[16]=C,t[17]=j,t[18]=N,t[19]=F):F=t[19];let R;t[20]===c?R=t[21]:(R=()=>c(),t[20]=c,t[21]=R);let z;t[22]!==a.channelId||t[23]!==a.projectId||t[24]!==o?(z=o||!a.channelId.trim()||!a.projectId,t[22]=a.channelId,t[23]=a.projectId,t[24]=o,t[25]=z):z=t[25];let B;t[26]===o?B=t[27]:(B=o?(0,A.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`}):null,t[26]=o,t[27]=B);let V;t[28]!==R||t[29]!==z||t[30]!==B?(V=(0,A.jsx)(D,{title:`Bind`,description:`Create a channel ↔ project binding.`,controlLayout:`row-end`,action:(0,A.jsxs)(g,{type:`button`,onClick:R,disabled:z,children:[B,`Bind channel`]})}),t[28]=R,t[29]=z,t[30]=B,t[31]=V):V=t[31];let H;t[32]!==F||t[33]!==V||t[34]!==m?(H=(0,A.jsxs)(w,{children:[m,F,V]}),t[32]=F,t[33]=V,t[34]=m,t[35]=H):H=t[35];let U;t[36]!==l||t[37]!==r||t[38]!==n.bindings?(U=n.bindings.length===0?(0,A.jsx)(`p`,{className:f(`text-muted-foreground`,i.compact),children:`No bindings yet.`}):n.bindings.map(e=>(0,A.jsx)(P,{binding:e,projects:r,onDelete:l},`${e.slackTeamId}:${e.slackChannelId}`)),t[36]=l,t[37]=r,t[38]=n.bindings,t[39]=U):U=t[39];let W;t[40]===U?W=t[41]:(W=(0,A.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:U}),t[40]=U,t[41]=W);let G;return t[42]!==H||t[43]!==W?(G=(0,A.jsxs)(`div`,{children:[p,H,W]}),t[42]=H,t[43]=W,t[44]=G):G=t[44],G}function I(e){return(0,A.jsx)(x,{value:e.projectId,children:e.name},e.projectId)}function L(e){return(0,A.jsx)(x,{value:e.id,children:e.name},e.id)}var R=e(n(),1),z={botToken:``,appToken:``,channelId:``,projectId:``},B={tokens:!1,binding:!1};function V(e,t){_({title:e,description:t instanceof Error?t.message:String(t),variant:`destructive`})}function H(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)([]),[i,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(z),[h,g]=(0,R.useState)(!0),[v,y]=(0,R.useState)(B),b=(0,R.useCallback)(async()=>{let[e,n]=await Promise.all([o(),s()]);t(e),r(n.projects)},[]);(0,R.useEffect)(()=>{let e=!1;async function n(){g(!0);try{let[n,i,a]=await Promise.all([o(),s(),l()]);e||(t(n),r(i.projects),f(a.manifest),i.projects[0]&&m(e=>e.projectId?e:{...e,projectId:i.projects[0].projectId}))}catch(t){e||V(`Failed to load Slack settings`,t)}finally{e||g(!1)}}return n(),()=>{e=!0}},[]);function x(e,t){m(n=>({...n,[e]:t}))}function S(e,t){y(n=>({...n,[e]:t}))}async function C(){let e=p.botToken.trim(),t=p.appToken.trim();if(e&&t){S(`tokens`,!0);try{await c({botToken:e,appToken:t}),m(e=>({...e,botToken:``,appToken:``})),await b(),_({title:`Slack tokens saved`})}catch(e){V(`Failed to save tokens`,e)}finally{S(`tokens`,!1)}}}async function w(){S(`tokens`,!0);try{await u(),await b(),_({title:`Slack tokens cleared`})}catch(e){V(`Failed to clear tokens`,e)}finally{S(`tokens`,!1)}}async function T(){let t=p.channelId.trim();if(t&&p.projectId){S(`binding`,!0);try{let n=e?.channels.find(e=>e.id===t);await d({slackChannelId:t,projectId:p.projectId,...n?{slackChannelName:n.name}:{}}),m(e=>({...e,channelId:``})),await b(),_({title:`Channel bound`})}catch(e){V(`Failed to bind channel`,e)}finally{S(`binding`,!1)}}}async function E(e){try{await a(e.slackTeamId,e.slackChannelId),await b(),_({title:`Binding removed`})}catch(e){V(`Failed to remove binding`,e)}}async function D(){try{await navigator.clipboard.writeText(i||(await l()).manifest),_({title:`Manifest copied`})}catch(e){V(`Failed to copy manifest`,e)}}return{settings:e,projects:n,manifest:i,drafts:p,isLoading:h,saving:v,setDraft:x,saveTokens:C,clearTokens:w,addBinding:T,deleteBinding:E,copyManifest:D}}function U(){let e=(0,k.c)(20),t=H();if(t.isLoading||!t.settings){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,A.jsx)(E,{title:`Slack`,description:`Loading Slack settings…`,children:(0,A.jsxs)(`div`,{className:f(`flex items-center gap-2 text-muted-foreground`,i.compact),children:[(0,A.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Loading Slack settings…`]})}),e[0]=t):t=e[0],t}let n;e[1]!==t.clearTokens||e[2]!==t.copyManifest||e[3]!==t.drafts||e[4]!==t.saveTokens||e[5]!==t.saving.tokens||e[6]!==t.setDraft||e[7]!==t.settings?(n=(0,A.jsx)(M,{settings:t.settings,drafts:t.drafts,isSavingTokens:t.saving.tokens,onDraftChange:t.setDraft,onSaveTokens:t.saveTokens,onClearTokens:t.clearTokens,onCopyManifest:t.copyManifest}),e[1]=t.clearTokens,e[2]=t.copyManifest,e[3]=t.drafts,e[4]=t.saveTokens,e[5]=t.saving.tokens,e[6]=t.setDraft,e[7]=t.settings,e[8]=n):n=e[8];let r;e[9]!==t.addBinding||e[10]!==t.deleteBinding||e[11]!==t.drafts||e[12]!==t.projects||e[13]!==t.saving.binding||e[14]!==t.setDraft||e[15]!==t.settings?(r=(0,A.jsx)(F,{settings:t.settings,projects:t.projects,drafts:t.drafts,isSavingBinding:t.saving.binding,onDraftChange:t.setDraft,onAddBinding:t.addBinding,onDeleteBinding:t.deleteBinding}),e[9]=t.addBinding,e[10]=t.deleteBinding,e[11]=t.drafts,e[12]=t.projects,e[13]=t.saving.binding,e[14]=t.setDraft,e[15]=t.settings,e[16]=r):r=e[16];let a;return e[17]!==n||e[18]!==r?(a=(0,A.jsx)(E,{title:`Slack`,description:`Connect a Slack app (Socket Mode) and bind channels to Tarsk projects.`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[n,r]})}),e[17]=n,e[18]=r,e[19]=a):a=e[19],a}export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,t as r}from"./react-vendor-D61Uve5n.js";import{U as i}from"./dist-v_MvKS2-.js";import{r as a}from"./store-W78TGOIO.js";import{Dr as o,I as s,Sr as c,T as l,Ut as u}from"./api-Cp9I7CxD.js";import{c as d,t as f}from"./utils-CqsIXqSC.js";import{t as p}from"./circle-DQwOli2u.js";import{r as m,t as h}from"./dialog-D_12AsZd.js";import{t as g}from"./button-DDaJhJP1.js";import{g as _,h as v,n as y,t as b,u as x}from"./dist-AbkJBHH5.js";import{o as S}from"./dist-2xH_pFmV.js";import{t as C}from"./label-BCs5CZEs.js";import{t as w}from"./dist-Dx8OsX8-.js";import{n as T,r as E,t as D}from"./dist-pCVg1Jdl.js";import{t as O}from"./use-toast-CKgZ8YeP.js";import{n as k}from"./explorer-tab-context-BwR8CM8l.js";import{t as A}from"./use-open-chat-dock-panel-CXzpgxVs.js";import{t as j}from"./dist-CkGJjZXY.js";import{at as M,ft as N,gn as P,gt as ee,ht as F,it as te,lt as ne,nt as I,pt as re,tt as L,wn as ie}from"./index-CcAwxnT5.js";import{t as ae}from"./delete-confirm-dialog-D1N86piR.js";import{t as R}from"./use-settings-page-loading-B5WU5d1c.js";import{i as oe,r as se,s as ce}from"./settings-list-Co3JPr9w.js";import{i as z,n as B,r as V}from"./slug-utils-CO6nui1C.js";var H=t(),U=e(n(),1),W=r(),G=`Radio`,[K,q]=v(G),[J,le]=K(G),Y=U.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[f,p]=U.useState(null),m=d(t,e=>p(e)),h=U.useRef(!1),g=!f||l||!!f.closest(`form`);return(0,W.jsxs)(J,{scope:n,checked:i,disabled:o,children:[(0,W.jsx)(x.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":fe(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:m,onClick:_(e.onClick,e=>{i||c?.(),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,W.jsx)(de,{control:f,bubbles:!h.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});Y.displayName=G;var X=`RadioIndicator`,Z=U.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=le(X,n);return(0,W.jsx)(y,{present:r||a.checked,children:(0,W.jsx)(x.span,{"data-state":fe(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Z.displayName=X;var ue=`RadioBubbleInput`,de=U.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=U.useRef(null),s=d(o,a),c=j(n),l=S(t);return U.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,W.jsx)(x.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});de.displayName=ue;function fe(e){return e?`checked`:`unchecked`}var pe=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Q=`RadioGroup`,[me,he]=v(Q,[E,q]),ge=E(),_e=q(),[ve,ye]=me(Q),be=U.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,p=ge(n),m=w(l),[h,g]=b({prop:a,defaultProp:i??null,onChange:d,caller:Q});return(0,W.jsx)(ve,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,W.jsx)(T,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,W.jsx)(x.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});be.displayName=Q;var xe=`RadioGroupItem`,Se=U.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=ye(xe,n),o=a.disabled||r,s=ge(n),c=_e(n),l=U.useRef(null),u=d(t,l),f=a.value===i.value,p=U.useRef(!1);return U.useEffect(()=>{let e=e=>{pe.includes(e.key)&&(p.current=!0)},t=()=>p.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,W.jsx)(D,{asChild:!0,...s,focusable:!o,active:f,children:(0,W.jsx)(Y,{disabled:o,required:a.required,checked:f,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:_(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:_(i.onFocus,()=>{p.current&&l.current?.click()})})})});Se.displayName=xe;var Ce=`RadioGroupIndicator`,we=U.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e,i=_e(n);return(0,W.jsx)(Z,{...i,...r,ref:t})});we.displayName=Ce;var Te=be,Ee=Se,De=we,Oe=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`grid gap-2`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Te,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Oe.displayName=Te.displayName;var $=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`aspect-square h-4 w-4 rounded-full border border-brand text-brand ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(De,{className:`flex items-center justify-center`,children:(0,W.jsx)(p,{className:`h-2.5 w-2.5 fill-current text-current`})}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,W.jsx)(Ee,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});$.displayName=Ee.displayName;function ke({projectId:e,threadId:t,onCommandCreated:n}){let[r,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,u]=(0,U.useState)(``),[d,p]=(0,U.useState)(`default`),[m,h]=(0,U.useState)(!1),g=V(r),_=B(g),v=async()=>{if(_&&e){h(!0);try{let e={description:o.trim()||void 0,argumentHint:c.trim()||void 0,mode:d===`plan`?`plan`:void 0};await l(g,``,e,`project`,t??void 0),O({title:`Command created`,description:`Command '/${g}' was created successfully.`}),a(``),s(``),u(``),p(`default`),n?.(g)}catch(e){O({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{h(!1)}}};return e?(0,W.jsx)(F,{children:(0,W.jsxs)(L,{children:[(0,W.jsx)(M,{title:`Add Slash Command`,description:`Saved as a .md file in .agents/commands in the selected project workspace.`,sticky:!0,className:`pr-10`}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(I,{title:`Command Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,W.jsx)(P,{id:`commandName`,value:r,onChange:e=>a(e.target.value),placeholder:`e.g. review`,disabled:m}),r?(0,W.jsxs)(`p`,{className:f(i.caption,`mt-2`),children:[`Command: `,(0,W.jsxs)(`span`,{className:`font-mono`,children:[`/`,g||`...`]})]}):null]}),(0,W.jsx)(I,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(P,{id:`commandDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:m})}),(0,W.jsx)(I,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(P,{id:`argumentHint`,value:c,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:m})}),(0,W.jsx)(I,{title:`Mode`,description:d==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsxs)(Oe,{value:d,onValueChange:e=>p(e),className:`flex gap-4`,disabled:m,children:[(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)($,{value:`default`,id:`mode-default`}),(0,W.jsx)(C,{htmlFor:`mode-default`,className:f(i.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)($,{value:`plan`,id:`mode-plan`}),(0,W.jsx)(C,{htmlFor:`mode-plan`,className:f(i.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,W.jsx)(z,{onContinue:()=>void v(),disabled:!_,creating:m})]})]})}):(0,W.jsx)(N,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function Ae(e,t){let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(new Map),c=(0,U.useCallback)(async()=>{if(!t){a(!1),r([]),s(new Map);return}a(!0);try{let e=(await u(t)).filter(function(e){return e.scope===`project`&&!e.isBuiltIn});r(e),s(new Map(e.map(e=>[e.name,e.filePath])))}catch{r([]),s(new Map)}finally{a(!1)}},[t]);return(0,U.useLayoutEffect)(()=>{t&&a(!0)},[e,t]),(0,U.useEffect)(()=>{c()},[c]),{commands:n,loading:i,installedCommands:o,setInstalledCommands:s,loadCommands:c}}function je(){let e=(0,H.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,U.useState)(t),[i,a]=(0,U.useState)(!0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a(!0),c().then(r).catch(()=>r([])).finally(()=>a(!1))},s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,U.useEffect)(o,s);let l;return e[3]!==i||e[4]!==n?(l={popularCommands:n,loadingPopularCommands:i},e[3]=i,e[4]=n,e[5]=l):l=e[5],l}function Me(e){let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`}function Ne(e,t){return e.filter(e=>!t.has(e.name))}function Pe(e,t){let n=(0,H.c)(3),r;return n[0]!==t||n[1]!==e?(r=function(n){e(n),t(`explorer`)},n[0]=t,n[1]=e,n[2]=r):r=n[2],r}function Fe(e){return(0,U.useCallback)(async function(t){e.setDeleting(!0);try{if(!e.selectedThreadId)return;await s(t.filePath,e.selectedThreadId),e.setExplorerClearPath(t.filePath),e.triggerExplorerRefresh(),e.setInstalledCommands(e=>{let n=new Map(e);return n.delete(t.name),n}),O({title:`Command removed`,description:`/${t.name}`}),e.setDeleteConfirm(null),await e.loadCommands()}catch(e){O({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{e.setDeleting(!1)}},[e.loadCommands,e.selectedThreadId,e.triggerExplorerRefresh,e.setExplorerClearPath])}function Ie(e){return(0,U.useCallback)(async function(t){if(e.selectedThreadId&&!e.installedCommands.has(t.name))try{if(t.gitHubRepo&&t.gitHubFolder){let n=`.agents/commands`;await o(e.selectedThreadId,t.gitHubRepo,t.gitHubFolder,n);let r=`${n}/${t.name}.md`;e.setInstalledCommands(e=>new Map(e).set(t.name,r))}else{let n=await l(t.name,t.content,{description:t.description,argumentHint:t.argumentHint},`project`,e.selectedThreadId);e.setInstalledCommands(e=>new Map(e).set(t.name,n.filePath))}e.triggerExplorerRefresh(),e.loadCommands(),O({title:`Command installed`,description:`/${t.name}`})}catch(e){O({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[e.selectedThreadId,e.installedCommands,e.triggerExplorerRefresh,e.loadCommands])}function Le(){let e=(0,H.c)(7),t=a(ze),n=a(Re),{openChatDockPanel:r}=A(),{setPendingExplorerPath:i,triggerExplorerRefresh:o,setExplorerClearPath:s}=k(),c;return e[0]!==r||e[1]!==t||e[2]!==n||e[3]!==s||e[4]!==i||e[5]!==o?(c={selectedProjectId:t,selectedThreadId:n,openChatDockPanel:r,setPendingExplorerPath:i,triggerExplorerRefresh:o,setExplorerClearPath:s},e[0]=r,e[1]=t,e[2]=n,e[3]=s,e[4]=i,e[5]=o,e[6]=c):c=e[6],c}function Re(e){return e.selectedThreadId}function ze(e){return e.selectedProjectId}function Be(){let e=(0,H.c)(5),[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``),l;return e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==t?(l={showAddDialog:t,setShowAddDialog:n,deleteConfirm:r,setDeleteConfirm:i,deleting:a,setDeleting:o,availableSearch:s,setAvailableSearch:c},e[0]=s,e[1]=r,e[2]=a,e[3]=t,e[4]=l):l=e[4],l}function Ve(e,t){return e?`${e}:${t??``}`:null}function He(){let e=(0,H.c)(41),t=Le(),n=Be(),{selectedProjectId:r,selectedThreadId:i,openChatDockPanel:a,setPendingExplorerPath:o,triggerExplorerRefresh:s,setExplorerClearPath:c}=t,{showAddDialog:l,setShowAddDialog:u,deleteConfirm:d,setDeleteConfirm:f,deleting:p,setDeleting:m,availableSearch:h,setAvailableSearch:g}=n,{commands:_,loading:v,installedCommands:y,setInstalledCommands:b,loadCommands:x}=Ae(r,i),{popularCommands:S,loadingPopularCommands:C}=je(),w;e[0]!==r||e[1]!==i?(w=Ve(r,i),e[0]=r,e[1]=i,e[2]=w):w=e[2];let T;e[3]!==v||e[4]!==C?(T=[v,C],e[3]=v,e[4]=C,e[5]=T):T=e[5];let E=R(w,T),D=Pe(o,a),O;e[6]!==x||e[7]!==i||e[8]!==f||e[9]!==m||e[10]!==c||e[11]!==b||e[12]!==s?(O={selectedThreadId:i,loadCommands:x,triggerExplorerRefresh:s,setExplorerClearPath:c,setDeleting:m,setDeleteConfirm:f,setInstalledCommands:b},e[6]=x,e[7]=i,e[8]=f,e[9]=m,e[10]=c,e[11]=b,e[12]=s,e[13]=O):O=e[13];let k=Fe(O),A;e[14]!==y||e[15]!==x||e[16]!==i||e[17]!==b||e[18]!==s?(A={selectedThreadId:i,installedCommands:y,setInstalledCommands:b,triggerExplorerRefresh:s,loadCommands:x},e[14]=y,e[15]=x,e[16]=i,e[17]=b,e[18]=s,e[19]=A):A=e[19];let j=Ie(A),M;e[20]!==y||e[21]!==S?(M=Ne(S,y),e[20]=y,e[21]=S,e[22]=M):M=e[22];let N=M,P;return e[23]!==N||e[24]!==h||e[25]!==_||e[26]!==d||e[27]!==p||e[28]!==k||e[29]!==j||e[30]!==D||e[31]!==x||e[32]!==E||e[33]!==r||e[34]!==i||e[35]!==g||e[36]!==f||e[37]!==u||e[38]!==l||e[39]!==s?(P={selectedProjectId:r,selectedThreadId:i,commands:_,showAddDialog:l,setShowAddDialog:u,deleteConfirm:d,setDeleteConfirm:f,deleting:p,availableSearch:h,setAvailableSearch:g,pageLoading:E,availableCommands:N,handleDelete:k,handleOpenInExplorer:D,getCommandSubtitle:Me,handleInstallPopular:j,loadCommands:x,triggerExplorerRefresh:s},e[23]=N,e[24]=h,e[25]=_,e[26]=d,e[27]=p,e[28]=k,e[29]=j,e[30]=D,e[31]=x,e[32]=E,e[33]=r,e[34]=i,e[35]=g,e[36]=f,e[37]=u,e[38]=l,e[39]=s,e[40]=P):P=e[40],P}function Ue(){let e=(0,H.c)(63),{selectedProjectId:t,selectedThreadId:n,commands:r,showAddDialog:a,setShowAddDialog:o,deleteConfirm:s,setDeleteConfirm:c,deleting:l,availableSearch:u,setAvailableSearch:d,pageLoading:p,availableCommands:_,handleDelete:v,handleOpenInExplorer:y,getCommandSubtitle:b,handleInstallPopular:x,loadCommands:S,triggerExplorerRefresh:C}=He();if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(N,{children:`Select a project to manage slash commands.`}),e[0]=t):t=e[0],t}let w;e[1]===o?w=e[2]:(w=()=>o(!0),e[1]=o,e[2]=w);let T=!n,E;e[3]!==w||e[4]!==T?(E=(0,W.jsx)(ce,{title:`Installed Slash Commands`,tooltip:`Project slash commands you run with / in chat.`,action:(0,W.jsx)(g,{onClick:w,disabled:T,children:`Add Command`})}),e[3]=w,e[4]=T,e[5]=E):E=e[5];let D;e[6]===n?D=e[7]:(D=!n&&(0,W.jsx)(te,{children:`Select a thread to add or install slash commands.`}),e[6]=n,e[7]=D);let O;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(O={icon:ie,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`},e[8]=O):O=e[8];let k;e[9]===b?k=e[10]:(k=e=>(0,W.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,W.jsxs)(`div`,{className:f(i.body,`truncate`),children:[`/`,e.name]}),(0,W.jsx)(`div`,{className:f(i.compact,`truncate text-muted-foreground`),children:b(e)})]}),e[9]=b,e[10]=k);let A;e[11]===y?A=e[12]:(A=e=>y(e.filePath),e[11]=y,e[12]=A);let j;e[13]!==r||e[14]!==c||e[15]!==k||e[16]!==A?(j=(0,W.jsx)(se,{showHeader:!1,loading:!1,items:r,emptyState:O,getKey:Xe,columnsClassName:`grid-cols-[minmax(0,1fr)_auto_1.75rem]`,renderContent:k,renderMiddle:Ye,onItemClick:A,itemClickLabel:Je,onDelete:c,deleteAriaLabel:qe,deleteTooltip:`Remove this slash command from the project`}),e[13]=r,e[14]=c,e[15]=k,e[16]=A,e[17]=j):j=e[17];let M;e[18]!==D||e[19]!==j?(M=(0,W.jsxs)(re,{className:`pt-6`,children:[D,j]}),e[18]=D,e[19]=j,e[20]=M):M=e[20];let P;e[21]!==E||e[22]!==M?(P=(0,W.jsxs)(ee,{className:`shrink-0`,children:[E,M]}),e[21]=E,e[22]=M,e[23]=P):P=e[23];let F;e[24]!==x||e[25]!==n?(F=e=>(0,W.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100`,disabled:!n,onClick:()=>void x(e),children:`Install`}),e[24]=x,e[25]=n,e[26]=F):F=e[26];let I;e[27]!==_||e[28]!==u||e[29]!==d||e[30]!==F?(I=(0,W.jsx)(oe,{title:`Available Slash Commands`,tooltip:`Browse and install slash commands from the catalog.`,emptyLabel:`No available commands found.`,searchValue:u,onSearchChange:d,items:_,getKey:Ke,renderName:Ge,getSubtitle:We,renderAction:F}),e[27]=_,e[28]=u,e[29]=d,e[30]=F,e[31]=I):I=e[31];let L;e[32]!==p||e[33]!==I||e[34]!==P?(L=(0,W.jsxs)(ne,{loading:p,children:[P,I]}),e[32]=p,e[33]=I,e[34]=P,e[35]=L):L=e[35];let R;e[36]!==S||e[37]!==o||e[38]!==C?(R=()=>{o(!1),S(),C()},e[36]=S,e[37]=o,e[38]=C,e[39]=R):R=e[39];let z;e[40]!==t||e[41]!==n||e[42]!==R?(z=(0,W.jsx)(m,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(ke,{projectId:t,threadId:n,onCommandCreated:R})}),e[40]=t,e[41]=n,e[42]=R,e[43]=z):z=e[43];let B;e[44]!==o||e[45]!==a||e[46]!==z?(B=(0,W.jsx)(h,{open:a,onOpenChange:o,children:z}),e[44]=o,e[45]=a,e[46]=z,e[47]=B):B=e[47];let V=s!==null,U;e[48]===c?U=e[49]:(U=e=>!e&&c(null),e[48]=c,e[49]=U);let G=`Are you sure you want to delete "/${s?.name}"? This action cannot be undone.`,K;e[50]!==s||e[51]!==v?(K=()=>{s&&v(s)},e[50]=s,e[51]=v,e[52]=K):K=e[52];let q;e[53]!==l||e[54]!==V||e[55]!==U||e[56]!==G||e[57]!==K?(q=(0,W.jsx)(ae,{open:V,onOpenChange:U,title:`Delete Slash Command`,description:G,onConfirm:K,confirming:l}),e[53]=l,e[54]=V,e[55]=U,e[56]=G,e[57]=K,e[58]=q):q=e[58];let J;return e[59]!==L||e[60]!==B||e[61]!==q?(J=(0,W.jsxs)(W.Fragment,{children:[L,B,q]}),e[59]=L,e[60]=B,e[61]=q,e[62]=J):J=e[62],J}function We(e){return e.description}function Ge(e){return`/${e.name}`}function Ke(e){return e.id}function qe(e){return`Delete /${e.name}`}function Je(e){return`Open /${e.name} in Files`}function Ye(e){return e.metadata?.mode?(0,W.jsx)(`span`,{className:f(i.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,W.jsx)(`div`,{})}function Xe(e){return e.filePath}export{Ue as SettingsSlashCommandsView,Ue as default};
|