agent-tower 0.7.4-beta.0 → 0.7.4
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/mcp/tools/tasks.js +3 -3
- package/dist/mcp/tools/tasks.js.map +1 -1
- package/dist/mcp/types.js +2 -2
- package/dist/mcp/types.js.map +1 -1
- package/dist/prompts/task-handoff.d.ts.map +1 -1
- package/dist/prompts/task-handoff.js +2 -1
- package/dist/prompts/task-handoff.js.map +1 -1
- package/dist/routes/__tests__/sessions-runtime.test.js +2 -0
- package/dist/routes/__tests__/sessions-runtime.test.js.map +1 -1
- package/dist/routes/__tests__/tasks.test.js +41 -0
- package/dist/routes/__tests__/tasks.test.js.map +1 -1
- package/dist/routes/__tests__/workspace-history.test.d.ts +2 -0
- package/dist/routes/__tests__/workspace-history.test.d.ts.map +1 -0
- package/dist/routes/__tests__/workspace-history.test.js +174 -0
- package/dist/routes/__tests__/workspace-history.test.js.map +1 -0
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +10 -0
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/tasks.d.ts.map +1 -1
- package/dist/routes/tasks.js +8 -0
- package/dist/routes/tasks.js.map +1 -1
- package/dist/runtime/__tests__/cli-driver-lifecycle.test.js +84 -0
- package/dist/runtime/__tests__/cli-driver-lifecycle.test.js.map +1 -1
- package/dist/runtime/cli-driver.js +11 -8
- package/dist/runtime/cli-driver.js.map +1 -1
- package/dist/services/__tests__/task.service.test.js +128 -13
- package/dist/services/__tests__/task.service.test.js.map +1 -1
- package/dist/services/__tests__/workspace.service.test.js +64 -5
- package/dist/services/__tests__/workspace.service.test.js.map +1 -1
- package/dist/services/message-delivery.service.d.ts +1 -0
- package/dist/services/message-delivery.service.d.ts.map +1 -1
- package/dist/services/session-manager.d.ts +4 -0
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +3 -1
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/session-resource-cleanup.d.ts +5 -0
- package/dist/services/session-resource-cleanup.d.ts.map +1 -1
- package/dist/services/session-resource-cleanup.js +7 -0
- package/dist/services/session-resource-cleanup.js.map +1 -1
- package/dist/services/task-cleanup.service.d.ts +2 -0
- package/dist/services/task-cleanup.service.d.ts.map +1 -1
- package/dist/services/task-cleanup.service.js +4 -0
- package/dist/services/task-cleanup.service.js.map +1 -1
- package/dist/services/task-display-state.d.ts +10 -0
- package/dist/services/task-display-state.d.ts.map +1 -0
- package/dist/services/task-display-state.js +45 -0
- package/dist/services/task-display-state.js.map +1 -0
- package/dist/services/task.service.d.ts +20 -1
- package/dist/services/task.service.d.ts.map +1 -1
- package/dist/services/task.service.js +134 -101
- package/dist/services/task.service.js.map +1 -1
- package/dist/services/workspace.service.d.ts +10 -7
- package/dist/services/workspace.service.d.ts.map +1 -1
- package/dist/services/workspace.service.js +160 -88
- package/dist/services/workspace.service.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-JXetlNBf.js → AgentDemoPage-D9bIiALx.js} +1 -1
- package/dist/web/assets/{AgentEnvironmentSettingsPage-CdYyUCwJ.js → AgentEnvironmentSettingsPage-BE0RC6fR.js} +1 -1
- package/dist/web/assets/{AttachmentPreview-DMS-PM-1.js → AttachmentPreview-TPd4gdfb.js} +2 -2
- package/dist/web/assets/{BranchSelect-BAq4L2ZS.js → BranchSelect-Kv3M1YhZ.js} +1 -1
- package/dist/web/assets/{BrandLogo--kWXXJtZ.js → BrandLogo-fR2lCwEo.js} +1 -1
- package/dist/web/assets/{ConversationPage-CvC4RyB5.js → ConversationPage-BZiMHI9T.js} +1 -1
- package/dist/web/assets/{CreateTaskInput-DjVxCAfc.js → CreateTaskInput-TcZpjBe-.js} +1 -1
- package/dist/web/assets/{DemoPage-cDVTGOp8.js → DemoPage-DwpThe16.js} +1 -1
- package/dist/web/assets/{DesignSystemPage-BI54IkKi.js → DesignSystemPage-DH9_cygJ.js} +1 -1
- package/dist/web/assets/{ExecutionPermissionSelector-f1UYIm1z.js → ExecutionPermissionSelector-C-akTOVg.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-C0yto6C_.js → GeneralSettingsPage-v2w1eofz.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-BiJSaHUi.js → LoadingPreviewPage-pgk3PWM9.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-BbHwZtyj.js → McpSettingsPage-w1DOlY5V.js} +1 -1
- package/dist/web/assets/{MemberAvatar-BLezO3vS.js → MemberAvatar-CJtylxwu.js} +1 -1
- package/dist/web/assets/MobileTaskDetail-D5Czlr2O.js +3 -0
- package/dist/web/assets/{NotificationSettingsPage-CiKoL2Kv.js → NotificationSettingsPage-CkLg4WvT.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-DCB48cPS.js → ProfileSettingsPage-B3yzbY1V.js} +1 -1
- package/dist/web/assets/ProjectKanbanPage-CuGSLvrU.js +14 -0
- package/dist/web/assets/{ProjectSettingsPage-COvIVq1h.js → ProjectSettingsPage-DoklOfna.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-CPuJcZDg.js → ProviderSettingsPage-Cm0hbX5n.js} +2 -2
- package/dist/web/assets/{SettingsMasterDetail-Cv7YaRJB.js → SettingsMasterDetail-CGCUalkW.js} +1 -1
- package/dist/web/assets/TaskDetail-BiZbuXcE.js +1 -0
- package/dist/web/assets/{TaskHandoffPanel-CxH3Mgyd.js → TaskHandoffPanel-CJahUKNo.js} +24 -24
- package/dist/web/assets/{TeamSettingsPage-D-XDefNd.js → TeamSettingsPage-CyppRTaY.js} +1 -1
- package/dist/web/assets/{TranslationSettingsPage-BPHI-SZW.js → TranslationSettingsPage-BoQXEZmn.js} +1 -1
- package/dist/web/assets/{arc-CC81aLuf.js → arc-5NPBSbiL.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-DL08XGaN.js → architectureDiagram-3BPJPVTR-CqPT-IsX.js} +1 -1
- package/dist/web/assets/{at-sign-DYPIlD6D.js → at-sign-Cf39WHCg.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-B4IW5WxI.js → blockDiagram-GPEHLZMM-BN-1z9KN.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-Cj4d_FqK.js → c4Diagram-AAUBKEIU-CkeLbmQp.js} +1 -1
- package/dist/web/assets/channel-CDkuQ_7m.js +1 -0
- package/dist/web/assets/check-yNWhPvMH.js +1 -0
- package/dist/web/assets/{chevron-down-DNhYsNAt.js → chevron-down-Ct7FZbKm.js} +1 -1
- package/dist/web/assets/{chevron-up-CjrLieBR.js → chevron-up-ARFlXMyO.js} +1 -1
- package/dist/web/assets/{chip-Cf92J-pQ.js → chip-BV_1-tIb.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-DeCj8QSD.js → chunk-2J33WTMH-CWR7tRuT.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-k-6rzQmQ.js → chunk-4BX2VUAB-CAulp4D5.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-qMTCQ5bX.js → chunk-55IACEB6-DqkKXsbD.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-CMnu18d1.js → chunk-727SXJPM-B19m45Sq.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-C0mFbUMn.js → chunk-AQP2D5EJ-CuODwkza.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-u6-_M137.js → chunk-FMBD7UC4-CbUAjtCT.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-DHrIE_8H.js → chunk-ND2GUHAM-C54VxArl.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-aTyC0wZq.js → chunk-QZHKN3VN-D54Uw5fD.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-eHY73FGu.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-eHY73FGu.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-CBIOQOMH.js → code-block-OCS4YCEC-CtAySD1h.js} +1 -1
- package/dist/web/assets/{confirm-dialog-DWeBZLJW.js → confirm-dialog-CCjHVFTv.js} +1 -1
- package/dist/web/assets/{content-JM9E1MeD.js → content-DZozZbBD.js} +2 -2
- package/dist/web/assets/{copy-D0gl9kF8.js → copy-C-jvx2et.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-xLyliSgU.js → cose-bilkent-S5V4N54A-BaB2EVcU.js} +1 -1
- package/dist/web/assets/{cssMode-DO5UnQ64.js → cssMode-wd7JR1S4.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-CbNpoO2d.js → dagre-BM42HDAG-C2j1Y8pO.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-CG3hKxAX.js → diagram-2AECGRRQ-CF-EvpV9.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-mQu9M28s.js → diagram-5GNKFQAL-rBNso835.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-BSeEp_Uw.js → diagram-KO2AKTUF-6NW-oos1.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-D6yRdao-.js → diagram-LMA3HP47-DTfRxRLT.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-BUBUW9wD.js → diagram-OG6HWLK6-CS4Ae-hD.js} +1 -1
- package/dist/web/assets/{dialog-D1lkhqVL.js → dialog-DV4wfpNU.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-BQSZgRqq.js → erDiagram-TEJ5UH35-Dw9QQctN.js} +1 -1
- package/dist/web/assets/{file-BijjwxRR.js → file-Btui_I8Z.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-D-eqyr5Y.js → flowDiagram-I6XJVG4X-BGZ9q86S.js} +1 -1
- package/dist/web/assets/{folder-picker-Czxm0_S9.js → folder-picker-DiR-8Qdl.js} +1 -1
- package/dist/web/assets/{freemarker2-B4RvEa_U.js → freemarker2-yVWXzD3l.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-BWGkCt_x.js → ganttDiagram-6RSMTGT7-CkGun0no.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DGVc49pR.js → gitGraphDiagram-PVQCEYII-Bz3oiYvi.js} +1 -1
- package/dist/web/assets/{globe-Ce01-45x.js → globe-DAFqpAcW.js} +1 -1
- package/dist/web/assets/{handlebars-oyT7drqS.js → handlebars-BPf0z6eN.js} +1 -1
- package/dist/web/assets/{html-CxxWf2Qk.js → html-HCTCjfUg.js} +1 -1
- package/dist/web/assets/{htmlMode-RfAHh5Jj.js → htmlMode-BDkbsknt.js} +1 -1
- package/dist/web/assets/index-408ws6FY.css +1 -0
- package/dist/web/assets/{index-Dh-tgeaL.js → index-B8xoIIa6.js} +4 -4
- package/dist/web/assets/{index-T38iVLEb.js → index-BMcLxIvZ.js} +1 -1
- package/dist/web/assets/{index-DWrSDMX2.js → index-BPqjxXmH.js} +1 -1
- package/dist/web/assets/index-BszkzNS4.js +122 -0
- package/dist/web/assets/{index-DyJfPc4O.js → index-DgUtx9rV.js} +1 -1
- package/dist/web/assets/{index-Pt4TsHjm.js → index-DkSPjZm4.js} +1 -1
- package/dist/web/assets/{index-hpHE1jXY.js → index-DuM6iAxG.js} +1 -1
- package/dist/web/assets/{index-BMZFF1UJ.js → index-GuczxPxb.js} +1 -1
- package/dist/web/assets/{index-Disv1kQS.js → index-lZLy5rkr.js} +1 -1
- package/dist/web/assets/{infoDiagram-5YYISTIA-DLPs3dV_.js → infoDiagram-5YYISTIA-DYFufUYC.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-d_OrnwDY.js → ishikawaDiagram-YF4QCWOH-IOkrKRwu.js} +1 -1
- package/dist/web/assets/javascript-DKmxrNeR.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-EtU1st_0.js → journeyDiagram-JHISSGLW-Btl3yxne.js} +1 -1
- package/dist/web/assets/{jsonMode-Bqh5vIxx.js → jsonMode-DJPdvFcw.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-ZWzUnsFK.js → kanban-definition-UN3LZRKU-CDryhPbA.js} +1 -1
- package/dist/web/assets/{kbd-IjDGsZ2B.js → kbd-8RRRm9jd.js} +1 -1
- package/dist/web/assets/{key-round-CbnAuUxp.js → key-round-wojrCrDP.js} +1 -1
- package/dist/web/assets/{layers-Pdy9vZ6K.js → layers-BH_LL4b8.js} +1 -1
- package/dist/web/assets/{linear-D7n23wcA.js → linear-BLuwKHze.js} +1 -1
- package/dist/web/assets/{link-Bl1ZbjFh.js → link-jWQOSQOQ.js} +1 -1
- package/dist/web/assets/{liquid-Ds47iVLN.js → liquid-1y-xg637.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-Dcch3bsp.js → lspLanguageFeatures-cYkILdCn.js} +1 -1
- package/dist/web/assets/{mdx-CM7ky-2B.js → mdx-CRg4Q6aP.js} +1 -1
- package/dist/web/assets/{menu-DubntFHq.js → menu-CMqbaDni.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-nBsnjgeU.js → mermaid-NOHMQCX5-CYeAhOl-.js} +4 -4
- package/dist/web/assets/{message-square-BE-pW0m_.js → message-square-DykJ2lWP.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-ClHORNTt.js → mindmap-definition-RKZ34NQL-B5wtw1Rv.js} +1 -1
- package/dist/web/assets/{modal-CHLtZWvx.js → modal-BwOwTzij.js} +1 -1
- package/dist/web/assets/{monaco-BbAmalE2.js → monaco-CcHqpOKe.js} +3 -3
- package/dist/web/assets/{nav-row-DH7rNq1V.js → nav-row-BmtdNLxR.js} +1 -1
- package/dist/web/assets/{paperclip-YP3Bk1lI.js → paperclip-C4t49vX2.js} +1 -1
- package/dist/web/assets/{pencil-BFDuhbtW.js → pencil-BQ5_raiB.js} +1 -1
- package/dist/web/assets/{people-DEeNaaLt.js → people-Dr0v8HK0.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-BUOaKIyP.js → pieDiagram-4H26LBE5-BZ3VoaNI.js} +1 -1
- package/dist/web/assets/{popover-CUmBEXxL.js → popover-CTqvKqTR.js} +1 -1
- package/dist/web/assets/{python-BODTtU6m.js → python-Huq_acyd.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Caezg-U2.js → quadrantDiagram-W4KKPZXB-C6ArHmnG.js} +1 -1
- package/dist/web/assets/{razor-CHm8DY1p.js → razor-Clc87Ivb.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-BtdP3Ka6.js → requirementDiagram-4Y6WPE33-DiLzBRQP.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-Bv74oA-n.js → sankeyDiagram-5OEKKPKP-QlYYd7IZ.js} +1 -1
- package/dist/web/assets/{search-ClmOQd4H.js → search-CMIAPUEt.js} +1 -1
- package/dist/web/assets/{select-CYtYPr-c.js → select-Bg7NI8i0.js} +1 -1
- package/dist/web/assets/{select-BB7QG08o.js → select-DqB7YF38.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-DuNPl-dg.js → sequenceDiagram-3UESZ5HK-COKEtqc0.js} +1 -1
- package/dist/web/assets/{server-bEB_DY55.js → server-D7knl8H9.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-B72HAgBJ.js → stateDiagram-AJRCARHV-1RZZZdOe.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CCLmVs34.js +1 -0
- package/dist/web/assets/{textarea-BqYPvoO-.js → textarea-BCY2J2ca.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-DTmHUgmQ.js → timeline-definition-PNZ67QCA-IJl1LY6J.js} +1 -1
- package/dist/web/assets/{toggles-a5fkwT_D.js → toggles-C4LmZwyo.js} +1 -1
- package/dist/web/assets/{tooltip-DuyJMci9.js → tooltip-Cirpotu3.js} +1 -1
- package/dist/web/assets/{track-DCjyrv3n.js → track-Cv7h6oaE.js} +1 -1
- package/dist/web/assets/{trash-2-CIyBqaVy.js → trash-2-BEOQ1ICJ.js} +1 -1
- package/dist/web/assets/{tsMode-C1UXAkMh.js → tsMode-CHIbCBQc.js} +1 -1
- package/dist/web/assets/{typescript-Biht2wHb.js → typescript-CScj0bbb.js} +1 -1
- package/dist/web/assets/{upload-D05XS5-G.js → upload-tLVD0xMT.js} +1 -1
- package/dist/web/assets/{use-profiles-CrWTyz1G.js → use-profiles-TkoP4Yw9.js} +1 -1
- package/dist/web/assets/{use-providers-Dv1Nk6s7.js → use-providers-Bz6YNiYj.js} +1 -1
- package/dist/web/assets/{use-translation-settings-CcUnipVO.js → use-translation-settings-CCpQNS30.js} +1 -1
- package/dist/web/assets/{useNormalizedLogs-D9W1cT4R.js → useNormalizedLogs-Bstb98cF.js} +1 -1
- package/dist/web/assets/{useTokenUsage-CZ5mDshD.js → useTokenUsage-D7SEwXb0.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-ByoNydXe.js → vennDiagram-CIIHVFJN-DzVayy4U.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-BqdMkOLl.js → wardley-L42UT6IY-CULSKh55.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-AO22HrEF.js → wardleyDiagram-YWT4CUSO-C5_h3lAA.js} +1 -1
- package/dist/web/assets/{xml-NLGqNFDv.js → xml-XuycSwh6.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-vzPgjgqW.js → xychartDiagram-2RQKCTM6-F65naXcR.js} +1 -1
- package/dist/web/assets/{yaml-AWlGS_Ig.js → yaml-BWm159lw.js} +1 -1
- package/dist/web/index.html +2 -2
- package/node_modules/@agent-tower/shared/dist/index.d.ts +1 -0
- package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/index.js +1 -0
- package/node_modules/@agent-tower/shared/dist/index.js.map +1 -1
- package/node_modules/@agent-tower/shared/dist/task-hierarchy.d.ts +17 -0
- package/node_modules/@agent-tower/shared/dist/task-hierarchy.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/task-hierarchy.js +12 -0
- package/node_modules/@agent-tower/shared/dist/task-hierarchy.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/types.d.ts +20 -4
- package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20261027000000_preserve_workspace_history/migration.sql +2 -0
- package/prisma/schema.prisma +2 -0
- package/dist/web/assets/MobileTaskDetail-M_Kke9rL.js +0 -3
- package/dist/web/assets/ProjectKanbanPage-soDqevjQ.js +0 -12
- package/dist/web/assets/TaskDetail-CqhPxvg3.js +0 -1
- package/dist/web/assets/channel-CUa8oyzC.js +0 -1
- package/dist/web/assets/check-DaZqOL8l.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-BAx111NO.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BAx111NO.js +0 -1
- package/dist/web/assets/index-BN53vGxp.css +0 -1
- package/dist/web/assets/index-Cc3qXMhU.js +0 -122
- package/dist/web/assets/javascript-BNXtViSL.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Bu3l_CgB.js +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskDetail-CqhPxvg3.js","assets/index-Cc3qXMhU.js","assets/index-BN53vGxp.css","assets/TaskHandoffPanel-CxH3Mgyd.js","assets/trash-2-CIyBqaVy.js","assets/mermaid-NOHMQCX5-nBsnjgeU.js","assets/AttachmentPreview-DMS-PM-1.js","assets/tooltip-DuyJMci9.js","assets/kbd-IjDGsZ2B.js","assets/index-DWrSDMX2.js","assets/index-Disv1kQS.js","assets/index-Pt4TsHjm.js","assets/use-translation-settings-CcUnipVO.js","assets/copy-D0gl9kF8.js","assets/index-DyJfPc4O.js","assets/chevron-down-DNhYsNAt.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/use-providers-Dv1Nk6s7.js","assets/MemberAvatar-BLezO3vS.js","assets/people-DEeNaaLt.js","assets/chevron-up-CjrLieBR.js","assets/at-sign-DYPIlD6D.js","assets/paperclip-YP3Bk1lI.js","assets/check-DaZqOL8l.js","assets/useTokenUsage-CZ5mDshD.js","assets/CreateTaskInput-DjVxCAfc.js","assets/BranchSelect-BAq4L2ZS.js","assets/popover-CUmBEXxL.js","assets/search-ClmOQd4H.js","assets/menu-styles-DWynpVVz.js","assets/BrandLogo--kWXXJtZ.js","assets/index-hpHE1jXY.js","assets/index-BMZFF1UJ.js","assets/ExecutionPermissionSelector-f1UYIm1z.js","assets/menu-DubntFHq.js","assets/provider-selection-DSu7SCI7.js","assets/confirm-dialog-DWeBZLJW.js","assets/dialog-D1lkhqVL.js","assets/modal-CHLtZWvx.js","assets/select-BB7QG08o.js","assets/select-CYtYPr-c.js","assets/index-T38iVLEb.js","assets/layers-Pdy9vZ6K.js","assets/message-square-BE-pW0m_.js","assets/textarea-BqYPvoO-.js","assets/content-JM9E1MeD.js","assets/file-BijjwxRR.js","assets/server-bEB_DY55.js","assets/upload-D05XS5-G.js","assets/globe-Ce01-45x.js","assets/pencil-BFDuhbtW.js","assets/TaskHandoffPanel-DcpNTP1B.css","assets/useNormalizedLogs-D9W1cT4R.js","assets/track-DCjyrv3n.js","assets/chip-Cf92J-pQ.js","assets/folder-picker-Czxm0_S9.js","assets/MobileTaskDetail-M_Kke9rL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as tr,aX as Xr,p as Be,r as u,ab as F,aF as ht,as as Ye,bm as Ae,ay as re,b4 as Se,u as De,bn as nr,j as o,a5 as Ne,ap as Sn,az as nt,l as ie,a2 as rr,bo as Mt,bp as qr,bq as Vr,br as Jr,aN as sr,N as Zr,m as es,o as $t,n as hn,q as fe,X as ts,aA as ns,ae as rs,aj as Dt,aT as ss,t as Te,bs as os,bt as is,ai as as,bu as ls,bv as cs,bw as us,aP as Nn,aQ as En,bx as or}from"./index-Cc3qXMhU.js";import{C as ds}from"./confirm-dialog-DWeBZLJW.js";import{a as fs,k as hs,h as ms}from"./BranchSelect-BAq4L2ZS.js";import{f as gs,g as kn,j as jn,s as mt,k as ps,c as vs,C as Rn}from"./CreateTaskInput-DjVxCAfc.js";import{P as ir,T as bs}from"./trash-2-CIyBqaVy.js";import{C as bt}from"./check-DaZqOL8l.js";import{S as ar}from"./search-ClmOQd4H.js";import{F as xs}from"./chip-Cf92J-pQ.js";import{S as ys,I as Jt,B as Tn}from"./BrandLogo--kWXXJtZ.js";import{M as ws}from"./message-square-BE-pW0m_.js";import{L as an}from"./layers-Pdy9vZ6K.js";import{c as Cs,P as Ss,a as Ns,b as Es,I as ks}from"./popover-CUmBEXxL.js";import{C as An}from"./copy-D0gl9kF8.js";import{u as js}from"./use-providers-Dv1Nk6s7.js";import{i as Rs}from"./provider-selection-DSu7SCI7.js";import{F as Ts}from"./folder-picker-Czxm0_S9.js";import{M as Dn}from"./modal-CHLtZWvx.js";import{a as dt}from"./ExecutionPermissionSelector-f1UYIm1z.js";import{C as As}from"./chevron-down-DNhYsNAt.js";const Ds=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Is=tr("list-tree",Ds);const Ms=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],In=tr("smartphone",Ms),Zt=new Map;async function Ps(e,t,n){const r=`tower:task-start:${e}:${JSON.stringify(t)}`;let a=Zt.get(r);if(!a)try{const h=sessionStorage.getItem(r);h&&(a=JSON.parse(h))}catch{}a??={creationId:Xr()},Zt.set(r,a);const c=()=>{try{sessionStorage.setItem(r,JSON.stringify(a))}catch{}};c(),a.workspace||(n.onStep?.("creating-workspace"),a.workspace=await n.createWorkspace(a.creationId),c()),a.session||(n.onStep?.("creating-session"),a.session=await Be.post(`/workspaces/${a.workspace.id}/sessions`,{providerId:t.providerId,prompt:t.prompt,retryTask:t.retryTask,clientSubmissionId:a.creationId}),c()),n.onStep?.("starting-session"),await n.startSession(a.session.id),Zt.delete(r);try{sessionStorage.removeItem(r)}catch{}return{workspace:a.workspace,session:a.session}}const Kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function st(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function mn(e){return"nodeType"in e}function pe(e){var t,n;return e?st(e)?e:mn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function gn(e){const{Document:t}=pe(e);return e instanceof t}function Ct(e){return st(e)?!1:e instanceof pe(e).HTMLElement}function lr(e){return e instanceof pe(e).SVGElement}function ot(e){return e?st(e)?e.document:mn(e)?gn(e)?e:Ct(e)||lr(e)?e.ownerDocument:document:document:document}const Fe=Kt?u.useLayoutEffect:u.useEffect;function Gt(e){const t=u.useRef(e);return Fe(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function Os(){const e=u.useRef(null),t=u.useCallback((r,a)=>{e.current=setInterval(r,a)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function xt(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return Fe(()=>{n.current!==e&&(n.current=e)},t),n}function St(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Pt(e){const t=Gt(e),n=u.useRef(null),r=u.useCallback(a=>{a!==n.current&&t?.(a,n.current),n.current=a},[]);return[n,r]}function Ot(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let en={};function Wt(e,t){return u.useMemo(()=>{if(t)return t;const n=en[e]==null?0:en[e]+1;return en[e]=n,e+"-"+n},[e,t])}function cr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((c,h)=>{const f=Object.entries(h);for(const[s,i]of f){const l=c[s];l!=null&&(c[s]=l+e*i)}return c},{...t})}}const rt=cr(1),Lt=cr(-1);function Ls(e){return"clientX"in e&&"clientY"in e}function pn(e){if(!e)return!1;const{KeyboardEvent:t}=pe(e.target);return t&&e instanceof t}function zs(e){if(!e)return!1;const{TouchEvent:t}=pe(e.target);return t&&e instanceof t}function zt(e){if(zs(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ls(e)?{x:e.clientX,y:e.clientY}:null}const yt=Object.freeze({Translate:{toString(e){if(!e)return;const{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;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[yt.Translate.toString(e),yt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Mn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bs(e){return e.matches(Mn)?e:e.querySelector(Mn)}const Fs={display:"none"};function _s(e){let{id:t,value:n}=e;return F.createElement("div",{id:t,style:Fs},n)}function Us(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={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"};return F.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function $s(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ur=u.createContext(null);function Ks(e){const t=u.useContext(ur);u.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Gs(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:a,event:c}=r;e.forEach(h=>{var f;return(f=h[a])==null?void 0:f.call(h,c)})},[e]),t]}const Ws={draggable:`
|
|
3
|
-
To pick up a draggable item, press the space bar.
|
|
4
|
-
While dragging, use the arrow keys to move the item.
|
|
5
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
-
`},Qs={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 Ys(e){let{announcements:t=Qs,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=Ws}=e;const{announce:c,announcement:h}=$s(),f=Wt("DndLiveRegion"),[s,i]=u.useState(!1);if(u.useEffect(()=>{i(!0)},[]),Ks(u.useMemo(()=>({onDragStart(d){let{active:m}=d;c(t.onDragStart({active:m}))},onDragMove(d){let{active:m,over:p}=d;t.onDragMove&&c(t.onDragMove({active:m,over:p}))},onDragOver(d){let{active:m,over:p}=d;c(t.onDragOver({active:m,over:p}))},onDragEnd(d){let{active:m,over:p}=d;c(t.onDragEnd({active:m,over:p}))},onDragCancel(d){let{active:m,over:p}=d;c(t.onDragCancel({active:m,over:p}))}}),[c,t])),!s)return null;const l=F.createElement(F.Fragment,null,F.createElement(_s,{id:r,value:a.draggable}),F.createElement(Us,{id:f,announcement:h}));return n?ht.createPortal(l,n):l}var ae;(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"})(ae||(ae={}));function Bt(){}function Hs(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Xs(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ee=Object.freeze({x:0,y:0});function qs(e,t){const n=zt(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Vs(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Js(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zs(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),h=a-r,f=c-n;if(r<a&&n<c){const s=t.width*t.height,i=e.width*e.height,l=h*f,d=l/(s+i-l);return Number(d.toFixed(4))}return 0}const eo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const c of r){const{id:h}=c,f=n.get(h);if(f){const s=Zs(f,t);s>0&&a.push({id:h,data:{droppableContainer:c,value:s}})}}return a.sort(Vs)};function to(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function dr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ee}function no(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),c=1;c<r;c++)a[c-1]=arguments[c];return a.reduce((h,f)=>({...h,top:h.top+e*f.y,bottom:h.bottom+e*f.y,left:h.left+e*f.x,right:h.right+e*f.x}),{...n})}}const ro=no(1);function fr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function so(e,t,n){const r=fr(t);if(!r)return e;const{scaleX:a,scaleY:c,x:h,y:f}=r,s=e.left-h-(1-a)*parseFloat(n),i=e.top-f-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),l=a?e.width/a:e.width,d=c?e.height/c:e.height;return{width:l,height:d,top:i,right:s+l,bottom:i+d,left:s}}const oo={ignoreTransform:!1};function Nt(e,t){t===void 0&&(t=oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:i,transformOrigin:l}=pe(e).getComputedStyle(e);i&&(n=so(n,i,l))}const{top:r,left:a,width:c,height:h,bottom:f,right:s}=n;return{top:r,left:a,width:c,height:h,bottom:f,right:s}}function Pn(e){return Nt(e,{ignoreTransform:!0})}function io(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ao(e,t){return t===void 0&&(t=pe(e).getComputedStyle(e)),t.position==="fixed"}function lo(e,t){t===void 0&&(t=pe(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const c=t[a];return typeof c=="string"?n.test(c):!1})}function vn(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(gn(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Ct(a)||lr(a)||n.includes(a))return n;const c=pe(e).getComputedStyle(a);return a!==e&&lo(a,c)&&n.push(a),ao(a,c)?n:r(a.parentNode)}return e?r(e):n}function hr(e){const[t]=vn(e,1);return t??null}function tn(e){return!Kt||!e?null:st(e)?e:mn(e)?gn(e)||e===ot(e).scrollingElement?window:Ct(e)?e:null:null}function mr(e){return st(e)?e.scrollX:e.scrollLeft}function gr(e){return st(e)?e.scrollY:e.scrollTop}function ln(e){return{x:mr(e),y:gr(e)}}var he;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(he||(he={}));function pr(e){return!Kt||!e?!1:e===document.scrollingElement}function vr(e){const t={x:0,y:0},n=pr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,h=e.scrollTop>=r.y,f=e.scrollLeft>=r.x;return{isTop:a,isLeft:c,isBottom:h,isRight:f,maxScroll:r,minScroll:t}}const co={x:.2,y:.2};function uo(e,t,n,r,a){let{top:c,left:h,right:f,bottom:s}=n;r===void 0&&(r=10),a===void 0&&(a=co);const{isTop:i,isBottom:l,isLeft:d,isRight:m}=vr(e),p={x:0,y:0},g={x:0,y:0},x={height:t.height*a.y,width:t.width*a.x};return!i&&c<=t.top+x.height?(p.y=he.Backward,g.y=r*Math.abs((t.top+x.height-c)/x.height)):!l&&s>=t.bottom-x.height&&(p.y=he.Forward,g.y=r*Math.abs((t.bottom-x.height-s)/x.height)),!m&&f>=t.right-x.width?(p.x=he.Forward,g.x=r*Math.abs((t.right-x.width-f)/x.width)):!d&&h<=t.left+x.width&&(p.x=he.Backward,g.x=r*Math.abs((t.left+x.width-h)/x.width)),{direction:p,speed:g}}function fo(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:h}=window;return{top:0,left:0,right:c,bottom:h,width:c,height:h}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function br(e){return e.reduce((t,n)=>rt(t,ln(n)),Ee)}function ho(e){return e.reduce((t,n)=>t+mr(n),0)}function mo(e){return e.reduce((t,n)=>t+gr(n),0)}function xr(e,t){if(t===void 0&&(t=Nt),!e)return;const{top:n,left:r,bottom:a,right:c}=t(e);hr(e)&&(a<=0||c<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const go=[["x",["left","right"],ho],["y",["top","bottom"],mo]];class bn{constructor(t,n){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;const r=vn(n),a=br(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of go)for(const s of h)Object.defineProperty(this,s,{get:()=>{const i=f(r),l=a[c]-i;return this.rect[s]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class gt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function po(e){const{EventTarget:t}=pe(e);return e instanceof t?e:ot(e)}function nn(e,t){const 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:!1}var Ce;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ce||(Ce={}));function On(e){e.preventDefault()}function vo(e){e.stopPropagation()}var te;(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"})(te||(te={}));const yr={start:[te.Space,te.Enter],cancel:[te.Esc],end:[te.Space,te.Enter,te.Tab]},bo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case te.Right:return{...n,x:n.x+25};case te.Left:return{...n,x:n.x-25};case te.Down:return{...n,y:n.y+25};case te.Up:return{...n,y:n.y-25}}};class wr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new gt(ot(n)),this.windowListeners=new gt(pe(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ce.Resize,this.handleCancel),this.windowListeners.add(Ce.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ce.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&xr(r),n(Ee)}handleKeyDown(t){if(pn(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:c=yr,coordinateGetter:h=bo,scrollBehavior:f="smooth"}=a,{code:s}=t;if(c.end.includes(s)){this.handleEnd(t);return}if(c.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:i}=r.current,l=i?{x:i.left,y:i.top}:Ee;this.referenceCoordinates||(this.referenceCoordinates=l);const d=h(t,{active:n,context:r.current,currentCoordinates:l});if(d){const m=Lt(d,l),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const x of g){const v=t.code,{isTop:k,isRight:C,isLeft:y,isBottom:R,maxScroll:N,minScroll:M}=vr(x),P=fo(x),S={x:Math.min(v===te.Right?P.right-P.width/2:P.right,Math.max(v===te.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(v===te.Down?P.bottom-P.height/2:P.bottom,Math.max(v===te.Down?P.top:P.top+P.height/2,d.y))},z=v===te.Right&&!C||v===te.Left&&!y,_=v===te.Down&&!R||v===te.Up&&!k;if(z&&S.x!==d.x){const O=x.scrollLeft+m.x,G=v===te.Right&&O<=N.x||v===te.Left&&O>=M.x;if(G&&!m.y){x.scrollTo({left:O,behavior:f});return}G?p.x=x.scrollLeft-O:p.x=v===te.Right?x.scrollLeft-N.x:x.scrollLeft-M.x,p.x&&x.scrollBy({left:-p.x,behavior:f});break}else if(_&&S.y!==d.y){const O=x.scrollTop+m.y,G=v===te.Down&&O<=N.y||v===te.Up&&O>=M.y;if(G&&!m.x){x.scrollTo({top:O,behavior:f});return}G?p.y=x.scrollTop-O:p.y=v===te.Down?x.scrollTop-N.y:x.scrollTop-M.y,p.y&&x.scrollBy({top:-p.y,behavior:f});break}}this.handleMove(t,rt(Lt(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=yr,onActivation:a}=t,{active:c}=n;const{code:h}=e.nativeEvent;if(r.start.includes(h)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function Ln(e){return!!(e&&"distance"in e)}function zn(e){return!!(e&&"delay"in e)}class xn{constructor(t,n,r){var a;r===void 0&&(r=po(t.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=t,this.events=n;const{event:c}=t,{target:h}=c;this.props=t,this.events=n,this.document=ot(h),this.documentListeners=new gt(this.document),this.listeners=new gt(r),this.windowListeners=new gt(pe(h)),this.initialCoordinates=(a=zt(c))!=null?a:Ee,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ce.Resize,this.handleCancel),this.windowListeners.add(Ce.DragStart,On),this.windowListeners.add(Ce.VisibilityChange,this.handleCancel),this.windowListeners.add(Ce.ContextMenu,On),this.documentListeners.add(Ce.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ln(n)){this.handlePending(n);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(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ce.Click,vo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ce.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!a)return;const s=(n=zt(t))!=null?n:Ee,i=Lt(a,s);if(!r&&f){if(Ln(f)){if(f.tolerance!=null&&nn(i,f.tolerance))return this.handleCancel();if(nn(i,f.distance))return this.handleStart()}if(zn(f)&&nn(i,f.tolerance))return this.handleCancel();this.handlePending(f,i);return}t.cancelable&&t.preventDefault(),h(s)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===te.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const xo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class yn extends xn{constructor(t){const{event:n}=t,r=ot(n.target);super(t,xo,r)}}yn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const yo={move:{name:"mousemove"},end:{name:"mouseup"}};var cn;(function(e){e[e.RightClick=2]="RightClick"})(cn||(cn={}));class wo extends xn{constructor(t){super(t,yo,ot(t.event.target))}}wo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===cn.RightClick?!1:(r?.({event:n}),!0)}}];const rn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Co extends xn{constructor(t){super(t,rn)}static setup(){return window.addEventListener(rn.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(rn.move.name,t)};function t(){}}}Co.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var pt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(pt||(pt={}));var Ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ft||(Ft={}));function So(e){let{acceleration:t,activator:n=pt.Pointer,canScroll:r,draggingRect:a,enabled:c,interval:h=5,order:f=Ft.TreeOrder,pointerCoordinates:s,scrollableAncestors:i,scrollableAncestorRects:l,delta:d,threshold:m}=e;const p=Eo({delta:d,disabled:!c}),[g,x]=Os(),v=u.useRef({x:0,y:0}),k=u.useRef({x:0,y:0}),C=u.useMemo(()=>{switch(n){case pt.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case pt.DraggableRect:return a}},[n,a,s]),y=u.useRef(null),R=u.useCallback(()=>{const M=y.current;if(!M)return;const P=v.current.x*k.current.x,S=v.current.y*k.current.y;M.scrollBy(P,S)},[]),N=u.useMemo(()=>f===Ft.TreeOrder?[...i].reverse():i,[f,i]);u.useEffect(()=>{if(!c||!i.length||!C){x();return}for(const M of N){if(r?.(M)===!1)continue;const P=i.indexOf(M),S=l[P];if(!S)continue;const{direction:z,speed:_}=uo(M,S,C,t,m);for(const O of["x","y"])p[O][z[O]]||(_[O]=0,z[O]=0);if(_.x>0||_.y>0){x(),y.current=M,g(R,h),v.current=_,k.current=z;return}}v.current={x:0,y:0},k.current={x:0,y:0},x()},[t,R,r,x,c,h,JSON.stringify(C),JSON.stringify(p),g,i,N,l,JSON.stringify(m)])}const No={x:{[he.Backward]:!1,[he.Forward]:!1},y:{[he.Backward]:!1,[he.Forward]:!1}};function Eo(e){let{delta:t,disabled:n}=e;const r=Ot(t);return St(a=>{if(n||!r||!a)return No;const c={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[he.Backward]:a.x[he.Backward]||c.x===-1,[he.Forward]:a.x[he.Forward]||c.x===1},y:{[he.Backward]:a.y[he.Backward]||c.y===-1,[he.Forward]:a.y[he.Forward]||c.y===1}}},[n,t,r])}function ko(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return St(a=>{var c;return t==null?null:(c=r??a)!=null?c:null},[r,t])}function jo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,c=a.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,r)}));return[...n,...c]},[]),[e,t])}var wt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(wt||(wt={}));var un;(function(e){e.Optimized="optimized"})(un||(un={}));const Bn=new Map;function Ro(e,t){let{dragging:n,dependencies:r,config:a}=t;const[c,h]=u.useState(null),{frequency:f,measure:s,strategy:i}=a,l=u.useRef(e),d=v(),m=xt(d),p=u.useCallback(function(k){k===void 0&&(k=[]),!m.current&&h(C=>C===null?k:C.concat(k.filter(y=>!C.includes(y))))},[m]),g=u.useRef(null),x=St(k=>{if(d&&!n)return Bn;if(!k||k===Bn||l.current!==e||c!=null){const C=new Map;for(let y of e){if(!y)continue;if(c&&c.length>0&&!c.includes(y.id)&&y.rect.current){C.set(y.id,y.rect.current);continue}const R=y.node.current,N=R?new bn(s(R),R):null;y.rect.current=N,N&&C.set(y.id,N)}return C}return k},[e,c,n,d,s]);return u.useEffect(()=>{l.current=e},[e]),u.useEffect(()=>{d||p()},[n,d]),u.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),u.useEffect(()=>{d||typeof f!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},f))},[f,d,p,...r]),{droppableRects:x,measureDroppableContainers:p,measuringScheduled:c!=null};function v(){switch(i){case wt.Always:return!1;case wt.BeforeDragging:return n;default:return!n}}}function wn(e,t){return St(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function To(e,t){return wn(e,t)}function Ao(e){let{callback:t,disabled:n}=e;const r=Gt(t),a=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(r)},[r,n]);return u.useEffect(()=>()=>a?.disconnect(),[a]),a}function Qt(e){let{callback:t,disabled:n}=e;const r=Gt(t),a=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(r)},[n]);return u.useEffect(()=>()=>a?.disconnect(),[a]),a}function Do(e){return new bn(Nt(e),e)}function Fn(e,t,n){t===void 0&&(t=Do);const[r,a]=u.useState(null);function c(){a(s=>{if(!e)return null;if(e.isConnected===!1){var i;return(i=s??n)!=null?i:null}const l=t(e);return JSON.stringify(s)===JSON.stringify(l)?s:l})}const h=Ao({callback(s){if(e)for(const i of s){const{type:l,target:d}=i;if(l==="childList"&&d instanceof HTMLElement&&d.contains(e)){c();break}}}}),f=Qt({callback:c});return Fe(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),r}function Io(e){const t=wn(e);return dr(e,t)}const _n=[];function Mo(e){const t=u.useRef(e),n=St(r=>e?r&&r!==_n&&e&&t.current&&e.parentNode===t.current.parentNode?r:vn(e):_n,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function Po(e){const[t,n]=u.useState(null),r=u.useRef(e),a=u.useCallback(c=>{const h=tn(c.target);h&&n(f=>f?(f.set(h,ln(h)),new Map(f)):null)},[]);return u.useEffect(()=>{const c=r.current;if(e!==c){h(c);const f=e.map(s=>{const i=tn(s);return i?(i.addEventListener("scroll",a,{passive:!0}),[i,ln(i)]):null}).filter(s=>s!=null);n(f.length?new Map(f):null),r.current=e}return()=>{h(e),h(c)};function h(f){f.forEach(s=>{const i=tn(s);i?.removeEventListener("scroll",a)})}},[a,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>rt(c,h),Ee):br(e):Ee,[e,t])}function Un(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==Ee;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Lt(e,n.current):Ee}function Oo(e){u.useEffect(()=>{if(!Kt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Lo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:c}=r;return n[a]=h=>{c(h,t)},n},{}),[e,t])}function Cr(e){return u.useMemo(()=>e?io(e):null,[e])}const $n=[];function zo(e,t){t===void 0&&(t=Nt);const[n]=e,r=Cr(n?pe(n):null),[a,c]=u.useState($n);function h(){c(()=>e.length?e.map(s=>pr(s)?r:new bn(t(s),s)):$n)}const f=Qt({callback:h});return Fe(()=>{f?.disconnect(),h(),e.forEach(s=>f?.observe(s))},[e]),a}function Sr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ct(t)?t:e}function Bo(e){let{measure:t}=e;const[n,r]=u.useState(null),a=u.useCallback(i=>{for(const{target:l}of i)if(Ct(l)){r(d=>{const m=t(l);return d?{...d,width:m.width,height:m.height}:m});break}},[t]),c=Qt({callback:a}),h=u.useCallback(i=>{const l=Sr(i);c?.disconnect(),l&&c?.observe(l),r(l?t(l):null)},[t,c]),[f,s]=Pt(h);return u.useMemo(()=>({nodeRef:f,rect:n,setRef:s}),[n,f,s])}const Fo=[{sensor:yn,options:{}},{sensor:wr,options:{}}],_o={current:{}},It={draggable:{measure:Pn},droppable:{measure:Pn,strategy:wt.WhileDragging,frequency:un.Optimized},dragOverlay:{measure:Nt}};class vt extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Uo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:It,measureDroppableContainers:Bt,windowRect:null,measuringScheduled:!1},Nr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bt,draggableNodes:new Map,over:null,measureDroppableContainers:Bt},Et=u.createContext(Nr),Er=u.createContext(Uo);function $o(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vt}}}function Ko(e,t){switch(t.type){case ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ae.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 ae.DragEnd:case ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ae.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new vt(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case ae.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,c=e.droppable.containers.get(n);if(!c||r!==c.key)return e;const h=new vt(e.droppable.containers);return h.set(n,{...c,disabled:a}),{...e,droppable:{...e.droppable,containers:h}}}case ae.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const c=new vt(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function Go(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=u.useContext(Et),c=Ot(r),h=Ot(n?.id);return u.useEffect(()=>{if(!t&&!r&&c&&h!=null){if(!pn(c)||document.activeElement===c.target)return;const f=a.get(h);if(!f)return;const{activatorNode:s,node:i}=f;if(!s.current&&!i.current)return;requestAnimationFrame(()=>{for(const l of[s.current,i.current]){if(!l)continue;const d=Bs(l);if(d){d.focus();break}}})}},[r,t,a,h,c]),null}function kr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,c)=>c({transform:a,...r}),n):n}function Wo(e){return u.useMemo(()=>({draggable:{...It.draggable,...e?.draggable},droppable:{...It.droppable,...e?.droppable},dragOverlay:{...It.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Qo(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const c=u.useRef(!1),{x:h,y:f}=typeof a=="boolean"?{x:a,y:a}:a;Fe(()=>{if(!h&&!f||!t){c.current=!1;return}if(c.current||!r)return;const i=t?.node.current;if(!i||i.isConnected===!1)return;const l=n(i),d=dr(l,r);if(h||(d.x=0),f||(d.y=0),c.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const m=hr(i);m&&m.scrollBy({top:d.y,left:d.x})}},[t,h,f,r,n])}const Yt=u.createContext({...Ee,scaleX:1,scaleY:1});var $e;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($e||($e={}));const Yo=u.memo(function(t){var n,r,a,c;let{id:h,accessibility:f,autoScroll:s=!0,children:i,sensors:l=Fo,collisionDetection:d=eo,measuring:m,modifiers:p,...g}=t;const x=u.useReducer(Ko,void 0,$o),[v,k]=x,[C,y]=Gs(),[R,N]=u.useState($e.Uninitialized),M=R===$e.Initialized,{draggable:{active:P,nodes:S,translate:z},droppable:{containers:_}}=v,O=P!=null?S.get(P):null,G=u.useRef({initial:null,translated:null}),B=u.useMemo(()=>{var le;return P!=null?{id:P,data:(le=O?.data)!=null?le:_o,rect:G}:null},[P,O]),V=u.useRef(null),[Q,J]=u.useState(null),[Y,H]=u.useState(null),W=xt(g,Object.values(g)),ne=Wt("DndDescribedBy",h),ge=u.useMemo(()=>_.getEnabled(),[_]),q=Wo(m),{droppableRects:Z,measureDroppableContainers:me,measuringScheduled:T}=Ro(ge,{dragging:M,dependencies:[z.x,z.y],config:q.droppable}),I=ko(S,P),U=u.useMemo(()=>Y?zt(Y):null,[Y]),w=Vt(),E=To(I,q.draggable.measure);Qo({activeNode:P!=null?S.get(P):null,config:w.layoutShiftCompensation,initialRect:E,measure:q.draggable.measure});const D=Fn(I,q.draggable.measure,E),se=Fn(I?I.parentElement:null),ve=u.useRef({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=_.getNodeFor((n=ve.current.over)==null?void 0:n.id),be=Bo({measure:q.dragOverlay.measure}),Ie=(r=be.nodeRef.current)!=null?r:I,Me=M?(a=be.rect)!=null?a:D:null,it=!!(be.nodeRef.current&&be.rect),Ke=Io(it?null:D),Ge=Cr(Ie?pe(Ie):null),xe=Mo(M?Xe??I:null),qe=zo(xe),Pe=kr(p,{transform:{x:z.x-Ke.x,y:z.y-Ke.y,scaleX:1,scaleY:1},activatorEvent:Y,active:B,activeNodeRect:D,containerNodeRect:se,draggingNodeRect:Me,over:ve.current.over,overlayNodeRect:be.rect,scrollableAncestors:xe,scrollableAncestorRects:qe,windowRect:Ge}),kt=U?rt(U,z):null,Ve=Po(xe),at=Un(Ve),jt=Un(Ve,[D]),Oe=rt(Pe,at),Le=Me?ro(Me,Pe):null,ye=B&&Le?d({active:B,collisionRect:Le,droppableRects:Z,droppableContainers:ge,pointerCoordinates:kt}):null,lt=Js(ye,"id"),[we,ct]=u.useState(null),Rt=it?Pe:rt(Pe,jt),Tt=to(Rt,(c=we?.rect)!=null?c:null,D),We=u.useRef(null),At=u.useCallback((le,ce)=>{let{sensor:ue,options:ke}=ce;if(V.current==null)return;const b=S.get(V.current);if(!b)return;const j=le.nativeEvent,A=new ue({active:V.current,activeNode:b,event:j,options:ke,context:ve,onAbort(K){if(!S.get(K))return;const{onDragAbort:X}=W.current,de={id:K};X?.(de),C({type:"onDragAbort",event:de})},onPending(K,ee,X,de){if(!S.get(K))return;const{onDragPending:_e}=W.current,Re={id:K,constraint:ee,initialCoordinates:X,offset:de};_e?.(Re),C({type:"onDragPending",event:Re})},onStart(K){const ee=V.current;if(ee==null)return;const X=S.get(ee);if(!X)return;const{onDragStart:de}=W.current,je={activatorEvent:j,active:{id:ee,data:X.data,rect:G}};ht.unstable_batchedUpdates(()=>{de?.(je),N($e.Initializing),k({type:ae.DragStart,initialCoordinates:K,active:ee}),C({type:"onDragStart",event:je}),J(We.current),H(j)})},onMove(K){k({type:ae.DragMove,coordinates:K})},onEnd:L(ae.DragEnd),onCancel:L(ae.DragCancel)});We.current=A;function L(K){return async function(){const{active:X,collisions:de,over:je,scrollAdjustedTranslate:_e}=ve.current;let Re=null;if(X&&_e){const{cancelDrop:Qe}=W.current;Re={activatorEvent:j,active:X,collisions:de,delta:_e,over:je},K===ae.DragEnd&&typeof Qe=="function"&&await Promise.resolve(Qe(Re))&&(K=ae.DragCancel)}V.current=null,ht.unstable_batchedUpdates(()=>{k({type:K}),N($e.Uninitialized),ct(null),J(null),H(null),We.current=null;const Qe=K===ae.DragEnd?"onDragEnd":"onDragCancel";if(Re){const ut=W.current[Qe];ut?.(Re),C({type:Qe,event:Re})}})}}},[S]),Je=u.useCallback((le,ce)=>(ue,ke)=>{const b=ue.nativeEvent,j=S.get(ke);if(V.current!==null||!j||b.dndKit||b.defaultPrevented)return;const A={active:j};le(ue,ce.options,A)===!0&&(b.dndKit={capturedBy:ce.sensor},V.current=ke,At(ue,ce))},[S,At]),ze=jo(l,Je);Oo(l),Fe(()=>{D&&R===$e.Initializing&&N($e.Initialized)},[D,R]),u.useEffect(()=>{const{onDragMove:le}=W.current,{active:ce,activatorEvent:ue,collisions:ke,over:b}=ve.current;if(!ce||!ue)return;const j={active:ce,activatorEvent:ue,collisions:ke,delta:{x:Oe.x,y:Oe.y},over:b};ht.unstable_batchedUpdates(()=>{le?.(j),C({type:"onDragMove",event:j})})},[Oe.x,Oe.y]),u.useEffect(()=>{const{active:le,activatorEvent:ce,collisions:ue,droppableContainers:ke,scrollAdjustedTranslate:b}=ve.current;if(!le||V.current==null||!ce||!b)return;const{onDragOver:j}=W.current,A=ke.get(lt),L=A&&A.rect.current?{id:A.id,rect:A.rect.current,data:A.data,disabled:A.disabled}:null,K={active:le,activatorEvent:ce,collisions:ue,delta:{x:b.x,y:b.y},over:L};ht.unstable_batchedUpdates(()=>{ct(L),j?.(K),C({type:"onDragOver",event:K})})},[lt]),Fe(()=>{ve.current={activatorEvent:Y,active:B,activeNode:I,collisionRect:Le,collisions:ye,droppableRects:Z,draggableNodes:S,draggingNode:Ie,draggingNodeRect:Me,droppableContainers:_,over:we,scrollableAncestors:xe,scrollAdjustedTranslate:Oe},G.current={initial:Me,translated:Le}},[B,I,ye,Le,S,Ie,Me,Z,_,we,xe,Oe]),So({...w,delta:z,draggingRect:Le,pointerCoordinates:kt,scrollableAncestors:xe,scrollableAncestorRects:qe});const Xt=u.useMemo(()=>({active:B,activeNode:I,activeNodeRect:D,activatorEvent:Y,collisions:ye,containerNodeRect:se,dragOverlay:be,draggableNodes:S,droppableContainers:_,droppableRects:Z,over:we,measureDroppableContainers:me,scrollableAncestors:xe,scrollableAncestorRects:qe,measuringConfiguration:q,measuringScheduled:T,windowRect:Ge}),[B,I,D,Y,ye,se,be,S,_,Z,we,me,xe,qe,q,T,Ge]),qt=u.useMemo(()=>({activatorEvent:Y,activators:ze,active:B,activeNodeRect:D,ariaDescribedById:{draggable:ne},dispatch:k,draggableNodes:S,over:we,measureDroppableContainers:me}),[Y,ze,B,D,k,ne,S,we,me]);return F.createElement(ur.Provider,{value:y},F.createElement(Et.Provider,{value:qt},F.createElement(Er.Provider,{value:Xt},F.createElement(Yt.Provider,{value:Tt},i)),F.createElement(Go,{disabled:f?.restoreFocus===!1})),F.createElement(Ys,{...f,hiddenTextDescribedById:ne}));function Vt(){const le=Q?.autoScrollEnabled===!1,ce=typeof s=="object"?s.enabled===!1:s===!1,ue=M&&!le&&!ce;return typeof s=="object"?{...s,enabled:ue}:{enabled:ue}}}),Ho=u.createContext(null),Kn="button",Xo="Draggable";function qo(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const c=Wt(Xo),{activators:h,activatorEvent:f,active:s,activeNodeRect:i,ariaDescribedById:l,draggableNodes:d,over:m}=u.useContext(Et),{role:p=Kn,roleDescription:g="draggable",tabIndex:x=0}=a??{},v=s?.id===t,k=u.useContext(v?Yt:Ho),[C,y]=Pt(),[R,N]=Pt(),M=Lo(h,t),P=xt(n);Fe(()=>(d.set(t,{id:t,key:c,node:C,activatorNode:R,data:P}),()=>{const z=d.get(t);z&&z.key===c&&d.delete(t)}),[d,t]);const S=u.useMemo(()=>({role:p,tabIndex:x,"aria-disabled":r,"aria-pressed":v&&p===Kn?!0:void 0,"aria-roledescription":g,"aria-describedby":l.draggable}),[r,p,x,v,g,l.draggable]);return{active:s,activatorEvent:f,activeNodeRect:i,attributes:S,isDragging:v,listeners:r?void 0:M,node:C,over:m,setNodeRef:y,setActivatorNodeRef:N,transform:k}}function Vo(){return u.useContext(Er)}const Jo="Droppable",Zo={timeout:25};function ei(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const c=Wt(Jo),{active:h,dispatch:f,over:s,measureDroppableContainers:i}=u.useContext(Et),l=u.useRef({disabled:n}),d=u.useRef(!1),m=u.useRef(null),p=u.useRef(null),{disabled:g,updateMeasurementsFor:x,timeout:v}={...Zo,...a},k=xt(x??r),C=u.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{i(Array.isArray(k.current)?k.current:[k.current]),p.current=null},v)},[v]),y=Qt({callback:C,disabled:g||!h}),R=u.useCallback((S,z)=>{y&&(z&&(y.unobserve(z),d.current=!1),S&&y.observe(S))},[y]),[N,M]=Pt(R),P=xt(t);return u.useEffect(()=>{!y||!N.current||(y.disconnect(),d.current=!1,y.observe(N.current))},[N,y]),u.useEffect(()=>(f({type:ae.RegisterDroppable,element:{id:r,key:c,disabled:n,node:N,rect:m,data:P}}),()=>f({type:ae.UnregisterDroppable,key:c,id:r})),[r]),u.useEffect(()=>{n!==l.current.disabled&&(f({type:ae.SetDroppableDisabled,id:r,key:c,disabled:n}),l.current.disabled=n)},[r,c,n,f]),{active:h,rect:m,isOver:s?.id===r,node:N,over:s,setNodeRef:M}}function ti(e){let{animation:t,children:n}=e;const[r,a]=u.useState(null),[c,h]=u.useState(null),f=Ot(n);return!n&&!r&&f&&a(f),Fe(()=>{if(!c)return;const s=r?.key,i=r?.props.id;if(s==null||i==null){a(null);return}Promise.resolve(t(i,c)).then(()=>{a(null)})},[t,r,c]),F.createElement(F.Fragment,null,n,r?u.cloneElement(r,{ref:h}):null)}const ni={x:0,y:0,scaleX:1,scaleY:1};function ri(e){let{children:t}=e;return F.createElement(Et.Provider,{value:Nr},F.createElement(Yt.Provider,{value:ni},t))}const si={position:"fixed",touchAction:"none"},oi=e=>pn(e)?"transform 250ms ease":void 0,ii=u.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:c,className:h,rect:f,style:s,transform:i,transition:l=oi}=e;if(!f)return null;const d=a?i:{...i,scaleX:1,scaleY:1},m={...si,width:f.width,height:f.height,top:f.top,left:f.left,transform:yt.Transform.toString(d),transformOrigin:a&&r?qs(r,f):void 0,transition:typeof l=="function"?l(r):l,...s};return F.createElement(n,{className:h,style:m,ref:t},c)}),ai=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:c,className:h}=e;if(c!=null&&c.active)for(const[f,s]of Object.entries(c.active))s!==void 0&&(a[f]=n.node.style.getPropertyValue(f),n.node.style.setProperty(f,s));if(c!=null&&c.dragOverlay)for(const[f,s]of Object.entries(c.dragOverlay))s!==void 0&&r.node.style.setProperty(f,s);return h!=null&&h.active&&n.node.classList.add(h.active),h!=null&&h.dragOverlay&&r.node.classList.add(h.dragOverlay),function(){for(const[s,i]of Object.entries(a))n.node.style.setProperty(s,i);h!=null&&h.active&&n.node.classList.remove(h.active)}},li=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:yt.Transform.toString(t)},{transform:yt.Transform.toString(n)}]},ci={duration:250,easing:"ease",keyframes:li,sideEffects:ai({styles:{active:{opacity:"0"}}})};function ui(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return Gt((c,h)=>{if(t===null)return;const f=n.get(c);if(!f)return;const s=f.node.current;if(!s)return;const i=Sr(h);if(!i)return;const{transform:l}=pe(h).getComputedStyle(h),d=fr(l);if(!d)return;const m=typeof t=="function"?t:di(t);return xr(s,a.draggable.measure),m({active:{id:c,data:f.data,node:s,rect:a.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:h,rect:a.dragOverlay.measure(i)},droppableContainers:r,measuringConfiguration:a,transform:d})})}function di(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...ci,...e};return c=>{let{active:h,dragOverlay:f,transform:s,...i}=c;if(!t)return;const l={x:f.rect.left-h.rect.left,y:f.rect.top-h.rect.top},d={scaleX:s.scaleX!==1?h.rect.width*s.scaleX/f.rect.width:1,scaleY:s.scaleY!==1?h.rect.height*s.scaleY/f.rect.height:1},m={x:s.x-l.x,y:s.y-l.y,...d},p=a({...i,active:h,dragOverlay:f,transform:{initial:s,final:m}}),[g]=p,x=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(x))return;const v=r?.({active:h,dragOverlay:f,...i}),k=f.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(C=>{k.onfinish=()=>{v?.(),C()}})}}let Gn=0;function fi(e){return u.useMemo(()=>{if(e!=null)return Gn++,Gn},[e])}const hi=F.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:c,modifiers:h,wrapperElement:f="div",className:s,zIndex:i=999}=e;const{activatorEvent:l,active:d,activeNodeRect:m,containerNodeRect:p,draggableNodes:g,droppableContainers:x,dragOverlay:v,over:k,measuringConfiguration:C,scrollableAncestors:y,scrollableAncestorRects:R,windowRect:N}=Vo(),M=u.useContext(Yt),P=fi(d?.id),S=kr(h,{activatorEvent:l,active:d,activeNodeRect:m,containerNodeRect:p,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:R,transform:M,windowRect:N}),z=wn(m),_=ui({config:r,draggableNodes:g,droppableContainers:x,measuringConfiguration:C}),O=z?v.setRef:void 0;return F.createElement(ri,null,F.createElement(ti,{animation:_},d&&P?F.createElement(ii,{key:P,id:d.id,ref:O,as:f,activatorEvent:l,adjustScale:t,className:s,transition:c,rect:z,style:{zIndex:i,...a},transform:S},n):null))}),jr=768;function mi(e){const t=window.matchMedia(`(max-width: ${jr-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function gi(){return window.innerWidth<jr}function pi(){return!1}function Rr(){return u.useSyncExternalStore(mi,gi,pi)}function Ht(e){switch(e){case Ae.TODO:return re.Pending;case Ae.IN_PROGRESS:return re.Running;case Ae.IN_REVIEW:return re.Review;case Ae.DONE:return re.Done;case Ae.CANCELLED:return re.Cancelled}}function vi(e){switch(e){case re.Pending:return Ae.TODO;case re.Running:return Ae.IN_PROGRESS;case re.Review:return Ae.IN_REVIEW;case re.Done:return Ae.DONE;case re.Cancelled:return Ae.CANCELLED}}function Tr(e){switch(e){case Se.CLAUDE_CODE:return"Claude Code";case Se.GEMINI_CLI:return"Gemini CLI";case Se.CURSOR_AGENT:return"Cursor Agent";case Se.CODEX:return"Codex";case Se.QWEN_CODE:return"Qwen Code";case Se.KIRO_CLI:return"Kiro CLI";case Se.OPENCODE:return"OpenCode";case Se.PI_CODING_AGENT:return"Pi Coding Agent";case Se.GROK_BUILD:return"Grok Build";case Se.MINION_CODE:return"Minion Code";case Se.DEEPSEEK_HERMES:return"DeepSeek Harness"}}const _t=["text-indigo-600","text-emerald-600","text-rose-600","text-amber-600","text-cyan-600","text-violet-600","text-teal-600","text-pink-600"];function Ar(e,t){let n=0;for(let r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r)|0;return Math.abs(n)%t}function bi(e,t){return e?.find(n=>n.status==="ACTIVE")??e?.[0]}function xi(e){return e?e.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":e.branchName:"—"}function yi(e){return{id:e.id,name:e.name,color:e.color||_t[Ar(e.name,_t.length)],isGitRepo:e.isGitRepo,worktreeReady:e.worktreeReady,reason:e.reason,archivedAt:e.archivedAt??null,repoDeletedAt:e.repoDeletedAt??null}}function wi(e){const t=bi(e);if(!t)return{agent:"—",branch:"—"};const n=xi(t),r=t.sessions;if(r&&r.length>0){const a=r[r.length-1];return{agent:Tr(a.agentType),branch:n}}return{agent:"—",branch:n}}function Ci(e){const{agent:t,branch:n}=wi(e.workspaces),r=e.project;return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,projectId:e.projectId,title:e.titlePreview??e.title,status:Ht(e.status),priority:e.priority,agent:t,branch:n,description:e.contentPreview??e.description??"",updatedAt:e.updatedAt,isGitRepo:r?.isGitRepo,worktreeReady:r?.worktreeReady,reason:r?.reason,projectArchivedAt:r?.archivedAt??null,projectRepoDeletedAt:r?.repoDeletedAt??null}}function Dr(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,runningSubtaskCount:e.runningSubtaskCount,projectId:e.projectId,title:e.title,status:Ht(e.status),priority:e.priority,agent:e.latestAgentType?Tr(e.latestAgentType):"—",branch:n,description:"",updatedAt:new Date(e.updatedAt).toISOString(),isGitRepo:t?.isGitRepo,worktreeReady:t?.worktreeReady,reason:t?.reason,projectArchivedAt:t?.archivedAt??null,projectRepoDeletedAt:t?.repoDeletedAt??null}}function Si(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,projectId:t.id,projectName:t.name,projectColor:t.color||_t[Ar(t.name,_t.length)],title:e.title,status:Ht(e.status),priority:e.priority,branch:n,mainBranch:t.mainBranch??"main",description:"",isGitRepo:t.isGitRepo,worktreeReady:t.worktreeReady,reason:t.reason,projectArchivedAt:t.archivedAt??null,projectRepoDeletedAt:t.repoDeletedAt??null}}const Ir=u.createContext(null);function Ni(e,t){const n=[];if(!e||e.length===0)return n;const r=e.some(c=>c.status==="ACTIVE");return e.some(c=>c.sessions?.some(h=>h.status===Sn.RUNNING||h.status===Sn.PENDING))&&n.push(t("正在运行的 Agent 将被停止")),r&&(n.push(t("分支上未合并的变更将丢失")),n.push(t("关联的工作目录(worktree)将被清理"))),n}function Ei({isOpen:e,onClose:t,onConfirm:n,taskId:r,taskTitle:a,workspaces:c,isLoading:h}){const{t:f}=De(),{data:s,isLoading:i}=fs(c===void 0&&e?r:""),l=nr(r,e),d=l.data?.pages[0]?.total??0,m=c??s,p=c===void 0&&e&&i,g=u.useMemo(()=>Ni(m,f),[m,f]);return o.jsx(ds,{isOpen:e,onClose:t,onConfirm:()=>n(d),title:f("删除任务"),description:o.jsxs(o.Fragment,{children:[o.jsx("p",{children:d>0?f("Delete “{title}” and its {count} subtasks? This cannot be undone.",{title:a,count:d}):f("确认删除任务「{title}」?此操作不可撤销。",{title:a})}),d>0&&o.jsx("p",{className:"mt-2 text-warning-ink",children:f("All related Agents and services will stop. Their worktrees and owned branches will be deleted.")}),l.isError&&o.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>l.refetch(),children:f("Could not load subtasks. Retry")}),l.isFetching&&o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f("Loading...")}),p?o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f("加载中...")}):g.length>0?o.jsx("ul",{className:"mt-2 space-y-1",children:g.map((x,v)=>o.jsxs("li",{className:"flex items-start gap-1.5 text-warning-ink",children:[o.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-warning"}),o.jsx("span",{children:x})]},v))}):null]}),confirmText:d>0?f("Delete all"):f("删除"),variant:"danger",isLoading:h,confirmDisabled:p||l.isFetching||l.isError||!l.data})}const ki=3e4;function ji(e=ki){const[,t]=u.useState(0);u.useEffect(()=>{const n=setInterval(()=>t(r=>r+1),e);return()=>clearInterval(n)},[e])}function Ri(e){const t=Jr(e,9,"..");if(t===e)return e;const n=t.slice(0,-2),r=n.search(/[-_.\s][^-_.\s]*$/);return`${r>=3?n.slice(0,r):n}..`}const et="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] text-foreground/80 transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:outline-none",Wn="px-2 pb-1 pt-1.5 text-xs font-medium text-muted-foreground",sn=o.jsx("div",{className:"-mx-1 my-1 h-px bg-border/60"});function Mr({task:e,status:t,isSelected:n,project:r,showProject:a,onSelectTask:c,onTaskStatusChange:h,onDeleteTask:f,onTaskPriorityChange:s,disableDrag:i,onCreateSubtask:l,selectedTaskId:d,expandForSelection:m,selectedChildTask:p}){const{t:g,locale:x}=De(),[v,k]=u.useState({open:!1}),C=v.open||!!(m&&v.selection!==d),y=nr(e.id,C&&!e.parentTaskId),R=y.data?.pages[0]?.total??e.subtaskCount??0,N=y.data?.pages.flatMap(w=>w.data).map(w=>Dr(w))??[];p?.parentTaskId===e.id&&!N.some(w=>w.id===p.id)&&N.push(p);const M=u.useContext(Ir),P=u.useRef(null),S=!!e.projectArchivedAt,z=S||!!i,{attributes:_,listeners:O,setNodeRef:G,isDragging:B}=qo({id:e.id,data:{task:e,fromStatus:t},disabled:z}),V=u.useCallback(w=>{P.current=w,G(w),M&&(w?M.registry.set(e.id,w):M.registry.delete(e.id))},[G,M,e.id]);u.useEffect(()=>()=>{M?.registry.delete(e.id)},[e.id,M]);const[Q,J]=u.useState(null),[Y,H]=u.useState(!1),W=u.useRef(null),ne=u.useRef(null),ge=u.useCallback(w=>{S||!h&&!f&&!s&&!l||(w.preventDefault(),J({x:w.clientX,y:w.clientY}))},[S,h,f,s,l,J]),q=u.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),Z=u.useCallback(w=>{if(!i||S||!h&&!f&&!l)return;const E=w.touches[0];if(!E)return;const{clientX:D,clientY:se}=E;ne.current=setTimeout(()=>{ne.current=null,J({x:D,y:se})},500)},[i,S,h,f,l,J]);u.useEffect(()=>{if(!Q)return;const w=()=>J(null),E=se=>{W.current&&!W.current.contains(se.target)&&w()},D=se=>{se.key==="Escape"&&w()};return document.addEventListener("mousedown",E),document.addEventListener("touchstart",E),document.addEventListener("keydown",D),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("touchstart",E),document.removeEventListener("keydown",D),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[Q]),u.useLayoutEffect(()=>{const w=W.current;if(!Q||!w)return;const E=8;w.style.left=`${Math.max(E,Math.min(Q.x,window.innerWidth-w.offsetWidth-E))}px`,w.style.top=`${Math.max(E,Math.min(Q.y,window.innerHeight-w.offsetHeight-E))}px`},[Q]);const me=r?r.name:void 0,T=a?r:void 0,I=e.updatedAt?gs(e.updatedAt,g,x):null,{titleClass:U}=nt[t];return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[o.jsxs("button",{ref:V,type:"button",onClick:()=>c(e.id),onContextMenu:ge,onTouchStart:Z,onTouchEnd:q,onTouchMove:q,title:T?`${e.title} · ${T.name}`:e.title,"aria-label":me?`${e.title} — ${me}`:e.title,"aria-current":n||void 0,"data-sidebar-item":"",className:ie("task-row animate-task-enter",mt(n),"min-w-0 flex-1",B&&"opacity-30"),...z?{}:O,...z?{}:_,children:[e.parentTaskId&&(()=>{const{icon:w,accentClass:E,label:D}=nt[t];return o.jsx("span",{className:"shrink-0",title:g(D),"aria-label":g(D),children:o.jsx(w,{className:ie("size-3.5",E)})})})(),t===re.Running?o.jsx(kn,{text:e.title,variant:"running",animate:!n,className:ie("min-w-0 flex-1 truncate",U)}):o.jsx("span",{className:ie("min-w-0 flex-1 truncate",U),children:e.title}),e.priority!==void 0&&e.priority!==Mt.NORMAL&&o.jsx(jn,{priority:e.priority}),e.projectArchivedAt&&o.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full bg-foreground/[0.06] px-1.5 py-0.5 text-xs font-medium leading-none text-muted-foreground",children:e.projectRepoDeletedAt?g("源码已删除"):g("已删除")}),(I||T)&&o.jsx("span",{className:"task-row-meta",children:o.jsxs("span",{className:"flex items-center gap-1",children:[T&&o.jsx("span",{className:"shrink-0 whitespace-nowrap rounded bg-foreground/[0.05] px-1 py-0.5 text-[10px] font-medium leading-none @max-[22rem]:hidden",children:o.jsx(kn,{text:Ri(T.name),variant:"project",className:T.color})}),I&&o.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:I})]})})]}),!e.parentTaskId&&R>0&&o.jsxs("button",{type:"button","data-sidebar-item":"","aria-expanded":C,"aria-label":g("Subtasks of {title}",{title:e.title}),title:g("{count} subtasks, {running} running",{count:R,running:e.runningSubtaskCount??0}),onClick:()=>k({selection:d,open:!C}),className:"flex h-8 shrink-0 items-center gap-1 rounded-md px-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 pointer-coarse:h-10",children:[o.jsx(Is,{size:14}),o.jsx("span",{className:"tabular-nums",children:R}),o.jsx(rr,{size:12,className:ie("transition-transform",C&&"rotate-90")})]})]}),!e.parentTaskId&&C&&o.jsxs("div",{className:"ml-4 border-l border-border/60 pl-1",role:"group","aria-label":g("Subtasks of {title}",{title:e.title}),children:[y.isLoading&&o.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:g("Loading...")}),y.isError&&o.jsx("button",{type:"button",className:et,onClick:()=>y.refetch(),children:g("Could not load subtasks. Retry")}),N.map(w=>o.jsx(Mr,{task:{...w,projectArchivedAt:e.projectArchivedAt},status:w.status,isSelected:d===w.id,project:r,showProject:!1,onSelectTask:c,onTaskStatusChange:h,onDeleteTask:f,onTaskPriorityChange:s,disableDrag:i},w.id)),y.hasNextPage&&o.jsx("button",{type:"button",className:et,disabled:y.isFetchingNextPage,onClick:()=>y.fetchNextPage(),children:g("Load more")})]}),Q&&o.jsxs("div",{ref:W,role:"menu",className:"fixed z-[100] w-48 rounded-lg border border-border bg-popover p-1 shadow-popover shadow-black/5 animate-in fade-in zoom-in-95 duration-100",children:[l&&!e.parentTaskId&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",role:"menuitem",className:et,onClick:()=>{l(e.id),J(null)},children:[o.jsx(ir,{className:"size-3.5 shrink-0"}),o.jsx("span",{children:g("Create subtask")})]}),sn]}),h&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Wn,children:g("Move to")}),qr.filter(w=>w!==t).map(w=>{const{icon:E,label:D,accentClass:se}=nt[w];return o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(e.id,w),J(null)},className:et,children:[o.jsx(E,{className:ie("size-3.5 shrink-0",se)}),o.jsx("span",{children:g(D)})]},w)})]}),s&&o.jsxs(o.Fragment,{children:[h&&sn,o.jsx("div",{className:Wn,children:g("Priority")}),Vr.map(w=>{const E=(e.priority??Mt.NORMAL)===w.value;return o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":E,onClick:()=>{s(e.id,w.value),J(null)},className:et,children:[o.jsx(jn,{priority:w.value}),o.jsx("span",{className:"flex-1",children:g(w.label)}),E&&o.jsx(bt,{className:"size-3.5 shrink-0 text-foreground","aria-hidden":!0})]},w.value)})]}),f&&o.jsxs(o.Fragment,{children:[(h||s)&&sn,o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{H(!0),J(null)},className:ie(et,"text-destructive-ink hover:bg-destructive/10 hover:text-destructive-ink focus-visible:bg-destructive/10"),children:[o.jsx(bs,{className:"size-3.5 shrink-0","aria-hidden":!0}),o.jsx("span",{children:g("Delete Task")})]})]})]}),o.jsx(Ei,{isOpen:Y,onClose:()=>H(!1),onConfirm:w=>{f?.(e.id,w),H(!1)},taskId:e.id,taskTitle:e.title})]})}const Ti=u.memo(function({title:t,tasks:n,status:r,defaultOpen:a,selectedTaskId:c,selectedParentTaskId:h,selectedChildTask:f,onCreateSubtask:s,onSelectTask:i,projects:l,showProject:d=!0,isDragging:m,dragFromStatus:p,onTaskStatusChange:g,onDeleteTask:x,onTaskPriorityChange:v,disableDrag:k}){const{t:C}=De(),[y,R]=u.useState({selection:null,open:a}),N=y.open||!!(c&&y.selection!==c&&n.some(H=>H.id===c||H.id===h));ji();const M=n.length===0,P=m&&p===r,S=m&&p!==r,{setNodeRef:z,isOver:_}=ei({id:`group-${r}`,data:{status:r}}),O=r===re.Review,G=C(t),{icon:B,accentClass:V}=nt[r],Q=u.useId(),J=m?P:N,Y=J&&!S&&!M;return o.jsxs("div",{className:Y?"mb-4":"mb-2","data-task-group-status":r,children:[o.jsx("div",{className:"sticky top-0 z-10 bg-sidebar px-2",children:o.jsxs("button",{type:"button",onClick:()=>!m&&R({selection:c,open:!N}),"aria-expanded":N,"data-sidebar-item":"",className:"group/header flex h-8 w-full items-center gap-1 rounded-md px-2 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 pointer-coarse:h-10 pointer-coarse:text-[15px]",children:[o.jsx(B,{className:ie("mr-1.5 size-4 shrink-0 -translate-y-px",V)}),o.jsx("span",{id:Q,className:"truncate",children:G}),o.jsx(rr,{size:14,"aria-hidden":!0,className:ie("shrink-0 text-muted-foreground transition-transform duration-150 group-hover/header:text-muted-foreground",J&&"rotate-90")}),O&&!M?o.jsx("span",{className:"ml-auto rounded-full bg-warning/15 px-1.5 text-xs font-semibold leading-5 tabular-nums text-warning-ink",children:n.length}):o.jsx("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground",children:n.length})]})}),S&&o.jsx("div",{ref:z,className:ie("mx-2 mt-0.5 flex h-9 items-center justify-center rounded-md border border-dashed text-xs font-medium transition-colors duration-150",_?"border-foreground/30 bg-foreground/[0.04] text-foreground/80":"border-border bg-foreground/[0.02] text-muted-foreground"),children:_?C("Drop into {title}",{title:G}):C("Drop here")}),Y&&o.jsx("div",{ref:P?void 0:z,role:"group","aria-labelledby":Q,className:"mt-0.5 flex flex-col gap-px px-2",children:n.map(H=>{const W=c===H.id,ne=H.projectId?l.find(ge=>ge.id===H.projectId):void 0;return o.jsx(Mr,{selectedTaskId:c,selectedChildTask:f,expandForSelection:h===H.id,onCreateSubtask:H.projectArchivedAt?void 0:s,task:H,status:r,isSelected:W,project:ne,showProject:d,onSelectTask:i,onTaskStatusChange:H.projectArchivedAt?void 0:g,onDeleteTask:H.projectArchivedAt?void 0:x,onTaskPriorityChange:H.projectArchivedAt?void 0:v,disableDrag:k},H.id)})})]})}),Ai=12,Di=50;function Ii({isOpen:e,onClose:t,tasks:n,projects:r,onSelectTask:a}){const{t:c}=De(),[h,f]=u.useState(""),[s,i]=u.useState(0),l=u.useRef(null);u.useEffect(()=>{e&&(f(""),i(0))},[e]);const d=u.useMemo(()=>{const g=h.trim().toLowerCase();return g?n.filter(x=>x.title.toLowerCase().includes(g)).slice(0,Di):n.slice(0,Ai)},[n,h]);u.useEffect(()=>{i(0)},[h]),u.useEffect(()=>{l.current?.children[s]?.scrollIntoView({block:"nearest"})},[s]);const m=u.useCallback(g=>{a(g),t()},[a,t]),p=u.useCallback(g=>{if(g.key==="Escape")g.preventDefault(),t();else if(g.key==="ArrowDown")g.preventDefault(),i(x=>Math.min(x+1,d.length-1));else if(g.key==="ArrowUp")g.preventDefault(),i(x=>Math.max(x-1,0));else if(g.key==="Enter"&&!g.nativeEvent.isComposing){g.preventDefault();const x=d[s];x&&m(x.id)}},[t,d,s,m]);return e?o.jsxs("div",{className:"fixed inset-0 z-90",role:"dialog","aria-modal":"true",children:[o.jsx("div",{className:"absolute inset-0 bg-black/20",onClick:t}),o.jsxs("div",{className:"absolute left-1/2 top-[18vh] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 bg-popover rounded-xl border border-border shadow-popover overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 border-b border-border/60",children:[o.jsx(ar,{size:15,className:"text-muted-foreground/70 shrink-0"}),o.jsx("input",{value:h,onChange:g=>f(g.target.value),onKeyDown:p,placeholder:c("Search tasks..."),"aria-label":c("Search tasks..."),autoFocus:!0,className:"flex-1 py-3 bg-transparent border-none focus:outline-none text-sm text-foreground placeholder-muted-foreground/60"})]}),d.length>0?o.jsxs(o.Fragment,{children:[!h.trim()&&o.jsx("div",{className:"px-4 pt-2.5 pb-1 text-xs font-medium text-muted-foreground",children:c("Recent tasks")}),o.jsx("div",{ref:l,className:"max-h-[46vh] overflow-y-auto scrollbar-app-thin pb-1.5 pt-0.5",children:d.map((g,x)=>{const v=r.find(y=>y.id===g.projectId),{icon:k,iconClass:C}=nt[g.status];return o.jsxs("button",{onClick:()=>m(g.id),onMouseEnter:()=>i(x),className:`w-full flex items-center gap-2.5 px-4 py-2 text-left transition-colors
|
|
7
|
-
${x===s?"bg-accent":""}`,children:[o.jsx(k,{className:`${C} size-4 shrink-0`}),o.jsxs("span",{className:"flex-1 min-w-0 truncate text-sm text-foreground/90",title:g.title,children:[g.title,g.parentTaskId&&o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c("Parent task: {title}",{title:n.find(y=>y.id===g.parentTaskId)?.title??"…"})})]}),v&&o.jsx("span",{className:"shrink-0 max-w-[120px] truncate text-xs text-muted-foreground",children:v.name})]},g.id)})})]}):o.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:c("No matching tasks")})]})]}):null}const Mi=260,Pi=220;function Oi(e){const t={[re.Review]:[],[re.Running]:[],[re.Pending]:[],[re.Done]:[],[re.Cancelled]:[]};for(const n of e)t[n.status].push(n);return t[re.Review].sort((n,r)=>(r.priority??Mt.NORMAL)-(n.priority??Mt.NORMAL)),t}const Li=[{status:re.Review,title:"Review",defaultOpen:!0},{status:re.Running,title:"Running",defaultOpen:!0},{status:re.Pending,title:"Pending",defaultOpen:!1},{status:re.Done,title:"Done",defaultOpen:!1},{status:re.Cancelled,title:"Cancelled",defaultOpen:!1}];function zi(){return o.jsx("div",{className:"flex-1 overflow-hidden px-2 pt-3 motion-safe:animate-pulse","aria-hidden":!0,children:[3,4].map((e,t)=>o.jsxs("div",{className:"mb-4",children:[o.jsxs("div",{className:"flex h-8 items-center gap-2.5 px-2 pointer-coarse:h-10",children:[o.jsx("div",{className:"size-4 shrink-0 rounded-full bg-foreground/[0.06]"}),o.jsx("div",{className:"h-3 w-14 rounded-full bg-foreground/[0.06]"})]}),Array.from({length:e}).map((n,r)=>o.jsxs("div",{className:"flex h-8 items-center gap-2.5 px-2 pointer-coarse:h-10",children:[o.jsx("div",{className:"h-3 rounded-full bg-foreground/[0.06]",style:{width:`${64-(r+t)%3*14}%`}}),o.jsx("div",{className:"ml-auto h-2.5 w-8 shrink-0 rounded-full bg-foreground/[0.05]"})]},r))]},t))})}function Qn({tasks:e=[],projects:t=[],selectedTaskId:n,selectedParentTaskId:r,onCreateSubtask:a,onSelectTask:c,filterProjectId:h,setFilterProjectId:f,width:s=320,onCreateTask:i,onCreateProject:l,isCreateActive:d,onTaskStatusChange:m,onDeleteTask:p,onTaskPriorityChange:g,isLoading:x=!1}){const{t:v}=De(),{preserveDesktopSearch:k}=sr(),C=Rr(),[y,R]=u.useState(null),[N,M]=u.useState(null),[P,S]=u.useState(!1),z=u.useRef(new Set),_=u.useRef(new Map),[O]=u.useState(()=>({registry:new Map})),G=u.useCallback(T=>{T.remove(),z.current.delete(T)},[]),B=h?e.filter(T=>T.projectId===h):e,V=u.useCallback((T,I)=>{const U=document.querySelector(`[data-task-group-status="${T}"]`);if(!U)return null;const E=(U.querySelector("button")??U).getBoundingClientRect();return E.width===0||E.height===0?null:new DOMRect(E.left,E.bottom+2,I.width,I.height)},[]),Q=u.useCallback((T,I,U,w=!1)=>{const E=document.createElement("div");E.setAttribute("aria-hidden","true"),E.innerHTML=U,E.querySelectorAll("[data-gradient-ready]").forEach(be=>be.removeAttribute("data-gradient-ready")),E.querySelectorAll(".task-gradient-text__canvas").forEach(be=>be.remove());const D=E.firstElementChild;D&&(D.style.cssText="",D.className=D.className.replace(/\bopacity-\S*/g,"").replace(/\banimate-task-enter\b/g,""),D.style.pointerEvents="none",D.style.width=`${T.width}px`,D.style.height=`${T.height}px`,D.style.margin="0",D.style.backgroundColor="var(--background)",D.style.borderRadius="0.5rem",D.style.boxShadow="var(--shadow-popover), 0 0 0 1px var(--border)",D.style.opacity="0.96",D.style.transition="none",D.setAttribute("tabindex","-1")),Object.assign(E.style,{position:"fixed",left:`${T.left}px`,top:`${T.top}px`,width:`${T.width}px`,height:`${T.height}px`,zIndex:"9999",pointerEvents:"none",overflow:"visible",transformOrigin:"top left",willChange:"transform, opacity"}),document.body.appendChild(E),z.current.add(E);const se=I.left-T.left,ve=I.top-T.top;E.animate([{transform:"translate(0, 0)",opacity:.96,offset:0},{transform:`translate(${se}px, ${ve}px)`,opacity:w?.12:.96,offset:1}],{duration:w?Pi:Mi,easing:"cubic-bezier(0.2, 0, 0, 1)",fill:"forwards"}).finished.then(()=>G(E),()=>G(E))},[G]);u.useLayoutEffect(()=>{const T=window.matchMedia("(prefers-reduced-motion: reduce)").matches,I=new Map;for(const U of B){const w=O.registry.get(U.id);if(!w)continue;const E={status:U.status,rect:w.getBoundingClientRect(),html:w.outerHTML};if(I.set(U.id,E),T)continue;const D=_.current.get(U.id);if(!D||D.status===U.status)continue;const se=E.rect.left-D.rect.left,ve=E.rect.top-D.rect.top;Math.abs(se)<1&&Math.abs(ve)<1||Q(D.rect,E.rect,D.html)}if(!T)for(const[U,w]of _.current){if(I.has(U))continue;const E=B.find(se=>se.id===U);if(!E||E.status===w.status)continue;const D=V(E.status,w.rect);D&&Q(w.rect,D,w.html,!0)}_.current=I},[B,Q,V,O]),u.useEffect(()=>()=>{for(const T of z.current)T.remove();z.current.clear()},[]);const J=Xs(Hs(yn,{activationConstraint:{distance:8}})),Y=u.useCallback(T=>{const I=T.active.data.current?.task,U=T.active.data.current?.fromStatus;I&&R(I),U&&M(U)},[]),H=u.useCallback(T=>{R(null),M(null);const{active:I,over:U}=T;if(!U)return;const w=I.data.current?.task,E=I.data.current?.fromStatus,D=U.data.current?.status;!w||!E||!D||w.projectArchivedAt||E!==D&&m?.(w.id,D)},[m]),ge=!!!(h?t.find(T=>T.id===h)??null:null)?.archivedAt,q=Oi(B.filter(T=>!T.parentTaskId)),Z=y?nt[y.status]:null,me=u.useCallback(T=>{if(T.key!=="ArrowDown"&&T.key!=="ArrowUp"||T.altKey||T.ctrlKey||T.metaKey||T.shiftKey)return;const I=Array.from(T.currentTarget.querySelectorAll("[data-sidebar-item]:not(:disabled)")),U=I.indexOf(T.target);U!==-1&&(T.preventDefault(),I[U+(T.key==="ArrowDown"?1:-1)]?.focus())},[]);return o.jsxs("div",{className:"@container h-full flex flex-col flex-shrink-0",style:{width:s},onKeyDown:me,children:[o.jsxs("div",{className:"px-2 pt-2 pb-1 flex flex-col gap-px flex-shrink-0",children:[l&&o.jsxs("button",{type:"button",onClick:l,"data-sidebar-item":"",className:mt(!1),children:[o.jsx(xs,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("New Project")})]}),o.jsxs("button",{type:"button",onClick:i,disabled:!ge,"aria-current":d||void 0,"data-sidebar-item":"",className:ie(mt(!!d),"disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"),title:ge?void 0:v("Deleted projects are read-only"),children:[o.jsx(ys,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("New Task")})]}),o.jsxs("button",{type:"button",onClick:()=>S(!0),"data-sidebar-item":"",className:mt(!1),children:[o.jsx(ar,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("Search")})]}),o.jsxs(Zr,{to:k("/conversations"),"data-sidebar-item":"",className:mt(!1),children:[o.jsx(ws,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("对话")})]})]}),x?o.jsx(zi,{}):B.length===0?o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 pb-[10vh] text-center select-none",children:[o.jsx(an,{size:36,"aria-hidden":"true",className:"text-muted-foreground/50 mb-3",strokeWidth:1.5}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:v("No tasks")}),ge&&i?o.jsx("button",{type:"button",onClick:i,className:"px-3.5 py-1.5 rounded-md bg-brand text-brand-foreground text-xs font-medium hover:bg-brand/90 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2",children:v("New Task")}):null]}):o.jsx(Ir.Provider,{value:O,children:o.jsxs(Yo,{sensors:J,onDragStart:Y,onDragEnd:H,children:[o.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin scroll-pt-8 pointer-coarse:scroll-pt-10 relative",children:o.jsx("div",{className:"pt-3 pb-4",children:Li.map(({status:T,title:I,defaultOpen:U})=>o.jsx(Ti,{title:I,tasks:q[T],status:T,defaultOpen:U,selectedTaskId:n,selectedChildTask:e.find(w=>w.id===n&&w.parentTaskId),selectedParentTaskId:r??e.find(w=>w.id===n)?.parentTaskId,onCreateSubtask:a,onSelectTask:c,projects:t,showProject:!h,isDragging:y!==null,dragFromStatus:N,onTaskStatusChange:m,onDeleteTask:p,onTaskPriorityChange:g,disableDrag:C},T))})}),o.jsx(hi,{dropAnimation:null,children:y&&Z?o.jsxs("div",{className:"flex h-8 w-fit max-w-[280px] items-center gap-2.5 rounded-md bg-background px-2 text-sm text-foreground shadow-overlay ring-1 ring-border/80",children:[o.jsx(Z.icon,{className:ie("size-4 shrink-0",Z.iconClass)}),o.jsx("span",{className:"truncate",title:y.title,children:y.title})]}):null})]})}),!x&&o.jsxs("div",{className:"h-9 px-4 flex flex-shrink-0 items-center justify-between border-t border-border/60 text-xs text-muted-foreground",children:[o.jsx("span",{className:"tabular-nums",children:v("{count} tasks",{count:B.length})}),h?o.jsx("button",{type:"button",onClick:()=>f(null),className:"rounded-sm hover:text-foreground underline decoration-border underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:v("Clear filter")}):null]}),o.jsx(Ii,{isOpen:P,onClose:()=>S(!1),tasks:B,projects:t,onSelectTask:c})]})}var Bi=Object.defineProperty,Ut=Object.getOwnPropertySymbols,Pr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Yn=(e,t,n)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dn=(e,t)=>{for(var n in t||(t={}))Pr.call(t,n)&&Yn(e,n,t[n]);if(Ut)for(var n of Ut(t))Or.call(t,n)&&Yn(e,n,t[n]);return e},fn=(e,t)=>{var n={};for(var r in e)Pr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&Or.call(e,r)&&(n[r]=e[r]);return n};var He;(e=>{const t=class ${constructor(s,i,l,d){if(this.version=s,this.errorCorrectionLevel=i,this.modules=[],this.isFunction=[],s<$.MIN_VERSION||s>$.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=s*4+17;let m=[];for(let g=0;g<this.size;g++)m.push(!1);for(let g=0;g<this.size;g++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),d==-1){let g=1e9;for(let x=0;x<8;x++){this.applyMask(x),this.drawFormatBits(x);const v=this.getPenaltyScore();v<g&&(d=x,g=v),this.applyMask(x)}}a(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(s,i){const l=e.QrSegment.makeSegments(s);return $.encodeSegments(l,i)}static encodeBinary(s,i){const l=e.QrSegment.makeBytes(s);return $.encodeSegments([l],i)}static encodeSegments(s,i,l=1,d=40,m=-1,p=!0){if(!($.MIN_VERSION<=l&&l<=d&&d<=$.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let g,x;for(g=l;;g++){const y=$.getNumDataCodewords(g,i)*8,R=h.getTotalBits(s,g);if(R<=y){x=R;break}if(g>=d)throw new RangeError("Data too long")}for(const y of[$.Ecc.MEDIUM,$.Ecc.QUARTILE,$.Ecc.HIGH])p&&x<=$.getNumDataCodewords(g,y)*8&&(i=y);let v=[];for(const y of s){n(y.mode.modeBits,4,v),n(y.numChars,y.mode.numCharCountBits(g),v);for(const R of y.getData())v.push(R)}a(v.length==x);const k=$.getNumDataCodewords(g,i)*8;a(v.length<=k),n(0,Math.min(4,k-v.length),v),n(0,(8-v.length%8)%8,v),a(v.length%8==0);for(let y=236;v.length<k;y^=253)n(y,8,v);let C=[];for(;C.length*8<v.length;)C.push(0);return v.forEach((y,R)=>C[R>>>3]|=y<<7-(R&7)),new $(g,i,C,m)}getModule(s,i){return 0<=s&&s<this.size&&0<=i&&i<this.size&&this.modules[i][s]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),i=s.length;for(let l=0;l<i;l++)for(let d=0;d<i;d++)l==0&&d==0||l==0&&d==i-1||l==i-1&&d==0||this.drawAlignmentPattern(s[l],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const i=this.errorCorrectionLevel.formatBits<<3|s;let l=i;for(let m=0;m<10;m++)l=l<<1^(l>>>9)*1335;const d=(i<<10|l)^21522;a(d>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(d,m));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(d,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(d,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(d,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let l=0;l<12;l++)s=s<<1^(s>>>11)*7973;const i=this.version<<12|s;a(i>>>18==0);for(let l=0;l<18;l++){const d=r(i,l),m=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(m,p,d),this.setFunctionModule(p,m,d)}}drawFinderPattern(s,i){for(let l=-4;l<=4;l++)for(let d=-4;d<=4;d++){const m=Math.max(Math.abs(d),Math.abs(l)),p=s+d,g=i+l;0<=p&&p<this.size&&0<=g&&g<this.size&&this.setFunctionModule(p,g,m!=2&&m!=4)}}drawAlignmentPattern(s,i){for(let l=-2;l<=2;l++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,i+l,Math.max(Math.abs(d),Math.abs(l))!=1)}setFunctionModule(s,i,l){this.modules[i][s]=l,this.isFunction[i][s]=!0}addEccAndInterleave(s){const i=this.version,l=this.errorCorrectionLevel;if(s.length!=$.getNumDataCodewords(i,l))throw new RangeError("Invalid argument");const d=$.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i],m=$.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i],p=Math.floor($.getNumRawDataModules(i)/8),g=d-p%d,x=Math.floor(p/d);let v=[];const k=$.reedSolomonComputeDivisor(m);for(let y=0,R=0;y<d;y++){let N=s.slice(R,R+x-m+(y<g?0:1));R+=N.length;const M=$.reedSolomonComputeRemainder(N,k);y<g&&N.push(0),v.push(N.concat(M))}let C=[];for(let y=0;y<v[0].length;y++)v.forEach((R,N)=>{(y!=x-m||N>=g)&&C.push(R[y])});return a(C.length==p),C}drawCodewords(s){if(s.length!=Math.floor($.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let i=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let d=0;d<this.size;d++)for(let m=0;m<2;m++){const p=l-m,x=(l+1&2)==0?this.size-1-d:d;!this.isFunction[x][p]&&i<s.length*8&&(this.modules[x][p]=r(s[i>>>3],7-(i&7)),i++)}}a(i==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let i=0;i<this.size;i++)for(let l=0;l<this.size;l++){let d;switch(s){case 0:d=(l+i)%2==0;break;case 1:d=i%2==0;break;case 2:d=l%3==0;break;case 3:d=(l+i)%3==0;break;case 4:d=(Math.floor(l/3)+Math.floor(i/2))%2==0;break;case 5:d=l*i%2+l*i%3==0;break;case 6:d=(l*i%2+l*i%3)%2==0;break;case 7:d=((l+i)%2+l*i%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[i][l]&&d&&(this.modules[i][l]=!this.modules[i][l])}}getPenaltyScore(){let s=0;for(let m=0;m<this.size;m++){let p=!1,g=0,x=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[m][v]==p?(g++,g==5?s+=$.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,x),p||(s+=this.finderPenaltyCountPatterns(x)*$.PENALTY_N3),p=this.modules[m][v],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,x)*$.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,g=0,x=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][m]==p?(g++,g==5?s+=$.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,x),p||(s+=this.finderPenaltyCountPatterns(x)*$.PENALTY_N3),p=this.modules[v][m],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,x)*$.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){const g=this.modules[m][p];g==this.modules[m][p+1]&&g==this.modules[m+1][p]&&g==this.modules[m+1][p+1]&&(s+=$.PENALTY_N2)}let i=0;for(const m of this.modules)i=m.reduce((p,g)=>p+(g?1:0),i);const l=this.size*this.size,d=Math.ceil(Math.abs(i*20-l*10)/l)-1;return a(0<=d&&d<=9),s+=d*$.PENALTY_N4,a(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,i=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2;let l=[6];for(let d=this.size-7;l.length<s;d-=i)l.splice(1,0,d);return l}}static getNumRawDataModules(s){if(s<$.MIN_VERSION||s>$.MAX_VERSION)throw new RangeError("Version number out of range");let i=(16*s+128)*s+64;if(s>=2){const l=Math.floor(s/7)+2;i-=(25*l-10)*l-55,s>=7&&(i-=36)}return a(208<=i&&i<=29648),i}static getNumDataCodewords(s,i){return Math.floor($.getNumRawDataModules(s)/8)-$.ECC_CODEWORDS_PER_BLOCK[i.ordinal][s]*$.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let i=[];for(let d=0;d<s-1;d++)i.push(0);i.push(1);let l=1;for(let d=0;d<s;d++){for(let m=0;m<i.length;m++)i[m]=$.reedSolomonMultiply(i[m],l),m+1<i.length&&(i[m]^=i[m+1]);l=$.reedSolomonMultiply(l,2)}return i}static reedSolomonComputeRemainder(s,i){let l=i.map(d=>0);for(const d of s){const m=d^l.shift();l.push(0),i.forEach((p,g)=>l[g]^=$.reedSolomonMultiply(p,m))}return l}static reedSolomonMultiply(s,i){if(s>>>8||i>>>8)throw new RangeError("Byte out of range");let l=0;for(let d=7;d>=0;d--)l=l<<1^(l>>>7)*285,l^=(i>>>d&1)*s;return a(l>>>8==0),l}finderPenaltyCountPatterns(s){const i=s[1];a(i<=this.size*3);const l=i>0&&s[2]==i&&s[3]==i*3&&s[4]==i&&s[5]==i;return(l&&s[0]>=i*4&&s[6]>=i?1:0)+(l&&s[6]>=i*4&&s[0]>=i?1:0)}finderPenaltyTerminateAndCount(s,i,l){return s&&(this.finderPenaltyAddHistory(i,l),i=0),i+=this.size,this.finderPenaltyAddHistory(i,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(s,i){i[0]==0&&(s+=this.size),i.pop(),i.unshift(s)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(f,s,i){if(s<0||s>31||f>>>s)throw new RangeError("Value out of range");for(let l=s-1;l>=0;l--)i.push(f>>>l&1)}function r(f,s){return(f>>>s&1)!=0}function a(f){if(!f)throw new Error("Assertion error")}const c=class oe{constructor(s,i,l){if(this.mode=s,this.numChars=i,this.bitData=l,i<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(s){let i=[];for(const l of s)n(l,8,i);return new oe(oe.Mode.BYTE,s.length,i)}static makeNumeric(s){if(!oe.isNumeric(s))throw new RangeError("String contains non-numeric characters");let i=[];for(let l=0;l<s.length;){const d=Math.min(s.length-l,3);n(parseInt(s.substring(l,l+d),10),d*3+1,i),l+=d}return new oe(oe.Mode.NUMERIC,s.length,i)}static makeAlphanumeric(s){if(!oe.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let i=[],l;for(l=0;l+2<=s.length;l+=2){let d=oe.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l))*45;d+=oe.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l+1)),n(d,11,i)}return l<s.length&&n(oe.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l)),6,i),new oe(oe.Mode.ALPHANUMERIC,s.length,i)}static makeSegments(s){return s==""?[]:oe.isNumeric(s)?[oe.makeNumeric(s)]:oe.isAlphanumeric(s)?[oe.makeAlphanumeric(s)]:[oe.makeBytes(oe.toUtf8ByteArray(s))]}static makeEci(s){let i=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,i);else if(s<16384)n(2,2,i),n(s,14,i);else if(s<1e6)n(6,3,i),n(s,21,i);else throw new RangeError("ECI assignment value out of range");return new oe(oe.Mode.ECI,0,i)}static isNumeric(s){return oe.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return oe.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,i){let l=0;for(const d of s){const m=d.mode.numCharCountBits(i);if(d.numChars>=1<<m)return 1/0;l+=4+m+d.bitData.length}return l}static toUtf8ByteArray(s){s=encodeURI(s);let i=[];for(let l=0;l<s.length;l++)s.charAt(l)!="%"?i.push(s.charCodeAt(l)):(i.push(parseInt(s.substring(l+1,l+3),16)),l+=2);return i}};c.NUMERIC_REGEX=/^[0-9]*$/,c.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,c.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let h=c;e.QrSegment=c})(He||(He={}));(e=>{(t=>{const n=class{constructor(a,c){this.ordinal=a,this.formatBits=c}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(He||(He={}));(e=>{(t=>{const n=class{constructor(a,c){this.modeBits=a,this.numBitsCharCount=c}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(He||(He={}));var tt=He;var Fi={L:tt.QrCode.Ecc.LOW,M:tt.QrCode.Ecc.MEDIUM,Q:tt.QrCode.Ecc.QUARTILE,H:tt.QrCode.Ecc.HIGH},Lr=128,zr="L",Br="#FFFFFF",Fr="#000000",_r=!1,Ur=1,_i=4,Ui=0,$i=.1;function $r(e,t=0){const n=[];return e.forEach(function(r,a){let c=null;r.forEach(function(h,f){if(!h&&c!==null){n.push(`M${c+t} ${a+t}h${f-c}v1H${c+t}z`),c=null;return}if(f===r.length-1){if(!h)return;c===null?n.push(`M${f+t},${a+t} h1v1H${f+t}z`):n.push(`M${c+t},${a+t} h${f+1-c}v1H${c+t}z`);return}h&&c===null&&(c=f)})}),n.join("")}function Kr(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((a,c)=>c<t.x||c>=t.x+t.w?a:!1))}function Ki(e,t,n,r){if(r==null)return null;const a=e.length+n*2,c=Math.floor(t*$i),h=a/t,f=(r.width||c)*h,s=(r.height||c)*h,i=r.x==null?e.length/2-f/2:r.x*h,l=r.y==null?e.length/2-s/2:r.y*h,d=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let g=Math.floor(i),x=Math.floor(l),v=Math.ceil(f+i-g),k=Math.ceil(s+l-x);m={x:g,y:x,w:v,h:k}}const p=r.crossOrigin;return{x:i,y:l,h:s,w:f,excavation:m,opacity:d,crossOrigin:p}}function Gi(e,t){return t!=null?Math.max(Math.floor(t),0):e?_i:Ui}function Gr({value:e,level:t,minVersion:n,includeMargin:r,marginSize:a,imageSettings:c,size:h,boostLevel:f}){let s=F.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((x,v)=>(x.push(...tt.QrSegment.makeSegments(v)),x),[]);return tt.QrCode.encodeSegments(g,Fi[t],n,void 0,void 0,f)},[e,t,n,f]);const{cells:i,margin:l,numCells:d,calculatedImageSettings:m}=F.useMemo(()=>{let p=s.getModules();const g=Gi(r,a),x=p.length+g*2,v=Ki(p,h,g,c);return{cells:p,margin:g,numCells:x,calculatedImageSettings:v}},[s,h,c,r,a]);return{qrcode:s,margin:l,cells:i,numCells:d,calculatedImageSettings:m}}var Wi=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Qi=F.forwardRef(function(t,n){const r=t,{value:a,size:c=Lr,level:h=zr,bgColor:f=Br,fgColor:s=Fr,includeMargin:i=_r,minVersion:l=Ur,boostLevel:d,marginSize:m,imageSettings:p}=r,x=fn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=x,k=fn(x,["style"]),C=p?.src,y=F.useRef(null),R=F.useRef(null),N=F.useCallback(V=>{y.current=V,typeof n=="function"?n(V):n&&(n.current=V)},[n]),[M,P]=F.useState(!1),{margin:S,cells:z,numCells:_,calculatedImageSettings:O}=Gr({value:a,level:h,minVersion:l,boostLevel:d,includeMargin:i,marginSize:m,imageSettings:p,size:c});F.useEffect(()=>{if(y.current!=null){const V=y.current,Q=V.getContext("2d");if(!Q)return;let J=z;const Y=R.current,H=O!=null&&Y!==null&&Y.complete&&Y.naturalHeight!==0&&Y.naturalWidth!==0;H&&O.excavation!=null&&(J=Kr(z,O.excavation));const W=window.devicePixelRatio||1;V.height=V.width=c*W;const ne=c/_*W;Q.scale(ne,ne),Q.fillStyle=f,Q.fillRect(0,0,_,_),Q.fillStyle=s,Wi?Q.fill(new Path2D($r(J,S))):z.forEach(function(ge,q){ge.forEach(function(Z,me){Z&&Q.fillRect(me+S,q+S,1,1)})}),O&&(Q.globalAlpha=O.opacity),H&&Q.drawImage(Y,O.x+S,O.y+S,O.w,O.h)}}),F.useEffect(()=>{P(!1)},[C]);const G=dn({height:c,width:c},v);let B=null;return C!=null&&(B=F.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{P(!0)},ref:R,crossOrigin:O?.crossOrigin})),F.createElement(F.Fragment,null,F.createElement("canvas",dn({style:G,height:c,width:c,ref:N,role:"img"},k)),B)});Qi.displayName="QRCodeCanvas";var Wr=F.forwardRef(function(t,n){const r=t,{value:a,size:c=Lr,level:h=zr,bgColor:f=Br,fgColor:s=Fr,includeMargin:i=_r,minVersion:l=Ur,boostLevel:d,title:m,marginSize:p,imageSettings:g}=r,x=fn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:k,numCells:C,calculatedImageSettings:y}=Gr({value:a,level:h,minVersion:l,boostLevel:d,includeMargin:i,marginSize:p,imageSettings:g,size:c});let R=k,N=null;g!=null&&y!=null&&(y.excavation!=null&&(R=Kr(k,y.excavation)),N=F.createElement("image",{href:g.src,height:y.h,width:y.w,x:y.x+v,y:y.y+v,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const M=$r(R,v);return F.createElement("svg",dn({height:c,width:c,viewBox:`0 0 ${C} ${C}`,ref:n,role:"img"},x),!!m&&F.createElement("title",null,m),F.createElement("path",{fill:f,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),F.createElement("path",{fill:s,d:M,shapeRendering:"crispEdges"}),N)});Wr.displayName="QRCodeSVG";function Qr(){return parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10)}function Yi(){return es({queryKey:fe.tunnel.status,queryFn:()=>Be.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?5e3:!1})}function Hi(){const e=$t();return hn({mutationFn:()=>Be.post("/tunnel/start",{port:Qr()}),onSuccess:()=>{e.invalidateQueries({queryKey:fe.tunnel.status})}})}function Xi(){const e=$t();return hn({mutationFn:()=>Be.post("/tunnel/regenerate",{port:Qr()}),onSuccess:()=>{e.invalidateQueries({queryKey:fe.tunnel.status})}})}function qi(){const e=$t();return hn({mutationFn:()=>Be.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:fe.tunnel.status})}})}function Vi(e){if(!e||e.status==="stopped")return{button:"text-muted-foreground hover:text-foreground hover:bg-accent",dot:"",label:"Use Agent Tower on your phone",icon:"idle"};switch(e.status){case"healthy":case"checking":return{button:"text-success-ink hover:bg-success/10",dot:"bg-success",label:e.status==="healthy"?"Tunnel healthy":"Checking tunnel health",icon:"ok"};case"degraded":case"localUnhealthy":case"linkReplaced":return{button:"text-warning-ink hover:bg-warning/10",dot:"bg-warning",label:"Tunnel needs attention",icon:"warn"};case"exited":case"error":return{button:"text-destructive-ink hover:bg-destructive/10",dot:"bg-destructive",label:"Tunnel unavailable",icon:"error"};case"starting":return{button:"text-warning-ink hover:bg-warning/10",dot:"bg-warning",label:"Tunnel starting",icon:"loading"}}}function Ji(e){if(!e||e.status==="stopped")return"Tunnel is off";switch(e.status){case"healthy":return"Tunnel healthy";case"checking":return"Checking tunnel health";case"degraded":return"Observing original link";case"localUnhealthy":return"Local service unavailable";case"exited":return"Tunnel process exited";case"error":return"Tunnel error";case"linkReplaced":return"New link generated";case"starting":return"Tunnel starting"}}function Zi(e){if(!e||e.status==="stopped")return"Start a temporary Quick Tunnel when you need to share this Agent Tower session.";switch(e.status){case"healthy":return"The Cloudflare tunnel is running and the local Agent Tower health check passed.";case"checking":return"The Cloudflare tunnel is running. Agent Tower is waiting for the first local health check.";case"degraded":return"The original public URL is currently unreachable. Agent Tower is watching for it to recover and will not generate a new link automatically.";case"localUnhealthy":return"The local Agent Tower target is not responding, so the tunnel cannot be considered healthy.";case"exited":return"The tunnel process has exited. The old Quick Tunnel link is unlikely to recover.";case"error":return"The tunnel reported an error. Check the diagnostics before generating a new link.";case"linkReplaced":return"A new Quick Tunnel link was generated. The old link and token are no longer valid.";case"starting":return"Agent Tower is asking Cloudflare Quick Tunnel for a temporary public URL."}}function Hn(e){if(!e)return"Never";const t=new Date(e).getTime();if(!Number.isFinite(t))return e;const n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`${n}s ago`;const r=Math.round(n/60);if(r<60)return`${r}m ago`;const a=Math.round(r/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}function ft(e){const t=e?.trim();return t||null}function ea(e){if(!e)return"";const t=[ft(e.lastLocalError),ft(e.lastRemoteError),ft(e.lastError)].filter(a=>a!==null),n=ft(e.lastProcessOutput),r=!!n&&(e.status==="error"||e.status==="exited"||!!ft(e.lastError));return n&&r&&t.push(n),t.join(`
|
|
8
|
-
`)}function Xn(){const{t:e}=De(),{data:t}=Yi(),n=Hi(),r=qi(),a=Xi(),[c,h]=u.useState(!1),[f,s]=u.useState(null),[i,l]=u.useState(!1),[d,m]=u.useState(!1),p=t?.status!==void 0&&t.status!=="stopped",g=n.isPending||t?.status==="starting",x=a.isPending,v=t?.shareableUrl,k=t?.token,C=Vi(t),y=Ji(t),R=ea(t),N=t?.status==="healthy"||t?.status==="checking"?"text-success-ink":t?.status==="exited"||t?.status==="error"?"text-destructive-ink":"text-warning-ink",M=u.useCallback(()=>{n.mutate(void 0,{onSuccess:()=>h(!0)})},[n]),P=u.useCallback(()=>{v&&(navigator.clipboard.writeText(v),s("url"),setTimeout(()=>s(null),2e3))},[v]),S=u.useCallback(()=>{k&&(navigator.clipboard.writeText(k),s("token"),setTimeout(()=>s(null),2e3))},[k]),z=u.useCallback(()=>{r.mutate(),h(!1),l(!1),m(!1)},[r]),_=u.useCallback(()=>{a.mutate(void 0,{onSuccess:()=>{m(!1),h(!0)}})},[a]),O=o.jsx(Cs,{asChild:!0,children:o.jsx(Jt,{size:"xs",label:e("Close"),className:"-mr-1 -mt-0.5 shrink-0",children:o.jsx(ts,{})})});return o.jsxs(Ss,{open:c,onOpenChange:h,children:[o.jsxs("div",{className:"relative",children:[o.jsx(Ns,{asChild:!0,children:o.jsx("button",{type:"button",disabled:g,className:ie("p-1.5 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/60",C.button),title:e(C.label),"aria-label":e(C.label),children:g?o.jsx(ns,{size:"md"}):C.icon==="warn"?o.jsx(rs,{size:16}):o.jsx(In,{size:16})})}),p&&!g&&o.jsx("span",{className:`pointer-events-none absolute top-0.5 right-0.5 w-2 h-2 ${C.dot} rounded-full`})]}),o.jsx(Es,{align:"end",className:ie("max-w-[calc(100vw-1rem)]",p?"w-96":"w-80"),children:p?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("span",{className:ie("flex items-center gap-1.5 text-xs font-medium",N),children:[o.jsx("span",{className:`inline-block w-1.5 h-1.5 ${C.dot} rounded-full`}),e(y)]}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:e(Zi(t))})]}),O]}),k&&o.jsxs("div",{className:"mb-2 flex items-center gap-1.5 rounded-md bg-muted/50 px-2 py-1 text-xs text-foreground/80",children:[o.jsx(ps,{size:12}),o.jsx("span",{children:e("Token protected")})]}),v&&o.jsx("div",{className:"flex justify-center py-3",children:o.jsx(Wr,{value:v,size:160})}),v||t?.url?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ks,{size:"sm",readOnly:!0,value:v??t?.url??"",onFocus:G=>G.target.select(),"aria-label":e("Copy shareable link"),className:"select-all text-xs"}),o.jsx(Jt,{size:"sm",label:e("Copy shareable link"),onClick:P,disabled:!v,children:f==="url"?o.jsx(bt,{className:"text-success"}):o.jsx(An,{})})]}):o.jsx("div",{className:"rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs text-muted-foreground",children:e("No tunnel link available")}),o.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"rounded-md border border-border px-2 py-1.5",children:[o.jsx("div",{className:"text-muted-foreground",children:e("Last checked")}),o.jsx("div",{className:"mt-0.5 text-foreground",children:Hn(t?.lastCheckedAt)})]}),o.jsxs("div",{className:"rounded-md border border-border px-2 py-1.5",children:[o.jsx("div",{className:"text-muted-foreground",children:e("Last healthy")}),o.jsx("div",{className:"mt-0.5 text-foreground",children:Hn(t?.lastHealthyAt)})]})]}),R&&o.jsx(Dt,{tone:"warning",size:"sm",className:"mt-2 max-h-28 overflow-auto",children:o.jsx("div",{className:"whitespace-pre-wrap break-words",children:R})}),t?.status==="degraded"&&o.jsx(Dt,{tone:"warning",size:"sm",className:"mt-2",children:e("Agent Tower is keeping the same URL and waiting for Cloudflare Quick Tunnel to recover.")}),t?.status==="linkReplaced"&&o.jsx(Dt,{tone:"warning",size:"sm",className:"mt-2",children:e("The previous tunnel link and token are no longer valid.")}),k&&o.jsxs("div",{className:"mt-2",children:[o.jsx("button",{type:"button",onClick:()=>l(!i),className:"rounded-sm text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:e(i?"Hide token":"Show token")}),i&&o.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 break-all rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs text-foreground/80",children:k}),o.jsx(Jt,{size:"sm",label:e("Copy token"),onClick:S,className:"shrink-0",children:f==="token"?o.jsx(bt,{className:"text-success"}):o.jsx(An,{})})]})]}),d?o.jsxs(Dt,{tone:"danger",size:"sm",className:"mt-3",children:[e("Generating a new link will invalidate the current link. People using the old URL must receive the new one."),o.jsxs("div",{className:"mt-2 flex gap-2",children:[o.jsx(Ne,{variant:"secondary",size:"xs",className:"flex-1",onClick:()=>m(!1),children:e("Cancel")}),o.jsx(Ne,{variant:"primary",tone:"danger",size:"xs",className:"flex-1",onClick:_,loading:x,children:e(x?"Generating...":"Regenerate link")})]})]}):o.jsxs(Ne,{variant:"ghost",size:"sm",block:!0,className:"mt-3",onClick:()=>m(!0),disabled:x||t?.canRegenerate===!1,children:[o.jsx(ss,{}),e("Regenerate link")]}),o.jsx(Ne,{variant:"ghost",tone:"danger",size:"sm",block:!0,className:"mt-1",onClick:z,loading:r.isPending,children:r.isPending?e("Stopping..."):e("Stop Tunnel")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-foreground/80",children:o.jsx(In,{size:16})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-foreground",children:e("Use Agent Tower on your phone")}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:e("After enabling the tunnel, you can scan a QR code with your phone to visit this Agent Tower instance, assign tasks, and check agent status.")})]})]}),O]}),o.jsx(Ne,{variant:"primary",size:"sm",block:!0,className:"mt-3",onClick:M,loading:g,children:e(g?"Starting tunnel...":"Enable phone access")})]})})]})}function on({isOpen:e,onClose:t}){const{t:n}=De(),r=hs(),[a,c]=u.useState(""),[h,f]=u.useState(""),[s,i]=u.useState(null),[l,d]=u.useState(!1),[m,p]=u.useState(!1),g=a.trim(),x=h.trim(),v=l||r.isPending,k=u.useMemo(()=>!!(g&&x&&!v),[g,x,v]),C=u.useCallback(()=>{c(""),f(""),i(null),p(!1)},[]),y=u.useCallback(()=>{v||(C(),t())},[v,t,C]);u.useEffect(()=>{e||C()},[e,C]);const R=u.useCallback(async S=>{try{await r.mutateAsync({name:g,repoPath:x,initEmptyRepo:S}),C(),t()}catch(z){const _=z instanceof Error?z.message:n("Failed to create project");i(_),Te.error(_)}},[r,t,C,n,g,x]),N=u.useCallback(async()=>{if(!(!g||!x||v)){i(null),d(!0);try{const S=await Be.get("/filesystem/validate",{params:{path:x}});if(!S.valid){i(S.error??n("Selected path is not a valid directory"));return}if(S.isGitRepo){await R(!1);return}if(S.reason==="no_git"&&S.isEmpty){p(!0);return}if(S.reason==="no_git"){await R(!1);return}await R(!1)}catch(S){i(S instanceof Error?S.message:n("Could not check project path"))}finally{d(!1)}}},[R,v,n,g,x]),M=u.useCallback(()=>{p(!1),R(!1)},[R]),P=u.useCallback(()=>{p(!1),R(!0)},[R]);return o.jsxs(o.Fragment,{children:[o.jsx(Dn,{isOpen:e,onClose:y,title:n("Create New Project"),action:o.jsxs(o.Fragment,{children:[o.jsx(Ne,{onClick:y,disabled:v,children:n("Cancel")}),o.jsx(Ne,{variant:"primary",onClick:N,disabled:!k,children:l?n("Checking..."):r.isPending?n("Creating..."):n("Create Project")})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-1.5",children:n("Project Name")}),o.jsx("input",{type:"text",value:a,onChange:S=>c(S.target.value),placeholder:n("e.g., Agent Tower"),disabled:v,className:"w-full px-3 py-2 border border-border rounded-lg text-sm focus:outline-none focus:border-ring transition-colors disabled:bg-muted/50 disabled:text-muted-foreground",autoFocus:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-1.5",children:n("Project Path")}),o.jsx(Ts,{value:h,onChange:f,validationMode:"directory"})]}),s&&o.jsx("p",{className:"text-xs text-destructive-ink leading-relaxed",children:s})]})}),o.jsx(Dn,{isOpen:m,onClose:()=>{r.isPending||p(!1)},title:n("Initialize Git repository?"),action:o.jsxs(o.Fragment,{children:[o.jsx(Ne,{onClick:()=>p(!1),disabled:r.isPending,children:n("Cancel")}),o.jsx(Ne,{onClick:M,disabled:r.isPending,children:n("Create Local Project")}),o.jsx(Ne,{variant:"primary",onClick:P,disabled:r.isPending,children:r.isPending?n("Creating..."):n("Initialize and Create")})]}),children:o.jsxs("div",{className:"space-y-3 text-sm text-foreground/70 leading-relaxed",children:[o.jsx("p",{children:n("This directory is empty and does not have Git version control yet. Agent Tower can initialize Git and create the initial commit before creating the project.")}),o.jsx("p",{children:n("You can also create it as a local project now. Local projects only support local Solo tasks until Git is initialized.")})]})})]})}function qn(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function ta(e){return e.map((t,n)=>({project:t,index:n,activityTime:qn(t.lastActivityAt??t.createdAt),createdTime:qn(t.createdAt)})).sort((t,n)=>{const r=n.activityTime-t.activityTime;if(r!==0)return r;const a=n.createdTime-t.createdTime;return a!==0?a:t.index-n.index}).map(({project:t})=>t)}const Yr="providerLastUsedAt";function na(){const e={};try{const t=localStorage.getItem(Yr),n=t?JSON.parse(t):{};if(n&&typeof n=="object"&&!Array.isArray(n))for(const[r,a]of Object.entries(n))typeof a=="number"&&Number.isFinite(a)&&a>0&&(e[r]=a)}catch{}try{const t=localStorage.getItem("lastSelectedProviderId");t&&Object.keys(e).length===0&&(e[t]=1)}catch{}return e}function ra(e){try{localStorage.setItem(Yr,JSON.stringify(e))}catch{}}const sa=u.lazy(()=>or(()=>import("./TaskDetail-CqhPxvg3.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(e=>({default:e.TaskDetail}))),oa=u.lazy(()=>or(()=>import("./MobileTaskDetail-M_Kke9rL.js"),__vite__mapDeps([56,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(e=>({default:e.MobileTaskDetail})));function Vn(){const{t:e}=De();return o.jsx("div",{role:"status",className:"flex flex-1 items-center justify-center bg-background p-4 text-sm text-muted-foreground",children:e("Loading...")})}function Jn({projects:e,filterProjectId:t,setFilterProjectId:n,onCreateProject:r,className:a}){const{t:c}=De(),[h,f]=u.useState(!1),s=e.filter(l=>!l.archivedAt),i=t?e.find(l=>l.id===t)??null:null;return o.jsxs("div",{className:ie("relative flex items-center min-w-0",a),children:[o.jsx("span",{className:"mx-1.5 text-muted-foreground select-none",children:"/"}),o.jsxs("button",{onClick:()=>f(l=>!l),className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-sm text-foreground/90 hover:bg-accent transition-colors min-w-0",children:[i?o.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${i.color.replace("text-","bg-")}`}):o.jsx(an,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:"truncate max-w-[200px] font-medium",children:i?i.name:c("All Projects")}),o.jsx(As,{size:13,className:`text-muted-foreground/70 shrink-0 transition-transform duration-200 ${h?"rotate-180":""}`})]}),h?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>f(!1)}),o.jsxs("div",{className:"absolute left-4 top-full mt-1.5 w-60 bg-popover border border-border rounded-lg shadow-popover shadow-black/5 z-40 py-1 animate-in fade-in zoom-in-95 duration-100 origin-top-left",children:[o.jsxs("button",{onClick:()=>{n(null),f(!1)},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[o.jsx(an,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:`flex-1 truncate ${t===null?"text-foreground font-medium":"text-muted-foreground"}`,children:c("All Projects")}),t===null?o.jsx(bt,{size:14,className:"text-foreground shrink-0"}):null]}),o.jsx("div",{className:"h-px bg-border/60 my-1 mx-2"}),o.jsx("div",{className:"max-h-[40vh] overflow-y-auto scrollbar-app-thin",children:s.map(l=>{const d=t===l.id;return o.jsxs("button",{onClick:()=>{n(l.id),f(!1)},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[o.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l.color.replace("text-","bg-")}`}),o.jsx("span",{className:`flex-1 truncate ${d?"text-foreground font-medium":"text-muted-foreground"}`,children:l.name}),d?o.jsx(bt,{size:14,className:"text-foreground shrink-0"}):null]},l.id)})}),o.jsx("div",{className:"h-px bg-border/60 my-1 mx-2"}),o.jsxs("button",{onClick:()=>{f(!1),r()},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors",children:[o.jsx(ir,{size:13}),o.jsx("span",{children:c("Create New Project...")})]})]})]}):null]})}const ia=260,aa=600,Zn=400,la=100,ca=1e3;function er(e){const t=e.workspaces?.find(r=>r.status==="ACTIVE")??e.workspaces?.[0],n=t?.sessions?.at(-1);return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,projectId:e.projectId,title:e.titlePreview??e.title,status:e.status,priority:e.priority,...t?{preferredWorkspace:{...t.workspaceKind===Ye.MAIN_DIRECTORY?{workspaceKind:Ye.MAIN_DIRECTORY}:{},branchName:t.branchName}}:{},...n?{latestAgentType:n.agentType}:{},...e.workspaces?.some(r=>r.sessions?.some(a=>a.status==="RUNNING"||a.status==="PENDING"))?{hasRunningSession:!0}:{},updatedAt:e.updatedAt?new Date(e.updatedAt).getTime():Date.now()}}function ua(){const{t:e,locale:t}=De(),[n,r]=u.useState(void 0),a=u.useRef(0),[c,h]=u.useState(null),[f,s]=u.useState(null),[i,l]=u.useState(Zn),[d,m]=u.useState(!1),[p,g]=u.useState("idle"),[x,v]=u.useState({}),k=u.useRef(!1),C=u.useRef(0),y=u.useRef(Zn),R=u.useRef(null),N=$t(),{data:M,isLoading:P}=js(),[S,z]=u.useState(na),{data:_,isLoading:O}=ms({limit:la}),G=u.useMemo(()=>_?.data??[],[_?.data]),B=f&&G.some(b=>b.id===f)?f:null,{data:V,isLoading:Q}=os({...B?{projectId:B}:{},limit:ca}),J=u.useMemo(()=>[...V?.data??[],...V?.parents??[]],[V]),[Y,H]=u.useState([]),W=u.useMemo(()=>{if(Y.length===0)return J;const b=new Set(J.map(j=>j.id));return[...Y.filter(j=>!b.has(j.id)),...J]},[J,Y]),[ne,ge]=u.useState(null),q=is(c&&!W.some(b=>b.id===c)?c:""),Z=u.useMemo(()=>c&&W.some(b=>b.id===c)?c:ne&&c===ne?ne:c&&(q.isLoading||q.data&&(!B||q.data.projectId===B))?c:null,[c,W,ne,q.data,q.isLoading,B]);u.useEffect(()=>{ne&&W.some(b=>b.id===ne)&&ge(null)},[ne,W]),u.useEffect(()=>{if(Y.length===0)return;const b=new Set(J.map(j=>j.id));Y.some(j=>b.has(j.id))&&H(j=>j.filter(A=>!b.has(A.id)))},[J,Y]);const me=u.useMemo(()=>ta(G),[G]),T=u.useMemo(()=>me.map(yi),[me]),I=u.useMemo(()=>me.filter(b=>!b.archivedAt),[me]),U=u.useMemo(()=>M?M.filter(Rs).sort((b,j)=>{const A=!dt(b),L=!dt(j);return A!==L?A?-1:1:(S[j.provider.id]??0)-(S[b.provider.id]??0)}):[],[M,S]),w=u.useMemo(()=>{const b=W.map(j=>Dr(j,G.find(A=>A.id===j.projectId)));return q.data&&Z===q.data.id&&!b.some(j=>j.id===q.data.id)&&b.push(Ci(q.data)),b},[G,W,q.data,Z]),E=u.useMemo(()=>{if(!Z)return null;const b=W.find(A=>A.id===Z)??(q.data?er(q.data):void 0);if(!b)return null;const j=G.find(A=>A.id===b.projectId);if(!j){const A=b.preferredWorkspace?b.preferredWorkspace.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":b.preferredWorkspace.branchName:"—";return{id:b.id,parentTaskId:b.parentTaskId,subtaskCount:b.subtaskCount,projectId:b.projectId,projectName:"Unknown",projectColor:"text-muted-foreground",title:b.title,status:Ht(b.status),priority:b.priority,branch:A,mainBranch:"main",description:"",isGitRepo:!1,worktreeReady:!1,reason:"NO_GIT",projectArchivedAt:null,projectRepoDeletedAt:null}}return Si(b,j)},[Z,W,G,q.data]),D=as(),se=ls(),ve=cs(),Xe=us(),be=vs(),Ie=u.useCallback(b=>{const j=er(b);H(A=>A.some(L=>L.id===b.id)?A.map(L=>L.id===b.id?j:L):[j,...A]),N.setQueryData(fe.tasks.detail(b.id),b),ge(b.id),h(b.id)},[N]),Me=u.useCallback((b,j,A)=>{const L=b.id,K=[b.title,b.description].filter(Boolean).join(`
|
|
9
|
-
|
|
10
|
-
`),ee=A===Ye.WORKTREE?I.find(X=>X.id===b.projectId)?.setupScript??null:null;v(X=>({...X,[L]:{status:"creating-workspace",setupScript:ee}})),(async()=>{try{await Ps(L,{providerId:j,prompt:K,workspaceKind:A},{createWorkspace:X=>Be.post(`/tasks/${L}/workspaces`,{clientSubmissionId:X,workspaceKind:A}),startSession:X=>be.mutateAsync(X),onStep:X=>v(de=>({...de,[L]:{status:X,setupScript:ee}}))}),await N.invalidateQueries({queryKey:fe.workspaces.list(L)}),await N.invalidateQueries({queryKey:fe.workspaces.setupProgress(L)}),await N.invalidateQueries({queryKey:fe.tasks.all}),v(X=>{const de={...X};return delete de[L],de})}catch(X){const de=X instanceof Error?X.message:e("启动 Agent 失败");v(je=>({...je,[L]:{status:"failed",error:de,setupScript:ee}})),Te.error(e("任务已创建,但启动 Agent 失败,可在详情中重试")),N.invalidateQueries({queryKey:fe.workspaces.list(L)}),N.invalidateQueries({queryKey:fe.tasks.all})}})()},[I,N,be,e]),it=u.useCallback(b=>{v(j=>{const A={...j};return delete A[b],A}),N.invalidateQueries({queryKey:fe.workspaces.list(b)}),N.invalidateQueries({queryKey:fe.tasks.all})},[N]),Ke=u.useCallback((b,j)=>{const A=new Set([b,...W.filter(L=>L.parentTaskId===b).map(L=>L.id)]);se.mutate({id:b,expectedSubtaskCount:j},{onSuccess:()=>{(Z===b||E?.parentTaskId===b)&&h(null),v(L=>{const K={...L};for(const ee of A)delete K[ee];return K}),H(L=>L.filter(K=>K.id!==b&&K.parentTaskId!==b)),N.invalidateQueries({queryKey:fe.tasks.all})},onError:L=>{Te.error(L instanceof Error?e(L.message):e("删除任务失败"))}})},[se,Z,E?.parentTaskId,W,N,e]),Ge=u.useCallback((b,j)=>{ve.mutate({id:b,status:vi(j)},{onError:()=>{Te.error(e("状态变更失败,该操作不被允许"))}})},[ve,e]),xe=u.useCallback((b,j)=>{Xe.mutate({id:b,priority:j},{onError:()=>{Te.error(e("优先级变更失败"))}})},[Xe,e]),qe=u.useCallback(b=>{b.preventDefault(),k.current=!0,C.current=b.clientX,y.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[i]);u.useEffect(()=>{const b=A=>{if(!k.current)return;const L=A.clientX-C.current,K=Math.max(ia,Math.min(aa,y.current+L));l(K)},j=()=>{k.current&&(k.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",j)}},[]);const Pe=u.useCallback(()=>{m(!0)},[]),kt=u.useCallback(()=>{if(a.current++,r(void 0),I.length===0){Te.error(e("没有可用项目,请先创建或恢复项目"));return}h(null)},[I,e]),Ve=u.useCallback(()=>{m(!1)},[]),at=u.useCallback(async b=>{const{title:j,description:A,projectId:L,providerId:K,mode:ee,workspaceMode:X,teamRunMode:de,teamTemplateId:je,memberPresetIds:_e,attachmentLinks:Re,priority:Qe,baseBranch:ut}=b,Hr=[A,Re].filter(Boolean).join(`
|
|
11
|
-
|
|
12
|
-
`);let Ue=null;try{if(g("creating-task"),Ue=await Be.post(`/projects/${L}/tasks`,{title:j,description:Hr||void 0,priority:Qe,baseBranch:ut,parentTaskId:b.parentTaskId}),localStorage.setItem("lastSelectedProjectId",L),ee==="SOLO"&&K){localStorage.setItem("lastSelectedProviderId",K);const Cn={...S,[K]:Date.now()};ra(Cn),z(Cn)}ee==="TEAM"?(g("creating-teamrun"),await D.mutateAsync({taskId:Ue.id,mode:de,...je?{teamTemplateId:je}:{},..._e.length>0?{memberPresetIds:_e}:{}})):K&&Me(Ue,K,X),B&&L!==B&&s(null),Ie(Ue),r(void 0),g("idle"),N.invalidateQueries({queryKey:fe.tasks.all}),N.invalidateQueries({queryKey:fe.projects.all})}catch(Ze){if(g("idle"),Ue&&ee==="TEAM")Ie(Ue),N.invalidateQueries({queryKey:fe.tasks.all}),Te.error(Ze instanceof Error?Ze.message:e("TeamRun 创建失败,请检查团队配置后重试"));else if(Ue)B&&L!==B&&s(null),Ie(Ue),N.invalidateQueries({queryKey:fe.tasks.all}),N.invalidateQueries({queryKey:fe.projects.all});else throw Te.error(Ze instanceof Error?Ze.message:e("Failed to create task")),Ze}},[D,Me,N,e,B,Ie,S]),jt=O||Q,Oe=u.useMemo(()=>I.filter(b=>!n||b.id===n.projectId).map(b=>({id:b.id,name:b.name,color:T.find(j=>j.id===b.id)?.color,repoPath:b.repoPath,mainBranch:b.mainBranch,isGitRepo:b.isGitRepo,worktreeReady:b.worktreeReady,reason:b.reason})),[I,T,n]),Le=u.useMemo(()=>U.map(b=>{const j=dt(b);return{id:b.provider.id,name:b.provider.name,agentType:b.provider.agentType,available:!j,permissionMode:b.provider.executionPermission,reason:j}}),[U]),ye=u.useMemo(()=>{if(n)return n.projectId;if(B&&I.find(j=>j.id===B))return B;const b=localStorage.getItem("lastSelectedProjectId");return b&&I.find(j=>j.id===b)?b:I[0]?.id??""},[I,B,n]),[lt,we]=u.useState(ye);u.useEffect(()=>{we(ye)},[ye]);const ct=u.useMemo(()=>I.find(b=>b.id===lt)?.name??I.find(b=>b.id===ye)?.name??e("Project"),[I,lt,ye,e]),Rt=n?e("Create subtask"):t==="zh-CN"?`你需要在 ${ct} 中做点什么?`:`What do you need to do in ${ct}?`,Tt=u.useMemo(()=>{const b=localStorage.getItem("lastSelectedProviderId");return b&&U.find(A=>A.provider.id===b&&!dt(A))?b:U.find(A=>!dt(A))?.provider.id??""},[U]),We=Rr(),[At,Je]=u.useState(!1),{usesIntegratedTitlebar:ze,desktopPlatform:Xt,hasMacTrafficLights:qt}=sr(),Vt=ze&&Xt==="win32",le=u.useCallback(()=>{if(a.current++,r(void 0),I.length===0){Te.error(e("没有可用项目,请先创建或恢复项目"));return}Je(!0)},[I,e]),ce=u.useCallback(b=>{a.current++,r(void 0),h(b)},[]),ue=u.useCallback(async b=>{const j=++a.current;try{const A=await Be.get(`/tasks/${b}`);if(j!==a.current)return;const L=(A.workspaces?.filter(ee=>!ee.parentWorkspaceId&&ee.status!=="ABANDONED")??[]).sort((ee,X)=>(X.createdAt??"").localeCompare(ee.createdAt??"")),K=L.find(ee=>ee.status==="ACTIVE")??L.find(ee=>ee.status==="HIBERNATED")??L[0];r({id:b,title:A.titlePreview??A.title,projectId:A.projectId,baseBranch:K?.branchName||A.baseBranch}),h(null),We&&Je(!0)}catch(A){j===a.current&&Te.error(A instanceof Error?A.message:e("Failed to create task"))}},[We,e]),ke=u.useCallback(async b=>{await at(b),Je(!1)},[at]);return We?At?o.jsxs("div",{className:"flex flex-col h-dvh bg-background overflow-hidden text-sm",children:[o.jsx("header",{className:"h-12 border-b border-border/60 flex items-center px-4 shrink-0",children:o.jsx("button",{onClick:()=>{a.current++,n&&h(n.id),r(void 0),Je(!1)},className:"text-sm text-muted-foreground active:text-foreground",children:e("Cancel")})}),o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-4 pb-[8vh]",children:[o.jsx("h1",{className:"max-w-full text-center text-[22px] font-medium tracking-tight leading-snug text-foreground mb-5 break-words",children:Rt}),o.jsx(Rn,{parentTask:n,projects:Oe,providers:Le,isProvidersLoading:P,onSubmit:ke,defaultProjectId:ye,defaultProviderId:Tt,onProjectChange:we,createStep:p},n?.id??"root")]})]}):Z&&E?o.jsxs(o.Fragment,{children:[o.jsx(u.Suspense,{fallback:o.jsx("div",{className:"flex h-dvh",children:o.jsx(Vn,{})}),children:o.jsx(oa,{task:E,onSelectTask:ce,onCreateSubtask:ue,onBack:()=>h(null),onDeleteTask:E.projectArchivedAt?void 0:Ke,onTaskPriorityChange:E.projectArchivedAt?void 0:xe,isDeleting:se.isPending,autoStartState:x[E.id]??null,onAutoStartRecovered:it})}),o.jsx(on,{isOpen:d,onClose:Ve})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col h-dvh bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:"h-12 bg-sidebar flex items-center px-4 justify-between shrink-0 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(Tn,{}),o.jsx(Jn,{projects:T,filterProjectId:B,setFilterProjectId:s,onCreateProject:Pe})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Xn,{}),o.jsx("button",{onClick:()=>En.getState().openSettings(),className:"p-1.5 text-muted-foreground active:text-foreground rounded-md",children:o.jsx(Nn,{size:16})})]})]}),o.jsx(Qn,{tasks:w,projects:T,selectedTaskId:null,onSelectTask:ce,onCreateSubtask:ue,selectedParentTaskId:E?.parentTaskId,filterProjectId:B,setFilterProjectId:s,width:"100%",onDeleteTask:Ke,onCreateTask:le,onCreateProject:Pe,onTaskStatusChange:Ge,onTaskPriorityChange:xe,isLoading:jt&&w.length===0})]}),o.jsx(on,{isOpen:d,onClose:Ve})]}):o.jsxs("div",{ref:R,className:"flex flex-col h-screen bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:ie("h-12 bg-sidebar flex items-center px-4 justify-between flex-shrink-0 z-20 relative",ze&&"app-region-drag",Vt&&"pr-[150px]"),children:[o.jsxs("div",{className:ie("flex items-center gap-2 min-w-0",qt&&"pl-[72px]"),children:[o.jsx(Tn,{}),o.jsx(Jn,{projects:T,filterProjectId:B,setFilterProjectId:s,onCreateProject:Pe,className:ze?"app-region-no-drag":void 0})]}),o.jsxs("div",{className:ie("flex items-center gap-1",ze&&"app-region-no-drag"),children:[o.jsx("div",{className:ze?"app-region-no-drag":void 0,children:o.jsx(Xn,{})}),o.jsx("button",{onClick:()=>En.getState().openSettings(),className:ie("p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded-md transition-colors",ze&&"app-region-no-drag"),children:o.jsx(Nn,{size:16})})]})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Qn,{tasks:w,projects:T,selectedTaskId:Z,onSelectTask:ce,onCreateSubtask:ue,selectedParentTaskId:E?.parentTaskId,filterProjectId:B,setFilterProjectId:s,width:i,onCreateTask:kt,onCreateProject:Pe,isCreateActive:!Z,onTaskStatusChange:Ge,onDeleteTask:Ke,onTaskPriorityChange:xe,isLoading:jt&&w.length===0}),o.jsx("div",{onMouseDown:qe,className:"w-1 cursor-col-resize hover:bg-border active:bg-ring/40 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:e("Drag to resize")}),o.jsx("div",{className:"flex-1 flex min-w-0 mb-2 mr-2 rounded-xl border border-border/50 bg-background overflow-hidden",children:Z&&E?o.jsx(u.Suspense,{fallback:o.jsx(Vn,{}),children:o.jsx(sa,{task:E,onSelectTask:ce,onCreateSubtask:ue,onDeleteTask:E.projectArchivedAt?void 0:Ke,isDeleting:se.isPending,onTaskStatusChange:E.projectArchivedAt?void 0:Ge,onTaskPriorityChange:E.projectArchivedAt?void 0:xe,autoStartState:x[E.id]??null,onAutoStartRecovered:it})}):Z&&!E?o.jsx("div",{className:"flex-1 flex items-center justify-center bg-background min-w-0",children:o.jsx("span",{className:"text-sm text-muted-foreground",children:e("Loading...")})}):o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center bg-background min-w-0 px-8 pb-[10vh]",children:o.jsxs("div",{className:"w-full max-w-2xl flex flex-col items-center animate-[fadeInUp_0.5s_cubic-bezier(0.16,1,0.3,1)]",children:[o.jsx("h1",{className:"max-w-full text-center text-[26px] font-medium tracking-tight leading-snug text-foreground mb-6 break-words",children:Rt}),o.jsx(Rn,{parentTask:n,projects:Oe,providers:Le,isProvidersLoading:P,onSubmit:at,defaultProjectId:ye,defaultProviderId:Tt,onProjectChange:we,createStep:p},n?.id??"root")]})})})]}),o.jsx(on,{isOpen:d,onClose:Ve})]})}const Ia=Object.freeze(Object.defineProperty({__proto__:null,ProjectKanbanPage:ua},Symbol.toStringTag,{value:"Module"}));export{Ei as D,Is as L,Ia as P,Ht as m,Ps as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Re,r as n,ai as Ft,j as e,B as oe,aj as Ut,a5 as Js,a6 as _t,ak as Kt,al as qt,am as Vt,an as Gt,ao as Ht,ap as F,aq as Qt,ar as $t,o as Xt,p as Yt,q as Ie,as as ms,at as Jt,af as Zs,ag as U,au as Zt,s as en,av as et,aw as sn,a3 as tn,ax as nn,ay as W,a0 as rn,az as on}from"./index-Cc3qXMhU.js";import{u as an,r as ln,c as cn,g as _e,a as dn,b as un,d as mn,e as pn,f as fn,h as xn,W as gn,E as hn,i as bn,C as vn,S as jn,T as st,R as yn,j as kn,k as Cn,l as wn,m as Nn,n as In,o as Sn,p as Rn}from"./TaskHandoffPanel-CxH3Mgyd.js";import{r as Tn,a as tt,Q as An,s as En}from"./mermaid-NOHMQCX5-nBsnjgeU.js";import{t as Wn,D as Pn}from"./ProjectKanbanPage-soDqevjQ.js";import{u as Dn,a as Mn,R as On,P as Ln,T as Bn}from"./useTokenUsage-CZ5mDshD.js";import{u as zn,a as Fn,L as nt,T as rt}from"./useNormalizedLogs-D9W1cT4R.js";import{g as Un}from"./ExecutionPermissionSelector-f1UYIm1z.js";import{u as _n,A as Kn}from"./AttachmentPreview-DMS-PM-1.js";import{T as qn,u as Vn,a as Gn,b as Hn,c as Qn,d as $n,e as Xn,S as ot}from"./CreateTaskInput-DjVxCAfc.js";import{u as Yn,a as Jn,b as Zn,c as er,d as sr,e as tr}from"./BranchSelect-BAq4L2ZS.js";import{u as nr}from"./use-providers-Dv1Nk6s7.js";import{i as rr}from"./provider-selection-DSu7SCI7.js";import{M as or}from"./modal-CHLtZWvx.js";import{C as ar}from"./confirm-dialog-DWeBZLJW.js";import{C as ir,P as ps}from"./content-JM9E1MeD.js";import{P as fs,T as lr}from"./trash-2-CIyBqaVy.js";import{P as cr}from"./paperclip-YP3Bk1lI.js";import"./use-translation-settings-CcUnipVO.js";import"./MemberAvatar-BLezO3vS.js";import"./people-DEeNaaLt.js";import"./chevron-down-DNhYsNAt.js";import"./chevron-up-CjrLieBR.js";import"./at-sign-DYPIlD6D.js";import"./check-DaZqOL8l.js";import"./tooltip-DuyJMci9.js";import"./kbd-IjDGsZ2B.js";import"./index-DWrSDMX2.js";import"./index-Disv1kQS.js";import"./index-Pt4TsHjm.js";import"./BrandLogo--kWXXJtZ.js";import"./popover-CUmBEXxL.js";import"./search-ClmOQd4H.js";import"./index-DyJfPc4O.js";import"./index-hpHE1jXY.js";import"./index-BMZFF1UJ.js";import"./select-BB7QG08o.js";import"./select-CYtYPr-c.js";import"./menu-styles-DWynpVVz.js";import"./index-T38iVLEb.js";import"./layers-Pdy9vZ6K.js";import"./message-square-BE-pW0m_.js";import"./textarea-BqYPvoO-.js";import"./menu-DubntFHq.js";import"./server-bEB_DY55.js";import"./upload-D05XS5-G.js";import"./globe-Ce01-45x.js";import"./pencil-BFDuhbtW.js";import"./copy-D0gl9kF8.js";import"./chip-Cf92J-pQ.js";import"./folder-picker-Czxm0_S9.js";import"./track-DCjyrv3n.js";import"./dialog-D1lkhqVL.js";import"./file-BijjwxRR.js";function dr({isOpen:t,onClose:f,taskId:N}){const{t:d}=Re(),[I,S]=n.useState("AUTO"),[R,l]=n.useState(null),[T,o]=n.useState([]),[k,P]=n.useState(null),Te=Ft();n.useEffect(()=>{t&&(S("AUTO"),l(null),o([]),P(null))},[t]);const D=Te.isPending,Ke=!!R||T.length>0,ae=async()=>{if(!D){if(!R&&T.length===0){P(d("请选择至少一个团队模板或成员预设。"));return}P(null);try{await Te.mutateAsync({taskId:N,mode:I,...R?{teamTemplateId:R}:{},...T.length>0?{memberPresetIds:T}:{}}),f()}catch(G){P(G instanceof Error?G.message:d("创建 TeamRun 失败"))}}},qe=D||!Ke;return e.jsxs(or,{isOpen:t,onClose:D?()=>{}:f,title:d("创建 TeamRun"),className:"max-w-5xl",action:e.jsxs(e.Fragment,{children:[e.jsx(oe,{type:"button",variant:"outline",onClick:f,disabled:D,children:d("取消")}),e.jsx(oe,{type:"button",onClick:ae,disabled:qe,children:d(D?"处理中...":"创建 TeamRun")})]}),children:[e.jsx(qn,{mode:I,setMode:S,selectedTemplateId:R,setSelectedTemplateId:l,selectedMemberPresetIds:T,setSelectedMemberPresetIds:o,disabled:D}),k&&e.jsx("div",{role:"alert",className:"rounded-lg border border-destructive/25 bg-destructive/10 px-4 py-3 text-sm text-destructive-ink",children:k})]})}function ur({workspaceId:t,gitStatus:f,onResolve:N}){const{t:d}=Re(),I=Yn();if(f.operation==="idle"||f.conflictedFiles.length===0)return null;const S=f.operation==="rebase"?"Rebase":"Merge";return e.jsx(Ut,{tone:"warning",className:"mx-6 mt-3 items-center",title:e.jsxs("span",{className:"flex items-center gap-2",children:[S," ",d("冲突"),e.jsxs(_t,{tone:"warning",className:"tabular-nums",children:[f.conflictedFiles.length," ",d("个文件")]})]}),action:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Js,{variant:"ghost",onClick:()=>I.mutate(t),loading:I.isPending,children:d("中止操作")}),e.jsx(Js,{variant:"primary",onClick:N,children:d("解决冲突")})]})})}const mr=rn(),pr=t=>t.includes("://")||t.startsWith("/api/")?t:t.startsWith("/")?`${mr}/attachments/by-path?path=${encodeURIComponent(t)}`:t,re=520,xs=48,fr=4,xr=420;function gr(){const{t}=Re();return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-background text-muted-foreground select-none",children:[e.jsx("div",{className:"w-16 h-16 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-6",children:e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-muted-foreground",children:[e.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),e.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsx("h3",{className:"text-foreground font-medium mb-2 text-[15px]",children:"Agent Tower"}),e.jsx("p",{className:"text-sm max-w-sm text-center text-muted-foreground leading-relaxed",children:t("Select a task from the sidebar to view logs, monitor execution, or interact with an agent.")})]})}function Se(t){const f=on[t].icon;return e.jsx(f,{className:"size-3"})}const at=[{status:W.Review,className:"bg-warning/10 text-warning-ink",hoverClass:"hover:bg-warning/15",icon:Se(W.Review)},{status:W.Running,className:"bg-info/10 text-info-ink",hoverClass:"hover:bg-info/15",icon:Se(W.Running)},{status:W.Pending,className:"bg-muted/50 text-muted-foreground",hoverClass:"hover:bg-muted",icon:Se(W.Pending)},{status:W.Done,className:"bg-success/10 text-success-ink",hoverClass:"hover:bg-success/15",icon:Se(W.Done)},{status:W.Cancelled,className:"bg-muted/50 text-muted-foreground",hoverClass:"hover:bg-border",icon:Se(W.Cancelled)}];function hr({status:t,onChangeStatus:f}){const{t:N}=Re(),[d,I]=n.useState(!1),S=n.useRef(null);n.useEffect(()=>{if(!d)return;const l=T=>{S.current&&!S.current.contains(T.target)&&I(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[d]);const R=at.find(l=>l.status===t);return e.jsxs("div",{className:"relative",ref:S,children:[e.jsxs("button",{onClick:()=>f&&I(l=>!l),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium transition-colors ${R.className} ${f?"cursor-pointer hover:opacity-80":""}`,children:[R.icon,e.jsx("span",{children:N(t)}),f&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${d?"rotate-180":""}`,children:e.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})]}),d&&e.jsx("div",{className:"absolute right-0 top-full mt-2 w-40 bg-background rounded-lg border border-border shadow-popover z-50 py-1 animate-in fade-in zoom-in-95 duration-100",children:at.filter(l=>l.status!==t).map(l=>e.jsxs("button",{onClick:()=>{f?.(l.status),I(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${l.hoverClass}`,children:[e.jsx("span",{className:l.className.split(" ").find(T=>T.startsWith("text-")),children:l.icon}),e.jsx("span",{className:"text-foreground/80",children:N(l.status)})]},l.status))})]})}function bo({task:t,onSelectTask:f,onCreateSubtask:N,onDeleteTask:d,isDeleting:I,onTaskStatusChange:S,onTaskPriorityChange:R,autoStartState:l,onAutoStartRecovered:T}){const{t:o}=Re(),[k,P]=n.useState(""),[Te,D]=n.useState(!1),[Ke,ae]=n.useState(!1),[qe,G]=n.useState(!1),[it,Ve]=n.useState(!1),[lt,gs]=n.useState(!1),Ae=n.useRef(null),[Ge,H]=n.useState(!1),[A,He]=n.useState(null),[ie,Q]=n.useState(void 0),[$,Ee]=n.useState(!1),Qe=n.useRef(null),$e=n.useRef(null),le=n.useRef(null),hs=n.useRef(null),{scrollRef:_,contentRef:bs,isAtBottom:vs,scrollToBottom:We,stopScroll:js}=Dn({resize:"smooth",initial:"instant"}),[M,ys]=n.useState(!1),[Xe,ce]=n.useState(re),[Pe,ks]=n.useState(!1),Cs=n.useRef(0),ws=n.useRef(re),Ns=n.useRef(null),Ye=n.useCallback((s,r,i)=>{Ae.current?.openFile(s,r,i)},[]),{data:a,isLoading:ct}=Jn(t?.id??""),de=an(t?.id),Is=de?.status==="completed"&&l?.status!=="failed"?null:l,Je=!!(Is||de&&de.status!=="completed"),{data:ue}=Kt(t?.id??""),{data:dt}=qt(ue?.id??""),Ss=Vt(ue?.id??""),u=ue??null,me=!!u,X=t?.isGitRepo!==!1&&t?.worktreeReady!==!1,De=ue===null&&X,ut=!!(t?.id&&ue===null),{data:Y,isLoading:Rs}=Gt(t?.id??"",ut);n.useEffect(()=>{Ee(!1),He(null),Q(void 0)},[t?.id]);const K=n.useMemo(()=>ln(a,u,ie),[ie,u,a]);n.useEffect(()=>{ie&&!a?.some(s=>s.id===ie)&&Q(void 0)},[ie,a]);const x=n.useMemo(()=>a?.find(s=>s.id===K),[K,a]),y=x?.status===Ht.ACTIVE?x.id:void 0,pe=X&&cn(x,u);n.useEffect(()=>{if(!$||!a)return;a.some(r=>r.status==="ACTIVE"&&r.sessions&&r.sessions.length>0)&&Ee(!1)},[a,$]);const g=n.useMemo(()=>{if($||!a)return null;const s=c=>{const us=c.createdAt,Ne=c.endedAt??c.startedAt??us;if(!Ne)return 0;const ne=Date.parse(Ne);return Number.isNaN(ne)?0:ne},r=(c,us)=>{const Ne=c.filter(ne=>us.includes(ne.status));return Ne.length===0?null:Ne.sort((ne,zt)=>s(zt)-s(ne))[0]??null},i=a.filter(c=>c.status==="ACTIVE"&&Array.isArray(c.sessions)).flatMap(c=>c.sessions??[]),p=r(i,[F.RUNNING])??r(i,[F.PENDING])??r(i,[F.COMPLETED,F.FAILED,F.CANCELLED]);if(p)return p;const w=a.filter(c=>(c.status==="MERGED"||c.status==="ABANDONED"||c.status==="HIBERNATED")&&Array.isArray(c.sessions)).flatMap(c=>c.sessions??[]);return r(w,[F.COMPLETED,F.FAILED,F.CANCELLED])},[a,$]),J=g?.id??"",h=me?A??"":J,mt=n.useMemo(()=>{if(!A||!a)return null;for(const s of a){const r=s.sessions?.find(i=>i.id===A);if(r)return r}return null},[A,a]),Ze=n.useMemo(()=>{if(!A||!u?.invocations)return null;const s=u.invocations.filter(r=>r.sessionId===A);return s.length===0?null:s.sort((r,i)=>{const p=Date.parse(r.updatedAt??r.createdAt??""),w=Date.parse(i.updatedAt??i.createdAt??"");return(Number.isNaN(w)?0:w)-(Number.isNaN(p)?0:p)})[0]??null},[A,u?.invocations]),pt=n.useMemo(()=>!Ze?.memberId||!u?.members?null:u.members.find(s=>s.id===Ze.memberId)??null,[Ze?.memberId,u?.members]),b=A?mt:g??null,L=b?.id,Z=n.useMemo(()=>{if(b?.workspaceId)return b.workspaceId;if(!(!b||!a))return a.find(s=>s.sessions?.some(r=>r.id===b.id))?.id},[b,a]),Me=n.useCallback((s,r)=>{const p=(r&&a?.some(w=>w.id===r)?r:void 0)??Z??K??void 0;p&&Q(p),Ae.current?.openPreview(s,p)},[Z,K,a]),es=n.useCallback((s,r)=>{Me({kind:"web",url:s},r)},[Me]),ss=n.useCallback((s,r,i)=>{Me({kind:"visualization",sessionId:s,file:r},i)},[Me]),Ts=n.useCallback(s=>{es(s,Z)},[Z,es]),As=n.useCallback(s=>{L&&ss(L,s,Z)},[L,Z,ss]),{isActive:fe,isCancelling:xe}=Vn(L??"",b?.status),m=!!t?.projectArchivedAt,Es=!!t?.projectRepoDeletedAt,ts=o(Es?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。"),{data:ee}=nr(),[Oe,Ws]=n.useState(null),Le=g?Un(ee,Oe??g.providerId):void 0;n.useEffect(()=>{Ws(g?.providerId??null)},[g?.providerId]);const ft=n.useMemo(()=>!g||!a?!1:!a.some(r=>r.status==="ACTIVE"&&r.sessions?.some(i=>i.id===g.id)),[g,a]),C=n.useMemo(()=>{if(!(!a||$)){if(x)return _e(x);for(const s of a)if(s.status==="ACTIVE"&&_e(s))return _e(s);return _e(a[0])}},[$,x,a]),q=Gn({agentType:g?.agentType,workingDir:C,input:k,setInput:P,textareaRef:le,minHeight:60,maxHeight:300}),V=dn({agentType:g?.agentType,workingDir:C,input:k,setInput:P,textareaRef:le,minHeight:60,maxHeight:300}),ns=Qt(s=>s.setVisibleContext),ge=!!(pe&&y&&C&&!m),{data:E,isLoading:xt}=Zn(y??"",{enabled:ge}),{data:gt}=un(C,{enabled:ge});n.useEffect(()=>{if(!(M||!ge||!y||!C))return ns({workspaceId:y,workingDir:C,tab:"changes"}),()=>{ns(null)}},[M,y,ns,ge,C]);const ht=x?.sessions??[],he=mn(x),Ps=x?.commitMessage,be=n.useMemo(()=>pn(x,a,t?.mainBranch??""),[x,t?.mainBranch,a]),ve=fn((a??[]).map(s=>s.id),!me),{pendingConflictDetails:je}=ve,Ds=!!je,v=n.useMemo(()=>je||(E?.conflictOp&&E.conflictedFiles.length>0?$t({conflictOp:E.conflictOp,conflictedFiles:E.conflictedFiles,resolutionContextToken:E.resolutionContextToken,sourceWorkspaceId:y,sourceWorktreePath:x?.worktreePath,sourceBranch:he,targetBranch:be}):je),[E,je,y,x?.worktreePath,he,be]),Ms=v?.targetWorkspaceId??y,bt=v?.targetWorktreePath??x?.worktreePath,vt=v?.sourceBranch??he,jt=v?.targetBranch??be,j=Xt(),Be=n.useCallback(async()=>t?.id?j.fetchQuery({queryKey:Ie.tasks.body(t.id),queryFn:()=>Yt.get(`/tasks/${t.id}/body`)}):null,[j,t?.id]),Os=n.useCallback(()=>t?.id?j.invalidateQueries({queryKey:Ie.workspaces.list(t.id)}):Promise.resolve(),[t?.id,j]);n.useEffect(()=>{if(!Ge)return;const s=r=>{$e.current&&!$e.current.contains(r.target)&&H(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[Ge]);const B=Hn(),Ls=er(),Bs=sr(t?.id??""),zs=Qn(),rs=tr(),ye=n.useMemo(()=>!a||a.some(r=>r.status==="ACTIVE")?null:a.find(r=>r.status==="HIBERNATED")??null,[a]),os=n.useRef(null);n.useEffect(()=>{ye&&os.current!==ye.id&&(rs.isPending||(os.current=ye.id,rs.mutate(ye.id,{onSettled:()=>{os.current=null}})))},[ye,rs]);const yt=n.useCallback(async()=>{if(!t?.id)return;const s=g?.providerId??ee?.find(r=>rr(r)&&r.availability.type!=="NOT_FOUND")?.provider.id;if(s){Ve(!1),gs(!0);try{const i=(await Be())?.prompt??t.title;Ee(!0),await Wn(t.id,{providerId:s,prompt:i,retryTask:!0,workspaceKind:X?ms.WORKTREE:ms.MAIN_DIRECTORY},{createWorkspace:p=>Bs.mutateAsync({clientSubmissionId:p,workspaceKind:X?void 0:ms.MAIN_DIRECTORY}),startSession:p=>zs.mutateAsync(p)}),await j.invalidateQueries({queryKey:Ie.workspaces.list(t.id)})}catch(r){console.error("[retry] failed:",r),Ee(!1)}finally{gs(!1)}}},[t?.id,t?.title,X,g?.providerId,ee,Be,Bs,zs,j]),as=n.useCallback(async()=>{t?.id&&(await Be(),D(!0))},[Be,t?.id]),kt=n.useCallback(()=>{x?.id&&Ls.mutate({workspaceId:x.id})},[Ls,x?.id]),Ct=n.useCallback(s=>{!t?.id||!d||(d(t.id,s),G(!1))},[t?.id,d]),Fs=n.useCallback(s=>{He(s),requestAnimationFrame(()=>{We()})},[We]),wt=n.useCallback(()=>{He(null)},[]),ke=n.useCallback(s=>{const r=s??v;r&&ve.openDialog(r)},[v,ve]),Nt=n.useCallback(s=>Ss.mutateAsync(s),[Ss]),se=n.useCallback(()=>{j.invalidateQueries({queryKey:Jt.all})},[j]),{isConnected:Us,isLoadingSnapshot:_s,isOutputActive:Ks,lastExitAt:qs,logs:Ce,entries:It,attach:ze}=zn({sessionId:h,sessionStatus:b?.status,sessionStartedAt:b?.startedAt??b?.createdAt,sessionEndedAt:b?.endedAt??(fe?null:b?.updatedAt),onExit:n.useCallback(()=>{j.invalidateQueries({queryKey:["workspaces"]})},[j])});n.useEffect(()=>{if(!t?.id)return;const s=Zs.connect(),r=Tn(t.id),i=c=>{c.taskId===t.id&&(j.invalidateQueries({queryKey:["tasks"]}),se())},p=c=>{c.taskId===t.id&&(j.invalidateQueries({queryKey:Ie.workspaces.list(t.id)}),se())},w=c=>{c.taskId===t.id&&(j.invalidateQueries({queryKey:Ie.workspaces.list(t.id)}),se())};return s.on(U.TASK_UPDATED,i),s.on(U.WORKSPACE_COMMIT_MESSAGE_UPDATED,p),s.on(U.WORKSPACE_HIBERNATED,w),()=>{s.off(U.TASK_UPDATED,i),s.off(U.WORKSPACE_COMMIT_MESSAGE_UPDATED,p),s.off(U.WORKSPACE_HIBERNATED,w),r()}},[t?.id,j,se]),n.useEffect(()=>{if(!h)return;const s=Zs.connect(),r=i=>{i.sessionId===h&&(j.invalidateQueries({queryKey:["workspaces"]}),se())};return s.on(U.SESSION_COMPLETED,r),()=>{s.off(U.SESSION_COMPLETED,r)}},[h,j,se]);const{todos:Fe}=Fn(It),{files:St,addFiles:te,removeFile:Rt,clear:Vs,getDoneAttachments:Gs,hasFiles:we,isUploading:Ue}=_n(),Tt=n.useMemo(()=>xn(b),[b?.tokenUsage]),Hs=Mn(Ce,Tt);n.useEffect(()=>{h&&Us&&ze()},[h,Us,ze]);const Qs=n.useRef(t?.id);n.useEffect(()=>{if(Qs.current!==t?.id&&_.current){const s=_.current;requestAnimationFrame(()=>{s.scrollTop=s.scrollHeight})}Qs.current=t?.id},[t?.id,_]);const z=$n(),is=n.useRef(!1),$s=n.useCallback(async()=>{if(!k.trim()&&!we||!h||is.current||z.isPending||xe||Ue||Le)return;is.current=!0;const s=Gs().map(i=>i.id),r=k.trim()||(s.length?" ":"");P(""),Vs(),le.current&&(le.current.style.height="60px"),B.mutate({id:h,message:r,attachmentIds:s,providerId:Oe??void 0},{onSuccess:()=>{ze()},onSettled:()=>{is.current=!1}})},[k,h,B,ze,we,Ue,Gs,Vs,Oe,Le,z.isPending,xe]),At=n.useCallback(()=>{!h||z.isPending||z.mutate(h)},[h,z]),Et=n.useCallback(s=>{const r=s.target.files;r&&r.length>0&&te(Array.from(r)),s.target.value=""},[te]),Wt=n.useCallback(s=>{const r=s.clipboardData.items,i=[];for(const p of r)if(p.kind==="file"){const w=p.getAsFile();w&&i.push(w)}i.length>0&&(s.preventDefault(),te(i))},[te]),[Xs,ls]=n.useState(!1),Pt=n.useCallback(s=>{s.preventDefault(),ls(!0)},[]),Dt=n.useCallback(s=>{s.preventDefault(),ls(!1)},[]),Mt=n.useCallback(s=>{s.preventDefault(),ls(!1);const r=s.dataTransfer.files;r.length>0&&te(Array.from(r))},[te]),O=n.useCallback(s=>{const r=Ns.current?.getBoundingClientRect().width??(typeof window<"u"?window.innerWidth:void 0),i=r?Math.max(re,r-xs-fr-xr):re;return Math.max(re,Math.min(Math.round(s),i))},[]),cs=n.useCallback(s=>{const r=s.clientX-Cs.current;ce(O(ws.current-r))},[O]),ds=n.useCallback(()=>{ks(!1),document.body.style.cursor="",document.body.style.userSelect=""},[]);n.useEffect(()=>{if(Pe)return document.addEventListener("mousemove",cs),document.addEventListener("mouseup",ds),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",cs),document.removeEventListener("mouseup",ds),document.body.style.cursor="",document.body.style.userSelect=""}},[ds,cs,Pe]);const Ot=n.useCallback(s=>{s.preventDefault(),Cs.current=s.clientX,ws.current=Xe,ks(!0)},[Xe]);n.useEffect(()=>{!M||Pe||ce(s=>O(s))},[O,M,Pe]),n.useEffect(()=>{if(!M)return;const s=()=>{ce(r=>O(r))};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[O,M]);const Lt=n.useCallback(()=>{ce(s=>O(s)),ys(!0),requestAnimationFrame(()=>{Ae.current?.setTab("review")})},[O]),Bt=n.useCallback(s=>{P(s.target.value);const r=s.target;r.style.height="auto";const i=r.scrollHeight;r.style.height=`${Math.max(60,Math.min(i,300))}px`},[]),Ys=ge&&y?e.jsx(gn,{projectId:t?.projectId??"",workspaceId:y,branchName:he,targetBranch:be,commitMessage:Ps,changes:gt,gitStatus:E,isGitStatusLoading:xt,canRunGitOperations:pe,onOpenChanges:Lt,onRefreshCommitMessage:Os,onConflict:ke,className:"mb-1.5"}):null;return t?e.jsxs("div",{className:"flex-1 flex flex-col h-full bg-background relative overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-3 flex items-center justify-between border-b border-border/60 bg-background z-20 flex-shrink-0",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1 mr-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${t.projectColor.replace("text-","bg-")}`}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.projectName}),t.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground shrink-0",children:t.projectRepoDeletedAt?o("源码已删除"):o("已删除")}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"/"}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate",children:t.branch})]}),e.jsx(hn,{taskId:t.id,title:t.title,readOnly:m})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[e.jsx(hr,{status:t.status,onChangeStatus:!m&&S?s=>S(t.id,s):void 0}),e.jsx(Xn,{value:t.priority,onChange:!m&&R?s=>R(t.id,s):void 0}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:kt,disabled:!C||m,className:"w-8 h-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:o("Open in IDE"),children:e.jsx(ir,{size:16})}),(d||N||De)&&!m&&e.jsxs("div",{className:"relative",ref:$e,children:[e.jsx("button",{onClick:()=>H(s=>!s),className:"w-8 h-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:o("More actions"),children:e.jsx(bn,{size:16})}),Ge&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 w-44 bg-background rounded-lg border border-border shadow-popover z-50 py-1",children:[N&&!t.parentTaskId&&e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground/80 hover:bg-muted/50",onClick:()=>{H(!1),N(t.id)},children:[e.jsx(fs,{size:15}),e.jsx("span",{children:o("Create subtask")})]}),De&&e.jsxs("button",{onClick:()=>{ae(!0),H(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground/80 hover:bg-muted/50 transition-colors",children:[e.jsx(fs,{size:15}),e.jsx("span",{children:o("创建 TeamRun")})]}),e.jsxs("button",{onClick:()=>{Ve(!0),H(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground/80 hover:bg-muted/50 transition-colors",children:[e.jsx(Zt,{size:15}),e.jsx("span",{children:o("重新开始")})]}),d&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-1 border-t border-border/60"}),e.jsxs("button",{onClick:()=>{G(!0),H(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive-ink hover:bg-destructive/10 transition-colors",children:[e.jsx(lr,{size:15}),e.jsx("span",{children:o("删除任务")})]})]})]})]})]})]})]}),!me&&e.jsx(vn,{recovery:ve,onRecover:s=>{Q(s.sourceWorkspaceId),ke(s)}}),pe&&y&&E&&e.jsx(ur,{workspaceId:y,gitStatus:E,onResolve:()=>ke()}),e.jsxs("div",{ref:Ns,className:"flex-1 flex overflow-hidden",children:[e.jsx("div",{className:"flex min-w-0 flex-1 flex-col bg-background relative",children:me&&u?A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-border px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:o("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:A})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(jn,{session:b,providers:ee,usage:Hs,providerIdFallback:pt?.providerId,agentTypeFallback:b?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(oe,{type:"button",size:"sm",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-border/70 bg-background/60 px-2 text-xs font-medium text-muted-foreground hover:border-muted-foreground/40 hover:bg-muted hover:text-foreground",onClick:wt,children:[e.jsx(en,{size:13}),e.jsx("span",{children:o("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:_,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pt-6 pb-4",children:e.jsxs("div",{ref:bs,className:"w-full max-w-4xl mx-auto",children:[!u&&t&&e.jsx(st,{taskId:t.id}),_s?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:o("Loading logs...")})]}):Ce.length===0&&!h?e.jsx("div",{className:"text-muted-foreground text-center py-8",children:o(fe?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(nt,{children:e.jsx(tt,{logs:Ce,sessionId:L,downloadSessionId:L,isOutputActive:Ks,lastExitAt:qs,onUserToggleDetails:js,workingDir:C,scrollElementRef:_,onOpenWorkspaceFile:Ye,onOpenPreviewUrl:Ts,onOpenVisualization:As})})]})}),!vs&&e.jsxs("button",{onClick:()=>We(),className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-muted-foreground hover:bg-background hover:text-foreground transition-all","aria-label":o("Scroll to bottom"),children:[e.jsx(et,{size:14}),e.jsx("span",{children:o("回到底部")})]})]}),Fe.length>0&&e.jsx("div",{className:"px-6 pt-2 pb-1 bg-background flex-shrink-0 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(rt,{todos:Fe})})})]}):e.jsx(yn,{teamRun:u,messages:dt??u.messages??[],readOnly:m,readOnlyMessage:ts,onSendMessage:Nt,onViewInvocationSession:Fs,changeSummaryBar:Ys,centered:!0,workingDir:C,onOpenWorkspaceFile:Ye,onOpenPreviewUrl:es,onOpenVisualization:ss}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:_,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pt-6 pb-4",children:e.jsxs("div",{ref:bs,className:"w-full min-w-0 max-w-4xl mx-auto",children:[!u&&t&&e.jsx(st,{taskId:t.id}),(Rs||Y?.body)&&e.jsx("div",{className:"mb-4 pb-4 border-b border-border/60 min-w-0",children:Rs?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:o("Loading...")}):Y?.body?e.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed prose prose-sm max-w-none break-words overflow-hidden",children:e.jsx(An,{urlTransform:pr,components:En,children:Y.body})}):null}),!m&&e.jsx(kn,{state:Is,setupProgress:de,sessionStarted:!!g?.startedAt,onRetry:J&&l?.status==="failed"?as:void 0},t.id),ct?(!Je||m)&&e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:o("Loading...")})]}):J?_s?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:o("Loading logs...")})]}):Ce.length===0&&!h?e.jsx("div",{className:"text-muted-foreground text-center py-8",children:o(fe?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(nt,{children:e.jsx(tt,{logs:Ce,sessionId:L,downloadSessionId:L,isOutputActive:Ks,lastExitAt:qs,onUserToggleDetails:js,workingDir:C,scrollElementRef:_,onOpenWorkspaceFile:Ye,onOpenPreviewUrl:Ts,onOpenVisualization:As})}):!Je||l?.status==="failed"||de?.status==="failed"||m?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(!Je||m)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-14 h-14 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-5",children:e.jsx(ps,{size:24,className:"text-muted-foreground/70 ml-0.5"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-1.5",children:o(m?"项目为只读历史":"尚未启动 Agent")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-xs",children:m?ts:o("选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。")})]}),!m&&(!l||l.status==="failed")&&e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[e.jsxs(oe,{onClick:as,disabled:!!(l&&l.status!=="failed"),children:[e.jsx(ps,{size:16,className:"mr-1.5"}),l?.status==="failed"?o("重试启动 Agent"):o("启动 Agent")]}),De&&e.jsxs(oe,{variant:"outline",onClick:()=>ae(!0),children:[e.jsx(fs,{size:16,className:"mr-1.5"}),o("创建 TeamRun")]})]})]}):null]})}),!vs&&e.jsxs("button",{onClick:()=>We(),className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-muted-foreground hover:bg-background hover:text-foreground transition-all","aria-label":o("Scroll to bottom"),children:[e.jsx(et,{size:14}),e.jsx("span",{children:o("回到底部")})]})]}),Fe.length>0&&e.jsx("div",{className:"px-6 pt-2 pb-1 bg-background flex-shrink-0 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(rt,{todos:Fe})})}),m?e.jsx("div",{className:"p-6 pt-3 bg-background flex-shrink-0 w-full z-10 pb-6 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx("div",{className:"bg-muted/50 rounded-xl border border-border px-4 py-3 text-sm text-muted-foreground",children:ts})})}):ft?e.jsx("div",{className:"p-6 pt-3 bg-background flex-shrink-0 w-full z-10 pb-6 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between bg-muted/50 rounded-xl border border-border px-4 py-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:o("代码已合并,以上为历史沟通记录")}),e.jsxs(oe,{size:"sm",onClick:as,children:[e.jsx(ps,{size:14,className:"mr-1.5"}),o("启动新 Agent")]})]})})}):e.jsxs("div",{className:"p-6 pt-2 bg-background flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:Pt,onDragLeave:Dt,onDrop:Mt,children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[Ys,h?e.jsx(On,{sessionId:h}):null,e.jsxs("div",{ref:Qe,className:`relative bg-background rounded-xl border hover:border-ring/40 focus-within:border-ring/60 transition-colors duration-200 ${Xs?"border-foreground/40 bg-foreground/[0.02]":"border-border"}`,children:[e.jsx(Kn,{files:St,onRemove:Rt}),e.jsx("textarea",{ref:le,value:k,onChange:Bt,onPaste:Wt,onKeyDown:s=>{V.handleKeyDown(s)||q.handleKeyDown(s)||s.key==="Enter"&&!s.shiftKey&&!s.repeat&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),$s())},rows:1,placeholder:o(Xs?"Drop files here...":J&&!fe?"Continue conversation...":"Message Agent..."),className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-sm text-foreground placeholder-muted-foreground/70 leading-relaxed",style:{minHeight:"60px",maxHeight:"300px"}}),e.jsx("input",{ref:hs,type:"file",multiple:!0,className:"hidden",onChange:Et}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("button",{onClick:()=>hs.current?.click(),className:"p-2 text-muted-foreground hover:text-muted-foreground hover:bg-muted rounded-lg transition-colors",title:o("Upload file"),children:e.jsx(cr,{size:18})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[g&&ee&&e.jsx(Ln,{providers:ee,currentProviderId:Oe,agentType:g.agentType,runtimeType:g.runtimeType,onSelect:Ws}),e.jsx(Bn,{usage:Hs}),fe&&!B.isPending&&!k.trim()&&!we?e.jsx("button",{onClick:At,disabled:z.isPending||xe,"aria-label":o("Stop"),title:o("Stop"),className:"p-2 rounded-lg transition-all duration-200 bg-destructive-ink text-white hover:bg-destructive-ink/90 disabled:opacity-50",children:e.jsx(sn,{size:14})}):e.jsx("button",{onClick:$s,"aria-label":o(B.isPending?"发送中...":"Send"),"aria-busy":B.isPending,disabled:!k.trim()&&!we||Ue||B.isPending||z.isPending||xe||!!Le,className:`p-2 rounded-lg transition-all duration-200 ${(k.trim()||we)&&!Ue&&!B.isPending&&!z.isPending&&!xe&&!Le?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-transparent text-muted-foreground cursor-not-allowed"}`,children:B.isPending?e.jsx(tn,{size:18,className:"animate-spin"}):e.jsx(nn,{size:18})})]})]})]})]}),e.jsx(ot,{open:q.query!==null,anchorRef:Qe,commands:q.filteredCommands,selectedIndex:q.selectedIndex,query:q.query??"",hasCatalog:q.allCommands.length>0,onSelect:q.applyCommand}),e.jsx(ot,{open:V.query!==null,anchorRef:Qe,commands:V.filteredSkills,selectedIndex:V.selectedIndex,query:V.query??"",hasCatalog:V.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",onSelect:V.applySkill})]})]})}),M&&e.jsx("div",{className:"w-1 cursor-col-resize hover:bg-border active:bg-ring/40 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",onMouseDown:Ot,role:"separator","aria-orientation":"vertical","aria-label":o("调整工作区宽度")}),e.jsx("div",{className:"flex h-full flex-shrink-0 bg-background",style:{width:M?xs+Xe:xs},children:e.jsx(Cn,{handoff:e.jsx(In,{taskId:t.id,readOnly:m},t.id),subtasks:e.jsx(Nn,{task:t,onSelectTask:f,onCreateSubtask:N},t.id),sessionId:J||void 0,workspaceId:K,workingDir:C,projectId:t.projectId,readOnly:m,repoDeleted:Es,teamRun:u,teamStatus:u?e.jsx(wn,{teamRun:u,workspaces:a,selectedWorkspaceId:K,onSelectWorkspace:Q,onViewInvocationSession:Fs}):void 0,workspaces:a,selectedWorkspaceId:K,onSelectWorkspace:Q,variant:"rail",expanded:M,onExpandedChange:s=>{s&&ce(r=>O(r)),ys(s)},minContentWidth:re,tabRef:Ae,gitAvailable:X,gitProps:pe&&y?{branchName:he,targetBranch:be,commitMessage:Ps,canRunGitOperations:!0,onRefreshCommitMessage:Os,onConflict:ke,onResolveConflicts:()=>ke()}:void 0})})]}),!m&&e.jsx(Sn,{isOpen:Te,onClose:()=>D(!1),taskId:t.id,projectId:t.projectId,taskTitle:Y?.title??t.title,taskDescription:Y?.body??"",taskPrompt:Y?.prompt,projectIsGitRepo:t.isGitRepo,projectWorktreeReady:t.worktreeReady,projectGitReason:t.reason,onStarted:()=>T?.(t.id)}),De&&!m&&e.jsx(dr,{isOpen:Ke,onClose:()=>ae(!1),taskId:t.id}),Ds&&pe&&Ms&&v&&e.jsx(Rn,{open:Ds,onOpenChange:s=>{s||ve.closeDialog()},workspaceId:Ms,conflictOp:v.conflictOp,conflictedFiles:v.conflictedFiles,resolutionContextToken:v.resolutionContextToken,sourceBranch:vt,targetBranch:jt,operation:E?.operation,worktreePath:bt,mergeAborted:v.mergeAborted,mergeStrategy:v.mergeStrategy,sourceWorkspaceId:v.sourceWorkspaceId,targetWorkspaceId:v.targetWorkspaceId,sourceWorktreePath:v.sourceWorktreePath,targetWorktreePath:v.targetWorktreePath,sessions:ht,currentSessionId:me?void 0:J,teamRunId:u?.id}),e.jsx(ar,{isOpen:it,onClose:()=>Ve(!1),onConfirm:yt,title:o("重新开始任务"),description:e.jsx("p",{children:o("将归档当前工作区并自动在新 Worktree 中重新启动 Agent,旧工作区内容保留供参考。")}),confirmText:o("确认重试"),variant:"default",isLoading:lt}),e.jsx(Pn,{isOpen:qe,onClose:()=>G(!1),onConfirm:Ct,taskId:t.id,taskTitle:t.title,workspaces:a,isLoading:I})]}):e.jsx(gr,{})}export{bo as TaskDetail};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,M as n}from"./index-Dh-tgeaL.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./index-Cc3qXMhU.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-CMnu18d1.js";import{_ as i}from"./index-Dh-tgeaL.js";import"./chunk-FMBD7UC4-u6-_M137.js";import"./chunk-ND2GUHAM-DHrIE_8H.js";import"./chunk-55IACEB6-qMTCQ5bX.js";import"./chunk-2J33WTMH-DeCj8QSD.js";import"./index-Cc3qXMhU.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-CMnu18d1.js";import{_ as i}from"./index-Dh-tgeaL.js";import"./chunk-FMBD7UC4-u6-_M137.js";import"./chunk-ND2GUHAM-DHrIE_8H.js";import"./chunk-55IACEB6-qMTCQ5bX.js";import"./chunk-2J33WTMH-DeCj8QSD.js";import"./index-Cc3qXMhU.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|