@kabmo-labs/kabmo 0.58.0 → 0.58.1

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 (216) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +457 -444
  3. package/dist/client/static/js/{Body-karkrzkc.js → Body-ysmhxbvk.js} +3 -3
  4. package/dist/client/static/js/{CsvGrid-j03knmbe.js → CsvGrid-w90pxyn2.js} +1 -1
  5. package/dist/client/static/js/{DocxView-e8408vzs.js → DocxView-evxn6kaq.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-fj4mfzch.js → DrawioView-tmdevwf4.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-9g8xwzgw.js → HtmlPreview-bpsn2z9p.js} +1 -1
  8. package/dist/client/static/js/{ImageView-sz4fzz9k.js → ImageView-ssazqckj.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-q6q4h04a.js → LayoutWrapper-qwpfq4dq.js} +2 -2
  10. package/dist/client/static/js/MergeDiffView-en6aazw8.js +1 -0
  11. package/dist/client/static/js/{Modal-ahecatp5.js → Modal-zjnhj9nb.js} +19 -19
  12. package/dist/client/static/js/{PdfView-8jtdx5hd.js → PdfView-txxn6qff.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-jwp8xvw5.js → SessionsView-eryjtmb2.js} +1 -1
  14. package/dist/client/static/js/{SheetView-hwx8s864.js → SheetView-52b33e6f.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-ete36nzv.js → SvgPreview-hrk4pfm1.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-7nsqzz6z.js → abnfDiagram-O67JEVCF-at77sybc.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-v05ap4e3.js +1 -0
  18. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-xvpkfq2f.js → architectureDiagram-NJMV4G6O-raw33jgg.js} +3 -3
  19. package/dist/client/static/js/{astro-rsrqgjjx.js → astro-qha7sceh.js} +1 -1
  20. package/dist/client/static/js/{blockDiagram-BEXU5L5S-0saahcs6.js → blockDiagram-BEXU5L5S-b6e90fbk.js} +6 -6
  21. package/dist/client/static/js/{c4Diagram-YGBWAQC7-ktpqnb4a.js → c4Diagram-YGBWAQC7-msg9y1c6.js} +2 -2
  22. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-x67cz3ms.js → classDiagram-v2-NBCMYWYE-jmrd1h8r.js} +5 -5
  23. package/dist/client/static/js/{cose-bilkent-JH36ORCC-9wzmhkz8.js → cose-bilkent-JH36ORCC-na65ebq3.js} +1 -1
  24. package/dist/client/static/js/css-q2k6afe3.js +1 -0
  25. package/dist/client/static/js/cynefin-OW5HDTMX-sqv0ze38.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-dmmgmv99.js → cynefinDiagram-VND7K2PF-9xkkw71m.js} +1 -1
  27. package/dist/client/static/js/{dagre-6A5THRUB-ygkkms1t.js → dagre-6A5THRUB-p59f19tv.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-qxj0pqb4.js → diagram-22UHCM2B-2e2rcvn7.js} +8 -8
  29. package/dist/client/static/js/{diagram-3UASUU5V-77k8w5dt.js → diagram-3UASUU5V-r9ds8vgr.js} +2 -2
  30. package/dist/client/static/js/{diagram-ATOU4E4O-m0h86vf4.js → diagram-ATOU4E4O-jgwxv7v8.js} +3 -3
  31. package/dist/client/static/js/{diagram-CDSNMT55-5v28kaeg.js → diagram-CDSNMT55-20m35eqq.js} +4 -4
  32. package/dist/client/static/js/{diagram-MLGK6HIB-zgcg9gaz.js → diagram-MLGK6HIB-vt3kxt2m.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-10c9s6e6.js → diagram-MPIPVDR6-c47rgxf1.js} +1 -1
  34. package/dist/client/static/js/{dockerfile-dr9sdsqp.js → dockerfile-gtcyey0q.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-mz4022dz.js → ebnfDiagram-ZINNZB2B-aszw3xy3.js} +1 -1
  36. package/dist/client/static/js/{elixir-3dy25ex8.js → elixir-w92v180e.js} +1 -1
  37. package/dist/client/static/js/{elk-276RUBZZ-ccerbsag.js → elk-276RUBZZ-gbvr3gry.js} +1 -1
  38. package/dist/client/static/js/{erDiagram-OPXOYQCR-a8vjyrrw.js → erDiagram-OPXOYQCR-1hqca8qe.js} +2 -2
  39. package/dist/client/static/js/eventmodeling-NTZA5JFV-t4dzf5s7.js +1 -0
  40. package/dist/client/static/js/flowDiagram-KWPJA3E3-c16xmjyv.js +1 -0
  41. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-sz1g29fp.js → ganttDiagram-FUAMR5RP-07v22te5.js} +2 -2
  42. package/dist/client/static/js/gitGraph-4MIJSDKK-0jq8y0qd.js +1 -0
  43. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-efqk42q0.js → gitGraphDiagram-X574FWY7-y068jtz9.js} +8 -8
  44. package/dist/client/static/js/graphql-qx4tt6ze.js +1 -0
  45. package/dist/client/static/js/html-5e0g8664.js +1 -0
  46. package/dist/client/static/js/{index-gw4c5n3a.js → index-007sewcn.js} +1 -1
  47. package/dist/client/static/js/{index-qbqm3c91.js → index-1e0rt7c6.js} +2 -2
  48. package/dist/client/static/js/{index-6qqsy78z.js → index-1e710snk.js} +1 -1
  49. package/dist/client/static/js/{index-kc5yt2cd.js → index-2s17netq.js} +2 -2
  50. package/dist/client/static/js/{index-7s4dge1z.js → index-374xq5a4.js} +1 -1
  51. package/dist/client/static/js/index-4ddgpqm0.css +1 -0
  52. package/dist/client/static/js/{index-6h46r2de.js → index-5g2j626a.js} +1 -1
  53. package/dist/client/static/js/{index-5tp3emtg.js → index-5hvt233n.js} +1 -1
  54. package/dist/client/static/js/{index-ssepzdaz.js → index-5xxbbzqa.js} +5 -5
  55. package/dist/client/static/js/{index-jnxmvxb8.js → index-7sq6cjt1.js} +11 -11
  56. package/dist/client/static/js/{index-q0k1am0g.js → index-80kx6dm6.js} +2 -2
  57. package/dist/client/static/js/{index-2f6psebk.js → index-8d8ce00v.js} +1 -1
  58. package/dist/client/static/js/{index-gqsnyh8k.js → index-94d416ee.js} +1 -1
  59. package/dist/client/static/js/{index-2a0b9ya2.js → index-an7fq7f6.js} +1 -1
  60. package/dist/client/static/js/{index-6ey6y9em.js → index-azz46nwc.js} +2 -2
  61. package/dist/client/static/js/{index-bkwax812.js → index-c9aqx3ht.js} +1 -1
  62. package/dist/client/static/js/{index-rr79n77k.js → index-cc7qbfvn.js} +155 -148
  63. package/dist/client/static/js/{index-wnk9k57k.js → index-cmjyet7w.js} +50 -50
  64. package/dist/client/static/js/{index-f31c6jg8.js → index-cpp43af3.js} +8 -8
  65. package/dist/client/static/js/{index-dz18nn65.js → index-dxq1tbwm.js} +1 -1
  66. package/dist/client/static/js/{index-8aqjj2x2.js → index-e0kahttb.js} +1 -1
  67. package/dist/client/static/js/{index-ts8rhd06.js → index-e4nge3f4.js} +1 -1
  68. package/dist/client/static/js/{index-k4qshngy.js → index-f27wvdky.js} +3 -3
  69. package/dist/client/static/js/{index-7ma44af3.js → index-f61c25vn.js} +1 -1
  70. package/dist/client/static/js/{index-nzq51nbb.js → index-fe92hqmb.js} +5 -5
  71. package/dist/client/static/js/{index-k56patms.js → index-fv7nybnf.js} +2 -2
  72. package/dist/client/static/js/{index-xfyxmaj1.js → index-gqrt766t.js} +44 -44
  73. package/dist/client/static/js/{index-mkp3gwag.js → index-hb7a7m9m.js} +1 -1
  74. package/dist/client/static/js/{index-qkcmspxq.js → index-j830qk07.js} +1 -1
  75. package/dist/client/static/js/{index-6ac860yz.js → index-kzzvrqnv.js} +1 -1
  76. package/dist/client/static/js/{index-x7h04xzf.js → index-m5n0zsft.js} +1 -1
  77. package/dist/client/static/js/{index-q5q8a3qn.js → index-medk4f18.js} +1 -1
  78. package/dist/client/static/js/{index-tnxp90ac.js → index-nptbz7sv.js} +1 -1
  79. package/dist/client/static/js/{index-r1wrke3j.js → index-qefssj0m.js} +1 -1
  80. package/dist/client/static/js/{index-mpyd7qxj.js → index-r8d4bk86.js} +2 -2
  81. package/dist/client/static/js/{index-vf01q99d.js → index-rqt8mem9.js} +2 -2
  82. package/dist/client/static/js/{index-zh550byg.js → index-s4dpkds5.js} +1 -1
  83. package/dist/client/static/js/index-s9k82stc.js +2 -0
  84. package/dist/client/static/js/{index-xygk0v3e.js → index-skwem10a.js} +2 -2
  85. package/dist/client/static/js/{index-k1576e2m.js → index-tv9rn2nd.js} +1 -1
  86. package/dist/client/static/js/{index-dqf0srrp.js → index-vny4ymjf.js} +2 -2
  87. package/dist/client/static/js/{index-w5j1wgcz.js → index-vw8b29ek.js} +1 -1
  88. package/dist/client/static/js/{index-e42ys2q3.js → index-wn28m9h7.js} +7 -7
  89. package/dist/client/static/js/{index-tc07gd33.js → index-wxqcnsrq.js} +2 -2
  90. package/dist/client/static/js/{index-j863hg0d.js → index-xmg1x6zv.js} +6 -6
  91. package/dist/client/static/js/{index-t71k3b28.js → index-zhgh7a31.js} +1 -1
  92. package/dist/client/static/js/{index-vb5a3g01.js → index-zs7kw0be.js} +3 -3
  93. package/dist/client/static/js/info-A6RAGUB7-szttx3v5.js +1 -0
  94. package/dist/client/static/js/{infoDiagram-VRGFBTTK-rykcacj5.js → infoDiagram-VRGFBTTK-1x83h4k4.js} +2 -2
  95. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-rj752kd8.js → ishikawaDiagram-OU5B5YK6-et6z3c28.js} +2 -2
  96. package/dist/client/static/js/javascript-av46zx4c.js +1 -0
  97. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-mtetwn6f.js → journeyDiagram-ZHPQQLJL-sw669e7a.js} +3 -3
  98. package/dist/client/static/js/{julia-mxe3pnz3.js → julia-z14p8jsx.js} +1 -1
  99. package/dist/client/static/js/{kanban-definition-PNTS6WVX-4h5pw5mm.js → kanban-definition-PNTS6WVX-aqxg95kx.js} +7 -7
  100. package/dist/client/static/js/{mermaid.core-bs542jma.js → mermaid.core-6cgqsgcf.js} +3 -3
  101. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-67s4xy7h.js → mindmap-definition-NLK3R4M7-530anpc4.js} +4 -4
  102. package/dist/client/static/js/one-dark-pro-9hnhtkpr.js +1 -0
  103. package/dist/client/static/js/one-light-2n5y8592.js +1 -0
  104. package/dist/client/static/js/packet-AYTQ26CC-401149bv.js +1 -0
  105. package/dist/client/static/js/{pegDiagram-GJSIUBJH-qykb6ssk.js → pegDiagram-GJSIUBJH-5zar6hvy.js} +1 -1
  106. package/dist/client/static/js/{perl-a8eeaqkn.js → perl-1na2x6yd.js} +1 -1
  107. package/dist/client/static/js/{php-6gq92zt8.js → php-x75tt7w3.js} +1 -1
  108. package/dist/client/static/js/pie-WAS4IAKB-bgfv8tfz.js +1 -0
  109. package/dist/client/static/js/{pieDiagram-5QR66LMP-mymrrvck.js → pieDiagram-5QR66LMP-3bx8syvw.js} +2 -2
  110. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-6f8ahd40.js → quadrantDiagram-O4NWA36T-yaarpr2e.js} +2 -2
  111. package/dist/client/static/js/radar-RG4KPBEZ-pw720590.js +1 -0
  112. package/dist/client/static/js/railroad-74A4TZTK-n2a30ngs.js +1 -0
  113. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rn5rx9qt.js +1 -0
  114. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-t4yryhtd.js +1 -0
  115. package/dist/client/static/js/railroad-peg-WCYAUIDC-c4ebgvrr.js +1 -0
  116. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-c3habpvw.js → railroadDiagram-XR7U4H2S-ag41q4nt.js} +1 -1
  117. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-nysqy6te.js → requirementDiagram-PLB6GJNP-g8sr48h4.js} +4 -4
  118. package/dist/client/static/js/{ruby-mc826p2e.js → ruby-3h22qahv.js} +1 -1
  119. package/dist/client/static/js/{rust-m4f4vpvn.js → rust-r27demr5.js} +1 -1
  120. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-s5dtfp3z.js → sankeyDiagram-IPEJSGJF-t1wbd1hh.js} +1 -1
  121. package/dist/client/static/js/{scss-9wz47c6t.js → scss-c04ezwnn.js} +1 -1
  122. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-bb3yp049.js → sequenceDiagram-PO4LG4MO-407mjqty.js} +5 -5
  123. package/dist/client/static/js/{sizeCapture-INFHLROL-0m2msee7.js → sizeCapture-INFHLROL-w38zb9ky.js} +1 -1
  124. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-cd0qgj6t.js → stateDiagram-v2-GCMORJYK-4cvgymkc.js} +3 -3
  125. package/dist/client/static/js/{svelte-5vrwkc13.js → svelte-egg3x4tw.js} +1 -1
  126. package/dist/client/static/js/{swimlanes-2SLR337P-rpb01f7p.js → swimlanes-2SLR337P-w7ts2rzw.js} +1 -1
  127. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-zx36y2c8.js → swimlanesDiagram-TC7HE7FX-v82nym6b.js} +1 -1
  128. package/dist/client/static/js/{timeline-definition-EJHVYXUP-tqw2e6y1.js → timeline-definition-EJHVYXUP-nq46nzy9.js} +4 -4
  129. package/dist/client/static/js/treeView-Q6P3EWNA-bxgt5yhm.js +1 -0
  130. package/dist/client/static/js/treemap-WGGIJYW6-hh3595m0.js +1 -0
  131. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-dhf4d5xg.js → usecaseDiagram-POWQR4AR-q144snzb.js} +22 -22
  132. package/dist/client/static/js/{vennDiagram-UO4OBE2U-ztkk79dv.js → vennDiagram-UO4OBE2U-2wemak2p.js} +5 -5
  133. package/dist/client/static/js/{vue-gmjnxjm3.js → vue-d7p4wv35.js} +1 -1
  134. package/dist/client/static/js/wardley-WFR3VGLG-6bza7h1b.js +1 -0
  135. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-ahre5tmv.js → wardleyDiagram-VNRHLVJA-bb2qvvgr.js} +2 -2
  136. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-vak2c50n.js → xychartDiagram-PMCCYNJV-9dr05fdq.js} +4 -4
  137. package/package.json +4 -4
  138. package/src/client/components/common/anchored-menu/index.tsx +11 -4
  139. package/src/client/components/common/session-row/TrailingSlot.tsx +6 -2
  140. package/src/client/components/common/session-row/index.tsx +32 -16
  141. package/src/client/components/common/session-row/session-row.test.tsx +56 -18
  142. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +24 -3
  143. package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +20 -0
  144. package/src/client/components/workspace/chat-timeline/ChatOverlays.tsx +1 -0
  145. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +5 -0
  146. package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +81 -162
  147. package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +7 -3
  148. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +12 -4
  149. package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +1 -0
  150. package/src/client/components/workspace/chat-timeline/UserTurn.test.tsx +24 -6
  151. package/src/client/components/workspace/chat-timeline/UserTurn.tsx +17 -4
  152. package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +16 -0
  153. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +66 -10
  154. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +103 -41
  155. package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +3 -1
  156. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +2 -2
  157. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +54 -35
  158. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.test.tsx +110 -0
  159. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +51 -32
  160. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +62 -0
  161. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +15 -3
  162. package/src/client/components/workspace/chat-timeline/chat-input/access-capability.test.tsx +151 -0
  163. package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +5 -0
  164. package/src/client/components/workspace/chat-timeline/fork-preview.test.tsx +1 -1
  165. package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +21 -5
  166. package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +100 -71
  167. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +9 -9
  168. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +83 -66
  169. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.test.tsx +3 -3
  170. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +36 -15
  171. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -3
  172. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions.tsx +10 -2
  173. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Card.tsx +2 -2
  174. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Compact.tsx +11 -6
  175. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +2 -2
  176. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Trace.tsx +2 -2
  177. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +5 -3
  178. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +19 -12
  179. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/parity.test.tsx +50 -2
  180. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/props.ts +2 -0
  181. package/src/client/hooks/chat/timeline/access-ladder-wiring.test.ts +111 -0
  182. package/src/client/hooks/chat/timeline/access-ladder.test.ts +66 -0
  183. package/src/client/hooks/chat/timeline/access-ladder.ts +72 -0
  184. package/src/client/hooks/chat/timeline/access-mode.ts +11 -1
  185. package/src/client/hooks/chat/timeline/index.ts +4 -5
  186. package/src/client/hooks/chat/timeline/modes-contract.ts +10 -1
  187. package/src/client/hooks/chat/timeline/modes.ts +10 -2
  188. package/src/server/lib/realtime/topics/session-data.server.ts +6 -5
  189. package/src/server/lib/realtime/topics/session-data.test.ts +35 -0
  190. package/src/shared/lib/chat/orchestration/outcome-markdown.test.ts +57 -0
  191. package/src/shared/lib/chat/orchestration/outcome-markdown.ts +74 -0
  192. package/dist/client/static/js/MergeDiffView-b8f013ws.js +0 -1
  193. package/dist/client/static/js/architecture-7GRP2DOG-dc7zys46.js +0 -1
  194. package/dist/client/static/js/css-9gak6bze.js +0 -1
  195. package/dist/client/static/js/cynefin-OW5HDTMX-9fx59e89.js +0 -1
  196. package/dist/client/static/js/eventmodeling-NTZA5JFV-61d2ee91.js +0 -1
  197. package/dist/client/static/js/flowDiagram-KWPJA3E3-104ywb7w.js +0 -1
  198. package/dist/client/static/js/gitGraph-4MIJSDKK-zkb30q0t.js +0 -1
  199. package/dist/client/static/js/graphql-2ntm7jyh.js +0 -1
  200. package/dist/client/static/js/html-mt2yb43b.js +0 -1
  201. package/dist/client/static/js/index-f44k9k8d.css +0 -1
  202. package/dist/client/static/js/index-ver116ed.js +0 -2
  203. package/dist/client/static/js/info-A6RAGUB7-xxvyt8p8.js +0 -1
  204. package/dist/client/static/js/javascript-0mqgcvps.js +0 -1
  205. package/dist/client/static/js/one-dark-pro-541ed4b7.js +0 -1
  206. package/dist/client/static/js/one-light-nr79mykt.js +0 -1
  207. package/dist/client/static/js/packet-AYTQ26CC-cm8jeesg.js +0 -1
  208. package/dist/client/static/js/pie-WAS4IAKB-8b9xgcxv.js +0 -1
  209. package/dist/client/static/js/radar-RG4KPBEZ-fxr2x2mf.js +0 -1
  210. package/dist/client/static/js/railroad-74A4TZTK-5qd45xk1.js +0 -1
  211. package/dist/client/static/js/railroad-abnf-HS5TGJTU-6fa00vpk.js +0 -1
  212. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-pcbtg7tj.js +0 -1
  213. package/dist/client/static/js/railroad-peg-WCYAUIDC-r0fdhdtp.js +0 -1
  214. package/dist/client/static/js/treeView-Q6P3EWNA-9sn2h4ea.js +0 -1
  215. package/dist/client/static/js/treemap-WGGIJYW6-9fzms0pq.js +0 -1
  216. package/dist/client/static/js/wardley-WFR3VGLG-vy6rp5gp.js +0 -1
