@cuongtran001/kanna 1.63.0 → 1.63.2

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.
Files changed (204) hide show
  1. package/dist/client/assets/{BoardsPage-DICQ52PG.js → BoardsPage-BJalB-bc.js} +1 -1
  2. package/dist/client/assets/{BoardsRoutePage-CRKmSWH5.js → BoardsRoutePage-BTTjJX-Y.js} +1 -1
  3. package/dist/client/assets/{ChatPage-Co0Etwn3.js → ChatPage-DH8wtQyD.js} +26 -26
  4. package/dist/client/assets/{CronJobRow-DNErcbgF.js → CronJobRow-CPbO_jwU.js} +1 -1
  5. package/dist/client/assets/{CronJobsPage-C43nRU-Z.js → CronJobsPage-Ck3SNgGi.js} +1 -1
  6. package/dist/client/assets/{FilePreviewSheet-TusiyTzv.js → FilePreviewSheet-XEuUtDPn.js} +4 -4
  7. package/dist/client/assets/{FlowSurface-Cm80dvNk.js → FlowSurface-BCbeMTJe.js} +1 -1
  8. package/dist/client/assets/{GenUIBlock-C6x_0n1W.js → GenUIBlock-BJy_dfs-.js} +2 -2
  9. package/dist/client/assets/{KannaSocketProvider-P9V0NjH2.js → KannaSocketProvider-D7Lzlt35.js} +1 -1
  10. package/dist/client/assets/{LocalProjectsPage-Dd1olMl7.js → LocalProjectsPage-9LJkQjhT.js} +1 -1
  11. package/dist/client/assets/{SettingsPage-CBgdSFSe.js → SettingsPage-CKrZ6dGQ.js} +1 -1
  12. package/dist/client/assets/{StackBoardsRoutePage-DsncTCnt.js → StackBoardsRoutePage-t_EaFNG4.js} +1 -1
  13. package/dist/client/assets/{ToolCallMessage-C01I-eCr.js → ToolCallMessage-RbF9XT2B.js} +1 -1
  14. package/dist/client/assets/{VChartSurface-Cb6hwa68.js → VChartSurface-CKuPelsn.js} +1 -1
  15. package/dist/client/assets/{WorkflowsPage-lwtxVhHb.js → WorkflowsPage-B6qUmQA3.js} +1 -1
  16. package/dist/client/assets/{WorkflowsSection-BlybQZfD.js → WorkflowsSection-DxO0S4An.js} +1 -1
  17. package/dist/client/assets/{abnfDiagram-O67JEVCF-B_a9AXMB.js → abnfDiagram-YUKMZFIV-DDFdMTc_.js} +1 -1
  18. package/dist/client/assets/architecture-WOLXFQ4H-C0NxYiG7.js +1 -0
  19. package/dist/client/assets/{architectureDiagram-NJMV4G6O-DWmCLg7_.js → architectureDiagram-47P4ROYG-DCVMl_eo.js} +3 -3
  20. package/dist/client/assets/{blockDiagram-BEXU5L5S-4aomY5mS.js → blockDiagram-E7TT5TSB-Bk5H-yPa.js} +3 -3
  21. package/dist/client/assets/{c4Diagram-YGBWAQC7-D76ydxUf.js → c4Diagram-CRA5TL53-DRb3rwj0.js} +2 -2
  22. package/dist/client/assets/channel-UMoGGbLh.js +1 -0
  23. package/dist/client/assets/{chart-renderer-B64ygyZW.js → chart-renderer-DjYZvNxh.js} +1 -1
  24. package/dist/client/assets/{chatSounds-DNLDbhwt.js → chatSounds-FD2DQzF6.js} +1 -1
  25. package/dist/client/assets/chevron-left-CJ0qv9kF.js +1 -0
  26. package/dist/client/assets/{chunk-6AZGARVD-CnZDr4Cj.js → chunk-24IY7LWP-flnn6SWX.js} +1 -1
  27. package/dist/client/assets/chunk-2BW5OAIV-CAk9x6ti.js +10 -0
  28. package/dist/client/assets/{chunk-5V3GS4D5-BR7kgIgJ.js → chunk-3M4EKCLJ-D-sZGCtO.js} +1 -1
  29. package/dist/client/assets/{chunk-ZIGJFQKS-DNaCAnHq.js → chunk-3YJQHVM4-BD0QjGHE.js} +2 -2
  30. package/dist/client/assets/{chunk-7PRAP22T-DA2a7RLB.js → chunk-4EA7E6EY-C-3QyPC4.js} +1 -1
  31. package/dist/client/assets/{chunk-6K3QC6MW-DGVRzL6v.js → chunk-4S7OKTRW-BpUW13a3.js} +1 -1
  32. package/dist/client/assets/{chunk-ICYGCRZG-D97UeqJs.js → chunk-53FOQ5SW-5lPdGYP4.js} +1 -1
  33. package/dist/client/assets/{chunk-GWA4HPMP-DYjQvLPz.js → chunk-7TKQ45FW-B7U4miWo.js} +1 -1
  34. package/dist/client/assets/{chunk-GTNCS2PH-MNZlXrOu.js → chunk-AW2ZBBNX-C7Z9OZ45.js} +3 -3
  35. package/dist/client/assets/{chunk-747NJXEK-Cur1aosP.js → chunk-BP2KR52E-DAQ1pzDV.js} +1 -1
  36. package/dist/client/assets/{chunk-5DYCD2WN-CdfvSpXJ.js → chunk-DBDB3WZW-BuRZXbw3.js} +1 -1
  37. package/dist/client/assets/{chunk-MBY4JIJT-B13n2mKy.js → chunk-E2ZNV5FY-CWsTozRZ.js} +3 -3
  38. package/dist/client/assets/chunk-EU5HNXII-BwtAKWTK.js +213 -0
  39. package/dist/client/assets/{chunk-2ZTRR5NV-CnDP55cn.js → chunk-F6S3BTY2-DVWKCAHp.js} +1 -1
  40. package/dist/client/assets/chunk-FVRAUYC3-z2KPe-Z4.js +2 -0
  41. package/dist/client/assets/{chunk-742MDFTN-Caihy1xI.js → chunk-HJ2JQQFS-DHgNY4oe.js} +1 -1
  42. package/dist/client/assets/{chunk-NETBCI7D-BzvWYIqO.js → chunk-HTAEGDNF-Bi7Wtyof.js} +1 -1
  43. package/dist/client/assets/{chunk-IH6LHLGP-CvXe34hB.js → chunk-KPI5JJXK-B2ld5-w4.js} +1 -1
  44. package/dist/client/assets/{chunk-WEXAMYUT-CKktArnq.js → chunk-KQW6MTUR-Bg7sW3yW.js} +1 -1
  45. package/dist/client/assets/chunk-NGNAAXSQ-DqoPQk1a.js +136 -0
  46. package/dist/client/assets/{chunk-UA2S7LBM-Bf77iZxm.js → chunk-NTY3LDVX-Bvl8xsuC.js} +1 -1
  47. package/dist/client/assets/{chunk-OB3PAWPO-COxrdEAH.js → chunk-OB3PAWPO-mARpRU1A.js} +1 -1
  48. package/dist/client/assets/{chunk-UY3FDG6J-DqSM_0FB.js → chunk-OD3NTWWA-Dz9nCUGX.js} +1 -1
  49. package/dist/client/assets/{chunk-3Z5EZCMW-Yx4Q5AcN.js → chunk-QNH66VMT-Cb9xxTwQ.js} +1 -1
  50. package/dist/client/assets/{chunk-GNY47TPC-lZyp2s3D.js → chunk-SVEVUXB4-Csc8k5gP.js} +2 -2
  51. package/dist/client/assets/{chunk-6EIED4P4-Bp8dpTvX.js → chunk-TPMEZKFX-DIPHIqGb.js} +1 -1
  52. package/dist/client/assets/{chunk-6TQVIW2G-DgBX-Pv0.js → chunk-VPELOWWC-DXayM28-.js} +1 -1
  53. package/dist/client/assets/chunk-VPRB5NB3-DdvbFm4G.js +129 -0
  54. package/dist/client/assets/{chunk-I5DQTOEV-B98XA8VK.js → chunk-VTWWFHGB-SZnJiyWY.js} +1 -1
  55. package/dist/client/assets/{chunk-KI3K4JFJ-D5XCPRZv.js → chunk-VZTHESGH-eHyXmK8W.js} +1 -1
  56. package/dist/client/assets/{chunk-7INBJB4K-aVCoMKLb.js → chunk-XC4XBNZT-C7Gta1hk.js} +10 -10
  57. package/dist/client/assets/{chunk-XHIXRSVI-BSN7JlfK.js → chunk-YK26KJH5-DVy3MGMd.js} +1 -1
  58. package/dist/client/assets/{chunk-6AEJRKK7-DO1dhGbP.js → chunk-Z6ETV63D-CJv8Kmac.js} +1 -1
  59. package/dist/client/assets/{chunk-OUJLGHUK-DA95-S9B.js → chunk-ZO67DCNQ-BAOMIkLF.js} +1 -1
  60. package/dist/client/assets/{classDiagram-v2-NBCMYWYE-C0XhFBKC.js → classDiagram-v2-K4WV4PDN--EIM3jTT.js} +3 -3
  61. package/dist/client/assets/{clipboard.adapter-CpYfdxOc.js → clipboard.adapter-GN9nnYak.js} +1 -1
  62. package/dist/client/assets/{columnStyle-BS-pfo90.js → columnStyle-DjA7hA9k.js} +1 -1
  63. package/dist/client/assets/{createScopedStore-BFPsowk4.js → createScopedStore-BoLB9Rhc.js} +1 -1
  64. package/dist/client/assets/cynefin-EF2NZ3EQ-DVkJeZ8i.js +1 -0
  65. package/dist/client/assets/{cynefinDiagram-VND7K2PF-DPncXCvf.js → cynefinDiagram-3GCD6N5R-7ZbxUax_.js} +1 -1
  66. package/dist/client/assets/{dagre-6A5THRUB-Co7Xp01k.js → dagre-W4DXFKR2--Fgx23t5.js} +1 -1
  67. package/dist/client/assets/{diagram-22UHCM2B-DbV2Joxk.js → diagram-2UJZ2QOL-C_PHVXvF.js} +9 -9
  68. package/dist/client/assets/{diagram-3UASUU5V-BWCja6Yr.js → diagram-OVF4WLC6-jlwkZ7-M.js} +4 -4
  69. package/dist/client/assets/{diagram-CDSNMT55-Cw5KqwEG.js → diagram-PFPMY2P6-RHK5hLcM.js} +3 -3
  70. package/dist/client/assets/{diagram-MLGK6HIB-CpMA1Coa.js → diagram-UMYRVEAY-CZRK2Kvd.js} +1 -1
  71. package/dist/client/assets/{diagram-MPIPVDR6-d_hbFiNV.js → diagram-YEKJPTXX-CgUlPJbo.js} +2 -2
  72. package/dist/client/assets/diagram-ZIFT7M5P-DmBLxbge.js +3 -0
  73. package/dist/client/assets/{dist-DLd14rxw.js → dist-BdNQvasR.js} +1 -1
  74. package/dist/client/assets/{dist-DoC0Fm3K.js → dist-CimtOoGK.js} +1 -1
  75. package/dist/client/assets/{ebnfDiagram-ZINNZB2B-DfYkfziT.js → ebnfDiagram-VR2GEFS7-DbuiXobi.js} +1 -1
  76. package/dist/client/assets/{editor-icons-CttcWuni.js → editor-icons-CONDQZof.js} +1 -1
  77. package/dist/client/assets/elk-IJKZMXRS-u6wcmDiA.js +27 -0
  78. package/dist/client/assets/{ellipsis-BDHGURxK.js → ellipsis-Cd7sO0LO.js} +1 -1
  79. package/dist/client/assets/{erDiagram-OPXOYQCR-DgQKCKSy.js → erDiagram-O2IAPWRE-28xfq-CO.js} +2 -2
  80. package/dist/client/assets/eventmodeling-K75KTNOO-BWBlZ5cR.js +1 -0
  81. package/dist/client/assets/{flow-kinds-9RVGvvkd.js → flow-kinds-CW2TU_83.js} +1 -1
  82. package/dist/client/assets/flowDiagram-OXPTDLAJ-BohhOA9-.js +1 -0
  83. package/dist/client/assets/{folder-RkcfzeEB.js → folder-C7sXCaHj.js} +1 -1
  84. package/dist/client/assets/ganttDiagram-R7TSEDQI-BhWFgPkz.js +292 -0
  85. package/dist/client/assets/{genui-CR4wkCwK.js → genui-EzBIAYFE.js} +1 -1
  86. package/dist/client/assets/gitGraph-VSP46ZUC-1499lQAI.js +1 -0
  87. package/dist/client/assets/gitGraphDiagram-XJZIOB7I-BLqGp4ws.js +106 -0
  88. package/dist/client/assets/{globe-ZAraYMi7.js → globe-xmRpmpma.js} +1 -1
  89. package/dist/client/assets/{host-CSpC459v.js → host-DCaA9W-Z.js} +1 -1
  90. package/dist/client/assets/index-CDqjh7nt.js +26 -0
  91. package/dist/client/assets/{info-C7LIj64h.js → info-D4MMvZFe.js} +1 -1
  92. package/dist/client/assets/info-OHQRW6UA-BDFQOo4H.js +1 -0
  93. package/dist/client/assets/{infoDiagram-VRGFBTTK-BHpK5iC8.js → infoDiagram-5W2HQ5XZ-DMKTA8zc.js} +1 -1
  94. package/dist/client/assets/{input-95Sz2mQF.js → input-C4fvDiQ4.js} +1 -1
  95. package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-C5SBM_wu.js → ishikawaDiagram-K3B6WC7H-CwjDouqD.js} +2 -2
  96. package/dist/client/assets/{journeyDiagram-ZHPQQLJL-QYT1qcqk.js → journeyDiagram-COXZFDF6-dYdj66tB.js} +3 -3
  97. package/dist/client/assets/{kanban-definition-PNTS6WVX-DR-xBtFN.js → kanban-definition-P3RFRI5V-DqYhFf23.js} +6 -6
  98. package/dist/client/assets/{lexicalToReact-BDa_5qRY.js → lexicalToReact-sPUyOWk6.js} +3 -3
  99. package/dist/client/assets/{line-Dsdv7KRC.js → line-Bu0kN2MJ.js} +1 -1
  100. package/dist/client/assets/{log-DTKPehdH.js → log-aTaDVF_e.js} +1 -1
  101. package/dist/client/assets/mermaid-parser.core-sBwmEtVp.js +4 -0
  102. package/dist/client/assets/mermaid.core-gRh-26W4.js +11 -0
  103. package/dist/client/assets/{mindmap-definition-NLK3R4M7-jUo0VKxK.js → mindmap-definition-LZFPQGKD-B6yVfjHJ.js} +3 -3
  104. package/dist/client/assets/{monitor-BCfDUj_v.js → monitor-_CRKcV1h.js} +1 -1
  105. package/dist/client/assets/packet-JDAUHWVQ-DJ9K2MA4.js +1 -0
  106. package/dist/client/assets/{pegDiagram-GJSIUBJH-MGiSqOj9.js → pegDiagram-BGZESJAR-ClyHpAxi.js} +1 -1
  107. package/dist/client/assets/{pencil-CblyZXwW.js → pencil-fNBeUUCf.js} +1 -1
  108. package/dist/client/assets/{pendingActionsStore-9qaSyloJ.js → pendingActionsStore-COTh4Ztq.js} +1 -1
  109. package/dist/client/assets/pie-XZMESJXO-CQIQasY-.js +1 -0
  110. package/dist/client/assets/pieDiagram-CAPJLFHJ-WFVbdtcQ.js +39 -0
  111. package/dist/client/assets/{play-Cbu0CZdB.js → play-BAmkJfn6.js} +1 -1
  112. package/dist/client/assets/{plus-CZJUl6yo.js → plus-c75CkNEO.js} +1 -1
  113. package/dist/client/assets/{popover-GuUsP1oe.js → popover-CHM4skzh.js} +1 -1
  114. package/dist/client/assets/preload-helper-DjzSQ1t3.js +1 -0
  115. package/dist/client/assets/{pushClient-D9iQDbZI.js → pushClient-BJH_ITRB.js} +1 -1
  116. package/dist/client/assets/{quadrantDiagram-O4NWA36T-BE5-2xv9.js → quadrantDiagram-GDMTTRAM-r_q6attF.js} +3 -3
  117. package/dist/client/assets/radar-ABXABTNO-ByfpCXh9.js +1 -0
  118. package/dist/client/assets/railroad-I3PHUGI6-CTUn9HhI.js +1 -0
  119. package/dist/client/assets/railroad-abnf-LNEFI6M7-Ct-b-y0F.js +1 -0
  120. package/dist/client/assets/railroad-ebnf-DWYD2UWJ-BZMYMWOe.js +1 -0
  121. package/dist/client/assets/railroad-peg-JR7BVNR7-Dj23PxYc.js +1 -0
  122. package/dist/client/assets/{railroadDiagram-XR7U4H2S-DON3aKdK.js → railroadDiagram-SM67HX2B-AOJ6ETrw.js} +1 -1
  123. package/dist/client/assets/{react-7j8fMtgQ.js → react-BEZnZ2sS.js} +1 -1
  124. package/dist/client/assets/{requirementDiagram-PLB6GJNP-DtoMdLUF.js → requirementDiagram-X7JNWC4A-Bh7hodP7.js} +4 -4
  125. package/dist/client/assets/runDetached-DqQ3k2ji.js +1 -0
  126. package/dist/client/assets/sankeyDiagram-UM26HJRW-DYEynJ9v.js +40 -0
  127. package/dist/client/assets/{segmented-control-Cy9rtD95.js → segmented-control-DNOwRupT.js} +1 -1
  128. package/dist/client/assets/{select-DqZnZy8K.js → select-dLHiAls6.js} +1 -1
  129. package/dist/client/assets/sequenceDiagram-ZO4K6R2Y-DvzfWWQD.js +169 -0
  130. package/dist/client/assets/{settings-header-button-CiwE9Cfg.js → settings-header-button-CGKCzFyk.js} +1 -1
  131. package/dist/client/assets/{sidebarPendingActions-DcVAcgqh.js → sidebarPendingActions-Dyp80Lv_.js} +1 -1
  132. package/dist/client/assets/{square-pen-BMoWvdPc.js → square-pen-B1IxmScM.js} +1 -1
  133. package/dist/client/assets/{state-mark-DiYY9y5l.js → state-mark-BhTZfcYe.js} +1 -1
  134. package/dist/client/assets/{stateDiagram-v2-GCMORJYK-B9dfuNUZ.js → stateDiagram-v2-TBUQTH76-CRVWjkEX.js} +2 -2
  135. package/dist/client/assets/{status-pill-CYqhEAXJ.js → status-pill-CwhJhaMy.js} +1 -1
  136. package/dist/client/assets/{swimlanes-2SLR337P-Doyn0_pS.js → swimlanes-N4OXWK64-CBibkObe.js} +1 -1
  137. package/dist/client/assets/swimlanesDiagram-K3J5GTZL-Cr216W7P.js +8 -0
  138. package/dist/client/assets/{terminal-CzIIZKjC.js → terminal-Bnj7qFGw.js} +1 -1
  139. package/dist/client/assets/{timeline-definition-EJHVYXUP-CqHWbhTY.js → timeline-definition-YOQAKGHF-71bSSqCF.js} +6 -6
  140. package/dist/client/assets/{timer.adapter-DDgBJONP.js → timer.adapter-DHt2zwsL.js} +1 -1
  141. package/dist/client/assets/{tools-BY_ZRXAf.js → tools-3gJcj3hK.js} +1 -1
  142. package/dist/client/assets/treeView-D4JQ5SDB-DcX7Bx0H.js +1 -0
  143. package/dist/client/assets/treemap-SAJKECNS-BcCHmcAX.js +1 -0
  144. package/dist/client/assets/{triangle-alert-vEEZ59Sw.js → triangle-alert-CWrc0CIO.js} +1 -1
  145. package/dist/client/assets/useAppGlobalState-DKOGrO5l.js +1 -0
  146. package/dist/client/assets/useKannaState-D7R_-dM6.js +5 -0
  147. package/dist/client/assets/{useTheme-BXQFYwx9.js → useTheme-B57LIKyx.js} +1 -1
  148. package/dist/client/assets/usecaseDiagram-VIAY4XPW-BTgSYvlK.js +328 -0
  149. package/dist/client/assets/{vennDiagram-UO4OBE2U-CQJWleWu.js → vennDiagram-BLWOH2XV-BiaO_Ibi.js} +3 -3
  150. package/dist/client/assets/wardley-7MLQ67FV-DOahSwbZ.js +1 -0
  151. package/dist/client/assets/{wardleyDiagram-VNRHLVJA-9oHTqfIO.js → wardleyDiagram-YMQ3BMBF-DGeNeGLQ.js} +4 -4
  152. package/dist/client/assets/xychartDiagram-TAQBALBS-CpByZdBF.js +7 -0
  153. package/dist/client/index.html +35 -35
  154. package/package.json +4 -4
  155. package/src/server/claude-message-normalizer.test.ts +40 -0
  156. package/src/server/claude-message-normalizer.ts +12 -0
  157. package/src/server/claude-pty/jsonl-to-event.test.ts +22 -0
  158. package/src/server/http-api-routes.ts +4 -4
  159. package/src/server/session-share/shareable-entries.ts +1 -1
  160. package/src/server/uploads.adapter.ts +69 -41
  161. package/src/server/uploads.test.ts +79 -1
  162. package/src/shared/claude-api-error-classification.ts +22 -0
  163. package/src/shared/transcript-types.ts +2 -1
  164. package/src/shared/types.ts +4 -0
  165. package/dist/client/assets/architecture-7GRP2DOG-BBwRXFv3.js +0 -1
  166. package/dist/client/assets/channel-uKchqF_Z.js +0 -1
  167. package/dist/client/assets/chevron-left-CfG-TQKa.js +0 -1
  168. package/dist/client/assets/chunk-3FUC2YCW-FajGLwnZ.js +0 -2
  169. package/dist/client/assets/chunk-7M6MHVWA-Cjqu4r1U.js +0 -213
  170. package/dist/client/assets/chunk-FOHPRMQF-DzxwRta7.js +0 -161
  171. package/dist/client/assets/chunk-O7XYJQB3-BuJf_igd.js +0 -128
  172. package/dist/client/assets/chunk-Z7XXMR3K-c-eB5Ea8.js +0 -10
  173. package/dist/client/assets/cynefin-OW5HDTMX-CF3N9j1_.js +0 -1
  174. package/dist/client/assets/diagram-ATOU4E4O-DGfvrVZh.js +0 -3
  175. package/dist/client/assets/elk-276RUBZZ-C752MQR0.js +0 -27
  176. package/dist/client/assets/eventmodeling-NTZA5JFV-CDy1bN6j.js +0 -1
  177. package/dist/client/assets/flowDiagram-KWPJA3E3-QP3skdqL.js +0 -1
  178. package/dist/client/assets/ganttDiagram-FUAMR5RP-BrUtQZf-.js +0 -292
  179. package/dist/client/assets/gitGraph-4MIJSDKK-B-rpDYbz.js +0 -1
  180. package/dist/client/assets/gitGraphDiagram-X574FWY7-C498HPzm.js +0 -106
  181. package/dist/client/assets/index-O6qfmG2f.js +0 -26
  182. package/dist/client/assets/info-A6RAGUB7-BlutK7BT.js +0 -1
  183. package/dist/client/assets/mermaid-parser.core-DPWCsFq8.js +0 -4
  184. package/dist/client/assets/mermaid.core-jDbZZtuE.js +0 -11
  185. package/dist/client/assets/packet-AYTQ26CC-DvbY8dI6.js +0 -1
  186. package/dist/client/assets/pie-WAS4IAKB-DWSm9SSD.js +0 -1
  187. package/dist/client/assets/pieDiagram-5QR66LMP-Cu_2J_zG.js +0 -39
  188. package/dist/client/assets/preload-helper-BZ1Pz5am.js +0 -1
  189. package/dist/client/assets/radar-RG4KPBEZ-BfNQUEQy.js +0 -1
  190. package/dist/client/assets/railroad-74A4TZTK-BaQ6U6eJ.js +0 -1
  191. package/dist/client/assets/railroad-abnf-HS5TGJTU-BJ3KZw7J.js +0 -1
  192. package/dist/client/assets/railroad-ebnf-LZEXJU2U-DA0sEq7w.js +0 -1
  193. package/dist/client/assets/railroad-peg-WCYAUIDC-DCmlICzO.js +0 -1
  194. package/dist/client/assets/runDetached-D_x7Eiol.js +0 -1
  195. package/dist/client/assets/sankeyDiagram-IPEJSGJF-B4Aq_m_f.js +0 -40
  196. package/dist/client/assets/sequenceDiagram-PO4LG4MO-nCEd15gL.js +0 -169
  197. package/dist/client/assets/swimlanesDiagram-TC7HE7FX-BihL4laV.js +0 -8
  198. package/dist/client/assets/treeView-Q6P3EWNA-BvHOzbu9.js +0 -1
  199. package/dist/client/assets/treemap-WGGIJYW6-oety7paS.js +0 -1
  200. package/dist/client/assets/useAppGlobalState-CAqGn8Ly.js +0 -1
  201. package/dist/client/assets/useKannaState-BUM3PsvR.js +0 -5
  202. package/dist/client/assets/usecaseDiagram-POWQR4AR-CHJp21mw.js +0 -328
  203. package/dist/client/assets/wardley-WFR3VGLG-BdwDpX_I.js +0 -1
  204. package/dist/client/assets/xychartDiagram-PMCCYNJV-CscFdzOK.js +0 -7
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{t as n}from"./jsx-runtime-BdxMnOeJ.js";import{f as r}from"./log-DTKPehdH.js";import{a as i,c as a,f as o,n as s,r as c,s as l,t as u}from"./pendingActionsStore-9qaSyloJ.js";import{a as d,c as f,n as p,o as m,r as h,s as g}from"./KannaSocketProvider-P9V0NjH2.js";import{f as _,l as v,p as y}from"./pushClient-D9iQDbZI.js";import{t as b}from"./pencil-CblyZXwW.js";import{t as x}from"./play-Cbu0CZdB.js";import{a as S,g as C,i as w,n as T,o as E,r as D,u as O}from"./timer.adapter-DDgBJONP.js";import{t as k}from"./segmented-control-Cy9rtD95.js";import{t as A}from"./createScopedStore-BFPsowk4.js";import{t as j}from"./input-95Sz2mQF.js";import{r as M,t as N}from"./formatDuration-BbWTR_M_.js";var P={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};P.node;var ee=o(P),F=e(t(),1);function I(e){for(let t of e.recentRuns)if(t.status!==`skipped`)return t.status===`running`;return!1}var L={"@hourly":`0 * * * *`,"@daily":`0 0 * * *`,"@weekly":`0 0 * * 0`,"@monthly":`0 0 1 * *`},R=Object.keys(L),z=[{name:`minute`,min:0,max:59},{name:`hour`,min:0,max:23},{name:`day-of-month`,min:1,max:31},{name:`month`,min:1,max:12,names:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12}},{name:`day-of-week`,min:0,max:7,names:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},normalize:e=>e===7?0:e}],B={name:`second`,min:0,max:59},V={s:1e3,m:6e4,h:36e5};function H(e){let t=e.trim();if(t===``)return{ok:!1,part:`schedule`,message:"missing schedule — expected 5- or 6-field cron, @shortcut, or `every <N>s|m|h`"};let n=t.split(/\s+/);return n[0].startsWith(`@`)?U(n):n[0].toLowerCase()===`every`?ne(n):W(n)}function U(e){let t=e[0].toLowerCase(),n=L[t];if(n===void 0){let n=te(t);return{ok:!1,part:`schedule`,message:`unknown shortcut "${e[0]}" — valid shortcuts are ${R.join(`, `)}`,correctedSchedule:n??void 0}}if(e.length>1)return{ok:!1,part:`schedule`,message:`${t} takes no extra tokens (got "${e.slice(1).join(` `)}")`,correctedSchedule:t};let r=W(n.split(` `));if(!r.ok)throw Error(`builtin shortcut ${t} failed to parse: ${r.message}`);return r}function te(e){let t=null,n=4;for(let r of R){let i=oe(e,r,n);i<n&&(t=r,n=i)}return t}function ne(e){if(e.length===1)return{ok:!1,part:`schedule`,message:"missing interval after `every` — expected e.g. `every 30s`, `every 5m`, or `every 2h`"};let t=e.length===3?e[1]+e[2]:e[1];if(e.length>3||e.length===3&&!re(t))return{ok:!1,part:`schedule`,message:`expected exactly \`every <N>s|m|h\`, got "${e.join(` `)}"`};let n=/^(\d+)(s|m|h)$/.exec(t);if(n){let r=Number.parseInt(n[1],10);if(r<1)return{ok:!1,part:`schedule`,message:`interval must be at least 1`,correctedSchedule:`every 1${n[2]}`};let i=V[n[2]],a=e.length===3?`every ${t}`:void 0;return a===void 0?{ok:!0,schedule:{type:`interval`,ms:r*i}}:{ok:!1,part:`schedule`,message:`interval "${e.slice(1).join(` `)}" has a stray space`,correctedSchedule:a}}let r=/^(\d+)\s*(min|mins|minute|minutes|m|hr|hrs|hour|hours|h|s|sec|secs|second|seconds|d|day|days)$/i.exec(t);if(r){let e=r[1],t=r[2].toLowerCase();if(t.startsWith(`d`))return{ok:!1,part:`schedule`,message:`use @daily instead of "every ${e}${t}"`,correctedSchedule:`@daily`};let n=t[0];return{ok:!1,part:`schedule`,message:`interval unit "${t}" is not valid — use \`s\`, \`m\`, or \`h\``,correctedSchedule:`every ${e}${n}`}}return{ok:!1,part:`schedule`,message:`interval "${t}" is not valid — expected e.g. \`every 30s\`, \`every 5m\`, or \`every 2h\``}}function re(e){return/^\d+\s*[a-z]+$/i.test(e)}function W(e){let t=e.length===6;if(e.length!==5&&!t){let t=e.length===1&&/^\d+(s|m|h)$/.test(e[0]);return{ok:!1,part:`schedule`,message:`cron schedule has ${e.length} field${e.length===1?``:`s`}, expected 5 (minute hour day-of-month month day-of-week) or 6 with a leading second`,correctedSchedule:t?`every ${e[0]}`:ie(e)}}let n=t?[B,...z]:z,r=[];for(let t=0;t<n.length;t++){let i=ae(n[t],e[t]);if(!i.ok)return{ok:!1,part:`schedule_field`,message:i.message};r.push(i.field)}let i=+!!t;return{ok:!0,schedule:{type:`cron`,expression:e.join(` `),...t?{second:r[0]}:{},minute:r[i],hour:r[i+1],dom:r[i+2],month:r[i+3],dow:r[i+4]}}}function ie(e){if(e.length>=2&&e.length<=4){let t=[...e,...Array(5-e.length).fill(`*`)];return W(t).ok?t.join(` `):void 0}if(e.length===7){let t=e.slice(0,6);return W(t).ok?t.join(` `):void 0}}function ae(e,t){if(t===`*`)return{ok:!0,field:{kind:`any`}};let n=new Set;for(let r of t.split(`,`)){if(r===``)return{ok:!1,message:`${e.name} field "${t}" has an empty list entry`};let i=/^(\*|[A-Za-z]+|\d+)(?:-([A-Za-z]+|\d+))?(?:\/(\d+))?$/.exec(r);if(!i)return{ok:!1,message:`${e.name} field "${r}" is not valid — expected \`*\`, \`N\`, \`N-M\`, \`*/S\`, or \`N-M/S\``};let[,a,o,s]=i,c,l;if(a===`*`){if(o!==void 0)return{ok:!1,message:`${e.name} field "${r}" is not valid — \`*\` cannot be a range start`};c=e.min,l=e.max}else{let t=G(e,a);if(t===null)return{ok:!1,message:K(e,a)};if(c=t,o!==void 0){let t=G(e,o);if(t===null)return{ok:!1,message:K(e,o)};l=t}else l=c}if(c<e.min||c>e.max||l<e.min||l>e.max)return{ok:!1,message:`${e.name} field "${r}" is out of range ${e.min}-${e.max}`};if(l<c)return{ok:!1,message:`${e.name} field "${r}" has a range end below its start`};let u=1;if(s!==void 0){if(u=Number.parseInt(s,10),u<1)return{ok:!1,message:`${e.name} field "${r}" has a step of 0 — steps start at 1`};if(a!==`*`&&o===void 0)return{ok:!1,message:`${e.name} field "${r}" applies a step to a single value — use \`*/S\` or \`N-M/S\``}}for(let t=c;t<=l;t+=u)n.add(e.normalize?e.normalize(t):t)}return{ok:!0,field:{kind:`values`,values:[...n].sort((e,t)=>e-t)}}}function G(e,t){return/^\d+$/.test(t)?Number.parseInt(t,10):e.names?.[t.toLowerCase()]??null}function K(e,t){return/^\d+$/.test(t)?`${e.name} field "${t}" is out of range ${e.min}-${e.max}`:e.names?`${e.name} field "${t}" is not a valid ${e.name} name (${Object.keys(e.names).join(`, `)})`:`${e.name} field "${t}" is not a number`}function oe(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1,c=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s);a.push(c),c<o&&(o=c)}if(o>n)return n+1;r=a}return r[t.length]}var q=A(`CronJobEditDialog`,e=>t=>({instruction:e.instruction,scheduleText:e.scheduleText,mode:e.mode,setInstruction:e=>t({instruction:e}),setScheduleText:e=>t({scheduleText:e}),setMode:e=>t({mode:e})})),J=e(n(),1),se=[{value:`inline`,label:`inline`},{value:`spawn`,label:`spawn`}];function ce({job:e,open:t,onOpenChange:n,onSave:r}){let a=u(`cron.update`,e.jobId),o=c(a),l=q.useScopedStore(e=>e.instruction),d=q.useScopedStore(e=>e.scheduleText),f=q.useScopedStore(e=>e.mode),p=q.useScopedStore(e=>e.setInstruction),h=q.useScopedStore(e=>e.setScheduleText),v=q.useScopedStore(e=>e.setMode),y=(0,F.useMemo)(()=>H(d.trim()),[d]),b=(0,F.useMemo)(()=>{let t={},n=l.trim();n&&n!==e.instruction&&(t.instruction=n),f!==e.mode&&(t.mode=f);let r=d.trim();return y.ok&&r!==e.scheduleText&&(t.schedule=y.schedule,t.scheduleText=r),t},[l,e.instruction,e.mode,e.scheduleText,f,y,d]),x=l.trim().length===0,C=!x&&y.ok&&Object.keys(b).length>0,A=(0,F.useCallback)(()=>{y.ok||y.correctedSchedule===void 0||h(y.correctedSchedule)},[y,h]),M=(0,F.useCallback)(()=>{C&&s(a,async()=>{await r(b),n(!1)})},[C,n,r,b,a]),N=(0,F.useCallback)(()=>{n(!1)},[n]);return(0,J.jsx)(T,{open:t,onOpenChange:n,children:(0,J.jsxs)(w,{size:`lg`,children:[(0,J.jsxs)(D,{className:`space-y-4`,children:[(0,J.jsx)(O,{children:`Edit cron job`}),(0,J.jsxs)(S,{children:[(0,J.jsx)(`span`,{className:`font-mono`,children:e.jobId}),` — saving re-arms the job, which clears its run history and resets its created age.`]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`cron-edit-instruction`,className:`text-sm font-medium text-foreground`,children:`Instruction`}),(0,J.jsx)(_,{id:`cron-edit-instruction`,rows:4,value:l,onChange:e=>p(e.target.value)}),x?(0,J.jsx)(`p`,{className:`text-xs text-destructive`,children:`An instruction is required.`}):null]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`cron-edit-schedule`,className:`text-sm font-medium text-foreground`,children:`Schedule`}),(0,J.jsx)(j,{id:`cron-edit-schedule`,value:d,onChange:e=>h(e.target.value),placeholder:`0 9 * * 1, @daily, or every 5m`,className:`font-mono`}),y.ok?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m(y.schedule,d.trim())}):(0,J.jsx)(`p`,{className:`text-xs text-destructive`,children:y.message}),!y.ok&&y.correctedSchedule!==void 0?(0,J.jsxs)(i,{variant:`secondary`,size:`sm`,onClick:A,children:[`Use `,(0,J.jsx)(`span`,{className:`ml-1 font-mono`,children:y.correctedSchedule})]}):null]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Mode`}),(0,J.jsx)(k,{value:f,onValueChange:v,options:se,size:`sm`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g(f)})]})]}),(0,J.jsxs)(E,{children:[(0,J.jsx)(i,{variant:`ghost`,size:`sm`,onClick:N,children:`Cancel`}),(0,J.jsx)(i,{size:`sm`,onClick:M,disabled:!C,pending:o,children:`Save`})]})]})})}function le(e){return(0,J.jsx)(q.Provider,{init:e.job,children:(0,J.jsx)(ce,{...e})})}var Y=A(`CronJobRow`,()=>e=>({editing:!1,openEditor:()=>e({editing:!0}),setEditing:t=>e({editing:t})})),X=`rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-foreground`,Z=`cannot edit while a run is in flight`;function Q(e,t,n){return u(e,t,n)}async function $(e,t){if(e)try{await e.command(t),v.getState().setCommandError(null)}catch(e){throw v.getState().setCommandError(r(e)),e}}function ue({job:e,chatId:t,trailing:n,divider:r}){let i=f(1e3),o=p(),u=Y.useScopedStore(e=>e.editing),g=Y.useScopedStore(e=>e.openEditor),_=Y.useScopedStore(e=>e.setEditing),v=Q(`cron.pause`,t,e.jobId),S=Q(`cron.resume`,t,e.jobId),w=Q(`cron.remove`,t,e.jobId),T=c(v),E=c(S),D=c(w),O=(0,F.useCallback)(e=>{s(Q(e.type,e.chatId,e.jobId),()=>$(o,e))},[o]),k=(0,F.useCallback)(()=>{O({type:`cron.pause`,chatId:t,jobId:e.jobId})},[t,e.jobId,O]),A=(0,F.useCallback)(()=>{O({type:`cron.resume`,chatId:t,jobId:e.jobId})},[t,e.jobId,O]),j=(0,F.useCallback)(()=>{O({type:`cron.remove`,chatId:t,jobId:e.jobId})},[t,e.jobId,O]),P=(0,F.useCallback)(()=>{I(e)||g()},[e,g]),L=(0,F.useCallback)(n=>$(o,{type:`cron.update`,chatId:t,jobId:e.jobId,patch:n}),[t,e.jobId,o]),R=i-e.armedAt,z=e.lastRun?.status===`running`?e.lastRun:null,B=I(e);return(0,J.jsxs)(`div`,{className:a(`flex items-center gap-3 bg-background px-4 py-2.5`,r&&`border-b border-border`),children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm text-foreground`,children:e.instruction}),e.paused?(0,J.jsx)(h,{}):null,!e.paused&&e.lastRun?(0,J.jsx)(d,{status:e.lastRun.status}):null]}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`font-mono`,children:e.jobId}),(0,J.jsx)(`span`,{children:m(e.schedule,e.scheduleText)}),(0,J.jsxs)(`span`,{children:[`· `,e.mode]}),e.model?(0,J.jsx)(`span`,{className:`font-mono`,children:e.model}):null,(0,J.jsx)(y,{label:new Date(e.armedAt).toLocaleString(),side:`top`,children:(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`created `,N(R),` ago`]})}),z?(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`running for `,M(i-z.firedAt)]}):null,e.paused&&e.lastRun?(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`Last run: `,(0,J.jsx)(d,{status:e.lastRun.status})]}):null,!e.paused&&e.nextFireAt!==null?(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`next in `,M(Math.max(0,e.nextFireAt-i))]}):null,n]})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(y,{label:B?Z:`Edit cron job`,side:`top`,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Edit cron job ${e.jobId}${B?` — ${Z}`:``}`,"aria-disabled":B,className:a(X,B&&`cursor-not-allowed opacity-40 hover:bg-transparent hover:text-muted-foreground`),onClick:P,children:(0,J.jsx)(b,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})}),e.paused?(0,J.jsx)(`button`,{type:`button`,"aria-label":`Resume cron job ${e.jobId}`,className:X,disabled:E,"aria-busy":E||void 0,onClick:A,children:E?(0,J.jsx)(l,{}):(0,J.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):(0,J.jsx)(`button`,{type:`button`,"aria-label":`Pause cron job ${e.jobId}`,className:X,disabled:T,"aria-busy":T||void 0,onClick:k,children:T?(0,J.jsx)(l,{}):(0,J.jsx)(ee,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Remove cron job ${e.jobId}`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-destructive`,disabled:D,"aria-busy":D||void 0,onClick:j,children:D?(0,J.jsx)(l,{}):(0,J.jsx)(C,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),u?(0,J.jsx)(le,{job:e,open:!0,onOpenChange:_,onSave:L},`${e.jobId} ${String(e.armedAt)}`):null]})}function de(e){return(0,J.jsx)(Y.Provider,{init:void 0,children:(0,J.jsx)(ue,{...e})})}export{de as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{t as n}from"./jsx-runtime-BdxMnOeJ.js";import{f as r}from"./log-aTaDVF_e.js";import{a as i,c as a,f as o,n as s,r as c,s as l,t as u}from"./pendingActionsStore-COTh4Ztq.js";import{a as d,c as f,n as p,o as m,r as h,s as g}from"./KannaSocketProvider-D7Lzlt35.js";import{f as _,l as v,p as y}from"./pushClient-BJH_ITRB.js";import{t as b}from"./pencil-fNBeUUCf.js";import{t as x}from"./play-BAmkJfn6.js";import{a as S,g as C,i as w,n as T,o as E,r as D,u as O}from"./timer.adapter-DHt2zwsL.js";import{t as k}from"./segmented-control-DNOwRupT.js";import{t as A}from"./createScopedStore-BoLB9Rhc.js";import{t as j}from"./input-C4fvDiQ4.js";import{r as M,t as N}from"./formatDuration-BbWTR_M_.js";var P={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};P.node;var ee=o(P),F=e(t(),1);function I(e){for(let t of e.recentRuns)if(t.status!==`skipped`)return t.status===`running`;return!1}var L={"@hourly":`0 * * * *`,"@daily":`0 0 * * *`,"@weekly":`0 0 * * 0`,"@monthly":`0 0 1 * *`},R=Object.keys(L),z=[{name:`minute`,min:0,max:59},{name:`hour`,min:0,max:23},{name:`day-of-month`,min:1,max:31},{name:`month`,min:1,max:12,names:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12}},{name:`day-of-week`,min:0,max:7,names:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},normalize:e=>e===7?0:e}],B={name:`second`,min:0,max:59},V={s:1e3,m:6e4,h:36e5};function H(e){let t=e.trim();if(t===``)return{ok:!1,part:`schedule`,message:"missing schedule — expected 5- or 6-field cron, @shortcut, or `every <N>s|m|h`"};let n=t.split(/\s+/);return n[0].startsWith(`@`)?U(n):n[0].toLowerCase()===`every`?ne(n):W(n)}function U(e){let t=e[0].toLowerCase(),n=L[t];if(n===void 0){let n=te(t);return{ok:!1,part:`schedule`,message:`unknown shortcut "${e[0]}" — valid shortcuts are ${R.join(`, `)}`,correctedSchedule:n??void 0}}if(e.length>1)return{ok:!1,part:`schedule`,message:`${t} takes no extra tokens (got "${e.slice(1).join(` `)}")`,correctedSchedule:t};let r=W(n.split(` `));if(!r.ok)throw Error(`builtin shortcut ${t} failed to parse: ${r.message}`);return r}function te(e){let t=null,n=4;for(let r of R){let i=oe(e,r,n);i<n&&(t=r,n=i)}return t}function ne(e){if(e.length===1)return{ok:!1,part:`schedule`,message:"missing interval after `every` — expected e.g. `every 30s`, `every 5m`, or `every 2h`"};let t=e.length===3?e[1]+e[2]:e[1];if(e.length>3||e.length===3&&!re(t))return{ok:!1,part:`schedule`,message:`expected exactly \`every <N>s|m|h\`, got "${e.join(` `)}"`};let n=/^(\d+)(s|m|h)$/.exec(t);if(n){let r=Number.parseInt(n[1],10);if(r<1)return{ok:!1,part:`schedule`,message:`interval must be at least 1`,correctedSchedule:`every 1${n[2]}`};let i=V[n[2]],a=e.length===3?`every ${t}`:void 0;return a===void 0?{ok:!0,schedule:{type:`interval`,ms:r*i}}:{ok:!1,part:`schedule`,message:`interval "${e.slice(1).join(` `)}" has a stray space`,correctedSchedule:a}}let r=/^(\d+)\s*(min|mins|minute|minutes|m|hr|hrs|hour|hours|h|s|sec|secs|second|seconds|d|day|days)$/i.exec(t);if(r){let e=r[1],t=r[2].toLowerCase();if(t.startsWith(`d`))return{ok:!1,part:`schedule`,message:`use @daily instead of "every ${e}${t}"`,correctedSchedule:`@daily`};let n=t[0];return{ok:!1,part:`schedule`,message:`interval unit "${t}" is not valid — use \`s\`, \`m\`, or \`h\``,correctedSchedule:`every ${e}${n}`}}return{ok:!1,part:`schedule`,message:`interval "${t}" is not valid — expected e.g. \`every 30s\`, \`every 5m\`, or \`every 2h\``}}function re(e){return/^\d+\s*[a-z]+$/i.test(e)}function W(e){let t=e.length===6;if(e.length!==5&&!t){let t=e.length===1&&/^\d+(s|m|h)$/.test(e[0]);return{ok:!1,part:`schedule`,message:`cron schedule has ${e.length} field${e.length===1?``:`s`}, expected 5 (minute hour day-of-month month day-of-week) or 6 with a leading second`,correctedSchedule:t?`every ${e[0]}`:ie(e)}}let n=t?[B,...z]:z,r=[];for(let t=0;t<n.length;t++){let i=ae(n[t],e[t]);if(!i.ok)return{ok:!1,part:`schedule_field`,message:i.message};r.push(i.field)}let i=+!!t;return{ok:!0,schedule:{type:`cron`,expression:e.join(` `),...t?{second:r[0]}:{},minute:r[i],hour:r[i+1],dom:r[i+2],month:r[i+3],dow:r[i+4]}}}function ie(e){if(e.length>=2&&e.length<=4){let t=[...e,...Array(5-e.length).fill(`*`)];return W(t).ok?t.join(` `):void 0}if(e.length===7){let t=e.slice(0,6);return W(t).ok?t.join(` `):void 0}}function ae(e,t){if(t===`*`)return{ok:!0,field:{kind:`any`}};let n=new Set;for(let r of t.split(`,`)){if(r===``)return{ok:!1,message:`${e.name} field "${t}" has an empty list entry`};let i=/^(\*|[A-Za-z]+|\d+)(?:-([A-Za-z]+|\d+))?(?:\/(\d+))?$/.exec(r);if(!i)return{ok:!1,message:`${e.name} field "${r}" is not valid — expected \`*\`, \`N\`, \`N-M\`, \`*/S\`, or \`N-M/S\``};let[,a,o,s]=i,c,l;if(a===`*`){if(o!==void 0)return{ok:!1,message:`${e.name} field "${r}" is not valid — \`*\` cannot be a range start`};c=e.min,l=e.max}else{let t=G(e,a);if(t===null)return{ok:!1,message:K(e,a)};if(c=t,o!==void 0){let t=G(e,o);if(t===null)return{ok:!1,message:K(e,o)};l=t}else l=c}if(c<e.min||c>e.max||l<e.min||l>e.max)return{ok:!1,message:`${e.name} field "${r}" is out of range ${e.min}-${e.max}`};if(l<c)return{ok:!1,message:`${e.name} field "${r}" has a range end below its start`};let u=1;if(s!==void 0){if(u=Number.parseInt(s,10),u<1)return{ok:!1,message:`${e.name} field "${r}" has a step of 0 — steps start at 1`};if(a!==`*`&&o===void 0)return{ok:!1,message:`${e.name} field "${r}" applies a step to a single value — use \`*/S\` or \`N-M/S\``}}for(let t=c;t<=l;t+=u)n.add(e.normalize?e.normalize(t):t)}return{ok:!0,field:{kind:`values`,values:[...n].sort((e,t)=>e-t)}}}function G(e,t){return/^\d+$/.test(t)?Number.parseInt(t,10):e.names?.[t.toLowerCase()]??null}function K(e,t){return/^\d+$/.test(t)?`${e.name} field "${t}" is out of range ${e.min}-${e.max}`:e.names?`${e.name} field "${t}" is not a valid ${e.name} name (${Object.keys(e.names).join(`, `)})`:`${e.name} field "${t}" is not a number`}function oe(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1,c=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s);a.push(c),c<o&&(o=c)}if(o>n)return n+1;r=a}return r[t.length]}var q=A(`CronJobEditDialog`,e=>t=>({instruction:e.instruction,scheduleText:e.scheduleText,mode:e.mode,setInstruction:e=>t({instruction:e}),setScheduleText:e=>t({scheduleText:e}),setMode:e=>t({mode:e})})),J=e(n(),1),se=[{value:`inline`,label:`inline`},{value:`spawn`,label:`spawn`}];function ce({job:e,open:t,onOpenChange:n,onSave:r}){let a=u(`cron.update`,e.jobId),o=c(a),l=q.useScopedStore(e=>e.instruction),d=q.useScopedStore(e=>e.scheduleText),f=q.useScopedStore(e=>e.mode),p=q.useScopedStore(e=>e.setInstruction),h=q.useScopedStore(e=>e.setScheduleText),v=q.useScopedStore(e=>e.setMode),y=(0,F.useMemo)(()=>H(d.trim()),[d]),b=(0,F.useMemo)(()=>{let t={},n=l.trim();n&&n!==e.instruction&&(t.instruction=n),f!==e.mode&&(t.mode=f);let r=d.trim();return y.ok&&r!==e.scheduleText&&(t.schedule=y.schedule,t.scheduleText=r),t},[l,e.instruction,e.mode,e.scheduleText,f,y,d]),x=l.trim().length===0,C=!x&&y.ok&&Object.keys(b).length>0,A=(0,F.useCallback)(()=>{y.ok||y.correctedSchedule===void 0||h(y.correctedSchedule)},[y,h]),M=(0,F.useCallback)(()=>{C&&s(a,async()=>{await r(b),n(!1)})},[C,n,r,b,a]),N=(0,F.useCallback)(()=>{n(!1)},[n]);return(0,J.jsx)(T,{open:t,onOpenChange:n,children:(0,J.jsxs)(w,{size:`lg`,children:[(0,J.jsxs)(D,{className:`space-y-4`,children:[(0,J.jsx)(O,{children:`Edit cron job`}),(0,J.jsxs)(S,{children:[(0,J.jsx)(`span`,{className:`font-mono`,children:e.jobId}),` — saving re-arms the job, which clears its run history and resets its created age.`]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`cron-edit-instruction`,className:`text-sm font-medium text-foreground`,children:`Instruction`}),(0,J.jsx)(_,{id:`cron-edit-instruction`,rows:4,value:l,onChange:e=>p(e.target.value)}),x?(0,J.jsx)(`p`,{className:`text-xs text-destructive`,children:`An instruction is required.`}):null]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`cron-edit-schedule`,className:`text-sm font-medium text-foreground`,children:`Schedule`}),(0,J.jsx)(j,{id:`cron-edit-schedule`,value:d,onChange:e=>h(e.target.value),placeholder:`0 9 * * 1, @daily, or every 5m`,className:`font-mono`}),y.ok?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m(y.schedule,d.trim())}):(0,J.jsx)(`p`,{className:`text-xs text-destructive`,children:y.message}),!y.ok&&y.correctedSchedule!==void 0?(0,J.jsxs)(i,{variant:`secondary`,size:`sm`,onClick:A,children:[`Use `,(0,J.jsx)(`span`,{className:`ml-1 font-mono`,children:y.correctedSchedule})]}):null]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Mode`}),(0,J.jsx)(k,{value:f,onValueChange:v,options:se,size:`sm`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g(f)})]})]}),(0,J.jsxs)(E,{children:[(0,J.jsx)(i,{variant:`ghost`,size:`sm`,onClick:N,children:`Cancel`}),(0,J.jsx)(i,{size:`sm`,onClick:M,disabled:!C,pending:o,children:`Save`})]})]})})}function le(e){return(0,J.jsx)(q.Provider,{init:e.job,children:(0,J.jsx)(ce,{...e})})}var Y=A(`CronJobRow`,()=>e=>({editing:!1,openEditor:()=>e({editing:!0}),setEditing:t=>e({editing:t})})),X=`rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-foreground`,Z=`cannot edit while a run is in flight`;function Q(e,t,n){return u(e,t,n)}async function $(e,t){if(e)try{await e.command(t),v.getState().setCommandError(null)}catch(e){throw v.getState().setCommandError(r(e)),e}}function ue({job:e,chatId:t,trailing:n,divider:r}){let i=f(1e3),o=p(),u=Y.useScopedStore(e=>e.editing),g=Y.useScopedStore(e=>e.openEditor),_=Y.useScopedStore(e=>e.setEditing),v=Q(`cron.pause`,t,e.jobId),S=Q(`cron.resume`,t,e.jobId),w=Q(`cron.remove`,t,e.jobId),T=c(v),E=c(S),D=c(w),O=(0,F.useCallback)(e=>{s(Q(e.type,e.chatId,e.jobId),()=>$(o,e))},[o]),k=(0,F.useCallback)(()=>{O({type:`cron.pause`,chatId:t,jobId:e.jobId})},[t,e.jobId,O]),A=(0,F.useCallback)(()=>{O({type:`cron.resume`,chatId:t,jobId:e.jobId})},[t,e.jobId,O]),j=(0,F.useCallback)(()=>{O({type:`cron.remove`,chatId:t,jobId:e.jobId})},[t,e.jobId,O]),P=(0,F.useCallback)(()=>{I(e)||g()},[e,g]),L=(0,F.useCallback)(n=>$(o,{type:`cron.update`,chatId:t,jobId:e.jobId,patch:n}),[t,e.jobId,o]),R=i-e.armedAt,z=e.lastRun?.status===`running`?e.lastRun:null,B=I(e);return(0,J.jsxs)(`div`,{className:a(`flex items-center gap-3 bg-background px-4 py-2.5`,r&&`border-b border-border`),children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm text-foreground`,children:e.instruction}),e.paused?(0,J.jsx)(h,{}):null,!e.paused&&e.lastRun?(0,J.jsx)(d,{status:e.lastRun.status}):null]}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`font-mono`,children:e.jobId}),(0,J.jsx)(`span`,{children:m(e.schedule,e.scheduleText)}),(0,J.jsxs)(`span`,{children:[`· `,e.mode]}),e.model?(0,J.jsx)(`span`,{className:`font-mono`,children:e.model}):null,(0,J.jsx)(y,{label:new Date(e.armedAt).toLocaleString(),side:`top`,children:(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`created `,N(R),` ago`]})}),z?(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`running for `,M(i-z.firedAt)]}):null,e.paused&&e.lastRun?(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`Last run: `,(0,J.jsx)(d,{status:e.lastRun.status})]}):null,!e.paused&&e.nextFireAt!==null?(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[`next in `,M(Math.max(0,e.nextFireAt-i))]}):null,n]})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(y,{label:B?Z:`Edit cron job`,side:`top`,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Edit cron job ${e.jobId}${B?` — ${Z}`:``}`,"aria-disabled":B,className:a(X,B&&`cursor-not-allowed opacity-40 hover:bg-transparent hover:text-muted-foreground`),onClick:P,children:(0,J.jsx)(b,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})}),e.paused?(0,J.jsx)(`button`,{type:`button`,"aria-label":`Resume cron job ${e.jobId}`,className:X,disabled:E,"aria-busy":E||void 0,onClick:A,children:E?(0,J.jsx)(l,{}):(0,J.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):(0,J.jsx)(`button`,{type:`button`,"aria-label":`Pause cron job ${e.jobId}`,className:X,disabled:T,"aria-busy":T||void 0,onClick:k,children:T?(0,J.jsx)(l,{}):(0,J.jsx)(ee,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Remove cron job ${e.jobId}`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-destructive`,disabled:D,"aria-busy":D||void 0,onClick:j,children:D?(0,J.jsx)(l,{}):(0,J.jsx)(C,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),u?(0,J.jsx)(le,{job:e,open:!0,onOpenChange:_,onSave:L},`${e.jobId} ${String(e.armedAt)}`):null]})}function de(e){return(0,J.jsx)(Y.Provider,{init:void 0,children:(0,J.jsx)(ue,{...e})})}export{de as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{n}from"./chunk-OB3PAWPO-COxrdEAH.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{f as i,u as a}from"./KannaSocketProvider-P9V0NjH2.js";import{h as o,s}from"./pushClient-D9iQDbZI.js";import{t as c}from"./CronJobRow-DNErcbgF.js";import{o as l}from"./formatters-wSVyvDFZ.js";var u=e(t(),1),d=e(r(),1);function f(){let e=s(e=>e.rows),t=(0,u.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{projectPath:n.projectPath,rows:[]};e.rows.push(n),t.set(n.projectId,e)}return[...t.values()]},[e]);return(0,d.jsx)(`div`,{className:a,children:(0,d.jsxs)(`div`,{className:`mx-auto w-full max-w-[900px] px-4 py-8`,children:[(0,d.jsxs)(`h1`,{className:`flex items-center gap-2.5 text-lg font-semibold text-foreground`,children:[(0,d.jsx)(i,{className:`h-5 w-5 text-muted-foreground`,"aria-hidden":`true`}),`Cron jobs`,(0,d.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground tabular-nums`,children:[e.length,` armed`]})]}),e.length===0?(0,d.jsxs)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:[`No cron jobs armed anywhere. Arm one from any chat with`,` `,(0,d.jsx)(`code`,{className:`font-mono text-xs`,children:`/cron <instruction> inline|spawn <schedule>`}),`.`]}):(0,d.jsx)(`div`,{className:`mt-6 space-y-6`,children:t.map(e=>(0,d.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,d.jsxs)(`h2`,{className:`border-b border-border bg-card p-3 px-4 text-sm font-medium text-foreground`,children:[l(e.projectPath),(0,d.jsx)(`span`,{className:`ml-2 font-mono text-xs font-normal text-muted-foreground`,children:e.projectPath})]}),(0,d.jsx)(`div`,{children:e.rows.map((t,r)=>(0,d.jsx)(c,{job:t.job,chatId:t.chatId,divider:r<e.rows.length-1,trailing:(0,d.jsxs)(n,{to:`/chat/${t.chatId}`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[(0,d.jsx)(o,{className:`h-3 w-3`,"aria-hidden":`true`}),t.chatTitle||`Open chat`]})},`${t.chatId} ${t.job.jobId}`))})]},e.projectPath))})]})})}export{f as CronJobsPage};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{n}from"./chunk-OB3PAWPO-mARpRU1A.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{f as i,u as a}from"./KannaSocketProvider-D7Lzlt35.js";import{h as o,s}from"./pushClient-BJH_ITRB.js";import{t as c}from"./CronJobRow-CPbO_jwU.js";import{o as l}from"./formatters-wSVyvDFZ.js";var u=e(t(),1),d=e(r(),1);function f(){let e=s(e=>e.rows),t=(0,u.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{projectPath:n.projectPath,rows:[]};e.rows.push(n),t.set(n.projectId,e)}return[...t.values()]},[e]);return(0,d.jsx)(`div`,{className:a,children:(0,d.jsxs)(`div`,{className:`mx-auto w-full max-w-[900px] px-4 py-8`,children:[(0,d.jsxs)(`h1`,{className:`flex items-center gap-2.5 text-lg font-semibold text-foreground`,children:[(0,d.jsx)(i,{className:`h-5 w-5 text-muted-foreground`,"aria-hidden":`true`}),`Cron jobs`,(0,d.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground tabular-nums`,children:[e.length,` armed`]})]}),e.length===0?(0,d.jsxs)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:[`No cron jobs armed anywhere. Arm one from any chat with`,` `,(0,d.jsx)(`code`,{className:`font-mono text-xs`,children:`/cron <instruction> inline|spawn <schedule>`}),`.`]}):(0,d.jsx)(`div`,{className:`mt-6 space-y-6`,children:t.map(e=>(0,d.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,d.jsxs)(`h2`,{className:`border-b border-border bg-card p-3 px-4 text-sm font-medium text-foreground`,children:[l(e.projectPath),(0,d.jsx)(`span`,{className:`ml-2 font-mono text-xs font-normal text-muted-foreground`,children:e.projectPath})]}),(0,d.jsx)(`div`,{children:e.rows.map((t,r)=>(0,d.jsx)(c,{job:t.job,chatId:t.chatId,divider:r<e.rows.length-1,trailing:(0,d.jsxs)(n,{to:`/chat/${t.chatId}`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[(0,d.jsx)(o,{className:`h-3 w-3`,"aria-hidden":`true`}),t.chatTitle||`Open chat`]})},`${t.chatId} ${t.job.jobId}`))})]},e.projectPath))})]})})}export{f as CronJobsPage};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-jDbZZtuE.js","assets/preload-helper-BZ1Pz5am.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-DEuepP9r.js","assets/rolldown-runtime-C0FnF6B9.js","assets/src-B-DeWB10.js","assets/chunk-O7XYJQB3-BuJf_igd.js","assets/chunk-ZIGJFQKS-DNaCAnHq.js","assets/dist-Cz2MTljl.js","assets/chunk-6AEJRKK7-DO1dhGbP.js","assets/chunk-742MDFTN-Caihy1xI.js","assets/chunk-MBY4JIJT-B13n2mKy.js","assets/chunk-7PRAP22T-DA2a7RLB.js","assets/chunk-7INBJB4K-aVCoMKLb.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-5DYCD2WN-CdfvSpXJ.js","assets/chunk-Z7XXMR3K-c-eB5Ea8.js","assets/line-Dsdv7KRC.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-UA2S7LBM-Bf77iZxm.js","assets/chunk-GNY47TPC-lZyp2s3D.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-LNGE3PJU-5-SxdO55.js","assets/dist-DLd14rxw.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{t as n}from"./react-dom-CvX0TCLz.js";import{t as r}from"./preload-helper-BZ1Pz5am.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{d as a,h as o,m as s,t as c}from"./log-DTKPehdH.js";import{a as l,c as u,f as d,n as f,r as p,t as m}from"./pendingActionsStore-9qaSyloJ.js";import{$ as h,A as g,Bt as _,C as v,D as y,E as b,F as ee,Ht as te,I as ne,K as re,M as ie,N as ae,O as oe,P as se,Pt as x,S as ce,T as le,Tt as ue,Ut as de,V as fe,Vt as pe,_ as me,a as he,b as ge,c as _e,d as ve,f as ye,g as be,h as xe,i as Se,j as Ce,k as we,l as Te,m as Ee,n as De,o as Oe,p as ke,q as S,r as Ae,s as je,t as Me,u as Ne,v as Pe,vt as Fe,wt as Ie,x as Le,y as Re,zt as ze}from"./lexicalToReact-BDa_5qRY.js";import{n as Be,r as C,t as w}from"./clipboard.adapter-CpYfdxOc.js";import{n as Ve,r as He,t as Ue}from"./terminal-CzIIZKjC.js";import{n as We,t as Ge}from"./triangle-alert-vEEZ59Sw.js";import{t as Ke}from"./pencil-CblyZXwW.js";import{t as qe}from"./plus-CZJUl6yo.js";import{a as Je,g as Ye,i as Xe,n as Ze,t as T,u as Qe}from"./timer.adapter-DDgBJONP.js";import{t as E}from"./createScopedStore-BFPsowk4.js";import{r as $e}from"./useTheme-BXQFYwx9.js";import{t as D}from"./runDetached-D_x7Eiol.js";var et={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};et.node;var tt=d(et),nt={name:`check-line`,size:24,node:[[`path`,{d:`M20 4L9 15`,key:`1qkx8z`}],[`path`,{d:`M21 19L3 19`,key:`100sma`}],[`path`,{d:`M9 15L4 10`,key:`9zxff7`}]]};nt.node;var O=d(nt),rt={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};rt.node;var it=d(rt),at={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};at.node;var ot=d(at),st={name:`file-braces`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]],aliases:[`file-json`]};st.node;var ct=d(st),lt={name:`file-code-corner`,size:24,node:[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]],aliases:[`file-code-2`]};lt.node;var ut=d(lt),dt={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};dt.node;var ft=d(dt),pt={name:`file-image`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]};pt.node;var mt=d(pt),ht={name:`file-pen`,size:24,node:[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]],aliases:[`file-edit`]};ht.node;var gt=d(ht),_t={name:`file-plus-corner`,size:24,node:[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]],aliases:[`file-plus-2`]};_t.node;var vt=d(_t),yt={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};yt.node;var bt=d(yt),xt={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};xt.node;var St=d(xt),Ct={name:`file-video-camera`,size:24,node:[[`path`,{d:`M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2`,key:`jrl274`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 17.843 3.033-1.755a.64.64 0 0 1 .967.56v4.704a.65.65 0 0 1-.967.56L10 20.157`,key:`17aeo9`}],[`rect`,{width:`7`,height:`6`,x:`3`,y:`16`,rx:`1`,key:`s27ndx`}]],aliases:[`file-video-2`]};Ct.node;var wt=d(Ct),Tt={name:`file-x`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]};Tt.node;var Et=d(Tt),Dt={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};Dt.node;var Ot=d(Dt),kt={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};kt.node;var At=d(kt),jt={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};jt.node;var Mt=d(jt),Nt={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};Nt.node;var Pt=d(Nt),Ft={name:`receipt-text`,size:24,node:[[`path`,{d:`M13 16H8`,key:`wsln4y`}],[`path`,{d:`M14 8H8`,key:`1l3xfs`}],[`path`,{d:`M16 12H8`,key:`1fr5h0`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};Ft.node;var It=d(Ft),Lt={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Lt.node;var Rt=d(Lt),zt={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};zt.node;var Bt=d(zt),Vt={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};Vt.node;var Ht=d(Vt),Ut={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Ut.node;var Wt=d(Ut),Gt={name:`square-x`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-square`]};Gt.node;var Kt=d(Gt),qt={name:`toy-brick`,size:24,node:[[`rect`,{width:`18`,height:`12`,x:`3`,y:`8`,rx:`1`,key:`158fvp`}],[`path`,{d:`M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3`,key:`s0042v`}],[`path`,{d:`M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3`,key:`9wmeh2`}]]};qt.node;var Jt=d(qt),Yt={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Yt.node;var Xt=d(Yt);async function Zt(e,t={}){let n=t.http??ze;try{let r=await n.head(e,{signal:t.signal});return r.ok?{kind:`ready`,mimeType:r.headers[`content-type`]?.split(`;`)[0]?.trim()??`application/octet-stream`,size:Number.parseInt(r.headers[`content-length`]??`0`,10)||0}:r.status===404?{kind:`missing`}:{kind:`error`}}catch{return{kind:`error`}}}async function Qt(e,t={}){let n=t.http??ze,r=e.replace(/\/content$/,``),i=await n.del(r);if(!i.ok&&i.status!==404)throw Error(`Delete request failed with status ${i.status}`)}async function $t(e,t,n={}){let{body:r,ok:i,status:a}=await(n.http??ze).streamBytes(e,{signal:n.signal,headers:{Accept:`text/plain, text/markdown, application/json, text/csv, text/tab-separated-values, */*`}});if(!i)throw Error(`Preview request failed with status ${a}`);if(!r)return{content:``,truncated:!1};let o=r.getReader(),s=[],c=0,l=!1;for(;;){let{done:e,value:n}=await o.read();if(e)break;if(!n)continue;let r=t-c;if(r<=0){l=!0,await o.cancel();break}if(n.byteLength>r){s.push(n.slice(0,r)),c+=r,l=!0,await o.cancel();break}s.push(n),c+=n.byteLength}let u=new Uint8Array(c),d=0;for(let e of s)u.set(e,d),d+=e.byteLength;return{content:new TextDecoder().decode(u),truncated:l}}var en=1048576,tn=new Set(`.c,.cc,.cfg,.conf,.cpp,.cs,.css,.env,.go,.graphql,.h,.hpp,.html,.ini,.java,.js,.jsonc,.jsx,.kt,.lua,.mjs,.php,.pl,.properties,.py,.rb,.rs,.scss,.sh,.sql,.swift,.toml,.ts,.tsx,.txt,.vue,.xml,.yaml,.yml,.zsh`.split(`,`)),nn=new Set([`.7z`,`.bz2`,`.gz`,`.rar`,`.tar`,`.tgz`,`.xz`,`.zip`]),rn=new Set([`.aac`,`.flac`,`.m4a`,`.mp3`,`.ogg`,`.wav`]),an=new Set([`.avi`,`.m4v`,`.mov`,`.mp4`,`.mkv`,`.webm`]);function on(e){let t=e.mimeType.toLowerCase(),n=A(e.displayName);return t.startsWith(`image/`)?{kind:`image`,openInNewTab:!1}:t===`application/pdf`?{kind:`pdf`,openInNewTab:!1}:t===`application/json`?e.size<=262144?{kind:`json`,openInNewTab:!1}:{kind:`external`,openInNewTab:!0}:hn(e)?{kind:`markdown`,openInNewTab:!1}:t===`text/csv`||t===`text/tab-separated-values`?{kind:`table`,openInNewTab:!1}:t.startsWith(`audio/`)||rn.has(n)?{kind:`audio`,openInNewTab:!1}:t.startsWith(`video/`)||an.has(n)?{kind:`video`,openInNewTab:!1}:t.startsWith(`text/`)||tn.has(n)?{kind:`text`,openInNewTab:!1}:{kind:`external`,openInNewTab:!0}}var sn={image:`Image`,pdf:`PDF`,markdown:`Markdown`,json:`JSON`,table:`Table`,code:`Source`,text:`Text`,archive:`Archive`,audio:`Audio`,video:`Video`,file:`File`,mermaid:`Diagram`};function cn(e,t){if(e===`archive`&&t){if(t.includes(`zip`))return`ZIP archive`;if(t.includes(`gzip`))return`Gzip archive`;if(t.includes(`x-tar`))return`Tar archive`}if(e===`image`&&t){let e=t.split(`/`)[1]?.split(`;`)[0]?.toUpperCase();if(e)return`${e} image`}return sn[e]}function k(e){let t=e.mimeType.toLowerCase(),n=A(e.displayName);return t.startsWith(`image/`)?`image`:t===`application/pdf`||n===`.pdf`?`pdf`:t===`application/json`||n===`.json`||n===`.jsonc`?`json`:hn(e)?`markdown`:t===`text/csv`||t===`text/tab-separated-values`||n===`.csv`||n===`.tsv`?`table`:t.startsWith(`audio/`)||rn.has(n)?`audio`:t.startsWith(`video/`)||an.has(n)?`video`:t.includes(`zip`)||t.includes(`archive`)||nn.has(n)?`archive`:_n(e)?`mermaid`:tn.has(n)?n===`.txt`?`text`:`code`:t.startsWith(`text/`)?`text`:`file`}async function ln(e,t,n={}){let r=n.dom??a,i=n.timer??T,s=typeof AbortController<`u`?new AbortController:null,c=s?i.setTimeout(()=>s.abort(`preview-timeout`),15e3):null;try{return await $t(vn(e,r),t,{signal:s?.signal,http:n.http})}catch(e){throw yn(o(e))?Error(`Preview request timed out`,{cause:e}):e}finally{c!==null&&i.clearTimeout(c)}}function un(e){try{return`${JSON.stringify(JSON.parse(e),null,2)}\n`}catch{return e}}function dn(e,t){let n=bn(e,t),r=n.length,i=n.reduce((e,t)=>Math.max(e,t.length),0),a=r>200,o=i>20;return{rows:n.slice(0,200).map(e=>e.slice(0,20)),rowCount:r,columnCount:i,truncatedRows:a,truncatedColumns:o}}function A(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t).toLowerCase():``}function fn(e){return e.split(`;`)[0]?.trim().toLowerCase()??``}function pn(e){return[A(e.displayName),A(e.relativePath)]}var mn=new Set([`text/markdown`,`text/x-markdown`]);function hn(e){return mn.has(fn(e.mimeType))?!0:pn(e).includes(`.md`)}var gn=new Set([`.mmd`,`.mermaid`]);function _n(e){return fn(e.mimeType)===`text/vnd.mermaid`||pn(e).some(e=>gn.has(e))}function vn(e,t){return new URL(e,t.getBaseURI()||t.getHref()).toString()}function yn(e){return e instanceof DOMException&&e.name===`AbortError`||e.message===`preview-timeout`}function bn(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;o<e.length;o+=1){let s=e[o],c=e[o+1];if(s===`"`){a&&c===`"`?(i+=`"`,o+=1):a=!a;continue}if(!a&&s===t){r.push(i),i=``;continue}if(!a&&(s===`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-gRh-26W4.js","assets/preload-helper-DjzSQ1t3.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-DEuepP9r.js","assets/rolldown-runtime-C0FnF6B9.js","assets/src-B-DeWB10.js","assets/chunk-VPRB5NB3-DdvbFm4G.js","assets/chunk-3YJQHVM4-BD0QjGHE.js","assets/dist-Cz2MTljl.js","assets/chunk-Z6ETV63D-CJv8Kmac.js","assets/chunk-HJ2JQQFS-DHgNY4oe.js","assets/chunk-E2ZNV5FY-CWsTozRZ.js","assets/chunk-4EA7E6EY-C-3QyPC4.js","assets/chunk-XC4XBNZT-C7Gta1hk.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-DBDB3WZW-BuRZXbw3.js","assets/chunk-2BW5OAIV-CAk9x6ti.js","assets/line-Bu0kN2MJ.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-NTY3LDVX-Bvl8xsuC.js","assets/chunk-SVEVUXB4-Csc8k5gP.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-LNGE3PJU-5-SxdO55.js","assets/dist-BdNQvasR.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{t as n}from"./react-dom-CvX0TCLz.js";import{t as r}from"./preload-helper-DjzSQ1t3.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{d as a,h as o,m as s,t as c}from"./log-aTaDVF_e.js";import{a as l,c as u,f as d,n as f,r as p,t as m}from"./pendingActionsStore-COTh4Ztq.js";import{$ as h,A as g,Bt as _,C as v,D as y,E as b,F as ee,Ht as te,I as ne,K as re,M as ie,N as ae,O as oe,P as se,Pt as x,S as ce,T as le,Tt as ue,Ut as de,V as fe,Vt as pe,_ as me,a as he,b as ge,c as _e,d as ve,f as ye,g as be,h as xe,i as Se,j as Ce,k as we,l as Te,m as Ee,n as De,o as Oe,p as ke,q as S,r as Ae,s as je,t as Me,u as Ne,v as Pe,vt as Fe,wt as Ie,x as Le,y as Re,zt as ze}from"./lexicalToReact-sPUyOWk6.js";import{n as Be,r as C,t as w}from"./clipboard.adapter-GN9nnYak.js";import{n as Ve,r as He,t as Ue}from"./terminal-Bnj7qFGw.js";import{n as We,t as Ge}from"./triangle-alert-CWrc0CIO.js";import{t as Ke}from"./pencil-fNBeUUCf.js";import{t as qe}from"./plus-c75CkNEO.js";import{a as Je,g as Ye,i as Xe,n as Ze,t as T,u as Qe}from"./timer.adapter-DHt2zwsL.js";import{t as E}from"./createScopedStore-BoLB9Rhc.js";import{r as $e}from"./useTheme-B57LIKyx.js";import{t as D}from"./runDetached-DqQ3k2ji.js";var et={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};et.node;var tt=d(et),nt={name:`check-line`,size:24,node:[[`path`,{d:`M20 4L9 15`,key:`1qkx8z`}],[`path`,{d:`M21 19L3 19`,key:`100sma`}],[`path`,{d:`M9 15L4 10`,key:`9zxff7`}]]};nt.node;var O=d(nt),rt={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};rt.node;var it=d(rt),at={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};at.node;var ot=d(at),st={name:`file-braces`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]],aliases:[`file-json`]};st.node;var ct=d(st),lt={name:`file-code-corner`,size:24,node:[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]],aliases:[`file-code-2`]};lt.node;var ut=d(lt),dt={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};dt.node;var ft=d(dt),pt={name:`file-image`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]};pt.node;var mt=d(pt),ht={name:`file-pen`,size:24,node:[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]],aliases:[`file-edit`]};ht.node;var gt=d(ht),_t={name:`file-plus-corner`,size:24,node:[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]],aliases:[`file-plus-2`]};_t.node;var vt=d(_t),yt={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};yt.node;var bt=d(yt),xt={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};xt.node;var St=d(xt),Ct={name:`file-video-camera`,size:24,node:[[`path`,{d:`M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2`,key:`jrl274`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 17.843 3.033-1.755a.64.64 0 0 1 .967.56v4.704a.65.65 0 0 1-.967.56L10 20.157`,key:`17aeo9`}],[`rect`,{width:`7`,height:`6`,x:`3`,y:`16`,rx:`1`,key:`s27ndx`}]],aliases:[`file-video-2`]};Ct.node;var wt=d(Ct),Tt={name:`file-x`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]};Tt.node;var Et=d(Tt),Dt={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};Dt.node;var Ot=d(Dt),kt={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};kt.node;var At=d(kt),jt={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};jt.node;var Mt=d(jt),Nt={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};Nt.node;var Pt=d(Nt),Ft={name:`receipt-text`,size:24,node:[[`path`,{d:`M13 16H8`,key:`wsln4y`}],[`path`,{d:`M14 8H8`,key:`1l3xfs`}],[`path`,{d:`M16 12H8`,key:`1fr5h0`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};Ft.node;var It=d(Ft),Lt={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Lt.node;var Rt=d(Lt),zt={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};zt.node;var Bt=d(zt),Vt={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};Vt.node;var Ht=d(Vt),Ut={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Ut.node;var Wt=d(Ut),Gt={name:`square-x`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-square`]};Gt.node;var Kt=d(Gt),qt={name:`toy-brick`,size:24,node:[[`rect`,{width:`18`,height:`12`,x:`3`,y:`8`,rx:`1`,key:`158fvp`}],[`path`,{d:`M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3`,key:`s0042v`}],[`path`,{d:`M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3`,key:`9wmeh2`}]]};qt.node;var Jt=d(qt),Yt={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Yt.node;var Xt=d(Yt);async function Zt(e,t={}){let n=t.http??ze;try{let r=await n.head(e,{signal:t.signal});return r.ok?{kind:`ready`,mimeType:r.headers[`content-type`]?.split(`;`)[0]?.trim()??`application/octet-stream`,size:Number.parseInt(r.headers[`content-length`]??`0`,10)||0}:r.status===404?{kind:`missing`}:{kind:`error`}}catch{return{kind:`error`}}}async function Qt(e,t={}){let n=t.http??ze,r=e.replace(/\/content$/,``),i=await n.del(r);if(!i.ok&&i.status!==404)throw Error(`Delete request failed with status ${i.status}`)}async function $t(e,t,n={}){let{body:r,ok:i,status:a}=await(n.http??ze).streamBytes(e,{signal:n.signal,headers:{Accept:`text/plain, text/markdown, application/json, text/csv, text/tab-separated-values, */*`}});if(!i)throw Error(`Preview request failed with status ${a}`);if(!r)return{content:``,truncated:!1};let o=r.getReader(),s=[],c=0,l=!1;for(;;){let{done:e,value:n}=await o.read();if(e)break;if(!n)continue;let r=t-c;if(r<=0){l=!0,await o.cancel();break}if(n.byteLength>r){s.push(n.slice(0,r)),c+=r,l=!0,await o.cancel();break}s.push(n),c+=n.byteLength}let u=new Uint8Array(c),d=0;for(let e of s)u.set(e,d),d+=e.byteLength;return{content:new TextDecoder().decode(u),truncated:l}}var en=1048576,tn=new Set(`.c,.cc,.cfg,.conf,.cpp,.cs,.css,.env,.go,.graphql,.h,.hpp,.html,.ini,.java,.js,.jsonc,.jsx,.kt,.lua,.mjs,.php,.pl,.properties,.py,.rb,.rs,.scss,.sh,.sql,.swift,.toml,.ts,.tsx,.txt,.vue,.xml,.yaml,.yml,.zsh`.split(`,`)),nn=new Set([`.7z`,`.bz2`,`.gz`,`.rar`,`.tar`,`.tgz`,`.xz`,`.zip`]),rn=new Set([`.aac`,`.flac`,`.m4a`,`.mp3`,`.ogg`,`.wav`]),an=new Set([`.avi`,`.m4v`,`.mov`,`.mp4`,`.mkv`,`.webm`]);function on(e){let t=e.mimeType.toLowerCase(),n=A(e.displayName);return t.startsWith(`image/`)?{kind:`image`,openInNewTab:!1}:t===`application/pdf`?{kind:`pdf`,openInNewTab:!1}:t===`application/json`?e.size<=262144?{kind:`json`,openInNewTab:!1}:{kind:`external`,openInNewTab:!0}:hn(e)?{kind:`markdown`,openInNewTab:!1}:t===`text/csv`||t===`text/tab-separated-values`?{kind:`table`,openInNewTab:!1}:t.startsWith(`audio/`)||rn.has(n)?{kind:`audio`,openInNewTab:!1}:t.startsWith(`video/`)||an.has(n)?{kind:`video`,openInNewTab:!1}:t.startsWith(`text/`)||tn.has(n)?{kind:`text`,openInNewTab:!1}:{kind:`external`,openInNewTab:!0}}var sn={image:`Image`,pdf:`PDF`,markdown:`Markdown`,json:`JSON`,table:`Table`,code:`Source`,text:`Text`,archive:`Archive`,audio:`Audio`,video:`Video`,file:`File`,mermaid:`Diagram`};function cn(e,t){if(e===`archive`&&t){if(t.includes(`zip`))return`ZIP archive`;if(t.includes(`gzip`))return`Gzip archive`;if(t.includes(`x-tar`))return`Tar archive`}if(e===`image`&&t){let e=t.split(`/`)[1]?.split(`;`)[0]?.toUpperCase();if(e)return`${e} image`}return sn[e]}function k(e){let t=e.mimeType.toLowerCase(),n=A(e.displayName);return t.startsWith(`image/`)?`image`:t===`application/pdf`||n===`.pdf`?`pdf`:t===`application/json`||n===`.json`||n===`.jsonc`?`json`:hn(e)?`markdown`:t===`text/csv`||t===`text/tab-separated-values`||n===`.csv`||n===`.tsv`?`table`:t.startsWith(`audio/`)||rn.has(n)?`audio`:t.startsWith(`video/`)||an.has(n)?`video`:t.includes(`zip`)||t.includes(`archive`)||nn.has(n)?`archive`:_n(e)?`mermaid`:tn.has(n)?n===`.txt`?`text`:`code`:t.startsWith(`text/`)?`text`:`file`}async function ln(e,t,n={}){let r=n.dom??a,i=n.timer??T,s=typeof AbortController<`u`?new AbortController:null,c=s?i.setTimeout(()=>s.abort(`preview-timeout`),15e3):null;try{return await $t(vn(e,r),t,{signal:s?.signal,http:n.http})}catch(e){throw yn(o(e))?Error(`Preview request timed out`,{cause:e}):e}finally{c!==null&&i.clearTimeout(c)}}function un(e){try{return`${JSON.stringify(JSON.parse(e),null,2)}\n`}catch{return e}}function dn(e,t){let n=bn(e,t),r=n.length,i=n.reduce((e,t)=>Math.max(e,t.length),0),a=r>200,o=i>20;return{rows:n.slice(0,200).map(e=>e.slice(0,20)),rowCount:r,columnCount:i,truncatedRows:a,truncatedColumns:o}}function A(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t).toLowerCase():``}function fn(e){return e.split(`;`)[0]?.trim().toLowerCase()??``}function pn(e){return[A(e.displayName),A(e.relativePath)]}var mn=new Set([`text/markdown`,`text/x-markdown`]);function hn(e){return mn.has(fn(e.mimeType))?!0:pn(e).includes(`.md`)}var gn=new Set([`.mmd`,`.mermaid`]);function _n(e){return fn(e.mimeType)===`text/vnd.mermaid`||pn(e).some(e=>gn.has(e))}function vn(e,t){return new URL(e,t.getBaseURI()||t.getHref()).toString()}function yn(e){return e instanceof DOMException&&e.name===`AbortError`||e.message===`preview-timeout`}function bn(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;o<e.length;o+=1){let s=e[o],c=e[o+1];if(s===`"`){a&&c===`"`?(i+=`"`,o+=1):a=!a;continue}if(!a&&s===t){r.push(i),i=``;continue}if(!a&&(s===`
3
3
  `||s===`\r`)){s===`\r`&&c===`
4
4
  `&&(o+=1),r.push(i),n.push(r),r=[],i=``;continue}i+=s}return(i.length>0||r.length>0)&&(r.push(i),n.push(r)),n}var j=e(i(),1),xn=18,Sn=3,Cn=2*Math.PI*xn,M=42;function wn({progress:e,onCancel:t,size:n=`md`,className:r,cancelLabel:i=`Cancel upload`}){let a=e==null,o=a?0:Math.min(1,Math.max(0,e)),s=a?null:Math.round(o*100),c=Cn*(1-o),l=n===`sm`?36:48;return(0,j.jsx)(`div`,{className:u(`pointer-events-auto absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-background/85`,r),role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s??void 0,"aria-label":a?`Uploading`:`Uploading, ${s}%`,children:(0,j.jsxs)(`div`,{className:u(`group/overlay relative inline-flex items-center justify-center`,a&&`motion-safe:animate-spin`),style:{width:l,height:l},children:[(0,j.jsxs)(`svg`,{viewBox:`0 0 ${M} ${M}`,width:l,height:l,className:`absolute inset-0 -rotate-90`,"aria-hidden":`true`,children:[(0,j.jsx)(`circle`,{cx:M/2,cy:M/2,r:xn,stroke:`currentColor`,strokeWidth:Sn,fill:`none`,className:`text-border`}),(0,j.jsx)(`circle`,{cx:M/2,cy:M/2,r:xn,stroke:`currentColor`,strokeWidth:Sn,fill:`none`,strokeLinecap:`round`,strokeDasharray:Cn,strokeDashoffset:a?Cn*.75:c,className:u(`motion-safe:transition-[stroke-dashoffset] motion-safe:duration-150 motion-safe:ease-out`,t?`text-foreground group-hover/overlay:text-destructive`:`text-foreground`)})]}),s===null?null:(0,j.jsxs)(`span`,{className:u(`pointer-events-none select-none font-mono tabular-nums text-foreground transition-opacity`,`text-xs`,t&&`group-hover/overlay:opacity-0`),children:[s,`%`]}),t?(0,j.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},className:u(`absolute inset-0 flex items-center justify-center rounded-full text-destructive transition-opacity`,s===null?``:`opacity-0 group-hover/overlay:opacity-100`,`focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive`),"aria-label":i,children:(0,j.jsx)(Ye,{className:n===`sm`?`h-3.5 w-3.5`:`h-4 w-4`})}):null]})})}var Tn=E(`ExpandableRow`,({defaultExpanded:e})=>t=>({expanded:e,setExpanded:e=>t({expanded:e})})),N=E(`CopyState`,()=>e=>({copied:!1,setCopied:t=>e({copied:t})})),P=e(t(),1),En=()=>{},Dn=(0,P.createContext)(En);function On({children:e,onOpenLocalLink:t}){return(0,j.jsx)(Dn.Provider,{value:t??En,children:e})}var kn={Task:te,TaskOutput:te,Bash:Ue,Glob:_,Grep:_,ExitPlanMode:At,Read:Ot,Edit:gt,Write:vt,Delete:Et,NotebookEdit:Ke,WebFetch:tt,TodoWrite:O,TaskCreate:O,TaskUpdate:O,TaskGet:O,TaskList:O,WebSearch:_,KillShell:Kt,TaskStop:Kt,AskUserQuestion:Pt,Skill:Wt,EnterPlanMode:At},An=Jt;function jn(e){return kn[e]?kn[e]:An}function Mn({icon:e,className:t}){return(0,j.jsx)(e,{className:t})}function Nn({children:e,className:t}){return(0,j.jsx)(`div`,{className:u(`flex gap-3 justify-start items-center`,t),children:e})}function Pn({children:e,className:t}){return(0,j.jsx)(`div`,{className:u(`flex items-center gap-1.5 text-xs`,t),children:e})}function Fn({children:e,className:t}){return(0,j.jsx)(`span`,{className:u(`font-medium text-foreground/80`,t),children:e})}function In({children:e}){return(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:e})}function Ln({children:e,className:t}){return(0,j.jsxs)(Nn,{className:u(`px-0.5 text-xs tracking-wide`,t),children:[(0,j.jsx)(`div`,{className:`w-full h-[1px] bg-border`}),(0,j.jsx)(Fn,{className:`whitespace-nowrap text-xs tracking-widest text-muted-foreground/60 flex-shrink-0`,children:e}),(0,j.jsx)(`div`,{className:`w-full h-[1px] bg-border`})]})}function Rn({children:e,expandedContent:t}){let n=Tn.useScopedStore(e=>e.expanded),r=Tn.useScopedStore(e=>e.setExpanded);return(0,j.jsxs)(`div`,{className:`flex flex-col w-full`,children:[(0,j.jsxs)(`button`,{onClick:()=>r(!n),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${n?``:`hover:opacity-60 transition-opacity`}`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] items-center gap-1.5`,children:e}),(0,j.jsx)(He,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-[transform,opacity] motion-reduce:transition-none duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${n?`rotate-90 opacity-100`:``}`})]}),n&&t]})}function zn({children:e,expandedContent:t,defaultExpanded:n=!1}){return(0,j.jsx)(Tn.Provider,{init:{defaultExpanded:n},children:(0,j.jsx)(Rn,{expandedContent:t,children:e})})}function Bn({label:e,children:t,copyText:n,ports:r={}}){let i=N.useScopedStore(e=>e.copied),a=N.useScopedStore(e=>e.setCopied),o=n??F(t),s=r.clipboard??w,c=r.timer??T,d=(0,P.useCallback)(async()=>{await s.writeText(o),a(!0),c.setTimeout(()=>a(!1),2e3)},[o,a,s,c]),f=(0,P.useCallback)(()=>{D(`copy code`,d())},[d]);return(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:e}),(0,j.jsxs)(`div`,{className:`relative group/codeblock`,children:[(0,j.jsx)(`pre`,{className:`my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full`,children:t}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":i?`Copied`:`Copy code`,className:u(`absolute top-[4px] right-[4px] z-10 h-11 w-11 md:h-6.5 md:w-6.5 rounded-sm text-muted-foreground opacity-100 md:opacity-0 md:group-hover/codeblock:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100`,!i&&`hover:text-foreground`,i&&`hover:!bg-transparent hover:!border-transparent`),onClick:f,children:i?(0,j.jsx)(C,{className:`h-3.5 w-3.5 text-success-text`}):(0,j.jsx)(Be,{className:`h-4 w-4`})})]})]})}function Vn({label:e,children:t,copyText:n,ports:r}){return(0,j.jsx)(N.Provider,{init:void 0,children:(0,j.jsx)(Bn,{label:e,copyText:n,ports:r,children:t})})}function Hn({children:e,icon:t,className:n}){return(0,j.jsxs)(`span`,{className:u(`inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full`,n),children:[t&&(0,j.jsx)(t,{className:`h-3 w-3 text-muted-foreground`}),e]})}function Un({children:e,className:t}){return(0,j.jsxs)(`div`,{className:u(`grid grid-cols-[auto_1fr] gap-2 min-w-0`,t),children:[(0,j.jsx)(`div`,{className:` min-w-5 flex flex-col relative items-center justify-center`,children:(0,j.jsx)(`div`,{className:`min-h-full w-[1px] bg-muted-foreground/20`})}),(0,j.jsx)(`div`,{className:`-ml-[1px] min-w-0 overflow-hidden`,children:e})]})}function Wn(e){return typeof e==`object`&&!!e&&`props`in e}function F(e){return typeof e==`string`?e:typeof e==`number`?String(e):Array.isArray(e)?e.map(F).join(``):Wn(e)?F(e.props.children):``}function Gn({children:e,ports:t={},copyText:n,...r}){let i=N.useScopedStore(e=>e.copied),a=N.useScopedStore(e=>e.setCopied),o=n??F(e),s=t.clipboard??w,c=t.timer??T,d=async()=>{await s.writeText(o),a(!0),c.setTimeout(()=>a(!1),2e3)},f=()=>{D(`copy code`,d())};return(0,j.jsxs)(`div`,{className:`relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre`,children:[(0,j.jsx)(`pre`,{className:`min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background`,...r,children:e}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":i?`Copied`:`Copy code`,className:u(`absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-11 w-11 md:h-8 md:w-8 text-muted-foreground opacity-100 md:opacity-0 md:group-hover/pre:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100`,!i&&`hover:text-foreground`,i&&`hover:!bg-transparent hover:!border-transparent`),onClick:f,children:i?(0,j.jsx)(C,{className:`h-4 w-4 text-success-text`}):(0,j.jsx)(Be,{className:`h-4 w-4`})})]})}function Kn({children:e,ports:t,copyText:n,...r}){return(0,j.jsx)(N.Provider,{init:void 0,children:(0,j.jsx)(Gn,{ports:t,copyText:n,...r,children:e})})}function I({source:e,ports:t,highlightLine:n}){return n===void 0?(0,j.jsx)(Kn,{ports:t,children:(0,j.jsx)(`code`,{className:`block text-xs whitespace-pre language-mermaid`,children:e})}):(0,j.jsx)(Kn,{ports:t,copyText:e,children:(0,j.jsx)(`code`,{className:`grid grid-cols-[auto_1fr] text-xs language-mermaid`,children:e.split(`
5
5
  `).flatMap((e,t)=>{let r=t+1,i=r===n;return[(0,j.jsx)(`span`,{"aria-hidden":`true`,className:u(`select-none pr-3 text-right tabular-nums`,i?`bg-muted font-medium text-destructive`:`text-muted-foreground/60`),children:r},`gutter-${r}`),(0,j.jsx)(`span`,{className:u(`whitespace-pre`,i&&`bg-muted text-destructive`),children:e.length>0?e:` `},`line-${r}`)]})})})}function qn({attachment:e,previewUrl:t,onClick:n,onRemove:r,className:i,size:a=`transcript`,uploadProgress:o,onCancelUpload:s}){let c=e.contentUrl||t,l=a===`composer`,d=o!==void 0;return(0,j.jsxs)(`div`,{className:u(`group relative flex flex-row items-end`,i),children:[(0,j.jsxs)(`button`,{type:`button`,onClick:n,className:u(`group/image relative overflow-hidden rounded-xl border border-border/80 bg-background shadow-sm`,l?`min-w-[80px]`:`min-w-[200px]`),children:[c?(0,j.jsx)(`img`,{src:c,alt:e.displayName,className:u(`rounded-xl object-contain bg-muted`,l?`min-h-[50px] min-w-[80px] max-h-[120px] max-w-[200px]`:`min-h-[100px] min-w-[200px] max-h-[300px] max-w-[300px]`)}):(0,j.jsx)(`div`,{className:u(`flex items-center justify-center rounded-xl bg-muted text-muted-foreground`,l?`min-h-[64px] min-w-[80px]`:`min-h-[160px] min-w-[200px]`),children:(0,j.jsx)(mt,{className:u(l?`size-6`:`size-8`)})}),(0,j.jsxs)(`div`,{className:u(`pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/75 via-black/30 to-transparent text-left opacity-0 transition-opacity duration-200 group-hover/image:opacity-100`,l?`px-2.5 pb-2 pt-6`:`px-4 pb-3 pt-10`),children:[(0,j.jsx)(`div`,{className:u(`truncate font-medium text-white`,l?`text-xs`:`text-sm`),children:e.displayName}),(0,j.jsxs)(`div`,{className:`truncate text-xs text-white/80`,children:[e.mimeType,` · `,R(e.size)]})]})]}),d?(0,j.jsx)(wn,{progress:o??null,onCancel:s,size:l?`sm`:`md`,cancelLabel:`Cancel upload of ${e.displayName}`}):null,r&&!d?(0,j.jsx)(Xn,{displayName:e.displayName,onRemove:r}):null]})}function L({attachment:e,onClick:t,onRemove:n,className:r,uploadProgress:i,onCancelUpload:a,href:o,download:s,meta:c,ariaLabel:l,disabledReason:d}){let f=Zn(e.kind===`mention`?`text`:k(e)),p=e.kind===`mention`,m=p?Jn(e.displayName):e.displayName,h=p?Yn(e.displayName):``,g=i!==void 0,_=!!d,v=u(`flex w-[200px] items-center gap-2 rounded-xl border border-border bg-background p-1 pr-3 text-left transition-colors`,_?`cursor-not-allowed opacity-60`:`hover:bg-accent/50`),y;y=p?(0,j.jsx)(`div`,{className:`max-w-[150px] truncate text-xs text-muted-foreground`,children:h?`@${h}`:`@mention`}):d?(0,j.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:d}):c===void 0?(0,j.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[e.mimeType,` · `,R(e.size)]}):(0,j.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:c});let b=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`flex min-h-10 min-w-10 items-center justify-center rounded-lg border border-border bg-muted text-muted-foreground`,children:(0,j.jsx)(Mn,{icon:f,className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:u(`max-w-[150px] truncate text-13 font-medium`,_?`text-muted-foreground line-through`:`text-foreground`),children:m}),y]})]});return(0,j.jsxs)(`div`,{className:u(`group relative`,r),children:[o&&!_?(0,j.jsx)(`a`,{href:o,download:s,rel:`noopener`,"aria-label":l,className:v,children:b}):(0,j.jsx)(`button`,{type:`button`,onClick:_?void 0:t,"aria-label":l,"aria-disabled":_||void 0,disabled:_,className:v,children:b}),g?(0,j.jsx)(wn,{progress:i??null,onCancel:a,size:`sm`,cancelLabel:`Cancel upload of ${e.displayName}`}):null,n&&!g?(0,j.jsx)(Xn,{displayName:e.displayName,onRemove:n}):null]})}function Jn(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function Yn(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(0,n):``}function Xn({displayName:e,onRemove:t}){return(0,j.jsx)(`button`,{type:`button`,className:`absolute right-2 top-2 rounded-full bg-background/90 p-1 text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":`Remove ${e}`,children:(0,j.jsx)(Ye,{className:`h-3.5 w-3.5`})})}function Zn(e){switch(e){case`image`:return mt;case`pdf`:return It;case`markdown`:return Bt;case`json`:return ct;case`table`:return bt;case`code`:return ut;case`text`:return St;case`archive`:return ot;case`audio`:return ft;case`video`:return wt;default:return Ot}}function R(e){return e<1024?`${e} B`:e<1048576?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1048576).toFixed(1)} MB`}function Qn({source:e}){return(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center overflow-auto`,children:(0,j.jsx)(`img`,{src:e.contentUrl,alt:e.altText??e.displayName,className:`max-h-[80dvh] w-auto max-w-full rounded-2xl object-contain`,style:{touchAction:`pinch-zoom`}})})}function $n({source:e}){return(0,j.jsxs)(`div`,{className:`flex h-full flex-col gap-2`,children:[(0,j.jsx)(`iframe`,{src:e.contentUrl,title:e.displayName,sandbox:``,className:`hidden md:block h-[75dvh] w-full rounded-xl border border-border bg-background`}),(0,j.jsx)(`a`,{href:e.contentUrl,target:`_blank`,rel:`noopener noreferrer`,className:`md:hidden inline-flex items-center justify-center rounded-xl border border-border bg-muted px-3 py-2 text-sm`,children:`Open PDF externally`})]})}var er=/<thinking>([\s\S]*?)<\/thinking>/gi;function tr(e){let t=[],n=0;er.lastIndex=0;let r;for(;(r=er.exec(e))!==null;){if(r.index>n){let i=e.slice(n,r.index);i.length>0&&t.push({kind:`text`,content:i})}t.push({kind:`thinking`,content:r[1]??``}),n=r.index+r[0].length}let i=e.slice(n),a=i.search(/<thinking>/i);if(a!==-1){let e=i.slice(0,a);e.length>0&&t.push({kind:`text`,content:e});let n=i.slice(a+10);t.push({kind:`thinking`,content:n})}else i.length>0&&t.push({kind:`text`,content:i});return nr(t)}function nr(e){let t=[];for(let n of e){let e=t[t.length-1];n.kind===`text`&&e&&e.kind===`text`?e.content+=n.content:t.push(n)}return t}var rr=/^[ \t]*(`{3,}|~{3,})/,ir=/https?:\/\/[^\s<>)\]'"]+/g,ar=/(?<![a-zA-Z0-9_])((?:PR|pull\s+request|merge\s+request|MR|issue|fix(?:es|ed)?|close[sd]?|resolve[sd]?|bug|task|ticket|story)\s+)?#(\d+)/gi,or=/[.,;:!?)\]]+$/;function sr(e){if(!e.includes(`#`)||!e.includes(`http`))return e;let t=e.split(`
@@ -7,5 +7,5 @@ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtp
7
7
  `):e}function cr(e){if(!e.includes(`#`)||!e.includes(`http`))return e;let t=[],n=new RegExp(ir.source,`g`),r;for(;(r=n.exec(e))!==null;){let e=r[0],n=e.match(or);n&&(e=e.slice(0,-n[0].length)),t.push({start:r.index,end:r.index+e.length,url:e})}if(t.length===0)return e;let i=[],a=new RegExp(ar.source,`gi`);for(;(r=a.exec(e))!==null;){let t=e.slice(0,r.index);t.lastIndexOf(`[`)>t.lastIndexOf(`]`)||i.push({start:r.index,end:r.index+r[0].length,full:r[0],num:r[2]??``})}if(i.length===0)return e;let o=new Map;for(let n of i){let r=t.find(e=>{try{let{pathname:t,search:r}=new URL(e.url),i=t+r;return RegExp(`(?:/|\\.|-|=)${n.num}(?:[/?&#]|$)`).test(i)}catch{return!1}});if(r){o.set(n.start,r.url);continue}let i=t.find(e=>e.start>n.end);if(i){let t=e.slice(n.end,i.start);!/[.!?]\s/.test(t)&&t.length<200&&o.set(n.start,i.url)}}if(o.size===0)return e;let s=i.filter(e=>o.has(e.start)).sort((e,t)=>t.start-e.start),c=e;for(let e of s){let t=o.get(e.start);c=`${c.slice(0,e.start)}[${e.full}](${t})${c.slice(e.end)}`}return c}var lr=E(`ThinkingBlock`,()=>e=>({expanded:!1,setExpanded:t=>e({expanded:t})}));function ur({content:e}){let t=lr.useScopedStore(e=>e.expanded),n=lr.useScopedStore(e=>e.setExpanded),r=e.trim();return r.length===0?null:(0,j.jsxs)(`div`,{className:`my-3 first:mt-0 last:mb-0`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),"aria-expanded":t,className:`group/thinking flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:[(0,j.jsx)(de,{className:`h-3.5 w-3.5`}),(0,j.jsx)(`span`,{className:`font-medium tracking-wider`,children:`Thinking`}),(0,j.jsx)(He,{className:u(`h-3.5 w-3.5 transition-transform duration-200`,t&&`rotate-90`)})]}),t&&(0,j.jsx)(`div`,{className:`mt-2 border-l-2 border-muted-foreground/20 pl-3 text-sm text-muted-foreground italic prose prose-sm dark:prose-invert max-w-[70ch]`,children:Me(r)})]})}var dr=(0,P.memo)(({content:e})=>(0,j.jsx)(lr.Provider,{init:void 0,children:(0,j.jsx)(ur,{content:e})})),fr=class e extends x{__mentionKind;__value;__label;__dom;constructor(e,t,n,r,i=a){super(r),this.__mentionKind=e,this.__value=t,this.__label=n,this.__dom=i}static getType(){return`kanna-mention`}static clone(t){return new e(t.__mentionKind,t.__value,t.__label,t.__key,t.__dom)}static importJSON(e){return pr({mentionKind:e.mentionKind,value:e.value,label:e.label})}exportJSON(){return{type:e.getType(),version:1,mentionKind:this.__mentionKind,value:this.__value,label:this.__label}}createDOM(e,t){let n=this.__dom.createElement(`span`);return n.dataset.lexicalDecorator=`true`,n}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return this.__mentionKind===`agent`?`@agent/${this.__value}`:this.__mentionKind===`project`?`@project/${this.__value}`:`@${this.__value}`}decorate(e,t){let n=this.__label;return this.__mentionKind===`agent`?(0,j.jsx)(`span`,{className:u(`inline-flex items-center rounded px-1 text-sm`,`bg-primary/10 text-primary border border-primary/20`),children:n}):this.__mentionKind===`project`?(0,j.jsx)(`span`,{className:u(`inline-flex items-center rounded px-1 text-sm font-mono`,`bg-accent text-accent-foreground border border-border`),children:n}):(0,j.jsx)(`span`,{className:u(`inline-flex items-center rounded px-1 text-sm`,`bg-muted text-muted-foreground border border-border`),children:n})}};function pr(e){return S(new fr(e.mentionKind,e.value,e.label))}var mr=class e extends x{__commandName;__hasArgument;__dom;constructor(e,t,n,r=a){super(n),this.__commandName=e,this.__hasArgument=t,this.__dom=r}static getType(){return`kanna-slash-command`}static clone(t){return new e(t.__commandName,t.__hasArgument,t.__key,t.__dom)}static importJSON(e){return hr({commandName:e.commandName,hasArgument:e.hasArgument})}exportJSON(){return{type:e.getType(),version:1,commandName:this.__commandName,hasArgument:this.__hasArgument}}createDOM(e,t){let n=this.__dom.createElement(`span`);return n.dataset.lexicalDecorator=`true`,n}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return this.__hasArgument?`/${this.__commandName} `:`/${this.__commandName}`}decorate(e,t){return(0,j.jsx)(`span`,{className:u(`inline-flex items-center rounded px-1 text-sm font-mono`,`bg-muted text-muted-foreground border border-border`),children:`/${this.__commandName}`})}};function hr(e){return S(new mr(e.commandName,e.hasArgument))}var gr=class e extends x{__attachment;__dom;static getType(){return`kanna-attachment`}static clone(t){return new e(t.__attachment,t.__key,t.__dom)}static importJSON(e){return _r(e.attachment)}constructor(e,t,n=a){super(t),this.__attachment=e,this.__dom=n}getAttachment(){return this.getLatest().__attachment}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return``}createDOM(e,t){return this.__dom.createElement(`span`)}updateDOM(){return!1}exportJSON(){return{type:e.getType(),version:1,attachment:this.__attachment}}decorate(e,t){let n=this.getLatest().__attachment;return n.kind===`image`&&n.contentUrl?(0,j.jsx)(qn,{attachment:n,size:`composer`}):(0,j.jsx)(L,{attachment:n})}};function _r(e){return S(new gr(e))}function vr(){return h(gr)}var yr=.25,br=8,xr=.25;function Sr(e){return Math.min(br,Math.max(yr,e))}function Cr(){return e=>({scale:1,offset:{x:0,y:0},drag:null,zoomIn:()=>e(e=>{let t=Sr(e.scale+xr);return t===e.scale?e:{scale:t}}),zoomOut:()=>e(e=>{let t=Sr(e.scale-xr);return t===e.scale?e:{scale:t}}),resetView:()=>e({scale:1,offset:{x:0,y:0}}),beginDrag:(t,n)=>e(e=>({drag:{x:t-e.offset.x,y:n-e.offset.y}})),dragTo:(t,n)=>e(e=>e.drag?{offset:{x:t-e.drag.x,y:n-e.drag.y}}:e),endDrag:()=>e({drag:null})})}var z=E(`MermaidZoomModal`,Cr),wr=e(n(),1);function Tr({svg:e,onClose:t,ports:n}){let r=n?.dom??a,i=z.useScopedStore(e=>e.scale),o=z.useScopedStore(e=>e.offset),s=z.useScopedStore(e=>e.zoomIn),c=z.useScopedStore(e=>e.zoomOut),u=z.useScopedStore(e=>e.resetView),d=z.useScopedStore(e=>e.beginDrag),f=z.useScopedStore(e=>e.dragTo),p=z.useScopedStore(e=>e.endDrag);return(0,P.useEffect)(()=>r.addWindowListener(`keydown`,e=>{e.key===`Escape`&&t()}),[t,r]),(0,wr.createPortal)((0,j.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex flex-col bg-background/95`,role:`dialog`,"aria-modal":`true`,"aria-label":`Diagram zoom view`,children:[(0,j.jsxs)(`div`,{className:`flex justify-end gap-1 p-2`,children:[(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":`Zoom out`,className:`h-9 w-9`,onClick:c,children:(0,j.jsx)(We,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":`Zoom in`,className:`h-9 w-9`,onClick:s,children:(0,j.jsx)(qe,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":`Reset view`,className:`h-9 w-9`,onClick:u,children:(0,j.jsx)(Rt,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`h-9 w-9`,onClick:t,children:(0,j.jsx)(Ye,{className:`h-4 w-4`})})]}),(0,j.jsx)(`div`,{className:`flex-1 overflow-hidden touch-none cursor-grab active:cursor-grabbing`,onPointerDown:e=>d(e.clientX,e.clientY),onPointerMove:e=>f(e.clientX,e.clientY),onPointerUp:p,onPointerLeave:p,children:(0,j.jsx)(`div`,{"data-mermaid-stage":!0,className:`w-full h-full flex items-center justify-center`,style:{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`},dangerouslySetInnerHTML:{__html:e}})})]}),r.getBodyElement())}function Er({svg:e,onClose:t,ports:n}){return(0,j.jsx)(z.Provider,{init:void 0,children:(0,j.jsx)(Tr,{svg:e,onClose:t,ports:n})})}var B=E(`MermaidDiagram`,()=>e=>({renderState:{status:`loading`},showSource:!1,zoomOpen:!1,copied:!1,setRenderState:t=>e({renderState:t}),setShowSource:t=>e({showSource:t}),setZoomOpen:t=>e({zoomOpen:t}),setCopied:t=>e({copied:t})})),Dr=/error on line (\d+)\s*[.:]?\s*(.*)$/i,Or=/^[\s-]*\^\s*$/;function kr(e){return e.map(e=>e.trim()).filter(e=>e.length>0).join(` `)}function Ar(e){let t=e.trim();if(t.length===0)return{line:null,summary:`Unknown error`,excerpt:null};let n=t.split(`
8
8
  `),r=n.findIndex(e=>Dr.test(e)),i=r===-1?null:Dr.exec(n[r]??``);if(i===null)return{line:null,summary:kr(n),excerpt:null};let a=Number(i[1]),o=n.slice(r+1),s=o.findIndex(e=>Or.test(e)),c=s===-1?null:o.slice(0,s+1).join(`
9
9
  `),l=s===-1?o:o.slice(s+1),u=kr([i[2]??``,...l]);return{line:Number.isInteger(a)?a:null,summary:u.length>0?u:`Parse error on line ${String(a)}`,excerpt:c}}var jr=[{from:`-.x`,to:`-.-x`},{from:`-.o`,to:`-.-o`}],V={"[":`]`,"(":`)`,"{":`}`};function Mr(e){let t=[],n=``,r=1,i=0,a=!1,o=!1,s=!1,c=[];for(;i<e.length;){let l=e[i]??``;if(l===`
10
- `){o=!1,s=!1,a=!1,c.length=0,r+=1,n+=l,i+=1;continue}if(o){n+=l,i+=1;continue}if(a){l===`"`&&(a=!1),n+=l,i+=1;continue}if(l===`"`){a=!0,n+=l,i+=1;continue}if(e.startsWith(`%%`,i)){o=!0,n+=`%%`,i+=2;continue}if(c.length>0){l===c[c.length-1]?c.pop():V[l]&&c.push(V[l]),n+=l,i+=1;continue}if(V[l]){c.push(V[l]),n+=l,i+=1;continue}if(l===`|`){s=!s,n+=l,i+=1;continue}if(s){n+=l,i+=1;continue}let u=jr.find(t=>e.startsWith(t.from,i));if(u){n+=u.to,t.push({line:r,from:u.from,to:u.to}),i+=u.from.length;continue}n+=l,i+=1}return{source:n,repairs:t}}var Nr=[`failed to fetch dynamically imported module`,`error loading dynamically imported module`,`importing a module script failed`];function Pr(e){let t=e.message.toLowerCase();return Nr.some(e=>t.includes(e))}function Fr(e){let t=null;return()=>(t||=e().catch(e=>{throw t=null,o(e)}),t)}var Ir=Fr(()=>r(()=>import(`./mermaid.core-jDbZZtuE.js`).then(e=>e.default),__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])));async function Lr(e,t,n){try{let{svg:r}=await e.render(t,n);return{svg:r,repairs:[]}}catch(r){let i=Mr(n);if(i.repairs.length===0)throw r;try{let{svg:n}=await e.render(`${t}-repaired`,i.source);return{svg:n,repairs:i.repairs}}catch{throw r}}}function Rr(e){let t=[];for(let n of e){let e=`${n.from} → ${n.to}`;t.includes(e)||t.push(e)}return t.join(`, `)}function zr({source:e,ports:t}){let{resolvedTheme:n}=$e(),r=n===`dark`?`dark`:`default`,i=B.useScopedStore(e=>e.renderState),s=i.status===`error`?i.message:void 0,c=i.status===`error`&&i.kind===`stale-chunk`,u=B.useScopedStore(e=>e.showSource),d=B.useScopedStore(e=>e.zoomOpen),f=B.useScopedStore(e=>e.copied),p=B.useScopedStore(e=>e.setRenderState),m=B.useScopedStore(e=>e.setShowSource),h=B.useScopedStore(e=>e.setZoomOpen),g=B.useScopedStore(e=>e.setCopied),_=`mermaid-${(0,P.useId)().replace(/[^a-zA-Z0-9_-]/g,``)}`,v=(0,P.useCallback)(()=>h(!1),[h]),y=async()=>{await(t?.clipboard??w).writeText(e),g(!0),(t?.timer??T).setTimeout(()=>g(!1),2e3)},b=()=>{D(`copy mermaid source`,y())},ee=t?.loadMermaid??Ir;if((0,P.useEffect)(()=>{let t=!1;return ee().then(async n=>{n.initialize({startOnLoad:!1,securityLevel:`strict`,theme:r});let{svg:i,repairs:a}=await Lr(n,_,e);t||p({status:`ready`,svg:i,repairs:a})}).catch(e=>{if(t)return;let n=o(e);if(Pr(n)){p({status:`error`,kind:`stale-chunk`});return}p({status:`error`,message:n.message})}),()=>{t=!0}},[e,r,_,p,ee]),c)return(0,j.jsxs)(`div`,{className:`my-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground mb-1`,children:[(0,j.jsx)(Ge,{className:`size-3.5 shrink-0`}),(0,j.jsx)(`span`,{children:`This diagram needs the latest version of the app.`}),(0,j.jsxs)(l,{variant:`ghost`,size:`sm`,"aria-label":`Reload the app`,className:`h-6 px-2 text-xs`,onClick:()=>(t?.dom??a).reload(),children:[(0,j.jsx)(pe,{className:`size-3 mr-1`}),`Reload`]})]}),(0,j.jsx)(I,{source:e})]});if(i.status===`error`){let t=Ar(s??``);return(0,j.jsxs)(`div`,{className:`my-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-destructive mb-1`,children:[(0,j.jsx)(Ge,{className:`size-3.5 shrink-0 mt-px`}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`span`,{children:[`Couldn't render this Mermaid diagram`,t.line===null?null:(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — line `,(0,j.jsx)(`span`,{className:`tabular-nums`,children:t.line})]})]}),(0,j.jsx)(`div`,{className:`text-muted-foreground`,children:t.summary}),t.excerpt?(0,j.jsx)(`pre`,{className:`mt-1 overflow-x-auto rounded-md border border-border bg-muted px-2 py-1 font-mono text-xs leading-snug whitespace-pre text-muted-foreground`,children:t.excerpt}):null]})]}),(0,j.jsx)(I,{source:e,highlightLine:t.line??void 0})]})}return i.status===`loading`?(0,j.jsx)(`div`,{className:`relative group/mermaid`,children:(0,j.jsx)(I,{source:e})}):u?(0,j.jsxs)(`div`,{className:`relative group/mermaid`,children:[(0,j.jsx)(I,{source:e}),(0,j.jsx)(Vr,{showSource:u,onToggleSource:()=>m(!u),onCopy:b,copied:f,onZoom:void 0})]}):(0,j.jsxs)(`div`,{className:`relative group/mermaid my-3`,children:[i.repairs.length>0&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-muted-foreground mb-1`,children:[(0,j.jsx)(Xt,{className:`size-3.5 shrink-0 mt-px`}),(0,j.jsxs)(`span`,{children:[`Corrected `,(0,j.jsx)(`span`,{className:`tabular-nums`,children:i.repairs.length}),i.repairs.length===1?` invalid link`:` invalid links`,` to render this (`,(0,j.jsx)(`span`,{className:`font-mono`,children:Rr(i.repairs)}),`). The source is unchanged.`]})]}),(0,j.jsx)(`div`,{className:`flex justify-center overflow-x-auto`,dangerouslySetInnerHTML:{__html:i.svg}}),(0,j.jsx)(Vr,{showSource:u,onToggleSource:()=>m(!u),onCopy:b,copied:f,onZoom:()=>h(!0)}),d&&(0,j.jsx)(Er,{svg:i.svg,onClose:v})]})}function Br({source:e,ports:t}){return(0,j.jsx)(B.Provider,{init:void 0,children:(0,j.jsx)(zr,{source:e,ports:t})})}function Vr({showSource:e,onToggleSource:t,onCopy:n,copied:r,onZoom:i}){return(0,j.jsxs)(`div`,{className:`absolute top-1.5 right-1.5 flex gap-1 opacity-100 md:opacity-0 md:group-hover/mermaid:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100`,children:[i&&!e&&(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":`Zoom diagram`,className:`h-8 w-8 rounded-md text-muted-foreground hover:text-foreground`,onClick:i,children:(0,j.jsx)(Mt,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":e?`View rendered diagram`:`View diagram source`,className:`h-8 w-8 rounded-md text-muted-foreground hover:text-foreground`,onClick:t,children:(0,j.jsx)(Ve,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":r?`Copied`:`Copy diagram source`,className:u(`h-8 w-8 rounded-md text-muted-foreground`,!r&&`hover:text-foreground`,r&&`hover:!bg-transparent`),onClick:n,children:r?(0,j.jsx)(C,{className:`h-4 w-4 text-success-text`}):(0,j.jsx)(Be,{className:`h-4 w-4`})})]})}var H=class e extends x{__source;__dom;constructor(e,t,n=a){super(t),this.__source=e,this.__dom=n}static getType(){return`kanna-mermaid`}static clone(t){return new e(t.__source,t.__key,t.__dom)}static importJSON(e){return Hr(e.source)}exportJSON(){return{type:e.getType(),version:1,source:this.__source}}createDOM(e,t){return this.__dom.createElement(`div`)}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__source}decorate(e,t){return(0,j.jsx)(Br,{source:this.__source})}};function Hr(e){return S(new H(e))}function Ur(e){return e instanceof H}function Wr(e,t=28){if(e.length<=t)return e;let n=e.lastIndexOf(`.`),r=n>0&&e.length-n<=6,i=r?e.slice(n):``,a=r?e.slice(0,n):e,o=t-1-i.length;if(o<=2){let n=t-1,r=Math.ceil(n/2),i=Math.floor(n/2);return`${e.slice(0,r)}…${e.slice(e.length-i)}`}let s=Math.ceil(o/2),c=o-s;return`${a.slice(0,s)}…${a.slice(a.length-c)}${i}`}var Gr=new Set(`.c,.cc,.cfg,.conf,.cpp,.cs,.css,.diff,.env,.go,.graphql,.h,.hpp,.html,.ini,.java,.js,.json,.jsonc,.jsx,.kt,.log,.lua,.md,.mjs,.patch,.php,.pl,.properties,.py,.rb,.rs,.scss,.sh,.sql,.swift,.toml,.ts,.tsx,.txt,.vue,.xml,.yaml,.yml,.zsh`.split(`,`)),Kr=new Set([`.gitignore`,`.npmrc`,`.prettierrc`,`.python-version`,`.ruby-version`,`.tool-versions`,`Dockerfile`,`Gemfile`,`Makefile`,`Procfile`]);function U(e){if(!e)return;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function qr(e){let t=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(e);if(t?.groups?.path)return{path:t.groups.path,line:U(t.groups.line),column:U(t.groups.column)};let n=/^(?<path>\/.+?):(?<line>\d+)(?::(?<column>\d+))?$/.exec(e);return n?.groups?.path?{path:n.groups.path,line:U(n.groups.line),column:U(n.groups.column)}:e.startsWith(`/`)?{path:e}:null}function Jr(e,t=a){if(!e)return null;let n=e.trim();if(!n||/^(mailto:|ftp:|file:)/i.test(n))return null;if(/^https?:/i.test(n))try{let e=new URL(n);return e.origin!==t.getOrigin()||!e.pathname.startsWith(`/`)?null:qr(`${e.pathname}${e.hash}`)}catch{return null}return qr(n)}function Yr(e){let t=e.split(/[\\/]/);for(;t.length>0&&t[t.length-1]===``;)t.pop();return t.length>0?t[t.length-1]:e}function Xr(e){let t=Yr(e);if(Kr.has(t))return!0;let n=t.lastIndexOf(`.`);if(n<0)return!0;let r=t.slice(n).toLowerCase();return Gr.has(r)}var Zr=[`/Users/`,`/home/`,`/private/`,`/tmp/`,`/var/`,`/opt/`,`/root/`];function Qr(e){return e?e.startsWith(`file://`)?!0:Zr.some(t=>e.startsWith(t)):!1}function $r(e){let t=e;if(t.startsWith(`file://`))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.slice(7)}return`/api/local-file?path=${encodeURIComponent(t)}`}function ei(e,t){if(!e)return``;if(t){let n=t.endsWith(`/`)?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return``}return e.replace(/^\/home\/user\/workspace\//,``)}function ti(e,t){return{id:e.id,contentUrl:e.contentUrl,displayName:e.displayName,fileName:e.displayName,relativePath:e.relativePath,mimeType:e.mimeType,size:e.size,origin:t}}var W=E(`LocalFileLinkCard`,()=>e=>({probe:{kind:`loading`},previewOpen:!1,setProbe:t=>e({probe:t}),setPreviewOpen:t=>e({previewOpen:t})}));function ni(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function ri({path:e,linkText:t}){let n=(0,P.useMemo)(()=>$r(e),[e]),r=W.useScopedStore(e=>e.probe),i=W.useScopedStore(e=>e.previewOpen),a=W.useScopedStore(e=>e.setProbe),o=W.useScopedStore(e=>e.setPreviewOpen);(0,P.useEffect)(()=>{let e=new AbortController;return D(`probe local file link`,Zt(n,{signal:e.signal}).then(t=>{e.signal.aborted||a(t)})),()=>e.abort()},[n,a]);let s=ni(e),c=t||s,l=Wr(c,28),u=r.kind===`ready`?r.mimeType:`application/octet-stream`,d=r.kind===`ready`?r.size:0,f={id:`local-file-${n}`,kind:`file`,displayName:l,absolutePath:e,relativePath:e,contentUrl:n,mimeType:u,size:d};if(r.kind===`missing`)return(0,j.jsx)(`span`,{className:`inline-flex align-bottom`,"data-testid":`local-file-link`,children:(0,j.jsx)(L,{attachment:f,disabledReason:`File no longer available`})});let p=cn(k(f),u),m=d>0?R(d):null,h=r.kind===`loading`,g=r.kind===`error`,_;_=h?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`Fetching…`}):g?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`Unable to load`}):(0,j.jsxs)(j.Fragment,{children:[p,m?(0,j.jsxs)(j.Fragment,{children:[` · `,(0,j.jsx)(`span`,{className:`tabular-nums`,children:m})]}):null]});let v=r.kind===`ready`?on(f):null,y=v!==null&&!v.openInNewTab,b=[y?`Preview`:`Download`,c,p,m].filter(e=>!!e);return y?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`inline-flex align-bottom`,"data-testid":`local-file-link`,children:(0,j.jsx)(L,{attachment:f,onClick:()=>o(!0),meta:_,ariaLabel:b.join(`, `)})}),(0,j.jsx)(Gi,{source:i?ti(f,`local_file_link`):null,open:i,onOpenChange:o})]}):(0,j.jsx)(`span`,{className:`inline-flex align-bottom`,"data-testid":`local-file-link`,children:(0,j.jsx)(L,{attachment:f,href:n,download:s,meta:_,ariaLabel:b.join(`, `)})})}function ii({path:e,linkText:t}){return(0,j.jsx)(W.Provider,{init:void 0,children:(0,j.jsx)(ri,{path:e,linkText:t})})}var G=class e extends x{__path;__line;__column;__dom;constructor(e,t,n,r,i=a){super(r),this.__path=e,this.__line=t,this.__column=n,this.__dom=i}static getType(){return`kanna-local-file-link`}static clone(t){return new e(t.__path,t.__line,t.__column,t.__key,t.__dom)}static importJSON(e){return ai({path:e.path,line:e.line,column:e.column})}exportJSON(){let t={type:e.getType(),version:1,path:this.__path};return this.__line!==void 0&&(t.line=this.__line),this.__column!==void 0&&(t.column=this.__column),t}createDOM(e,t){return this.__dom.createElement(`span`)}updateDOM(){return!1}isInline(){return!0}getTextContent(){return this.__path}decorate(e,t){let n=this.__line===void 0?void 0:`${this.__path}:${this.__line}${this.__column===void 0?``:`:${this.__column}`}`;return(0,j.jsx)(ii,{path:this.__path,linkText:n})}};function ai(e){return S(new G(e.path,e.line,e.column))}function oi(e){return e instanceof G}var si=class e extends x{__content;__dom;constructor(e,t,n=a){super(t),this.__content=e,this.__dom=n}static getType(){return`kanna-thinking`}static clone(t){return new e(t.__content,t.__key,t.__dom)}static importJSON(e){return ci(e.content)}exportJSON(){return{type:e.getType(),version:1,content:this.__content}}createDOM(e,t){return this.__dom.createElement(`div`)}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__content}decorate(e,t){return(0,j.jsx)(dr,{content:this.__content})}};function ci(e){return S(new si(e))}var li=[fr,mr,gr],ui=[H,je,G,si],di={type:`multiline-element`,dependencies:[H],regExpStart:Te,regExpEnd:{optional:!0,regExp:_e},handleImportAfterStartMatch({lines:e,rootNode:t,startLineIndex:n,startMatch:r}){let{source:i,lastLineIndex:a}=Ne(e,n,r[1]??"```");return t.append(Hr(i)),[!0,a]},replace(e,t,n,r,i,a){return!1},export(e){return e instanceof H?`\`\`\`mermaid\n${e.getTextContent()}\n\`\`\``:null}},fi=`(?:file://|/(?:Users|home|private|tmp|var|opt|root)/)`,pi=RegExp(`\\[(.+?)\\]\\((${fi}[^)\\s]*)\\)`),mi=RegExp(`\\[([^[\\]]+)\\]\\((${fi}[^)\\s]*)\\)$`),hi=[di,he,Se,{type:`text-match`,dependencies:[G],importRegExp:pi,regExp:mi,trigger:`)`,replace(e,t){let n=t[2];if(!n)return;let r=Jr(n);if(!r||!Qr(r.path)&&!n.startsWith(`/`))return;let i=ai({path:r.path,line:r.line,column:r.column});e.replace(i)},export(e){if(!(e instanceof G))return null;let t=e.getTextContent();return`[${t}](${t})`}},...ve],gi=[ce,ge,y,le,ae,ne,Ce,we,Pe,me,ke,...ui],_i=0;function K(){return String(_i++)}var q=null,J=null,vi={h1:`text-20 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h2:`text-18 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h3:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h4:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h5:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h6:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`};function yi(e){if((Ur(e)||Oe(e))&&q&&J||oi(e)&&q&&J)return(0,j.jsx)(`span`,{children:e.decorate(q,J)},K());if(v(e)){let t=e.getTag(),n=Y(e),r=vi[t]??vi.h1,i=K();switch(t){case`h1`:return(0,j.jsx)(`h1`,{className:r,children:n},i);case`h2`:return(0,j.jsx)(`h2`,{className:r,children:n},i);case`h3`:return(0,j.jsx)(`h3`,{className:r,children:n},i);case`h4`:return(0,j.jsx)(`h4`,{className:r,children:n},i);case`h5`:return(0,j.jsx)(`h5`,{className:r,children:n},i);default:return(0,j.jsx)(`h6`,{className:r,children:n},i)}}if(Le(e))return(0,j.jsx)(`blockquote`,{className:`my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground`,children:Y(e)},K());if(ue(e))return(0,j.jsx)(`p`,{className:`break-words mt-5 mb-3 first:mt-0 last:mb-0`,children:Y(e)},K());if(ee(e)){let t=e.getLanguage()??``,n=e.getChildren().map(e=>Fe(e)||se(e)?e.getTextContent():re(e)?`
11
- `:``).join(``);return(0,j.jsx)(De,{source:n,lang:t},K())}if(oe(e)){let t=e.getListType(),n=Y(e),r=K();return t===`number`?(0,j.jsx)(`ol`,{className:`list-decimal ml-5 my-2`,children:n},r):(0,j.jsx)(`ul`,{className:`list-disc ml-5 my-2`,children:n},r)}if(b(e)){let t=e.getChecked(),n=Y(e),r=K();return t===void 0?(0,j.jsx)(`li`,{className:`my-0.5`,children:n},r):(0,j.jsxs)(`li`,{className:`my-0.5 list-none flex items-start gap-1.5`,children:[(0,j.jsx)(`input`,{type:`checkbox`,readOnly:!0,checked:t,className:`mt-[3px] shrink-0`}),(0,j.jsx)(`span`,{children:n})]},r)}if(g(e)||ie(e)){let t=e.getURL();return(0,j.jsx)(`a`,{href:t,className:`transition-colors underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40`,target:`_blank`,rel:`noopener noreferrer`,children:Y(e)},K())}if(xe(e)){let t=e.getChildren(),n=t[0],r=n!==void 0&&Ee(n)&&n.getChildren().every(e=>ye(e)&&(e.getHeaderStyles()&be.ROW)!==0),i=r?n:void 0,a=r?t.slice(1):t;return(0,j.jsx)(`div`,{className:`border border-border rounded-xl overflow-x-auto`,children:(0,j.jsxs)(`table`,{className:`table-auto min-w-full divide-y divide-border bg-background`,children:[i!==void 0&&(0,j.jsx)(`thead`,{children:(0,j.jsx)(`tr`,{children:i.getChildren().map(e=>(0,j.jsx)(`th`,{className:`text-left text-xs text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold`,children:Y(e)},K()))})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-border`,children:a.map(e=>Ee(e)?(0,j.jsx)(`tr`,{children:e.getChildren().map(e=>ye(e)?(0,j.jsx)(`td`,{className:`text-left p-2 pl-0 first:pl-3 [&_*]:font-normal`,children:Y(e)},K()):null)},K()):null)})]})},K())}if(re(e))return(0,j.jsx)(`br`,{},K());if(Fe(e))return bi(e);if(se(e))return(0,j.jsx)(`code`,{className:`break-all px-1 bg-border/60 py-0.5 rounded text-sm`,children:e.getTextContent()},K());let t=e.getTextContent();return t?(0,j.jsx)(`span`,{children:t},K()):null}function bi(e){let t=e.getFormat(),n=e.getTextContent(),r=!!(t&1),i=!!(t&2),a=!!(t&4);if(t&16)return(0,j.jsx)(`code`,{className:`break-all px-1 bg-border/60 py-0.5 rounded text-sm`,children:n},K());let o=n;return a&&(o=(0,j.jsx)(`del`,{className:`line-through`,children:o},K())),i&&(o=(0,j.jsx)(`em`,{className:`italic`,children:o},K())),r&&(o=(0,j.jsx)(`strong`,{className:`font-semibold`,children:o},K())),!r&&!i&&!a?n:o}function Y(e){return e.getChildren().map(yi)}function xi(e){let t=sr(e),n=Ae({namespace:`kanna-message-renderer`,nodes:gi,editable:!1}),r=fe(n);return r.update(()=>{Re(t,hi,void 0,!0)},{discrete:!0}),r.getEditorState().read(()=>{_i=0,q=r,J=n;let e=Ie().getChildren(),t=(0,j.jsx)(j.Fragment,{children:e.map(yi)});return q=null,J=null,t})}function Si(e){return xi(e)}function Ci(e){let t=tr(e).map((e,t)=>{if(e.kind===`thinking`)return(0,j.jsx)(dr,{content:e.content},`think-${t}`);let n=xi(e.content);return(0,j.jsx)(`span`,{children:n},`text-${t}`)});return(0,j.jsx)(j.Fragment,{children:t})}var X=new Map;function wi(e){return`${e.id}|${e.contentUrl}|${e.size??0}`}function Ti(e,t){return t.type===`setLoadState`?{...e,loadState:t.payload}:{lastKey:t.newKey,loadState:X.get(t.newKey)??{status:`loading`}}}function Z(e){let t=wi(e),n=X.get(t),[{loadState:r,lastKey:i},a]=(0,P.useReducer)(Ti,{loadState:n??{status:`loading`},lastKey:t}),o=(0,P.useRef)(t);return o.current=t,i!==t&&a({type:`resetForKey`,newKey:t}),(0,P.useEffect)(()=>{if(n&&n.status!==`loading`)return;let r=!1,i=t;return ln(e.contentUrl,en).then(e=>{if(r||o.current!==i)return;let t={status:`ready`,content:e.content,truncated:e.truncated};X.set(i,t),a({payload:t,type:`setLoadState`})}).catch(s(e=>{if(r||o.current!==i)return;let t={status:`error`,message:e.message};X.set(i,t),a({payload:t,type:`setLoadState`})})),()=>{r=!0}},[n,t,e.contentUrl]),r}function Ei({source:e}){let t=Z(e);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`div`,{className:`prose hidden`}),` Loading…`]}):t.status===`error`?(0,j.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:t.message}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`div`,{className:`prose prose-sm prose-invert max-w-none rounded-xl border border-border bg-background p-4`,children:Si(t.content)})]})}var Di=E(`TableBody`,e=>t=>({state:e.initialState,setState:e=>t({state:e})})),Q=new Map;function Oi(e){return`${e.id}|${e.contentUrl}|${e.size??0}|${e.mimeType}`}function ki({source:e}){let t=Oi(e),n=Q.get(t),r=Di.useScopedStore(e=>e.state),i=Di.useScopedStore(e=>e.setState),a=(0,P.useRef)(t);if(a.current=t,(0,P.useEffect)(()=>{if(n&&n.status!==`loading`)return;let r=e.mimeType===`text/tab-separated-values`?` `:`,`,o=!1,c=t;return ln(e.contentUrl,en).then(e=>{if(o||a.current!==c)return;let t={status:`ready`,table:dn(e.content,r),truncated:e.truncated};Q.set(c,t),i(t)}).catch(s(e=>{if(o||a.current!==c)return;let t={status:`error`,message:e.message};Q.set(c,t),i(t)})),()=>{o=!0}},[n,t,e.contentUrl,e.mimeType,i]),r.status===`loading`)return(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`table`,{className:`sr-only`}),` Loading…`]});if(r.status===`error`)return(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`table`,{className:`sr-only`}),` `,r.message]});let{table:o}=r,[c,...l]=o.rows,u=[r.truncated?`Preview truncated to 1024 KB.`:null,o.truncatedRows?`Showing first ${o.rows.length} of ${o.rowCount} rows.`:null,o.truncatedColumns?`Showing first 20 of ${o.columnCount} columns.`:null].filter(Boolean);return(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[u.length?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:u.join(` `)}):null,(0,j.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border bg-background`,children:(0,j.jsxs)(`table`,{className:`min-w-full border-collapse text-xs`,children:[c?(0,j.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,j.jsx)(`tr`,{children:c.map((e,t)=>(0,j.jsx)(`th`,{className:`border-b border-border px-3 py-2 text-left font-medium`,children:e||` `},t))})}):null,(0,j.jsx)(`tbody`,{children:l.map((e,t)=>(0,j.jsx)(`tr`,{className:`odd:bg-background even:bg-muted/20`,children:e.map((e,t)=>(0,j.jsx)(`td`,{className:`max-w-[320px] border-b border-border px-3 py-2 align-top`,children:(0,j.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e||` `})},t))},t))})]})})]})}function Ai({source:e}){let t=Oi(e),n=Q.get(t);return(0,j.jsx)(Di.Provider,{init:{initialState:n??{status:`loading`}},children:(0,j.jsx)(ki,{source:e})})}function ji({source:e}){let t=Z(e);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` Loading…`]}):t.status===`error`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` `,t.message]}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(Mi,{children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-xl border border-border bg-background p-3 text-xs`,children:t.content})]})}function Mi({children:e}){return(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:e})}function Ni({source:e}){let t=Z(e),n=(0,P.useMemo)(()=>t.status===`ready`?un(t.content):``,[t]);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` Loading…`]}):t.status===`error`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` `,t.message]}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-xl border border-border bg-background p-3 text-xs`,children:n})]})}function Pi({source:e}){return(0,j.jsxs)(`div`,{className:`flex h-full flex-col items-stretch justify-center gap-3 p-4`,children:[(0,j.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.displayName}),(0,j.jsx)(`audio`,{src:e.contentUrl,controls:!0,preload:`metadata`,className:`w-full`})]})}function Fi({source:e}){return(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center bg-black/40 p-2`,children:(0,j.jsx)(`video`,{src:e.contentUrl,controls:!0,playsInline:!0,preload:`metadata`,className:`max-h-[60dvh] w-full rounded-xl`})})}var Ii=E(`CodeBody`,()=>e=>({highlighted:null,setHighlighted:t=>e({highlighted:t})})),Li=204800;function Ri(e){let t=e.lastIndexOf(`.`);return t<0?`text`:{ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,py:`python`,go:`go`,rs:`rust`,java:`java`,rb:`ruby`,sh:`bash`,zsh:`bash`,yml:`yaml`,yaml:`yaml`,css:`css`,scss:`scss`,html:`html`,json:`json`,md:`markdown`,sql:`sql`,cpp:`cpp`,c:`c`,h:`c`,swift:`swift`,kt:`kotlin`,php:`php`,toml:`toml`}[e.slice(t+1).toLowerCase()]??`text`}function zi({source:e}){let t=Z(e),n=t.status===`ready`&&t.content.length<=Li,i=n?`${e.id}|${e.contentUrl}|${e.size??0}|${t.content.length}`:null,a=Ii.useScopedStore(e=>e.highlighted),o=Ii.useScopedStore(e=>e.setHighlighted);return(0,P.useEffect)(()=>{if(!n||t.status!==`ready`||i===null)return;let a=!1,s=i;return r(()=>import(`./dist-DLd14rxw.js`).then(e=>e.t).then(async n=>{if(a)return;let r=await n.codeToHtml(t.content,{lang:Ri(e.fileName),theme:`github-dark`});a||o({key:s,html:r})}),__vite__mapDeps([25,4,1])).catch(()=>{c.warn(`[file-preview] Shiki unavailable; falling back to plain text`)}),()=>{a=!0}},[n,i,t,e.fileName,o]),t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` Loading…`]}):t.status===`error`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` `,t.message]}):a&&a.key===i?(0,j.jsx)(`div`,{className:`overflow-x-auto p-3 text-xs`,dangerouslySetInnerHTML:{__html:a.html}}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-xl border border-border bg-background p-3 text-xs`,children:t.content})]})}function Bi({source:e}){return(0,j.jsx)(Ii.Provider,{init:void 0,children:(0,j.jsx)(zi,{source:e})})}function Vi({source:e}){let t=Z(e);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`div`,{className:`hidden`}),` Loading…`]}):t.status===`error`?(0,j.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:t.message}):(0,j.jsx)(`div`,{className:`p-4`,children:(0,j.jsx)(Br,{source:t.content})})}async function Hi(e,t={}){let n=t.dom??a,r=t.clipboard??w,i=Wi(e.contentUrl,n);if(n.isWebShareSupported())try{return await n.webShare({title:e.displayName,url:i}),`shared`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return`shared`}try{return await r.writeText(i),`copied`}catch{return`failed`}}function Ui(e,t={}){(t.dom??a).triggerDownload(e.contentUrl,e.fileName)}function Wi(e,t){return new URL(e,t.getBaseURI()||t.getHref()).toString()}var $=E(`SheetBody`,()=>e=>({dy:0,shareOutcome:null,setDy:t=>e({dy:t}),setShareOutcome:t=>e({shareOutcome:t})}));function Gi({source:e,open:t,onOpenChange:n}){let r=(0,P.useCallback)(()=>n(!1),[n]);return(0,j.jsx)(Ze,{open:t&&e!==null,onOpenChange:n,children:(0,j.jsx)(Xe,{size:`lg`,className:`inset-0 h-[100dvh] max-h-none w-full max-w-none translate-x-0 translate-y-0 rounded-none p-0 md:inset-auto md:left-1/2 md:top-1/2 md:h-auto md:max-h-[90dvh] md:w-auto md:max-w-3xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl`,children:e?(0,j.jsx)(Xi,{source:e,onClose:r}):null})})}var Ki=120,qi=.5;function Ji({startY:e,lastY:t,lastT:n,endY:r,now:i}){let a=r-e,o=Math.max(1,i-n),s=(r-t)/o;return a>Ki||s>qi}function Yi({source:e,onClose:t}){let n=Qi(e),r=$.useScopedStore(e=>e.dy),i=$.useScopedStore(e=>e.setDy),a=(0,P.useRef)(null),o=(0,P.useCallback)(e=>{a.current={y:e.clientY,lastY:e.clientY,lastT:Date.now()};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},[]),s=(0,P.useCallback)(e=>{if(!a.current)return;let t=e.clientY-a.current.y;t<0||(a.current.lastY=e.clientY,a.current.lastT=Date.now(),i(t))},[i]),c=(0,P.useCallback)(e=>{let n=a.current;a.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}n&&(Ji({startY:n.y,lastY:n.lastY,lastT:n.lastT,endY:e.clientY,now:Date.now()})?t():i(0))},[t,i]),u=m(`file.share`,e.id),d=p(u),h=$.useScopedStore(e=>e.shareOutcome),g=$.useScopedStore(e=>e.setShareOutcome),_=(0,P.useCallback)(()=>{f(u,async()=>{g(await Hi(e))})},[g,u,e]),v=(0,P.useCallback)(()=>Ui(e),[e]);return(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,style:r>0?{transform:`translateY(${r}px)`,transition:`none`}:void 0,children:[(0,j.jsxs)(`div`,{onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,className:`border-b border-border px-4 py-3 touch-none`,children:[(0,j.jsx)(`div`,{className:`mx-auto mb-2 h-1 w-12 rounded-full bg-muted md:hidden`,role:`button`,"aria-label":`Drag down to close`}),(0,j.jsx)(Qe,{className:`truncate text-base`,children:e.displayName}),(0,j.jsx)(Je,{className:`truncate text-xs`,children:n})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain touch-pan-y [-webkit-overflow-scrolling:touch]`,role:`region`,"aria-label":`File preview`,children:(0,P.createElement)(Zi(e),{source:e})},e.id),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border px-4 py-3`,children:[h===`copied`||h===`failed`?(0,j.jsx)(`span`,{role:`status`,className:`mr-auto text-xs text-muted-foreground`,children:h===`copied`?`Link copied`:`Couldn't share this file`}):null,(0,j.jsxs)(l,{type:`button`,variant:`outline`,pending:d,onClick:_,children:[d?null:(0,j.jsx)(Ht,{className:`mr-2 h-4 w-4`}),`Share`]}),e.origin===`offer_download`?(0,j.jsxs)(l,{type:`button`,onClick:v,children:[(0,j.jsx)(it,{className:`mr-2 h-4 w-4`}),`Download`]}):null]})]})}function Xi({source:e,onClose:t}){return(0,j.jsx)($.Provider,{init:void 0,children:(0,j.jsx)(Yi,{source:e,onClose:t})})}function Zi(e){let t={id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``},n=k(t);return n===`image`?Qn:n===`pdf`?$n:n===`audio`?Pi:n===`video`?Fi:n===`table`?Ai:n===`markdown`?Ei:n===`json`?Ni:n===`mermaid`?Vi:n===`code`?Bi:on(t).kind===`external`?$n:ji}function Qi(e){return`${cn(k({id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``}),e.mimeType)}${e.size?` · ${R(e.size)}`:``}`}export{jn as A,Bt as B,Hn as C,Ln as D,On as E,ln as F,ut as G,St as H,cn as I,it as K,Qt as L,N as M,k as N,Un as O,on as P,Zt as R,Fn as S,In as T,vt as U,Pt as V,gt as W,R as _,ti as a,Vn as b,ei as c,vr as d,hr as f,qn as g,L as h,li as i,kn as j,An as k,$r as l,dr as m,Si as n,Yr as o,pr as p,Ci as r,Xr as s,Gi as t,_r as u,zn as v,Nn as w,Pn as x,Mn as y,Xt as z};
10
+ `){o=!1,s=!1,a=!1,c.length=0,r+=1,n+=l,i+=1;continue}if(o){n+=l,i+=1;continue}if(a){l===`"`&&(a=!1),n+=l,i+=1;continue}if(l===`"`){a=!0,n+=l,i+=1;continue}if(e.startsWith(`%%`,i)){o=!0,n+=`%%`,i+=2;continue}if(c.length>0){l===c[c.length-1]?c.pop():V[l]&&c.push(V[l]),n+=l,i+=1;continue}if(V[l]){c.push(V[l]),n+=l,i+=1;continue}if(l===`|`){s=!s,n+=l,i+=1;continue}if(s){n+=l,i+=1;continue}let u=jr.find(t=>e.startsWith(t.from,i));if(u){n+=u.to,t.push({line:r,from:u.from,to:u.to}),i+=u.from.length;continue}n+=l,i+=1}return{source:n,repairs:t}}var Nr=[`failed to fetch dynamically imported module`,`error loading dynamically imported module`,`importing a module script failed`];function Pr(e){let t=e.message.toLowerCase();return Nr.some(e=>t.includes(e))}function Fr(e){let t=null;return()=>(t||=e().catch(e=>{throw t=null,o(e)}),t)}var Ir=Fr(()=>r(()=>import(`./mermaid.core-gRh-26W4.js`).then(e=>e.default),__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])));async function Lr(e,t,n){try{let{svg:r}=await e.render(t,n);return{svg:r,repairs:[]}}catch(r){let i=Mr(n);if(i.repairs.length===0)throw r;try{let{svg:n}=await e.render(`${t}-repaired`,i.source);return{svg:n,repairs:i.repairs}}catch{throw r}}}function Rr(e){let t=[];for(let n of e){let e=`${n.from} → ${n.to}`;t.includes(e)||t.push(e)}return t.join(`, `)}function zr({source:e,ports:t}){let{resolvedTheme:n}=$e(),r=n===`dark`?`dark`:`default`,i=B.useScopedStore(e=>e.renderState),s=i.status===`error`?i.message:void 0,c=i.status===`error`&&i.kind===`stale-chunk`,u=B.useScopedStore(e=>e.showSource),d=B.useScopedStore(e=>e.zoomOpen),f=B.useScopedStore(e=>e.copied),p=B.useScopedStore(e=>e.setRenderState),m=B.useScopedStore(e=>e.setShowSource),h=B.useScopedStore(e=>e.setZoomOpen),g=B.useScopedStore(e=>e.setCopied),_=`mermaid-${(0,P.useId)().replace(/[^a-zA-Z0-9_-]/g,``)}`,v=(0,P.useCallback)(()=>h(!1),[h]),y=async()=>{await(t?.clipboard??w).writeText(e),g(!0),(t?.timer??T).setTimeout(()=>g(!1),2e3)},b=()=>{D(`copy mermaid source`,y())},ee=t?.loadMermaid??Ir;if((0,P.useEffect)(()=>{let t=!1;return ee().then(async n=>{n.initialize({startOnLoad:!1,securityLevel:`strict`,theme:r});let{svg:i,repairs:a}=await Lr(n,_,e);t||p({status:`ready`,svg:i,repairs:a})}).catch(e=>{if(t)return;let n=o(e);if(Pr(n)){p({status:`error`,kind:`stale-chunk`});return}p({status:`error`,message:n.message})}),()=>{t=!0}},[e,r,_,p,ee]),c)return(0,j.jsxs)(`div`,{className:`my-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground mb-1`,children:[(0,j.jsx)(Ge,{className:`size-3.5 shrink-0`}),(0,j.jsx)(`span`,{children:`This diagram needs the latest version of the app.`}),(0,j.jsxs)(l,{variant:`ghost`,size:`sm`,"aria-label":`Reload the app`,className:`h-6 px-2 text-xs`,onClick:()=>(t?.dom??a).reload(),children:[(0,j.jsx)(pe,{className:`size-3 mr-1`}),`Reload`]})]}),(0,j.jsx)(I,{source:e})]});if(i.status===`error`){let t=Ar(s??``);return(0,j.jsxs)(`div`,{className:`my-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-destructive mb-1`,children:[(0,j.jsx)(Ge,{className:`size-3.5 shrink-0 mt-px`}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`span`,{children:[`Couldn't render this Mermaid diagram`,t.line===null?null:(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — line `,(0,j.jsx)(`span`,{className:`tabular-nums`,children:t.line})]})]}),(0,j.jsx)(`div`,{className:`text-muted-foreground`,children:t.summary}),t.excerpt?(0,j.jsx)(`pre`,{className:`mt-1 overflow-x-auto rounded-md border border-border bg-muted px-2 py-1 font-mono text-xs leading-snug whitespace-pre text-muted-foreground`,children:t.excerpt}):null]})]}),(0,j.jsx)(I,{source:e,highlightLine:t.line??void 0})]})}return i.status===`loading`?(0,j.jsx)(`div`,{className:`relative group/mermaid`,children:(0,j.jsx)(I,{source:e})}):u?(0,j.jsxs)(`div`,{className:`relative group/mermaid`,children:[(0,j.jsx)(I,{source:e}),(0,j.jsx)(Vr,{showSource:u,onToggleSource:()=>m(!u),onCopy:b,copied:f,onZoom:void 0})]}):(0,j.jsxs)(`div`,{className:`relative group/mermaid my-3`,children:[i.repairs.length>0&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-muted-foreground mb-1`,children:[(0,j.jsx)(Xt,{className:`size-3.5 shrink-0 mt-px`}),(0,j.jsxs)(`span`,{children:[`Corrected `,(0,j.jsx)(`span`,{className:`tabular-nums`,children:i.repairs.length}),i.repairs.length===1?` invalid link`:` invalid links`,` to render this (`,(0,j.jsx)(`span`,{className:`font-mono`,children:Rr(i.repairs)}),`). The source is unchanged.`]})]}),(0,j.jsx)(`div`,{className:`flex justify-center overflow-x-auto`,dangerouslySetInnerHTML:{__html:i.svg}}),(0,j.jsx)(Vr,{showSource:u,onToggleSource:()=>m(!u),onCopy:b,copied:f,onZoom:()=>h(!0)}),d&&(0,j.jsx)(Er,{svg:i.svg,onClose:v})]})}function Br({source:e,ports:t}){return(0,j.jsx)(B.Provider,{init:void 0,children:(0,j.jsx)(zr,{source:e,ports:t})})}function Vr({showSource:e,onToggleSource:t,onCopy:n,copied:r,onZoom:i}){return(0,j.jsxs)(`div`,{className:`absolute top-1.5 right-1.5 flex gap-1 opacity-100 md:opacity-0 md:group-hover/mermaid:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100`,children:[i&&!e&&(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":`Zoom diagram`,className:`h-8 w-8 rounded-md text-muted-foreground hover:text-foreground`,onClick:i,children:(0,j.jsx)(Mt,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":e?`View rendered diagram`:`View diagram source`,className:`h-8 w-8 rounded-md text-muted-foreground hover:text-foreground`,onClick:t,children:(0,j.jsx)(Ve,{className:`h-4 w-4`})}),(0,j.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":r?`Copied`:`Copy diagram source`,className:u(`h-8 w-8 rounded-md text-muted-foreground`,!r&&`hover:text-foreground`,r&&`hover:!bg-transparent`),onClick:n,children:r?(0,j.jsx)(C,{className:`h-4 w-4 text-success-text`}):(0,j.jsx)(Be,{className:`h-4 w-4`})})]})}var H=class e extends x{__source;__dom;constructor(e,t,n=a){super(t),this.__source=e,this.__dom=n}static getType(){return`kanna-mermaid`}static clone(t){return new e(t.__source,t.__key,t.__dom)}static importJSON(e){return Hr(e.source)}exportJSON(){return{type:e.getType(),version:1,source:this.__source}}createDOM(e,t){return this.__dom.createElement(`div`)}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__source}decorate(e,t){return(0,j.jsx)(Br,{source:this.__source})}};function Hr(e){return S(new H(e))}function Ur(e){return e instanceof H}function Wr(e,t=28){if(e.length<=t)return e;let n=e.lastIndexOf(`.`),r=n>0&&e.length-n<=6,i=r?e.slice(n):``,a=r?e.slice(0,n):e,o=t-1-i.length;if(o<=2){let n=t-1,r=Math.ceil(n/2),i=Math.floor(n/2);return`${e.slice(0,r)}…${e.slice(e.length-i)}`}let s=Math.ceil(o/2),c=o-s;return`${a.slice(0,s)}…${a.slice(a.length-c)}${i}`}var Gr=new Set(`.c,.cc,.cfg,.conf,.cpp,.cs,.css,.diff,.env,.go,.graphql,.h,.hpp,.html,.ini,.java,.js,.json,.jsonc,.jsx,.kt,.log,.lua,.md,.mjs,.patch,.php,.pl,.properties,.py,.rb,.rs,.scss,.sh,.sql,.swift,.toml,.ts,.tsx,.txt,.vue,.xml,.yaml,.yml,.zsh`.split(`,`)),Kr=new Set([`.gitignore`,`.npmrc`,`.prettierrc`,`.python-version`,`.ruby-version`,`.tool-versions`,`Dockerfile`,`Gemfile`,`Makefile`,`Procfile`]);function U(e){if(!e)return;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function qr(e){let t=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(e);if(t?.groups?.path)return{path:t.groups.path,line:U(t.groups.line),column:U(t.groups.column)};let n=/^(?<path>\/.+?):(?<line>\d+)(?::(?<column>\d+))?$/.exec(e);return n?.groups?.path?{path:n.groups.path,line:U(n.groups.line),column:U(n.groups.column)}:e.startsWith(`/`)?{path:e}:null}function Jr(e,t=a){if(!e)return null;let n=e.trim();if(!n||/^(mailto:|ftp:|file:)/i.test(n))return null;if(/^https?:/i.test(n))try{let e=new URL(n);return e.origin!==t.getOrigin()||!e.pathname.startsWith(`/`)?null:qr(`${e.pathname}${e.hash}`)}catch{return null}return qr(n)}function Yr(e){let t=e.split(/[\\/]/);for(;t.length>0&&t[t.length-1]===``;)t.pop();return t.length>0?t[t.length-1]:e}function Xr(e){let t=Yr(e);if(Kr.has(t))return!0;let n=t.lastIndexOf(`.`);if(n<0)return!0;let r=t.slice(n).toLowerCase();return Gr.has(r)}var Zr=[`/Users/`,`/home/`,`/private/`,`/tmp/`,`/var/`,`/opt/`,`/root/`];function Qr(e){return e?e.startsWith(`file://`)?!0:Zr.some(t=>e.startsWith(t)):!1}function $r(e){let t=e;if(t.startsWith(`file://`))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.slice(7)}return`/api/local-file?path=${encodeURIComponent(t)}`}function ei(e,t){if(!e)return``;if(t){let n=t.endsWith(`/`)?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return``}return e.replace(/^\/home\/user\/workspace\//,``)}function ti(e,t){return{id:e.id,contentUrl:e.contentUrl,displayName:e.displayName,fileName:e.displayName,relativePath:e.relativePath,mimeType:e.mimeType,size:e.size,origin:t}}var W=E(`LocalFileLinkCard`,()=>e=>({probe:{kind:`loading`},previewOpen:!1,setProbe:t=>e({probe:t}),setPreviewOpen:t=>e({previewOpen:t})}));function ni(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function ri({path:e,linkText:t}){let n=(0,P.useMemo)(()=>$r(e),[e]),r=W.useScopedStore(e=>e.probe),i=W.useScopedStore(e=>e.previewOpen),a=W.useScopedStore(e=>e.setProbe),o=W.useScopedStore(e=>e.setPreviewOpen);(0,P.useEffect)(()=>{let e=new AbortController;return D(`probe local file link`,Zt(n,{signal:e.signal}).then(t=>{e.signal.aborted||a(t)})),()=>e.abort()},[n,a]);let s=ni(e),c=t||s,l=Wr(c,28),u=r.kind===`ready`?r.mimeType:`application/octet-stream`,d=r.kind===`ready`?r.size:0,f={id:`local-file-${n}`,kind:`file`,displayName:l,absolutePath:e,relativePath:e,contentUrl:n,mimeType:u,size:d};if(r.kind===`missing`)return(0,j.jsx)(`span`,{className:`inline-flex align-bottom`,"data-testid":`local-file-link`,children:(0,j.jsx)(L,{attachment:f,disabledReason:`File no longer available`})});let p=cn(k(f),u),m=d>0?R(d):null,h=r.kind===`loading`,g=r.kind===`error`,_;_=h?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`Fetching…`}):g?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`Unable to load`}):(0,j.jsxs)(j.Fragment,{children:[p,m?(0,j.jsxs)(j.Fragment,{children:[` · `,(0,j.jsx)(`span`,{className:`tabular-nums`,children:m})]}):null]});let v=r.kind===`ready`?on(f):null,y=v!==null&&!v.openInNewTab,b=[y?`Preview`:`Download`,c,p,m].filter(e=>!!e);return y?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`inline-flex align-bottom`,"data-testid":`local-file-link`,children:(0,j.jsx)(L,{attachment:f,onClick:()=>o(!0),meta:_,ariaLabel:b.join(`, `)})}),(0,j.jsx)(Gi,{source:i?ti(f,`local_file_link`):null,open:i,onOpenChange:o})]}):(0,j.jsx)(`span`,{className:`inline-flex align-bottom`,"data-testid":`local-file-link`,children:(0,j.jsx)(L,{attachment:f,href:n,download:s,meta:_,ariaLabel:b.join(`, `)})})}function ii({path:e,linkText:t}){return(0,j.jsx)(W.Provider,{init:void 0,children:(0,j.jsx)(ri,{path:e,linkText:t})})}var G=class e extends x{__path;__line;__column;__dom;constructor(e,t,n,r,i=a){super(r),this.__path=e,this.__line=t,this.__column=n,this.__dom=i}static getType(){return`kanna-local-file-link`}static clone(t){return new e(t.__path,t.__line,t.__column,t.__key,t.__dom)}static importJSON(e){return ai({path:e.path,line:e.line,column:e.column})}exportJSON(){let t={type:e.getType(),version:1,path:this.__path};return this.__line!==void 0&&(t.line=this.__line),this.__column!==void 0&&(t.column=this.__column),t}createDOM(e,t){return this.__dom.createElement(`span`)}updateDOM(){return!1}isInline(){return!0}getTextContent(){return this.__path}decorate(e,t){let n=this.__line===void 0?void 0:`${this.__path}:${this.__line}${this.__column===void 0?``:`:${this.__column}`}`;return(0,j.jsx)(ii,{path:this.__path,linkText:n})}};function ai(e){return S(new G(e.path,e.line,e.column))}function oi(e){return e instanceof G}var si=class e extends x{__content;__dom;constructor(e,t,n=a){super(t),this.__content=e,this.__dom=n}static getType(){return`kanna-thinking`}static clone(t){return new e(t.__content,t.__key,t.__dom)}static importJSON(e){return ci(e.content)}exportJSON(){return{type:e.getType(),version:1,content:this.__content}}createDOM(e,t){return this.__dom.createElement(`div`)}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__content}decorate(e,t){return(0,j.jsx)(dr,{content:this.__content})}};function ci(e){return S(new si(e))}var li=[fr,mr,gr],ui=[H,je,G,si],di={type:`multiline-element`,dependencies:[H],regExpStart:Te,regExpEnd:{optional:!0,regExp:_e},handleImportAfterStartMatch({lines:e,rootNode:t,startLineIndex:n,startMatch:r}){let{source:i,lastLineIndex:a}=Ne(e,n,r[1]??"```");return t.append(Hr(i)),[!0,a]},replace(e,t,n,r,i,a){return!1},export(e){return e instanceof H?`\`\`\`mermaid\n${e.getTextContent()}\n\`\`\``:null}},fi=`(?:file://|/(?:Users|home|private|tmp|var|opt|root)/)`,pi=RegExp(`\\[(.+?)\\]\\((${fi}[^)\\s]*)\\)`),mi=RegExp(`\\[([^[\\]]+)\\]\\((${fi}[^)\\s]*)\\)$`),hi=[di,he,Se,{type:`text-match`,dependencies:[G],importRegExp:pi,regExp:mi,trigger:`)`,replace(e,t){let n=t[2];if(!n)return;let r=Jr(n);if(!r||!Qr(r.path)&&!n.startsWith(`/`))return;let i=ai({path:r.path,line:r.line,column:r.column});e.replace(i)},export(e){if(!(e instanceof G))return null;let t=e.getTextContent();return`[${t}](${t})`}},...ve],gi=[ce,ge,y,le,ae,ne,Ce,we,Pe,me,ke,...ui],_i=0;function K(){return String(_i++)}var q=null,J=null,vi={h1:`text-20 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h2:`text-18 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h3:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h4:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h5:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,h6:`text-16 font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`};function yi(e){if((Ur(e)||Oe(e))&&q&&J||oi(e)&&q&&J)return(0,j.jsx)(`span`,{children:e.decorate(q,J)},K());if(v(e)){let t=e.getTag(),n=Y(e),r=vi[t]??vi.h1,i=K();switch(t){case`h1`:return(0,j.jsx)(`h1`,{className:r,children:n},i);case`h2`:return(0,j.jsx)(`h2`,{className:r,children:n},i);case`h3`:return(0,j.jsx)(`h3`,{className:r,children:n},i);case`h4`:return(0,j.jsx)(`h4`,{className:r,children:n},i);case`h5`:return(0,j.jsx)(`h5`,{className:r,children:n},i);default:return(0,j.jsx)(`h6`,{className:r,children:n},i)}}if(Le(e))return(0,j.jsx)(`blockquote`,{className:`my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground`,children:Y(e)},K());if(ue(e))return(0,j.jsx)(`p`,{className:`break-words mt-5 mb-3 first:mt-0 last:mb-0`,children:Y(e)},K());if(ee(e)){let t=e.getLanguage()??``,n=e.getChildren().map(e=>Fe(e)||se(e)?e.getTextContent():re(e)?`
11
+ `:``).join(``);return(0,j.jsx)(De,{source:n,lang:t},K())}if(oe(e)){let t=e.getListType(),n=Y(e),r=K();return t===`number`?(0,j.jsx)(`ol`,{className:`list-decimal ml-5 my-2`,children:n},r):(0,j.jsx)(`ul`,{className:`list-disc ml-5 my-2`,children:n},r)}if(b(e)){let t=e.getChecked(),n=Y(e),r=K();return t===void 0?(0,j.jsx)(`li`,{className:`my-0.5`,children:n},r):(0,j.jsxs)(`li`,{className:`my-0.5 list-none flex items-start gap-1.5`,children:[(0,j.jsx)(`input`,{type:`checkbox`,readOnly:!0,checked:t,className:`mt-[3px] shrink-0`}),(0,j.jsx)(`span`,{children:n})]},r)}if(g(e)||ie(e)){let t=e.getURL();return(0,j.jsx)(`a`,{href:t,className:`transition-colors underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40`,target:`_blank`,rel:`noopener noreferrer`,children:Y(e)},K())}if(xe(e)){let t=e.getChildren(),n=t[0],r=n!==void 0&&Ee(n)&&n.getChildren().every(e=>ye(e)&&(e.getHeaderStyles()&be.ROW)!==0),i=r?n:void 0,a=r?t.slice(1):t;return(0,j.jsx)(`div`,{className:`border border-border rounded-xl overflow-x-auto`,children:(0,j.jsxs)(`table`,{className:`table-auto min-w-full divide-y divide-border bg-background`,children:[i!==void 0&&(0,j.jsx)(`thead`,{children:(0,j.jsx)(`tr`,{children:i.getChildren().map(e=>(0,j.jsx)(`th`,{className:`text-left text-xs text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold`,children:Y(e)},K()))})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-border`,children:a.map(e=>Ee(e)?(0,j.jsx)(`tr`,{children:e.getChildren().map(e=>ye(e)?(0,j.jsx)(`td`,{className:`text-left p-2 pl-0 first:pl-3 [&_*]:font-normal`,children:Y(e)},K()):null)},K()):null)})]})},K())}if(re(e))return(0,j.jsx)(`br`,{},K());if(Fe(e))return bi(e);if(se(e))return(0,j.jsx)(`code`,{className:`break-all px-1 bg-border/60 py-0.5 rounded text-sm`,children:e.getTextContent()},K());let t=e.getTextContent();return t?(0,j.jsx)(`span`,{children:t},K()):null}function bi(e){let t=e.getFormat(),n=e.getTextContent(),r=!!(t&1),i=!!(t&2),a=!!(t&4);if(t&16)return(0,j.jsx)(`code`,{className:`break-all px-1 bg-border/60 py-0.5 rounded text-sm`,children:n},K());let o=n;return a&&(o=(0,j.jsx)(`del`,{className:`line-through`,children:o},K())),i&&(o=(0,j.jsx)(`em`,{className:`italic`,children:o},K())),r&&(o=(0,j.jsx)(`strong`,{className:`font-semibold`,children:o},K())),!r&&!i&&!a?n:o}function Y(e){return e.getChildren().map(yi)}function xi(e){let t=sr(e),n=Ae({namespace:`kanna-message-renderer`,nodes:gi,editable:!1}),r=fe(n);return r.update(()=>{Re(t,hi,void 0,!0)},{discrete:!0}),r.getEditorState().read(()=>{_i=0,q=r,J=n;let e=Ie().getChildren(),t=(0,j.jsx)(j.Fragment,{children:e.map(yi)});return q=null,J=null,t})}function Si(e){return xi(e)}function Ci(e){let t=tr(e).map((e,t)=>{if(e.kind===`thinking`)return(0,j.jsx)(dr,{content:e.content},`think-${t}`);let n=xi(e.content);return(0,j.jsx)(`span`,{children:n},`text-${t}`)});return(0,j.jsx)(j.Fragment,{children:t})}var X=new Map;function wi(e){return`${e.id}|${e.contentUrl}|${e.size??0}`}function Ti(e,t){return t.type===`setLoadState`?{...e,loadState:t.payload}:{lastKey:t.newKey,loadState:X.get(t.newKey)??{status:`loading`}}}function Z(e){let t=wi(e),n=X.get(t),[{loadState:r,lastKey:i},a]=(0,P.useReducer)(Ti,{loadState:n??{status:`loading`},lastKey:t}),o=(0,P.useRef)(t);return o.current=t,i!==t&&a({type:`resetForKey`,newKey:t}),(0,P.useEffect)(()=>{if(n&&n.status!==`loading`)return;let r=!1,i=t;return ln(e.contentUrl,en).then(e=>{if(r||o.current!==i)return;let t={status:`ready`,content:e.content,truncated:e.truncated};X.set(i,t),a({payload:t,type:`setLoadState`})}).catch(s(e=>{if(r||o.current!==i)return;let t={status:`error`,message:e.message};X.set(i,t),a({payload:t,type:`setLoadState`})})),()=>{r=!0}},[n,t,e.contentUrl]),r}function Ei({source:e}){let t=Z(e);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`div`,{className:`prose hidden`}),` Loading…`]}):t.status===`error`?(0,j.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:t.message}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`div`,{className:`prose prose-sm prose-invert max-w-none rounded-xl border border-border bg-background p-4`,children:Si(t.content)})]})}var Di=E(`TableBody`,e=>t=>({state:e.initialState,setState:e=>t({state:e})})),Q=new Map;function Oi(e){return`${e.id}|${e.contentUrl}|${e.size??0}|${e.mimeType}`}function ki({source:e}){let t=Oi(e),n=Q.get(t),r=Di.useScopedStore(e=>e.state),i=Di.useScopedStore(e=>e.setState),a=(0,P.useRef)(t);if(a.current=t,(0,P.useEffect)(()=>{if(n&&n.status!==`loading`)return;let r=e.mimeType===`text/tab-separated-values`?` `:`,`,o=!1,c=t;return ln(e.contentUrl,en).then(e=>{if(o||a.current!==c)return;let t={status:`ready`,table:dn(e.content,r),truncated:e.truncated};Q.set(c,t),i(t)}).catch(s(e=>{if(o||a.current!==c)return;let t={status:`error`,message:e.message};Q.set(c,t),i(t)})),()=>{o=!0}},[n,t,e.contentUrl,e.mimeType,i]),r.status===`loading`)return(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`table`,{className:`sr-only`}),` Loading…`]});if(r.status===`error`)return(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`table`,{className:`sr-only`}),` `,r.message]});let{table:o}=r,[c,...l]=o.rows,u=[r.truncated?`Preview truncated to 1024 KB.`:null,o.truncatedRows?`Showing first ${o.rows.length} of ${o.rowCount} rows.`:null,o.truncatedColumns?`Showing first 20 of ${o.columnCount} columns.`:null].filter(Boolean);return(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[u.length?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:u.join(` `)}):null,(0,j.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border bg-background`,children:(0,j.jsxs)(`table`,{className:`min-w-full border-collapse text-xs`,children:[c?(0,j.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,j.jsx)(`tr`,{children:c.map((e,t)=>(0,j.jsx)(`th`,{className:`border-b border-border px-3 py-2 text-left font-medium`,children:e||` `},t))})}):null,(0,j.jsx)(`tbody`,{children:l.map((e,t)=>(0,j.jsx)(`tr`,{className:`odd:bg-background even:bg-muted/20`,children:e.map((e,t)=>(0,j.jsx)(`td`,{className:`max-w-[320px] border-b border-border px-3 py-2 align-top`,children:(0,j.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e||` `})},t))},t))})]})})]})}function Ai({source:e}){let t=Oi(e),n=Q.get(t);return(0,j.jsx)(Di.Provider,{init:{initialState:n??{status:`loading`}},children:(0,j.jsx)(ki,{source:e})})}function ji({source:e}){let t=Z(e);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` Loading…`]}):t.status===`error`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` `,t.message]}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(Mi,{children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-xl border border-border bg-background p-3 text-xs`,children:t.content})]})}function Mi({children:e}){return(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:e})}function Ni({source:e}){let t=Z(e),n=(0,P.useMemo)(()=>t.status===`ready`?un(t.content):``,[t]);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` Loading…`]}):t.status===`error`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` `,t.message]}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-xl border border-border bg-background p-3 text-xs`,children:n})]})}function Pi({source:e}){return(0,j.jsxs)(`div`,{className:`flex h-full flex-col items-stretch justify-center gap-3 p-4`,children:[(0,j.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.displayName}),(0,j.jsx)(`audio`,{src:e.contentUrl,controls:!0,preload:`metadata`,className:`w-full`})]})}function Fi({source:e}){return(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center bg-black/40 p-2`,children:(0,j.jsx)(`video`,{src:e.contentUrl,controls:!0,playsInline:!0,preload:`metadata`,className:`max-h-[60dvh] w-full rounded-xl`})})}var Ii=E(`CodeBody`,()=>e=>({highlighted:null,setHighlighted:t=>e({highlighted:t})})),Li=204800;function Ri(e){let t=e.lastIndexOf(`.`);return t<0?`text`:{ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,py:`python`,go:`go`,rs:`rust`,java:`java`,rb:`ruby`,sh:`bash`,zsh:`bash`,yml:`yaml`,yaml:`yaml`,css:`css`,scss:`scss`,html:`html`,json:`json`,md:`markdown`,sql:`sql`,cpp:`cpp`,c:`c`,h:`c`,swift:`swift`,kt:`kotlin`,php:`php`,toml:`toml`}[e.slice(t+1).toLowerCase()]??`text`}function zi({source:e}){let t=Z(e),n=t.status===`ready`&&t.content.length<=Li,i=n?`${e.id}|${e.contentUrl}|${e.size??0}|${t.content.length}`:null,a=Ii.useScopedStore(e=>e.highlighted),o=Ii.useScopedStore(e=>e.setHighlighted);return(0,P.useEffect)(()=>{if(!n||t.status!==`ready`||i===null)return;let a=!1,s=i;return r(()=>import(`./dist-BdNQvasR.js`).then(e=>e.t).then(async n=>{if(a)return;let r=await n.codeToHtml(t.content,{lang:Ri(e.fileName),theme:`github-dark`});a||o({key:s,html:r})}),__vite__mapDeps([25,4,1])).catch(()=>{c.warn(`[file-preview] Shiki unavailable; falling back to plain text`)}),()=>{a=!0}},[n,i,t,e.fileName,o]),t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` Loading…`]}):t.status===`error`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-destructive`,children:[(0,j.jsx)(`pre`,{className:`sr-only`}),` `,t.message]}):a&&a.key===i?(0,j.jsx)(`div`,{className:`overflow-x-auto p-3 text-xs`,dangerouslySetInnerHTML:{__html:a.html}}):(0,j.jsxs)(`div`,{className:`space-y-2 p-3`,children:[t.truncated?(0,j.jsx)(`div`,{className:`rounded-xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground`,children:`Preview truncated to 1024 KB.`}):null,(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-xl border border-border bg-background p-3 text-xs`,children:t.content})]})}function Bi({source:e}){return(0,j.jsx)(Ii.Provider,{init:void 0,children:(0,j.jsx)(zi,{source:e})})}function Vi({source:e}){let t=Z(e);return t.status===`loading`?(0,j.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[(0,j.jsx)(`div`,{className:`hidden`}),` Loading…`]}):t.status===`error`?(0,j.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:t.message}):(0,j.jsx)(`div`,{className:`p-4`,children:(0,j.jsx)(Br,{source:t.content})})}async function Hi(e,t={}){let n=t.dom??a,r=t.clipboard??w,i=Wi(e.contentUrl,n);if(n.isWebShareSupported())try{return await n.webShare({title:e.displayName,url:i}),`shared`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return`shared`}try{return await r.writeText(i),`copied`}catch{return`failed`}}function Ui(e,t={}){(t.dom??a).triggerDownload(e.contentUrl,e.fileName)}function Wi(e,t){return new URL(e,t.getBaseURI()||t.getHref()).toString()}var $=E(`SheetBody`,()=>e=>({dy:0,shareOutcome:null,setDy:t=>e({dy:t}),setShareOutcome:t=>e({shareOutcome:t})}));function Gi({source:e,open:t,onOpenChange:n}){let r=(0,P.useCallback)(()=>n(!1),[n]);return(0,j.jsx)(Ze,{open:t&&e!==null,onOpenChange:n,children:(0,j.jsx)(Xe,{size:`lg`,className:`inset-0 h-[100dvh] max-h-none w-full max-w-none translate-x-0 translate-y-0 rounded-none p-0 md:inset-auto md:left-1/2 md:top-1/2 md:h-auto md:max-h-[90dvh] md:w-auto md:max-w-3xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl`,children:e?(0,j.jsx)(Xi,{source:e,onClose:r}):null})})}var Ki=120,qi=.5;function Ji({startY:e,lastY:t,lastT:n,endY:r,now:i}){let a=r-e,o=Math.max(1,i-n),s=(r-t)/o;return a>Ki||s>qi}function Yi({source:e,onClose:t}){let n=Qi(e),r=$.useScopedStore(e=>e.dy),i=$.useScopedStore(e=>e.setDy),a=(0,P.useRef)(null),o=(0,P.useCallback)(e=>{a.current={y:e.clientY,lastY:e.clientY,lastT:Date.now()};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},[]),s=(0,P.useCallback)(e=>{if(!a.current)return;let t=e.clientY-a.current.y;t<0||(a.current.lastY=e.clientY,a.current.lastT=Date.now(),i(t))},[i]),c=(0,P.useCallback)(e=>{let n=a.current;a.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}n&&(Ji({startY:n.y,lastY:n.lastY,lastT:n.lastT,endY:e.clientY,now:Date.now()})?t():i(0))},[t,i]),u=m(`file.share`,e.id),d=p(u),h=$.useScopedStore(e=>e.shareOutcome),g=$.useScopedStore(e=>e.setShareOutcome),_=(0,P.useCallback)(()=>{f(u,async()=>{g(await Hi(e))})},[g,u,e]),v=(0,P.useCallback)(()=>Ui(e),[e]);return(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,style:r>0?{transform:`translateY(${r}px)`,transition:`none`}:void 0,children:[(0,j.jsxs)(`div`,{onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,className:`border-b border-border px-4 py-3 touch-none`,children:[(0,j.jsx)(`div`,{className:`mx-auto mb-2 h-1 w-12 rounded-full bg-muted md:hidden`,role:`button`,"aria-label":`Drag down to close`}),(0,j.jsx)(Qe,{className:`truncate text-base`,children:e.displayName}),(0,j.jsx)(Je,{className:`truncate text-xs`,children:n})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain touch-pan-y [-webkit-overflow-scrolling:touch]`,role:`region`,"aria-label":`File preview`,children:(0,P.createElement)(Zi(e),{source:e})},e.id),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border px-4 py-3`,children:[h===`copied`||h===`failed`?(0,j.jsx)(`span`,{role:`status`,className:`mr-auto text-xs text-muted-foreground`,children:h===`copied`?`Link copied`:`Couldn't share this file`}):null,(0,j.jsxs)(l,{type:`button`,variant:`outline`,pending:d,onClick:_,children:[d?null:(0,j.jsx)(Ht,{className:`mr-2 h-4 w-4`}),`Share`]}),e.origin===`offer_download`?(0,j.jsxs)(l,{type:`button`,onClick:v,children:[(0,j.jsx)(it,{className:`mr-2 h-4 w-4`}),`Download`]}):null]})]})}function Xi({source:e,onClose:t}){return(0,j.jsx)($.Provider,{init:void 0,children:(0,j.jsx)(Yi,{source:e,onClose:t})})}function Zi(e){let t={id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``},n=k(t);return n===`image`?Qn:n===`pdf`?$n:n===`audio`?Pi:n===`video`?Fi:n===`table`?Ai:n===`markdown`?Ei:n===`json`?Ni:n===`mermaid`?Vi:n===`code`?Bi:on(t).kind===`external`?$n:ji}function Qi(e){return`${cn(k({id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``}),e.mimeType)}${e.size?` · ${R(e.size)}`:``}`}export{jn as A,Bt as B,Hn as C,Ln as D,On as E,ln as F,ut as G,St as H,cn as I,it as K,Qt as L,N as M,k as N,Un as O,on as P,Zt as R,Fn as S,In as T,vt as U,Pt as V,gt as W,R as _,ti as a,Vn as b,ei as c,vr as d,hr as f,qn as g,L as h,li as i,kn as j,An as k,$r as l,dr as m,Si as n,Yr as o,pr as p,Ci as r,Xr as s,Gi as t,_r as u,zn as v,Nn as w,Pn as x,Mn as y,Xt as z};