orc-ai 0.1.52 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +477 -477
- package/dist/web/assets/{Agents-DLu7phP7.js → Agents-D71JHI2H.js} +2 -2
- package/dist/web/assets/Attention-C_LKxdwf.js +2 -0
- package/dist/web/assets/{Audit-nUBNwvkU.js → Audit-BWh52YwS.js} +1 -1
- package/dist/web/assets/{ConfirmDialog-BGZ6sd6E.js → ConfirmDialog-D25Wf6Nc.js} +1 -1
- package/dist/web/assets/{Dashboard-Bhsm-LF4.js → Dashboard-DmYJjKna.js} +1 -1
- package/dist/web/assets/{DocumentWorkspace-C1HAVy0v.js → DocumentWorkspace-CW6S2i4-.js} +1 -1
- package/dist/web/assets/{ErrorState-B0KI2D4y.js → ErrorState-BoQqdsym.js} +1 -1
- package/dist/web/assets/FileEditor-_z3t0Dbd.js +1 -0
- package/dist/web/assets/JobWebhooks-Z4MXZNvH.js +1 -0
- package/dist/web/assets/Jobs-B-7i16mV.js +1 -0
- package/dist/web/assets/Knowledge-DX3nwzng.js +1 -0
- package/dist/web/assets/Markdown-BYChkZ3Z.js +2 -0
- package/dist/web/assets/{MarkdownEditor-BM9COcIb.js → MarkdownEditor-BMQq1cAY.js} +2 -2
- package/dist/web/assets/{MarkdownRenderer-C3UcCxdl.js → MarkdownRenderer-B5esWp7J.js} +96 -96
- package/dist/web/assets/PackageCatalog-CYF3tX8J.js +8 -0
- package/dist/web/assets/{PackageRunDialog-D3kvHk8o.js → PackageRunDialog-DxUs3Qnc.js} +2 -2
- package/dist/web/assets/{Pager-CMsNCI1_.js → Pager-DQCWHQWA.js} +1 -1
- package/dist/web/assets/PriorityBadge-ADp-pD5B.js +1 -0
- package/dist/web/assets/{Projects-BmfdCEv3.js → Projects-C2Ei5Q8Q.js} +2 -2
- package/dist/web/assets/QueryClientProvider-DlPztvhd.js +1 -0
- package/dist/web/assets/{RemoteFolderBrowser-ClOOMU0_.js → RemoteFolderBrowser-Btryj6gG.js} +1 -1
- package/dist/web/assets/{ResumeActions-gVze1Xjw.js → ResumeActions-1gJa3nsX.js} +1 -1
- package/dist/web/assets/{Rules-BMqF79Mt.js → Rules-CZvA-Eis.js} +4 -4
- package/dist/web/assets/ScratchpadDiagramEditor-D44NiVP_.js +159 -0
- package/dist/web/assets/Scratchpads-DP_v2hc8.js +10 -0
- package/dist/web/assets/Sessions-Ctd49sC9.js +3 -0
- package/dist/web/assets/{Settings-Dh7H43-p.js → Settings-BmbdT6Mp.js} +5 -5
- package/dist/web/assets/Skills-C_bBvy92.js +8 -0
- package/dist/web/assets/{SourceEditor-DlC3qNcT.js → SourceEditor-B5CtJBt0.js} +1 -1
- package/dist/web/assets/StatusBadge-CTFDUHuw.js +1 -0
- package/dist/web/assets/TagInput-T6rDuQ7O.js +1 -0
- package/dist/web/assets/TaskDetailSheet-BiIQ82AG.js +1 -0
- package/dist/web/assets/Tasks-OQmOaNqh.js +24 -0
- package/dist/web/assets/Terminals-DVu5OtGU.js +3 -0
- package/dist/web/assets/{ViewHeader-CX02p2eb.js → ViewHeader-DHM9SSkD.js} +1 -1
- package/dist/web/assets/{Webhooks-DUB9var7.js → Webhooks-CDNv5fUD.js} +1 -1
- package/dist/web/assets/{ar-SA-G6X2FPQ2-Br_n6QDe.js → ar-SA-G6X2FPQ2-9uLW-Aib.js} +1 -1
- package/dist/web/assets/{az-AZ-76LH7QW2-QyHk3dvA.js → az-AZ-76LH7QW2-DOqqo97y.js} +1 -1
- package/dist/web/assets/{bg-BG-XCXSNQG7-C6nlcNp_.js → bg-BG-XCXSNQG7-BHUaosi9.js} +1 -1
- package/dist/web/assets/{bn-BD-2XOGV67Q-4ptCYf5W.js → bn-BD-2XOGV67Q-_-LDSkWx.js} +1 -1
- package/dist/web/assets/button-BHKbOsmj.js +1 -0
- package/dist/web/assets/{ca-ES-6MX7JW3Y-Cgoa8y8g.js → ca-ES-6MX7JW3Y-D00wQc68.js} +1 -1
- package/dist/web/assets/{chunk-EIO257PC-D5rz2EHY.js → chunk-EIO257PC-BfeJ3EDs.js} +1 -1
- package/dist/web/assets/{client-BEiLQQ-F.js → client-BwhkVepQ.js} +1 -1
- package/dist/web/assets/{cs-CZ-2BRQDIVT-TiBX7ffm.js → cs-CZ-2BRQDIVT-EB-m3ztC.js} +1 -1
- package/dist/web/assets/{da-DK-5WZEPLOC-qeFhKopb.js → da-DK-5WZEPLOC-DWYR6cGM.js} +1 -1
- package/dist/web/assets/{de-DE-XR44H4JA-m_mVoRik.js → de-DE-XR44H4JA-Ck6sMUnJ.js} +1 -1
- package/dist/web/assets/{dist-EENe35AZ.js → dist-B9K53eWS.js} +1 -1
- package/dist/web/assets/{dist-BqZPrSfD.js → dist-ClOxCp9t.js} +1 -1
- package/dist/web/assets/{dist-C5yPNRzG.js → dist-D3PXSw6Q.js} +1 -1
- package/dist/web/assets/{dist-DcKneJwp.js → dist-HH469UWY.js} +1 -1
- package/dist/web/assets/{el-GR-BZB4AONW-BkZEWwVO.js → el-GR-BZB4AONW-DTkIqoGp.js} +1 -1
- package/dist/web/assets/{en-B4ZKOASM-DZ61I4Io.js → en-B4ZKOASM-Boq12EIA.js} +1 -1
- package/dist/web/assets/{es-ES-U4NZUMDT-N6PHqPGp.js → es-ES-U4NZUMDT-DY7ipP7c.js} +1 -1
- package/dist/web/assets/{eu-ES-A7QVB2H4-B0v57KpC.js → eu-ES-A7QVB2H4-D4Y6LEUc.js} +1 -1
- package/dist/web/assets/{fa-IR-HGAKTJCU-DRM3hyQI.js → fa-IR-HGAKTJCU-BlO1bnpc.js} +1 -1
- package/dist/web/assets/{fi-FI-Z5N7JZ37-BBhjlkHm.js → fi-FI-Z5N7JZ37-CQlPsyFJ.js} +1 -1
- package/dist/web/assets/{fr-FR-RHASNOE6-C6Ekm99g.js → fr-FR-RHASNOE6-DsyF_chP.js} +1 -1
- package/dist/web/assets/{gl-ES-HMX3MZ6V-BVrGslVP.js → gl-ES-HMX3MZ6V-BGAJPW2y.js} +1 -1
- package/dist/web/assets/{he-IL-6SHJWFNN-GiN2vY9l.js → he-IL-6SHJWFNN-BCFUF5Bi.js} +1 -1
- package/dist/web/assets/{hi-IN-IWLTKZ5I-tPRQ0szT.js → hi-IN-IWLTKZ5I-CWKeCfbn.js} +1 -1
- package/dist/web/assets/{highlighted-body-JLMTFACH-R4J_nfqS.js → highlighted-body-JLMTFACH-CYOy6uZ1.js} +1 -1
- package/dist/web/assets/{hu-HU-A5ZG7DT2-CkV1DDWQ.js → hu-HU-A5ZG7DT2-fqogn_m9.js} +1 -1
- package/dist/web/assets/{id-ID-SAP4L64H-DpzooQVd.js → id-ID-SAP4L64H-XFT4nLO5.js} +1 -1
- package/dist/web/assets/{image-GAAHSSAO-D7XRYD-a.js → image-GAAHSSAO-CtqEtsMw.js} +1 -1
- package/dist/web/assets/index-BCGI8JzG.css +1 -0
- package/dist/web/assets/{index-Ck-SDgTR.js → index-CMRGRbC9.js} +27 -28
- package/dist/web/assets/{it-IT-JPQ66NNP-C6oBozob.js → it-IT-JPQ66NNP-CjvUp5j1.js} +1 -1
- package/dist/web/assets/{ja-JP-DBVTYXUO-BG7OaLPP.js → ja-JP-DBVTYXUO-WaxwOOp1.js} +1 -1
- package/dist/web/assets/{kaa-6HZHGXH3-oYKKAQ51.js → kaa-6HZHGXH3-BABl6rMV.js} +1 -1
- package/dist/web/assets/{kab-KAB-ZGHBKWFO-B7LjxWHx.js → kab-KAB-ZGHBKWFO-vrrKDhKa.js} +1 -1
- package/dist/web/assets/{kk-KZ-P5N5QNE5-BjKAAAQx.js → kk-KZ-P5N5QNE5-DV0HT-Fa.js} +1 -1
- package/dist/web/assets/{km-KH-HSX4SM5Z-CP5JVtE5.js → km-KH-HSX4SM5Z-CMzRvYB5.js} +1 -1
- package/dist/web/assets/{ko-KR-MTYHY66A-skmsixpS.js → ko-KR-MTYHY66A-7XqecPXy.js} +1 -1
- package/dist/web/assets/{ku-TR-6OUDTVRD-BQGbWbVU.js → ku-TR-6OUDTVRD-D8O0bwyA.js} +1 -1
- package/dist/web/assets/label-BQ1Lr4sA.js +1 -0
- package/dist/web/assets/{lt-LT-XHIRWOB4-jPcUmdv0.js → lt-LT-XHIRWOB4-DrK90jMT.js} +1 -1
- package/dist/web/assets/{lv-LV-5QDEKY6T-BJimFBjM.js → lv-LV-5QDEKY6T-D7Xl2RRC.js} +1 -1
- package/dist/web/assets/mermaid-WFAXDIZX-CiFtUZlz.js +1 -0
- package/dist/web/assets/{mr-IN-CRQNXWMA-BJCZe-ef.js → mr-IN-CRQNXWMA-CjH1Q3x7.js} +1 -1
- package/dist/web/assets/{my-MM-5M5IBNSE-CzqI7mKR.js → my-MM-5M5IBNSE-CvdwmXcF.js} +1 -1
- package/dist/web/assets/{nb-NO-T6EIAALU-DOipNzcK.js → nb-NO-T6EIAALU-BWMKi1Br.js} +1 -1
- package/dist/web/assets/{nl-NL-IS3SIHDZ-m_uDUlnM.js → nl-NL-IS3SIHDZ-D5A6sC_f.js} +1 -1
- package/dist/web/assets/{nn-NO-6E72VCQL-ChLlN8eQ.js → nn-NO-6E72VCQL-D-p6QrsB.js} +1 -1
- package/dist/web/assets/{oc-FR-POXYY2M6-BJLoLhGq.js → oc-FR-POXYY2M6-6fyqLMv5.js} +1 -1
- package/dist/web/assets/{pa-IN-N4M65BXN-uYfxnmgm.js → pa-IN-N4M65BXN-D99Vs_Tb.js} +1 -1
- package/dist/web/assets/{percentages-BXMCSKIN--kwJevql.js → percentages-BXMCSKIN-B0BZzQvB.js} +1 -1
- package/dist/web/assets/{pl-PL-T2D74RX3-CDCLDsvJ.js → pl-PL-T2D74RX3-cl5WZaGT.js} +1 -1
- package/dist/web/assets/{pt-BR-5N22H2LF-CIrdrTZX.js → pt-BR-5N22H2LF-T6l12jm6.js} +1 -1
- package/dist/web/assets/{pt-PT-UZXXM6DQ-4Aps73mI.js → pt-PT-UZXXM6DQ-DnxUMvhO.js} +1 -1
- package/dist/web/assets/{ro-RO-JPDTUUEW-fgJWBuSP.js → ro-RO-JPDTUUEW-w6wCZHtR.js} +1 -1
- package/dist/web/assets/{ru-RU-B4JR7IUQ-D98t4_hW.js → ru-RU-B4JR7IUQ-DMaA4CQ-.js} +1 -1
- package/dist/web/assets/scratchpad-routes-B75DnNPp.js +1 -0
- package/dist/web/assets/scroll-area-DMjOmHf5.js +1 -0
- package/dist/web/assets/select-CBHDS40x.js +1 -0
- package/dist/web/assets/{si-LK-N5RQ5JYF-DNwP7Qip.js → si-LK-N5RQ5JYF-Coe9-5Yb.js} +1 -1
- package/dist/web/assets/{sk-SK-C5VTKIMK-BfncC8rh.js → sk-SK-C5VTKIMK-Bq23BXvP.js} +1 -1
- package/dist/web/assets/{sl-SI-NN7IZMDC-IXH265Xx.js → sl-SI-NN7IZMDC-WZEKy1qu.js} +1 -1
- package/dist/web/assets/subset-shared.chunk-CAD0Eg6H.js +1 -0
- package/dist/web/assets/{subset-worker.chunk-BNdMWEQD.js → subset-worker.chunk-CAbfOFrS.js} +1 -1
- package/dist/web/assets/{sv-SE-XGPEYMSR-CWjE7XZA.js → sv-SE-XGPEYMSR-p1gc_GrE.js} +1 -1
- package/dist/web/assets/{ta-IN-2NMHFXQM-mzDgApaO.js → ta-IN-2NMHFXQM-o8J0vNj1.js} +1 -1
- package/dist/web/assets/table-ByS-sgsb.js +1 -0
- package/dist/web/assets/tabs-DltQVo38.js +1 -0
- package/dist/web/assets/{th-TH-HPSO5L25-sCRbUk4w.js → th-TH-HPSO5L25-pt7Zt9xm.js} +1 -1
- package/dist/web/assets/{tr-TR-DEFEU3FU-BJVVhuUn.js → tr-TR-DEFEU3FU-BENdvVvp.js} +1 -1
- package/dist/web/assets/{uk-UA-QMV73CPH-CoaqtD6Z.js → uk-UA-QMV73CPH-CenI2hX1.js} +1 -1
- package/dist/web/assets/useDetailRoute-C8xQeILG.js +1 -0
- package/dist/web/assets/useJobs-CCQUWZt3.js +1 -0
- package/dist/web/assets/useKnowledge-DbjT1a0E.js +1 -0
- package/dist/web/assets/{useListSelection-DcULI867.js → useListSelection-CgpNqqAb.js} +1 -1
- package/dist/web/assets/useMemories-D0tEN20z.js +1 -0
- package/dist/web/assets/useMutation-HX90wI4L.js +1 -0
- package/dist/web/assets/useProjectScope-CZEfU9mq.js +1 -0
- package/dist/web/assets/useSessions-C2GU4FkG.js +1 -0
- package/dist/web/assets/{vi-VN-M7AON7JQ-C_1RRSxn.js → vi-VN-M7AON7JQ-REgvRLzg.js} +1 -1
- package/dist/web/assets/{view-params-DNioxw0G.js → view-params-BqRwdnv0.js} +1 -1
- package/dist/web/assets/{x-CtXhMM9g.js → x-BKorzD7S.js} +1 -1
- package/dist/web/assets/{zh-CN-LNUGB5OW-BRsIz_fP.js → zh-CN-LNUGB5OW-Ceo4z5r5.js} +1 -1
- package/dist/web/assets/{zh-HK-E62DVLB3-DwjC6Cwv.js → zh-HK-E62DVLB3-CFQOn9E1.js} +1 -1
- package/dist/web/assets/{zh-TW-RAJ6MFWO-DrD43hHv.js → zh-TW-RAJ6MFWO-GpxYPogk.js} +1 -1
- package/dist/web/index.html +16 -16
- package/package.json +1 -1
- package/dist/web/assets/Attention-D80Q2fL4.js +0 -2
- package/dist/web/assets/FileEditor-B1pLaZil.js +0 -1
- package/dist/web/assets/JobWebhooks-DIfKugwY.js +0 -1
- package/dist/web/assets/Jobs-0VP8O03Z.js +0 -1
- package/dist/web/assets/Knowledge-DCsSHLqC.js +0 -1
- package/dist/web/assets/Markdown-CenDHcGi.js +0 -2
- package/dist/web/assets/PackageCatalog-oQ9U4WEt.js +0 -8
- package/dist/web/assets/PriorityBadge-_KMVnMst.js +0 -1
- package/dist/web/assets/ScratchpadDiagramEditor-BtuYQvFc.js +0 -159
- package/dist/web/assets/Scratchpads-D98SMUv3.js +0 -10
- package/dist/web/assets/Sessions-CLDdpR36.js +0 -3
- package/dist/web/assets/Skills-B5OEYsYx.js +0 -8
- package/dist/web/assets/StatusBadge-CZQsVLgL.js +0 -1
- package/dist/web/assets/TagInput-D7ZsM-Dr.js +0 -1
- package/dist/web/assets/TaskDetailSheet-0hZx_-me.js +0 -1
- package/dist/web/assets/Tasks-c1HlLJhH.js +0 -24
- package/dist/web/assets/Terminals-DQ8HWVlI.js +0 -3
- package/dist/web/assets/button-PNx108iL.js +0 -1
- package/dist/web/assets/index-Bpb-AzH6.css +0 -1
- package/dist/web/assets/label-Ce3QFsX5.js +0 -1
- package/dist/web/assets/mermaid-WFAXDIZX-DmWpYePv.js +0 -1
- package/dist/web/assets/pencil-BPI6pWhy.js +0 -1
- package/dist/web/assets/scratchpad-routes-BwYHUs6J.js +0 -1
- package/dist/web/assets/scroll-area-Alw_ieLV.js +0 -1
- package/dist/web/assets/select-Cg0xEvji.js +0 -1
- package/dist/web/assets/subset-shared.chunk-BJl1UMhd.js +0 -1
- package/dist/web/assets/table-DC8IBMHg.js +0 -1
- package/dist/web/assets/tabs-DWq5oObc.js +0 -1
- package/dist/web/assets/trash-D7o9t0-a.js +0 -1
- package/dist/web/assets/useDetailRoute-1i4Z0-d5.js +0 -1
- package/dist/web/assets/useJobs-B2MCCWKa.js +0 -1
- package/dist/web/assets/useKnowledge-oAVI1FoA.js +0 -1
- package/dist/web/assets/useMemories-CcDhzt2Y.js +0 -1
- package/dist/web/assets/useMutation-DDLZlpLS.js +0 -1
- package/dist/web/assets/useProjectScope-C7yZQa4i.js +0 -1
- package/dist/web/assets/useSessions-Bx-Bw75y.js +0 -1
- package/dist/web/assets/utils-Q1DAuYRG.js +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScratchpadDiagramEditor-BtuYQvFc.js","assets/rolldown-runtime-DSDNlrLa.js","assets/jsx-runtime-CVMpzJz9.js","assets/button-PNx108iL.js","assets/bundle-mjs-CdK3cBzO.js","assets/utils-Q1DAuYRG.js","assets/react-dom-DTbwZiiP.js","assets/es2015-w69PgVrA.js","assets/check-hFtKhUSV.js","assets/createLucideIcon-jLuHkL03.js","assets/copy-d40YbOUX.js","assets/preload-helper-BLdHbfdN.js","assets/index-Ck-SDgTR.js","assets/useMutation-DDLZlpLS.js","assets/dist-BqZPrSfD.js","assets/dist-DcKneJwp.js","assets/x-CtXhMM9g.js","assets/dist-EENe35AZ.js","assets/select-Cg0xEvji.js","assets/dist-C5yPNRzG.js","assets/dist-Ct6061MC.js","assets/dist-D8Wfxh48.js","assets/chevron-down-D2sszSv3.js","assets/label-Ce3QFsX5.js","assets/MarkdownEditor-BM9COcIb.js","assets/Markdown-CenDHcGi.js","assets/document-display-BQ5dM8QT.js","assets/file-kind-BYU1kv95.js","assets/client-BEiLQQ-F.js","assets/bulk-actions-C8S1Gt4W.js","assets/index-Bpb-AzH6.css","assets/save-file-3ZpJah8W.js","assets/ScratchpadDiagramEditor-DtRVLazd.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,n as t}from"./rolldown-runtime-DSDNlrLa.js";import{n,t as r}from"./jsx-runtime-CVMpzJz9.js";import{t as i}from"./button-PNx108iL.js";import{t as a}from"./check-hFtKhUSV.js";import{a as o,i as s,n as c,r as l,t as u}from"./select-Cg0xEvji.js";import{t as d}from"./label-Ce3QFsX5.js";import{t as f}from"./createLucideIcon-jLuHkL03.js";import{t as p}from"./arrow-left-Czr-LF4l.js";import{a as m,c as h,i as g,l as _,n as v,o as y,r as b,s as x,t as S,u as C}from"./scratchpad-routes-BwYHUs6J.js";import{t as w}from"./download-WG9NKrMe.js";import{t as T}from"./link-2-DSYfKX_9.js";import{i as E,n as D,r as O}from"./MarkdownEditor-BM9COcIb.js";import{t as k}from"./trash-D7o9t0-a.js";import{t as A}from"./preload-helper-BLdHbfdN.js";import{a as j,n as M,r as ee}from"./client-BEiLQQ-F.js";import{n as te}from"./utils-Q1DAuYRG.js";import{At as ne,Dn as re,En as ie,Et as ae,Gt as oe,Jt as N,Kt as P,On as se,Ot as ce,Tt as le,U as F,Vt as I,Wt as ue,Yt as L,Zt as R,_t as z,an as de,kt as fe,nn as pe,qt as B,rn as me,wn as he,wt as ge,zt as _e}from"./index-Ck-SDgTR.js";import{t as ve}from"./save-file-3ZpJah8W.js";import{t as ye}from"./ConfirmDialog-BGZ6sd6E.js";import{t as be}from"./ErrorState-B0KI2D4y.js";import{t as xe}from"./ViewHeader-CX02p2eb.js";import{t as V}from"./view-params-DNioxw0G.js";import{a as Se}from"./live-sessions-D07BClP7.js";import{t as Ce}from"./EmptyState-YM4VSLR9.js";import{n as we}from"./useSessions-Bx-Bw75y.js";import{a as Te,i as H,n as Ee,o as De,r as U,t as Oe}from"./table-DC8IBMHg.js";import{t as ke}from"./DocumentWorkspace-C1HAVy0v.js";import{t as Ae}from"./TagInput-D7ZsM-Dr.js";var je={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};je.node;var Me=f(je),Ne={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};Ne.node;var Pe=f(Ne),W=[`doc`,`diagram`,`html`],Fe=_e(W),Ie={doc:{extension:`.md`,mime:`text/markdown; charset=utf-8`},diagram:{extension:`.excalidraw`,mime:`application/json; charset=utf-8`},html:{extension:`.html`,mime:`text/html; charset=utf-8`}};oe({type:ue(`excalidraw`),elements:I(N(L(),R())),appState:N(L(),R()).optional(),files:N(L(),R()).optional()});function G(e,t){return`${e.normalize(`NFKD`).replace(/[^\w\s.-]/g,``).trim().replace(/\s+/g,`-`).toLowerCase().slice(0,80)||`scratchpad`}${Ie[t].extension}`}var Le=L().trim().min(1).max(200),Re=I(L().min(1).max(64)).max(20),ze=L().min(1).max(200);B({id:L(),kind:Fe,title:L(),content:L(),project_id:L().nullable(),session_id:L().nullable(),tags:I(L()),author:L(),revision:P().int(),created_at:P().int(),updated_at:P().int()}).omit({content:!0}).extend({size_bytes:P().int()}),B({kind:Fe,title:Le,content:L().optional(),project_id:L().min(1).nullable().optional(),session_id:ze.nullable().optional(),tags:Re.optional(),author:L().min(1).max(200).optional()}).strict(),B({title:Le.optional(),content:L().optional(),project_id:L().min(1).nullable().optional(),session_id:ze.nullable().optional(),tags:Re.optional(),author:L().min(1).max(200).optional(),if_revision:P().int().min(1).optional()}).strict(),B({download_url:L().url().optional(),upload_url:L().url().optional(),filename:L(),revision:P().int(),expires_at:L().datetime()});var K=e(n(),1),q=r();function Be({draft:e,children:t}){let n=e.saving?`Saving…`:e.dirty?`Unsaved changes`:`Saved`;return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:t}),(0,q.jsx)(`span`,{"data-testid":`scratchpad-save-status`,role:`status`,className:`text-xs text-outline`,children:n}),(e.dirty||e.saving)&&(0,q.jsxs)(q.Fragment,{children:[e.stale&&(0,q.jsx)(i,{type:`button`,size:`sm`,variant:`ghost`,"data-testid":`scratchpad-overwrite`,disabled:e.saving,onClick:e.overwrite,children:`Keep mine`}),(0,q.jsx)(i,{type:`button`,size:`sm`,variant:`ghost`,"data-testid":`scratchpad-discard`,disabled:e.saving,onClick:e.discard,children:`Discard`}),(0,q.jsx)(i,{type:`button`,size:`sm`,"data-testid":`scratchpad-save`,disabled:e.saving,onClick:()=>void e.save(),children:`Save`})]})]}),e.error&&(0,q.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[e.error,` Your draft has been kept.`,e.stale&&` Discard loads their version; Keep mine lets you save over it.`]}),e.stale&&!e.error&&(0,q.jsx)(`p`,{role:`status`,className:`text-sm text-outline`,children:`This scratchpad changed elsewhere. Your draft is preserved: Discard loads their version; Keep mine lets you save over it.`})]})}function Ve({active:e,onClick:t,children:n,testId:r}){return(0,q.jsx)(`button`,{type:`button`,"data-testid":r,"aria-pressed":e,onClick:t,className:`inline-flex min-h-9 items-center gap-1.5 font-label text-sm px-3 py-1.5 border transition-colors ${e?`bg-surface-highest text-on-surface border-transparent`:`bg-transparent border-transparent text-muted-foreground hover:bg-surface-low hover:text-on-surface`}`,children:n})}function He(e){let t=x(),[n,r]=(0,K.useState)(e.content),[i,a]=(0,K.useState)({content:e.content,revision:e.revision}),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(null),u=(0,K.useRef)(e.content),d=n!==i.content;(0,K.useEffect)(()=>{e.revision<=i.revision||(e.content===i.content?a({content:e.content,revision:e.revision}):u.current===i.content&&(u.current=e.content,r(e.content),a({content:e.content,revision:e.revision})))},[e.content,e.revision,i]),(0,K.useEffect)(()=>{if(!d)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[d]);let f=(0,K.useCallback)(e=>{u.current=e,r(e)},[]);async function p(){if(!d||o)return;s(!0),l(null);let n=u.current;try{let t=await M.scratchpads.update(e.id,{content:n,if_revision:i.revision});a({content:t.content,revision:t.revision})}catch(e){l(e instanceof Error?e.message:`Could not save scratchpad`)}finally{s(!1),await t()}}function m(){a({content:e.content,revision:e.revision}),l(null)}function h(){u.current=e.content,r(e.content),a({content:e.content,revision:e.revision}),l(null)}return{draft:n,setDraft:f,dirty:d,stale:d&&e.revision!==i.revision,saving:o,error:c,save:p,overwrite:m,discard:h}}function Ue(e,t,n){if(!/^\/(?![/\\])/.test(e))return!1;let r=new URL(t,n),i=new URL(`${t}${e}`,n),a=r.pathname.replace(/\/$/,``);return i.origin===r.origin&&i.pathname.startsWith(`${a}/`)}var We=[`preview`,`code`,`split`],Ge={preview:`Preview`,code:`Code`,split:`Split`},Ke=400,qe=`allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals`,Je=`orc:fetch`,J=`orc:fetch:result`,Ye=e=>`<script>(()=>{const pending=new Map();let next=0;
|
|
3
|
-
addEventListener("message",(e)=>{const d=e.data;if(e.source!==parent||!d||d.type!=="${J}")return;
|
|
4
|
-
const p=pending.get(d.id);if(!p)return;pending.delete(d.id);
|
|
5
|
-
if(d.error)p.reject(new Error(d.error));
|
|
6
|
-
else p.resolve(new Response(d.body,{status:d.status,statusText:d.statusText,headers:d.headers}));});
|
|
7
|
-
window.orc=Object.freeze({fetch:(path,init={})=>new Promise((resolve,reject)=>{const id=++next;
|
|
8
|
-
pending.set(id,{resolve,reject});
|
|
9
|
-
parent.postMessage({type:"${Je}",nonce:"${e}",id,path:String(path),method:init.method,
|
|
10
|
-
headers:[...new Headers(init.headers)],body:init.body},"*");})});})();<\/script>`,Xe=()=>Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);function Ze(e,t){let n=Ye(t),r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}${n}${e.slice(r[0].length)}`:`${n}${e}`}function Qe(e,t){let n=e;return n?.type===Je&&n.nonce===t&&typeof n.id==`number`&&typeof n.path==`string`&&Array.isArray(n.headers)}async function $e(e,t){try{if(!Ue(t.path,j(),window.location.href))throw Error(`orc.fetch path must be an ORC API path: ${t.path}`);let n=await ee(t.path,{method:t.method,headers:t.headers,body:t.body??null}),r=await n.arrayBuffer();e.postMessage({type:J,id:t.id,status:n.status,statusText:n.statusText,headers:[...n.headers],body:r.byteLength?r:null},`*`,r.byteLength?[r]:[])}catch(n){e.postMessage({type:J,id:t.id,error:n instanceof Error?n.message:`Request failed`},`*`)}}function et({html:e,title:t,trusted:n=!1}){let r=(0,K.useRef)(null),i=(0,K.useMemo)(()=>n?Xe():``,[n,e]);return(0,K.useEffect)(()=>{if(!i)return;let e=e=>{let t=r.current?.contentWindow;t&&e.source===t&&Qe(e.data,i)&&$e(t,e.data)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[i]),(0,q.jsx)(`iframe`,{ref:r,"data-testid":`scratchpad-html-preview`,"data-trusted":n||void 0,title:`${t} preview`,sandbox:qe,referrerPolicy:`no-referrer`,srcDoc:i?Ze(e,i):e,className:`h-(--pad-height,70vh) w-full border bg-white ${n?`border-destructive`:`border-outline-variant`}`},n?`trusted`:`sandboxed`)}function tt({pad:e}){let t=He(e),[n,r]=V(`padView`,`preview`,We),[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),l=(0,K.useRef)(e.revision);(0,K.useEffect)(()=>{e.revision!==l.current&&(l.current=e.revision,e.content!==t.draft&&o(!1))},[e.revision,e.content,t.draft]);let u={...t,discard:()=>{e.content!==t.draft&&o(!1),t.discard()}},[d,f]=(0,K.useState)(t.draft);(0,K.useEffect)(()=>{let e=setTimeout(()=>f(t.draft),Ke);return()=>clearTimeout(e)},[t.draft]);let p=(0,q.jsx)(D,{path:G(e.title,`html`),value:t.draft,onChange:t.setDraft,onSave:()=>void t.save(),readOnly:t.saving,height:`var(--pad-height, 70vh)`,label:`HTML source`,testId:`scratchpad-html-source`});return(0,q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`scratchpad-html`,children:[(0,q.jsxs)(Be,{draft:u,children:[We.map(e=>(0,q.jsx)(Ve,{active:n===e,onClick:()=>r(e),testId:`scratchpad-view-${e}`,children:Ge[e]},e)),n!==`code`&&(a?(0,q.jsxs)(i,{type:`button`,size:`sm`,variant:`outline`,"data-testid":`scratchpad-html-sandbox`,onClick:()=>o(!1),children:[(0,q.jsx)(Pe,{size:12,className:`mr-1`}),` Back to sandbox`]}):(0,q.jsxs)(i,{type:`button`,size:`sm`,variant:`outline`,"data-testid":`scratchpad-html-trust`,onClick:()=>c(!0),children:[(0,q.jsx)(Me,{size:12,className:`mr-1`}),` Render with ORC access`]}))]}),a&&n!==`code`&&(0,q.jsxs)(`p`,{role:`status`,className:`text-sm text-destructive`,children:[`This page runs with ORC access: its scripts act as you and can call the API through`,` `,(0,q.jsx)(`code`,{className:`font-mono text-xs`,children:`orc.fetch()`}),`.`]}),n===`preview`?(0,q.jsx)(et,{html:d,title:e.title,trusted:a}):n===`code`?p:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 lg:grid-cols-2`,children:[(0,q.jsx)(`div`,{className:`min-w-0`,children:p}),(0,q.jsx)(et,{html:d,title:e.title,trusted:a})]}),(0,q.jsx)(ye,{open:s,title:`Render with ORC access?`,description:`The page's scripts will be able to call the ORC API as you through orc.fetch: read and change anything, including starting agents and terminals. They stay in the sandbox; the dashboard does not hand them your API secret, though API calls such as terminals can reach anything you can. Only do this for a page you trust. Access ends when you go back to the sandbox, leave the page, or someone else edits it.`,confirmLabel:`Render with access`,variant:`destructive`,onCancel:()=>c(!1),onConfirm:()=>{c(!1),o(!0)}})]})}var nt=(0,K.lazy)(()=>A(()=>import(`./ScratchpadDiagramEditor-BtuYQvFc.js`).then(e=>e.t),__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])));function rt({pad:e}){return e.kind===`doc`?(0,q.jsx)(it,{pad:e}):e.kind===`html`?(0,q.jsx)(tt,{pad:e}):(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(`div`,{role:`status`,className:`p-3 text-sm text-outline`,children:`Loading diagram editor…`}),children:(0,q.jsx)(nt,{pad:e})})}function it({pad:e}){let t=x(),n=(0,K.useRef)(e.revision);return(0,q.jsx)(ke,{documentId:`scratchpad:${e.id}`,path:G(e.title,`doc`),content:e.content,testId:`scratchpad-doc`,layout:`page`,pageTitle:e.title,onSave:async(r,i)=>{try{let t=await M.scratchpads.update(e.id,{content:r,if_revision:i===e.content?e.revision:n.current});return n.current=t.revision,r}finally{await t()}}})}var at=t({ScratchpadFormDialog:()=>$,default:()=>lt}),Y=`all`,X=`unassigned`,ot=200;function st(e,t){if(e===X)return``;for(let n of[e,t])if(n&&n!==Y&&n!==X)return n;return``}function ct(e){return new Date(e*1e3).toLocaleString()}function lt({projectId:e}){let{scratchpadId:t}=se();return t?(0,q.jsx)(mt,{id:t},t):(0,q.jsx)(dt,{defaultProjectId:e})}function ut({kind:e}){let{label:t,icon:n}=g[e];return(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-label text-xs text-muted-foreground`,children:[(0,q.jsx)(n,{size:12,"aria-hidden":!0}),` `,t]})}function dt({defaultProjectId:e}){let t=re(),n=ie(),[r,a]=V(`padProject`,Y),[d,f]=V(`padKind`,Y,[Y,...W]),[p,m]=V(`padQuery`,``),[h,y]=(0,K.useState)(p);(0,K.useEffect)(()=>y(p),[p]);let[b,x]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=new URLSearchParams(n.search);e.get(`new`)===`1`&&(x(!0),e.delete(`new`),t({search:e.toString()},{replace:!0}))},[n.search,t]);let{data:S}=z({status:`active`}),C=_({kind:d===Y?void 0:d,project_id:r===Y||r===X?void 0:r,unassigned:r===X?`true`:void 0,q:p||void 0,limit:ot}),w=C.data?.scratchpads??[],T=e=>e?S?.find(t=>t.id===e)?.name??e:`—`,E=!!p||d!==Y||r!==Y;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(xe,{title:`Scratchpads`,meta:C.data?`${C.data.total} ${C.data.total===1?`scratchpad`:`scratchpads`}`:void 0,action:(0,q.jsxs)(i,{"data-testid":`new-scratchpad-button`,size:`sm`,onClick:()=>x(!0),className:`font-label text-sm`,children:[(0,q.jsx)(de,{size:12,className:`mr-1`}),` New scratchpad`]})}),(0,q.jsxs)(`p`,{className:`mb-4 text-sm leading-relaxed text-muted-foreground`,children:[`Working docs, diagrams and HTML pages you or an agent keep and come back to. Agents create and edit them with the `,(0,q.jsx)(`code`,{className:`font-mono text-xs`,children:`pad_*`}),` tools; share one by copying its link.`]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-4`,children:[(0,q.jsxs)(u,{value:r,onValueChange:e=>a(e),children:[(0,q.jsx)(s,{"aria-label":`Project`,"data-testid":`scratchpad-project-filter`,className:`h-9 w-48 bg-background text-on-surface font-body text-sm`,children:(0,q.jsx)(o,{})}),(0,q.jsxs)(c,{className:`bg-surface border-outline-variant`,children:[(0,q.jsx)(l,{value:Y,className:`font-body text-sm`,children:`All projects`}),(0,q.jsx)(l,{value:X,className:`font-body text-sm`,children:`No project`}),S?.map(e=>(0,q.jsx)(l,{value:e.id,className:`font-body text-sm`,children:e.name},e.id))]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[Y,...W].map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e),"data-testid":`scratchpad-kind-${e}`,"aria-pressed":d===e,className:`font-label text-sm px-3 py-1.5 border transition-colors ${d===e?`bg-surface-highest text-on-surface border-transparent`:`bg-transparent border-transparent text-muted-foreground hover:bg-surface-low hover:text-on-surface`}`,children:e===Y?`All`:g[e].label},e))}),(0,q.jsxs)(`div`,{className:`relative min-w-[160px] flex-1`,children:[(0,q.jsx)(me,{size:12,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,q.jsx)(ge,{"aria-label":`Search scratchpads`,"data-testid":`scratchpad-search-input`,value:h,onChange:e=>y(e.target.value),onKeyDown:e=>e.key===`Enter`&&m(e.currentTarget.value),placeholder:`Search titles and content...`,className:`pl-8 bg-background text-on-surface font-body text-sm placeholder:text-muted-foreground`})]}),(0,q.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>m(h),className:`font-label text-sm`,children:`Search`})]}),C.error?(0,q.jsx)(be,{message:C.error.message,onRetry:()=>void C.refetch()}):C.isLoading?(0,q.jsx)(`div`,{className:`space-y-2`,children:[...[,,,,,]].map((e,t)=>(0,q.jsx)(F,{className:`h-10 w-full bg-surface-highest`},t))}):w.length===0?(0,q.jsx)(Ce,{message:E?`No scratchpads match`:`No scratchpads yet`}):(0,q.jsx)(`div`,{className:`overflow-hidden`,children:(0,q.jsxs)(Oe,{children:[(0,q.jsx)(Te,{children:(0,q.jsxs)(De,{className:`border-b border-outline-variant hover:bg-transparent`,children:[(0,q.jsx)(H,{className:`font-label text-sm text-muted-foreground`,children:`Title`}),(0,q.jsx)(H,{className:`font-label text-sm text-muted-foreground w-28`,children:`Kind`}),(0,q.jsx)(H,{className:`font-label text-sm text-muted-foreground`,children:`Project`}),(0,q.jsx)(H,{className:`font-label text-sm text-muted-foreground hidden md:table-cell`,children:`Author`}),(0,q.jsx)(H,{className:`font-label text-sm text-muted-foreground w-20 hidden md:table-cell`,children:`Size`}),(0,q.jsx)(H,{className:`font-label text-sm text-muted-foreground w-44`,children:`Updated`})]})}),(0,q.jsx)(Ee,{children:w.map(e=>(0,q.jsxs)(De,{"data-testid":`scratchpad-row`,"data-scratchpad-id":e.id,className:`border-b border-outline-variant/50 hover:bg-surface-low cursor-pointer`,onClick:()=>t(`${v(e.id)}${n.search}`),children:[(0,q.jsxs)(U,{className:`font-body text-sm font-medium text-on-surface`,children:[(0,q.jsx)(he,{to:`${v(e.id)}${n.search}`,className:`inline-flex min-h-11 items-center hover:text-primary`,onClick:e=>e.stopPropagation(),children:e.title}),e.tags.length>0&&(0,q.jsx)(`span`,{className:`ml-2 font-label text-xs text-outline`,children:e.tags.map(e=>`#${e}`).join(` `)})]}),(0,q.jsx)(U,{children:(0,q.jsx)(ut,{kind:e.kind})}),(0,q.jsx)(U,{className:`font-body text-sm text-muted-foreground`,children:T(e.project_id)}),(0,q.jsx)(U,{className:`font-body text-sm text-muted-foreground hidden md:table-cell`,children:e.author}),(0,q.jsx)(U,{className:`font-label text-sm text-muted-foreground hidden md:table-cell`,children:te(e.size_bytes)}),(0,q.jsx)(U,{className:`font-label text-sm text-muted-foreground`,children:ct(e.updated_at)})]},e.id))})]})}),b&&(0,q.jsx)($,{defaultProjectId:st(r,e),onClose:()=>x(!1),onSaved:e=>t(v(e.id))})]})}var Z=`none`,Q=`none`,ft=50;function pt(e,t,n){let r=(e??[]).filter(e=>e.session_id&&(t===Z||e.project_id===t||e.session_id===n)).sort((e,t)=>(t.last_activity_at??t.created_at).localeCompare(e.last_activity_at??e.created_at)).slice(0,ft),i=e?.find(e=>e.session_id===n);return i&&!r.includes(i)?[i,...r]:r}function $({pad:e,defaultProjectId:t=``,defaultKind:n=`doc`,onClose:r,onSaved:a}){let[f,p]=(0,K.useState)(e?.kind??n),[h,_]=(0,K.useState)(e?.title??``),[v,y]=(0,K.useState)((e?e.project_id:t)||Z),[b,x]=(0,K.useState)(e?.session_id??Q),[S,w]=(0,K.useState)(e?.tags??[]),{data:T}=z({status:`active`}),{data:E}=we(!1),D=pt(E,v,b),O=m(),k=C(),A=e?k:O;function j(){let t={title:h.trim(),project_id:v===Z?null:v,session_id:b===Q?null:b,tags:S},n=e=>{r(),a?.(e)};e?k.mutate({id:e.id,...t},{onSuccess:n}):O.mutate({kind:f,...t},{onSuccess:n})}return(0,q.jsx)(le,{open:!0,onOpenChange:e=>!e&&r(),children:(0,q.jsxs)(ae,{"data-testid":`scratchpad-form`,className:`sm:max-w-lg`,children:[(0,q.jsx)(fe,{children:(0,q.jsx)(ne,{children:e?`Scratchpad properties`:`New scratchpad`})}),(0,q.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),j()},children:[!e&&(0,q.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,q.jsx)(`legend`,{className:`font-label text-sm`,children:`Kind`}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:W.map(e=>{let{label:t,icon:n,hint:r}=g[e];return(0,q.jsxs)(`button`,{type:`button`,"data-testid":`scratchpad-form-kind-${e}`,"aria-pressed":f===e,onClick:()=>p(e),className:`flex flex-col items-start gap-1 border p-3 text-left transition-colors ${f===e?`border-primary bg-surface-low`:`border-outline-variant hover:bg-surface-low`}`,children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-label text-sm`,children:[(0,q.jsx)(n,{size:14,"aria-hidden":!0}),` `,t]}),(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]},e)})})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(d,{htmlFor:`scratchpad-title`,children:`Title`}),(0,q.jsx)(ge,{id:`scratchpad-title`,"data-testid":`scratchpad-form-title`,value:h,maxLength:200,autoFocus:!0,onChange:e=>_(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(d,{htmlFor:`scratchpad-project`,children:`Project`}),(0,q.jsxs)(u,{value:v,onValueChange:y,children:[(0,q.jsx)(s,{id:`scratchpad-project`,"data-testid":`scratchpad-form-project`,children:(0,q.jsx)(o,{})}),(0,q.jsxs)(c,{className:`bg-surface border-outline-variant`,children:[(0,q.jsx)(l,{value:Z,children:`No project`}),T?.map(e=>(0,q.jsx)(l,{value:e.id,children:e.name},e.id))]})]})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(d,{htmlFor:`scratchpad-session`,children:`Session`}),(0,q.jsxs)(u,{value:b,onValueChange:x,children:[(0,q.jsx)(s,{id:`scratchpad-session`,"data-testid":`scratchpad-form-session`,children:(0,q.jsx)(o,{})}),(0,q.jsxs)(c,{className:`bg-surface border-outline-variant`,children:[(0,q.jsx)(l,{value:Q,children:`No session`}),b!==Q&&!D.some(e=>e.session_id===b)&&(0,q.jsx)(l,{value:b,children:b.slice(0,8)}),D.map(e=>(0,q.jsxs)(l,{value:e.session_id,"data-testid":`scratchpad-form-session-option`,children:[e.agent,` · `,e.name??`Untitled session`,` ·`,` `,Se(e.last_activity_at??e.created_at)]},e.id))]})]})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(d,{children:`Tags`}),(0,q.jsx)(Ae,{value:S,onChange:w,placeholder:`Add a tag`,"aria-label":`Tags`,"data-testid":`scratchpad-form-tags`})]}),A.error&&(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:A.error.message}),(0,q.jsxs)(ce,{children:[(0,q.jsx)(i,{type:`button`,variant:`ghost`,onClick:r,children:`Cancel`}),(0,q.jsx)(i,{type:`submit`,"data-testid":`scratchpad-form-submit`,disabled:!h.trim()||A.isPending,children:e?`Save`:`Create`})]})]})]})})}function mt({id:e}){let t=re(),n=ie(),{data:r,isLoading:o,error:s,refetch:c}=h(e),{data:l}=z(),[u,d]=(0,K.useState)(!1),[f,m]=(0,K.useState)(!1),[g,_]=(0,K.useState)(`idle`),[v,x]=(0,K.useState)(!1),C=y(),D=`${S}${n.search}`;(0,K.useEffect)(()=>{if(g!==`copied`)return;let e=setTimeout(()=>_(`idle`),2e3);return()=>clearTimeout(e)},[g]),(0,K.useEffect)(()=>{if(!v)return;function e(e){e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[role="dialog"], [role="alertdialog"]`)||x(!1)}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]);async function A(){try{await navigator.clipboard.writeText(b(e)),_(`copied`)}catch{_(`failed`)}}let j=(0,q.jsxs)(he,{to:D,className:`inline-flex min-h-11 items-center gap-1.5 font-label text-sm text-muted-foreground hover:text-on-surface`,children:[(0,q.jsx)(p,{size:14,"aria-hidden":!0}),` Scratchpads`]});if(s)return(0,q.jsxs)(`div`,{children:[j,(0,q.jsx)(be,{message:s.message,onRetry:()=>void c()})]});if(o||!r)return(0,q.jsxs)(`div`,{className:`space-y-3`,children:[j,(0,q.jsx)(F,{className:`h-8 w-1/2 bg-surface-highest`}),(0,q.jsx)(F,{className:`h-64 w-full bg-surface-highest`})]});let M=r.project_id?l?.find(e=>e.id===r.project_id):void 0;return(0,q.jsxs)(`div`,{"data-testid":`scratchpad-page`,"data-scratchpad-kind":r.kind,className:`min-w-0`,children:[j,(0,q.jsxs)(`div`,{className:`mt-2 mb-4 flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsx)(`h1`,{"data-testid":`scratchpad-title`,className:`font-headline font-medium text-2xl tracking-tight text-on-surface wrap-break-word`,children:r.title}),(0,q.jsxs)(`div`,{"data-testid":`scratchpad-meta`,className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-outline`,children:[(0,q.jsx)(ut,{kind:r.kind}),(0,q.jsxs)(`span`,{children:[`revision `,r.revision]}),(0,q.jsxs)(`span`,{children:[`by `,(0,q.jsx)(`span`,{"data-testid":`scratchpad-author`,children:r.author}),`,`,` `,ct(r.updated_at)]}),(0,q.jsx)(`span`,{children:M?.name??(r.project_id?r.project_id:`No project`)}),r.session_id&&(0,q.jsxs)(`span`,{title:`Agent session that created it`,children:[`session `,(0,q.jsx)(`code`,{className:`font-mono text-xs`,children:r.session_id.slice(0,8)})]}),r.tags.length>0&&(0,q.jsx)(`span`,{children:r.tags.map(e=>`#${e}`).join(` `)})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(i,{"data-testid":`scratchpad-fullscreen`,size:`sm`,variant:`outline`,onClick:()=>x(!0),children:[(0,q.jsx)(E,{size:12,className:`mr-1`}),` Full screen`]}),(0,q.jsxs)(i,{"data-testid":`scratchpad-copy-link`,size:`sm`,variant:`outline`,onClick:()=>void A(),children:[g===`copied`?(0,q.jsx)(a,{size:12,className:`mr-1`}):(0,q.jsx)(T,{size:12,className:`mr-1`}),g===`copied`?`Copied`:`Copy link`]}),(0,q.jsxs)(i,{"data-testid":`scratchpad-download`,size:`sm`,variant:`outline`,title:`Download the saved file`,onClick:()=>ve(new Blob([r.content],{type:Ie[r.kind].mime}),G(r.title,r.kind)),children:[(0,q.jsx)(w,{size:12,className:`mr-1`}),` Download`]}),(0,q.jsxs)(i,{"data-testid":`scratchpad-properties`,size:`sm`,variant:`outline`,onClick:()=>d(!0),children:[(0,q.jsx)(pe,{size:12,className:`mr-1`}),` Properties`]}),(0,q.jsxs)(i,{"data-testid":`scratchpad-delete`,size:`sm`,variant:`outline`,onClick:()=>m(!0),children:[(0,q.jsx)(k,{size:12,className:`mr-1`}),` Delete`]})]})]}),g===`failed`&&(0,q.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:`Clipboard access failed. Copy the link from the address bar instead.`}),(0,q.jsxs)(`div`,{"data-testid":`scratchpad-stage`,"data-fullscreen":v||void 0,className:v?`fixed inset-0 z-40 flex flex-col gap-3 overflow-auto bg-background p-3 [--pad-height:calc(100dvh-8.5rem)] sm:p-4`:`min-w-0`,children:[v&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`h2`,{className:`min-w-0 flex-1 truncate font-headline text-lg font-medium text-on-surface`,children:r.title}),(0,q.jsxs)(i,{"data-testid":`scratchpad-exit-fullscreen`,size:`sm`,variant:`outline`,onClick:()=>x(!1),children:[(0,q.jsx)(O,{size:12,className:`mr-1`}),` Exit full screen`]})]}),(0,q.jsx)(rt,{pad:r})]}),u&&(0,q.jsx)($,{pad:r,onClose:()=>d(!1)}),f&&(0,q.jsx)(ye,{open:!0,title:`Delete scratchpad`,description:`Delete "${r.title}"? This cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,isPending:C.isPending,onConfirm:()=>C.mutate(r.id,{onSuccess:()=>{m(!1),t(D)}}),onCancel:()=>m(!1)}),C.error&&(0,q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-destructive`,children:C.error.message})]})}export{$ as ScratchpadFormDialog,lt as default,G as i,He as n,Be as r,at as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{l as r,t as i}from"./button-PNx108iL.js";import{n as a}from"./useMutation-DDLZlpLS.js";import{t as o}from"./label-Ce3QFsX5.js";import{i as s,l as c,n as l}from"./scratchpad-routes-BwYHUs6J.js";import{t as u}from"./link-2-DSYfKX_9.js";import{t as d}from"./pencil-BPI6pWhy.js";import{t as f}from"./Markdown-CenDHcGi.js";import{n as p}from"./client-BEiLQQ-F.js";import{At as m,Dn as h,Dt as g,Et as _,G as v,K as y,Qt as b,Tt as x,U as S,W as ee,X as C,Y as w,_t as T,fn as E,in as D,jt as O,kn as k,kt as A,l as j,pn as M,rn as te,vn as ne,wn as N,wt as P}from"./index-Ck-SDgTR.js";import{t as F}from"./ErrorState-B0KI2D4y.js";import{t as re}from"./ViewHeader-CX02p2eb.js";import{a as I,c as L,i as R,n as z,t as B}from"./live-sessions-D07BClP7.js";import{t as V}from"./EmptyState-YM4VSLR9.js";import{t as ie}from"./Pager-CMsNCI1_.js";import{a as ae,c as H,n as U,o as W,t as G}from"./useSessions-Bx-Bw75y.js";import{a as K,i as q,n as oe,o as se,r as J,t as ce}from"./table-DC8IBMHg.js";import{t as le}from"./useProjectScope-C7yZQa4i.js";import{t as ue}from"./ResumeActions-gVze1Xjw.js";import{t as de}from"./StatusBadge-CZQsVLgL.js";var Y=e(t(),1),X=n();function fe({projectId:e}){let[t]=k(),n=h(),s=r(),c=T(),[l,u]=(0,Y.useState)({key:``,offset:0}),[d,f]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[S,ee]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(``),[E,D]=(0,Y.useState)(``),[O,j]=(0,Y.useState)(e),[M,te]=(0,Y.useState)(``),[ne,N]=(0,Y.useState)(``),[F,re]=(0,Y.useState)(``),[I,L]=(0,Y.useState)(``),[R,z]=(0,Y.useState)(0),B=t.get(`q`)??``,V=t.get(`agent`)??``,ie=t.get(`ended`)!==`0`,ae=JSON.stringify([e,B,V]),H=l.key===ae?l.offset:0,U=e=>u({key:ae,offset:e}),W=a({queryKey:[`sessions`,`archive`,e,B,V,H],queryFn:()=>p.sessions.archive({q:B,...e===`all`?{}:{project_id:e},...[`claude`,`codex`].includes(V)?{agent:V}:{},offset:H,limit:20}),enabled:ie,refetchInterval:1e4}),G=a({queryKey:[`sessions`,`archive-transcript`,d?.id,d?.revision,R],queryFn:()=>p.sessions.archiveTranscript(d?.id,{revision:d?.revision,offset:R,limit:50}),enabled:!!d});async function K(e){ee(!0),w(``),D(``);try{await e(),await s.invalidateQueries({queryKey:[`sessions`]})}catch(e){w(e instanceof Error?e.message:`Request failed`)}finally{ee(!1)}}async function q(e){if(!e?.length)return;let t=c.data?.find(e=>e.id===O)?.name;t?await K(async()=>{let n=localStorage.getItem(`orc_session_upload_source`);n||(n=crypto.randomUUID(),localStorage.setItem(`orc_session_upload_source`,n));let r=0,i=[];for(let a of Array.from(e))try{if(a.size>62914560)throw Error(`File exceeds 60 MiB`);let e=await a.text(),i=e.split(/\r?\n/).filter(e=>e.trim()).map(e=>JSON.parse(e)),o=i[0]?.type===`session_meta`,s=o?i[0].payload:i.find(e=>e.sessionId),c=await p.sessions.archiveUpload({project:t,source_id:n,agent:o?`codex`:`claude`,session_id:o?s?.id:s?.sessionId,title:a.name.slice(0,200),metadata:{cwd:s?.cwd??``,subdirectory:``,...o&&s?.git?.repository_url?{repository:s.git.repository_url}:{},...o&&s?.git?.branch?{branch:s.git.branch}:{},...o&&s?.git?.commit_hash?{commit:s.git.commit_hash}:{}},bundle:{version:1,files:[{path:`session.jsonl`,content:e}]}});[`created`,`updated`,`unchanged`,`stale`].includes(c.outcome)&&r++}catch(e){i.push(`${a.name}: ${e instanceof Error?e.message:`Upload failed`}`)}D(`${r} of ${e.length} sessions synchronized${i.length?`; ${i.length} need attention`:``}.`),i.length&&w(i.join(`
|
|
2
|
-
`))}):w(`Select a project before uploading`)}return ie?(0,X.jsxs)(`section`,{className:`mt-8 space-y-3`,"data-testid":`session-archive`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-medium`,children:`Archived sessions`}),(0,X.jsx)(`p`,{className:`text-xs text-outline`,children:`Uploaded history stays available after the source computer is offline.`})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(i,{variant:`outline`,"data-testid":`archive-index`,disabled:S,onClick:()=>void K(async()=>{let t=await p.sessions.archiveIndex(e===`all`||e===`unassigned`?void 0:e);D(`${t.indexed} sessions indexed; ${t.failed} failed; ${t.skipped} skipped.`)}),children:`Index discovered sessions`}),(0,X.jsx)(i,{"data-testid":`archive-upload-open`,onClick:()=>{j(e),y(!0)},children:`Upload sessions`})]})]}),E&&(0,X.jsx)(`p`,{role:`status`,"data-testid":`archive-feedback`,className:`text-sm`,children:E}),(C||W.error)&&(0,X.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap text-sm text-error`,children:C||W.error?.message}),W.data?.degraded&&(0,X.jsx)(`p`,{role:`status`,"data-testid":`archive-degraded`,className:`text-xs text-outline`,children:W.data.degraded}),!!W.data?.pending_chunks&&(0,X.jsxs)(`p`,{className:`text-xs text-outline`,children:[W.data.pending_chunks,` passages waiting for embeddings`]}),(0,X.jsxs)(`div`,{className:`divide-y divide-outline-variant rounded border border-outline-variant`,children:[W.isLoading&&(0,X.jsx)(`p`,{className:`p-4 text-sm`,children:`Loading archived sessions…`}),!W.isLoading&&!W.data?.sessions.length&&(0,X.jsx)(`p`,{className:`p-4 text-sm text-outline`,children:`No archived sessions match this view.`}),W.data?.sessions.map(e=>(0,X.jsxs)(`button`,{type:`button`,"data-testid":`archive-session-row`,"data-archive-id":e.id,className:`block w-full p-3 text-left hover:bg-surface-container`,onClick:()=>{f(e),z(0),te(e.metadata.repository??``),N(e.metadata.branch??``),re(e.metadata.commit??``),L(e.metadata.subdirectory)},children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium`,children:e.title}),(0,X.jsxs)(`span`,{className:`text-xs text-outline`,children:[e.agent,` · ended · `,new Date(e.updated_at).toLocaleString(),` · revision`,` `,e.revision,` · `,e.metadata.cwd]}),e.passages.map(e=>(0,X.jsx)(`span`,{className:`mt-1 block text-sm text-outline`,children:e.snippet},e.citation)),e.embedding_error&&(0,X.jsx)(`span`,{className:`block text-xs text-error`,children:e.embedding_error})]},e.id))]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,X.jsx)(i,{variant:`ghost`,disabled:H===0,onClick:()=>U(Math.max(0,H-20)),children:`Previous`}),(0,X.jsx)(i,{variant:`ghost`,disabled:!W.data?.has_more,onClick:()=>U(H+20),children:`Next`})]}),(0,X.jsx)(x,{open:v,onOpenChange:y,children:(0,X.jsxs)(_,{children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(m,{children:`Upload session histories`}),(0,X.jsx)(g,{children:`Select an existing project and native Claude/Codex JSONL files. This stores history without starting a terminal. For large collections, use the orc-platform sync script.`})]}),(0,X.jsx)(o,{htmlFor:`archive-project`,children:`Project`}),(0,X.jsxs)(`select`,{id:`archive-project`,"data-testid":`archive-project`,value:O,onChange:e=>j(e.target.value),className:`rounded border border-outline-variant bg-surface p-2`,children:[(0,X.jsx)(`option`,{value:`all`,children:`Select a project`}),c.data?.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,X.jsx)(P,{"data-testid":`archive-files`,type:`file`,multiple:!0,accept:`.jsonl`,disabled:S||!c.data?.some(e=>e.id===O),onChange:e=>void q(e.target.files)}),S&&(0,X.jsx)(`p`,{role:`status`,children:`Uploading…`}),E&&(0,X.jsx)(`p`,{role:`status`,"data-testid":`archive-upload-feedback`,children:E}),C&&(0,X.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap text-sm text-error`,children:C})]})}),(0,X.jsx)(x,{open:!!d,onOpenChange:e=>{e||f(null)},children:(0,X.jsxs)(_,{className:`max-h-[90vh] max-w-3xl overflow-y-auto`,"data-testid":`archive-detail`,children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(m,{children:d?.title}),(0,X.jsxs)(g,{children:[`Archived history · revision `,d?.revision,`. Prepare a destination checkout to continue in a terminal.`]})]}),G.error&&(0,X.jsx)(`p`,{role:`alert`,children:G.error.message}),G.data?.turns.map(e=>(0,X.jsxs)(`div`,{className:`border-b border-outline-variant py-2`,"data-testid":`archive-turn`,children:[(0,X.jsx)(`p`,{className:`text-xs text-outline`,children:e.role}),(0,X.jsx)(b,{plain:!0,children:e.blocks.map(e=>e.type===`tool_use`?`${e.name}\n${e.input}\n${e.result??``}`:e.text).join(`
|
|
3
|
-
`)})]},e.index)),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(i,{variant:`ghost`,disabled:!R,onClick:()=>z(Math.max(0,R-50)),children:`Previous messages`}),(0,X.jsx)(i,{variant:`ghost`,disabled:R+50>=(G.data?.total??0),onClick:()=>z(R+50),children:`Next messages`})]}),(0,X.jsxs)(`div`,{className:`space-y-2 border-t border-outline-variant pt-3`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium`,children:`Continue on ORC`}),(0,X.jsx)(`p`,{className:`text-xs text-outline`,children:`Use the pushed repository, branch and exact commit for the work you want to continue. The destination project must have its repository configured.`}),(0,X.jsx)(o,{htmlFor:`archive-repository`,children:`Repository`}),(0,X.jsx)(P,{id:`archive-repository`,"data-testid":`archive-repository`,value:M,onChange:e=>te(e.target.value)}),(0,X.jsx)(o,{htmlFor:`archive-branch`,children:`Branch`}),(0,X.jsx)(P,{id:`archive-branch`,"data-testid":`archive-branch`,value:ne,onChange:e=>N(e.target.value)}),(0,X.jsx)(o,{htmlFor:`archive-commit`,children:`Pushed commit`}),(0,X.jsx)(P,{id:`archive-commit`,"data-testid":`archive-commit`,value:F,onChange:e=>re(e.target.value)}),(0,X.jsx)(o,{htmlFor:`archive-subdirectory`,children:`Repository subdirectory`}),(0,X.jsx)(P,{id:`archive-subdirectory`,"data-testid":`archive-subdirectory`,value:I,onChange:e=>L(e.target.value),placeholder:`Repository root`}),(0,X.jsx)(i,{"data-testid":`archive-resume`,disabled:S||!M||!ne||!/^[a-f0-9]{40}$/i.test(F),onClick:()=>void K(async()=>{if(!d)return;let e=await p.sessions.archiveResume(d.id,{revision:d.revision,repository:M,branch:ne,commit:F,subdirectory:I});if(e.status!==`ready`||!e.live_session_id)throw Error(e.error||`Session preparation failed`);let t=await p.terminals.create({kind:d.agent,live_session_id:e.live_session_id});n(`/terminals/${t.id}`)}),children:S?`Preparing…`:`Prepare and resume in terminal`}),C&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:C})]})]})})]}):null}function Z({text:e,query:t}){let n=t.trim();if(n.length<2)return(0,X.jsx)(X.Fragment,{children:e});let r=e.split(RegExp(`(${z(n)})`,`gi`));return(0,X.jsx)(X.Fragment,{children:r.map((e,t)=>e.toLowerCase()===n.toLowerCase()?(0,X.jsx)(`mark`,{className:`bg-primary/30 text-on-surface rounded-xs`,children:e},t):e)})}function pe({projectId:e,pending:t,onSelect:n}){let[r,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),d=a({queryKey:[`tasks`,`session-picker`,e],queryFn:()=>p.tasks.list({...e?{project_id:e}:{},limit:100})});async function f(e){u(null);try{await n(e)}catch(e){u(e instanceof Error?e.message:`Could not link task`)}}async function m(){c(!0),u(null);try{await f((await p.tasks.get(r.trim())).id)}catch(e){u(e instanceof Error?e.message:`Task lookup failed`)}finally{c(!1)}}let h=(d.data?.tasks??[]).filter(e=>`${e.title} ${e.id}`.toLowerCase().includes(r.trim().toLowerCase()));return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(P,{"data-testid":`session-task-search`,"aria-label":`Search tasks or enter a task ID`,value:r,onChange:e=>{o(e.target.value),u(null)},placeholder:`Search recent tasks or paste a task ID`}),(0,X.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Up to 100 recent tasks`,e?` in this project`:` across projects`,`. Older or other-project tasks can be linked by exact ID.`]}),l&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:l}),d.error?(0,X.jsx)(F,{message:d.error.message,onRetry:()=>d.refetch()}):d.isLoading?(0,X.jsx)(`p`,{role:`status`,children:`Loading tasks…`}):(0,X.jsxs)(`div`,{className:`max-h-72 overflow-y-auto divide-y divide-border`,children:[h.map(e=>(0,X.jsxs)(`button`,{type:`button`,"data-testid":`session-task-option`,"data-task-id":e.id,disabled:t||s,onClick:()=>void f(e.id),className:`w-full min-h-11 py-2 text-left hover:bg-surface-highest disabled:opacity-50`,children:[(0,X.jsx)(`span`,{className:`block text-sm wrap-break-word`,children:e.title}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs text-outline`,children:[(0,X.jsx)(de,{status:e.status,className:`px-0`}),e.id]})]},e.id)),h.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-sm text-outline`,children:`No recent task matches. Paste its exact ID to look it up.`})]}),r.trim()&&(0,X.jsx)(i,{variant:`outline`,disabled:t||s,onClick:()=>void m(),children:s?`Looking up…`:`Link by exact ID`})]})}function me({session:e,linkTestId:t=`open-task`}){let[n]=k(),[r,a]=(0,Y.useState)(!1),o=G(),s=n.get(`project`)??e.project_id;async function c(t){try{await o.mutateAsync({id:e.id,taskId:t}),a(!1)}catch{}}return(0,X.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[e.task&&(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(N,{"data-testid":t,to:L(`/tasks/${e.task.id}`,s),className:`block max-w-64 truncate text-sm text-primary hover:underline`,title:e.task.title,children:e.task.title}),(0,X.jsx)(de,{status:e.task.status,className:`px-0`})]}),(0,X.jsxs)(x,{open:r,onOpenChange:e=>{a(e),e&&o.reset()},children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-testid":`link-task`,className:`inline-flex min-h-9 items-center gap-1.5 text-xs text-outline hover:text-on-surface`,children:[e.task?(0,X.jsx)(d,{size:12}):(0,X.jsx)(u,{size:13}),e.task?`Change task`:`Link task`]})}),(0,X.jsxs)(_,{"data-testid":`session-task-dialog`,className:`max-h-[85dvh] w-[calc(100%-2rem)] overflow-y-auto`,children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(m,{children:`Link a task`}),(0,X.jsxs)(g,{children:[`Choose a recent task for `,e.name??`this session`,`, or paste an exact task ID.`]})]}),o.error&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:o.error.message}),(0,X.jsx)(pe,{projectId:e.project_id,pending:o.isPending,onSelect:c}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.task&&(0,X.jsx)(i,{variant:`outline`,"data-testid":`session-task-unlink`,disabled:o.isPending,onClick:()=>void c(null),children:`Unlink task`})})]})]})]})}function he({session:e}){let[t]=k(),{data:n}=c({session_id:e.session_id??void 0,limit:20},{enabled:!!e.session_id}),r=n?.scratchpads??[];if(r.length===0)return null;let i=t.get(`project`)??e.project_id;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,"data-testid":`session-scratchpads`,children:[(0,X.jsx)(`span`,{className:`text-on-surface-variant`,children:`scratchpads`}),r.map(e=>{let t=s[e.kind].icon;return(0,X.jsxs)(N,{to:L(l(e.id),i),"data-testid":`session-scratchpad-link`,className:`inline-flex max-w-56 items-center gap-1 text-primary hover:underline`,title:e.title,children:[(0,X.jsx)(t,{size:12,"aria-hidden":!0,className:`shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id)})]})}var ge=`session-search`,_e={user:`border-border/65`,assistant:`border-border/65`,tool:`border-border/65 bg-transparent`,system:`border-border/65 bg-transparent`},ve=[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`];function ye(e){try{let t=JSON.parse(e);for(let e of ve)if(typeof t[e]==`string`)return t[e]}catch{}return e}function be(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function xe(e,t,n){(0,Y.useEffect)(()=>{let n=e.current,r=CSS.highlights,i=window.Highlight;if(!n||!r||!i)return;let a=t.trim().toLowerCase(),o=()=>{if(r.delete(ge),a.length<2)return;let e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let n=t.nextNode();n;n=t.nextNode()){let t=n.textContent?.toLowerCase()??``;for(let r=t.indexOf(a);r>=0;r=t.indexOf(a,r+a.length)){let t=new Range;t.setStart(n,r),t.setEnd(n,r+a.length),e.push(t)}}e.length>0&&r.set(ge,new i(...e))};o();let s,c=new MutationObserver(()=>{clearTimeout(s),s=setTimeout(o,150)});return c.observe(n,{childList:!0,subtree:!0,characterData:!0}),()=>{clearTimeout(s),c.disconnect(),r.delete(ge)}},[e,t,n])}function Se({block:e,open:t}){let n=e.result!==void 0;return(0,X.jsxs)(`details`,{open:t||void 0,"data-testid":`tool-box`,className:`border-l border-border bg-background`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer items-center gap-2 px-2 py-1.5 font-label text-xs font-medium text-outline hover:text-on-surface`,children:[(0,X.jsx)(`span`,{className:`text-secondary shrink-0`,children:e.name}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono normal-case tracking-normal text-on-surface-variant`,children:ye(e.input)}),(0,X.jsx)(`span`,{className:`shrink-0 ${n?`text-outline`:`text-tertiary`}`,children:n?`done`:`no result`})]}),(0,X.jsxs)(`div`,{className:`space-y-2 border-t border-border px-2 py-2`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:`input`}),(0,X.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-lg bg-background p-2 font-mono text-xs text-on-surface-variant whitespace-pre-wrap wrap-break-word`,children:be(e.input)}),n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:`result`}),(0,X.jsx)(`pre`,{className:`max-h-96 overflow-auto rounded-lg bg-background p-2 font-mono text-xs text-on-surface-variant whitespace-pre-wrap wrap-break-word`,children:e.result})]})]})]})}function Ce({block:e,matched:t}){if(e.type===`text`)return(0,X.jsx)(b,{revealContext:t,children:e.text});if(e.type===`tool_use`)return(0,X.jsx)(Se,{block:e,open:t});let n=e.type===`thinking`?`thinking`:`result`;return(0,X.jsxs)(`details`,{open:t||void 0,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer font-label text-xs font-medium text-outline hover:text-on-surface`,children:n}),e.type===`thinking`?(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(f,{children:e.text})}):(0,X.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto rounded-lg bg-background p-2 font-mono text-xs text-on-surface-variant whitespace-pre-wrap wrap-break-word`,children:e.text})]})}function we({sessionId:e,initialQuery:t,onClose:n}){let[r,i]=(0,Y.useState)(t),[a,o]=(0,Y.useState)(0),{data:s}=U(!1),c=s?.find(t=>t.id===e),l=c!==void 0&&c.status!==`stopped`,u=r.trim().length>=2?r.trim():``,{data:d,isLoading:f,isFetching:p,error:m,refetch:h,dataUpdatedAt:g}=H(e,u),_=(0,Y.useRef)(null),b=(0,Y.useRef)(null),x=(0,Y.useRef)(!0),T=(0,Y.useRef)(0),[O,k]=(0,Y.useState)(!0),A=(0,Y.useCallback)(()=>{let e=_.current;e&&(e.scrollTo({top:e.scrollHeight}),requestAnimationFrame(()=>e.scrollTo({top:e.scrollHeight})))},[]);xe(b,u,d?.turns);let j=d?.matches??[],N=j[a];(0,Y.useEffect)(()=>{d&&(N===void 0?x.current&&A():(x.current=!1,document.getElementById(`turn-${N}`)?.scrollIntoView({block:`center`})))},[N,d,A]),(0,Y.useEffect)(()=>{d&&O&&(T.current=d.total)},[d,O]);let P=e=>{j.length>0&&o(t=>(t+e+j.length)%j.length)};return(0,X.jsx)(ee,{open:!!e,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(y,{side:`right`,defaultWidth:1100,resizeKey:`live-session`,"data-testid":`live-session-detail`,children:[(0,X.jsxs)(w,{children:[(0,X.jsx)(C,{className:`normal-case tracking-normal text-sm pr-8`,children:c?.name??`Session`}),c&&(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-1 font-body text-xs text-on-surface tabular-nums`,children:[(0,X.jsx)(`span`,{className:`font-medium text-primary`,children:c.agent}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`h-2 w-2 rounded-full ${B[c.status].dot}`}),B[c.status].label]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-on-surface-variant`,children:`tokens `}),R(c)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-on-surface-variant`,children:`active `}),I(c.last_activity_at)]}),(0,X.jsx)(me,{session:c,linkTestId:`detail-open-task`}),(0,X.jsx)(ue,{session:c}),(0,X.jsx)(he,{session:c}),(0,X.jsx)(`span`,{className:`truncate max-w-full text-on-surface-variant`,children:c.cwd})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-[150px] flex-1`,children:[(0,X.jsx)(te,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-outline`}),(0,X.jsx)(`input`,{"data-testid":`transcript-search`,"aria-label":`Search this session`,value:r,onChange:e=>{i(e.target.value),o(0)},placeholder:`Search this session`,className:`w-full bg-background border border-control-border rounded-lg min-h-11 pl-7 pr-2 py-2 font-body text-xs text-on-surface`})]}),u&&(0,X.jsx)(`span`,{"data-testid":`transcript-match-count`,className:`font-label text-xs font-medium text-outline`,children:j.length===0?`no matches`:`${a+1} / ${j.length}`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Previous match`,onClick:()=>P(-1),className:`min-h-11 min-w-11 p-2 text-outline hover:text-on-surface`,children:(0,X.jsx)(M,{className:`h-4 w-4`})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Next match`,onClick:()=>P(1),className:`min-h-11 min-w-11 p-2 text-outline hover:text-on-surface`,children:(0,X.jsx)(E,{className:`h-4 w-4`})}),(0,X.jsxs)(`button`,{type:`button`,"data-testid":`transcript-refresh`,onClick:()=>{x.current=!0,h()},className:`min-h-11 px-2 inline-flex items-center gap-1 font-label text-xs font-medium text-primary hover:text-on-surface`,children:[(0,X.jsx)(D,{className:`h-3 w-3 ${p?`animate-spin`:``}`}),`Refresh`]})]}),d&&(0,X.jsxs)(`div`,{"data-testid":`transcript-status`,className:`mt-2 font-body text-xs text-on-surface-variant tabular-nums`,children:[d.total,` turns`,l?` · live, updated ${new Date(g).toLocaleTimeString()}`:``]})]}),(0,X.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(v,{ref:_,onScroll:e=>{let t=e.currentTarget,n=t.scrollHeight-t.scrollTop-t.clientHeight<160;x.current=n,k(n)},children:f?(0,X.jsx)(`div`,{className:`space-y-4`,children:[...[,,,,,]].map((e,t)=>(0,X.jsx)(S,{className:`h-16 w-full bg-surface-highest`},t))}):m||!d?(0,X.jsxs)(`div`,{"data-testid":`transcript-unavailable`,className:`font-body text-xs text-outline py-12 text-center`,children:[m?`Could not load the conversation: ${m.message}`:`No conversation was recorded for this session.`,(0,X.jsx)(`p`,{className:`mt-2`,children:`Resume actions remain available when the native agent session exists.`}),(0,X.jsx)(`button`,{type:`button`,className:`mt-3 min-h-11 text-primary hover:underline`,onClick:()=>h(),children:`Retry conversation`})]}):(0,X.jsx)(`div`,{ref:b,className:`space-y-3`,children:d.turns.map(e=>{let t=j.includes(e.index),n=e.blocks.map((e,n)=>(0,X.jsx)(Ce,{block:e,matched:t},n));return(0,X.jsxs)(`div`,{id:`turn-${e.index}`,"data-testid":`transcript-turn`,"data-role":e.role,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 120px`},className:`border-b px-4 py-3 text-on-surface space-y-2 ${_e[e.role]} ${e.index===N?`ring-1 ring-primary`:``}`,children:[(0,X.jsxs)(`div`,{className:`font-label text-xs font-medium text-outline`,children:[e.role,e.time?` · ${I(e.time)}`:``]}),e.role===`system`?(0,X.jsxs)(`details`,{open:t||void 0,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer font-label text-xs font-medium text-outline hover:text-on-surface`,children:`injected context`}),(0,X.jsx)(`div`,{className:`mt-2 space-y-2`,children:n})]}):n]},e.index)})})}),d&&!O&&(0,X.jsxs)(`button`,{type:`button`,"data-testid":`jump-to-latest`,onClick:()=>{x.current=!0,A()},className:`absolute bottom-4 right-6 inline-flex items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-1.5 font-body text-xs text-primary shadow-lg hover:bg-surface-bright`,children:[(0,X.jsx)(ne,{className:`h-3.5 w-3.5`}),`Jump to latest`,d.total>T.current&&` · ${d.total-T.current} new`]})]})]})})}var Te=[`claude`,`codex`,`cursor`,`cursor-agent`,`gemini`],Q=25,$=`font-label text-xs font-medium text-outline`;function Ee({projectId:e}){let t=j(`sm`),[n,r]=k(),i=n.get(`agent`)??``,a=n.get(`ended`)!==`0`,o=n.get(`q`)??``,s=n.get(`order`)===`asc`?`asc`:`desc`,c=n.get(`session`),[l,u]=(0,Y.useState)(o),[d,f]=(0,Y.useState)({order:s,page:0}),p=d.order===s?d.page:0,m=(0,Y.useCallback)(e=>f({order:s,page:e}),[s]),h=(0,Y.useCallback)((e,t)=>{m(0),r(n=>{let r=new URLSearchParams(n);return t?r.set(e,t):r.delete(e),r},{replace:e===`q`})},[r,m]);(0,Y.useEffect)(()=>u(o),[o]),(0,Y.useEffect)(()=>{if(l===o)return;let e=setTimeout(()=>h(`q`,l.trim()||null),350);return()=>clearTimeout(e)},[l,o,h]);let g=o.trim().length>=2,_=U(!a),v=ae(g?o.trim():``,i),{data:y}=T(),b=W(),x=new Map((y??[]).map(e=>[e.id,e.name])),S=g?v.data?.hits??[]:_.data??[],ee=[...new Set([...Te,...S.map(e=>e.agent)])],C=g?v.isLoading:_.isLoading,w=g?v:_,E=S.filter(e=>(!i||e.agent===i)&&(a||e.status!==`stopped`||e.handoff?.status===`ready`)),O=E.filter(t=>e===`all`?!0:e===`unassigned`?t.project_id===null:t.project_id===e).sort((e,t)=>{let n=new Date(e.last_activity_at??e.created_at).getTime()-new Date(t.last_activity_at??t.created_at).getTime()||e.id.localeCompare(t.id);return s===`asc`?n:-n}),A=Math.min(p,Math.max(0,Math.ceil(O.length/Q)-1))*Q,M=e===`unassigned`?`unassigned`:x.get(e)??e;return(0,X.jsxs)(`section`,{className:`mb-8`,"data-testid":`live-sessions`,children:[(0,X.jsx)(`p`,{className:`mb-4 text-sm text-outline`,children:`Discovered from your coding agents. Working sessions update automatically; waiting sessions remain available to resume.`}),(0,X.jsxs)(`div`,{className:`mb-3 relative`,children:[(0,X.jsx)(te,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-outline`}),(0,X.jsx)(`input`,{"data-testid":`session-search`,"aria-label":`Search agent sessions`,value:l,onChange:e=>u(e.target.value),placeholder:`Search agent sessions: titles, summaries and conversation text`,className:`w-full bg-background border border-control-border rounded-lg pl-9 pr-3 py-2 font-body text-xs text-on-surface placeholder:text-outline`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 mb-4`,children:[(0,X.jsxs)(`h2`,{className:`font-label text-xs font-medium text-outline`,children:[g?`Search results`:`Agent sessions`,` · `,O.length,O.length!==E.length&&(0,X.jsxs)(`span`,{"data-testid":`scope-hint`,className:`normal-case tracking-normal`,children:[` `,`of `,E.length,` · scope: `,M]}),g&&v.data&&(0,X.jsxs)(`span`,{"data-testid":`search-meta`,className:`normal-case tracking-normal`,children:[` `,`· `,(v.data.ms/1e3).toFixed(1),`s`,v.data.rg?``:` · titles and summaries only (install ripgrep for content)`]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsxs)(`select`,{"aria-label":`Sort sessions by date`,"data-testid":`session-date-sort`,value:s,onChange:e=>h(`order`,e.target.value===`asc`?`asc`:null),className:`min-h-11 rounded-md border border-control-border bg-background px-3 text-sm text-on-surface`,children:[(0,X.jsx)(`option`,{value:`desc`,children:`Last active: newest first`}),(0,X.jsx)(`option`,{value:`asc`,children:`Last active: oldest first`})]}),(0,X.jsxs)(`select`,{"data-testid":`agent-filter`,"aria-label":`Agent`,className:`bg-background border border-control-border rounded-lg min-h-11 px-3 py-2 font-label text-xs font-medium text-on-surface`,value:i,onChange:e=>h(`agent`,e.target.value||null),children:[(0,X.jsx)(`option`,{value:``,children:`all agents`}),ee.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]}),(0,X.jsxs)(`label`,{className:`flex items-center gap-2 font-label text-xs font-medium text-outline cursor-pointer`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`show-ended`,checked:a,onChange:e=>h(`ended`,e.target.checked?`1`:`0`)}),`Show ended`]}),(0,X.jsxs)(`button`,{type:`button`,"data-testid":`sync-sessions`,disabled:b.isPending,className:`min-h-11 px-2 inline-flex items-center gap-1 font-label text-xs font-medium text-primary hover:text-on-surface disabled:opacity-50`,onClick:()=>b.mutate(),children:[(0,X.jsx)(D,{className:`h-3 w-3 ${b.isPending?`animate-spin`:``}`}),b.isPending?`Syncing`:`Refresh`]})]})]}),b.error&&(0,X.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-error`,children:b.error.message}),w.error?(0,X.jsx)(F,{message:w.error.message,onRetry:()=>w.refetch()}):C?(0,X.jsx)(`p`,{role:`status`,className:`py-8 text-sm text-outline`,children:`Loading sessions…`}):O.length===0?(0,X.jsx)(V,{message:g?`No sessions match`:`No active agent sessions. Enable Show ended to browse previous conversations.`}):(0,X.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[t?(0,X.jsxs)(ce,{children:[(0,X.jsx)(K,{children:(0,X.jsxs)(se,{className:`border-b border-border hover:bg-transparent`,children:[(0,X.jsx)(q,{className:`${$} w-40`,children:`Status`}),(0,X.jsx)(q,{className:`${$} w-20`,children:`Agent`}),(0,X.jsx)(q,{className:$,children:`Session`}),(0,X.jsx)(q,{className:`${$} w-28`,children:`Project`}),(0,X.jsx)(q,{className:`${$} w-20 text-right`,children:`Tokens`}),(0,X.jsx)(q,{className:`${$} w-36`,children:`Last active`}),(0,X.jsx)(q,{className:`${$} w-56`,children:`Task`}),(0,X.jsx)(q,{className:`${$} w-24`})]})}),(0,X.jsx)(oe,{children:O.slice(A,A+Q).map(e=>{let t=B[e.status];return(0,X.jsxs)(se,{"data-testid":`live-session-row`,"data-session-id":e.session_id,"data-agent":e.agent,className:`border-b border-border/65 cursor-pointer hover:bg-surface-high`,onClick:t=>{t.target.closest(`button, a, input, [role='dialog']`)||h(`session`,e.id)},children:[(0,X.jsx)(J,{className:`font-label text-xs text-on-surface`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-testid":`live-status`,children:[(0,X.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t.dot}`}),e.handoff?.status===`ready`?`Ready`:t.label]})}),(0,X.jsx)(J,{className:`font-label text-xs font-medium text-primary`,children:e.agent}),(0,X.jsxs)(J,{className:`max-w-md`,children:[(0,X.jsx)(`button`,{type:`button`,className:`block max-w-full text-left font-body text-sm font-medium text-on-surface truncate hover:text-primary`,onClick:t=>{t.stopPropagation(),h(`session`,e.id)},children:(0,X.jsx)(Z,{text:e.name??`Untitled session`,query:g?o:``})}),e.summary&&e.summary!==e.name&&(0,X.jsx)(`div`,{className:`font-body text-xs text-outline truncate`,title:e.summary,children:(0,X.jsx)(Z,{text:e.summary,query:g?o:``})}),e.snippets?.map(e=>(0,X.jsx)(`div`,{"data-testid":`search-snippet`,className:`font-mono text-xs text-on-surface-variant truncate`,title:e,children:(0,X.jsx)(Z,{text:e,query:o})},e)),(0,X.jsx)(`div`,{className:`font-label text-xs text-outline truncate`,title:e.cwd??void 0,children:e.cwd??``})]}),(0,X.jsx)(J,{className:`font-label text-xs text-outline`,children:e.project_id&&x.get(e.project_id)||`—`}),(0,X.jsx)(J,{"data-testid":`live-tokens`,className:`font-body text-xs text-on-surface-variant text-right`,children:R(e)}),(0,X.jsx)(J,{className:`font-body text-xs text-on-surface-variant`,children:I(e.last_activity_at)}),(0,X.jsx)(J,{children:(0,X.jsx)(me,{session:e})}),(0,X.jsx)(J,{className:`text-right`,children:(0,X.jsx)(`div`,{className:`inline-flex items-center gap-3`,children:(0,X.jsx)(ue,{session:e})})})]},e.id)})})]}):(0,X.jsx)(`div`,{className:`divide-y divide-border`,children:O.slice(A,A+Q).map(e=>(0,X.jsxs)(`article`,{"data-testid":`live-session-row`,"data-session-id":e.session_id,"data-agent":e.agent,className:`py-4 space-y-3`,children:[(0,X.jsx)(`button`,{type:`button`,className:`text-left text-sm font-medium wrap-break-word hover:text-primary`,onClick:()=>h(`session`,e.id),children:(0,X.jsx)(Z,{text:e.name??`Untitled session`,query:g?o:``})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-outline`,children:[(0,X.jsx)(`span`,{className:`text-primary`,children:e.agent}),(0,X.jsx)(`span`,{"data-testid":`live-status`,children:e.handoff?.status===`ready`?`Ready`:B[e.status].label}),(0,X.jsxs)(`span`,{"data-testid":`live-tokens`,children:[R(e),` tokens`]}),(0,X.jsx)(`span`,{children:I(e.last_activity_at)})]}),e.summary&&(0,X.jsx)(`p`,{className:`text-sm text-outline wrap-break-word`,children:(0,X.jsx)(Z,{text:e.summary,query:g?o:``})}),e.snippets?.map(e=>(0,X.jsx)(`p`,{"data-testid":`search-snippet`,className:`text-xs wrap-break-word text-on-surface-variant`,children:(0,X.jsx)(Z,{text:e,query:o})},e)),(0,X.jsxs)(`p`,{className:`text-xs text-outline break-all`,children:[e.project_id&&x.get(e.project_id)||`Unassigned`,e.cwd?` · ${e.cwd}`:``]}),(0,X.jsx)(me,{session:e}),(0,X.jsx)(ue,{session:e})]},e.id))}),(0,X.jsx)(ie,{page:A/Q,pageSize:Q,total:O.length,onPage:m})]}),(0,X.jsx)(we,{sessionId:c,initialQuery:g?o.trim():``,onClose:()=>h(`session`,null)},c??`closed`)]})}function De({projectId:e}){let t=le(e);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(re,{title:`Sessions`}),(0,X.jsx)(Ee,{projectId:t},t),(0,X.jsx)(fe,{projectId:t},`archive-${t}`)]})}export{De as default};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{l as r,t as i}from"./button-PNx108iL.js";import{E as a,O as o,_ as s,a as c,c as l,f as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,w as ee}from"./useMutation-DDLZlpLS.js";import{t as b}from"./label-Ce3QFsX5.js";import{t as x}from"./createLucideIcon-jLuHkL03.js";import{t as te}from"./download-WG9NKrMe.js";import{t as S}from"./MarkdownEditor-BM9COcIb.js";import{n as C}from"./client-BEiLQQ-F.js";import{t as ne}from"./bulk-actions-C8S1Gt4W.js";import{At as w,Et as T,G as E,K as re,Ot as D,Tt as O,U as ie,W as k,X as ae,Y as oe,_n as se,an as ce,ct as A,dn as j,kt as M,rn as le,st as N,vn as ue,wt as P}from"./index-Ck-SDgTR.js";import{t as de}from"./ConfirmDialog-BGZ6sd6E.js";import{t as fe}from"./ErrorState-B0KI2D4y.js";import{t as pe}from"./ViewHeader-CX02p2eb.js";import{t as me}from"./useDetailRoute-1i4Z0-d5.js";import{t as F}from"./view-params-DNioxw0G.js";import{t as he}from"./EmptyState-YM4VSLR9.js";import{a as ge,i as I,n as _e,o as ve,r as L,t as ye}from"./table-DC8IBMHg.js";import{t as be}from"./useProjectScope-C7yZQa4i.js";import{n as xe,t as Se}from"./useListSelection-DcULI867.js";import{n as R,t as Ce}from"./DocumentWorkspace-C1HAVy0v.js";import{t as z}from"./primitive-files-BKGHFjYN.js";function B(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var V=class extends s{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,d.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),s=i||a,c=s?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!o(e,n)});(s||c)&&(s&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(s&&(B(e,n).forEach(e=>{e.destroy()}),B(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=a(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new u(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&d.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(t(),1);function we({queries:e,...t},n){let i=r(n),a=y(),o=p(),s=t.subscribed!==!1,m=H.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:s?`optimistic`:void 0,t}),[e,i,a,s]);m.forEach(e=>{g(e);let t=i.getQueryCache().get(e.queryHash);h(e,o,t)}),l(o);let[v]=H.useState(()=>new V(i,m,t)),[b,x,te]=v.getOptimisticResult(m,t.combine),S=!a&&s;H.useSyncExternalStore(H.useCallback(e=>S?v.subscribe(d.batchCalls(e)):ee,[v,S]),()=>v.getCurrentResult(),()=>v.getCurrentResult()),H.useEffect(()=>{v.setQueries(m,t)},[m,t,v]);let C=b.some((e,t)=>c(m[t],e))?b.flatMap((e,t)=>{let n=m[t];if(n&&c(n,e)){let e=new u(i,n);return f(n,e,o)}return[]}):[];if(C.length>0)throw Promise.all(C);let ne=b.find((e,t)=>{let n=m[t];return n&&_({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(ne)throw ne.error;return x(te())}var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=x(U),G={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};G.node;var Te=x(G),Ee={name:`toggle-right`,size:24,node:[[`circle`,{cx:`15`,cy:`12`,r:`3`,key:`1afu0r`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};Ee.node;var De=x(Ee),K=n();function Oe({files:e,selected:t,onSelect:n,testId:r=`document-file-tab`,entryTestId:i}){return(0,K.jsxs)(`nav`,{"aria-label":`Document files`,className:`min-w-0 space-y-2`,"data-testid":`document-tabs`,children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-label":`Open a file`,className:`flex max-w-full gap-1 overflow-x-auto overscroll-x-contain rounded-md border border-surface-highest p-1`,children:e.map((a,o)=>(0,K.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a===t,"data-testid":o===0&&i?i:r,"data-file-name":a,title:a,tabIndex:a===t?0:-1,onKeyDown:t=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(t.key))return;t.preventDefault();let r=o;t.key===`ArrowRight`&&(r=(o+1)%e.length),t.key===`ArrowLeft`&&(r=(o+e.length-1)%e.length),t.key===`Home`&&(r=0),t.key===`End`&&(r=e.length-1),n(e[r])!==!1&&(t.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`))?.[r]?.focus()},onClick:()=>n(a),className:`flex min-h-11 shrink-0 items-center gap-2 rounded px-3 text-sm ${a===t?`bg-surface-highest text-on-surface`:`text-muted-foreground hover:bg-surface-low hover:text-on-surface`}`,children:[(0,K.jsx)(j,{size:14,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`max-w-[180px] truncate`,children:a.split(`/`).pop()})]},a))}),(0,K.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm text-outline sm:hidden`,children:[`File`,(0,K.jsx)(`select`,{"aria-label":`Choose document file`,"data-testid":`document-file-picker`,value:t,onChange:e=>n(e.target.value),className:`min-h-11 min-w-0 flex-1 rounded border border-control-border bg-surface px-2 text-on-surface`,children:e.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]})]})}var q={new:``,installed:`Already in ORC`,conflict:`Name taken in ORC (different content)`,changed:`Changed since import`,invalid:`Invalid`},J=e=>`${e.agent}/${e.name}`;function ke({onClose:e}){let[t,n]=(0,H.useState)([]),a=r(),o=m({queryKey:[`skills`,`local-agents`],queryFn:C.skills.localAgents}),s=v({mutationFn:C.skills.importLocal,onSuccess:async t=>{n([]),await a.invalidateQueries({queryKey:[`skills`]}),t.skipped.length||e()}}),c=s.isPending,l=o.data?.agents??[],u=new Set(t.map(e=>e.split(`/`)[1])),d=(e,r)=>n(r?[...t,J(e)]:t.filter(t=>t!==J(e))),f=e=>{let r=[...t],i=new Set(u);for(let t of e)t.status!==`new`||i.has(t.name)||(r.push(J(t)),i.add(t.name));n(r)};return(0,K.jsx)(O,{open:!0,onOpenChange:t=>!t&&!c&&e(),children:(0,K.jsxs)(T,{className:`max-w-xl`,children:[(0,K.jsx)(M,{children:(0,K.jsx)(w,{children:`Import from local agents`})}),(0,K.jsx)(`p`,{className:`text-xs text-outline`,children:`Copies skills from agent folders such as ~/.claude/skills and ~/.codex/skills into ORC. The originals are not changed.`}),o.isLoading&&(0,K.jsx)(`p`,{role:`status`,children:`Scanning agent folders…`}),o.data&&!l.length&&(0,K.jsx)(`p`,{role:`status`,children:`No local agent skill folders found.`}),(0,K.jsx)(`div`,{className:`max-h-[55vh] overflow-y-auto space-y-4`,children:l.map(e=>{let n=e.skills.filter(e=>e.status===`new`);return(0,K.jsxs)(`section`,{"data-testid":`local-agent`,"data-agent":e.id,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,K.jsx)(`p`,{className:`text-xs text-outline`,children:e.dir})]}),(0,K.jsxs)(i,{size:`sm`,variant:`outline`,"data-testid":`local-agent-select-all`,disabled:c||!n.length,onClick:()=>f(e.skills),children:[`Select all new (`,n.length,`)`]})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:e.skills.map(e=>{let n=t.includes(J(e)),r=!n&&u.has(e.name);return(0,K.jsxs)(`label`,{className:`flex items-start gap-3 border border-surface-highest rounded p-3`,"data-testid":`local-skill`,"data-skill-name":e.name,children:[(0,K.jsx)(`input`,{type:`checkbox`,"data-testid":`local-skill-select`,checked:n,disabled:c||e.status!==`new`||r,onChange:t=>d(e,t.target.checked)}),(0,K.jsxs)(`span`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.name}),q[e.status]&&(0,K.jsx)(`span`,{className:`ml-2 text-xs text-outline`,children:q[e.status]}),(0,K.jsx)(`span`,{className:`block text-xs text-outline`,children:e.error??e.description}),e.extra_fields.length>0&&(0,K.jsxs)(`span`,{className:`block text-xs text-outline`,"data-testid":`local-skill-extra-fields`,children:[`Extra fields: `,e.extra_fields.join(`, `)]}),e.also_in.length>0&&(0,K.jsxs)(`span`,{className:`block text-xs text-outline`,children:[`Also in `,e.also_in.join(`, `)]})]})]},J(e))})})]},e.id)})}),s.data?.skipped.map(e=>(0,K.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Skipped `,e.name,`: `,e.reason]},`${e.agent}/${e.name}`)),(o.error||s.error)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:(o.error||s.error)?.message}),(0,K.jsxs)(D,{children:[(0,K.jsx)(i,{variant:`ghost`,disabled:c,onClick:e,children:`Close`}),(0,K.jsx)(i,{"data-testid":`local-skill-import-submit`,disabled:c||!t.length,onClick:()=>s.mutate(t.map(e=>{let[t=``,n=``]=e.split(`/`);return{agent:t,name:n}})),children:s.isPending?`Importing…`:`Import selected${t.length?` (${t.length})`:``}`})]})]})})}function Ae({onClose:e}){let[t,n]=(0,H.useState)(``),[a,o]=(0,H.useState)([]),s=r(),c=v({mutationFn:C.skills.discover,onSuccess:()=>{l.clear(),o([])}}),l=Se((c.data?.skills??[]).filter(e=>!e.installed&&!a.includes(e.path)).map(e=>e.path),`${t}:${c.data?.commit??``}`),u=l.selectedIds,d=v({mutationFn:async()=>{if(!c.data)throw Error(`Discover skills first`);let e=[],n=[];for(let r=0;r<u.length;r+=16){let i=u.slice(r,r+16);try{await C.skills.import({source:t.trim(),commit:c.data.commit,paths:i}),n.push(...i)}catch(t){e.push(...i.map(e=>({path:e,error:t instanceof Error?t.message:`Import failed`})))}}return{imported:n,failed:e}},onSuccess:async t=>{await s.invalidateQueries({queryKey:[`skills`]}),o(e=>[...e,...t.imported]),l.select(t.failed.map(e=>e.path)),t.failed.length||e()}}),f=c.isPending||d.isPending;return(0,K.jsx)(O,{open:!0,onOpenChange:t=>!t&&!f&&e(),children:(0,K.jsxs)(T,{className:`max-w-xl`,children:[(0,K.jsx)(M,{children:(0,K.jsx)(w,{children:`Import from GitHub`})}),(0,K.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),c.mutate(t.trim())},children:[(0,K.jsx)(b,{htmlFor:`skill-repository`,children:`Repository or skills.sh link`}),(0,K.jsx)(P,{id:`skill-repository`,"data-testid":`skill-repository-input`,value:t,disabled:f,onChange:e=>{n(e.target.value),c.reset(),d.reset(),l.clear(),o([])},placeholder:`https://github.com/vercel-labs/agent-skills`,autoFocus:!0}),(0,K.jsx)(`p`,{className:`text-xs text-outline`,children:`GitHub repositories, owner/repo, skill-folder URLs and skills.sh links. Private repositories use gh login on the execution host (local or SSH), or ORC_GITHUB_TOKEN on the ORC server. Supporting files are included.`}),(0,K.jsx)(i,{type:`submit`,"data-testid":`skill-discover`,disabled:f||!t.trim(),children:c.isPending?`Discovering…`:`Discover skills`})]}),c.data&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`p`,{className:`text-xs text-outline`,children:[c.data.skills.length,` skills found · `,c.data.commit.slice(0,8)]}),!c.data.skills.length&&(0,K.jsx)(`p`,{role:`status`,children:`No valid skills found in this source.`}),(0,K.jsx)(xe,{resourceLabel:`new skills`,count:u.length,allSelected:l.allSelected,someSelected:l.someSelected,onSelectAll:l.selectAll,onClear:l.clear,disabled:f,children:(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Imports run in batches of up to 16.`})}),(0,K.jsx)(`div`,{className:`max-h-[45vh] overflow-y-auto space-y-2`,children:c.data.skills.map(e=>(0,K.jsxs)(`label`,{className:`flex items-start gap-3 border border-surface-highest rounded p-3`,"data-testid":`remote-skill`,"data-skill-name":e.name,children:[(0,K.jsx)(`input`,{type:`checkbox`,"data-testid":`remote-skill-select`,checked:u.includes(e.path),disabled:f||e.installed||a.includes(e.path),onChange:()=>l.toggle(e.path)}),(0,K.jsxs)(`span`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.name}),(e.installed||a.includes(e.path))&&(0,K.jsx)(`span`,{className:`ml-2 text-xs text-outline`,children:`Already installed`}),(0,K.jsx)(`span`,{className:`block text-xs text-outline`,children:e.description}),(0,K.jsx)(`span`,{className:`block text-xs text-outline`,children:e.path||`Repository root`})]})]},e.path))}),c.data.issues.map(e=>(0,K.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[e.path,`: `,e.error]},e.path))]}),(c.error||d.error)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:(c.error||d.error)?.message}),!!d.data?.failed.length&&(0,K.jsxs)(`div`,{role:`alert`,className:`text-sm text-destructive`,children:[(0,K.jsxs)(`p`,{children:[d.data.imported.length,` imported; `,d.data.failed.length,` failed. Failed selections retained for retry.`]}),d.data.failed.map(e=>(0,K.jsxs)(`p`,{children:[e.path||`Repository root`,`: `,e.error]},e.path))]}),(0,K.jsxs)(D,{children:[(0,K.jsx)(i,{variant:`ghost`,disabled:f,onClick:e,children:`Cancel`}),(0,K.jsx)(i,{"data-testid":`skill-import-submit`,disabled:f||!c.data||!u.length,onClick:()=>d.mutate(),children:d.isPending?`Importing…`:`Import selected${u.length?` (${u.length})`:``}`})]})]})})}var Y=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Y{};function je(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Me(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Ne(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Pe(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function X(e,t){return Ne(e,t,``)}function Fe(e,t){return Pe(e,t,``)}function Ie(e,t){return t.slice(0,Le(e,t))}function Le(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Re(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function ze(e,t){if(t)return Q(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Z(e,t){if(t)return Q(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Q(e,t){if(!t)return[Z(e),ze(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Re(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var $=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Be=RegExp(`[${$}]+|\\s+|[^${$}]`,`ug`);new class extends Y{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Re(e,r)}else n=e.match(Be)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Ve(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Ve(n,i,r,null,t.intlSegmenter),e}};function Ve(e,t,n,r,i){if(t&&n){let[a,o]=Q(t.value,i),[s,c]=Q(n.value,i);if(e){let r=je(a,s);e.value=Pe(e.value,s,r),t.value=X(t.value,r),n.value=X(n.value,r)}if(r){let e=Me(o,c);r.value=Ne(r.value,c,e),t.value=Fe(t.value,e),n.value=Fe(n.value,e)}}else if(n){if(e){let e=Z(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Z(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Z(r.value,i),[a,o]=Q(t.value,i),s=je(n,a);t.value=X(t.value,s);let c=Me(X(n,s),o);t.value=Fe(t.value,c),r.value=Ne(r.value,n,c),e.value=Pe(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Z(r.value,i),n=Ie(ze(t.value,i),e);t.value=Fe(t.value,n)}else if(e){let n=Ie(ze(e.value,i),Z(t.value,i));t.value=X(t.value,n)}}new class extends Y{tokenize(e){let t=RegExp(`(\\r?\\n)|[${$}]+|[^\\S\\n\\r]+|[^${$}]`,`ug`);return e.match(t)||[]}};var He=new class extends Y{constructor(){super(...arguments),this.tokenize=We}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
|
|
2
|
-
`)||(e=e.trim()),n.newlineIsToken&&t.includes(`
|
|
3
|
-
`)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
4
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
5
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Ue(e,t,n){return He.diff(e,t,n)}function We(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
6
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Ge(e){return e==`.`||e==`!`||e==`?`}new class extends Y{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Ge(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Y{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Y{constructor(){super(...arguments),this.tokenize=We}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Ke(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Ke(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Ke(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Ke(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Y{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function qe({name:e,scope:t,mutation:n}){let a=r(),[o,s]=(0,H.useState)(``),c=m({queryKey:[`skill-history`,e,t],queryFn:()=>C.skills.history(e,t)}),l=v({mutationFn:t=>{if(!n)throw Error(`No active instruction edit`);return C.skills.revert(e,{project_id:n.project_id,change_id:t,expected_change_id:n.id,reason:o.trim()})},onSuccess:()=>{a.invalidateQueries({queryKey:[`skill`]}),a.invalidateQueries({queryKey:[`skills`]}),a.invalidateQueries({queryKey:[`skill-history`]}),s(``)}});return!c.data?.changes.length&&!c.error?null:(0,K.jsxs)(`section`,{"data-testid":`skill-history-panel`,className:`mb-5 space-y-3`,children:[n&&(0,K.jsxs)(`p`,{"data-testid":`skill-mutated-label`,className:`text-xs text-primary`,children:[`Mutated · `,n.project_id?`Project`:`Global`,` ·`,` `,new Date(n.updated_at*1e3).toLocaleString(),` · `,n.author]}),(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Instruction history`}),(0,K.jsx)(P,{"data-testid":`skill-revert-reason`,"aria-label":`Reason for reverting instructions`,value:o,onChange:e=>s(e.target.value),placeholder:`Reason for reverting...`}),c.error&&(0,K.jsx)(`p`,{role:`alert`,children:c.error.message}),l.error&&(0,K.jsx)(`p`,{role:`alert`,children:l.error.message}),c.data?.changes.map(e=>(0,K.jsxs)(`details`,{"data-testid":`skill-history-change`,className:`border-b border-outline-variant p-3`,children:[(0,K.jsxs)(`summary`,{className:`text-xs cursor-pointer`,children:[e.action,` · `,e.reason,` · `,e.author,` ·`,` `,(0,K.jsx)(`time`,{dateTime:new Date(e.created_at*1e3).toISOString(),children:new Date(e.created_at*1e3).toLocaleString()})]}),(0,K.jsx)(Je,{before:e.previous_raw,after:e.raw}),(0,K.jsx)(i,{"data-testid":`skill-revert-change`,size:`sm`,variant:`outline`,disabled:!o.trim()||l.isPending,onClick:()=>l.mutate(e.id),children:`Restore instructions before this change`})]},e.id))]})}function Je({before:e,after:t}){let[n,r]=(0,H.useState)(!1),a=Ue(e,t).filter(e=>e.added||e.removed);return(0,K.jsxs)(`div`,{className:`my-3 space-y-2`,children:[(0,K.jsx)(`pre`,{"data-testid":`skill-change-diff`,className:`text-xs whitespace-pre-wrap break-all`,children:a.length===0?`No instruction changes`:a.map(e=>(0,K.jsxs)(`span`,{className:e.added?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`,children:[e.value.split(/(?<=\n)/).filter(Boolean).map(t=>`${e.added?`+ `:`- `}${t}`).join(``),!e.value.endsWith(`
|
|
7
|
-
`)&&`
|
|
8
|
-
`]},`${a.indexOf(e)}-${e.added?`added`:`removed`}`))}),(0,K.jsx)(i,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>r(!n),children:n?`Hide full skill`:`Show full skill`}),n&&(0,K.jsxs)(`div`,{"data-testid":`skill-change-full`,children:[(0,K.jsx)(`p`,{className:`text-xs text-outline mt-2`,children:`Before`}),(0,K.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap break-all`,children:e}),(0,K.jsx)(`p`,{className:`text-xs text-outline mt-2`,children:`After`}),(0,K.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap break-all`,children:t})]})]})}function Ye({name:e}){let t=r(),[n,a]=(0,H.useState)(!1),o=m({queryKey:[`skill-origin`,e],queryFn:()=>C.skills.origin(e)}),s=v({mutationFn:t=>C.skills.sync(e,t),onSuccess:async n=>{a(!1),n.applied&&await Promise.all([t.invalidateQueries({queryKey:[`skill`,e]}),t.invalidateQueries({queryKey:[`skills`]}),t.invalidateQueries({queryKey:[`skill-origin`,e]})])}});if(o.error)return(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:o.error.message});if(!o.data)return null;let c=s.data,l=c&&!c.applied&&c.conflicts.length>0;return(0,K.jsxs)(`div`,{className:`space-y-2 mb-4`,children:[(0,K.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Imported from`,` `,(0,K.jsx)(`a`,{className:`text-primary underline`,href:`https://github.com/${o.data.repository}/tree/${encodeURIComponent(o.data.ref===`HEAD`?o.data.commit:o.data.ref)}/${o.data.path}`,target:`_blank`,rel:`noreferrer`,children:o.data.repository}),` `,`· `,o.data.commit.slice(0,8)]}),(0,K.jsx)(i,{"data-testid":`skill-sync`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({}),children:s.isPending?`Syncing…`:`Sync from GitHub`}),c?.applied&&(0,K.jsx)(`p`,{role:`status`,"data-testid":`skill-sync-status`,className:`text-xs`,children:c.changed.length?`Synced ${c.changed.length} files. Local edits preserved outside confirmed conflicts.`:`Up to date. Local edits preserved.`}),l&&(0,K.jsxs)(`div`,{"data-testid":`skill-sync-conflicts`,className:`space-y-2`,children:[(0,K.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Sync paused. Both you and GitHub changed these files:`}),(0,K.jsx)(`ul`,{className:`text-xs space-y-1`,children:c.conflicts.map(e=>(0,K.jsx)(`li`,{children:e},e))}),(0,K.jsx)(i,{"data-testid":`skill-sync-review-override`,variant:`outline`,size:`sm`,onClick:()=>a(!0),children:`Review override`})]}),s.error&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:s.error.message}),(0,K.jsx)(O,{open:n,onOpenChange:e=>!s.isPending&&a(e),children:(0,K.jsxs)(T,{children:[(0,K.jsx)(M,{children:(0,K.jsx)(w,{children:`Replace conflicting local edits?`})}),(0,K.jsxs)(`p`,{className:`text-sm`,children:[`GitHub's version at `,c?.commit.slice(0,8),` will replace or remove these files. Your other local edits will be kept. The current skill folder will be backed up.`]}),(0,K.jsx)(`ul`,{className:`text-sm space-y-1`,children:c?.conflicts.map(e=>(0,K.jsx)(`li`,{children:e},e))}),(0,K.jsxs)(D,{children:[(0,K.jsx)(i,{variant:`ghost`,disabled:s.isPending,onClick:()=>a(!1),children:`Keep local edits`}),(0,K.jsx)(i,{"data-testid":`skill-sync-confirm-override`,disabled:s.isPending,onClick:()=>c&&s.mutate({override:!0,expectedCommit:c.commit,expectedRevision:c.revision}),children:s.isPending?`Syncing…`:`Replace listed files`})]})]})})]})}function Xe(e){return m({queryKey:[`skills`,e],queryFn:()=>C.skills.list(e)})}function Ze(){return m({queryKey:[`skill-visibility`],queryFn:()=>C.skills.visibility()})}function Qe(){let e=r();return v({mutationFn:e=>C.skills.setVisibility(e),onSuccess:t=>{e.setQueryData([`skill-visibility`],t),e.invalidateQueries({queryKey:[`skills`]})}})}function $e(e,t,n={}){return m({queryKey:[`skill`,e,t,n],queryFn:()=>C.skills.get(e,t,n),enabled:!!e})}function et(){let e=r();return v({mutationFn:e=>C.skills.create(e),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})})}var tt={default:`none`,asc:`ascending`,desc:`descending`},nt={default:W,asc:se,desc:ue},rt=[{value:`all`,label:`All`},{value:`builtin`,label:`Built-in`},{value:`user`,label:`User`}],it={sync:`synced`,delete:`deleted`,hide:`hidden`,show:`shown`},at={builtin:`text-muted-foreground`,user:`text-muted-foreground`};function ot({projectId:e}){let t=be(e),n=t===`all`||t===`unassigned`?{scope:`global`}:{project_id:t},[a,o]=F(`skillQuery`,``),[s,c]=(0,H.useState)(a),[l,u]=F(`source`,`all`,[`all`,`builtin`,`user`]),[d,f]=F(`skillRepositorySort`,`default`,[`default`,`asc`,`desc`]),p=nt[d];(0,H.useEffect)(()=>c(a),[a]);let{selectedId:m,openDetail:h,closeDetail:g}=me(`/skills`,`skillName`),[_,y]=(0,H.useState)(!1),[ee,b]=(0,H.useState)(!1),[x,S]=(0,H.useState)(!1),w=Ze(),T=Qe(),E=JSON.stringify([t,a,l]),[re,D]=(0,H.useState)({scope:E,offset:0}),O=re.scope===E?re.offset:0,{data:k,isLoading:ae,error:oe,refetch:se}=Xe({...n,q:a||void 0,source:l===`all`?void 0:l,include_hidden:!0,limit:30,offset:O}),A=k?.skills,j=r(),M=(A??[]).filter(e=>e.source===`user`),N=we({queries:M.map(e=>({queryKey:[`skill-origin`,e.name],queryFn:()=>C.skills.origin(e.name)}))}),ue=M.filter((e,t)=>!!N[t]?.data).map(e=>e.name),R=new Map(M.map((e,t)=>[e.name,N[t]?.data?.repository])),Ce=[...A??[]];!a&&d!=="default"&&Ce.sort((e,t)=>{let n=R.get(e.name),r=R.get(t.name);if(!n&&r)return 1;if(n&&!r)return-1;let i=(n??``).localeCompare(r??``,void 0,{sensitivity:`base`});return i?d===`asc`?i:-i:e.name.localeCompare(t.name)});let z=JSON.stringify([t,a,l,O]),B=(0,H.useRef)(z);B.current=z;let V=Se((A??[]).map(e=>e.name),z),U=(A??[]).filter(e=>V.selectedIds.includes(e.name)),W=U.filter(e=>ue.includes(e.name)),G=U.filter(e=>e.source===`user`),[Ee,Oe]=(0,H.useState)(!1),q=v({mutationFn:async({action:e,names:t,scope:n})=>{if(e===`hide`||e===`show`){let r=new Set(w.data?.hidden_skills??[]),i=new Set(w.data?.hidden_builtins??[]);for(let n of t)e===`hide`?r.add(n):(r.delete(n),i.delete(n));return await T.mutateAsync({hidden_skills:[...r],hidden_builtins:[...i]}),{action:e,scope:n,succeeded:t,failed:[]}}return{action:e,scope:n,...await ne(t,async t=>{if(e===`delete`)return C.skills.delete(t);let n=await C.skills.sync(t);if(!n.applied)throw Error(`Conflicts: ${n.conflicts.join(`, `)}. Open this skill to review.`)})}},onSettled:async()=>{await Promise.all([j.invalidateQueries({queryKey:[`skills`]}),j.invalidateQueries({queryKey:[`skill`]}),j.invalidateQueries({queryKey:[`skill-origin`]})])}}),J=q.data?.scope===z?q.data:void 0;async function Y(e,t){let n=await q.mutateAsync({action:e,names:t,scope:z});n.scope===B.current&&V.select(n.failed.map(e=>e.id))}return oe?(0,K.jsx)(fe,{message:oe.message,onRetry:()=>se()}):(0,K.jsxs)(`div`,{children:[(0,K.jsx)(pe,{title:`Skills`,meta:`${(A??[]).length} skills`,action:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(i,{"data-testid":`import-skill-button`,size:`sm`,variant:`outline`,onClick:()=>b(!0),children:[(0,K.jsx)(te,{size:12,className:`mr-1`}),` Import from GitHub`]}),(0,K.jsxs)(i,{"data-testid":`import-local-skills-button`,size:`sm`,variant:`outline`,onClick:()=>S(!0),children:[(0,K.jsx)(te,{size:12,className:`mr-1`}),` Import from agents`]}),(0,K.jsxs)(i,{"data-testid":`new-skill-button`,size:`sm`,onClick:()=>y(!0),className:`font-label text-sm `,children:[(0,K.jsx)(ce,{size:12,className:`mr-1`}),` New skill`]})]})}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Skill folders follow the`,` `,(0,K.jsx)(`a`,{className:`text-primary underline`,href:`https://agentskills.io/specification`,target:`_blank`,rel:`noreferrer`,children:`Agent Skills specification`}),`.`]}),(w.error||T.error)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-destructive text-xs mb-2`,children:(w.error||T.error)?.message}),k?.broken?.map(e=>(0,K.jsxs)(`p`,{role:`alert`,className:`text-destructive text-xs mb-2`,children:[e.path,`: `,e.error]},e.path)),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-4`,children:[(0,K.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:rt.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>u(e.value),"data-testid":`skill-source-${e.value}`,"aria-pressed":l===e.value,className:`font-label text-sm px-3 py-1.5 border transition-colors ${l===e.value?`bg-surface-highest text-on-surface border-transparent`:`bg-transparent border-transparent text-muted-foreground hover:bg-surface-low hover:text-on-surface`}`,children:e.label},e.value))}),(0,K.jsxs)(`div`,{className:`relative min-w-[160px] flex-1`,children:[(0,K.jsx)(le,{size:12,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,K.jsx)(P,{"data-testid":`skill-search-input`,"aria-label":`Search skills`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&o(e.currentTarget.value),placeholder:`Search skills...`,className:`pl-8 bg-background text-on-surface font-body text-sm placeholder:text-muted-foreground`})]}),(0,K.jsx)(i,{"data-testid":`skill-search-submit`,variant:`outline`,size:`sm`,onClick:()=>o(s),className:`font-label text-sm `,children:`Search`})]}),!!A?.length&&(0,K.jsxs)(xe,{resourceLabel:`skills`,count:V.selectedIds.length,allSelected:V.allSelected,someSelected:V.someSelected,onSelectAll:V.selectAll,onClear:V.clear,disabled:q.isPending,children:[(0,K.jsx)(i,{"data-testid":`skills-bulk-hide`,variant:`outline`,size:`sm`,disabled:q.isPending||!w.data,onClick:()=>void Y(`hide`,V.selectedIds),children:`Hide`}),(0,K.jsx)(i,{"data-testid":`skills-bulk-show`,variant:`outline`,size:`sm`,disabled:q.isPending||!w.data,onClick:()=>void Y(`show`,V.selectedIds),children:`Show`}),(0,K.jsx)(i,{"data-testid":`skills-bulk-sync`,variant:`outline`,size:`sm`,title:`Local edits are kept; conflicts need review`,disabled:q.isPending||!W.length||N.some(e=>e.isPending),onClick:()=>void Y(`sync`,W.map(e=>e.name)),children:q.isPending&&q.variables?.action===`sync`?`Syncing…`:`Sync from GitHub${W.length?` (${W.length})`:``}`}),(0,K.jsx)(i,{"data-testid":`skills-bulk-delete`,variant:`outline`,size:`sm`,className:`text-destructive`,title:`Built-in skills cannot be deleted`,disabled:q.isPending||!G.length,onClick:()=>Oe(!0),children:`Delete${G.length?` (${G.length})`:``}`})]}),(0,K.jsx)(de,{open:Ee,title:`Delete skills`,description:`Delete ${G.map(e=>e.name).join(`, `)}? This removes the skill folders and cannot be undone.`,isPending:q.isPending,onCancel:()=>Oe(!1),onConfirm:()=>{Oe(!1),Y(`delete`,G.map(e=>e.name))}}),N.some(e=>e.error)&&(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Could not check GitHub origins: `,N.find(e=>e.error)?.error?.message]}),J&&(0,K.jsxs)(`div`,{"data-testid":`skills-bulk-result`,role:`status`,className:`mb-3 text-sm`,children:[(0,K.jsxs)(`p`,{children:[J.succeeded.length,` `,it[J.action],J.failed.length?`; ${J.failed.length} need attention.`:`.`]}),J.failed.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`block text-left text-destructive underline`,onClick:()=>h(e.id),children:[e.id,`: `,e.error]},e.id))]}),ae?(0,K.jsx)(`div`,{className:`space-y-2`,children:[...[,,,,,]].map((e,t)=>(0,K.jsx)(ie,{className:`h-10 w-full bg-surface-highest`},t))}):(A??[]).length===0?(0,K.jsx)(he,{message:a?`No skills match your search`:`No skills found`}):(0,K.jsx)(`div`,{className:`overflow-hidden`,children:(0,K.jsxs)(ye,{children:[(0,K.jsx)(ge,{children:(0,K.jsxs)(ve,{className:`border-b border-outline-variant hover:bg-transparent`,children:[(0,K.jsx)(I,{className:`w-12`,children:(0,K.jsx)(`span`,{className:`sr-only`,children:`Select skills`})}),(0,K.jsx)(I,{className:`font-label text-sm text-muted-foreground`,children:`Name`}),(0,K.jsx)(I,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,K.jsx)(I,{className:`font-label text-sm text-muted-foreground w-24`,children:`Source`}),(0,K.jsx)(I,{"data-testid":`skill-repository-header`,"aria-sort":tt[d],children:(0,K.jsxs)(`button`,{type:`button`,"data-testid":`skill-repository-sort`,className:`flex min-h-11 items-center gap-2 text-sm text-muted-foreground hover:text-on-surface`,onClick:()=>{f(d==="default"?`asc`:d===`asc`?`desc`:`default`)},title:`Sort by GitHub repository: ascending, descending, then default order`,children:[`GitHub repository `,(0,K.jsx)(p,{size:14,"aria-hidden":`true`})]})}),(0,K.jsx)(I,{className:`text-xs text-muted-foreground`,children:`Agent discovery`})]})}),(0,K.jsx)(_e,{children:Ce.map(e=>(0,K.jsxs)(ve,{"data-testid":`skill-row`,"data-skill-name":e.name,className:`border-b border-outline-variant/50 hover:bg-surface-low cursor-pointer`,onClick:()=>h(e.name),children:[(0,K.jsx)(L,{onClick:e=>e.stopPropagation(),children:(0,K.jsx)(`input`,{type:`checkbox`,"data-testid":`skill-select`,"aria-label":`Select ${e.name}`,checked:V.selectedIds.includes(e.name),disabled:q.isPending,onChange:()=>V.toggle(e.name),className:`size-4 accent-primary`})}),(0,K.jsxs)(L,{className:`font-body text-sm font-medium text-on-surface`,children:[(0,K.jsx)(`button`,{type:`button`,"data-testid":`skill-open`,className:`min-h-11 text-left hover:text-primary`,onClick:t=>{t.stopPropagation(),h(e.name)},children:e.name}),e.mutation&&(0,K.jsx)(`span`,{className:`ml-2 text-primary text-xs`,title:`Instructions were edited`,children:`Modified`})]}),(0,K.jsx)(L,{className:`font-body text-sm text-muted-foreground max-w-md truncate`,children:e.description||`—`}),(0,K.jsx)(L,{"data-testid":`skill-source-cell`,children:(0,K.jsx)(`span`,{className:`inline-flex py-0.5 font-label text-sm ${at[e.source]}`,children:e.source})}),(0,K.jsx)(L,{"data-testid":`skill-repository-cell`,onClick:e=>e.stopPropagation(),className:`max-w-56 truncate text-sm text-muted-foreground`,children:R.get(e.name)?(0,K.jsx)(`a`,{"data-testid":`skill-repository-link`,href:`https://github.com/${R.get(e.name)}`,target:`_blank`,rel:`noreferrer`,className:`text-primary hover:underline`,title:R.get(e.name),children:R.get(e.name)}):`—`}),(0,K.jsx)(L,{onClick:e=>e.stopPropagation(),children:(0,K.jsxs)(`button`,{type:`button`,role:`switch`,"aria-label":`${e.name} visible to agents`,"aria-checked":!e.discovery_hidden,"data-testid":`skill-visibility-${e.name}`,disabled:!w.data||T.isPending,className:`inline-flex min-h-11 items-center gap-2 text-xs text-primary disabled:opacity-50`,title:e.discovery_hidden?`Hidden from agent discovery. Still loadable by name and in flows.`:`Hide from agent discovery`,onClick:()=>{let t=new Set(w.data?.hidden_skills??[]),n=new Set(w.data?.hidden_builtins??[]);e.discovery_hidden?(t.delete(e.name),n.delete(e.name)):t.add(e.name),T.mutate({hidden_skills:[...t],hidden_builtins:[...n]})},children:[e.discovery_hidden?(0,K.jsx)(Te,{size:22,"aria-hidden":`true`,className:`text-muted-foreground`}):(0,K.jsx)(De,{size:22,"aria-hidden":`true`}),e.discovery_hidden?`Hidden`:`Visible`,e.mutation&&` (Modified)`]})})]},e.name))})]})}),k&&k.total>30&&(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-4`,"data-testid":`skills-pagination`,children:[(0,K.jsxs)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`skills-page-summary`,children:[O+1,`–`,Math.min(O+k.skills.length,k.total),` of`,` `,k.total]}),(0,K.jsx)(i,{variant:`outline`,size:`sm`,"data-testid":`skills-previous`,disabled:O===0||ae,onClick:()=>D({scope:E,offset:Math.max(0,O-30)}),children:`Previous`}),(0,K.jsx)(i,{variant:`outline`,size:`sm`,"data-testid":`skills-next`,disabled:k.next_offset===null||ae,onClick:()=>D({scope:E,offset:k.next_offset??O}),children:`Next`})]}),(0,K.jsx)(st,{scope:n,skillName:m,open:!!m,onClose:g},m),_&&(0,K.jsx)(ct,{open:_,onClose:()=>y(!1)}),ee&&(0,K.jsx)(Ae,{onClose:()=>b(!1)}),x&&(0,K.jsx)(ke,{onClose:()=>S(!1)})]})}function st({skillName:e,scope:t,open:n,onClose:i}){let{data:a,isLoading:o,error:s,refetch:c}=$e(e,void 0,t),l=a,[u,d]=F(`skillFile`,`SKILL.md`),f=$e(e,u??`SKILL.md`,t),p=f.data,m=r(),[h,g]=(0,H.useState)(!1),_=`skill:${t.project_id??`global`}:${e}:${u??`SKILL.md`}`;function v(e){return(e??`SKILL.md`)===(u??`SKILL.md`)?!0:R(_)?(d(e??`SKILL.md`),!0):!1}let y=l?(0,K.jsx)(Oe,{files:[`SKILL.md`,...(l.files??[]).map(e=>e.name)],selected:u??`SKILL.md`,onSelect:e=>v(e===`SKILL.md`?void 0:e),testId:`skill-file`,entryTestId:`skill-show-entry`}):null;return(0,K.jsx)(k,{open:n,onOpenChange:e=>!e&&R(_)&&i(),children:(0,K.jsxs)(re,{defaultWidth:1120,resizeKey:`skills`,children:[(0,K.jsxs)(oe,{children:[(0,K.jsx)(ae,{children:l?.name??`Skill Details`}),l?.description&&(0,K.jsx)(`p`,{className:`font-body text-sm text-muted-foreground mt-1`,children:l.description})]}),(0,K.jsx)(E,{children:(0,K.jsxs)(K.Fragment,{children:[e&&l&&(0,K.jsx)(qe,{name:e,scope:t,mutation:l.mutation}),e&&l&&(0,K.jsx)(Ye,{name:e}),s?(0,K.jsx)(fe,{message:s.message,onRetry:()=>void c()}):o||!l?(0,K.jsx)(`div`,{className:`space-y-3`,children:[...[,,,,]].map((e,t)=>(0,K.jsx)(ie,{className:`h-8 w-full bg-surface-highest`},t))}):(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,K.jsx)(N,{label:`Source`,children:(0,K.jsx)(`span`,{className:`inline-flex py-0.5 font-label text-sm ${at[l.source]}`,children:l.source})}),(0,K.jsx)(N,{label:`Path`,children:(0,K.jsx)(`code`,{className:`font-mono text-sm text-muted-foreground break-all`,children:l.path})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-label text-sm text-muted-foreground mb-2`,children:u??`SKILL.md`}),(0,K.jsxs)(`div`,{className:`overflow-hidden`,children:[p?.encoding===`base64`&&(0,K.jsx)(`div`,{className:`p-3`,children:y}),f.error?(0,K.jsx)(`p`,{role:`alert`,children:f.error.message}):f.isLoading?(0,K.jsx)(`p`,{children:`Loading...`}):p?.encoding===`base64`?(0,K.jsx)(A,{path:u??`SKILL.md`,value:p?.content??``,readOnly:!0,hidePreview:!0,height:400,testId:`skill-file-content`}):(0,K.jsx)(Ce,{documentId:_,expanded:h,onExpandedChange:g,navigation:y,path:u??`SKILL.md`,content:p?.content??``,testId:`skill-file-content`,onSave:l.source===`user`&&p?.encoding===`utf8`?async(e,n)=>{let r=u??`SKILL.md`;return l.mutation&&r===`SKILL.md`?await C.skills.updateInstructions(l.name,{project_id:t.project_id??null,content:e,expected_content:n,reason:`Manual instruction edit`,author:`human`}):await C.skills.editFile(l.name,{path:r,content:e,expectedContent:n}),await m.invalidateQueries({queryKey:[`skill`,l.name]}),await m.invalidateQueries({queryKey:[`skills`]}),await m.invalidateQueries({queryKey:[`skill-history`,l.name]}),e}:void 0},_),p?.encoding===`base64`&&(0,K.jsx)(`p`,{className:`p-4 text-xs text-muted-foreground`,children:`Binary asset shown as base64 (read-only).`})]})]})]})]})})]})})}function ct({open:e,onClose:t}){let[n,r]=(0,H.useState)(``),[a,o]=(0,H.useState)(``),s=et(),[c,l]=(0,H.useState)([]),[u,d]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),m=!!(n||a||c.length);(0,H.useEffect)(()=>{if(!m)return;function e(e){e.preventDefault(),e.returnValue=``}return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[m]);function h(){s.isPending||f||(!m||window.confirm(`Discard this unsaved skill?`))&&t()}async function g(e){if(e?.length){p(!0),d(void 0);try{let t=(await z(e)).map(e=>({...e,encoding:e.encoding??`utf8`,id:crypto.randomUUID()})),n=t.find(e=>e.path===`SKILL.md`);if(!n)throw Error(`Choose a skill folder containing SKILL.md`);if(n.encoding!==`utf8`)throw Error(`SKILL.md must be UTF-8 text`);o(n.content),r(e[0].webkitRelativePath.split(`/`)[0]),l(t.filter(e=>e!==n))}catch(e){d(e.message)}finally{p(!1)}}}let _=()=>{!n.trim()||!a.trim()||s.isPending||f||c.some(e=>!e.path.trim())||s.mutate({name:n.trim(),content:a.trim(),files:c.map(({path:e,content:t,encoding:n})=>({path:e,content:t,encoding:n}))},{onSuccess:t})};return(0,K.jsx)(O,{open:e,onOpenChange:e=>!e&&h(),children:(0,K.jsxs)(T,{className:`bg-surface border-outline-variant w-[calc(100%-1rem)] max-w-5xl max-h-[94dvh] overflow-y-auto`,children:[(0,K.jsx)(M,{children:(0,K.jsx)(w,{className:`font-headline text-base text-on-surface`,children:`New skill`})}),(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_()},className:`space-y-3 mt-2`,children:[(0,K.jsx)(b,{htmlFor:`skill-folder-input`,children:`Import skill folder`}),(0,K.jsx)(P,{id:`skill-folder-input`,"data-testid":`skill-folder-input`,type:`file`,multiple:!0,webkitdirectory:``,onChange:e=>void g(e.target.files)}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(b,{className:`font-label text-sm text-muted-foreground`,children:`Name *`}),(0,K.jsx)(P,{"aria-label":`Name`,"data-testid":`skill-name-input`,value:n,onChange:e=>r(e.target.value),placeholder:`my-skill`,className:`bg-background text-on-surface font-body text-sm`,autoFocus:!0})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(b,{className:`font-label text-sm text-muted-foreground`,children:`SKILL.md *`}),(0,K.jsx)(S,{testId:`skill-content-input`,path:`SKILL.md`,value:a,onChange:o,onSave:_})]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(i,{"data-testid":`skill-add-file`,type:`button`,variant:`outline`,onClick:()=>l([...c,{id:crypto.randomUUID(),path:``,content:``,encoding:`utf8`}]),children:`Add file`}),c.map(e=>(0,K.jsxs)(`div`,{"data-testid":`skill-supporting-file`,className:`space-y-2 border border-outline-variant p-3`,children:[(0,K.jsx)(P,{"data-testid":`skill-file-path-input`,"aria-label":`File path`,placeholder:`references/guide.md or scripts/check.py`,value:e.path,onChange:t=>l(c.map(n=>n.id===e.id?{...n,path:t.target.value}:n))}),(0,K.jsx)(A,{testId:`skill-file-content-input`,path:e.path||`supporting.txt`,readOnly:e.encoding===`base64`,label:`Content of ${e.path||`supporting file`}`,value:e.content,height:180,onChange:t=>l(c.map(n=>n.id===e.id?{...n,content:t}:n))}),e.encoding===`base64`&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Binary asset (base64)`}),(0,K.jsx)(i,{type:`button`,variant:`ghost`,onClick:()=>l(c.filter(t=>t.id!==e.id)),children:`Remove file`})]},e.id))]}),(u||s.error)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:u??s.error?.message}),(0,K.jsxs)(D,{children:[(0,K.jsx)(i,{type:`button`,variant:`ghost`,size:`sm`,onClick:h,className:`font-label text-sm text-muted-foreground`,children:`Cancel`}),(0,K.jsx)(i,{"data-testid":`skill-submit`,type:`submit`,size:`sm`,disabled:f||s.isPending||!n.trim()||!a.trim()||c.some(e=>!e.path.trim()),className:`font-label text-sm `,children:s.isPending?`Creating...`:`Create`})]})]})]})})}export{ot as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{t}from"./utils-Q1DAuYRG.js";var n=e(),r={todo:`bg-muted-foreground`,queued:`bg-progress`,doing:`bg-progress`,review:`bg-tertiary`,changes_requested:`bg-error`,blocked:`bg-error`,done:`bg-secondary`,cancelled:`bg-muted-foreground`,paused:`bg-muted-foreground`},i={pending:`bg-muted-foreground`,running:`bg-progress`,success:`bg-secondary`,failed:`bg-error`,cancelled:`bg-muted-foreground`,skipped:`bg-muted-foreground`};function a({status:e,type:a=`task`,className:o}){let s=a===`job`?i[e]??`bg-muted-foreground`:r[e]??`bg-muted-foreground`;return(0,n.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-label font-normal text-muted-foreground`,o),children:[(0,n.jsx)(`span`,{className:t(`size-1.5 rounded-full shrink-0`,s)}),e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `)]})}export{a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./x-CtXhMM9g.js";import{t as i}from"./utils-Q1DAuYRG.js";var a=e(t(),1),o=n(),s=/[,\s]+/;function c(e,t){let n=t.split(s).map(e=>e.trim()).filter(Boolean);return[...new Set([...e,...n])]}function l({value:e,onChange:t,suggestions:n=[],placeholder:l=`Add a label`,"aria-label":u,"data-testid":d}){let[f,p]=(0,a.useState)(``),m=(0,a.useRef)(null),h=(0,a.useId)(),g=n.filter(t=>!e.includes(t));function _(n){let r=c(e,n);r.length!==e.length&&t(r),p(``)}function v(n){let r=n.split(s);if(r.length>1){let n=r.pop()??``;t(c(e,r.join(`,`))),p(n)}else p(n)}function y(n){(n.key===`Enter`||n.key===`Tab`)&&f.trim()?(n.preventDefault(),_(f)):n.key===`Backspace`&&!f&&e.length>0&&(n.preventDefault(),t(e.slice(0,-1)))}function b(e){let t=e.clipboardData.getData(`text`);s.test(t)&&(e.preventDefault(),_(`${f},${t}`))}return(0,o.jsxs)(`div`,{className:i(`flex min-h-10 w-full cursor-text flex-wrap items-center gap-1.5 rounded-md border border-control-border bg-surface px-2 py-1.5 text-sm`,`focus-within:ring-2 focus-within:ring-focus focus-within:ring-offset-2 ring-offset-background`),onClick:()=>m.current?.focus(),children:[e.map(n=>(0,o.jsxs)(`span`,{"data-testid":`tag-input-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full border border-outline-variant bg-surface-high py-0.5 pl-2.5 pr-1 text-xs text-on-surface`,children:[(0,o.jsx)(`span`,{className:`truncate`,children:n}),(0,o.jsx)(`button`,{type:`button`,"aria-label":`Remove ${n}`,className:`rounded-full p-0.5 text-outline hover:bg-surface-highest hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus`,onClick:r=>{r.stopPropagation(),t(e.filter(e=>e!==n)),m.current?.focus()},children:(0,o.jsx)(r,{size:12,"aria-hidden":!0})})]},n)),(0,o.jsx)(`input`,{ref:m,"aria-label":u,"data-testid":d,list:g.length>0?h:void 0,value:f,onChange:e=>v(e.target.value),onKeyDown:y,onPaste:b,onBlur:()=>f.trim()&&_(f),placeholder:e.length===0?l:``,className:`h-7 min-w-32 flex-1 bg-transparent px-1 outline-hidden placeholder:text-muted-foreground`}),g.length>0&&(0,o.jsx)(`datalist`,{id:h,children:g.map(e=>(0,o.jsx)(`option`,{value:e},e))})]})}export{l as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./button-PNx108iL.js";import{a as i,i as a,n as o,r as s,t as c}from"./select-Cg0xEvji.js";import{t as l}from"./label-Ce3QFsX5.js";import{t as u}from"./createLucideIcon-jLuHkL03.js";import{t as d}from"./link-2-DSYfKX_9.js";import{t as f}from"./trash-D7o9t0-a.js";import{$ as p,A as m,At as h,B as g,D as _,Et as v,F as y,G as ee,H as b,I as x,J as te,K as S,M as ne,N as C,Nt as w,O as re,Ot as T,Q as E,R as ie,Tt as D,U as O,V as k,W as A,X as j,Y as M,Z as N,_t as ae,an as P,at as F,dt as I,et as oe,it as L,j as se,kn as R,kt as z,ln as B,lt as ce,mn as V,nt as H,on as le,ot as ue,rt as de,st as U,tt as W,wn as G,wt as K,z as q}from"./index-Ck-SDgTR.js";import{t as fe}from"./ConfirmDialog-BGZ6sd6E.js";import{t as pe}from"./ErrorState-B0KI2D4y.js";import{a as J,c as me,i as he,r as ge,t as _e}from"./live-sessions-D07BClP7.js";import{s as ve}from"./useSessions-Bx-Bw75y.js";import{t as ye}from"./PriorityBadge-_KMVnMst.js";import{t as be}from"./ResumeActions-gVze1Xjw.js";import{t as xe}from"./StatusBadge-CZQsVLgL.js";var Se={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};Se.node;var Ce=u(Se),we={name:`user-check`,size:24,node:[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};we.node;var Te=u(we),Y=e(t(),1),X=n(),Ee=new Set([`task_id`,`task_title`,`project_id`,`skill_name`,`required_review`,`max_review_rounds`]),De={running:`bg-primary/15 text-primary border-primary/40`,completed:`bg-secondary/15 text-secondary border-secondary/40`,halted:`bg-error/15 text-error border-error/40`,cancelled:`bg-surface-highest text-outline border-outline-variant`},Oe={pending:`text-primary`,running:`text-primary`,awaiting_human:`text-tertiary`,succeeded:`text-secondary`,failed:`text-error`,cancelled:`text-outline`,skipped:`text-outline`};function Z({children:e,className:t}){return(0,X.jsx)(`span`,{className:`inline-flex px-2 py-0.5 font-label text-xs rounded-md border ${t??`bg-surface-highest border-surface-highest text-on-surface-variant`}`,children:e})}function ke({taskId:e}){let{data:t,isLoading:n}=b(e),[r,i]=(0,Y.useState)(null);return n?(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`Loading flow…`}):t?(0,X.jsx)(Ae,{run:t,taskId:e,selectedNodeId:r,onSelectNode:e=>i(t=>t===e?null:e)}):(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,"data-testid":`flow-run-empty`,children:`No flow has run on this task yet.`})}function Ae({run:e,taskId:t,selectedNodeId:n,onSelectNode:i}){let a=(0,Y.useMemo)(()=>ue(e.definition),[e.definition]),o=(0,Y.useMemo)(()=>L(e),[e]),s=(0,Y.useMemo)(()=>p(e),[e]),c=g(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),m=Object.entries(e.vars).filter(([e])=>!Ee.has(e));return(0,X.jsxs)(`div`,{className:`space-y-4`,"data-testid":`flow-run-panel`,"data-flow-status":e.status,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e.flow_source===`task`?(0,X.jsx)(`span`,{className:`font-body text-sm text-on-surface truncate`,"data-testid":`flow-run-name`,children:e.flow_name}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>f(!0),className:`font-body text-sm text-primary hover:underline truncate`,"data-testid":`flow-run-name`,children:e.flow_name}),(0,X.jsx)(Z,{children:e.flow_source}),(0,X.jsx)(Z,{className:De[e.status],children:e.status})]}),e.status===`running`&&(0,X.jsxs)(r,{"data-testid":`flow-halt-button`,size:`sm`,onClick:()=>u(!0),className:`font-label text-xs bg-error/10 text-error border border-error/30 hover:bg-error/20 min-h-11 sm:min-h-9 px-3`,children:[(0,X.jsx)(Ce,{size:11,className:`mr-1`}),`Halt`]})]}),e.halt_reason&&(0,X.jsxs)(`div`,{className:`p-2 rounded-lg border border-border bg-transparent space-y-0.5`,"data-testid":`flow-halt-reason`,"data-halt-reason":e.halt_reason,children:[(0,X.jsxs)(`div`,{className:`font-label text-xs font-medium text-error`,children:[`Halted: `,e.halt_reason.replace(/_/g,` `)]}),e.halt_description&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant`,children:e.halt_description})]}),a?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(N,{definition:a,states:o,selectedNodeId:n,onSelectNode:i}),(0,X.jsx)(E,{})]}):(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`This run did not record a readable definition, so its graph cannot be drawn.`}),s&&(0,X.jsx)(je,{taskId:t,nodeRun:s,definition:a,isHalting:c.isPending}),a&&n&&(0,X.jsx)(Me,{definition:a,nodeId:n}),(0,X.jsx)(Ne,{run:e,selectedNodeId:n,onSelectNode:i}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1`,children:[(0,X.jsxs)(Q,{label:`Executions`,children:[e.node_executions,a?.limits.max_node_executions?` / ${a.limits.max_node_executions}`:``]}),(0,X.jsx)(Q,{label:`Elapsed`,children:W(e.started_at,e.ended_at)}),(0,X.jsx)(Q,{label:`Started`,children:H(e.started_at)}),(0,X.jsx)(Q,{label:`Ended`,children:H(e.ended_at)})]}),m.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,"data-testid":`flow-run-vars`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Run vars`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:m.map(([e,t])=>(0,X.jsxs)(Z,{children:[e,`=`,JSON.stringify(t)]},e))})]}),(0,X.jsx)(q,{flowName:d?e.flow_name:null,open:d,onClose:()=>f(!1)}),(0,X.jsx)(fe,{open:l,title:`Halt Flow`,description:`Stop flow "${e.flow_name}" and kill any live agent sessions for this task? The task keeps its current status.`,confirmLabel:`Halt`,variant:`destructive`,isPending:c.isPending,onConfirm:()=>c.mutate({taskId:t,reason:`halted from the web dashboard`},{onSuccess:()=>u(!1)}),onCancel:()=>u(!1)})]})}function Q({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:e}),(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant`,children:t})]})}function je({taskId:e,nodeRun:t,definition:n,isHalting:u}){let d=(0,Y.useMemo)(()=>n?F(n,t.node_id):[],[n,t.node_id]),f=k(),[p,m]=(0,Y.useState)(d[0]??``),[h,g]=(0,Y.useState)(``),_=p.trim();return(0,X.jsxs)(`div`,{className:`p-3 rounded-lg border border-border bg-transparent space-y-3`,"data-testid":`flow-gate-form`,"data-gate-node":t.node_id,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-tertiary`,children:[(0,X.jsx)(Te,{size:12}),`Waiting for you at “`,t.node_id,`”`]}),n?.nodeById[t.node_id]?.prompt&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface whitespace-pre-wrap`,children:n.nodeById[t.node_id]?.prompt}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Outcome`}),d.length>0?(0,X.jsxs)(c,{value:p,onValueChange:m,children:[(0,X.jsx)(a,{"aria-label":`Outcome`,"data-testid":`flow-gate-outcome`,className:`bg-background border-control-border text-on-surface font-label text-sm min-h-11 sm:min-h-9`,children:(0,X.jsx)(i,{placeholder:`Pick an outcome`})}),(0,X.jsx)(o,{className:`bg-surface-highest border-surface-highest`,children:d.map(e=>(0,X.jsx)(s,{value:e,className:`font-label text-xs`,children:e},e))})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K,{"aria-label":`Outcome`,"data-testid":`flow-gate-outcome-input`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g. approved`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-11 sm:min-h-9`}),(0,X.jsx)(`p`,{className:`font-body text-sm text-outline`,children:`This node routes everything through a catch-all edge, so any outcome continues the flow.`})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Comment (posted on the task)`}),(0,X.jsx)(w,{"aria-label":`Comment posted on the task`,"data-testid":`flow-gate-comment`,value:h,onChange:e=>g(e.target.value),placeholder:`Why this outcome…`,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`,rows:2})]}),f.error&&(0,X.jsx)(`div`,{className:`font-body text-sm text-error`,"data-testid":`flow-gate-error`,children:f.error.message}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(r,{"data-testid":`flow-gate-submit`,size:`sm`,disabled:f.isPending||u||_.length===0,onClick:()=>f.mutate({taskId:e,outcome:_,...h.trim()?{summary:h.trim()}:{},author:`human`},{onSuccess:()=>g(``)}),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90 min-h-11 sm:min-h-9 px-3`,children:f.isPending?`Resuming…`:`Resume flow`})})]})}function Me({definition:e,nodeId:t}){let n=e.nodeById[t];if(!n)return null;let r=e.edges.map((e,t)=>({edge:e,index:t})).filter(({edge:e})=>e.from===t);return(0,X.jsxs)(`div`,{className:`p-2 rounded-lg border border-surface-highest bg-surface-highest/30 space-y-2`,"data-testid":`flow-node-detail`,"data-node-id":t,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,X.jsx)(`span`,{className:`font-body text-sm font-medium text-on-surface`,children:n.id}),(0,X.jsx)(Z,{children:n.kind}),n.skill&&(0,X.jsxs)(Z,{children:[`skill `,n.skill]}),n.role&&(0,X.jsx)(Z,{children:n.role}),n.task_status&&(0,X.jsxs)(Z,{children:[`sets `,n.task_status]}),n.max_visits!==void 0&&(0,X.jsxs)(Z,{children:[`max `,n.max_visits,` visits`]}),n.routing===`all`&&(0,X.jsx)(Z,{children:`fan out`}),n.join&&(0,X.jsxs)(Z,{children:[`join `,n.join.mode,` of `,n.join.from.join(`, `)]}),n.on_error&&(0,X.jsxs)(Z,{children:[`on error → `,n.on_error]})]}),n.description&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant`,children:n.description}),r.length>0&&(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:`Outgoing edges (first match wins)`}),r.map(({edge:e,index:t},n)=>(0,X.jsxs)(`div`,{className:`font-mono text-xs text-on-surface-variant`,"data-testid":`flow-node-detail-edge`,children:[n+1,`. → `,e.to,` `,(0,X.jsxs)(`span`,{className:`text-outline`,children:[`when `,oe(e.when)]}),e.label&&(0,X.jsxs)(`span`,{className:`text-outline`,children:[` (`,e.label,`)`]})]},t))]})]})}function Ne({run:e,selectedNodeId:t,onSelectNode:n}){return(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`div`,{className:`font-label text-xs font-medium text-outline`,children:[`Ledger (`,e.nodes.length,` `,e.nodes.length===1?`visit`:`visits`,`)`]}),e.nodes.length===0?(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`Nothing has run yet.`}):(0,X.jsx)(`div`,{className:`space-y-1`,children:e.nodes.map((e,r)=>(0,X.jsxs)(`div`,{onClick:()=>n(e.node_id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&n(e.node_id)},"data-testid":`flow-ledger-row`,"data-node-id":e.node_id,"data-node-status":e.status,"data-node-outcome":e.outcome??``,className:`w-full text-left p-2 rounded-lg border transition-colors cursor-pointer ${t===e.node_id?`border-primary/40 bg-primary/5`:`border-surface-highest bg-surface-highest/40 hover:bg-surface-highest/70`}`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,X.jsx)(`span`,{className:`font-label text-[10px] text-outline`,children:r+1}),(0,X.jsx)(`span`,{className:`font-body text-sm text-on-surface`,children:e.node_id}),(0,X.jsxs)(`span`,{className:`font-label text-[10px] text-outline`,children:[`visit `,e.attempt,e.retry>0?` · retry ${e.retry}`:``]}),(0,X.jsx)(`span`,{className:`font-label text-[10px] ${Oe[e.status]??`text-outline`}`,children:e.status.replace(/_/g,` `)}),e.outcome&&(0,X.jsxs)(`span`,{className:`font-label text-[10px] text-primary`,children:[`→ `,e.outcome]}),(0,X.jsxs)(`span`,{className:`font-label text-[10px] text-outline ml-auto`,children:[W(e.started_at??e.created_at,e.ended_at),e.started_at===null&&de(e.status)?` waiting`:``]})]}),e.summary&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant mt-1 whitespace-pre-wrap`,children:e.summary}),e.error&&(0,X.jsx)(`div`,{className:`font-body text-sm text-error mt-1 whitespace-pre-wrap`,children:e.error}),e.gateway_session_id&&(0,X.jsxs)(G,{to:`/sessions/${e.gateway_session_id}`,onClick:e=>e.stopPropagation(),className:`font-mono text-xs text-primary hover:underline mt-1 inline-block`,"data-testid":`flow-ledger-session-link`,children:[`session `,e.gateway_session_id.slice(-8)]})]},`${e.node_id}-${e.attempt}-${e.retry}`))})]})}function Pe({children:e}){return(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-outline`,children:[(0,X.jsx)(B,{size:12}),`Flow`,e]})}var $=[`git_repo`,`git_branch`,`git_worktree`,`github_issue`,`github_pr`],Fe={git_repo:`Repository folder`,git_branch:`Branch`,git_worktree:`Worktree folder`,github_issue:`GitHub issue URL`,github_pr:`GitHub PR URL`};function Ie({task:e}){let[t,n]=(0,Y.useState)(!1),[r,i]=(0,Y.useState)(()=>Object.fromEntries($.map(t=>[t,e[t]??``]))),a=y();return(0,X.jsxs)(`section`,{"data-testid":`task-git-links`,className:`space-y-2 text-xs`,children:[(0,X.jsxs)(`div`,{className:`flex justify-between`,children:[(0,X.jsx)(`strong`,{children:`Git / GitHub`}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`task-git-edit`,onClick:()=>{i(Object.fromEntries($.map(t=>[t,e[t]??``]))),n(!t)},children:`Edit links`})]}),t?(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),a.mutate({id:e.id,...Object.fromEntries($.map(e=>[e,r[e].trim()||null]))},{onSuccess:()=>n(!1)})},className:`space-y-2`,children:[$.map(e=>(0,X.jsxs)(`label`,{className:`block`,children:[Fe[e],(0,X.jsx)(`input`,{"data-testid":`task-link-${e}`,className:`w-full bg-surface-highest p-2`,value:r[e],onChange:t=>i({...r,[e]:t.target.value})})]},e)),(0,X.jsx)(`button`,{type:`submit`,"data-testid":`task-git-save`,disabled:a.isPending,className:`text-primary`,children:`Save links`}),a.error&&(0,X.jsx)(`p`,{role:`alert`,children:a.error.message})]}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[$.map(t=>e[t]?(0,X.jsxs)(`p`,{className:`break-all`,children:[Fe[t],`:`,` `,t.startsWith(`github_`)?(0,X.jsx)(`a`,{href:e[t]??``,target:`_blank`,rel:`noreferrer`,className:`text-primary`,children:e[t]}):e[t]]},t):null),!$.some(t=>e[t])&&(0,X.jsx)(`p`,{className:`text-outline`,children:`No links yet. Link a checkout from its terminal Git panel, or edit here.`})]})]})}function Le({taskId:e}){let[t]=R(),{data:n,isLoading:r,error:i,refetch:a}=ve(e),o=(n??[]).filter(e=>e.tokens_used!=null),s=o.reduce((e,t)=>e+(t.tokens_used??0),0),c=(n??[]).map(e=>e.last_activity_at??``).sort().pop();return(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,"data-testid":`task-sessions`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs text-outline`,children:[(0,X.jsx)(V,{size:12}),`Agent sessions`,n&&n.length>0&&(0,X.jsxs)(`span`,{className:`font-body text-xs normal-case tracking-normal text-on-surface-variant`,children:[` `,`· `,n.length,` ·`,` `,ge(s,o.some(e=>e.tokens_estimated)),` `,`tokens · last active `,J(c??null)]})]}),i?(0,X.jsx)(pe,{message:i.message,onRetry:()=>a()}):r?(0,X.jsx)(`p`,{role:`status`,className:`text-sm text-outline`,children:`Loading agent sessions…`}):!n||n.length===0?(0,X.jsx)(`div`,{className:`font-body text-xs text-outline`,children:`No session yet. Add a session: line with the session id to the task body, or pick the task on the Sessions page.`}):(0,X.jsx)(`div`,{className:`space-y-1`,children:n.map(e=>(0,X.jsxs)(`div`,{"data-testid":`task-session-row`,className:`flex flex-wrap items-center gap-3 px-2 py-2 rounded-lg`,children:[(0,X.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${_e[e.status].dot}`,title:_e[e.status].label}),(0,X.jsx)(`span`,{className:`font-label text-xs text-primary w-14 shrink-0`,children:e.agent}),(0,X.jsx)(G,{to:me(`/sessions?session=${encodeURIComponent(e.id)}`,t.get(`project`)??e.project_id),"data-testid":`task-session-link`,className:`flex-1 min-w-0 truncate font-body text-xs text-on-surface hover:text-primary`,title:e.name??void 0,children:e.name??e.session_id}),(0,X.jsx)(`span`,{className:`font-label text-xs text-outline shrink-0`,children:he(e)}),(0,X.jsx)(`span`,{className:`font-label text-xs text-outline shrink-0`,children:J(e.last_activity_at)}),(0,X.jsx)(be,{session:e})]},e.id))})]})}var Re=[`todo`,`doing`,`review`,`blocked`,`done`],ze=[`low`,`normal`,`high`,`critical`],Be=[`blocks`,`blocked_by`,`relates_to`,`duplicates`,`clones`,`subtask_of`,`parent_of`];function Ve({taskId:e,open:t,onOpenChange:n}){let{data:u,isLoading:p,error:h,refetch:g}=se(e),{data:v}=ne(e),{data:y}=C(e),{data:b}=ae(),x=_(),T=re(),E=m(),[D,k]=(0,Y.useState)(``),[N,F]=(0,Y.useState)(`human`),[oe,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(``),[B,ce]=(0,Y.useState)(`relates_to`),[V,H]=(0,Y.useState)(!1),ue=()=>{e&&D.trim()&&x.mutate({id:e,content:D.trim(),author:N||`human`},{onSuccess:()=>{k(``)}})},de=()=>{e&&R.trim()&&T.mutate({id:e,to_task_id:R.trim(),link_type:B},{onSuccess:()=>{z(``),L(!1)}})},W=(0,Y.useMemo)(()=>y?y.reduce((e,t)=>{let n=t.link_type;return e[n]||(e[n]=[]),e[n].push(t),e},{}):{},[y]),G=ie(u??{}),q=I(u??{}),fe=(0,Y.useMemo)(()=>!u?.project_id||!b?null:b.find(e=>e.id===u.project_id)?.name??u.project_id.slice(-6),[u?.project_id,b]),J=e=>e?new Date(e).toLocaleString():`-`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{open:t,onOpenChange:n,children:(0,X.jsxs)(S,{"data-testid":`task-detail-sheet`,defaultWidth:620,resizeKey:`tasks`,children:[(0,X.jsx)(M,{children:p?(0,X.jsx)(O,{className:`h-5 w-48 bg-surface-highest`}):u?(0,X.jsxs)(`div`,{className:`space-y-2 pr-6`,children:[(0,X.jsx)(j,{children:u.title}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(xe,{status:u.status}),(0,X.jsx)(ye,{priority:u.priority})]})]}):(0,X.jsx)(j,{children:`Task not found`})}),(0,X.jsxs)(ee,{children:[(x.error||T.error||E.error)&&(0,X.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-error`,children:(x.error??T.error??E.error)?.message}),h?(0,X.jsx)(pe,{message:h.message,onRetry:()=>g()}):p?(0,X.jsx)(`div`,{className:`space-y-4`,children:Array.from({length:6}).map((e,t)=>(0,X.jsx)(O,{className:`h-8 w-full bg-surface-highest`},t))}):u?(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(Ie,{task:u},u.id),u.body&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Body`}),(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface whitespace-pre-wrap wrap-break-word bg-transparent p-3 rounded-lg border border-border`,children:u.body})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,X.jsx)(U,{label:`ID`,children:(0,X.jsx)(`span`,{className:`font-mono text-xs break-all`,children:u.id})}),(0,X.jsx)(U,{label:`Author`,children:u.author}),(0,X.jsx)(U,{label:`Claimed By`,children:u.claimed_by??`-`}),(0,X.jsx)(U,{label:`Project`,children:fe??`-`}),(0,X.jsx)(U,{label:`Skill`,children:u.skill_name??`-`}),(0,X.jsxs)(U,{label:`Agent Backend`,children:[(0,X.jsx)(`span`,{"data-testid":`task-backend-name`,children:q.label}),q.available===!1&&(0,X.jsxs)(`span`,{className:`text-error`,title:`This backend is not usable right now`,children:[` `,`○`]})]}),(0,X.jsx)(U,{label:`Flow`,children:(0,X.jsx)(`span`,{"data-testid":`task-flow-name`,children:G.label})}),(0,X.jsx)(U,{label:`Required Review`,children:u.required_review?`Yes`:`No`}),(0,X.jsx)(U,{label:`Max Review Rounds`,children:u.max_review_rounds}),(0,X.jsx)(U,{label:`Due`,children:(0,X.jsx)(`span`,{className:(e=>e?new Date(e)<new Date:!1)(u.due_at)&&u.status!==`done`?`text-error`:``,children:J(u.due_at)})}),(0,X.jsx)(U,{label:`Created`,children:J(u.created_at)}),(0,X.jsx)(U,{label:`Updated`,children:J(u.updated_at)})]}),u.progress>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Progress`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`flex-1 h-2 bg-surface-highest rounded-lg overflow-hidden`,children:(0,X.jsx)(`div`,{className:`h-full bg-primary rounded-lg transition-all`,style:{width:`${Math.min(100,u.progress)}%`}})}),(0,X.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[u.progress,`%`]})]})]}),u.tags&&u.tags.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Tags`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:u.tags.map(e=>(0,X.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-label bg-primary/10 text-primary border border-primary/20 rounded-lg`,children:e},e))})]}),(0,X.jsx)(Le,{taskId:u.id}),(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,children:[(0,X.jsx)(Pe,{}),(0,X.jsx)(ke,{taskId:u.id})]}),(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-outline`,children:[(0,X.jsx)(d,{size:12}),`Links`]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>L(!0),className:`text-primary hover:text-primary/80 transition-colors`,children:(0,X.jsx)(P,{size:14})})]}),y&&y.length>0?(0,X.jsx)(`div`,{className:`space-y-2`,children:Object.entries(W).map(([t,n])=>(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:t.replace(/_/g,` `)}),n.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 bg-surface-highest/50 rounded-lg`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:t.from_task_id===e?t.to_task_id.slice(-6):t.from_task_id.slice(-6)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>E.mutate({taskId:e,linkId:t.id}),className:`text-outline hover:text-error transition-colors p-0.5`,children:(0,X.jsx)(f,{size:10})})]},t.id))]},t))}):(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`No links`}),oe&&(0,X.jsxs)(`div`,{className:`space-y-2 p-2 bg-surface-highest/30 rounded-lg border border-surface-highest`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Link Type`}),(0,X.jsxs)(c,{value:B,onValueChange:e=>ce(e),children:[(0,X.jsx)(a,{className:`bg-background border-control-border text-on-surface font-label text-xs h-7`,children:(0,X.jsx)(i,{})}),(0,X.jsx)(o,{className:`bg-surface-highest border-surface-highest`,children:Be.map(e=>(0,X.jsx)(s,{value:e,className:`font-label text-xs`,children:e.replace(/_/g,` `)},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Target Task ID`}),(0,X.jsx)(K,{value:R,onChange:e=>z(e.target.value),placeholder:`Task ID...`,className:`bg-background border-control-border text-on-surface font-body text-sm h-7`})]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,X.jsx)(r,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{L(!1),z(``)},className:`font-label text-xs text-outline h-6 px-2`,children:`Cancel`}),(0,X.jsx)(r,{size:`sm`,onClick:de,disabled:T.isPending||!R.trim(),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90 h-6 px-2`,children:`Add`})]})]})]}),(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-outline`,children:[(0,X.jsx)(le,{size:12}),`Comments (`,v?.length??0,`)`]}),v&&v.length>0&&(0,X.jsx)(`div`,{className:`space-y-2`,children:v.map(e=>(0,X.jsxs)(`div`,{className:`py-2 border-b border-border space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`font-label text-xs text-primary`,children:e.author}),(0,X.jsx)(`span`,{className:`font-label text-[10px] text-outline`,children:new Date(e.created_at).toLocaleString()})]}),(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface whitespace-pre-wrap wrap-break-word`,children:e.content})]},e.id))}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(K,{"aria-label":`Comment author`,value:N,onChange:e=>F(e.target.value),placeholder:`Author`,className:`bg-background border-control-border text-on-surface font-body text-sm h-7 w-24`}),(0,X.jsx)(w,{value:D,onChange:e=>k(e.target.value),placeholder:`Add a comment...`,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none flex-1`,rows:2})]}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(r,{"data-testid":`task-comment-submit`,size:`sm`,onClick:ue,disabled:x.isPending||!D.trim(),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90 h-6 px-2`,children:x.isPending?`...`:`Comment`})})]})]})]}):(0,X.jsx)(`div`,{className:`text-outline font-label text-xs font-medium text-center py-8`,children:`Task not found`})]}),u&&(0,X.jsx)(te,{children:(0,X.jsx)(r,{size:`sm`,onClick:()=>H(!0),className:`font-label text-xs font-medium bg-transparent text-on-surface border border-control-border hover:bg-surface`,children:`Edit task`})})]})}),u&&V&&(0,X.jsx)(He,{task:u,open:V,onClose:()=>H(!1)})]})}function He({task:e,open:t,onClose:n}){let{data:u}=ae(),d=y(),[f,p]=(0,Y.useState)(e.title),[m,g]=(0,Y.useState)(e.body??``),[_,ee]=(0,Y.useState)(e.status),[b,te]=(0,Y.useState)(e.priority),[S,ne]=(0,Y.useState)(e.due_at??``),[C,re]=(0,Y.useState)((e.tags??[]).join(`, `)),[E,ie]=(0,Y.useState)(e.project_id??``),[O,k]=(0,Y.useState)(e.skill_name??``),[A,j]=(0,Y.useState)(e.agent_backend??`__default__`),[M,N]=(0,Y.useState)(e.required_review),[P,F]=(0,Y.useState)(String(e.max_review_rounds)),[I,oe]=(0,Y.useState)(e.flow_name??`__default__`);return(0,X.jsx)(D,{open:t,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(v,{"data-testid":`edit-task-dialog`,className:`bg-surface-high border-border max-w-lg max-h-[85vh] overflow-y-auto`,children:[(0,X.jsx)(z,{children:(0,X.jsx)(h,{className:`font-headline text-sm font-medium text-on-surface`,children:`Edit task`})}),(0,X.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),!f.trim())return;let r=C.split(`,`).map(e=>e.trim()).filter(Boolean);d.mutate({id:e.id,title:f.trim(),body:m.trim()||null,status:_,priority:b,due_at:S||null,tags:r.length>0?r:null,project_id:E||null,skill_name:O||null,agent_backend:A===`__default__`?null:A,required_review:M,max_review_rounds:Number(P)||3,...e.flow_override?{}:{flow_name:I===`__default__`?null:I}},{onSuccess:()=>n()})},className:`space-y-4 mt-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Title *`}),(0,X.jsx)(K,{"aria-label":`Title`,"data-testid":`edit-task-title`,value:f,onChange:e=>p(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Body`}),(0,X.jsx)(w,{"aria-label":`Body`,value:m,onChange:e=>g(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`,rows:4})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Status`}),(0,X.jsxs)(c,{value:_,onValueChange:e=>ee(e),children:[(0,X.jsx)(a,{"aria-label":`Status`,className:`bg-background border-control-border text-on-surface font-label text-xs`,children:(0,X.jsx)(i,{})}),(0,X.jsx)(o,{className:`bg-surface-highest border-surface-highest`,children:Re.map(e=>(0,X.jsx)(s,{value:e,className:`font-label text-xs`,children:e.replace(/_/g,` `)},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Priority`}),(0,X.jsxs)(c,{value:b,onValueChange:e=>te(e),children:[(0,X.jsx)(a,{"aria-label":`Priority`,className:`bg-background border-control-border text-on-surface font-label text-xs`,children:(0,X.jsx)(i,{})}),(0,X.jsx)(o,{className:`bg-surface-highest border-surface-highest`,children:ze.map(e=>(0,X.jsx)(s,{value:e,className:`font-label text-xs`,children:e},e))})]})]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Due date`}),(0,X.jsx)(K,{type:`datetime-local`,value:S?S.slice(0,16):``,onChange:e=>ne(e.target.value?new Date(e.target.value).toISOString():``),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Project`}),(0,X.jsxs)(c,{value:E||`__none__`,onValueChange:e=>ie(e===`__none__`?``:e),children:[(0,X.jsx)(a,{"aria-label":`Project`,className:`bg-background border-control-border text-on-surface font-label text-xs`,children:(0,X.jsx)(i,{})}),(0,X.jsxs)(o,{className:`bg-surface-highest border-surface-highest`,children:[(0,X.jsx)(s,{value:`__none__`,className:`font-label text-xs`,children:`None`}),u?.map(e=>(0,X.jsx)(s,{value:e.id,className:`font-label text-xs`,children:e.name},e.id))]})]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Tags (comma-separated)`}),(0,X.jsx)(K,{"aria-label":`Tags`,value:C,onChange:e=>re(e.target.value),placeholder:`tag1, tag2`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Skill Name`}),(0,X.jsx)(K,{"aria-label":`Skill override`,value:O,onChange:e=>k(e.target.value),placeholder:`e.g. code-review`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsx)(ce,{value:A,onChange:j,testId:`edit-task-backend`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5 flex items-center gap-2 pt-4`,children:[(0,X.jsx)(`input`,{type:`checkbox`,id:`edit-required-review`,checked:M,onChange:e=>N(e.target.checked),className:`accent-primary`}),(0,X.jsx)(l,{htmlFor:`edit-required-review`,className:`font-label text-xs font-medium text-outline cursor-pointer`,children:`Required Review`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(l,{className:`font-label text-xs font-medium text-outline`,children:`Max Review Rounds`}),(0,X.jsx)(K,{type:`number`,value:P,onChange:e=>F(e.target.value),min:1,className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),e.flow_override?(0,X.jsxs)(`p`,{className:`font-body text-sm text-outline`,"data-testid":`task-flow-override-note`,children:[`This task carries an inline flow definition (flow_override), which beats any named flow. Detach it with `,(0,X.jsx)(`code`,{children:`orc flow attach`}),` to use a named flow instead.`]}):(0,X.jsx)(x,{value:I,onChange:oe,testId:`edit-task-flow`}),(0,X.jsxs)(T,{children:[(0,X.jsx)(r,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,className:`font-label text-xs text-outline`,children:`Cancel`}),(0,X.jsx)(r,{"data-testid":`edit-task-submit`,type:`submit`,size:`sm`,disabled:d.isPending||!f.trim(),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90`,children:d.isPending?`Saving...`:`Save`})]})]})]})})}export{Ve as t};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{l as r,t as i}from"./button-PNx108iL.js";import{n as a,t as o}from"./useMutation-DDLZlpLS.js";import{t as s}from"./react-dom-DTbwZiiP.js";import{i as c,n as l,r as u,t as d}from"./tabs-DWq5oObc.js";import{a as f,i as p,n as m,r as h,t as g}from"./select-Cg0xEvji.js";import{t as _}from"./createLucideIcon-jLuHkL03.js";import{t as v}from"./TaskDetailSheet-0hZx_-me.js";import{t as y}from"./list-DhKHpsuX.js";import{t as b}from"./trash-D7o9t0-a.js";import{n as x}from"./client-BEiLQQ-F.js";import{E as ee,F as S,P as C,U as te,an as ne,k as w,kn as re,on as T,rn as ie,wn as E,wt as ae}from"./index-Ck-SDgTR.js";import{t as oe}from"./ConfirmDialog-BGZ6sd6E.js";import{t as se}from"./ErrorState-B0KI2D4y.js";import{t as ce}from"./ViewHeader-CX02p2eb.js";import{t as D}from"./useDetailRoute-1i4Z0-d5.js";import{t as le}from"./EmptyState-YM4VSLR9.js";import{a as ue,i as O,n as k,o as de,r as A,t as fe}from"./table-DC8IBMHg.js";import{t as j}from"./useProjectScope-C7yZQa4i.js";import{t as pe}from"./PriorityBadge-_KMVnMst.js";import{t as me}from"./StatusBadge-CZQsVLgL.js";var he={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};he.node;var ge=_(he),M={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};M.node;var N=_(M),P=e(s()),F=e(t()),I=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function L(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function _e(e){return`nodeType`in e}function R(e){return e?L(e)?e:_e(e)?e.ownerDocument?.defaultView??window:window:window}function ve(e){let{Document:t}=R(e);return e instanceof t}function z(e){return!L(e)&&e instanceof R(e).HTMLElement}function ye(e){return e instanceof R(e).SVGElement}function B(e){return e?L(e)?e.document:_e(e)?ve(e)?e:z(e)||ye(e)?e.ownerDocument:document:document:document}var V=I?F.useLayoutEffect:F.useEffect;function H(e){let t=(0,F.useRef)(e);return V(()=>{t.current=e}),(0,F.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function U(){let e=(0,F.useRef)(null);return[(0,F.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,F.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function be(e,t){t===void 0&&(t=[e]);let n=(0,F.useRef)(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function W(e,t){let n=(0,F.useRef)();return(0,F.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function G(e){let t=H(e),n=(0,F.useRef)(null);return[n,(0,F.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function xe(e){let t=(0,F.useRef)();return(0,F.useEffect)(()=>{t.current=e},[e]),t.current}var Se={};function Ce(e,t){return(0,F.useMemo)(()=>{if(t)return t;let n=Se[e]==null?0:Se[e]+1;return Se[e]=n,e+`-`+n},[e,t])}function K(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var q=K(1),we=K(-1);function Te(e){return`clientX`in e&&`clientY`in e}function Ee(e){if(!e)return!1;let{KeyboardEvent:t}=R(e.target);return t&&e instanceof t}function De(e){if(!e)return!1;let{TouchEvent:t}=R(e.target);return t&&e instanceof t}function Oe(e){if(De(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Te(e)?{x:e.clientX,y:e.clientY}:null}var ke=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[ke.Translate.toString(e),ke.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Ae=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function je(e){return e.matches(Ae)?e:e.querySelector(Ae)}var Me={display:`none`};function Ne(e){let{id:t,value:n}=e;return F.createElement(`div`,{id:t,style:Me},n)}function Pe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return F.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Fe(){let[e,t]=(0,F.useState)(``);return{announce:(0,F.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Ie=(0,F.createContext)(null);function Le(e){let t=(0,F.useContext)(Ie);(0,F.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Re(){let[e]=(0,F.useState)(()=>new Set),t=(0,F.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,F.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var ze={draggable:`
|
|
2
|
-
To pick up a draggable item, press the space bar.
|
|
3
|
-
While dragging, use the arrow keys to move the item.
|
|
4
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
-
`},Be={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Ve(e){let{announcements:t=Be,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=ze}=e,{announce:a,announcement:o}=Fe(),s=Ce(`DndLiveRegion`),[c,l]=(0,F.useState)(!1);if((0,F.useEffect)(()=>{l(!0)},[]),Le((0,F.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=F.createElement(F.Fragment,null,F.createElement(Ne,{id:r,value:i.draggable}),F.createElement(Pe,{id:s,announcement:o}));return n?(0,P.createPortal)(u,n):u}var J;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(J||={});function He(){}function Ue(e,t){return(0,F.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function We(){var e=[...arguments];return(0,F.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Y=Object.freeze({x:0,y:0});function Ge(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Ke(e,t){let n=Oe(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function qe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Je(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ye(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Xe(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}var Ze=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Ye(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Ye(r),o=i.reduce((e,t,r)=>e+Ge(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(qe)};function Qe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var $e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Qe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Je)};function et(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Y}function nt(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var rt=nt(1);function it(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function at(e,t,n){let r=it(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ot={ignoreTransform:!1};function st(e,t){t===void 0&&(t=ot);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=R(e).getComputedStyle(e);t&&(n=at(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ct(e){return st(e,{ignoreTransform:!0})}function lt(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ut(e,t){return t===void 0&&(t=R(e).getComputedStyle(e)),t.position===`fixed`}function dt(e,t){t===void 0&&(t=R(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function ft(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ve(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!z(i)||ye(i)||n.includes(i))return n;let a=R(e).getComputedStyle(i);return i!==e&&dt(i,a)&&n.push(i),ut(i,a)?n:r(i.parentNode)}return e?r(e):n}function pt(e){let[t]=ft(e,1);return t??null}function mt(e){return!I||!e?null:L(e)?e:_e(e)?ve(e)||e===B(e).scrollingElement?window:z(e)?e:null:null}function ht(e){return L(e)?e.scrollX:e.scrollLeft}function gt(e){return L(e)?e.scrollY:e.scrollTop}function _t(e){return{x:ht(e),y:gt(e)}}var X;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(X||={});function vt(e){return!I||!e?!1:e===document.scrollingElement}function yt(e){let t={x:0,y:0},n=vt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var bt={x:.2,y:.2};function xt(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=bt);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=yt(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=X.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=X.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=X.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=X.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function St(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ct(e){return e.reduce((e,t)=>q(e,_t(t)),Y)}function wt(e){return e.reduce((e,t)=>e+ht(t),0)}function Tt(e){return e.reduce((e,t)=>e+gt(t),0)}function Et(e,t){if(t===void 0&&(t=st),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);pt(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Dt=[[`x`,[`left`,`right`],wt],[`y`,[`top`,`bottom`],Tt]],Ot=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=ft(t),r=Ct(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Dt)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},kt=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function At(e){let{EventTarget:t}=R(e);return e instanceof t?e:B(e)}function jt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function Mt(e){e.preventDefault()}function Nt(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Q||={});var Pt={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter,Q.Tab]},Ft=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Q.Right:return{...n,x:n.x+25};case Q.Left:return{...n,x:n.x-25};case Q.Down:return{...n,y:n.y+25};case Q.Up:return{...n,y:n.y-25}}},It=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new kt(B(t)),this.windowListeners=new kt(R(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Et(n),t(Y)}handleKeyDown(e){if(Ee(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Pt,coordinateGetter:a=Ft,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Y;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=we(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=yt(n),p=St(n),m={x:Math.min(i===Q.Right?p.right-p.width/2:p.right,Math.max(i===Q.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Q.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Q.Down?p.top:p.top+p.height/2,u.y))},h=i===Q.Right&&!s||i===Q.Left&&!c,g=i===Q.Down&&!l||i===Q.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Q.Right&&e<=d.x||i===Q.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===Q.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Q.Down&&e<=d.y||i===Q.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===Q.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,q(we(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};It.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Pt,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Lt(e){return!!(e&&`distance`in e)}function Rt(e){return!!(e&&`delay`in e)}var zt=class{constructor(e,t,n){n===void 0&&(n=At(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=B(i),this.documentListeners=new kt(this.document),this.listeners=new kt(n),this.windowListeners=new kt(R(i)),this.initialCoordinates=Oe(r)??Y,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,Mt),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,Mt),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Lt(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,Nt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Oe(e)??Y,s=we(n,o);if(!t&&a){if(Lt(a)){if(a.tolerance!=null&&jt(s,a.tolerance))return this.handleCancel();if(jt(s,a.distance))return this.handleStart()}if(Rt(a)&&jt(s,a.tolerance))return this.handleCancel();this.handlePending(a,s)}else e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Bt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Vt=class extends zt{constructor(e){let{event:t}=e,n=B(t.target);super(e,Bt,n)}};Vt.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Ht={move:{name:`mousemove`},end:{name:`mouseup`}},Ut;(function(e){e[e.RightClick=2]=`RightClick`})(Ut||={});var Wt=class extends zt{constructor(e){super(e,Ht,B(e.event.target))}};Wt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Ut.RightClick&&(r?.({event:n}),!0)}}];var Gt={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Kt=class extends zt{constructor(e){super(e,Gt)}static setup(){return window.addEventListener(Gt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Gt.move.name,e)};function e(){}}};Kt.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var qt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(qt||={});var Jt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Jt||={});function Yt(e){let{acceleration:t,activator:n=qt.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Jt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Zt({delta:d,disabled:!a}),[m,h]=U(),g=(0,F.useRef)({x:0,y:0}),_=(0,F.useRef)({x:0,y:0}),v=(0,F.useMemo)(()=>{switch(n){case qt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qt.DraggableRect:return i}},[n,i,c]),y=(0,F.useRef)(null),b=(0,F.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,F.useMemo)(()=>s===Jt.TreeOrder?[...l].reverse():l,[s,l]);(0,F.useEffect)(()=>{if(!a||!l.length||!v)h();else{for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=xt(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()}},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Xt={x:{[X.Backward]:!1,[X.Forward]:!1},y:{[X.Backward]:!1,[X.Forward]:!1}};function Zt(e){let{delta:t,disabled:n}=e,r=xe(t);return W(e=>{if(n||!r||!e)return Xt;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[X.Backward]:e.x[X.Backward]||i.x===-1,[X.Forward]:e.x[X.Forward]||i.x===1},y:{[X.Backward]:e.y[X.Backward]||i.y===-1,[X.Forward]:e.y[X.Forward]||i.y===1}}},[n,t,r])}function Qt(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return W(e=>t==null?null:r??e??null,[r,t])}function $t(e,t){return(0,F.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var en;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(en||={});var tn;(function(e){e.Optimized=`optimized`})(tn||={});var nn=new Map;function rn(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,F.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,F.useRef)(e),d=g(),f=be(d),p=(0,F.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,F.useRef)(null),h=W(t=>{if(d&&!n)return nn;if(!t||t===nn||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Ot(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,F.useEffect)(()=>{u.current=e},[e]),(0,F.useEffect)(()=>{d||p()},[n,d]),(0,F.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,F.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case en.Always:return!1;case en.BeforeDragging:return n;default:return!n}}}function an(e,t){return W(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function on(e,t){return an(e,t)}function sn(e){let{callback:t,disabled:n}=e,r=H(t),i=(0,F.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,F.useEffect)(()=>()=>i?.disconnect(),[i]),i}function cn(e){let{callback:t,disabled:n}=e,r=H(t),i=(0,F.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,F.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ln(e){return new Ot(st(e),e)}function un(e,t,n){t===void 0&&(t=ln);let[r,i]=(0,F.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=sn({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=cn({callback:a});return V(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function dn(e){return tt(e,an(e))}var fn=[];function pn(e){let t=(0,F.useRef)(e),n=W(n=>e?n&&n!==fn&&e&&t.current&&e.parentNode===t.current.parentNode?n:ft(e):fn,[e]);return(0,F.useEffect)(()=>{t.current=e},[e]),n}function mn(e){let[t,n]=(0,F.useState)(null),r=(0,F.useRef)(e),i=(0,F.useCallback)(e=>{let t=mt(e.target);t&&n(e=>e?(e.set(t,_t(t)),new Map(e)):null)},[]);return(0,F.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=mt(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,_t(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{mt(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,F.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>q(e,t),Y):Ct(e):Y,[e,t])}function hn(e,t){t===void 0&&(t=[]);let n=(0,F.useRef)(null);return(0,F.useEffect)(()=>{n.current=null},t),(0,F.useEffect)(()=>{let t=e!==Y;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?we(e,n.current):Y}function gn(e){(0,F.useEffect)(()=>{if(!I)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function _n(e,t){return(0,F.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function vn(e){return(0,F.useMemo)(()=>e?lt(e):null,[e])}var yn=[];function bn(e,t){t===void 0&&(t=st);let[n]=e,r=vn(n?R(n):null),[i,a]=(0,F.useState)(yn);function o(){a(()=>e.length?e.map(e=>vt(e)?r:new Ot(t(e),e)):yn)}let s=cn({callback:o});return V(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function xn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return z(t)?t:e}function Sn(e){let{measure:t}=e,[n,r]=(0,F.useState)(null),i=cn({callback:(0,F.useCallback)(e=>{for(let{target:n}of e)if(z(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=G((0,F.useCallback)(e=>{let n=xn(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,F.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Cn=[{sensor:Vt,options:{}},{sensor:It,options:{}}],wn={current:{}},Tn={draggable:{measure:ct},droppable:{measure:ct,strategy:en.WhileDragging,frequency:tn.Optimized},dragOverlay:{measure:st}},En=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Dn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new En,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:He},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tn,measureDroppableContainers:He,windowRect:null,measuringScheduled:!1},On={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:He,draggableNodes:new Map,over:null,measureDroppableContainers:He},kn=(0,F.createContext)(On),An=(0,F.createContext)(Dn);function jn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new En}}}function Mn(e,t){switch(t.type){case J.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case J.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case J.DragEnd:case J.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case J.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new En(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case J.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new En(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case J.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new En(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Nn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,F.useContext)(kn),a=xe(r),o=xe(n?.id);return(0,F.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ee(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=je(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Pn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Fn(e){return(0,F.useMemo)(()=>({draggable:{...Tn.draggable,...e?.draggable},droppable:{...Tn.droppable,...e?.droppable},dragOverlay:{...Tn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function In(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,F.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;V(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=tt(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=pt(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Ln=(0,F.createContext)({...Y,scaleX:1,scaleY:1}),Rn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Rn||={});var zn=(0,F.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Cn,collisionDetection:o=$e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,F.useReducer)(Mn,void 0,jn),[f,p]=Re(),[m,h]=(0,F.useState)(Rn.Uninitialized),g=m===Rn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),ee=(0,F.useRef)({initial:null,translated:null}),S=(0,F.useMemo)(()=>_==null?null:{id:_,data:x?.data??wn,rect:ee},[_,x]),C=(0,F.useRef)(null),[te,ne]=(0,F.useState)(null),[w,re]=(0,F.useState)(null),T=be(l,Object.values(l)),ie=Ce(`DndDescribedBy`,t),E=(0,F.useMemo)(()=>b.getEnabled(),[b]),ae=Fn(s),{droppableRects:oe,measureDroppableContainers:se,measuringScheduled:ce}=rn(E,{dragging:g,dependencies:[y.x,y.y],config:ae.droppable}),D=Qt(v,_),le=(0,F.useMemo)(()=>w?Oe(w):null,[w]),ue=ke(),O=on(D,ae.draggable.measure);In({activeNode:_==null?null:v.get(_),config:ue.layoutShiftCompensation,initialRect:O,measure:ae.draggable.measure});let k=un(D,ae.draggable.measure,O),de=un(D?D.parentElement:null),A=(0,F.useRef)({activatorEvent:null,active:null,activeNode:D,collisionRect:null,collisions:null,droppableRects:oe,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=b.getNodeFor(A.current.over?.id),j=Sn({measure:ae.dragOverlay.measure}),pe=j.nodeRef.current??D,me=g?j.rect??k:null,he=!!(j.nodeRef.current&&j.rect),ge=dn(he?null:k),M=vn(pe?R(pe):null),N=pn(g?fe??D:null),I=bn(N),L=Pn(c,{transform:{x:y.x-ge.x,y:y.y-ge.y,scaleX:1,scaleY:1},activatorEvent:w,active:S,activeNodeRect:k,containerNodeRect:de,draggingNodeRect:me,over:A.current.over,overlayNodeRect:j.rect,scrollableAncestors:N,scrollableAncestorRects:I,windowRect:M}),_e=le?q(le,y):null,ve=mn(N),z=hn(ve),ye=hn(ve,[k]),B=q(L,z),H=me?rt(me,L):null,U=S&&H?o({active:S,collisionRect:H,droppableRects:oe,droppableContainers:E,pointerCoordinates:_e}):null,W=Xe(U,`id`),[G,xe]=(0,F.useState)(null),Se=et(he?L:q(L,ye),G?.rect??null,k),K=(0,F.useRef)(null),we=(0,F.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(C.current==null)return;let i=v.get(C.current);if(!i)return;let a=e.nativeEvent,o=new n({active:C.current,activeNode:i,event:a,options:r,context:A,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=T.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=T.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=C.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=T.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:ee}};(0,P.unstable_batchedUpdates)(()=>{r?.(i),h(Rn.Initializing),d({type:J.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),ne(K.current),re(a)})},onMove(e){d({type:J.DragMove,coordinates:e})},onEnd:s(J.DragEnd),onCancel:s(J.DragCancel)});K.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=A.current,o=null;if(t&&i){let{cancelDrop:s}=T.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===J.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=J.DragCancel)}C.current=null,(0,P.unstable_batchedUpdates)(()=>{d({type:e}),h(Rn.Uninitialized),xe(null),ne(null),re(null),K.current=null;let t=e===J.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=T.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Te=$t(a,(0,F.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(C.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},C.current=r,we(n,t))},[v,we]));gn(a),V(()=>{k&&m===Rn.Initializing&&h(Rn.Initialized)},[k,m]),(0,F.useEffect)(()=>{let{onDragMove:e}=T.current,{active:t,activatorEvent:n,collisions:r,over:i}=A.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:B.x,y:B.y},over:i};(0,P.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[B.x,B.y]),(0,F.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=A.current;if(!e||C.current==null||!t||!i)return;let{onDragOver:a}=T.current,o=r.get(W),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,P.unstable_batchedUpdates)(()=>{xe(s),a?.(c),f({type:`onDragOver`,event:c})})},[W]),V(()=>{A.current={activatorEvent:w,active:S,activeNode:D,collisionRect:H,collisions:U,droppableRects:oe,draggableNodes:v,draggingNode:pe,draggingNodeRect:me,droppableContainers:b,over:G,scrollableAncestors:N,scrollAdjustedTranslate:B},ee.current={initial:me,translated:H}},[S,D,U,H,v,pe,me,oe,b,G,N,B]),Yt({...ue,delta:y,draggingRect:H,pointerCoordinates:_e,scrollableAncestors:N,scrollableAncestorRects:I});let Ee=(0,F.useMemo)(()=>({active:S,activeNode:D,activeNodeRect:k,activatorEvent:w,collisions:U,containerNodeRect:de,dragOverlay:j,draggableNodes:v,droppableContainers:b,droppableRects:oe,over:G,measureDroppableContainers:se,scrollableAncestors:N,scrollableAncestorRects:I,measuringConfiguration:ae,measuringScheduled:ce,windowRect:M}),[S,D,k,w,U,de,j,v,b,oe,G,se,N,I,ae,ce,M]),De=(0,F.useMemo)(()=>({activatorEvent:w,activators:Te,active:S,activeNodeRect:k,ariaDescribedById:{draggable:ie},dispatch:d,draggableNodes:v,over:G,measureDroppableContainers:se}),[w,Te,S,k,d,ie,v,G,se]);return F.createElement(Ie.Provider,{value:p},F.createElement(kn.Provider,{value:De},F.createElement(An.Provider,{value:Ee},F.createElement(Ln.Provider,{value:Se},i)),F.createElement(Nn,{disabled:n?.restoreFocus===!1})),F.createElement(Ve,{...n,hiddenTextDescribedById:ie}));function ke(){let e=te?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Bn=(0,F.createContext)(null),Vn=`button`,Hn=`Draggable`;function Un(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ce(Hn),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,F.useContext)(kn),{role:p=Vn,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,F.useContext)(g?Ln:Bn),[v,y]=G(),[b,x]=G(),ee=_n(o,t),S=be(n);return V(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:S}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,F.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Vn?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:ee,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Wn(){return(0,F.useContext)(An)}var Gn=`Droppable`,Kn={timeout:25};function qn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ce(Gn),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,F.useContext)(kn),u=(0,F.useRef)({disabled:n}),d=(0,F.useRef)(!1),f=(0,F.useRef)(null),p=(0,F.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Kn,...i},_=be(h??r),v=cn({callback:(0,F.useCallback)(()=>{d.current?(p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)):d.current=!0},[g]),disabled:m||!o}),[y,b]=G((0,F.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=be(t);return(0,F.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,F.useEffect)(()=>(s({type:J.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:J.UnregisterDroppable,key:a,id:r})),[r]),(0,F.useEffect)(()=>{n!==u.current.disabled&&(s({type:J.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Jn(e){let{animation:t,children:n}=e,[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(null),s=xe(n);return!n&&!r&&s&&i(s),V(()=>{if(!a)return;let e=r?.key,n=r?.props.id;e==null||n==null?i(null):Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),F.createElement(F.Fragment,null,n,r?(0,F.cloneElement)(r,{ref:o}):null)}var Yn={x:0,y:0,scaleX:1,scaleY:1};function Xn(e){let{children:t}=e;return F.createElement(kn.Provider,{value:On},F.createElement(Ln.Provider,{value:Yn},t))}var Zn={position:`fixed`,touchAction:`none`},Qn=e=>Ee(e)?`transform 250ms ease`:void 0,$n=(0,F.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Qn}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Zn,width:s.width,height:s.height,top:s.top,left:s.left,transform:ke.Transform.toString(d),transformOrigin:i&&r?Ke(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return F.createElement(n,{className:o,style:f,ref:t},a)}),er={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ke.Transform.toString(t)},{transform:ke.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function tr(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return H((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=xn(a);if(!c)return;let{transform:l}=R(a).getComputedStyle(a),u=it(l);if(!u)return;let d=typeof t==`function`?t:nr(t);return Et(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function nr(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...er,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var rr=0;function ir(e){return(0,F.useMemo)(()=>{if(e!=null)return rr++,rr},[e])}var ar=F.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Wn(),ee=(0,F.useContext)(Ln),S=ir(d?.id),C=Pn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:ee,windowRect:x}),te=an(f),ne=tr({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),w=te?g.setRef:void 0;return F.createElement(Xn,null,F.createElement(Jn,{animation:ne},d&&S?F.createElement($n,{key:S,id:d.id,ref:w,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:te,style:{zIndex:l,...i},transform:C},n):null))}),or=[{status:`todo`,label:`Todo`,color:`rgb(var(--muted-foreground))`},{status:`doing`,label:`In Progress`,color:`rgb(var(--progress))`},{status:`review`,label:`Review`,color:`rgb(var(--warning))`},{status:`blocked`,label:`Blocked`,color:`rgb(var(--error))`},{status:`done`,label:`Done`,color:`rgb(var(--success))`}];or.map(e=>e.status);function sr(e){switch(e){case`todo`:case`doing`:case`review`:case`blocked`:case`done`:return e;case`queued`:return`todo`;case`changes_requested`:return`review`;case`paused`:return`blocked`;case`cancelled`:return null;default:return null}}function cr(e){let t=sr(e);return t===null||t===e?null:e.replace(/_/g,` `)}var $=n();function lr({task:e,onDelete:t,onClick:n,isDragOverlay:r}){let{attributes:i,listeners:a,setNodeRef:o,setActivatorNodeRef:s,transform:c,isDragging:l}=Un({id:e.id,data:{type:`task`,task:e}}),u=(0,F.useRef)(null),d={transform:ke.Translate.toString(c),opacity:l?.3:1},f=cr(e.status),p=a?.onPointerDown,m=e=>{u.current={x:e.clientX,y:e.clientY},p?.(e)},h=t=>{if(!n||!u.current)return;let r=Math.abs(t.clientX-u.current.x),i=Math.abs(t.clientY-u.current.y);u.current=null,r<5&&i<5&&n(e)},g=r?{}:{onPointerDown:m};return(0,$.jsx)(`div`,{ref:r?void 0:o,style:r?void 0:d,"data-testid":`kanban-card`,"data-task-id":e.id,"data-task-status":e.status,...g,onPointerUp:r?void 0:h,className:`
|
|
6
|
-
group relative bg-background border-b border-border/65 rounded-md
|
|
7
|
-
cursor-grab active:cursor-grabbing
|
|
8
|
-
hover:bg-surface-high
|
|
9
|
-
transition-colors duration-150
|
|
10
|
-
${r?`bg-surface shadow-lg`:``}
|
|
11
|
-
`,children:(0,$.jsxs)(`div`,{className:`pl-4 pr-3 py-4`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`Open task: ${e.title}`,onClick:t=>{t.detail===0&&n?.(e)},className:`w-full text-left font-body text-sm text-on-surface line-clamp-2 leading-relaxed hover:text-primary`,children:e.title}),(e.git_branch||e.github_issue||e.github_pr)&&(0,$.jsxs)(`p`,{"data-testid":`task-git-badge`,className:`text-xs text-primary truncate`,children:[e.git_branch,e.github_issue&&` · Issue #${e.github_issue.split(`/`).pop()}`,e.github_pr&&` · PR #${e.github_pr.split(`/`).pop()}`]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between mt-2 gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(pe,{priority:e.priority}),(0,$.jsx)(`span`,{className:`shrink-0 w-4 h-4 rounded-lg bg-surface-highest
|
|
12
|
-
text-[8px] font-label font-bold text-outline
|
|
13
|
-
flex items-center justify-center`,children:e.author?.[0]??`?`}),f&&(0,$.jsx)(`span`,{"data-testid":`kanban-card-status`,className:`text-xs font-label text-on-surface-variant
|
|
14
|
-
px-1.5 py-0.5 rounded shrink-0`,children:f}),e.tags?.slice(0,2).map(e=>(0,$.jsx)(`span`,{className:`text-xs font-label text-outline
|
|
15
|
-
px-1.5 py-0.5 rounded-lg truncate max-w-[60px]`,children:e},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[!r&&(0,$.jsx)(`button`,{type:`button`,ref:s,...i,onKeyDown:e=>a?.onKeyDown?.(e),"aria-label":`Move task: ${e.title}`,title:`Move task with Space, arrow keys, then Space to drop`,onPointerUp:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`inline-flex min-h-11 min-w-11 md:min-h-8 md:min-w-8 items-center justify-center rounded text-outline hover:text-on-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-primary`,children:(0,$.jsx)(ge,{size:14})}),e.comments_count!=null&&e.comments_count>0&&(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5 text-xs font-label text-outline`,title:`${e.comments_count} comment${e.comments_count===1?``:`s`}`,children:[(0,$.jsx)(T,{size:9}),e.comments_count]}),(0,$.jsx)(`span`,{className:`text-xs font-label text-outline`,children:ur(e.updated_at)}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Delete task: ${e.title}`,onPointerDown:e=>e.stopPropagation(),onClick:n=>{n.stopPropagation(),t(e.id)},className:`opacity-100 md:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 text-outline hover:text-error
|
|
16
|
-
transition-opacity min-h-11 min-w-11 md:min-h-8 md:min-w-8 inline-flex items-center justify-center`,children:(0,$.jsx)(b,{size:14})})]})]})]})})}function ur(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`now`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function dr({activeTask:e}){return(0,$.jsx)(ar,{dropAnimation:null,children:e?(0,$.jsx)(`div`,{className:`w-[260px]`,children:(0,$.jsx)(lr,{task:e,onDelete:()=>{},isDragOverlay:!0})}):null})}function fr({status:e,label:t,color:n,tasks:r,onDeleteTask:i,onCardClick:a,isValidDrop:o}){let{setNodeRef:s,isOver:c}=qn({id:e,data:{type:`column`,status:e}}),l=`border-transparent`;return o===!0&&c?l=`border-outline bg-surface-high`:o===!0?l=`border-border`:o===!1&&(l=`border-error border-dashed`),(0,$.jsxs)(`div`,{className:`
|
|
17
|
-
flex flex-col w-full md:min-w-[260px] md:max-w-[300px] md:flex-1
|
|
18
|
-
bg-background border rounded-lg
|
|
19
|
-
transition-all duration-200
|
|
20
|
-
${l}
|
|
21
|
-
`,children:[(0,$.jsx)(`div`,{className:`shrink-0 px-3 py-2.5 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{backgroundColor:n}}),(0,$.jsx)(`span`,{className:`font-label text-sm font-medium text-on-surface-variant`,children:t})]}),(0,$.jsx)(`span`,{className:`text-[11px] font-label px-1.5 py-0.5 rounded-xs
|
|
22
|
-
text-outline`,children:r.length})]})}),(0,$.jsxs)(`div`,{ref:s,"data-testid":`kanban-column`,"data-column-status":e,"data-drop-target":c,className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px]`,children:[r.map(e=>(0,$.jsx)(lr,{task:e,onDelete:i,onClick:a},e.id)),r.length===0&&(0,$.jsx)(`div`,{className:`flex items-center justify-center h-16 text-outline text-sm font-label`,children:`Empty`})]})]})}function pr({tasks:e,onUpdateStatus:t,onDeleteTask:n,onCardClick:r}){let[i,a]=(0,F.useState)(null),o=We(Ue(Vt,{activationConstraint:{distance:5}}),Ue(It)),s=(0,F.useMemo)(()=>{let t={todo:[],doing:[],review:[],blocked:[],done:[]};for(let n of e){let e=sr(n.status);e&&t[e].push(n)}return t},[e]);function c(e){let t=e.active.data.current?.task;t&&a(t)}function l(e){let{active:n,over:r}=e;if(a(null),!r)return;let i=n.data.current?.task;if(!i)return;let o;if(r.data.current?.type===`column`)o=r.data.current.status;else if(r.data.current?.type===`task`){let e=r.data.current.task,t=sr(e.status);t&&(o=t)}o&&sr(i.status)!==o&&t(i.id,o)}function u(e){return!i||sr(i.status)===e?null:!0}return(0,$.jsxs)(zn,{sensors:o,collisionDetection:Ze,onDragStart:c,onDragEnd:l,children:[(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col gap-4 pb-4 md:flex-row md:overflow-x-auto`,children:or.map(e=>(0,$.jsx)(fr,{status:e.status,label:e.label,color:e.color,tasks:s[e.status],onDeleteTask:n,onCardClick:r,isValidDrop:u(e.status)},e.status))}),(0,$.jsx)(dr,{activeTask:i})]})}function mr({projectId:e}){let[t,n]=(0,F.useState)(`relevant`),[r,i]=(0,F.useState)(!1),o=a({queryKey:[`github`,e,t],queryFn:()=>x.git.githubItems(t,e),enabled:r,staleTime:3e4,retry:!1});return(0,$.jsxs)(`section`,{className:`border-b border-surface-highest p-3 text-xs space-y-2`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`github-board-toggle`,onClick:()=>i(!r),className:`text-primary`,children:r?`Hide GitHub`:`GitHub issues / PRs`}),r&&(0,$.jsxs)(`div`,{"data-testid":`github-board`,className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,$.jsxs)(`label`,{children:[`Show`,` `,(0,$.jsxs)(`select`,{"data-testid":`github-filter`,value:t,onChange:e=>n(e.target.value),className:`bg-surface-highest p-1`,children:[(0,$.jsx)(`option`,{value:`relevant`,children:`My work (branches + assignee + linked)`}),(0,$.jsx)(`option`,{value:`branches`,children:`Current branches / worktrees + linked`}),(0,$.jsx)(`option`,{value:`assigned`,children:`Assigned to me`}),(0,$.jsx)(`option`,{value:`all`,children:`All open items in known repositories`})]})]}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`github-refresh`,onClick:()=>void o.refetch(),children:`Refresh`}),o.data?.login&&(0,$.jsxs)(`span`,{"data-testid":`github-auth`,children:[o.data.login,` · `,o.data.auth]})]}),o.isFetching&&(0,$.jsx)(`p`,{children:`Loading GitHub…`}),o.error&&(0,$.jsx)(`p`,{role:`alert`,children:o.error.message}),o.data?.auth===`none`&&(0,$.jsx)(`p`,{"data-testid":`github-no-auth`,children:`Sign in with gh auth login, or configure github.token / ORC_GITHUB_TOKEN on the API machine.`}),o.data?.auth!==`none`&&o.data?.items.length===0&&(0,$.jsx)(`p`,{"data-testid":`github-empty`,children:`No matching open issues or PRs. Add a project repository folder, launch a terminal there, or choose a broader filter.`}),o.data?.truncated&&(0,$.jsx)(`p`,{role:`alert`,children:`Results limited by repository, pagination or request time budget. Narrow the project scope.`}),o.data?.errors.map(e=>(0,$.jsxs)(`p`,{role:`alert`,children:[e.repo,`: `,e.error]},e.repo)),(0,$.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2 xl:grid-cols-3 max-h-80 overflow-auto`,children:o.data?.items.map(t=>(0,$.jsx)(hr,{item:t,projectId:e},t.url))})]})]})}function hr({item:e,projectId:t}){let[n,i]=(0,F.useState)(``),a=r(),s=C(t?{project_id:t}:void 0),c=o({mutationFn:async r=>{let i={[e.kind===`issue`?`github_issue`:`github_pr`]:e.url,...e.branch?{git_branch:e.branch}:{}};return r?x.tasks.create({title:e.title,project_id:t,body:`${e.kind===`pr`?`PR`:`Issue`} #${e.number}: ${e.url}`,...i}):x.tasks.update(n,i)},onSuccess:()=>{a.invalidateQueries({queryKey:[`tasks`]}),a.invalidateQueries({queryKey:[`task`]}),a.invalidateQueries({queryKey:[`github`]})}});return(0,$.jsxs)(`article`,{"data-testid":`github-item`,"data-url":e.url,className:`bg-surface-high p-3 border border-surface-highest rounded-lg space-y-2`,children:[(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-primary`,children:[e.kind===`pr`?`PR`:`Issue`,` #`,e.number,` · `,e.repo]}),(0,$.jsx)(`p`,{children:e.title}),e.branch&&(0,$.jsx)(`p`,{children:e.branch}),(0,$.jsx)(`div`,{className:`flex gap-2`,children:e.task_ids.map(e=>(0,$.jsx)(E,{"data-testid":`github-linked-task`,to:`/tasks/${e}`,className:`text-primary`,children:`Open task`},e))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(`select`,{"data-testid":`github-link-task`,"aria-label":`Link ${e.kind} ${e.number} to task`,value:n,onChange:e=>i(e.target.value),className:`bg-surface-highest p-1 max-w-44`,children:[(0,$.jsx)(`option`,{value:``,children:`Choose task`}),s.data?.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`github-link-save`,disabled:!n||c.isPending,onClick:()=>c.mutate(!1),children:`Link task`}),!e.task_ids.length&&(0,$.jsx)(`button`,{type:`button`,"data-testid":`github-create-task`,disabled:c.isPending,onClick:()=>c.mutate(!0),className:`text-primary`,children:`Create task`})]}),c.error&&(0,$.jsx)(`p`,{role:`alert`,children:c.error.message})]})}var gr=[`low`,`normal`,`high`,`critical`],_r=[{value:`all`,label:`All`},{value:`todo`,label:`Todo`},{value:`doing`,label:`Doing`},{value:`review`,label:`Review`},{value:`blocked`,label:`Blocked`},{value:`done`,label:`Done`}],vr=[`todo`,`doing`,`review`,`blocked`,`done`],yr=new Set([`all`,`todo`,`queued`,`doing`,`review`,`changes_requested`,`blocked`,`done`,`cancelled`,`paused`]),br=new Set([`all`,`low`,`normal`,`high`,`critical`]);function xr({projectId:e}){let t=j(e),[n,r]=re(),a=(0,F.useRef)(n);a.current=n;let{selectedId:o,openDetail:s,closeDetail:_}=D(`/tasks`,`taskId`),x=n.get(`status`),E=x&&yr.has(x)?x:`all`,he=_r.some(({value:e})=>e===E)?_r:[..._r,{value:E,label:E.charAt(0).toUpperCase()+E.slice(1).replace(/_/g,` `)}],ge=n.get(`priority`),M=ge&&br.has(ge)?ge:`all`,P=n.get(`q`)??``,I=n.get(`view`)===`table`?`table`:`board`,L=(0,F.useCallback)((e,t,n)=>{let i=new URLSearchParams(a.current);t===null||t===``||t===n?i.delete(e):i.set(e,t),i.toString()!==a.current.toString()&&(a.current=i,r(i,{replace:e===`q`}))},[r]),_e=e=>L(`status`,e,`all`),R=e=>L(`priority`,e,`all`),ve=e=>L(`q`,e||null),z=e=>L(`view`,e,`board`),[ye,B]=(0,F.useState)(!1),[V,H]=(0,F.useState)(null),U=t===`all`||t===`unassigned`?void 0:t,{data:be,isLoading:W,error:G,refetch:xe}=C(U?{project_id:U}:void 0),Se=S(),Ce=w(),K=(0,F.useMemo)(()=>{let e=be??[];return t===`unassigned`?e.filter(e=>!e.project_id):e},[be,t]),q=(0,F.useMemo)(()=>{let e=K;if(E!==`all`&&(e=e.filter(e=>e.status===E)),M!==`all`&&(e=e.filter(e=>e.priority===M)),P.trim()){let t=P.trim().toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t))}return e},[K,E,M,P]),we=(0,F.useMemo)(()=>K.reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{}),[K]),Te=()=>{V&&Ce.mutate(V.id,{onSuccess:()=>H(null)})},Ee=(e,t)=>!e||t===`done`||t===`cancelled`?!1:new Date(e)<new Date;return G?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(ce,{title:`Tasks`}),(0,$.jsx)(se,{message:G.message,onRetry:()=>xe()})]}):(0,$.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,$.jsx)(ce,{title:`Tasks`,meta:`${K.length} total`,action:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex rounded-md overflow-hidden`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`tasks-view-board`,title:`Board view`,"aria-label":`Board view`,"aria-pressed":I===`board`,onClick:()=>z(`board`),className:`p-3 transition-colors ${I===`board`?`bg-surface-highest text-on-surface`:`text-outline hover:text-on-surface-variant`}`,children:(0,$.jsx)(N,{size:14})}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`tasks-view-table`,title:`Table view`,"aria-label":`Table view`,"aria-pressed":I===`table`,onClick:()=>z(`table`),className:`p-3 transition-colors ${I===`table`?`bg-surface-highest text-on-surface`:`text-outline hover:text-on-surface-variant`}`,children:(0,$.jsx)(y,{size:14})})]}),(0,$.jsxs)(i,{"data-testid":`new-task-button`,size:`sm`,onClick:()=>B(!0),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,$.jsx)(ne,{size:14,className:`mr-1`}),`New task`]})]})}),(0,$.jsx)(mr,{projectId:U}),(Se.error||Ce.error)&&(0,$.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-error`,children:(Se.error??Ce.error)?.message}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-4`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,$.jsx)(ie,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-outline`}),(0,$.jsx)(ae,{"aria-label":`Search tasks`,value:P,onChange:e=>ve(e.target.value),placeholder:`Search tasks...`,className:`bg-background border-control-border text-on-surface font-body text-xs pl-8 min-h-11`})]}),(0,$.jsxs)(g,{value:M,onValueChange:e=>R(e),children:[(0,$.jsx)(p,{"aria-label":`Filter by priority`,className:`bg-background border-control-border text-on-surface font-label text-xs w-36 min-h-11`,children:(0,$.jsx)(f,{placeholder:`Priority`})}),(0,$.jsxs)(m,{className:`bg-surface border-border`,children:[(0,$.jsx)(h,{value:`all`,className:`font-label text-xs`,children:`All Priorities`}),gr.map(e=>(0,$.jsx)(h,{value:e,className:`font-label text-xs`,children:e},e))]})]})]}),I===`board`?W?(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`space-y-2`,children:Array.from({length:5}).map((e,t)=>(0,$.jsx)(te,{className:`h-10 w-full bg-surface-highest`},t))}):(0,$.jsx)(pr,{tasks:q,onUpdateStatus:(e,t)=>Se.mutate({id:e,status:t}),onDeleteTask:e=>{let t=(be??[]).find(t=>t.id===e);t&&H(t)},onCardClick:e=>s(e.id)}):(0,$.jsxs)(d,{value:E,onValueChange:e=>_e(e),className:`mb-4`,children:[(0,$.jsx)(u,{className:`bg-background gap-1 h-auto p-0 flex-wrap justify-start`,children:he.map(({value:e,label:t})=>(0,$.jsxs)(c,{value:e,className:`font-label text-sm px-4 py-2 rounded-md
|
|
23
|
-
data-[state=active]:bg-surface-highest data-[state=active]:text-on-surface data-[state=active]:shadow-none
|
|
24
|
-
text-outline hover:text-on-surface-variant`,children:[t,e!==`all`&&we[e]!=null&&(0,$.jsx)(`span`,{className:`ml-1.5 text-xs text-outline px-1.5 py-0.5`,children:we[e]}),e===`all`&&(0,$.jsx)(`span`,{className:`ml-1.5 text-xs text-outline px-1.5 py-0.5`,children:K.length})]},e))}),(0,$.jsx)(l,{value:E,children:W?(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`space-y-2`,children:Array.from({length:5}).map((e,t)=>(0,$.jsx)(te,{className:`h-10 w-full bg-surface-highest`},t))}):q.length===0?(0,$.jsx)(le,{message:`No tasks`}):(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(fe,{children:[(0,$.jsx)(ue,{children:(0,$.jsxs)(de,{className:`border-b border-border hover:bg-transparent`,children:[(0,$.jsx)(O,{className:`font-label text-xs text-outline w-16`,children:`ID`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline`,children:`Title`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-40`,children:`Status`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-28`,children:`Priority`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-24`,children:`Tags`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-16`,title:`Comments`,children:(0,$.jsx)(T,{size:12,className:`inline`})}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-24`,children:`Due`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-24`,children:`Author`}),(0,$.jsx)(O,{className:`font-label text-xs text-outline w-24`,children:`Updated`}),(0,$.jsx)(O,{className:`w-10`})]})}),(0,$.jsx)(k,{children:q.map(e=>(0,$.jsxs)(de,{"data-testid":`task-row`,"data-task-id":e.id,"data-task-title":e.title,className:`border-b border-border/65 hover:bg-surface-high cursor-pointer`,onClick:()=>s(e.id),children:[(0,$.jsx)(A,{className:`font-label text-xs text-outline`,children:e.id.slice(-6)}),(0,$.jsx)(A,{className:`font-body text-xs text-on-surface max-w-xs truncate`,children:(0,$.jsx)(`button`,{type:`button`,className:`text-left font-medium hover:text-primary`,onClick:t=>{t.stopPropagation(),s(e.id)},children:e.title})}),(0,$.jsx)(A,{children:(0,$.jsx)(`div`,{onClick:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:(0,$.jsxs)(g,{value:e.status,onValueChange:t=>Se.mutate({id:e.id,status:t}),children:[(0,$.jsx)(p,{"aria-label":`Status for ${e.title}`,className:`min-h-10 w-auto border-0 bg-transparent p-1 gap-1`,children:(0,$.jsx)(f,{children:(0,$.jsx)(me,{status:e.status})})}),(0,$.jsx)(m,{className:`bg-surface border-border`,children:vr.map(e=>(0,$.jsx)(h,{value:e,className:`font-label text-xs`,children:e.replace(/_/g,` `)},e))})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(pe,{priority:e.priority})}),(0,$.jsx)(A,{children:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-0.5`,children:[e.tags&&e.tags.length>0?e.tags.slice(0,2).map(e=>(0,$.jsx)(`span`,{className:`px-1.5 py-0.5 text-xs font-label text-outline`,children:e},e)):(0,$.jsx)(`span`,{className:`text-outline text-xs`,children:`-`}),e.tags&&e.tags.length>2&&(0,$.jsxs)(`span`,{className:`text-outline text-xs`,children:[`+`,e.tags.length-2]})]})}),(0,$.jsx)(A,{className:`font-label text-xs text-outline`,"data-testid":`task-comments-count`,children:e.comments_count&&e.comments_count>0?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(T,{size:10}),e.comments_count]}):(0,$.jsx)(`span`,{className:`text-outline`,children:`-`})}),(0,$.jsx)(A,{className:`font-label text-xs ${Ee(e.due_at,e.status)?`text-error`:`text-outline`}`,children:e.due_at?new Date(e.due_at).toLocaleDateString():`-`}),(0,$.jsx)(A,{className:`font-label text-xs text-outline`,children:e.author}),(0,$.jsx)(A,{className:`font-label text-xs text-outline`,children:new Date(e.updated_at).toLocaleDateString()}),(0,$.jsx)(A,{children:(0,$.jsx)(`button`,{type:`button`,"data-testid":`task-delete`,"aria-label":`Delete ${e.title}`,onClick:t=>{t.stopPropagation(),H(e)},className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-md text-outline hover:text-error hover:bg-error/10 transition-colors p-2`,children:(0,$.jsx)(b,{size:12})})})]},e.id))})]})})})]}),ye&&(0,$.jsx)(ee,{open:ye,onClose:()=>B(!1),onCreated:s,defaultProjectId:t!==`all`&&t!==`unassigned`?t:void 0}),(0,$.jsx)(oe,{open:V!==null,title:`Delete Task`,description:`Are you sure you want to delete "${V?.title??``}"? This action cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,isPending:Ce.isPending,onConfirm:Te,onCancel:()=>H(null)}),(0,$.jsx)(v,{taskId:o,open:o!==null,onOpenChange:e=>{e||_()}})]})}export{xr as default};
|