@@ -1,2 +1,2 @@
1
- import{d,n,o,K,i,u,a,Fe,ce,Ut,Ic,e,s,Le,_e,p,dn,pn,I,dt,mn,f,C,le,pt,ae,fe,Nt,et,yn,de,Ke,pe,Sa,ia,nn,Da,ir,L,S,U,hl,h,sr,bl,He,we,an,Nh,io,Rm,kn,Qe,Qt,Po,Ve,kl,Or,he,X,mt,It,Rt,Oo,As,Rd,Tc,se,We,bs,Qc,i0,Lc,Mt,Fc,vs,zo,El,Bl,jo,rt,st,pa,at,Tl,Ao,Dl,ru,$a,au,jd,Is,za,qo,Wo,Ko,St,ur,Ds,Vo,Yo,Jo,ho,Ql,Rl,Ll,Ml,dr,jf,Hf,Zo,lu,qf,Ns,Qs,Wf,Rs,Vf,Yf,Jf,cu,Di,Fl,Ua,Ni,Zf,Xf,uu,eg,tg,ib,Yd,cb,ei,Jd,Sn,ng,rg,ag,og,BA,Pl,sg,lg,du,$l,mg,fg,np,gg,mb}from"./index-rr79n77k.js";import{lp}from"./index-k1576e2m.js";import"./index-jnxmvxb8.js";import{fu,gu,Au,hu,bu,yu,vu,Mi,ku,zl,xu}from"./index-vb5a3g01.js";import{Xs}from"./index-ssepzdaz.js";import"./index-t71k3b28.js";import{Ms,Eu,Bu,ti,Fs,Iu,_u,Su,Tu,Du,Nu,Ru,Lu}from"./index-e42ys2q3.js";import{wd,Cd,mi,Ed,Bd}from"./index-7ma44af3.js";import{ht,Fi,Pu,Ou,zu}from"./index-xygk0v3e.js";import{$s,ja,Ur,Uu,Gu,ni,ju,zs,Ap,zA,Us,Gs,js,Gr,Hs,qs,ri,Ws,Ks,Vs,Ys,Oi,ai,Js,Zs,Hu,hp,qu,Wu,Ku,Vu,Yu,Ju}from"./index-k4qshngy.js";import{Wa,Ka}from"./index-6ac860yz.js";import{Sd}from"./index-x7h04xzf.js";function Xe(t){let{editorOpen:r,diffOpen:l,settingsOpen:m,offMainScreen:b,onCloseEditor:g,onCloseDiff:x,onCloseSettings:v,onReturnToMain:w}=t;o(()=>mb(()=>{if(r)return g(),!0;if(l)return x(),!0;if(m)return v(),!0;if(b)return w(),!0;return!1}),[r,l,m,b,g,x,v,w])}var ft="terminal";function $e(t){return t===ft}function Re(t){if($e(t))i0()}function qe({dock:t,sessionId:r,currentScreen:l,setCurrentScreen:m}){let[b,g]=n(0),[x,v]=n(0),w=a(()=>{let y=we(r,"layout.mobileRightPanel")??Ic;Re(y),g((N)=>N+1),m("right")},[r,m]),c=a(()=>{v((y)=>y+1),m("session")},[m]),k=a((y)=>{let N=cb(y,t);if(!N)return;let R=we(r,"layout.mobileRightPanel");if(N==="right"&&(l!=="right"||R!==y))Re(y);if(an(r,N==="left"?"layout.mobileLeftPanel":"layout.mobileRightPanel",y),N==="right")g(0);m(N==="left"?"session":"right")},[t,r,l,m]);return se(Yd,(y)=>{let N=y.detail?.panelKey;if(N)k(N)}),{right:b,left:x,openSessionDrawer:c,openRightDrawer:w,openNamedPanel:k}}var bt={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]},Ye=s(bt);function Oe(){let t=bs(),[r,l]=n(null),m=a((x,v)=>{l({top:v,bottom:v,left:x,right:x})},[]),b=wd({enabled:t,onLongPress:m}),g=a(()=>l(null),[]);return{anchor:r,close:g,surfaceProps:{onContextMenu:(x)=>{x.preventDefault();let v=x.currentTarget.getBoundingClientRect();l({top:v.top,bottom:v.bottom,left:v.left,right:v.right})},onTouchStart:b.onTouchStart,onTouchMove:b.onTouchMove,onTouchEnd:b.onTouchEnd,onTouchCancel:b.onTouchCancel,onClickCapture:(x)=>{if(!b.consume())return;x.preventDefault(),x.stopPropagation()}}}}var gt=10,Ze=600000;function Je({activeSessionTitle:t,activeSessionId:r,onOpenSessionSidebar:l,onOpenRightSidebar:m,onNewSession:b,onSelectSession:g}){let{folders:x}=at(),v=np(),w=za(r),[c,k]=n(null),{hidden:y,setHidden:N}=rg(),R=Oe(),E=Jd("mobile"),W=u(()=>{let M=Date.now(),A=[];for(let D of x)for(let O of D.sessions??[]){if(O.is_archived===1)continue;let T=Nh(String(O.id)),B=O.updated_at?Date.parse(O.updated_at):0,Y=T!==void 0&&M-T<=Ze?T:B;if(T!==void 0&&M-T>Ze)continue;A.push({id:O.id,title:O.title,folderName:D.name,modified:Y})}return A.sort((D,O)=>O.modified-D.modified).slice(0,gt)},[x]),P=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return e("header",{className:`flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between ${kl} px-3 z-20 titlebar-drag-region select-none`,...Ua(),...R.surfaceProps,style:ei(),children:[e("div",{className:"flex items-center space-x-2 flex-1 min-w-0 titlebar-no-drag",children:[e("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 inline-flex items-center justify-center",title:"Open Sessions","aria-label":"Open Sessions",children:e(Ye,{size:20,strokeWidth:2})}),e("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[e($a,{glow:!0}),e("span",{className:"absolute -top-0.5 -right-1.5 flex",children:e(cu,{status:v})})]}),e("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),e("div",{className:"relative min-w-0 flex-1 max-w-[150px]","data-testid":"session-picker",children:[e("button",{type:"button",onClick:(M)=>{k((A)=>A?null:It(M.currentTarget))},className:"tap-chip flex w-full items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 min-w-0",title:P,"aria-haspopup":"menu","aria-expanded":c!==null,children:[e("span",{className:"truncate",children:P}),w&&e(p,{size:12,className:"animate-spin text-ink/50 flex-shrink-0",role:"status","aria-label":"Generating a session name…"}),e(C,{size:13,className:"text-ink/50 flex-shrink-0"})]}),c&&e(Rt,{anchor:c,align:"start",className:"w-72 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",onClose:()=>k(null),children:[e("button",{type:"button",onClick:()=>{k(null),b()},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5",children:[e(L,{size:14}),e("span",{children:"Start New Session"})]}),e("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),e("div",{className:"max-h-64 scrollbar-overlay-container space-y-0.5",children:W.length===0?e("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):W.map((M)=>e("button",{type:"button",onClick:()=>{k(null),g(M.id)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(r)===String(M.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:"truncate",children:M.title?M.title.charAt(0).toUpperCase()+M.title.slice(1):"Untitled"}),e("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:M.folderName})]}),String(r)===String(M.id)&&e(f,{size:12,className:"flex-shrink-0"})]},M.id))})]})]})]}),e(ag,{layout:"mobile",sessionId:r==null?null:String(r),showRightPanel:!1,onToggleRightPanel:m,entries:E,hidden:y}),R.anchor?e(Zo,{anchor:R.anchor,title:"Navbar",align:"right",items:ng([...E.inline,...E.folded]).filter((M)=>M.id!==Sn.install).map((M)=>({...M,removable:!0})),hidden:y,onToggle:N,onClose:R.close}):null]})}function eo({activeSessionId:t,onSelectSession:r,onNewSession:l,onOpenSessionSidebar:m,onOpenRightSidebar:b,appSettings:g={}}){let{folders:x}=at(),[v,w]=n(null),c=u(()=>{if(!t)return"New session";for(let y of x){let N=y.sessions?.find((R)=>String(R.id)===String(t));if(N)return N.title}return null},[t,x]);return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[e(Je,{activeSessionTitle:v||c||"New session",activeSessionId:t,onOpenSessionSidebar:m,onOpenRightSidebar:b,onNewSession:l,onSelectSession:r}),e("main",{className:"flex-1 min-h-0",children:e(lg,{appSettings:g,onSessionTitle:w,variant:"mobile"})})]})}function oo({onClose:t,viewLabel:r="Sessions",menuProps:l}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Ua(),...l,style:{...ei()},children:[e("div",{className:"flex items-center space-x-2.5 titlebar-no-drag min-w-0",children:[e("span",{className:"font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:e($a,{className:"text-[16px]",glow:!0})}),e("span",{className:"text-ink/25 text-xs select-none flex-shrink-0",children:"/"}),e("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono truncate",children:r})]}),e("div",{className:"flex items-center gap-1 titlebar-no-drag flex-shrink-0",children:[e(og,{variant:"chip"}),e("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer",title:"Close sidebar","aria-label":"Close sidebar",children:e(h,{size:19,strokeWidth:2})})]})]})}function to({onSettings:t,onKeyBindings:r,onAbout:l,updateAvailable:m,onUpdateClick:b,onDesktopToggle:g,shellDownload:x}){return e("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:[e("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(hl,{size:14}),e("span",{children:"Settings"})]}),e("button",{type:"button",onClick:r,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(Sa,{size:14}),e("span",{children:"Keys"})]}),e("button",{type:"button",onClick:l,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(pe,{size:14}),e("span",{children:"About"})]}),x&&e(Jf,{download:x,variant:"label"}),g&&e("button",{type:"button",onClick:g,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[e(Da,{size:14}),e("span",{children:"Desktop"})]})]}),e("div",{className:"flex items-center gap-2",children:[e("span",{className:"font-mono text-[10px] text-ink/40",children:["v",ru.version]}),m&&e("button",{type:"button",onClick:b,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}function no(t){let r=Zf(),l=Yf();return se(au,()=>{t.onClose(),t.openAbout(),r.apply("kabmo").then((m)=>{if(!m)return;t.pushToast(m.message,Tc(m))})}),Xf(r,t.pushToast),{updates:r,shellDownload:l}}function ro(t,r,l){return t.filter((m)=>m.id!==r&&!(l&&m.side==="left"))}function so(t){return t}var vt=8;function Ae({panels:t,activeId:r,onSelect:l,hasGitChanges:m=!1}){let b=i(null),g=i(new Map),x=i({activeId:r,panels:t});x.current={activeId:r,panels:t};let v=i({signature:"",width:0}),w=a(()=>{let c=b.current,k=g.current.get(x.current.activeId);if(!c||!k||c.clientWidth<=0)return;let y=`${x.current.activeId}\x00${x.current.panels.map((P)=>P.id).join("\x00")}`,N=v.current;if(N.signature===y&&N.width===c.clientWidth)return;v.current={signature:y,width:c.clientWidth};let R=c.getBoundingClientRect(),E=k.getBoundingClientRect(),W=qf({scrollLeft:c.scrollLeft,clientWidth:c.clientWidth,scrollWidth:c.scrollWidth,start:E.left-R.left+c.scrollLeft,size:E.width},vt);if(W!==c.scrollLeft)c.scrollLeft=W},[]);return K(w,[r,t,w]),o(()=>{let c=b.current;if(!c||typeof ResizeObserver>"u")return;let k=new ResizeObserver(w);return k.observe(c),()=>k.disconnect()},[w]),e("div",{ref:b,className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:t.map((c)=>{let k=c.id===r;return e("button",{ref:(y)=>{if(y)g.current.set(c.id,y);else g.current.delete(c.id)},type:"button",onClick:()=>l(c.id),"aria-pressed":k,"aria-label":c.title,className:`tap-chip relative flex shrink-0 items-center transition-all cursor-pointer ${k?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:c.title,children:[e(Ao,{panelId:c.id,builtin:c.builtin,icon:c.builtin?c.icon:void 0,name:c.builtin?c.label:c.name,...c.iconUrl?{iconUrl:c.iconUrl}:{},...c.color?{color:c.color}:{},size:Ut}),k&&e("span",{className:`shrink-0 whitespace-nowrap ${c.id==="git"?"tracking-wide":""}`,children:c.label}),c.id==="git"&&m&&e("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},c.id)})})}function ao({panels:t,activeId:r,onSelect:l,menuProps:m}){return e("div",{className:"px-3 py-1.5 border-b border-ink/10 bg-canvas flex-shrink-0",...m,children:e(Ae,{panels:t,activeId:r,onSelect:l})})}function lo({panelKey:t,panel:r,body:l}){if(!r)return e("div",{className:"flex-1 min-h-0",children:e(lu,{panelKey:t})});return e("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:e(Fe,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Po,{value:l,children:r.render(l)})})})}var Te="w-9.5 h-9.5 rounded-xl border flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",Ee="border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink",co="bg-ink/10 text-ink border-ink/30";function po({searchQuery:t,sortOption:r,optionsOpen:l,showArchived:m,optionsRef:b,onNewSession:g,onNewWorkspace:x,onScheduler:v,scheduledCount:w,onRefresh:c,refreshing:k,onToggleOptions:y,onSortChange:N,onResetSort:R,onToggleArchived:E,onHideArchived:W,onSearchChange:P,onClearSearch:M,onSelectWorkspaces:A,selecting:D}){let{ref:O,width:T}=zs(0),B=zA(T),Y={};for(let q of Ap.slice(0,B))Y[q]=!0;let z=Ap.slice(B),F=m?"Hide archived sessions":"Show archived sessions",te=w>0?`Scheduled tasks (${w} armed)`:"Scheduled tasks",H=[];if(z.includes("new-workspace"))H.push({id:"new-workspace",label:"New Workspace",icon:yn,onSelect:x});if(z.includes("refresh"))H.push({id:"refresh",label:"Refresh sessions",icon:S,onSelect:c});if(z.includes("scheduler"))H.push({id:"scheduler",label:te,icon:ja,onSelect:v});if(z.includes("archive"))H.push({id:"archive",label:F,icon:dt,onSelect:E,active:m});if(z.includes("select"))H.push({id:"select",label:D?"Cancel selection":"Select workspaces",icon:Ur,onSelect:A,active:D});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[e("div",{ref:O,className:"flex items-center space-x-2",children:[e("button",{type:"button",onClick:g,"aria-label":"New Session",title:"New Session",className:"flex-1 min-w-0 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 text-xs font-semibold transition-all shadow-xs",children:[e(L,{size:15,strokeWidth:2.4,className:"shrink-0"}),e("span",{className:"min-w-0 truncate",children:"New Session"})]}),Y["new-workspace"]&&e("button",{type:"button",onClick:x,className:`${Te} ${Ee}`,title:"New Workspace","aria-label":"New Workspace",children:e(yn,{size:16,strokeWidth:1.8})}),Y.scheduler&&e("button",{type:"button",onClick:v,className:`relative ${Te} ${Ee}`,title:te,"aria-label":w>0?`Scheduled tasks, ${w} armed`:"Scheduled tasks",children:[e(ja,{size:16,strokeWidth:1.8}),w>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-[3px] rounded-full bg-ink text-canvas text-[10px] leading-[13px] text-center font-semibold",children:w>9?"9+":w})]}),Y.archive&&e("button",{type:"button",onClick:E,"aria-pressed":m,className:`${Te} ${m?"bg-warning/15 border-warning/40 text-warning-text":Ee}`,title:F,"aria-label":F,children:e(dt,{size:16,strokeWidth:1.8})}),Y.select&&e("button",{type:"button",onClick:A,"aria-pressed":D,className:`${Te} ${D?co:Ee}`,title:D?"Cancel selection":"Select workspaces","aria-label":D?"Cancel selection":"Select workspaces",children:e(Ur,{size:16,strokeWidth:1.8})}),Y.refresh&&e("button",{type:"button",onClick:c,className:`${Te} ${Ee}`,title:"Refresh sessions","aria-label":"Refresh sessions","aria-busy":k,children:e(S,{size:15,strokeWidth:1.8,className:k?"animate-spin":void 0})}),Y.sort&&e("div",{className:"relative flex-shrink-0",ref:b,children:[e("button",{type:"button",onClick:y,className:`${Te} ${l||r!=="A-Z"?co:Ee}`,title:"Sort workspaces","aria-label":"Sort workspaces",children:e($s,{size:15,strokeWidth:1.8})}),l&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:e(ni,{variant:"mobile",sortOption:r,onSortChange:N})})]}),z.length>0&&e(ju,{actions:H,sortHidden:z.includes("sort"),sortOption:r,onSortChange:N,layout:"mobile"})]}),e("div",{className:"relative flex items-center",children:[e(U,{size:14,className:"absolute left-3 text-ink/40"}),e("input",{type:"text",value:t,onChange:(q)=>P(q.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&e("button",{type:"button",onClick:M,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:e(h,{size:13})})]}),(m||r!=="A-Z")&&e("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:[r!=="A-Z"&&e("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e("span",{children:["Sort: ",r.replace("_"," ")]}),e("button",{type:"button",onClick:R,className:"hover:text-ink ml-0.5",title:"Reset sort",children:e(h,{size:10})})]}),m&&e("span",{className:"inline-flex items-center space-x-1 bg-warning/15 border border-warning/25 text-warning-text rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e(dt,{size:10}),e("span",{children:"Archived"}),e("button",{type:"button",onClick:W,className:"hover:text-warning-text ml-0.5",title:"Hide archived",children:e(h,{size:10})})]})]})]})}var xt="p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink";function mo({folder:t,canWorktree:r,onOpenFolder:l,onNewWorktree:m,onSelectSessions:b,confirmDelete:g,onPin:x,onDelete:v,onRequestDelete:w,onCancelDelete:c}){let[k,y]=n(!1),N=i(null),[R,E]=n(null),W=(P)=>()=>{y(!1),P()};return e("div",{className:"relative flex items-center",onClick:(P)=>P.stopPropagation(),children:[e("button",{ref:N,type:"button",onClick:(P)=>{if(P.stopPropagation(),N.current)E(It(N.current));y((M)=>!M)},className:xt,title:"Workspace options","aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":k,children:e(_e,{size:15})}),e(Rt,{anchor:k?R:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"w-48 rounded-lg border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:()=>{y(!1),c()},children:e(Vs,{variant:"mobile",isPinned:t.isPinned,onOpenFolder:l?W(l):void 0,onNewWorktree:r&&m?W(m):void 0,onSelectSessions:b?W(b):void 0,confirmDelete:g,onPin:W(x),onDelete:W(v),onRequestDelete:w,onCancelDelete:c})})]})}var uo={inset:"",insetPx:0,slotWidth:16,markGap:8,padding:"py-2",glyph:st.touch};function fo({session:t,harness:r,isActive:l,status:m,awaitingInput:b=!1,timeAgo:g,timeTitle:x,runStartedAt:v,expandable:w=!1,isExpanded:c=!1,onToggleExpand:k,isChild:y=!1,folderId:N,onSelect:R,onArchive:E,onDelete:W,onRename:P,onRenameWithAi:M,waitingFor:A,onCancelWait:D,selectable:O=!1,selected:T=!1,onToggleSelect:B}){let{isEditing:Y,draft:z,setDraft:F,inputRef:te,startRename:H,handleKeyDown:q,handleBlur:re}=Ko(t.title,P),_=za(t.id),ne=Vo(),ie=ne.anchor!==null,ee=Boolean(P||E||W||D),J=Boolean(A),me=w&&Boolean(k),Q=t.title.charAt(0).toUpperCase()+t.title.slice(1);if(Y)return e("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:e("input",{ref:te,autoFocus:!0,value:z,onChange:(oe)=>F(oe.currentTarget.value),onKeyDown:q,onBlur:re,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})});return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t.id),"data-menu-open":ie?"true":void 0,onContextMenu:ee&&!O?ne.openAtCursor:void 0,className:`w-full rounded-lg flex items-center transition-colors ${O&&T||ie?Ks:l?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[e("button",{type:"button",onClick:O?B:R,className:"flex-1 text-left py-2 flex items-center justify-between min-w-0",children:[e("div",{className:"flex items-center min-w-0 pr-2",children:[O?e(Gr,{checked:T,label:`Select ${t.title}`,onChange:()=>B?.()}):e("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:_?e("span",{role:"status","aria-label":"Generating a name…",children:e(p,{size:13,className:"text-ink/50 animate-spin"})}):b?e(Le,{size:13,className:"text-ink/70 animate-pulse"}):J?e("span",{role:"status","aria-label":`Waiting for ${A?.title??"another session"}`,children:e(Ke,{size:13,className:"text-ink/60 animate-pulse"})}):m==="stream"?e("span",{role:"status","aria-label":"Running",children:e(p,{size:13,className:"text-ink/50 animate-spin"})}):m?e(f,{size:13,className:"text-ink/50"}):y?e("span",{"data-testid":"child-indicator",className:"text-ink/35","aria-hidden":"true",children:e(de,{size:13})}):null}),e("span",{className:"flex flex-col min-w-0 ml-2 leading-snug",children:[e("span",{className:"flex min-w-0 items-center",children:[r&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(rt,{harness:r,size:st.touch})}),e("span",{className:"min-w-0 truncate text-xs",children:Q})]}),J&&e("span",{className:"text-[10px] text-ink/40 truncate",children:["waiting for ",A?.title??"another session"]}),t.worktree?e(Hs,{worktree:t.worktree}):null]})]}),e(Ws,{timeAgo:g,timeTitle:x,runStartedAt:v,className:"text-[11px] font-mono flex-shrink-0 ml-2",restingClassName:"text-ink/45"})]}),ee&&!O&&e("button",{type:"button",onClick:ne.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":ie,className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:e(_e,{size:16})}),me&&!O&&e("button",{type:"button",onClick:k,title:c?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":c,"aria-label":c?"Collapse sessions and subagents":"Expand sessions and subagents",className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/50 hover:text-ink rounded-lg cursor-pointer",children:c?e(C,{size:14}):e(le,{size:14})})]}),ne.anchor&&e(Yo,{anchor:ne.anchor,sessionId:t.id,...r?{harness:r}:{},...N!==void 0?{folderId:N}:{},isArchived:t.is_archived===1,onRename:P?H:void 0,onRenameWithAi:M,onArchive:E,onDelete:W,onCancelWait:D,onClose:ne.close})]})}function bo(t,r){let[l,m]=n(!1);return{open:()=>m(!0),dialog:l?e(Jo,{isOpen:!0,onClose:()=>m(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(b)=>{m(!1),r(b.path)}}):null}}function go({hiddenCount:t,canShowLess:r,onShowMore:l,onShowLess:m}){if(t<=0&&!r)return null;return e("div",{className:"flex items-center gap-1",children:[t>0&&e("button",{type:"button",onClick:l,className:"flex items-center min-w-0 text-left py-2 pr-3 text-xs text-ink/60 hover:text-ink",children:[e("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:e(C,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate",children:["Show more sessions (",t,")"]})]}),r&&e("button",{type:"button",onClick:m,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/60 hover:text-ink pl-3 py-2",children:[e(pt,{size:12}),e("span",{className:"truncate",children:"Show less"})]})]})}function vo(t){return t?"mb-4":"mb-1"}function So({folder:t,activeSessionId:r,onSelectSession:l,onNewSessionForFolder:m,onNewWorktreeSession:b,isExpanded:g,onToggleExpand:x,showArchived:v=!1,sessionStatus:w={},onToast:c,batch:k,onStartSessionSelection:y,onCancelWait:N}){let{visibleCount:R,showMore:E,showLess:W,canShowLess:P}=Gs(),M=bo(t,(G)=>b?.(t.id,G)),{refresh:A,runStartedAtMap:D}=at(),{expandedSessionIds:O,toggleSession:T}=Ds(),[B]=ce(),Y=B.get("subagent"),z=B.get("sessionId"),{confirmDelete:F,requestDelete:te,cancelDelete:H,handlePin:q,handleDelete:re,handleArchive:_,handleRename:ne,handleRenameWithAi:ie,handleOpenFolder:ee}=js(t,A,c),J=qo(),me=q,Q=re,oe=ee??void 0,ue=(t.sessions||[]).filter((G)=>v?G.is_archived===1:G.is_archived!==1),ke=pa(t.icon),{folderCheckbox:ge,sessionCheckboxes:be,folderSummary:V,toggleFolderSelection:j,rendered:Z,hiddenCount:ye}=Js({batch:k,folder:t,sessions:ue,showArchived:v,visibleCount:R,activeSessionId:r,sessionStatus:w}),Pe=ai(Z),Se=g||be,Ne=(G,Me)=>{let ve=String(G.id),je=String(r)===ve,ct=je&&z===ve&&Boolean(Y),ze=St(ve);return e(fo,{session:G,harness:G.harness,folderId:G.folder_id,isActive:je&&!ct,status:w[ve],awaitingInput:Boolean(G.awaitingInput),timeAgo:qs(G.updated_at??G.created_at),timeTitle:ri(G.updated_at??G.created_at),runStartedAt:w[ve]==="stream"?D[ve]:void 0,expandable:Me.expandable,isChild:Me.isChild,isExpanded:Me.isExpanded,onToggleExpand:Me.onToggleExpand,onSelect:()=>l(G.id),onArchive:()=>_(G),onDelete:ze?void 0:()=>J.requestDelete(G),onRename:ze?void 0:(ut)=>void ne(G,ut),onRenameWithAi:ze?void 0:()=>void ie(G),waitingFor:G.waitingFor?{title:G.waitingFor.title}:void 0,onCancelWait:G.waitingFor?()=>N?.(G.waitingFor.waitId):void 0,selectable:be,selected:Boolean(k?.selected.includes(ve)),onToggleSelect:k?()=>k.toggle(ve):void 0})},lt=(G)=>Ys(G,Pe.childrenOf,O,T);return e("div",{className:vo(Se),"data-testid":"session-folder",children:[e("div",{onClick:k?void 0:x,className:"flex items-center justify-between gap-2 py-1 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[e("div",{className:"flex items-center space-x-2 min-w-0",children:[ge&&V?e(Gr,{size:"md",checked:V.all,indeterminate:V.some,label:`Select ${t.name}`,onChange:j}):e(d,{children:e("span",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain",referrerPolicy:"no-referrer"}):t.iconType==="chat"?e(nn,{size:15,className:"text-ink/80"}):e(ke,{size:15,className:"text-ink/80",style:{color:t.accentColor||void 0}})})}),e("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),e("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[e("span",{className:"font-mono text-[11px] text-ink/70",children:ue.length}),t.project_path&&e(de,{size:13,className:"text-ink/50 ml-1"}),!k&&e(d,{children:[e("button",{type:"button",onClick:(G)=>{G.stopPropagation(),m(t.id)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"New Session","aria-label":`New session in ${t.name}`,children:e(L,{size:15})}),e(mo,{folder:t,canWorktree:Boolean(b&&t.project_path),onOpenFolder:oe,onNewWorktree:b?()=>M.open():void 0,onSelectSessions:y?()=>y(t.id):void 0,confirmDelete:F,onPin:me,onDelete:Q,onRequestDelete:te,onCancelDelete:H}),e("span",{className:"flex items-center justify-center pr-1",children:g?e(C,{size:14}):e(le,{size:14})})]})]})]}),Se&&e("div",{className:"mt-0.5 space-y-0.5",children:[Pe.roots.map((G)=>{let Me=String(G.id),ve=lt(G);return e("div",{className:"space-y-0.5",children:[Ne(G,ve),ve.isExpanded&&e(Oi,{parentId:Me,hasSubagents:Boolean(G.hasSubagents),childrenOf:Pe.childrenOf,expandedIds:O,onToggle:T,activeSessionId:r===null?null:String(r),renderSession:Ne,style:uo})]},G.id)}),e(go,{hiddenCount:be?0:ye,canShowLess:!be&&P,onShowMore:E,onShowLess:W})]}),e(Wo,{session:J.pending,isDeleting:J.isDeleting,error:J.error,onClose:J.cancelDelete,onConfirm:()=>void J.confirmDelete()}),M.dialog]})}function xo({folders:t,activeSessionId:r,expandedFolders:l,showArchived:m,sessionStatus:b,onSelectSession:g,onNewSessionForFolder:x,onNewWorktreeSession:v,onToggleFolder:w,onToast:c,batch:k,onStartSessionSelection:y,onCancelWait:N}){return e("div",{className:"flex-1 scrollbar-overlay-container pl-3 pr-2 py-3",children:t.length===0?e("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map((R)=>e(So,{folder:R,activeSessionId:r,onSelectSession:g,onNewSessionForFolder:x,onNewWorktreeSession:v,isExpanded:l[R.id]??!0,onToggleExpand:()=>w(R.id),showArchived:m,sessionStatus:b,onToast:c,batch:k,onStartSessionSelection:y,onCancelWait:N},R.id))})}var wt=[3,2];function wo(){return e("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:wt.map((t,r)=>e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center gap-2 py-2",children:[e("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(l,m)=>e("div",{className:"flex items-center gap-2 rounded py-2",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-m%3*12}%`}})]},m))]},r))})}function ko({folders:t,initializing:r,failed:l,activeSessionId:m,expandedFolders:b,sessionStatus:g,searchQuery:x,sortOption:v,optionsOpen:w,showArchived:c,harnessFilter:k,onHarnessFilterChange:y,harnessOptions:N,optionsRef:R,scheduledCount:E,refreshing:W,selecting:P,batch:M,onNewSession:A,onNewWorkspace:D,onScheduler:O,onRefresh:T,onToggleOptions:B,onSortChange:Y,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:q,onSelectWorkspaces:re,onSelectSession:_,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,onStartSessionSelection:me,onCancelWait:Q}){return e(d,{children:[e(po,{searchQuery:x,sortOption:v,optionsOpen:w,showArchived:c,optionsRef:R,onNewSession:A,onNewWorkspace:D,onScheduler:O,scheduledCount:E,onRefresh:T,refreshing:W,onToggleOptions:B,onSortChange:Y,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:q,onSelectWorkspaces:re,selecting:P}),e("div",{className:"px-3 pt-2 pb-1",children:e(Us,{options:N,value:k,onChange:y,touch:!0})}),l?e(Zs,{touch:!0,onRetry:T,refreshing:W}):r?e(wo,{}):e(xo,{folders:t,activeSessionId:m,expandedFolders:b,showArchived:c,sessionStatus:g,onSelectSession:_,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,batch:M,onStartSessionSelection:me,onCancelWait:Q})]})}function yo({sidebarStyle:t,controller:r,batch:l,dock:m,dockBody:b,expandedFolders:g,optionsRef:x,activeSessionId:v,scheduledCount:w,onToggleFolder:c,onNewSession:k,onNewWorkspace:y,onScheduler:N,onToggleArchived:R,onNewSessionForFolder:E,onNewWorktreeSession:W,onToast:P,onArchiveSelected:M,onCancelWait:A}){let{initializing:D,failed:O,refreshNow:T,isRefreshing:B,searchQuery:Y,setSearchQuery:z,showArchived:F,setShowArchived:te,optionsOpen:H,setOptionsOpen:q,sortOption:re,handleSortChange:_,harnessFilter:ne,setHarnessFilter:ie,harnessOptions:ee,processedFolders:J,sessionStatus:me,handleSelectSession:Q}=r,{selection:oe,deleteRun:ue,archiveRun:ke,binding:ge,scopeFolder:be,available:V,selected:j}=l,Z={className:"flex-1 min-h-0 w-full",folders:J,initializing:D,failed:O,activeSessionId:v,sessionStatus:me,searchQuery:Y,onSearchChange:z,showArchived:F,onToggleArchived:R,sortOption:re,optionsOpen:H,onToggleOptions:()=>q(!H),onCloseOptions:()=>q(!1),onSortChange:_,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,onRefresh:T,refreshing:B,scheduledCount:w,onNewSession:k,onNewWorkspace:y,onScheduler:N,onSelectSession:Q,onNewSessionForFolder:E,onNewWorktreeSession:W,onToast:P,onCancelWait:A,batch:ge,onSelectWorkspaces:l.toggleWorkspaceSelection,onStartSessionSelection:(ye)=>oe.begin("session",ye)};return e(d,{children:[e("div",{className:m.showingSessions?"contents":"hidden",children:[t==="modern"?e(Hu,{...Z,touch:!0}):e(ko,{folders:J,initializing:D,failed:O,activeSessionId:v,expandedFolders:g,sessionStatus:me,searchQuery:Y,sortOption:re,optionsOpen:H,showArchived:F,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,optionsRef:x,scheduledCount:w,refreshing:B,selecting:oe.mode!==null,batch:ge,onNewSession:k,onNewWorkspace:y,onScheduler:N,onRefresh:T,onToggleOptions:()=>q(!H),onSortChange:_,onResetSort:()=>_("A-Z"),onToggleArchived:R,onHideArchived:()=>te(!1),onSearchChange:z,onClearSearch:()=>z(""),onSelectWorkspaces:l.toggleWorkspaceSelection,onSelectSession:Q,onNewSessionForFolder:E,onNewWorktreeSession:W,onToggleFolder:c,onToast:P,onStartSessionSelection:(ye)=>oe.begin("session",ye),onCancelWait:A}),oe.mode&&e(Yu,{drawer:!0,mode:oe.mode,count:j.length,total:V.length,busy:ue.isDeleting,archiving:ke.isArchiving,scopeLabel:be?.name,onSelectAll:()=>oe.selectAllOf(V),onUnselectAll:()=>oe.unselectAllOf(V),onDelete:()=>ue.request(j),onArchive:M,onCancel:oe.end})]}),m.showingSessions?null:e(lo,{panelKey:m.activeView,panel:m.activePanel,body:b})]})}function No(t,r){let l=t.tabs;Rs({enabled:t.tabsMode,revealed:Wf(r),storedView:t.activeView,home:l?.home??!1,chosenHome:l?.chosenHome??!1,openTab:l?.open??null,known:new Set(t.catalog.map((g)=>g.id))});let m=i(!1),b=l?{...l,select:(g)=>{m.current=!0,l.select(g)},open:(g)=>{m.current=!0,l.open(g)},close:(g)=>{m.current=!0,l.close(g)}}:null;return o(()=>{if(!t.tabsMode||!l)return;if(l.active!==null&&l.active!==t.activeView)t.setActiveView(l.active)},[t.tabsMode,l?.active,t.activeView,t.setActiveView]),o(()=>{if(!t.tabsMode||!l)return;if(m.current){m.current=!1;return}if(l.tabs.includes(t.activeView))return;if(!t.catalog.some((g)=>g.id===t.activeView))return;l.open(t.activeView)},[t.tabsMode,l,t.activeView,t.catalog]),{tabs:b}}function Ie(t){return{dragRegion:!0,layout:"mobile",rootProps:{...Ua(),...t},style:{paddingLeft:Ni(Di("0.75rem",!0)),paddingRight:Fl("0.75rem",!0)}}}function Co({side:t,onClose:r}){let l=t==="left"?dn:ir;return e("button",{type:"button",onClick:r,className:`${Ve.mobile} flex-none cursor-pointer rounded-lg text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink titlebar-no-drag`,title:t==="left"?"Tutup panel kiri":"Tutup panel kanan","aria-label":t==="left"?"Close left sidebar":"Close right sidebar",children:e(l,{size:Or.mobile,strokeWidth:1.8})})}function Mo({activeSessionId:t,newWorkspaceOpen:r,onCloseNewWorkspace:l,schedulerOpen:m,onCloseScheduler:b,aboutOpen:g,onCloseAbout:x,updates:v,pushToast:w,batchDelete:c,batchMode:k,onEndBatch:y,scopeLabel:N}){return e(d,{children:[e(Is,{isOpen:r,onClose:l,onCreate:Ll,onClone:Ml}),e(Gu,{isOpen:m,onClose:b,activeSessionId:t===null?null:String(t),onToast:w}),e(jd,{isOpen:g,onClose:x,updates:v,onToast:w}),e(Vf,{updates:v}),e(Ju,{mode:k??"session",count:c.pending.length,scopeLabel:N,isDeleting:c.isDeleting,progress:c.progress,outcome:c.outcome,onClose:()=>{let R=c.outcome?.refused.length??0;if(c.cancel(),c.outcome&&R===0)y()},onConfirm:()=>{let R=k??"session";c.confirm(R).then((E)=>{if(E&&E.refused.length===0)y()})}})]})}function Ro(){let t=Qt(),r=dr("left"),[l,m]=io("layout.mobileLeftPanel",Qe),b=jf(l,t.enabled),g=lp("left"),x=t.enabled&&g==="tabs",v=u(()=>new Set(r.map((c)=>c.id)),[r]),w=Qs("left",v,Qe);return{catalog:r,activeView:b,setActiveView:m,showingSessions:b===Qe,activePanel:r.find((c)=>c.id===b),enabled:t.enabled,tabsMode:x,tabs:x?w:null}}function To(t){return{className:"w-full h-full",sessionId:t.sessionId===null?null:String(t.sessionId),enabled:t.requiresWorkspace?t.hasActiveContext===!0:!0,active:!0,refreshKey:t.refreshKey,...t.rootPath?{rootPath:t.rootPath}:{},...t.onRefresh?{onRefresh:t.onRefresh}:{},...t.onOpenFile?{onOpenFile:t.onOpenFile}:{},onClose:t.onClose,showHeader:!1,layout:"phone"}}function Eo({appSettings:t,onSelectSession:r,onClose:l,rootPath:m,refreshKey:b,onRefresh:g,onOpenFile:x}){let v=qu(t,{onSelectSession:r,onAfterSelect:l}),{folders:w,processedFolders:c,refreshNow:k,showArchived:y,activeSessionId:N}=v,R=Vu(c,y,k),[E,W]=n({1:!0,2:!0,3:!0}),P=i(null);he(P,()=>v.setOptionsOpen(!1));let M=(T)=>{W((z)=>({...z,[T]:!z[T]}));let B=w.find((z)=>z.id===T),Y=!(E[T]??B?.isExpanded??!0);hp(T,Y)},A=c.map((T)=>`${T.id}:${T.isExpanded}`).join("|");o(()=>{W(Object.fromEntries(c.map((T)=>[T.id,T.isExpanded])))},[A]);let D=Ro(),O=To({sessionId:N,refreshKey:b,rootPath:m,onRefresh:g,onOpenFile:x,onClose:l,requiresWorkspace:D.activePanel?.requiresWorkspace??!1,hasActiveContext:Boolean(m)});return{controller:v,batch:R,expandedFolders:E,toggleFolder:M,optionsRef:P,dock:D,dockBody:O}}function Be(t){let{disabledPanels:r}=kn(),{setEnabled:l}=Tl(),m=Oe(),b=Hf(t),g=a((x,v)=>{l(x,v)},[l]);return{...m,items:b,hidden:r,toggle:g}}function Do({activeSessionId:t,onSelectSession:r,onNewSession:l,onNewSessionForFolder:m,onNewWorktreeSession:b,onClose:g,onDesktopToggle:x,appSettings:v={},rootPath:w,refreshKey:c=0,onRefresh:k,onOpenFile:y,revealSignal:N=0}){let{controller:R,batch:E,expandedFolders:W,toggleFolder:P,optionsRef:M,dock:A,dockBody:D}=Eo({appSettings:v,onSelectSession:r,onClose:g,rootPath:w,refreshKey:c,onRefresh:k,onOpenFile:y}),{showArchived:O,setShowArchived:T}=R,{selection:B,deleteRun:Y,archiveRun:z,selected:F,scopeFolder:te}=E,H=Sd(),q=Be("left"),[re,_]=n(!1),[ne,ie]=n(!1),ee=Uu(),[J,me]=n(!1),{pushToast:Q}=We(),oe=Rl(Q);Wu({onNotice:Q});let{updates:ue,shellDownload:ke}=no({onClose:g,openAbout:()=>me(!0),pushToast:Q}),{tabs:ge}=No(A,N),be=()=>{l(),g()},V=()=>{z.archive(F).then((Se)=>{if(!Se)return;let Ne=Ku(Se);if(Ne)Q(Ne.message,Ne.tone);if(!Se.error)B.end()})},j=(Se)=>{m(Se),g()},Z=()=>{T(!O)},ye=b?(Se,Ne)=>{b(Se,Ne),g()}:void 0,Pe=e(yo,{sidebarStyle:H,controller:R,batch:E,dock:A,dockBody:D,expandedFolders:W,optionsRef:M,activeSessionId:t,scheduledCount:ee,onToggleFolder:P,onNewSession:be,onNewWorkspace:()=>_(!0),onScheduler:()=>ie(!0),onToggleArchived:Z,onNewSessionForFolder:j,...ye?{onNewWorktreeSession:ye}:{},onToast:Q,onArchiveSelected:V,onCancelWait:oe});return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[e(oo,{onClose:g,viewLabel:A.showingSessions?"Sessions":A.activePanel?.label??"Panel",menuProps:q.surfaceProps}),!A.tabsMode&&so(A.enabled)?e(ao,{panels:A.catalog,activeId:A.activeView,onSelect:A.setActiveView,menuProps:q.surfaceProps}):null,A.tabsMode&&ge?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(Ns,{catalog:A.catalog,tabs:ge,pinned:Qe,homeTitle:"Panel kiri",stripProps:Ie(q.surfaceProps),children:e("div",{className:"h-full w-full",children:Pe})})}):null,q.anchor?e(Zo,{anchor:q.anchor,items:q.items,hidden:q.hidden,onToggle:q.toggle,onClose:q.close}):null,A.tabsMode?null:e("div",{className:"contents",children:Pe}),e(to,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onKeyBindings:Qc,onAbout:()=>me(!0),shellDownload:ke,onDesktopToggle:x,updateAvailable:ue.hasUpdate,onUpdateClick:()=>{me(!0),ue.check()}}),e(Mo,{activeSessionId:t,newWorkspaceOpen:re,onCloseNewWorkspace:()=>_(!1),schedulerOpen:ne,onCloseScheduler:()=>ie(!1),aboutOpen:J,onCloseAbout:()=>me(!1),updates:ue,pushToast:Q,batchDelete:Y,batchMode:B.mode,onEndBatch:B.end,scopeLabel:te?.name})]})}function Fo({catalog:t,activeId:r,onSelect:l,hasGitChanges:m,onClose:b,menuProps:g}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Ua(),...g,style:ei(),children:[e("div",{className:"flex items-center min-w-0 titlebar-no-drag",children:e(Ae,{panels:t,activeId:r,onSelect:l,hasGitChanges:m})}),e("button",{type:"button",onClick:b,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2 titlebar-no-drag",title:"Close right sidebar","aria-label":"Close right sidebar",children:e(h,{size:20,strokeWidth:1.8})})]})}function Ue({panel:t,body:r}){if(!t)return e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(Fe,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Po,{value:r,children:t.render(r)})})}function Io({enabled:t=!0,rootPath:r,refreshKey:l=0,onRefresh:m,onOpenFile:b,onClose:g,revealSignal:x=0}){let[v,w]=io("layout.mobileRightPanel",Ic),{sessionId:c}=He(),k=Qt(),y=ro(dr("all"),Qe,k.enabled),N=y.find((_)=>_.id===v)??y[0],E=lp("right")==="tabs",W=u(()=>new Set(y.map((_)=>_.id)),[y]),P=Qs("right",W,null),M=we(c,"layout.mobileRightPanel")!==void 0;Rs({enabled:E,revealed:Wf(x),storedView:M?v:null,home:P.home,chosenHome:P.chosenHome,openTab:P.open,known:W});let{open:A,tabs:D}=P,O=(_)=>{if(_!==N?.id)Re(_)},T=i(!1),B={...P,select:(_)=>{T.current=!0,O(_),P.select(_)},open:(_)=>{T.current=!0,O(_),P.open(_)},close:(_)=>{T.current=!0,P.close(_)}};o(()=>{if(!E)return;if(P.active!==null&&P.active!==v)w(P.active)},[E,P.active,v,w]),o(()=>{if(!E||P.home)return;if(T.current){T.current=!1;return}if(!M)return;if(D.includes(v)||!W.has(v))return;A(v)},[E,P.home,M,v,D,A,W]);let Y=Rm(r,t),{changes:z}=bl(r,Y,t),F=z.length>0,te=a((_)=>{if(_!==N?.id)Re(_);w(_)},[N?.id,w]);o(()=>{if(!$e(N?.id))Lc()},[N?.id]);let H=Be(k.enabled?"right":"all"),q=k.enabled?H.items:H.items.filter((_)=>_.id!==Qe),re={className:"h-full w-full",enabled:t||!N?.requiresWorkspace,active:!0,refreshKey:l,...r?{rootPath:r}:{},onRefresh:m,onOpenFile:b,onClose:g,showHeader:!1,layout:"phone"};return e("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[E?null:e(Fo,{catalog:y,activeId:N?.id??v,onSelect:te,hasGitChanges:F,onClose:g,menuProps:H.surfaceProps}),E?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(Ns,{catalog:y,tabs:B,homeTitle:"Panel kanan",stripProps:Ie(H.surfaceProps),actions:e(Co,{side:"right",onClose:g}),children:e("div",{className:"h-full w-full",children:e(Ue,{panel:N,body:re})})})}):null,H.anchor?e(Zo,{anchor:H.anchor,align:"right",items:q,hidden:H.hidden,onToggle:H.toggle,onClose:H.close}):null,E?null:e("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:e(Ue,{panel:N,body:re})})]})}function Ce({label:t,onClick:r,active:l=!1,danger:m=!1,children:b}){let g=m?"bg-error text-error-on hover:bg-error/90":l?"bg-ink text-canvas":"text-ink/70 hover:bg-ink/10 hover:text-ink";return e("button",{type:"button",onClick:r,title:t,"aria-label":t,"aria-pressed":l||void 0,className:`${Ve.mobile} flex-none cursor-pointer rounded-lg transition-colors ${g}`,children:b})}var xe=Or.mobile;function Lo({actions:t}){let[r,l]=n(!1),m=i(null);return he(m,()=>l(!1),r),o(()=>{if(!r)return;let b=(g)=>{if(g.key==="Escape")l(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[r]),e("div",{className:"relative flex-none",ref:m,children:[e("button",{type:"button",onClick:()=>l((b)=>!b),title:"More file actions","aria-label":"More file actions","aria-haspopup":"menu","aria-expanded":r,className:`${Ve.mobile} flex-none cursor-pointer rounded-lg text-ink/70 transition-colors hover:bg-ink/10 hover:text-ink`,children:e(_e,{size:Or.mobile})}),r?e("div",{role:"menu","aria-label":"File actions",className:"absolute right-0 top-full z-50 mt-1 w-52 overflow-hidden rounded-xl border border-ink/15 bg-paper py-1 text-xs shadow-lg",children:t.map((b)=>{let g=b.icon;return e("button",{type:"button",role:"menuitem",onClick:()=>{l(!1),b.onSelect()},className:"flex w-full items-center gap-2 px-3 py-2.5 text-left text-ink/80 transition-colors hover:bg-ink/5 hover:text-ink",children:[e(g,{size:15,className:"flex-none text-ink/60"}),e("span",{className:"truncate",children:b.label})]},b.id)})}):null]})}var kt=420;function Bo({fileName:t,hasPreview:r,isPreview:l,hasReview:m,isReviewing:b,onToggleReview:g,wordWrap:x,copied:v,byteViewer:w=!1,missing:c=!1,onSave:k,onClose:y,onTogglePreview:N,onToggleFind:R,findOpen:E,onToggleWrap:W,onZoomOut:P,onZoomIn:M,onCopy:A,onDownload:D}){let O=uu(kt),T=u(()=>{let B=[];if(!w)B.push({id:"wrap",label:x?"Word wrap: on":"Word wrap: off",icon:pn,onSelect:W},{id:"zoom-out",label:"Decrease font size",icon:Ka,onSelect:P},{id:"zoom-in",label:"Increase font size",icon:Wa,onSelect:M});if(!O)B.push({id:"copy",label:v?"Copied":"Copy content",icon:v?f:ae,onSelect:A},{id:"download",label:"Download file",icon:fe,onSelect:D});return B},[w,O,x,v,W,P,M,A,D]);return e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between gap-1 px-3 flex-shrink-0 titlebar-drag-region",style:ei(),children:[e("div",{className:"flex items-center gap-1 min-w-0 titlebar-no-drag",children:[e(Ce,{label:"Close editor",onClick:y,children:e(mn,{size:xe,strokeWidth:2})}),e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(mt,{name:t,size:15,className:`flex-shrink-0${c?" text-error-text":""}`}),e("span",{className:`truncate font-semibold text-xs${c?" text-error-text line-through":" text-ink"}`,children:t})]})]}),e("div",{className:"flex flex-none items-center gap-0.5 text-ink/70 titlebar-no-drag",children:[c&&k&&e(Ce,{label:"Save and recreate the file",onClick:k,danger:!0,children:e(ht,{size:xe})}),!w&&e(Ce,{label:E?"Close find":"Find in file",onClick:R,active:E,children:e(U,{size:xe})}),m&&e(Ce,{label:b?"Exit review mode":"Review this document",onClick:g,active:b,children:e(nn,{size:xe})}),r&&e(Ce,{label:l?"View source":"Show preview",onClick:N,active:l,children:l?e(Nt,{size:xe}):e(et,{size:xe})}),O&&e(d,{children:[e(Ce,{label:"Copy content",onClick:A,children:v?e(f,{size:xe,className:"text-success-text"}):e(ae,{size:xe})}),e(Ce,{label:"Download file",onClick:D,children:e(fe,{size:xe})})]}),T.length>0&&e(Lo,{actions:T})]})]})}function _o({fileName:t,content:r,path:l,root:m,repo:b,fontSize:g,scrollRef:x,onScroll:v,isLoading:w,unsupported:c,loadError:k,reviewActive:y,onExitReview:N}){return e("div",{ref:x,onScroll:v,"data-testid":"editor-scroller",className:"flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text",children:w?e("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[e(p,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content..."})]}):c?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(fu,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:c})]}):k?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(I,{size:20,className:"text-error-text"}),e("span",{className:"text-xs text-error-text font-sans",children:["Could not read ",t]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:k})]}):e("div",{className:"p-4 bg-paper text-ink min-h-full font-sans",style:{fontSize:`${g}px`},children:e(Au,{content:r,file:{name:t,path:l,root:m,repo:b},active:y,onExit:N})})})}function Ho({file:t,editor:r,viewerKind:l,byteViewer:m,isPreview:b,isMd:g,content:x,language:v,wordWrap:w,fileKey:c,revealMarks:k,currentMark:y,surfaceRef:N,setCodeScroller:R,previewRef:E,scroll:W,fontSize:P,reviewActive:M,onExitReview:A,editorTheme:D,editorFontFamily:O,indentUnitText:T,typing:B}){let Y=a(async(z)=>{let F=await xu(t,z,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(F.status==="written")return{ok:!0};if(F.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(F.status==="needs-permission")return{ok:!1,error:"Tap Save again to grant write access."};return{ok:!1,error:F.error}},[t,r.baseMtimeMs]);if(r.isImage&&r.imageUrl)return e(Mi,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"});if(r.isImage||ku(l)&&(m||b))return e(zl,{kind:l,path:t.path??t.name,name:t.name,source:r.byteSource,content:r.content,root:t.root,repo:t.repo,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:Y,onDirtyChange:r.setBinaryDirty});if(r.isLoading||r.unsupported||r.loadError||g&&b)return e(_o,{fileName:t.name,content:x,path:t.path??t.name,root:t.root,repo:t.repo,fontSize:P,scrollRef:E,onScroll:W.onScroll,isLoading:r.isLoading,unsupported:r.unsupported,loadError:r.loadError,reviewActive:M,onExitReview:A});return e(bu,{ref:N,value:x,onValueChange:r.onChange,language:v,wordWrap:w,documentKey:c,marks:k,currentMark:y,onScroller:R,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",themeVars:D.vars,themes:D.themes,indentUnitText:T,typing:B,padding:12,placeholder:"This file is empty",style:{fontFamily:O,fontSize:`${P}px`,lineHeight:vs}})}function $o(){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error-text shrink-0",children:[e(I,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error-text",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]})}function Uo({isImage:t,byteViewer:r,viewerKind:l,lineCount:m,charCount:b,language:g,saveStatus:x,path:v,conflicts:w=0}){return e("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:t?e("span",{className:"uppercase",children:"Image"}):r?e("span",{className:"uppercase",children:ti[l]}):e(d,{children:[w>0&&e("span",{className:"text-error-text font-semibold tabular-nums",children:["⚠ ",w]}),e("span",{children:[m," lines"]}),e("span",{children:[b," chars"]}),e("span",{className:"uppercase",children:g})]})}),e("div",{className:"flex items-center space-x-2",children:[x==="saving"&&e(d,{children:[e(p,{size:10,className:"animate-spin"}),e("span",{children:"Saving…"})]}),x==="saved"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),e("span",{children:"Saved"})]}),x==="error"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),e("span",{className:"text-error-text",children:"Save failed"})]}),x==="idle"&&v&&e("span",{className:"truncate max-w-[140px]",children:v})]})]})}function Go({path:t,content:r,ready:l,surfaceRef:m}){let b=Tu(t,r,l),g=i(null);return o(()=>{if(!b||g.current===b.request)return;g.current=b.request;let x=b.matches[b.currentIndex];if(!x)return;m.current?.select(x.start,x.end,!1),m.current?.revealOffset(x.start)},[b,m]),{matches:b?.matches??[],currentIndex:b?.currentIndex??-1}}function Xo({path:t,content:r,documentKey:l,ready:m,surfaceRef:b,toggleWordWrap:g}){let x=Go({path:t,content:r,ready:m,surfaceRef:b}),v=Su({text:r,documentKey:l,readSelection:()=>b.current?.getSelection()??null,select:(w,c,k=!0)=>b.current?.select(w,c,k),reveal:(w)=>b.current?.revealOffset(w),applyDocument:(w,c,k)=>b.current?.applyDocument(w,c,k),toggleWordWrap:g});if(v.open&&v.matches.length>0)return{find:v,revealMarks:v.matches,currentMark:v.currentIndex};return{find:v,revealMarks:x.matches.length>0?x.matches:void 0,currentMark:x.currentIndex}}function Qo({path:t,symbols:r,total:l,truncated:m,emptyNotice:b,preview:g=!1}){let[x,v]=n(!1);if(!t)return null;let w=(c,k)=>{if(v(!1),g){let y=Rd(r,k);if(y)As({path:t,...y});return}Oo({path:t,line:c.line,column:c.column,length:c.name.length})};return e(d,{children:[e("div",{className:"absolute bottom-14 right-3 z-20",children:e("button",{type:"button",onClick:()=>v(!0),"aria-label":`Outline (${l} symbols)`,title:"Outline",className:"flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink",children:e(ia,{size:16})})}),x&&e(X,{onClose:()=>v(!1),maxWidthClass:"max-w-sm",zClass:"z-[70]",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(ia,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Outline"}),e("span",{className:"font-mono text-[11px] text-ink/40",children:m?`${r.length}/${l}`:l})]}),children:e("div",{className:"max-h-[60vh] overflow-y-auto scrollbar-overlay-container py-1",children:[r.length===0?e("div",{className:"px-4 py-3 text-[11px] italic text-ink/40",children:b}):r.map((c,k)=>e("button",{type:"button",onClick:()=>w(c,k),"aria-label":g?`${mi(c.kind)} ${c.name}`:`${mi(c.kind)} ${c.name}, line ${c.line}`,className:"flex w-full min-w-0 items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${16+c.depth*12}px`},children:[e(Cd,{kind:c.kind,size:13}),e("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-ink",children:c.name}),!g&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/40",children:c.line})]},`${c.line}:${c.kind}:${c.name}`)),m&&e("div",{className:"px-4 py-2 text-[11px] italic text-ink/40",children:Ed(l)})]})})]})}function ot({file:t,missing:r=!1,onClose:l,onFileSaved:m,onDropResult:b}){let g=Fs(t.path??t.name),[x,v]=n({}),[w,c]=n(zo),[k,y]=n(!0),N=jo(),R=Fi(),E=Ou(),W=zu(),P=g==="markdown",M=Ms[g]===!0,A=Eu[g]===!0,D=t.path??t.name,O=x[D]??Bu(g),T=Lu(String(D)),B=P&&O,Y=()=>v((Z)=>({...Z,[D]:!O})),z=du({enabled:Boolean(t.root),onResult:b}),F=_u(t,{flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:m,missing:r}),[te,H]=n(null),q=Xs({tabKey:D,surface:P&&O?"rendered":"code",ready:F.loaded,slot:ib,element:P&&O?void 0:te}),[re,_]=n(null),ne=a((Z)=>{q.ref(Z),_(Z)},[q.ref]);vu({path:t.path??null,scroller:re,preview:P&&O});let ie=i(null),{find:ee,revealMarks:J,currentMark:me}=Xo({path:t.path??null,content:F.content,documentKey:`${D}\x00${F.language}`,ready:F.loaded&&!F.loadError,surfaceRef:ie,toggleWordWrap:()=>y((Z)=>!Z)}),{content:Q,language:oe}=F,ue=Q.split(`
2
- `).length,ke=hu(Q);Du({file:{id:D,name:t.name,path:t.path??D},editor:F,surfaceRef:ie,isPreview:O,exitPreview:()=>v((Z)=>({...Z,[D]:!1})),publish:!1});let{symbols:ge,total:be,truncated:V,notice:j}=Bd({content:Q,language:oe,path:t.path??null,state:M?"not-a-document":F.loadError?"error":F.loaded?"ready":"loading",note:M?`${ti[g]} files have no text outline.`:F.loadError});return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",...z.dropProps,...z.captureDropProps,children:[e($l,{visible:z.isDragging}),e(Bo,{fileName:t.name,hasPreview:A,isPreview:O,wordWrap:k,copied:F.copied,byteViewer:M,missing:r,onSave:F.saveNow,onClose:l,onTogglePreview:Y,hasReview:B,isReviewing:B&&T.active,onToggleReview:T.toggle,onToggleFind:()=>ee.open?ee.close():ee.openFind(),findOpen:ee.open,onToggleWrap:()=>y(!k),onZoomOut:()=>c((Z)=>Math.max(El,Z-1)),onZoomIn:()=>c((Z)=>Math.min(Bl,Z+1)),onCopy:F.copy,onDownload:F.download}),r&&e($o,{}),F.diskChange&&e(Nu,{fileName:t.name,onReload:F.reloadFromDisk,onKeepMine:F.keepMineAgainstDisk}),ee.open&&!M&&e("div",{className:"relative shrink-0 h-9 border-b border-ink/10 bg-paper",children:e(yu,{find:ee})}),e(Ho,{file:t,editor:F,viewerKind:g,byteViewer:M,isPreview:O,isMd:P,content:Q,language:oe,wordWrap:k,fileKey:D,revealMarks:J,currentMark:me,surfaceRef:ie,setCodeScroller:H,previewRef:ne,scroll:q,fontSize:w,reviewActive:B&&T.active,onExitReview:T.toggle,editorTheme:R,editorFontFamily:N,indentUnitText:Pu(E),typing:W}),!M&&e(Qo,{path:t.path??null,symbols:ge,total:be,truncated:V,emptyNotice:j,preview:P&&O}),e(Uo,{isImage:F.isImage,byteViewer:M,viewerKind:g,lineCount:ue,charCount:Q.length,language:oe,saveStatus:F.saveStatus,path:t.path,conflicts:ke}),F.saveMissingConfirm&&t.path&&e(Ru,{fileName:t.name,filePath:t.path,onClose:F.cancelSaveMissing,onConfirm:F.confirmSaveMissing})]})}function tt({diff:t,onClose:r,onFileSaved:l}){let m=t.path.split("/").pop()||t.path,b=Boolean(t.staged),g=t.status||"M",x=sr(g,b);return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:ei(),children:[e("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[e("button",{type:"button",onClick:r,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:e(mn,{size:18,strokeWidth:1.9})}),e(mt,{name:m,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:m})]}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${x.badgeBgClass}`,children:[x.charStatus," ",x.label]})]}),e("div",{className:"flex-1 min-h-0",children:e(gu,{className:"h-full",viewModeButtons:!1,filePath:t.path,status:g,isStaged:b,root:t.root,repo:t.repo||".",journalDiff:t.journal,readOnly:Boolean(t.journal),onFileSaved:l,tabKey:t.journal?tg(t.journal.path,t.journal.from,t.journal.to):eg(t.path,b)})})]})}function De(t,r){let l=t[r];return typeof l==="string"&&l.length>0?l:void 0}function yt(t){let r=t.content;return typeof r==="string"?r:void 0}function Ge(t,r){let l=typeof t==="object"&&t!==null?t:{},m=(De(l,"path")??"").replace(/^\/+/,"");if(!m)return null;return{name:De(l,"name")??m.split("/").pop()??"file",path:m,content:yt(l),root:De(l,"root")??r??void 0,repo:De(l,"repo"),handleId:De(l,"handleId"),deviceFile:l.deviceFile===!0?!0:void 0}}function nt(t){if(!t)return[];return[{id:"mobile-editor",path:t.path,root:t.root,repo:t.repo,content:t.content,handleId:t.handleId,deviceFile:t.deviceFile}]}function it(t,r,l){ho(l);let m=ur(r);return an(m,BA,{folderId:r,worktreePath:l}),t.setSearchParams((b)=>{let g=Mt(b);return g.set("sessionId",m),g.set("folderId",r.toString()),g},{replace:!0}),t.afterNavigate?.(),m}function Qd({onDesktopToggle:t,appSettings:r={}}){let{folders:l,isMock:m}=at(),b=Qt(),{sessionId:g}=He(),[x,v]=ce(),w=x.get("sessionId"),c=w?Number.isNaN(Number(w))?w:Number(w):null,k=x.get("folderId"),y=k?Number.isNaN(Number(k))?k:Number(k):null,[N,R]=n("main"),E=qe({dock:b,sessionId:g,currentScreen:N,setCurrentScreen:R}),[W,P]=n(null),[M,A]=n(null),[D,O]=n(0),[T,B]=n(!1),[Y,z]=n("appearance"),[F,te]=n(!1),H=a(()=>O((V)=>V+1),[]),q=Iu(nt(W),D),{pushToast:re}=We(),_=a((V)=>re(V.message,V.ok?"success":"error"),[re]),ne=q.size>0;Xe({editorOpen:W!==null,diffOpen:M!==null,settingsOpen:T,offMainScreen:N!=="main",onCloseEditor:()=>P(null),onCloseDiff:()=>A(null),onCloseSettings:()=>{B(!1),te(!1)},onReturnToMain:()=>R("main")});let{folder:ie}=Pl(l,c),ee=ie??(y?l.find((V)=>String(V.id)===String(y))??null:null),J=sg(l,c)??ee?.project_path??null,me=!!ee,Q=du({enabled:me,onResult:_});se("omp:open-file",(V)=>{let Z=Ge(V.detail,J);if(Z)P(Z)}),se("omp:open-diff",(V)=>{let j=V.detail;if(!j?.file)return;A({path:j.file.replace(/^\/+/,""),status:j.status,staged:j.staged,repo:j.repo,root:j.root??J??void 0,...j.source==="journal"&&j.journal?{journal:j.journal}:{}})}),se("omp:view-subagent",()=>R("main")),se("omp:open-settings",(V)=>{let j=V.detail;z(j?.category??"appearance"),te(Boolean(j?.autoOpenAdd)),B(!0)});let oe=(V)=>{v((j)=>{let Z=Mt(j);if(Z.set("sessionId",V.toString()),Z.has("subagent"))Z.delete("subagent");return Z},{replace:!0}),R("main")},ue=()=>{v(new URLSearchParams,{replace:!0}),R("main")},ke=(V)=>{let j=Ql(l,w,V);if(j)ho(j);v((Z)=>Fc(Z,ur(V),V),{replace:!0}),R("main")},ge=(V,j)=>it({setSearchParams:v,afterNavigate:()=>R("main")},V,j),be=a((V)=>{let j=Ge(V,J);if(j)P(j)},[J]);return e("div",{"data-testid":"app-root",className:"app-window flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[e(mg,{}),e(fg,{isMock:m}),e(gg,{workspacePath:J}),e("div",{className:`flex-1 min-h-0 w-full relative ${N==="main"?"block":"hidden"}`,...Q.dropProps,...Q.captureDropProps,children:[e($l,{visible:Q.isDragging}),e(eo,{activeSessionId:c,onSelectSession:oe,onNewSession:ue,onOpenSessionSidebar:E.openSessionDrawer,onOpenRightSidebar:E.openRightDrawer,appSettings:r})]}),e("div",{className:`flex-1 min-h-0 w-full ${N==="session"?"block":"hidden"}`,children:e(Do,{activeSessionId:c,onSelectSession:oe,onNewSession:ue,onNewSessionForFolder:ke,onNewWorktreeSession:ge,onClose:()=>R("main"),onDesktopToggle:t,appSettings:r,rootPath:J??void 0,refreshKey:D,onRefresh:H,onOpenFile:be,revealSignal:E.left})}),N==="right"&&e("div",{className:"flex-1 min-h-0 w-full",children:e(Io,{enabled:me,rootPath:J??void 0,refreshKey:D,onRefresh:H,onOpenFile:be,onClose:()=>R("main"),revealSignal:E.right})}),W&&e(ot,{file:W,missing:ne,onClose:()=>P(null),onFileSaved:H}),M&&e(tt,{diff:M,onClose:()=>A(null),onFileSaved:H}),e(Dl,{isOpen:T,onClose:()=>{B(!1),te(!1)},initialCategory:Y,autoOpenAddProvider:F,appSettings:r})]})}export{Qd as MobileLayoutWrapper};
1
+ import{d,n,o,K,i,u,a,Pe,ce,Ut,Ic,e,s,Le,Ie,p,dn,pn,B,mt,mn,f,C,se,ft,ae,me,Qt,nt,yn,de,Ye,Ae,Sa,ia,nn,Da,ir,L,S,U,hl,h,sr,bl,We,xe,an,Nh,io,Rm,kn,Ne,Rt,Po,Je,kl,Or,$e,X,gt,Re,Me,Oo,As,Rd,Tc,le,Ve,bs,Qc,i0,Lc,Mt,Fc,vs,zo,El,Bl,jo,ot,ct,pa,it,Tl,Ao,Dl,ru,$a,au,jd,Is,za,qo,Wo,Ko,Tt,ur,Ds,Vo,Yo,Jo,ho,Ql,Rl,Ll,Ml,dr,jf,Hf,Zo,lu,qf,Ns,Qs,Wf,Rs,Vf,Yf,Jf,cu,Di,Fl,Ua,Ni,Zf,Xf,uu,eg,tg,ib,Yd,cb,ei,Jd,_n,ng,rg,ag,og,BA,Pl,sg,lg,du,$l,mg,fg,np,gg,mb}from"./index-cc7qbfvn.js";import{lp}from"./index-tv9rn2nd.js";import"./index-7sq6cjt1.js";import{fu,gu,Au,hu,bu,yu,vu,Mi,ku,zl,xu}from"./index-zs7kw0be.js";import{Xs}from"./index-5xxbbzqa.js";import"./index-zhgh7a31.js";import{Ms,Eu,Bu,ti,Fs,Iu,_u,Su,Tu,Du,Nu,Ru,Lu}from"./index-wn28m9h7.js";import{wd,Cd,mi,Ed,Bd}from"./index-f61c25vn.js";import{yt,Fi,Pu,Ou,zu}from"./index-skwem10a.js";import{$s,ja,Ur,Uu,Gu,ni,ju,zs,Ap,zA,Us,Gs,js,Gr,Hs,qs,ri,Ws,Ks,Vs,Ys,Oi,ai,Js,Zs,Hu,hp,qu,Wu,Ku,Vu,Yu,Ju}from"./index-f27wvdky.js";import{Wa,Ka}from"./index-kzzvrqnv.js";import{Sd}from"./index-m5n0zsft.js";function qe(t){let{editorOpen:r,diffOpen:l,settingsOpen:m,offMainScreen:b,onCloseEditor:g,onCloseDiff:x,onCloseSettings:v,onReturnToMain:w}=t;o(()=>mb(()=>{if(r)return g(),!0;if(l)return x(),!0;if(m)return v(),!0;if(b)return w(),!0;return!1}),[r,l,m,b,g,x,v,w])}var ht="terminal";function Ue(t){return t===ht}function Ee(t){if(Ue(t))i0()}function Ze({dock:t,sessionId:r,currentScreen:l,setCurrentScreen:m}){let[b,g]=n(0),[x,v]=n(0),w=a(()=>{let y=xe(r,"layout.mobileRightPanel")??Ic;Ee(y),g((N)=>N+1),m("right")},[r,m]),c=a(()=>{v((y)=>y+1),m("session")},[m]),k=a((y)=>{let N=cb(y,t);if(!N)return;let R=xe(r,"layout.mobileRightPanel");if(N==="right"&&(l!=="right"||R!==y))Ee(y);if(an(r,N==="left"?"layout.mobileLeftPanel":"layout.mobileRightPanel",y),N==="right")g(0);m(N==="left"?"session":"right")},[t,r,l,m]);return le(Yd,(y)=>{let N=y.detail?.panelKey;if(N)k(N)}),{right:b,left:x,openSessionDrawer:c,openRightDrawer:w,openNamedPanel:k}}var bt={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]},Qe=s(bt);function Be(){let t=bs(),[r,l]=n(null),m=a((x,v)=>{l({top:v,bottom:v,left:x,right:x})},[]),b=wd({enabled:t,onLongPress:m}),g=a(()=>l(null),[]);return{anchor:r,close:g,surfaceProps:{onContextMenu:(x)=>{x.preventDefault();let v=x.currentTarget.getBoundingClientRect();l({top:v.top,bottom:v.bottom,left:v.left,right:v.right})},onTouchStart:b.onTouchStart,onTouchMove:b.onTouchMove,onTouchEnd:b.onTouchEnd,onTouchCancel:b.onTouchCancel,onClickCapture:(x)=>{if(!b.consume())return;x.preventDefault(),x.stopPropagation()}}}}var vt=10,eo=600000;function oo({activeSessionTitle:t,activeSessionId:r,onOpenSessionSidebar:l,onOpenRightSidebar:m,onNewSession:b,onSelectSession:g}){let{folders:x}=it(),v=np(),w=za(r),[c,k]=n(null),{hidden:y,setHidden:N}=rg(),R=Be(),E=Jd("mobile"),I=u(()=>{let M=Date.now(),A=[];for(let D of x)for(let O of D.sessions??[]){if(O.is_archived===1)continue;let T=Nh(String(O.id)),W=O.updated_at?Date.parse(O.updated_at):0,Y=T!==void 0&&M-T<=eo?T:W;if(T!==void 0&&M-T>eo)continue;A.push({id:O.id,title:O.title,folderName:D.name,modified:Y})}return A.sort((D,O)=>O.modified-D.modified).slice(0,vt)},[x]),P=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return e("header",{className:`flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between ${kl} px-3 z-20 titlebar-drag-region select-none`,...Ua(),...R.surfaceProps,style:ei(),children:[e("div",{className:"flex items-center space-x-2 flex-1 min-w-0 titlebar-no-drag",children:[e("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 inline-flex items-center justify-center",title:"Open Sessions","aria-label":"Open Sessions",children:e(Qe,{size:20,strokeWidth:2})}),e("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[e($a,{glow:!0}),e("span",{className:"absolute -top-0.5 -right-1.5 flex",children:e(cu,{status:v})})]}),e("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),e("div",{className:"relative min-w-0 flex-1 max-w-[150px]","data-testid":"session-picker",children:[e("button",{type:"button",onClick:(M)=>{k((A)=>A?null:Re(M.currentTarget))},className:"tap-chip flex w-full items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 min-w-0",title:P,"aria-haspopup":"menu","aria-expanded":c!==null,children:[e("span",{className:"truncate",children:P}),w&&e(p,{size:12,className:"animate-spin text-ink/50 flex-shrink-0",role:"status","aria-label":"Generating a session name…"}),e(C,{size:13,className:"text-ink/50 flex-shrink-0"})]}),c&&e(Me,{anchor:c,align:"start",className:"w-72 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",onClose:()=>k(null),children:[e("button",{type:"button",onClick:()=>{k(null),b()},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5",children:[e(L,{size:14}),e("span",{children:"Start New Session"})]}),e("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),e("div",{className:"max-h-64 scrollbar-overlay-container space-y-0.5",children:I.length===0?e("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):I.map((M)=>e("button",{type:"button",onClick:()=>{k(null),g(M.id)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(r)===String(M.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:"truncate",children:M.title?M.title.charAt(0).toUpperCase()+M.title.slice(1):"Untitled"}),e("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:M.folderName})]}),String(r)===String(M.id)&&e(f,{size:12,className:"flex-shrink-0"})]},M.id))})]})]})]}),e(ag,{layout:"mobile",sessionId:r==null?null:String(r),showRightPanel:!1,onToggleRightPanel:m,entries:E,hidden:y}),R.anchor?e(Zo,{anchor:R.anchor,title:"Navbar",align:"right",items:ng([...E.inline,...E.folded]).filter((M)=>M.id!==_n.install).map((M)=>({...M,removable:!0})),hidden:y,onToggle:N,onClose:R.close}):null]})}function to({activeSessionId:t,onSelectSession:r,onNewSession:l,onOpenSessionSidebar:m,onOpenRightSidebar:b,appSettings:g={}}){let{folders:x}=it(),[v,w]=n(null),c=u(()=>{if(!t)return"New session";for(let y of x){let N=y.sessions?.find((R)=>String(R.id)===String(t));if(N)return N.title}return null},[t,x]);return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[e(oo,{activeSessionTitle:v||c||"New session",activeSessionId:t,onOpenSessionSidebar:m,onOpenRightSidebar:b,onNewSession:l,onSelectSession:r}),e("main",{className:"flex-1 min-h-0",children:e(lg,{appSettings:g,onSessionTitle:w,variant:"mobile"})})]})}function no({onClose:t,viewLabel:r="Sessions",menuProps:l}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Ua(),...l,style:{...ei()},children:[e("div",{className:"flex items-center space-x-2.5 titlebar-no-drag min-w-0",children:[e("span",{className:"font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:e($a,{className:"text-[16px]",glow:!0})}),e("span",{className:"text-ink/25 text-xs select-none flex-shrink-0",children:"/"}),e("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono truncate",children:r})]}),e("div",{className:"flex items-center gap-1 titlebar-no-drag flex-shrink-0",children:[e(og,{variant:"chip"}),e("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer",title:"Close sidebar","aria-label":"Close sidebar",children:e(h,{size:19,strokeWidth:2})})]})]})}function ro({onSettings:t,onKeyBindings:r,onAbout:l,updateAvailable:m,onUpdateClick:b,onDesktopToggle:g,shellDownload:x}){return e("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:[e("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(hl,{size:14}),e("span",{children:"Settings"})]}),e("button",{type:"button",onClick:r,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(Sa,{size:14}),e("span",{children:"Keys"})]}),e("button",{type:"button",onClick:l,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(Ae,{size:14}),e("span",{children:"About"})]}),x&&e(Jf,{download:x,variant:"label"}),g&&e("button",{type:"button",onClick:g,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[e(Da,{size:14}),e("span",{children:"Desktop"})]})]}),e("div",{className:"flex items-center gap-2",children:[e("span",{className:"font-mono text-[10px] text-ink/40",children:["v",ru.version]}),m&&e("button",{type:"button",onClick:b,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}function so(t){let r=Zf(),l=Yf();return le(au,()=>{t.onClose(),t.openAbout(),r.apply("kabmo").then((m)=>{if(!m)return;t.pushToast(m.message,Tc(m))})}),Xf(r,t.pushToast),{updates:r,shellDownload:l}}function ao(t,r,l){return t.filter((m)=>m.id!==r&&!(l&&m.side==="left"))}function lo(t){return t}var St=8;function _e({panels:t,activeId:r,onSelect:l,hasGitChanges:m=!1}){let b=i(null),g=i(new Map),x=i({activeId:r,panels:t});x.current={activeId:r,panels:t};let v=i({signature:"",width:0}),w=a(()=>{let c=b.current,k=g.current.get(x.current.activeId);if(!c||!k||c.clientWidth<=0)return;let y=`${x.current.activeId}\x00${x.current.panels.map((P)=>P.id).join("\x00")}`,N=v.current;if(N.signature===y&&N.width===c.clientWidth)return;v.current={signature:y,width:c.clientWidth};let R=c.getBoundingClientRect(),E=k.getBoundingClientRect(),I=qf({scrollLeft:c.scrollLeft,clientWidth:c.clientWidth,scrollWidth:c.scrollWidth,start:E.left-R.left+c.scrollLeft,size:E.width},St);if(I!==c.scrollLeft)c.scrollLeft=I},[]);return K(w,[r,t,w]),o(()=>{let c=b.current;if(!c||typeof ResizeObserver>"u")return;let k=new ResizeObserver(w);return k.observe(c),()=>k.disconnect()},[w]),e("div",{ref:b,className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:t.map((c)=>{let k=c.id===r;return e("button",{ref:(y)=>{if(y)g.current.set(c.id,y);else g.current.delete(c.id)},type:"button",onClick:()=>l(c.id),"aria-pressed":k,"aria-label":c.title,className:`tap-chip relative flex shrink-0 items-center transition-all cursor-pointer ${k?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:c.title,children:[e(Ao,{panelId:c.id,builtin:c.builtin,icon:c.builtin?c.icon:void 0,name:c.builtin?c.label:c.name,...c.iconUrl?{iconUrl:c.iconUrl}:{},...c.color?{color:c.color}:{},size:Ut}),k&&e("span",{className:`shrink-0 whitespace-nowrap ${c.id==="git"?"tracking-wide":""}`,children:c.label}),c.id==="git"&&m&&e("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},c.id)})})}function co({panels:t,activeId:r,onSelect:l,menuProps:m}){return e("div",{className:"px-3 py-1.5 border-b border-ink/10 bg-canvas flex-shrink-0",...m,children:e(_e,{panels:t,activeId:r,onSelect:l})})}function po({panelKey:t,panel:r,body:l}){if(!r)return e("div",{className:"flex-1 min-h-0",children:e(lu,{panelKey:t})});return e("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:e(Pe,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Po,{value:l,children:r.render(l)})})})}var De="w-9.5 h-9.5 rounded-xl border flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",Oe="border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink",mo="bg-ink/10 text-ink border-ink/30";function uo({searchQuery:t,sortOption:r,optionsOpen:l,showArchived:m,optionsRef:b,onNewSession:g,onNewWorkspace:x,onScheduler:v,scheduledCount:w,onRefresh:c,refreshing:k,onToggleOptions:y,onSortChange:N,onResetSort:R,onToggleArchived:E,onHideArchived:I,onSearchChange:P,onClearSearch:M,onSelectWorkspaces:A,selecting:D}){let{ref:O,width:T}=zs(0),W=zA(T),Y={};for(let q of Ap.slice(0,W))Y[q]=!0;let z=Ap.slice(W),F=m?"Hide archived sessions":"Show archived sessions",te=w>0?`Scheduled tasks (${w} armed)`:"Scheduled tasks",H=[];if(z.includes("new-workspace"))H.push({id:"new-workspace",label:"New Workspace",icon:yn,onSelect:x});if(z.includes("refresh"))H.push({id:"refresh",label:"Refresh sessions",icon:S,onSelect:c});if(z.includes("scheduler"))H.push({id:"scheduler",label:te,icon:ja,onSelect:v});if(z.includes("archive"))H.push({id:"archive",label:F,icon:mt,onSelect:E,active:m});if(z.includes("select"))H.push({id:"select",label:D?"Cancel selection":"Select workspaces",icon:Ur,onSelect:A,active:D});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[e("div",{ref:O,className:"flex items-center space-x-2",children:[e("button",{type:"button",onClick:g,"aria-label":"New Session",title:"New Session",className:"flex-1 min-w-0 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 text-xs font-semibold transition-all shadow-xs",children:[e(L,{size:15,strokeWidth:2.4,className:"shrink-0"}),e("span",{className:"min-w-0 truncate",children:"New Session"})]}),Y["new-workspace"]&&e("button",{type:"button",onClick:x,className:`${De} ${Oe}`,title:"New Workspace","aria-label":"New Workspace",children:e(yn,{size:16,strokeWidth:1.8})}),Y.scheduler&&e("button",{type:"button",onClick:v,className:`relative ${De} ${Oe}`,title:te,"aria-label":w>0?`Scheduled tasks, ${w} armed`:"Scheduled tasks",children:[e(ja,{size:16,strokeWidth:1.8}),w>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-[3px] rounded-full bg-ink text-canvas text-[10px] leading-[13px] text-center font-semibold",children:w>9?"9+":w})]}),Y.archive&&e("button",{type:"button",onClick:E,"aria-pressed":m,className:`${De} ${m?"bg-warning/15 border-warning/40 text-warning-text":Oe}`,title:F,"aria-label":F,children:e(mt,{size:16,strokeWidth:1.8})}),Y.select&&e("button",{type:"button",onClick:A,"aria-pressed":D,className:`${De} ${D?mo:Oe}`,title:D?"Cancel selection":"Select workspaces","aria-label":D?"Cancel selection":"Select workspaces",children:e(Ur,{size:16,strokeWidth:1.8})}),Y.refresh&&e("button",{type:"button",onClick:c,className:`${De} ${Oe}`,title:"Refresh sessions","aria-label":"Refresh sessions","aria-busy":k,children:e(S,{size:15,strokeWidth:1.8,className:k?"animate-spin":void 0})}),Y.sort&&e("div",{className:"relative flex-shrink-0",ref:b,children:[e("button",{type:"button",onClick:y,className:`${De} ${l||r!=="A-Z"?mo:Oe}`,title:"Sort workspaces","aria-label":"Sort workspaces",children:e($s,{size:15,strokeWidth:1.8})}),l&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:e(ni,{variant:"mobile",sortOption:r,onSortChange:N})})]}),z.length>0&&e(ju,{actions:H,sortHidden:z.includes("sort"),sortOption:r,onSortChange:N,layout:"mobile"})]}),e("div",{className:"relative flex items-center",children:[e(U,{size:14,className:"absolute left-3 text-ink/40"}),e("input",{type:"text",value:t,onChange:(q)=>P(q.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&e("button",{type:"button",onClick:M,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:e(h,{size:13})})]}),(m||r!=="A-Z")&&e("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:[r!=="A-Z"&&e("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e("span",{children:["Sort: ",r.replace("_"," ")]}),e("button",{type:"button",onClick:R,className:"hover:text-ink ml-0.5",title:"Reset sort",children:e(h,{size:10})})]}),m&&e("span",{className:"inline-flex items-center space-x-1 bg-warning/15 border border-warning/25 text-warning-text rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e(mt,{size:10}),e("span",{children:"Archived"}),e("button",{type:"button",onClick:I,className:"hover:text-warning-text ml-0.5",title:"Hide archived",children:e(h,{size:10})})]})]})]})}var xt="p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink";function fo({folder:t,canWorktree:r,onOpenFolder:l,onNewWorktree:m,onSelectSessions:b,confirmDelete:g,onPin:x,onDelete:v,onRequestDelete:w,onCancelDelete:c}){let[k,y]=n(!1),N=i(null),[R,E]=n(null),I=(P)=>()=>{y(!1),P()};return e("div",{className:"relative flex items-center",onClick:(P)=>P.stopPropagation(),children:[e("button",{ref:N,type:"button",onClick:(P)=>{if(P.stopPropagation(),N.current)E(Re(N.current));y((M)=>!M)},className:xt,title:"Workspace options","aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":k,children:e(Ie,{size:15})}),e(Me,{anchor:k?R:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"w-48 rounded-lg border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:()=>{y(!1),c()},children:e(Vs,{variant:"mobile",isPinned:t.isPinned,onOpenFolder:l?I(l):void 0,onNewWorktree:r&&m?I(m):void 0,onSelectSessions:b?I(b):void 0,confirmDelete:g,onPin:I(x),onDelete:I(v),onRequestDelete:w,onCancelDelete:c})})]})}var bo={inset:"",insetPx:0,slotWidth:16,markGap:8,padding:"py-2",glyph:ct.touch};function go({session:t,harness:r,isActive:l,status:m,awaitingInput:b=!1,timeAgo:g,timeTitle:x,runStartedAt:v,expandable:w=!1,isExpanded:c=!1,onToggleExpand:k,isChild:y=!1,folderId:N,onSelect:R,onArchive:E,onDelete:I,onRename:P,onRenameWithAi:M,waitingFor:A,onCancelWait:D,selectable:O=!1,selected:T=!1,onToggleSelect:W}){let{isEditing:Y,draft:z,setDraft:F,inputRef:te,startRename:H,handleKeyDown:q,handleBlur:re}=Ko(t.title,P),_=za(t.id),ne=Vo(),ie=ne.anchor!==null,ee=Boolean(P||E||I||D),J=Boolean(A),pe=w&&Boolean(k),Q=t.title.charAt(0).toUpperCase()+t.title.slice(1);if(Y)return e("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:e("input",{ref:te,autoFocus:!0,value:z,onChange:(oe)=>F(oe.currentTarget.value),onKeyDown:q,onBlur:re,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})});return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t.id),"data-menu-open":ie?"true":void 0,onContextMenu:ee&&!O?ne.openAtCursor:void 0,className:`w-full rounded-lg flex items-center transition-colors ${O&&T||ie?Ks:l?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[e("button",{type:"button",onClick:O?W:R,className:"flex-1 text-left py-2 flex items-center justify-between min-w-0",children:[e("div",{className:"flex items-center min-w-0 pr-2",children:[O?e(Gr,{checked:T,label:`Select ${t.title}`,onChange:()=>W?.()}):e("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:_?e("span",{role:"status","aria-label":"Generating a name…",children:e(p,{size:13,className:"text-ink/50 animate-spin"})}):b?e(Le,{size:13,className:"text-ink/70 animate-pulse"}):J?e("span",{role:"status","aria-label":`Waiting for ${A?.title??"another session"}`,children:e(Ye,{size:13,className:"text-ink/60 animate-pulse"})}):m==="stream"?e("span",{role:"status","aria-label":"Running",children:e(p,{size:13,className:"text-ink/50 animate-spin"})}):m?e(f,{size:13,className:"text-ink/50"}):y?e("span",{"data-testid":"child-indicator",className:"text-ink/35","aria-hidden":"true",children:e(de,{size:13})}):null}),e("span",{className:"flex flex-col min-w-0 ml-2 leading-snug",children:[e("span",{className:"flex min-w-0 items-center",children:[r&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(ot,{harness:r,size:ct.touch})}),e("span",{className:"min-w-0 truncate text-xs",children:Q})]}),J&&e("span",{className:"text-[10px] text-ink/40 truncate",children:["waiting for ",A?.title??"another session"]}),t.worktree?e(Hs,{worktree:t.worktree}):null]})]}),e(Ws,{timeAgo:g,timeTitle:x,runStartedAt:v,className:"text-[11px] font-mono flex-shrink-0 ml-2",restingClassName:"text-ink/45"})]}),ee&&!O&&e("button",{type:"button",onClick:ne.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":ie,className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:e(Ie,{size:16})}),pe&&!O&&e("button",{type:"button",onClick:k,title:c?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":c,"aria-label":c?"Collapse sessions and subagents":"Expand sessions and subagents",className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/50 hover:text-ink rounded-lg cursor-pointer",children:c?e(C,{size:14}):e(se,{size:14})})]}),ne.anchor&&e(Yo,{anchor:ne.anchor,sessionId:t.id,...r?{harness:r}:{},...N!==void 0?{folderId:N}:{},isArchived:t.is_archived===1,onRename:P?H:void 0,onRenameWithAi:M,onArchive:E,onDelete:I,onCancelWait:D,onClose:ne.close})]})}function vo(t,r){let[l,m]=n(!1);return{open:()=>m(!0),dialog:l?e(Jo,{isOpen:!0,onClose:()=>m(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(b)=>{m(!1),r(b.path)}}):null}}function So({hiddenCount:t,canShowLess:r,onShowMore:l,onShowLess:m}){if(t<=0&&!r)return null;return e("div",{className:"flex items-center gap-1",children:[t>0&&e("button",{type:"button",onClick:l,className:"flex items-center min-w-0 text-left py-2 pr-3 text-xs text-ink/60 hover:text-ink",children:[e("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:e(C,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate",children:["Show more sessions (",t,")"]})]}),r&&e("button",{type:"button",onClick:m,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/60 hover:text-ink pl-3 py-2",children:[e(ft,{size:12}),e("span",{className:"truncate",children:"Show less"})]})]})}function xo(t){return t?"mb-4":"mb-1"}function wo({folder:t,activeSessionId:r,onSelectSession:l,onNewSessionForFolder:m,onNewWorktreeSession:b,isExpanded:g,onToggleExpand:x,showArchived:v=!1,sessionStatus:w={},onToast:c,batch:k,onStartSessionSelection:y,onCancelWait:N}){let{visibleCount:R,showMore:E,showLess:I,canShowLess:P}=Gs(),M=vo(t,(G)=>b?.(t.id,G)),{refresh:A,runStartedAtMap:D}=it(),{expandedSessionIds:O,toggleSession:T}=Ds(),[W]=ce(),Y=W.get("subagent"),z=W.get("sessionId"),{confirmDelete:F,requestDelete:te,cancelDelete:H,handlePin:q,handleDelete:re,handleArchive:_,handleRename:ne,handleRenameWithAi:ie,handleOpenFolder:ee}=js(t,A,c),J=qo(),pe=q,Q=re,oe=ee??void 0,ue=(t.sessions||[]).filter((G)=>v?G.is_archived===1:G.is_archived!==1),Se=pa(t.icon),{folderCheckbox:he,sessionCheckboxes:fe,folderSummary:V,toggleFolderSelection:j,rendered:Z,hiddenCount:we}=Js({batch:k,folder:t,sessions:ue,showArchived:v,visibleCount:R,activeSessionId:r,sessionStatus:w}),Ce=ai(Z),ge=g||fe,ke=(G,Te)=>{let be=String(G.id),Xe=String(r)===be,pt=Xe&&z===be&&Boolean(Y),Ke=Tt(be);return e(go,{session:G,harness:G.harness,folderId:G.folder_id,isActive:Xe&&!pt,status:w[be],awaitingInput:Boolean(G.awaitingInput),timeAgo:qs(G.updated_at??G.created_at),timeTitle:ri(G.updated_at??G.created_at),runStartedAt:w[be]==="stream"?D[be]:void 0,expandable:Te.expandable,isChild:Te.isChild,isExpanded:Te.isExpanded,onToggleExpand:Te.onToggleExpand,onSelect:()=>l(G.id),onArchive:()=>_(G),onDelete:Ke?void 0:()=>J.requestDelete(G),onRename:Ke?void 0:(ut)=>void ne(G,ut),onRenameWithAi:Ke?void 0:()=>void ie(G),waitingFor:G.waitingFor?{title:G.waitingFor.title}:void 0,onCancelWait:G.waitingFor?()=>N?.(G.waitingFor.waitId):void 0,selectable:fe,selected:Boolean(k?.selected.includes(be)),onToggleSelect:k?()=>k.toggle(be):void 0})},dt=(G)=>Ys(G,Ce.childrenOf,O,T);return e("div",{className:xo(ge),"data-testid":"session-folder",children:[e("div",{onClick:k?void 0:x,className:"flex items-center justify-between gap-2 py-1 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[e("div",{className:"flex items-center space-x-2 min-w-0",children:[he&&V?e(Gr,{size:"md",checked:V.all,indeterminate:V.some,label:`Select ${t.name}`,onChange:j}):e(d,{children:e("span",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain",referrerPolicy:"no-referrer"}):t.iconType==="chat"?e(nn,{size:15,className:"text-ink/80"}):e(Se,{size:15,className:"text-ink/80",style:{color:t.accentColor||void 0}})})}),e("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),e("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[e("span",{className:"font-mono text-[11px] text-ink/70",children:ue.length}),t.project_path&&e(de,{size:13,className:"text-ink/50 ml-1"}),!k&&e(d,{children:[e("button",{type:"button",onClick:(G)=>{G.stopPropagation(),m(t.id)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"New Session","aria-label":`New session in ${t.name}`,children:e(L,{size:15})}),e(fo,{folder:t,canWorktree:Boolean(b&&t.project_path),onOpenFolder:oe,onNewWorktree:b?()=>M.open():void 0,onSelectSessions:y?()=>y(t.id):void 0,confirmDelete:F,onPin:pe,onDelete:Q,onRequestDelete:te,onCancelDelete:H}),e("span",{className:"flex items-center justify-center pr-1",children:g?e(C,{size:14}):e(se,{size:14})})]})]})]}),ge&&e("div",{className:"mt-0.5 space-y-0.5",children:[Ce.roots.map((G)=>{let Te=String(G.id),be=dt(G);return e("div",{className:"space-y-0.5",children:[ke(G,be),be.isExpanded&&e(Oi,{parentId:Te,hasSubagents:Boolean(G.hasSubagents),childrenOf:Ce.childrenOf,expandedIds:O,onToggle:T,activeSessionId:r===null?null:String(r),renderSession:ke,style:bo})]},G.id)}),e(So,{hiddenCount:fe?0:we,canShowLess:!fe&&P,onShowMore:E,onShowLess:I})]}),e(Wo,{session:J.pending,isDeleting:J.isDeleting,error:J.error,onClose:J.cancelDelete,onConfirm:()=>void J.confirmDelete()}),M.dialog]})}function ko({folders:t,activeSessionId:r,expandedFolders:l,showArchived:m,sessionStatus:b,onSelectSession:g,onNewSessionForFolder:x,onNewWorktreeSession:v,onToggleFolder:w,onToast:c,batch:k,onStartSessionSelection:y,onCancelWait:N}){return e("div",{className:"flex-1 scrollbar-overlay-container pl-3 pr-2 py-3",children:t.length===0?e("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map((R)=>e(wo,{folder:R,activeSessionId:r,onSelectSession:g,onNewSessionForFolder:x,onNewWorktreeSession:v,isExpanded:l[R.id]??!0,onToggleExpand:()=>w(R.id),showArchived:m,sessionStatus:b,onToast:c,batch:k,onStartSessionSelection:y,onCancelWait:N},R.id))})}var wt=[3,2];function yo(){return e("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:wt.map((t,r)=>e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center gap-2 py-2",children:[e("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(l,m)=>e("div",{className:"flex items-center gap-2 rounded py-2",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-m%3*12}%`}})]},m))]},r))})}function No({folders:t,initializing:r,failed:l,activeSessionId:m,expandedFolders:b,sessionStatus:g,searchQuery:x,sortOption:v,optionsOpen:w,showArchived:c,harnessFilter:k,onHarnessFilterChange:y,harnessOptions:N,optionsRef:R,scheduledCount:E,refreshing:I,selecting:P,batch:M,onNewSession:A,onNewWorkspace:D,onScheduler:O,onRefresh:T,onToggleOptions:W,onSortChange:Y,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:q,onSelectWorkspaces:re,onSelectSession:_,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,onStartSessionSelection:pe,onCancelWait:Q}){return e(d,{children:[e(uo,{searchQuery:x,sortOption:v,optionsOpen:w,showArchived:c,optionsRef:R,onNewSession:A,onNewWorkspace:D,onScheduler:O,scheduledCount:E,onRefresh:T,refreshing:I,onToggleOptions:W,onSortChange:Y,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:q,onSelectWorkspaces:re,selecting:P}),e("div",{className:"px-3 pt-2 pb-1",children:e(Us,{options:N,value:k,onChange:y,touch:!0})}),l?e(Zs,{touch:!0,onRetry:T,refreshing:I}):r?e(yo,{}):e(ko,{folders:t,activeSessionId:m,expandedFolders:b,showArchived:c,sessionStatus:g,onSelectSession:_,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,batch:M,onStartSessionSelection:pe,onCancelWait:Q})]})}function Co({sidebarStyle:t,controller:r,batch:l,dock:m,dockBody:b,expandedFolders:g,optionsRef:x,activeSessionId:v,scheduledCount:w,onToggleFolder:c,onNewSession:k,onNewWorkspace:y,onScheduler:N,onToggleArchived:R,onNewSessionForFolder:E,onNewWorktreeSession:I,onToast:P,onArchiveSelected:M,onCancelWait:A}){let{initializing:D,failed:O,refreshNow:T,isRefreshing:W,searchQuery:Y,setSearchQuery:z,showArchived:F,setShowArchived:te,optionsOpen:H,setOptionsOpen:q,sortOption:re,handleSortChange:_,harnessFilter:ne,setHarnessFilter:ie,harnessOptions:ee,processedFolders:J,sessionStatus:pe,handleSelectSession:Q}=r,{selection:oe,deleteRun:ue,archiveRun:Se,binding:he,scopeFolder:fe,available:V,selected:j}=l,Z={className:"flex-1 min-h-0 w-full",folders:J,initializing:D,failed:O,activeSessionId:v,sessionStatus:pe,searchQuery:Y,onSearchChange:z,showArchived:F,onToggleArchived:R,sortOption:re,optionsOpen:H,onToggleOptions:()=>q(!H),onCloseOptions:()=>q(!1),onSortChange:_,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,onRefresh:T,refreshing:W,scheduledCount:w,onNewSession:k,onNewWorkspace:y,onScheduler:N,onSelectSession:Q,onNewSessionForFolder:E,onNewWorktreeSession:I,onToast:P,onCancelWait:A,batch:he,onSelectWorkspaces:l.toggleWorkspaceSelection,onStartSessionSelection:(we)=>oe.begin("session",we)};return e(d,{children:[e("div",{className:m.showingSessions?"contents":"hidden",children:[t==="modern"?e(Hu,{...Z,touch:!0}):e(No,{folders:J,initializing:D,failed:O,activeSessionId:v,expandedFolders:g,sessionStatus:pe,searchQuery:Y,sortOption:re,optionsOpen:H,showArchived:F,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,optionsRef:x,scheduledCount:w,refreshing:W,selecting:oe.mode!==null,batch:he,onNewSession:k,onNewWorkspace:y,onScheduler:N,onRefresh:T,onToggleOptions:()=>q(!H),onSortChange:_,onResetSort:()=>_("A-Z"),onToggleArchived:R,onHideArchived:()=>te(!1),onSearchChange:z,onClearSearch:()=>z(""),onSelectWorkspaces:l.toggleWorkspaceSelection,onSelectSession:Q,onNewSessionForFolder:E,onNewWorktreeSession:I,onToggleFolder:c,onToast:P,onStartSessionSelection:(we)=>oe.begin("session",we),onCancelWait:A}),oe.mode&&e(Yu,{drawer:!0,mode:oe.mode,count:j.length,total:V.length,busy:ue.isDeleting,archiving:Se.isArchiving,scopeLabel:fe?.name,onSelectAll:()=>oe.selectAllOf(V),onUnselectAll:()=>oe.unselectAllOf(V),onDelete:()=>ue.request(j),onArchive:M,onCancel:oe.end})]}),m.showingSessions?null:e(po,{panelKey:m.activeView,panel:m.activePanel,body:b})]})}function Mo(t,r){let l=t.tabs;Rs({enabled:t.tabsMode,revealed:Wf(r),storedView:t.activeView,home:l?.home??!1,chosenHome:l?.chosenHome??!1,openTab:l?.open??null,known:new Set(t.catalog.map((g)=>g.id))});let m=i(!1),b=l?{...l,select:(g)=>{m.current=!0,l.select(g)},open:(g)=>{m.current=!0,l.open(g)},close:(g)=>{m.current=!0,l.close(g)}}:null;return o(()=>{if(!t.tabsMode||!l)return;if(l.active!==null&&l.active!==t.activeView)t.setActiveView(l.active)},[t.tabsMode,l?.active,t.activeView,t.setActiveView]),o(()=>{if(!t.tabsMode||!l)return;if(m.current){m.current=!1;return}if(l.tabs.includes(t.activeView))return;if(!t.catalog.some((g)=>g.id===t.activeView))return;l.open(t.activeView)},[t.tabsMode,l,t.activeView,t.catalog]),{tabs:b}}function He(t){return{dragRegion:!0,layout:"mobile",rootProps:{...Ua(),...t},style:{paddingLeft:Ni(Di("0.75rem",!0)),paddingRight:Fl("0.75rem",!0)}}}function Ro({side:t,onClose:r}){let l=t==="left"?dn:ir;return e("button",{type:"button",onClick:r,className:`${Je.mobile} flex-none cursor-pointer rounded-lg text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink titlebar-no-drag`,title:t==="left"?"Tutup panel kiri":"Tutup panel kanan","aria-label":t==="left"?"Close left sidebar":"Close right sidebar",children:e(l,{size:Or.mobile,strokeWidth:1.8})})}function To({activeSessionId:t,newWorkspaceOpen:r,onCloseNewWorkspace:l,schedulerOpen:m,onCloseScheduler:b,aboutOpen:g,onCloseAbout:x,updates:v,pushToast:w,batchDelete:c,batchMode:k,onEndBatch:y,scopeLabel:N}){return e(d,{children:[e(Is,{isOpen:r,onClose:l,onCreate:Ll,onClone:Ml}),e(Gu,{isOpen:m,onClose:b,activeSessionId:t===null?null:String(t),onToast:w}),e(jd,{isOpen:g,onClose:x,updates:v,onToast:w}),e(Vf,{updates:v}),e(Ju,{mode:k??"session",count:c.pending.length,scopeLabel:N,isDeleting:c.isDeleting,progress:c.progress,outcome:c.outcome,onClose:()=>{let R=c.outcome?.refused.length??0;if(c.cancel(),c.outcome&&R===0)y()},onConfirm:()=>{let R=k??"session";c.confirm(R).then((E)=>{if(E&&E.refused.length===0)y()})}})]})}function Eo(){let t=Rt(),r=dr("left"),[l,m]=io("layout.mobileLeftPanel",Ne),b=jf(l,t.enabled),g=lp("left"),x=t.enabled&&g==="tabs",v=u(()=>new Set(r.map((c)=>c.id)),[r]),w=Qs("left",v,Ne);return{catalog:r,activeView:b,setActiveView:m,showingSessions:b===Ne,activePanel:r.find((c)=>c.id===b),enabled:t.enabled,tabsMode:x,tabs:x?w:null}}function Do(t){return{className:"w-full h-full",sessionId:t.sessionId===null?null:String(t.sessionId),enabled:t.requiresWorkspace?t.hasActiveContext===!0:!0,active:!0,refreshKey:t.refreshKey,...t.rootPath?{rootPath:t.rootPath}:{},...t.onRefresh?{onRefresh:t.onRefresh}:{},...t.onOpenFile?{onOpenFile:t.onOpenFile}:{},onClose:t.onClose,showHeader:!1,layout:"phone"}}function Fo({appSettings:t,onSelectSession:r,onClose:l,rootPath:m,refreshKey:b,onRefresh:g,onOpenFile:x}){let v=qu(t,{onSelectSession:r,onAfterSelect:l}),{folders:w,processedFolders:c,refreshNow:k,showArchived:y,activeSessionId:N}=v,R=Vu(c,y,k),[E,I]=n({1:!0,2:!0,3:!0}),P=i(null);$e(P,()=>v.setOptionsOpen(!1));let M=(T)=>{I((z)=>({...z,[T]:!z[T]}));let W=w.find((z)=>z.id===T),Y=!(E[T]??W?.isExpanded??!0);hp(T,Y)},A=c.map((T)=>`${T.id}:${T.isExpanded}`).join("|");o(()=>{I(Object.fromEntries(c.map((T)=>[T.id,T.isExpanded])))},[A]);let D=Eo(),O=Do({sessionId:N,refreshKey:b,rootPath:m,onRefresh:g,onOpenFile:x,onClose:l,requiresWorkspace:D.activePanel?.requiresWorkspace??!1,hasActiveContext:Boolean(m)});return{controller:v,batch:R,expandedFolders:E,toggleFolder:M,optionsRef:P,dock:D,dockBody:O}}function ze(t){let{disabledPanels:r}=kn(),{setEnabled:l}=Tl(),m=Be(),b=Hf(t),g=a((x,v)=>{l(x,v)},[l]);return{...m,items:b,hidden:r,toggle:g}}function Io({activeSessionId:t,onSelectSession:r,onNewSession:l,onNewSessionForFolder:m,onNewWorktreeSession:b,onClose:g,onDesktopToggle:x,appSettings:v={},rootPath:w,refreshKey:c=0,onRefresh:k,onOpenFile:y,revealSignal:N=0}){let{controller:R,batch:E,expandedFolders:I,toggleFolder:P,optionsRef:M,dock:A,dockBody:D}=Fo({appSettings:v,onSelectSession:r,onClose:g,rootPath:w,refreshKey:c,onRefresh:k,onOpenFile:y}),{showArchived:O,setShowArchived:T}=R,{selection:W,deleteRun:Y,archiveRun:z,selected:F,scopeFolder:te}=E,H=Sd(),q=ze("left"),[re,_]=n(!1),[ne,ie]=n(!1),ee=Uu(),[J,pe]=n(!1),{pushToast:Q}=Ve(),oe=Rl(Q);Wu({onNotice:Q});let{updates:ue,shellDownload:Se}=so({onClose:g,openAbout:()=>pe(!0),pushToast:Q}),{tabs:he}=Mo(A,N),fe=()=>{l(),g()},V=()=>{z.archive(F).then((ge)=>{if(!ge)return;let ke=Ku(ge);if(ke)Q(ke.message,ke.tone);if(!ge.error)W.end()})},j=(ge)=>{m(ge),g()},Z=()=>{T(!O)},we=b?(ge,ke)=>{b(ge,ke),g()}:void 0,Ce=e(Co,{sidebarStyle:H,controller:R,batch:E,dock:A,dockBody:D,expandedFolders:I,optionsRef:M,activeSessionId:t,scheduledCount:ee,onToggleFolder:P,onNewSession:fe,onNewWorkspace:()=>_(!0),onScheduler:()=>ie(!0),onToggleArchived:Z,onNewSessionForFolder:j,...we?{onNewWorktreeSession:we}:{},onToast:Q,onArchiveSelected:V,onCancelWait:oe});return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[e(no,{onClose:g,viewLabel:A.showingSessions?"Sessions":A.activePanel?.label??"Panel",menuProps:q.surfaceProps}),!A.tabsMode&&lo(A.enabled)?e(co,{panels:A.catalog,activeId:A.activeView,onSelect:A.setActiveView,menuProps:q.surfaceProps}):null,A.tabsMode&&he?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(Ns,{catalog:A.catalog,tabs:he,pinned:Ne,homeTitle:"Panel kiri",stripProps:He(q.surfaceProps),children:e("div",{className:"h-full w-full",children:Ce})})}):null,q.anchor?e(Zo,{anchor:q.anchor,items:q.items,hidden:q.hidden,onToggle:q.toggle,onClose:q.close}):null,A.tabsMode?null:e("div",{className:"contents",children:Ce}),e(ro,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onKeyBindings:Qc,onAbout:()=>pe(!0),shellDownload:Se,onDesktopToggle:x,updateAvailable:ue.hasUpdate,onUpdateClick:()=>{pe(!0),ue.check()}}),e(To,{activeSessionId:t,newWorkspaceOpen:re,onCloseNewWorkspace:()=>_(!1),schedulerOpen:ne,onCloseScheduler:()=>ie(!1),aboutOpen:J,onCloseAbout:()=>pe(!1),updates:ue,pushToast:Q,batchDelete:Y,batchMode:W.mode,onEndBatch:W.end,scopeLabel:te?.name})]})}function Lo({catalog:t,activeId:r,onSelect:l,hasGitChanges:m,onClose:b,menuProps:g}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Ua(),...g,style:ei(),children:[e("div",{className:"flex items-center min-w-0 titlebar-no-drag",children:e(_e,{panels:t,activeId:r,onSelect:l,hasGitChanges:m})}),e("button",{type:"button",onClick:b,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2 titlebar-no-drag",title:"Close right sidebar","aria-label":"Close right sidebar",children:e(h,{size:20,strokeWidth:1.8})})]})}function Ge({panel:t,body:r}){if(!t)return e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(Pe,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Po,{value:r,children:t.render(r)})})}function Bo({enabled:t=!0,rootPath:r,refreshKey:l=0,onRefresh:m,onOpenFile:b,onClose:g,revealSignal:x=0}){let[v,w]=io("layout.mobileRightPanel",Ic),{sessionId:c}=We(),k=Rt(),y=ao(dr("all"),Ne,k.enabled),N=y.find((_)=>_.id===v)??y[0],E=lp("right")==="tabs",I=u(()=>new Set(y.map((_)=>_.id)),[y]),P=Qs("right",I,null),M=xe(c,"layout.mobileRightPanel")!==void 0;Rs({enabled:E,revealed:Wf(x),storedView:M?v:null,home:P.home,chosenHome:P.chosenHome,openTab:P.open,known:I});let{open:A,tabs:D}=P,O=(_)=>{if(_!==N?.id)Ee(_)},T=i(!1),W={...P,select:(_)=>{T.current=!0,O(_),P.select(_)},open:(_)=>{T.current=!0,O(_),P.open(_)},close:(_)=>{T.current=!0,P.close(_)}};o(()=>{if(!E)return;if(P.active!==null&&P.active!==v)w(P.active)},[E,P.active,v,w]),o(()=>{if(!E||P.home)return;if(T.current){T.current=!1;return}if(!M)return;if(D.includes(v)||!I.has(v))return;A(v)},[E,P.home,M,v,D,A,I]);let Y=Rm(r,t),{changes:z}=bl(r,Y,t),F=z.length>0,te=a((_)=>{if(_!==N?.id)Ee(_);w(_)},[N?.id,w]);o(()=>{if(!Ue(N?.id))Lc()},[N?.id]);let H=ze(k.enabled?"right":"all"),q=k.enabled?H.items:H.items.filter((_)=>_.id!==Ne),re={className:"h-full w-full",enabled:t||!N?.requiresWorkspace,active:!0,refreshKey:l,...r?{rootPath:r}:{},onRefresh:m,onOpenFile:b,onClose:g,showHeader:!1,layout:"phone"};return e("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[E?null:e(Lo,{catalog:y,activeId:N?.id??v,onSelect:te,hasGitChanges:F,onClose:g,menuProps:H.surfaceProps}),E?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(Ns,{catalog:y,tabs:W,homeTitle:"Panel kanan",stripProps:He(H.surfaceProps),actions:e(Ro,{side:"right",onClose:g}),children:e("div",{className:"h-full w-full",children:e(Ge,{panel:N,body:re})})})}):null,H.anchor?e(Zo,{anchor:H.anchor,align:"right",items:q,hidden:H.hidden,onToggle:H.toggle,onClose:H.close}):null,E?null:e("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:e(Ge,{panel:N,body:re})})]})}function ye({label:t,onClick:r,active:l=!1,danger:m=!1,children:b}){let g=m?"bg-error text-error-on hover:bg-error/90":l?"bg-ink text-canvas":"text-ink/70 hover:bg-ink/10 hover:text-ink";return e("button",{type:"button",onClick:r,title:t,"aria-label":t,"aria-pressed":l||void 0,className:`${Je.mobile} flex-none cursor-pointer rounded-lg transition-colors ${g}`,children:b})}var ve=Or.mobile;function _o({actions:t}){let[r,l]=n(!1),m=i(null);return $e(m,()=>l(!1),r),o(()=>{if(!r)return;let b=(g)=>{if(g.key==="Escape")l(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[r]),e("div",{className:"relative flex-none",ref:m,children:[e("button",{type:"button",onClick:()=>l((b)=>!b),title:"More file actions","aria-label":"More file actions","aria-haspopup":"menu","aria-expanded":r,className:`${Je.mobile} flex-none cursor-pointer rounded-lg text-ink/70 transition-colors hover:bg-ink/10 hover:text-ink`,children:e(Ie,{size:Or.mobile})}),r?e("div",{role:"menu","aria-label":"File actions",className:"absolute right-0 top-full z-50 mt-1 w-52 overflow-hidden rounded-xl border border-ink/15 bg-paper py-1 text-xs shadow-lg",children:t.map((b)=>{let g=b.icon;return e("button",{type:"button",role:"menuitem",onClick:()=>{l(!1),b.onSelect()},className:"flex w-full items-center gap-2 px-3 py-2.5 text-left text-ink/80 transition-colors hover:bg-ink/5 hover:text-ink",children:[e(g,{size:15,className:"flex-none text-ink/60"}),e("span",{className:"truncate",children:b.label})]},b.id)})}):null]})}var kt=420;function Ho({fileName:t,hasPreview:r,isPreview:l,hasReview:m,isReviewing:b,onToggleReview:g,wordWrap:x,copied:v,byteViewer:w=!1,missing:c=!1,onSave:k,onClose:y,onTogglePreview:N,onToggleFind:R,findOpen:E,onToggleWrap:I,onZoomOut:P,onZoomIn:M,onCopy:A,onDownload:D}){let O=uu(kt),T=u(()=>{let W=[];if(!w)W.push({id:"wrap",label:x?"Word wrap: on":"Word wrap: off",icon:pn,onSelect:I},{id:"zoom-out",label:"Decrease font size",icon:Ka,onSelect:P},{id:"zoom-in",label:"Increase font size",icon:Wa,onSelect:M});if(!O)W.push({id:"copy",label:v?"Copied":"Copy content",icon:v?f:ae,onSelect:A},{id:"download",label:"Download file",icon:me,onSelect:D});return W},[w,O,x,v,I,P,M,A,D]);return e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between gap-1 px-3 flex-shrink-0 titlebar-drag-region",style:ei(),children:[e("div",{className:"flex items-center gap-1 min-w-0 titlebar-no-drag",children:[e(ye,{label:"Close editor",onClick:y,children:e(mn,{size:ve,strokeWidth:2})}),e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(gt,{name:t,size:15,className:`flex-shrink-0${c?" text-error-text":""}`}),e("span",{className:`truncate font-semibold text-xs${c?" text-error-text line-through":" text-ink"}`,children:t})]})]}),e("div",{className:"flex flex-none items-center gap-0.5 text-ink/70 titlebar-no-drag",children:[c&&k&&e(ye,{label:"Save and recreate the file",onClick:k,danger:!0,children:e(yt,{size:ve})}),!w&&e(ye,{label:E?"Close find":"Find in file",onClick:R,active:E,children:e(U,{size:ve})}),m&&e(ye,{label:b?"Exit review mode":"Review this document",onClick:g,active:b,children:e(nn,{size:ve})}),r&&e(ye,{label:l?"View source":"Show preview",onClick:N,active:l,children:l?e(Qt,{size:ve}):e(nt,{size:ve})}),O&&e(d,{children:[e(ye,{label:"Copy content",onClick:A,children:v?e(f,{size:ve,className:"text-success-text"}):e(ae,{size:ve})}),e(ye,{label:"Download file",onClick:D,children:e(me,{size:ve})})]}),T.length>0&&e(_o,{actions:T})]})]})}function $o({fileName:t,content:r,path:l,root:m,repo:b,fontSize:g,scrollRef:x,onScroll:v,isLoading:w,unsupported:c,loadError:k,reviewActive:y,onExitReview:N}){return e("div",{ref:x,onScroll:v,"data-testid":"editor-scroller",className:"flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text",children:w?e("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[e(p,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content..."})]}):c?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(fu,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:c})]}):k?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(B,{size:20,className:"text-error-text"}),e("span",{className:"text-xs text-error-text font-sans",children:["Could not read ",t]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:k})]}):e("div",{className:"p-4 bg-paper text-ink min-h-full font-sans",style:{fontSize:`${g}px`},children:e(Au,{content:r,file:{name:t,path:l,root:m,repo:b},active:y,onExit:N})})})}function Uo({file:t,editor:r,viewerKind:l,byteViewer:m,isPreview:b,isMd:g,content:x,language:v,wordWrap:w,fileKey:c,revealMarks:k,currentMark:y,surfaceRef:N,setCodeScroller:R,previewRef:E,scroll:I,fontSize:P,reviewActive:M,onExitReview:A,editorTheme:D,editorFontFamily:O,indentUnitText:T,typing:W}){let Y=a(async(z)=>{let F=await xu(t,z,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(F.status==="written")return{ok:!0};if(F.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(F.status==="needs-permission")return{ok:!1,error:"Tap Save again to grant write access."};return{ok:!1,error:F.error}},[t,r.baseMtimeMs]);if(r.isImage&&r.imageUrl)return e(Mi,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"});if(r.isImage||ku(l)&&(m||b))return e(zl,{kind:l,path:t.path??t.name,name:t.name,source:r.byteSource,content:r.content,root:t.root,repo:t.repo,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:Y,onDirtyChange:r.setBinaryDirty});if(r.isLoading||r.unsupported||r.loadError||g&&b)return e($o,{fileName:t.name,content:x,path:t.path??t.name,root:t.root,repo:t.repo,fontSize:P,scrollRef:E,onScroll:I.onScroll,isLoading:r.isLoading,unsupported:r.unsupported,loadError:r.loadError,reviewActive:M,onExitReview:A});return e(bu,{ref:N,value:x,onValueChange:r.onChange,language:v,wordWrap:w,documentKey:c,marks:k,currentMark:y,onScroller:R,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",themeVars:D.vars,themes:D.themes,indentUnitText:T,typing:W,padding:12,placeholder:"This file is empty",style:{fontFamily:O,fontSize:`${P}px`,lineHeight:vs}})}function Go(){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error-text shrink-0",children:[e(B,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error-text",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]})}function Xo({isImage:t,byteViewer:r,viewerKind:l,lineCount:m,charCount:b,language:g,saveStatus:x,path:v,conflicts:w=0}){return e("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:t?e("span",{className:"uppercase",children:"Image"}):r?e("span",{className:"uppercase",children:ti[l]}):e(d,{children:[w>0&&e("span",{className:"text-error-text font-semibold tabular-nums",children:["⚠ ",w]}),e("span",{children:[m," lines"]}),e("span",{children:[b," chars"]}),e("span",{className:"uppercase",children:g})]})}),e("div",{className:"flex items-center space-x-2",children:[x==="saving"&&e(d,{children:[e(p,{size:10,className:"animate-spin"}),e("span",{children:"Saving…"})]}),x==="saved"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),e("span",{children:"Saved"})]}),x==="error"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),e("span",{className:"text-error-text",children:"Save failed"})]}),x==="idle"&&v&&e("span",{className:"truncate max-w-[140px]",children:v})]})]})}function Qo({path:t,content:r,ready:l,surfaceRef:m}){let b=Tu(t,r,l),g=i(null);return o(()=>{if(!b||g.current===b.request)return;g.current=b.request;let x=b.matches[b.currentIndex];if(!x)return;m.current?.select(x.start,x.end,!1),m.current?.revealOffset(x.start)},[b,m]),{matches:b?.matches??[],currentIndex:b?.currentIndex??-1}}function et({path:t,content:r,documentKey:l,ready:m,surfaceRef:b,toggleWordWrap:g}){let x=Qo({path:t,content:r,ready:m,surfaceRef:b}),v=Su({text:r,documentKey:l,readSelection:()=>b.current?.getSelection()??null,select:(w,c,k=!0)=>b.current?.select(w,c,k),reveal:(w)=>b.current?.revealOffset(w),applyDocument:(w,c,k)=>b.current?.applyDocument(w,c,k),toggleWordWrap:g});if(v.open&&v.matches.length>0)return{find:v,revealMarks:v.matches,currentMark:v.currentIndex};return{find:v,revealMarks:x.matches.length>0?x.matches:void 0,currentMark:x.currentIndex}}function tt({path:t,symbols:r,total:l,truncated:m,emptyNotice:b,preview:g=!1}){let[x,v]=n(!1);if(!t)return null;let w=(c,k)=>{if(v(!1),g){let y=Rd(r,k);if(y)As({path:t,...y});return}Oo({path:t,line:c.line,column:c.column,length:c.name.length})};return e(d,{children:[e("div",{className:"absolute bottom-14 right-3 z-20",children:e("button",{type:"button",onClick:()=>v(!0),"aria-label":`Outline (${l} symbols)`,title:"Outline",className:"flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink",children:e(ia,{size:16})})}),x&&e(X,{onClose:()=>v(!1),maxWidthClass:"max-w-sm",zClass:"z-[70]",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(ia,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Outline"}),e("span",{className:"font-mono text-[11px] text-ink/40",children:m?`${r.length}/${l}`:l})]}),children:e("div",{className:"max-h-[60vh] overflow-y-auto scrollbar-overlay-container py-1",children:[r.length===0?e("div",{className:"px-4 py-3 text-[11px] italic text-ink/40",children:b}):r.map((c,k)=>e("button",{type:"button",onClick:()=>w(c,k),"aria-label":g?`${mi(c.kind)} ${c.name}`:`${mi(c.kind)} ${c.name}, line ${c.line}`,className:"flex w-full min-w-0 items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${16+c.depth*12}px`},children:[e(Cd,{kind:c.kind,size:13}),e("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-ink",children:c.name}),!g&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/40",children:c.line})]},`${c.line}:${c.kind}:${c.name}`)),m&&e("div",{className:"px-4 py-2 text-[11px] italic text-ink/40",children:Ed(l)})]})})]})}function rt({file:t,missing:r=!1,onClose:l,onFileSaved:m,onDropResult:b}){let g=Fs(t.path??t.name),[x,v]=n({}),[w,c]=n(zo),[k,y]=n(!0),N=jo(),R=Fi(),E=Ou(),I=zu(),P=g==="markdown",M=Ms[g]===!0,A=Eu[g]===!0,D=t.path??t.name,O=x[D]??Bu(g),T=Lu(String(D)),W=P&&O,Y=()=>v((Z)=>({...Z,[D]:!O})),z=du({enabled:Boolean(t.root),onResult:b}),F=_u(t,{flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:m,missing:r}),[te,H]=n(null),q=Xs({tabKey:D,surface:P&&O?"rendered":"code",ready:F.loaded,slot:ib,element:P&&O?void 0:te}),[re,_]=n(null),ne=a((Z)=>{q.ref(Z),_(Z)},[q.ref]);vu({path:t.path??null,scroller:re,preview:P&&O});let ie=i(null),{find:ee,revealMarks:J,currentMark:pe}=et({path:t.path??null,content:F.content,documentKey:`${D}\x00${F.language}`,ready:F.loaded&&!F.loadError,surfaceRef:ie,toggleWordWrap:()=>y((Z)=>!Z)}),{content:Q,language:oe}=F,ue=Q.split(`
2
+ `).length,Se=hu(Q);Du({file:{id:D,name:t.name,path:t.path??D},editor:F,surfaceRef:ie,isPreview:O,exitPreview:()=>v((Z)=>({...Z,[D]:!1})),publish:!1});let{symbols:he,total:fe,truncated:V,notice:j}=Bd({content:Q,language:oe,path:t.path??null,state:M?"not-a-document":F.loadError?"error":F.loaded?"ready":"loading",note:M?`${ti[g]} files have no text outline.`:F.loadError});return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",...z.dropProps,...z.captureDropProps,children:[e($l,{visible:z.isDragging}),e(Ho,{fileName:t.name,hasPreview:A,isPreview:O,wordWrap:k,copied:F.copied,byteViewer:M,missing:r,onSave:F.saveNow,onClose:l,onTogglePreview:Y,hasReview:W,isReviewing:W&&T.active,onToggleReview:T.toggle,onToggleFind:()=>ee.open?ee.close():ee.openFind(),findOpen:ee.open,onToggleWrap:()=>y(!k),onZoomOut:()=>c((Z)=>Math.max(El,Z-1)),onZoomIn:()=>c((Z)=>Math.min(Bl,Z+1)),onCopy:F.copy,onDownload:F.download}),r&&e(Go,{}),F.diskChange&&e(Nu,{fileName:t.name,onReload:F.reloadFromDisk,onKeepMine:F.keepMineAgainstDisk}),ee.open&&!M&&e("div",{className:"relative shrink-0 h-9 border-b border-ink/10 bg-paper",children:e(yu,{find:ee})}),e(Uo,{file:t,editor:F,viewerKind:g,byteViewer:M,isPreview:O,isMd:P,content:Q,language:oe,wordWrap:k,fileKey:D,revealMarks:J,currentMark:pe,surfaceRef:ie,setCodeScroller:H,previewRef:ne,scroll:q,fontSize:w,reviewActive:W&&T.active,onExitReview:T.toggle,editorTheme:R,editorFontFamily:N,indentUnitText:Pu(E),typing:I}),!M&&e(tt,{path:t.path??null,symbols:he,total:fe,truncated:V,emptyNotice:j,preview:P&&O}),e(Xo,{isImage:F.isImage,byteViewer:M,viewerKind:g,lineCount:ue,charCount:Q.length,language:oe,saveStatus:F.saveStatus,path:t.path,conflicts:Se}),F.saveMissingConfirm&&t.path&&e(Ru,{fileName:t.name,filePath:t.path,onClose:F.cancelSaveMissing,onConfirm:F.confirmSaveMissing})]})}function st({diff:t,onClose:r,onFileSaved:l}){let m=t.path.split("/").pop()||t.path,b=Boolean(t.staged),g=t.status||"M",x=sr(g,b);return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:ei(),children:[e("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[e("button",{type:"button",onClick:r,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:e(mn,{size:18,strokeWidth:1.9})}),e(gt,{name:m,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:m})]}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${x.badgeBgClass}`,children:[x.charStatus," ",x.label]})]}),e("div",{className:"flex-1 min-h-0",children:e(gu,{className:"h-full",viewModeButtons:!1,filePath:t.path,status:g,isStaged:b,root:t.root,repo:t.repo||".",journalDiff:t.journal,readOnly:Boolean(t.journal),onFileSaved:l,tabKey:t.journal?tg(t.journal.path,t.journal.from,t.journal.to):eg(t.path,b)})})]})}function Fe(t,r){let l=t[r];return typeof l==="string"&&l.length>0?l:void 0}function Nt(t){let r=t.content;return typeof r==="string"?r:void 0}function je(t,r){let l=typeof t==="object"&&t!==null?t:{},m=(Fe(l,"path")??"").replace(/^\/+/,"");if(!m)return null;return{name:Fe(l,"name")??m.split("/").pop()??"file",path:m,content:Nt(l),root:Fe(l,"root")??r??void 0,repo:Fe(l,"repo"),handleId:Fe(l,"handleId"),deviceFile:l.deviceFile===!0?!0:void 0}}function at(t){if(!t)return[];return[{id:"mobile-editor",path:t.path,root:t.root,repo:t.repo,content:t.content,handleId:t.handleId,deviceFile:t.deviceFile}]}function lt(t,r,l){ho(l);let m=ur(r);return an(m,BA,{folderId:r,worktreePath:l}),t.setSearchParams((b)=>{let g=Mt(b);return g.set("sessionId",m),g.set("folderId",r.toString()),g},{replace:!0}),t.afterNavigate?.(),m}function Qd({onDesktopToggle:t,appSettings:r={}}){let{folders:l,isMock:m}=it(),b=Rt(),{sessionId:g}=We(),[x,v]=ce(),w=x.get("sessionId"),c=w?Number.isNaN(Number(w))?w:Number(w):null,k=x.get("folderId"),y=k?Number.isNaN(Number(k))?k:Number(k):null,[N,R]=n("main"),E=Ze({dock:b,sessionId:g,currentScreen:N,setCurrentScreen:R}),[I,P]=n(null),[M,A]=n(null),[D,O]=n(0),[T,W]=n(!1),[Y,z]=n("appearance"),[F,te]=n(!1),H=a(()=>O((V)=>V+1),[]),q=Iu(at(I),D),{pushToast:re}=Ve(),_=a((V)=>re(V.message,V.ok?"success":"error"),[re]),ne=q.size>0;qe({editorOpen:I!==null,diffOpen:M!==null,settingsOpen:T,offMainScreen:N!=="main",onCloseEditor:()=>P(null),onCloseDiff:()=>A(null),onCloseSettings:()=>{W(!1),te(!1)},onReturnToMain:()=>R("main")});let{folder:ie}=Pl(l,c),ee=ie??(y?l.find((V)=>String(V.id)===String(y))??null:null),J=sg(l,c)??ee?.project_path??null,pe=!!ee,Q=du({enabled:pe,onResult:_});le("omp:open-file",(V)=>{let Z=je(V.detail,J);if(Z)P(Z)}),le("omp:open-diff",(V)=>{let j=V.detail;if(!j?.file)return;A({path:j.file.replace(/^\/+/,""),status:j.status,staged:j.staged,repo:j.repo,root:j.root??J??void 0,...j.source==="journal"&&j.journal?{journal:j.journal}:{}})}),le("omp:view-subagent",()=>R("main")),le("omp:open-settings",(V)=>{let j=V.detail;z(j?.category??"appearance"),te(Boolean(j?.autoOpenAdd)),W(!0)});let oe=(V)=>{v((j)=>{let Z=Mt(j);if(Z.set("sessionId",V.toString()),Z.has("subagent"))Z.delete("subagent");return Z},{replace:!0}),R("main")},ue=()=>{v(new URLSearchParams,{replace:!0}),R("main")},Se=(V)=>{let j=Ql(l,w,V);if(j)ho(j);v((Z)=>Fc(Z,ur(V),V),{replace:!0}),R("main")},he=(V,j)=>lt({setSearchParams:v,afterNavigate:()=>R("main")},V,j),fe=a((V)=>{let j=je(V,J);if(j)P(j)},[J]);return e("div",{"data-testid":"app-root",className:"app-window flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[e(mg,{}),e(fg,{isMock:m}),e(gg,{workspacePath:J}),e("div",{className:`flex-1 min-h-0 w-full relative ${N==="main"?"block":"hidden"}`,...Q.dropProps,...Q.captureDropProps,children:[e($l,{visible:Q.isDragging}),e(to,{activeSessionId:c,onSelectSession:oe,onNewSession:ue,onOpenSessionSidebar:E.openSessionDrawer,onOpenRightSidebar:E.openRightDrawer,appSettings:r})]}),e("div",{className:`flex-1 min-h-0 w-full ${N==="session"?"block":"hidden"}`,children:e(Io,{activeSessionId:c,onSelectSession:oe,onNewSession:ue,onNewSessionForFolder:Se,onNewWorktreeSession:he,onClose:()=>R("main"),onDesktopToggle:t,appSettings:r,rootPath:J??void 0,refreshKey:D,onRefresh:H,onOpenFile:fe,revealSignal:E.left})}),N==="right"&&e("div",{className:"flex-1 min-h-0 w-full",children:e(Bo,{enabled:pe,rootPath:J??void 0,refreshKey:D,onRefresh:H,onOpenFile:fe,onClose:()=>R("main"),revealSignal:E.right})}),I&&e(rt,{file:I,missing:ne,onClose:()=>P(null),onFileSaved:H}),M&&e(st,{diff:M,onClose:()=>A(null),onFileSaved:H}),e(Dl,{isOpen:T,onClose:()=>{W(!1),te(!1)},initialCategory:Y,autoOpenAddProvider:F,appSettings:r})]})}export{Qd as MobileLayoutWrapper};
@@ -0,0 +1 @@
1
+ import{kg}from"./index-5xxbbzqa.js";import"./index-7sq6cjt1.js";import"./index-zhgh7a31.js";export{kg as MergeDiffView};