@nervekit/desktop 0.21.0 → 0.22.0

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 (176) hide show
  1. package/node_modules/@nervekit/contracts/dist/domains/completions/index.d.ts +1 -0
  2. package/node_modules/@nervekit/contracts/dist/domains/completions/index.d.ts.map +1 -1
  3. package/node_modules/@nervekit/contracts/dist/domains/completions/index.js +1 -0
  4. package/node_modules/@nervekit/contracts/dist/domains/completions/index.js.map +1 -1
  5. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.d.ts +13 -0
  6. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.d.ts.map +1 -0
  7. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.js +36 -0
  8. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.js.map +1 -0
  9. package/node_modules/@nervekit/contracts/dist/domains/git/git.events.schema.d.ts.map +1 -1
  10. package/node_modules/@nervekit/contracts/dist/domains/git/git.events.schema.js +11 -1
  11. package/node_modules/@nervekit/contracts/dist/domains/git/git.events.schema.js.map +1 -1
  12. package/node_modules/@nervekit/contracts/dist/domains/protocol/operation-catalog.schema.d.ts +18 -0
  13. package/node_modules/@nervekit/contracts/dist/domains/protocol/operation-catalog.schema.d.ts.map +1 -1
  14. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.operations.schema.d.ts +18 -0
  15. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.operations.schema.d.ts.map +1 -1
  16. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.d.ts +19 -0
  17. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.d.ts.map +1 -1
  18. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.js +4 -0
  19. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.js.map +1 -1
  20. package/node_modules/@nervekit/contracts/package.json +1 -1
  21. package/node_modules/@nervekit/harness/package.json +2 -2
  22. package/node_modules/@nervekit/protocol/package.json +2 -2
  23. package/node_modules/@nervekit/tools/dist/git/git-overview.d.ts.map +1 -1
  24. package/node_modules/@nervekit/tools/dist/git/git-overview.js +7 -1
  25. package/node_modules/@nervekit/tools/dist/git/git-overview.js.map +1 -1
  26. package/node_modules/@nervekit/tools/dist/git/git-service.d.ts.map +1 -1
  27. package/node_modules/@nervekit/tools/dist/git/git-service.js +7 -2
  28. package/node_modules/@nervekit/tools/dist/git/git-service.js.map +1 -1
  29. package/node_modules/@nervekit/tools/package.json +2 -2
  30. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.d.ts +35 -0
  31. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.d.ts.map +1 -0
  32. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.js +202 -0
  33. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.js.map +1 -0
  34. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.d.ts +5 -0
  35. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.d.ts.map +1 -0
  36. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.js +16 -0
  37. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.js.map +1 -0
  38. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.d.ts +6 -7
  39. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.d.ts.map +1 -1
  40. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.js +4 -27
  41. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.js.map +1 -1
  42. package/node_modules/@nervekit/workbench-server/dist/routes/completion-routes.d.ts.map +1 -1
  43. package/node_modules/@nervekit/workbench-server/dist/routes/completion-routes.js +2 -28
  44. package/node_modules/@nervekit/workbench-server/dist/routes/completion-routes.js.map +1 -1
  45. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.d.ts +2 -0
  46. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.d.ts.map +1 -1
  47. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.js +11 -2
  48. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.js.map +1 -1
  49. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.d.ts.map +1 -1
  50. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.js +1 -0
  51. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.js.map +1 -1
  52. package/node_modules/@nervekit/workbench-server/dist/web/assets/AuthShell-DzpCms9n.js +7 -0
  53. package/node_modules/@nervekit/workbench-server/dist/web/assets/{DiffShell-CXbZJlLG.js → DiffShell-CiuEqHmo.js} +1 -1
  54. package/node_modules/@nervekit/workbench-server/dist/web/assets/{FileShell-Cg2bNpS1.js → FileShell-DoQAVVCz.js} +1 -1
  55. package/node_modules/@nervekit/workbench-server/dist/web/assets/FilesPanelView-BbI7dxQA.js +1 -0
  56. package/node_modules/@nervekit/workbench-server/dist/web/assets/{GitPullRequestsPanelView-DYC3T8A7.js → GitPullRequestsPanelView-BAueBEFa.js} +1 -1
  57. package/node_modules/@nervekit/workbench-server/dist/web/assets/LogsShell-Ck34Zk9s.js +2 -0
  58. package/node_modules/@nervekit/workbench-server/dist/web/assets/{PrShell-Dsng-Aya.js → PrShell-CmVdW2dh.js} +1 -1
  59. package/node_modules/@nervekit/workbench-server/dist/web/assets/SettingsShell-D9_ahajy.js +4 -0
  60. package/node_modules/@nervekit/workbench-server/dist/web/assets/{TaskShell-CCAZjK9o.js → TaskShell-BzR6YXIn.js} +1 -1
  61. package/node_modules/@nervekit/workbench-server/dist/web/assets/{TasksPanelView-BV2VovlR.js → TasksPanelView-BnWJjqs-.js} +1 -1
  62. package/node_modules/@nervekit/workbench-server/dist/web/assets/{abnfDiagram-N423BO3Z-BQvGwAOZ.js → abnfDiagram-N423BO3Z-D1m4mgnn.js} +1 -1
  63. package/node_modules/@nervekit/workbench-server/dist/web/assets/architecture-TIHT7OUA-B8oKoHUs.js +1 -0
  64. package/node_modules/@nervekit/workbench-server/dist/web/assets/{architectureDiagram-T3A2C74G-T_gGQddN.js → architectureDiagram-T3A2C74G-0hRQ6LV4.js} +1 -1
  65. package/node_modules/@nervekit/workbench-server/dist/web/assets/{blockDiagram-VBNYF7ZC-ysKluxsM.js → blockDiagram-VBNYF7ZC-BqsnEf8C.js} +1 -1
  66. package/node_modules/@nervekit/workbench-server/dist/web/assets/{c4Diagram-5PPSVZJV-BUsC8IqR.js → c4Diagram-5PPSVZJV-DebqFggI.js} +1 -1
  67. package/node_modules/@nervekit/workbench-server/dist/web/assets/channel-BnKEhp41.js +1 -0
  68. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-2GRJ4B5K-BW2k3PNn.js → chunk-2GRJ4B5K-CiLWL4Hp.js} +1 -1
  69. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-3NCLNEKW-ACJdsgee.js +1 -0
  70. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-4I5QYGJK-C-C1wGYE.js → chunk-4I5QYGJK-BIKYgwZ3.js} +1 -1
  71. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-5RXB4S5H-Cuj4Wyyi.js → chunk-5RXB4S5H-DgeszCo_.js} +1 -1
  72. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-6Q2QTUOP-CfSX9zzr.js → chunk-6Q2QTUOP-jdK1_wBf.js} +1 -1
  73. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-7Z6QIM7H-BBVpK819.js → chunk-7Z6QIM7H-BuzVGzVK.js} +1 -1
  74. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-GF5L2VYU-Bz29O6Fm.js → chunk-GF5L2VYU-UN2tdGaZ.js} +1 -1
  75. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-I66GZJ75-C1Uf6uvM.js → chunk-I66GZJ75-Biph9515.js} +1 -1
  76. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-J7OUQ5F2-MaDAPO1H.js → chunk-J7OUQ5F2-BpF9jBhd.js} +2 -2
  77. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-JQJVKLGR-BbaEwyz9.js → chunk-JQJVKLGR-Dh7vCor8.js} +1 -1
  78. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-KBJHAD2P-D4ajrZj0.js → chunk-KBJHAD2P-YfTR2eJG.js} +1 -1
  79. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-NSK5VX7P-BxAErRSL.js → chunk-NSK5VX7P-Bxwgu0ot.js} +1 -1
  80. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-QR6OTTB3-CqwhByxV.js → chunk-QR6OTTB3-DWWB3hg3.js} +1 -1
  81. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-RYQCIY6F-AsrcnhOn.js → chunk-RYQCIY6F-CTt3nSNw.js} +1 -1
  82. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-UBXNYLIW-CFryZrPK.js → chunk-UBXNYLIW-Cff_FR8r.js} +1 -1
  83. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-W5SLKNZC-DdNs-ICd.js → chunk-W5SLKNZC-B6fBG70B.js} +1 -1
  84. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-WRU74C26-DaFT3tfi.js → chunk-WRU74C26-DSPY0qpJ.js} +1 -1
  85. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-XXDRQBXY-CUs6EOga.js +1 -0
  86. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-JCYQIIEL-DUiB-xhZ.js +1 -0
  87. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-v2-OCEON4UE-DUiB-xhZ.js +1 -0
  88. package/node_modules/@nervekit/workbench-server/dist/web/assets/{code-Cz4NuT3w.js → code-C-lNA7Tp.js} +1 -1
  89. package/node_modules/@nervekit/workbench-server/dist/web/assets/{cose-bilkent-JH36ORCC-jfIOeXSF.js → cose-bilkent-JH36ORCC-DVzJYiHr.js} +1 -1
  90. package/node_modules/@nervekit/workbench-server/dist/web/assets/credential-crypto-C14v7RMk.js +1 -0
  91. package/node_modules/@nervekit/workbench-server/dist/web/assets/{cynefin-VYW2F7L2-DyO273Nb.js → cynefin-VYW2F7L2-BI6cILop.js} +1 -1
  92. package/node_modules/@nervekit/workbench-server/dist/web/assets/{cynefinDiagram-MW4NZA55-DKqr7fNe.js → cynefinDiagram-MW4NZA55-Bdi63hEA.js} +1 -1
  93. package/node_modules/@nervekit/workbench-server/dist/web/assets/{dagre-VZM6K2ZE-fXJK6FeK.js → dagre-VZM6K2ZE-qmvSWxZb.js} +1 -1
  94. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-7IWD3JNH-_EVqtb48.js → diagram-7IWD3JNH-DrHe-CI7.js} +1 -1
  95. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-B4RE2ZJO-WRJJ90ty.js → diagram-B4RE2ZJO-ij4HCwiB.js} +1 -1
  96. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-LBJQPF4R-Bj_ldaRJ.js → diagram-LBJQPF4R-B-XHp13e.js} +1 -1
  97. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-Q27KOJAE-DMuukQW3.js → diagram-Q27KOJAE-oyyFNP8d.js} +1 -1
  98. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-UB23O5K3-CeCKQgiY.js → diagram-UB23O5K3-Dg05maOu.js} +1 -1
  99. package/node_modules/@nervekit/workbench-server/dist/web/assets/dist-CRSOKjjD.js +25 -0
  100. package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-Ci71hNpt.js → dist-DyXP4lzk.js} +1 -1
  101. package/node_modules/@nervekit/workbench-server/dist/web/assets/{ebnfDiagram-BXEA7PRR-TqJirFSZ.js → ebnfDiagram-BXEA7PRR-D6bU5ZkN.js} +1 -1
  102. package/node_modules/@nervekit/workbench-server/dist/web/assets/{erDiagram-JOGREHBK-Bwe7PPhP.js → erDiagram-JOGREHBK-BUXNJgXO.js} +1 -1
  103. package/node_modules/@nervekit/workbench-server/dist/web/assets/eventmodeling-45OFAUF4-DReiX9Og.js +1 -0
  104. package/node_modules/@nervekit/workbench-server/dist/web/assets/flowDiagram-UKHOOZJN-CsVXXeD_.js +1 -0
  105. package/node_modules/@nervekit/workbench-server/dist/web/assets/{ganttDiagram-PKOTCBZU-BRaAo0_G.js → ganttDiagram-PKOTCBZU-n0YBC5b0.js} +1 -1
  106. package/node_modules/@nervekit/workbench-server/dist/web/assets/{git-Cwqv44-m.js → git-DX1JG5MH.js} +4 -4
  107. package/node_modules/@nervekit/workbench-server/dist/web/assets/{gitGraph-TEB2WS4Q-Didn8YFH.js → gitGraph-TEB2WS4Q-DQ7k5Tp8.js} +1 -1
  108. package/node_modules/@nervekit/workbench-server/dist/web/assets/{gitGraphDiagram-DS77QQ5N-DQIfPJ2s.js → gitGraphDiagram-DS77QQ5N-fwjFvThs.js} +1 -1
  109. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-6-uAAvzD.css +1 -0
  110. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-DcOnHsqm.js +169 -0
  111. package/node_modules/@nervekit/workbench-server/dist/web/assets/{info-DKCQHKI2-DYcoAuHZ.js → info-DKCQHKI2-CFJLkOJo.js} +1 -1
  112. package/node_modules/@nervekit/workbench-server/dist/web/assets/{infoDiagram-6WML65LV-CpW6nqFl.js → infoDiagram-6WML65LV-KGSrkIAw.js} +1 -1
  113. package/node_modules/@nervekit/workbench-server/dist/web/assets/{ishikawaDiagram-WSZJBQD7-FQbW3RyQ.js → ishikawaDiagram-WSZJBQD7-DZIPtI6E.js} +1 -1
  114. package/node_modules/@nervekit/workbench-server/dist/web/assets/{journeyDiagram-NVQOT4AX-DZXcglnz.js → journeyDiagram-NVQOT4AX-Cy-8Y1J1.js} +1 -1
  115. package/node_modules/@nervekit/workbench-server/dist/web/assets/{kanban-definition-27J2QSJJ-BDSIU4Cq.js → kanban-definition-27J2QSJJ-BzrbTBzK.js} +1 -1
  116. package/node_modules/@nervekit/workbench-server/dist/web/assets/{line-BnVa8ftx.js → line-CYzY3zEz.js} +1 -1
  117. package/node_modules/@nervekit/workbench-server/dist/web/assets/{linear-DpDBHYTx.js → linear-DUE5nG_T.js} +1 -1
  118. package/node_modules/@nervekit/workbench-server/dist/web/assets/{mermaid-parser.core-DKgsfEdo.js → mermaid-parser.core-EIuoudly.js} +3 -3
  119. package/node_modules/@nervekit/workbench-server/dist/web/assets/{mermaid.core-mWIFQm8i.js → mermaid.core-BRVnyKar.js} +3 -3
  120. package/node_modules/@nervekit/workbench-server/dist/web/assets/{mindmap-definition-FAOFIHXS-CS634_fL.js → mindmap-definition-FAOFIHXS-BmqtkZyv.js} +1 -1
  121. package/node_modules/@nervekit/workbench-server/dist/web/assets/{packet-7NZHBO7P-Oc6wU-dc.js → packet-7NZHBO7P-akxqIWE6.js} +1 -1
  122. package/node_modules/@nervekit/workbench-server/dist/web/assets/{pegDiagram-VL7TDLO6-CQGfupoV.js → pegDiagram-VL7TDLO6-BuZGheaO.js} +1 -1
  123. package/node_modules/@nervekit/workbench-server/dist/web/assets/{pie-RZYD4A2V-Bk0OOpw0.js → pie-RZYD4A2V-0vXe4gRC.js} +1 -1
  124. package/node_modules/@nervekit/workbench-server/dist/web/assets/{pieDiagram-7S7Q4E2Y-Cxdep5t3.js → pieDiagram-7S7Q4E2Y-Bs9gNRoi.js} +1 -1
  125. package/node_modules/@nervekit/workbench-server/dist/web/assets/{quadrantDiagram-CIZ2JOQS-Dk7BCP9d.js → quadrantDiagram-CIZ2JOQS-A_q3bw76.js} +1 -1
  126. package/node_modules/@nervekit/workbench-server/dist/web/assets/{radar-I7S5WNFK-CFB6_yvT.js → radar-I7S5WNFK-CIxrpgmX.js} +1 -1
  127. package/node_modules/@nervekit/workbench-server/dist/web/assets/{railroad-3IZDKUUU-BZgdTfjv.js → railroad-3IZDKUUU-D0u7U-aD.js} +1 -1
  128. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-abnf-AHOZXSZD-dHl238vE.js +1 -0
  129. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-ebnf-EBAXGLYW-CLeAlZUp.js +1 -0
  130. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-peg-LSFZ7HO6-C-aMe3fF.js +1 -0
  131. package/node_modules/@nervekit/workbench-server/dist/web/assets/{railroadDiagram-AXF67PYL-B39qNFfy.js → railroadDiagram-AXF67PYL-Bl0cURtS.js} +1 -1
  132. package/node_modules/@nervekit/workbench-server/dist/web/assets/{requirementDiagram-LRYGKXZP-fSJxTsD3.js → requirementDiagram-LRYGKXZP-Clut2i1j.js} +1 -1
  133. package/node_modules/@nervekit/workbench-server/dist/web/assets/{sankeyDiagram-W5VNT64P-le1jhrbo.js → sankeyDiagram-W5VNT64P-BK0-huc7.js} +1 -1
  134. package/node_modules/@nervekit/workbench-server/dist/web/assets/{scratch-notes-Dp9Qv2DB.js → scratch-notes-BGV5WcII.js} +1 -1
  135. package/node_modules/@nervekit/workbench-server/dist/web/assets/{sequenceDiagram-SI44F4Z6-B8sy98rq.js → sequenceDiagram-SI44F4Z6-BjqhuV2K.js} +1 -1
  136. package/node_modules/@nervekit/workbench-server/dist/web/assets/{src-Bdf7luT7.js → src-B_LdBh2I.js} +1 -1
  137. package/node_modules/@nervekit/workbench-server/dist/web/assets/state-CPdWoA3M.js +10 -0
  138. package/node_modules/@nervekit/workbench-server/dist/web/assets/{stateDiagram-OKZ733FA-gcUtfVyX.js → stateDiagram-OKZ733FA-CTje9_-7.js} +1 -1
  139. package/node_modules/@nervekit/workbench-server/dist/web/assets/stateDiagram-v2-UEYNNEHI-DQa8eaZB.js +1 -0
  140. package/node_modules/@nervekit/workbench-server/dist/web/assets/{swimlanes-SLNWSIFB-QSeWxhjb.js → swimlanes-SLNWSIFB-F6k7PJbk.js} +1 -1
  141. package/node_modules/@nervekit/workbench-server/dist/web/assets/swimlanesDiagram-ULZ7WXOC-BU0bCuI7.js +8 -0
  142. package/node_modules/@nervekit/workbench-server/dist/web/assets/{task-state.svelte-WTxmxGsR.js → task-state.svelte-B98zEdKT.js} +1 -1
  143. package/node_modules/@nervekit/workbench-server/dist/web/assets/{tasks.api-B8W55vtY.js → tasks.api-Dh_TlNhq.js} +1 -1
  144. package/node_modules/@nervekit/workbench-server/dist/web/assets/{timeline-definition-Z64GVDOM-CpW4XBbR.js → timeline-definition-Z64GVDOM-DVJD_KiA.js} +1 -1
  145. package/node_modules/@nervekit/workbench-server/dist/web/assets/{treeView-QDETBFTQ-CT4Ibeho.js → treeView-QDETBFTQ-BfD63A7a.js} +1 -1
  146. package/node_modules/@nervekit/workbench-server/dist/web/assets/{treemap-6X3UGDF4-BFY78XhI.js → treemap-6X3UGDF4-CqAWTuHf.js} +1 -1
  147. package/node_modules/@nervekit/workbench-server/dist/web/assets/{vennDiagram-T6HMQDX7-DC485Kqf.js → vennDiagram-T6HMQDX7-DOcyXxIP.js} +1 -1
  148. package/node_modules/@nervekit/workbench-server/dist/web/assets/{wardley-OPB4EBWU-B_zkNB3a.js → wardley-OPB4EBWU-DZ4bdz8u.js} +1 -1
  149. package/node_modules/@nervekit/workbench-server/dist/web/assets/{wardleyDiagram-T6FBY63Y-QgSIC1tM.js → wardleyDiagram-T6FBY63Y-DtPrR0kA.js} +1 -1
  150. package/node_modules/@nervekit/workbench-server/dist/web/assets/{xychartDiagram-ELKLHX3M-J-dhsbdt.js → xychartDiagram-ELKLHX3M-CQ0RDIRi.js} +1 -1
  151. package/node_modules/@nervekit/workbench-server/dist/web/index.html +6 -6
  152. package/node_modules/@nervekit/workbench-server/dist/web/sw.js +1 -1
  153. package/node_modules/@nervekit/workbench-server/package.json +5 -5
  154. package/package.json +6 -6
  155. package/node_modules/@nervekit/workbench-server/dist/web/assets/AuthShell-NbeFRi_q.js +0 -7
  156. package/node_modules/@nervekit/workbench-server/dist/web/assets/FilesPanelView-CnNkKGX2.js +0 -1
  157. package/node_modules/@nervekit/workbench-server/dist/web/assets/LogsShell-Bn6B-So1.js +0 -2
  158. package/node_modules/@nervekit/workbench-server/dist/web/assets/SettingsShell-C9rL1szU.js +0 -3
  159. package/node_modules/@nervekit/workbench-server/dist/web/assets/architecture-TIHT7OUA-Z4OQU5Fu.js +0 -1
  160. package/node_modules/@nervekit/workbench-server/dist/web/assets/channel-DKA3-9I6.js +0 -1
  161. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-3NCLNEKW-D5KXKJA5.js +0 -1
  162. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-XXDRQBXY-DXC-pGHz.js +0 -1
  163. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-JCYQIIEL-MnQb-u9c.js +0 -1
  164. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-v2-OCEON4UE-MnQb-u9c.js +0 -1
  165. package/node_modules/@nervekit/workbench-server/dist/web/assets/credential-crypto-Cs2Lsmdw.js +0 -1
  166. package/node_modules/@nervekit/workbench-server/dist/web/assets/dist-DTR83M_W.js +0 -25
  167. package/node_modules/@nervekit/workbench-server/dist/web/assets/eventmodeling-45OFAUF4-BKcq2yaq.js +0 -1
  168. package/node_modules/@nervekit/workbench-server/dist/web/assets/flowDiagram-UKHOOZJN-DBGaVxY1.js +0 -1
  169. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-DIWu29rF.js +0 -169
  170. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-YSHHqi_A.css +0 -1
  171. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-abnf-AHOZXSZD-BNfX4t04.js +0 -1
  172. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-ebnf-EBAXGLYW-B7eMhM4S.js +0 -1
  173. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-peg-LSFZ7HO6-B1ZB-7vK.js +0 -1
  174. package/node_modules/@nervekit/workbench-server/dist/web/assets/state-DGmj3MVW.js +0 -10
  175. package/node_modules/@nervekit/workbench-server/dist/web/assets/stateDiagram-v2-UEYNNEHI-Scr7HccZ.js +0 -1
  176. package/node_modules/@nervekit/workbench-server/dist/web/assets/swimlanesDiagram-ULZ7WXOC-CDejUJab.js +0 -8
@@ -0,0 +1,169 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bash-B7CDPTg5.js","assets/shellscript-CLZ0U2zV.js","assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/svelte-Uaf2W_lJ.js","assets/typescript-bsJCZSQ-.js","assets/mermaid.core-BRVnyKar.js","assets/chunk-4I5QYGJK-BIKYgwZ3.js","assets/src-B_LdBh2I.js","assets/chunk-QTnfLwEv.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/chunk-I66GZJ75-Biph9515.js","assets/purify.es--UZZef80.js","assets/chunk-NSK5VX7P-Bxwgu0ot.js","assets/dist-lRkD-JPF.js","assets/chunk-WRU74C26-DSPY0qpJ.js","assets/chunk-3NCLNEKW-ACJdsgee.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-7Z6QIM7H-BuzVGzVK.js","assets/line-CYzY3zEz.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-QR6OTTB3-DWWB3hg3.js","assets/chunk-UBXNYLIW-Cff_FR8r.js","assets/chunk-W5SLKNZC-B6fBG70B.js","assets/rough.esm-CSKSodPl.js","assets/chunk-J7OUQ5F2-BpF9jBhd.js","assets/chunk-ZIRB5QZD-H-kepumB.js","assets/TaskShell-BzR6YXIn.js","assets/button-CVO5fNBi.js","assets/FileShell-DoQAVVCz.js","assets/scroll-area-7H4ZayRq.js","assets/spinner-BjfTQcTY.js","assets/code-C-lNA7Tp.js","assets/dist-CuX9uX_B.js","assets/FileShell-Dp-BAGcK.css","assets/PrShell-CmVdW2dh.js","assets/git-DX1JG5MH.js","assets/panel-DE9divB9.js","assets/popper-layer-force-mount-DHU7ILEx.js","assets/status-dot-5fTmlMf5.js","assets/virtual-list-y3Fa09LY.js","assets/lru-cache-RFDR4GSx.js","assets/virtual-list-BmmRz0Tb.css","assets/chevron-down-B7JAcl1j.js","assets/github-pr-checks-BWC_pfMO.js","assets/notify.svelte-DvUTOP7s.js","assets/toast-state.svelte-Cc86Tnw4.js","assets/desktop-bridge.svelte-CDIrP8Lg.js","assets/DiffShell-CiuEqHmo.js","assets/file-state.svelte-fK_ncpqb.js","assets/task-state.svelte-B98zEdKT.js","assets/SettingsShell-D9_ahajy.js","assets/select-field-u8QUBe4W.js","assets/select-field-CV-KWLNP.css","assets/checkbox-DTiwSGQF.js","assets/legacy-rAg2dwjR.js","assets/credential-crypto-C14v7RMk.js","assets/credential-crypto-BDCyIX5i.css","assets/state-CPdWoA3M.js","assets/dist-CRSOKjjD.js","assets/text-preview-BB9zMOPI.js","assets/AuthShell-DzpCms9n.js","assets/AuthShell-CI3W44sI.css","assets/LogsShell-Ck34Zk9s.js","assets/LogsShell-Cu3zYRGe.css","assets/FilesPanelView-BbI7dxQA.js","assets/TasksPanelView-BnWJjqs-.js","assets/tasks.api-Dh_TlNhq.js","assets/scratch-notes-BGV5WcII.js","assets/GitPullRequestsPanelView-BAueBEFa.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./chunk-QTnfLwEv.js";import{$ as r,A as i,At as a,B as o,D as s,Dt as c,E as l,F as u,Ft as d,H as f,I as p,It as m,J as h,K as g,L as _,Lt as v,Mt as y,N as b,O as x,Ot as S,P as C,Pt as w,Q as T,R as E,Rt as D,S as O,St as ee,U as te,V as k,W as A,X as ne,Y as j,Z as M,_ as re,_t as N,a as P,at as ie,b as ae,bt as oe,c as se,ct as F,d as ce,dt as le,et as ue,f as I,ft as de,g as fe,gt as L,h as pe,ht as R,i as me,it as he,j as ge,jt as _e,k as ve,kt as z,l as ye,lt as be,m as B,mt as V,n as xe,nt as Se,o as Ce,ot as we,p as H,pt as Te,q as U,rt as W,s as Ee,st as De,t as G,tt as Oe,u as ke,ut as Ae,v as je,vt as K,w as q,x as Me,xt as J,y as Ne,yt as Y,z as Pe,zt as Fe}from"./button-CVO5fNBi.js";import"./legacy-rAg2dwjR.js";import{B as Ie,Ct as Le,Dt as Re,F as ze,Ft as Be,G as Ve,H as He,I as eee,L as tee,N as Ue,Nt as X,Ot as We,P as Ge,Pt as Ke,R as qe,U as Je,V as Ye,W as Xe,Y as Ze,_t as Qe,a as $e,b as nee,bt as et,c as tt,ft as nt,gt as rt,ht as ree,i as it,j as iee,kt as at,l as ot,lt as st,m as ct,mt as lt,n as ut,o as dt,p as aee,pt as ft,r as pt,s as mt,t as ht,u as gt,ut as _t,v as vt,vt as yt,wt as bt,yt as xt,z as St}from"./status-dot-5fTmlMf5.js";import{A as Ct,C as wt,D as Tt,E as oee,M as Et,N as see,O as cee,P as Dt,S as Ot,T as kt,_ as lee,a as uee,b as At,c as dee,d as jt,f as Mt,g as Nt,h as Pt,i as Ft,j as It,k as Lt,l as Rt,m as zt,n as Bt,o as Vt,p as Ht,r as Ut,s as Wt,t as Gt,u as Kt,v as qt,w as Jt,x as Yt,y as Xt}from"./state-CPdWoA3M.js";import{a as Zt,i as Qt,n as $t,o as en,r as tn,t as nn}from"./select-field-u8QUBe4W.js";import{a as fee,i as rn,n as an,o as on,r as sn,t as cn}from"./popper-layer-force-mount-DHU7ILEx.js";import{C as ln,D as pee,E as un,O as mee,S as dn,T as fn,a as pn,c as mn,d as hn,f as gn,i as _n,l as vn,n as yn,o as bn,p as xn,r as Sn,s as Cn,t as wn,u as Tn,w as En,x as Dn}from"./panel-DE9divB9.js";import{n as On,t as kn}from"./scroll-area-7H4ZayRq.js";import{c as An,i as jn,l as Mn,n as Nn,o as Pn,r as Fn,t as In}from"./desktop-bridge.svelte-CDIrP8Lg.js";import{a as Ln,i as Rn,n as zn,r as Bn,t as Vn}from"./toast-state.svelte-Cc86Tnw4.js";import{a as Hn,c as Un,i as Wn,n as Gn,o as Kn,r as qn,s as Jn,t as Yn}from"./notify.svelte-DvUTOP7s.js";import{_ as Xn,a as Z,b as Zn,c as Qn,d as $n,f as er,g as hee,i as tr,l as nr,m as gee,n as rr,o as ir,r as ar,s as or,t as sr,u as cr,v as _ee,x as lr,y as ur}from"./task-state.svelte-B98zEdKT.js";import{$ as vee,A as dr,B as yee,C as fr,D as bee,E as xee,F as See,G as Cee,H as wee,I as Tee,L as Eee,M as Dee,N as pr,O as Oee,P as kee,Q as Aee,R as jee,S as Mee,U as Nee,V as Pee,W as Fee,X as Iee,Y as Lee,Z as Ree,a as zee,at as mr,c as hr,ct as gr,dt as _r,et as vr,ft as yr,g as br,h as xr,ht as Sr,i as Cr,it as wr,j as Tr,k as Er,l as Dr,m as Or,mt as kr,n as Ar,nt as jr,o as Mr,ot as Nr,p as Pr,pt as Fr,r as Ir,rt as Lr,s as Rr,st as zr,t as Br,tt as Vr,u as Hr,ut as Ur,x as Wr,z as Gr}from"./dist-CRSOKjjD.js";import{a as Kr,c as qr,i as Jr,l as Q,n as Yr,o as Xr,r as Zr,s as Qr,t as $r}from"./file-state.svelte-fK_ncpqb.js";import{a as ei,i as ti,n as ni,r as ri,t as ii}from"./text-preview-BB9zMOPI.js";import{Ct as ai,F as oi,H as si,K as ci,O as li,Q as ui,S as di,St as fi,T as pi,U as mi,W as hi,_ as gi,_t as _i,at as vi,ct as yi,dt as bi,gt as xi,ht as Si,it as Ci,lt as wi,n as Ti,ot as Ei,rt as Di,st as Oi,tt as ki,v as Ai,vt as ji,x as Mi,xt as Bee}from"./dist-CuX9uX_B.js";import{i as Vee,l as Hee,n as Uee,o as Ni,r as Wee,s as Pi,u as Gee}from"./dist-B-6VYEsK.js";import{n as Kee}from"./dist-Ji_a5TTJ.js";import{t as Fi}from"./spinner-BjfTQcTY.js";import{t as Ii}from"./virtual-list-y3Fa09LY.js";import{t as Li}from"./lru-cache-RFDR4GSx.js";import{n as Ri,t as qee}from"./chevron-down-B7JAcl1j.js";import{a as Jee,c as zi,d as Bi,f as Vi,h as Yee,l as Xee,m as Zee,n as Qee,o as $ee,p as ete,r as Hi,s as tte,t as nte,u as Ui}from"./tasks.api-Dh_TlNhq.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Wi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},rte={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Gi=new class{#e=rte;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function ite(e){setTimeout(e,0)}var Ki=typeof window>`u`||`Deno`in globalThis;function qi(){}function ate(e,t){return typeof e==`function`?e(t):e}function ote(e){return typeof e==`number`&&e>=0&&e!==1/0}function ste(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ji(e,t){return typeof e==`function`?e(t):e}function cte(e,t){return typeof e==`function`?e(t):e}function Yi(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Zi(o,t.options))return!1}else if(!$i(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Xi(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Qi(t.options.mutationKey)!==Qi(a))return!1}else if(!$i(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Zi(e,t){return(t?.queryKeyHashFn||Qi)(e)}function Qi(e){return JSON.stringify(e,(e,t)=>na(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function $i(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>$i(e[n],t[n])):!1}var lte=Object.prototype.hasOwnProperty;function ea(e,t){if(e===t)return e;let n=ta(e)&&ta(t);if(!n&&!(na(e)&&na(t)))return t;let r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?Array(a):{},s=0;for(let c=0;c<a;c++){let a=n?c:i[c],l=e[a],u=t[a];if(l===u){o[a]=l,(n?c<r:lte.call(e,a))&&s++;continue}if(l===null||u===null||typeof l!=`object`||typeof u!=`object`){o[a]=u;continue}let d=ea(l,u);o[a]=d,d===l&&s++}return r===a&&s===r?e:o}function ta(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function na(e){if(!ra(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ra(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ra(e){return Object.prototype.toString.call(e)===`[object Object]`}function ute(e){return new Promise(t=>{Gi.setTimeout(t,e)})}function dte(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ea(e,t)}function fte(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pte(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ia=Symbol();function aa(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ia?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var oa=new class extends Wi{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Ki&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function mte(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var hte=ite;function gte(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=hte,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var sa=gte(),ca=new class extends Wi{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Ki&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _te(e){return Math.min(1e3*2**e,3e4)}function la(e){return(e??`online`)===`online`?ca.isOnline():!0}var ua=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function da(e){let t=!1,n=0,r,i=mte(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ua(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>oa.isFocused()&&(e.networkMode===`always`||ca.isOnline())&&e.canRun(),u=()=>la(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ki?0:3),o=e.retryDelay??_te,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ute(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var fa=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ote(this.gcTime)&&(this.#e=Gi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ki?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Gi.clearTimeout(this.#e),void 0)}},vte=class extends fa{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=pa(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=pa(this.options);e.data!==void 0&&(this.setData(e.data,{updatedAt:e.dataUpdatedAt,manual:!0}),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=dte(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(qi).catch(qi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>cte(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ia||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ji(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ste(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=aa(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=da({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ua&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ua){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...yte(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:`success`,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),sa.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function yte(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:la(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function pa(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}function ma(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener(`abort`,()=>{n=!0}),t.signal)})},u=aa(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?pte:fte;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?bte:ha,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ha(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ha(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function bte(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var xte=class extends fa{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ste(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=da({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{throw await this.#n.config.onError?.(t,e,this.state.context,this,n),await this.options.onError?.(t,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,t,e,this.state.context,n),t}finally{this.#i({type:`error`,error:t})}}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),sa.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ste(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Cte=class extends Wi{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new xte({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ga(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ga(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ga(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ga(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sa.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Xi(t,e))}findAll(e={}){return this.getAll().filter(t=>Xi(e,t))}notify(e){sa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sa.batch(()=>Promise.all(e.map(e=>e.continue().catch(qi))))}};function ga(e){return e.options.scope?.id}var wte=class extends Wi{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Zi(r,t),a=this.get(i);return a||(a=new vte({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){sa.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Yi(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Yi(e,t)):t}notify(e){sa.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},_a=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new wte,this.#t=e.mutationCache||new Cte,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=oa.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ca.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ji(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ate(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sa.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;sa.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sa.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=sa.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(qi).catch(qi)}invalidateQueries(e,t={}){return sa.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=sa.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(qi)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(qi)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Ji(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(qi).catch(qi)}fetchInfiniteQuery(e){return e.behavior=ma(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qi).catch(qi)}ensureInfiniteQueryData(e){return e.behavior=ma(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ca.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Qi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{$i(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Qi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{$i(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Zi(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ia&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Tte=Symbol(`QueryClient`),Ete=e=>{_e(Tte,e)};function va(e,t){a(t,!0);let n=I(t,`client`,19,()=>new _a);ce(()=>{n().mount()}),Ete(n()),ke(()=>{n().unmount()});var r=U();u(R(r),()=>t.children),g(e,r),z()}var ya=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function ba(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}new class{#e;#t;constructor(e={}){let{window:t=ya,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=ee(e=>{let n=Oe(t,`focusin`,e),r=Oe(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?ba(this.#e):null}};function xa(e,t){switch(e){case`post`:be(t);break;case`pre`:Ae(t);break}}function Sa(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;xa(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=ie(()=>n(t,o));return o=t,r})}function Ca(e,t,n){let r=De(()=>{let i=!1;Sa(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});be(()=>r)}function wa(e,t,n){Sa(e,`post`,t,n)}function Ta(e,t,n){Sa(e,`pre`,t,n)}wa.pre=Ta;function Ea(e,t){Ca(e,`post`,t)}function Da(e,t){Ca(e,`pre`,t)}Ea.pre=Da;function Oa(e,t){switch(e){case`local`:return t.localStorage;case`session`:return t.sessionStorage}}var ka=class{#e;#t;#n;#r;#i;#a=Y(0);constructor(e,t,n={}){let{storage:r=`local`,serializer:i={serialize:JSON.stringify,deserialize:JSON.parse},syncTabs:a=!0,window:o=ya}=n;if(this.#e=t,this.#t=e,this.#n=i,o===void 0)return;let s=Oa(r,o);this.#r=s;let c=s.getItem(e);c===null?this.#c(t):this.#e=this.#s(c),a&&r===`local`&&(this.#i=ee(()=>Oe(o,`storage`,this.#o)))}get current(){this.#i?.(),W(this.#a);let e=this.#s(this.#r?.getItem(this.#t))??this.#e,t=new WeakMap,n=r=>{if(r===null||r?.constructor.name===`Date`||typeof r!=`object`)return r;let i=t.get(r);return i||(i=new Proxy(r,{get:(e,t)=>(W(this.#a),n(Reflect.get(e,t))),set:(t,n,r)=>(K(this.#a,W(this.#a)+1),Reflect.set(t,n,r),this.#c(e),!0)}),t.set(r,i)),i};return n(e)}set current(e){this.#c(e),K(this.#a,W(this.#a)+1)}#o=e=>{e.key!==this.#t||e.newValue===null||(this.#e=this.#s(e.newValue),K(this.#a,W(this.#a)+1))};#s(e){try{return this.#n.deserialize(e)}catch(t){console.error(`Error when parsing "${e}" from persisted store "${this.#t}"`,t);return}}#c(e){try{e!=null&&this.#r?.setItem(this.#t,this.#n.serialize(e))}catch(e){console.error(`Error when writing value from persisted store "${this.#t}" to ${this.#r}`,e)}}};function Aa(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function ja(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function Ma(e,t,n={},r){let{lazy:i=!1,once:a=!1,initialValue:o,debounce:s,throttle:c}=n,l=Y(N(o)),u=Y(!1),d=Y(void 0),f=Y(N([])),p=()=>{W(f).forEach(e=>e()),K(f,[],!0)},m=e=>{K(f,[...W(f),e],!0)},h=async(e,n,r=!1)=>{try{K(u,!0),K(d,void 0),p();let i=new AbortController;m(()=>i.abort());let a=await t(e,n,{data:W(l),refetching:r,onCleanup:m,signal:i.signal});return K(l,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||K(d,e,!0);return}finally{K(u,!1)}},g=s?Aa(h,s):c?ja(h,c):h,_=Array.isArray(e)?e:[e],v;return r((t,n)=>{a&&v||v&&JSON.stringify(t)===JSON.stringify(v)||(v=t,g(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:i}),{get current(){return W(l)},get loading(){return W(u)},get error(){return W(d)},mutate:e=>{K(l,e,!0)},refetch:t=>{let n=_.map(e=>e());return g(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function Na(e,t,n){return Ma(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];wa(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function Pa(e,t,n){return Ma(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];wa.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}Na.pre=Pa;function Fa(e){return e.filter(e=>e.length>0)}var Ia={getItem:e=>null,setItem:(e,t)=>{}},La=typeof document<`u`;function Ra(e){return typeof e==`function`}function za(e){return typeof e==`object`&&!!e}var Ba=Symbol(`box`),Va=Symbol(`is-writable`);function Ha(e){return za(e)&&Ba in e}function Ua(e){return Wa.isBox(e)&&Va in e}function Wa(e){let t=Y(N(e));return{[Ba]:!0,[Va]:!0,get current(){return W(t)},set current(e){K(t,e,!0)}}}function Ga(e,t){let n=J(e);return t?{[Ba]:!0,[Va]:!0,get current(){return W(n)},set current(e){t(e)}}:{[Ba]:!0,get current(){return e()}}}function Ka(e){return Wa.isBox(e)?e:Ra(e)?Wa.with(e):Wa(e)}function qa(e){return Object.entries(e).reduce((e,[t,n])=>Wa.isBox(n)?(Wa.isWritableBox(n)?Object.defineProperty(e,t,{get(){return n.current},set(e){n.current=e}}):Object.defineProperty(e,t,{get(){return n.current}}),e):Object.assign(e,{[t]:n}),{})}function Ja(e){return Wa.isWritableBox(e)?{[Ba]:!0,get current(){return e.current}}:e}Wa.from=Ka,Wa.with=Ga,Wa.flatten=qa,Wa.readonly=Ja,Wa.isBox=Ha,Wa.isWritableBox=Ua;function Ya(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var Xa=Ya(/[A-Z]/,e=>`-${e.toLowerCase()}`);function Za(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${Xa(t)}: ${e[t]};`).join(`
3
+ `)}function Qa(e={}){return Za(e).replace(`
4
+ `,` `)}Qa({position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,transform:`translateX(-100%)`});var $a=Wa(`mode-watcher-mode`),eo=Wa(`mode-watcher-theme`),to=[`dark`,`light`,`system`];function no(e){return typeof e==`string`?to.includes(e):!1}var ro=class{#e=`system`;#t=La?localStorage:Ia;#n=this.#t.getItem($a.current);#r=no(this.#n)?this.#n:this.#e;#i=Y(N(this.#a()));#a(e=this.#r){return new ka($a.current,e,{serializer:{serialize:e=>e,deserialize:e=>no(e)?e:this.#e}})}constructor(){De(()=>wa.pre(()=>$a.current,(e,t)=>{let n=W(this.#i).current;K(this.#i,this.#a(n),!0),t&&localStorage.removeItem(t)}))}get current(){return W(this.#i).current}set current(e){W(this.#i).current=e}},io=class{#e=void 0;#t=!0;#n=Y(N(this.#e));#r=typeof window<`u`&&typeof window.matchMedia==`function`?new Ce(`prefers-color-scheme: light`):{current:!1};query(){La&&K(this.#n,this.#r.current?`light`:`dark`,!0)}tracking(e){this.#t=e}constructor(){De(()=>{Ae(()=>{this.#t&&this.query()})}),this.query=this.query.bind(this),this.tracking=this.tracking.bind(this)}get current(){return W(this.#n)}},ao=new ro,oo=new io,so=new class{#e=La?localStorage:Ia;#t=this.#e.getItem(eo.current);#n=this.#t===null||this.#t===void 0?``:this.#t;#r=Y(N(this.#i()));#i(e=this.#n){return new ka(eo.current,e,{serializer:{serialize:e=>typeof e==`string`?e:``,deserialize:e=>e}})}constructor(){De(()=>wa.pre(()=>eo.current,(e,t)=>{let n=W(this.#r).current;K(this.#r,this.#i(n),!0),t&&localStorage.removeItem(t)}))}get current(){return W(this.#r).current}set current(e){W(this.#r).current=e}},co,lo,uo=!1,fo=null;function po(){return fo||(fo=document.createElement(`style`),fo.appendChild(document.createTextNode(`* {
5
+ -webkit-transition: none !important;
6
+ -moz-transition: none !important;
7
+ -o-transition: none !important;
8
+ -ms-transition: none !important;
9
+ transition: none !important;
10
+ }`)),fo)}function mo(e,t=!1){if(typeof document>`u`)return;if(!uo){uo=!0,e();return}if(typeof window<`u`&&window.__vitest_worker__){e();return}clearTimeout(co),clearTimeout(lo);let n=po(),r=()=>document.head.appendChild(n),i=()=>{n.parentNode&&document.head.removeChild(n)};function a(){e(),window.requestAnimationFrame(i)}if(window.requestAnimationFrame!==void 0){r(),t?a():window.requestAnimationFrame(()=>{a()});return}r(),co=window.setTimeout(()=>{e(),lo=window.setTimeout(i,16)},16)}var ho=Wa(void 0),go=Wa(!0),_o=Wa(!1),vo=Wa([]),yo=Wa([]);function bo(){let e=J(()=>{if(!La)return;let e=ao.current===`system`?oo.current:ao.current,t=Fa(vo.current),n=Fa(yo.current);function r(){let r=document.documentElement,i=document.querySelector(`meta[name="theme-color"]`);e===`light`?(t.length&&r.classList.remove(...t),n.length&&r.classList.add(...n),r.style.colorScheme=`light`,i&&ho.current&&i.setAttribute(`content`,ho.current.light)):(n.length&&r.classList.remove(...n),t.length&&r.classList.add(...t),r.style.colorScheme=`dark`,i&&ho.current&&i.setAttribute(`content`,ho.current.dark))}return go.current?mo(r,_o.current):r(),e});return{get current(){return W(e)}}}function xo(){let e=J(()=>{if(so.current,!La)return;function e(){document.documentElement.setAttribute(`data-theme`,so.current)}return go.current?mo(e,ie(()=>_o.current)):e(),so.current});return{get current(){return W(e)}}}var So=bo(),Co=xo();function wo(e){ao.current=e}function To(e){so.current=e}function Eo(e){return e}function Do({defaultMode:e=`system`,themeColors:t,darkClassNames:n=[`dark`],lightClassNames:r=[],defaultTheme:i=``,modeStorageKey:a=`mode-watcher-mode`,themeStorageKey:o=`mode-watcher-theme`}){let s=document.documentElement,c=localStorage.getItem(a)??e,l=localStorage.getItem(o)??i,u=c===`light`||c===`system`&&window.matchMedia(`(prefers-color-scheme: light)`).matches;if(u?(n.length&&s.classList.remove(...n.filter(Boolean)),r.length&&s.classList.add(...r.filter(Boolean))):(r.length&&s.classList.remove(...r.filter(Boolean)),n.length&&s.classList.add(...n.filter(Boolean))),s.style.colorScheme=u?`light`:`dark`,t){let e=document.querySelector(`meta[name="theme-color"]`);e&&e.setAttribute(`content`,c===`light`?t.light:t.dark)}l&&(s.setAttribute(`data-theme`,l),localStorage.setItem(o,l)),localStorage.setItem(a,c)}var Oo=h(`<meta name="theme-color"/>`);function ko(e,t){a(t,!0);var n=U(),r=R(n),i=e=>{var n=Oo();F(()=>q(n,`content`,t.themeColors.dark)),g(e,n)};k(r,e=>{t.themeColors&&e(i)}),g(e,n),z()}var Ao=h(`<meta name="theme-color"/>`),jo=h(`<!> <!>`,1);function Mo(e,t){a(t,!0);let n=I(t,`trueNonce`,3,``);ge(`26pea3`,e=>{var r=jo(),i=R(r),a=e=>{var n=Ao();F(()=>q(n,`content`,t.themeColors.dark)),g(e,n)};k(i,e=>{t.themeColors&&e(a)}),p(L(i,2),()=>`<script${n()?` nonce=${n()}`:``}>(`+Do.toString()+`)(`+JSON.stringify(t.initConfig)+`);<\/script>`),g(e,r)}),z()}function No(e,t){a(t,!0);let n=I(t,`track`,3,!0),r=I(t,`defaultMode`,3,`system`),i=I(t,`disableTransitions`,3,!0),o=I(t,`darkClassNames`,19,()=>[`dark`]),s=I(t,`lightClassNames`,19,()=>[]),c=I(t,`defaultTheme`,3,``),l=I(t,`nonce`,3,``),u=I(t,`themeStorageKey`,3,`mode-watcher-theme`),d=I(t,`modeStorageKey`,3,`mode-watcher-mode`),f=I(t,`disableHeadScriptInjection`,3,!1),p=I(t,`synchronousModeChanges`,3,!1);$a.current=d(),eo.current=u(),vo.current=o(),yo.current=s(),go.current=i(),ho.current=t.themeColors,_o.current=p(),Ae(()=>{_o.current=p()}),Ae(()=>{go.current=i()}),Ae(()=>{ho.current=t.themeColors}),Ae(()=>{vo.current=o()}),Ae(()=>{yo.current=s()}),Ae(()=>{$a.current=d()}),Ae(()=>{eo.current=u()}),Ae(()=>{So.current,$a.current,eo.current,Co.current}),ce(()=>{oo.tracking(n()),oo.query();let e=localStorage.getItem($a.current);wo(no(e)?e:r()),To(localStorage.getItem(eo.current)||c())});let m=Eo({defaultMode:r(),themeColors:t.themeColors,darkClassNames:o(),lightClassNames:s(),defaultTheme:c(),modeStorageKey:d(),themeStorageKey:u()}),h=J(()=>typeof window>`u`?l():``);var _=U(),v=R(_),y=e=>{ko(e,{get themeColors(){return ho.current}})},b=e=>{Mo(e,{get trueNonce(){return W(h)},get initConfig(){return m},get themeColors(){return ho.current}})};k(v,e=>{f()?e(y):e(b,-1)}),g(e,_),z()}var Po=[`left`,`right`,`bottom`],Fo={left:`Left Panel`,right:`Right Panel`,bottom:`Bottom Panel`},Io=h(`<div aria-hidden="true"><span class="dock-drop-label svelte-p8iqem"> </span></div>`);function Lo(e,t){a(t,!0);let n=I(t,`hovered`,3,!1);var r=Io();let i;var o=V(r),c=V(o);d(o),d(r),F(()=>{i=s(r,1,`dock-drop-indicator svelte-p8iqem`,null,i,{hovered:n()}),A(c,`Move to ${Fo[t.dock]??``}`)}),g(e,r),z()}var Ro=new Set([`$$slots`,`$$events`,`$$legacy`]);function zo(e,t){let n=H(t,Ro),r=[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}],[`path`,{d:`m2 2 20 20`}]];P(e,B({name:`eye-off`},()=>n,{get iconNode(){return r}}))}var Bo=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vo(e,t){let n=H(t,Bo),r=[[`path`,{d:`M6 8L2 12L6 16`}],[`path`,{d:`M2 12H22`}]];P(e,B({name:`move-left`},()=>n,{get iconNode(){return r}}))}var Ho=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uo(e,t){let n=H(t,Ho),r=[[`path`,{d:`M18 8L22 12L18 16`}],[`path`,{d:`M2 12H22`}]];P(e,B({name:`move-right`},()=>n,{get iconNode(){return r}}))}var Wo=new Set([`$$slots`,`$$events`,`$$legacy`]);function Go(e,t){let n=H(t,Wo),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 15h18`}]];P(e,B({name:`panel-bottom`},()=>n,{get iconNode(){return r}}))}var Ko=new Set([`$$slots`,`$$events`,`$$legacy`]);function qo(e,t){let n=H(t,Ko),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]];P(e,B({name:`panel-left`},()=>n,{get iconNode(){return r}}))}var Jo=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yo(e,t){let n=H(t,Jo),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}]];P(e,B({name:`panel-right`},()=>n,{get iconNode(){return r}}))}function Xo(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`onOpenChange`,3,Ye),i=I(t,`onOpenChangeComplete`,3,Ye);St.create({variant:X(()=>`alert-dialog`),open:X(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:X(()=>i())});var o=U();u(R(o),()=>t.children??D),g(e,o),z()}var Zo=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`]),Qo=h(`<button><!></button>`);function $o(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=H(t,Zo),s=eee.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e))}),c=J(()=>at(o,s.props));var l=U(),f=R(l),p=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(c)})),g(e,n)},m=e=>{var n=Qo();O(n,()=>({...W(c)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(f,e=>{t.child?e(p):e(m,-1)}),g(e,l),z()}var es=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`,`disabled`]),ts=h(`<button><!></button>`);function ns(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`disabled`,3,!1),s=H(t,es),c=ze.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e)),disabled:X(()=>!!o())}),l=J(()=>at(s,c.props));var f=U(),p=R(f),m=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(l)})),g(e,n)},h=e=>{var n=ts();O(n,()=>({...W(l)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(p,e=>{t.child?e(m):e(h,-1)}),g(e,f),z()}var rs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`interactOutsideBehavior`,`onCloseAutoFocus`,`onEscapeKeydown`,`onOpenAutoFocus`,`onInteractOutside`,`preventScroll`,`trapFocus`,`restoreScrollDelay`]),is=h(`<!> <!>`,1),as=h(`<!> <div><!></div>`,1);function os(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`forceMount`,3,!1),s=I(t,`interactOutsideBehavior`,3,`ignore`),c=I(t,`onCloseAutoFocus`,3,Ye),l=I(t,`onEscapeKeydown`,3,Ye),f=I(t,`onOpenAutoFocus`,3,Ye),p=I(t,`onInteractOutside`,3,Ye),m=I(t,`preventScroll`,3,!0),h=I(t,`trapFocus`,3,!0),_=I(t,`restoreScrollDelay`,3,null),v=H(t,rs),y=qe.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e))}),b=J(()=>at(v,y.props));var x=U(),S=R(x),C=e=>{tt(e,{get ref(){return y.opts.ref},loop:!0,get trapFocus(){return h()},get enabled(){return y.root.opts.open.current},get onCloseAutoFocus(){return c()},onOpenAutoFocus:e=>{f()(e),!e.defaultPrevented&&(e.preventDefault(),Le(0,()=>y.opts.ref.current?.focus()))},focusScope:(e,n)=>{let r=()=>n?.().props;ot(e,B(()=>W(b),{get enabled(){return y.root.opts.open.current},get ref(){return y.opts.ref},onEscapeKeydown:e=>{l()(e),!e.defaultPrevented&&y.root.handleClose()},children:(e,n)=>{gt(e,B(()=>W(b),{get ref(){return y.opts.ref},get enabled(){return y.root.opts.open.current},get interactOutsideBehavior(){return s()},onInteractOutside:e=>{p()(e),!e.defaultPrevented&&y.root.handleClose()},children:(e,n)=>{mt(e,B(()=>W(b),{get ref(){return y.opts.ref},get enabled(){return y.root.opts.open.current},children:(e,n)=>{var i=U(),a=R(i),o=e=>{var n=is(),i=R(n),a=e=>{$e(e,{get preventScroll(){return m()},get restoreScrollDelay(){return _()}})};k(i,e=>{y.root.opts.open.current&&e(a)});var o=L(i,2);{let e=J(()=>({props:at(W(b),r()),...y.snippetProps}));u(o,()=>t.child,()=>W(e))}g(e,n)},s=e=>{var n=as(),i=R(n);$e(i,{get preventScroll(){return m()}});var a=L(i,2);O(a,e=>({...e}),[()=>at(W(b),r())]),u(V(a),()=>t.children??D),d(a),g(e,n)};k(a,e=>{t.child?e(o):e(s,-1)}),g(e,i)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};k(S,e=>{(y.shouldRender||o())&&e(C)}),g(e,x),z()}var ss=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`width`,`height`]),cs=j(`<svg viewBox="0 0 30 10" preserveAspectRatio="none" data-arrow=""><polygon points="0,0 30,0 15,10" fill="currentColor"></polygon></svg>`),ls=h(`<span><!></span>`);function us(e,t){a(t,!0);let n=I(t,`id`,19,dt),r=I(t,`width`,3,10),i=I(t,`height`,3,5),o=H(t,ss),s=J(()=>at(o,{id:n()}));var c=U(),l=R(c),f=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(s)})),g(e,n)},p=e=>{var n=ls();O(n,()=>({...W(s)}));var a=V(n),o=e=>{var n=U();u(R(n),()=>t.children??D),g(e,n)},c=e=>{var t=cs();F(()=>{q(t,`width`,r()),q(t,`height`,i())}),g(e,t)};k(a,e=>{t.children?e(o):e(c,-1)}),d(n),g(e,n)};k(l,e=>{t.child?e(f):e(p,-1)}),g(e,c),z()}var ds=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`]);function fs(e,t){a(t,!0);let n=I(t,`id`,19,dt),r=I(t,`ref`,15,null),i=H(t,ds),o=fee.create({id:X(()=>n()),ref:X(()=>r(),e=>r(e))}),s=J(()=>at(i,o.props));us(e,B(()=>W(s))),z()}function ps(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]??[0,0],[c,l]=t[o]??[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function ms(e,t){return e[0]>=t.left&&e[0]<=t.right&&e[1]>=t.top&&e[1]<=t.bottom}function hs(e,t){let n=e.left+e.width/2,r=e.top+e.height/2,i=t.left+t.width/2,a=t.top+t.height/2,o=i-n,s=a-r;return Math.abs(o)>Math.abs(s)?o>0?`right`:`left`:s>0?`bottom`:`top`}var gs=class{#e;#t;#n;#r=null;#i=null;#a=[];#o=null;#s=null;#c=null;#l(){this.#s!==null&&(cancelAnimationFrame(this.#s),this.#s=null)}#u(){this.#l(),this.#s=requestAnimationFrame(()=>{this.#s=null,!(!this.#r||!this.#i)&&(this.#m(),this.#e.onPointerExit())})}#d(){this.#c!==null&&(clearTimeout(this.#c),this.#c=null)}#f(){this.#n!==null&&(this.#d(),this.#c=window.setTimeout(()=>{this.#c=null,!(!this.#r||!this.#i)&&(this.#m(),this.#e.onPointerExit())},this.#n))}constructor(e){this.#e=e,this.#t=e.buffer??1;let t=e.transitIntentTimeout;this.#n=typeof t==`number`&&t>0?t:null,Re([e.triggerNode,e.contentNode,e.enabled],([e,t,n])=>{if(!e||!t||!n){this.#o=null,this.#m();return}return this.#o&&this.#o!==e&&this.#m(),this.#o=e,[Oe(et(e),`pointermove`,n=>{this.#p([n.clientX,n.clientY],e,t)}),Oe(e,`pointerleave`,e=>{let n=e.relatedTarget;if(Xe(n)&&t.contains(n))return;let r=this.#e.ignoredTargets?.()??[];Xe(n)&&r.some(e=>e===n||e.contains(n))||(this.#a=Xe(n)&&r.length>0?r.filter(e=>n.contains(e)):[],this.#r=[e.clientX,e.clientY],this.#i=`content`,this.#u())}),Oe(e,`pointerenter`,()=>{this.#m()}),Oe(t,`pointerenter`,()=>{this.#m()}),Oe(t,`pointerleave`,t=>{let n=t.relatedTarget;Xe(n)&&e.contains(n)||(this.#r=[t.clientX,t.clientY],this.#i=`trigger`,this.#u())})].reduce((e,t)=>()=>{e(),t()},()=>{})})}#p(e,t,n){if(!this.#r||!this.#i)return;this.#l(),this.#f();let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();if(this.#i===`content`&&ms(e,i)){this.#m();return}if(this.#i===`trigger`&&ms(e,r)){this.#m();return}if(this.#i===`content`&&this.#a.length>0)for(let t of this.#a){let n=t.getBoundingClientRect();if(ms(e,n))return;let i=hs(r,n),a=this.#h(r,n,i);if(a&&ps(e,a))return}let a=hs(r,i),o=this.#h(r,i,a);if(o&&ps(e,o))return;let s=this.#i===`content`?i:r;ps(e,this.#g(this.#r,s,a,this.#i))||(this.#m(),this.#e.onPointerExit())}#m(){this.#r=null,this.#i=null,this.#a=[],this.#l(),this.#d()}#h(e,t,n){let r=this.#t;switch(n){case`top`:return[[Math.min(e.left,t.left)-r,e.top],[Math.min(e.left,t.left)-r,t.bottom],[Math.max(e.right,t.right)+r,t.bottom],[Math.max(e.right,t.right)+r,e.top]];case`bottom`:return[[Math.min(e.left,t.left)-r,e.bottom],[Math.min(e.left,t.left)-r,t.top],[Math.max(e.right,t.right)+r,t.top],[Math.max(e.right,t.right)+r,e.bottom]];case`left`:return[[e.left,Math.min(e.top,t.top)-r],[t.right,Math.min(e.top,t.top)-r],[t.right,Math.max(e.bottom,t.bottom)+r],[e.left,Math.max(e.bottom,t.bottom)+r]];case`right`:return[[e.right,Math.min(e.top,t.top)-r],[t.left,Math.min(e.top,t.top)-r],[t.left,Math.max(e.bottom,t.bottom)+r],[e.right,Math.max(e.bottom,t.bottom)+r]]}}#g(e,t,n,r){let i=this.#t*4,[a,o]=e;switch(r===`trigger`?this.#_(n):n){case`top`:return[[a-i,o+i],[a+i,o+i],[t.right+i,t.bottom],[t.right+i,t.top],[t.left-i,t.top],[t.left-i,t.bottom]];case`bottom`:return[[a-i,o-i],[a+i,o-i],[t.right+i,t.top],[t.right+i,t.bottom],[t.left-i,t.bottom],[t.left-i,t.top]];case`left`:return[[a+i,o-i],[a+i,o+i],[t.right,t.bottom+i],[t.left,t.bottom+i],[t.left,t.top-i],[t.right,t.top-i]];case`right`:return[[a-i,o-i],[a-i,o+i],[t.left,t.bottom+i],[t.right,t.bottom+i],[t.right,t.top-i],[t.left,t.top-i]]}}#_(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`}}},_s=ft({component:`popover`,parts:[`root`,`trigger`,`content`,`close`,`overlay`]}),vs=new We(`Popover.Root`),ys=class e{static create(t){return vs.set(new e(t))}opts;#e=Y(null);get contentNode(){return W(this.#e)}set contentNode(e){K(this.#e,e,!0)}contentPresence;#t=Y(null);get triggerNode(){return W(this.#t)}set triggerNode(e){K(this.#t,e,!0)}#n=Y(null);get overlayNode(){return W(this.#n)}set overlayNode(e){K(this.#n,e,!0)}overlayPresence;#r=Y(!1);get openedViaHover(){return W(this.#r)}set openedViaHover(e){K(this.#r,e,!0)}#i=Y(!1);get hasInteractedWithContent(){return W(this.#i)}set hasInteractedWithContent(e){K(this.#i,e,!0)}#a=Y(!1);get hoverCooldown(){return W(this.#a)}set hoverCooldown(e){K(this.#a,e,!0)}#o=Y(0);get closeDelay(){return W(this.#o)}set closeDelay(e){K(this.#o,e,!0)}#s=null;#c=null;constructor(e){this.opts=e,this.contentPresence=new He({ref:X(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new He({ref:X(()=>this.overlayNode),open:this.opts.open}),Re(()=>this.opts.open.current,e=>{e||(this.openedViaHover=!1,this.hasInteractedWithContent=!1,this.#l())})}setDomContext(e){this.#c=e}#l(){this.#s!==null&&this.#c&&(this.#c.clearTimeout(this.#s),this.#s=null)}toggleOpen(){this.#l(),this.opts.open.current=!this.opts.open.current}handleClose(){this.#l(),this.opts.open.current&&(this.opts.open.current=!1)}handleHoverOpen(){this.#l(),!this.opts.open.current&&(this.openedViaHover=!0,this.opts.open.current=!0)}handleHoverClose(){this.opts.open.current&&this.openedViaHover&&!this.hasInteractedWithContent&&(this.opts.open.current=!1)}handleDelayedHoverClose(){this.opts.open.current&&(!this.openedViaHover||this.hasInteractedWithContent||(this.#l(),this.closeDelay<=0?this.opts.open.current=!1:this.#c&&(this.#s=this.#c.setTimeout(()=>{this.openedViaHover&&!this.hasInteractedWithContent&&(this.opts.open.current=!1),this.#s=null},this.closeDelay))))}cancelDelayedClose(){this.#l()}markInteraction(){this.hasInteractedWithContent=!0,this.#l()}},bs=class e{static create(t){return new e(t,vs.get())}opts;root;attachment;domContext;#e=null;#t=null;#n=Y(!1);constructor(e,t){this.opts=e,this.root=t,this.attachment=yt(this.opts.ref,e=>this.root.triggerNode=e),this.domContext=new xt(e.ref),this.root.setDomContext(this.domContext),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this),Re(()=>this.opts.closeDelay.current,e=>{this.root.closeDelay=e})}#r(){this.#e!==null&&(this.domContext.clearTimeout(this.#e),this.#e=null)}#i(){this.#t!==null&&(this.domContext.clearTimeout(this.#t),this.#t=null)}#a(){this.#r(),this.#i()}onpointerenter(e){if(this.opts.disabled.current||!this.opts.openOnHover.current||Ze(e)||(K(this.#n,!0),this.#i(),this.root.cancelDelayedClose(),this.root.opts.open.current||this.root.hoverCooldown))return;let t=this.opts.openDelay.current;t<=0?this.root.handleHoverOpen():this.#e=this.domContext.setTimeout(()=>{this.root.handleHoverOpen(),this.#e=null},t)}onpointerleave(e){this.opts.disabled.current||this.opts.openOnHover.current&&(Ze(e)||(K(this.#n,!1),this.#r(),this.root.hoverCooldown=!1))}onclick(e){if(!this.opts.disabled.current&&e.button===0){if(this.#a(),W(this.#n)&&this.root.opts.open.current&&this.root.openedViaHover){this.root.openedViaHover=!1,this.root.hasInteractedWithContent=!0;return}W(this.#n)&&this.opts.openOnHover.current&&this.root.opts.open.current&&(this.root.hoverCooldown=!0),this.root.hoverCooldown&&!this.root.opts.open.current&&(this.root.hoverCooldown=!1),this.root.toggleOpen()}}onkeydown(e){this.opts.disabled.current||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.#a(),this.root.toggleOpen())}#o(){if(this.root.opts.open.current&&this.root.contentNode?.id)return this.root.contentNode?.id}#s=J(()=>({id:this.opts.id.current,"aria-haspopup":`dialog`,"aria-expanded":_t(this.root.opts.open.current),"data-state":rt(this.root.opts.open.current),"aria-controls":this.#o(),[_s.trigger]:``,disabled:this.opts.disabled.current,onkeydown:this.onkeydown,onclick:this.onclick,onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave,...this.attachment}));get props(){return W(this.#s)}set props(e){K(this.#s,e)}},xs=class e{static create(t){return new e(t,vs.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=yt(this.opts.ref,e=>this.root.contentNode=e),this.onpointerdown=this.onpointerdown.bind(this),this.onfocusin=this.onfocusin.bind(this),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this),new gs({triggerNode:()=>this.root.triggerNode,contentNode:()=>this.root.contentNode,enabled:()=>this.root.opts.open.current&&this.root.openedViaHover&&!this.root.hasInteractedWithContent,onPointerExit:()=>{this.root.handleDelayedHoverClose()}})}onpointerdown(e){this.root.markInteraction()}onfocusin(e){let t=e.target;Xe(t)&&iee(t)&&this.root.markInteraction()}onpointerenter(e){Ze(e)||this.root.cancelDelayedClose()}onpointerleave(e){Ze(e)}onInteractOutside=e=>{if(this.opts.onInteractOutside.current(e),e.defaultPrevented||!Xe(e.target))return;let t=e.target.closest(_s.selector(`trigger`));if(!(t&&t===this.root.triggerNode)){if(this.opts.customAnchor.current){if(Xe(this.opts.customAnchor.current)){if(this.opts.customAnchor.current.contains(e.target))return}else if(typeof this.opts.customAnchor.current==`string`){let t=document.querySelector(this.opts.customAnchor.current);if(t&&t.contains(e.target))return}}this.root.handleClose()}};onEscapeKeydown=e=>{this.opts.onEscapeKeydown.current(e),!e.defaultPrevented&&this.root.handleClose()};get shouldRender(){return this.root.contentPresence.shouldRender}get shouldTrapFocus(){return!(this.root.openedViaHover&&!this.root.hasInteractedWithContent)}#e=J(()=>({open:this.root.opts.open.current}));get snippetProps(){return W(this.#e)}set snippetProps(e){K(this.#e,e)}#t=J(()=>({id:this.opts.id.current,tabindex:-1,"data-state":rt(this.root.opts.open.current),...Qe(this.root.contentPresence.transitionStatus),[_s.content]:``,style:{pointerEvents:`auto`,contain:`layout style`},onpointerdown:this.onpointerdown,onfocusin:this.onfocusin,onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave,...this.attachment}));get props(){return W(this.#t)}set props(e){K(this.#t,e)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown}},Ss=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`forceMount`,`onOpenAutoFocus`,`onCloseAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`customAnchor`,`style`]),Cs=h(`<div><div><!></div></div>`);function ws(e,t){let n=ne();a(t,!0);let r=I(t,`ref`,15,null),i=I(t,`id`,19,()=>Ie(n)),o=I(t,`forceMount`,3,!1),s=I(t,`onOpenAutoFocus`,3,Ye),c=I(t,`onCloseAutoFocus`,3,Ye),l=I(t,`onEscapeKeydown`,3,Ye),f=I(t,`onInteractOutside`,3,Ye),p=I(t,`trapFocus`,3,!0),m=I(t,`preventScroll`,3,!1),h=I(t,`customAnchor`,3,null),_=H(t,Ss),v=xs.create({id:X(()=>i()),ref:X(()=>r(),e=>r(e)),onInteractOutside:X(()=>f()),onEscapeKeydown:X(()=>l()),customAnchor:X(()=>h())}),y=J(()=>at(_,v.props)),b=J(()=>p()&&v.shouldTrapFocus);function x(e){v.shouldTrapFocus||e.preventDefault(),s()(e)}var S=U(),C=R(S),w=e=>{cn(e,B(()=>W(y),()=>v.popperProps,{get ref(){return v.opts.ref},get enabled(){return v.root.opts.open.current},get id(){return i()},get trapFocus(){return W(b)},get preventScroll(){return m()},loop:!0,forceMount:!0,get customAnchor(){return h()},onOpenAutoFocus:x,get onCloseAutoFocus(){return c()},get shouldRender(){return v.shouldRender},popper:(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=J(()=>at(r(),{style:on(`popover`)},{style:t.style}));var o=U(),s=R(o),c=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(a),wrapperProps:i(),...v.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Cs();O(n,()=>({...i()}));var r=V(n);O(r,()=>({...W(a)})),u(V(r),()=>t.children??D),d(r),d(n),g(e,n)};k(s,e=>{t.child?e(c):e(l,-1)}),g(e,o)},$$slots:{popper:!0}}))},T=e=>{an(e,B(()=>W(y),()=>v.popperProps,{get ref(){return v.opts.ref},get open(){return v.root.opts.open.current},get id(){return i()},get trapFocus(){return W(b)},get preventScroll(){return m()},loop:!0,forceMount:!1,get customAnchor(){return h()},onOpenAutoFocus:x,get onCloseAutoFocus(){return c()},get shouldRender(){return v.shouldRender},popper:(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=J(()=>at(r(),{style:on(`popover`)},{style:t.style}));var o=U(),s=R(o),c=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(a),wrapperProps:i(),...v.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Cs();O(n,()=>({...i()}));var r=V(n);O(r,()=>({...W(a)})),u(V(r),()=>t.children??D),d(r),d(n),g(e,n)};k(s,e=>{t.child?e(c):e(l,-1)}),g(e,o)},$$slots:{popper:!0}}))};k(C,e=>{o()?e(w):o()||e(T,1)}),g(e,S),z()}var Ts=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`type`,`disabled`,`openOnHover`,`openDelay`,`closeDelay`]),Es=h(`<button><!></button>`);function Ds(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`type`,3,`button`),s=I(t,`disabled`,3,!1),c=I(t,`openOnHover`,3,!1),l=I(t,`openDelay`,3,700),f=I(t,`closeDelay`,3,300),p=H(t,Ts),m=bs.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e)),disabled:X(()=>!!s()),openOnHover:X(()=>c()),openDelay:X(()=>l()),closeDelay:X(()=>f())}),h=J(()=>at(p,m.props,{type:o()}));sn(e,{get id(){return r()},get ref(){return m.opts.ref},children:(e,n)=>{var r=U(),i=R(r),a=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(h)})),g(e,n)},o=e=>{var n=Es();O(n,()=>({...W(h)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(i,e=>{t.child?e(a):e(o,-1)}),g(e,r)},$$slots:{default:!0}}),z()}var Os=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function ks(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,Os);fs(e,B(()=>r,{"data-popover-arrow":``,get ref(){return n()},set ref(e){n(e)}})),z()}function As(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`onOpenChange`,3,Ye),i=I(t,`onOpenChangeComplete`,3,Ye);St.create({variant:X(()=>`dialog`),open:X(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:X(()=>i())});var o=U();u(R(o),()=>t.children??D),g(e,o),z()}var js=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`disabled`]),Ms=h(`<button><!></button>`);function Ns(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`disabled`,3,!1),s=H(t,js),c=tee.create({variant:X(()=>`close`),id:X(()=>r()),ref:X(()=>i(),e=>i(e)),disabled:X(()=>!!o())}),l=J(()=>at(s,c.props));var f=U(),p=R(f),m=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(l)})),g(e,n)},h=e=>{var n=Ms();O(n,()=>({...W(l)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(p,e=>{t.child?e(m):e(h,-1)}),g(e,f),z()}var Ps=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`onCloseAutoFocus`,`onOpenAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`restoreScrollDelay`]),Fs=h(`<!> <!>`,1),Is=h(`<!> <div><!></div>`,1);function Ls(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`forceMount`,3,!1),s=I(t,`onCloseAutoFocus`,3,Ye),c=I(t,`onOpenAutoFocus`,3,Ye),l=I(t,`onEscapeKeydown`,3,Ye),f=I(t,`onInteractOutside`,3,Ye),p=I(t,`trapFocus`,3,!0),m=I(t,`preventScroll`,3,!0),h=I(t,`restoreScrollDelay`,3,null),_=H(t,Ps),v=qe.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e))}),y=J(()=>at(_,v.props));var b=U(),x=R(b),S=e=>{tt(e,{get ref(){return v.opts.ref},loop:!0,get trapFocus(){return p()},get enabled(){return v.root.opts.open.current},get onOpenAutoFocus(){return c()},get onCloseAutoFocus(){return s()},focusScope:(e,n)=>{let r=()=>n?.().props;ot(e,B(()=>W(y),{get enabled(){return v.root.opts.open.current},get ref(){return v.opts.ref},onEscapeKeydown:e=>{l()(e),!e.defaultPrevented&&v.root.handleClose()},children:(e,n)=>{gt(e,B(()=>W(y),{get ref(){return v.opts.ref},get enabled(){return v.root.opts.open.current},onInteractOutside:e=>{f()(e),!e.defaultPrevented&&v.root.handleClose()},children:(e,n)=>{mt(e,B(()=>W(y),{get ref(){return v.opts.ref},get enabled(){return v.root.opts.open.current},children:(e,n)=>{var i=U(),a=R(i),o=e=>{var n=Fs(),i=R(n),a=e=>{$e(e,{get preventScroll(){return m()},get restoreScrollDelay(){return h()}})};k(i,e=>{v.root.opts.open.current&&e(a)});var o=L(i,2);{let e=J(()=>({props:at(W(y),r()),...v.snippetProps}));u(o,()=>t.child,()=>W(e))}g(e,n)},s=e=>{var n=Is(),i=R(n);$e(i,{get preventScroll(){return m()}});var a=L(i,2);O(a,e=>({...e}),[()=>at(W(y),r())]),u(V(a),()=>t.children??D),d(a),g(e,n)};k(a,e=>{t.child?e(o):e(s,-1)}),g(e,i)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};k(x,e=>{(v.shouldRender||o())&&e(S)}),g(e,b),z()}function Rs(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`dir`,3,`ltr`),i=I(t,`onOpenChange`,3,Ye),o=I(t,`onOpenChangeComplete`,3,Ye),s=I(t,`_internal_variant`,3,`dropdown-menu`),c=I(t,`_internal_should_skip_exit_animation`,3,void 0),l=nee.create({variant:X(()=>s()),dir:X(()=>r()),onClose:()=>{n(!1),i()(!1)},shouldSkipExitAnimation:()=>c()?.()??!1});vt.create({open:X(()=>n(),e=>{n(e),i()(e)}),onOpenChangeComplete:X(()=>o())},l),rn(e,{children:(e,n)=>{var r=U();u(R(r),()=>t.children??D),g(e,r)},$$slots:{default:!0}}),z()}var zs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`child`,`children`,`ref`,`loop`,`onInteractOutside`,`onEscapeKeydown`,`onCloseAutoFocus`,`forceMount`,`trapFocus`,`style`]),Bs=h(`<div><div><!></div></div>`);function Vs(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`loop`,3,!0),s=I(t,`onInteractOutside`,3,Ye),c=I(t,`onEscapeKeydown`,3,Ye),l=I(t,`onCloseAutoFocus`,3,Ye),f=I(t,`forceMount`,3,!1),p=I(t,`trapFocus`,3,!1),m=H(t,zs),h=ct.create({id:X(()=>r()),loop:X(()=>o()),ref:X(()=>i(),e=>i(e)),onCloseAutoFocus:X(()=>l())}),_=J(()=>at(m,h.props));function v(e){if(h.handleInteractOutside(e),!e.defaultPrevented&&(s()(e),!e.defaultPrevented)){if(e.target&&e.target instanceof Element){let t=`[${h.parentMenu.root.getBitsAttr(`sub-content`)}]`;if(e.target.closest(t))return}h.parentMenu.onClose()}}function y(e){c()(e),!e.defaultPrevented&&h.parentMenu.onClose()}var b=U(),x=R(b),S=e=>{cn(e,B(()=>W(_),()=>h.popperProps,{get ref(){return h.opts.ref},get enabled(){return h.parentMenu.opts.open.current},onInteractOutside:v,onEscapeKeydown:y,get trapFocus(){return p()},get loop(){return o()},forceMount:!0,get id(){return r()},get shouldRender(){return h.shouldRender},popper:(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=J(()=>at(r(),{style:on(`dropdown-menu`)},{style:t.style}));var o=U(),s=R(o),c=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(a),wrapperProps:i(),...h.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Bs();O(n,()=>({...i()}));var r=V(n);O(r,()=>({...W(a)})),u(V(r),()=>t.children??D),d(r),d(n),g(e,n)};k(s,e=>{t.child?e(c):e(l,-1)}),g(e,o)},$$slots:{popper:!0}}))},C=e=>{an(e,B(()=>W(_),()=>h.popperProps,{get ref(){return h.opts.ref},get open(){return h.parentMenu.opts.open.current},onInteractOutside:v,onEscapeKeydown:y,get trapFocus(){return p()},get loop(){return o()},forceMount:!1,get id(){return r()},get shouldRender(){return h.shouldRender},popper:(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=J(()=>at(r(),{style:on(`dropdown-menu`)},{style:t.style}));var o=U(),s=R(o),c=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(a),wrapperProps:i(),...h.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Bs();O(n,()=>({...i()}));var r=V(n);O(r,()=>({...W(a)})),u(V(r),()=>t.children??D),d(r),d(n),g(e,n)};k(s,e=>{t.child?e(c):e(l,-1)}),g(e,o)},$$slots:{popper:!0}}))};k(x,e=>{f()?e(S):f()||e(C,1)}),g(e,b),z()}var Hs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`disabled`,`type`]),Us=h(`<button><!></button>`);function Ws(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`disabled`,3,!1),s=I(t,`type`,3,`button`),c=H(t,Hs),l=aee.create({id:X(()=>r()),disabled:X(()=>o()??!1),ref:X(()=>i(),e=>i(e))}),f=J(()=>at(c,l.props,{type:s()}));sn(e,{get id(){return r()},get ref(){return l.opts.ref},children:(e,n)=>{var r=U(),i=R(r),a=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(f)})),g(e,n)},o=e=>{var n=Us();O(n,()=>({...W(f)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(i,e=>{t.child?e(a):e(o,-1)}),g(e,r)},$$slots:{default:!0}}),z()}var Gs=ft({component:`label`,parts:[`root`]}),Ks=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=yt(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}onmousedown(e){e.detail>1&&e.preventDefault()}#e=J(()=>({id:this.opts.id.current,[Gs.root]:``,onmousedown:this.onmousedown,...this.attachment}));get props(){return W(this.#e)}set props(e){K(this.#e,e)}},qs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`for`]),Js=h(`<label><!></label>`);function Ys(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=H(t,qs),s=Ks.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e))}),c=J(()=>at(o,s.props,{for:t.for}));var l=U(),f=R(l),p=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(c)})),g(e,n)},m=e=>{var n=Js();O(n,()=>({...W(c),for:t.for})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(f,e=>{t.child?e(p):e(m,-1)}),g(e,l),z()}function Xs(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`onOpenChange`,3,Ye),i=I(t,`onOpenChangeComplete`,3,Ye);ys.create({open:X(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:X(()=>i())}),rn(e,{children:(e,n)=>{var r=U();u(R(r),()=>t.children??D),g(e,r)},$$slots:{default:!0}}),z()}var Zs=ft({component:`progress`,parts:[`root`]}),Qs=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=yt(this.opts.ref)}#e=J(()=>({role:`progressbar`,value:this.opts.value.current,"aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":this.opts.value.current===null?void 0:this.opts.value.current,"data-value":this.opts.value.current===null?void 0:this.opts.value.current,"data-state":$s(this.opts.value.current,this.opts.max.current),"data-max":this.opts.max.current,"data-min":this.opts.min.current,"data-indeterminate":this.opts.value.current===null?``:void 0,[Zs.root]:``,...this.attachment}));get props(){return W(this.#e)}set props(e){K(this.#e,e)}};function $s(e,t){return e===null?`indeterminate`:e===t?`loaded`:`loading`}var ec=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`value`,`max`,`min`,`id`,`ref`]),tc=h(`<div><!></div>`);function nc(e,t){let n=ne();a(t,!0);let r=I(t,`value`,3,0),i=I(t,`max`,3,100),o=I(t,`min`,3,0),s=I(t,`id`,19,()=>Ie(n)),c=I(t,`ref`,15,null),l=H(t,ec),f=Qs.create({value:X(()=>r()),max:X(()=>i()),min:X(()=>o()),id:X(()=>s()),ref:X(()=>c(),e=>c(e))}),p=J(()=>at(l,f.props));var m=U(),h=R(m),_=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(p)})),g(e,n)},v=e=>{var n=tc();O(n,()=>({...W(p)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(h,e=>{t.child?e(_):e(v,-1)}),g(e,m),z()}var rc=ft({component:`radio-group`,parts:[`root`,`item`]}),ic=new We(`RadioGroup.Root`),ac=class e{static create(t){return ic.set(new e(t))}opts;#e=J(()=>this.opts.value.current!==``);get hasValue(){return W(this.#e)}set hasValue(e){K(this.#e,e)}rovingFocusGroup;attachment;constructor(e){this.opts=e,this.attachment=yt(this.opts.ref),this.rovingFocusGroup=new Je({rootNode:this.opts.ref,candidateAttr:rc.item,loop:this.opts.loop,orientation:this.opts.orientation})}isChecked(e){return this.opts.value.current===e}setValue(e){this.opts.value.current=e}#t=J(()=>({id:this.opts.id.current,role:`radiogroup`,"aria-required":_t(this.opts.required.current),"aria-disabled":_t(this.opts.disabled.current),"aria-readonly":this.opts.readonly.current?`true`:void 0,"data-disabled":st(this.opts.disabled.current),"data-readonly":st(this.opts.readonly.current),"data-orientation":this.opts.orientation.current,[rc.root]:``,...this.attachment}));get props(){return W(this.#t)}set props(e){K(this.#t,e)}},oc=class e{static create(t){return new e(t,ic.get())}opts;root;attachment;#e=J(()=>this.root.opts.value.current===this.opts.value.current);get checked(){return W(this.#e)}set checked(e){K(this.#e,e)}#t=J(()=>this.opts.disabled.current||this.root.opts.disabled.current);#n=J(()=>this.root.opts.readonly.current);#r=J(()=>this.root.isChecked(this.opts.value.current));#i=Y(-1);constructor(e,t){this.opts=e,this.root=t,this.attachment=yt(this.opts.ref),this.opts.value.current===this.root.opts.value.current?(this.root.rovingFocusGroup.setCurrentTabStopId(this.opts.id.current),K(this.#i,0)):this.root.opts.value.current||K(this.#i,0),be(()=>{K(this.#i,this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current),!0)}),Re([()=>this.opts.value.current,()=>this.root.opts.value.current],()=>{this.opts.value.current===this.root.opts.value.current&&(this.root.rovingFocusGroup.setCurrentTabStopId(this.opts.id.current),K(this.#i,0))}),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this),this.onfocus=this.onfocus.bind(this)}onclick(e){this.opts.disabled.current||W(this.#n)||this.root.setValue(this.opts.value.current)}onfocus(e){!this.root.hasValue||W(this.#n)||this.root.setValue(this.opts.value.current)}onkeydown(e){if(!W(this.#t)){if(e.key===` `){e.preventDefault(),W(this.#n)||this.root.setValue(this.opts.value.current);return}this.root.rovingFocusGroup.handleKeydown(this.opts.ref.current,e,!0)}}#a=J(()=>({checked:W(this.#r)}));get snippetProps(){return W(this.#a)}set snippetProps(e){K(this.#a,e)}#o=J(()=>({id:this.opts.id.current,disabled:W(this.#t)?!0:void 0,"data-value":this.opts.value.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":st(W(this.#t)),"data-readonly":st(W(this.#n)),"data-state":W(this.#r)?`checked`:`unchecked`,"aria-checked":lt(W(this.#r),!1),[rc.item]:``,type:`button`,role:`radio`,tabindex:W(this.#i),onkeydown:this.onkeydown,onfocus:this.onfocus,onclick:this.onclick,...this.attachment}));get props(){return W(this.#o)}set props(e){K(this.#o,e)}},sc=class e{static create(){return new e(ic.get())}root;#e=J(()=>this.root.opts.name.current!==void 0);get shouldRender(){return W(this.#e)}set shouldRender(e){K(this.#e,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){this.root.rovingFocusGroup.focusCurrentTabStop()}#t=J(()=>({name:this.root.opts.name.current,value:this.root.opts.value.current,required:this.root.opts.required.current,disabled:this.root.opts.disabled.current,onfocus:this.onfocus}));get props(){return W(this.#t)}set props(e){K(this.#t,e)}};function cc(e,t){a(t,!1);let n=sc.create();pe();var r=U(),i=R(r),o=e=>{Zt(e,B(()=>n.props))};k(i,e=>{n.shouldRender&&e(o)}),g(e,r),z()}var lc=new Set([`$$slots`,`$$events`,`$$legacy`,`disabled`,`children`,`child`,`value`,`ref`,`orientation`,`loop`,`name`,`required`,`readonly`,`id`,`onValueChange`]),uc=h(`<div><!></div>`),dc=h(`<!> <!>`,1);function fc(e,t){let n=ne();a(t,!0);let r=I(t,`disabled`,3,!1),i=I(t,`value`,15,``),o=I(t,`ref`,15,null),s=I(t,`orientation`,3,`vertical`),c=I(t,`loop`,3,!0),l=I(t,`name`,3,void 0),f=I(t,`required`,3,!1),p=I(t,`readonly`,3,!1),m=I(t,`id`,19,()=>Ie(n)),h=I(t,`onValueChange`,3,Ye),_=H(t,lc),v=ac.create({orientation:X(()=>s()),disabled:X(()=>r()),loop:X(()=>c()),name:X(()=>l()),required:X(()=>f()),readonly:X(()=>p()),id:X(()=>m()),value:X(()=>i(),e=>{e!==i()&&(i(e),h()?.(e))}),ref:X(()=>o(),e=>o(e))}),y=J(()=>at(_,v.props));var b=dc(),x=R(b),S=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(y)})),g(e,n)},C=e=>{var n=uc();O(n,()=>({...W(y)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(x,e=>{t.child?e(S):e(C,-1)}),cc(L(x,2),{}),g(e,b),z()}var pc=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`value`,`disabled`,`ref`]),mc=h(`<button><!></button>`);function hc(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`disabled`,3,!1),o=I(t,`ref`,15,null),s=H(t,pc),c=oc.create({value:X(()=>t.value),disabled:X(()=>i()??!1),id:X(()=>r()),ref:X(()=>o(),e=>o(e))}),l=J(()=>at(s,c.props));var f=U(),p=R(f),m=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(l),...c.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},h=e=>{var n=mc();O(n,()=>({...W(l)})),u(V(n),()=>t.children??D,()=>c.snippetProps),d(n),g(e,n)};k(p,e=>{t.child?e(m):e(h,-1)}),g(e,f),z()}var gc=ft({component:`switch`,parts:[`root`,`thumb`]}),_c=new We(`Switch.Root`),vc=class e{static create(t){return _c.set(new e(t))}opts;attachment;constructor(e){this.opts=e,this.attachment=yt(e.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this)}#e(){this.opts.checked.current=!this.opts.checked.current}onkeydown(e){!(e.key===`Enter`||e.key===` `)||this.opts.disabled.current||(e.preventDefault(),this.#e())}onclick(e){this.opts.disabled.current||this.#e()}#t=J(()=>({"data-disabled":st(this.opts.disabled.current),"data-state":ree(this.opts.checked.current),"data-required":st(this.opts.required.current)}));get sharedProps(){return W(this.#t)}set sharedProps(e){K(this.#t,e)}#n=J(()=>({checked:this.opts.checked.current}));get snippetProps(){return W(this.#n)}set snippetProps(e){K(this.#n,e)}#r=J(()=>({...this.sharedProps,id:this.opts.id.current,role:`switch`,disabled:nt(this.opts.disabled.current),"aria-checked":lt(this.opts.checked.current,!1),"aria-required":_t(this.opts.required.current),[gc.root]:``,onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return W(this.#r)}set props(e){K(this.#r,e)}},yc=class e{static create(){return new e(_c.get())}root;#e=J(()=>this.root.opts.name.current!==void 0);get shouldRender(){return W(this.#e)}set shouldRender(e){K(this.#e,e)}constructor(e){this.root=e}#t=J(()=>({type:`checkbox`,name:this.root.opts.name.current,value:this.root.opts.value.current,checked:this.root.opts.checked.current,disabled:this.root.opts.disabled.current,required:this.root.opts.required.current}));get props(){return W(this.#t)}set props(e){K(this.#t,e)}},bc=class e{static create(t){return new e(t,_c.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=yt(e.ref)}#e=J(()=>({checked:this.root.opts.checked.current}));get snippetProps(){return W(this.#e)}set snippetProps(e){K(this.#e,e)}#t=J(()=>({...this.root.sharedProps,id:this.opts.id.current,[gc.thumb]:``,...this.attachment}));get props(){return W(this.#t)}set props(e){K(this.#t,e)}};function xc(e,t){a(t,!1);let n=yc.create();pe();var r=U(),i=R(r),o=e=>{Zt(e,B(()=>n.props))};k(i,e=>{n.shouldRender&&e(o)}),g(e,r),z()}var Sc=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`required`,`checked`,`value`,`name`,`type`,`onCheckedChange`]),Cc=h(`<button><!></button>`),wc=h(`<!> <!>`,1);function Tc(e,t){let n=ne();a(t,!0);let r=I(t,`ref`,15,null),i=I(t,`id`,19,()=>Ie(n)),o=I(t,`disabled`,3,!1),s=I(t,`required`,3,!1),c=I(t,`checked`,15,!1),l=I(t,`value`,3,`on`),f=I(t,`name`,3,void 0),p=I(t,`type`,3,`button`),m=I(t,`onCheckedChange`,3,Ye),h=H(t,Sc),_=vc.create({checked:X(()=>c(),e=>{c(e),m()?.(e)}),disabled:X(()=>o()??!1),required:X(()=>s()),value:X(()=>l()),name:X(()=>f()),id:X(()=>i()),ref:X(()=>r(),e=>r(e))}),v=J(()=>at(h,_.props,{type:p()}));var y=wc(),b=R(y),x=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(v),..._.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},S=e=>{var n=Cc();O(n,()=>({...W(v)})),u(V(n),()=>t.children??D,()=>_.snippetProps),d(n),g(e,n)};k(b,e=>{t.child?e(x):e(S,-1)}),xc(L(b,2),{}),g(e,y),z()}var Ec=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`]),Dc=h(`<span><!></span>`);function Oc(e,t){let n=ne();a(t,!0);let r=I(t,`ref`,15,null),i=I(t,`id`,19,()=>Ie(n)),o=H(t,Ec),s=bc.create({id:X(()=>i()),ref:X(()=>r(),e=>r(e))}),c=J(()=>at(o,s.props));var l=U(),f=R(l),p=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(c),...s.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},m=e=>{var n=Dc();O(n,()=>({...W(c)})),u(V(n),()=>t.children??D,()=>s.snippetProps),d(n),g(e,n)};k(f,e=>{t.child?e(p):e(m,-1)}),g(e,l),z()}var kc=ft({component:`toolbar`,parts:[`root`,`item`,`group`,`group-item`,`link`,`button`]}),Ac=new We(`Toolbar.Root`);new We(`Toolbar.Group`);var jc=class e{static create(t){return Ac.set(new e(t))}opts;rovingFocusGroup;attachment;constructor(e){this.opts=e,this.attachment=yt(this.opts.ref),this.rovingFocusGroup=new Je({orientation:this.opts.orientation,loop:this.opts.loop,rootNode:this.opts.ref,candidateAttr:kc.item})}#e=J(()=>({id:this.opts.id.current,role:`toolbar`,"data-orientation":this.opts.orientation.current,[kc.root]:``,...this.attachment}));get props(){return W(this.#e)}set props(e){K(this.#e,e)}},Mc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`id`,`orientation`,`loop`,`child`,`children`]),Nc=h(`<div><!></div>`);function Pc(e,t){let n=ne();a(t,!0);let r=I(t,`ref`,15,null),i=I(t,`id`,19,()=>Ie(n)),o=I(t,`orientation`,3,`horizontal`),s=I(t,`loop`,3,!0),c=H(t,Mc),l=jc.create({id:X(()=>i()),orientation:X(()=>o()),loop:X(()=>s()),ref:X(()=>r(),e=>r(e))}),f=J(()=>at(c,l.props));var p=U(),m=R(p),h=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(f)})),g(e,n)},_=e=>{var n=Nc();O(n,()=>({...W(f)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(m,e=>{t.child?e(h):e(_,-1)}),g(e,p),z()}var Fc=class{#e;#t;#n=null;constructor(e,t){this.#t=e,this.#e=t,this.stop=this.stop.bind(this),this.start=this.start.bind(this),bt(this.stop)}#r(){this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)}stop(){this.#r()}start(...e){this.#r(),this.#n=window.setTimeout(()=>{this.#n=null,this.#t(...e)},this.#e)}},Ic=ft({component:`tooltip`,parts:[`content`,`trigger`]}),Lc=new We(`Tooltip.Provider`),Rc=new We(`Tooltip.Root`),zc=class{#e=Y(N(new Map));get triggers(){return W(this.#e)}set triggers(e){K(this.#e,e,!0)}#t=Y(null);get activeTriggerId(){return W(this.#t)}set activeTriggerId(e){K(this.#t,e,!0)}#n=J(()=>{let e=this.activeTriggerId;return e===null?null:this.triggers.get(e)?.node??null});get activeTriggerNode(){return W(this.#n)}set activeTriggerNode(e){K(this.#n,e)}#r=J(()=>{let e=this.activeTriggerId;return e===null?null:this.triggers.get(e)?.payload??null});get activePayload(){return W(this.#r)}set activePayload(e){K(this.#r,e)}register=e=>{let t=new Map(this.triggers);t.set(e.id,e),this.triggers=t,this.#i()};update=e=>{let t=new Map(this.triggers);t.set(e.id,e),this.triggers=t,this.#i()};unregister=e=>{if(!this.triggers.has(e))return;let t=new Map(this.triggers);t.delete(e),this.triggers=t,this.activeTriggerId===e&&(this.activeTriggerId=null)};setActiveTrigger=e=>{if(e===null){this.activeTriggerId=null;return}if(!this.triggers.has(e)){this.activeTriggerId=null;return}this.activeTriggerId=e};get=e=>this.triggers.get(e);has=e=>this.triggers.has(e);getFirstTriggerId=()=>{let e=this.triggers.entries().next();return e.done?null:e.value[0]};#i=()=>{let e=this.activeTriggerId;e!==null&&(this.triggers.has(e)||(this.activeTriggerId=null))}},Bc=class e{static create(t){return Lc.set(new e(t))}opts;#e=Y(!0);get isOpenDelayed(){return W(this.#e)}set isOpenDelayed(e){K(this.#e,e,!0)}isPointerInTransit=Ke(!1);#t;#n=Y(null);constructor(e){this.opts=e,this.#t=new Fc(()=>{this.isOpenDelayed=!0},this.opts.skipDelayDuration.current),en(()=>Oe(window,`scroll`,e=>{let t=W(this.#n);if(!t)return;let n=t.triggerNode;if(!n)return;let r=e.target;(r instanceof Element||r instanceof Document)&&r.contains(n)&&t.handleClose()}))}#r=()=>{if(this.opts.skipDelayDuration.current===0){this.isOpenDelayed=!0;return}else this.#t.start()};#i=()=>{this.#t.stop()};onOpen=e=>{W(this.#n)&&W(this.#n)!==e&&W(this.#n).handleClose(),this.#i(),this.isOpenDelayed=!1,K(this.#n,e,!0)};onClose=e=>{W(this.#n)===e&&(K(this.#n,null),this.#r())};isTooltipOpen=e=>W(this.#n)===e},Vc=class e{static create(t){return Rc.set(new e(t,Lc.get()))}opts;provider;#e=J(()=>this.opts.delayDuration.current??this.provider.opts.delayDuration.current);get delayDuration(){return W(this.#e)}set delayDuration(e){K(this.#e,e)}#t=J(()=>this.opts.disableHoverableContent.current??this.provider.opts.disableHoverableContent.current);get disableHoverableContent(){return W(this.#t)}set disableHoverableContent(e){K(this.#t,e)}#n=J(()=>this.opts.disableCloseOnTriggerClick.current??this.provider.opts.disableCloseOnTriggerClick.current);get disableCloseOnTriggerClick(){return W(this.#n)}set disableCloseOnTriggerClick(e){K(this.#n,e)}#r=J(()=>this.opts.disabled.current??this.provider.opts.disabled.current);get disabled(){return W(this.#r)}set disabled(e){K(this.#r,e)}#i=J(()=>this.opts.ignoreNonKeyboardFocus.current??this.provider.opts.ignoreNonKeyboardFocus.current);get ignoreNonKeyboardFocus(){return W(this.#i)}set ignoreNonKeyboardFocus(e){K(this.#i,e)}registry;tether;#a=Y(null);get contentNode(){return W(this.#a)}set contentNode(e){K(this.#a,e,!0)}contentPresence;#o=Y(!1);#s;#c=J(()=>this.opts.open.current?W(this.#o)?`delayed-open`:`instant-open`:`closed`);get stateAttr(){return W(this.#c)}set stateAttr(e){K(this.#c,e)}constructor(e,t){this.opts=e,this.provider=t,this.tether=e.tether.current?.state??null,this.registry=this.tether?.registry??new zc,this.#s=new Fc(()=>{K(this.#o,!0),this.opts.open.current=!0},this.delayDuration??0),this.tether&&(this.tether.root=this,en(()=>()=>{this.tether?.root===this&&(this.tether.root=null)})),this.contentPresence=new He({open:this.opts.open,ref:X(()=>this.contentNode),onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),Re(()=>this.delayDuration,()=>{this.delayDuration!==void 0&&(this.#s=new Fc(()=>{K(this.#o,!0),this.opts.open.current=!0},this.delayDuration))}),Re(()=>this.opts.open.current,e=>{e?(this.ensureActiveTrigger(),this.provider.onOpen(this)):this.provider.onClose(this)},{lazy:!0}),Re(()=>this.opts.triggerId.current,e=>{e!==this.registry.activeTriggerId&&this.registry.setActiveTrigger(e)}),Re(()=>this.registry.activeTriggerId,e=>{this.opts.triggerId.current!==e&&(this.opts.triggerId.current=e)})}handleOpen=()=>{this.#s.stop(),K(this.#o,!1),this.ensureActiveTrigger(),this.opts.open.current=!0};handleClose=()=>{this.#s.stop(),this.opts.open.current=!1};#l=()=>{this.#s.stop();let e=!this.provider.isOpenDelayed,t=this.delayDuration??0;e||t===0?(K(this.#o,!1),this.opts.open.current=!0):this.#s.start()};onTriggerEnter=e=>{this.setActiveTrigger(e),this.#l()};onTriggerLeave=()=>{this.disableHoverableContent?this.handleClose():this.#s.stop()};ensureActiveTrigger=()=>{if(this.registry.activeTriggerId!==null&&this.registry.has(this.registry.activeTriggerId))return;if(this.opts.triggerId.current!==null&&this.registry.has(this.opts.triggerId.current)){this.registry.setActiveTrigger(this.opts.triggerId.current);return}let e=this.registry.getFirstTriggerId();this.registry.setActiveTrigger(e)};setActiveTrigger=e=>{this.registry.setActiveTrigger(e)};registerTrigger=e=>{this.registry.register(e),e.disabled&&this.registry.activeTriggerId===e.id&&this.opts.open.current&&this.handleClose()};updateTrigger=e=>{this.registry.update(e),e.disabled&&this.registry.activeTriggerId===e.id&&this.opts.open.current&&this.handleClose()};unregisterTrigger=e=>{let t=this.registry.activeTriggerId===e;this.registry.unregister(e),t&&this.opts.open.current&&this.handleClose()};isActiveTrigger=e=>this.registry.activeTriggerId===e;get triggerNode(){return this.registry.activeTriggerNode}get activePayload(){return this.registry.activePayload}get activeTriggerId(){return this.registry.activeTriggerId}},Hc=class e{static create(t){return t.tether.current?new e(t,null,t.tether.current.state):new e(t,Rc.get(),null)}opts;root;tether;attachment;#e=Ke(!1);#t=Y(!1);domContext;#n=null;#r=!1;#i=null;constructor(e,t,n){this.opts=e,this.root=t,this.tether=n,this.domContext=new xt(e.ref),this.attachment=yt(this.opts.ref,e=>this.#s(e)),Re(()=>this.opts.id.current,()=>{this.#s(this.opts.ref.current)}),Re(()=>this.opts.payload.current,()=>{this.#s(this.opts.ref.current)}),Re(()=>this.opts.disabled.current,()=>{this.#s(this.opts.ref.current)}),en(()=>(this.#r=!0,this.#s(this.opts.ref.current),()=>{let e=this.#a(),t=this.#i;t&&(this.tether?this.tether.registry.unregister(t):e?.unregisterTrigger(t)),this.#i=null,this.#r=!1}))}#a=()=>this.tether?.root??this.root;#o=()=>{let e=this.#a();return this.opts.disabled.current||!!e?.disabled};#s=e=>{if(!this.#r)return;let t=this.opts.id.current,n=this.opts.payload.current,r=this.opts.disabled.current;if(this.#i&&this.#i!==t){let e=this.#a();this.tether?this.tether.registry.unregister(this.#i):e?.unregisterTrigger(this.#i)}let i={id:t,node:e,payload:n,disabled:r},a=this.#a();this.tether?(this.tether.registry.has(t)?this.tether.registry.update(i):this.tether.registry.register(i),r&&this.tether.registry.activeTriggerId===t&&a?.opts.open.current&&a.handleClose()):a?.registry.has(t)?a.updateTrigger(i):a?.registerTrigger(i),this.#i=t};#c=()=>{this.#n!==null&&(clearTimeout(this.#n),this.#n=null)};handlePointerUp=()=>{this.#e.current=!1};#l=()=>{this.#o()||(this.#e.current=!1)};#u=()=>{this.#o()||(this.#e.current=!0,this.domContext.getDocument().addEventListener(`pointerup`,()=>{this.handlePointerUp()},{once:!0}))};#d=e=>{let t=this.#a();if(t){if(this.#o()){t.opts.open.current&&t.handleClose();return}if(e.pointerType!==`touch`){if(t.provider.isPointerInTransit.current){this.#c(),this.#n=window.setTimeout(()=>{t.provider.isPointerInTransit.current&&(t.provider.isPointerInTransit.current=!1,t.onTriggerEnter(this.opts.id.current),K(this.#t,!0))},250);return}t.onTriggerEnter(this.opts.id.current),K(this.#t,!0)}}};#f=e=>{let t=this.#a();if(t){if(this.#o()){t.opts.open.current&&t.handleClose();return}e.pointerType!==`touch`&&(W(this.#t)||(this.#c(),t.provider.isPointerInTransit.current=!1,t.onTriggerEnter(this.opts.id.current),K(this.#t,!0)))}};#p=e=>{let t=this.#a();if(!t||this.#o())return;if(this.#c(),!t.isActiveTrigger(this.opts.id.current)){K(this.#t,!1);return}let n=e.relatedTarget;if(Xe(n)){for(let e of t.registry.triggers.values())if(e.node===n){if(t.provider.opts.skipDelayDuration.current>0){K(this.#t,!1);return}t.handleClose(),K(this.#t,!1);return}}t.onTriggerLeave(),K(this.#t,!1)};#m=e=>{let t=this.#a();if(t&&!this.#e.current){if(this.#o()){t.opts.open.current&&t.handleClose();return}t.ignoreNonKeyboardFocus&&!Ve(e.currentTarget)||(t.setActiveTrigger(this.opts.id.current),t.handleOpen())}};#h=()=>{let e=this.#a();!e||this.#o()||e.handleClose()};#g=()=>{let e=this.#a();!e||e.disableCloseOnTriggerClick||this.#o()||e.handleClose()};#_=J(()=>{let e=this.#a(),t=!!(e?.opts.open.current&&e.isActiveTrigger(this.opts.id.current)),n=this.#o();return{id:this.opts.id.current,"aria-describedby":t?e?.contentNode?.id:void 0,"data-state":t?e?.stateAttr:`closed`,"data-disabled":st(n),"data-delay-duration":`${e?.delayDuration??0}`,[Ic.trigger]:``,tabindex:n?void 0:this.opts.tabindex.current,disabled:this.opts.disabled.current,onpointerup:this.#l,onpointerdown:this.#u,onpointerenter:this.#d,onpointermove:this.#f,onpointerleave:this.#p,onfocus:this.#m,onblur:this.#h,onclick:this.#g,...this.attachment}});get props(){return W(this.#_)}set props(e){K(this.#_,e)}},Uc=class e{static create(t){return new e(t,Rc.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=yt(this.opts.ref,e=>this.root.contentNode=e),new gs({triggerNode:()=>this.root.triggerNode,contentNode:()=>this.root.contentNode,enabled:()=>this.root.opts.open.current&&!this.root.disableHoverableContent,transitIntentTimeout:180,ignoredTargets:()=>{if(this.root.provider.opts.skipDelayDuration.current===0)return[];let e=[],t=this.root.triggerNode;for(let n of this.root.registry.triggers.values())n.node&&n.node!==t&&e.push(n.node);return e},onPointerExit:()=>{this.root.provider.isTooltipOpen(this.root)&&this.root.handleClose()}})}onInteractOutside=e=>{if(Xe(e.target)&&this.root.triggerNode?.contains(e.target)&&this.root.disableCloseOnTriggerClick){e.preventDefault();return}this.opts.onInteractOutside.current(e),!e.defaultPrevented&&this.root.handleClose()};onEscapeKeydown=e=>{this.opts.onEscapeKeydown.current?.(e),!e.defaultPrevented&&this.root.handleClose()};onOpenAutoFocus=e=>{e.preventDefault()};onCloseAutoFocus=e=>{e.preventDefault()};get shouldRender(){return this.root.contentPresence.shouldRender}#e=J(()=>({open:this.root.opts.open.current}));get snippetProps(){return W(this.#e)}set snippetProps(e){K(this.#e,e)}#t=J(()=>({id:this.opts.id.current,"data-state":this.root.stateAttr,"data-disabled":st(this.root.disabled),...Qe(this.root.contentPresence.transitionStatus),style:{outline:`none`},[Ic.content]:``,...this.attachment}));get props(){return W(this.#t)}set props(e){K(this.#t,e)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown,onOpenAutoFocus:this.onOpenAutoFocus,onCloseAutoFocus:this.onCloseAutoFocus}};function Wc(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`triggerId`,15,null),i=I(t,`onOpenChange`,3,Ye),o=I(t,`onOpenChangeComplete`,3,Ye),s=Vc.create({open:X(()=>n(),e=>{n(e),i()(e)}),triggerId:X(()=>r(),e=>{r(e)}),delayDuration:X(()=>t.delayDuration),disableCloseOnTriggerClick:X(()=>t.disableCloseOnTriggerClick),disableHoverableContent:X(()=>t.disableHoverableContent),ignoreNonKeyboardFocus:X(()=>t.ignoreNonKeyboardFocus),disabled:X(()=>t.disabled),onOpenChangeComplete:X(()=>o()),tether:X(()=>t.tether)});rn(e,{tooltip:!0,children:(e,n)=>{var r=U();u(R(r),()=>t.children??D,()=>({open:s.opts.open.current,triggerId:s.activeTriggerId,payload:s.activePayload})),g(e,r)},$$slots:{default:!0}}),z()}var Gc=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`side`,`sideOffset`,`align`,`avoidCollisions`,`arrowPadding`,`sticky`,`strategy`,`hideWhenDetached`,`customAnchor`,`collisionPadding`,`onInteractOutside`,`onEscapeKeydown`,`forceMount`,`style`]),Kc=h(`<div><div><!></div></div>`);function qc(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`ref`,15,null),o=I(t,`side`,3,`top`),s=I(t,`sideOffset`,3,0),c=I(t,`align`,3,`center`),l=I(t,`avoidCollisions`,3,!0),f=I(t,`arrowPadding`,3,0),p=I(t,`sticky`,3,`partial`),m=I(t,`hideWhenDetached`,3,!1),h=I(t,`collisionPadding`,3,0),_=I(t,`onInteractOutside`,3,Ye),v=I(t,`onEscapeKeydown`,3,Ye),y=I(t,`forceMount`,3,!1),b=H(t,Gc),x=Uc.create({id:X(()=>r()),ref:X(()=>i(),e=>i(e)),onInteractOutside:X(()=>_()),onEscapeKeydown:X(()=>v())}),S=J(()=>({side:o(),sideOffset:s(),align:c(),avoidCollisions:l(),arrowPadding:f(),sticky:p(),hideWhenDetached:m(),collisionPadding:h(),strategy:t.strategy,customAnchor:t.customAnchor??x.root.triggerNode})),C=J(()=>at(b,W(S),x.props));var w=U(),T=R(w),E=e=>{{let n=(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=J(()=>at(i(),{style:{pointerEvents:x.root.disableHoverableContent?`none`:void 0}})),o=J(()=>at(r(),{style:on(`tooltip`)},{style:t.style}));var s=U(),c=R(s),l=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(o),wrapperProps:W(a),...x.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},f=e=>{var n=Kc();O(n,()=>({...W(a)}));var r=V(n);O(r,()=>({...W(o)})),u(V(r),()=>t.children??D),d(r),d(n),g(e,n)};k(c,e=>{t.child?e(l):e(f,-1)}),g(e,s)},i=J(()=>x.root.disableHoverableContent?`none`:`auto`);cn(e,B(()=>W(C),()=>x.popperProps,{get enabled(){return x.root.opts.open.current},get id(){return r()},trapFocus:!1,loop:!1,preventScroll:!1,forceMount:!0,get ref(){return x.opts.ref},tooltip:!0,get shouldRender(){return x.shouldRender},get contentPointerEvents(){return W(i)},popper:n,$$slots:{popper:!0}}))}},ee=e=>{{let n=(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=J(()=>at(i(),{style:{pointerEvents:x.root.disableHoverableContent?`none`:void 0}})),o=J(()=>at(r(),{style:on(`tooltip`)},{style:t.style}));var s=U(),c=R(s),l=e=>{var n=U(),r=R(n);{let e=J(()=>({props:W(o),wrapperProps:W(a),...x.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},f=e=>{var n=Kc();O(n,()=>({...W(a)}));var r=V(n);O(r,()=>({...W(o)})),u(V(r),()=>t.children??D),d(r),d(n),g(e,n)};k(c,e=>{t.child?e(l):e(f,-1)}),g(e,s)},i=J(()=>x.root.disableHoverableContent?`none`:`auto`);an(e,B(()=>W(C),()=>x.popperProps,{get open(){return x.root.opts.open.current},get id(){return r()},trapFocus:!1,loop:!1,preventScroll:!1,forceMount:!1,get ref(){return x.opts.ref},tooltip:!0,get shouldRender(){return x.shouldRender},get contentPointerEvents(){return W(i)},popper:n,$$slots:{popper:!0}}))}};k(T,e=>{y()?e(E):y()||e(ee,1)}),g(e,w),z()}var Jc=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`disabled`,`payload`,`tether`,`type`,`tabindex`,`ref`]),Yc=h(`<button><!></button>`);function Xc(e,t){let n=ne();a(t,!0);let r=I(t,`id`,19,()=>Ie(n)),i=I(t,`disabled`,3,!1),o=I(t,`type`,3,`button`),s=I(t,`tabindex`,3,0),c=I(t,`ref`,15,null),l=H(t,Jc),f=Hc.create({id:X(()=>r()),disabled:X(()=>i()??!1),tabindex:X(()=>s()??0),payload:X(()=>t.payload),tether:X(()=>t.tether),ref:X(()=>c(),e=>c(e))}),p=J(()=>at(l,f.props,{type:o()}));var m=U(),h=R(m),_=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(p)})),g(e,n)},v=e=>{var n=Yc();O(n,()=>({...W(p)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(h,e=>{t.child?e(_):e(v,-1)}),g(e,m),z()}var Zc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function Qc(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,Zc);fs(e,B(()=>r,{get ref(){return n()},set ref(e){n(e)}})),z()}function $c(e,t){a(t,!0);let n=I(t,`delayDuration`,3,700),r=I(t,`disableCloseOnTriggerClick`,3,!1),i=I(t,`disableHoverableContent`,3,!1),o=I(t,`disabled`,3,!1),s=I(t,`ignoreNonKeyboardFocus`,3,!1),c=I(t,`skipDelayDuration`,3,300);Bc.create({delayDuration:X(()=>n()),disableCloseOnTriggerClick:X(()=>r()),disableHoverableContent:X(()=>i()),disabled:X(()=>o()),ignoreNonKeyboardFocus:X(()=>s()),skipDelayDuration:X(()=>c())});var l=U();u(R(l),()=>t.children??D),g(e,l),z()}var el=`application/x-nerve-panel-view`,tl=N({});function nl(e){tl.viewId=e,tl.hoverDock=void 0,tl.hoverIndex=void 0}function rl(e,t){tl.hoverDock=e,tl.hoverIndex=t}function il(e){tl.hoverDock===e&&(tl.hoverDock=void 0,tl.hoverIndex=void 0)}function al(){tl.viewId=void 0,tl.hoverDock=void 0,tl.hoverIndex=void 0}var ol=h(`<button type="button" role="tab"><!></button>`),sl=h(`<span class="dock-tab-drop-end svelte-l43sst" aria-hidden="true"></span>`),cl=h(`<div role="presentation"><div class="dock-tabs svelte-l43sst" role="tablist"><!> <!></div> <span class="sr-only" aria-live="polite"> </span></div>`);function ll(e,t){a(t,!0);let n=I(t,`registry`,19,()=>t.views),i=I(t,`draggable`,3,!0),o=Y(null),c=Y(``),l={left:qo,right:Yo,bottom:Go},u=J(()=>!!(i()&&tl.viewId)),f=J(()=>tl.hoverDock===t.dock?tl.hoverIndex:void 0);function p(e){if(!W(o))return t.views.length;let n=[...W(o).querySelectorAll(`[data-view-id]`)];for(let[t,r]of n.entries()){let n=r.getBoundingClientRect();if(e.clientX<n.left+n.width/2)return t}return n.length}function m(e,r){t.onMove?.(e,r);let i=n().find(t=>t.id===e)?.title??`Panel`,a=Fo[r.dock].toLowerCase();K(c,r.dock===t.dock?`${i} moved to ${a}, position ${r.index+1}`:`${i} moved to ${a}`,!0)}function h(e){W(u)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),rl(t.dock,p(e)))}function v(e){if(!W(u))return;e.preventDefault();let n=tl.viewId??e.dataTransfer?.getData(`application/x-nerve-panel-view`),r=p(e);al(),n&&m(n,{dock:t.dock,index:r})}function y(e,n){let r=Po.map(r=>({label:`Move to ${Fo[r]}`,icon:l[r],disabled:r===t.dock||!t.onMove,onSelect:()=>m(e.id,{dock:r,index:r===t.dock?n:2**53-1})}));return r.push({type:`separator`},{label:`Move Left`,icon:Vo,disabled:n===0||!t.onMove,onSelect:()=>m(e.id,{dock:t.dock,index:n-1})},{label:`Move Right`,icon:Uo,disabled:n>=t.views.length-1||!t.onMove,onSelect:()=>m(e.id,{dock:t.dock,index:n+1})}),e.hideable!==!1&&t.onHide&&r.push({type:`separator`},{label:`Hide "${e.title}"`,icon:zo,onSelect:()=>t.onHide(e.id)}),r}function b(e,n){let r=y(e,n);return t.buildMenuItems?.({view:e,dock:t.dock,index:n,views:t.views,defaultItems:r})??r}let x={conversations:`conversations-tab`,files:`files-panel`,tasks:`tasks-panel`,notes:`scratch-notes-panel`,git:`git-workflow`,"pull-requests":`pull-request-workflow`,context:`context-panel`};var S=cl();let w;var T=V(S),E=V(T);_(E,19,()=>t.views,e=>e.id,(e,n,a)=>{let o=J(()=>W(n).icon);{let c=J(()=>b(W(n),W(a)));un(e,{get items(){return W(c)},triggerClass:`contents`,children:(e,c)=>{var l=ol();let u;C(V(l),()=>W(o),(e,t)=>{t(e,{size:14,strokeWidth:2.1,"aria-hidden":`true`})}),d(l),F(e=>{u=s(l,1,`dock-tab svelte-l43sst`,null,u,{active:W(n).id===t.activeViewId,dragging:tl.viewId===W(n).id,"drop-before":W(f)===W(a)}),q(l,`data-view-id`,W(n).id),q(l,`data-tour-id`,x[W(n).id]),q(l,`aria-selected`,W(n).id===t.activeViewId),q(l,`aria-label`,W(n).title),q(l,`title`,W(n).title),q(l,`draggable`,e)},[()=>i()&&!!t.onMove]),ue(`dragstart`,l,e=>{t.onMove&&(nl(W(n).id),e.dataTransfer?.setData(el,W(n).id),e.dataTransfer?.setData(`text/plain`,W(n).title),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`))}),ue(`dragend`,l,function(...e){al?.apply(this,e)}),r(`click`,l,()=>t.onSelect?.(W(n).id)),g(e,l)},$$slots:{default:!0}})}});var D=L(E,2),O=e=>{g(e,sl())};k(D,e=>{W(u)&&W(f)!==void 0&&W(f)>=t.views.length&&e(O)}),d(T);var ee=L(T,2),te=V(ee,!0);d(ee),d(S),fe(S,e=>K(o,e),()=>W(o)),F(()=>{w=s(S,1,`dock-tab-strip svelte-l43sst`,null,w,{"drag-active":W(u)}),q(S,`data-tour-id`,t.dock===`left`?`panel-layout`:void 0),q(T,`aria-label`,`${Fo[t.dock]} views`),A(te,W(c))}),ue(`dragover`,S,h),ue(`dragleave`,S,()=>il(t.dock)),ue(`drop`,S,v),g(e,S),z()}T([`click`]);var ul=h(`<section class="dock-panel"><!> <div class="dock-body" role="presentation"><!> <!></div></section>`);function dl(e,t){a(t,!0);let n=I(t,`registry`,19,()=>t.views),r=I(t,`draggable`,3,!0),i=J(()=>!!(r()&&tl.viewId&&t.onMove));function o(e){W(i)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),rl(t.dock,t.views.length))}function s(e){if(!W(i))return;e.preventDefault();let n=tl.viewId??e.dataTransfer?.getData(`application/x-nerve-panel-view`);al(),n&&t.onMove?.(n,{dock:t.dock,index:t.views.length})}var c=ul(),l=V(c);ll(l,{get dock(){return t.dock},get views(){return t.views},get registry(){return n()},get activeViewId(){return t.activeViewId},get draggable(){return r()},get buildMenuItems(){return t.buildMenuItems},get onSelect(){return t.onSelect},get onMove(){return t.onMove},get onHide(){return t.onHide}});var f=L(l,2),p=V(f),m=e=>{var n=U();u(R(n),()=>t.panelView,()=>t.activeViewId),g(e,n)};k(p,e=>{t.activeViewId&&e(m)});var h=L(p,2),_=e=>{{let n=J(()=>tl.hoverDock===t.dock);Lo(e,{get dock(){return t.dock},get hovered(){return W(n)}})}};k(h,e=>{W(i)&&e(_)}),d(f),d(c),F(()=>{q(c,`data-dock`,t.dock),q(c,`aria-label`,Fo[t.dock])}),ue(`dragover`,f,o),ue(`dragleave`,f,()=>il(t.dock)),ue(`drop`,f,s),g(e,c),z()}var fl=new Set([`$$slots`,`$$events`,`$$legacy`]);function pl(e,t){let n=H(t,fl),r=[[`path`,{d:`m15 18-6-6 6-6`}]];P(e,B({name:`chevron-left`},()=>n,{get iconNode(){return r}}))}var ml=new Set([`$$slots`,`$$events`,`$$legacy`]);function hl(e,t){let n=H(t,ml),r=[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]];P(e,B({name:`plus`},()=>n,{get iconNode(){return r}}))}var gl=new Set([`$$slots`,`$$events`,`$$legacy`]);function _l(e,t){let n=H(t,gl),r=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]];P(e,B({name:`refresh-cw`},()=>n,{get iconNode(){return r}}))}var vl=new Set([`$$slots`,`$$events`,`$$legacy`]);function yl(e,t){let n=H(t,vl),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];P(e,B({name:`x`},()=>n,{get iconNode(){return r}}))}var bl=h(`<button type="button" class="tab-file-toggle svelte-cucb0v"><!></button>`),xl=h(`<span class="tab-status svelte-cucb0v" aria-hidden="true"></span>`),Sl=h(`<span class="tab-kind-icon flex-none svelte-cucb0v"><!></span>`),Cl=h(`<span class="draft-dot svelte-cucb0v" title="Draft" aria-label="Draft"></span>`),wl=h(`<div class="editor-tab group relative inline-grid h-8 w-full grid-cols-[auto_minmax(0,1fr)_auto] border-r border-r-border/62 bg-card text-muted-foreground data-[active]:bg-background data-[active]:text-foreground data-[dragging]:opacity-55 not-data-[active]:hover:bg-accent/60 not-data-[active]:hover:text-foreground svelte-cucb0v" role="presentation"><div class="inline-grid h-8 w-5.5 place-items-center pl-1.5"><!></div> <button type="button" class="inline-flex h-8 min-w-0 cursor-pointer items-center gap-1.5 border-0 bg-transparent px-1 text-left text-xs text-inherit focus-visible:z-1 focus-visible:-outline-offset-1 focus-visible:outline-1 focus-visible:outline-ring" role="tab"><!> <span class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"> </span> <!></button> <button type="button" class="inline-grid w-5.5 cursor-pointer place-items-center rounded-none border-0 bg-transparent text-inherit opacity-62 hover:bg-destructive/12 hover:text-destructive hover:opacity-100 focus-visible:z-1 focus-visible:-outline-offset-1 focus-visible:outline-1 focus-visible:outline-ring" title="Close tab"><!></button></div>`),Dte=h(`<div class="flex items-center border-l border-l-border/62 px-1"><!></div>`),Ote=h(`<nav class="flex min-h-8 min-w-0 border-b border-border bg-card" aria-label="Open editor tabs"><!> <div class="tab-scroller flex min-w-0 flex-1 overflow-x-auto overflow-y-hidden svelte-cucb0v"></div> <!> <!> <span class="sr-only" aria-live="polite"> </span></nav>`);function Tl(e,t){a(t,!0);let n=I(t,`tabs`,19,()=>[]),i=I(t,`newLabel`,3,`New chat`),o=Y(null),s=Y(!1),c=Y(!1),l=Y(void 0),u=Y(void 0),f=Y(``);function p(){W(o)&&(K(s,W(o).scrollLeft>1),K(c,W(o).scrollLeft+W(o).clientWidth<W(o).scrollWidth-1))}function m(e){W(o)?.scrollBy({left:e*Math.max(160,W(o).clientWidth*.75),behavior:`smooth`})}function h(e,n){t.onReorder&&(K(l,b(n),!0),e.dataTransfer?.setData(`text/plain`,W(l)),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`))}function v(e,r){e.preventDefault();let i=W(l)??e.dataTransfer?.getData(`text/plain`),a=n().find(e=>b(e)===i);a&&(t.onReorder?.(y(a),r),K(f,`${a.label} moved to position ${r+1}`)),K(l,void 0),K(u,void 0)}be(()=>{if(!W(o))return;let e=new ResizeObserver(p);return e.observe(W(o)),p(),()=>e.disconnect()}),be(()=>{let e=n().find(e=>e.active);requestAnimationFrame(()=>{p(),e&&W(o)&&[...W(o).querySelectorAll(`[data-tab-key]`)].find(t=>t.dataset.tabKey===b(e))?.scrollIntoView({block:`nearest`,inline:`nearest`})})});function y(e){return{kind:e.kind,id:e.id}}function b(e){return e.key??`${e.kind}:${e.id}`}function x(e,r){let i=y(e),a=r>0,o=r>=0&&r<n().length-1,s=[{label:`Refresh`,icon:_l,shortcut:t.refreshShortcut,disabled:!t.onRefresh,onSelect:()=>t.onRefresh?.(i)}];return t.onReorder&&s.push({type:`separator`},{label:`Move Left`,icon:Vo,disabled:!a,onSelect:()=>t.onReorder(i,r-1)},{label:`Move Right`,icon:Uo,disabled:!o,onSelect:()=>t.onReorder(i,r+1)}),s.push({type:`separator`},{label:`Close Pane`,icon:yl,shortcut:t.closeShortcut,disabled:e.closeable===!1||!t.onClose,onSelect:()=>t.onClose?.(i)},{label:`Close Other Panes`,icon:yl,shortcut:t.closeOthersShortcut,disabled:n().length<=1||!t.onCloseOther,onSelect:()=>t.onCloseOther?.(i)},{label:`Close Panes on Right`,icon:yl,disabled:!o||!t.onCloseRight,onSelect:()=>t.onCloseRight?.(i)},{label:`Close Panes on Left`,icon:yl,disabled:!a||!t.onCloseLeft,onSelect:()=>t.onCloseLeft?.(i)}),s}function S(e,r){return t.buildMenuItems?.({tab:e,tabs:n(),index:r})??x(e,r)}var w=Ote(),T=V(w),E=e=>{{let t=J(()=>!W(s));G(e,{variant:`ghost`,size:`icon-sm`,class:`rounded-none border-r-border/62`,ariaLabel:`Scroll tabs left`,get disabled(){return W(t)},onclick:()=>m(-1),children:(e,t)=>{pl(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}})}};k(T,e=>{(W(s)||W(c))&&e(E)});var D=L(T,2);_(D,23,n,e=>b(e),(e,n,i)=>{let a=J(()=>W(n).icon),o=J(()=>W(n).selectIcon),s=J(()=>W(n).toggle?.icon);{let c=J(()=>S(W(n),W(i))),f=J(()=>`h-8 min-w-0 flex-none ${W(n).wide?`w-54 basis-54`:`w-50 basis-50`}`);un(e,{get items(){return W(c)},get triggerClass(){return W(f)},children:(e,c)=>{var f=wl(),p=V(f),m=V(p),_=e=>{var t=bl();C(V(t),()=>W(s),(e,t)=>{t(e,{size:12,strokeWidth:2.2,"aria-hidden":`true`})}),d(t),F(()=>{q(t,`aria-label`,W(n).toggle.label),q(t,`title`,W(n).toggle.title??W(n).toggle.label),t.disabled=W(n).toggle.disabled}),r(`click`,t,e=>{e.stopPropagation(),W(n).toggle?.onClick?.(e)}),g(e,t)},x=e=>{ht(e,{get tone(){return W(n).status.tone},get pulse(){return W(n).status.pulse},get label(){return W(n).status.label}})},S=e=>{var t=xl();F(()=>q(t,`title`,W(n).status?.label)),g(e,t)},w=e=>{var t=Sl();C(V(t),()=>W(a),(e,t)=>{t(e,{size:12,strokeWidth:2.2,"aria-hidden":`true`})}),d(t),g(e,t)};k(m,e=>{W(n).toggle&&W(s)?e(_):W(n).status?.tone?e(x,1):W(n).status||W(n).running||W(n).error?e(S,2):W(a)&&e(w,3)}),d(p);var T=L(p,2),E=V(T),D=e=>{var t=Sl();C(V(t),()=>W(o),(e,t)=>{t(e,{size:12,strokeWidth:2.2,"aria-hidden":`true`})}),d(t),g(e,t)};k(E,e=>{W(o)&&e(D)});var O=L(E,2),ee=V(O,!0);d(O);var te=L(O,2),ne=e=>{g(e,Cl())};k(te,e=>{W(n).draft&&e(ne)}),d(T);var j=L(T,2);yl(V(j),{size:13,strokeWidth:2.2}),d(j),d(f),F((e,t,r,i)=>{q(f,`data-active`,W(n).active?``:void 0),q(f,`data-running`,W(n).running?``:void 0),q(f,`data-errored`,W(n).error?``:void 0),q(f,`data-dragging`,e),q(f,`data-drop-target`,t),q(f,`data-tab-key`,r),q(f,`draggable`,i),q(T,`aria-selected`,W(n).active),q(T,`title`,W(n).title??W(n).label),A(ee,W(n).label),q(j,`aria-label`,`Close ${W(n).label}`),j.disabled=W(n).closeable===!1},[()=>W(l)===b(W(n))?``:void 0,()=>W(u)===W(i)&&W(l)!==b(W(n))?``:void 0,()=>b(W(n)),()=>!!t.onReorder]),ue(`dragstart`,f,e=>h(e,W(n))),ue(`dragover`,f,e=>{t.onReorder&&(e.preventDefault(),K(u,W(i),!0))}),ue(`drop`,f,e=>v(e,W(i))),ue(`dragend`,f,()=>{K(l,void 0),K(u,void 0)}),r(`click`,T,()=>t.onSelect?.(y(W(n)))),r(`click`,j,()=>t.onClose?.(y(W(n)))),g(e,f)},$$slots:{default:!0}})}}),d(D),fe(D,e=>K(o,e),()=>W(o));var O=L(D,2),ee=e=>{{let t=J(()=>!W(c));G(e,{variant:`ghost`,size:`icon-sm`,class:`rounded-none border-l-border/62`,ariaLabel:`Scroll tabs right`,get disabled(){return W(t)},onclick:()=>m(1),children:(e,t)=>{ut(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}})}};k(O,e=>{(W(s)||W(c))&&e(ee)});var te=L(O,2),ne=e=>{var n=Dte(),r=V(n);{let e=J(()=>t.newShortcut?`${i()} (${t.newShortcut})`:i());G(r,{variant:`ghost`,size:`icon-sm`,get ariaLabel(){return i()},get"aria-keyshortcuts"(){return t.newShortcutAria},"data-tour-id":`tab-new-conversation`,get title(){return W(e)},get onclick(){return t.onNew},children:(e,t)=>{hl(e,{size:13,strokeWidth:2.25})},$$slots:{default:!0}})}d(n),g(e,n)};k(te,e=>{t.onNew&&e(ne)});var j=L(te,2),M=V(j,!0);d(j),d(w),F(()=>A(M,W(f))),ue(`scroll`,D,p),g(e,w),z()}T([`click`]);var kte=h(`<div class="grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)]"><!> <div class="grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)]"><!></div></div>`);function Ate(e,t){a(t,!0);let n=I(t,`tabs`,19,()=>[]);var r=kte(),i=V(r),o=e=>{var n=U();u(R(n),()=>t.tabStrip),g(e,n)},s=e=>{Tl(e,{get tabs(){return n()},get buildMenuItems(){return t.buildMenuItems},get onSelect(){return t.onSelect},get onClose(){return t.onClose},get onRefresh(){return t.onRefresh},get onCloseOther(){return t.onCloseOther},get onCloseRight(){return t.onCloseRight},get onCloseLeft(){return t.onCloseLeft},get onNew(){return t.onNew},get onReorder(){return t.onReorder}})};k(i,e=>{t.tabStrip?e(o):e(s,-1)});var c=L(i,2),l=V(c),f=e=>{var n=U();u(R(n),()=>t.content),g(e,n)},p=e=>{var n=U();u(R(n),()=>t.empty),g(e,n)};k(l,e=>{t.contentVisible??n().length>0?e(f):t.empty&&e(p,1)}),d(c),d(r),g(e,r),z()}var El={left:{min:14,max:34},right:{min:16,max:40},bottom:{min:12,max:70}},Dl={left:19,right:24,bottom:30};function Ol(e,t){let n=El[e];return typeof t!=`number`||!Number.isFinite(t)?Dl[e]:Math.min(n.max,Math.max(n.min,t))}function jte(e){return Po.includes(e)}function kl(e){return{version:1,docks:{left:{...e.docks.left,views:[...e.docks.left.views]},right:{...e.docks.right,views:[...e.docks.right.views]},bottom:{...e.docks.bottom,views:[...e.docks.bottom.views]}},hidden:[...e.hidden]}}function Mte(e,t,n){let r=t.views.filter(e=>!n.includes(e)),i=t.activeViewId&&r.includes(t.activeViewId)?t.activeViewId:r[0];return{views:t.views,activeViewId:i,size:Ol(e,t.size),collapsed:r.length===0?!0:t.collapsed}}function Al(e){let t=kl(e);for(let e of Po)t.docks[e]=Mte(e,t.docks[e],t.hidden);return t}function Nte(e,t={}){let n={};for(let r of Po){let i=e.filter(e=>e.defaultDock===r).sort((e,t)=>e.defaultOrder-t.defaultOrder).map(e=>e.id);n[r]={views:i,activeViewId:i[0],size:Ol(r,t.sizes?.[r]??Dl[r]),collapsed:t.collapsed?.includes(r)??!1}}return Al({version:1,docks:n,hidden:[]})}function jl(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Ml(e,t,n={}){let r=Nte(t,n);if(!e||typeof e!=`object`||Array.isArray(e))return r;let i=e,a=i.docks&&typeof i.docks==`object`?i.docks:void 0;if(!a)return r;let o=new Set(t.map(e=>e.id)),s=new Set,c={};for(let e of Po){let t=a[e],n=t&&typeof t==`object`?t:{};c[e]={views:jl(n.views).filter(e=>!o.has(e)||s.has(e)?!1:(s.add(e),!0)),activeViewId:typeof n.activeViewId==`string`?n.activeViewId:void 0,size:Ol(e,n.size??r.docks[e].size),collapsed:n.collapsed===!0}}for(let e of[...t].sort((e,t)=>e.defaultOrder-t.defaultOrder))s.has(e.id)||(s.add(e.id),c[e.defaultDock].views.push(e.id));let l=jl(i.hidden).filter(e=>o.has(e));return Al({version:1,docks:c,hidden:[...new Set(l)]})}function Nl(e,t){return Po.find(n=>e.docks[n].views.includes(t))}function Pte(e,t,n){if(!jte(n.dock))return e;let r=Nl(e,t);if(!r)return e;let i=kl(e),a=i.docks[r],o=a.views.indexOf(t);a.views.splice(o,1);let s=i.docks[n.dock],c=Math.min(Math.max(n.index,0),s.views.length);return s.views.splice(c,0,t),i.hidden=i.hidden.filter(e=>e!==t),s.activeViewId=t,s.collapsed=!1,Al(i)}function Fte(e,t){let n=Nl(e,t);if(!n)return e;let r=kl(e);return r.hidden=r.hidden.filter(e=>e!==t),r.docks[n].activeViewId=t,r.docks[n].collapsed=!1,Al(r)}function Ite(e,t){if(!Nl(e,t)||e.hidden.includes(t))return e;let n=kl(e);return n.hidden.push(t),Al(n)}function Lte(e,t){let n=Nl(e,t);if(!n)return e;let r=kl(e);return r.hidden=r.hidden.filter(e=>e!==t),r.docks[n].activeViewId=t,r.docks[n].collapsed=!1,Al(r)}function Rte(e,t){let n=kl(e);return n.docks[t].collapsed=!n.docks[t].collapsed,Al(n)}function zte(e,t,n){let r=Ol(t,n);if(e.docks[t].size===r)return e;let i=kl(e);return i.docks[t].size=r,i}function Pl(e,t,n){let r=new Map(n.map(e=>[e.id,e]));return e.docks[t].views.filter(t=>!e.hidden.includes(t)).map(e=>r.get(e)).filter(e=>e!==void 0)}function Fl(e,t){return e.docks[t].collapsed?!1:e.docks[t].views.some(t=>!e.hidden.includes(t))}var Bte=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vte(e,t){let n=H(t,Bte),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 15h18`}],[`path`,{d:`m15 8-3 3-3-3`}]];P(e,B({name:`panel-bottom-close`},()=>n,{get iconNode(){return r}}))}var Hte=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ute(e,t){let n=H(t,Hte),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}],[`path`,{d:`m16 15-3-3 3-3`}]];P(e,B({name:`panel-left-close`},()=>n,{get iconNode(){return r}}))}var Wte=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gte(e,t){let n=H(t,Wte),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}],[`path`,{d:`m8 9 3 3-3 3`}]];P(e,B({name:`panel-right-close`},()=>n,{get iconNode(){return r}}))}var Kte=h(`<footer class="flex h-full min-w-0 items-center justify-between gap-3 border-t border-border bg-card px-1.5 text-xs text-muted-foreground select-none max-sm:pb-[env(safe-area-inset-bottom)]"><div class="flex min-w-0 flex-auto items-center gap-0.5 overflow-hidden"><!> <!></div> <div class="flex min-w-0 flex-none items-center gap-0.5"><!> <!></div></footer>`);function qte(e,t){a(t,!0);let n=(e,t=D)=>{let n=J(()=>t().open?i[t().dock].open:i[t().dock].closed);{let r=J(()=>`Toggle ${t().label}`),i=J(()=>t().open?`Hide ${t().label}`:`Show ${t().label}`);G(e,{variant:`ghost`,size:`icon-sm`,class:`size-5.5 rounded-sm max-sm:size-9`,get ariaLabel(){return W(r)},get title(){return W(i)},get pressed(){return t().open},get onclick(){return t().onToggle},children:(e,t)=>{var r=U();C(R(r),()=>W(n),(e,t)=>{t(e,{size:13,strokeWidth:2.1,"aria-hidden":`true`})}),g(e,r)},$$slots:{default:!0}})}},r=I(t,`toggles`,19,()=>[]),i={left:{open:Ute,closed:qo},right:{open:Gte,closed:Yo},bottom:{open:Vte,closed:Go}},o=J(()=>r().filter(e=>e.dock===`left`)),s=J(()=>r().filter(e=>e.dock!==`left`));var c=Kte(),l=V(c),f=V(l);_(f,17,()=>W(o),e=>e.dock,(e,t)=>{n(e,()=>W(t))});var p=L(f,2),m=e=>{var n=U();u(R(n),()=>t.left),g(e,n)};k(p,e=>{t.left&&e(m)}),d(l);var h=L(l,2),v=V(h),y=e=>{var n=U();u(R(n),()=>t.right),g(e,n)};k(v,e=>{t.right&&e(y)}),_(L(v,2),17,()=>W(s),e=>e.dock,(e,t)=>{n(e,()=>W(t))}),d(h),d(c),g(e,c),z()}var Jte=h(`<header><div class="flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden"><!> <!></div> <!></header>`);function Yte(e,t){let n=I(t,`desktop`,3,!1);var r=Jte(),i=V(r),a=V(i),o=e=>{var n=U();u(R(n),()=>t.leadingControls),g(e,n)};k(a,e=>{t.leadingControls&&e(o)}),u(L(a,2),()=>t.left),d(i);var c=L(i,2),l=e=>{var n=U();u(R(n),()=>t.actions),g(e,n)};k(c,e=>{t.actions&&e(l)}),d(r),F(()=>s(r,1,`flex h-full min-w-0 items-center justify-between gap-4 border-b border-border bg-card px-3 pt-[env(safe-area-inset-top)] select-none ${n()?`[-webkit-app-region:drag]`:``}`)),g(e,r)}var Xte=h(`<main class="app-frame svelte-qbdwib"><!> <!> <!></main>`);function Zte(e,t){var n=Xte(),r=V(n);u(r,()=>t.titlebar);var i=L(r,2);u(i,()=>t.workspace),u(L(i,2),()=>t.footer),d(n),g(e,n)}function Qte(e){return typeof e==`function`}function Il(e){return typeof e==`object`&&!!e}var $te=[`string`,`number`,`bigint`,`boolean`];function Ll(e){return e==null||$te.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>Ll(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var Rl=Symbol(`box`),zl=Symbol(`is-writable`);function ene(e){return Il(e)&&Rl in e}function tne(e){return Bl.isBox(e)&&zl in e}function Bl(e){let t=Y(N(e));return{[Rl]:!0,[zl]:!0,get current(){return W(t)},set current(e){K(t,e,!0)}}}function nne(e,t){let n=J(e);return t?{[Rl]:!0,[zl]:!0,get current(){return W(n)},set current(e){t(e)}}:{[Rl]:!0,get current(){return e()}}}function rne(e){return Bl.isBox(e)?e:Qte(e)?Bl.with(e):Bl(e)}function ine(e){return Object.entries(e).reduce((e,[t,n])=>Bl.isBox(n)?(Bl.isWritableBox(n)?Object.defineProperty(e,t,{get(){return n.current},set(e){n.current=e}}):Object.defineProperty(e,t,{get(){return n.current}}),e):Object.assign(e,{[t]:n}),{})}function ane(e){return Bl.isWritableBox(e)?{[Rl]:!0,get current(){return e.current}}:e}Bl.from=rne,Bl.with=nne,Bl.flatten=ine,Bl.readonly=ane,Bl.isBox=ene,Bl.isWritableBox=tne;function one(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var sne=/\d/,cne=[`-`,`_`,`/`,`.`];function lne(e=``){if(!sne.test(e))return e!==e.toLowerCase()}function une(e){let t=[],n=``,r,i;for(let a of e){let e=cne.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=lne(a);if(i===!1){if(r===!1&&o===!0){t.push(n),n=a,r=o;continue}if(r===!0&&o===!1&&n.length>1){let e=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=e+a,r=o;continue}}n+=a,r=o,i=e}return t.push(n),t}function Vl(e){return e?une(e).map(e=>fne(e)).join(``):``}function dne(e){return pne(Vl(e||``))}function fne(e){return e?e[0].toUpperCase()+e.slice(1):``}function pne(e){return e?e[0].toLowerCase()+e.slice(1):``}function Hl(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[Vl(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[dne(e)]=n}return Be(e,n),t}function Ul(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function mne(e,t,n,r){let i=Array.isArray(t)?t:[t];return i.forEach(t=>e.addEventListener(t,n,r)),()=>{i.forEach(t=>e.removeEventListener(t,n,r))}}function hne(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var gne=hne(/[A-Z]/,e=>`-${e.toLowerCase()}`);function _ne(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${gne(t)}: ${e[t]};`).join(`
11
+ `)}function Wl(e={}){return _ne(e).replace(`
12
+ `,` `)}Wl({position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,transform:`translateX(-100%)`});var vne=new Set(`onabort.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.onauxclick.onbeforeinput.onbeforetoggle.onblur.oncancel.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncompositionend.oncompositionstart.oncompositionupdate.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onerror.onfocus.onfocusin.onfocusout.onformdata.ongotpointercapture.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onlostpointercapture.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onpaste.onpause.onplay.onplaying.onpointercancel.onpointerdown.onpointerenter.onpointerleave.onpointermove.onpointerout.onpointerover.onpointerup.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onselectionchange.onselectstart.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.ontoggle.ontouchcancel.ontouchend.ontouchmove.ontouchstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onvolumechange.onwaiting.onwebkitanimationend.onwebkitanimationiteration.onwebkitanimationstart.onwebkittransitionend.onwheel`.split(`.`));function yne(e){return vne.has(e)}function Gl(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];if(r){for(let e of Object.keys(r)){let n=t[e],i=r[e],a=typeof n==`function`,o=typeof i==`function`;if(a&&typeof o&&yne(e))t[e]=one(n,i);else if(a&&o)t[e]=Ul(n,i);else if(e===`class`){let r=Ll(n),a=Ll(i);r&&a?t[e]=ve(n,i):r?t[e]=ve(n):a&&(t[e]=ve(i))}else if(e===`style`){let r=typeof n==`object`,a=typeof i==`object`,o=typeof n==`string`,s=typeof i==`string`;if(r&&a)t[e]={...n,...i};else if(r&&s){let r=Hl(i);t[e]={...n,...r}}else if(o&&a)t[e]={...Hl(n),...i};else if(o&&s){let r=Hl(n),a=Hl(i);t[e]={...r,...a}}else r?t[e]=n:a?t[e]=i:o?t[e]=n:s&&(t[e]=i)}else t[e]=i===void 0?n:i}for(let e of Object.getOwnPropertySymbols(r)){let n=t[e],i=r[e];t[e]=i===void 0?n:i}}}return typeof t.style==`object`&&(t.style=Wl(t.style).replaceAll(`
13
+ `,` `)),t.hidden!==!0&&(t.hidden=void 0,delete t.hidden),t.disabled!==!0&&(t.disabled=void 0,delete t.disabled),t}var bne=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function xne(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}new class{#e;#t;constructor(e={}){let{window:t=bne,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=ee(e=>{let n=Oe(t,`focusin`,e),r=Oe(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?xne(this.#e):null}};function Sne(e,t){switch(e){case`post`:be(t);break;case`pre`:Ae(t);break}}function Kl(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;Sne(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=ie(()=>n(t,o));return o=t,r})}function ql(e,t,n){let r=De(()=>{let i=!1;Kl(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});be(()=>r)}function Jl(e,t,n){Kl(e,`post`,t,n)}function Cne(e,t,n){Kl(e,`pre`,t,n)}Jl.pre=Cne;function wne(e,t){ql(e,`post`,t)}function Tne(e,t){ql(e,`pre`,t)}wne.pre=Tne;function Ene(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function Dne(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function Yl(e,t,n={},r){let{lazy:i=!1,once:a=!1,initialValue:o,debounce:s,throttle:c}=n,l=Y(N(o)),u=Y(!1),d=Y(void 0),f=Y(N([])),p=()=>{W(f).forEach(e=>e()),K(f,[],!0)},m=e=>{K(f,[...W(f),e],!0)},h=async(e,n,r=!1)=>{try{K(u,!0),K(d,void 0),p();let i=new AbortController;m(()=>i.abort());let a=await t(e,n,{data:W(l),refetching:r,onCleanup:m,signal:i.signal});return K(l,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||K(d,e,!0);return}finally{K(u,!1)}},g=s?Ene(h,s):c?Dne(h,c):h,_=Array.isArray(e)?e:[e],v;return r((t,n)=>{a&&v||(v=t,g(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:i}),{get current(){return W(l)},get loading(){return W(u)},get error(){return W(d)},mutate:e=>{K(l,e,!0)},refetch:t=>{let n=_.map(e=>e());return g(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function One(e,t,n){return Yl(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Jl(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function kne(e,t,n){return Yl(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Jl.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}One.pre=kne;function Ane(e){he().then(e)}var jne=9;function Mne(e){return Il(e)&&e.nodeType===jne}function Nne(e){return Il(e)&&e.constructor?.name===`VisualViewport`}function Pne(e){return Mne(e)?e:Nne(e)?e.document:e?.ownerDocument??document}function Fne(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var Xl=class{element;#e=J(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return W(this.#e)}set root(e){K(this.#e,e)}constructor(e){typeof e==`function`?this.element=Bl.with(e):this.element=e}getDocument=()=>Pne(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>Fne(this.root);isActiveElement=e=>e===this.getActiveElement();getElementById(e){return this.root.getElementById(e)}querySelector=e=>this.root?this.root.querySelector(e):null;querySelectorAll=e=>this.root?this.root.querySelectorAll(e):[];setTimeout=(e,t)=>this.getWindow().setTimeout(e,t);clearTimeout=e=>this.getWindow().clearTimeout(e)};function Zl(e,t){return{[Se()]:n=>Bl.isBox(e)?(e.current=n,ie(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e.current=null,t?.(null))}):(e(n),ie(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e(null),t?.(null))})}}function Ine({layout:e,panesArray:t,pivotIndices:n}){let r=0,i=100,a=0,o=0,s=n[0];for(let e=0;e<t.length;e++){let{maxSize:n=100,minSize:c=0}=t[e].constraints;e===s?(r=c,i=n):(a+=c,o+=n)}return{valueMax:Math.min(i,100-a),valueMin:Math.max(r,100-o),valueNow:e[s]}}function Ql(e,t=`Assertion failed!`){if(!e)throw console.error(t),Error(t)}function $l(e,t,n=10){return eu(e,t,n)===0}function eu(e,t,n=10){let r=nu(e,n),i=nu(t,n);return Math.sign(r-i)}function tu(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function nu(e,t){return Number.parseFloat(e.toFixed(t))}var ru=typeof document<`u`;function Lne(e){return e instanceof HTMLElement}function iu(e){return e.type===`keydown`}function au(e){return e.type.startsWith(`mouse`)}function ou(e){return e.type.startsWith(`touch`)}function su({paneConstraints:e,paneIndex:t,initialSize:n}){let r=e[t];Ql(r!=null,`Pane constraints should not be null.`);let{collapsedSize:i=0,collapsible:a,maxSize:o=100,minSize:s=0}=r,c=n;return eu(c,s)<0&&(c=Rne(c,a,i,s)),c=Math.min(o,c),Number.parseFloat(c.toFixed(10))}function Rne(e,t,n,r){return t&&eu(e,(n+r)/2)<0?n:r}function cu(){}function zne({groupId:e,layout:t,panesArray:n,domContext:r}){let i=lu(e,r);for(let e=0;e<n.length-1;e++){let{valueMax:r,valueMin:a,valueNow:o}=Ine({layout:t,panesArray:n,pivotIndices:[e,e+1]}),s=i[e];if(Lne(s)){let t=n[e];s.setAttribute(`aria-controls`,t.opts.id.current),s.setAttribute(`aria-valuemax`,`${Math.round(r)}`),s.setAttribute(`aria-valuemin`,`${Math.round(a)}`),s.setAttribute(`aria-valuenow`,o==null?``:`${Math.round(o)}`)}}return()=>{for(let e of i)e.removeAttribute(`aria-controls`),e.removeAttribute(`aria-valuemax`),e.removeAttribute(`aria-valuemin`),e.removeAttribute(`aria-valuenow`)}}function lu(e,t){return ru?Array.from(t.querySelectorAll(`[data-pane-resizer-id][data-pane-group-id="${e}"]`)):[]}function uu({groupId:e,id:t,domContext:n}){return ru?lu(e,n).findIndex(e=>e.getAttribute(`data-pane-resizer-id`)===t)??null:null}function du({groupId:e,dragHandleId:t,domContext:n}){let r=uu({groupId:e,id:t,domContext:n});return r==null?[-1,-1]:[r,r+1]}function fu(e,t,n){let r=e.map(e=>e.constraints),i=pu(e,t),a=r[i],o=i===e.length-1?[i-1,i]:[i,i+1],s=n[i];return{...a,paneSize:s,pivotIndices:o}}function pu(e,t){return e.findIndex(e=>e.opts.id.current===t.opts.id.current)}function mu(e,t,n){for(let r=0;r<t.length;r++){let i=t[r],a=e[r];Ql(a);let{collapsedSize:o=0,collapsible:s}=a.constraints,c=n[a.opts.id.current];if(!(c==null||i!==c))continue;n[a.opts.id.current]=i;let{onCollapse:l,onExpand:u,onResize:d}=a.callbacks;d?.(i,c),s&&(l||u)&&(u&&(c==null||c===o)&&i!==o&&u(),l&&(c==null||c!==o)&&i===o&&l())}}function Bne({panesArray:e}){let t=Array(e.length),n=e.map(e=>e.constraints),r=0,i=100;for(let a=0;a<e.length;a++){let e=n[a];Ql(e);let{defaultSize:o}=e;o!=null&&(r++,t[a]=o,i-=o)}for(let a=0;a<e.length;a++){let o=n[a];Ql(o);let{defaultSize:s}=o;if(s!=null)continue;let c=e.length-r,l=i/c;r++,t[a]=l,i-=l}return t}function Vne({layout:e,paneConstraints:t}){let n=[...e],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} pane layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!$l(r,100))for(let e=0;e<t.length;e++){let t=n[e];Ql(t!=null),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];Ql(r!=null);let a=su({paneConstraints:t,paneIndex:e,initialSize:r});r!==a&&(i+=r-a,n[e]=a)}if(!$l(i,0))for(let e=0;e<t.length;e++){let r=n[e];Ql(r!=null);let a=r+i,o=su({paneConstraints:t,paneIndex:e,initialSize:a});if(r!==o&&(i-=o-r,n[e]=o,$l(i,0)))break}return n}function Hne(e,t){return ru&&t.querySelector(`[data-pane-group][data-pane-group-id="${e}"]`)||null}function hu(e,t){return ru&&t.querySelector(`[data-pane-resizer-id="${e}"]`)||null}function Une({event:e,dragHandleId:t,dir:n,initialDragState:r,domContext:i}){let a=n===`horizontal`,o=hu(t,i);Ql(o);let s=o.getAttribute(`data-pane-group-id`);Ql(s);let{initialCursorPosition:c}=r,l=gu(n,e),u=Hne(s,i);Ql(u);let d=u.getBoundingClientRect(),f=a?d.width:d.height;return(l-c)/f*100}function Wne({event:e,dragHandleId:t,dir:n,initialDragState:r,keyboardResizeBy:i,domContext:a}){if(iu(e)){let t=n===`horizontal`,r=0;r=e.shiftKey?100:i??10;let a=0;switch(e.key){case`ArrowDown`:a=t?0:r;break;case`ArrowLeft`:a=t?-r:0;break;case`ArrowRight`:a=t?r:0;break;case`ArrowUp`:a=t?0:-r;break;case`End`:a=100;break;case`Home`:a=-100;break}return a}else return r==null?0:Une({event:e,dragHandleId:t,dir:n,initialDragState:r,domContext:a})}function gu(e,t){let n=e===`horizontal`;if(au(t))return n?t.clientX:t.clientY;if(ou(t)){let e=t.touches[0];return Ql(e),n?e.screenX:e.screenY}else throw Error(`Unsupported event type "${t.type}"`)}function Gne({groupId:e,handleId:t,panesArray:n,domContext:r}){let i=hu(t,r),a=lu(e,r),o=i?a.indexOf(i):-1;return[n[o]?.opts.id.current??null,n[o+1]?.opts.id.current??null]}function _u({delta:e,layout:t,paneConstraints:n,pivotIndices:r,trigger:i}){if($l(e,0))return t;let a=[...t],[o,s]=r,c=0;if(i===`keyboard`){{let r=e<0?s:o,i=n[r];if(Ql(i),i.collapsible){let i=t[r];Ql(i!=null);let a=n[r];Ql(a);let{collapsedSize:o=0,minSize:s=0}=a;if($l(i,o)){let t=s-i;eu(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?o:s,i=n[r];Ql(i);let{collapsible:a}=i;if(a){let i=t[r];Ql(i!=null);let a=n[r];Ql(a);let{collapsedSize:o=0,minSize:s=0}=a;if($l(i,s)){let t=i-o;eu(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,i=e<0?s:o,a=0;for(;;){let e=t[i];Ql(e!=null);let o=su({paneConstraints:n,paneIndex:i,initialSize:100})-e;if(a+=o,i+=r,i<0||i>=n.length)break}let c=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-c:c}{let r=e<0?o:s;for(;r>=0&&r<n.length;){let i=Math.abs(e)-Math.abs(c),o=t[r];Ql(o!=null);let s=o-i,l=su({paneConstraints:n,paneIndex:r,initialSize:s});if(!$l(o,l)&&(c+=o-l,a[r]=l,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if($l(c,0))return t;{let r=e<0?s:o,i=t[r];Ql(i!=null);let l=i+c,u=su({paneConstraints:n,paneIndex:r,initialSize:l});if(a[r]=u,!$l(u,l)){let t=l-u,r=e<0?s:o;for(;r>=0&&r<n.length;){let i=a[r];Ql(i!=null);let o=i+t,s=su({paneConstraints:n,paneIndex:r,initialSize:o});if($l(i,s)||(t-=s-i,a[r]=s),$l(t,0))break;e>0?r--:r++}}}return $l(a.reduce((e,t)=>t+e,0),100)?a:t}var vu=null,yu=null;function bu(e){switch(e){case`horizontal`:return`ew-resize`;case`horizontal-max`:return`w-resize`;case`horizontal-min`:return`e-resize`;case`vertical`:return`ns-resize`;case`vertical-max`:return`n-resize`;case`vertical-min`:return`s-resize`}}function Kne(){yu!==null&&(document.head.removeChild(yu),vu=null,yu=null)}function qne(e,t){if(vu===e)return;vu=e;let n=bu(e);yu===null&&(yu=t.createElement(`style`),t.head.appendChild(yu)),yu.innerHTML=`*{cursor: ${n}!important;}`}function Jne({defaultSize:e,dragState:t,layout:n,panesArray:r,paneIndex:i,precision:a=3}){let o=n[i],s;return s=o==null?e??`1`:r.length===1?`1`:o.toPrecision(a),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:`hidden`,pointerEvents:t===null?void 0:`none`}}function xu(e){try{if(typeof localStorage>`u`)throw TypeError(`localStorage is not supported in this environment`);e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>localStorage.setItem(e,t)}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Su(e){return`paneforge:${e}`}function Cu(e){return e.map(e=>e.opts.order.current?`${e.opts.order.current}:${JSON.stringify(e.constraints)}`:JSON.stringify(e.constraints)).sort().join(`,`)}function wu(e,t){try{let n=Su(e),r=t.getItem(n),i=JSON.parse(r||``);if(typeof i==`object`&&i)return i}catch{}return null}function Yne(e,t,n){return(wu(e,n)||{})[Cu(t)]||null}function Xne(e,t,n,r,i){let a=Su(e),o=Cu(t),s=wu(e,i)||{};s[o]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(a,JSON.stringify(s))}catch(e){console.error(e)}}var Tu={};function Zne(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function Qne({autoSaveId:e,layout:t,storage:n,panesArray:r,paneSizeBeforeCollapse:i}){if(t.length===0||t.length!==r.length)return;let a=Tu[e];a??(a=Zne(Xne,100),Tu[e]=a);let o=[...r],s=new Map(i);a(e,o,s,t,n)}var Eu={getItem:e=>(xu(Eu),Eu.getItem(e)),setItem:(e,t)=>{xu(Eu),Eu.setItem(e,t)}},Du=new see(`PaneGroup`),$ne=class e{static create(t){return Du.set(new e(t))}opts;attachment;domContext;#e=Y(null);get dragState(){return W(this.#e)}set dragState(e){K(this.#e,e)}#t=Y([]);get layout(){return W(this.#t)}set layout(e){K(this.#t,e)}#n=Y([]);get panesArray(){return W(this.#n)}set panesArray(e){K(this.#n,e)}#r=Y(!1);get panesArrayChanged(){return W(this.#r)}set panesArrayChanged(e){K(this.#r,e,!0)}#i=Y(N({}));get paneIdToLastNotifiedSizeMap(){return W(this.#i)}set paneIdToLastNotifiedSizeMap(e){K(this.#i,e,!0)}paneSizeBeforeCollapseMap=new Map;prevDelta=0;constructor(e){this.opts=e,this.attachment=Zl(this.opts.ref),this.domContext=new Xl(this.opts.ref),Dt([()=>this.opts.id.current,()=>this.layout,()=>this.panesArray],()=>zne({groupId:this.opts.id.current,layout:this.layout,panesArray:this.panesArray,domContext:this.domContext})),be(()=>ie(()=>this.#a())),Dt([()=>this.opts.autoSaveId.current,()=>this.layout,()=>this.opts.storage.current],()=>{this.opts.autoSaveId.current&&Qne({autoSaveId:this.opts.autoSaveId.current,layout:this.layout,storage:this.opts.storage.current,panesArray:this.panesArray,paneSizeBeforeCollapse:this.paneSizeBeforeCollapseMap})}),Dt(()=>this.panesArrayChanged,()=>{if(!this.panesArrayChanged)return;this.panesArrayChanged=!1;let e=this.layout,t=null;if(this.opts.autoSaveId.current){let e=Yne(this.opts.autoSaveId.current,this.panesArray,this.opts.storage.current);e&&(this.paneSizeBeforeCollapseMap=new Map(Object.entries(e.expandToSizes)),t=e.layout)}t??=Bne({panesArray:this.panesArray});let n=Vne({layout:t,paneConstraints:this.panesArray.map(e=>e.constraints)});tu(e,n)||(this.layout=n,this.opts.onLayout.current?.(n),mu(this.panesArray,n,this.paneIdToLastNotifiedSizeMap))})}setLayout=e=>{this.layout=e};registerResizeHandle=e=>t=>{t.preventDefault();let n=this.opts.direction.current,r=this.dragState,i=this.opts.id.current,a=this.opts.keyboardResizeBy.current,o=this.layout,s=this.panesArray,{initialLayout:c}=r??{},l=this.domContext.getDocument(),u=du({groupId:i,dragHandleId:e,domContext:this.domContext}),d=Wne({event:t,dragHandleId:e,dir:n,initialDragState:r,keyboardResizeBy:a,domContext:this.domContext});if(d===0)return;let f=n===`horizontal`;l.dir===`rtl`&&f&&(d=-d);let p=s.map(e=>e.constraints),m=_u({delta:d,layout:c??o,paneConstraints:p,pivotIndices:u,trigger:iu(t)?`keyboard`:`mouse-or-touch`}),h=!tu(o,m);(au(t)||ou(t))&&this.prevDelta!==d&&(this.prevDelta=d,qne(h?f?`horizontal`:`vertical`:f?d<0?`horizontal-min`:`horizontal-max`:d<0?`vertical-min`:`vertical-max`,l)),h&&(this.setLayout(m),this.opts.onLayout.current?.(m),mu(s,m,this.paneIdToLastNotifiedSizeMap))};resizePane=(e,t)=>{let n=this.layout,r=this.panesArray,i=r.map(e=>e.constraints),{paneSize:a,pivotIndices:o}=fu(r,e,n);Ql(a!=null);let s=_u({delta:pu(r,e)===r.length-1?a-t:t-a,layout:n,paneConstraints:i,pivotIndices:o,trigger:`imperative-api`});tu(n,s)||(this.setLayout(s),this.opts.onLayout.current?.(s),mu(r,s,this.paneIdToLastNotifiedSizeMap))};startDragging=(e,t)=>{let n=this.opts.direction.current,r=this.layout,i=hu(e,this.domContext);Ql(i);let a=gu(n,t);this.dragState={dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r}};stopDragging=()=>{Kne(),this.dragState=null};isPaneCollapsed=e=>{let t=this.panesArray,n=this.layout,{collapsedSize:r=0,collapsible:i,paneSize:a}=fu(t,e,n);return typeof a!=`number`||typeof r!=`number`?!1:i===!0&&$l(a,r)};expandPane=e=>{let t=this.layout,n=this.panesArray;if(!e.constraints.collapsible)return;let r=n.map(e=>e.constraints),{collapsedSize:i=0,paneSize:a,minSize:o=0,pivotIndices:s}=fu(n,e,t);if(a!==i)return;let c=this.paneSizeBeforeCollapseMap.get(e.opts.id.current),l=c!=null&&c>=o?c:o,u=_u({delta:pu(n,e)===n.length-1?a-l:l-a,layout:t,paneConstraints:r,pivotIndices:s,trigger:`imperative-api`});tu(t,u)||(this.setLayout(u),this.opts.onLayout.current?.(u),mu(n,u,this.paneIdToLastNotifiedSizeMap))};collapsePane=e=>{let t=this.layout,n=this.panesArray;if(!e.constraints.collapsible)return;let r=n.map(e=>e.constraints),{collapsedSize:i=0,paneSize:a,pivotIndices:o}=fu(n,e,t);if(Ql(a!=null),a===i)return;this.paneSizeBeforeCollapseMap.set(e.opts.id.current,a);let s=_u({delta:pu(n,e)===n.length-1?a-i:i-a,layout:t,paneConstraints:r,pivotIndices:o,trigger:`imperative-api`});tu(t,s)||(this.layout=s,this.opts.onLayout.current?.(s),mu(n,s,this.paneIdToLastNotifiedSizeMap))};getPaneSize=e=>fu(this.panesArray,e,this.layout).paneSize;getPaneStyle=(e,t)=>{let n=this.panesArray,r=this.layout,i=this.dragState;return Jne({defaultSize:t,dragState:i,layout:r,panesArray:n,paneIndex:pu(n,e)})};isPaneExpanded=e=>{let{collapsedSize:t=0,collapsible:n,paneSize:r}=fu(this.panesArray,e,this.layout);return!n||r>t};registerPane=e=>{let t=[...this.panesArray,e];return t.sort((e,t)=>{let n=e.opts.order.current,r=t.opts.order.current;return n==null&&r==null?0:n==null?-1:r==null?1:n-r}),this.panesArray=t,this.panesArrayChanged=!0,()=>{let t=[...this.panesArray],n=pu(this.panesArray,e);n<0||(t.splice(n,1),this.panesArray=t,delete this.paneIdToLastNotifiedSizeMap[e.opts.id.current],this.panesArrayChanged=!0)}};#a=()=>{let e=this.opts.id.current,t=lu(e,this.domContext),n=this.panesArray,r=t.map(t=>{let r=t.getAttribute(`data-pane-resizer-id`);if(!r)return cu;let[i,a]=Gne({groupId:e,handleId:r,panesArray:n,domContext:this.domContext});if(i==null||a==null)return cu;let o=mne(t,`keydown`,t=>{if(t.defaultPrevented||t.key!==`Enter`)return;t.preventDefault();let n=this.panesArray,a=n.findIndex(e=>e.opts.id.current===i);if(a<0)return;let o=n[a];Ql(o);let s=this.layout,c=s[a],{collapsedSize:l=0,collapsible:u,minSize:d=0}=o.constraints;if(!(c!=null&&u))return;let f=_u({delta:$l(c,l)?d-c:l-c,layout:s,paneConstraints:n.map(e=>e.constraints),pivotIndices:du({groupId:e,dragHandleId:r,domContext:this.domContext}),trigger:`keyboard`});s!==f&&(this.layout=f)});return()=>{o()}});return()=>{for(let e of r)e()}};#o=J(()=>({id:this.opts.id.current,"data-pane-group":``,"data-direction":this.opts.direction.current,"data-pane-group-id":this.opts.id.current,style:{display:`flex`,flexDirection:this.opts.direction.current===`horizontal`?`row`:`column`,height:`100%`,overflow:`hidden`,width:`100%`},...this.attachment}));get props(){return W(this.#o)}set props(e){K(this.#o,e)}},ere=[`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`],tre=class e{static create(t){return new e(t,Du.get())}opts;#e;attachment;domContext;#t=J(()=>this.#e.dragState?.dragHandleId===this.opts.id.current);#n=Y(!1);resizeHandler=null;constructor(e,t){this.opts=e,this.#e=t,this.attachment=Zl(this.opts.ref),this.domContext=new Xl(this.opts.ref),be(()=>{this.opts.disabled.current?this.resizeHandler=null:this.resizeHandler=this.#e.registerResizeHandle(this.opts.id.current)}),be(()=>{let e=this.opts.ref.current;if(!e)return;let t=this.opts.disabled.current,n=this.resizeHandler,r=W(this.#t);if(t||n===null||!r)return;let i=e=>{n(e)},a=e=>{n(e)},o=()=>{e.blur(),this.#e.stopDragging(),this.opts.onDraggingChange.current(!1)},s=this.domContext.getDocument().body,c=this.domContext.getWindow();return Ul(Oe(s,`contextmenu`,o),Oe(s,`mousemove`,i),Oe(s,`touchmove`,i,{passive:!1}),Oe(s,`mouseleave`,a),Oe(c,`mouseup`,o),Oe(c,`touchend`,o))})}#r=e=>{e.preventDefault(),!this.opts.disabled.current&&(this.#e.startDragging(this.opts.id.current,e),this.opts.onDraggingChange.current(!0))};#i=()=>{let e=this.opts.ref.current;e&&(e.blur(),this.#e.stopDragging(),this.opts.onDraggingChange.current(!1))};#a=e=>{if(this.opts.disabled.current||!this.resizeHandler||e.defaultPrevented)return;if(ere.includes(e.key)){e.preventDefault(),this.resizeHandler(e);return}if(e.key!==`F6`)return;e.preventDefault();let t=lu(this.#e.opts.id.current,this.domContext),n=uu({groupId:this.#e.opts.id.current,id:this.opts.id.current,domContext:this.domContext});if(n===null)return;let r=0;r=e.shiftKey?n>0?n-1:t.length-1:n+1<t.length?n+1:0,t[r].focus()};#o=()=>{K(this.#n,!1)};#s=()=>{K(this.#n,!0)};#c=e=>{this.#r(e)};#l=()=>{this.#i()};#u=()=>{this.#i()};#d=()=>{this.#i()};#f=e=>{this.#r(e)};#p=J(()=>({id:this.opts.id.current,role:`separator`,"data-direction":this.#e.opts.direction.current,"data-pane-group-id":this.#e.opts.id.current,"data-active":W(this.#t)?`pointer`:W(this.#n)?`keyboard`:void 0,"data-enabled":!this.opts.disabled.current,"data-pane-resizer-id":this.opts.id.current,"data-pane-resizer":``,tabIndex:this.opts.tabIndex.current,style:{cursor:bu(this.#e.opts.direction.current),touchAction:`none`,userSelect:`none`,"-webkit-user-select":`none`,"-webkit-touch-callout":`none`},onkeydown:this.#a,onblur:this.#o,onfocus:this.#s,onmousedown:this.#c,onmouseup:this.#l,ontouchcancel:this.#u,ontouchend:this.#d,ontouchstart:this.#f,...this.attachment}));get props(){return W(this.#p)}set props(e){K(this.#p,e)}},nre=class e{static create(t){return new e(t,Du.get())}opts;group;attachment;domContext;#e=Y(``);#t=J(()=>({onCollapse:this.opts.onCollapse.current,onExpand:this.opts.onExpand.current,onResize:this.opts.onResize.current}));get callbacks(){return W(this.#t)}set callbacks(e){K(this.#t,e)}#n=J(()=>({collapsedSize:this.opts.collapsedSize.current,collapsible:this.opts.collapsible.current,defaultSize:this.opts.defaultSize.current,maxSize:this.opts.maxSize.current,minSize:this.opts.minSize.current}));get constraints(){return W(this.#n)}set constraints(e){K(this.#n,e)}#r=e=>{K(this.#e,e,!0),Ane(()=>{if(this.opts.ref.current){let e=this.opts.ref.current;if(getComputedStyle(e).transitionDuration===`0s`){K(this.#e,``);return}let t=n=>{n.propertyName===`flex-grow`&&(K(this.#e,``),e.removeEventListener(`transitionend`,t))};e.addEventListener(`transitionend`,t)}else K(this.#e,``)})};pane={collapse:()=>{this.#r(`collapsing`),this.group.collapsePane(this)},expand:()=>{this.#r(`expanding`),this.group.expandPane(this)},getSize:()=>this.group.getPaneSize(this),isCollapsed:()=>this.group.isPaneCollapsed(this),isExpanded:()=>this.group.isPaneExpanded(this),resize:e=>this.group.resizePane(this,e),getId:()=>this.opts.id.current};constructor(e,t){this.opts=e,this.group=t,this.attachment=Zl(this.opts.ref),this.domContext=new Xl(this.opts.ref),ce(()=>this.group.registerPane(this)),Dt(()=>y(this.constraints),()=>{this.group.panesArrayChanged=!0})}#i=J(()=>this.group.isPaneCollapsed(this));#a=J(()=>W(this.#e)===``?W(this.#i)?`collapsed`:`expanded`:W(this.#e));#o=J(()=>({id:this.opts.id.current,style:this.group.getPaneStyle(this,this.opts.defaultSize.current),"data-pane":``,"data-pane-id":this.opts.id.current,"data-pane-group-id":this.group.opts.id.current,"data-collapsed":W(this.#i)?``:void 0,"data-expanded":W(this.#i)?void 0:``,"data-pane-state":W(this.#a),...this.attachment}));get props(){return W(this.#o)}set props(e){K(this.#o,e)}},rre=new Set([`$$slots`,`$$events`,`$$legacy`,`autoSaveId`,`direction`,`id`,`keyboardResizeBy`,`onLayoutChange`,`storage`,`ref`,`child`,`children`]),ire=h(`<div><!></div>`);function are(e,t){let n=ne();a(t,!0);let r=I(t,`autoSaveId`,3,null),i=I(t,`id`,3,n),o=I(t,`keyboardResizeBy`,3,null),s=I(t,`onLayoutChange`,3,cu),c=I(t,`storage`,3,Eu),l=I(t,`ref`,15,null),f=H(t,rre),p=$ne.create({id:Bl.with(()=>i()??n),ref:Bl.with(()=>l(),e=>l(e)),autoSaveId:Bl.with(()=>r()),direction:Bl.with(()=>t.direction),keyboardResizeBy:Bl.with(()=>o()),onLayout:Bl.with(()=>s()),storage:Bl.with(()=>c())}),m=()=>p.layout,h=p.setLayout,_=()=>p.opts.id.current,v=J(()=>Gl(f,p.props));var y={getLayout:m,setLayout:h,getId:_},b=U(),x=R(b),S=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(v)})),g(e,n)},C=e=>{var n=ire();O(n,()=>({...W(v)})),u(V(n),()=>t.children??D),d(n),g(e,n)};return k(x,e=>{t.child?e(S):e(C,-1)}),g(e,b),z(y)}var ore=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`collapsedSize`,`collapsible`,`defaultSize`,`maxSize`,`minSize`,`onCollapse`,`onExpand`,`onResize`,`order`,`child`,`children`]),sre=h(`<div><!></div>`);function Ou(e,t){let n=ne();a(t,!0);let r=I(t,`id`,3,n),i=I(t,`ref`,15,null),o=I(t,`onCollapse`,3,cu),s=I(t,`onExpand`,3,cu),c=I(t,`onResize`,3,cu),l=H(t,ore),f=nre.create({id:Bl.with(()=>r()),ref:Bl.with(()=>i(),e=>i(e)),collapsedSize:Bl.with(()=>t.collapsedSize),collapsible:Bl.with(()=>t.collapsible),defaultSize:Bl.with(()=>t.defaultSize),maxSize:Bl.with(()=>t.maxSize),minSize:Bl.with(()=>t.minSize),onCollapse:Bl.with(()=>o()),onExpand:Bl.with(()=>s()),onResize:Bl.with(()=>c()),order:Bl.with(()=>t.order)}),p=f.pane.collapse,m=f.pane.expand,h=f.pane.getSize,_=f.pane.isCollapsed,v=f.pane.isExpanded,y=f.pane.resize,b=f.pane.getId,x=J(()=>Gl(l,f.props));var S={collapse:p,expand:m,getSize:h,isCollapsed:_,isExpanded:v,resize:y,getId:b},C=U(),w=R(C),T=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(x)})),g(e,n)},E=e=>{var n=sre();O(n,()=>({...W(x)})),u(V(n),()=>t.children??D),d(n),g(e,n)};return k(w,e=>{t.child?e(T):e(E,-1)}),g(e,C),z(S)}var cre=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`disabled`,`onDraggingChange`,`tabindex`,`child`,`children`]),lre=h(`<div><!></div>`);function ure(e,t){let n=ne();a(t,!0);let r=I(t,`id`,3,n),i=I(t,`ref`,15,null),o=I(t,`disabled`,3,!1),s=I(t,`onDraggingChange`,3,cu),c=I(t,`tabindex`,3,0),l=H(t,cre),f=tre.create({id:Bl.with(()=>r()),ref:Bl.with(()=>i(),e=>i(e)),disabled:Bl.with(()=>o()),onDraggingChange:Bl.with(()=>s()),tabIndex:Bl.with(()=>c())}),p=J(()=>Gl(l,f.props));var m=U(),h=R(m),_=e=>{var n=U();u(R(n),()=>t.child,()=>({props:W(p)})),g(e,n)},v=e=>{var n=lre();O(n,()=>({...W(p)})),u(V(n),()=>t.children??D),d(n),g(e,n)};k(h,e=>{t.child?e(_):e(v,-1)}),g(e,m),z()}var dre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`withHandle`]),fre=h(`<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>`);function ku(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`withHandle`,3,!1),i=H(t,dre);var o=U(),s=R(o);{let e=J(()=>me(`cn-resizable-handle bg-border focus-visible:ring-ring hover:bg-ring data-[active=keyboard]:bg-ring data-[active=pointer]:bg-ring relative z-10 flex w-px items-center justify-center transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[direction=vertical]:h-px data-[direction=vertical]:w-full data-[direction=vertical]:after:left-0 data-[direction=vertical]:after:h-2 data-[direction=vertical]:after:w-full data-[direction=vertical]:after:translate-x-0 data-[direction=vertical]:after:-translate-y-1/2 [&[data-direction=vertical]>div]:rotate-90`,t.class));C(s,()=>ure,(t,a)=>{a(t,B({"data-slot":`resizable-handle`,get class(){return W(e)}},()=>i,{get ref(){return n()},set ref(e){n(e)},children:(e,t)=>{var n=U(),i=R(n),a=e=>{g(e,fre())};k(i,e=>{r()&&e(a)}),g(e,n)},$$slots:{default:!0}}))})}g(e,o),z()}var pre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`this`,`class`]);function Au(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`this`,15),i=H(t,pre);var o=U(),s=R(o);{let e=J(()=>me(`cn-resizable-panel-group flex h-full w-full data-[direction=vertical]:flex-col`,t.class));C(s,()=>are,(t,a)=>{fe(a(t,B({"data-slot":`resizable-pane-group`,get class(){return W(e)}},()=>i,{get ref(){return n()},set ref(e){n(e)}})),e=>r(e),()=>r())})}g(e,o),z()}var mre=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function ju(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=H(t,mre);var i=U();C(R(i),()=>As,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),z()}var hre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function gre(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,hre);var i=U(),o=R(i);{let e=J(()=>me(`dialog-overlay data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 duration-200`,t.class));C(o,()=>it,(t,i)=>{i(t,B({"data-slot":`sheet-overlay`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var _re=new Set([`$$slots`,`$$events`,`$$legacy`]);function vre(e,t){let n=H(t,_re);var r=U();C(R(r),()=>Ue,(e,t)=>{t(e,B(()=>n))}),g(e,r)}function Mu(e){return e===`left`?-1:1}function Nu(e,t){return Number.isFinite(t)?Math.max(0,t*Mu(e)):0}function yre(e,t){let n=Nu(e,t);return n===0?0:n*Mu(e)}function bre({distance:e,width:t,velocity:n}){return!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||e<=0||t<=0?!1:e>=t*.3||n>=.5}var xre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`style`,`side`,`portalProps`,`swipeToDismiss`,`onSwipeDismiss`,`children`]),Sre=h(`<!> <!>`,1);function Pu(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`side`,3,`right`),i=I(t,`swipeToDismiss`,3,!1),o=H(t,xre),s=J(()=>i()&&(r()===`left`||r()===`right`)),c=Y(void 0),l=Y(!1),d=Y(!1),f,p=!1,m;function h(){f!==void 0&&(clearTimeout(f),f=void 0)}function _(){if(!W(d))return;let e=p;h(),p=!1,K(d,!1),K(l,!1),K(c,void 0),e&&t.onSwipeDismiss?.()}function v(){m=void 0,h(),p=!1,K(d,!1),K(l,!1),K(c,void 0)}be(()=>{let e=n();if(!e||!W(s))return;let t=e,i=r();function a(e){t.hasPointerCapture(e)&&t.releasePointerCapture(e)}function o(e){let n=m;if(m=void 0,n&&a(n.pointerId),K(l,!1),K(d,!0),p=e,K(c,e?(i===`left`?-1:1)*t.getBoundingClientRect().width:0,!0),window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){_();return}h(),f=setTimeout(_,240)}function u(e){W(d)||m||!e.isPrimary||e.pointerType===`mouse`||(m={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,horizontal:!1})}function g(e){let n=m;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startX,a=e.clientY-n.startY;if(!n.horizontal){let i=Math.abs(r),o=Math.abs(a);if(i<8&&o<8)return;if(o>i){m=void 0;return}if(i<o*1.2)return;n.horizontal=!0,t.setPointerCapture(e.pointerId),K(l,!0)}e.preventDefault(),K(c,yre(i,r),!0)}function y(e){let n=m;if(!n||e.pointerId!==n.pointerId)return;if(!n.horizontal){m=void 0;return}let r=Nu(i,e.clientX-n.startX),a=Math.max(1,e.timeStamp-n.startTime);o(bre({distance:r,width:t.getBoundingClientRect().width,velocity:r/a}))}function b(e){!m||e.pointerId!==m.pointerId||(m.horizontal?o(!1):m=void 0)}function x(e){e.target===t&&e.propertyName===`translate`&&_()}return t.addEventListener(`pointerdown`,u,!0),t.addEventListener(`pointermove`,g,!0),t.addEventListener(`pointerup`,y,!0),t.addEventListener(`pointercancel`,b,!0),t.addEventListener(`transitionend`,x),()=>{t.removeEventListener(`pointerdown`,u,!0),t.removeEventListener(`pointermove`,g,!0),t.removeEventListener(`pointerup`,y,!0),t.removeEventListener(`pointercancel`,b,!0),t.removeEventListener(`transitionend`,x),v()}}),vre(e,B(()=>t.portalProps,{children:(e,i)=>{var a=Sre(),f=R(a);gre(f,{});var p=L(f,2);{let e=J(()=>me(`bg-sidebar text-foreground data-open:animate-in data-closed:animate-out fixed z-50 flex flex-col overflow-hidden shadow-lg outline-none duration-200`,r()===`right`&&`data-open:slide-in-from-right data-closed:slide-out-to-right inset-y-0 right-0 h-full w-[min(90vw,24rem)] border-l`,r()===`left`&&`data-open:slide-in-from-left data-closed:slide-out-to-left inset-y-0 left-0 h-full w-[min(85vw,20rem)] border-r`,r()===`top`&&`data-open:slide-in-from-top data-closed:slide-out-to-top inset-x-0 top-0 h-auto max-h-[85vh] border-b`,r()===`bottom`&&`data-open:slide-in-from-bottom data-closed:slide-out-to-bottom inset-x-0 bottom-0 h-auto max-h-[85vh] border-t`,W(s)&&`touch-pan-y [&_*]:touch-pan-y`,W(l)&&`transition-none will-change-[translate]`,W(d)&&`transition-[translate] ease-out`,t.class)),i=J(()=>W(c)===void 0?t.style:`${t.style?`${t.style};`:``}translate:${W(c)}px 0`);C(p,()=>Ls,(a,s)=>{s(a,B({"data-slot":`sheet-content`,get"data-side"(){return r()},get class(){return W(e)},get style(){return W(i)}},()=>o,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=U();u(R(r),()=>t.children??D),g(e,r)},$$slots:{default:!0}}))})}g(e,a)},$$slots:{default:!0}})),z()}h(`<div><!></div>`);var Cre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Fu(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,Cre);var i=U(),o=R(i);{let e=J(()=>me(`text-foreground font-medium`,t.class));C(o,()=>Ge,(t,i)=>{i(t,B({"data-slot":`sheet-title`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var wre=h(`<div role="presentation"><span class="dock-drop-label svelte-17tnf9a"> </span></div>`),Iu=h(`<!> <!>`,1),Tre=h(`<!> <section class="dock-panel" data-dock="right" aria-label="Panels"><!> <div class="dock-body"><!></div></section>`,1),Ere=h(`<div class="workspace-shell compact svelte-17tnf9a"><div class="workbench-editor-area svelte-17tnf9a"><!></div></div> <!> <!>`,1),Dre=h(`<div class="workbench-editor-area svelte-17tnf9a"><!></div>`),Lu=h(`<!> <!> <!>`,1),Ore=h(`<div class="workspace-shell svelte-17tnf9a"><!> <!></div>`);function kre(e,t){a(t,!0);let n=(e,t=D)=>{var n=wre();let r;var i=V(n),a=V(i,!0);d(i),d(n),F(()=>{r=s(n,1,`dock-drop-strip svelte-17tnf9a`,null,r,{hovered:tl.hoverDock===t()}),q(n,`data-dock`,t()),A(a,Fo[t()])}),ue(`dragover`,n,e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),rl(t(),2**53-1)}),ue(`dragleave`,n,()=>il(t())),ue(`drop`,n,e=>O(e,t())),g(e,n)},r=I(t,`compact`,3,!1),i=I(t,`primarySheetOpen`,3,!1),c=I(t,`secondarySheetOpen`,3,!1),l=I(t,`keyboardResizeBy`,3,8),f=I(t,`actions`,19,()=>({})),p=J(()=>Pl(t.layout,`left`,t.descriptors)),m=J(()=>Pl(t.layout,`right`,t.descriptors)),h=J(()=>Pl(t.layout,`bottom`,t.descriptors)),_=J(()=>!r()&&Fl(t.layout,`left`)),v=J(()=>!r()&&Fl(t.layout,`right`)),y=J(()=>!r()&&Fl(t.layout,`bottom`)),b=J(()=>[...W(m),...W(h)]),x=Y(void 0),S=J(()=>W(x)&&W(b).some(e=>e.id===W(x))?W(x):W(b)[0]?.id);function T(e){K(x,e,!0),f().onActivateView?.(e)}let E=J(()=>!r()&&!!tl.viewId);function O(e,t){e.preventDefault();let n=tl.viewId??e.dataTransfer?.getData(`application/x-nerve-panel-view`);al(),n&&f().onMoveView?.(n,{dock:t,index:2**53-1})}Zte(e,{titlebar:e=>{var n=U();u(R(n),()=>t.titlebar),g(e,n)},workspace:e=>{var a=Iu(),s=R(a),x=e=>{var n=Ere(),r=R(n),a=V(r);u(V(a),()=>t.editor),d(a),d(r);var o=L(r,2);C(o,()=>ju,(e,n)=>{n(e,{get open(){return i()},onOpenChange:e=>f().onSheetOpenChange?.(`primary`,e),children:(e,n)=>{var r=U();C(R(r),()=>Pu,(e,n)=>{n(e,{side:`left`,class:`sheet-pane`,swipeToDismiss:!0,onSwipeDismiss:()=>f().onSheetOpenChange?.(`primary`,!1),children:(e,n)=>{var r=Iu(),i=R(r);C(i,()=>Fu,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{w();var n=M();F(()=>A(n,Fo.left)),g(e,n)},$$slots:{default:!0}})}),dl(L(i,2),{dock:`left`,get views(){return W(p)},get registry(){return t.descriptors},get activeViewId(){return t.layout.docks.left.activeViewId},draggable:!1,get onSelect(){return f().onActivateView},get onMove(){return f().onMoveView},get onHide(){return f().onHideView},get panelView(){return t.panelView}}),g(e,r)},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}})}),C(L(o,2),()=>ju,(e,n)=>{n(e,{get open(){return c()},onOpenChange:e=>f().onSheetOpenChange?.(`secondary`,e),children:(e,n)=>{var r=U();C(R(r),()=>Pu,(e,n)=>{n(e,{side:`right`,class:`sheet-pane`,swipeToDismiss:!0,onSwipeDismiss:()=>f().onSheetOpenChange?.(`secondary`,!1),children:(e,n)=>{var r=Tre(),i=R(r);C(i,()=>Fu,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{w(),g(e,M(`Panels`))},$$slots:{default:!0}})});var a=L(i,2),o=V(a);ll(o,{dock:`right`,get views(){return W(b)},get registry(){return t.descriptors},get activeViewId(){return W(S)},draggable:!1,onSelect:T,get onMove(){return f().onMoveView},get onHide(){return f().onHideView}});var s=L(o,2),c=V(s),l=e=>{var n=U();u(R(n),()=>t.panelView,()=>W(S)),g(e,n)};k(c,e=>{W(S)&&e(l)}),d(s),d(a),g(e,r)},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}})}),g(e,n)},D=e=>{var r=Ore(),i=V(r);Au(i,{direction:`horizontal`,get keyboardResizeBy(){return l()},children:(e,n)=>{var r=Lu(),i=R(r),a=e=>{var n=Iu(),r=R(n);Ou(r,{get defaultSize(){return t.layout.docks.left.size},get minSize(){return El.left.min},get maxSize(){return El.left.max},order:1,onResize:e=>f().onDockResize?.(`left`,e),children:(e,n)=>{dl(e,{dock:`left`,get views(){return W(p)},get registry(){return t.descriptors},get activeViewId(){return t.layout.docks.left.activeViewId},get onSelect(){return f().onActivateView},get onMove(){return f().onMoveView},get onHide(){return f().onHideView},get panelView(){return t.panelView}})},$$slots:{default:!0}}),ku(L(r,2),{"aria-label":`Resize left panel`}),g(e,n)};k(i,e=>{W(_)&&e(a)});var s=L(i,2);Ou(s,{minSize:25,order:2,children:(e,n)=>{var r=U();o(R(r),()=>W(y),e=>{Au(e,{direction:`vertical`,get keyboardResizeBy(){return l()},children:(e,n)=>{var r=Iu(),i=R(r);{let e=J(()=>100-(W(y)?t.layout.docks.bottom.size:0));Ou(i,{get defaultSize(){return W(e)},minSize:25,order:1,children:(e,n)=>{var r=Dre();u(V(r),()=>t.editor),d(r),g(e,r)},$$slots:{default:!0}})}var a=L(i,2),o=e=>{var n=Iu(),r=R(n);ku(r,{"aria-label":`Resize bottom panel`}),Ou(L(r,2),{get defaultSize(){return t.layout.docks.bottom.size},get minSize(){return El.bottom.min},get maxSize(){return El.bottom.max},order:2,onResize:e=>f().onDockResize?.(`bottom`,e),children:(e,n)=>{dl(e,{dock:`bottom`,get views(){return W(h)},get registry(){return t.descriptors},get activeViewId(){return t.layout.docks.bottom.activeViewId},get onSelect(){return f().onActivateView},get onMove(){return f().onMoveView},get onHide(){return f().onHideView},get panelView(){return t.panelView}})},$$slots:{default:!0}}),g(e,n)};k(a,e=>{W(y)&&e(o)}),g(e,r)},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}});var c=L(s,2),b=e=>{var n=Iu(),r=R(n);ku(r,{"aria-label":`Resize right panel`}),Ou(L(r,2),{get defaultSize(){return t.layout.docks.right.size},get minSize(){return El.right.min},get maxSize(){return El.right.max},order:3,onResize:e=>f().onDockResize?.(`right`,e),children:(e,n)=>{dl(e,{dock:`right`,get views(){return W(m)},get registry(){return t.descriptors},get activeViewId(){return t.layout.docks.right.activeViewId},get onSelect(){return f().onActivateView},get onMove(){return f().onMoveView},get onHide(){return f().onHideView},get panelView(){return t.panelView}})},$$slots:{default:!0}}),g(e,n)};k(c,e=>{W(v)&&e(b)}),g(e,r)},$$slots:{default:!0}});var a=L(i,2),s=e=>{var t=Lu(),r=R(t),i=e=>{n(e,()=>`left`)};k(r,e=>{W(_)||e(i)});var a=L(r,2),o=e=>{n(e,()=>`right`)};k(a,e=>{W(v)||e(o)});var s=L(a,2),c=e=>{n(e,()=>`bottom`)};k(s,e=>{W(y)||e(c)}),g(e,t)};k(a,e=>{W(E)&&e(s)}),d(r),g(e,r)};k(s,e=>{r()?e(x):e(D,-1)});var O=L(s,2),ee=e=>{var n=U();u(R(n),()=>t.overlays),g(e,n)};k(O,e=>{t.overlays&&e(ee)}),g(e,a)},footer:e=>{var n=U();u(R(n),()=>t.statusBar),g(e,n)},$$slots:{titlebar:!0,workspace:!0,footer:!0}}),z()}var Ru=N({quitRequested:!1}),Are=h(`<div class="shutdown-overlay svelte-xmbw1i" role="status" aria-live="polite"><div class="shutdown-card svelte-xmbw1i"><div class="shutdown-spinner svelte-xmbw1i" aria-hidden="true"></div> <strong>Closing Nerve…</strong> <span class="svelte-xmbw1i">Stopping the local daemon safely.</span></div></div>`);function jre(e,t){a(t,!0);let n=J(()=>Nn.quitting||Ru.quitRequested);var r=U(),i=R(r),o=e=>{g(e,Are())};k(i,e=>{Nn.isDesktop&&W(n)&&e(o)}),g(e,r),z()}var Mre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nre(e,t){let n=H(t,Mre),r=[[`path`,{d:`M12 7v14`}],[`path`,{d:`M16 12h2`}],[`path`,{d:`M16 8h2`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`}],[`path`,{d:`M6 12h2`}],[`path`,{d:`M6 8h2`}]];P(e,B({name:`book-open-text`},()=>n,{get iconNode(){return r}}))}var Pre=new Set([`$$slots`,`$$events`,`$$legacy`]);function zu(e,t){let n=H(t,Pre),r=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]];P(e,B({name:`code-xml`},()=>n,{get iconNode(){return r}}))}var Fre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bu(e,t){let n=H(t,Fre),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];P(e,B({name:`copy`},()=>n,{get iconNode(){return r}}))}var Ire=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vu(e,t){let n=H(t,Ire),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M9 10h6`}],[`path`,{d:`M12 13V7`}],[`path`,{d:`M9 17h6`}]];P(e,B({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var Lre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Hu(e,t){let n=H(t,Lre),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]];P(e,B({name:`file-text`},()=>n,{get iconNode(){return r}}))}var Rre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uu(e,t){let n=H(t,Rre),r=[[`circle`,{cx:`18`,cy:`18`,r:`3`}],[`circle`,{cx:`6`,cy:`6`,r:`3`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`}]];P(e,B({name:`git-pull-request`},()=>n,{get iconNode(){return r}}))}var zre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Wu(e,t){let n=H(t,zre),r=[[`path`,{d:`m10.852 19.772-.383.924`}],[`path`,{d:`m13.148 14.228.383-.923`}],[`path`,{d:`M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923`}],[`path`,{d:`m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544`}],[`path`,{d:`m14.772 15.852.923-.383`}],[`path`,{d:`m14.772 18.148.923.383`}],[`path`,{d:`M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2`}],[`path`,{d:`m9.228 15.852-.923-.383`}],[`path`,{d:`m9.228 18.148-.923.383`}]];P(e,B({name:`cloud-cog`},()=>n,{get iconNode(){return r}}))}var Bre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gu(e,t){let n=H(t,Bre),r=[[`path`,{d:`M3 5h1`}],[`path`,{d:`M3 12h1`}],[`path`,{d:`M3 19h1`}],[`path`,{d:`M8 5h1`}],[`path`,{d:`M8 12h1`}],[`path`,{d:`M8 19h1`}],[`path`,{d:`M13 5h8`}],[`path`,{d:`M13 12h8`}],[`path`,{d:`M13 19h8`}]];P(e,B({name:`logs`},()=>n,{get iconNode(){return r}}))}var Vre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ku(e,t){let n=H(t,Vre),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];P(e,B({name:`settings`},()=>n,{get iconNode(){return r}}))}var Hre=new Set([`$$slots`,`$$events`,`$$legacy`]);function qu(e,t){let n=H(t,Hre),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];P(e,B({name:`terminal`},()=>n,{get iconNode(){return r}}))}async function Ju(e){let t=Fn();if(t){await t.clipboard.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n?.writeText){await n.writeText(e);return}throw Error(`Clipboard API is not available.`)}var Ure=Array(12).fill(0),Wre=h(`<div class="sonner-loading-bar"></div>`),Gre=h(`<div><div class="sonner-spinner"></div></div>`);function Kre(e,t){a(t,!0);var n=Gre(),r=V(n);_(r,23,()=>Ure,(e,t)=>`spinner-bar-${t}`,(e,t)=>{g(e,Wre())}),d(r),d(n),F(e=>{s(n,1,e),q(n,`data-visible`,t.visible)},[()=>x([`sonner-loading-wrapper`,t.class].filter(Boolean).join(` `))]),g(e,n),z()}function Yu(e){return e.label!==void 0}function qre(){let e=Y(N(typeof document<`u`?document.hidden:!1));return be(()=>Oe(document,`visibilitychange`,()=>{K(e,document.hidden,!0)})),{get current(){return W(e)}}}var Xu=4e3,Jre=14,Yre=45,Xre=200,Zre=.05,Qre={toast:``,title:``,description:``,loader:``,closeButton:``,cancelButton:``,actionButton:``,action:``,warning:``,error:``,success:``,default:``,info:``,loading:``};function $re(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}function Zu(e){return 1/(1.5+Math.abs(e)/20)}var eie=new Set(`$$slots.$$events.$$legacy.toast.index.expanded.invert.position.visibleToasts.expandByDefault.closeButton.interacting.cancelButtonStyle.actionButtonStyle.duration.descriptionClass.classes.unstyled.loadingIcon.successIcon.errorIcon.warningIcon.closeIcon.infoIcon.defaultRichColors.swipeDirections.closeButtonAriaLabel.pauseWhenPageIsHidden`.split(`.`)),Qu=h(`<div><!></div>`),$u=h(`<button data-close-button=""><!></button>`),ed=h(`<div data-icon=""><!> <!></div>`),td=h(`<div data-description=""><!></div>`),nd=h(`<button data-button="" data-cancel=""> </button>`),rd=h(`<button data-button=""> </button>`),id=h(`<!> <div data-content=""><div data-title=""><!></div> <!></div> <!> <!>`,1),ad=h(`<li aria-atomic="true" data-sonner-toast=""><!> <!></li>`);function od(e,t){a(t,!0);let n=e=>{var n=U(),r=R(n),i=e=>{var n=Qu();u(V(n),()=>t.loadingIcon),d(n),F(e=>{s(n,1,e),q(n,`data-visible`,W(j)===`loading`)},[()=>x(Ln(W(_e)?.loader,t.toast?.classes?.loader,`sonner-loader`))]),g(e,n)},a=e=>{{let n=J(()=>Ln(W(_e)?.loader,t.toast.classes?.loader)),r=J(()=>W(j)===`loading`);Kre(e,{get class(){return W(n)},get visible(){return W(r)}})}};k(r,e=>{t.loadingIcon?e(i):e(a,-1)}),g(e,n)},i=I(t,`cancelButtonStyle`,3,``),o=I(t,`actionButtonStyle`,3,``),c=I(t,`descriptionClass`,3,``),f=I(t,`unstyled`,3,!1),p=I(t,`defaultRichColors`,3,!1);H(t,eie);let m={...Qre},h=Y(!1),_=Y(!1),v=Y(!1),y=Y(!1),b=Y(!1),S=Y(0),w=Y(0),T=t.toast.duration||t.duration||Xu,E=Y(void 0),O=Y(null),ee=Y(null),te=J(()=>t.index===0),ne=J(()=>t.index+1<=t.visibleToasts),j=J(()=>t.toast.type),re=J(()=>t.toast.dismissible===void 0?t.toast.dismissable!==!1:t.toast.dismissible!==!1),N=J(()=>t.toast.class||``),P=J(()=>t.toast.descriptionClass||``),ae=J(()=>Bn.heights.findIndex(e=>e.toastId===t.toast.id)||0),oe=J(()=>t.toast.closeButton??t.closeButton),se=J(()=>t.toast.duration??t.duration??Xu),le=null,de=J(()=>t.position.split(`-`)),pe=J(()=>Bn.heights.reduce((e,t,n)=>n>=W(ae)?e:e+t.height,0)),me=qre(),he=J(()=>t.toast.invert||t.invert),ge=J(()=>W(j)===`loading`),_e=J(()=>({...m,...t.classes})),ve=J(()=>t.toast.title),ye=J(()=>t.toast.description),xe=Y(0),Se=Y(0),Ce=J(()=>Math.round(W(ae)*Jre+W(pe)));be(()=>{W(ve),W(ye);let e;e=t.expanded||t.expandByDefault?1:1-t.index*Zre;let n=ie(()=>W(E));if(n===void 0)return;n.style.setProperty(`height`,`auto`);let r=n.offsetHeight,i=n.getBoundingClientRect().height,a=Math.round(i/e+2**-52&100)/100;n.style.removeProperty(`height`);let o;o=Math.abs(a-r)<1?a:r,K(w,o,!0),Bn.setHeight({toastId:t.toast.id,height:o})});function we(){K(_,!0),K(S,W(Ce),!0),Bn.removeHeight(t.toast.id),setTimeout(()=>{Bn.remove(t.toast.id)},Xre)}let Te,Ee=J(()=>t.toast.promise&&W(j)===`loading`||t.toast.duration===1/0);function De(){K(xe,new Date().getTime(),!0),Te=setTimeout(()=>{t.toast.onAutoClose?.(t.toast),we()},T)}function G(){if(W(Se)<W(xe)){let e=new Date().getTime()-W(xe);T-=e}K(Se,new Date().getTime(),!0)}be(()=>{t.toast.updated&&(clearTimeout(Te),T=W(se),W(Ee)||De())}),be(()=>(W(Ee)||(t.expanded||t.interacting||t.pauseWhenPageIsHidden&&me.current?G():De()),()=>clearTimeout(Te))),ce(()=>{K(h,!0);let e=W(E)?.getBoundingClientRect().height;return K(w,e,!0),Bn.setHeight({toastId:t.toast.id,height:e}),()=>{Bn.removeHeight(t.toast.id)}}),be(()=>{t.toast.delete&&ie(()=>{we(),t.toast.onDismiss?.(t.toast)})});let Oe=e=>{if(W(ge))return;K(S,W(Ce),!0);let t=e.target;t.setPointerCapture(e.pointerId),t.tagName!==`BUTTON`&&(K(v,!0),le={x:e.clientX,y:e.clientY})},ke=()=>{if(W(y)||!W(re))return;le=null;let e=Number(W(E)?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),n=Number(W(E)?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-0,i=W(O)===`x`?e:n,a=Math.abs(i)/r;if(Math.abs(i)>=Yre||a>.11){K(S,W(Ce),!0),t.toast.onDismiss?.(t.toast),W(O)===`x`?K(ee,e>0?`right`:`left`,!0):K(ee,n>0?`down`:`up`,!0),we(),K(y,!0);return}else W(E)?.style.setProperty(`--swipe-amount-x`,`0px`),W(E)?.style.setProperty(`--swipe-amount-y`,`0px`);K(b,!1),K(v,!1),K(O,null)},Ae=e=>{if(!le||!W(re)||(window.getSelection()?.toString().length??-1)>0)return;let n=e.clientY-le.y,r=e.clientX-le.x,i=t.swipeDirections??$re(t.position);!W(O)&&(Math.abs(r)>1||Math.abs(n)>1)&&K(O,Math.abs(r)>Math.abs(n)?`x`:`y`,!0);let a={x:0,y:0};if(W(O)===`y`){if(i.includes(`top`)||i.includes(`bottom`))if(i.includes(`top`)&&n<0||i.includes(`bottom`)&&n>0)a.y=n;else{let e=n*Zu(n);a.y=Math.abs(e)<Math.abs(n)?e:n}}else if(W(O)===`x`&&(i.includes(`left`)||i.includes(`right`)))if(i.includes(`left`)&&r<0||i.includes(`right`)&&r>0)a.x=r;else{let e=r*Zu(r);a.x=Math.abs(e)<Math.abs(r)?e:r}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&K(b,!0),W(E)?.style.setProperty(`--swipe-amount-x`,`${a.x}px`),W(E)?.style.setProperty(`--swipe-amount-y`,`${a.y}px`)},je=()=>{K(v,!1),K(O,null),le=null},Me=J(()=>t.toast.icon?t.toast.icon:W(j)===`success`?t.successIcon:W(j)===`error`?t.errorIcon:W(j)===`warning`?t.warningIcon:W(j)===`info`?t.infoIcon:W(j)===`loading`?t.loadingIcon:null);var Ne=ad();q(Ne,`tabindex`,0);let Pe;var Fe=V(Ne),Ie=e=>{var n=$u();u(V(n),()=>t.closeIcon??D),d(n),F(e=>{q(n,`aria-label`,t.closeButtonAriaLabel),q(n,`data-disabled`,W(ge)),s(n,1,e)},[()=>x(Ln(W(_e)?.closeButton,t.toast?.classes?.closeButton))]),r(`click`,n,()=>{W(ge)||!W(re)||(we(),t.toast.onDismiss?.(t.toast))}),g(e,n)};k(Fe,e=>{W(oe)&&!t.toast.component&&W(j)!==`loading`&&t.closeIcon!==null&&e(Ie)});var Le=L(Fe,2),Re=e=>{let n=J(()=>t.toast.component);var r=U();C(R(r),()=>W(n),(e,n)=>{n(e,B(()=>t.toast.componentProps,{closeToast:we}))}),g(e,r)},ze=e=>{var a=id(),f=R(a),p=e=>{var r=ed(),i=V(r),a=e=>{var r=U(),i=R(r),a=e=>{var n=U();C(R(n),()=>t.toast.icon,(e,t)=>{t(e,{})}),g(e,n)},o=e=>{n(e)};k(i,e=>{t.toast.icon?e(a):e(o,-1)}),g(e,r)};k(i,e=>{(t.toast.promise||W(j)===`loading`)&&e(a)});var o=L(i,2),c=e=>{var n=U(),r=R(n),i=e=>{var n=U();C(R(n),()=>t.toast.icon,(e,t)=>{t(e,{})}),g(e,n)},a=e=>{var n=U();u(R(n),()=>t.successIcon??D),g(e,n)},o=e=>{var n=U();u(R(n),()=>t.errorIcon??D),g(e,n)},s=e=>{var n=U();u(R(n),()=>t.warningIcon??D),g(e,n)},c=e=>{var n=U();u(R(n),()=>t.infoIcon??D),g(e,n)};k(r,e=>{t.toast.icon?e(i):W(j)===`success`?e(a,1):W(j)===`error`?e(o,2):W(j)===`warning`?e(s,3):W(j)===`info`&&e(c,4)}),g(e,n)};k(o,e=>{t.toast.type!==`loading`&&e(c)}),d(r),F(e=>s(r,1,e),[()=>x(Ln(W(_e)?.icon,t.toast?.classes?.icon))]),g(e,r)};k(f,e=>{(W(j)||t.toast.icon||t.toast.promise)&&t.toast.icon!==null&&(W(Me)!==null||t.toast.icon)&&e(p)});var m=L(f,2),h=V(m),_=V(h),v=e=>{var n=U(),r=R(n),i=e=>{let n=J(()=>t.toast.title);var r=U();C(R(r),()=>W(n),(e,n)=>{n(e,B(()=>t.toast.componentProps))}),g(e,r)},a=e=>{var n=M();F(()=>A(n,t.toast.title)),g(e,n)};k(r,e=>{typeof t.toast.title==`string`?e(a,-1):e(i)}),g(e,n)};k(_,e=>{t.toast.title&&e(v)}),d(h);var y=L(h,2),b=e=>{var n=td(),r=V(n),i=e=>{let n=J(()=>t.toast.description);var r=U();C(R(r),()=>W(n),(e,n)=>{n(e,B(()=>t.toast.componentProps))}),g(e,r)},a=e=>{var n=M();F(()=>A(n,t.toast.description)),g(e,n)};k(r,e=>{typeof t.toast.description==`string`?e(a,-1):e(i)}),d(n),F(e=>s(n,1,e),[()=>x(Ln(c(),W(P),W(_e)?.description,t.toast.classes?.description))]),g(e,n)};k(y,e=>{t.toast.description&&e(b)}),d(m);var S=L(m,2),w=e=>{var n=U(),a=R(n),o=e=>{var n=U();C(R(n),()=>t.toast.cancel,(e,t)=>{t(e,{})}),g(e,n)},c=e=>{var n=nd(),a=V(n,!0);d(n),F(e=>{l(n,t.toast.cancelButtonStyle??i()),s(n,1,e),A(a,t.toast.cancel.label)},[()=>x(Ln(W(_e)?.cancelButton,t.toast?.classes?.cancelButton))]),r(`click`,n,e=>{Yu(t.toast.cancel)&&W(re)&&(t.toast.cancel?.onClick?.(e),we())}),g(e,n)},u=J(()=>Yu(t.toast.cancel));k(a,e=>{typeof t.toast.cancel==`function`?e(o):W(u)&&e(c,1)}),g(e,n)};k(S,e=>{t.toast.cancel&&e(w)});var T=L(S,2),E=e=>{var n=U(),i=R(n),a=e=>{var n=U();C(R(n),()=>t.toast.action,(e,t)=>{t(e,{})}),g(e,n)},c=e=>{var n=rd(),i=V(n,!0);d(n),F(e=>{l(n,t.toast.actionButtonStyle??o()),s(n,1,e),A(i,t.toast.action.label)},[()=>x(Ln(W(_e)?.actionButton,t.toast?.classes?.actionButton))]),r(`click`,n,e=>{Yu(t.toast.action)&&(t.toast.action?.onClick(e),!e.defaultPrevented&&we())}),g(e,n)},u=J(()=>Yu(t.toast.action));k(i,e=>{typeof t.toast.action==`function`?e(a):W(u)&&e(c,1)}),g(e,n)};k(T,e=>{t.toast.action&&e(E)}),F((e,t)=>{s(m,1,e),s(h,1,t)},[()=>x(Ln(W(_e)?.content,t.toast?.classes?.content)),()=>x(Ln(W(_e)?.title,t.toast?.classes?.title))]),g(e,a)};k(Le,e=>{t.toast.component?e(Re):e(ze,-1)}),d(Ne),fe(Ne,e=>K(E,e),()=>W(E)),F((e,n,r)=>{s(Ne,1,e),q(Ne,`aria-live`,t.toast.important?`assertive`:`polite`),q(Ne,`data-rich-colors`,t.toast.richColors??p()),q(Ne,`data-styled`,!(t.toast.component||t.toast.unstyled||f())),q(Ne,`data-mounted`,W(h)),q(Ne,`data-promise`,n),q(Ne,`data-swiped`,W(b)),q(Ne,`data-removed`,W(_)),q(Ne,`data-visible`,W(ne)),q(Ne,`data-y-position`,W(de)[0]),q(Ne,`data-x-position`,W(de)[1]),q(Ne,`data-index`,t.index),q(Ne,`data-front`,W(te)),q(Ne,`data-swiping`,W(v)),q(Ne,`data-dismissible`,W(re)),q(Ne,`data-type`,W(j)),q(Ne,`data-invert`,W(he)),q(Ne,`data-swipe-out`,W(y)),q(Ne,`data-swipe-direction`,W(ee)),q(Ne,`data-expanded`,r),Pe=l(Ne,`${t.style} ${t.toast.style}`,Pe,{"--index":t.index,"--toasts-before":t.index,"--z-index":Bn.toasts.length-t.index,"--offset":`${W(_)?W(S):W(Ce)}px`,"--initial-height":t.expandByDefault?`auto`:`${W(w)}px`})},[()=>x(Ln(t.class,W(N),W(_e)?.toast,t.toast?.classes?.toast,W(_e)?.[W(j)],t.toast?.classes?.[W(j)])),()=>!!t.toast.promise,()=>!!(t.expanded||t.expandByDefault&&W(h))]),r(`pointermove`,Ne,Ae),r(`pointerup`,Ne,ke),r(`pointerdown`,Ne,Oe),ue(`dragend`,Ne,je),g(e,Ne),z()}T([`pointermove`,`pointerup`,`pointerdown`,`click`]);var sd=j(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-success-icon=""><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path></svg>`);function cd(e){g(e,sd())}var ld=j(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-error-icon=""><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`);function ud(e){g(e,ld())}var dd=j(`<svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" data-sonner-warning-icon="" xmlns="http://www.w3.org/2000/svg"><path d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"></path><path d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"></path></svg>`);function fd(e){g(e,dd())}var pd=j(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-info-icon=""><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg>`);function md(e){g(e,pd())}var hd=j(`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-sonner-close-icon=""><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`);function gd(e){g(e,hd())}var _d=3,vd=`24px`,yd=`16px`,bd=4e3,xd=356,Sd=14,Cd=`dark`,wd=`light`;function Td(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?yd:vd;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{let r=e[t];r===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof r==`number`?`${r}px`:r}):o(a)}),n}var Ed=new Set(`$$slots.$$events.$$legacy.invert.position.hotkey.expand.closeButton.offset.mobileOffset.theme.richColors.duration.visibleToasts.toastOptions.dir.gap.pauseWhenPageIsHidden.loadingIcon.successIcon.errorIcon.warningIcon.closeIcon.infoIcon.containerAriaLabel.class.closeButtonAriaLabel.onblur.onfocus.onmouseenter.onmousemove.onmouseleave.ondragend.onpointerdown.onpointerup`.split(`.`)),Dd=h(`<ol></ol>`),Od=h(`<section aria-live="polite" aria-relevant="additions text" aria-atomic="false" class="svelte-q7vsul"><!></section>`);function kd(e,t){a(t,!0);function n(e){return e===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?Cd:wd:e}let r=I(t,`invert`,3,!1),i=I(t,`position`,3,`bottom-right`),o=I(t,`hotkey`,19,()=>[`altKey`,`KeyT`]),s=I(t,`expand`,3,!1),c=I(t,`closeButton`,3,!1),l=I(t,`offset`,3,vd),f=I(t,`mobileOffset`,3,yd),p=I(t,`theme`,3,`light`),m=I(t,`richColors`,3,!1),h=I(t,`duration`,3,bd),v=I(t,`visibleToasts`,3,_d),y=I(t,`toastOptions`,19,()=>({})),b=I(t,`dir`,7,`auto`),x=I(t,`gap`,3,Sd),S=I(t,`pauseWhenPageIsHidden`,3,!1),C=I(t,`containerAriaLabel`,3,`Notifications`),w=I(t,`closeButtonAriaLabel`,3,`Close toast`),T=H(t,Ed);function E(){if(b()!==`auto`)return b();if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?(ie(()=>b(window.getComputedStyle(document.documentElement).direction??`ltr`)),b()):(ie(()=>b(e)),e)}let ee=J(()=>Array.from(new Set([i(),...Bn.toasts.filter(e=>e.position).map(e=>e.position)].filter(Boolean)))),te=Y(!1),A=Y(!1),ne=Y(N(n(p()))),j=Y(void 0),M=Y(null),re=Y(!1),P=J(()=>o().join(`+`).replace(/Key/g,``).replace(/Digit/g,``));be(()=>{Bn.toasts.length<=1&&K(te,!1)}),be(()=>{let e=Bn.toasts.filter(e=>e.dismiss&&!e.delete);e.length>0&&(Bn.toasts=Bn.toasts.map(t=>e.find(e=>e.id===t.id)?{...t,delete:!0}:t))}),be(()=>()=>{W(j)&&W(M)&&(W(M).focus({preventScroll:!0}),K(M,null),K(re,!1))}),ce(()=>(Bn.reset(),Oe(document,`keydown`,e=>{o().every(t=>e[t]||e.code===t)&&(K(te,!0),W(j)?.focus()),e.code===`Escape`&&(document.activeElement===W(j)||W(j)?.contains(document.activeElement))&&K(te,!1)}))),be(()=>{if(p()!==`system`&&K(ne,p()),typeof window<`u`){p()===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?K(ne,Cd):K(ne,wd));let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=({matches:e})=>{p()===`system`&&K(ne,e?Cd:wd,!0)};`addEventListener`in e?e.addEventListener(`change`,t):e.addListener(t)}});let ae=e=>{t.onblur?.(e),W(re)&&!e.currentTarget.contains(e.relatedTarget)&&(K(re,!1),W(M)&&(W(M).focus({preventScroll:!0}),K(M,null)))},oe=e=>{t.onfocus?.(e),!(e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`)&&(W(re)||(K(re,!0),K(M,e.relatedTarget,!0)))},se=e=>{t.onpointerdown?.(e),!(e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`)&&K(A,!0)},le=e=>{t.onmouseenter?.(e),K(te,!0)},ue=e=>{t.onmouseleave?.(e),W(A)||K(te,!1)},de=e=>{t.onmousemove?.(e),K(te,!0)},L=e=>{t.ondragend?.(e),K(te,!1)},pe=e=>{t.onpointerup?.(e),K(A,!1)};Rn.set(new Vn);var me=Od();q(me,`tabindex`,-1);var he=V(me),ge=e=>{var n=U();_(R(n),18,()=>W(ee),e=>e,(e,n,i,a)=>{let o=J(()=>{let[e,t]=n.split(`-`);return{y:e,x:t}}),p=J(()=>Td(l(),f()));var b=Dd();O(b,e=>({tabindex:-1,dir:e,class:t.class,"data-sonner-toaster":!0,"data-sonner-theme":W(ne),"data-y-position":W(o).y,"data-x-position":W(o).x,style:t.style,onblur:ae,onfocus:oe,onmouseenter:le,onmousemove:de,onmouseleave:ue,ondragend:L,onpointerdown:se,onpointerup:pe,...T,[Me]:{"--front-toast-height":`${Bn.heights[0]?.height}px`,"--width":`${xd}px`,"--gap":`${x()}px`,"--offset-top":W(p)[`--offset-top`],"--offset-right":W(p)[`--offset-right`],"--offset-bottom":W(p)[`--offset-bottom`],"--offset-left":W(p)[`--offset-left`],"--mobile-offset-top":W(p)[`--mobile-offset-top`],"--mobile-offset-right":W(p)[`--mobile-offset-right`],"--mobile-offset-bottom":W(p)[`--mobile-offset-bottom`],"--mobile-offset-left":W(p)[`--mobile-offset-left`]}}),[()=>E()],void 0,void 0,`svelte-q7vsul`),_(b,23,()=>Bn.toasts.filter(e=>!e.position&&W(i)===0||e.position===n),e=>e.id,(e,i,a,o)=>{{let o=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.successIcon??D),g(e,n)},a=e=>{cd(e,{})};k(r,e=>{t.successIcon?e(i):t.successIcon!==null&&e(a,1)}),g(e,n)},l=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.errorIcon??D),g(e,n)},a=e=>{ud(e,{})};k(r,e=>{t.errorIcon?e(i):t.errorIcon!==null&&e(a,1)}),g(e,n)},d=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.warningIcon??D),g(e,n)},a=e=>{fd(e,{})};k(r,e=>{t.warningIcon?e(i):t.warningIcon!==null&&e(a,1)}),g(e,n)},f=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.infoIcon??D),g(e,n)},a=e=>{md(e,{})};k(r,e=>{t.infoIcon?e(i):t.infoIcon!==null&&e(a,1)}),g(e,n)},p=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.closeIcon??D),g(e,n)},a=e=>{gd(e,{})};k(r,e=>{t.closeIcon?e(i):t.closeIcon!==null&&e(a,1)}),g(e,n)},_=J(()=>y()?.duration??h()),b=J(()=>y()?.class??``),x=J(()=>y()?.descriptionClass||``),C=J(()=>y()?.style??``),T=J(()=>y().classes||{}),E=J(()=>y().unstyled??!1),O=J(()=>y()?.cancelButtonStyle??``),ee=J(()=>y()?.actionButtonStyle??``),ne=J(()=>y()?.closeButtonAriaLabel??w());od(e,{get index(){return W(a)},get toast(){return W(i)},get defaultRichColors(){return m()},get duration(){return W(_)},get class(){return W(b)},get descriptionClass(){return W(x)},get invert(){return r()},get visibleToasts(){return v()},get closeButton(){return c()},get interacting(){return W(A)},get position(){return n},get style(){return W(C)},get classes(){return W(T)},get unstyled(){return W(E)},get cancelButtonStyle(){return W(O)},get actionButtonStyle(){return W(ee)},get closeButtonAriaLabel(){return W(ne)},get expandByDefault(){return s()},get expanded(){return W(te)},get pauseWhenPageIsHidden(){return S()},get loadingIcon(){return t.loadingIcon},successIcon:o,errorIcon:l,warningIcon:d,infoIcon:f,closeIcon:p,$$slots:{successIcon:!0,errorIcon:!0,warningIcon:!0,infoIcon:!0,closeIcon:!0}})}}),d(b),fe(b,e=>K(j,e),()=>W(j)),F(()=>b.dir=b.dir),g(e,b)}),g(e,n)};k(he,e=>{Bn.toasts.length>0&&e(ge)}),d(me),F(()=>q(me,`aria-label`,`${C()??``} ${W(P)??``}`)),g(e,me),z()}function Ad(){return typeof navigator>`u`?!1:navigator.platform.toLowerCase().includes(`mac`)||navigator.userAgent.includes(`Mac OS X`)}function jd(e){return e===` `?`space`:e===`Esc`?`escape`:e.toLowerCase()}function Md(e){if(/^Key[A-Z]$/.test(e))return e.slice(3).toLowerCase();if(/^Digit[0-9]$/.test(e))return e.slice(5);switch(e){case`BracketLeft`:return`[`;case`BracketRight`:return`]`;case`Minus`:return`-`;case`Equal`:return`=`;case`Period`:return`.`;case`Enter`:case`NumpadEnter`:return`enter`;case`Escape`:return`escape`;default:return}}function Nd(e){return e instanceof Element?!!e.closest(`input, textarea, select, [contenteditable="true"], .cm-editor`):!1}function Pd(e,t){let n=Ad(),r=!!(t.ctrl||t.mod&&!n),i=!!(t.meta||t.mod&&n),a=!!t.alt,o=!!t.shift;if(e.ctrlKey!==r||e.metaKey!==i||e.altKey!==a||e.shiftKey!==o)return!1;let s=jd(t.key);return jd(e.key)===s||jd(Md(e.code)??``)===s}function Fd(e){let t=jd(e);return t===`escape`?`Esc`:t===`enter`?`Enter`:t===`space`?`Space`:t.length===1?t.toUpperCase():e}function Id(e){let t=Ad(),n=[];return e.mod&&n.push(t?`⌘`:`Ctrl`),e.ctrl&&n.push(t?`⌃`:`Ctrl`),e.alt&&n.push(t?`⌥`:`Alt`),e.shift&&n.push(t?`⇧`:`Shift`),n.push(Fd(e.key)),t?n.join(``):n.join(`+`)}function Ld(e){let t=Ad(),n=[];return e.mod&&n.push(t?`Meta`:`Control`),e.ctrl&&n.push(`Control`),e.alt&&n.push(`Alt`),e.shift&&n.push(`Shift`),n.push(Fd(e.key)),n.join(`+`)}var Rd=[{id:`conversation.new`,label:`New chat`,category:`Conversation`,defaultBinding:{key:`n`,mod:!0}},{id:`conversation.newFromProject`,label:`New chat from project`,category:`Conversation`,defaultBinding:{key:`n`,mod:!0,shift:!0}},{id:`pane.close`,label:`Close pane`,category:`Panes`,defaultBinding:{key:`w`,mod:!0},allowInEditable:!0},{id:`pane.closeOthers`,label:`Close other panes`,category:`Panes`,defaultBinding:{key:`w`,mod:!0,shift:!0}},{id:`pane.refresh`,label:`Refresh pane`,category:`Panes`,defaultBinding:{key:`r`,mod:!0}},{id:`pane.previous`,label:`Previous pane`,category:`Panes`,defaultBinding:{key:`[`,mod:!0}},{id:`pane.next`,label:`Next pane`,category:`Panes`,defaultBinding:{key:`]`,mod:!0}},...Array.from({length:9},(e,t)=>{let n=t+1;return{id:`pane.focusByIndex.${n}`,label:`Focus pane ${n}`,category:`Panes`,defaultBinding:{key:String(n),mod:!0}}}),{id:`projectSearch.focus`,label:`Search conversations`,category:`Conversation`,defaultBinding:{key:`k`,mod:!0}},{id:`composer.focus`,label:`Focus composer`,category:`Composer`,defaultBinding:{key:`escape`},allowInEditable:!0},{id:`composer.send`,label:`Send prompt`,category:`Composer`,defaultBinding:{key:`enter`,mod:!0},allowInEditable:!0},{id:`composer.stopRun`,label:`Stop active run`,category:`Composer`,defaultBinding:{key:`.`,mod:!0},allowInEditable:!0},{id:`composer.toggleMic`,label:`Toggle voice recording`,category:`Composer`,defaultBinding:{key:`v`,alt:!0},allowInEditable:!0},{id:`composer.cancelMic`,label:`Cancel voice recording`,category:`Composer`,defaultBinding:{key:`escape`},allowInEditable:!0},{id:`composer.toggleMode`,label:`Toggle coding/planning mode`,category:`Composer`,defaultBinding:{key:`m`,alt:!0},allowInEditable:!0},{id:`composer.cyclePermission`,label:`Cycle permission level`,category:`Composer`,defaultBinding:{key:`p`,alt:!0},allowInEditable:!0},{id:`composer.cycleThinking`,label:`Cycle thinking level`,category:`Composer`,defaultBinding:{key:`t`,alt:!0},allowInEditable:!0},{id:`zoom.in`,label:`Zoom in`,category:`View`,defaultBinding:{key:`=`,mod:!0}},{id:`zoom.out`,label:`Zoom out`,category:`View`,defaultBinding:{key:`-`,mod:!0}},{id:`zoom.reset`,label:`Reset zoom`,category:`View`,defaultBinding:{key:`0`,mod:!0}},{id:`view.toggleLeftDock`,label:`Toggle left panel`,category:`View`,defaultBinding:{key:`b`,mod:!0},allowInEditable:!0},{id:`view.toggleRightDock`,label:`Toggle right panel`,category:`View`,defaultBinding:{key:`b`,mod:!0,alt:!0},allowInEditable:!0},{id:`view.toggleBottomDock`,label:`Toggle bottom panel`,category:`View`,defaultBinding:{key:`j`,mod:!0},allowInEditable:!0}];function zd(e){return Rd.find(t=>t.id===e)}function Bd(e){return zd(e)?.defaultBinding}function Vd(e){let t=Bd(e);return t?Id(t):void 0}function Hd(e){let t=Bd(e);return t?Ld(t):void 0}function Ud(e,t){if(!e)return``;let n=Wd(e),r=``,i=t?Wd(t):void 0;i&&(Kd(n,i)||qd(n,i))?(n=n.slice(i.length),r=`~`):n.startsWith(`/`)&&(r=``);let a=n.split(`/`).filter(Boolean);if(a.length===0)return r||n||`/`;let o=a[a.length-1],s=a.slice(0,-1).map(e=>{let[t]=Array.from(e);return t??``});return[...r?[r,...s]:s,o].join(`/`)}function Wd(e){return e.replace(/\\/g,`/`).replace(/\/+$/,``)||e}function Gd(e){let t=Wd(e);return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function Kd(e,t){return Gd(e)===Gd(t)}function qd(e,t){return Gd(e).startsWith(`${Gd(t)}/`)}function Jd(e,t){if(!e||!t)return!1;let n=Wd(e),r=Wd(t);return Kd(n,r)||qd(n,r)}function Yd(e,t){if(!e)return``;let n=Wd(e),r=t?Wd(t):void 0;return r&&Kd(n,r)?`~`:r&&qd(n,r)?`~${n.slice(r.length)}`:n||e||`/`}function Xd(e){return Gd(e)}function Zd(e){let t=e.trim();return t?t.startsWith(`/`)||t.startsWith(`~`)||t.startsWith(`\\\\`)||/^[A-Za-z]:[\\/]?/.test(t)||t.includes(`/`)||t.includes(`\\`)||t.toLowerCase().startsWith(`file://`):!1}function Qd(e){return(/^[A-Za-z]:[\\/]/.test(e)||e.startsWith(`\\\\`))&&e.includes(`\\`)?`\\`:`/`}function $d(e,t,n){return e.endsWith(n)?`${e}${t}`:`${e}${n}${t}`}function ef(e,t){let n=e.match(/^([A-Za-z]:)[\\/]/);if(n){let e=n[1]??``;return{label:e,path:`${e}${t}`}}let r=e.match(/^[\\/]{2}([^\\/]+)[\\/]+([^\\/]+)/);if(r){let e=`${t}${t}${r[1]}${t}${r[2]}`;return{label:e,path:e}}if(e.startsWith(`/`))return{label:`/`,path:`/`}}function tf(e,t){if(!e)return[];let n=e.trim();if(!n)return[];let r=Qd(n),i=Wd(n),a=[],o,s,c=t?Wd(t):void 0;if(c&&(Kd(i,c)||qd(i,c)))o=t?.replace(/[\\/]+$/,``)||(t??`~`),a.push({label:`~`,path:o}),s=i.slice(c.length);else{let e=ef(n,r);e?(o=e.path,a.push({label:e.label,path:e.path}),s=i.slice(Wd(e.path).length)):(o=``,s=i)}for(let e of s.split(`/`).filter(Boolean))o=o?$d(o,e,r):e,a.push({label:e,path:o});return a}function nf(e){return e.kind===`settings`?{kind:`settings`,id:`settings`}:e.kind===`auth`?{kind:`auth`,id:`auth`}:e.kind===`logs`?{kind:`logs`,id:`logs`}:{kind:e.kind,id:e.id}}function rf(e){if(e.kind===`task`)return e.task?.name??e.task?.command??e.id;if(e.kind===`file`)return e.file?.name??e.relativePath?.split(`/`).pop()??e.path?.split(`/`).pop()??`File`;if(e.kind===`pr`)return`#${e.number}`;if(e.kind===`diff`){let t=e.path?.split(`/`).pop()??`Diff`;return e.area===`staged`?`${t} (staged)`:t}return e.kind===`settings`?`Settings`:e.kind===`auth`?`Authentication`:e.kind===`logs`?`Nerve Logs`:e.kind===`pending-conversation`?e.title:e.conversation.title}function af(e,t){if(e.kind===`task`)return e.task?`${e.task.name??e.task.command} · ${e.task.status} · ${Ud(e.task.cwd,t)} · ${e.task.id}`:`Missing task · ${e.id}`;if(e.kind===`file`)return e.file?.path??e.path??e.id;if(e.kind===`diff`)return`${e.path??e.id} · ${e.area===`staged`?`staged`:`unstaged`} changes${e.repo&&e.repo!==`.`?` · ${e.repo}`:``}`;if(e.kind===`pr`)return e.title?`#${e.number} ${e.title}`:`Pull request #${e.number}`;if(e.kind===`settings`)return`Workbench settings`;if(e.kind===`auth`)return`Providers & authentication`;if(e.kind===`logs`)return`Nerve application logs`;let n=e.project?.dir?er(e.project.dir,t):e.kind===`pending-conversation`?er(e.projectDir,t):`Unknown project`;return e.kind===`pending-conversation`?`${e.title} · ${n} · created on first send`:`${e.conversation.title} · ${n} · ${e.conversation.id}`}function of(e){if(e.error)return e.error;if(e.kind===`conversation`||e.kind===`pending-conversation`)return e.activity.label??(e.hasDraft?`Unsaved draft`:void 0);if(e.sending){if(e.kind===`task`)return`Task active`;if(e.kind===`file`)return`Loading file`;if(e.kind===`diff`)return`Loading diff`}if(e.kind===`task`)return e.task?.status??`missing`;if(e.kind===`file`&&e.file?.truncated)return`Truncated`}function sf(e){return e.kind===`file`?e.displayMode===`rendered`?`Show code`:`Show preview`:``}function cf(e){return e.kind===`file`?e.wrapLines?`Disable line wrap`:`Wrap long lines`:``}function lf(e,t){let n=nf(t);return e.findIndex(e=>{let t=nf(e);return t.kind===n.kind&&t.id===n.id})}function uf(e,t){a(t,!0);let n=I(t,`tabs`,19,()=>[]),r=Vd(`pane.refresh`),i=Vd(`pane.close`),o=Vd(`pane.closeOthers`),s=Vd(`conversation.new`),c=Hd(`conversation.new`),l=J(()=>n().map(f));function u(e){return e}function d(e){return n().find(t=>{let n=nf(t);return n.kind===e.kind&&n.id===e.id})}function f(e){let n={...nf(e),label:rf(e),title:af(e,t.homeDir),active:e.active,running:e.sending,error:e.error,closeable:!0,wide:e.kind===`task`||e.kind===`file`||e.kind===`diff`,draft:(e.kind===`conversation`||e.kind===`pending-conversation`)&&e.hasDraft};return e.kind===`conversation`||e.kind===`pending-conversation`?n.status={tone:e.activity.tone,pulse:e.activity.pulse,label:of(e)}:e.kind===`task`?(n.status={label:of(e)},n.selectIcon=qu):e.kind===`file`?e.renderKind?n.toggle={label:sf(e),icon:e.displayMode===`rendered`?Nre:zu,disabled:!t.onToggleFileDisplayMode,onClick:()=>t.onToggleFileDisplayMode?.(e.id)}:n.icon=Hu:e.kind===`pr`?n.icon=Uu:e.kind===`diff`?n.icon=Vu:e.kind===`settings`?n.icon=Ku:e.kind===`auth`?n.icon=Wu:e.kind===`logs`&&(n.icon=Gu),n}async function p(e,t){if(e)try{await Ju(e),Kn.success(`Copied ${t}`)}catch{Kn.error(`Could not copy to clipboard`)}}function m(e){let a=d(e);if(!a)return[];let s=nf(a),c=lf(n(),a),l=c>0,u=c!==-1&&c<n().length-1,f=[];if(a.kind===`file`){let e=a.file?.path??a.path,n=a.relativePath??a.file?.relativePath;f.push({label:`Copy Path`,icon:Bu,disabled:!e,onSelect:()=>void p(e,`path`)},{label:`Copy Relative Path`,icon:Bu,disabled:!n,onSelect:()=>void p(n,`relative path`)},{type:`separator`},{label:cf(a),icon:zu,disabled:!t.onToggleFileLineWrap,onSelect:()=>t.onToggleFileLineWrap?.(a.id)})}return f.push({label:`Refresh`,icon:_l,shortcut:r,disabled:!t.onRefresh,onSelect:()=>t.onRefresh?.(s)}),t.onReorder&&f.push({type:`separator`},{label:`Move Left`,icon:Vo,disabled:!l,onSelect:()=>t.onReorder(s,c-1)},{label:`Move Right`,icon:Uo,disabled:!u,onSelect:()=>t.onReorder(s,c+1)}),f.push({type:`separator`},{label:`Close Pane`,icon:yl,shortcut:i,onSelect:()=>t.onClose?.(s)},{label:`Close Other Panes`,icon:yl,shortcut:o,disabled:n().length<=1||!t.onCloseOther,onSelect:()=>t.onCloseOther?.(s)},{label:`Close Panes on Right`,icon:yl,disabled:!u||!t.onCloseRight,onSelect:()=>t.onCloseRight?.(s)},{label:`Close Panes on Left`,icon:yl,disabled:!l||!t.onCloseLeft,onSelect:()=>t.onCloseLeft?.(s)}),f}Tl(e,{get tabs(){return W(l)},get refreshShortcut(){return r},get closeShortcut(){return i},get closeOthersShortcut(){return o},newLabel:`New chat`,get newShortcut(){return s},get newShortcutAria(){return c},buildMenuItems:({tab:e})=>m(e),onSelect:e=>t.onSelect?.(u(e)),onClose:e=>t.onClose?.(u(e)),onRefresh:e=>t.onRefresh?.(u(e)),onCloseOther:e=>t.onCloseOther?.(u(e)),onCloseRight:e=>t.onCloseRight?.(u(e)),onCloseLeft:e=>t.onCloseLeft?.(u(e)),get onNew(){return t.onNew},onReorder:(e,n)=>t.onReorder?.(u(e),n)}),z()}function df(e,t){let n={needsUser:0,running:0};for(let r of e){let e=t[r.id];e&&(e.needsUser?n.needsUser+=1:e.busy&&e.tone!==`danger`&&(n.running+=1))}return n}function ff(e){let t=[e.needsUser?`${e.needsUser} waiting for you`:``,e.running?`${e.running} running`:``].filter(Boolean);if(!t.length)return;let n=e.needsUser?`warn`:`running`;return{tone:n,pulse:n===`running`,summary:t.join(`, `)}}function pf(e){let t=new Map;for(let n of e.projects){let e=cr(n);t.set(e,[...t.get(e)??[],n])}let n=new Map;for(let e of t.values()){let t=nr(e[0].dir);n.set(t,(n.get(t)??0)+1)}return[...t.entries()].map(([t,r])=>{let i=[...r].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0],a=r.map(e=>e.id),o=new Set(a),s=e.conversations.filter(e=>o.has(e.projectId)),c=s.map(Qn).sort((e,t)=>t.localeCompare(e))[0],l=nr(i.dir);return{key:t,project:i,projectIds:a,label:(n.get(l)??0)>1?er(i.dir,e.homeDir):l,sortAt:c&&c>i.updatedAt?c:i.updatedAt,lastAccessedAt:e.recency?.[t],activity:df(s,e.activityById)}}).sort((t,n)=>{let r=(e.recency?.[n.key]??0)-(e.recency?.[t.key]??0);return r===0?n.sortAt.localeCompare(t.sortAt)||t.label.localeCompare(n.label):r})}function mf(e,t,n){if(n<=0)return[];let r=e.slice(0,n),i=e.find(e=>e.key===t);return i&&!r.some(e=>e.key===i.key)&&r.splice(Math.max(0,r.length-1),1,i),r.sort((e,t)=>e.label.localeCompare(t.label,void 0,{sensitivity:`base`}))}function hf(e){return e===`planning`?`good`:`running`}function gf(e,t=!1,n){return e===`awaiting_user`?`warn`:e===`running`||t?hf(n):`neutral`}function _f(e,t=!1){return e===`awaiting_user`?!1:e===`running`||t}function vf(e){return e===`running`||e===`ready`||e===`recovered`?`good`:e===`starting`||e===`stopping`?`warn`:e===`failed`||e===`timed_out`||e===`orphaned`||e===`recovery_unknown`?`danger`:`neutral`}function yf(e){return e===`running`||e===`ready`||e===`starting`||e===`stopping`||e===`recovered`}function bf(e){return e===`error`?`danger`:e===`warn`?`warn`:`neutral`}var xf=new Set([`.md`,`.markdown`,`.mdown`,`.mkd`]),Sf=new Set([`.mmd`,`.mermaid`]);function Cf(e){if(!e)return;let t=e.split(/[?#]/,1)[0]?.toLowerCase()??``,n=t.lastIndexOf(`.`);if(n===-1)return;let r=t.slice(n);if(xf.has(r))return`markdown`;if(Sf.has(r))return`mermaid`}function wf(e){return Cf(e)?`rendered`:`raw`}var Tf={tone:`neutral`,pulse:!1,busy:!1,needsUser:!1,source:`none`};function Ef(e){let t=!!e.hasPendingHumanInput,n=e.view?.activeRun?.status===`waiting`;return t||n||e.agent?.status===`awaiting_user`?{tone:`warn`,pulse:!1,label:`Needs user action`,busy:!1,needsUser:!0,source:t?`pending-input`:n?`live-view`:`agent`}:e.view?.transient?.compaction?.state===`running`?{tone:`running`,pulse:!0,label:`Compacting context`,busy:!0,needsUser:!1,source:`live-view`}:e.agent?.status===`running`||e.view?.sending||e.view?.activeRun?{tone:hf(e.agent?.mode??e.mode),pulse:!0,label:`Agent running`,busy:!0,needsUser:!1,source:e.agent?.status===`running`?`agent`:`live-view`}:e.agent?.status===`error`?{tone:`danger`,pulse:!1,label:`Agent error`,busy:!1,needsUser:!1,source:`agent`}:Tf}function Df(e){let t=new Map,n=new Map;for(let r of e.agents)t.set(r.id,r),r.conversationId&&!n.has(r.conversationId)&&n.set(r.conversationId,r);let r=new Set;for(let t of e.approvals)t.status===`pending`&&r.add(t.conversationId);for(let t of e.userQuestions)t.status===`pending`&&r.add(t.conversationId);for(let t of e.planReviews)t.status===`pending`&&r.add(t.conversationId);let i=Object.create(null);for(let a of e.conversations){let o=(a.activeAgentId?t.get(a.activeAgentId):void 0)??n.get(a.id);i[a.id]=Ef({conversationId:a.id,agent:o,mode:o?.mode??a.mode,view:e.views[Yr(a.id)],hasPendingHumanInput:r.has(a.id)})}return i}var Of=N({projectId:void 0,conversationId:void 0,agentId:void 0,entryId:void 0});N({items:[]});var kf=N({text:``,projectDir:``});function Af(){Of.projectId=void 0,Of.conversationId=void 0,Of.agentId=void 0,Of.entryId=void 0}function jf(e,t){return Q.activeCenterTab?.kind===e&&Q.activeCenterTab.id===t}function Mf(){let e=Q.activeCenterTab;if(e?.kind===`pending-conversation`)return Z.pendingConversations[Qr(e.id)]}function Nf(e){return[`starting`,`running`,`ready`,`stopping`].includes(e)}var Pf=J(()=>Df({conversations:Q.conversations,agents:Q.agents,views:Z.conversationViews,approvals:Q.approvals,userQuestions:Q.userQuestions,planReviews:Q.planReviews}));function Ff(e){return`${e.kind}\0${e.id}`}var If={get status(){return Q.status},get connection(){return Q.connection},get error(){let e=Of.conversationId??Z.activeConversationTabId,t=e?Z.conversationViews[Yr(e)]:void 0;return Mf()?.error??t?.error??Q.error},get projects(){return Q.projects},get conversations(){return Q.conversations},get agents(){return Q.agents},get approvals(){return Q.approvals},get userQuestions(){return Q.userQuestions},get planReviews(){return Q.planReviews},get activeProject(){return Q.projects.find(e=>e.id===Q.selectedProjectId)??Q.projects.find(e=>cr(e)===Q.selectedProjectKey)},get selectedProjectIds(){let e=Q.selectedProjectKey;return Q.projects.filter(t=>e&&cr(t)===e).map(e=>e.id)},get selectedProjectConversations(){let e=new ye(this.selectedProjectIds);return Q.conversations.filter(t=>e.has(t.projectId))},get projectSwitcherItems(){return pf({projects:Q.projects,conversations:Q.conversations,activityById:this.conversationActivityById,homeDir:Q.status?.storage.userHome,recency:Q.projectRecency})},get activeConversation(){return Q.conversations.find(e=>e.id===Of.conversationId)},get activeAgent(){return Q.agents.find(e=>e.id===Of.agentId)},get conversationActivityById(){return W(Pf)},get openConversationTabs(){let e=[],t=Object.fromEntries(Q.conversations.map(e=>[e.id,e])),n=Object.fromEntries(Q.projects.map(e=>[e.id,e])),r=Object.fromEntries(Q.agents.map(e=>[e.id,e])),i=Object.create(null);for(let e of Q.agents)e.conversationId&&!i[e.conversationId]&&(i[e.conversationId]=e);let a=W(Pf);for(let o of Z.openConversationTabIds){let s=t[o];if(!s)continue;let c=n[s.projectId],l=(s.activeAgentId?r[s.activeAgentId]:void 0)??i[s.id],u=Z.conversationViews[Yr(s.id)],d=a[s.id]??Tf;e.push({kind:`conversation`,id:s.id,conversation:s,project:c,agent:l,active:jf(`conversation`,s.id),hasDraft:!!u?.composerText.trim(),sending:d.busy,activity:d,error:u?.error??(l?.status===`error`?`Agent error`:void 0)})}return e},get openPendingConversationTabs(){let e=[];for(let t of Q.openCenterTabs){if(t.kind!==`pending-conversation`)continue;let n=Z.pendingConversations[Qr(t.id)];n&&e.push({kind:`pending-conversation`,id:n.id,title:n.title,project:Q.projects.find(e=>e.id===n.projectId),projectDir:n.projectDir,active:jf(`pending-conversation`,n.id),hasDraft:!!n.composerText.trim(),sending:n.sending,activity:n.sending?{tone:hf(n.mode),pulse:!0,label:`Agent running`,busy:!0,needsUser:!1,source:`live-view`}:Tf,error:n.error})}return e},get openTaskTabs(){let e=[];for(let t of sr.openTaskTabIds){let n=sr.selectedRunByEntry[t],r=sr.tasks.filter(e=>(e.definitionId??e.restartRootTaskId??e.id)===t).sort((e,t)=>t.startedAt.localeCompare(e.startedAt)),i=r.find(e=>e.id===n)??r[0];e.push({kind:`task`,id:t,task:i,active:jf(`task`,t),sending:i?Nf(i.status):!1,error:i?i.status===`failed`?i.error??`Task failed`:void 0:`Task not found`})}return e},get openFileTabs(){return $r.openFileTabIds.map(e=>{let t=$r.fileViews[Jr(e)],n=t?.content?.relativePath??t?.path;return{kind:`file`,id:e,file:t?.content,path:t?.path,relativePath:t?.content?.relativePath,displayMode:t?.displayMode??wf(n),wrapLines:!!t?.wrapLines,renderKind:Cf(n),active:jf(`file`,e),sending:!!t?.loading,error:t?.error}})},get openDiffTabs(){return tr.openDiffTabIds.map(e=>{let t=tr.diffViews[Zr(e)];return{kind:`diff`,id:e,path:t?.path,repo:t?.repo,area:t?.area,active:jf(`diff`,e),sending:!!(t?.loading||t?.refreshing),error:t?.error}})},get openPrTabs(){return tr.openPrTabIds.map(e=>{let t=tr.prViews[qr(e)];return{kind:`pr`,id:e,number:t?.number??0,title:t?.core.data?.title,checksStatus:t?.checks.data?.checks.status,isDraft:t?.core.data?.isDraft,active:jf(`pr`,e),sending:!!(t?.core.loading||t?.core.refreshing),error:t?.core.error}})},get openSettingsTabs(){return rr.settingsTabOpen?[{kind:`settings`,id:`settings`,active:jf(`settings`,`settings`),sending:rr.settingsSaveStatus===`saving`,error:rr.settingsSaveStatus===`error`?rr.settingsMessage:void 0}]:[]},get openAuthTabs(){return ir.authTabOpen?[{kind:`auth`,id:`auth`,active:jf(`auth`,`auth`),sending:!1}]:[]},get openLogsTabs(){return ar.logsTabOpen?[{kind:`logs`,id:`logs`,active:jf(`logs`,`logs`),sending:!1}]:[]},get openConversationTabIds(){let e=new ye;for(let t of Q.openCenterTabs)t.kind===`conversation`&&e.add(t.id);return e},get centerTabs(){let e=Object.create(null),t=[this.openConversationTabs,this.openPendingConversationTabs,this.openTaskTabs,this.openFileTabs,this.openPrTabs,this.openDiffTabs,this.openSettingsTabs,this.openAuthTabs,this.openLogsTabs];for(let n of t)for(let t of n)e[Ff(t)]=t;return Q.openCenterTabs.flatMap(t=>{let n=e[Ff(t)];return n?[n]:[]})},get activeCenterTab(){return Q.activeCenterTab}};function Lf(){Z.openConversationTabIds=Q.openCenterTabs.filter(e=>e.kind===`conversation`).map(e=>e.id),sr.openTaskTabIds=Q.openCenterTabs.filter(e=>e.kind===`task`).map(e=>e.id),$r.openFileTabIds=Q.openCenterTabs.filter(e=>e.kind===`file`).map(e=>e.id),tr.openPrTabIds=Q.openCenterTabs.filter(e=>e.kind===`pr`).map(e=>e.id),tr.openDiffTabIds=Q.openCenterTabs.filter(e=>e.kind===`diff`).map(e=>e.id),rr.settingsTabOpen=Q.openCenterTabs.some(e=>e.kind===`settings`),ir.authTabOpen=Q.openCenterTabs.some(e=>e.kind===`auth`),ar.logsTabOpen=Q.openCenterTabs.some(e=>e.kind===`logs`)}function Rf(e){return`${e.kind}:${e.id}`}function zf(e,t,n){let r=Rf(t),i=e.findIndex(e=>Rf(e)===r);if(i<0)return e;let a=[...e],[o]=a.splice(i,1),s=Math.max(0,Math.min(n,a.length));return a.splice(s,0,o),a}function Bf(e,t,n){let r=new Set(n.map(Rf)),i=e.filter(e=>!r.has(Rf(e)));for(let e of t){let t=i.find(t=>Rf(t)===e);if(t)return t}return i[0]}var Vf=`nerve.workspaceTabs.v2`,Hf=`nerve.conversationTabs.v1`,Uf=24,Wf=30,Gf=new Set([`settings`,`auth`,`logs`]),Kf=!1,qf=Rf;function Jf(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function Yf(e){return Gf.has(e.kind)}function Xf(e){let t=new Set;return e.filter(e=>{let n=qf(e);return t.has(n)?!1:(t.add(n),!0)}).slice(0,Wf)}function Zf(e){let t=Xf(e.tabs),n=new Set(t.map(qf)),r=[...new Set(e.mru)].filter(e=>n.has(e));for(let e of t)r.includes(qf(e))||r.push(qf(e));return{tabs:t,active:e.active&&n.has(qf(e.active))?e.active:t[0],mru:r}}function Qf(){let e=Q.selectedProjectKey;e&&(Q.projectTabSessions[e]=Zf({tabs:[...Q.openCenterTabs],active:Q.activeCenterTab,mru:[...Q.centerTabMru]}),fp())}function $f(e){let t=Zf(Q.projectTabSessions[e]??{tabs:[],mru:[]}),n=new Set(t.tabs.map(qf));for(let e of Q.globalCenterTabs)n.has(qf(e))||t.tabs.push(e);return Zf(t)}function ep(e,t={}){let n=$f(e);return Q.selectedProjectKey=e,Q.openCenterTabs=[...n.tabs],Q.activeCenterTab=t.deferActivation?void 0:n.active,Q.centerTabMru=[...n.mru],Q.projectTabSessions[e]=n,Lf(),n}function tp(e){let t=qf(e);Q.centerTabMru=[t,...Q.centerTabMru.filter(e=>e!==t)],Yf(e)&&!Q.globalCenterTabs.some(t=>Jf(t,e))&&(Q.globalCenterTabs=[...Q.globalCenterTabs,e]),Q.selectedProjectKey?Qf():fp()}function np(){let e=new Set(Q.openCenterTabs.map(qf));Q.centerTabMru=Q.centerTabMru.filter(t=>e.has(t)),Qf()}function rp(e){Q.globalCenterTabs=Q.globalCenterTabs.filter(t=>!Jf(t,e));for(let[t,n]of Object.entries(Q.projectTabSessions))Q.projectTabSessions[t]=Zf({tabs:n.tabs.filter(t=>!Jf(t,e)),active:Jf(n.active,e)?void 0:n.active,mru:n.mru.filter(t=>t!==qf(e))});fp()}function ip(e){return Bf(Q.openCenterTabs,Q.centerTabMru,Array.isArray(e)?e:[e])}function ap(e,t){Q.openCenterTabs=zf(Q.openCenterTabs,e,t),Qf()}function op(e){for(let[t,n]of Object.entries(Q.projectTabSessions)){let r=n.tabs.filter(t=>!e(t)),i=new Set(r.map(qf));Q.projectTabSessions[t]=Zf({tabs:r,active:n.active&&i.has(qf(n.active))?n.active:void 0,mru:n.mru.filter(e=>i.has(e))})}Q.openCenterTabs=Q.openCenterTabs.filter(t=>!e(t)),np()}function sp(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.kind==`string`&&typeof t.id==`string`&&[`conversation`,`pending-conversation`,`task`,`file`,`pr`,`diff`,`settings`,`auth`,`logs`].includes(t.kind)}function cp(e){if(!e||typeof e!=`object`)return;let t=e,n=Array.isArray(t.tabs)?t.tabs.filter(sp):[],r=[];for(let e of n){if(e.kind===`file`){if(!e.projectId||!e.path)continue;$r.fileViews[Jr(e.id)]={id:e.id,projectId:e.projectId,path:e.path,line:e.line,displayMode:e.displayMode,wrapLines:e.wrapLines,loading:!1}}else if(e.kind===`pr`){if(!e.projectId||!e.repo||typeof e.number!=`number`)continue;tr.prViews[qr(e.id)]={id:e.id,projectId:e.projectId,repo:e.repo,number:e.number,core:{loading:!1,refreshing:!1},conversation:{loading:!1,refreshing:!1},overview:{loading:!1,refreshing:!1},commits:{loading:!1,refreshing:!1},checks:{loading:!1,refreshing:!1},files:{loading:!1,refreshing:!1},fileDiffs:{},activeTab:`conversation`,refreshing:!1,merging:!1}}else if(e.kind===`diff`){if(!e.projectId||!e.repo||!e.path||e.area!==`staged`&&e.area!==`unstaged`)continue;tr.diffViews[Zr(e.id)]={id:e.id,projectId:e.projectId,repo:e.repo,path:e.path,renamedFrom:e.renamedFrom,area:e.area,loading:!1,refreshing:!1}}r.push({kind:e.kind,id:e.id})}return Zf({tabs:r,active:sp(t.active)?t.active:void 0,mru:Array.isArray(t.mru)?t.mru.filter(e=>typeof e==`string`):[]})}function lp(){if(!(typeof localStorage>`u`))try{return JSON.parse(localStorage.getItem(Vf)??`null`)}catch{return}}function up(e,t){if(typeof localStorage>`u`)return{};try{let n=JSON.parse(localStorage.getItem(Hf)??`null`),r=Array.isArray(n?.tabIds)?n.tabIds.filter(e=>typeof e==`string`):[],i={};for(let a of r){let r=t.find(e=>e.id===a),o=r&&e.find(e=>e.id===r.projectId);if(!o)continue;let s=cr(o);i[s]??={tabs:[],mru:[]};let c={kind:`conversation`,id:a};i[s].tabs.push(c),i[s].mru.push(qf(c)),n?.activeId===a&&(i[s].active=c)}return i}catch{return{}}}function dp(e,t={}){if(Kf)return;Kf=!0;let n=new Set(e.projects.map(cr)),r=new Set(e.conversations.map(e=>e.id)),i=new Set(e.tasks.map(e=>e.definitionId??e.restartRootTaskId??e.id)),a=lp(),o=a?.sessions??up(e.projects,e.conversations),s={};for(let[e,t]of Object.entries(o).slice(0,Uf)){if(!n.has(e))continue;let a=cp(t);a&&(a.tabs=a.tabs.filter(e=>e.kind===`pending-conversation`?!1:e.kind===`file`?!!$r.fileViews[Jr(e.id)]:e.kind===`pr`?!!tr.prViews[qr(e.id)]:e.kind===`diff`?!!tr.diffViews[Zr(e.id)]:e.kind===`conversation`?r.has(e.id):e.kind===`task`?i.has(e.id):!0),s[e]=Zf(a))}Q.projectTabSessions=s,Q.globalCenterTabs=(a?.globals??[]).filter(sp).filter(Yf);let c;return a?.selectedProjectKey||(Q.openCenterTabs=[...Q.globalCenterTabs],c=Q.globalCenterTabs[0],Q.activeCenterTab=t.deferActivation?void 0:c,Q.centerTabMru=Q.globalCenterTabs.map(qf),Lf()),Q.projectRecency=a?.projectRecency??{},Q.selectedProjectKey=a?.selectedProjectKey&&n.has(a.selectedProjectKey)?a.selectedProjectKey:void 0,typeof localStorage<`u`&&!a&&localStorage.removeItem(Hf),c}function fp(){if(typeof localStorage>`u`)return;let e=Object.fromEntries(Object.entries(Q.projectTabSessions).slice(0,Uf).map(([e,t])=>{let n=t.tabs.flatMap(e=>{if(e.kind===`pending-conversation`)return[];if(e.kind===`file`){let t=$r.fileViews[Jr(e.id)];return t?[{...e,projectId:t.projectId,path:t.path,line:t.line,displayMode:t.displayMode,wrapLines:t.wrapLines}]:[]}if(e.kind===`pr`){let t=tr.prViews[qr(e.id)];return t?[{...e,projectId:t.projectId,repo:t.repo,number:t.number}]:[]}if(e.kind===`diff`){let t=tr.diffViews[Zr(e.id)];return t?[{...e,projectId:t.projectId,repo:t.repo,path:t.path,renamedFrom:t.renamedFrom,area:t.area}]:[]}return[e]}),r=new Set(n.map(qf));return[e,{tabs:n,active:t.active&&r.has(qf(t.active))?t.active:void 0,mru:t.mru.filter(e=>r.has(e))}]})),t={selectedProjectKey:Q.selectedProjectKey,projectRecency:Q.projectRecency,sessions:e,globals:Q.globalCenterTabs};localStorage.setItem(Vf,JSON.stringify(t))}function pp(e){return`${e.kind}:${e.id}`}function mp(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}var hp,gp;function _p(e){hp=e.select,gp=e.close}function vp(e,t){return e?.[t.kind]}function yp(e,t){let n=t instanceof Error?t.message:String(t);Q.error=n,Kn.error(`Could not ${e} pane`,{description:n})}function bp(){return{openTabs:Q.openCenterTabs.map(e=>({...e})),activeTab:Q.activeCenterTab?{...Q.activeCenterTab}:void 0}}function xp(e){Sp(e.openTabs),Op(e.activeTab)}function Sp(e){let t=new ye;Q.openCenterTabs=e.filter(e=>{let n=pp(e);return t.has(n)?!1:(t.add(n),!0)}),Lf(),np()}function Cp(e){Q.openCenterTabs.some(t=>mp(t,e))||(Q.openCenterTabs=[...Q.openCenterTabs,e],Lf())}function wp(e,t){Sp(Q.openCenterTabs.map(n=>mp(n,e)?t:n)),mp(Q.activeCenterTab,e)&&Op(t)}function Tp(e){return ip(e)}function Ep(e){Yf(e)&&rp(e),Sp(Q.openCenterTabs.filter(t=>!mp(t,e)))}function Dp(e,t){ap(e,t),Lf()}function Op(e){e&&Cp(e),Q.activeCenterTab=e,e?tp(e):np()}function kp(e){return Q.openCenterTabs.find(t=>!e||!mp(t,e))}async function Ap(e){if(!e){Op(void 0);return}try{let t=vp(hp,e);if(!t)throw Error(`No select handler for ${e.kind} panes`);await t(e)}catch(e){yp(`switch`,e)}}async function jp(e){try{let t=vp(gp,e);if(!t)throw Error(`No close handler for ${e.kind} panes`);await t(e)}catch(e){yp(`close`,e)}}function Mp(){Op(kp())}var Np=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pp(e,t){let n=H(t,Np),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}]];P(e,B({name:`file`},()=>n,{get iconNode(){return r}}))}var Fp=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Bp(e.state,n.from);return r.line?Lp(e):r.block?zp(e):!1};function Ip(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Lp=Ip(Gp,0),Rp=Ip(Wp,0),zp=Ip((e,t)=>Wp(e,t,Up(t)),0);function Bp(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var Vp=50;function Hp(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-Vp,r),o=e.sliceDoc(i,i+Vp),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*Vp?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+Vp),d=e.sliceDoc(i-Vp,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Up(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function Wp(e,t,n=t.selection.ranges){let r=n.map(e=>Bp(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>Hp(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Gp(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Bp(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Kp=Di.define(),qp=Di.define(),Jp=wi.define(),Yp=wi.define({combine(e){return Bee(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Xp=xi.define({create(){return hm.empty},update(e,t){let n=t.state.facet(Yp),r=t.annotation(Kp);if(r){let i=rm.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?im(o,o.length,n.minDepth,i):um(o,t.startState.selection),new hm(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(qp);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(ji.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=rm.fromTransaction(t),o=t.annotation(ji.time),s=t.annotation(ji.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new hm(e.done.map(rm.fromJSON),e.undone.map(rm.fromJSON))}});function Zp(e={}){return[Xp,Yp.of(e),hi.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?$p:e.inputType==`historyRedo`?em:null;return n?(e.preventDefault(),n(t)):!1}})]}function Qp(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Xp,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var $p=Qp(0,!1),em=Qp(1,!1),tm=Qp(0,!0),nm=Qp(1,!0),rm=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&vi.fromJSON(t.changes),[],t.mapped&&Ci.fromJSON(t.mapped),t.startSelection&&Oi.fromJSON(t.startSelection),t.selectionsAfter.map(Oi.fromJSON))}static fromTransaction(t,n){let r=cm;for(let e of t.startState.facet(Jp)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,cm)}static selection(t){return new e(void 0,cm,void 0,void 0,t)}};function im(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function am(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function om(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function sm(e,t){return e.length?t.length?e.concat(t):e:t}var cm=[],lm=200;function um(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-lm));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),im(e,e.length-1,1e9,n.setSelAfter(r)))}else return[rm.selection([t])]}function dm(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function fm(e,t){if(!e.length)return e;let n=e.length,r=cm;for(;n;){let i=pm(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[rm.selection(r)]:cm}function pm(e,t,n){let r=sm(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):cm,n);if(!e.changes)return rm.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new rm(i,Si.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var mm=/^(input\.type|delete)($|\.)/,hm=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||mm.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,am(s.changes,t.changes))||r==`input.type.compose`)?im(o,o.length-1,i.minDepth,new rm(t.changes.compose(s.changes),sm(Si.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,cm)):im(o,o.length,i.minDepth,t),new e(o,cm,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:cm;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&om(a[a.length-1],t)?this:new e(um(this.done,t),this.undone,n,r)}addMapping(t){return new e(fm(this.done,t),fm(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Kp.of({side:e,rest:dm(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?cm:r.slice(0,r.length-1);return i.mapped&&(n=fm(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Kp.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};hm.empty=new hm(cm,cm);var gm=[{key:`Mod-z`,run:$p,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:em,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:em,preventDefault:!0},{key:`Mod-u`,run:tm,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:nm,preventDefault:!0}];function _m(e,t){return Oi.create(e.ranges.map(t),e.mainIndex)}function vm(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function ym({state:e,dispatch:t},n){let r=_m(e.selection,n);return r.eq(e.selection,!0)?!1:(t(vm(e,r)),!0)}function bm(e,t){return Oi.cursor(t?e.to:e.from)}function xm(e,t){return ym(e,n=>n.empty?e.moveByChar(n,t):bm(n,t))}function Sm(e){return e.textDirectionAt(e.state.selection.main.head)==mi.LTR}var Cm=e=>xm(e,!Sm(e)),wm=e=>xm(e,Sm(e));function Tm(e,t){return ym(e,n=>n.empty?e.moveByGroup(n,t):bm(n,t))}var Em=e=>Tm(e,!Sm(e)),Dm=e=>Tm(e,Sm(e));typeof Intl<`u`&&Intl.Segmenter;function Om(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function km(e,t,n){let r=li(e).resolveInner(t.head),i=n?oi.closedBy:oi.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Om(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?pi(e,r.from,1):pi(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,Oi.cursor(s,n?-1:1)}var Am=e=>ym(e,t=>km(e.state,t,!Sm(e))),jm=e=>ym(e,t=>km(e.state,t,Sm(e)));function Mm(e,t){return ym(e,n=>{if(!n.empty)return bm(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Nm=e=>Mm(e,!1),Pm=e=>Mm(e,!0);function Fm(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(hi.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Im(e,t){let n=Fm(e),{state:r}=e,i=_m(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):bm(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=hi.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(vm(r,i),{effects:a}),!0}var Lm=e=>Im(e,!1),Rm=e=>Im(e,!0);function zm(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=Oi.cursor(r.from+n))}return i}var Bm=e=>ym(e,t=>zm(e,t,!0)),Vm=e=>ym(e,t=>zm(e,t,!1)),Hm=e=>ym(e,t=>zm(e,t,!Sm(e))),Um=e=>ym(e,t=>zm(e,t,Sm(e))),Wm=e=>ym(e,t=>Oi.cursor(e.lineBlockAt(t.head).from,1)),Gm=e=>ym(e,t=>Oi.cursor(e.lineBlockAt(t.head).to,-1));function Km(e,t,n){let r=!1,i=_m(e.selection,t=>{let i=pi(e,t.head,-1)||pi(e,t.head,1)||t.head>0&&pi(e,t.head-1,1)||t.head<e.doc.length&&pi(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?Oi.range(t.anchor,a):Oi.cursor(a)});return r?(t(vm(e,i)),!0):!1}var qm=({state:e,dispatch:t})=>Km(e,t,!1);function Jm(e,t){let n=_m(e.state.selection,e=>{let n=t(e);return Oi.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(vm(e.state,n)),!0)}function Ym(e,t){return Jm(e,n=>e.moveByChar(n,t))}var Xm=e=>Ym(e,!Sm(e)),Zm=e=>Ym(e,Sm(e));function Qm(e,t){return Jm(e,n=>e.moveByGroup(n,t))}var $m=e=>Qm(e,!Sm(e)),eh=e=>Qm(e,Sm(e)),th=e=>Jm(e,t=>km(e.state,t,!Sm(e))),nh=e=>Jm(e,t=>km(e.state,t,Sm(e)));function rh(e,t){return Jm(e,n=>e.moveVertically(n,t))}var ih=e=>rh(e,!1),ah=e=>rh(e,!0);function oh(e,t){return Jm(e,n=>e.moveVertically(n,t,Fm(e).height))}var sh=e=>oh(e,!1),ch=e=>oh(e,!0),lh=e=>Jm(e,t=>zm(e,t,!0)),uh=e=>Jm(e,t=>zm(e,t,!1)),dh=e=>Jm(e,t=>zm(e,t,!Sm(e))),fh=e=>Jm(e,t=>zm(e,t,Sm(e))),ph=e=>Jm(e,t=>Oi.cursor(e.lineBlockAt(t.head).from)),mh=e=>Jm(e,t=>Oi.cursor(e.lineBlockAt(t.head).to)),hh=({state:e,dispatch:t})=>(t(vm(e,{anchor:0})),!0),gh=({state:e,dispatch:t})=>(t(vm(e,{anchor:e.doc.length})),!0),_h=({state:e,dispatch:t})=>(t(vm(e,{anchor:e.selection.main.anchor,head:0})),!0),vh=({state:e,dispatch:t})=>(t(vm(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),yh=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),bh=({state:e,dispatch:t})=>{let n=zh(e).map(({from:t,to:n})=>Oi.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Oi.create(n),userEvent:`select`})),!0},xh=({state:e,dispatch:t})=>{let n=_m(e.selection,t=>{let n=li(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Oi.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(vm(e,n)),!0)};function Sh(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(vm(n,Oi.create(i,i.length-1))),!0)}var Ch=e=>Sh(e,!1),wh=e=>Sh(e,!0),Th=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Oi.create([n.main]):n.main.empty||(r=Oi.create([Oi.cursor(n.main.head)])),r?(t(vm(e,r)),!0):!1};function Eh(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Dh(e,o,!1)):o>i&&(n=`delete.forward`,o=Dh(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Dh(e,i,!1),a=Dh(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:Oi.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?hi.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Dh(e,t,n){if(e instanceof hi)for(let r of e.state.facet(hi.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Oh=(e,t,n)=>Eh(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=fi(s,a.tabSize)%gi(a)||gi(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=ai(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=ai(o.text,c-o.from,!1,!1)+o.from);return c}),kh=e=>Oh(e,!1,!0),Ah=e=>Oh(e,!0,!1),jh=(e,t)=>Eh(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=ai(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Mh=e=>jh(e,!1),Nh=e=>jh(e,!0),Ph=e=>Eh(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Fh=e=>Eh(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Ih=e=>Eh(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Lh=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:_i.of([``,``])},range:Oi.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Rh=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:ai(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:ai(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:Oi.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function zh(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Bh(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of zh(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(Oi.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(Oi.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Oi.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Vh=({state:e,dispatch:t})=>Bh(e,t,!1),Hh=({state:e,dispatch:t})=>Bh(e,t,!0);function Uh(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of zh(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Wh=({state:e,dispatch:t})=>Uh(e,t,!1),Gh=({state:e,dispatch:t})=>Uh(e,t,!0),Kh=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(zh(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=_m(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function qh(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=li(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(oi.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Jh=Xh(!1),Yh=Xh(!0);function Xh(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&qh(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Ti(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Ai(s,r);for(c??=fi(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,Mi(t,c)];return o&&l.push(Mi(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:_i.of(l)},range:Oi.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Zh(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:Oi.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Qh=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ti(e,{overrideIndentation:e=>n[e]??-1}),i=Zh(e,(t,i,a)=>{let o=Ai(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=Mi(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},$h=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Zh(e,(t,n)=>{n.push({from:t.from,insert:e.facet(di)})}),{userEvent:`input.indent`})),!0),eg=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Zh(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=fi(r,e.tabSize),a=0,o=Mi(e,Math.max(0,i-gi(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),tg=e=>(e.setTabFocusMode(),!0),ng=[{key:`Ctrl-b`,run:Cm,shift:Xm,preventDefault:!0},{key:`Ctrl-f`,run:wm,shift:Zm},{key:`Ctrl-p`,run:Nm,shift:ih},{key:`Ctrl-n`,run:Pm,shift:ah},{key:`Ctrl-a`,run:Wm,shift:ph},{key:`Ctrl-e`,run:Gm,shift:mh},{key:`Ctrl-d`,run:Ah},{key:`Ctrl-h`,run:kh},{key:`Ctrl-k`,run:Ph},{key:`Ctrl-Alt-h`,run:Mh},{key:`Ctrl-o`,run:Lh},{key:`Ctrl-t`,run:Rh},{key:`Ctrl-v`,run:Rm}],rg=[{key:`ArrowLeft`,run:Cm,shift:Xm,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Em,shift:$m,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Hm,shift:dh,preventDefault:!0},{key:`ArrowRight`,run:wm,shift:Zm,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Dm,shift:eh,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Um,shift:fh,preventDefault:!0},{key:`ArrowUp`,run:Nm,shift:ih,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:hh,shift:_h},{mac:`Ctrl-ArrowUp`,run:Lm,shift:sh},{key:`ArrowDown`,run:Pm,shift:ah,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:gh,shift:vh},{mac:`Ctrl-ArrowDown`,run:Rm,shift:ch},{key:`PageUp`,run:Lm,shift:sh},{key:`PageDown`,run:Rm,shift:ch},{key:`Home`,run:Vm,shift:uh,preventDefault:!0},{key:`Mod-Home`,run:hh,shift:_h},{key:`End`,run:Bm,shift:lh,preventDefault:!0},{key:`Mod-End`,run:gh,shift:vh},{key:`Enter`,run:Jh,shift:Jh},{key:`Mod-a`,run:yh},{key:`Backspace`,run:kh,shift:kh,preventDefault:!0},{key:`Delete`,run:Ah,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Mh,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Nh,preventDefault:!0},{mac:`Mod-Backspace`,run:Fh,preventDefault:!0},{mac:`Mod-Delete`,run:Ih,preventDefault:!0}].concat(ng.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),ig=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Am,shift:th},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:jm,shift:nh},{key:`Alt-ArrowUp`,run:Vh},{key:`Shift-Alt-ArrowUp`,run:Wh},{key:`Alt-ArrowDown`,run:Hh},{key:`Shift-Alt-ArrowDown`,run:Gh},{key:`Mod-Alt-ArrowUp`,run:Ch},{key:`Mod-Alt-ArrowDown`,run:wh},{key:`Escape`,run:Th},{key:`Mod-Enter`,run:Yh},{key:`Alt-l`,mac:`Ctrl-l`,run:bh},{key:`Mod-i`,run:xh,preventDefault:!0},{key:`Mod-[`,run:eg},{key:`Mod-]`,run:$h},{key:`Mod-Alt-\\`,run:Qh},{key:`Shift-Mod-k`,run:Kh},{key:`Shift-Mod-\\`,run:qm},{key:`Mod-/`,run:Fp},{key:`Alt-A`,run:Rp},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:tg}].concat(rg),ag={key:`Tab`,run:$h,shift:eg},og=h(`<div class="pointer-events-none absolute inset-0 z-10 flex items-center justify-center gap-2 rounded-md border border-primary bg-background/95 px-4 text-sm font-medium text-foreground shadow-sm" aria-hidden="true"><!> <span>Drop files or folders to add their paths</span></div>`),sg=h(`<div role="group"><div></div> <!></div>`);function cg(e,t){a(t,!0);let n={name:`Commands`,rank:0},r={name:`Project references`,rank:10},i=I(t,`placeholder`,3,`Ask the Nerve agent`),o=I(t,`ariaLabel`,3,`Prompt editor drop area`),c=I(t,`disabled`,3,!1),l=I(t,`focusToken`,3,0),u=I(t,`slashCompletions`,19,()=>[]),f,p,m=Y(``),h=0,_=0,v=Y(!1),y=new Ei,b=new Ei,x=new Ei,S=J(()=>u().length>0||!!t.fileCompletions);function C(e){return[yi.readOnly.of(e),hi.editable.of(!e)]}function T(e){return e.kind===`directory`||e.kind===`file`?r:n}function E(e){if(e.sortScore!==void 0)return Math.max(-99,Math.min(99,Math.round(e.sortScore/160)))}function D(e){return{label:e.label,displayLabel:e.displayLabel,detail:e.detail,info:e.info,type:e.kind===`directory`?`folder`:e.kind===`file`?`file`:`keyword`,apply:e.apply??e.label,boost:E(e),section:T(e),matchRanges:e.matchRanges?.flatMap(([e,t])=>[e,t]),nerveKind:e.kind}}function O(e){return e.matchRanges??[]}function ee(e){return`nerve-completion-option nerve-completion-${e.nerveKind??`slash`}`}let te=`http://www.w3.org/2000/svg`,A={file:[`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,`M14 2v5a1 1 0 0 0 1 1h5`],folder:[`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`]};function ne(e,t=14){let n=document.createElementNS(te,`svg`);n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-width`,`2`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`aria-hidden`,`true`);for(let t of A[e]){let e=document.createElementNS(te,`path`);e.setAttribute(`d`,t),n.appendChild(e)}return n}function j(e,t,n){let r=0;for(let[i,a]of n){i>r&&e.appendChild(document.createTextNode(t.slice(r,i)));let n=document.createElement(`span`);n.className=`cm-nerve-match`,n.textContent=t.slice(i,a),e.appendChild(n),r=a}r<t.length&&e.appendChild(document.createTextNode(t.slice(r)))}function M(e){let t=e.nerveKind,n=e.matchRanges??[],r=document.createElement(`span`);r.className=`cm-nerve-row`;let i=document.createElement(`span`);i.className=`cm-nerve-row-icon`,i.appendChild(ne(t===`directory`?`folder`:`file`)),r.appendChild(i);let a=document.createElement(`span`);if(a.className=`cm-nerve-row-main`,t===`file`||t===`directory`){let r=e.label??``,i=e.info,o=typeof i==`string`?i:r.replace(/^@/,``),s=t===`directory`,c=s?o.replace(/\/+$/,``):o,l=c.lastIndexOf(`/`)+1,u=c.slice(0,l),d=c.slice(l)+(s?`/`:``),f=[];for(let e=0;e+1<n.length;e+=2){let t=Math.max(0,n[e]-1),r=Math.min(c.length,n[e+1]-1);r>t&&f.push([t,r])}if(u){let e=document.createElement(`span`);e.className=`cm-nerve-row-dir`,e.textContent=`‎`,j(e,u,f.filter(([e])=>e<l).map(([e,t])=>[e,Math.min(t,l)])),a.appendChild(e)}let p=document.createElement(`span`);p.className=`cm-nerve-row-name`,j(p,d,f.filter(([,e])=>e>l).map(([e,t])=>[Math.max(e,l)-l,t-l])),a.appendChild(p)}else{let t=document.createElement(`span`);t.className=`cm-nerve-row-name`,t.textContent=e.label??``,a.appendChild(t)}return r.appendChild(a),r}async function re(e){let n=e.matchBefore(/(?:^|\s)([/@][^\s]*)/);if(!n&&!e.explicit)return null;let r=n?.text.trimStart()??``,i=n?n.to-r.length:e.pos;if(r.startsWith(`/`))return{from:i,options:u().filter(e=>e.label.startsWith(r)||e.label.includes(r.slice(1))).slice(0,8).map(D),validFor:/^\/[\w-]*$/};if(r.startsWith(`@`)){e.addEventListener(`abort`,()=>void 0,{onDocChange:!0});let n=r.slice(1),a=(await t.fileCompletions?.(n)??[]).slice(0,8).reverse().map(D);return e.aborted?null:{from:i,options:a,filter:!1,getMatch:O}}return e.explicit?{from:e.pos,options:u().slice(0,8).map(D)}:null}function N(e){let t=[],n=si.line({class:`cm-executable-command-block-line`}),r=si.mark({class:`cm-executable-command-block-command`});for(let i of Ur(e.doc.toString())){let a=i.start;for(;a<i.end;){let r=e.doc.lineAt(a);if(t.push(n.range(r.from)),r.to>=i.end)break;a=r.to+1}i.commandEnd>i.commandStart&&t.push(r.range(i.commandStart,i.commandEnd))}return si.set(t.sort((e,t)=>e.from-t.from||e.to-t.to),!0)}let P=ci.fromClass(class{lastOptions;update(e){if(Ni(e.state)!==`active`){this.lastOptions=void 0;return}let t=Pi(e.state);!t.some(e=>{let t=e.nerveKind;return t===`file`||t===`directory`})||t===this.lastOptions||(this.lastOptions=t,queueMicrotask(()=>{if(!p||Ni(p.state)!==`active`||Pi(p.state)!==t)return;let e=t.length-1;e<0||Hee(p.state)===e||p.dispatch({effects:Gee(e)})}))}}),ie=ci.fromClass(class{decorations;constructor(e){this.decorations=N(e.state)}update(e){e.docChanged&&(this.decorations=N(e.state))}},{decorations:e=>e.decorations});function ae(){return W(S)?Wee({override:[re],icons:!1,aboveCursor:!0,maxRenderedOptions:8,tooltipClass:()=>`nerve-composer-completions`,optionClass:ee,addToOptions:[{render:M,position:20}]}):[]}function oe(){return c()?!1:(t.onSubmit?.(),!0)}function se(e){return Ni(e.state)===`active`?!1:oe()}function le(e){return Ni(e.state)===`active`?Uee(e):!1}function de(e,t,n){if(!p||!e)return;let r=p.state.selection.main,i=p.state.doc.length,a=Math.min(t??r.from,i),o=Math.min(n??r.to,i);p.dispatch({changes:{from:a,to:o,insert:e},selection:{anchor:a+e.length},scrollIntoView:!0}),p.focus()}function pe(e,t){if(!p||e.length===0)return;let n=p.state.doc,r=Math.min(t.from,n.length),i=Math.min(t.to,n.length),a=r>0?n.sliceString(r-1,r):``,o=i<n.length?n.sliceString(i,i+1):``,s=a&&!/\s/.test(a)?` `:``,c=o&&!/\s/.test(o)?` `:``;de(`${s}${e.join(` `)}${c}`,r,i)}function R(e){return e?Array.from(e.items).some(e=>e.kind===`file`)||Array.from(e.types).includes(`Files`):!1}function me(e){return!!(!c()&&t.onDropFiles&&R(e.dataTransfer))}function he(e){me(e)&&(e.preventDefault(),e.stopPropagation(),_+=1,K(v,!0))}function ge(e){me(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))}function _e(e){W(v)&&(e.preventDefault(),e.stopPropagation(),_=Math.max(0,_-1),_===0&&K(v,!1))}function ve(e){if(!me(e)||!t.onDropFiles||!p)return;e.preventDefault(),e.stopPropagation(),_=0,K(v,!1);let n=Array.from(e.dataTransfer?.files??[]);if(n.length===0)return;let{from:r,to:i}=p.state.selection.main;t.onDropFiles(n).then(e=>pe(e,{from:r,to:i})).catch(e=>{console.error(`Failed to resolve dropped file paths`,e)})}function ye(e){if(c()||!t.onPasteImage)return!1;let n=Array.from(e.clipboardData?.files??[]).filter(e=>e.type.startsWith(`image/`));return n.length?(e.preventDefault(),Promise.all(n.map(e=>t.onPasteImage(e))).then(e=>de(e.join(`
14
+ `))).catch(e=>{console.error(`Failed to paste clipboard image`,e)}),!0):!1}ce(()=>{K(m,t.value,!0),p=new hi({parent:f,state:yi.create({doc:t.value,extensions:[Zp(),Kee(),x.of(ki(i())),y.of(C(c())),b.of(ae()),ie,P,bi.highest(ui.of([{key:`Enter`,run:se},{key:`Tab`,run:le},{key:`Escape`,run:Vee},{key:`Mod-Enter`,run:oe},{key:`Ctrl-Enter`,run:oe},ag])),ui.of([...ig,...gm]),hi.lineWrapping,hi.domEventHandlers({paste:ye}),hi.updateListener.of(e=>{e.docChanged&&(K(m,e.state.doc.toString(),!0),t.onChange?.(W(m)))}),hi.theme({"&":{background:`transparent`,color:`var(--foreground)`,maxHeight:`min(40vh, 320px)`},".cm-content":{caretColor:`var(--primary)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,lineHeight:`1.5`,padding:`18px 46px 14px 11px`},".cm-line":{padding:`0 2px`},".cm-cursor":{borderLeftColor:`var(--primary)`},".cm-placeholder":{color:`color-mix(in oklab, var(--muted-foreground) 75%, transparent)`},".cm-executable-command-block-line":{backgroundColor:`color-mix(in oklab, var(--info) 9%, transparent)`},".cm-executable-command-block-command":{backgroundColor:`color-mix(in oklab, var(--info) 16%, transparent)`,color:`var(--foreground)`,borderRadius:`var(--radius-sm)`},".cm-scroller":{minHeight:`92px`,maxHeight:`min(40vh, 320px)`,overflow:`auto`},".cm-tooltip":{border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,background:`var(--popover)`,color:`var(--popover-foreground)`,boxShadow:`var(--shadow-lg)`,overflow:`hidden`},".cm-tooltip-autocomplete.nerve-composer-completions":{minWidth:`min(24rem, calc(100vw - 2rem))`,maxWidth:`min(34rem, calc(100vw - 2rem))`,padding:`0.15rem`},".cm-tooltip-autocomplete.nerve-composer-completions > ul":{maxHeight:`none`,overflow:`hidden`,padding:`0.1rem`,fontFamily:`var(--font-mono)`},".cm-tooltip-autocomplete.nerve-composer-completions > ul > completion-section":{borderBottom:`0`,color:`var(--muted-foreground)`,fontFamily:`var(--font-sans)`,fontSize:`var(--text-xs)`,fontWeight:`500`,letterSpacing:`0.02em`,padding:`0.25rem 0.4rem 0.15rem`,textTransform:`uppercase`},".cm-tooltip-autocomplete.nerve-composer-completions > ul > li":{display:`flex`,alignItems:`center`,minHeight:`1.55rem`,borderRadius:`var(--radius-sm)`,padding:`0.18rem 0.4rem`,color:`var(--popover-foreground)`},".cm-tooltip-autocomplete.nerve-composer-completions > ul > li[aria-selected]":{background:`var(--accent)`,color:`var(--accent-foreground)`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-completionLabel":{display:`none`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-completionDetail":{display:`none`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-nerve-row":{display:`flex`,alignItems:`center`,gap:`0.4rem`,minWidth:`0`,width:`100%`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-nerve-row-icon":{display:`inline-flex`,flexShrink:`0`,alignItems:`center`,color:`var(--muted-foreground)`},".cm-tooltip-autocomplete.nerve-composer-completions .nerve-completion-directory .cm-nerve-row-icon":{color:`var(--info)`},".cm-tooltip-autocomplete.nerve-composer-completions .nerve-completion-file .cm-nerve-row-icon":{color:`var(--success)`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-nerve-row-main":{display:`flex`,alignItems:`baseline`,gap:`0.3rem`,flex:`1`,minWidth:`0`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-nerve-row-dir":{flexShrink:`1`,minWidth:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,direction:`rtl`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-xs)`,color:`var(--muted-foreground)`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-nerve-row-name":{flexShrink:`0`,whiteSpace:`nowrap`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:`500`,color:`var(--popover-foreground)`},".cm-tooltip-autocomplete.nerve-composer-completions .cm-nerve-match":{color:`var(--primary)`,fontWeight:`600`},".cm-tooltip.cm-completionInfo":{maxWidth:`min(30rem, calc(100vw - 2rem))`,padding:`0.55rem 0.7rem`,color:`var(--popover-foreground)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-xs)`},"&.cm-focused":{outline:`none`},"&.cm-focused .cm-cursor":{borderLeftColor:`var(--primary)`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`color-mix(in oklab, var(--primary) 22%, transparent)`}})]})})}),be(()=>{p&&(p.dispatch({effects:y.reconfigure(C(c()))}),c()&&(_=0,K(v,!1)))}),be(()=>{p&&(u(),t.fileCompletions,p.dispatch({effects:b.reconfigure(ae())}))}),be(()=>{p&&p.dispatch({effects:x.reconfigure(ki(i()))})}),be(()=>{!p||c()||l()===h||(h=l(),p.focus())}),be(()=>{!p||t.value===W(m)||(p.dispatch({changes:{from:0,to:p.state.doc.length,insert:t.value}}),K(m,t.value,!0))}),ke(()=>p?.destroy());var B=sg();let xe;var Se=V(B);fe(Se,e=>f=e,()=>f);var Ce=L(Se,2),we=e=>{var t=og();Pp(V(t),{class:`size-4 text-primary`}),w(2),d(t),g(e,t)};k(Ce,e=>{W(v)&&e(we)}),d(B),F(()=>{xe=s(B,1,`composer-editor relative svelte-18og541`,null,xe,{disabled:c()}),q(B,`aria-label`,o())}),ue(`dragenter`,B,he,!0),ue(`dragover`,B,ge,!0),ue(`dragleave`,B,_e,!0),ue(`drop`,B,ve,!0),g(e,B),z()}var lg=new Set([`$$slots`,`$$events`,`$$legacy`]);function ug(e,t){let n=H(t,lg),r=[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`}],[`path`,{d:`m21.854 2.147-10.94 10.939`}]];P(e,B({name:`send`},()=>n,{get iconNode(){return r}}))}var dg=new Set([`$$slots`,`$$events`,`$$legacy`]);function fg(e,t){let n=H(t,dg),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];P(e,B({name:`square`},()=>n,{get iconNode(){return r}}))}var pg=h(`<form class="composer svelte-dbq0fc" data-tour-id="composer"><!> <div class="composer-surface svelte-dbq0fc"><div class="editor-shell svelte-dbq0fc"><!> <!> <div class="composer-send svelte-dbq0fc" data-tour-id="composer-send-actions"><!> <!> <!></div></div></div></form>`);function mg(e,t){a(t,!0);let n=I(t,`commandMode`,3,!1),r=I(t,`executableBlocks`,3,!1),i=I(t,`pendingApproval`,3,!1),o=I(t,`pendingQuestion`,3,!1),s=I(t,`pendingPlan`,3,!1),c=I(t,`showStop`,3,!1),l=I(t,`stopping`,3,!1),f=I(t,`stopDisabled`,3,!1),p=I(t,`stopAriaLabel`,3,`Stop generation`),m=I(t,`stopTitle`,3,`Stop generation`);var h=pg(),_=V(h),v=e=>{var n=U();u(R(n),()=>t.header),g(e,n)};k(_,e=>{t.header&&e(v)});var y=L(_,2),b=V(y),x=V(b);u(x,()=>t.toolbar);var S=L(x,2);u(S,()=>t.editor);var C=L(S,2),w=V(C),T=e=>{var n=U();u(R(n),()=>t.sendLeading),g(e,n)};k(w,e=>{t.sendLeading&&e(T)});var E=L(w,2),D=e=>{{let n=J(()=>f()||l()),r=J(()=>l()?`Stopping generation`:p()),i=J(()=>l()?`Stopping generation`:m());G(e,{variant:`destructive`,size:`icon-sm`,class:`rounded-full`,type:`button`,get disabled(){return W(n)},get onclick(){return t.onAbort},get"aria-label"(){return W(r)},get"aria-keyshortcuts"(){return t.stopShortcutAria},get title(){return W(i)},children:(e,t)=>{var n=U(),r=R(n),i=e=>{Fi(e,{class:`size-3.5`})},a=e=>{fg(e,{size:13,strokeWidth:2.5})};k(r,e=>{l()?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}};k(E,e=>{c()&&e(D)}),G(L(E,2),{size:`icon-sm`,class:`rounded-full inset-ring-1 inset-ring-primary-foreground/18`,type:`submit`,get disabled(){return t.submitDisabled},get"aria-label"(){return t.sendAriaLabel},get title(){return t.sendTitle},children:(e,t)=>{ug(e,{size:14,strokeWidth:2.4})},$$slots:{default:!0}}),d(C),d(b),d(y),d(h),F(()=>{q(h,`data-pending-approval`,i()?`true`:void 0),q(h,`data-pending-question`,o()?`true`:void 0),q(h,`data-pending-plan`,s()?`true`:void 0),q(y,`data-mode`,t.mode),q(y,`data-command-mode`,n()?`true`:void 0),q(y,`data-executable-blocks`,r()?`true`:void 0)}),ue(`submit`,h,e=>{e.preventDefault(),t.onSubmit()}),g(e,h),z()}var hg=new Set([`$$slots`,`$$events`,`$$legacy`]);function gg(e,t){let n=H(t,hg),r=[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}],[`path`,{d:`M12 11h4`}],[`path`,{d:`M12 16h4`}],[`path`,{d:`M8 11h.01`}],[`path`,{d:`M8 16h.01`}]];P(e,B({name:`clipboard-list`},()=>n,{get iconNode(){return r}}))}var _g=new Set([`$$slots`,`$$events`,`$$legacy`]);function vg(e,t){let n=H(t,_g),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];P(e,B({name:`lock`},()=>n,{get iconNode(){return r}}))}var yg=new Set([`$$slots`,`$$events`,`$$legacy`]);function bg(e,t){let n=H(t,yg),r=[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}]];P(e,B({name:`shield`},()=>n,{get iconNode(){return r}}))}var xg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sg(e,t){let n=H(t,xg),r=[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`}]];P(e,B({name:`zap`},()=>n,{get iconNode(){return r}}))}var Cg=h(`<!> <!>`,1);function wg(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`class`,3,``),i=I(t,`triggerClass`,3,``),o=I(t,`size`,3,`xl`),s=I(t,`side`,3,`bottom`),c=I(t,`align`,3,`end`),l=I(t,`sideOffset`,3,7),d=I(t,`collisionPadding`,3,8),f=I(t,`trapFocus`,3,!0);function p(e){n(e),t.onOpenChange?.(e)}var m=U();C(R(m),()=>Xs,(e,a)=>{a(e,{onOpenChange:p,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=Cg(),p=R(a);{let e=J(()=>me(`popover-trigger`,i()));C(p,()=>Ds,(n,r)=>{r(n,{get class(){return W(e)},get"aria-label"(){return t.ariaLabel},get title(){return t.triggerTitle},get"aria-keyshortcuts"(){return t.triggerAriaKeyShortcuts},children:(e,n)=>{var r=U();u(R(r),()=>t.trigger??D),g(e,r)},$$slots:{default:!0}})})}C(L(p,2),()=>Ue,(e,n)=>{n(e,{children:(e,n)=>{var i=U(),a=R(i);{let e=J(()=>me(`popover-content`,`popover-${o()}`,r()));C(a,()=>ws,(n,r)=>{r(n,{get class(){return W(e)},get side(){return s()},get align(){return c()},get sideOffset(){return l()},get collisionPadding(){return d()},get trapFocus(){return f()},children:(e,n)=>{var r=Cg(),i=R(r);u(i,()=>t.children??D),C(L(i,2),()=>ks,(e,t)=>{t(e,{class:`popover-arrow`,width:9,height:5})}),g(e,r)},$$slots:{default:!0}})})}g(e,i)},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),g(e,m),z()}var Tg=h(`<div><!></div>`);function Eg(e,t){a(t,!0);var n=Tg();u(V(n),()=>t.children??D),d(n),F(e=>s(n,1,e),[()=>x(me(`grid gap-3 p-3 text-xs`,t.class))]),g(e,n),z()}var Dg=h(`<span class="flex-none text-xs text-muted-foreground"> </span>`),Og=h(`<div><strong class="text-sm font-semibold"> </strong> <!></div>`);function kg(e,t){a(t,!0);var n=Og(),r=V(n),i=V(r,!0);d(r);var o=L(r,2),c=e=>{var n=U();u(R(n),()=>t.action),g(e,n)},l=e=>{var n=Dg(),r=V(n,!0);d(n),F(()=>A(r,t.meta)),g(e,n)};k(o,e=>{t.action?e(c):t.meta&&e(l,1)}),d(n),F(e=>{s(n,1,e),A(i,t.title)},[()=>x(me(`flex items-baseline justify-between gap-3`,t.class))]),g(e,n),z()}var Ag=h(`<span class="text-xs text-muted-foreground"> </span>`),jg=h(`<div class="flex items-baseline justify-between gap-3"><!> <!></div>`),Mg=h(`<div><!> <!></div>`);function Ng(e,t){a(t,!0);let n=I(t,`separated`,3,!1);var r=Mg(),i=V(r),o=e=>{var n=jg(),r=V(n),i=e=>{var n=Ag(),r=V(n,!0);d(n),F(()=>A(r,t.label)),g(e,n)};k(r,e=>{t.label&&e(i)});var a=L(r,2),o=e=>{var n=U();u(R(n),()=>t.action),g(e,n)};k(a,e=>{t.action&&e(o)}),d(n),g(e,n)};k(i,e=>{(t.label||t.action)&&e(o)}),u(L(i,2),()=>t.children??D),d(r),F(e=>s(r,1,e),[()=>x(me(`grid gap-1.5`,n()&&`border-t border-border/60 pt-3`,t.class))]),g(e,r),z()}var Pg=h(`<span class="truncate text-xs text-muted-foreground"> </span>`),Fg=h(`<button type="button"><!> <span class="grid min-w-0 flex-1 gap-0.5"><span class="truncate text-xs font-medium text-foreground"> </span> <!></span> <!> <!></button>`);function Ig(e,t){a(t,!0);let n=I(t,`selected`,3,!1),i=I(t,`disabled`,3,!1);var o=Fg(),c=V(o);u(c,()=>t.icon??D);var l=L(c,2),f=V(l),p=V(f,!0);d(f);var m=L(f,2),h=e=>{var n=Pg(),r=V(n,!0);d(n),F(()=>A(r,t.detail)),g(e,n)},_=e=>{var n=U();u(R(n),()=>t.detail),g(e,n)};k(m,e=>{typeof t.detail==`string`?e(h):t.detail&&e(_,1)}),d(l);var v=L(l,2);u(v,()=>t.trailing??D);var y=L(v,2),b=e=>{Qt(e,{class:`size-3.5 flex-none text-primary`,"aria-hidden":`true`})};k(y,e=>{n()&&e(b)}),d(o),F(e=>{o.disabled=i(),q(o,`title`,t.title),q(o,`aria-pressed`,n()),s(o,1,e),A(p,t.label)},[()=>x(me(`flex w-full items-center gap-2.5 rounded-md border border-border bg-transparent px-2 py-2 text-left transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-55`,n()&&`bg-accent`,t.class))]),r(`click`,o,function(...e){t.onclick?.apply(this,e)}),g(e,o),z()}T([`click`]);var Lg=h(`<dl><!></dl>`);function Rg(e,t){a(t,!0);var n=Lg();u(V(n),()=>t.children??D),d(n),F(e=>s(n,1,e),[()=>x(me(`grid gap-1.5 text-xs`,t.class))]),g(e,n),z()}var zg=h(`<div class="flex items-center justify-between gap-4"><dt class="flex-none text-muted-foreground"> </dt> <dd><!></dd></div>`);function Bg(e,t){a(t,!0);var n=zg(),r=V(n),i=V(r,!0);d(r);var o=L(r,2),c=V(o),l=e=>{var n=U();u(R(n),()=>t.children),g(e,n)},f=e=>{var n=M();F(()=>A(n,t.value??`—`)),g(e,n)};k(c,e=>{t.children?e(l):e(f,-1)}),d(o),d(n),F(e=>{A(i,t.label),s(o,1,e),q(o,`title`,t.title)},[()=>x(me(`min-w-0 truncate tabular-nums text-foreground`,t.valueClass))]),g(e,n),z()}var Vg=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`checked`,`size`]);function Hg(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`checked`,15,!1),i=I(t,`size`,3,`default`),o=H(t,Vg);var s=U(),c=R(s);{let e=J(()=>me(`data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent shadow-xs focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-[size=settings]:h-4 data-[size=settings]:w-7 data-[size=settings]:p-0.5 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50`,t.class));C(c,()=>Tc,(t,a)=>{a(t,B({"data-slot":`switch`,get"data-size"(){return i()},get class(){return W(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)},get checked(){return r()},set checked(e){r(e)},children:(e,t)=>{var n=U();C(R(n),()=>Oc,(e,t)=>{t(e,{"data-slot":`switch-thumb`,class:`bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=settings]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=settings]/switch:data-checked:translate-x-3 group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 group-data-[size=settings]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform rtl:data-[state=checked]:translate-x-[calc(-100%)]`})}),g(e,n)},$$slots:{default:!0}}))})}g(e,s),z()}var Ug=h(`<span> </span>`),Wg=h(`<small class="text-xs text-muted-foreground"> </small>`),Gg=h(`<label><span class="grid min-w-0 gap-0.5"><!> <!></span> <!></label>`);function Kg(e,t){a(t,!0);let n=I(t,`checked`,15,!1),r=I(t,`disabled`,3,!1),i=I(t,`class`,3,``);function o(e){n(e),t.onCheckedChange?.(e)}var c=Gg(),l=V(c),u=V(l),f=e=>{var n=Ug(),r=V(n,!0);d(n),F(()=>A(r,t.label)),g(e,n)};k(u,e=>{t.label&&e(f)});var p=L(u,2),m=e=>{var n=Wg(),r=V(n,!0);d(n),F(()=>A(r,t.description)),g(e,n)};k(p,e=>{t.description&&e(m)}),d(l),Hg(L(l,2),{get disabled(){return r()},size:`settings`,onCheckedChange:o,get"aria-label"(){return t.label},get checked(){return n()},set checked(e){n(e)}}),d(c),F(e=>s(c,1,e),[()=>x(me(`flex items-center justify-between gap-3 text-sm text-foreground`,i()))]),g(e,c),z()}var qg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jg(e,t){let n=H(t,qg),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];On(e,B({name:`search`},()=>n,{get iconNode(){return r}}))}var Yg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xg(e,t){let n=H(t,Yg),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];On(e,B({name:`x`},()=>n,{get iconNode(){return r}}))}var Zg=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`type`,`files`,`class`,`size`,`ariaLabel`,`data-slot`]),Qg=h(`<input/>`);function $g(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`value`,15),i=I(t,`files`,15),o=I(t,`size`,3,`default`),s=I(t,`data-slot`,3,`input`),c=H(t,Zg),l=J(()=>o()===`xs`?`h-7 px-2 text-xs md:text-xs`:o()===`sm`?`h-8`:`h-9`);var u=U(),d=R(u),f=e=>{var a=Qg();O(a,e=>({"data-slot":s(),"aria-label":t.ariaLabel,class:e,type:`file`,...c}),[()=>me(`dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,W(l),t.class)],void 0,void 0,void 0,!0),fe(a,e=>n(e),()=>n()),je(a,i),Ne(a,r),g(e,a)},p=e=>{var i=Qg();O(i,e=>({"data-slot":s(),"aria-label":t.ariaLabel,class:e,type:t.type,...c}),[()=>me(`dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,W(l),t.class)],void 0,void 0,void 0,!0),fe(i,e=>n(e),()=>n()),Ne(i,r),g(e,i)};k(d,e=>{t.type===`file`?e(f):e(p,-1)}),g(e,u),z()}var e_=h(`<div><div class="relative min-w-0 flex-1"><!> <!> <!></div> <!></div>`);function t_(e,t){a(t,!0);let n=I(t,`value`,15,``),r=I(t,`placeholder`,3,`Search`),i=I(t,`ariaLabel`,3,`Search`),o=I(t,`size`,3,`xs`),c=I(t,`icon`,3,Jg),l=I(t,`clearable`,3,!0),f=I(t,`disabled`,3,!1),p=I(t,`ref`,15,null);function m(e){n(e),t.onValueChange?.(e)}var h=e_(),_=V(h),v=V(_);{let e=J(()=>me(`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground`,f()&&`opacity-50`));C(v,c,(t,n)=>{n(t,{get class(){return W(e)},"aria-hidden":`true`})})}var y=L(v,2);{let e=J(()=>me(`pl-7`,l()&&n()?`pr-7`:void 0,t.inputClass));$g(y,{get size(){return o()},get placeholder(){return r()},get ariaLabel(){return i()},get disabled(){return f()},type:`text`,get class(){return W(e)},oninput:e=>t.onValueChange?.(e.currentTarget.value),get ref(){return p()},set ref(e){p(e)},get value(){return n()},set value(e){n(e)}})}var b=L(y,2),S=e=>{{let t=J(()=>`Clear ${i().toLowerCase()}`);G(e,{variant:`ghost`,size:`icon-xs`,class:`absolute top-1/2 right-0.5 -translate-y-1/2`,get ariaLabel(){return W(t)},get disabled(){return f()},onclick:()=>m(``),children:(e,t)=>{Xg(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}};k(b,e=>{l()&&n()&&e(S)}),d(_);var w=L(_,2),T=e=>{var n=U();u(R(n),()=>t.trailing),g(e,n)};k(w,e=>{t.trailing&&e(T)}),d(h),F(e=>s(h,1,e),[()=>x(me(`flex min-w-0 items-center gap-2`,t.class))]),g(e,h),z()}function n_(e){let t=_ee(e);return e.map(e=>{let n=hee(e),r=Zn(e.provider);return{key:Xn(e),model:e,displayName:n,contextualLabel:(t.get(n)??0)>1?`${r} / ${n}`:n,providerLabel:r,searchText:`${n} ${e.modelId} ${r} ${e.provider}`.toLowerCase()}}).sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel),r=e.displayName.localeCompare(t.displayName);return n||r||e.key.localeCompare(t.key)})}function r_(e,t,n=`all`){let r=t.trim().toLowerCase();return!r&&n===`all`?e:e.filter(e=>(n===`all`||e.model.provider===n)&&(!r||e.searchText.includes(r)))}function i_(e){let t=new Map;for(let n of e){let e=t.get(n.model.provider);e?e.count+=1:t.set(n.model.provider,{id:n.model.provider,label:n.providerLabel,count:1})}return[{id:`all`,label:`All`,count:e.length},...[...t.values()].sort((e,t)=>e.label.localeCompare(t.label))]}var a_=h(`<span class="model-tab-suffix svelte-1u8q75"> </span>`),o_=h(`<span class="model-tab-short-suffix svelte-1u8q75"> </span>`),s_=h(`<span data-tour-id="composer-model"><span class="model-tab-label svelte-1u8q75"> </span> <!> <!></span>`),c_=h(`<p class="text-muted-foreground"> </p>`),l_=h(` <span class="text-muted-foreground"> </span>`,1),u_=h(`<!> <!>`,1),d_=h(`<p class="text-muted-foreground">No models match.</p>`),f_=h(`<div class="grid gap-2"><!> <!></div>`);function p_(e,t){a(t,!0);let n=I(t,`models`,19,()=>[]),r=I(t,`selectedModelKey`,3,``),i=I(t,`thinkingLevel`,3,`off`),o=I(t,`disabled`,3,!1),c=I(t,`emptyMessage`,3,`No models available. Configure a provider or adjust Scoped Models in Settings.`),l=Y(!1),u=Y(``),f=Y(`all`),p=J(()=>n_(n())),m=J(()=>i_(W(p))),h=J(()=>r_(W(p),n().length>10?W(u):``,n().length>10?W(f):`all`)),v=J(()=>n().find(e=>Xn(e)===r())),y={off:`No reasoning`,minimal:`Very brief reasoning`,low:`Light reasoning`,medium:`Moderate reasoning`,high:`Deep reasoning`,xhigh:`Extra-high reasoning`,max:`Maximum reasoning`};function b(e){return e===`off`?`Off`:e[0].toUpperCase()+e.slice(1)}function x(e){switch(e){case`minimal`:return`Mi`;case`low`:return`L`;case`medium`:return`M`;case`high`:return`H`;case`xhigh`:return`XH`;case`max`:return`Max`;default:return`Off`}}let S=J(()=>W(v)?.supportedThinkingLevels?.length?W(v).supportedThinkingLevels:[`off`]),T=J(()=>W(S).length>1),E=J(()=>W(v)?gee(W(v),n()):`Select model`),D=J(()=>W(T)&&i()!==`off`?b(i()):void 0),O=J(()=>W(T)&&i()!==`off`?x(i()):void 0),ee=J(()=>`${W(D)?`${W(E)} (${W(D)})`:W(E)}${t.runtimeChangeHint?` · ${t.runtimeChangeHint}`:``}${t.shortcutLabel?` · Cycle thinking ${t.shortcutLabel}`:``}`);function te(e){K(l,o()?!1:e,!0),W(l)&&(K(u,``),K(f,`all`))}function ne(e){if(o())return;let n=Xn(e);n!==r()&&t.onModelChange?.(n)}function j(e){o()||e!==i()&&t.onThinkingLevelChange?.(e)}be(()=>{o()&&K(l,!1)}),wg(e,{get open(){return W(l)},onOpenChange:te,size:`lg`,triggerClass:`composer-tab model-tab`,ariaLabel:`Model and thinking level`,get triggerTitle(){return W(ee)},side:`top`,align:`end`,sideOffset:9,trigger:e=>{var t=s_();let n;var r=V(t),i=V(r,!0);d(r);var a=L(r,2),c=e=>{var t=a_(),n=V(t);d(t),F(()=>A(n,`(${W(D)??``})`)),g(e,t)};k(a,e=>{W(D)&&e(c)});var l=L(a,2),u=e=>{var t=o_(),n=V(t);d(t),F(()=>A(n,`(${W(O)??``})`)),g(e,t)};k(l,e=>{W(O)&&e(u)}),d(t),F(()=>{n=s(t,1,`model-tab-inner svelte-1u8q75`,null,n,{disabled:o()}),q(t,`aria-disabled`,o()),A(i,W(E))}),g(e,t)},children:(e,t)=>{Eg(e,{children:(e,t)=>{var a=u_(),s=R(a);Ng(s,{label:`Model`,children:(e,t)=>{var i=U(),a=R(i),s=e=>{var t=c_(),n=V(t,!0);d(t),F(()=>A(n,c())),g(e,t)},l=e=>{var t=f_(),i=V(t),a=e=>{var t=u_(),n=R(t);t_(n,{placeholder:`Search models`,ariaLabel:`Search models`,get value(){return W(u)},set value(e){K(u,e,!0)}});var r=L(n,2),i=e=>{var t=U();C(R(t),()=>tn,(e,t)=>{t(e,{type:`single`,size:`xs`,spacing:1,variant:`outline`,get value(){return W(f)},"aria-label":`Filter by provider`,class:`flex-nowrap overflow-x-auto`,onValueChange:e=>{e&&K(f,e,!0)},children:(e,t)=>{var n=U();_(R(n),17,()=>W(m),e=>e.id,(e,t)=>{var n=U();C(R(n),()=>$t,(e,n)=>{n(e,{get value(){return W(t).id},class:`flex-none gap-1.5 text-xs`,children:(e,n)=>{w();var r=l_(),i=R(r),a=L(i),o=V(a,!0);d(a),F(()=>{A(i,`${W(t).label??``} `),A(o,W(t).count)}),g(e,r)},$$slots:{default:!0}})}),g(e,n)}),g(e,n)},$$slots:{default:!0}})}),g(e,t)};k(r,e=>{W(m).length>2&&e(i)}),g(e,t)};k(i,e=>{n().length>10&&e(a)});var s=L(i,2),c=e=>{g(e,d_())},l=e=>{Ii(e,{get items(){return W(h)},getKey:e=>e.key,estimateSize:()=>36,gap:6,viewportClass:`max-h-[min(44vh,18rem)]`,viewportAriaLabel:`Available models`,row:(e,t)=>{let n=()=>t?.().item;{let t=J(()=>n().key===r());Ig(e,{get label(){return n().contextualLabel},get selected(){return W(t)},get disabled(){return o()},onclick:()=>ne(n().model)})}},$$slots:{row:!0}})};k(s,e=>{W(h).length===0?e(c):e(l,-1)}),d(t),g(e,t)};k(a,e=>{n().length===0?e(s):e(l,-1)}),g(e,i)},$$slots:{default:!0}});var l=L(s,2),p=e=>{Ng(e,{label:`Thinking level`,separated:!0,children:(e,t)=>{var n=U();C(R(n),()=>tn,(e,t)=>{t(e,{type:`single`,size:`xs`,spacing:1,variant:`outline`,get value(){return i()},"aria-label":`Thinking level`,class:`flex-wrap justify-start`,onValueChange:e=>{e&&j(e)},children:(e,t)=>{var n=U();_(R(n),16,()=>W(S),e=>e,(e,t)=>{var n=U();C(R(n),()=>$t,(e,n)=>{n(e,{get value(){return t},class:`flex-none rounded-full text-xs data-[state=on]:text-primary`,get title(){return y[t]},get disabled(){return o()},children:(e,n)=>{w();var r=M();F(e=>A(r,e),[()=>b(t)]),g(e,r)},$$slots:{default:!0}})}),g(e,n)}),g(e,n)},$$slots:{default:!0}})}),g(e,n)},$$slots:{default:!0}})};k(l,e=>{W(T)&&e(p)}),g(e,a)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}}),z()}var m_=new Set([`$$slots`,`$$events`,`$$legacy`]);function h_(e,t){let n=H(t,m_),r=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3-3-3 3`}],[`path`,{d:`m15 5-3 3-3-3`}]];P(e,B({name:`fold-vertical`},()=>n,{get iconNode(){return r}}))}var g_=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function __(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=H(t,g_);var i=U();C(R(i),()=>Xo,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),z()}var v_=new Set([`$$slots`,`$$events`,`$$legacy`]);function y_(e,t){let n=H(t,v_);var r=U();C(R(r),()=>Ue,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var b_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function x_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,b_);var i=U(),o=R(i);{let e=J(()=>me(`dialog-title`,t.class));C(o,()=>Ge,(t,i)=>{i(t,B({"data-slot":`alert-dialog-title`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var S_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`variant`,`size`]);function C_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`variant`,3,`default`),i=I(t,`size`,3,`default`),o=H(t,S_);var s=U(),c=R(s);{let e=J(()=>me(xe({variant:r(),size:i()}),`cn-alert-dialog-action`,t.class));C(c,()=>$o,(t,r)=>{r(t,B({"data-slot":`alert-dialog-action`,get class(){return W(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,s),z()}var w_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`variant`,`size`]);function T_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`variant`,3,`outline`),i=I(t,`size`,3,`default`),o=H(t,w_);var s=U(),c=R(s);{let e=J(()=>me(xe({variant:r(),size:i()}),`cn-alert-dialog-cancel`,t.class));C(c,()=>ns,(t,r)=>{r(t,B({"data-slot":`alert-dialog-cancel`,get class(){return W(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,s),z()}var E_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),D_=h(`<div><!></div>`);function O_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,E_);var i=D_();O(i,e=>({"data-slot":`alert-dialog-footer`,class:e,...r}),[()=>me(`dialog-footer gap-2`,t.class)]),u(V(i),()=>t.children??D),d(i),fe(i,e=>n(e),()=>n()),g(e,i),z()}var k_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),A_=h(`<div><div class="dialog-title-block"><!></div></div>`);function j_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,k_);var i=A_();O(i,e=>({"data-slot":`alert-dialog-header`,class:e,...r}),[()=>me(`dialog-header`,t.class)]);var o=V(i);u(V(o),()=>t.children??D),d(o),d(i),fe(i,e=>n(e),()=>n()),g(e,i),z()}var M_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function N_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,M_);var i=U(),o=R(i);{let e=J(()=>me(`dialog-overlay data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 duration-100`,t.class));C(o,()=>it,(t,i)=>{i(t,B({"data-slot":`alert-dialog-overlay`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var P_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`portalProps`]),F_=h(`<!> <!>`,1);function I_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,P_);y_(e,B(()=>t.portalProps,{children:(e,i)=>{var a=F_(),o=R(a);N_(o,{});var s=L(o,2);{let e=J(()=>me(`dialog-content dialog-content-confirm data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 duration-100 outline-none`,t.class));C(s,()=>os,(t,i)=>{i(t,B({"data-slot":`alert-dialog-content`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,a)},$$slots:{default:!0}})),z()}var L_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function R_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,L_);var i=U(),o=R(i);{let e=J(()=>me(`dialog-description *:[a]:hover:text-foreground text-pretty *:[a]:underline *:[a]:underline-offset-3`,t.class));C(o,()=>pt,(t,i)=>{i(t,B({"data-slot":`alert-dialog-description`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}h(`<div><!></div>`);var z_=h(`<!> <!>`,1);function B_(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`confirmLabel`,3,`Confirm`),i=I(t,`cancelLabel`,3,`Cancel`),o=I(t,`destructive`,3,!1);function s(){n(!1),t.onOpenChange?.(!1)}function c(){t.onConfirm?.(),s()}function l(){t.onCancel?.(),s()}var u=U();C(R(u),()=>__,(e,a)=>{a(e,{get onOpenChange(){return t.onOpenChange},get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=U();C(R(a),()=>I_,(e,n)=>{n(e,{get class(){return t.class},children:(e,n)=>{var a=z_(),s=R(a);C(s,()=>j_,(e,n)=>{n(e,{children:(e,n)=>{var r=z_(),i=R(r);C(i,()=>x_,(e,n)=>{n(e,{children:(e,n)=>{w();var r=M();F(()=>A(r,t.title)),g(e,r)},$$slots:{default:!0}})});var a=L(i,2),o=e=>{var n=U();C(R(n),()=>R_,(e,n)=>{n(e,{children:(e,n)=>{w();var r=M();F(()=>A(r,t.description)),g(e,r)},$$slots:{default:!0}})}),g(e,n)};k(a,e=>{t.description&&e(o)}),g(e,r)},$$slots:{default:!0}})}),C(L(s,2),()=>O_,(e,n)=>{n(e,{children:(e,n)=>{var a=z_(),s=R(a);C(s,()=>T_,(e,t)=>{t(e,{size:`sm`,onclick:l,children:(e,t)=>{w();var n=M();F(()=>A(n,i())),g(e,n)},$$slots:{default:!0}})});var u=L(s,2);{let e=J(()=>t.confirmVariant??(o()?`destructive`:`default`));C(u,()=>C_,(t,n)=>{n(t,{size:`sm`,get variant(){return W(e)},onclick:c,children:(e,t)=>{w();var n=M();F(()=>A(n,r())),g(e,n)},$$slots:{default:!0}})})}g(e,a)},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),g(e,u),z()}var V_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`max`,`value`]),H_=h(`<div data-slot="progress-indicator" class="bg-primary size-full flex-1 transition-all"></div>`);function U_(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`max`,3,100),i=H(t,V_);var o=U(),s=R(o);{let e=J(()=>me(`bg-muted h-1.5 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class));C(s,()=>nc,(a,o)=>{o(a,B({"data-slot":`progress`,get class(){return W(e)},get value(){return t.value},get max(){return r()}},()=>i,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var i=H_();F(()=>l(i,`transform: translateX(-${100-100*(t.value??0)/(r()??1)}%)`)),g(e,i)},$$slots:{default:!0}}))})}g(e,o),z()}var W_=h(`<span aria-hidden="true"><span class="progress-ring-core size-2 rounded-full svelte-k86mvk"></span></span>`);function G_(e,t){a(t,!0);let n=I(t,`percent`,3,0),r=I(t,`tone`,3,`neutral`),i=J(()=>Math.min(100,Math.max(0,n()??0)));var o=W_();F(e=>{s(o,1,e,`svelte-k86mvk`),q(o,`data-tone`,r()),l(o,`--progress-ring-fill: ${W(i)}%;`)},[()=>x(me(`progress-ring inline-grid size-3 flex-none place-items-center rounded-full`,t.class))]),g(e,o),z()}function K_(e){return e<1e3?e.toString():e<1e4?`${(e/1e3).toFixed(1)}k`:e<1e6?`${Math.round(e/1e3)}k`:e<1e7?`${(e/1e6).toFixed(1)}M`:`${Math.round(e/1e6)}M`}function q_(e){return e==null?`neutral`:e>90?`error`:e>70?`warning`:`neutral`}var J_=[{minutes:300,label:`Session`,abbreviation:`S`},{minutes:1440,label:`Daily`,abbreviation:`D`},{minutes:10080,label:`Weekly`,abbreviation:`W`},{minutes:720*60,label:`Monthly`,abbreviation:`M`},{minutes:365*24*60,label:`Annual`,abbreviation:`A`}];function Y_(e,t){if(e==null||!Number.isFinite(e))return t;for(let t of J_)if(X_(e,t.minutes))return{label:t.label,abbreviation:t.abbreviation};return t}function X_(e,t){return e>=t*.95&&e<=t*1.05}function Z_(e){if(e==null||!Number.isFinite(e)||e<0)return null;let t=Math.floor(e);if(t===0)return`0m`;let n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60,a=[];return n>0&&a.push(`${n}d`),r>0&&a.push(`${r}h`),i>0&&a.push(`${i}m`),a.join(` `)}function Q_(e){if(!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:ev(t-Date.now())}function $_(e){return e==null||e<=0?null:ev(e*1e3)}function ev(e){return e<=0?null:Z_(Math.floor(e/6e4))}var tv=h(`<span class="context-usage-tab-inner inline-flex items-center gap-1 svelte-icoso1" data-tour-id="composer-context"><!> <span class="ctx-percent svelte-icoso1"> </span> <span class="ctx-window font-medium text-muted-foreground svelte-icoso1"> </span></span>`),nv=h(`<span> </span>`),rv=h(`<p class="text-muted-foreground">Usage will be available after the next response.</p>`),iv=h(`<!> <!>`,1),av=h(`<!> <!> <!>`,1),ov=h(`<!> `,1),sv=h(`<!> <!> <!> <!>`,1);function cv(e,t){a(t,!0);let n=I(t,`contextWindow`,3,0),r=I(t,`compacting`,3,!1),i=I(t,`compactDisabled`,3,!1),o=Y(!1),c=Y(!1),l=J(()=>n()||t.contextUsage?.contextWindow||0),u=J(()=>t.contextUsage?.tokens??null),f=J(()=>W(u)!=null&&W(l)>0?W(u)/W(l)*100:t.contextUsage?.percent??null),p=J(()=>W(f)==null?0:Math.max(0,Math.min(100,W(f)))),m=J(()=>W(u)!=null&&W(l)>0?Math.max(0,W(l)-W(u)):null),h=J(()=>q_(W(f))),_=J(()=>W(h)===`error`?`danger`:W(h)===`warning`?`warn`:`neutral`),v=J(()=>W(f)==null?`?%`:`${Math.round(W(f))}%`),y=J(()=>W(f)==null?`Usage unavailable`:`${W(v)} used`),b=J(()=>W(u)!=null&&W(l)>0?`Context: ${W(u).toLocaleString()} / ${W(l).toLocaleString()} tokens`:W(l)>0?`Context usage unknown / ${W(l).toLocaleString()} tokens`:`Context window unknown`),S=J(()=>W(l)>0?K_(W(l)):`—`),C=J(()=>r()||i()||!t.onCompact),w=J(()=>W(h)===`error`?`[&_[data-slot=progress-indicator]]:bg-destructive-solid`:W(h)===`warning`?`[&_[data-slot=progress-indicator]]:bg-warning`:``);function T(){W(C)||(K(o,!1),K(c,!0))}var E=iv(),D=R(E),O=e=>{wg(e,{size:`md`,triggerClass:`composer-tab context-usage-tab`,ariaLabel:`Context usage`,get triggerTitle(){return W(b)},side:`top`,align:`end`,sideOffset:9,get open(){return W(o)},set open(e){K(o,e,!0)},trigger:e=>{var t=tv(),n=V(t);G_(n,{get percent(){return W(p)},get tone(){return W(_)}});var r=L(n,2),i=V(r,!0);d(r);var a=L(r,2),o=V(a);d(a),d(t),F(()=>{q(t,`data-tone`,W(h)),A(i,W(v)),A(o,`/${W(S)??``}`)}),g(e,t)},children:(e,t)=>{Eg(e,{children:(e,t)=>{var n=sv(),i=R(n);kg(i,{title:`Context window`,action:e=>{var t=nv(),n=V(t,!0);d(t),F(e=>{s(t,1,e,`svelte-icoso1`),A(n,W(y))},[()=>x(me(`flex-none text-xs font-medium`,W(h)===`error`?`text-destructive`:W(h)===`warning`?`text-warning`:`text-foreground`))]),g(e,t)},$$slots:{action:!0}});var a=L(i,2);Ng(a,{children:(e,t)=>{var n=iv(),r=R(n);{let e=J(()=>me(`h-1`,W(w))),t=J(()=>W(f)==null?`Context usage unavailable`:`${W(v)} of context window used`);U_(r,{get value(){return W(p)},get class(){return W(e)},get"aria-label"(){return W(t)}})}var i=L(r,2),a=e=>{g(e,rv())};k(i,e=>{W(f)??e(a)}),g(e,n)},$$slots:{default:!0}});var o=L(a,2);Ng(o,{separated:!0,children:(e,t)=>{Rg(e,{children:(e,t)=>{var n=av(),r=R(n);{let e=J(()=>W(u)==null?`Unavailable`:`${W(u).toLocaleString()} tokens`);Bg(r,{label:`Used`,get value(){return W(e)}})}var i=L(r,2);{let e=J(()=>W(m)==null?`Unavailable`:`${W(m).toLocaleString()} tokens`);Bg(i,{label:`Remaining`,get value(){return W(e)}})}var a=L(i,2);{let e=J(()=>W(l)>0?`${W(l).toLocaleString()} tokens`:`Unknown`);Bg(a,{label:`Window`,get value(){return W(e)}})}g(e,n)},$$slots:{default:!0}})},$$slots:{default:!0}});var c=L(o,2);{let e=J(()=>r()?`Conversation compaction is in progress`:`Summarize earlier messages to reduce context usage`);G(c,{size:`xs`,variant:`outline`,class:`w-full`,get disabled(){return W(C)},get title(){return W(e)},onclick:T,children:(e,t)=>{var n=ov(),i=R(n);h_(i,{});var a=L(i);F(()=>A(a,` ${r()?`Compacting…`:`Compact context`}`)),g(e,n)},$$slots:{default:!0}})}g(e,n)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}})};k(D,e=>{(W(l)>0||W(f)!=null)&&e(O)}),B_(L(D,2),{title:`Compact conversation`,description:`This summarizes earlier messages to reduce context size. The full history stays available in the branch tree.`,confirmLabel:`Compact context`,onConfirm:()=>t.onCompact?.(),get open(){return W(c)},set open(e){K(c,e,!0)}}),g(e,E),z()}var lv=new Set([`$$slots`,`$$events`,`$$legacy`]);function uv(e,t){let n=H(t,lv),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]];P(e,B({name:`circle`},()=>n,{get iconNode(){return r}}))}var dv=new Set([`$$slots`,`$$events`,`$$legacy`]);function fv(e,t){let n=H(t,dv),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]];P(e,B({name:`circle-check`},()=>n,{get iconNode(){return r}}))}var pv=h(`<p> </p>`),mv=h(`<li><!> <span> </span></li>`),hv=h(`<ul class="m-0 grid list-none gap-1.5 p-0" aria-label="Todo list"></ul>`);function gv(e,t){a(t,!0);let n=I(t,`emptyLabel`,3,`No todos set.`),r=I(t,`dense`,3,!1),i=J(()=>r()?`text-xs`:`text-sm`),o=J(()=>r()?13:15);var c=U(),l=R(c),u=e=>{var t=pv(),r=V(t,!0);d(t),F(()=>{s(t,1,`m-0 text-muted-foreground ${W(i)}`),A(r,n())}),g(e,t)},f=e=>{var n=hv();_(n,23,()=>t.items,(e,t)=>`${e.todo}:${e.done}:${t}`,(e,t)=>{var n=mv(),r=V(n),a=e=>{fv(e,{get size(){return W(o)},strokeWidth:2.2,"aria-hidden":`true`,class:`mt-0.5 text-success`})},c=e=>{uv(e,{get size(){return W(o)},strokeWidth:2.2,"aria-hidden":`true`,class:`mt-0.5 text-muted-foreground`})};k(r,e=>{W(t).done?e(a):e(c,-1)});var l=L(r,2);let u;var f=V(l,!0);d(l),d(n),F(()=>{s(n,1,`grid grid-cols-[auto_1fr] items-start gap-2 leading-normal ${W(i)} ${W(t).done?`text-muted-foreground`:`text-foreground`}`),u=s(l,1,`min-w-0 [overflow-wrap:anywhere]`,null,u,{"line-through":W(t).done}),A(f,W(t).todo)}),g(e,n)}),d(n),g(e,n)};k(l,e=>{t.items.length===0?e(u):e(f,-1)}),g(e,c),z()}var _v=h(`<span class="todo-tab-inner svelte-1kjsgm3"><!> <span class="todo-count svelte-1kjsgm3"> </span></span>`),vv=h(`<!> <!>`,1);function yv(e,t){a(t,!0);let n=Y(!1),r=J(()=>t.todos.length),i=J(()=>t.todos.filter(e=>e.done).length),o=J(()=>W(r)>0?W(i)/W(r)*100:0),s=J(()=>W(r)>0&&W(i)===W(r)),c=J(()=>`Todos: ${W(i)} of ${W(r)} complete`);var l=U(),u=R(l),f=e=>{wg(e,{size:`xl`,triggerClass:`composer-tab todo-progress-tab`,ariaLabel:`Todo progress`,get triggerTitle(){return W(c)},side:`top`,align:`end`,sideOffset:9,get open(){return W(n)},set open(e){K(n,e,!0)},trigger:e=>{var t=_v(),n=V(t);{let e=J(()=>W(s)?`good`:`primary`);G_(n,{get percent(){return W(o)},get tone(){return W(e)}})}var a=L(n,2),c=V(a);d(a),d(t),F(()=>A(c,`${W(i)??``}/${W(r)??``}`)),g(e,t)},children:(e,n)=>{Eg(e,{class:`max-h-[min(48vh,20rem)] overflow-y-auto`,children:(e,n)=>{var a=vv(),o=R(a);{let e=J(()=>`${W(i)}/${W(r)}`);kg(o,{title:`Todo list`,get meta(){return W(e)}})}gv(L(o,2),{get items(){return t.todos},dense:!0}),g(e,a)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}})};k(u,e=>{W(r)>0&&e(f)}),g(e,l),z()}var bv=h(`<span data-tour-id="composer-permission"><!></span>`),xv=h(`<!> <!> <!>`,1),Sv=h(`<div class="composer-tabs svelte-11h85zl" data-tour-id="composer-controls"><!> <button type="button" class="composer-tab mode-tab svelte-11h85zl" data-tour-id="composer-mode"><span class="mode-tab-icon svelte-11h85zl" aria-hidden="true"><!></span> <span class="mode-tab-label svelte-11h85zl"> </span></button> <!> <!> <!></div>`);function Cv(e,t){a(t,!0);let n=I(t,`compacting`,3,!1),i=I(t,`compactDisabled`,3,!1),o=I(t,`todos`,19,()=>[]),c=J(()=>[{value:`read_only`,label:`Read only`,detail:`No writes or mutating commands`,icon:vg,iconClass:`text-muted-foreground`},{value:`supervised`,label:`Supervised`,detail:t.approvalPolicy.autoApproveReadOnly?`Ask before non-read tool calls`:`Ask before read and non-read tool calls`,icon:bg,iconClass:`text-muted-foreground`},{value:`autonomous`,label:`Autonomous`,detail:`Allow tool calls without approval`,icon:Sg,iconClass:`text-warning`}]),l=J(()=>W(c).find(e=>e.value===t.permissionLevel)??W(c)[2]),u=Y(!1);function f(e){e!==t.permissionLevel&&t.onPermissionChange?.(e),K(u,!1)}function p(e){t.onApprovalPolicyChange?.({...t.approvalPolicy,autoApproveReadOnly:e})}var m=Sv(),h=V(m);{let e=e=>{let n=J(()=>W(l).icon);var r=bv();let i;C(V(r),()=>W(n),(e,t)=>{t(e,{size:13,strokeWidth:2.2})}),d(r),F(()=>i=s(r,1,`permission-tab-inner svelte-11h85zl`,null,i,{disabled:t.controlsDisabled})),g(e,r)},n=J(()=>t.permissionShortcut?`Permission: ${W(l).label} (${t.permissionShortcut})`:`Permission: ${W(l).label}`);wg(h,{size:`lg`,triggerClass:`composer-tab w-7 p-0 max-sm:w-7.5`,ariaLabel:`Permission level`,get triggerTitle(){return W(n)},get triggerAriaKeyShortcuts(){return t.permissionShortcutAria},side:`top`,align:`start`,sideOffset:9,get open(){return W(u)},set open(e){K(u,e,!0)},trigger:e,children:(e,n)=>{Eg(e,{children:(e,n)=>{var r=xv(),i=R(r);kg(i,{title:`Permission level`});var a=L(i,2);Ng(a,{children:(e,n)=>{var r=U();_(R(r),17,()=>W(c),e=>e.value,(e,n)=>{let r=J(()=>W(n).icon);{let i=e=>{var t=U(),i=R(t);{let e=J(()=>`size-4 flex-none ${W(n).iconClass}`);C(i,()=>W(r),(t,n)=>{n(t,{get class(){return W(e)},strokeWidth:2.1,"aria-hidden":`true`})})}g(e,t)},a=J(()=>W(n).value===t.permissionLevel);Ig(e,{get label(){return W(n).label},get detail(){return W(n).detail},get selected(){return W(a)},onclick:()=>f(W(n).value),icon:i,$$slots:{icon:!0}})}}),g(e,r)},$$slots:{default:!0}});var o=L(a,2),s=e=>{Ng(e,{separated:!0,children:(e,n)=>{Kg(e,{get checked(){return t.approvalPolicy.autoApproveReadOnly},get disabled(){return t.controlsDisabled},label:`Auto-approve read-only tools`,description:`Allow read, grep, find, ls, todos, and task status/log/list without prompting.`,onCheckedChange:p})},$$slots:{default:!0}})};k(o,e=>{t.permissionLevel===`supervised`&&e(s)}),g(e,r)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}})}var v=L(h,2),y=V(v),b=V(y),x=e=>{gg(e,{size:13,strokeWidth:2.2})},S=e=>{zu(e,{size:13,strokeWidth:2.2})};k(b,e=>{t.modePlanning?e(x):e(S,-1)}),d(y);var w=L(y,2),T=V(w,!0);d(w),d(v);var E=L(v,2);yv(E,{get todos(){return o()}});var D=L(E,2);cv(D,{get contextUsage(){return t.contextUsage},get contextWindow(){return t.contextWindow},get compacting(){return n()},get compactDisabled(){return i()},get onCompact(){return t.onCompact}}),p_(L(D,2),{get models(){return t.models},get selectedModelKey(){return t.selectedModelKey},get thinkingLevel(){return t.thinkingLevel},get disabled(){return t.modelDisabled},get onModelChange(){return t.onModelChange},get onThinkingLevelChange(){return t.onThinkingLevelChange},get runtimeChangeHint(){return t.runtimeChangeHint},get emptyMessage(){return t.modelEmptyMessage},get shortcutLabel(){return t.thinkingShortcut}}),d(m),F(()=>{v.disabled=t.modeDisabled,q(v,`title`,t.modeShortcut?`Mode: ${t.modeLabel} (${t.modeShortcut})`:`Mode: ${t.modeLabel} (click to switch)`),q(v,`aria-keyshortcuts`,t.modeShortcutAria),A(T,t.modeLabel)}),r(`click`,v,()=>t.onToggleMode?.()),g(e,m),z()}T([`click`]);var wv=h(`<p class="flex items-center gap-1 text-xs text-muted-foreground"> </p>`);function Tv(e,t){a(t,!0);let n=J(()=>Fr(t.model.text)),r=J(()=>yr(t.model.text)),i=J(()=>!!(t.model.disabled||t.model.compacting)),o=J(()=>t.model.editorDisabled??W(i)),s=J(()=>t.model.submitDisabled??!!(W(i)||W(n)&&t.model.sending)),c=J(()=>t.model.controlsDisabled??(W(i)||!!t.model.sending)),l=J(()=>t.model.mode===`planning`),f=J(()=>t.model.runtimeChangeHint??(t.model.sending?`Changes apply to the next model request`:void 0)),p=J(()=>t.model.placeholder??(W(i)?`Composer is unavailable right now`:t.model.sending?`Queue a prompt for the next agent turn`:`Ask the agent`)),m=J(()=>t.model.sendTitle??(W(n)?t.model.sending?`Wait for the current agent turn before running a command`:`Run command`:t.model.sending?`Queue prompt for the next agent turn`:`Send prompt`));function h(){W(s)||t.actions.onSubmit?.()}{let a=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.header),g(e,n)},a=e=>{var n=wv(),r=V(n,!0);d(n),F(()=>A(r,t.model.hint)),g(e,n)};k(r,e=>{t.header?e(i):t.model.hint&&e(a,1)}),g(e,n)},_=e=>{{let n=J(()=>t.model.modeDisabled??W(i)),r=J(()=>t.model.modelDisabled??(W(i)||t.model.models.length===0)),a=J(()=>W(l)?`Planning`:`Coding`),o=J(()=>t.model.contextWindow??0),s=J(()=>W(i)||!t.actions.onCompact),u=J(()=>t.model.modelEmptyMessage??`No models available. Configure a provider in this host.`);Cv(e,{get controlsDisabled(){return W(c)},get modeDisabled(){return W(n)},get modelDisabled(){return W(r)},get modeLabel(){return W(a)},get modePlanning(){return W(l)},onToggleMode:()=>t.actions.onModeChange?.(W(l)?`coding`:`planning`),get permissionLevel(){return t.model.permissionLevel},get permissionShortcut(){return t.model.permissionShortcut},get permissionShortcutAria(){return t.model.permissionShortcutAria},get modeShortcut(){return t.model.modeShortcut},get modeShortcutAria(){return t.model.modeShortcutAria},get thinkingShortcut(){return t.model.thinkingShortcut},get approvalPolicy(){return t.model.approvalPolicy},get contextUsage(){return t.model.contextUsage},get contextWindow(){return W(o)},get compacting(){return t.model.compacting},get compactDisabled(){return W(s)},get onCompact(){return t.actions.onCompact},get todos(){return t.model.todos},get models(){return t.model.models},get selectedModelKey(){return t.model.selectedModelKey},get thinkingLevel(){return t.model.thinkingLevel},get runtimeChangeHint(){return W(f)},get modelEmptyMessage(){return W(u)},get onModelChange(){return t.actions.onModelChange},get onThinkingLevelChange(){return t.actions.onThinkingLevelChange},get onPermissionChange(){return t.actions.onPermissionChange},get onApprovalPolicyChange(){return t.actions.onApprovalPolicyChange}})}},v=e=>{{let n=J(()=>t.model.focusToken??0);cg(e,{get value(){return t.model.text},get disabled(){return W(o)},get placeholder(){return W(p)},get slashCompletions(){return t.model.slashCompletions},get fileCompletions(){return t.model.fileCompletions},get focusToken(){return W(n)},get onChange(){return t.actions.onComposerChange},onSubmit:h,get onPasteImage(){return t.actions.onPasteImage},get onDropFiles(){return t.actions.onDropFiles}})}},y=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.sendLeading),g(e,n)};k(r,e=>{t.sendLeading&&e(i)}),g(e,n)},b=J(()=>t.model.showStop??t.model.sending),x=J(()=>!t.actions.onAbort||t.model.stopping),S=J(()=>t.model.sendAriaLabel??(W(n)?`Run command`:`Send prompt`));mg(e,{get mode(){return t.model.mode},get commandMode(){return W(n)},get executableBlocks(){return W(r)},get pendingApproval(){return t.model.pendingApproval},get pendingQuestion(){return t.model.pendingQuestion},get pendingPlan(){return t.model.pendingPlan},get showStop(){return W(b)},get stopping(){return t.model.stopping},get stopDisabled(){return W(x)},get stopAriaLabel(){return t.model.stopAriaLabel},get stopShortcutAria(){return t.model.stopShortcutAria},get stopTitle(){return t.model.stopTitle},get submitDisabled(){return W(s)},get sendAriaLabel(){return W(S)},get sendTitle(){return W(m)},get onAbort(){return t.actions.onAbort},onSubmit:h,header:a,toolbar:_,editor:v,sendLeading:y,$$slots:{header:!0,toolbar:!0,editor:!0,sendLeading:!0}})}z()}var Ev=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dv(e,t){let n=H(t,Ev),r=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]];P(e,B({name:`arrow-down`},()=>n,{get iconNode(){return r}}))}var Ov=h(`<span>Latest</span> <!>`,1),kv=h(`<div class="transcript svelte-10b0laq"><!></div> <!> <div><!></div> <div class="composer-wrap svelte-10b0laq"><!></div>`,1),Av=h(`<section class="conversation-pane svelte-10b0laq"><!></section>`);function jv(e,t){a(t,!0);let n=I(t,`showScrollButton`,3,!1),r=I(t,`composerHeight`,3,0),i=I(t,`composerWrapRef`,15);var o=Av(),c=V(o),f=e=>{var a=kv(),o=R(a);u(V(o),()=>t.transcript),d(o);var c=L(o,2),f=e=>{var n=U();u(R(n),()=>t.announcer),g(e,n)};k(c,e=>{t.announcer&&e(f)});var p=L(c,2);let m;var h=V(p);{let e=J(()=>n()&&r()>0?void 0:-1);G(h,{class:`rounded-full shadow-sm`,variant:`secondary`,size:`sm`,ariaLabel:`Scroll to latest`,title:`Scroll to latest`,get tabindex(){return W(e)},onclick:()=>t.onJumpToBottom?.(),children:(e,t)=>{var n=Ov();Dv(L(R(n),2),{size:15,strokeWidth:2.4,"aria-hidden":`true`}),g(e,n)},$$slots:{default:!0}})}d(p);var _=L(p,2);u(V(_),()=>t.composer),d(_),fe(_,e=>i(e),()=>i()),F(()=>{m=s(p,1,`scroll-bottom-button-wrap rounded-full svelte-10b0laq`,null,m,{"is-visible":n()&&r()>0}),l(p,`bottom: ${r()+8}px;`),q(p,`aria-hidden`,!n()||r()<=0)}),g(e,a)},p=e=>{var n=U();u(R(n),()=>t.empty),g(e,n)};k(c,e=>{t.open?e(f):e(p,-1)}),d(o),g(e,o),z()}function Mv(e){return[...e??[]].sort().join(`\0`)}function Nv(e,t){if(!e||!e.active||!t.active)return;let n=t.pendingApprovalCount??0;if(n>0&&(n!==(e.pendingApprovalCount??0)||t.pendingApprovalId!==e.pendingApprovalId))return n===1?`1 approval required.`:`${n} approvals required.`;let r=t.pendingQuestionIds?.length??0;if(r>0&&Mv(t.pendingQuestionIds)!==Mv(e.pendingQuestionIds))return r===1?`Nerve is waiting for your answer.`:`${r} answers required.`;let i=t.pendingPlanReviewIds?.length??0;if(i>0&&Mv(t.pendingPlanReviewIds)!==Mv(e.pendingPlanReviewIds))return i===1?`A plan is ready for review.`:`${i} plans are ready for review.`;if(t.sending&&!e.sending)return`Nerve is responding.`;if(!t.sending&&e.sending)return`Response complete.`}var Pv=h(`<span> </span>`),Fv=h(`<div class="sr-only" role="status" aria-live="polite" aria-atomic="true"><!></div>`);function Iv(e,t){a(t,!0);let n=Y(``),r=Y(0),i;be(()=>{let e={active:t.active,sending:t.sending,pendingApprovalId:t.pendingApprovalId,pendingApprovalCount:t.pendingApprovalCount,pendingQuestionIds:t.pendingQuestionIds,pendingPlanReviewIds:t.pendingPlanReviewIds},a=Nv(i,e);i=e,a&&(K(n,a,!0),K(r,W(r)+1))});var s=Fv();o(V(s),()=>W(r),e=>{var t=Pv(),r=V(t,!0);d(t),F(()=>A(r,W(n))),g(e,t)}),d(s),g(e,s),z()}var Lv=j(`<path d="M150 162L232 235L258 208L284 288L362 350"></path>`),Rv=j(`<path d="M150 162L222 226L246 194L272 300L296 262L362 350"></path>`),zv=j(`<svg viewBox="120 120 272 272" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M150 350V162"></path><path d="M362 350V162"></path><!></g></svg>`);function Bv(e,t){let n=I(t,`compact`,3,!1);var r=zv(),i=V(r),a=L(V(i),2),o=e=>{g(e,Lv())},c=e=>{g(e,Rv())};k(a,e=>{n()?e(o):e(c,-1)}),d(i),d(r),F(()=>{s(r,0,x(t.class)),q(r,`role`,t.label?`img`:void 0),q(r,`aria-label`,t.label),q(r,`aria-hidden`,t.label?void 0:`true`),q(i,`stroke-width`,n()?32:28)}),g(e,r)}var Vv=h(`<span><!></span>`);function Hv(e,t){a(t,!0);var n=Vv();Bv(V(n),{compact:!0,get label(){return t.label}}),d(n),F(e=>s(n,1,e,`svelte-1mk3yeo`),[()=>x(me(`nerve-badge inline-flex items-center justify-center rounded-lg bg-foreground text-background`,t.class))]),g(e,n),z()}var Uv=h(`<div class="mt-6 flex flex-col items-center"><!></div>`),Wv=h(`<div class="flex h-full min-h-full items-center justify-center p-6 text-center"><div class="brand-signal-enter flex w-full max-w-xl flex-col items-center"><!> <h2 class="mt-5 text-xl font-semibold tracking-tight text-foreground"> </h2> <p class="mt-2 max-w-lg text-sm leading-relaxed text-muted-foreground"> </p> <!></div></div>`);function Gv(e,t){var n=Wv(),r=V(n),i=V(r);Hv(i,{class:`size-12`});var a=L(i,2),o=V(a,!0);d(a);var s=L(a,2),c=V(s,!0);d(s);var l=L(s,2),f=e=>{var n=Uv();u(V(n),()=>t.footer),d(n),g(e,n)};k(l,e=>{t.footer&&e(f)}),d(r),d(n),F(()=>{A(o,t.title),A(c,t.message)}),g(e,n)}var Kv=new Set([`$$slots`,`$$events`,`$$legacy`]);function qv(e,t){let n=H(t,Kv),r=[[`path`,{d:`M16 5H3`}],[`path`,{d:`M11 12H3`}],[`path`,{d:`M16 19H3`}],[`path`,{d:`M18 9v6`}],[`path`,{d:`M21 12h-6`}]];P(e,B({name:`list-plus`},()=>n,{get iconNode(){return r}}))}var Jv=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yv(e,t){let n=H(t,Jv),r=[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}],[`path`,{d:`m15 5 4 4`}]];P(e,B({name:`pencil`},()=>n,{get iconNode(){return r}}))}var Xv=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zv(e,t){let n=H(t,Xv),r=[[`path`,{d:`M10 11v6`}],[`path`,{d:`M14 11v6`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}],[`path`,{d:`M3 6h18`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}]];P(e,B({name:`trash-2`},()=>n,{get iconNode(){return r}}))}function Qv(e,t){if(!e||e.isCollapsed||e.rangeCount===0)return;let n=e.toString();if(n.trim())try{for(let r=0;r<e.rangeCount;r+=1)if(e.getRangeAt(r).intersectsNode(t))return n}catch{}}var $v=h(`<div class="contents" role="presentation"><!></div>`);function ey(e,t){a(t,!0);let n=I(t,`disabled`,3,!1),i=Y(void 0),o=J(()=>t.menu(t.target,W(i)));function s(e){K(i,Qv(window.getSelection(),e.currentTarget),!0)}var c=$v();un(V(c),{get items(){return W(o)},get triggerClass(){return t.triggerClass},get disabled(){return n()},children:(e,n)=>{var r=U();u(R(r),()=>t.children),g(e,r)},$$slots:{default:!0}}),d(c),r(`contextmenu`,c,s),g(e,c),z()}T([`contextmenu`]);var ty=h(`<div> </div>`);function ny(e,t){a(t,!0);let n=I(t,`class`,3,``);var r=ty(),i=V(r,!0);d(r),F(e=>{s(r,1,e),A(i,t.text)},[()=>x(me(`min-w-0 max-w-full whitespace-pre-wrap break-words`,n()))]),g(e,r),z()}var ry=h(`<span class="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground"><!> Running…</span>`),iy=h(`<span> </span>`),ay=h(`<pre class="min-w-0 font-mono text-xs leading-4 whitespace-pre-wrap break-words text-muted-foreground"> </pre>`),oy=h(`<p class="font-mono text-xs italic text-muted-foreground">(no output)</p>`),sy=h(`<div class="border-t border-border px-2.5 py-1.5"><!></div>`),cy=h(`<div class="w-full min-w-0 overflow-hidden rounded-md border border-border bg-card text-card-foreground"><div class="flex items-start gap-2 px-2.5 py-1.5"><!> <pre class="min-w-0 flex-1 font-mono text-xs leading-5 whitespace-pre-wrap break-words"> </pre> <!></div> <!></div>`);function ly(e,t){let n=I(t,`output`,3,``),r=J(()=>t.exitCode===0||t.exitCode===void 0&&t.status===`completed`),i=J(()=>t.exitCode===void 0?t.status??``:`exit ${t.exitCode}`);var a=cy(),o=V(a),c=V(o);qu(c,{size:14,strokeWidth:2,class:`mt-0.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`});var l=L(c,2),u=V(l);d(l);var f=L(l,2),p=e=>{var t=ry();Fi(V(t),{class:`size-3`,"aria-label":`Running command`}),w(),d(t),g(e,t)},m=e=>{var n=iy(),a=V(n,!0);d(n),F(()=>{s(n,1,`shrink-0 font-mono text-xs leading-5 ${W(r)?`text-success`:`text-destructive`}`),q(n,`title`,t.status?`status: ${t.status}`:void 0),A(a,W(i))}),g(e,n)};k(f,e=>{t.phase===`running`?e(p):t.phase===`done`&&W(i)&&e(m,1)}),d(o);var h=L(o,2),_=e=>{var t=sy(),r=V(t),i=e=>{var t=ay(),r=V(t,!0);d(t),F(()=>A(r,n())),g(e,t)},a=e=>{g(e,oy())};k(r,e=>{n()?e(i):e(a,-1)}),d(t),g(e,t)};k(h,e=>{t.phase===`done`&&e(_)}),d(a),F(()=>A(u,`$ ${t.command??``}`)),g(e,a)}var uy=`(no output)`;function dy(e){let t=_r(e).map(e=>({start:e.start,end:e.end,segment:{kind:`command_result`,command:e.command,status:e.status,exitCode:e.exitCode,output:e.output===uy?``:e.output}})),n=Ur(e).filter(e=>!t.some(t=>e.start<t.end&&e.end>t.start)).map(e=>({start:e.start,end:e.end,segment:{kind:`command_pending`,command:e.command}})),r=[...t,...n].sort((e,t)=>e.start-t.start);if(r.length===0)return[{kind:`text`,text:e}];let i=[],a=0;for(let t of r)fy(i,e.slice(a,t.start)),i.push(t.segment),a=t.end;return fy(i,e.slice(a)),i}function fy(e,t){let n=t.replace(/^\n+/,``).replace(/\n+$/,``);n.length>0&&e.push({kind:`text`,text:n})}var py=h(`<div class="flex min-w-0 flex-col gap-2"></div>`);function my(e,t){a(t,!0);let n=I(t,`pending`,3,!1),r=J(()=>dy(t.text)),i=J(()=>W(r).length===1&&W(r)[0].kind===`text`);var o=U(),s=R(o),c=e=>{ny(e,{get text(){return t.text}})},l=e=>{var t=py();_(t,21,()=>W(r),E,(e,t)=>{var r=U(),i=R(r),a=e=>{ny(e,{get text(){return W(t).text}})},o=e=>{ly(e,{phase:`done`,get command(){return W(t).command},get status(){return W(t).status},get exitCode(){return W(t).exitCode},get output(){return W(t).output}})},s=e=>{{let r=J(()=>n()?`running`:`static`);ly(e,{get phase(){return W(r)},get command(){return W(t).command}})}};k(i,e=>{W(t).kind===`text`?e(a):W(t).kind===`command_result`?e(o,1):e(s,-1)}),g(e,r)}),d(t),g(e,t)};k(s,e=>{W(i)?e(c):e(l,-1)}),g(e,o),z()}var hy=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function gy(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=H(t,hy);var i=U();C(R(i),()=>Wc,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),z()}var _y=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function vy(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,_y);var i=U();C(R(i),()=>Xc,(e,t)=>{t(e,B({"data-slot":`tooltip-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),g(e,i),z()}var yy=new Set([`$$slots`,`$$events`,`$$legacy`]);function by(e,t){let n=H(t,yy);var r=U();C(R(r),()=>Ue,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var xy=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`sideOffset`,`side`,`children`,`arrowClasses`,`portalProps`]),Sy=h(`<div></div>`),Cy=h(`<!> <!>`,1);function wy(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`sideOffset`,3,0),i=I(t,`side`,3,`top`),o=H(t,xy);by(e,B(()=>t.portalProps,{children:(e,a)=>{var s=U(),c=R(s);{let e=J(()=>me(`data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm border bg-popover text-popover-foreground shadow-md z-50 w-fit max-w-xs origin-(--bits-tooltip-content-transform-origin)`,t.class));C(c,()=>qc,(a,s)=>{s(a,B({"data-slot":`tooltip-content`,get sideOffset(){return r()},get side(){return i()},get class(){return W(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=Cy(),i=R(r);u(i,()=>t.children??D);var a=L(i,2);{let e=(e,n)=>{let r=()=>n?.().props;var i=Sy();O(i,e=>({class:e,...r()}),[()=>me(`size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] border-r border-b border-border bg-popover fill-popover z-50`,`data-[side=top]:translate-x-1/2 data-[side=top]:translate-y-[calc(-50%+2px)]`,`data-[side=bottom]:-translate-x-1/2 data-[side=bottom]:-translate-y-[calc(-50%+1px)]`,`data-[side=right]:translate-x-[calc(50%+2px)] data-[side=right]:translate-y-1/2`,`data-[side=left]:-translate-y-[calc(50%-3px)]`,t.arrowClasses)]),g(e,i)};C(a,()=>Qc,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}g(e,r)},$$slots:{default:!0}}))})}g(e,s)},$$slots:{default:!0}})),z()}var Ty=new Set([`$$slots`,`$$events`,`$$legacy`,`delayDuration`]);function Ey(e,t){let n=I(t,`delayDuration`,3,0),r=H(t,Ty);var i=U();C(R(i),()=>$c,(e,t)=>{t(e,B({get delayDuration(){return n()}},()=>r))}),g(e,i)}var Dy=h(`<!> <!>`,1),Oy=h(`<article class="queued-prompt-card svelte-126i39" aria-label="Queued user prompt"><div class="queued-badge svelte-126i39" title="This prompt is queued for the next agent turn"><!> <span>Queued</span></div> <div class="queued-actions svelte-126i39" role="group" aria-label="Queued prompt actions"><!></div> <div class="queued-content svelte-126i39"><!></div></article>`);function ky(e,t){a(t,!0);let n=Y(void 0);async function r(e){if(!W(n)){K(n,e,!0);try{e===`edit`?await t.onMoveToComposer?.(t.prompt):await t.onDiscard?.(t.prompt)}catch{}finally{K(n,void 0)}}}let i=J(()=>({kind:`queued_prompt`,prompt:t.prompt,busy:!!W(n),canEdit:!!t.onMoveToComposer,canDiscard:!!t.onDiscard,onEdit:()=>void r(`edit`),onDiscard:()=>void r(`discard`)}));ey(e,{get target(){return W(i)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,i)=>{var a=Oy(),o=V(a);qv(V(o),{size:13,strokeWidth:2.2,"aria-hidden":`true`}),w(2),d(o);var s=L(o,2);C(V(s),()=>Ey,(e,i)=>{i(e,{delayDuration:300,disableHoverableContent:!0,children:(e,i)=>{var a=Dy(),o=R(a);C(o,()=>gy,(e,i)=>{i(e,{children:(e,i)=>{var a=Dy(),o=R(a);{let e=(e,i)=>{let a=()=>i?.().props;{let i=J(()=>!t.onMoveToComposer||!!W(n));G(e,B(a,{variant:`ghost`,size:`icon-xs`,get disabled(){return W(i)},ariaLabel:`Cancel and edit queued prompt`,onclick:()=>void r(`edit`),children:(e,t)=>{Yv(e,{"aria-hidden":`true`})},$$slots:{default:!0}}))}};C(o,()=>vy,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}C(L(o,2),()=>wy,(e,t)=>{t(e,{sideOffset:4,children:(e,t)=>{w(),g(e,M(`Cancel & Edit`))},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),C(L(o,2),()=>gy,(e,i)=>{i(e,{children:(e,i)=>{var a=Dy(),o=R(a);{let e=(e,i)=>{let a=()=>i?.().props;{let i=J(()=>!t.onDiscard||!!W(n));G(e,B(a,{variant:`ghost`,size:`icon-xs`,get disabled(){return W(i)},ariaLabel:`Discard queued prompt`,onclick:()=>void r(`discard`),children:(e,t)=>{Zv(e,{"aria-hidden":`true`})},$$slots:{default:!0}}))}};C(o,()=>vy,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}C(L(o,2),()=>wy,(e,t)=>{t(e,{sideOffset:4,children:(e,t)=>{w(),g(e,M(`Discard`))},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),d(s);var c=L(s,2);my(V(c),{get text(){return t.prompt.text}}),d(c),d(a),g(e,a)},$$slots:{default:!0}}),z()}var Ay=/(?:api[_-]?key|access[_-]?token|authorization|auth[_-]?token|bearer|cookie|credential|password|private[_-]?key|secret|session|token)/i,jy=/^(?:bearer\s+\S+|(?:gh[opusr]|sk|pk)_[A-Za-z0-9_-]{16,}|[A-Za-z0-9+/=_-]{40,})$/i,My=24e3,Ny=12,Py=240;function Fy(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Iy(e){if(typeof e!=`string`)return Fy(e);try{return Fy(JSON.parse(e))}catch{return{}}}function Ly(e){try{return JSON.parse(`"${e}"`)}catch{return e.replaceAll(`\\n`,`
15
+ `).replaceAll(`\\r`,`\r`).replaceAll(`\\t`,` `).replace(/\\(["\\/])/g,`$1`)}}function Ry(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function zy(e,t){let n=[],r=RegExp(`"${Ry(t)}"\\s*:\\s*"`,`g`),i=r.exec(e);for(;i;){let t=``,a=!1,o=i.index+i[0].length;for(;o<e.length&&t.length<My;){let n=e[o];if(!a&&n===`"`)break;t+=n,a?a=!1:n===`\\`&&(a=!0),o+=1}n.push(Ly(t)),i=r.exec(e)}return n}function By(e,t){let n=-1,r=!1,i=!1,a=-1;for(let o=0;o<e.length;o+=1){let s=e[o];if(r){if(i)i=!1;else if(s===`\\`)i=!0;else if(s===`"`){if(r=!1,Ly(e.slice(a,o))!==t)continue;let i=o+1;for(;/\s/.test(e[i]??``);)i+=1;if(e[i]!==`:`)continue;for(i+=1;/\s/.test(e[i]??``);)i+=1;if(e[i]===`[`){n=i;break}}continue}s===`"`&&(r=!0,a=o+1)}if(n<0)return[];let o=[],s=1,c=0,l=-1;r=!1,i=!1;for(let t=n+1;t<e.length;t+=1){let n=e[t];if(r){i?i=!1:n===`\\`?i=!0:n===`"`&&(r=!1);continue}if(n===`"`){r=!0;continue}if(n===`[`){s+=1;continue}if(n===`]`){if(--s,s===0)break;continue}if(n===`{`){c===0&&s===1&&(l=t),l>=0&&(c+=1);continue}if(n===`}`&&l>=0&&(--c,c===0&&(o.push(e.slice(l,Math.min(t+1,l+My))),l=-1,o.length>=Ny)))break}return l>=0&&o.length<Ny&&o.push(e.slice(l,Math.min(e.length,l+My))),o}function Vy(e,t){let n=zy(e,t)[0];if(n!==void 0)return n;let r=e.match(RegExp(`"${Ry(t)}"\\s*:\\s*(true|false|-?(?:\\d+\\.?\\d*|\\.\\d+))`));if(!r)return;if(r[1]===`true`)return!0;if(r[1]===`false`)return!1;let i=Number(r[1]);return Number.isFinite(i)?i:void 0}function Hy(e){if(typeof e==`string`)return e;if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`boolean`)return e?`true`:`false`;if(e===null)return`null`;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`);return t.length===e.length?t.join(`, `):`${e.length} ${e.length===1?`item`:`items`}`}if(e&&typeof e==`object`){let t=Object.keys(e);return t.length>0?`fields: ${t.join(`, `)}`:`empty object`}}function Uy(e){return Ay.test(e)}function Wy(e){return jy.test(e.trim())}function Gy(e,t){if(Uy(e))return`[redacted]`;let n=Hy(t)??`[unavailable]`;return Wy(n)?`[redacted]`:n}var Ky=class e{argsText;records;constructor(e={}){this.argsText=e.argsText??``;let t=Fy(e.args),n=Iy(this.argsText),r=Iy(e.argsPreview);this.records=[t,n,r].filter(e=>Object.keys(e).length>0)}value(e){for(let t of this.records)if(Object.hasOwn(t,e))return t[e];return Vy(this.argsText,e)}string(e){let t=this.value(e);return typeof t==`string`?t:void 0}strings(e){let t=this.value(e);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);return e.length>0?e:t.length===0?[]:void 0}let n=zy(this.argsText,e);return n.length>0?n:void 0}number(e){let t=this.value(e);return typeof t==`number`&&Number.isFinite(t)?t:void 0}boolean(e){let t=this.value(e);return typeof t==`boolean`?t:void 0}array(e){let t=this.value(e);return Array.isArray(t)?t:void 0}recordsArray(e){let t=this.array(e);if(t)return t.map(Fy).filter(e=>Object.keys(e).length>0)}objectArraySources(t){for(let n of this.records){if(!Object.hasOwn(n,t))continue;let r=n[t];return Array.isArray(r)?r.slice(0,Ny).map(t=>new e({args:Fy(t)})):[]}return By(this.argsText,t).map(t=>new e({argsText:t}))}record(e){let t=this.value(e);if(!(!t||typeof t!=`object`||Array.isArray(t)))return t}objectKeys(e){return Object.keys(this.record(e)??{})}count(e){return this.array(e)?.length}selectorCount(...e){return e.reduce((e,t)=>{let n=this.value(t);return Array.isArray(n)?e+n.length:n==null||n===``?e:e+1},0)}nestedStrings(e){let t=[],n=r=>{if(Array.isArray(r)){for(let e of r)n(e);return}if(!r||typeof r!=`object`)return;let i=r;typeof i[e]==`string`&&t.push(i[e]);for(let e of Object.values(i))e&&typeof e==`object`&&n(e)};for(let e of this.records)n(e);return t.length>0?t:zy(this.argsText,e)}structuredEntries(e=Ny){let t=this.records[0]??this.records[1]??this.records[2];if(t)return Object.entries(t).slice(0,e).map(([e,t])=>{let n=Gy(e,t);return{key:e,value:n.length>Py?`${n.slice(0,Py-1)}…`:n,redacted:n===`[redacted]`}});let n=Array.from(this.argsText.matchAll(/"([^"\\]{1,80})"\s*:/g),e=>e[1]);return[...new Set(n)].slice(0,e).map(e=>{let t=Gy(e,Vy(this.argsText,e));return{key:e,value:t,redacted:t===`[redacted]`}})}};function qy(e={}){return new Ky(e)}var Jy=20;function Yy(e,t,n,r){let i=Xy(e.toolName);if(!i)return{kind:`generic`,toolName:e.toolName,args:[],result:[]};let a=At(n),o=Xt(a?.details),s=qt(a?.details),c=Dee.safeParse(a?.details),l=c.success?c.data:jt(a?.details)??{},u=wt(a,n,r),d=Zy(l.spaces,e=>pr.parse(e)),f=Zy(l.pages,e=>dr.parse(e)),p=Zy(l.attachments,e=>Er.parse(e)),m=Zy(l.outcomes,e=>Tr.parse(e)),h=dr.safeParse(l.page),g=pr.safeParse(l.space),_=Er.safeParse(l.attachment);return{kind:`confluence`,action:i,toolName:e.toolName,content:u,contentLineCount:o?.model?.displayedLines??$y(u),messageLines:eb(u),query:kt(l.query)??kt(t.query),cql:kt(l.cql)??kt(t.cql),pageId:kt(l.pageId)??(h.success?h.data.id:void 0)??kt(t.page_id),spaceId:kt(l.spaceId)??(g.success?g.data.id:void 0)??kt(t.space_id),spaceKey:kt(l.spaceKey)??(g.success?g.data.key:void 0)??kt(t.space_key),title:kt(l.title)??(h.success?h.data.title:void 0)??kt(t.title),status:kt(l.status)??kt(t.status),bodyFormat:kt(l.bodyFormat)??kt(t.body_format),spaces:d.slice(0,Jy),space:g.success?g.data:d[0],spaceCount:Qy(l.spaceCount)??(d.length>0?d.length:void 0),displayedSpaceCount:Qy(l.displayedSpaceCount)??(d.length>0?Math.min(d.length,Jy):void 0),pages:f.slice(0,Jy),page:h.success?h.data:f[0],pageCount:Qy(l.pageCount)??(f.length>0?f.length:void 0),displayedPageCount:Qy(l.displayedPageCount)??(f.length>0?Math.min(f.length,Jy):void 0),attachments:p.slice(0,Jy),attachment:_.success?_.data:p[0],attachmentCount:Qy(l.attachmentCount)??(p.length>0?p.length:void 0),displayedAttachmentCount:Qy(l.displayedAttachmentCount)??(p.length>0?Math.min(p.length,Jy):void 0),includedCounts:c.success?c.data.includedCounts:void 0,downloadDir:kt(l.downloadDir),manifestPath:kt(l.manifestPath),pagesJsonlPath:kt(l.pagesJsonlPath),inputPath:kt(l.inputPath)??kt(t.input_path),nextCursor:kt(l.nextCursor),outcomes:m.slice(0,Jy),outcomeCount:Qy(l.outcomeCount)??(m.length>0?m.length:void 0),displayedOutcomeCount:Qy(l.displayedOutcomeCount)??(m.length>0?Math.min(m.length,Jy):void 0),dryRun:typeof l.dryRun==`boolean`?l.dryRun:void 0,payload:l.payload,outputLimits:o,outputArtifacts:s}}function Xy(e){switch(e){case`confluence_search_spaces`:return`search_spaces`;case`confluence_search_pages`:return`search_pages`;case`confluence_get_page`:return`get_page`;case`confluence_download_pages`:return`download_pages`;case`confluence_create_page`:return`create_page`;case`confluence_update_page`:return`update_page`;case`confluence_publish_pages`:return`publish_pages`;case`confluence_upload_attachment`:return`upload_attachment`;default:return}}function Zy(e,t){return Array.isArray(e)?e.flatMap(e=>{try{return[t(e)]}catch{return[]}}):[]}function Qy(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function $y(e){return e?e.length===0?0:e.split(`
16
+ `).length:0}function eb(e){return e?e.split(`
17
+ `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`- `)).slice(0,8):[]}function tb(e){if(!e)return{updates:[]};let t=[],n=[];for(let r of e.split(/\r?\n/)){let e=r.trim();if(e){try{let n=jt(JSON.parse(e));if(n.type===`explore_progress`&&typeof n.timestamp==`string`&&typeof n.phase==`string`&&typeof n.message==`string`){t.push({type:`explore_progress`,timestamp:n.timestamp,agentId:kt(n.agentId),taskIndex:typeof n.taskIndex==`number`?n.taskIndex:void 0,taskCount:typeof n.taskCount==`number`?n.taskCount:void 0,label:kt(n.label),model:kt(n.model),thinkingLevel:kt(n.thinkingLevel),phase:n.phase,message:n.message,report:See.safeParse(n.report).data});continue}}catch{}n.push(r)}}return{updates:t,fallback:n.length>0?n.join(`
18
+ `):void 0}}var nb=new Set([`Final report received.`]);function rb(e){return/\bcompleted\b/i.test(e)&&!/\b(?:failed|error)\b/i.test(e)}function ib(e){if(!nb.has(e.message))switch(e.phase){case`tool_call`:return{text:e.message,mono:!1};case`tool_result`:return rb(e.message)?void 0:{text:e.message,mono:!0};case`assistant`:return;case`completed`:case`failed`:return{text:e.message,mono:!1};case`started`:return e.agentId?{text:`Started.`,mono:!1}:void 0;case`queued`:return}}function ab(e){let t=e.updates.map(ib).filter(e=>e!==void 0);return t.length>0?t.slice(-3):(e.status===`failed`||e.status===`aborted`)&&e.error?[{text:e.error,mono:!1}]:e.status===`completed`&&e.report?.summaryPreview?[{text:e.report.summaryPreview,mono:!1}]:[]}var ob=new WeakMap;function sb(e){let t=ob.get(e);if(t)return t;let n=cb(e);return ob.set(e,n),n}function cb(e){let t=e.reports,n=new Map,r=-1,i=0;for(let t of e.liveUpdates){if(typeof t.taskCount==`number`&&(i=Math.max(i,t.taskCount)),typeof t.taskIndex!=`number`)continue;r=Math.max(r,t.taskIndex);let e=n.get(t.taskIndex)??[];e.push(t),n.set(t.taskIndex,e)}let a=Math.max(i,t.length,r+1,+(e.liveUpdates.length>0||t.length>0)),o=[];for(let r=0;r<a;r+=1){let i=n.get(r)??[],s=i.findLast(e=>e.report)?.report,c=t[r]??s,l=i[i.length-1],u=i.map(ib).filter(e=>e!==void 0).slice(-3),d=u[u.length-1],f=i.find(e=>e.phase===`failed`),p;p=c?.status===`aborted`?`aborted`:c?.status===`failed`?`failed`:c?.status===`completed`||c||i.some(e=>e.phase===`completed`)?`completed`:f?`failed`:i.some(e=>[`started`,`tool_call`,`tool_result`,`assistant`].includes(e.phase))?`running`:`queued`;let m=p===`running`?d:void 0,h=c?.model??i.find(e=>e.model)?.model??l?.model,g=c?.thinkingLevel??i.find(e=>e.thinkingLevel)?.thinkingLevel??l?.thinkingLevel,_=c?.errorMessage??c?.summaryPreview??f?.message;o.push({key:`task-${r}`,index:r,count:a||void 0,label:c?.label??l?.label,task:c?.task??e.task,agentId:c?.agentId??l?.agentId,model:h,thinkingLevel:g,status:p,revision:`${l?.timestamp??`stored`}:${c?.status??`live`}`,currentAction:m?.text,currentActionMono:m?.mono??!1,recentActions:p===`running`?u:[],recentMessages:ab({status:p,report:c,error:_,updates:i}),actionCount:i.filter(e=>e.phase===`tool_call`).length,report:c,error:_})}let s=o.filter(e=>e.status===`completed`).length,c=o.filter(e=>e.status===`failed`).length,l=o.filter(e=>e.status===`aborted`).length;return{tasks:o,summary:{total:a,completed:s,failed:c,aborted:l,running:o.filter(e=>e.status===`running`||e.status===`queued`).length,totalTurns:o.reduce((e,t)=>e+(t.report?.usage?.turns??0),0),totalTokens:o.reduce((e,t)=>{let n=t.report?.usage;return e+(n?n.totalTokens||n.input+n.output:0)},0),done:a>0&&s+c+l===a}}}var lb=20,ub=20,db=300;function fb(e,t,n,r){let i=pb(e.toolName);if(!i)return{kind:`generic`,toolName:e.toolName,args:[],result:[]};let a=At(n),o=Xt(a?.details),s=qt(a?.details),c=Db(a?.details),l=wt(a,n,r),u=kt(c.projectKey)??kt(t.project_key),d=Sb(c.issue),f=Ab(l).slice(0,lb),p=d??(i===`get_issue`?f[0]:void 0),m=Ob(c.issues,Sb).slice(0,lb),h=m.length>0?m:f,g=jb(l).slice(0,lb),_=Ob(c.transitions,wb).slice(0,lb),v=_.length>0?_:g,y=Ob(c.users,Tb).slice(0,lb),b=Ob(c.fields,Eb).slice(0,ub),x=Pb(c.includedCounts,l),S=_b(c.updatedFields).filter(e=>typeof e==`string`).slice(0,ub);return{kind:`jira`,action:i,toolName:e.toolName,content:l,contentLineCount:gb(l,e,`lines`,`head`,o),messageLines:Nb(l),query:kt(c.query)??kt(t.query),jql:kt(c.jql)??kt(t.jql),issueKey:kt(c.issueKey)??p?.key??kt(t.issue_key)??kt(t.parent_key),projectKey:u,issueType:kt(c.issueType)??kt(t.issue_type),summary:yb(kt(c.summary)??kt(t.summary)),issue:p,issues:h,issueCount:vb(c.issueCount)??(h.length>0?h.length:void 0),displayedIssueCount:vb(c.displayedIssueCount)??(h.length>0?h.length:void 0),total:vb(c.total),nextPageToken:kt(c.nextPageToken),users:y,userCount:vb(c.userCount)??(y.length>0?y.length:void 0),displayedUserCount:vb(c.displayedUserCount)??(y.length>0?y.length:void 0),project:Cb(c.project,u),includedCounts:x,dryRun:typeof c.dryRun==`boolean`?c.dryRun:void 0,resolvedAssignee:Tb(c.resolvedAssignee),updatedFields:S,updatedFieldCount:vb(c.updatedFieldCount)??(S.length>0?S.length:void 0),commentId:kt(c.commentId),transition:wb(c.transition),transitions:v,fields:b,payload:c.payload,fieldCount:vb(c.fieldCount)??(b.length>0?b.length:void 0),displayedFieldCount:vb(c.displayedFieldCount)??(b.length>0?b.length:void 0),transitionCount:vb(c.transitionCount)??(v.length>0?v.length:void 0),displayedTransitionCount:vb(c.displayedTransitionCount)??(v.length>0?v.length:void 0),outputLimits:o,outputArtifacts:s}}function pb(e){switch(e){case`jira_search_users`:return`search_users`;case`jira_search_issues`:return`search_issues`;case`jira_get_issue`:return`get_issue`;case`jira_get_project`:return`get_project`;case`jira_create_issue`:return`create_issue`;case`jira_update_issue`:return`update_issue`;case`jira_add_comment`:return`add_comment`;case`jira_transition_issue`:return`transition_issue`;default:return}}function mb(e){return e?e.length===0?0:e.split(`
19
+ `).length:0}function hb(e,t,n){let r=`previewOverflow`in e?e.previewOverflow:void 0;return!r||r.noun!==t||n&&r.direction!==n?0:r.hidden}function gb(e,t,n,r,i){return i?.model?.displayedLines??mb(e)+hb(t,n,r)}function _b(e){return Array.isArray(e)?e:[]}function vb(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function yb(e){if(e===void 0)return;let t=e.replace(/\s+/g,` `).trim();return t.length<=db?t:`${t.slice(0,db-1)}…`}function bb(e){return kt(jt(e).name)}function xb(e){return kt(jt(e).displayName)??bb(e)}function Sb(e){let t=jee.safeParse(e);if(t.success)return t.data;let n=jt(e),r=jt(n.fields),i=kt(n.key)??kt(n.id);if(i)return{key:i,id:kt(n.id),summary:yb(kt(r.summary)),issueType:yb(bb(r.issuetype)),status:yb(bb(r.status)),statusCategory:yb(kt(jt(jt(r.status).statusCategory).key)),assignee:yb(xb(r.assignee)),priority:yb(bb(r.priority)),updated:yb(kt(r.updated))}}function Cb(e,t){let n=Gr.safeParse(e);if(n.success)return n.data;let r=jt(e),i=kt(r.key)??t??kt(r.id);return i?{key:i,id:kt(r.id),name:yb(kt(r.name)),projectTypeKey:yb(kt(r.projectTypeKey)),lead:yb(xb(r.lead))}:t?{key:t}:void 0}function wb(e){let t=Pee.safeParse(e);if(t.success)return t.data;let n=jt(e),r=kt(n.id);if(r)return{id:r,name:yb(kt(n.name)),to:yb(bb(n.to)??kt(n.to)),toStatusCategory:yb(kt(jt(jt(n.to).statusCategory).key))}}function Tb(e){let t=wee.safeParse(e);if(t.success)return t.data;let n=jt(e),r=kt(n.accountId);if(r)return{accountId:r,displayName:yb(xb(n)),emailAddress:yb(kt(n.emailAddress)),active:typeof n.active==`boolean`?n.active:void 0,accountType:yb(kt(n.accountType))}}function Eb(e){let t=Eee.safeParse(e);if(t.success)return t.data;let n=jt(e),r=kt(n.id)??kt(n.key);if(r)return{id:r,name:yb(kt(n.name)),key:yb(kt(n.key)),required:typeof n.required==`boolean`?n.required:void 0,type:yb(kt(n.type)),custom:typeof n.custom==`boolean`?n.custom:void 0}}function Db(e){let t=yee.safeParse(e);return t.success?t.data:jt(e)}function Ob(e,t){return _b(e).flatMap(e=>{let n=t(e);return n?[n]:[]})}function kb(e){return!!(e&&/^[A-Z][A-Z0-9]+-\d+$/.test(e))}function Ab(e){return e?e.split(/\r?\n/).flatMap(e=>{let t=e.trim();if(!t.startsWith(`- `))return[];let[n,...r]=t.slice(2).split(/\s+—\s+/),i=n.split(` · `).map(e=>e.trim()).filter(Boolean),a=i[0];if(!kb(a))return[];let o,s,c,l;for(let e of i.slice(1))e.startsWith(`assignee: `)?l=e.slice(10):e.startsWith(`priority: `)?c=e.slice(10):o?s||=e:o=e;return[{key:a,issueType:yb(o),status:yb(s),priority:yb(c),assignee:yb(l),summary:yb(r.join(` — `))}]}):[]}function jb(e){return e?e.split(/\r?\n/).flatMap(e=>{let t=e.trim(),n=/^-\s+([^·]+?)\s+·\s+(.+?)(?:\s+→\s+(.+))?$/.exec(t);if(!n)return[];let r=n[1]?.trim();return!r||kb(r)?[]:[{id:r,name:yb(n[2]?.trim()),to:yb(n[3]?.trim())}]}):[]}function Mb(e){if(!e)return;let t={};for(let n of e.split(/\r?\n/)){let e=/^(Comments|statuses|components|versions|issueTypes|fields|priorities|resolutions|Worklogs|Attachments|Remote links|Changelog entries|Edit fields):\s+(\d+)\s*$/i.exec(n.trim());if(!e)continue;let r=e[1].toLowerCase().replace(`remote links`,`remoteLinks`).replace(`changelog entries`,`changelog`).replace(`edit fields`,`editmetaFields`).replace(`issuetypes`,`issueTypes`);t[r===`comments`?`comments`:r]=Number(e[2])}return Object.keys(t).length>0?t:void 0}function Nb(e){return e?e.split(/\r?\n/).map(e=>e.trim()).filter(e=>!(!e||e.startsWith(`Raw JSON saved to:`)||e.startsWith(`Available transitions`)||e.startsWith(`- `))).slice(0,lb):[]}function Pb(e,t){let n=jt(e),r={};for(let e of[`comments`,`transitions`,`statuses`,`components`,`versions`,`issueTypes`,`fields`,`priorities`,`resolutions`,`worklogs`,`changelog`,`remoteLinks`,`attachments`,`editmetaFields`]){let t=vb(n[e]);t!==void 0&&(r[e]=t)}return Object.keys(r).length>0?r:Mb(t)}function Fb(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Ib(e){let t=e.exitCode!==void 0||e.signal!==void 0||e.error!==void 0,n=!!(e.groupId||e.restartedFromTaskId);return{id:e.id,name:e.name,cwd:e.cwd,command:e.command,status:e.status,readiness:{outcome:e.readiness.outcome,readyUrl:e.readiness.readyUrl,readyOnUrl:e.readiness.readyOnUrl,matched:e.readiness.matched},timing:{startedAt:e.startedAt,finishedAt:e.finishedAt},termination:t?{exitCode:e.exitCode,signal:e.signal,error:e.error}:void 0,lineage:n?{groupId:e.groupId,restartedFromTaskId:e.restartedFromTaskId}:void 0}}function Lb(e){let t=jr.safeParse(e);if(t.success)return t.data;let n=wr.safeParse(e);return n.success?Ib(n.data):void 0}function Rb(e){if(!Array.isArray(e))return{tasks:[],valid:!1};let t=[],n=!0;for(let r of e){let e=Lb(r);e?t.push(e):n=!1}return{tasks:t,valid:n}}function zb(e){if(!Array.isArray(e))return{events:[],valid:!1};let t=[],n=!0;for(let r of e){let e=Lr.safeParse(r);e.success?t.push(e.data):n=!1}return{events:t,valid:n}}function Bb(e){let t=vr.safeParse(e);if(t.success)return{task:t.data.task,previewUnavailable:!1};let n=Lb(Fb(e).task);return{task:n,previewUnavailable:!n}}function Vb(e){let t=vee.safeParse(e);if(t.success)return{task:t.data.task,restartedFromTaskId:t.data.restartedFromTaskId,previewUnavailable:!1};let n=Fb(e),r=Lb(n.task),i=typeof n.restartedFromTaskId==`string`?n.restartedFromTaskId:r?.lineage?.restartedFromTaskId;return{task:r,restartedFromTaskId:i,previewUnavailable:!r||!i}}function Hb(e){let t=Ree.safeParse(e);if(t.success)return{tasks:t.data.outcomes.flatMap(e=>e.task?[e.task]:[]),outcomes:t.data.outcomes,previewUnavailable:!1};let n=Fb(e),r=Array.isArray(n.tasks)?n.tasks:[];if(!Array.isArray(n.cancelResults))return{tasks:[],outcomes:[],previewUnavailable:!0};let i=[],a=!0;for(let e=0;e<n.cancelResults.length;e+=1){let t=Fee.safeParse(n.cancelResults[e]);if(!t.success){a=!1;continue}let o=r[e],s=o===void 0?void 0:Lb(r[e]);o!==void 0&&!s&&(a=!1),i.push({task:s,outcome:t.data.outcome,status:t.data.status,message:t.data.message})}return{tasks:i.flatMap(e=>e.task?[e.task]:[]),outcomes:i,previewUnavailable:!a}}function Ub(e){let t=Vr.safeParse(e);if(t.success)return{tasks:t.data.tasks,previewUnavailable:!1};let n=Rb(Fb(e).tasks);return{tasks:n.tasks,previewUnavailable:!n.valid}}function Wb(e){let t=Aee.safeParse(e);if(t.success)return{task:t.data.task,events:t.data.events,nextCursor:t.data.nextCursor,mode:t.data.mode,previewUnavailable:!1};let n=Fb(e),r=Lb(n.task),i=zb(n.events),a=typeof n.nextCursor==`number`&&Number.isInteger(n.nextCursor)&&n.nextCursor>=0?n.nextCursor:void 0,o=typeof n.mode==`string`?n.mode:void 0;return{task:r,events:i.events,nextCursor:a,mode:o,previewUnavailable:!r||!i.valid||a===void 0||o===void 0}}function Gb(e){return Array.isArray(e)?e:[]}function Kb(e){return Gb(e.replacements).length+Gb(e.insertions).length+Gb(e.lineReplacements).length+Gb(e.lineInsertions).length+ +(typeof e.patch==`string`&&e.patch.length>0)}function qb(e,t,n){let r=`previewOverflow`in e?e.previewOverflow:void 0;return!r||r.noun!==t||n&&r.direction!==n?0:r.hidden}function Jb(e,t,n,r){return e+qb(t,n,r)}function tie(e){return e?.model?.displayedLines}function Yb(e,t,n,r,i){return tie(i)??Jb(Mt(e),t,n,r)}var Xb=new Li(300);function Zb(e){if(e===void 0)return``;if(typeof e==`string`)return`s:${e.length}`;try{return`j:${JSON.stringify(e)?.length??0}`}catch{return`u`}}function nie(e,t){let n=e,r=`result`in e||`args`in e?`full`:`preview`,i=`previewOverflow`in e?e.previewOverflow:void 0;return[e.id,e.status,e.updatedAt,r,Zb(n.argsPreview??n.args),Zb(n.resultPreview??n.result),i?`${i.hidden}:${i.noun}:${i.direction}`:``,t?.updatedAt??``,t?.text.length??0].join(`\0`)}function Qb(e,t){let n=nie(e,t),r=Xb.get(n);if(r!==void 0)return r;let i=rie(e,t);return Xb.set(n,i),i}function rie(e,t){let n=e,r=n.argsPreview??n.args,i=n.resultPreview??n.result,a=jt(r),o=e.cwd,s=At(i),c=Xt(s?.details),l=qt(s?.details);switch(e.toolName){case`read`:{let t=Ot(s?.path??kt(a.path),o),n=Yt(t,o),r=s?.contentBlocks?.find(e=>e.type===`image`);if(r&&r.type===`image`)return{kind:`read`,path:t,relPath:n,image:{dataUrl:lee(r.mimeType,r.data),mimeType:r.mimeType},truncated:!1,outputLimits:c,outputArtifacts:l};let i=s?.content,u=typeof a.offset==`number`||typeof a.limit==`number`,d,f=i===void 0?void 0:Yb(i,e,`lines`,`head`,c);if(f!==void 0)if(u&&typeof a.offset==`number`&&f>0){let e=a.offset;d=`lines ${e}–${e+f-1}`}else d=`${f} line${f===1?``:`s`}`;return{kind:`read`,path:t,relPath:n,lineLabel:d,lineCount:f,content:i,truncated:Ht(s?.details),outputLimits:c,outputArtifacts:l}}case`bash`:{let n=kt(a.command),r=Oee.safeParse(s?.details),o=wt(s,i,t),u=Yb(o,e,`lines`,`tail`,c);return{kind:`bash`,command:n,exitCode:s?.exitCode,signal:r.success?r.data.signal??void 0:void 0,backgroundTask:r.success&&r.data.execution?.disposition===`backgrounded`?{taskId:r.data.execution.taskId,status:r.data.execution.status,elapsedMs:r.data.execution.elapsedMs,terminalUpdate:r.data.execution.terminalUpdate}:void 0,output:o,outputLineCount:u,savedTo:r.success?r.data.fullOutputPath:void 0,truncated:Ht(s?.details),live:!s&&!!t?.text,outputLimits:t?.outputLimits?{...c,live:{...t.outputLimits}}:c,outputArtifacts:l}}case`python`:case`python_exec`:{let n=kt(a.code),r=kt(a.path),u=Nee.safeParse(s?.details),d=Ot((u.success?u.data.scriptPath:void 0)??r,o),f=wt(s,i,t),p=n?Jb(Mt(n),e,`lines`,`head`):0,m=Yb(f,e,`lines`,`tail`,c);return{kind:`python`,inputMode:u.success?u.data.inputMode??(d?`file`:`inline`):r?`file`:`inline`,code:n,codeLineCount:p,scriptPath:d,relScriptPath:Yt(d,o),exitCode:s?.exitCode,signal:u.success?u.data.signal??void 0:void 0,output:f,outputLineCount:m,savedTo:u.success?u.data.fullOutputPath:void 0,truncated:Ht(s?.details),live:!s&&!!t?.text,allowNetwork:u.success?u.data.allowNetwork:void 0,allowFileWrite:u.success?u.data.allowFileWrite:void 0,durationMs:u.success?u.data.durationMs:void 0,timedOut:u.success?u.data.timedOut:void 0,timeoutKilled:u.success?u.data.timeoutKilled:void 0,envKeys:u.success?u.data.envKeys:void 0,artifactDir:u.success?u.data.artifactDir:void 0,artifacts:u.success?u.data.artifacts:void 0,streams:u.success?u.data.streams:void 0,outputLimits:t?.outputLimits?{...c,live:{...t.outputLimits}}:c,outputArtifacts:l}}case`edit`:{let t=Ot(s?.path??kt(a.path),o),n=Yt(t,o),r=kee.safeParse(s?.details),i=r.success?r.data.operationCount:Kb(a),c=r.success?r.data.diff:void 0,l=Jb(Mt(c),e,`lines`,`tail`),{additions:u,deletions:d}=zt(c);return{kind:`edit`,path:t,relPath:n,operationCount:i,additions:u,deletions:d,diff:c,diffLineCount:l,dryRun:r.success?r.data.dryRun:void 0}}case`write`:{let t=Ot(s?.path??kt(a.path),o),n=Yt(t,o),r=kt(a.content),i=s?.content?.match(/Wrote (\d+) bytes/);return{kind:`write`,path:t,relPath:n,bytes:i?Number(i[1]):void 0,lineCount:r===void 0?void 0:Jb(Mt(r),e,`lines`,`tail`),charCount:r?.length,content:r}}case`grep`:{let t=kt(a.pattern),n=Ot(s?.path,o)??Ot(kt(a.path)??`.`,o)??o,r=(s?.matches??[]).map(e=>Lt({...e,openPath:Ot(e.path,n)??e.path})),i=Nt(r);return{kind:`grep`,pattern:t,matchCount:Jb(r.length,e,`matches`,`head`),fileCount:i.length,allMatches:i}}case`find`:{let t=kt(a.pattern),n=s?.entries??[],r=Ot(s?.path,o)??Ot(kt(a.path)??`.`,o)??o,i=n.map(e=>e.path);return{kind:`find`,pattern:t,paths:i,openPaths:n.map(e=>Ot(e.path,r)??e.path),count:Jb(i.length,e,`files`,`head`)}}case`ls`:{let t=Ot(s?.path??kt(a.path),o),n=Yt(t,o)??`.`,r=(s?.entries??[]).map(e=>({...e,openPath:Ot(e.path,t??o)??e.path}));return{kind:`ls`,path:t,relPath:n,entries:r,total:Jb(r.length,e,`entries`,`head`)}}case`ask_user`:{let e=bee.safeParse(i),t=e.success?e.data:void 0;return{kind:`ask_user`,question:t?.question??kt(a.question),context:t?.context??kt(a.context),recommendation:t?.recommendation??kt(a.recommendation),answer:t?.response,dismissed:!!t?.dismissed,dismissedReason:t?.dismissedReason}}case`todos_set`:case`todos_get`:{let e=Cee.safeParse(i),t=(e.success?e.data.details?.todos:void 0)??cee(a.todos)??[];return{kind:`todos`,items:t,completed:t.filter(e=>e.done).length,total:t.length}}case`task_start`:return{kind:`task_action`,action:`start`,...Bb(i),liveLog:t?.text};case`task_cancel`:{let n=Hb(i),r=n.outcomes?.length??0;return{kind:`task_action`,action:`cancel`,task:n.tasks?.[0],...n,outcomeCount:r+qb(e,`tasks`,`head`),liveLog:t?.text}}case`task_restart`:return{kind:`task_action`,action:`restart`,...Vb(i),liveLog:t?.text};case`task_status`:{let t=Ub(i),n=qb(e,`tasks`,`head`);return{kind:`task_status`,...t,hiddenTaskCount:n,taskCount:t.tasks.length+n}}case`task_logs`:{let t=Wb(i);return{kind:`task_logs`,...t,eventCount:Jb(t.events.length,e,`events`,`tail`)}}case`explore`:{let e=Tee.safeParse(i),n=e.success?e.data:void 0,r=kt(a.task),o=tb(t?.text);return{kind:`explore`,task:r,reports:n?.reports??[],liveUpdates:o.updates,liveLog:o.fallback}}case`plan_mode_enter`:{let e=kt(jt(i).planDir);return{kind:`plan_mode`,action:`enter`,summary:Pt(i),planPath:e}}case`plan_mode_present`:{let e=jt(i),t=jt(e.review),n=kt(t.planPath)??kt(a.file_path),r=kt(e.outcome)??kt(t.status);return{kind:`plan_mode`,action:`present`,summary:kt(e.feedback)??Pt(i),planPath:n,outcome:r}}case`plan_mode_force_exit`:return{kind:`plan_mode`,action:`force_exit`,summary:kt(jt(i).reason)};case`jira_search_users`:case`jira_search_issues`:case`jira_get_issue`:case`jira_get_project`:case`jira_create_issue`:case`jira_update_issue`:case`jira_add_comment`:case`jira_transition_issue`:return fb(e,a,i,t);case`confluence_search_spaces`:case`confluence_search_pages`:case`confluence_get_page`:case`confluence_download_pages`:case`confluence_create_page`:case`confluence_update_page`:case`confluence_publish_pages`:case`confluence_upload_attachment`:return Yy(e,a,i,t);case`web_search`:{let e=Iee.safeParse(s?.details),t=e.success?e.data.query:kt(a.query),n=e.success?e.data.results:[];return{kind:`web_search`,query:t,answer:e.success?e.data.answer:void 0,results:n,outputLimits:c,outputArtifacts:l}}case`web_fetch`:{let e=Lee.safeParse(s?.details),t=e.success?e.data:void 0;return{kind:`web_fetch`,url:t?.url??kt(a.url),status:t?.status,contentType:t?.contentType,size:t?.size,savedTo:t?.savedTo,converted:t?.converted??!1,content:s?.content,outputLimits:c,outputArtifacts:l}}default:{let n=wt(s,i,t),a=n?Gy(`result`,n).slice(0,6e3):void 0;return{kind:`generic`,toolName:e.toolName,args:qy({args:r}).structuredEntries(),result:qy({args:i}).structuredEntries(),resultText:a}}}}function $b(e){return e.split(/[\\/]/).pop()||e}function iie(e){if(e===void 0)return;if(e<1024)return`${e} B`;let t=e/1024;return t<1024?`${t.toFixed(1)} KB`:`${(t/1024).toFixed(1)} MB`}function aie(e){if(e!==void 0)return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ex(e,t,n=`s`){return`${e} ${t}${e===1?``:n}`}function tx(e){return Mt(e)}function nx(e,t,n=`head`,r=6){let i=e-r;if(!(i<=0))return rx(i,t,n)}function rx(e,t,n=`head`){if(!(!e||e<=0))return{hidden:e,label:n===`mixed`?`Show complete tool call (${e} more ${t})`:`Show ${e} ${n===`tail`?`earlier`:`more`} ${t}`}}function oie(e,t){switch(e.status){case`error`:case`denied`:return{tone:`danger`,pulse:!1};case`running`:case`requested`:return{tone:`running`,pulse:!0};case`pending_approval`:case`waiting_for_user`:return{tone:`warn`,pulse:!0};default:break}return(t.kind===`bash`||t.kind===`python`)&&t.exitCode!==void 0&&t.exitCode!==0||t.kind===`explore`&&sb(t).summary.failed>0?{tone:`danger`,pulse:!1}:{tone:`good`,pulse:!1}}var ix=300,sie=6e3;function cie(e){if(e===void 0)return;let t=e.replace(/\s+/g,` `).trim();return t.length<=ix?t:`${t.slice(0,ix-1)}…`}function lie(e){if(e!==void 0)return e.length<=sie?e:e.slice(-6e3)}function ax(e,t,n={}){return{label:e,value:t,...n}}function ox(e,t,n={}){return t===void 0||t===``?[]:[{label:e,value:t,...n}]}function sx(e){return e.boolean(`dry_run`)===!0?[{label:`Mode`,value:`dry run`,tone:`info`}]:[]}function cx(e){let t=new Set,n=e.fields.flatMap(e=>t.has(e.label)?[]:(t.add(e.label),[{...e,value:cie(e.value)}])),r=e.text?{...e.text,text:lie(e.text.text)}:void 0;return n.length===0&&!r?{kind:`none`}:{kind:`atlassian-draft`,fields:n,text:r}}function uie(e){if(!(e===void 0||e.length===0))return e.replace(/\r\n/g,`
20
+ `).replace(/\r/g,`
21
+ `).split(`
22
+ `).length}var die=()=>({kind:`none`});function lx(e={}){return{primaryArg:e.primaryArg,secondary:e.secondary??[],body:e.body??die(),safetyNotes:e.safetyNotes??[]}}var ux=6,fie=6e3;function dx(e,t,n=`s`){return`${e} ${t}${e===1?``:n}`}function fx(e){if(!e)return;let t=e.replace(/\r\n/g,`
23
+ `).replace(/\r/g,`
24
+ `),n=t.split(`
25
+ `),r=n.length>ux?n.slice(-ux).join(`
26
+ `):t;return r.length>fie?r.slice(-6e3):r}function px(e){return e===void 0?void 0:e.length===0?0:e.split(/\r?\n/).length}function mx(e,t,n=`path`,r){let i=e.string(n)??r;if(i)return{text:t&&ri(i,t)||i,openPath:i===`.`?void 0:t?ti(i,t):i}}function hx(e,t){let n=e||t;if(n)return{text:n.length>500?`${n.slice(0,499)}…`:n}}function pie(e){if(e)return{text:e.length>500?`${e.slice(0,499)}…`:e,href:e}}function gx(e,t,n={}){let r=fx(e);return!r||!n.force&&!r.includes(`
27
+ `)?{kind:`none`}:{kind:`code`,text:r,language:t,label:n.label,tail:!0}}function _x(e){let t=e.flatMap(([e,t,n])=>t===void 0||t===``?[]:[{label:e,value:String(t),mono:n}]);return t.length>0?{kind:`key-values`,items:t}:{kind:`none`}}function vx(e){let t=[],n=(e,n)=>{if(!(typeof e!=`string`||!e))for(let r of e.replace(/\r\n/g,`
28
+ `).split(`
29
+ `))t.push(`${n}${r}`)};for(let t of e.recordsArray(`replacements`)??[])n(t.oldText,`-`),n(t.newText,`+`);for(let t of e.recordsArray(`insertions`)??[])n(t.text,`+`);for(let t of e.recordsArray(`lineReplacements`)??[])n(t.newText,`+`);for(let t of e.recordsArray(`lineInsertions`)??[])n(t.text,`+`);let r=e.string(`patch`);if(r&&t.push(...r.replace(/\r\n/g,`
30
+ `).split(`
31
+ `)),t.length===0){let t=e.nestedStrings(`oldText`),r=e.nestedStrings(`newText`);t.forEach(e=>n(e,`-`)),r.forEach(e=>n(e,`+`))}return t}function mie(e){return fx(vx(e).join(`
32
+ `))}function hie(e){let t=(e.count(`replacements`)??0)+(e.count(`insertions`)??0)+(e.count(`lineReplacements`)??0)+(e.count(`lineInsertions`)??0)+ +!!e.string(`patch`),n=0,r=0;for(let t of vx(e))t.startsWith(`+`)&&!t.startsWith(`+++`)&&(n+=1),t.startsWith(`-`)&&!t.startsWith(`---`)&&(r+=1);return{operations:t,additions:n,deletions:r}}function yx(e){return e}function gie(e,t,n){let r=e.number(`offset`),i=e.number(`limit`),a=e.number(`byteOffset`),o=e.number(`byteLimit`),s=[];return a!==void 0||o!==void 0?s.push({text:`bytes ${a??0}${o===void 0?``:` +${o}`}`}):(r!==void 0||i!==void 0)&&s.push({text:`lines ${r??1}${i===void 0?``:` +${i}`}`}),lx({primaryArg:mx(e,n),secondary:s,body:t===`approval`?_x([[`Path`,e.string(`path`),!0],[`Line start`,r],[`Line limit`,i],[`Byte offset`,a],[`Byte limit`,o]]):void 0})}function _ie(e){let t=e.string(`command`),n=px(t)??0,r=e.string(`cwd`),i=e.number(`timeout`);return lx({primaryArg:hx(n<=1?t:void 0,t?`inline command`:`Command`),secondary:[...r?[{text:`cwd ${r}`,mono:!0}]:[],...i===void 0?[]:[{text:`timeout ${i}s`}]],body:gx(t,`bash`,{force:(t?.length??0)>500,label:`Command`}),safetyNotes:[`Runs a Bash-compatible command in the selected working directory.`]})}function vie(e,t,n){let r=e.string(`path`),i=e.string(`code`),a=px(i)??0,o=e.objectKeys(`env`),s=[],c=e.string(`cwd`);c&&s.push({text:`cwd ${c}`,mono:!0});let l=e.number(`timeout`);l!==void 0&&s.push({text:`timeout ${l}s`}),o.length>0&&s.push({text:dx(o.length,`env key`)});let u=e.boolean(`allowFileWrite`)??e.boolean(`allow_file_write`);u===!1&&s.push({text:`writes off`,tone:`warning`});let d=gx(i,`python`,{force:(i?.length??0)>500,label:`Python`});return lx({primaryArg:r?mx(e,n):hx(a<=1?i:void 0,i?`inline Python`:`Python`),secondary:s,body:d,safetyNotes:[u===!1?`File writes are disabled.`:`Python may write files unless the execution policy disables it.`,...o.length>0?[`Environment values are hidden; keys: ${o.join(`, `)}.`]:[]]})}function yie(e,t,n){let r=e.string(`content`),i=r===void 0?void 0:new TextEncoder().encode(r).length;return lx({primaryArg:mx(e,n),secondary:[...i===void 0?[]:[{text:dx(i,`byte`)}]],body:t!==`failed`&&r?{kind:`code`,text:fx(r),language:`text`,tail:!0}:void 0,safetyNotes:[`Creates the file or overwrites it if it already exists.`]})}function bie(e,t,n){let r=hie(e),i=mie(e),a=[];return r.operations>0&&a.push({text:dx(r.operations,`operation`)}),r.additions>0&&a.push({text:`+${r.additions}`,tone:`success`}),r.deletions>0&&a.push({text:`-${r.deletions}`,tone:`error`}),e.boolean(`dryRun`)===!0&&a.push({text:`dry run`,tone:`info`}),lx({primaryArg:mx(e,n),secondary:a,body:t!==`failed`&&i?{kind:`diff`,text:i,tail:!0}:void 0,safetyNotes:[e.boolean(`dryRun`)===!0?`Previews the edit without changing the file.`:`Applies the proposed changes to the existing file.`]})}var xie={read:yx({name:`read`,argumentRegion:`none`,completedView:`read`,present:gie}),bash:yx({name:`bash`,argumentRegion:`persistent`,completedView:`bash`,resultPlaceholder:{variant:`text`,rows:2},emptyResult:`No output`,present:_ie}),python_exec:yx({name:`python_exec`,argumentRegion:`persistent`,completedView:`python`,resultPlaceholder:{variant:`text`,rows:2},emptyResult:`No output`,present:vie}),edit:yx({name:`edit`,argumentRegion:`until-result`,completedView:`edit`,present:bie}),write:yx({name:`write`,argumentRegion:`until-result`,completedView:`write`,present:yie}),grep:yx({name:`grep`,argumentRegion:`none`,completedView:`grep`,emptyResult:`No matches`,present:(e,t)=>{let n=e.strings(`paths`),r=n?.length?n.join(`, `):e.string(`path`),i=[];return r&&i.push({text:r,mono:!0}),e.string(`glob`)&&i.push({text:`glob ${e.string(`glob`)}`}),i.push({text:e.boolean(`literal`)?`literal`:`regex`}),e.boolean(`ignoreCase`)&&i.push({text:`ignore case`}),(e.number(`context`)??0)>0&&i.push({text:`context ${e.number(`context`)}`}),e.number(`limit`)!==void 0&&e.number(`limit`)!==100&&i.push({text:`max ${e.number(`limit`)}`}),lx({primaryArg:hx(e.string(`pattern`),`Pattern`),secondary:i,body:t===`approval`?_x([[`Scope`,r??`project root`,!0],[`Pattern mode`,e.boolean(`literal`)?`literal`:`regular expression`]]):void 0})}}),find:yx({name:`find`,argumentRegion:`none`,completedView:`find`,emptyResult:`No files found`,present:(e,t,n)=>lx({primaryArg:hx(e.string(`pattern`),`Glob pattern`),secondary:[...e.string(`path`)?[{text:n&&ri(e.string(`path`),n)||e.string(`path`),mono:!0}]:[],...e.number(`limit`)!==void 0&&e.number(`limit`)!==1e3?[{text:`max ${e.number(`limit`)}`}]:[]],body:t===`approval`?_x([[`Search root`,e.string(`path`)??`project root`,!0]]):void 0})}),ls:yx({name:`ls`,argumentRegion:`none`,completedView:`ls`,emptyResult:`Empty directory`,present:(e,t,n)=>lx({primaryArg:mx(e,n,`path`,`.`),secondary:e.number(`limit`)!==void 0&&e.number(`limit`)!==500?[{text:`max ${e.number(`limit`)}`}]:[],body:t===`approval`?_x([[`Directory`,e.string(`path`)??`project root`,!0]]):void 0})}),ask_user:yx({name:`ask_user`,argumentRegion:`until-result`,completedView:`ask_user`,present:e=>{let t=[e.string(`context`)?`Context: ${e.string(`context`)}`:void 0,e.string(`recommendation`)?`Recommendation: ${e.string(`recommendation`)}`:void 0].filter(e=>!!e);return lx({primaryArg:hx(e.string(`question`),`Question`),body:t.length>0?{kind:`text-summary`,text:fx(t.join(`
33
+
34
+ `))}:void 0})}}),todos_set:yx({name:`todos_set`,argumentRegion:`until-result`,completedView:`todos`,present:e=>{let t=e.recordsArray(`todos`)??[],n=e.nestedStrings(`todo`),r=t.length>0?t.flatMap(e=>typeof e.todo==`string`?[{text:e.todo,done:e.done===!0}]:[]):n.map(e=>({text:e,done:!1}));return lx({primaryArg:hx(`todos`),secondary:r.length>0?[{text:dx(r.filter(e=>e.done).length,`done`)},{text:`${r.length} total`}]:[],body:r.length>0?{kind:`checklist`,items:r}:void 0})}}),todos_get:yx({name:`todos_get`,argumentRegion:`none`,completedView:`todos`,emptyResult:`No todos`,present:()=>lx({primaryArg:hx(`Get todos`)})}),web_search:yx({name:`web_search`,argumentRegion:`none`,completedView:`web_search`,resultPlaceholder:{variant:`list`,rows:3},emptyResult:`No results`,present:(e,t)=>lx({primaryArg:hx(e.string(`query`),`Search query`),secondary:e.number(`max_results`)!==void 0&&e.number(`max_results`)!==5?[{text:`max ${e.number(`max_results`)}`}]:[],body:t===`approval`?_x([[`External search`,e.string(`query`)]]):void 0,safetyNotes:[`Sends the query to the configured external search provider.`]})}),web_fetch:yx({name:`web_fetch`,argumentRegion:`none`,completedView:`web_fetch`,resultPlaceholder:{variant:`text`,rows:3},present:(e,t)=>lx({primaryArg:pie(e.string(`url`))??hx(`URL`),secondary:[{text:e.boolean(`raw`)?`raw download`:`converted`}],body:t===`approval`?_x([[`Destination`,e.string(`url`)],[`Mode`,e.boolean(`raw`)?`save raw response`:`convert to readable text`]]):void 0,safetyNotes:[`Fetches content from an external URL.`]})})};function bx(e){return e}function xx(e){return e&&e.length>0?e.join(`, `):void 0}function Sie(e){let t=fx(e.join(`
35
+ `));return t?{kind:`atlassian-summary`,text:t}:{kind:`none`}}function Sx(e){return e.boolean(`dry_run`)===!0?[{text:`dry run`,tone:`info`}]:[]}function Cx(e,t){return[e.boolean(`dry_run`)===!0?`Dry run only; Confluence will not ${t}.`:`This will ${t} in Confluence.`]}function wx(e,t){return e===`approval`?Sie(t):void 0}function Tx(e){let t=!!(e.string(`page_file`)??e.string(`body_file`)),n=e.string(`body_representation`),r=e.string(`body`),i=[],a=e.string(`status`);a&&i.push({text:a}),n&&n!==`storage`&&i.push({text:n});let o=uie(r);return o!==void 0&&i.push({text:`+${o}`,tone:`success`}),t?{body:{kind:`none`},chips:i}:{body:cx({fields:[],text:{label:`Page body`,text:r,language:n===void 0||n===`storage`?`xml`:void 0}}),chips:i}}var Cie={confluence_search_spaces:bx({name:`confluence_search_spaces`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`confluence`,emptyResult:`No spaces found`,present:(e,t)=>{let n=xx(e.strings(`keys`))??xx(e.strings(`ids`)),r=[];return e.string(`type`)&&r.push({text:e.string(`type`)}),e.string(`status`)&&r.push({text:e.string(`status`)}),e.number(`limit`)!==void 0&&r.push({text:`max ${e.number(`limit`)}`}),lx({primaryArg:hx(e.string(`query`)??n,`Spaces`),secondary:r,body:wx(t,[`Query: ${e.string(`query`)??n??`all spaces`}`])})}}),confluence_search_pages:bx({name:`confluence_search_pages`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`confluence`,emptyResult:`No pages found`,present:(e,t)=>{let n=e.string(`cql`)??e.string(`query`)??e.string(`title`),r=[];return e.string(`space_key`)&&r.push({text:`space ${e.string(`space_key`)}`,mono:!0}),e.string(`status`)&&r.push({text:e.string(`status`)}),e.number(`limit`)!==void 0&&r.push({text:`max ${e.number(`limit`)}`}),e.string(`cursor`)&&r.push({text:`cursor`}),lx({primaryArg:hx(n,`Page query`),secondary:r,body:wx(t,[`${e.string(`cql`)?`CQL`:`Query`}: ${n??``}`,...e.string(`space_key`)?[`Space: ${e.string(`space_key`)}`]:[]])})}}),confluence_get_page:bx({name:`confluence_get_page`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`confluence`,present:(e,t)=>{let n=e.string(`page_id`)??e.string(`page_file`),r=[[`include_labels`,`labels`],[`include_properties`,`properties`],[`include_operations`,`operations`],[`include_versions`,`versions`],[`include_direct_children`,`children`],[`include_attachments`,`attachments`]].flatMap(([t,n])=>e.boolean(t)?[n]:[]);return lx({primaryArg:hx(n,`Page`),secondary:[...e.string(`body_format`)?[{text:e.string(`body_format`)}]:[],...r.map(e=>({text:e}))],body:wx(t,[`Page: ${n??``}`,...r.length?[`Include: ${r.join(`, `)}`]:[]])})}}),confluence_download_pages:bx({name:`confluence_download_pages`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`confluence`,emptyResult:`No pages downloaded`,present:(e,t)=>{let n=e.string(`page_id`)??e.string(`space_key`)??e.string(`space_id`)??e.string(`cql`),r=e.string(`output_dir`)??e.string(`download_dir`),i=[];return e.boolean(`recurse`)&&i.push({text:`subtree`}),e.number(`depth`)!==void 0&&i.push({text:`depth ${e.number(`depth`)}`}),e.string(`body_format`)&&i.push({text:e.string(`body_format`)}),r&&i.push({text:r,mono:!0,openPath:r}),lx({primaryArg:hx(n,`Page download`),secondary:i,body:wx(t,[`Scope: ${n??``}`,...r?[`Destination: ${r}`]:[],...e.boolean(`download_attachments`)?[`Attachments: download`]:[]]),safetyNotes:r?[`Writes downloaded files under ${r}.`]:[]})}}),confluence_create_page:bx({name:`confluence_create_page`,argumentRegion:`until-result`,completedView:`confluence`,present:e=>{let t=e.string(`space_key`)??e.string(`space_id`),n=e.string(`title`)??e.string(`page_file`),{body:r,chips:i}=Tx(e);return lx({primaryArg:hx([t,n].filter(Boolean).join(` · `),`New Confluence page`),secondary:[...Sx(e),...e.string(`parent_id`)?[{text:`parent ${e.string(`parent_id`)}`,mono:!0}]:[],...i],body:r,safetyNotes:Cx(e,`create the page`)})}}),confluence_update_page:bx({name:`confluence_update_page`,argumentRegion:`until-result`,completedView:`confluence`,present:e=>{let t=e.string(`page_id`)??e.string(`page_file`),{body:n,chips:r}=Tx(e);return lx({primaryArg:hx(t,`Confluence page`),secondary:[...Sx(e),...e.number(`expected_version`)===void 0?[]:[{text:`version ${e.number(`expected_version`)}`}],...e.boolean(`allow_stale`)?[{text:`allow stale`,tone:`warning`}]:[],...r],body:n,safetyNotes:Cx(e,`update the page`)})}}),confluence_publish_pages:bx({name:`confluence_publish_pages`,argumentRegion:`until-result`,completedView:`confluence`,present:e=>{let t=e.string(`input_path`),n=e.nestedStrings(`title`),r=e.boolean(`allow_stale`)===!0,i=cx({fields:[ax(`Source`,t,{mono:!0}),...ox(`Pages`,n.length?`${dx(n.length,`page`)}: ${n.slice(0,5).join(`, `)}${n.length>5?`, …`:``}`:void 0),...ox(`Version message`,e.string(`version_message`)),ax(`Conflict handling`,r?`allow stale`:`enforce versions`,r?{tone:`warning`}:{}),...e.boolean(`create_missing`)===!0?[ax(`Create missing`,`yes`)]:[],...sx(e)]});return lx({primaryArg:t?{text:t.split(/[\\/]/).pop()||t,openPath:t}:hx(`Page bundle`),secondary:[...Sx(e),...n.length?[{text:dx(n.length,`page`)}]:[],...e.boolean(`create_missing`)?[{text:`create missing`}]:[],...e.boolean(`allow_stale`)?[{text:`allow stale`,tone:`warning`}]:[]],body:i,safetyNotes:Cx(e,`publish the pages`)})}}),confluence_upload_attachment:bx({name:`confluence_upload_attachment`,argumentRegion:`none`,completedView:`confluence`,present:(e,t)=>{let n=e.string(`file_path`),r=e.string(`filename`)??n?.split(/[\\/]/).pop(),i=e.string(`page_id`),a=[];return i&&a.push({text:`page ${i}`,mono:!0}),e.boolean(`update_existing`)===!1&&a.push({text:`new only`}),e.boolean(`minor_edit`)&&a.push({text:`minor edit`}),lx({primaryArg:hx([r,i].filter(Boolean).join(` · `),`Attachment`),secondary:a,body:t===`approval`?cx({fields:[ax(`Target page`,i,{mono:!0}),ax(`Source file`,n,{mono:!0}),...ox(`Filename`,r),...ox(`Comment`,e.string(`comment`)),ax(`Existing attachment`,e.boolean(`update_existing`)===!1?`do not replace`:`update if present`)]}):void 0,safetyNotes:[`Uploads this local file to the selected Confluence page.`]})}})};function Ex(e){return e}function Dx(e){return e&&e.length>0?e.join(`, `):void 0}function Ox(e){let t=[],n=e=>{if(Array.isArray(e)){e.forEach(n);return}if(!e||typeof e!=`object`)return;let r=e;r.type===`text`&&typeof r.text==`string`&&t.push(r.text),r.content&&n(r.content)};return n(e),t.join(``).trim()||void 0}function wie(e){let t=fx(e.join(`
36
+ `));return t?{kind:`atlassian-summary`,text:t}:{kind:`none`}}function kx(e){let t=e.string(`assignee_query`);if(t)return t;let n=e.string(`assignee_account_id`);return n?`account ${n}`:void 0}function Ax(e,t){let n=e.objectKeys(t);return n.length>0?n.join(`, `):void 0}function jx(e){return e.boolean(`dry_run`)===!0?[{text:`dry run`,tone:`info`}]:[]}function Mx(e,t){return[e.boolean(`dry_run`)===!0?`Dry run only; Jira will not ${t}.`:`This will ${t} in Jira.`]}function Nx(e,t,n){return t===`approval`?wie(n):void 0}var Tie={jira_search_users:Ex({name:`jira_search_users`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`jira`,emptyResult:`No users found`,present:(e,t)=>{let n=[];return e.string(`project_key`)&&n.push({text:`project ${e.string(`project_key`)}`,mono:!0}),e.string(`issue_key`)&&n.push({text:e.string(`issue_key`),mono:!0}),e.number(`max_results`)!==void 0&&n.push({text:`max ${e.number(`max_results`)}`}),e.boolean(`include_inactive`)&&n.push({text:`include inactive`}),lx({primaryArg:hx(e.string(`query`),`User query`),secondary:n,body:Nx(e,t,[`Query: ${e.string(`query`)??``}`,...e.string(`project_key`)?[`Project: ${e.string(`project_key`)}`]:[],...e.string(`issue_key`)?[`Issue: ${e.string(`issue_key`)}`]:[]])})}}),jira_search_issues:Ex({name:`jira_search_issues`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`jira`,emptyResult:`No issues found`,present:(e,t)=>{let n=e.strings(`fields`),r=[];return n&&r.push({text:dx(n.length,`field`)}),e.number(`max_results`)!==void 0&&r.push({text:`max ${e.number(`max_results`)}`}),e.string(`next_page_token`)&&r.push({text:`next page`}),e.boolean(`save_to_file`)===!1&&r.push({text:`not saved`}),lx({primaryArg:hx(e.string(`jql`),`JQL`),secondary:r,body:Nx(e,t,[`JQL: ${e.string(`jql`)??``}`,...n?.length?[`Fields: ${n.join(`, `)}`]:[]])})}}),jira_get_issue:Ex({name:`jira_get_issue`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`jira`,present:(e,t)=>{let n=[[`include_comments`,`comments`],[`include_transitions`,`transitions`],[`include_editmeta`,`edit metadata`],[`include_worklogs`,`worklogs`],[`include_changelog`,`changelog`],[`include_remote_links`,`remote links`]].flatMap(([t,n])=>e.boolean(t)?[n]:[]);return lx({primaryArg:hx(e.string(`issue_key`),`Issue`),secondary:n.map(e=>({text:e})),body:Nx(e,t,[`Issue: ${e.string(`issue_key`)??``}`,...n.length>0?[`Include: ${n.join(`, `)}`]:[]])})}}),jira_get_project:Ex({name:`jira_get_project`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`jira`,present:(e,t)=>{let n=e.string(`project_key`)??`default project`,r=[[`include_statuses`,`statuses`],[`include_components`,`components`],[`include_versions`,`versions`],[`include_issue_types`,`issue types`],[`include_create_meta`,`create metadata`],[`include_fields`,`fields`]].flatMap(([t,n])=>e.boolean(t)?[n]:[]);return lx({primaryArg:hx(n),secondary:r.map(e=>({text:e})),body:Nx(e,t,[`Project: ${n}`,...r.length>0?[`Include: ${r.join(`, `)}`]:[]])})}}),jira_create_issue:Ex({name:`jira_create_issue`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.string(`project_key`),n=e.string(`issue_type`),r=e.string(`summary`),i=cx({fields:[ax(`Project`,t,{mono:!0}),ax(`Type`,n),ax(`Summary`,r),...ox(`Parent`,e.string(`parent_key`),{mono:!0}),...ox(`Priority`,e.string(`priority`)),...ox(`Assignee`,kx(e)),...ox(`Labels`,Dx(e.strings(`labels`))),...ox(`Components`,Dx(e.strings(`components`))),...ox(`Custom fields`,Ax(e,`fields`),{mono:!0}),...sx(e)],text:{label:`Description`,text:e.string(`description`)??Ox(e.value(`description_adf`))}});return lx({primaryArg:hx([t,n,r].filter(Boolean).join(` · `),`New Jira issue`),secondary:[...jx(e),...e.strings(`labels`)?[{text:dx(e.strings(`labels`).length,`label`)}]:[]],body:i,safetyNotes:Mx(e,`create an issue`)})}}),jira_update_issue:Ex({name:`jira_update_issue`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.string(`description`)??Ox(e.value(`description_adf`)),n=[...ox(`Summary`,e.string(`summary`)),...ox(`Priority`,e.string(`priority`)),...ox(`Assignee`,kx(e)),...ox(`Labels`,Dx(e.strings(`labels`))),...ox(`Field keys`,Ax(e,`fields`),{mono:!0}),...ox(`Update ops`,Ax(e,`update`),{mono:!0})],r=n.length+(t===void 0?0:1),i=cx({fields:[ax(`Issue`,e.string(`issue_key`),{mono:!0}),...n,...e.boolean(`notify_users`)===!1?[ax(`Notify users`,`no`)]:[],...sx(e)],text:t===void 0?void 0:{label:`Description`,text:t}});return lx({primaryArg:hx(e.string(`issue_key`),`Issue`),secondary:[...jx(e),...r>0?[{text:dx(r,`change`)}]:[]],body:i,safetyNotes:Mx(e,`update the issue`)})}}),jira_add_comment:Ex({name:`jira_add_comment`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.record(`visibility`),n=cx({fields:[ax(`Issue`,e.string(`issue_key`),{mono:!0}),...ox(`Visibility`,t?[t.type,t.value].filter(e=>typeof e==`string`).join(` · `):void 0)],text:{label:`Comment`,text:e.string(`body`)??Ox(e.value(`body_adf`))}});return lx({primaryArg:hx(e.string(`issue_key`),`Issue`),secondary:[{text:e.record(`body_adf`)?`ADF`:`plain text`}],body:n,safetyNotes:[`Adds this comment to the selected Jira issue.`]})}}),jira_transition_issue:Ex({name:`jira_transition_issue`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.string(`transition`)??`list available transitions`,n=e.string(`comment`)??Ox(e.value(`comment_adf`)),r=cx({fields:[ax(`Issue`,e.string(`issue_key`),{mono:!0}),ax(`Transition`,e.string(`transition`)),...ox(`Resolution`,e.string(`resolution`)),...ox(`Field keys`,Ax(e,`fields`),{mono:!0}),...ox(`Update ops`,Ax(e,`update`),{mono:!0}),...sx(e)],text:n===void 0?void 0:{label:`Comment`,text:n}});return lx({primaryArg:hx([e.string(`issue_key`),t].filter(Boolean).join(` · `),`Issue transition`),secondary:jx(e),body:r,safetyNotes:Mx(e,`transition the issue`)})}})};function Px(e){return e}function Fx(e){if(e!==void 0)return e<1e3?`${e}ms`:`${e/1e3}s`}function Ix(e){let t=e.string(`taskId`),n=e.string(`groupId`),r=e.strings(`taskIds`)??[],i=r.length||(t||n?1:0);return{primary:t??(r.length===1?r[0]:r.length>1?`${r.length} tasks`:n?`group ${n}`:`active tasks`),count:i}}function Eie(e,t){let n=e.string(`command`),r=e.string(`name`),i=e.string(`cwd`),a=e.objectKeys(`env`),o=e.string(`readyUrl`)??e.string(`readyPattern`)??(e.boolean(`readyOnUrl`)?`first detected URL`:void 0),s=[];i&&s.push({text:`cwd ${i}`,mono:!0}),o&&s.push({text:`ready: ${o}`}),e.number(`timeoutMs`)!==void 0&&s.push({text:`runtime ${Fx(e.number(`timeoutMs`))}`}),a.length>0&&s.push({text:dx(a.length,`env key`)}),e.boolean(`notify`)===!1&&s.push({text:`notifications off`});let c=px(n)??0,l=gx(n,`bash`,{force:(n?.length??0)>500,label:`Command`});return l.kind===`none`&&t===`approval`&&(l=_x([[`Working directory`,i??`project root`,!0],[`Readiness`,o],[`Readiness timeout`,Fx(e.number(`readyTimeoutMs`))],[`Runtime timeout`,Fx(e.number(`timeoutMs`))],[`Environment keys`,a.join(`, `)],[`Notifications`,e.boolean(`notify`)===!1?`off`:`on`]])),lx({primaryArg:hx(r??(c<=1?n:void 0),n?`background task`:`Task`),secondary:s,body:l,safetyNotes:[`Starts a supervised background process; tool completion only confirms the start request.`,...a.length>0?[`Environment values are hidden; keys: ${a.join(`, `)}.`]:[]]})}var Die={task_start:Px({name:`task_start`,argumentRegion:`until-result`,completedView:`task_action`,present:Eie}),task_status:Px({name:`task_status`,argumentRegion:`none`,completedView:`task_status`,emptyResult:`No tasks`,present:(e,t)=>{let n=Ix(e),r=[];return n.count>1&&r.push({text:dx(n.count,`selector`)}),e.string(`status`)&&r.push({text:`status ${e.string(`status`)}`}),e.number(`limit`)!==void 0&&r.push({text:`max ${e.number(`limit`)}`}),lx({primaryArg:hx(n.primary),secondary:r,body:t===`approval`?_x([[`Task selector`,n.primary]]):void 0})}}),task_logs:Px({name:`task_logs`,argumentRegion:`none`,completedView:`task_logs`,emptyResult:`No log events`,present:(e,t)=>{let n=[];return e.string(`mode`)&&n.push({text:e.string(`mode`)}),e.number(`sinceSeq`)!==void 0&&n.push({text:`after ${e.number(`sinceSeq`)}`}),e.string(`contains`)&&n.push({text:`substring filter`}),e.string(`regex`)&&n.push({text:`regex filter`}),e.number(`contextLines`)!==void 0&&n.push({text:`context ${e.number(`contextLines`)}`}),e.number(`limit`)!==void 0&&n.push({text:`max ${e.number(`limit`)}`}),lx({primaryArg:hx(e.string(`taskId`),`Task logs`),secondary:n,body:t===`approval`?_x([[`Task`,e.string(`taskId`)],[`Mode`,e.string(`mode`)??`recent`],[`Contains`,e.string(`contains`)],[`Regular expression`,e.string(`regex`)]]):void 0})}}),task_cancel:Px({name:`task_cancel`,argumentRegion:`none`,completedView:`task_action`,present:(e,t)=>{let n=Ix(e),r=e.string(`signal`)??`SIGTERM`,i=[];return n.count>1&&i.push({text:dx(n.count,`target`)}),i.push({text:r,tone:r===`SIGKILL`?`error`:`warning`}),e.number(`timeoutMs`)!==void 0&&i.push({text:`escalate after ${Fx(e.number(`timeoutMs`))}`}),lx({primaryArg:hx(n.primary),secondary:i,body:t===`approval`?_x([[`Targets`,(e.strings(`taskIds`)??[]).join(`, `)||n.primary],[`Signal`,r],[`Escalation timeout`,Fx(e.number(`timeoutMs`))],[`Reason`,e.string(`reason`)]]):void 0,safetyNotes:[`Requests cancellation of the selected supervised task process.`]})}}),task_restart:Px({name:`task_restart`,argumentRegion:`none`,completedView:`task_action`,present:(e,t)=>lx({primaryArg:hx(e.string(`taskId`),`Task`),body:t===`approval`?{kind:`text-summary`,text:`The task will restart with its stored launch settings and environment.`}:void 0,safetyNotes:[`Reuses the task's stored command, settings, and encrypted environment.`]})}),explore:Px({name:`explore`,argumentRegion:`until-result`,completedView:`explore`,present:(e,t)=>{let n=e.recordsArray(`tasks`)??[],r=n.length>0?n.map((e,t)=>typeof e.label==`string`?e.label:typeof e.task==`string`?e.task:`Agent ${t+1}`):e.nestedStrings(`label`),i=e.string(`task`),a=e.string(`label`),o=r.length||+!!i,s=r.length>0?r.map((e,t)=>`${t+1}. ${e}`):i?[fx(i)]:[],c=e.string(`split_rationale`);return lx({primaryArg:hx(a??(o>0?dx(o,`agent`):void 0),`Explore`),secondary:o>0?[{text:dx(o,`read-only agent`)}]:[],body:s.length>0?{kind:`text-summary`,text:s.join(`
37
+ `)}:void 0,safetyNotes:[`Delegates read-only investigation to child agents.`,...t===`approval`&&c?[`Why parallel: ${fx(c)}`]:[]]})}}),plan_mode_enter:Px({name:`plan_mode_enter`,argumentRegion:`until-result`,completedView:`plan_mode`,present:e=>lx({primaryArg:hx(`Enter planning mode`),body:e.string(`reason`)?{kind:`text-summary`,text:fx(e.string(`reason`))}:void 0})}),plan_mode_present:Px({name:`plan_mode_present`,argumentRegion:`until-result`,completedView:`plan_mode`,present:e=>{let t=e.string(`file_path`);return lx({primaryArg:t?{text:t.split(/[\\/]/).pop()||t,openPath:t}:hx(`Plan review`),secondary:t?[{text:t,mono:!0,openPath:t}]:[],body:e.string(`summary`)?{kind:`text-summary`,text:fx(e.string(`summary`))}:void 0})}}),plan_mode_force_exit:Px({name:`plan_mode_force_exit`,argumentRegion:`until-result`,completedView:`plan_mode`,present:e=>lx({primaryArg:hx(`Exit planning mode`),body:e.string(`reason`)?{kind:`text-summary`,text:fx(e.string(`reason`))}:void 0})})},Oie={...xie,...Die,...Tie,...Cie},kie={name:`unknown`,argumentRegion:`until-result`,completedView:`generic`,emptyResult:`No output`,present:e=>{let t=e.structuredEntries(),n=t.find(e=>!e.redacted&&e.value!==`[unavailable]`);return lx({primaryArg:n?{text:n.value}:void 0,secondary:[{text:`recorded tool`,tone:`warning`}],body:t.length>0?{kind:`key-values`,items:t.map(e=>({label:e.key,value:e.value,mono:!0,tone:e.redacted?`warning`:void 0}))}:void 0,safetyNotes:[`This tool is not in the active catalog. Review Details before approving it.`]})}};function Lx(e){return zr.safeParse(e).success}function Rx(e){return Lx(e)?Oie[e]:kie}function zx(e,t,n,r){return Rx(e).present(qy(t),n,r)}var Bx=new WeakMap;function Vx(e,t){let n=Bx.get(e);if(n)return n;let r=Mie(e,t);return Bx.set(e,r),r}function Hx(e,t){if(!(e===void 0||e<=0))return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function Ux(e,t){for(let[t,n]of e)if(t>5)return nx(t,n,`head`,5);return nx(t,`lines`)}function Wx(e){return!!(e&&!e.replace(/\r\n/g,`
38
+ `).replace(/\r/g,`
39
+ `).includes(`
40
+ `))}function Gx(e,t){return!!(t&&`outputArtifacts`in e&&e.outputArtifacts?.some(e=>e.path===t))}function Aie(e){switch(e.action){case`search_spaces`:return e.query?{text:e.query}:void 0;case`search_pages`:return e.cql?{text:e.cql}:e.query?{text:e.query}:void 0;case`download_pages`:return e.downloadDir?{text:$b(e.downloadDir),openPath:e.downloadDir}:e.pageId?{text:e.pageId}:void 0;case`publish_pages`:return e.inputPath?{text:$b(e.inputPath),openPath:e.inputPath}:void 0;case`upload_attachment`:return e.attachment?.filename?{text:e.attachment.filename}:e.pageId?{text:e.pageId}:void 0;case`get_page`:case`create_page`:case`update_page`:return e.page?.title?{text:e.page.id?`${e.page.id} · ${e.page.title}`:e.page.title}:e.pageId?{text:e.pageId}:e.title?{text:e.title}:void 0;default:return}}function jie(e){switch(e.action){case`search_users`:return e.query?{text:e.query}:void 0;case`search_issues`:return e.jql?{text:e.jql}:void 0;case`get_project`:{let t=e.project?.name?`${e.project.key} · ${e.project.name}`:e.projectKey??e.project?.key;return t?{text:t}:void 0}case`create_issue`:return e.issueKey?{text:e.issueKey}:e.summary?{text:e.issueType?`${e.issueType} · ${e.summary}`:e.summary}:void 0;case`get_issue`:case`update_issue`:case`add_comment`:case`transition_issue`:return e.issueKey?{text:e.issueKey}:void 0;default:return}}function Kx(e,t={}){let n=`outputLimits`in e?e.outputLimits:void 0,r=`outputArtifacts`in e?e.outputArtifacts:void 0,i=[];if(n?.model?.truncated){let e=Hx(n.model.omittedLines,`line`),t=Hx(n.model.omittedChars,`char`);i.push({text:[`LLM trimmed`,e??t].filter(Boolean).join(` · `),tone:`warning`})}if(t.includeLiveLimit!==!1&&n?.live?.capped){let e=Hx(n.live.omittedChars,`char`);i.push({text:[`live tail`,e?`${e} omitted`:void 0].filter(Boolean).join(` · `),tone:`info`})}for(let e of r??[]){let t=e.kind===`raw_result`?`raw result`:e.kind===`fetched_content`?`fetched content`:`full output`;i.push({text:t,mono:!0,openPath:e.path})}return i}function Mie(e,t){let n=`previewOverflow`in t?t.previewOverflow:void 0,r=n?rx(n.hidden,n.noun,n.direction):void 0,{tone:i,pulse:a}=oie(t,e),o=t,s=zx(t.toolName,{args:o.args,argsPreview:o.argsPreview},`completed`,t.cwd),c={badge:t.toolName,primaryArg:s.primaryArg,meta:[],dotTone:i,dotPulse:a};switch(e.kind){case`read`:{let t=e.relPath?{text:e.relPath,openPath:e.path}:void 0;if(e.image)return{...c,primaryArg:t,meta:[{text:`image`}]};let n=[];return e.lineLabel&&n.push({text:e.lineLabel}),e.truncated&&n.push({text:`truncated`,tone:`warning`}),n.push(...Kx(e)),{...c,primaryArg:t,meta:n,detailsAction:r??nx(e.lineCount??0,`lines`)}}case`bash`:{let t=[],n=e.outputLineCount;e.exitCode!==void 0&&e.exitCode!==0&&t.push({text:`exit ${e.exitCode}`,tone:`error`}),e.signal&&t.push({text:`signal ${e.signal}`,tone:`warning`}),e.backgroundTask&&(t.push({text:`background ${e.backgroundTask.taskId}`,tone:`warning`,mono:!0}),t.push({text:e.backgroundTask.status})),n>0&&t.push({text:ex(n,`line`)}),e.live&&t.push({text:`streaming`,tone:`info`}),e.truncated&&t.push({text:`truncated`,tone:`warning`}),t.push(...Kx(e,{includeLiveLimit:!1})),e.savedTo&&!Gx(e,e.savedTo)&&t.push({text:`saved ${$b(e.savedTo)}`,mono:!0,openPath:e.savedTo});let i=tx(e.command),a=Math.max(0,i-6),o=a+Math.max(0,n-6);return{...c,primaryArg:e.command?Wx(e.command)?{text:e.command}:{text:`inline`}:void 0,meta:t,detailsAction:r??(a>0?rx(o,`lines`,`mixed`):nx(n,`lines`,`tail`))}}case`python`:{let t=[],n=e.outputLineCount;e.exitCode!==void 0&&e.exitCode!==0&&t.push({text:`exit ${e.exitCode}`,tone:`error`}),e.signal&&t.push({text:`signal ${e.signal}`,tone:`warning`}),e.timedOut&&t.push({text:`timed out`,tone:`error`});let i=aie(e.durationMs);i&&t.push({text:i}),n>0&&t.push({text:ex(n,`line`)}),e.live&&t.push({text:`streaming`,tone:`info`}),e.artifacts&&e.artifacts.length>0&&t.push({text:ex(e.artifacts.length,`artifact`),tone:`info`}),e.streams?.stdout?.truncated&&t.push({text:`stdout truncated`,tone:`warning`}),e.streams?.stderr?.truncated&&t.push({text:`stderr truncated`,tone:`warning`}),e.truncated&&t.push({text:`truncated`,tone:`warning`}),t.push(...Kx(e)),e.savedTo&&!Gx(e,e.savedTo)&&t.push({text:`saved ${$b(e.savedTo)}`,mono:!0,openPath:e.savedTo});let a=Math.max(0,e.codeLineCount-6)+Math.max(0,n-6),o=r??rx(a,`lines`,`mixed`),s=e.inputMode===`file`&&e.relScriptPath?{text:e.relScriptPath,openPath:e.scriptPath}:e.code&&Wx(e.code)?{text:e.code}:{text:`inline`};return{...c,primaryArg:s,meta:t,detailsAction:o}}case`edit`:{let t=[{text:ex(e.operationCount,`operation`)}];return e.dryRun&&t.push({text:`preview`,tone:`info`}),e.additions>0&&t.push({text:`+${e.additions}`,tone:`success`}),e.deletions>0&&t.push({text:`−${e.deletions}`,tone:`error`}),e.diffLineCount>0&&t.push({text:ex(e.diffLineCount,`diff line`)}),{...c,primaryArg:e.relPath?{text:e.relPath,openPath:e.path}:void 0,meta:t,detailsAction:r??nx(e.diffLineCount,`lines`)}}case`write`:{let t=[];return e.bytes!==void 0&&t.push({text:`wrote ${e.bytes} bytes`}),e.lineCount!==void 0&&t.push({text:ex(e.lineCount,`line`)}),e.charCount!==void 0&&t.push({text:ex(e.charCount,`char`)}),{...c,primaryArg:e.relPath?{text:e.relPath,openPath:e.path}:void 0,meta:t,detailsAction:r??nx(e.lineCount??0,`lines`)}}case`grep`:return{...c,primaryArg:e.pattern?{text:e.pattern}:void 0,meta:[{text:ex(e.matchCount,`match`,`es`)},{text:ex(e.fileCount,`file`)}],detailsAction:r??nx(e.matchCount,`matches`)};case`find`:return{...c,primaryArg:e.pattern?{text:e.pattern}:void 0,meta:[{text:ex(e.count,`file`)}],detailsAction:r??nx(e.count,`files`)};case`ls`:return{...c,primaryArg:e.relPath?{text:e.relPath,openPath:e.path}:void 0,meta:[{text:`${e.total} ${e.total===1?`entry`:`entries`}`}],detailsAction:r??nx(e.total,`entries`)};case`task_logs`:{let t=[{text:ex(e.eventCount,`event`)}];return e.mode&&t.push({text:e.mode}),{...c,primaryArg:e.task?.name?{text:e.task.name}:c.primaryArg,meta:t,detailsAction:r??nx(e.eventCount,`events`,`tail`)}}case`web_fetch`:{let t=[];e.status!==void 0&&t.push({text:`${e.status}`,tone:e.status>=400?`error`:`success`}),e.contentType&&t.push({text:e.contentType});let n=iie(e.size);return n&&t.push({text:n}),e.converted&&t.push({text:`markdown`,tone:`info`}),e.savedTo&&!Gx(e,e.savedTo)&&t.push({text:`saved ${$b(e.savedTo)}`,mono:!0,openPath:e.savedTo}),t.push(...Kx(e)),{...c,primaryArg:e.url?{text:e.url,href:e.url}:void 0,meta:t,detailsAction:r??nx(tx(e.content),`lines`)}}case`jira`:{let t=[];e.dryRun&&t.push({text:`preview`,tone:`info`});let n=(e,n)=>{e!==void 0&&t.push({text:ex(e,n)})};switch(e.action){case`search_users`:n(e.userCount??e.users.length,`user`),e.projectKey&&t.push({text:`project ${e.projectKey}`,mono:!0}),e.issueKey&&t.push({text:e.issueKey,mono:!0});break;case`search_issues`:n(e.issueCount??e.issues.length,`issue`),e.total!==void 0&&e.total!==e.issueCount&&t.push({text:`${e.total} total`}),e.nextPageToken&&t.push({text:`next page`,tone:`info`});break;case`get_issue`:e.issue?.issueType&&t.push({text:e.issue.issueType}),e.issue?.status&&t.push({text:e.issue.status}),e.issue?.assignee&&t.push({text:`assignee ${e.issue.assignee}`}),e.includedCounts?.comments!==void 0&&n(e.includedCounts.comments,`comment`),e.includedCounts?.transitions!==void 0&&n(e.includedCounts.transitions,`transition`);break;case`get_project`:e.project?.projectTypeKey&&t.push({text:e.project.projectTypeKey}),e.includedCounts?.statuses!==void 0&&t.push({text:`${e.includedCounts.statuses} statuses`}),e.includedCounts?.components!==void 0&&n(e.includedCounts.components,`component`),e.includedCounts?.versions!==void 0&&n(e.includedCounts.versions,`version`);break;case`create_issue`:e.projectKey&&t.push({text:`project ${e.projectKey}`,mono:!0}),e.issueType&&t.push({text:e.issueType});break;case`update_issue`:{let n=e.updatedFieldCount??e.updatedFields?.length;n!==void 0&&t.push({text:`${ex(n,`field`)} updated`});break}case`add_comment`:e.commentId&&t.push({text:`comment ${e.commentId}`,mono:!0});break;case`transition_issue`:e.transition?.name&&t.push({text:e.transition.name}),e.transition?.to&&t.push({text:`to ${e.transition.to}`}),e.transition||n(e.transitionCount??e.transitions.length,`transition`);break}t.push(...Kx(e));let i=r??Ux([[e.issues.length,`issues`],[e.users.length,`users`],[e.transitions.length,`transitions`]],e.contentLineCount);return{...c,primaryArg:jie(e),meta:t,detailsAction:i}}case`confluence`:{let t=[];e.dryRun&&t.push({text:`preview`,tone:`info`});let n=(e,n)=>{e!==void 0&&t.push({text:ex(e,n)})};switch(e.action){case`search_spaces`:n(e.spaceCount??e.spaces.length,`space`);break;case`search_pages`:case`download_pages`:if(n(e.pageCount??e.pages.length,`page`),e.action===`download_pages`){let t=e.includedCounts?.downloadedAttachments??e.includedCounts?.attachments;t!==void 0&&t>0&&n(t,`attachment`)}e.bodyFormat&&t.push({text:e.bodyFormat}),e.downloadDir&&t.push({text:`bundle`,mono:!0,openPath:e.downloadDir}),e.manifestPath&&t.push({text:`manifest`,mono:!0,openPath:e.manifestPath}),e.pagesJsonlPath&&t.push({text:`pages.jsonl`,mono:!0,openPath:e.pagesJsonlPath});break;case`get_page`:{let t=e.attachmentCount??e.includedCounts?.attachments;t!==void 0&&t>0&&n(t,`attachment`);break}case`create_page`:case`update_page`:break;case`publish_pages`:n(e.outcomeCount??e.outcomes.length,`outcome`);break;case`upload_attachment`:n(e.attachmentCount??e.attachments.length,`attachment`),e.pageId&&t.push({text:`page ${e.pageId}`,mono:!0});break}t.push(...Kx(e));let i=r??Ux([[e.pages.length,`pages`],[e.spaces.length,`spaces`],[e.outcomes.length,`outcomes`]],e.contentLineCount);return{...c,primaryArg:Aie(e),meta:t,detailsAction:i}}case`web_search`:return{...c,primaryArg:e.query?{text:e.query}:void 0,meta:[{text:ex(e.results.length,`result`)},...Kx(e)],detailsAction:nx(e.results.length,`results`)};case`todos`:return{...c,badge:`todos`,primaryArg:e.total>0?{text:`${e.completed}/${e.total} done`}:void 0,meta:[]};case`task_action`:{let t=e.task??e.tasks?.[0];return{...c,badge:`task_${e.action}`,primaryArg:t?.name?{text:t.name}:c.primaryArg,meta:e.action===`cancel`&&(e.outcomeCount??0)>1?[{text:ex(e.outcomeCount??0,`outcome`)}]:[],detailsAction:r}}case`task_status`:return{...c,meta:[{text:ex(e.taskCount,`task`,`s`)}],detailsAction:rx(e.hiddenTaskCount,`tasks`,`head`)};case`explore`:{let{summary:t}=sb(e),n=[];t.totalTurns>0&&n.push({text:`${t.totalTurns.toLocaleString()} ${t.totalTurns===1?`turn`:`turns`}`}),t.totalTokens>0&&n.push({text:`${t.totalTokens.toLocaleString()} tokens`}),t.failed>0&&n.push({text:`${t.failed} failed`,tone:`error`}),t.aborted>0&&n.push({text:`${t.aborted} stopped`,tone:`warning`});let r=`${t.completed+t.failed+t.aborted}/${t.total} ${t.total===1?`agent`:`agents`}`;return{...c,primaryArg:t.total>0?{text:r}:void 0,meta:n}}case`ask_user`:return{...c,primaryArg:void 0,meta:[]};case`plan_mode`:return{...c,badge:`plan_mode_${e.action}`,primaryArg:c.primaryArg??(e.planPath?{text:e.planPath,openPath:e.planPath}:void 0),meta:[],detailsAction:r};default:return c}}var Nie=new Set([`$$slots`,`$$events`,`$$legacy`]);function qx(e,t){let n=H(t,Nie),r=[[`path`,{d:`M12 19v3`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`}]];P(e,B({name:`mic`},()=>n,{get iconNode(){return r}}))}function Jx(e,t,n){let r=n?{description:n}:void 0;e===`success`?zn.success(t,r):e===`error`?zn.error(t,r):zn(t,r)}var Yx={success(e,t={}){Jx(`success`,e,t.description)},error(e,t={}){Jx(`error`,e,t.description)},message(e,t={}){Jx(`message`,e,t.description)}};function Xx(e,t=`code block`){e?Yx.success(`Copied ${t}`):Yx.error(`Could not copy ${t}`)}async function Pie(e){let t=globalThis.navigator?.clipboard;if(t?.writeText){await t.writeText(e);return}throw Error(`Clipboard API is not available.`)}var Fie=`modulepreload`,Iie=function(e){return`/`+e},Zx={},Qx=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Iie(t,n),t in Zx)return;Zx[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Fie,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$x={bash:()=>Qx(()=>import(`./bash-B7CDPTg5.js`),__vite__mapDeps([0,1])),css:()=>Qx(()=>import(`./css-BsVw1vtW.js`),[]),diff:()=>Qx(()=>import(`./diff-woXpYk--.js`),[]),html:()=>Qx(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([2,3,4])),javascript:()=>Qx(()=>import(`./javascript-BgS3c2Ky.js`),[]),json:()=>Qx(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>Qx(()=>import(`./jsonc-CYpm1nAK.js`),[]),jsx:()=>Qx(()=>import(`./jsx-Bz0zcwM4.js`),[]),markdown:()=>Qx(()=>import(`./markdown-BYOwaDjH.js`),[]),python:()=>Qx(()=>import(`./python-gzcpVVnB.js`),[]),shellscript:()=>Qx(()=>import(`./shellscript-CLZ0U2zV.js`),[]),svelte:()=>Qx(()=>import(`./svelte-Uaf2W_lJ.js`),__vite__mapDeps([5,3,4,6])),tsx:()=>Qx(()=>import(`./tsx-udAQXfEw.js`),[]),typescript:()=>Qx(()=>import(`./typescript-bsJCZSQ-.js`),[]),xml:()=>Qx(()=>import(`./xml-DMbpbO54.js`),[]),yaml:()=>Qx(()=>import(`./yaml-rwi0_p6S.js`),[])},Lie={"github-light":()=>Qx(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-dark-dimmed":()=>Qx(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[])},Rie=new Map([[``,`markdown`],[`text`,`markdown`],[`plain`,`markdown`],[`plaintext`,`markdown`],[`sh`,`bash`],[`shell`,`shellscript`],[`zsh`,`shellscript`],[`js`,`javascript`],[`ts`,`typescript`],[`md`,`markdown`],[`yml`,`yaml`]]),zie=new Set(Object.keys($x)),eS,tS=new Li(500);function nS(e){let t=(e??``).toLowerCase().trim();return Rie.get(t)||(zie.has(t)?t:void 0)}function Bie(e){return typeof window>`u`||typeof window.requestIdleCallback!=`function`?e():new Promise((t,n)=>{window.requestIdleCallback(()=>{e().then(t,n)},{timeout:750})})}async function Vie(){return eS??=Promise.all([Qx(()=>import(`./dist-DyXP4lzk.js`),[]),Qx(()=>import(`./dist-FQvzRocB.js`),[])]).then(([e,t])=>{let n=e.createBundledHighlighter({langs:$x,themes:Lie,engine:()=>t.createJavaScriptRegexEngine()});return e.createSingletonShorthands(n)}),eS}async function Hie(e,t){let n=nS(t);if(n)return Bie(async()=>(await Vie()).codeToHtml(e,{lang:n,themes:{light:`github-light`,dark:`github-dark-dimmed`},defaultColor:!1}))}function Uie(e,t){return`${t}\0${e}`}function rS(e,t){let n=nS(t);if(!n)return;let r=Uie(e,n),i=tS.get(r);if(i!==void 0||tS.has(r))return i;let a=Hie(e,n).then(e=>(tS.set(r,e),e)).catch(()=>{tS.delete(r)});return tS.set(r,a),a}var Wie=0,iS=Promise.resolve();function aS(e,t,n,r){let i=e.getPropertyValue(t).trim()||n,a=r.createElement(`canvas`);a.width=1,a.height=1;let o=a.getContext(`2d`);if(!o)return n;o.clearRect(0,0,1,1),o.fillStyle=i,o.fillRect(0,0,1,1);let[s,c,l]=o.getImageData(0,0,1,1).data;return`#${[s,c,l].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function oS(e,t,n){let r=e=>[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)),i=r(e),a=r(t);return`#${i.map((e,t)=>Math.round(e*(1-n)+a[t]*n).toString(16).padStart(2,`0`)).join(``)}`}function Gie(e){let t=e.ownerDocument,n=t.documentElement,r=getComputedStyle(n),i=n.classList.contains(`dark`),a=aS(r,`--foreground`,`#000000`,t),o=aS(r,`--card`,`#ffffff`,t),s=aS(r,`--border`,`#808080`,t),c={dark:i,fontFamily:r.fontFamily||`sans-serif`,background:aS(r,`--background`,`#ffffff`,t),foreground:a,card:o,surface:i?oS(o,a,.1):o,primary:aS(r,`--primary`,`#000000`,t),border:s,strongBorder:i?oS(s,a,.3):s,mutedForeground:aS(r,`--muted-foreground`,`#808080`,t)};return{...c,fingerprint:[n.dataset.theme??``,c.dark?`dark`:`light`,c.fontFamily,c.background,c.foreground,c.card,c.surface,c.primary,c.border,c.strongBorder,c.mutedForeground].join(`\0`)}}function sS(e){return e?.trim().toLowerCase()===`mermaid`}async function Kie(e){let{default:t}=await Qx(async()=>{let{default:e}=await import(`./purify.es--UZZef80.js`);return{default:e}},[]),n=t(window).sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`script`,`foreignObject`],FORBID_ATTR:[`href`,`xlink:href`]}),r=new DOMParser().parseFromString(n,`image/svg+xml`);if(!(r.querySelector(`parsererror`)||r.documentElement.tagName!==`svg`))return r.documentElement.outerHTML}async function qie(e,t){let{default:n}=await Qx(async()=>{let{default:e}=await import(`./mermaid.core-BRVnyKar.js`);return{default:e}},__vite__mapDeps([7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]));n.initialize({startOnLoad:!1,securityLevel:`strict`,htmlLabels:!1,theme:`base`,fontFamily:t.fontFamily,themeVariables:{background:t.background,primaryColor:t.surface,primaryTextColor:t.foreground,primaryBorderColor:t.strongBorder,secondaryColor:t.background,secondaryTextColor:t.foreground,secondaryBorderColor:t.strongBorder,tertiaryColor:t.surface,tertiaryTextColor:t.foreground,tertiaryBorderColor:t.strongBorder,lineColor:t.mutedForeground,textColor:t.foreground,mainBkg:t.surface,nodeBorder:t.strongBorder,clusterBkg:t.background,clusterBorder:t.strongBorder,titleColor:t.foreground,edgeLabelBackground:t.background,actorBkg:t.surface,actorBorder:t.strongBorder,actorTextColor:t.foreground,actorLineColor:t.strongBorder,signalColor:t.foreground,signalTextColor:t.foreground,labelBoxBkgColor:t.background,labelBoxBorderColor:t.strongBorder,labelTextColor:t.foreground,loopTextColor:t.foreground,activationBkgColor:t.surface,activationBorderColor:t.primary,noteBkgColor:t.surface,noteBorderColor:t.primary,noteTextColor:t.foreground,sequenceNumberColor:t.background},flowchart:{htmlLabels:!1}});let r=`nerve-mermaid-${++Wie}`,{svg:i}=await n.render(r,e);return Kie(i)}function cS(e,t){let n=Gie(t),r=async()=>{try{let t=await qie(e,n);return t?{ok:!0,svg:t,themeFingerprint:n.fingerprint}:{ok:!1,themeFingerprint:n.fingerprint}}catch{return{ok:!1,themeFingerprint:n.fingerprint}}},i=iS.then(r,r);return iS=i.then(()=>void 0,()=>void 0),i}function lS(e,t){let n=new DOMParser().parseFromString(t,`image/svg+xml`);if(n.querySelector(`parsererror`)||n.documentElement.tagName!==`svg`)return!1;let r=e.ownerDocument.importNode(n.documentElement,!0);return r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,e.getAttribute(`aria-label`)??`Mermaid diagram`),e.replaceChildren(r),!0}function Jie(e){let t=0,n=Array.from(e.querySelectorAll(`[data-mermaid-diagram]`)).map(e=>({host:e,source:e.querySelector(`pre > code`)?.textContent??``,fallback:e.cloneNode(!0)})),r=()=>{let r=++t;for(let i of n)!i.source||!i.host.isConnected||(i.host.dataset.state=`loading`,cS(i.source,i.host).then(n=>{if(r!==t||!i.host.isConnected||!e.contains(i.host))return;if(n.ok&&lS(i.host,n.svg)){i.host.dataset.state=`rendered`;return}let a=i.fallback.cloneNode(!0),o=document.createElement(`p`);o.className=`mermaid-error`,o.textContent=`Diagram could not be rendered`,i.host.replaceChildren(...Array.from(a.childNodes),o),i.host.dataset.state=`error`}))};r();let i=new MutationObserver(r);return i.observe(e.ownerDocument.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`]}),{destroy(){t+=1,i.disconnect()}}}var Yie=typeof self==`object`?self:globalThis,uS=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Yie[e](t)},Xie=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(uS(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(uS(a,o),i)};return r},dS=e=>Xie(new Map,e)(0),fS=``,{toString:Zie}={},{keys:Qie}=Object,pS=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Zie.call(e).slice(8,-1);switch(n){case`Array`:return[1,fS];case`Object`:return[2,fS];case`Date`:return[3,fS];case`RegExp`:return[4,fS];case`Map`:return[5,fS];case`Set`:return[6,fS];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},mS=([e,t])=>e===0&&(t===`function`||t===`symbol`),$ie=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=pS(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Qie(r))(e||!mS(pS(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(mS(pS(n))||mS(pS(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!mS(pS(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},hS=(e,{json:t,lossy:n}={})=>{let r=[];return $ie(!(t||n),!!t,new Map,r)(e),r},gS=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?dS(hS(e,t)):structuredClone(e):(e,t)=>dS(hS(e,t)),_S=yS(`end`),vS=yS(`start`);function yS(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bS(e){let t=vS(e),n=_S(e);if(t&&n)return{start:t,end:n}}var xS=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],SS={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...xS,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...xS],h2:[[`className`,`sr-only`]],img:[...xS,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...xS,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...xS],table:[...xS],ul:[...xS,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},CS={}.hasOwnProperty;function eae(e,t){let n={type:`root`,children:[]},r=wS({schema:t?{...SS,...t}:SS,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function wS(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return tae(e,n);case`doctype`:return nae(e,n);case`element`:return rae(e,n);case`root`:return iae(e,n);case`text`:return aae(e,n);default:}}}function tae(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return OS(r,t),r}}function nae(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return OS(e,t),e}}function rae(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=TS(e,t.children),i=oae(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&CS.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return OS(o,t),o}function iae(e,t){let n={type:`root`,children:TS(e,t.children)};return OS(n,t),n}function aae(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return OS(n,t),n}function TS(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=wS(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function oae(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&CS.call(r,n)?r[n]:void 0,o=r&&CS.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(CS.call(s,l)){let t=s[l],n=ES(e,kS(a,l),l,t);n??=ES(e,kS(o,l),l,t),n!=null&&(c[l]=n)}if(i&&CS.call(i,n)){let e=i[n];for(l in e)CS.call(e,l)&&!CS.call(c,l)&&(c[l]=e[l])}return c}function ES(e,t,n,r){return t?Array.isArray(r)?sae(e,t,n,r):DS(e,t,n,r):void 0}function sae(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=DS(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function DS(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&cae(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function cae(e,t,n){let r=e.schema.protocols&&CS.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function OS(e,t){let n=bS(t);t.data&&(e.data=gS(t.data)),n&&(e.position=n)}function kS(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function lae(e){return function(t){return eae(t,e)}}var uae=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],AS=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};AS.prototype.normal={},AS.prototype.property={},AS.prototype.space=void 0;function jS(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new AS(n,r,t)}function MS(e){return e.toLowerCase()}var NS=class{constructor(e,t){this.attribute=t,this.property=e}};NS.prototype.attribute=``,NS.prototype.booleanish=!1,NS.prototype.boolean=!1,NS.prototype.commaOrSpaceSeparated=!1,NS.prototype.commaSeparated=!1,NS.prototype.defined=!1,NS.prototype.mustUseProperty=!1,NS.prototype.number=!1,NS.prototype.overloadedBoolean=!1,NS.prototype.property=``,NS.prototype.spaceSeparated=!1,NS.prototype.space=void 0;var PS=e({boolean:()=>FS,booleanish:()=>IS,commaOrSpaceSeparated:()=>VS,commaSeparated:()=>BS,number:()=>RS,overloadedBoolean:()=>LS,spaceSeparated:()=>zS}),dae=0,FS=HS(),IS=HS(),LS=HS(),RS=HS(),zS=HS(),BS=HS(),VS=HS();function HS(){return 2**++dae}var US=Object.keys(PS),WS=class extends NS{constructor(e,t,n,r){let i=-1;if(super(e,t),GS(this,`space`,r),typeof n==`number`)for(;++i<US.length;){let e=US[i];GS(this,US[i],(n&PS[e])===PS[e])}}};WS.prototype.defined=!0;function GS(e,t,n){n&&(e[t]=n)}function KS(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new WS(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[MS(r)]=r,n[MS(a.attribute)]=r}return new AS(t,n,e.space)}var qS=KS({properties:{ariaActiveDescendant:null,ariaAtomic:IS,ariaAutoComplete:null,ariaBusy:IS,ariaChecked:IS,ariaColCount:RS,ariaColIndex:RS,ariaColSpan:RS,ariaControls:zS,ariaCurrent:null,ariaDescribedBy:zS,ariaDetails:null,ariaDisabled:IS,ariaDropEffect:zS,ariaErrorMessage:null,ariaExpanded:IS,ariaFlowTo:zS,ariaGrabbed:IS,ariaHasPopup:null,ariaHidden:IS,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zS,ariaLevel:RS,ariaLive:null,ariaModal:IS,ariaMultiLine:IS,ariaMultiSelectable:IS,ariaOrientation:null,ariaOwns:zS,ariaPlaceholder:null,ariaPosInSet:RS,ariaPressed:IS,ariaReadOnly:IS,ariaRelevant:null,ariaRequired:IS,ariaRoleDescription:zS,ariaRowCount:RS,ariaRowIndex:RS,ariaRowSpan:RS,ariaSelected:IS,ariaSetSize:RS,ariaSort:null,ariaValueMax:RS,ariaValueMin:RS,ariaValueNow:RS,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function JS(e,t){return t in e?e[t]:t}function YS(e,t){return JS(e,t.toLowerCase())}var fae=KS({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:BS,acceptCharset:zS,accessKey:zS,action:null,allow:null,allowFullScreen:FS,allowPaymentRequest:FS,allowUserMedia:FS,alt:null,as:null,async:FS,autoCapitalize:null,autoComplete:zS,autoFocus:FS,autoPlay:FS,blocking:zS,capture:null,charSet:null,checked:FS,cite:null,className:zS,cols:RS,colSpan:null,content:null,contentEditable:IS,controls:FS,controlsList:zS,coords:RS|BS,crossOrigin:null,data:null,dateTime:null,decoding:null,default:FS,defer:FS,dir:null,dirName:null,disabled:FS,download:LS,draggable:IS,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:FS,formTarget:null,headers:zS,height:RS,hidden:LS,high:RS,href:null,hrefLang:null,htmlFor:zS,httpEquiv:zS,id:null,imageSizes:null,imageSrcSet:null,inert:FS,inputMode:null,integrity:null,is:null,isMap:FS,itemId:null,itemProp:zS,itemRef:zS,itemScope:FS,itemType:zS,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:FS,low:RS,manifest:null,max:null,maxLength:RS,media:null,method:null,min:null,minLength:RS,multiple:FS,muted:FS,name:null,nonce:null,noModule:FS,noValidate:FS,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:FS,optimum:RS,pattern:null,ping:zS,placeholder:null,playsInline:FS,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:FS,referrerPolicy:null,rel:zS,required:FS,reversed:FS,rows:RS,rowSpan:RS,sandbox:zS,scope:null,scoped:FS,seamless:FS,selected:FS,shadowRootClonable:FS,shadowRootDelegatesFocus:FS,shadowRootMode:null,shape:null,size:RS,sizes:null,slot:null,span:RS,spellCheck:IS,src:null,srcDoc:null,srcLang:null,srcSet:null,start:RS,step:null,style:null,tabIndex:RS,target:null,title:null,translate:null,type:null,typeMustMatch:FS,useMap:null,value:IS,width:RS,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zS,axis:null,background:null,bgColor:null,border:RS,borderColor:null,bottomMargin:RS,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:FS,declare:FS,event:null,face:null,frame:null,frameBorder:null,hSpace:RS,leftMargin:RS,link:null,longDesc:null,lowSrc:null,marginHeight:RS,marginWidth:RS,noResize:FS,noHref:FS,noShade:FS,noWrap:FS,object:null,profile:null,prompt:null,rev:null,rightMargin:RS,rules:null,scheme:null,scrolling:IS,standby:null,summary:null,text:null,topMargin:RS,valueType:null,version:null,vAlign:null,vLink:null,vSpace:RS,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:FS,disableRemotePlayback:FS,prefix:null,property:null,results:RS,security:null,unselectable:null},space:`html`,transform:YS}),pae=KS({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:VS,accentHeight:RS,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:RS,amplitude:RS,arabicForm:null,ascent:RS,attributeName:null,attributeType:null,azimuth:RS,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:RS,by:null,calcMode:null,capHeight:RS,className:zS,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:RS,diffuseConstant:RS,direction:null,display:null,dur:null,divisor:RS,dominantBaseline:null,download:FS,dx:null,dy:null,edgeMode:null,editable:null,elevation:RS,enableBackground:null,end:null,event:null,exponent:RS,externalResourcesRequired:null,fill:null,fillOpacity:RS,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:BS,g2:BS,glyphName:BS,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:RS,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:RS,horizOriginX:RS,horizOriginY:RS,id:null,ideographic:RS,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:RS,k:RS,k1:RS,k2:RS,k3:RS,k4:RS,kernelMatrix:VS,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:RS,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:RS,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:RS,overlineThickness:RS,paintOrder:null,panose1:null,path:null,pathLength:RS,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zS,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:RS,pointsAtY:RS,pointsAtZ:RS,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:VS,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:VS,rev:VS,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:VS,requiredFeatures:VS,requiredFonts:VS,requiredFormats:VS,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:RS,specularExponent:RS,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:RS,strikethroughThickness:RS,string:null,stroke:null,strokeDashArray:VS,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:RS,strokeOpacity:RS,strokeWidth:null,style:null,surfaceScale:RS,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:VS,tabIndex:RS,tableValues:null,target:null,targetX:RS,targetY:RS,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:VS,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:RS,underlineThickness:RS,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:RS,values:null,vAlphabetic:RS,vMathematical:RS,vectorEffect:null,vHanging:RS,vIdeographic:RS,version:null,vertAdvY:RS,vertOriginX:RS,vertOriginY:RS,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:RS,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:JS}),XS=KS({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ZS=KS({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:YS}),QS=KS({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),mae=/[A-Z]/g,$S=/-[a-z]/g,hae=/^data[-\w.:]+$/i;function gae(e,t){let n=MS(t),r=t,i=NS;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&hae.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace($S,vae);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!$S.test(e)){let n=e.replace(mae,_ae);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=WS}return new i(r,t)}function _ae(e){return`-`+e.toLowerCase()}function vae(e){return e.charAt(1).toUpperCase()}var yae=jS([qS,fae,XS,ZS,QS],`html`),eC=jS([qS,pae,XS,ZS,QS],`svg`),tC={}.hasOwnProperty;function bae(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&tC.call(t,e)){let n=String(t[e]);i=tC.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var xae=/["&'<>`]/g,Sae=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Cae=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wae=/[|\\{}()[\]^$+*?.]/g,nC=new WeakMap;function Tae(e,t){if(e=e.replace(t.subset?Eae(t.subset):xae,r),t.subset||t.escapeOnly)return e;return e.replace(Sae,n).replace(Cae,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Eae(e){let t=nC.get(e);return t||(t=Dae(e),nC.set(e,t)),t}function Dae(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(wae,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Oae=/[\dA-Fa-f]/;function kae(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Oae.test(String.fromCharCode(t))?r:r+`;`}var Aae=/\d/;function jae(e,t,n){let r=`&#`+String(e);return n&&t&&!Aae.test(String.fromCharCode(t))?r:r+`;`}var Mae=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),rC={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},Nae=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],iC={}.hasOwnProperty,aC={},oC;for(oC in rC)iC.call(rC,oC)&&(aC[rC[oC]]=oC);var Pae=/[^\dA-Za-z]/;function Fae(e,t,n,r){let i=String.fromCharCode(e);if(iC.call(aC,i)){let e=aC[i],a=`&`+e;return n&&Mae.includes(e)&&!Nae.includes(e)&&(!r||t&&t!==61&&Pae.test(String.fromCharCode(t)))?a:a+`;`}return``}function Iae(e,t,n){let r=kae(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Fae(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=jae(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function sC(e,t){return Tae(e,Object.assign({format:Iae},t))}var Lae=/^>|^->|<!--|-->|--!>|<!-$/g,Rae=[`>`],zae=[`<`,`>`];function Bae(e,t,n,r){return r.settings.bogusComments?`<?`+sC(e.value,Object.assign({},r.settings.characterReferences,{subset:Rae}))+`>`:`<!--`+e.value.replace(Lae,i)+`-->`;function i(e){return sC(e,Object.assign({},r.settings.characterReferences,{subset:zae}))}}function Vae(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function cC(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Hae(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Uae(e){return e.join(` `).trim()}var Wae=/[ \t\n\f\r]/g;function lC(e){return typeof e==`object`?e.type===`text`?uC(e.value):!1:uC(e)}function uC(e){return e.replace(Wae,``)===``}var dC=pC(1),fC=pC(-1),Gae=[];function pC(e){return t;function t(t,n,r){let i=t?t.children:Gae,a=(n||0)+e,o=i[a];if(!r)for(;o&&lC(o);)a+=e,o=i[a];return o}}var Kae={}.hasOwnProperty;function mC(e){return t;function t(t,n,r){return Kae.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var hC=mC({body:Jae,caption:gC,colgroup:gC,dd:Qae,dt:Zae,head:gC,html:qae,li:Xae,optgroup:$ae,option:eoe,p:Yae,rp:_C,rt:_C,tbody:noe,td:vC,tfoot:roe,th:vC,thead:toe,tr:ioe});function gC(e,t,n){let r=dC(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&lC(r.value.charAt(0)))}function qae(e,t,n){let r=dC(n,t);return!r||r.type!==`comment`}function Jae(e,t,n){let r=dC(n,t);return!r||r.type!==`comment`}function Yae(e,t,n){let r=dC(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function Xae(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Zae(e,t,n){let r=dC(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Qae(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function _C(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function $ae(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function eoe(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function toe(e,t,n){let r=dC(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function noe(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function roe(e,t,n){return!dC(n,t)}function ioe(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function vC(e,t,n){let r=dC(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var aoe=mC({body:coe,colgroup:loe,head:soe,html:ooe,tbody:uoe});function ooe(e){let t=dC(e,-1);return!t||t.type!==`comment`}function soe(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function coe(e){let t=dC(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&lC(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function loe(e,t,n){let r=fC(n,t),i=dC(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&hC(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function uoe(e,t,n){let r=fC(n,t),i=dC(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&hC(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var yC={name:[[`
41
+ \f\r &/=>`.split(``),`
42
+ \f\r "&'/=>\``.split(``)],[`\0
43
+ \f\r "&'/<=>`.split(``),`\0
44
+ \f\r "&'/<=>\``.split(``)]],unquoted:[[`
45
+ \f\r &>`.split(``),`\0
46
+ \f\r "&'<=>\``.split(``)],[`\0
47
+ \f\r "&'<=>\``.split(``),`\0
48
+ \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function doe(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1:r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=eC);let l=foe(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!aoe(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!hC(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function foe(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=poe(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function poe(e,t,n){let r=gae(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=sC(r.attribute,Object.assign({},e.settings.characterReferences,{subset:yC.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Hae:Uae)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=sC(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:yC.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&cC(n,o)>cC(n,e.alternative)&&(o=e.alternative),s=o+sC(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?yC.single:yC.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var moe=[`<`,`&`];function bC(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:sC(e.value,Object.assign({},r.settings.characterReferences,{subset:moe}))}function hoe(e,t,n,r){return r.settings.allowDangerousHtml?e.value:bC(e,t,n,r)}function goe(e,t,n,r){return r.all(e)}var _oe=bae(`type`,{invalid:voe,unknown:yoe,handlers:{comment:Bae,doctype:Vae,element:doe,raw:hoe,root:goe,text:bC}});function voe(e){throw Error("Expected node, not `"+e+"`")}function yoe(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var boe={},xoe={},Soe=[];function xC(e,t){let n=t||boe,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Coe,all:woe,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||uae,characterReferences:n.characterReferences||xoe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?eC:yae,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Coe(e,t,n){return _oe(e,t,n,this)}function woe(e){let t=[],n=e&&e.children||Soe,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}function Toe(e){let t=this,n={...t.data(`settings`),...e};t.compiler=r;function r(e){return xC(e,n)}}function Eoe(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}var SC=(function(e){if(e==null)return Aoe;if(typeof e==`function`)return CC(e);if(typeof e==`object`)return Array.isArray(e)?Doe(e):Ooe(e);if(typeof e==`string`)return koe(e);throw Error(`Expected function, string, or object as test`)});function Doe(e){let t=[],n=-1;for(;++n<e.length;)t[n]=SC(e[n]);return CC(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Ooe(e){let t=e;return CC(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function koe(e){return CC(t);function t(t){return t&&t.type===e}}function CC(e){return t;function t(t,n,r){return!!(joe(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Aoe(){return!0}function joe(e){return typeof e==`object`&&!!e&&`type`in e}function Moe(e){return e}var wC=[];function TC(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=SC(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Moe(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=wC,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Noe(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Noe(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?wC:[e]}function EC(e,t,n){let r=SC((n||{}).ignore||[]),i=Poe(t),a=-1;for(;++a<i.length;)TC(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function Poe(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Foe(e[0]),Ioe(e[1])])}return t}function Foe(e){return typeof e==`string`?new RegExp(Eoe(e),`g`):e}function Ioe(e){return typeof e==`function`?e:function(){return e}}function Loe(e){EC(e,[/\r?\n|\r/g,Roe])}function Roe(){return{type:`break`}}function zoe(){return function(e){Loe(e)}}var DC=IC(/[A-Za-z]/),OC=IC(/[\dA-Za-z]/),Boe=IC(/[#-'*+\--9=?A-Z^-~]/);function kC(e){return e!==null&&(e<32||e===127)}var AC=IC(/\d/),Voe=IC(/[\dA-Fa-f]/),Hoe=IC(/[!-/:-@[-`{-~]/);function jC(e){return e!==null&&e<-2}function MC(e){return e!==null&&(e<0||e===32)}function NC(e){return e===-2||e===-1||e===32}var PC=IC(/\p{P}|\p{S}/u),FC=IC(/\s/);function IC(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var LC=`phrasing`,RC=[`autolink`,`link`,`image`,`label`];function Uoe(){return{transforms:[Xoe],enter:{literalAutolink:Goe,literalAutolinkEmail:zC,literalAutolinkHttp:zC,literalAutolinkWww:zC},exit:{literalAutolink:Yoe,literalAutolinkEmail:Joe,literalAutolinkHttp:Koe,literalAutolinkWww:qoe}}}function Woe(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:LC,notInConstruct:RC},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:LC,notInConstruct:RC},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:LC,notInConstruct:RC}]}}function Goe(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function zC(e){this.config.enter.autolinkProtocol.call(this,e)}function Koe(e){this.config.exit.autolinkProtocol.call(this,e)}function qoe(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Joe(e){this.config.exit.autolinkEmail.call(this,e)}function Yoe(e){this.exit(e)}function Xoe(e){EC(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Zoe],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Qoe]],{ignore:[`link`,`linkReference`]})}function Zoe(e,t,n,r,i){let a=``;if(!BC(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!$oe(n)))return!1;let o=ese(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Qoe(e,t,n,r){return!BC(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function $oe(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function ese(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=cC(e,`(`),a=cC(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function BC(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||FC(n)||PC(n))&&(!t||n!==47)}function VC(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}HC.peek=lse;function tse(){this.buffer()}function nse(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function rse(){this.buffer()}function ise(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function ase(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=VC(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ose(e){this.exit(e)}function sse(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=VC(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cse(e){this.exit(e)}function lse(){return`[`}function HC(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function use(){return{enter:{gfmFootnoteCallString:tse,gfmFootnoteCall:nse,gfmFootnoteDefinitionLabelString:rse,gfmFootnoteDefinition:ise},exit:{gfmFootnoteCallString:ase,gfmFootnoteCall:ose,gfmFootnoteDefinitionLabelString:sse,gfmFootnoteDefinition:cse}}}function dse(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:HC},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
49
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?UC:fse))),s(),o}}function fse(e,t,n){return t===0?e:UC(e,t,n)}function UC(e,t,n){return(n?``:` `)+e}var pse=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];WC.peek=vse;function mse(){return{canContainEols:[`delete`],enter:{strikethrough:gse},exit:{strikethrough:_se}}}function hse(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:pse}],handlers:{delete:WC}}}function gse(e){this.enter({type:`delete`,children:[]},e)}function _se(e){this.exit(e)}function WC(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function vse(){return`~`}function yse(e){return e.length}function bse(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||yse,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=xse(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=GC(r[d]);else{let e=GC(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
50
+ `)}function xse(e){return e==null?``:String(e)}function GC(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Sse(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Cse);return i(),o}function Cse(e,t,n){return`>`+(n?``:` `)+e}function wse(e,t){return KC(e,t.inConstruct,!0)&&!KC(e,t.notInConstruct,!1)}function KC(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function qC(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
51
+ `&&wse(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
52
+ `}function Tse(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function Ese(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Dse(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Ose(e,t,n,r){let i=Dse(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Ese(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,kse);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(Tse(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
53
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
54
+ `),a&&(u+=s.move(a+`
55
+ `)),u+=s.move(c),l(),u}function kse(e,t,n){return(n?``:` `)+e}function JC(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ase(e,t,n,r){let i=JC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
56
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function jse(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function YC(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function XC(e){if(e===null||MC(e)||FC(e))return 1;if(PC(e))return 2}function ZC(e,t,n){let r=XC(e),i=XC(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}QC.peek=Mse;function QC(e,t,n,r){let i=jse(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=ZC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=YC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=ZC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+YC(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Mse(e,t,n){return n.options.emphasis||`*`}function $C(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),TC(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Nse={};function ew(e,t){let n=t||Nse;return tw(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function tw(e,t,n){if(Pse(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return nw(e.children,t,n)}return Array.isArray(e)?nw(e,t,n):``}function nw(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=tw(e[i],t,n);return r.join(``)}function Pse(e){return!!(e&&typeof e==`object`)}function Fse(e,t){let n=!1;return $C(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&ew(e)&&(t.options.setext||n))}function Ise(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Fse(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
57
+ `,after:`
58
+ `});return r(),t(),o+`
59
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
60
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
61
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=YC(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}rw.peek=Lse;function rw(e){return e.value||``}function Lse(){return`<`}iw.peek=Rse;function iw(e,t,n,r){let i=JC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Rse(){return`!`}aw.peek=zse;function aw(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function zse(){return`!`}ow.peek=Bse;function ow(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Bse(){return"`"}function sw(e,t){let n=ew(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}cw.peek=Vse;function cw(e,t,n,r){let i=JC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(sw(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Vse(e,t,n){return sw(e,n)?`<`:`[`}lw.peek=Hse;function lw(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Hse(){return`[`}function uw(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Use(e){let t=uw(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Wse(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function dw(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Gse(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Wse(n):uw(n),s=e.ordered?o===`.`?`)`:`.`:Use(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),dw(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Kse(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function qse(e,t,n,r){let i=Kse(n),a=n.bulletCurrent||uw(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Jse(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Yse=SC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Xse(e,t,n,r){return(e.children.some(function(e){return Yse(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Zse(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}fw.peek=Qse;function fw(e,t,n,r){let i=Zse(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=ZC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=YC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=ZC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+YC(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Qse(e,t,n){return n.options.strong||`*`}function $se(e,t,n,r){return n.safe(e.value,r)}function ece(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function tce(e,t,n){let r=(dw(n)+(n.options.ruleSpaces?` `:``)).repeat(ece(n));return n.options.ruleSpaces?r.slice(0,-1):r}var pw={blockquote:Sse,break:qC,code:Ose,definition:Ase,emphasis:QC,hardBreak:qC,heading:Ise,html:rw,image:iw,imageReference:aw,inlineCode:ow,link:cw,linkReference:lw,list:Gse,listItem:qse,paragraph:Jse,root:Xse,strong:fw,text:$se,thematicBreak:tce},mw=document.createElement(`i`);function hw(e){let t=`&`+e+`;`;mw.innerHTML=t;let n=mw.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function gw(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}var nce=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rce(e){return e.replace(nce,ice)}function ice(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return gw(n.slice(t?2:1),t?16:10)}return hw(n)||e}function ace(){return{enter:{table:oce,tableData:vw,tableHeader:vw,tableRow:cce},exit:{codeText:lce,table:sce,tableData:_w,tableHeader:_w,tableRow:_w}}}function oce(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function sce(e){this.exit(e),this.data.inTable=void 0}function cce(e){this.enter({type:`tableRow`,children:[]},e)}function _w(e){this.exit(e)}function vw(e){this.enter({type:`tableCell`,children:[]},e)}function lce(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,uce));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function uce(e,t){return t===`|`?t:e}function dce(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
62
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
63
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return bse(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=pw.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function fce(){return{exit:{taskListCheckValueChecked:yw,taskListCheckValueUnchecked:yw,paragraph:mce}}}function pce(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:hce}}}function yw(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function mce(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function hce(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=pw.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function gce(){return[Uoe(),use(),mse(),ace(),fce()]}function _ce(e){return{extensions:[Woe(),dse(e),hse(),dce(e),pce()]}}function bw(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function xw(e,t){return e.length>0?(bw(e,e.length,0,t),e):t}var Sw={}.hasOwnProperty;function Cw(e){let t={},n=-1;for(;++n<e.length;)vce(t,e[n]);return t}function vce(e,t){let n;for(n in t){let r=(Sw.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Sw.call(r,a)||(r[a]=[]);let e=i[a];yce(r[a],Array.isArray(e)?e:e?[e]:[])}}}function yce(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);bw(e,0,0,r)}var bce={tokenize:Ece,partial:!0},ww={tokenize:Dce,partial:!0},Tw={tokenize:Oce,partial:!0},Ew={tokenize:kce,partial:!0},xce={tokenize:Ace,partial:!0},Dw={name:`wwwAutolink`,tokenize:wce,previous:Mw},Ow={name:`protocolAutolink`,tokenize:Tce,previous:Nw},kw={name:`emailAutolink`,tokenize:Cce,previous:Pw},Aw={};function Sce(){return{text:Aw}}for(var jw=48;jw<123;)Aw[jw]=kw,jw++,jw===58?jw=65:jw===91&&(jw=97);Aw[43]=kw,Aw[45]=kw,Aw[46]=kw,Aw[95]=kw,Aw[72]=[kw,Ow],Aw[104]=[kw,Ow],Aw[87]=[kw,Dw],Aw[119]=[kw,Dw];function Cce(e,t,n){let r=this,i,a;return o;function o(t){return!Fw(t)||!Pw.call(r,r.previous)||Iw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Fw(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(xce,u,l)(t):t===45||t===95||OC(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&DC(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function wce(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Mw.call(r,r.previous)||Iw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(bce,e.attempt(ww,e.attempt(Tw,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Tce(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Nw.call(r,r.previous)&&!Iw(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(DC(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||kC(t)||MC(t)||FC(t)||PC(t)?n(t):e.attempt(ww,e.attempt(Tw,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Ece(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Dce(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Ew,c,s)(t):t===null||MC(t)||FC(t)||t!==45&&PC(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Oce(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Ew,t,a)(o):o===null||MC(o)||FC(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function kce(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||MC(o)||FC(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||MC(e)||FC(e)?t(e):r(e)}function a(e){return DC(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):DC(t)?(e.consume(t),o):n(t)}}function Ace(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return OC(e)?n(e):t(e)}}function Mw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||MC(e)}function Nw(e){return!DC(e)}function Pw(e){return!(e===47||Fw(e))}function Fw(e){return e===43||e===45||e===46||e===95||OC(e)}function Iw(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Lw(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&OC(e.charCodeAt(n+1))&&OC(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Rw(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var zw={name:`attention`,resolveAll:jce,tokenize:Mce};function jce(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Bw(d,-c),Bw(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=xw(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=xw(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=xw(l,Rw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=xw(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=xw(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,bw(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Mce(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=XC(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=XC(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Bw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Nce={name:`autolink`,tokenize:Pce};function Pce(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return DC(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||OC(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||OC(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||kC(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Boe(t)?(e.consume(t),l):n(t)}function u(e){return OC(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||OC(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function Vw(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return NC(r)?(e.enter(n),s(r)):t(r)}function s(r){return NC(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Hw={partial:!0,tokenize:Fce};function Fce(e,t,n){return r;function r(t){return NC(t)?Vw(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||jC(e)?t(e):n(e)}}var Uw={continuation:{tokenize:Lce},exit:Rce,name:`blockQuote`,tokenize:Ice};function Ice(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return NC(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Lce(e,t,n){let r=this;return i;function i(t){return NC(t)?Vw(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Uw,t,n)(r)}}function Rce(e){e.exit(`blockQuote`)}var Ww={name:`characterEscape`,tokenize:zce};function zce(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Hoe(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Gw={name:`characterReference`,tokenize:Bce};function Bce(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=OC,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Voe,u):(e.enter(`characterReferenceValue`),a=7,o=AC,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===OC&&!hw(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Kw={partial:!0,tokenize:Yw},qw={concrete:!0,name:`codeFenced`,tokenize:Jw};function Jw(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),NC(t)?Vw(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||jC(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Kw,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||jC(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):NC(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Vw(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||jC(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||jC(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&NC(t)?Vw(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||jC(t)?e.check(Kw,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||jC(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),NC(t)?Vw(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),NC(t)?Vw(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||jC(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Yw(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Xw={name:`codeIndented`,tokenize:Qw},Zw={partial:!0,tokenize:$w};function Qw(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Vw(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):jC(t)?e.attempt(Zw,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||jC(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function $w(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):jC(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Vw(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):jC(e)?i(e):n(e)}}var eT={name:`codeText`,previous:nT,resolve:tT,tokenize:rT};function tT(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function nT(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function rT(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):jC(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||jC(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var iT=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&aT(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),aT(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),aT(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);aT(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);aT(this.left,t.reverse())}}};function aT(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function oT(e){let t={},n=-1,r,i,a,o,s,c,l,u=new iT(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,sT(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return bw(e,0,1/0,u.slice(0)),!l}function sT(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var cT={resolve:uT,tokenize:dT},lT={partial:!0,tokenize:fT};function uT(e){return oT(e),e}function dT(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):jC(t)?e.check(lT,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function fT(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Vw(e,a,`linePrefix`)}function a(i){if(i===null||jC(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function pT(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||kC(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||jC(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||MC(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||kC(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function mT(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):jC(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||jC(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!NC(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function hT(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):jC(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Vw(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||jC(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function gT(e,t){let n;return r;function r(i){return jC(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):NC(i)?Vw(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var _T={name:`definition`,tokenize:yT},vT={partial:!0,tokenize:bT};function yT(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return mT.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=VC(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return MC(t)?gT(e,l)(t):l(t)}function l(t){return pT(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(vT,d,d)(t)}function d(t){return NC(t)?Vw(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||jC(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function bT(e,t,n){return r;function r(t){return MC(t)?gT(e,i)(t):n(t)}function i(t){return hT(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return NC(t)?Vw(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||jC(e)?t(e):n(e)}}var xT={name:`hardBreakEscape`,tokenize:ST};function ST(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return jC(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var CT={name:`headingAtx`,resolve:wT,tokenize:TT};function wT(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},bw(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function TT(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||MC(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||jC(n)?(e.exit(`atxHeading`),t(n)):NC(n)?Vw(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||MC(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ET=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),DT=[`pre`,`script`,`style`,`textarea`],OT={concrete:!0,name:`htmlFlow`,resolveTo:jT,tokenize:MT},kT={partial:!0,tokenize:PT},AT={partial:!0,tokenize:NT};function jT(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function MT(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:re):DC(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):DC(a)?(e.consume(a),i=4,r.interrupt?t:re):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:re):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return DC(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||MC(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&DT.includes(l)?(i=1,r.interrupt?t(s):O(s)):ET.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||OC(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return NC(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||DC(t)?(e.consume(t),b):NC(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||OC(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):NC(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):NC(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||jC(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||MC(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||NC(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||jC(t)?O(t):NC(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),ne):t===62&&i===4?(e.consume(t),N):t===63&&i===3?(e.consume(t),re):t===93&&i===5?(e.consume(t),M):jC(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(kT,P,ee)(t)):t===null||jC(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(AT,te,P)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),k}function k(t){return t===null||jC(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),re):O(t)}function ne(t){return t===47?(e.consume(t),o=``,j):O(t)}function j(t){if(t===62){let n=o.toLowerCase();return DT.includes(n)?(e.consume(t),N):O(t)}return DC(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),j):O(t)}function M(t){return t===93?(e.consume(t),re):O(t)}function re(t){return t===62?(e.consume(t),N):t===45&&i===2?(e.consume(t),re):O(t)}function N(t){return t===null||jC(t)?(e.exit(`htmlFlowData`),P(t)):(e.consume(t),N)}function P(n){return e.exit(`htmlFlow`),t(n)}}function NT(e,t,n){let r=this;return i;function i(t){return jC(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function PT(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Hw,t,n)}}var FT={name:`htmlText`,tokenize:IT};function IT(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):DC(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):DC(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):jC(t)?(o=d,ne(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):jC(t)?(o=h,ne(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):jC(t)?(o=v,ne(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):jC(t)?(o=y,ne(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return DC(t)?(e.consume(t),S):n(t)}function S(t){return t===45||OC(t)?(e.consume(t),S):C(t)}function C(t){return jC(t)?(o=C,ne(t)):NC(t)?(e.consume(t),C):A(t)}function w(t){return t===45||OC(t)?(e.consume(t),w):t===47||t===62||MC(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||DC(t)?(e.consume(t),E):jC(t)?(o=T,ne(t)):NC(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||OC(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):jC(t)?(o=D,ne(t)):NC(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):jC(t)?(o=O,ne(t)):NC(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,k):t===null?n(t):jC(t)?(o=ee,ne(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||MC(t)?T(t):(e.consume(t),te)}function k(e){return e===47||e===62||MC(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ne(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return NC(t)?Vw(e,M,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):M(t)}function M(t){return e.enter(`htmlTextData`),o(t)}}var LT={name:`labelEnd`,resolveAll:VT,resolveTo:HT,tokenize:UT},RT={tokenize:WT},zT={tokenize:GT},BT={tokenize:KT};function VT(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&bw(e,0,e.length,n),e}function HT(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=xw(s,e.slice(a+1,a+r+3)),s=xw(s,[[`enter`,u,t]]),s=xw(s,Rw(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=xw(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=xw(s,e.slice(o+1)),s=xw(s,[[`exit`,c,t]]),bw(e,a,e.length,s),e}function UT(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(VC(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(RT,u,o?u:d)(t):t===91?e.attempt(zT,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(BT,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function WT(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return MC(t)?gT(e,a)(t):a(t)}function a(t){return t===41?u(t):pT(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return MC(t)?gT(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?hT(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return MC(t)?gT(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function GT(e,t,n){let r=this;return i;function i(t){return mT.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(VC(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function KT(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var qT={name:`labelStartImage`,resolveAll:LT.resolveAll,tokenize:JT};function JT(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var YT={name:`labelStartLink`,resolveAll:LT.resolveAll,tokenize:XT};function XT(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ZT={name:`lineEnding`,tokenize:QT};function QT(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Vw(e,t,`linePrefix`)}}var $T={name:`thematicBreak`,tokenize:eE};function eE(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||jC(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),NC(t)?Vw(e,s,`whitespace`)(t):s(t))}}var tE={continuation:{tokenize:aE},exit:sE,name:`list`,tokenize:iE},nE={partial:!0,tokenize:cE},rE={partial:!0,tokenize:oE};function iE(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:AC(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check($T,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return AC(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Hw,r.interrupt?n:u,e.attempt(nE,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return NC(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function aE(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Hw,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Vw(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!NC(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(rE,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Vw(e,e.attempt(tE,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function oE(e,t,n){let r=this;return Vw(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function sE(e){e.exit(this.containerState.type)}function cE(e,t,n){let r=this;return Vw(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!NC(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var lE={name:`setextUnderline`,resolveTo:uE,tokenize:dE};function uE(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function dE(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),NC(t)?Vw(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||jC(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var fE={tokenize:bE,partial:!0};function pE(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:_E,continuation:{tokenize:vE},exit:yE}},text:{91:{name:`gfmFootnoteCall`,tokenize:gE},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:mE,resolveTo:hE}}}}function mE(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=VC(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function hE(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function gE(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||MC(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(VC(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return MC(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function _E(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||MC(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=VC(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return MC(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Vw(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function vE(e,t,n){return e.check(Hw,t,e.attempt(fE,t,n))}function yE(e){e.exit(`gfmFootnoteDefinition`)}function bE(e,t,n){let r=this;return Vw(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function xE(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&bw(o,o.length,0,Rw(s,e.slice(r+1,n),t)),bw(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),bw(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=XC(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=XC(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var SE=class{constructor(){this.map=[]}add(e,t,n){CE(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function CE(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function wE(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function TE(){return{flow:{null:{name:`table`,tokenize:EE,resolveAll:DE}}}}function EE(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):jC(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):NC(t)?Vw(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||MC(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,NC(t)?Vw(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return NC(t)?Vw(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||jC(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return NC(t)?Vw(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||jC(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||jC(n)?(e.exit(`tableRow`),t(n)):NC(n)?Vw(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||MC(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function DE(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new SE;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(kE(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=OE(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=OE(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=OE(f,t,o,i,n,d)):(o[0]=o[1],d=OE(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&kE(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=wE(t.events,n))}return e}function OE(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},AE(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=AE(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=AE(t.events,n[2]),a=AE(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},AE(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function kE(e,t,n,r,i){let a=[],o=AE(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function AE(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var jE={name:`tasklistCheck`,tokenize:NE};function ME(){return{text:{91:jE}}}function NE(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return MC(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return jC(r)?t(r):NC(r)?e.check({tokenize:PE},t,n)(r):n(r)}}function PE(e,t,n){return Vw(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function FE(e){return Cw([Sce(),pE(),xE(e),TE(),ME()])}var IE={};function LE(e){let t=this,n=e||IE,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(FE(n)),a.push(gce()),o.push(_ce(n))}var RE={tokenize:zE};function zE(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Vw(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return jC(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var BE={tokenize:HE},VE={tokenize:UE};function HE(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return bw(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(VE,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(VE,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return jC(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;bw(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function UE(e,t,n){return Vw(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var WE={tokenize:GE};function GE(e){let t=this,n=e.attempt(Hw,r,e.attempt(this.parser.constructs.flowInitial,i,Vw(e,e.attempt(this.parser.constructs.flow,i,e.attempt(cT,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var KE={resolveAll:XE()},qE=YE(`string`),JE=YE(`text`);function YE(e){return{resolveAll:XE(e===`text`?ZE:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function XE(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function ZE(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var QE=e({attentionMarkers:()=>oD,contentInitial:()=>eD,disable:()=>sD,document:()=>$E,flow:()=>nD,flowInitial:()=>tD,insideSpan:()=>aD,string:()=>rD,text:()=>iD}),$E={42:tE,43:tE,45:tE,48:tE,49:tE,50:tE,51:tE,52:tE,53:tE,54:tE,55:tE,56:tE,57:tE,62:Uw},eD={91:_T},tD={[-2]:Xw,[-1]:Xw,32:Xw},nD={35:CT,42:$T,45:[lE,$T],60:OT,61:lE,95:$T,96:qw,126:qw},rD={38:Gw,92:Ww},iD={[-5]:ZT,[-4]:ZT,[-3]:ZT,33:qT,38:Gw,42:zw,60:[Nce,FT],91:YT,92:[xT,Ww],93:LT,95:zw,96:eT},aD={null:[zw,KE]},oD={null:[42,95]},sD={null:[]};function cD(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=xw(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Rw(a,l.events,l),l.events):[]}function f(e,t){return uD(p(e),t)}function p(e){return lD(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){jC(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&bw(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function lD(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function uD(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
64
+ `;break;case-3:o=`\r
65
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function dD(e){let t={constructs:Cw([QE,...(e||{}).extensions||[]]),content:n(RE),defined:[],document:n(BE),flow:n(WE),lazy:{},string:n(qE),text:n(JE)};return t;function n(e){return n;function n(n){return cD(t,e,n)}}}function fD(e){for(;!oT(e););return e}var pD=/[\0\t\n\r]/g;function mD(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(pD.lastIndex=u,c=pD.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}function hD(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?_D(e.position):`start`in e||`end`in e?_D(e):`line`in e||`column`in e?gD(e):``}function gD(e){return vD(e&&e.line)+`:`+vD(e&&e.column)}function _D(e){return gD(e&&e.start)+`-`+gD(e&&e.end)}function vD(e){return e&&typeof e==`number`?e:1}var yD={}.hasOwnProperty;function bD(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),xD(n)(fD(dD(n).document().write(mD()(e,t,!0))))}function xD(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ge),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(pe),blockQuote:a(ue),characterEscape:T,characterReference:T,codeFenced:a(I),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(I,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(L),hardBreakEscape:a(R),hardBreakTrailing:a(R),htmlFlow:a(me,o),htmlFlowData:T,htmlText:a(me,o),htmlTextData:T,image:a(he),label:o,link:a(ge),listItem:a(ve),listItemValue:f,listOrdered:a(_e,d),listUnordered:a(_e),paragraph:a(z),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(pe),strong:a(ye),thematicBreak:a(B)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:se,characterReference:F,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(k),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(ne),label:M,labelText:j,lineEnding:D,link:c(A),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:re,resourceTitleString:N,resource:P,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};CD(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];yD.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||TD).call(a,void 0,e[0])}for(r.position={start:SD(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:SD(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:SD(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||TD).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+hD({start:e.start,end:e.end})+`): it’s not open`);n.position.end=SD(e.end)}function u(){return ew(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=VC(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=be(),n.position={start:SD(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=SD(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=SD(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ne(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function j(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=rce(t),n.identifier=VC(t).toLowerCase()}function M(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function P(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function ae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=VC(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function oe(e){this.data.characterReferenceType=e.type}function se(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=gw(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=hw(t);let i=this.stack[this.stack.length-1];i.value+=r}function F(e){let t=this.stack.pop();t.position.end=SD(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[]}}function I(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function L(){return{type:`emphasis`,children:[]}}function pe(){return{type:`heading`,depth:0,children:[]}}function R(){return{type:`break`}}function me(){return{type:`html`,value:``}}function he(){return{type:`image`,title:null,url:``,alt:null}}function ge(){return{type:`link`,title:null,url:``,children:[]}}function _e(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ve(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function z(){return{type:`paragraph`,children:[]}}function ye(){return{type:`strong`,children:[]}}function be(){return{type:`text`,value:``}}function B(){return{type:`thematicBreak`}}}function SD(e){return{line:e.line,column:e.column,offset:e.offset}}function CD(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?CD(e,r):wD(e,r)}}function wD(e,t){let n;for(n in t)if(yD.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function TD(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+hD({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hD({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+hD({start:t.start,end:t.end})+`) is still open`)}function ED(e){let t=this;t.parser=n;function n(n){return bD(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function DD(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function OD(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
66
+ `}]}function kD(e,t){let n=t.value?t.value+`
67
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function AD(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jD(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MD(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Lw(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function ND(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PD(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function FD(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function ID(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return FD(e,t);let i={src:Lw(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function LD(e,t){let n={src:Lw(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function RD(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function zD(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return FD(e,t);let i={href:Lw(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function BD(e,t){let n={href:Lw(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function VD(e,t,n){let r=e.all(t),i=n?HD(n):UD(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
68
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
69
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function HD(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=UD(n[r])}return t}function UD(e){return e.spread??e.children.length>1}function WD(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function GD(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KD(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function qD(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JD(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=vS(t.children[1]),o=_S(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function YD(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function XD(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var ZD=9,QD=32;function $D(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(eO(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(eO(t.slice(i),i>0,!1)),a.join(``)}function eO(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===ZD||t===QD;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===ZD||t===QD;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function tO(e,t){let n={type:`text`,value:$D(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function nO(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var rO={blockquote:DD,break:OD,code:kD,delete:AD,emphasis:jD,footnoteReference:MD,heading:ND,html:PD,imageReference:ID,image:LD,inlineCode:RD,linkReference:zD,link:BD,listItem:VD,list:WD,paragraph:GD,root:KD,strong:qD,table:JD,tableCell:XD,tableRow:YD,text:tO,thematicBreak:nO,toml:iO,yaml:iO,definition:iO,footnoteDefinition:iO};function iO(){}function aO(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function oO(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function sO(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||aO,r=e.options.footnoteBackLabel||oO,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Lw(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...gS(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
70
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
71
+ `}]}}var cO={}.hasOwnProperty,lO={};function uO(e,t){let n=t||lO,r=new Map,i=new Map,a={all:s,applyData:fO,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...rO,...n.handlers},one:o,options:n,patch:dO,wrap:mO};return $C(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(cO.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=gS(n);return r.children=a.all(e),r}return gS(e)}return(a.options.unknownHandler||pO)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=hO(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=hO(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function dO(e,t){e.position&&(t.position=bS(e))}function fO(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,gS(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function pO(e,t){let n=t.data||{},r=`value`in t&&!(cO.call(n,`hProperties`)||cO.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function mO(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
72
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
73
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
74
+ `}),n}function hO(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gO(e,t){let n=uO(e,t),r=n.one(e,void 0),i=sO(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
75
+ `},i)),a}function _O(e,t){return e&&`run`in e?async function(n,r){let i=gO(n,{file:r,...t});await e.run(i,r)}:function(n,r){return gO(n,{file:r,...e||t})}}function vO(e){if(e)throw e}var yO=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function bO(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function xO(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?SO(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function SO(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var CO=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=hD(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};CO.prototype.file=``,CO.prototype.name=``,CO.prototype.reason=``,CO.prototype.message=``,CO.prototype.stack=``,CO.prototype.column=void 0,CO.prototype.line=void 0,CO.prototype.ancestors=void 0,CO.prototype.cause=void 0,CO.prototype.fatal=void 0,CO.prototype.place=void 0,CO.prototype.ruleId=void 0,CO.prototype.source=void 0;var wO={basename:TO,dirname:EO,extname:DO,join:OO,sep:`/`};function TO(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);jO(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function EO(e){if(jO(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function DO(e){jO(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function OO(...e){let t=-1,n;for(;++t<e.length;)jO(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:kO(n)}function kO(e){jO(e);let t=e.codePointAt(0)===47,n=AO(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function AO(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function jO(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var MO={cwd:NO};function NO(){return`/`}function PO(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function FO(e){if(typeof e==`string`)e=new URL(e);else if(!PO(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return IO(e)}function IO(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var LO=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],RO=class{constructor(e){let t;t=e?PO(e)?{path:e}:typeof e==`string`||HO(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:MO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<LO.length;){let e=LO[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)LO.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?wO.basename(this.path):void 0}set basename(e){BO(e,`basename`),zO(e,`basename`),this.path=wO.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?wO.dirname(this.path):void 0}set dirname(e){VO(this.basename,`dirname`),this.path=wO.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?wO.extname(this.path):void 0}set extname(e){if(zO(e,`extname`),VO(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=wO.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){PO(e)&&(e=FO(e)),BO(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?wO.basename(this.path,this.extname):void 0}set stem(e){BO(e,`stem`),zO(e,`stem`),this.path=wO.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new CO(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function zO(e,t){if(e&&e.includes(wO.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+wO.sep+"`")}function BO(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function VO(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function HO(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var UO=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),WO=t(yO(),1),GO={}.hasOwnProperty,KO=new class e extends UO{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=xO()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,WO.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(YO(`data`,this.frozen),this.namespace[e]=t,this):GO.call(this.namespace,e)&&this.namespace[e]||void 0:e?(YO(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=QO(e),n=this.parser||this.Parser;return qO(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),qO(`process`,this.parser||this.Parser),JO(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=QO(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);ek(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),qO(`processSync`,this.parser||this.Parser),JO(`processSync`,this.compiler||this.Compiler),this.process(e,r),ZO(`processSync`,`process`,t),n;function r(e,r){t=!0,vO(e),n=r}}run(e,t,n){XO(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=QO(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),ZO(`runSync`,`run`,n),r;function i(e,t){vO(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=QO(t),r=this.compiler||this.Compiler;return JO(`stringify`,r),XO(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(YO(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,WO.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];bO(o)&&bO(r)&&(r=(0,WO.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function qO(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function JO(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function YO(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function XO(e){if(!bO(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function ZO(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function QO(e){return $O(e)?e:new RO(e)}function $O(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function ek(e){return typeof e==`string`||tk(e)}function tk(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function nk(e){let t=KO().use(ED).use(LE);return e&&t.use(zoe),t.use(_O).use(lae).use(Toe)}var rk=nk(!1),ik=nk(!0),ak=400,ok=new Li(ak),sk=new Li(ak),ck=new Li(ak),lk=new Map;function uk(e,t){return`${t?`breaks`:`standard`}\0${e}`}function dk(e,t,n){return`${t?`t`:`f`}\0${uk(e,n)}`}function fk(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function pk(e,t={}){let n=t.cache??!0,r=t.preserveLineBreaks??!1,i=uk(e,r);if(n){let e=ok.get(i);if(e!==void 0)return e}let a;try{a=String((r?ik:rk).processSync(e))}catch{a=fk(e)}return n&&ok.set(i,a),a}function mk(e){return e.match(/language-([\w-]+)/)?.[1]??`text`}function hk(e,t){let n=e.textContent??``;return t?ii(n).text:n}function gk(e,t){let n=e.cloneNode(!0),r=n.querySelector(`code`);return r?r.textContent=t:n.textContent=t,n}function _k(e){let t=document.createElement(`div`);t.className=`code-block`;let n=document.createElement(`button`);return n.type=`button`,n.className=`code-copy`,n.dataset.copyCode=``,n.textContent=`Copy`,t.append(n,e),t}function vk(e){let t=document.createElement(`div`);return t.className=`mermaid-block`,t.dataset.mermaidDiagram=``,t.setAttribute(`aria-label`,`Mermaid diagram`),t.append(e.cloneNode(!0)),t}function yk(e,t){if(typeof document>`u`||!e.includes(`<pre`))return e;let n=document.createElement(`div`);n.innerHTML=e;for(let e of Array.from(n.querySelectorAll(`pre > code`))){let n=e.parentElement;if(n){if(sS(mk(e.getAttribute(`class`)??``))){n.replaceWith(vk(n));continue}n.replaceWith(_k(gk(n,hk(e,t))))}}return n.innerHTML}function bk(e){if(typeof document>`u`||!e.includes(`<table`))return e;let t=document.createElement(`div`);t.innerHTML=e;for(let e of Array.from(t.querySelectorAll(`table`))){if(e.parentElement?.classList.contains(`table-scroll`))continue;let t=document.createElement(`div`);t.className=`table-scroll`,e.replaceWith(t),t.append(e)}return t.innerHTML}async function xk(e,t){if(typeof document>`u`||!e.includes(`<pre`))return e;let n=document.createElement(`div`);n.innerHTML=e;let r=Array.from(n.querySelectorAll(`pre > code`));return await Promise.all(r.map(async e=>{let n=mk(e.getAttribute(`class`)??``);if(sS(n)){let t=e.parentElement;t&&t.replaceWith(vk(t));return}try{let r=await rS(hk(e,t),n);if(r){let t=document.createElement(`div`);t.innerHTML=r;let n=t.firstElementChild;n&&e.parentElement?.replaceWith(_k(n));return}}catch{}let r=e.parentElement;r&&r.replaceWith(_k(gk(r,hk(e,t))))})),n.innerHTML}function Sk(e,t){return bk(yk(e,t))}async function Ck(e,t){return bk(await xk(e,t))}function wk(e,t,n=!1){let r=dk(e,t,n),i=sk.get(r);if(i!==void 0)return i;let a=Sk(pk(e,{preserveLineBreaks:n}),t);return sk.set(r,a),a}function Tk(e,t,n=!1){return ck.get(dk(e,t,n))}function Ek(e,t,n=!1){return Tk(e,t,n)??wk(e,t,n)}function Dk(e,t,n=!1){let r=dk(e,t,n),i=ck.get(r);if(i!==void 0)return Promise.resolve(i);let a=lk.get(r);if(a)return a;let o=Ck(pk(e,{preserveLineBreaks:n}),t).then(e=>(ck.set(r,e),lk.delete(r),e)).catch(e=>{throw lk.delete(r),e});return lk.set(r,o),o}function Ok(e){let t=0,n=0,r;for(;n<e.length;){let i=e.indexOf(`
76
+ `,n),a=i!==-1,o=a?i:e.length,s=a?o+1:o,c=e.slice(n,o),l=c.match(/^\s{0,3}(`{3,}|~{3,})/u)?.[1];if(l){let e=l[0];r?r.marker===e&&l.length>=r.length&&c.slice(c.indexOf(l)+l.length).trim()===``&&(r=void 0):r={marker:e,length:l.length}}n=s,!r&&a&&c.trim()===``&&(t=n)}return{prefix:e.slice(0,t),tail:e.slice(t)}}function kk(e,t){return t.length>e.length&&t.slice(e.length).includes(`
77
+ `)}var Ak={now:()=>Date.now(),schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)},jk=class{commit;intervalMs;clock;pending;hasPending=!1;timer;lastCommitAt;destroyed=!1;constructor(e,t=75,n=Ak){this.commit=e,this.intervalMs=t,this.clock=n}enqueue(e,t={}){if(this.destroyed)return;if(this.pending=e,this.hasPending=!0,t.priority||this.lastCommitAt===void 0){this.flushNow();return}if(this.timer!==void 0)return;let n=this.clock.now()-this.lastCommitAt;this.timer=this.clock.schedule(()=>{this.timer=void 0,this.commitPending()},Math.max(0,this.intervalMs-n))}flushNow(e){this.destroyed||(arguments.length>0&&(this.pending=e,this.hasPending=!0),this.cancelTimer(),this.commitPending())}destroy(){this.destroyed||(this.destroyed=!0,this.cancelTimer(),this.pending=void 0,this.hasPending=!1)}cancelTimer(){this.timer!==void 0&&(this.clock.cancel(this.timer),this.timer=void 0)}commitPending(){if(!this.hasPending)return;let e=this.pending;this.pending=void 0,this.hasPending=!1,this.lastCommitAt=this.clock.now(),this.commit(e)}},Mk=h(`<span class="whitespace-pre-wrap break-words"> </span>`),Nk=h(`<div class="markdown svelte-ss9wg9"><!> <!></div>`),Pk=h(`<div class="markdown svelte-ss9wg9"></div>`);function Fk(e,t){a(t,!0);let n=I(t,`trimCodeBlocks`,3,!0),r=I(t,`preserveLineBreaks`,3,!1),o=I(t,`streaming`,3,!1);function s(e,t,n){return e?Sk(pk(e,{cache:!1,preserveLineBreaks:n}),t):``}let c=ie(()=>{let e=o()?Ok(t.text):void 0;return{html:o()?``:Ek(t.text,n(),r()),prefixHtml:e?s(e.prefix,n(),r()):``,prefixSource:e?.prefix??``,tail:e?.tail??``,streaming:o(),source:t.text,trim:n(),preserveLineBreaks:r()}}),l=Y(N(c.html)),u=Y(N(c.prefixHtml)),f=c.prefixSource,m=c.trim,h=c.preserveLineBreaks,_=Y(N(c.tail)),v=Y(N(c.streaming)),y=c.source,b=c.trim,x=c.preserveLineBreaks,S=0;async function C(e){let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`button[data-copy-code]`);if(r){let e=r.closest(`.code-block`)?.querySelector(`pre code`)?.textContent??``;if(!e)return;try{await Pie(e),t.onCopy?.(!0)}catch{t.onCopy?.(!1)}return}if(!t.onOpenFile)return;let i=n.closest(`a[href]`)?.getAttribute(`href`);if(!i)return;let a=ni(i);if(!a)return;let o=ei(a),s=t.linkBasePath?ti(o.path,t.linkBasePath)??o.path:o.path;e.preventDefault(),t.onOpenFile(s,o.line)}function w(e){return e.addEventListener(`click`,C),{destroy(){e.removeEventListener(`click`,C)}}}function T(e,t){let n=0,r;async function i(t){let i=++n;r?.destroy(),r=void 0,!(!t.enabled||!t.html.includes(`data-mermaid-diagram`))&&(await he(),i===n&&(r=Jie(e)))}return i(t),{update:i,destroy(){n+=1,r?.destroy()}}}function E(e){let t=Ok(e.source);(t.prefix!==f||e.trim!==m||e.preserveLineBreaks!==h)&&(K(u,s(t.prefix,e.trim,e.preserveLineBreaks),!0),f=t.prefix,m=e.trim,h=e.preserveLineBreaks),K(_,t.tail,!0),K(v,!0),S+=1}let D=new jk(E);function O(e,t,n){let r=Tk(e,t,n);if(r!==void 0){K(l,r,!0),S+=1;return}K(l,wk(e,t,n),!0);let i=S+=1;Dk(e,t,n).then(e=>{i===S&&K(l,e,!0)}).catch(()=>{i===S&&K(l,wk(e,t,n),!0)})}be(()=>{let e=t.text,i=n(),a=r();if(!o()){W(v)&&D.flushNow({source:e,trim:i,preserveLineBreaks:a}),K(v,!1),O(e,i,a),y=e,b=i,x=a;return}let s=!W(v)||i!==b||a!==x||kk(y,e);y=e,b=i,x=a,D.enqueue({source:e,trim:i,preserveLineBreaks:a},{priority:s})}),be(()=>()=>D.destroy());var ee=U(),te=R(ee),ne=e=>{var t=Nk(),n=V(t);p(n,()=>W(u));var r=L(n,2),a=e=>{var t=Mk(),n=V(t,!0);d(t),F(()=>A(n,W(_))),g(e,t)};k(r,e=>{W(_)&&e(a)}),d(t),i(t,e=>w?.(e)),i(t,(e,t)=>T?.(e,t),()=>({html:W(u),enabled:!1})),g(e,t)},j=e=>{var t=Pk();p(t,()=>W(l),!0),d(t),i(t,e=>w?.(e)),i(t,(e,t)=>T?.(e,t),()=>({html:W(l),enabled:!0})),g(e,t)};k(te,e=>{W(v)?e(ne):e(j,-1)}),g(e,ee),z()}var Ik=Symbol.for(`nerve.conversationUi.capabilities`);function Lk(e){return _e(Ik,e)}function Rk(){return c(Ik)??{}}var zk=h(`<button type="button"> </button>`),Bk=h(`<a target="_blank" rel="noreferrer noopener"> </a>`),Vk=h(`<span> </span>`),Hk=h(`<div class="chips svelte-1xvwd06"></div>`),Uk=h(`<button class="more svelte-1xvwd06" type="button"> </button>`),Wk=h(`<div class="footer-actions svelte-1xvwd06"><!></div>`),Gk=h(`<div><!> <!> <!></div>`);function Kk(e,t){a(t,!0);let n=I(t,`meta`,19,()=>[]),i=J(()=>!!t.actions),o=J(()=>n().length>0||!!t.detailsAction||W(i));var c=U(),l=R(c),f=e=>{var a=Gk(),o=V(a),c=e=>{var i=Hk();_(i,21,n,E,(e,n)=>{var i=U(),a=R(i),o=e=>{var i=zk(),a=V(i,!0);d(i),F(()=>{s(i,1,`chip chip-action tone-${W(n).tone??`default`}`,`svelte-1xvwd06`),q(i,`title`,W(n).openPath),A(a,W(n).text)}),r(`click`,i,()=>t.onOpenFile?.(W(n).openPath)),g(e,i)},c=e=>{var t=Bk(),r=V(t,!0);d(t),F(()=>{s(t,1,`chip chip-action tone-${W(n).tone??`default`}`,`svelte-1xvwd06`),q(t,`href`,W(n).href),A(r,W(n).text)}),g(e,t)},l=e=>{var t=Vk(),r=V(t,!0);d(t),F(()=>{s(t,1,`chip tone-${W(n).tone??`default`}`,`svelte-1xvwd06`),A(r,W(n).text)}),g(e,t)};k(a,e=>{W(n).openPath?e(o):W(n).href?e(c,1):e(l,-1)}),g(e,i)}),d(i),g(e,i)};k(o,e=>{n().length>0&&e(c)});var l=L(o,2),f=e=>{var n=Uk(),i=V(n,!0);d(n),F(()=>A(i,t.detailsAction.label)),r(`click`,n,function(...e){t.detailsAction.onClick?.apply(this,e)}),g(e,n)};k(l,e=>{t.detailsAction&&e(f)});var p=L(l,2),m=e=>{var n=Wk();u(V(n),()=>t.actions),d(n),g(e,n)};k(p,e=>{t.actions&&e(m)}),d(a),F(()=>s(a,1,`tool-footer${W(i)?` has-actions`:``}`,`svelte-1xvwd06`)),g(e,a)};k(l,e=>{W(o)&&e(f)}),g(e,c),z()}T([`click`]);var qk=h(`<div class="question svelte-q82h90"><!></div>`),Jk=h(`<div class="meta svelte-q82h90"><span class="meta-label svelte-q82h90">context</span> <div class="meta-body svelte-q82h90"><!></div></div>`),Yk=h(`<div class="meta svelte-q82h90"><span class="meta-label svelte-q82h90">recommendation</span> <div class="meta-body svelte-q82h90"><!></div></div>`),Xk=h(`<button type="button" class="quick-reply rounded-full svelte-q82h90"> </button>`),Zk=h(`<div class="reply-voice-controls svelte-q82h90"><!> <!></div>`),Qk=h(`<!>Dismissing…`,1),$k=h(`<!>Dismiss`,1),eA=h(`<!>Sending…`,1),tA=h(`<!>Reply`,1),nA=h(`<!> <!>`,1),rA=h(`<p class="m-0 text-xs text-destructive" role="alert"> </p>`),iA=h(`<div class="quick-replies svelte-q82h90"></div> <form class="reply svelte-q82h90"><div class="reply-field svelte-q82h90" role="group" aria-label="Reply input"><!> <!></div> <!> <!></form>`,1),aA=h(`<div class="meta answer svelte-q82h90"><span class="meta-label svelte-q82h90">answer</span> <div class="meta-body svelte-q82h90"><!></div></div>`),oA=h(`<p class="meta svelte-q82h90"><span class="meta-label svelte-q82h90">dismissed</span> </p>`),sA=h(`<div class="ask select-text svelte-q82h90"><!> <!> <!> <!></div> <!>`,1);function cA(e,t){a(t,!0);let n=Rk(),o=n.voice,s=o?.TranscriptionActivity,c=o?.AudioAuthDialog,l=[`Yes, go ahead`,`I agree`,`Can you explain further?`,`No, hold on`],u=Y(``),f=Y(void 0),p=Y(void 0),m=Y(void 0),h=Y(!1),v=Y(0),y=Y(void 0),b,x,S,C=o?.micShortcutLabel,T=o?.micShortcutAria,E=J(()=>t.toolCall.status===`waiting_for_user`&&t.questionRecord?.status===`pending`),D=J(()=>t.questionRecord?.question??t.view.question),O=J(()=>t.questionRecord?.context??t.view.context),ee=J(()=>t.questionRecord?.recommendation??t.view.recommendation),te=n.askReply,ne=J(()=>te?.slashCompletions?.()??[]),j=J(()=>te?.fileCompletions),M=J(()=>te?.pasteImage),re=J(()=>te?.dropFiles),N=J(()=>t.questionRecord?.answer??t.view.answer??(W(m)?.kind===`answered`?W(m).answer:void 0)),P=J(()=>t.questionRecord?.status===`dismissed`||t.view.dismissed||W(m)?.kind===`dismissed`),ie=J(()=>t.questionRecord?.dismissedReason??t.view.dismissedReason),ae=J(()=>W(u).trim()),oe=J(()=>W(E)&&t.questionRecord?t.questionRecord.id:void 0),se=J(()=>o&&W(oe)?{kind:`ask-user`,id:W(oe)}:void 0),ce=J(()=>!!(o&&W(se)&&o.session.isTargetActive(W(se))&&o.session.recording)),le=J(()=>!!(o&&W(se)&&o.session.isTargetActive(W(se))&&o.session.transcribing)),I=J(()=>!!(o&&W(se)&&o.session.isBusyForOtherTarget(W(se)))),de=J(()=>!!o?.chatGptConfigured()),fe=J(()=>!!o?.session.isSupported()),pe=J(()=>!o||!W(se)||!!W(f)||o.session.pending||!W(ce)&&(!W(E)||W(I))),me=J(()=>o?W(ce)?`Stop recording${C?` (${C})`:``} — right-click to cancel (${ge(o.session.elapsedMs)} / ${ge(o.session.maxDurationMs)})`:W(I)?`Voice recording is active elsewhere`:o.session.retryAttempt>0&&W(se)&&o.session.isTargetActive(W(se))?`Retrying transcription ${o.session.retryAttempt}/${o.session.maxRetries}…`:W(le)?`Transcribing audio…`:W(de)?C?`Record voice reply (${C})`:`Record voice reply`:`Connect ChatGPT to use voice input`:``);function he(e){let t=x;S?.(),S=void 0,x=void 0,b=void 0,e&&t&&o?.session.cancelIfTarget(t)}be(()=>{if(!o)return;let e=W(se),t=e?o.targetKey(e):void 0;t!==b&&(he(!0),!(!e||!t)&&(x=e,b=t,S=o.session.registerTargetHandlers(e,{appendTranscript:e=>{K(u,o.appendTranscriptText(W(u),e),!0)},onError:e=>Yx.error(`Voice input failed`,{description:e})})))}),be(()=>{let e=W(E)&&t.questionRecord?t.questionRecord.id:void 0;!e||e===W(y)||(K(y,e,!0),W(E)&&t.questionRecord?.id===e&&K(v,W(v)+1))}),ke(()=>he(!0));function ge(e){let t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)}`}async function _e(e){if(!W(E)||!t.questionRecord||W(f)||!t.onAnswerUserQuestion)return;let n=t.questionRecord.id;K(f,`answer`),K(p,void 0);try{await t.onAnswerUserQuestion(n,e),K(m,{kind:`answered`,answer:e},!0)}catch(e){K(p,xe(e,`Could not send the reply.`),!0)}finally{K(f,void 0)}}function ve(){W(ae)&&_e(W(ae))}function ye(e){_e(e)}async function B(){if(!W(E)||!t.questionRecord||W(f)||!t.onDismissUserQuestion)return;let e=t.questionRecord.id;K(f,`dismiss`),K(p,void 0);try{await t.onDismissUserQuestion(e),K(m,{kind:`dismissed`},!0)}catch(e){K(p,xe(e,`Could not dismiss the question.`),!0)}finally{K(f,void 0)}}function xe(e,t){return e instanceof Error&&e.message.trim()?e.message:t}function Se(){if(!(!o||W(pe)||!W(se))){if(!W(ce)&&!W(de)){K(h,!0);return}o.session.toggle(W(se))}}function Ce(e){(e.key.toLowerCase()===`v`||e.code===`KeyV`)&&e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&(e.preventDefault(),Se())}function we(e){!o||!W(ce)||!W(se)||(e.preventDefault(),o.session.cancel(W(se)))}function H(e){return e.addEventListener(`keydown`,Ce),{destroy(){e.removeEventListener(`keydown`,Ce)}}}var Te=sA(),Ee=R(Te),De=V(Ee),Oe=e=>{var n=qk();Fk(V(n),{get text(){return W(D)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(n),g(e,n)};k(De,e=>{W(D)&&e(Oe)});var Ae=L(De,2),je=e=>{var n=Jk(),r=L(V(n),2);Fk(V(r),{get text(){return W(O)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(r),d(n),g(e,n)};k(Ae,e=>{W(O)&&e(je)});var q=L(Ae,2),Me=e=>{var n=Yk(),r=L(V(n),2);Fk(V(r),{get text(){return W(ee)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(r),d(n),g(e,n)};k(q,e=>{W(ee)&&e(Me)});var Ne=L(q,2),Pe=e=>{var n=iA(),a=R(n);_(a,20,()=>l,e=>e,(e,t)=>{var n=Xk(),i=V(n,!0);d(n),F(e=>{n.disabled=e,A(i,t)},[()=>!!W(f)]),r(`click`,n,()=>ye(t)),g(e,n)}),d(a);var c=L(a,2),m=V(c),h=V(m);{let e=J(()=>!!W(f));cg(h,{get value(){return W(u)},get disabled(){return W(e)},placeholder:`Reply to the agent's question`,ariaLabel:`Reply to agent question`,get focusToken(){return W(v)},get slashCompletions(){return W(ne)},get fileCompletions(){return W(j)},onChange:e=>{K(u,e,!0)},onSubmit:ve,get onPasteImage(){return W(M)},get onDropFiles(){return W(re)}})}var y=L(h,2),b=e=>{var t=Zk(),n=V(t);{let e=J(()=>W(se)&&o.session.isTargetActive(W(se))?o.session.retryAttempt:0);s(n,{get recording(){return W(ce)},get transcribing(){return W(le)},get elapsedMs(){return o.session.elapsedMs},get maxDurationMs(){return o.session.maxDurationMs},get retryAttempt(){return W(e)},get maxRetries(){return o.session.maxRetries},class:`ask-transcription-status`})}var r=L(n,2);{let e=J(()=>W(ce)?`destructive`:`ghost`),t=J(()=>`rounded-full ${W(ce)?`inset-ring-1 inset-ring-destructive/28`:``}`),n=J(()=>W(ce)?`Stop recording; right-click to cancel`:W(de)?`Record voice reply`:`Connect ChatGPT to use voice input`);G(r,{get variant(){return W(e)},size:`icon-sm`,get class(){return W(t)},type:`button`,get disabled(){return W(pe)},onclick:Se,oncontextmenu:we,get"aria-label"(){return W(n)},get"aria-keyshortcuts"(){return T},get title(){return W(me)},children:(e,t)=>{var n=U(),r=R(n),i=e=>{Fi(e,{class:`size-3.5`})},a=e=>{qx(e,{size:14,strokeWidth:2.4})};k(r,e=>{W(le)?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}d(t),g(e,t)};k(y,e=>{o&&W(fe)&&s&&e(b)}),d(m),i(m,e=>H?.(e));var x=L(m,2);Kk(x,{get detailsAction(){return t.detailsAction},actions:e=>{var t=nA(),n=R(t);{let e=J(()=>!!W(f));G(n,{size:`sm`,variant:`secondary`,type:`button`,get disabled(){return W(e)},onclick:()=>void B(),children:(e,t)=>{var n=U(),r=R(n),i=e=>{var t=Qk();Fi(R(t),{class:`size-3.5`}),w(),g(e,t)},a=e=>{var t=$k();yl(R(t),{size:14,strokeWidth:2.4}),w(),g(e,t)};k(r,e=>{W(f)===`dismiss`?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}var r=L(n,2);{let e=J(()=>!W(ae)||!!W(f));G(r,{size:`sm`,type:`submit`,get disabled(){return W(e)},children:(e,t)=>{var n=U(),r=R(n),i=e=>{var t=eA();Fi(R(t),{class:`size-3.5`}),w(),g(e,t)},a=e=>{var t=tA();ug(R(t),{size:14,strokeWidth:2.4}),w(),g(e,t)};k(r,e=>{W(f)===`answer`?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}g(e,t)},$$slots:{actions:!0}});var S=L(x,2),C=e=>{var t=rA(),n=V(t,!0);d(t),F(()=>A(n,W(p))),g(e,t)};k(S,e=>{W(p)&&e(C)}),d(c),ue(`submit`,c,e=>{e.preventDefault(),ve()}),g(e,n)},Fe=e=>{var n=aA(),r=L(V(n),2);Fk(V(r),{get text(){return W(N)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(r),d(n),g(e,n)},Ie=e=>{var t=oA(),n=L(V(t));d(t),F(()=>A(n,` ${W(ie)??`No answer provided`??``}`)),g(e,t)};k(Ne,e=>{W(E)&&t.questionRecord?e(Pe):W(N)?e(Fe,1):W(P)&&e(Ie,2)}),d(Ee);var Le=L(Ee,2),Re=e=>{c(e,{get open(){return W(h)},set open(e){K(h,e,!0)}})};k(Le,e=>{c&&e(Re)}),g(e,Te),z()}T([`click`]);var lA=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`],uA=/[\x40-\x7e]/,dA=/https?:\/\/[^\s<>"']+/giu,fA=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),pA={")":`(`,"]":`[`,"}":`{`};function mA(){return{bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1,hidden:!1,strike:!1,fgClass:void 0,bgClass:void 0,fgColor:void 0,bgColor:void 0}}function hA(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`)}function gA(e,t){if(t>=30&&t<=37)return`ansi-${e}-${lA[t-30]}`;if(t>=90&&t<=97)return`ansi-${e}-bright-${lA[t-90]}`;if(t>=40&&t<=47)return`ansi-${e}-${lA[t-40]}`;if(t>=100&&t<=107)return`ansi-${e}-bright-${lA[t-100]}`}function _A(e){return Number.isFinite(e)?Math.max(0,Math.min(255,Math.round(e))):0}function vA(e,t,n){return`rgb(${_A(e)} ${_A(t)} ${_A(n)})`}function yA(e){let t=_A(e);if(t<16){let e=[[0,0,0],[128,0,0],[0,128,0],[128,128,0],[0,0,128],[128,0,128],[0,128,128],[192,192,192],[128,128,128],[255,0,0],[0,255,0],[255,255,0],[0,0,255],[255,0,255],[0,255,255],[255,255,255]][t];return vA(e[0],e[1],e[2])}if(t>=232){let e=8+(t-232)*10;return vA(e,e,e)}let n=t-16,r=Math.floor(n/36),i=Math.floor(n%36/6),a=n%6,o=e=>e===0?0:55+e*40;return vA(o(r),o(i),o(a))}function bA(e){let t=e.slice(0,-1).replaceAll(`:`,`;`);return t.trim()===``?[0]:t.split(`;`).map(e=>{if(e===``)return 0;let t=Number(e);return Number.isFinite(t)?t:NaN})}function xA(e,t,n,r,i){let a=t===`fg`?`fgClass`:`bgClass`,o=t===`fg`?`fgColor`:`bgColor`;if(n===5){let t=r[i+1];return Number.isFinite(t)?(e[a]=void 0,e[o]=yA(t),i+1):i}if(n===2){let t=r[i+1],n=r[i+2],s=r[i+3];if(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(s))return e[a]=void 0,e[o]=vA(t,n,s),i+3}return i}function SA(e,t){let n={...e},r=bA(t);for(let e=0;e<r.length;e+=1){let t=r[e];Number.isFinite(t)&&(t===0?Object.assign(n,mA()):t===1?(n.bold=!0,n.dim=!1):t===2?(n.dim=!0,n.bold=!1):t===3?n.italic=!0:t===4?n.underline=!0:t===7?n.inverse=!0:t===8?n.hidden=!0:t===9?n.strike=!0:t===21||t===22?(n.bold=!1,n.dim=!1):t===23?n.italic=!1:t===24?n.underline=!1:t===27?n.inverse=!1:t===28?n.hidden=!1:t===29?n.strike=!1:t===39?(n.fgClass=void 0,n.fgColor=void 0):t===49?(n.bgClass=void 0,n.bgColor=void 0):t>=30&&t<=37||t>=90&&t<=97?(n.fgClass=gA(`fg`,t),n.fgColor=void 0):t>=40&&t<=47||t>=100&&t<=107?(n.bgClass=gA(`bg`,t),n.bgColor=void 0):t===38?e=xA(n,`fg`,r[e+1],r,e+1):t===48&&(e=xA(n,`bg`,r[e+1],r,e+1)))}return n}function CA(e){return[e.bold?`ansi-bold`:void 0,e.dim?`ansi-dim`:void 0,e.italic?`ansi-italic`:void 0,e.underline?`ansi-underline`:void 0,e.inverse?`ansi-inverse`:void 0,e.hidden?`ansi-hidden`:void 0,e.strike?`ansi-strike`:void 0,e.fgClass,e.bgClass].filter(e=>!!e)}function wA(e){let t=[e.fgColor?`color: ${e.fgColor}`:void 0,e.bgColor?`background-color: ${e.bgColor}`:void 0].filter(Boolean);return t.length>0?t.join(`; `):void 0}function TA(e,t){let n=0;for(let r of e)r===t&&(n+=1);return n}function EA(e){let t=e.length;for(;t>0;){let n=e[t-1];if(fA.has(n)){--t;continue}let r=pA[n],i=e.slice(0,t);if(r&&TA(i,n)>TA(i,r)){--t;continue}break}return{url:e.slice(0,t),trailing:e.slice(t)}}function DA(e){try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function OA(e){let t=[];dA.lastIndex=0;for(let n of e.matchAll(dA)){let e=n[0],{url:r}=EA(e);r&&DA(r)&&t.push({start:n.index,end:n.index+r.length,url:r})}return t}function kA(e,t,n){let r=t+e.text.length,i=[],a=0;for(let o of n){if(o.end<=t)continue;if(o.start>=r)break;let n=Math.max(o.start,t)-t,s=Math.min(o.end,r)-t;n>a&&i.push({text:e.text.slice(a,n),state:e.state}),i.push({text:e.text.slice(n,s),state:e.state,url:o.url}),a=s}return a<e.text.length&&i.push({text:e.text.slice(a),state:e.state}),i}function AA(e){let t=hA(e.text),n=CA(e.state),r=wA(e.state);return n.length===0&&r===void 0?t:`<span${n.length>0?` class="${n.join(` `)}"`:``}${r?` style="${r}"`:``}>${t}</span>`}function jA(e){let t=``,n;for(let r of e){if(r.url!==n){if(n&&(t+=`</a>`),r.url){let e=hA(r.url);t+=`<a href="${e}" target="_blank" rel="noopener noreferrer">`}n=r.url}t+=AA(r)}return n&&(t+=`</a>`),t}function MA(e,t){for(let n=t;n<e.length;n+=1)if(uA.test(e[n]))return n;return-1}function NA(e,t){let n=e.indexOf(`\x07`,t),r=e.indexOf(`\x1B\\`,t);return n===-1?r===-1?-1:r+1:r===-1?n:Math.min(n,r+1)}function PA(e){let t=[],n=mA(),r=0,i=0,a=i=>{let a=e.slice(r,i);a&&t.push({text:a,state:n})};for(;i<e.length;){if(e.charCodeAt(i)!==27){i+=1;continue}a(i);let t=e[i+1];if(t===`[`){let t=MA(e,i+2);if(t===-1){r=e.length;break}let a=e.slice(i+2,t+1);a.endsWith(`m`)&&(n=SA(n,a)),i=t+1,r=i;continue}if(t===`]`){let t=NA(e,i+2);if(t===-1){r=e.length;break}i=t+1,r=i;continue}i=Math.min(i+2,e.length),r=i}return a(e.length),t}function FA(e,t={}){let n=PA(e),r=n.map(e=>e.text).join(``),i=t.linkifyUrls?OA(r):[],a=0,o=[];for(let e of n)o.push(...kA(e,a,i)),a+=e.text.length;return jA(o)}function IA(e,t=0){if(!e)return t;let n=e.trim();if(!n.endsWith(`px`))return t;let r=Number.parseFloat(n.slice(0,-2));return Number.isFinite(r)?r:t}function LA(e,t,n=16){let r=IA(e);if(r>0)return r;let i=IA(t,n);return i>0?i*1.4:n*1.4}function RA(e){let t=e.borderBoxWidth-e.paddingLeft-e.paddingRight-e.borderLeftWidth-e.borderRightWidth;return Math.max(0,t)}function zA(e,t){return!Number.isFinite(t)||t<=0?!1:e===void 0||Math.abs(e-t)>.5}function BA(e,t){return e<=0||t<=0?0:Math.max(1,Math.round(e/t))}function VA(e){let t=Math.max(1,Math.floor(e.fixedRows)),n=Math.max(1,Math.ceil(e.fallbackRows)),r=e.measuredRows!==void 0&&e.measuredRows>0?Math.ceil(e.measuredRows):n,i=Math.min(Math.max(1,r),t);return Math.max(e.previousRows,i)}var HA=h(`<div class="code-block terminal-output svelte-ytenc0" data-terminal="true"><div class="code-block__viewport svelte-ytenc0"><div class="code-block__content svelte-ytenc0"></div></div></div>`),UA=h(`<span class="diff-line svelte-ytenc0"> </span>`),WA=h(`<div class="code-block svelte-ytenc0" data-language="diff"><div class="code-block__viewport svelte-ytenc0"><pre class="code-block__content code-block__content--diff svelte-ytenc0"></pre></div></div>`),GA=h(`<div class="code-block svelte-ytenc0"><div class="code-block__viewport svelte-ytenc0"><div class="code-block__content svelte-ytenc0"></div></div></div>`),KA=h(`<div class="code-block svelte-ytenc0"><div class="code-block__viewport svelte-ytenc0"><pre class="code-block__content svelte-ytenc0"> </pre></div></div>`);function qA(e,t){a(t,!0);let n=I(t,`maxHeight`,3,`18rem`),r=I(t,`trim`,3,!0),i=I(t,`highlight`,3,!0),o=I(t,`wrap`,3,!0),s=I(t,`overflow`,3,`auto`),c=I(t,`terminal`,3,!1),u=I(t,`tail`,3,!1),f=Y(void 0),m=Y(void 0),h=Y(void 0),v=Y(void 0),y=Y(void 0),b=Y(void 0),x=Y(void 0),S=J(()=>r()?ii(t.code):{text:t.code}),C=J(()=>`${t.language??``}\0${W(S).text}`),w=J(()=>t.fixedRows!==void 0&&t.fixedRows>0),T=J(()=>FA(W(S).text)),E=J(()=>!c()&&(t.language??``).toLowerCase().trim()===`diff`),D=J(()=>W(E)?ne(W(S).text):[]),O=J(()=>{if(!W(w))return 1;let e=W(S).text,n=e.length===0?1:e.split(`
78
+ `).length;return Math.min(Math.max(n,1),t.fixedRows)}),ee=Y(0);function te(e){return e.startsWith(`@@`)?`hunk`:e.startsWith(`+++`)||e.startsWith(`---`)||e.startsWith(`diff `)?`file`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`delete`:`context`}function ne(e){return e.replace(/\r\n/g,`
79
+ `).replace(/\r/g,`
80
+ `).split(`
81
+ `).map(e=>({text:e,tone:te(e)}))}function j(e){!W(w)||t.fixedRows===void 0||K(ee,VA({previousRows:W(ee),measuredRows:e,fallbackRows:W(O),fixedRows:t.fixedRows}),!0)}function M(){W(x)!==void 0&&(cancelAnimationFrame(W(x)),K(x,void 0))}function re(){if(K(x,void 0),!W(w)||!W(v)||!W(y)||!W(b))return;let e=W(y).clientWidth;if(e<=0){let t=W(v).getBoundingClientRect(),n=getComputedStyle(W(v));e=RA({borderBoxWidth:t.width,paddingLeft:IA(n.paddingLeft),paddingRight:IA(n.paddingRight),borderLeftWidth:IA(n.borderLeftWidth),borderRightWidth:IA(n.borderRightWidth)})}if(e<=0)return;let t=getComputedStyle(W(b)),n=LA(t.lineHeight,t.fontSize);j(BA(W(b).scrollHeight,n))}function N(){if(W(w)&&W(x)===void 0){if(typeof requestAnimationFrame>`u`){re();return}K(x,requestAnimationFrame(re),!0)}}be(()=>{if(!W(w)){K(ee,0),M();return}j()}),be(()=>{let e=`${W(S).text}\0${W(f)??``}\0${W(T)}\0${t.fixedRows??``}`;!W(w)||e===void 0||N()}),be(()=>{if(!W(w)||!W(v)||!W(y)||!W(b)||typeof ResizeObserver>`u`)return;let e,t=new ResizeObserver(t=>{let n=t.at(-1);if(!n)return;let r=n.contentBoxSize[0]?.inlineSize??n.contentRect.width;zA(e,r)&&(e=r,N())});return t.observe(W(y)),N(),()=>t.disconnect()}),be(()=>()=>M());let P=J(()=>W(w)?String(t.fixedRows):void 0),ie=J(()=>W(w)?String(Math.max(W(ee),1)):void 0);be(()=>{if(c()||!i()||W(E)){K(f,void 0),K(m,void 0),K(h,void 0);return}let e=W(C);if(W(m)===e||W(h)===e)return;let n=rS(W(S).text,t.language);if(typeof n==`string`){K(f,n,!0),K(m,e,!0),K(h,void 0);return}if(!n){K(h,e,!0);return}let r=!1;return n.then(t=>{r||W(C)!==e||(t?(K(f,t,!0),K(m,e,!0),K(h,void 0)):K(h,e,!0))}),()=>{r=!0}});var ae=U(),oe=R(ae),se=e=>{var t=HA();let r;var i=V(t);let a;var c=V(i);p(c,()=>W(T),!0),d(c),fe(c,e=>K(b,e),()=>W(b)),d(i),fe(i,e=>K(y,e),()=>W(y)),d(t),fe(t,e=>K(v,e),()=>W(v)),F(()=>{q(t,`data-wrap`,o()?`true`:`false`),q(t,`data-overflow`,s()),q(t,`data-fixed-rows`,W(w)?`true`:void 0),q(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(P),"--code-block-visible-rows":W(ie)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()})}),g(e,t)},ce=e=>{var t=WA();let r;var i=V(t);let a;var c=V(i);_(c,23,()=>W(D),(e,t)=>`${t}:${e.text}`,(e,t)=>{var n=UA(),r=V(n,!0);d(n),F(()=>{q(n,`data-tone`,W(t).tone),A(r,W(t).text)}),g(e,n)}),d(c),fe(c,e=>K(b,e),()=>W(b)),d(i),fe(i,e=>K(y,e),()=>W(y)),d(t),fe(t,e=>K(v,e),()=>W(v)),F(()=>{q(t,`data-wrap`,o()?`true`:`false`),q(t,`data-overflow`,s()),q(t,`data-fixed-rows`,W(w)?`true`:void 0),q(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(P),"--code-block-visible-rows":W(ie)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()})}),g(e,t)},le=e=>{var t=GA();let r;var i=V(t);let a;var c=V(i);p(c,()=>W(f),!0),d(c),fe(c,e=>K(b,e),()=>W(b)),d(i),fe(i,e=>K(y,e),()=>W(y)),d(t),fe(t,e=>K(v,e),()=>W(v)),F(()=>{q(t,`data-wrap`,o()?`true`:`false`),q(t,`data-overflow`,s()),q(t,`data-fixed-rows`,W(w)?`true`:void 0),q(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(P),"--code-block-visible-rows":W(ie)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()})}),g(e,t)},ue=e=>{var t=KA();let r;var i=V(t);let a;var c=V(i),f=V(c,!0);d(c),fe(c,e=>K(b,e),()=>W(b)),d(i),fe(i,e=>K(y,e),()=>W(y)),d(t),fe(t,e=>K(v,e),()=>W(v)),F(()=>{q(t,`data-wrap`,o()?`true`:`false`),q(t,`data-overflow`,s()),q(t,`data-fixed-rows`,W(w)?`true`:void 0),q(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(P),"--code-block-visible-rows":W(ie)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()}),A(f,W(S).text)}),g(e,t)};k(oe,e=>{c()?e(se):W(E)?e(ce,1):i()&&W(f)&&W(m)===W(C)?e(le,2):e(ue,-1)}),g(e,ae),z()}var JA=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),YA=h(`<!> <!>`,1);function XA(e,t){a(t,!0);let n=I(t,`direction`,3,`head`),r=I(t,`collapsedLines`,3,6),i=I(t,`expanded`,3,!1),o=I(t,`terminal`,3,!1),s=J(()=>{if(i())return t.text;if(n()===`tail`)return Tt(t.text,r());let e=Jt(t.text);return e.length<=r()?t.text:e.slice(0,r()).join(`
82
+ `)});var c=YA(),l=R(c),u=e=>{var n=JA(),r=V(n);d(n),F(()=>A(r,`Showing latest
83
+ ${t.outputLimits.live.displayedLines??0??``} lines / ${t.outputLimits.live.displayedChars??0??``} chars;
84
+ ${t.outputLimits.live.omittedChars??0??``} earlier chars omitted from live preview.`)),g(e,n)};k(l,e=>{t.outputLimits?.live?.capped&&e(u)});var f=L(l,2);{let e=J(()=>i()?void 0:r()),a=J(()=>!i()&&n()===`tail`);qA(f,{get code(){return W(s)},get language(){return t.language},trim:!1,get terminal(){return o()},get fixedRows(){return W(e)},get tail(){return W(a)}})}g(e,c),z()}var ZA=h(`<section class="grid gap-1" aria-label="Bash command"><!></section>`),QA=h(`<section class="grid gap-1" aria-label="Command output"><!></section>`),$A=h(`<p class="m-0 text-xs text-muted-foreground">No output.</p>`),ej=h(`<div class="grid gap-1.5"><!> <!></div>`);function tj(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>!!t.view.command?.match(/[\r\n]/));var i=ej(),o=V(i),s=e=>{var r=ZA();XA(V(r),{get text(){return t.view.command},language:`bash`,get expanded(){return n()}}),d(r),g(e,r)};k(o,e=>{n()&&t.view.command&&W(r)&&e(s)});var c=L(o,2),l=e=>{var r=QA();XA(V(r),{get text(){return t.view.output},direction:`tail`,get expanded(){return n()},terminal:!0}),d(r),g(e,r)},u=e=>{g(e,$A())};k(c,e=>{t.view.output.length>0?e(l):t.toolCall.status===`completed`&&e(u,1)}),d(i),g(e,i),z()}var nj=new Set([`$$slots`,`$$events`,`$$legacy`]);function rj(e,t){let n=H(t,nj),r=[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`}],[`path`,{d:`M6.453 15h11.094`}],[`path`,{d:`M8.5 2h7`}]];P(e,B({name:`flask-conical`},()=>n,{get iconNode(){return r}}))}var ij=5,aj=20,oj=4,sj=12,cj=600,lj=2e3;function uj(e){return e.expanded?{itemLimit:aj,excerptLines:sj,excerptChars:lj}:{itemLimit:ij,excerptLines:oj,excerptChars:cj}}function dj(e,t,n,r){return n===`pending_approval`?`Review ${e} ${t}`:n===`requested`||n===`running`?`Executing ${e} ${t}`:n===`completed`?`${r?`Dry run`:`Completed`} ${e} ${t}`:n===`denied`?`Denied ${e} ${t}`:n===`error`?`Failed ${e} ${t}`:`${e} ${t}`}function fj(e){let t=e;return{args:Xj(t.args??t.argsPreview),status:e.status}}function pj(e){let t=e;return Xj(Xj(t.result??t.resultPreview).details)}function mj(e,t,n){if(n?.resolvedAssignee){$(e,`Resolved assignee`,Ij(n.resolvedAssignee));return}let r=Kj(t,`assignee_account_id`),i=Kj(t,`assignee_query`);r?$(e,`Assignee`,`account ${r}`):i&&$(e,`Assignee`,`query "${i}"`)}function hj(e,t){t.resolvedAssignee&&$(e,`Resolved assignee`,Ij(t.resolvedAssignee))}function gj(e,t,n,r){(r??Jj(t,`dry_run`))===!0?$(e,`Mode`,`dry run / no mutation`):t.status!==`completed`&&$(e,`Mode`,`will ${n}`)}function _j(e,t){Jj(t,`save_to_file`)===!1&&$(e,`Raw JSON`,`not saved`)}function vj(e,t,n){for(let[r,i]of n)$(e,r,Yj(t,i))}function yj(e,t,n){let r=Kj(t,`page_file`),i=Kj(t,`body_file`),a=Kj(t,`body`);r&&$(e,`Page file`,r),i&&$(e,`Body file`,i),a&&Aj(e,`Body`,a,n)}function bj(e,t){t&&($(e,`Storage`,t.storagePath),$(e,`Markdown`,t.markdownPath),$(e,`Attachments dir`,t.attachmentDir))}function xj(e,t,n){return Kj(e,t)??eM(e.args[n])}function Sj(e,t){return Object.entries(t).flatMap(([t,n])=>Jj(e,t)===!0?[n]:[])}function Cj(e,t,n,r){if(!t)return;let i=Object.entries(n).flatMap(([e,n])=>{let r=t[e];return typeof r==`number`&&Number.isFinite(r)?[`${r.toLocaleString()} ${n}`]:[]});i.length>0&&$(e,r,i.join(`, `))}function wj(e,t,n){let r=t.outputArtifacts??[];for(let t of r.slice(0,n.itemLimit))$(e,t.label??t.kind,t.path);r.length>n.itemLimit&&e.push(`… ${r.length-n.itemLimit} more artifacts`)}function Tj(e,t,n){let r=`previewOverflow`in t?t.previewOverflow:void 0;!n.expanded&&r?.hidden&&e.push(`… open Details for ${r.hidden} more ${r.noun}`)}function Ej(e,t,n){let r=Xj(t);if(Object.keys(r).length===0)return;Dj(e,`Payload fields`,Xj(r.fields),n),Dj(e,`Payload update ops`,Xj(r.update),n);let i=Object.keys(r).filter(e=>e!==`fields`&&e!==`update`);i.length>0&&$(e,`Payload keys`,Mj(i,n.itemLimit))}function Dj(e,t,n,r){let i=Object.keys(Xj(n));i.length>0&&$(e,t,Mj(i,r.itemLimit))}function Oj(e,t,n,r){let i=n.filter(e=>!!e?.trim());if(i.length!==0){e.push(`${t}:`);for(let t of i.slice(0,r.itemLimit))e.push(`- ${t}`);i.length>r.itemLimit&&e.push(`… ${i.length-r.itemLimit} more`)}}function kj(e,t,n,r){!n||n.length===0||$(e,t,Mj(n,r.itemLimit))}function $(e,t,n){n==null||n===``||e.push(`${t}: ${String(n)}`)}function Aj(e,t,n,r){let i=jj(n,r);if(i){if(!i.text.includes(`
85
+ `)){$(e,t,i.omitted?`${i.text}…`:i.text);return}e.push(`${t}:`);for(let t of i.text.split(`
86
+ `))e.push(` ${t}`);i.omitted&&e.push(` …`)}}function jj(e,t){let n=$j(e).trim();if(!n)return;let r=n.split(`
87
+ `).map(e=>e.trimEnd()).filter((e,t,n)=>e.trim().length>0||t>0&&t<n.length-1),i=r.slice(0,t.excerptLines).join(`
88
+ `),a=r.length>t.excerptLines;return i.length>t.excerptChars&&(i=`${i.slice(0,t.excerptChars-1).trimEnd()}…`,a=!0),{text:i,omitted:a}}function Mj(e,t){let n=e.filter(e=>e.trim().length>0),r=n.slice(0,t).join(`, `),i=n.length-t;return i>0?`${r} (+${i} more)`:r}function Nj(e){let t=[e.key,e.issueType,e.status,e.assignee?`assignee ${e.assignee}`:void 0].filter(Boolean).join(` · `);return e.summary?`${t} — ${e.summary}`:t}function Pj(e){return[e.key,e.name,e.projectTypeKey,e.lead?`lead ${e.lead}`:void 0].filter(Boolean).join(` · `)}function Fj(e){return[e.id,e.name,e.to?`→ ${e.to}`:void 0].filter(Boolean).join(` · `)}function Ij(e){let t=e.displayName??e.emailAddress??e.accountId,n=e.displayName&&e.emailAddress?` <${e.emailAddress}>`:``,r=e.active===!1?`inactive`:void 0;return[`${t}${n}`,e.accountId,e.accountType,r].filter(Boolean).join(` · `)}function Lj(e){return[e.id,e.name,e.required?`required`:void 0,e.type].filter(Boolean).join(` · `)}function Rj(e){return[e.key,e.name,e.id,e.status].filter(Boolean).join(` · `)}function zj(e){return[e.id,e.title,e.spaceKey?`space ${e.spaceKey}`:void 0,e.status,e.versionNumber===void 0?void 0:`v${e.versionNumber}`].filter(Boolean).join(` · `)}function Bj(e){return[e.filename??e.title??e.id??e.fileId,e.mediaType,e.fileSize===void 0?void 0:Uj(e.fileSize),e.versionNumber===void 0?void 0:`v${e.versionNumber}`].filter(Boolean).join(` · `)}function Vj(e){return[e.index===void 0?void 0:`#${e.index}`,e.operation,e.id,e.title?`"${e.title}"`:void 0,e.status,e.message].filter(Boolean).join(` · `)}function Hj(e){if(e.length===0)return;let t=new Map;for(let n of e){let e=n.status??`unknown`;t.set(e,(t.get(e)??0)+1)}return[...t.entries()].map(([e,t])=>`${t} ${e}`).join(`, `)}function Uj(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Wj(e,t){if(e!==void 0)return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function Gj(e){if(e!==void 0)return e?`yes`:`no`}function Kj(e,t){return Zj(e.args[t])??nM(e.argsText,t,{maxChars:1e3})[0]}function qj(e,t){let n=e.args[t];return Array.isArray(n)?n.flatMap(e=>typeof e==`string`?[e]:[]):void 0}function Jj(e,t){let n=e.args[t];return typeof n==`boolean`?n:void 0}function Yj(e,t){let n=e.args[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Xj(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Zj(e){return typeof e==`string`&&e.trim().length>0?e:void 0}function Qj(e){let t=[];for(let n of e){let e=n.trimEnd();e.length!==0&&t.at(-1)!==e&&t.push(e)}return t}function $j(e){return e?.replace(/\r\n/g,`
89
+ `).replace(/\r/g,`
90
+ `)??``}function eM(e){let t=[],n=e=>{if(Array.isArray(e)){for(let t of e)n(t);return}let r=Xj(e);if(Object.keys(r).length===0)return;let i=Zj(r.type);if(i===`text`){let e=Zj(r.text);e&&t.push(e);return}if(i===`hardBreak`){t.push(`
91
+ `);return}let a=i&&[`paragraph`,`heading`,`blockquote`,`codeBlock`,`bulletList`,`orderedList`,`listItem`].includes(i);a&&t.length>0&&!t.at(-1)?.endsWith(`
92
+ `)&&t.push(`
93
+ `),n(r.content),a&&t.length>0&&!t.at(-1)?.endsWith(`
94
+ `)&&t.push(`
95
+ `)};n(e);let r=t.join(``).replace(/[ \t]+\n/g,`
96
+ `).replace(/\n{3,}/g,`
97
+
98
+ `).trim();return r.length>0?r:void 0}function tM(e){return RegExp(`"${iM(e)}"\\s*:\\s*"`,`g`)}function nM(e,t,n={}){if(!e)return[];let r=[],i=tM(t),a=i.exec(e);for(;a;){let t=n.maxChars??1/0,o=``,s=a.index+a[0].length;for(;s<e.length;){let n=e[s];if(n===`\\`){if(s+1>=e.length)break;let n=e[s+1];o.length<t&&(o+=rM(n)),s+=2;continue}if(n===`"`)break;o.length<t&&(o+=n),s+=1}r.push(o),a=i.exec(e)}return r}function rM(e){return e===`n`?`
99
+ `:e===`r`?`\r`:e===`t`?` `:e}function iM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var aM={search_spaces:`search spaces`,search_pages:`search pages`,get_page:`get page`,download_pages:`download pages`,create_page:`create page`,update_page:`update page`,publish_pages:`publish pages`,upload_attachment:`upload attachment`},oM={pages:`pages`,spaces:`spaces`,labels:`labels`,properties:`properties`,operations:`operations`,versions:`versions`,directChildren:`direct children`,attachments:`attachments`,downloadedAttachments:`downloaded attachments`};function sM(e,t,n={}){let r=uj(n),i=fj(e),a=pj(e),o=[dj(`Confluence`,aM[t.action],e.status,t.dryRun)];return cM(o,t.action,i,t,r),lM(o,t,a,r),wj(o,t,r),Tj(o,e,n),Qj(o).join(`
100
+ `)}function cM(e,t,n,r,i){switch(t){case`search_spaces`:$(e,`Query`,r?.query??Kj(n,`query`)),kj(e,`Keys`,qj(n,`keys`),i),kj(e,`Ids`,qj(n,`ids`),i),$(e,`Limit`,Yj(n,`limit`)),$(e,`Cursor`,Kj(n,`cursor`)),_j(e,n);break;case`search_pages`:Aj(e,`CQL`,r?.cql??Kj(n,`cql`),i),$(e,`Query`,r?.query??Kj(n,`query`)),$(e,`Space`,r?.spaceKey??Kj(n,`space_key`)??r?.spaceId??Kj(n,`space_id`)),$(e,`Title`,r?.title??Kj(n,`title`)),$(e,`Status`,r?.status??Kj(n,`status`)),$(e,`Body format`,r?.bodyFormat??Kj(n,`body_format`)),$(e,`Limit`,Yj(n,`limit`)),$(e,`Cursor`,Kj(n,`cursor`)),_j(e,n);break;case`get_page`:$(e,`Page`,r?.pageId??Kj(n,`page_id`)),$(e,`Body format`,r?.bodyFormat??Kj(n,`body_format`)),kj(e,`Includes`,Sj(n,{include_labels:`labels`,include_properties:`properties`,include_operations:`operations`,include_versions:`versions`,include_version:`version metadata`,include_direct_children:`direct children`,include_attachments:`attachments`,markdown:`markdown sidecar`}),i),_j(e,n);break;case`download_pages`:$(e,`Root page`,r?.pageId??Kj(n,`page_id`)),$(e,`Space`,r?.spaceKey??Kj(n,`space_key`)??r?.spaceId??Kj(n,`space_id`)),Aj(e,`CQL`,r?.cql??Kj(n,`cql`),i),$(e,`Recurse`,Gj(Jj(n,`recurse`))),$(e,`Depth`,Yj(n,`depth`)),$(e,`Limit`,Yj(n,`limit`)),$(e,`Body format`,r?.bodyFormat??Kj(n,`body_format`)),kj(e,`Outputs`,Sj(n,{markdown:`markdown sidecars`,include_attachments:`attachment metadata`,download_attachments:`download attachments`}),i),_j(e,n);break;case`create_page`:$(e,`Space`,r?.spaceKey??Kj(n,`space_key`)??r?.spaceId??Kj(n,`space_id`)??`default space`),$(e,`Title`,r?.title??Kj(n,`title`)),$(e,`Parent`,Kj(n,`parent_id`)),$(e,`Status`,r?.status??Kj(n,`status`)),yj(e,n,i),$(e,`Representation`,Kj(n,`body_representation`)),gj(e,n,`create page`,r?.dryRun),$(e,`Return page`,Gj(Jj(n,`return_page`))),_j(e,n);break;case`update_page`:$(e,`Page`,r?.pageId??Kj(n,`page_id`)??Kj(n,`page_file`)),$(e,`Title`,r?.title??Kj(n,`title`)),$(e,`Parent`,Kj(n,`parent_id`)),$(e,`Status`,r?.status??Kj(n,`status`)),yj(e,n,i),$(e,`Representation`,Kj(n,`body_representation`)),Aj(e,`Version message`,Kj(n,`version_message`),i),$(e,`Allow stale`,Gj(Jj(n,`allow_stale`))),gj(e,n,`update page`,r?.dryRun),$(e,`Return page`,Gj(Jj(n,`return_page`))),_j(e,n);break;case`publish_pages`:$(e,`Input`,r?.inputPath??Kj(n,`input_path`)),$(e,`Create missing`,Gj(Jj(n,`create_missing`))),$(e,`Allow stale`,Gj(Jj(n,`allow_stale`))),Aj(e,`Version message`,Kj(n,`version_message`),i),$(e,`Limit`,Yj(n,`limit`)),gj(e,n,`publish pages`,r?.dryRun),_j(e,n);break;case`upload_attachment`:$(e,`Page`,r?.pageId??Kj(n,`page_id`)),$(e,`File`,Kj(n,`file_path`)),$(e,`Filename`,r?.attachment?.filename??Kj(n,`filename`)),Aj(e,`Comment`,Kj(n,`comment`),i),$(e,`Minor edit`,Gj(Jj(n,`minor_edit`))),$(e,`Update existing`,Gj(Jj(n,`update_existing`))),$(e,`Status`,r?.status??Kj(n,`status`)),_j(e,n);break}}function lM(e,t,n,r){if(uM(t))switch(t.action){case`search_spaces`:$(e,`Returned`,Wj(t.spaceCount??t.spaces.length,`space`)),$(e,`Next cursor`,t.nextCursor??Zj(n.nextCursor)),Oj(e,`Spaces`,t.spaces.map(Rj),r);break;case`search_pages`:$(e,`Returned`,Wj(t.pageCount??t.pages.length,`page`)),$(e,`Next cursor`,t.nextCursor??Zj(n.nextCursor)),Oj(e,`Pages`,t.pages.map(zj),r);break;case`get_page`:t.page&&$(e,`Fetched`,zj(t.page)),Cj(e,t.includedCounts,oM,`Included`),bj(e,t.page),Oj(e,`Attachments`,t.attachments.map(Bj),r);break;case`download_pages`:$(e,`Bundle`,t.downloadDir),$(e,`Manifest`,t.manifestPath),$(e,`Pages JSONL`,t.pagesJsonlPath),$(e,`Downloaded`,Wj(t.pageCount??t.pages.length,`page`)),Cj(e,t.includedCounts,oM,`Included`),Oj(e,`Pages`,t.pages.map(zj),r);break;case`create_page`:$(e,t.dryRun?`Would create`:`Created`,t.pageId),t.page&&$(e,`Page`,zj(t.page)),Ej(e,t.payload??n.payload,r);break;case`update_page`:$(e,t.dryRun?`Would update`:`Updated`,t.pageId),t.page&&$(e,`Page`,zj(t.page)),Ej(e,t.payload??n.payload,r);break;case`publish_pages`:$(e,`Processed`,Wj(t.outcomeCount??t.outcomes.length,`outcome`)),$(e,`Outcome statuses`,Hj(t.outcomes)),Oj(e,`Outcomes`,t.outcomes.map(Vj),r);break;case`upload_attachment`:{$(e,`Page`,t.pageId);let n=t.attachment??t.attachments[0];n&&$(e,`Attachment`,Bj(n)),n?.snippet&&Aj(e,`Storage snippet`,n.snippet,r);break}}}function uM(e){return!!(e.messageLines.length>0||e.pages.length>0||e.page||e.spaces.length>0||e.space||e.attachments.length>0||e.attachment||e.outcomes.length>0||e.downloadDir||e.dryRun)}var dM={search_users:`search users`,search_issues:`search issues`,get_issue:`get issue`,get_project:`get project`,create_issue:`create issue`,update_issue:`update issue`,add_comment:`add comment`,transition_issue:`transition issue`},fM={comments:`comments`,transitions:`transitions`,statuses:`statuses`,components:`components`,versions:`versions`,issueTypes:`issue types`,fields:`fields`,priorities:`priorities`,resolutions:`resolutions`,worklogs:`worklogs`,changelog:`changelog entries`,remoteLinks:`remote links`,attachments:`attachments`,editmetaFields:`edit fields`};function pM(e,t,n={}){let r=uj(n),i=fj(e),a=pj(e),o=[dj(`Jira`,dM[t.action],e.status,t.dryRun)];return mM(o,t.action,i,t,r),hM(o,t,a,r),wj(o,t,r),Tj(o,e,n),Qj(o).join(`
101
+ `)}function mM(e,t,n,r,i){switch(t){case`search_users`:$(e,`Query`,r?.query??Kj(n,`query`)),$(e,`Project`,r?.projectKey??Kj(n,`project_key`)),$(e,`Issue`,r?.issueKey??Kj(n,`issue_key`)),$(e,`Limit`,Yj(n,`max_results`)),$(e,`Include inactive`,Gj(Jj(n,`include_inactive`))),_j(e,n);break;case`search_issues`:Aj(e,`JQL`,r?.jql??Kj(n,`jql`),i),kj(e,`Fields`,qj(n,`fields`),i),kj(e,`Expand`,qj(n,`expand`),i),$(e,`Limit`,Yj(n,`max_results`)),$(e,`Next page token`,Kj(n,`next_page_token`)),$(e,`Validate query`,Gj(Jj(n,`validate_query`))),_j(e,n);break;case`get_issue`:$(e,`Issue`,r?.issueKey??Kj(n,`issue_key`)),kj(e,`Fields`,qj(n,`fields`),i),kj(e,`Expand`,qj(n,`expand`),i),kj(e,`Includes`,Sj(n,{include_comments:`comments`,include_transitions:`transitions`,include_editmeta:`edit metadata`,include_worklogs:`worklogs`,include_changelog:`changelog`,include_remote_links:`remote links`,include_attachments:`attachments`}),i),vj(e,n,[[`Comment limit`,`comment_limit`],[`Comment start`,`comment_start_at`],[`Worklog limit`,`worklog_limit`],[`Changelog limit`,`changelog_limit`]]),_j(e,n);break;case`get_project`:$(e,`Project`,r?.projectKey??Kj(n,`project_key`)??`default project`),kj(e,`Includes`,Sj(n,{include_statuses:`statuses`,include_components:`components`,include_versions:`versions`,include_issue_types:`issue types`,include_create_meta:`create metadata`,include_fields:`fields`,include_priorities:`priorities`,include_resolutions:`resolutions`}),i),$(e,`Issue type id`,Kj(n,`issue_type_id`)),$(e,`Issue type`,Kj(n,`issue_type_name`)),$(e,`Field query`,Kj(n,`field_query`)),$(e,`Field limit`,Yj(n,`field_limit`)),_j(e,n);break;case`create_issue`:$(e,`Project`,r?.projectKey??Kj(n,`project_key`)??`default project`),$(e,`Type`,r?.issueType??Kj(n,`issue_type`)),Aj(e,`Summary`,r?.summary??Kj(n,`summary`),i),$(e,`Parent`,Kj(n,`parent_key`)),Aj(e,`Description`,xj(n,`description`,`description_adf`),i),kj(e,`Labels`,qj(n,`labels`),i),kj(e,`Components`,qj(n,`components`),i),$(e,`Priority`,Kj(n,`priority`)),mj(e,n,r),Dj(e,`Custom fields`,n.args.fields,i),gj(e,n,`create issue`,r?.dryRun),$(e,`Return issue`,Gj(Jj(n,`return_issue`)));break;case`update_issue`:$(e,`Issue`,r?.issueKey??Kj(n,`issue_key`)),Aj(e,`New summary`,Kj(n,`summary`),i),Aj(e,`Description`,xj(n,`description`,`description_adf`),i),kj(e,`Labels`,qj(n,`labels`),i),$(e,`Priority`,Kj(n,`priority`)),mj(e,n,r),Dj(e,`Field keys`,n.args.fields,i),Dj(e,`Update ops`,n.args.update,i),$(e,`Notify users`,Gj(Jj(n,`notify_users`))),gj(e,n,`update issue`,r?.dryRun),$(e,`Return issue`,Gj(Jj(n,`return_issue`)));break;case`add_comment`:{$(e,`Issue`,r?.issueKey??Kj(n,`issue_key`)),Aj(e,`Comment`,xj(n,`body`,`body_adf`),i);let t=Xj(n.args.visibility);Object.keys(t).length>0&&$(e,`Visibility`,[Zj(t.type),Zj(t.value)].filter(Boolean).join(` · `)),$(e,`Return comment`,Gj(Jj(n,`return_comment`))),n.status!==`completed`&&$(e,`Mode`,`will add comment`);break}case`transition_issue`:{$(e,`Issue`,r?.issueKey??Kj(n,`issue_key`));let t=Kj(n,`transition`);$(e,`Transition`,t??(r?.transition?void 0:`list available transitions`)),$(e,`Resolution`,Kj(n,`resolution`)),Aj(e,`Comment`,xj(n,`comment`,`comment_adf`),i),Dj(e,`Field keys`,n.args.fields,i),Dj(e,`Update ops`,n.args.update,i),t&&gj(e,n,`transition issue`,r?.dryRun);break}}}function hM(e,t,n,r){if(gM(t))switch(t.action){case`search_users`:$(e,`Returned`,Wj(t.userCount??t.users.length,`user`)),Oj(e,`Users`,t.users.map(Ij),r);break;case`search_issues`:{let n=Wj(t.issueCount??t.issues.length,`issue`);$(e,`Returned`,t.total!==void 0&&n?`${n} (${t.total} total)`:n),$(e,`Next page token`,t.nextPageToken),Oj(e,`Issues`,t.issues.map(Nj),r);break}case`get_issue`:t.issue&&$(e,`Fetched`,Nj(t.issue)),Cj(e,t.includedCounts,fM,`Included`),Oj(e,`Transitions`,t.transitions.map(Fj),r);break;case`get_project`:t.project&&$(e,`Project`,Pj(t.project)),Cj(e,t.includedCounts,fM,`Included`),Oj(e,`Fields`,t.fields.map(Lj),r);break;case`create_issue`:$(e,t.dryRun?`Would create`:`Created`,t.issueKey??Zj(n.id)),$(e,`Jira id`,Zj(n.id)),t.issue&&$(e,`Returned issue`,Nj(t.issue)),hj(e,t),Ej(e,t.payload??n.payload,r);break;case`update_issue`:$(e,t.dryRun?`Would update`:`Updated`,t.issueKey),$(e,`Updated fields`,Wj(t.updatedFieldCount??t.updatedFields?.length,`field`)),kj(e,`Updated field keys`,t.updatedFields,r),t.issue&&$(e,`Returned issue`,Nj(t.issue)),hj(e,t),Ej(e,t.payload??n.payload,r);break;case`add_comment`:$(e,`Issue`,t.issueKey),$(e,`Comment id`,t.commentId),$(e,`Result`,t.messageLines[0]);break;case`transition_issue`:t.transition?($(e,t.dryRun?`Would transition`:`Transitioned`,t.issueKey),$(e,`Transition`,Fj(t.transition)),Ej(e,t.payload??n.payload,r)):($(e,`Available`,Wj(t.transitionCount??t.transitions.length,`transition`)),Oj(e,`Transitions`,t.transitions.map(Fj),r)),Oj(e,`Transition fields`,t.fields.map(Lj),r);break}}function gM(e){return!!(e.messageLines.length>0||e.issues.length>0||e.users.length>0||e.issue||e.project||e.transitions.length>0||e.fields.length>0||e.commentId||e.updatedFieldCount!==void 0||e.dryRun)}function _M(e,t){return{text:e,tone:t?`info`:`success`}}function vM(e,t){if(t===`completed`)switch(e.action){case`create_issue`:{if(e.dryRun)return _M(e.issueKey?`Dry run — would create ${e.issueKey}`:`Dry run — would create issue`,!0);if(!e.issueKey)return;let t=e.summary?` · ${e.summary}`:``;return _M(`Created ${e.issueKey}${t}`,!1)}case`update_issue`:{if(!e.issueKey)return;if(e.dryRun)return _M(`Dry run — would update ${e.issueKey}`,!0);let t=e.updatedFieldCount??e.updatedFields?.length,n=t===void 0?``:` · ${t} field${t===1?``:`s`}`;return _M(`Updated ${e.issueKey}${n}`,!1)}case`add_comment`:{if(!e.issueKey)return;let t=e.commentId?` · id ${e.commentId}`:``;return _M(`Comment added to ${e.issueKey}${t}`,!1)}case`transition_issue`:return!e.transition||!e.issueKey?void 0:e.dryRun?_M(`Dry run — would transition ${e.issueKey}`,!0):_M(`Transitioned ${e.issueKey}`,!1);default:return}}function yM(e,t){if(t===`completed`)switch(e.action){case`create_page`:{let t=e.title??e.page?.title;return e.dryRun?_M(t?`Dry run — would create page "${t}"`:`Dry run — would create page`,!0):t?_M(`Created page "${t}"`,!1):void 0}case`update_page`:{let t=e.title??e.page?.title;if(e.dryRun)return _M(t?`Dry run — would update page "${t}"`:`Dry run — would update page`,!0);if(!t)return;let n=e.page?.versionNumber;return _M(`Updated page "${t}"${n===void 0?``:` · v${n}`}`,!1)}case`upload_attachment`:{let t=e.attachment?.filename??e.attachment?.title;return t?_M(`Uploaded ${t}`,e.dryRun):void 0}case`download_pages`:{let t=e.pageCount??e.pages.length;return t<=0?void 0:_M(`Downloaded ${t} page${t===1?``:`s`}`,!1)}case`publish_pages`:{let t=e.outcomeCount??e.outcomes.length;if(t<=0)return;let n=`${t} page${t===1?``:`s`}`;return e.dryRun?_M(`Dry run — ${n}`,!0):_M(`Published ${n}`,!1)}default:return}}function bM(e,t){if(t===`completed`){if(e.action===`search_issues`&&e.issueCount===0)return`No issues found.`;if(e.action===`search_users`&&e.userCount===0)return`No users found.`}}function xM(e,t){if(t===`completed`){if(e.action===`search_pages`&&e.pageCount===0)return`No pages found.`;if(e.action===`search_spaces`&&e.spaceCount===0)return`No spaces found.`}}function SM(e,t){return!!(e.issue||e.issues.length>0||e.users.length>0||e.project||e.transitions.length>0||e.fields.length>0||e.commentId||e.updatedFields?.length||e.updatedFieldCount!==void 0||e.includedCounts||e.resolvedAssignee||vM(e,t)||bM(e,t))}function CM(e,t){return!!(e.page||e.pages.length>0||e.space||e.spaces.length>0||e.attachment||e.attachments.length>0||e.outcomes.length>0||e.includedCounts||e.downloadDir||yM(e,t)||xM(e,t))}var wM=h(`<div class="flex min-w-0 items-center gap-2 rounded-sm border bg-sidebar px-2.5 py-2"><!> <span class="min-w-0 break-words text-xs leading-normal text-sidebar-foreground"> </span></div>`);function TM(e,t){let n=I(t,`tone`,3,`default`),r={success:`text-success`,info:`text-info`,default:`text-muted-foreground`},i=J(()=>t.icon);var a=wM(),o=V(a),s=e=>{var t=U(),a=R(t);{let e=J(()=>`shrink-0 ${r[n()]}`);C(a,()=>W(i),(t,n)=>{n(t,{size:14,strokeWidth:2,get class(){return W(e)}})})}g(e,t)};k(o,e=>{W(i)&&e(s)});var c=L(o,2),l=V(c,!0);d(c),d(a),F(()=>A(l,t.text)),g(e,a)}var EM=new Set([`$$slots`,`$$events`,`$$legacy`]);function DM(e,t){let n=H(t,EM),r=[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`}]];P(e,B({name:`paperclip`},()=>n,{get iconNode(){return r}}))}var OM={success:`good`,warning:`warn`,info:`running`,muted:`neutral`,default:`neutral`};function kM(e){return OM[jM(e)]}function AM(e){return OM[MM(e)]}function jM(e){let t=e?.trim().toLowerCase();return t?t===`current`?`success`:t===`draft`?`warning`:t===`archived`||t===`deleted`?`muted`:`info`:`muted`}function MM(e){let t=e?.trim().toLowerCase();return t===`created`||t===`updated`?`success`:t===`dry_run`||t===`skipped`||t===`error`?`warning`:`muted`}function NM(e,t){if(!t)return;if(/^https?:\/\//i.test(t))return t;if(!e)return;let n=e.replace(/\/+$/,``).replace(/\/wiki$/i,``),r=t.startsWith(`/`)?t:`/${t}`;return`${n}${r===`/wiki`||r.startsWith(`/wiki/`)?r:`/wiki${r}`}`}function PM(e){if(e!==void 0)return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var FM=h(`<span class="text-xs text-muted-foreground"> </span>`),IM=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!> <!></div>`),LM=h(`<button type="button" class="inline-flex min-w-0 items-center gap-1 border-0 bg-transparent p-0 text-xs text-primary hover:underline"><span class="text-muted-foreground">File</span> <span class="truncate font-mono"> </span></button>`),RM=h(`<code class="block break-all text-xs text-muted-foreground"> </code>`),zM=h(`<div class="grid gap-1.5 rounded-sm border bg-sidebar px-2.5 py-2"><div class="flex min-w-0 items-center gap-2"><!> <span class="min-w-0 flex-1 truncate text-xs font-medium text-sidebar-foreground"> </span></div> <!> <!> <!></div>`);function BM(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),i=J(()=>t.attachment.filename??t.attachment.title??t.attachment.id??`attachment`),o=J(()=>PM(t.attachment.fileSize)),s=J(()=>!!(t.attachment.mediaType||W(o)||t.attachment.versionNumber!==void 0));var c=zM(),l=V(c),u=V(l);DM(u,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var f=L(u,2),p=V(f,!0);d(f),d(l);var m=L(l,2),h=e=>{var n=IM(),r=V(n),i=e=>{var n=FM(),r=V(n,!0);d(n),F(()=>A(r,t.attachment.mediaType)),g(e,n)};k(r,e=>{t.attachment.mediaType&&e(i)});var a=L(r,2),s=e=>{var t=FM(),n=V(t,!0);d(t),F(()=>A(n,W(o))),g(e,t)};k(a,e=>{W(o)&&e(s)});var c=L(a,2),l=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`v${t.attachment.versionNumber??``}`)),g(e,r)},$$slots:{default:!0}})};k(c,e=>{t.attachment.versionNumber!==void 0&&e(l)}),d(n),g(e,n)};k(m,e=>{W(s)&&e(h)});var _=L(m,2),v=e=>{var n=LM(),i=L(V(n),2),a=V(i,!0);d(i),d(n),F(e=>{q(n,`title`,t.attachment.path),A(a,e)},[()=>$b(t.attachment.path)]),r(`click`,n,()=>t.onOpenFile?.(t.attachment.path)),g(e,n)};k(_,e=>{n()&&t.attachment.path&&e(v)});var y=L(_,2),b=e=>{var n=RM(),r=V(n,!0);d(n),F(()=>A(r,t.attachment.snippet)),g(e,n)};k(y,e=>{n()&&t.attachment.snippet&&e(b)}),d(c),F(()=>A(p,W(i))),g(e,c),z()}T([`click`]);var VM=h(`<span class="inline-flex items-center gap-1.5 rounded-sm border bg-sidebar px-2 py-1 text-xs"><span class="font-semibold tabular-nums text-sidebar-foreground"> </span> <span class="text-muted-foreground"> </span></span>`),HM=h(`<div class="flex flex-wrap gap-1.5"></div>`);function UM(e,t){a(t,!0);let n=[[`versions`,`Versions`],[`attachments`,`Attachments`],[`downloadedAttachments`,`Downloaded`],[`labels`,`Labels`],[`properties`,`Properties`],[`directChildren`,`Children`],[`operations`,`Operations`],[`pages`,`Pages`],[`spaces`,`Spaces`]],r=J(()=>n.flatMap(([e,n])=>{let r=t.counts[e];return typeof r==`number`?[{label:n,value:r}]:[]}));var i=U(),o=R(i),s=e=>{var t=HM();_(t,21,()=>W(r),e=>e.label,(e,t)=>{var n=VM(),r=V(n),i=V(r,!0);d(r);var a=L(r,2),o=V(a,!0);d(a),d(n),F(e=>{A(i,e),A(o,W(t).label)},[()=>W(t).value.toLocaleString()]),g(e,n)}),d(t),g(e,t)};k(o,e=>{W(r).length>0&&e(s)}),g(e,i),z()}var WM=h(`<code class="font-mono text-xs text-sidebar-foreground"> </code>`),GM=h(`<span> </span>`),KM=h(`<div class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 rounded-sm border bg-sidebar px-2.5 py-2"><!> <!> <!> <!></div>`);function qM(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>t.outcome.status??t.outcome.operation??`row`);var i=KM(),o=V(i);{let e=J(()=>AM(t.outcome.status));Ri(o,{get tone(){return W(e)},size:`xs`,children:(e,t)=>{w();var n=M();F(()=>A(n,W(r))),g(e,n)},$$slots:{default:!0}})}var c=L(o,2),l=e=>{var n=WM(),r=V(n,!0);d(n),F(()=>A(r,t.outcome.id)),g(e,n)};k(c,e=>{t.outcome.id&&e(l)});var u=L(c,2),f=e=>{var r=GM(),i=V(r,!0);d(r),F(()=>{s(r,1,`text-xs text-muted-foreground${n()?``:` min-w-0 truncate`}`),A(i,t.outcome.title)}),g(e,r)};k(u,e=>{t.outcome.title&&e(f)});var p=L(u,2),m=e=>{var r=GM(),i=V(r,!0);d(r),F(()=>{s(r,1,`text-xs text-muted-foreground${n()?``:` min-w-0 truncate`}`),A(i,t.outcome.message)}),g(e,r)};k(p,e=>{t.outcome.message&&e(m)}),d(i),g(e,i),z()}var JM=new Set([`$$slots`,`$$events`,`$$legacy`]);function YM(e,t){let n=H(t,JM),r=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`M10 14 21 3`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}]];P(e,B({name:`external-link`},()=>n,{get iconNode(){return r}}))}var XM=h(`<a class="inline-flex items-center gap-1 font-mono text-xs font-semibold text-primary no-underline hover:underline" target="_blank" rel="noreferrer noopener"> <!></a>`),ZM=h(`<span class="font-mono text-xs font-semibold text-sidebar-foreground"> </span>`),QM=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),$M=h(`<span class="text-xs text-muted-foreground"> </span>`),eN=h(`<span class="text-xs text-muted-foreground">Parent <code> </code></span>`),tN=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!> <!> <!></div>`),nN=h(`<button type="button" class="inline-flex min-w-0 items-center gap-1 border-0 bg-transparent p-0 text-primary hover:underline"><span class="text-muted-foreground"> </span> <span class="truncate font-mono"> </span></button>`),rN=h(`<div class="flex flex-wrap gap-x-3 gap-y-1 text-xs"></div>`),iN=h(`<div class="grid gap-1.5 rounded-sm border bg-sidebar px-2.5 py-2"><div class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1"><span class="inline-flex items-center gap-1.5"><!> <!></span> <!></div> <!> <!></div>`);function aN(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),i=J(()=>NM(t.siteUrl,t.page.webui)),o=J(()=>!!(t.page.status||t.page.versionNumber!==void 0||t.page.spaceKey||t.page.parentId)),s=J(()=>[t.page.storagePath?{label:`Storage`,path:t.page.storagePath}:void 0,t.page.markdownPath?{label:`Markdown`,path:t.page.markdownPath}:void 0,t.page.attachmentDir?{label:`Attachments`,path:t.page.attachmentDir}:void 0].filter(e=>!!e));var c=iN(),l=V(c),u=V(l),f=V(u);Hu(f,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var p=L(f,2),m=e=>{var n=XM(),r=V(n);YM(L(r),{size:11,strokeWidth:2,class:`opacity-70`}),d(n),F(()=>{q(n,`href`,W(i)),q(n,`title`,`Open ${t.page.id} in Confluence`),A(r,`${t.page.id??``} `)}),g(e,n)},h=e=>{var n=ZM(),r=V(n,!0);d(n),F(()=>A(r,t.page.id)),g(e,n)};k(p,e=>{W(i)?e(m):e(h,-1)}),d(u);var v=L(u,2),y=e=>{var n=QM(),r=V(n,!0);d(n),F(()=>A(r,t.page.title)),g(e,n)};k(v,e=>{t.page.title&&e(y)}),d(l);var b=L(l,2),x=e=>{var n=tN(),r=V(n),i=e=>{{let n=J(()=>kM(t.page.status));Ri(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.page.status)),g(e,r)},$$slots:{default:!0}})}};k(r,e=>{t.page.status&&e(i)});var a=L(r,2),o=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`v${t.page.versionNumber??``}`)),g(e,r)},$$slots:{default:!0}})};k(a,e=>{t.page.versionNumber!==void 0&&e(o)});var s=L(a,2),c=e=>{var n=$M(),r=V(n);d(n),F(()=>A(r,`Space ${t.page.spaceKey??``}`)),g(e,n)};k(s,e=>{t.page.spaceKey&&e(c)});var l=L(s,2),u=e=>{var n=eN(),r=L(V(n)),i=V(r,!0);d(r),d(n),F(()=>A(i,t.page.parentId)),g(e,n)};k(l,e=>{t.page.parentId&&e(u)}),d(n),g(e,n)};k(b,e=>{W(o)&&e(x)});var S=L(b,2),C=e=>{var n=rN();_(n,21,()=>W(s),e=>e.path,(e,n)=>{var i=nN(),a=V(i),o=V(a,!0);d(a);var s=L(a,2),c=V(s,!0);d(s),d(i),F(e=>{q(i,`title`,W(n).path),A(o,W(n).label),A(c,e)},[()=>$b(W(n).path)]),r(`click`,i,()=>t.onOpenFile?.(W(n).path)),g(e,i)}),d(n),g(e,n)};k(S,e=>{n()&&W(s).length>0&&e(C)}),d(c),g(e,c),z()}T([`click`]);var oN=new Set([`$$slots`,`$$events`,`$$legacy`]);function sN(e,t){let n=H(t,oN),r=[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`}]];P(e,B({name:`database`},()=>n,{get iconNode(){return r}}))}var cN=h(`<span class="font-mono text-xs font-semibold text-sidebar-foreground"> </span>`),lN=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),uN=h(`<span class="text-xs text-muted-foreground"> </span>`),dN=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!></div>`),fN=h(`<div class="grid gap-1.5 rounded-sm border bg-sidebar px-2.5 py-2"><div class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1"><span class="inline-flex items-center gap-1.5"><!> <!> <span class="font-mono text-xs text-muted-foreground"> </span></span> <!></div> <!></div>`);function pN(e,t){a(t,!0);let n=J(()=>!!(t.space.status||t.space.type));var r=fN(),i=V(r),o=V(i),s=V(o);sN(s,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var c=L(s,2),l=e=>{var n=cN(),r=V(n,!0);d(n),F(()=>A(r,t.space.key)),g(e,n)};k(c,e=>{t.space.key&&e(l)});var u=L(c,2),f=V(u,!0);d(u),d(o);var p=L(o,2),m=e=>{var n=lN(),r=V(n,!0);d(n),F(()=>A(r,t.space.name)),g(e,n)};k(p,e=>{t.space.name&&e(m)}),d(i);var h=L(i,2),_=e=>{var n=dN(),r=V(n),i=e=>{{let n=J(()=>kM(t.space.status));Ri(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.space.status)),g(e,r)},$$slots:{default:!0}})}};k(r,e=>{t.space.status&&e(i)});var a=L(r,2),o=e=>{var n=uN(),r=V(n,!0);d(n),F(()=>A(r,t.space.type)),g(e,n)};k(a,e=>{t.space.type&&e(o)}),d(n),g(e,n)};k(h,e=>{W(n)&&e(_)}),d(r),F(()=>A(f,t.space.id)),g(e,r),z()}var mN=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]),hN=h(`<div></div>`);function gN(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,mN);var i=hN();O(i,e=>({"data-slot":`skeleton`,class:e,...r}),[()=>me(`bg-muted rounded-md animate-pulse`,t.class)]),fe(i,e=>n(e),()=>n()),g(e,i),z()}var _N=h(`<!> <!>`,1),vN=h(`<div class="grid gap-1.5"><span class="text-xs font-medium text-muted-foreground"> </span> <!></div>`),yN=h(`<dt class="text-muted-foreground"> </dt> <dd><!></dd>`,1),bN=h(`<div class="grid gap-1.5 rounded-sm border bg-sidebar px-2.5 py-2"><dl class="m-0 grid gap-x-3 gap-y-1 text-xs sm:grid-cols-[max-content_minmax(0,1fr)]"></dl> <!></div>`);function xN(e,t){a(t,!0);let n=e=>{var n=U(),a=R(n),o=e=>{var n=vN(),a=V(n),o=V(a,!0);d(a);var s=L(a,2),c=e=>{{let n=J(()=>!r()&&!!t.body.text.language);qA(e,{get code(){return t.body.text.text},get language(){return t.body.text.language},trim:!1,get highlight(){return W(n)},wrap:!0,overflow:`hidden`,tail:!0,get fixedRows(){return i()}})}},l=e=>{var t=_N(),n=R(t);gN(n,{class:`h-3 w-full`}),gN(L(n,2),{class:`h-3 w-2/3`}),g(e,t)};k(s,e=>{t.body.text.text===void 0?e(l,-1):e(c)}),d(n),F(()=>A(o,t.body.text.label)),g(e,n)};k(a,e=>{t.body.text&&e(o)}),g(e,n)},r=I(t,`streaming`,3,!1),i=I(t,`fixedRows`,3,6),o=J(()=>t.body.fields.filter(e=>e.value!==void 0||r())),c=J(()=>!!(t.body.text&&(t.body.text.text!==void 0||r())));var l=U(),u=R(l),f=e=>{var t=bN(),r=V(t);_(r,21,()=>W(o),e=>e.label,(e,t)=>{var n=yN(),r=R(n),i=V(r,!0);d(r);var a=L(r,2);let o;var c=V(a),l=e=>{var n=M();F(()=>A(n,W(t).value)),g(e,n)},u=e=>{gN(e,{class:`h-3 w-24`})};k(c,e=>{W(t).value===void 0?e(u,-1):e(l)}),d(a),F(()=>{A(i,W(t).label),o=s(a,1,`m-0 min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,null,o,{"font-mono":W(t).mono,"text-warning":W(t).tone===`warning`,"text-destructive":W(t).tone===`error`,"text-success":W(t).tone===`success`,"text-info":W(t).tone===`info`})}),g(e,n)}),d(r);var i=L(r,2),a=e=>{n(e)};k(i,e=>{W(c)&&e(a)}),d(t),g(e,t)},p=e=>{n(e)};k(u,e=>{W(o).length>0?e(f):W(c)&&e(p,1)}),g(e,l),z()}var SN=h(`<p class="m-0 text-xs font-medium text-muted-foreground"> </p>`),CN=h(`<div class="grid gap-1.5"><!> <!></div>`),wN=h(`<dt class="text-muted-foreground"> </dt> <dd> </dd>`,1),TN=h(`<dl class="m-0 grid gap-x-3 gap-y-1 text-sm sm:grid-cols-[max-content_minmax(0,1fr)]"></dl>`),EN=h(`<div class="grid gap-1.5"><!> <p class="m-0 whitespace-pre-wrap text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]"> </p></div>`);function DN(e,t){a(t,!0);let n=I(t,`fixedRows`,3,6),r=I(t,`highlight`,3,!0),i=I(t,`streaming`,3,!1);var o=U(),c=R(o),l=e=>{var i=CN(),a=V(i),o=e=>{var n=SN(),r=V(n,!0);d(n),F(()=>A(r,t.body.label)),g(e,n)};k(a,e=>{t.body.label&&e(o)});var s=L(a,2);{let e=J(()=>t.body.language===`text`?void 0:t.body.language),i=J(()=>r()&&t.body.language!==`text`);qA(s,{get code(){return t.body.text},get language(){return W(e)},trim:!1,get highlight(){return W(i)},wrap:!0,overflow:`hidden`,get tail(){return t.body.tail},get fixedRows(){return n()}})}d(i),g(e,i)},u=e=>{var r=CN(),i=V(r),a=e=>{var n=SN(),r=V(n,!0);d(n),F(()=>A(r,t.body.label)),g(e,n)};k(i,e=>{t.body.label&&e(a)}),qA(L(i,2),{get code(){return t.body.text},language:`diff`,trim:!1,highlight:!1,wrap:!0,overflow:`hidden`,get tail(){return t.body.tail},get fixedRows(){return n()}}),d(r),g(e,r)},f=e=>{var n=TN();_(n,23,()=>t.body.items,(e,t)=>`${e.label}:${t}`,(e,t)=>{var n=wN(),r=R(n),i=V(r,!0);d(r);var a=L(r,2);let o;var c=V(a,!0);d(a),F(()=>{A(i,W(t).label),o=s(a,1,`m-0 min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,null,o,{"font-mono":W(t).mono,"text-warning":W(t).tone===`warning`,"text-destructive":W(t).tone===`error`,"text-success":W(t).tone===`success`,"text-info":W(t).tone===`info`}),A(c,W(t).value)}),g(e,n)}),d(n),g(e,n)},p=e=>{{let n=J(()=>t.body.items.map(e=>({todo:e.text,done:e.done})));gv(e,{get items(){return W(n)}})}},m=e=>{xN(e,{get body(){return t.body},get streaming(){return i()},get fixedRows(){return n()}})},h=e=>{var n=EN(),r=V(n),i=e=>{var n=SN(),r=V(n,!0);d(n),F(()=>A(r,t.body.label)),g(e,n)};k(r,e=>{t.body.kind===`text-summary`&&t.body.label&&e(i)});var a=L(r,2),o=V(a,!0);d(a),d(n),F(()=>A(o,t.body.text)),g(e,n)};k(c,e=>{t.body.kind===`code`?e(l):t.body.kind===`diff`?e(u,1):t.body.kind===`key-values`?e(f,2):t.body.kind===`checklist`?e(p,3):t.body.kind===`atlassian-draft`?e(m,4):(t.body.kind===`text-summary`||t.body.kind===`atlassian-summary`)&&e(h,5)}),g(e,o),z()}var ON=h(`<button type="button" class="flex min-w-0 items-center gap-1.5 rounded-sm border bg-sidebar px-2.5 py-1.5 text-left font-mono text-xs text-sidebar-foreground hover:bg-muted/40"><!> <span class="truncate"> </span></button>`),kN=h(`<span class="flex min-w-0 items-center gap-1.5 rounded-sm border bg-sidebar px-2.5 py-1.5 font-mono text-xs text-sidebar-foreground"><!> <span class="truncate"> </span></span>`),AN=h(`<p class="m-0 text-xs text-muted-foreground">More results available.</p>`),jN=h(`<!> <!>`,1),MN=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),NN=h(`<div class="grid gap-1.5"><!> <!> <!></div>`),PN=h(`<p class="m-0 text-xs text-muted-foreground">No Confluence summary available. Open Details for raw arguments and result.</p>`);function FN(e,t){a(t,!0);let n=(e,n=D)=>{var i=U(),a=R(i),o=e=>{var i=ON(),a=V(i);En(a,{size:12,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var o=L(a,2),s=V(o,!0);d(o),d(i),F(()=>{q(i,`title`,n()),A(s,n())}),r(`click`,i,()=>t.onOpenFile?.(n())),g(e,i)},s=e=>{var t=kN(),r=V(t);En(r,{size:12,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var i=L(r,2),a=V(i,!0);d(i),d(t),F(()=>{q(t,`title`,n()),A(a,n())}),g(e,t)};k(a,e=>{t.onOpenFile?e(o):e(s,-1)}),g(e,i)},i=I(t,`expanded`,3,!1),o=Rk(),s=J(()=>o.atlassian?.confluenceSiteUrl()),c=J(()=>i()?1/0:5),l=J(()=>yM(t.view,t.toolCall.status)),u=J(()=>xM(t.view,t.toolCall.status)),f=J(()=>CM(t.view,t.toolCall.status)),p=J(()=>W(f)?void 0:sM(t.toolCall,t.view,{expanded:i()})),m=J(()=>{if(!t.view.includedCounts)return;let e={...t.view.includedCounts};return delete e.attachments,delete e.downloadedAttachments,Object.keys(e).length>0?e:void 0}),h=J(()=>t.view.action===`download_pages`?[t.view.downloadDir,...i()?[t.view.manifestPath,t.view.pagesJsonlPath]:[]].filter(e=>!!e):[]);var v=U(),y=R(v),b=e=>{var r=NN(),a=V(r),o=e=>{{let t=J(()=>W(l).tone===`info`?rj:fv);TM(e,{get text(){return W(l).text},get tone(){return W(l).tone},get icon(){return W(t)}})}};k(a,e=>{W(l)&&e(o)});var f=L(a,2),p=e=>{var n=jN(),r=R(n);_(r,17,()=>t.view.pages.slice(0,W(c)),e=>e.id,(e,n)=>{aN(e,{get page(){return W(n)},get siteUrl(){return W(s)},get expanded(){return i()},get onOpenFile(){return t.onOpenFile}})});var a=L(r,2),o=e=>{g(e,AN())};k(a,e=>{t.view.nextCursor&&e(o)}),g(e,n)},v=e=>{var n=U();_(R(n),17,()=>t.view.spaces.slice(0,W(c)),e=>e.id,(e,t)=>{pN(e,{get space(){return W(t)}})}),g(e,n)},y=e=>{var n=jN(),r=R(n),a=e=>{aN(e,{get page(){return t.view.page},get siteUrl(){return W(s)},get expanded(){return i()},get onOpenFile(){return t.onOpenFile}})};k(r,e=>{t.view.page&&e(a)});var o=L(r,2),c=e=>{UM(e,{get counts(){return W(m)}})};k(o,e=>{W(m)&&e(c)}),g(e,n)},b=e=>{var r=jN(),a=R(r);_(a,16,()=>W(h),e=>e,(e,t)=>{n(e,()=>t)}),_(L(a,2),17,()=>t.view.pages.slice(0,W(c)),e=>e.id,(e,n)=>{aN(e,{get page(){return W(n)},get siteUrl(){return W(s)},get expanded(){return i()},get onOpenFile(){return t.onOpenFile}})}),g(e,r)},x=e=>{var n=U(),r=R(n),a=e=>{aN(e,{get page(){return t.view.page},get siteUrl(){return W(s)},get expanded(){return i()},get onOpenFile(){return t.onOpenFile}})};k(r,e=>{t.view.page&&e(a)}),g(e,n)},S=e=>{var n=U();_(R(n),19,()=>t.view.outcomes.slice(0,W(c)),(e,t)=>e.id??e.index??t,(e,t)=>{qM(e,{get outcome(){return W(t)},get expanded(){return i()}})}),g(e,n)},C=e=>{var n=U(),r=R(n),a=e=>{BM(e,{get attachment(){return t.view.attachment},get expanded(){return i()},get onOpenFile(){return t.onOpenFile}})};k(r,e=>{t.view.attachment&&e(a)}),g(e,n)};k(f,e=>{t.view.action===`search_pages`?e(p):t.view.action===`search_spaces`?e(v,1):t.view.action===`get_page`?e(y,2):t.view.action===`download_pages`?e(b,3):t.view.action===`create_page`||t.view.action===`update_page`?e(x,4):t.view.action===`publish_pages`?e(S,5):t.view.action===`upload_attachment`&&e(C,6)});var w=L(f,2),T=e=>{var t=MN(),n=V(t,!0);d(t),F(()=>A(n,W(u))),g(e,t)};k(w,e=>{W(u)&&e(T)}),d(r),g(e,r)},x=e=>{{let t=J(()=>({kind:`atlassian-summary`,text:W(p)}));DN(e,{get body(){return W(t)}})}},S=e=>{g(e,PN())};k(y,e=>{W(f)?e(b):W(p)?e(x,1):t.toolCall.status===`completed`&&e(S,2)}),g(e,v),z()}T([`click`]);var IN=h(`<p class="m-0 text-xs text-muted-foreground">No changes.</p>`);function LN(e,t){a(t,!0);let n=I(t,`expanded`,3,!1);var r=U(),i=R(r),o=e=>{XA(e,{get text(){return t.view.diff},language:`diff`,direction:`tail`,get expanded(){return n()}})},s=e=>{g(e,IN())};k(i,e=>{t.view.diff?e(o):t.toolCall.status===`completed`&&e(s,1)}),g(e,r),z()}var RN=new Set([`$$slots`,`$$events`,`$$legacy`]);function zN(e,t){let n=H(t,RN),r=[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`}]];P(e,B({name:`messages-square`},()=>n,{get iconNode(){return r}}))}function BN(e){let t=qy(e),n=t.objectArraySources(`tasks`);if(n.length===0){let e=t.string(`task`);return[VN(0,1,t.string(`label`),e)]}let r=n.length;return n.map((e,t)=>VN(t,r,e.string(`label`),e.string(`task`)))}function VN(e,t,n,r){return{key:`task-${e}`,index:e,count:t,label:n,task:r,status:`drafting`}}var HN=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function UN(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=H(t,HN);var i=U();C(R(i),()=>As,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),z()}var WN=new Set([`$$slots`,`$$events`,`$$legacy`]);function GN(e,t){let n=H(t,WN);var r=U();C(R(r),()=>Ue,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var KN=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function qN(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,KN);var i=U(),o=R(i);{let e=J(()=>me(`leading-none font-medium`,t.class));C(o,()=>Ge,(t,i)=>{i(t,B({"data-slot":`dialog-title`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}h(`<div><!> <!></div>`),h(`<div><!></div>`);var JN=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function YN(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,JN);var i=U(),o=R(i);{let e=J(()=>me(`dialog-overlay data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 duration-100`,t.class));C(o,()=>it,(t,i)=>{i(t,B({"data-slot":`dialog-overlay`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var XN=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`portalProps`,`children`,`showCloseButton`,`layout`]),ZN=h(`<!> <span class="sr-only">Close</span>`,1),QN=h(`<!> <!>`,1);function $N(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`showCloseButton`,3,!0),i=I(t,`layout`,3,`default`),o=H(t,XN);GN(e,B(()=>t.portalProps,{children:(e,a)=>{var s=QN(),c=R(s);C(c,()=>YN,(e,t)=>{t(e,{})});var l=L(c,2);{let e=J(()=>me(`bg-card text-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 border-border grid rounded-lg border text-sm shadow-xl duration-100 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,i()==="default"&&`max-w-[calc(100%-2rem)] gap-4 p-4 sm:max-w-md`,t.class));C(l,()=>Ls,(i,a)=>{a(i,B({"data-slot":`dialog-content`,get class(){return W(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var i=QN(),a=R(i);u(a,()=>t.children??D);var o=L(a,2),s=e=>{var t=U(),n=R(t);{let e=(e,t)=>{G(e,B({variant:`ghost`,class:`absolute top-4 right-4`,size:`icon-sm`},()=>t?.().props,{children:(e,t)=>{var n=ZN();Xg(R(n),{}),w(2),g(e,n)},$$slots:{default:!0}}))};C(n,()=>Ns,(t,n)=>{n(t,{"data-slot":`dialog-close`,child:e,$$slots:{child:!0}})})}g(e,t)};k(o,e=>{r()&&e(s)}),g(e,i)},$$slots:{default:!0}}))})}g(e,s)},$$slots:{default:!0}})),z()}var eP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function tP(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,eP);var i=U(),o=R(i);{let e=J(()=>me(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,t.class));C(o,()=>pt,(t,i)=>{i(t,B({"data-slot":`dialog-description`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var nP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`type`]);function rP(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`type`,3,`button`),i=H(t,nP);var o=U();C(R(o),()=>Ns,(e,t)=>{t(e,B({"data-slot":`dialog-close`,get type(){return r()}},()=>i,{get ref(){return n()},set ref(e){n(e)}}))}),g(e,o),z()}var iP=h(`<div class="dialog-header-actions"><!></div>`),aP=h(`<footer class="dialog-footer"><!></footer>`),oP=h(`<header class="dialog-header"><div class="dialog-title-block"><!> <!></div> <!> <!></header> <div><!></div> <!>`,1);function sP(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`title`,3,`Dialog`),i=I(t,`class`,3,``),o=I(t,`closeLabel`,3,`Close dialog`),c=I(t,`size`,3,`default`),l=I(t,`flush`,3,!1),f=I(t,`closeOnInteractOutside`,3,!0);function p(e){n(e),t.onOpenChange?.(e)}var m=U();C(R(m),()=>UN,(e,a)=>{a(e,{onOpenChange:p,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=U(),p=R(a);{let e=J(()=>me(`dialog-content data-open:animate-in data-closed:animate-out data-open:fade-in-0 data-closed:fade-out-0 data-open:zoom-in-95 data-closed:zoom-out-95 duration-100 outline-none`,c()===`sm`&&`dialog-content-sm`,c()===`md`&&`dialog-content-md`,c()===`wide`&&`dialog-content-wide`,c()===`wide-viewport`&&`dialog-content-wide-viewport`,c()===`viewport`&&`dialog-content-viewport`,i()));C(p,()=>$N,(n,i)=>{i(n,{showCloseButton:!1,layout:`shell`,onInteractOutside:e=>{f()||e.preventDefault()},get class(){return W(e)},children:(e,n)=>{var i=oP(),a=R(i),c=V(a),f=V(c);C(f,()=>qN,(e,t)=>{t(e,{class:`dialog-title`,children:(e,t)=>{w();var n=M();F(()=>A(n,r())),g(e,n)},$$slots:{default:!0}})});var p=L(f,2),m=e=>{var n=U();C(R(n),()=>tP,(e,n)=>{n(e,{class:`dialog-description`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.description)),g(e,r)},$$slots:{default:!0}})}),g(e,n)};k(p,e=>{t.description&&e(m)}),d(c);var h=L(c,2),_=e=>{var n=iP();u(V(n),()=>t.headerActions),d(n),g(e,n)};k(h,e=>{t.headerActions&&e(_)}),C(L(h,2),()=>rP,(e,t)=>{t(e,{class:`dialog-close`,get"aria-label"(){return o()},children:(e,t)=>{Xg(e,{size:14,strokeWidth:2.25,"aria-hidden":`true`})},$$slots:{default:!0}})}),d(a);var v=L(a,2);u(V(v),()=>t.children??D),d(v);var y=L(v,2),b=e=>{var n=aP();u(V(n),()=>t.footer),d(n),g(e,n)};k(y,e=>{t.footer&&e(b)}),F(e=>s(v,1,e),[()=>x(me(`dialog-body`,l()&&`dialog-body-flush`))]),g(e,i)},$$slots:{default:!0}})})}g(e,a)},$$slots:{default:!0}})}),g(e,m),z()}function cP({atEnd:e,scrollDelta:t,userScrollAwayIntent:n,scrollbarPointerActive:r,epsilon:i=1}){return e?!1:r?!0:n&&t<-i}var lP=30,uP=2400,dP=32,fP=100,pP=350,mP=120,hP=1,gP=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),_P=new Set([`ArrowUp`,`Home`,`PageUp`]);function vP(e){return Math.max(e.scrollHeight-e.clientHeight-e.scrollTop,0)}function yP(e,t=dP){return vP(e)<=t}function bP(e,t){if(t.scrollHeight<=t.clientHeight)return!1;let n=t.offsetWidth-t.clientWidth;if(n<=0)return!1;let r=t.getBoundingClientRect();return e.clientX>=r.right-n&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom}function xP(e){let t=Y(void 0),n=Y(0),r=Y(void 0),i=Y(!0),a=Y(!0),o,s=!1,c=!1,l,u=!1,d,f=!1,p;function m(){d!==void 0&&(clearTimeout(d),d=void 0)}function h(){p!==void 0&&(clearTimeout(p),p=void 0)}function g(){f=!0,h(),p=setTimeout(()=>{f=!1,p=void 0},mP)}function _(){l!==void 0&&(cancelAnimationFrame(l),l=void 0)}function v(e){g(),W(r)?.scrollToEnd(e)}function y(e){let t=W(r);if(e){if(yP(e,dP)){K(a,!0);return}u&&vP(e)>fP&&(K(a,!1),_());return}if(t?.isAtEnd(dP)){K(a,!0);return}u&&(t?.getDistanceFromEnd()??0)>fP&&(K(a,!1),_())}function b(){K(a,!1),_()}function x(e){f||(u=e?.scrollAwayIntent??!!e?.disableFollowImmediately,e?.disableFollowImmediately&&b(),m(),d=setTimeout(()=>{u=!1,d=void 0},pP),requestAnimationFrame(()=>y(e?.viewport)))}function S(){let e=W(r);e&&(K(a,!0),e.getDistanceFromEnd()<=uP?v({behavior:`smooth`}):C())}function C(){_(),K(a,!0);let e=0,t=()=>{l=void 0,e+=1;let n=W(r);if(!n){e<lP&&(l=requestAnimationFrame(t));return}v({behavior:`instant`}),!n.isAtEnd(dP)&&e<lP&&(l=requestAnimationFrame(t))};l=requestAnimationFrame(t)}return be(()=>{if(!W(i))return;let e=W(r)?.getViewportElement();e&&!yP(e,dP)||K(a,!0)}),be(()=>{let t=e.active?.()??!0,n=e.conversationId(),r=e.contentReady(),i=t&&!s;if(s=t,n!==o&&(o=n,c=!1,K(a,!0),_()),!t){_();return}if(!(!e.conversationOpen()||!n||!r)){if(!c){c=!0,he().then(C);return}i&&W(a)&&he().then(C)}}),be(()=>{let r=W(t),i=e.active?.()??!0;if(!r||typeof ResizeObserver>`u`)return;let a=()=>{K(n,i?r.offsetHeight:0,!0)};a();let o=new ResizeObserver(a);return o.observe(r),()=>o.disconnect()}),be(()=>{let e=W(r)?.getViewportElement();if(!e)return;let t=e.scrollTop,n=!1,i=()=>{let r=e.scrollTop,i=r-t;if(t=r,f)return;let o=yP(e,dP);if(o){K(a,!0);return}cP({atEnd:o,scrollDelta:i,userScrollAwayIntent:u,scrollbarPointerActive:n,epsilon:hP})&&b()},o=t=>{n=bP(t,e),n&&x({disableFollowImmediately:!0,viewport:e})},s=()=>{n&&x({disableFollowImmediately:!0,viewport:e})},c=()=>{n&&yP(e,dP)&&K(a,!0),n=!1},l=t=>{let n=t.deltaY<0;x({disableFollowImmediately:n,scrollAwayIntent:n,viewport:e})},d=()=>{x({disableFollowImmediately:!0,viewport:e})},p=t=>{if(!gP.has(t.key))return;let n=_P.has(t.key)||t.key===` `&&t.shiftKey;x({disableFollowImmediately:n,scrollAwayIntent:n,viewport:e})};return e.addEventListener(`scroll`,i,{passive:!0}),e.addEventListener(`wheel`,l,{passive:!0}),e.addEventListener(`touchmove`,d,{passive:!0}),e.addEventListener(`pointerdown`,o,{passive:!0}),e.addEventListener(`pointermove`,s,{passive:!0}),e.addEventListener(`pointerup`,c,{passive:!0}),e.addEventListener(`pointerleave`,c,{passive:!0}),e.addEventListener(`keydown`,p),()=>{e.removeEventListener(`scroll`,i),e.removeEventListener(`wheel`,l),e.removeEventListener(`touchmove`,d),e.removeEventListener(`pointerdown`,o),e.removeEventListener(`pointermove`,s),e.removeEventListener(`pointerup`,c),e.removeEventListener(`pointerleave`,c),e.removeEventListener(`keydown`,p)}}),be(()=>()=>{_(),m(),h(),u=!1,f=!1}),{get composerWrapEl(){return W(t)},set composerWrapEl(e){K(t,e,!0)},get composerHeight(){return W(n)},get controller(){return W(r)},set controller(e){K(r,e,!0)},get atEnd(){return W(i)},set atEnd(e){K(i,e,!0)},get followBottom(){return W(a)},scrollToEnd:v,jumpToBottom:S}}function SP(e){return e.kind===`message`&&e.item.role===`assistant`&&e.item.displayKind===`thinking`}function CP(e){let t=[];for(let n of e){if(!SP(n)){t.push(n);continue}let e=t.at(-1);e?.kind===`thinking_group`?e.items.push(n):t.push({kind:`thinking_group`,key:n.key,items:[n]})}return t}var wP=h(`<p>Provider returned redacted thinking.</p>`),TP=h(`<span class="stream-caret svelte-ngmo3" aria-hidden="true"></span>`),EP=h(`<div><!> <!></div>`),DP=h(`<div><!></div>`),OP=h(`<div class="thinking-group svelte-ngmo3"><div class="thinking-content svelte-ngmo3"></div></div>`);function kP(e,t){var n=OP(),r=V(n);_(r,23,()=>t.items,(e,t)=>e.id??t,(e,t)=>{let n=J(()=>!!(W(t).live&&!W(t).done));var r=DP();let i;var a=V(r),o=e=>{var t=wP();let r;F(()=>r=s(t,1,`redacted svelte-ngmo3`,null,r,{"live-caret":W(n)})),g(e,t)},c=e=>{var r=EP();let i;var a=V(r);Fk(a,{get text(){return W(t).text},get streaming(){return W(n)},get onCopy(){return Xx}});var o=L(a,2),c=e=>{g(e,TP())};k(o,e=>{W(n)&&!W(t).text&&e(c)}),d(r),F(()=>i=s(r,1,`step-markdown svelte-ngmo3`,null,i,{"live-caret":W(n)})),g(e,r)};k(a,e=>{W(t).redacted&&!W(t).text?e(o):e(c,-1)}),d(r),F(()=>i=s(r,1,`thinking-step svelte-ngmo3`,null,i,{"step-live":W(n)})),g(e,r)}),d(r),d(n),g(e,n)}var AP=h(`<span class="elapsed svelte-8dfbf0"> </span>`),jP=h(`<div class="working-indicator svelte-8dfbf0"><span class="orbit svelte-8dfbf0" aria-hidden="true"><span class="orbit-spinner svelte-8dfbf0"></span></span> <span class="label svelte-8dfbf0"> </span> <!></div>`);function MP(e,t){a(t,!0);let n=[`Thinking…`,`Planning next steps…`,`Connecting the dots…`,`Reasoning through it…`,`Mapping it out…`,`Gathering context…`,`Weighing options…`,`Putting the pieces together…`,`Sketching an approach…`,`Getting my bearings…`],r=n[Math.floor(Math.random()*n.length)],i=Y(0);be(()=>{let e=Date.now(),t=setInterval(()=>{K(i,Math.floor((Date.now()-e)/1e3),!0)},250);return()=>clearInterval(t)});let o=J(()=>`${Math.floor(W(i)/60)}:${String(W(i)%60).padStart(2,`0`)}`);var s=jP(),c=L(V(s),2),l=V(c,!0);d(c);var u=L(c,2),f=e=>{var t=AP(),n=V(t,!0);d(t),F(()=>A(n,W(o))),g(e,t)};k(u,e=>{W(i)>=3&&e(f)}),d(s),F(()=>A(l,r)),g(e,s),z()}var NP=new Set([`$$slots`,`$$events`,`$$legacy`]);function PP(e,t){let n=H(t,NP),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]];P(e,B({name:`circle-alert`},()=>n,{get iconNode(){return r}}))}var FP=new Set([`$$slots`,`$$events`,`$$legacy`]);function IP(e,t){let n=H(t,FP),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];P(e,B({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var LP=new Set([`$$slots`,`$$events`,`$$legacy`]);function RP(e,t){let n=H(t,LP),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m15 9-6 6`}],[`path`,{d:`m9 9 6 6`}]];P(e,B({name:`circle-x`},()=>n,{get iconNode(){return r}}))}var zP=h(`<span class="tool-status-glyph inline-flex size-full items-center justify-center svelte-1ya8e7m"><!></span>`),BP=h(`<span><!></span>`);function VP(e,t){a(t,!0);let n=I(t,`pulse`,3,!1),r=I(t,`waitingForUser`,3,!1),i=I(t,`size`,3,14),c=J(()=>!r()&&(n()||t.tone===`running`)),u={running:`text-info`,good:`text-success`,warn:`text-warning`,danger:`text-destructive`,neutral:`text-muted-foreground`,accent:`text-muted-foreground`},f={running:uv,good:fv,warn:PP,danger:RP,neutral:uv,accent:uv},p=J(()=>r()?IP:f[t.tone]),m=J(()=>`${r()?`waiting`:W(c)?`spin`:`static`}:${t.tone}`);var h=BP();let _;o(V(h),()=>W(m),e=>{var n=zP(),r=V(n),a=e=>{{let n=J(()=>`width:${i()}px;height:${i()}px`),r=J(()=>me(`block`,u[t.tone])),a=J(()=>t.label?void 0:`true`);Fi(e,{get style(){return W(n)},get class(){return W(r)},get"aria-hidden"(){return W(a)},get"aria-label"(){return t.label}})}},o=e=>{var n=U(),r=R(n);{let e=J(()=>me(`block`,u[t.tone])),n=J(()=>t.label?void 0:`true`);C(r,()=>W(p),(r,a)=>{a(r,{get size(){return i()},strokeWidth:2.2,get class(){return W(e)},get"aria-hidden"(){return W(n)},get"aria-label"(){return t.label}})})}g(e,n)};k(r,e=>{W(c)?e(a):e(o,-1)}),d(n),g(e,n)}),d(h),F(e=>{s(h,1,e,`svelte-1ya8e7m`),_=l(h,``,_,{width:`${i()}px`,height:`${i()}px`})},[()=>x(me(`inline-flex shrink-0 items-center justify-center`,t.class))]),g(e,h),z()}var HP=h(`<article class="tool-result-error-card svelte-1utey9k"><div class="tool-header svelte-1utey9k"><!> <span class="badge svelte-1utey9k"> </span></div> <pre class="tool-error svelte-1utey9k"> </pre></article>`);function UP(e,t){a(t,!0);let n=J(()=>ii(t.error,{headLines:18,tailLines:6,maxChars:6e3}).text);var r=HP(),i=V(r),o=V(i);VP(o,{tone:`danger`,size:14,class:`mr-1.5 align-middle`});var s=L(o,2),c=V(s,!0);d(s),d(i);var l=L(i,2),u=V(l,!0);d(l),d(r),F(()=>{A(c,t.toolName),A(u,W(n))}),g(e,r),z()}var WP=h(`<div class="grid gap-3 p-6" aria-label="Loading subagent transcript"><!> <!> <!></div>`),GP=h(`<div class="grid place-items-center gap-3 p-8 text-center"><p class="m-0 text-sm text-destructive"> </p> <!></div>`),KP=h(`<span class="text-destructive"> </span>`),qP=h(`<div class="border-b bg-muted/30 px-4 py-2 text-xs text-muted-foreground"><!> <!></div>`),JP=h(`<div class="grid place-items-center p-8 text-sm text-muted-foreground">No transcript activity yet.</div>`),YP=h(`<article class="relative w-full min-w-0 p-3 text-sm"><!></article>`),XP=h(`<div class="min-w-0 px-3"><!></div>`),ZP=h(`<article class="min-w-0 p-3 text-sm"><!></article>`),QP=h(`<pre class="mt-2 whitespace-pre-wrap break-words rounded-md border border-destructive/40 bg-destructive/10 p-3 font-mono text-xs text-destructive"> </pre>`),$P=h(`<article><!> <!></article>`),eF=h(`<div class="relative min-h-0"><!> <!></div>`),tF=h(`<div class="grid h-full min-h-0 grid-rows-[auto_1fr]"><!> <!></div>`);function nF(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=Rk(),i=Y(void 0),o=Y(void 0),c=Y(!1),l=Y(void 0),u=Y(0),f=J(()=>Wt(W(o))),p=J(()=>{let e=CP(W(f).timeline).map(e=>({kind:`timeline`,key:e.key,node:e}));return W(o)?.sending&&!W(f).hasActiveTurnOutput&&e.push({kind:`waiting`,key:`__waiting__`}),e}),m=xP({active:()=>n(),conversationOpen:()=>n(),conversationId:()=>t.parentAgentId&&t.childAgentId?`subagent:${t.parentAgentId}:${t.childAgentId}`:void 0,contentReady:()=>W(p).length>0});function h(e){if(e.kind===`waiting`)return`waiting`;let t=e.node;return t.kind===`thinking_group`?t.items.map(e=>`${e.item.text.length}:${e.item.done?`done`:`open`}`).join(`|`):t.kind===`message`?[t.item.text.length,t.item.done?`done`:`open`,t.item.stopReason??`ok`,t.item.errorMessage?.length??0].join(`:`):t.kind===`tool`?t.toolCall?`${t.toolCall.status}:${t.toolCall.updatedAt}`:`draft:${t.draft?.block.argsText.length??0}`:t.key}be(()=>{let e=t.parentAgentId,a=t.childAgentId;if(W(u),!n()||!e||!a)return;let s=r.watchSubagentTranscript;if(!s){K(l,`Subagent transcripts are unavailable here.`);return}return K(c,!W(i)),K(l,void 0),s(e,a,{snapshot:t=>{t.parentAgentId!==e||t.agentId!==a||(K(i,t,!0),K(o,uee(t),!0),K(c,!1),K(l,void 0))},event:e=>{if(!W(o))return;let t=!1;return K(o,Ft(W(o),e,()=>{t=!0,K(l,`Live activity was interrupted; recovering the transcript.`)}),!0),!t},error:e=>{K(c,!1),K(l,e,!0)}})}),be(()=>{t.childAgentId&&(K(i,void 0),K(o,void 0),K(l,void 0))});function _(e){n(e),t.onOpenChange?.(e)}{let r=J(()=>`${t.label} transcript`),a=J(()=>W(i)?[W(i).status,W(i).model,W(i).thinkingLevel].filter(Boolean).join(` · `):`Read-only child-agent activity`);sP(e,{flush:!0,size:`wide-viewport`,get title(){return W(r)},get description(){return W(a)},onOpenChange:_,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var r=U(),a=R(r),o=e=>{var t=WP(),n=V(t);gN(n,{class:`h-16 w-3/4`});var r=L(n,2);gN(r,{class:`h-24 w-full`}),gN(L(r,2),{class:`h-20 w-4/5`}),d(t),g(e,t)},f=e=>{var t=GP(),n=V(t),r=V(n,!0);d(n),G(L(n,2),{size:`sm`,variant:`outline`,onclick:()=>K(u,W(u)+1),children:(e,t)=>{w(),g(e,M(`Retry`))},$$slots:{default:!0}}),d(t),F(()=>A(r,W(l))),g(e,t)},_=e=>{var n=tF(),r=V(n),a=e=>{var t=qP(),n=V(t),r=e=>{g(e,M(`Showing the assignment and most recent bounded activity.`))};k(n,e=>{(W(i).entriesTruncated||W(i).toolCallsTruncated)&&e(r)});var a=L(n,2),o=e=>{var t=KP(),n=V(t,!0);d(t),F(()=>A(n,W(l))),g(e,t)};k(a,e=>{W(l)&&e(o)}),d(t),g(e,t)};k(r,e=>{(W(i).entriesTruncated||W(i).toolCallsTruncated||W(l))&&e(a)});var o=L(r,2),c=e=>{g(e,JP())},u=e=>{var n=eF(),r=V(n);{let e=(e,t)=>{let n=()=>t?.().item;var r=U(),i=R(r),a=e=>{var t=YP();MP(V(t),{}),d(t),g(e,t)},o=e=>{var t=XP();OB(V(t),{get toolCall(){return n().node.toolCall},detailsEnabled:!1}),d(t),g(e,t)},c=e=>{var t=XP();UP(V(t),{get toolName(){return n().node.toolName},get error(){return n().node.error}}),d(t),g(e,t)},l=e=>{var t=ZP(),r=V(t);{let e=J(()=>n().node.items.map(e=>e.item));kP(r,{get items(){return W(e)}})}d(t),g(e,t)},u=e=>{var t=$P(),r=V(t),i=e=>{my(e,{get text(){return n().node.item.text},pending:!1})},a=e=>{{let t=J(()=>n().node.item.role!==`assistant`);Fk(e,{get text(){return n().node.item.text},get trimCodeBlocks(){return W(t)},get onCopy(){return Xx}})}};k(r,e=>{n().node.item.role===`user`?e(i):e(a,-1)});var o=L(r,2),c=e=>{var t=QP(),r=V(t,!0);d(t),F(()=>A(r,n().node.item.errorMessage)),g(e,t)};k(o,e=>{n().node.item.stopReason===`error`&&n().node.item.errorMessage&&e(c)}),d(t),F(()=>s(t,1,`min-w-0 p-3 text-sm ${n().node.item.role===`user`?`ml-auto w-fit max-w-[70%] rounded-lg rounded-br-sm border border-primary/20 bg-primary/10 px-3 py-2`:`w-full`}`)),g(e,t)};k(i,e=>{n().kind===`waiting`?e(a):n().node.kind===`tool`&&n().node.toolCall?e(o,1):n().node.kind===`tool_result_error`?e(c,2):n().node.kind===`thinking_group`?e(l,3):n().node.kind===`message`&&e(u,4)}),g(e,r)},n=J(()=>t.parentAgentId&&t.childAgentId?`subagent-transcript:${t.parentAgentId}:${t.childAgentId}`:void 0),i=J(()=>`${t.label} subagent transcript`);Ii(r,{get items(){return W(p)},getKey:e=>e.key,get heightCacheKey(){return W(n)},getMeasurementVersion:h,estimateSize:()=>112,overscan:10,anchor:`end`,get followOutput(){return m.followBottom},scrollEndThreshold:32,paddingStart:12,paddingEnd:12,gap:2,viewportTabIndex:0,get viewportAriaLabel(){return W(i)},viewportClass:`h-full px-3`,get controller(){return m.controller},set controller(e){m.controller=e},get atEnd(){return m.atEnd},set atEnd(e){m.atEnd=e},row:e,$$slots:{row:!0}})}var i=L(r,2),a=e=>{G(e,{size:`icon-sm`,variant:`secondary`,class:`absolute right-5 bottom-4 rounded-full shadow-md`,onclick:()=>m.jumpToBottom(),"aria-label":`Jump to latest subagent activity`,title:`Jump to latest`,children:(e,t)=>{Dv(e,{class:`size-4`,"aria-hidden":`true`})},$$slots:{default:!0}})};k(i,e=>{m.atEnd||e(a)}),d(n),g(e,n)};k(o,e=>{W(p).length===0?e(c):e(u,-1)}),d(n),g(e,n)};k(a,e=>{W(c)&&!W(i)?e(o):W(l)&&!W(i)?e(f,1):W(i)&&e(_,2)}),g(e,r)},$$slots:{default:!0}})}z()}var rF=h(`<strong class="min-w-0 truncate text-sm font-medium leading-tight"> </strong>`),iF=h(`<span class="shrink-0 rounded border px-1.5 py-0.5 text-xs leading-none text-muted-foreground"> </span>`),aF=h(`<span class="shrink-0 text-xs tabular-nums text-muted-foreground"> </span>`),oF=h(`<div class="grid gap-1" aria-hidden="true"><!> <!></div>`),sF=h(`<!> Transcript`,1),cF=h(`<!> Report`,1),lF=h(`<span class="inline-flex min-h-5 items-center rounded border bg-muted/30 px-1.5 py-0.5 text-xs tabular-nums text-muted-foreground"> </span>`),uF=h(`<div class="flex min-w-0 items-center gap-2"><p class="m-0 min-w-0 flex-1 truncate text-xs text-muted-foreground"> </p> <!></div> <div class="flex min-w-0 flex-wrap items-center gap-1.5"><!> <!> <!></div>`,1),dF=h(`<li class="grid min-w-0 gap-2 rounded-lg border bg-card px-3 py-2.5"><div class="flex min-w-0 items-center gap-2"><div class="flex min-w-0 flex-1 items-center gap-2"><!> <!></div> <span> </span> <!></div> <!></li>`),fF=h(`<div class="grid gap-2"><p class="sr-only" aria-live="polite"> </p> <ol class="grid gap-2"></ol></div> <!>`,1);function pF(e,t){a(t,!0);let n=J(()=>t.view?sb(t.view):void 0),r=J(()=>W(n)?.tasks??BN({args:t.draft?.block.args,argsText:t.draft?.block.argsText})),i=J(()=>W(n)?.summary),o=Y(void 0),c=Y(!1);be(()=>{if(!W(o))return;let e=W(r).find(e=>e.key===W(o)?.taskKey&&e.status!==`drafting`);if(!e?.agentId)return;let t=f(e);W(o).childAgentId===e.agentId&&W(o).label===t&&W(o).status===e.status||K(o,{...W(o),childAgentId:e.agentId,label:t,status:e.status},!0)});function l(e){return e.split(/[\\/]/).pop()||e}function u(e){return e.split(/[/:]/).pop()??e}function f(e){return e.label??e.task??`Explore ${(e.index??0)+1}`}function p(e){if(!(`model`in e))return;let t=[];return e.model&&t.push(u(e.model)),e.thinkingLevel&&t.push(e.thinkingLevel),t.length>0?t.join(` · `):void 0}function m(e,t){return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function h(e){let t=e.report?.usage;if(!t)return[];let n=[];t.turns&&n.push(m(t.turns,`turn`));let r=t.totalTokens||t.input+t.output;return r>0&&n.push(m(r,`token`)),n}function v(e){switch(e.status){case`drafting`:return`Drafting`;case`queued`:return`Queued`;case`running`:return`Running`;case`completed`:return`Completed`;case`failed`:return`Failed`;case`aborted`:return`Stopped`}}function y(e){switch(e.status){case`running`:return`text-info`;case`completed`:return`text-success`;case`failed`:return`text-destructive`;case`aborted`:return`text-warning`;default:return`text-muted-foreground`}}function b(e){return e.status===`queued`?`Waiting for an active-agent slot…`:e.status===`running`?e.currentAction??`Waiting for the first tool…`:e.status===`aborted`?e.error??`Agent run stopped.`:e.status===`failed`?e.error??`Agent run failed.`:e.report?.summaryPreview??`Investigation complete.`}function x(e){!e.agentId||!t.toolCall?.agentId||(K(o,{taskKey:e.key,parentAgentId:t.toolCall.agentId,childAgentId:e.agentId,label:f(e),status:e.status},!0),K(c,!0))}let S=J(()=>{if(!W(i))return`Preparing explore agents`;let e=W(i).completed+W(i).failed+W(i).aborted,t=[W(i).failed>0?`${W(i).failed} failed`:void 0,W(i).aborted>0?`${W(i).aborted} stopped`:void 0].filter(Boolean);return`${e} of ${W(i).total} finished${t.length?` · ${t.join(` · `)}`:``}`});var C=fF(),T=R(C),E=V(T),D=V(E,!0);d(E);var O=L(E,2);_(O,21,()=>W(r),e=>e.key,(e,n)=>{let r=J(()=>p(W(n)));var i=dF(),a=V(i),o=V(a),c=V(o),u=e=>{gN(e,{class:`h-4 w-2/5`})},S=e=>{var t=rF(),r=V(t,!0);d(t),F(e=>A(r,e),[()=>f(W(n))]),g(e,t)};k(c,e=>{W(n).status===`drafting`&&!W(n).label&&!W(n).task?e(u):e(S,-1)});var C=L(c,2),T=e=>{var t=iF(),n=V(t,!0);d(t),F(()=>A(n,W(r))),g(e,t)};k(C,e=>{W(r)&&e(T)}),d(o);var E=L(o,2),D=V(E,!0);d(E);var O=L(E,2),ee=e=>{var t=aF(),r=V(t);d(t),F(()=>A(r,`${(W(n).index??0)+1}/${W(n).count??``}`)),g(e,t)};k(O,e=>{(W(n).count??0)>1&&e(ee)}),d(a);var te=L(a,2),ne=e=>{var t=oF(),n=V(t);gN(n,{class:`h-3 w-full`}),gN(L(n,2),{class:`h-3 w-2/3`}),d(t),g(e,t)},j=e=>{var r=uF(),i=R(r),a=V(i),o=V(a,!0);d(a);var s=L(a,2),c=e=>{var t=aF(),r=V(t,!0);d(t),F(e=>A(r,e),[()=>m(W(n).actionCount,`action`)]),g(e,t)};k(s,e=>{W(n).status===`running`&&W(n).actionCount>0&&e(c)}),d(i);var u=L(i,2),p=V(u),v=e=>{{let t=J(()=>`View transcript for ${f(W(n))}`);G(e,{size:`xs`,variant:`outline`,class:`h-5 gap-1 rounded px-1.5 text-xs shadow-none`,onclick:()=>x(W(n)),get"aria-label"(){return W(t)},children:(e,t)=>{var n=sF();zN(R(n),{class:`size-3`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}};k(p,e=>{W(n).agentId&&t.toolCall?.agentId&&e(v)});var y=L(p,2),S=e=>{{let r=J(()=>`Open report ${l(W(n).report.reportPath)}`);G(e,{size:`xs`,variant:`outline`,class:`h-5 gap-1 rounded px-1.5 text-xs shadow-none`,onclick:()=>W(n).report?.reportPath&&t.onOpenFile?.(W(n).report.reportPath),get title(){return W(n).report.reportPath},get"aria-label"(){return W(r)},children:(e,t)=>{var n=cF();Hu(R(n),{class:`size-3`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}};k(y,e=>{W(n).report?.reportPath&&e(S)}),_(L(y,2),16,()=>h(W(n)),e=>e,(e,t)=>{var n=lF(),r=V(n,!0);d(n),F(()=>A(r,t)),g(e,n)}),d(u),F(e=>A(o,e),[()=>b(W(n))]),g(e,r)};k(te,e=>{W(n).status===`drafting`?e(ne):e(j,-1)}),d(i),F((e,t)=>{q(i,`data-status`,W(n).status),s(E,1,e),A(D,t)},[()=>`shrink-0 text-xs font-medium ${y(W(n))}`,()=>v(W(n))]),g(e,i)}),d(O),d(T);var ee=L(T,2),te=e=>{nF(e,{get parentAgentId(){return W(o).parentAgentId},get childAgentId(){return W(o).childAgentId},get label(){return W(o).label},onOpenChange:e=>K(c,e,!0),get open(){return W(c)},set open(e){K(c,e,!0)}})};k(ee,e=>{W(o)&&e(te)}),F(()=>A(D,W(S))),g(e,C),z()}var mF=h(`<p class="m-0 text-xs text-muted-foreground">No files found.</p>`),hF=h(`<li><button type="button" class="cursor-pointer border-0 bg-transparent p-0 text-left font-mono text-xs text-primary hover:underline"> </button></li>`),gF=h(`<ul class="m-0 list-none rounded-sm border bg-sidebar px-2.5 py-2 font-mono text-xs leading-snug text-sidebar-foreground"></ul>`);function _F(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),i=J(()=>(n()?t.view.paths:t.view.paths.slice(0,6)).map((e,n)=>({path:e,openPath:t.view.openPaths[n]??e})));var o=U(),s=R(o),c=e=>{g(e,mF())},l=e=>{var n=gF();_(n,21,()=>W(i),e=>e.path,(e,n)=>{var i=hF(),a=V(i),o=V(a,!0);d(a),d(i),F(()=>A(o,W(n).path)),r(`click`,a,()=>t.onOpenFile?.(W(n).openPath)),g(e,i)}),d(n),g(e,n)};k(s,e=>{t.view.count===0&&t.toolCall.status===`completed`?e(c):t.view.count>0&&e(l,1)}),g(e,o),z()}T([`click`]);var vF=h(`<div class="grid gap-1.5"><p class="m-0 text-xs font-medium text-muted-foreground">Result</p> <p> </p></div>`),yF=h(`<p class="m-0 text-xs text-muted-foreground">No output.</p>`),bF=h(`<div class="grid gap-1.5"><p class="m-0 text-xs font-medium text-muted-foreground">Recorded arguments</p> <!></div>`),xF=h(`<div class="grid gap-2" aria-label="Recorded tool output"><!> <!></div>`);function SF(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>t.view.result.length>0?{kind:`key-values`,items:t.view.result.map(e=>({label:e.key,value:e.value,mono:!0,tone:e.redacted?`warning`:void 0}))}:void 0),i=J(()=>({kind:`key-values`,items:t.view.args.map(e=>({label:e.key,value:e.value,mono:!0,tone:e.redacted?`warning`:void 0}))}));var o=xF(),c=V(o),l=e=>{var r=vF(),i=L(V(r),2);let a;var o=V(i,!0);d(i),d(r),F(()=>{a=s(i,1,`m-0 whitespace-pre-wrap text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]`,null,a,{"line-clamp-6":!n()}),A(o,t.view.resultText)}),g(e,r)},u=e=>{DN(e,{get body(){return W(r)}})},f=e=>{g(e,yF())};k(c,e=>{t.view.resultText?e(l):W(r)?e(u,1):t.toolCall.status===`completed`&&e(f,2)});var p=L(c,2),m=e=>{var t=bF();DN(L(V(t),2),{get body(){return W(i)}}),d(t),g(e,t)};k(p,e=>{t.view.args.length>0&&(t.toolCall.status===`error`||t.toolCall.status===`denied`)&&e(m)}),d(o),g(e,o),z()}var CF=h(`<button class="match svelte-17w44lw" type="button"><span class="line-no svelte-17w44lw"> </span><span class="line-text svelte-17w44lw"> </span></button>`),wF=h(`<div class="file"><button class="file-path svelte-17w44lw" type="button" title="Open file pane"> </button> <!></div>`),TF=h(`<div class="matches svelte-17w44lw"></div>`),EF=h(`<p class="note svelte-17w44lw">No matches.</p>`);function DF(e,t){a(t,!0);let n=(e,n=D)=>{var i=TF();_(i,21,n,e=>e.path,(e,n)=>{var i=wF(),a=V(i),o=V(a,!0);d(a),_(L(a,2),19,()=>W(n).matches,(e,t)=>`${W(n).path}:${e.line}:${t}:${e.text}`,(e,i)=>{var a=CF(),o=V(a),s=V(o,!0);d(o);var c=L(o),l=V(c,!0);d(c),d(a),F(()=>{q(a,`title`,`Open ${W(n).path}:${W(i).line}`),A(s,W(i).line),A(l,W(i).text)}),r(`click`,a,()=>t.onOpenFile?.(W(i).openPath??W(n).openPath??W(n).path,W(i).line)),g(e,a)}),d(i),F(()=>A(o,W(n).path)),r(`click`,a,()=>t.onOpenFile?.(W(n).openPath??W(n).path)),g(e,i)}),d(i),g(e,i)},i=I(t,`expanded`,3,!1),o=J(()=>{if(i())return t.view.allMatches;let e=[],n=0;for(let r of t.view.allMatches){if(n>=6)break;let t=r.matches.slice(0,6-n);e.push({path:r.path,openPath:r.openPath,matches:t}),n+=t.length}return e});var s=U(),c=R(s),l=e=>{g(e,EF())},u=e=>{n(e,()=>W(o))};k(c,e=>{t.view.matchCount===0&&t.toolCall.status===`completed`?e(l):t.view.matchCount>0&&e(u,1)}),g(e,s),z()}T([`click`]);var OF=new Set([`$$slots`,`$$events`,`$$legacy`]);function kF(e,t){let n=H(t,OF),r=[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}]];P(e,B({name:`tag`},()=>n,{get iconNode(){return r}}))}var AF=h(`<span class="min-w-0 break-words text-xs font-medium text-sidebar-foreground"> </span>`),jF=h(`<span class="inline-flex items-center gap-1 text-xs text-muted-foreground"><!> </span>`),MF=h(`<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>`),NF=h(`<div class="grid gap-1 rounded-sm border bg-sidebar px-2.5 py-2"><div class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1"><!> <span class="font-mono text-xs text-muted-foreground"> </span></div> <!></div>`);function PF(e,t){a(t,!0);let n=J(()=>t.field.allowedValues??[]);var r=NF(),i=V(r),o=V(i),s=e=>{var n=AF(),r=V(n,!0);d(n),F(()=>A(r,t.field.name)),g(e,n)};k(o,e=>{t.field.name&&e(s)});var c=L(o,2),l=V(c,!0);d(c),d(i);var u=L(i,2),f=e=>{var r=MF(),i=V(r),a=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.field.type)),g(e,r)},$$slots:{default:!0}})};k(i,e=>{t.field.type&&e(a)});var o=L(i,2),s=e=>{Ri(e,{tone:`warn`,size:`xs`,children:(e,t)=>{w(),g(e,M(`required`))},$$slots:{default:!0}})};k(o,e=>{t.field.required&&e(s)});var c=L(o,2),l=e=>{Ri(e,{tone:`accent`,size:`xs`,children:(e,t)=>{w(),g(e,M(`custom`))},$$slots:{default:!0}})};k(c,e=>{t.field.custom&&e(l)});var u=L(c,2),f=e=>{var t=jF(),r=V(t);kF(r,{size:11,strokeWidth:2});var i=L(r);d(t),F(e=>{q(t,`title`,e),A(i,` ${W(n).length??``} allowed`)},[()=>W(n).join(`, `)]),g(e,t)};k(u,e=>{W(n).length>0&&e(f)}),d(r),g(e,r)};k(u,e=>{(t.field.type||t.field.required||t.field.custom||W(n).length>0)&&e(f)}),d(r),F(()=>A(l,t.field.id)),g(e,r),z()}var FF=new Set([`$$slots`,`$$events`,`$$legacy`]);function IF(e,t){let n=H(t,FF),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 6v6l4 2`}]];P(e,B({name:`clock`},()=>n,{get iconNode(){return r}}))}var LF=new Set([`$$slots`,`$$events`,`$$legacy`]);function RF(e,t){let n=H(t,LF),r=[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`}],[`circle`,{cx:`12`,cy:`7`,r:`4`}]];P(e,B({name:`user`},()=>n,{get iconNode(){return r}}))}function zF(e){if(!e)return``;let t=new Date(e).getTime();if(Number.isNaN(t))return``;let n=Date.now()-t,r=Math.round(n/1e3);if(r<45)return`now`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);if(a<24)return`${a}h`;let o=Math.round(a/24);if(o<7)return`${o}d`;let s=Math.round(o/7);if(s<5)return`${s}w`;let c=Math.round(o/30);return c<12?`${c}mo`:`${Math.round(o/365)}y`}function BF(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function VF(e,t){switch(t?.toLowerCase()){case`new`:return`neutral`;case`indeterminate`:return`running`;case`done`:return`good`}let n=e?.toLowerCase()??``;return n?/block/.test(n)?`danger`:/progress|review|doing|started/.test(n)?`running`:/done|closed|resolved|complete/.test(n)?`good`:`neutral`:`neutral`}function HF(e){switch(e?.toLowerCase()){case`highest`:return`danger`;case`high`:return`warn`;case`medium`:case`low`:case`lowest`:return`neutral`;default:return}}function UF(e,t){let n=e?.trim().replace(/\/+$/,``);if(n)return`${n}/browse/${encodeURIComponent(t)}`}function WF(e){let t=e.displayName?.trim()||e.emailAddress?.trim()||``;if(t){let e=t.split(/[\s@._-]+/).filter(Boolean);if(e.length>=2)return(e[0][0]+e[1][0]).toUpperCase();if(e.length===1)return e[0].slice(0,2).toUpperCase()}return e.accountId.slice(0,2).toUpperCase()}var GF=new Set([`$$slots`,`$$events`,`$$legacy`]);function KF(e,t){let n=H(t,GF),r=[[`path`,{d:`M10 2v8l3-3 3 3V2`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`}]];P(e,B({name:`book-marked`},()=>n,{get iconNode(){return r}}))}var qF=new Set([`$$slots`,`$$events`,`$$legacy`]);function JF(e,t){let n=H(t,qF),r=[[`path`,{d:`M12 20v-9`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`}],[`path`,{d:`M14.12 3.88 16 2`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`}],[`path`,{d:`M22 13h-4`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`}],[`path`,{d:`M6 13H2`}],[`path`,{d:`m8 2 1.88 1.88`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`}]];P(e,B({name:`bug`},()=>n,{get iconNode(){return r}}))}var YF=new Set([`$$slots`,`$$events`,`$$legacy`]);function XF(e,t){let n=H(t,YF),r=[[`path`,{d:`m18 15-6-6-6 6`}]];P(e,B({name:`chevron-up`},()=>n,{get iconNode(){return r}}))}var ZF=new Set([`$$slots`,`$$events`,`$$legacy`]);function QF(e,t){let n=H(t,ZF),r=[[`path`,{d:`m7 6 5 5 5-5`}],[`path`,{d:`m7 13 5 5 5-5`}]];P(e,B({name:`chevrons-down`},()=>n,{get iconNode(){return r}}))}var $F=new Set([`$$slots`,`$$events`,`$$legacy`]);function eI(e,t){let n=H(t,$F),r=[[`path`,{d:`m17 11-5-5-5 5`}],[`path`,{d:`m17 18-5-5-5 5`}]];P(e,B({name:`chevrons-up`},()=>n,{get iconNode(){return r}}))}var tI=new Set([`$$slots`,`$$events`,`$$legacy`]);function nI(e,t){let n=H(t,tI),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`circle`,{cx:`12`,cy:`12`,r:`1`}]];P(e,B({name:`circle-dot`},()=>n,{get iconNode(){return r}}))}var rI=new Set([`$$slots`,`$$events`,`$$legacy`]);function iI(e,t){let n=H(t,rI),r=[[`line`,{x1:`5`,x2:`19`,y1:`9`,y2:`9`}],[`line`,{x1:`5`,x2:`19`,y1:`15`,y2:`15`}]];P(e,B({name:`equal`},()=>n,{get iconNode(){return r}}))}var aI=new Set([`$$slots`,`$$events`,`$$legacy`]);function oI(e,t){let n=H(t,aI),r=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]];P(e,B({name:`git-branch`},()=>n,{get iconNode(){return r}}))}var sI=new Set([`$$slots`,`$$events`,`$$legacy`]);function cI(e,t){let n=H(t,sI),r=[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`}],[`path`,{d:`m9 11 3 3L22 4`}]];P(e,B({name:`square-check-big`},()=>n,{get iconNode(){return r}}))}function lI(e){let t=e?.toLowerCase()??``;return t.includes(`epic`)?Sg:t.includes(`story`)?KF:t.includes(`bug`)?JF:t.includes(`subtask`)||t.includes(`sub-task`)?oI:t.includes(`task`)?cI:nI}function uI(e){let t=HF(e);if(t)return{icon:{highest:eI,high:XF,medium:iI,low:ln,lowest:QF}[e?.toLowerCase()??``],tone:t}}var dI=h(`<a class="inline-flex items-center gap-1 font-mono text-xs font-semibold text-primary no-underline hover:underline" target="_blank" rel="noreferrer noopener"> <!></a>`),fI=h(`<span class="font-mono text-xs font-semibold text-primary"> </span>`),pI=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),mI=h(`<span><!> </span>`),hI=h(`<span class="inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground"><!> <span class="truncate"> </span></span>`),gI=h(`<span class="ml-auto inline-flex items-center gap-1 text-xs text-muted-foreground"><!> </span>`),_I=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!> <!> <!></div>`),vI=h(`<div class="grid gap-1.5 rounded-sm border bg-sidebar px-2.5 py-2"><div class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1"><span class="inline-flex items-center gap-1.5"><!> <!></span> <!></div> <!></div>`);function yI(e,t){a(t,!0);let n=J(()=>UF(t.siteUrl,t.issue.key)),r=J(()=>lI(t.issue.issueType)),i=J(()=>VF(t.issue.status,t.issue.statusCategory)),o=J(()=>uI(t.issue.priority)),c=J(()=>t.issue.assignee??t.assigneeFallback),l=J(()=>zF(t.issue.updated)),u=J(()=>!!(t.issue.status||t.issue.priority||W(c)||W(l))),f={neutral:`text-muted-foreground`,accent:`text-foreground`,running:`text-info`,good:`text-success`,warn:`text-warning`,danger:`text-destructive`},p=J(()=>W(o)?f[W(o).tone??`neutral`]:`text-muted-foreground`);var m=vI(),h=V(m),_=V(h),v=V(_);C(v,()=>W(r),(e,n)=>{n(e,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`,get"aria-label"(){return t.issue.issueType}})});var y=L(v,2),b=e=>{var r=dI(),i=V(r);YM(L(i),{size:11,strokeWidth:2,class:`opacity-70`}),d(r),F(()=>{q(r,`href`,W(n)),q(r,`title`,`Open ${t.issue.key} in Jira`),A(i,`${t.issue.key??``} `)}),g(e,r)},x=e=>{var n=fI(),r=V(n,!0);d(n),F(()=>A(r,t.issue.key)),g(e,n)};k(y,e=>{W(n)?e(b):e(x,-1)}),d(_);var S=L(_,2),T=e=>{var n=pI(),r=V(n,!0);d(n),F(()=>A(r,t.issue.summary)),g(e,n)};k(S,e=>{t.issue.summary&&e(T)}),d(h);var E=L(h,2),D=e=>{var n=_I(),r=V(n),a=e=>{Ri(e,{get tone(){return W(i)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.issue.status)),g(e,r)},$$slots:{default:!0}})};k(r,e=>{t.issue.status&&e(a)});var u=L(r,2),f=e=>{let n=J(()=>W(o).icon);var r=mI(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{size:13,strokeWidth:2.2})});var a=L(i);d(r),F(()=>{s(r,1,`inline-flex items-center gap-1 text-xs ${W(p)}`),q(r,`title`,`Priority: ${t.issue.priority}`),A(a,` ${t.issue.priority??``}`)}),g(e,r)};k(u,e=>{W(o)&&e(f)});var m=L(u,2),h=e=>{var t=hI(),n=V(t);RF(n,{size:12,strokeWidth:2,class:`shrink-0`});var r=L(n,2),i=V(r,!0);d(r),d(t),F(()=>A(i,W(c))),g(e,t)};k(m,e=>{W(c)&&e(h)});var _=L(m,2),v=e=>{var n=gI(),r=V(n);IF(r,{size:12,strokeWidth:2});var i=L(r);d(n),F(e=>{q(n,`title`,e),A(i,` ${W(l)??``}`)},[()=>`Updated ${BF(t.issue.updated)}`]),g(e,n)};k(_,e=>{W(l)&&e(v)}),d(n),g(e,n)};k(E,e=>{W(u)&&e(D)}),d(m),g(e,m),z()}var bI=h(`<span class="inline-flex items-center gap-1.5 rounded-sm border bg-sidebar px-2 py-1 text-xs"><span class="font-semibold tabular-nums text-sidebar-foreground"> </span> <span class="text-muted-foreground"> </span></span>`),xI=h(`<div class="flex flex-wrap gap-1.5"></div>`);function SI(e,t){a(t,!0);let n=[[`comments`,`Comments`],[`transitions`,`Transitions`],[`statuses`,`Statuses`],[`components`,`Components`],[`versions`,`Versions`],[`issueTypes`,`Issue types`],[`fields`,`Fields`],[`priorities`,`Priorities`],[`resolutions`,`Resolutions`],[`worklogs`,`Worklogs`],[`changelog`,`Changelog`],[`remoteLinks`,`Remote links`],[`attachments`,`Attachments`],[`editmetaFields`,`Edit fields`]],r=J(()=>n.flatMap(([e,n])=>{let r=t.counts[e];return typeof r==`number`?[{label:n,value:r}]:[]}));var i=U(),o=R(i),s=e=>{var t=xI();_(t,21,()=>W(r),e=>e.label,(e,t)=>{var n=bI(),r=V(n),i=V(r,!0);d(r);var a=L(r,2),o=V(a,!0);d(a),d(n),F(e=>{A(i,e),A(o,W(t).label)},[()=>W(t).value.toLocaleString()]),g(e,n)}),d(t),g(e,t)};k(o,e=>{W(r).length>0&&e(s)}),g(e,i),z()}var CI=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),wI=h(`<span class="inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground"><!> <span class="truncate"> </span></span>`),TI=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!></div>`),EI=h(`<div class="grid gap-1.5 rounded-sm border bg-sidebar px-2.5 py-2"><div class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1"><span class="font-mono text-xs font-semibold text-primary"> </span> <!></div> <!></div>`);function DI(e,t){a(t,!0);var n=EI(),r=V(n),i=V(r),o=V(i,!0);d(i);var s=L(i,2),c=e=>{var n=CI(),r=V(n,!0);d(n),F(()=>A(r,t.project.name)),g(e,n)};k(s,e=>{t.project.name&&e(c)}),d(r);var l=L(r,2),u=e=>{var n=TI(),r=V(n),i=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.project.projectTypeKey)),g(e,r)},$$slots:{default:!0}})};k(r,e=>{t.project.projectTypeKey&&e(i)});var a=L(r,2),o=e=>{var n=wI(),r=V(n);RF(r,{size:12,strokeWidth:2,class:`shrink-0`});var i=L(r,2),a=V(i,!0);d(i),d(n),F(()=>A(a,t.project.lead)),g(e,n)};k(a,e=>{t.project.lead&&e(o)}),d(n),g(e,n)};k(l,e=>{(t.project.projectTypeKey||t.project.lead)&&e(u)}),d(n),F(()=>A(o,t.project.key)),g(e,n),z()}var OI=new Set([`$$slots`,`$$events`,`$$legacy`]);function kI(e,t){let n=H(t,OI),r=[[`path`,{d:`M5 12h14`}],[`path`,{d:`m12 5 7 7-7 7`}]];P(e,B({name:`arrow-right`},()=>n,{get iconNode(){return r}}))}var AI=h(`<!> <!>`,1),jI=h(`<div class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 rounded-sm border bg-sidebar px-2.5 py-2"><span class="rounded-sm border bg-muted/40 px-1.5 py-0.5 font-mono text-xs text-muted-foreground"> </span> <span class="text-xs font-medium text-sidebar-foreground"> </span> <!></div>`);function MI(e,t){a(t,!0);let n=J(()=>t.transition.name??`(unnamed)`),r=J(()=>VF(t.transition.to,t.transition.toStatusCategory)),i=J(()=>!!(t.transition.to&&t.transition.to!==t.transition.name));var o=jI(),s=V(o),c=V(s,!0);d(s);var l=L(s,2),u=V(l,!0);d(l);var f=L(l,2),p=e=>{var n=AI(),i=R(n);kI(i,{size:13,strokeWidth:2,class:`text-muted-foreground`}),Ri(L(i,2),{get tone(){return W(r)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.transition.to)),g(e,r)},$$slots:{default:!0}}),g(e,n)},m=e=>{Ri(e,{get tone(){return W(r)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.transition.to)),g(e,r)},$$slots:{default:!0}})};k(f,e=>{W(i)?e(p):t.transition.to&&e(m,1)}),d(o),F(()=>{A(c,t.transition.id),A(u,W(n))}),g(e,o),z()}var NI=h(`<span class="min-w-0 truncate font-mono text-xs text-muted-foreground"> </span>`),PI=h(`<div class="flex min-w-0 items-center gap-2.5 rounded-sm border bg-sidebar px-2.5 py-2"><span class="flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground" aria-hidden="true"> </span> <div class="grid min-w-0 flex-1 gap-0.5"><div class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1"><span class="min-w-0 truncate text-xs font-medium text-sidebar-foreground"> </span> <!> <!> <!></div> <span class="truncate font-mono text-xs text-muted-foreground/80"> </span></div></div>`);function FI(e,t){a(t,!0);let n=J(()=>WF(t.user)),r=J(()=>t.user.displayName??t.user.emailAddress??t.user.accountId);var i=PI(),o=V(i),s=V(o,!0);d(o);var c=L(o,2),l=V(c),u=V(l),f=V(u,!0);d(u);var p=L(u,2),m=e=>{var n=NI(),r=V(n,!0);d(n),F(()=>A(r,t.user.emailAddress)),g(e,n)};k(p,e=>{t.user.emailAddress&&t.user.emailAddress!==W(r)&&e(m)});var h=L(p,2),_=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.user.accountType)),g(e,r)},$$slots:{default:!0}})};k(h,e=>{t.user.accountType&&e(_)});var v=L(h,2),y=e=>{Ri(e,{tone:`warn`,size:`xs`,children:(e,t)=>{w(),g(e,M(`inactive`))},$$slots:{default:!0}})};k(v,e=>{t.user.active===!1&&e(y)}),d(l);var b=L(l,2),x=V(b,!0);d(b),d(c),d(i),F(()=>{A(s,W(n)),A(f,W(r)),A(x,t.user.accountId)}),g(e,i),z()}var II=(e,t=D)=>{var n=LI(),r=V(n,!0);d(n),F(()=>A(r,t())),g(e,n)},LI=h(`<span class="text-xs font-medium text-muted-foreground"> </span>`),RI=h(`<!> <!>`,1),zI=h(`<!> <!> <!>`,1),BI=h(`<span class="text-xs text-muted-foreground"> </span>`),VI=h(`<div class="flex flex-wrap items-center gap-1"><!> <!></div>`),HI=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),UI=h(`<div class="grid gap-1.5"><!> <!> <!></div>`),WI=h(`<p class="m-0 text-xs text-muted-foreground">No Jira summary available. Open Details for raw arguments and result.</p>`);function GI(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=Rk(),i=J(()=>r.atlassian?.jiraSiteUrl()),o=J(()=>n()?1/0:5),s=J(()=>vM(t.view,t.toolCall.status)),c=J(()=>bM(t.view,t.toolCall.status)),l=J(()=>SM(t.view,t.toolCall.status)),u=J(()=>W(l)?void 0:pM(t.toolCall,t.view,{expanded:n()})),f=J(()=>t.view.updatedFields??[]),p=J(()=>Math.max(0,W(f).length-W(o)));var m=U(),h=R(m),v=e=>{var n=UI(),r=V(n),a=e=>{{let t=J(()=>W(s).tone===`info`?rj:fv);TM(e,{get text(){return W(s).text},get tone(){return W(s).tone},get icon(){return W(t)}})}};k(r,e=>{W(s)&&e(a)});var l=L(r,2),u=e=>{var n=U();_(R(n),17,()=>t.view.issues.slice(0,W(o)),e=>e.key,(e,t)=>{yI(e,{get issue(){return W(t)},get siteUrl(){return W(i)}})}),g(e,n)},m=e=>{var n=U();_(R(n),17,()=>t.view.users.slice(0,W(o)),e=>e.accountId,(e,t)=>{FI(e,{get user(){return W(t)}})}),g(e,n)},h=e=>{var n=zI(),r=R(n),a=e=>{yI(e,{get issue(){return t.view.issue},get siteUrl(){return W(i)}})};k(r,e=>{t.view.issue&&e(a)});var s=L(r,2),c=e=>{SI(e,{get counts(){return t.view.includedCounts}})};k(s,e=>{t.view.includedCounts&&e(c)});var l=L(s,2),u=e=>{var n=RI(),r=R(n);II(r,()=>`Transitions`),_(L(r,2),17,()=>t.view.transitions.slice(0,W(o)),e=>e.id,(e,t)=>{MI(e,{get transition(){return W(t)}})}),g(e,n)};k(l,e=>{t.view.transitions.length>0&&e(u)}),g(e,n)},v=e=>{var n=zI(),r=R(n),i=e=>{DI(e,{get project(){return t.view.project}})};k(r,e=>{t.view.project&&e(i)});var a=L(r,2),s=e=>{SI(e,{get counts(){return t.view.includedCounts}})};k(a,e=>{t.view.includedCounts&&e(s)});var c=L(a,2),l=e=>{var n=RI(),r=R(n);II(r,()=>`Fields`),_(L(r,2),17,()=>t.view.fields.slice(0,W(o)),e=>e.id,(e,t)=>{PF(e,{get field(){return W(t)}})}),g(e,n)};k(c,e=>{t.view.fields.length>0&&e(l)}),g(e,n)},y=e=>{var n=RI(),r=R(n),a=e=>{yI(e,{get issue(){return t.view.issue},get siteUrl(){return W(i)}})};k(r,e=>{t.view.issue&&e(a)});var o=L(r,2),s=e=>{var n=RI(),r=R(n);II(r,()=>`Assignee`),FI(L(r,2),{get user(){return t.view.resolvedAssignee}}),g(e,n)};k(o,e=>{t.view.resolvedAssignee&&e(s)}),g(e,n)},b=e=>{var n=zI(),r=R(n),a=e=>{var t=VI(),n=V(t);_(n,16,()=>W(f).slice(0,W(o)),e=>e,(e,t)=>{Ri(e,{tone:`neutral`,size:`xs`,class:`font-mono`,children:(e,n)=>{w();var r=M();F(()=>A(r,t)),g(e,r)},$$slots:{default:!0}})});var r=L(n,2),i=e=>{var t=BI(),n=V(t);d(t),F(()=>A(n,`+${W(p)??``} more`)),g(e,t)};k(r,e=>{W(p)>0&&e(i)}),d(t),g(e,t)};k(r,e=>{W(f).length>0&&e(a)});var s=L(r,2),c=e=>{yI(e,{get issue(){return t.view.issue},get siteUrl(){return W(i)}})};k(s,e=>{t.view.issue&&e(c)});var l=L(s,2),u=e=>{var n=RI(),r=R(n);II(r,()=>`Assignee`),FI(L(r,2),{get user(){return t.view.resolvedAssignee}}),g(e,n)};k(l,e=>{t.view.resolvedAssignee&&e(u)}),g(e,n)},x=e=>{var n=RI(),r=R(n),i=e=>{MI(e,{get transition(){return t.view.transition}})},a=e=>{var n=RI(),r=R(n);II(r,()=>`Available transitions`),_(L(r,2),17,()=>t.view.transitions.slice(0,W(o)),e=>e.id,(e,t)=>{MI(e,{get transition(){return W(t)}})}),g(e,n)};k(r,e=>{t.view.transition?e(i):t.view.transitions.length>0&&e(a,1)});var s=L(r,2),c=e=>{var n=RI(),r=R(n);II(r,()=>`Transition fields`),_(L(r,2),17,()=>t.view.fields.slice(0,W(o)),e=>e.id,(e,t)=>{PF(e,{get field(){return W(t)}})}),g(e,n)};k(s,e=>{t.view.fields.length>0&&e(c)}),g(e,n)};k(l,e=>{t.view.action===`search_issues`?e(u):t.view.action===`search_users`?e(m,1):t.view.action===`get_issue`?e(h,2):t.view.action===`get_project`?e(v,3):t.view.action===`create_issue`?e(y,4):t.view.action===`update_issue`?e(b,5):t.view.action===`transition_issue`&&e(x,6)});var S=L(l,2),C=e=>{var t=HI(),n=V(t,!0);d(t),F(()=>A(n,W(c))),g(e,t)};k(S,e=>{W(c)&&e(C)}),d(n),g(e,n)},y=e=>{{let t=J(()=>({kind:`atlassian-summary`,text:W(u)}));DN(e,{get body(){return W(t)}})}},b=e=>{g(e,WI())};k(h,e=>{W(l)?e(v):W(u)?e(y,1):t.toolCall.status===`completed`&&e(b,2)}),g(e,m),z()}var KI=h(`<p class="m-0 text-xs text-muted-foreground">Empty directory.</p>`),qI=h(`<button type="button" class="cursor-pointer border-0 bg-transparent p-0 text-left font-mono text-xs text-primary hover:underline"> </button>`),JI=h(`<span> </span>`),YI=h(`<li class="flex items-center gap-1.5"><!> <!></li>`),XI=h(`<ul class="m-0 list-none rounded-sm border bg-sidebar px-2.5 py-2 font-mono text-xs leading-normal text-sidebar-foreground"></ul>`);function ZI(e,t){a(t,!0);let n=I(t,`expanded`,3,!1);function i(e){return[...e].sort((e,t)=>e.kind===t.kind?e.path.localeCompare(t.path):e.kind===`directory`?-1:1)}let o=J(()=>i(t.view.entries)),s=J(()=>n()?W(o):W(o).slice(0,6));var c=U(),l=R(c),u=e=>{g(e,KI())},f=e=>{var n=XI();_(n,21,()=>W(s),e=>e.path,(e,n)=>{var i=YI(),a=V(i),o=e=>{fn(e,{size:12,strokeWidth:2,class:`flex-none text-muted-foreground`})},s=e=>{Pp(e,{size:12,strokeWidth:2,class:`flex-none text-muted-foreground`})};k(a,e=>{W(n).kind===`directory`?e(o):e(s,-1)});var c=L(a,2),l=e=>{var i=qI(),a=V(i,!0);d(i),F(()=>A(a,W(n).path)),r(`click`,i,()=>t.onOpenFile?.(W(n).openPath??W(n).path)),g(e,i)},u=e=>{var t=JI(),r=V(t,!0);d(t),F(()=>A(r,W(n).path)),g(e,t)};k(c,e=>{W(n).kind===`file`?e(l):e(u,-1)}),d(i),g(e,i)}),d(n),g(e,n)};k(l,e=>{t.view.total===0&&t.toolCall.status===`completed`?e(u):t.view.total>0&&e(f,1)}),g(e,c),z()}T([`click`]);var QI=new Set([`$$slots`,`$$events`,`$$legacy`]);function $I(e,t){let n=H(t,QI),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];P(e,B({name:`check`},()=>n,{get iconNode(){return r}}))}var eL=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function tL(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=H(t,eL);var i=U();C(R(i),()=>Rs,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),z()}h(`<span class="absolute right-2 flex items-center justify-center pointer-events-none" data-slot="dropdown-menu-checkbox-item-indicator"><!></span> <!>`,1);var nL=new Set([`$$slots`,`$$events`,`$$legacy`]);function rL(e,t){let n=H(t,nL);var r=U();C(R(r),()=>Ue,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var iL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`sideOffset`,`align`,`portalProps`,`class`]);function aL(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`sideOffset`,3,4),i=I(t,`align`,3,`start`),o=H(t,iL);rL(e,B(()=>t.portalProps,{children:(e,a)=>{var s=U(),c=R(s);{let e=J(()=>me(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-md p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 w-(--bits-dropdown-menu-anchor-width) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden`,t.class));C(c,()=>Vs,(t,a)=>{a(t,B({"data-slot":`dropdown-menu-content`,get sideOffset(){return r()},get align(){return i()},get class(){return W(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,s)},$$slots:{default:!0}})),z()}var oL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`variant`]);function sL(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`variant`,3,`default`),i=H(t,oL);var o=U(),s=R(o);{let e=J(()=>me(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2 rounded-sm px-2 py-1.5 text-sm data-inset:pl-8 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,t.class));C(s,()=>mee,(a,o)=>{o(a,B({"data-slot":`dropdown-menu-item`,get"data-inset"(){return t.inset},get"data-variant"(){return r()},get class(){return W(e)}},()=>i,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,o),z()}h(`<div><!></div>`),h(`<span class="absolute right-2 flex items-center justify-center pointer-events-none" data-slot="dropdown-menu-radio-item-indicator"><!></span> <!>`,1);var cL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function lL(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,cL);var i=U(),o=R(i);{let e=J(()=>me(`bg-border -mx-1 my-1 h-px`,t.class));C(o,()=>pee,(t,i)=>{i(t,B({"data-slot":`dropdown-menu-separator`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}h(`<span><!></span>`);var uL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function dL(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,uL);var i=U();C(R(i),()=>Ws,(e,t)=>{t(e,B({"data-slot":`dropdown-menu-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),g(e,i),z()}h(`<!> <!>`,1);var fL=h(`<!> <!>`,1),pL=h(`<div class="inline-flex" role="group"><!> <!></div>`);function mL(e,t){a(t,!0);let n=I(t,`variant`,3,`default`),r=I(t,`size`,3,`sm`),i=I(t,`disabled`,3,!1),o=I(t,`menuAlign`,3,`end`),s=J(()=>n()==="default"||n()===`success`?`border-l-primary-foreground/25`:`border-l-border/70`);var c=pL(),l=V(c);G(l,{get variant(){return n()},get size(){return r()},get disabled(){return i()},get onclick(){return t.onclick},class:`rounded-r-none`,children:(e,n)=>{var r=U();u(R(r),()=>t.children),g(e,r)},$$slots:{default:!0}}),C(L(l,2),()=>tL,(e,a)=>{a(e,{children:(e,a)=>{var c=fL(),l=R(c);{let e=J(()=>me(xe({variant:n(),size:r()}),`-ml-px rounded-l-none border-l px-1.5`,W(s)));C(l,()=>dL,(n,r)=>{r(n,{get class(){return W(e)},get disabled(){return i()},get"aria-label"(){return t.triggerLabel},children:(e,t)=>{qee(e,{class:`size-3.5`,strokeWidth:2.3})},$$slots:{default:!0}})})}C(L(l,2),()=>aL,(e,n)=>{n(e,{get align(){return o()},get class(){return t.menuClass},children:(e,n)=>{var r=U();u(R(r),()=>t.menu),g(e,r)},$$slots:{default:!0}})}),g(e,c)},$$slots:{default:!0}})}),d(c),g(e,c),z()}var hL=h(`<!> <!>`,1),gL=h(`<p class="m-0 rounded-md border border-dashed border-border bg-muted p-3 text-sm text-muted-foreground">No models available. Configure a provider or adjust Scoped Models in
102
+ Settings.</p>`),_L=h(` <span class="text-muted-foreground"> </span>`,1),vL=h(`<p class="m-0 px-1 py-2 text-sm text-muted-foreground">No models match the current filters.</p>`),yL=h(`<button type="button" role="option"><span class="min-w-0 truncate font-medium"> </span> <!></button>`),bL=h(`<div class="grid gap-2"><!> <!> <!></div>`),xL=h(`<button type="button"> </button>`),SL=h(`<section class="grid gap-2 border-t border-border/60 pt-3"><p class="m-0 text-xs font-semibold uppercase tracking-wide text-muted-foreground">Thinking level</p> <div class="flex flex-wrap gap-2" role="group" aria-label="Implementation thinking level"></div></section>`),CL=h(`<div class="grid gap-3"><section class="grid gap-2"><p class="m-0 text-xs font-semibold uppercase tracking-wide text-muted-foreground">Model</p> <!></section> <!></div>`);function wL(e,t){a(t,!0);let n=I(t,`open`,15,!1),i=Y(``),o=Y(`off`),c=Y(``),l=Y(`all`),u=J(()=>n_(t.models)),f=J(()=>i_(W(u))),p=J(()=>r_(W(u),W(c),W(l))),m=J(()=>t.models.find(e=>Xn(e)===W(i))),h=J(()=>Ut(W(m))),v=J(()=>!W(m)),y={off:`No reasoning`,minimal:`Very brief reasoning`,low:`Light reasoning`,medium:`Moderate reasoning`,high:`Deep reasoning`,xhigh:`Extra-high reasoning`,max:`Maximum reasoning`};function b(e){return e===`off`?`Off`:e[0].toUpperCase()+e.slice(1)}function x(){K(c,``),K(l,`all`);let e=t.models.find(e=>Xn(e)===t.initialModelKey)??t.models[0];K(i,e?Xn(e):``,!0),K(o,Bt(t.initialThinkingLevel,e),!0)}function S(e){n(e),t.onOpenChange?.(e)}function T(e){K(i,Xn(e),!0),K(o,Bt(W(o),e),!0)}function E(e){K(o,Bt(e,W(m)),!0)}function D(){if(!W(m))return;let e=ur(W(i));if(!e)return;let n={implementationModel:e,implementationThinkingLevel:W(o)};S(!1),t.onConfirm?.(n)}be(()=>{n()&&x()}),sP(e,{get open(){return n()},get title(){return t.title},get description(){return t.description},onOpenChange:S,class:`max-w-xl`,footer:e=>{var n=hL(),r=R(n);G(r,{size:`sm`,variant:`ghost`,onclick:()=>S(!1),children:(e,t)=>{w(),g(e,M(`Cancel`))},$$slots:{default:!0}}),G(L(r,2),{size:`sm`,onclick:D,get disabled(){return W(v)},children:(e,n)=>{w();var r=M();F(()=>A(r,t.confirmLabel)),g(e,r)},$$slots:{default:!0}}),g(e,n)},children:(e,n)=>{var a=CL(),u=V(a),v=L(V(u),2),x=e=>{g(e,gL())},S=e=>{var t=bL(),n=V(t);t_(n,{placeholder:`Search models`,ariaLabel:`Search models`,get value(){return W(c)},set value(e){K(c,e,!0)}});var a=L(n,2),o=e=>{var t=U();C(R(t),()=>tn,(e,t)=>{t(e,{type:`single`,size:`xs`,spacing:1,variant:`outline`,get value(){return W(l)},"aria-label":`Filter by provider`,class:`flex-nowrap overflow-x-auto`,onValueChange:e=>{e&&K(l,e,!0)},children:(e,t)=>{var n=U();_(R(n),17,()=>W(f),e=>e.id,(e,t)=>{var n=U();C(R(n),()=>$t,(e,n)=>{n(e,{get value(){return W(t).id},class:`flex-none gap-1.5 text-xs`,children:(e,n)=>{w();var r=_L(),i=R(r),a=L(i),o=V(a,!0);d(a),F(()=>{A(i,`${W(t).label??``} `),A(o,W(t).count)}),g(e,r)},$$slots:{default:!0}})}),g(e,n)}),g(e,n)},$$slots:{default:!0}})}),g(e,t)};k(a,e=>{W(f).length>2&&e(o)});var u=L(a,2),m=e=>{g(e,vL())},h=e=>{Ii(e,{get items(){return W(p)},getKey:e=>e.key,estimateSize:()=>38,viewportClass:`max-h-[min(45vh,20rem)]`,viewportAriaLabel:`Implementation model`,row:(e,t)=>{let n=()=>t?.().item,a=J(()=>n().key===W(i));var o=yL(),c=V(o),l=V(c,!0);d(c);var u=L(c,2),f=e=>{$I(e,{class:`size-4`,strokeWidth:2.4})};k(u,e=>{W(a)&&e(f)}),d(o),F(()=>{s(o,1,`flex w-full items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 text-left text-sm transition-colors ${W(a)?`border-primary/40 bg-primary/10 text-primary`:`border-transparent text-foreground hover:bg-accent`}`),q(o,`aria-selected`,W(a)),A(l,n().contextualLabel)}),r(`click`,o,()=>T(n().model)),g(e,o)},$$slots:{row:!0}})};k(u,e=>{W(p).length===0?e(m):e(h,-1)}),d(t),g(e,t)};k(v,e=>{t.models.length===0?e(x):e(S,-1)}),d(u);var D=L(u,2),O=e=>{var t=SL(),n=L(V(t),2);_(n,20,()=>W(h),e=>e,(e,t)=>{let n=J(()=>t===W(o));var i=xL(),a=V(i,!0);d(i),F(e=>{s(i,1,`rounded-full border px-3 py-1 text-xs font-medium transition-colors ${W(n)?`border-primary bg-primary/10 text-primary`:`border-border bg-input text-muted-foreground hover:border-primary/40 hover:text-foreground`}`),q(i,`aria-pressed`,W(n)),q(i,`title`,y[t]),A(a,e)},[()=>b(t)]),r(`click`,i,()=>E(t)),g(e,i)}),d(n),d(t),g(e,t)};k(D,e=>{W(m)&&e(O)}),d(a),g(e,a)},$$slots:{footer:!0,default:!0}}),z()}T([`click`]);var TL=h(`<div class="whitespace-pre-wrap rounded-sm border bg-sidebar p-2.5 font-mono text-xs leading-relaxed text-foreground [overflow-wrap:anywhere]"> </div>`),EL=h(`<!> <!> <!> <!> <!> <!> <!>`,1),DL=h(`<!> `,1),OL=h(`<!> <!>`,1),kL=h(`<p class="m-0 text-xs text-destructive" role="alert"> </p>`),AL=h(`<div class="grid gap-2" aria-label="Plan review"><!> <!> <!> <!> <!> <!></div>`),jL=h(`<p class="m-0 text-sm text-muted-foreground"> </p>`);function ML(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=I(t,`planReviewModels`,19,()=>[]),i=I(t,`planReviewModelKey`,3,``),o=I(t,`planReviewThinkingLevel`,3,`off`),s=Y(void 0),c=Y(void 0),l=Y(!1),u=Y(void 0);function f(e){return e&&typeof e==`object`?e:{}}function p(e){return typeof e==`string`?e:void 0}function m(e){let t=f(f(e).review);return typeof t.id==`string`||typeof t.content==`string`?t:void 0}function h(e){let t=e;return t.resultPreview??t.result}function _(e,t){let n=e.split(`
103
+ `);return n.length>t?n.slice(0,t).join(`
104
+ `):e}let v=J(()=>h(t.toolCall)),y=J(()=>m(W(v))),b=J(()=>t.planReview?{...W(y),...t.planReview,content:W(y)?.content??t.planReview.content}:W(y)),x=J(()=>t.toolCall.toolName===`plan_mode_present`&&t.toolCall.status===`waiting_for_user`&&t.planReview?.status===`pending`),S=J(()=>W(b)?.status??p(f(W(v)).outcome)),T=J(()=>W(S)===`accepted`),E=J(()=>W(S)===`accepted_in_new_chat`),D=J(()=>W(S)===`changes_requested`||W(S)===`discarded`),O=J(()=>W(y)?.content??W(b)?.content??``),ee=J(()=>n()?W(b)?.content??``:_(W(O),6)),te=J(()=>t.toolCall.toolName===`plan_mode_present`&&!!W(b)),ne=J(()=>!W(x)||!!W(c)||W(l)),j=J(()=>W(T)||W(E)?`success`:`default`),re=J(()=>W(T)||W(E)?[{text:`Accepted`,tone:`success`}]:W(S)===`changes_requested`?[{text:`Changes requested`}]:W(S)===`discarded`?[{text:`Discarded`}]:W(x)?[{text:`Awaiting review`,tone:`warning`}]:[]);async function N(e){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onAcceptPlanReview)){K(c,`same`),K(u,void 0);try{await t.onAcceptPlanReview(t.planReview.id,e)}catch(e){K(u,ce(e,`Could not accept the plan.`),!0)}finally{K(c,void 0)}}}async function P(e){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onAcceptPlanReview)){K(c,`compact`),K(u,void 0);try{await t.onAcceptPlanReview(t.planReview.id,{...e,compactBeforeImplementation:!0})}catch(e){K(u,ce(e,`Could not compact and accept the plan.`),!0)}finally{K(c,void 0)}}}async function ie(e){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onAcceptPlanReviewInNewChat)){K(c,`new-chat`),K(u,void 0);try{await t.onAcceptPlanReviewInNewChat(t.planReview.id,e)}catch(e){K(u,ce(e,`Could not accept the plan.`),!0)}finally{K(c,void 0)}}}function ae(){!W(x)||W(c)||W(l)||K(s,`same`)}function oe(){!W(x)||W(c)||W(l)||K(s,`compact`)}function se(){!W(x)||W(c)||W(l)||K(s,`new-chat`)}function ce(e,t){return e instanceof Error&&e.message.trim()?e.message:t}async function le(){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onRejectPlanReview)){K(l,!0),K(u,void 0);try{await t.onRejectPlanReview(t.planReview.id)}catch(e){K(u,ce(e,`Could not reject the plan.`),!0)}finally{K(l,!1)}}}var ue=U(),de=R(ue),fe=e=>{var n=AL(),a=V(n),f=e=>{var t=TL(),n=V(t,!0);d(t),F(()=>A(n,W(ee))),g(e,t)},p=J(()=>W(ee).trim());k(a,e=>{W(p)&&e(f)});var m=L(a,2);Kk(m,{get meta(){return W(re)},get detailsAction(){return t.detailsAction},actions:e=>{var n=OL(),r=R(n);mL(r,{get variant(){return W(j)},size:`sm`,get disabled(){return W(ne)},menuAlign:`end`,menuClass:`w-60`,triggerLabel:`Accept options`,onclick:()=>void N(),menu:e=>{var n=EL(),r=R(n);C(r,()=>sL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:()=>void N(),children:(e,t)=>{w(),g(e,M(`Accept & implement`))},$$slots:{default:!0}})});var i=L(r,2);C(i,()=>sL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:()=>void P(),children:(e,t)=>{w(),g(e,M(`Compact & implement`))},$$slots:{default:!0}})});var a=L(i,2),o=e=>{var t=U();C(R(t),()=>sL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:()=>void ie(),children:(e,t)=>{w(),g(e,M(`Accept in new chat`))},$$slots:{default:!0}})}),g(e,t)};k(a,e=>{t.onAcceptPlanReviewInNewChat&&e(o)});var s=L(a,2);C(s,()=>lL,(e,t)=>{t(e,{})});var c=L(s,2);C(c,()=>sL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:ae,children:(e,t)=>{w(),g(e,M(`Choose model & implement`))},$$slots:{default:!0}})});var l=L(c,2);C(l,()=>sL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:oe,children:(e,t)=>{w(),g(e,M(`Choose model & compact`))},$$slots:{default:!0}})});var u=L(l,2),d=e=>{var t=U();C(R(t),()=>sL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:se,children:(e,t)=>{w(),g(e,M(`Choose model & start new chat`))},$$slots:{default:!0}})}),g(e,t)};k(u,e=>{t.onAcceptPlanReviewInNewChat&&e(d)}),g(e,n)},children:(e,t)=>{var n=DL(),r=R(n),i=e=>{$I(e,{class:`size-3.5`,strokeWidth:2.4})};k(r,e=>{(W(T)||W(E))&&e(i)});var a=L(r);F(()=>A(a,` ${W(c)===`same`?`Accepting…`:W(c)===`compact`?`Compacting…`:W(c)===`new-chat`?`Accepting in new chat…`:`Accept & Implement`}`)),g(e,n)},$$slots:{menu:!0,default:!0}}),G(L(r,2),{size:`sm`,variant:`secondary`,get disabled(){return W(ne)},onclick:le,children:(e,t)=>{var n=DL(),r=R(n),i=e=>{$I(e,{class:`size-3.5`,strokeWidth:2.4})};k(r,e=>{W(D)&&e(i)});var a=L(r);F(()=>A(a,` ${W(l)?`Rejecting…`:`Reject Plan`}`)),g(e,n)},$$slots:{default:!0}}),g(e,n)},$$slots:{actions:!0}});var h=L(m,2),_=e=>{var t=kL(),n=V(t,!0);d(t),F(()=>A(n,W(u))),g(e,t)};k(h,e=>{W(u)&&e(_)});var v=L(h,2);{let e=J(()=>W(s)===`same`);wL(v,{get open(){return W(e)},title:`Choose implementation model`,description:`The selected model will be used when implementation continues in this conversation.`,confirmLabel:`Accept and implement`,get models(){return r()},get initialModelKey(){return i()},get initialThinkingLevel(){return o()},onOpenChange:e=>{K(s,e?`same`:void 0,!0)},onConfirm:N})}var y=L(v,2);{let e=J(()=>W(s)===`compact`);wL(y,{get open(){return W(e)},title:`Choose implementation model`,description:`The selected model will compact the planning context, then implement the plan in this conversation.`,confirmLabel:`Compact and implement`,get models(){return r()},get initialModelKey(){return i()},get initialThinkingLevel(){return o()},onOpenChange:e=>{K(s,e?`compact`:void 0,!0)},onConfirm:P})}var b=L(y,2),x=e=>{{let t=J(()=>W(s)===`new-chat`);wL(e,{get open(){return W(t)},title:`Choose implementation model`,description:`The selected model will be used by the new implementation chat.`,confirmLabel:`Accept in new chat`,get models(){return r()},get initialModelKey(){return i()},get initialThinkingLevel(){return o()},onOpenChange:e=>{K(s,e?`new-chat`:void 0,!0)},onConfirm:ie})}};k(b,e=>{t.onAcceptPlanReviewInNewChat&&e(x)}),d(n),g(e,n)},pe=e=>{var n=jL(),r=V(n,!0);d(n),F(()=>A(r,t.view.summary)),g(e,n)};k(de,e=>{W(te)&&W(b)?e(fe):t.view.summary&&e(pe,1)}),g(e,ue),z()}var NL=h(`<section class="grid gap-1" aria-label="Python script"><!></section>`),PL=h(`<section class="grid gap-1" aria-label="Python output"><!></section>`),FL=h(`<section class="grid gap-1" aria-label="Python output"><p class="m-0 text-xs text-muted-foreground">No output.</p></section>`),IL=h(`<div class="grid gap-1.5"><!> <!></div>`);function LL(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>t.view.inputMode!==`file`&&!!t.view.code?.match(/[\r\n]/));var i=IL(),o=V(i),s=e=>{var r=NL();XA(V(r),{get text(){return t.view.code},language:`python`,get expanded(){return n()}}),d(r),g(e,r)};k(o,e=>{n()&&t.view.code&&W(r)&&e(s)});var c=L(o,2),l=e=>{var r=PL();XA(V(r),{get text(){return t.view.output},direction:`tail`,get expanded(){return n()},get outputLimits(){return t.view.outputLimits},terminal:!0}),d(r),g(e,r)},u=e=>{g(e,FL())};k(c,e=>{t.view.output.length>0?e(l):t.toolCall.status===`completed`&&e(u,1)}),d(i),g(e,i),z()}var RL={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`jsonc`,css:`css`,html:`html`,svelte:`svelte`,md:`markdown`,markdown:`markdown`,py:`python`,yml:`yaml`,yaml:`yaml`,sh:`bash`,bash:`bash`,zsh:`shellscript`};function zL(e){if(!e)return;let t=e.split(/[\\/]/).pop()??e,n=t.lastIndexOf(`.`);if(!(n<=0))return RL[t.slice(n+1).toLowerCase()]}var BL=h(`<button class="cursor-pointer border-0 bg-transparent p-0" type="button" title="Open image pane"><img class="max-h-60 max-w-80 rounded-sm border object-contain"/></button>`),VL=h(`<p class="m-0 text-xs text-muted-foreground">Empty file.</p>`);function HL(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),i=J(()=>zL(t.view.relPath));var o=U(),s=R(o),c=e=>{var n=BL(),i=V(n);d(n),F(()=>{q(i,`src`,t.view.image.dataUrl),q(i,`alt`,t.view.relPath??`image`)}),r(`click`,n,()=>t.view.path&&t.onOpenFile?.(t.view.path)),g(e,n)},l=e=>{XA(e,{get text(){return t.view.content},get language(){return W(i)},get expanded(){return n()}})},u=e=>{g(e,VL())};k(s,e=>{t.view.image?e(c):t.view.content!==void 0&&t.view.content.length>0?e(l,1):t.toolCall.status===`completed`&&e(u,2)}),g(e,o),z()}T([`click`]);var UL=/https?:\/\/[^\s)'"]+/i;function WL(e){if(e.readiness.readyUrl)return e.readiness.readyUrl;if(!e.readiness.readyOnUrl)return;let t=e.readiness.matched;return t&&UL.test(t)?t:void 0}var GL=h(`<a class="inline-flex min-w-0 items-center gap-1 truncate font-mono text-xs text-info hover:underline" target="_blank" rel="noreferrer noopener"><!> </a>`),KL=h(`<div><!> <div> </div> <!> <!> <!></div>`),qL=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">group</span> </span>`),JL=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">finished</span> </span>`),YL=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">exit</span> </span>`),XL=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">signal</span> </span>`),ZL=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">error</span> </span>`),QL=h(`<span class="tt-title svelte-1462m86"> </span> <span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">command</span> </span> <span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">cwd</span> </span> <span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">status</span> </span> <span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">started</span> </span> <!> <!> <!> <!> <span class="tt-id svelte-1462m86"> </span>`,1),$L=h(`<!> <!>`,1),eR=h(`<p class="m-0 break-words text-xs text-destructive"> </p>`);function tR(e,t){a(t,!0);let n=I(t,`dense`,3,!1),r=J(()=>WL(t.task)),i=J(()=>vf(t.task.status)),o=J(()=>t.task.termination?.exitCode!==void 0&&t.task.termination.exitCode!==null);var c=$L(),l=R(c);C(l,()=>Ey,(e,a)=>{a(e,{delayDuration:300,disableHoverableContent:!0,children:(e,a)=>{var c=U();C(R(c),()=>gy,(e,a)=>{a(e,{children:(e,a)=>{var c=$L(),l=R(c);{let e=(e,a)=>{let c=()=>a?.().props;var l=KL();O(l,()=>({...c(),class:`flex min-w-0 items-center gap-2.5 rounded-md border bg-card px-2.5 py-2`}),void 0,void 0,void 0,`svelte-1462m86`);var u=V(l);{let e=J(()=>yf(t.task.status));ht(u,{get tone(){return W(i)},get pulse(){return W(e)},size:`xs`,class:`flex-none`})}var f=L(u,2),p=V(f,!0);d(f);var m=L(f,2),h=e=>{var t=GL(),n=V(t);YM(n,{size:12,strokeWidth:2});var i=L(n,1,!0);d(t),F(()=>{q(t,`href`,W(r)),A(i,W(r))}),g(e,t)};k(m,e=>{W(r)&&e(h)});var _=L(m,2),v=e=>{{let n=J(()=>t.task.termination?.exitCode===0?`neutral`:`danger`);Ri(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`exit ${t.task.termination?.exitCode??``}`)),g(e,r)},$$slots:{default:!0}})}},y=e=>{Ri(e,{tone:`warn`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`signal ${t.task.termination.signal??``}`)),g(e,r)},$$slots:{default:!0}})};k(_,e=>{W(o)?e(v):t.task.termination?.signal&&e(y,1)});var b=L(_,2);{let e=J(()=>W(i)===`neutral`?`border-border bg-muted text-muted-foreground`:``);Ri(b,{get tone(){return W(i)},size:`xs`,get class(){return W(e)},children:(e,n)=>{w();var r=M();F(()=>A(r,t.task.status)),g(e,r)},$$slots:{default:!0}})}d(l),F(()=>{s(f,1,`min-w-0 flex-1 ${n()?`truncate`:`whitespace-pre-wrap break-words`} font-mono text-xs text-foreground`),A(p,t.task.command)}),g(e,l)};C(l,()=>vy,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}C(L(l,2),()=>wy,(e,n)=>{n(e,{side:`left`,sideOffset:6,class:`max-w-88 flex-col items-start gap-0.5 font-mono text-xs leading-[1.35] [overflow-wrap:anywhere]`,children:(e,n)=>{var r=QL(),i=R(r),a=V(i,!0);d(i);var s=L(i,2),c=L(V(s),1,!0);d(s);var l=L(s,2),u=L(V(l),1,!0);d(l);var f=L(l,2),p=L(V(f),1,!0);d(f);var m=L(f,2),h=L(V(m),1,!0);d(m);var _=L(m,2),v=e=>{var n=qL(),r=L(V(n),1,!0);d(n),F(()=>A(r,t.task.lineage.groupId)),g(e,n)};k(_,e=>{t.task.lineage?.groupId&&e(v)});var y=L(_,2),b=e=>{var n=JL(),r=L(V(n),1,!0);d(n),F(e=>A(r,e),[()=>BF(t.task.timing.finishedAt)]),g(e,n)};k(y,e=>{t.task.timing.finishedAt&&e(b)});var x=L(y,2),S=e=>{var n=YL(),r=L(V(n),1,!0);d(n),F(()=>A(r,t.task.termination?.exitCode)),g(e,n)},C=e=>{var n=XL(),r=L(V(n),1,!0);d(n),F(()=>A(r,t.task.termination.signal)),g(e,n)};k(x,e=>{W(o)?e(S):t.task.termination?.signal&&e(C,1)});var w=L(x,2),T=e=>{var n=ZL(),r=L(V(n),1,!0);d(n),F(()=>A(r,t.task.termination.error)),g(e,n)};k(w,e=>{t.task.termination?.error&&e(T)});var E=L(w,2),D=V(E,!0);d(E),F(e=>{A(a,t.task.name??t.task.command),A(c,t.task.command),A(u,t.task.cwd),A(p,t.task.status),A(h,e),A(D,t.task.id)},[()=>BF(t.task.timing.startedAt)]),g(e,r)},$$slots:{default:!0}})}),g(e,c)},$$slots:{default:!0}})}),g(e,c)},$$slots:{default:!0}})});var u=L(l,2),f=e=>{var n=eR(),r=V(n,!0);d(n),F(()=>A(r,t.task.termination.error)),g(e,n)};k(u,e=>{t.task.termination?.error&&e(f)}),g(e,c),z()}var nR=h(`<p> </p>`),rR=h(`<div class="grid gap-1"></div>`);function iR(e,t){a(t,!0);var n=U(),r=R(n),i=e=>{var n=nR();let r;var i=V(n,!0);d(n),F(()=>{r=s(n,1,`m-0 text-xs`,null,r,{"text-warning":t.view.previewUnavailable,"text-muted-foreground":!t.view.previewUnavailable}),A(i,t.view.previewUnavailable?`Task status preview unavailable. Open Details to inspect the full result.`:`No matching tasks.`)}),g(e,n)},o=e=>{var n=rR();_(n,21,()=>t.view.tasks,e=>e.id,(e,t)=>{tR(e,{get task(){return W(t)},dense:!0})}),d(n),g(e,n)};k(r,e=>{t.view.tasks.length===0&&t.toolCall.status===`completed`?e(i):t.view.tasks.length>0&&e(o,1)}),g(e,n),z()}var aR=h(`<span class="terminal-text terminal-output svelte-24sjlk"></span>`);function oR(e,t){a(t,!0);let n=J(()=>FA(t.text,{linkifyUrls:!0}));var r=aR();p(r,()=>W(n),!0),d(r),F(()=>{q(r,`data-stream`,t.stream),q(r,`data-level`,t.level)}),g(e,r),z()}var sR=h(`<p class="m-0 text-xs text-warning">Log preview is incomplete. Open Details to inspect the full result.</p>`),cR=h(`<div><span class="text-right text-muted-foreground"> </span> <span class="whitespace-pre-wrap break-words"><!></span></div>`),lR=h(`<div class="terminal-output rounded-sm border bg-sidebar px-2.5 py-1.5 font-mono text-xs text-sidebar-foreground"></div>`),uR=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),dR=h(`<!> <!>`,1);function fR(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>n()?t.view.events:oee(t.view.events,6));var i=dR(),o=R(i),c=e=>{g(e,sR())};k(o,e=>{t.view.previewUnavailable&&t.toolCall.status===`completed`&&e(c)});var l=L(o,2),u=e=>{var t=lR();_(t,21,()=>W(r),e=>e.seq,(e,t)=>{var n=cR();let r;var i=V(n),a=V(i,!0);d(i);var o=L(i,2),c=V(o);{let e=J(()=>W(t).line||`\xA0`);oR(c,{get text(){return W(e)},get stream(){return W(t).stream},get level(){return W(t).level}})}d(o),d(n),F(()=>{r=s(n,1,`grid grid-cols-[3.5rem_minmax(0,1fr)] gap-2`,null,r,{"text-warning":W(t).level===`warn`,"text-destructive":W(t).level===`error`}),A(a,W(t).seq)}),g(e,n)}),d(t),g(e,t)},f=e=>{var n=uR(),r=V(n);d(n),F(()=>A(r,`No matching log events${t.view.task?` for ${t.view.task.name??t.view.task.id} (${t.view.task.status})`:``}.`)),g(e,n)};k(l,e=>{t.view.events.length>0?e(u):t.toolCall.status===`completed`&&!t.view.previewUnavailable&&e(f,1)}),g(e,i),z()}var pR=h(`<p class="m-0 text-xs font-medium text-muted-foreground"> </p>`),mR=h(`<div class="grid gap-1"><!> <p> </p></div>`),hR=h(`<p class="m-0 text-xs text-muted-foreground">Replacement <span class="font-mono"> </span> restarted <span class="font-mono"> </span>.</p>`),gR=h(`<div class="grid gap-1.5"><!> <!> <!></div>`),_R=h(`<p class="m-0 text-xs text-warning">Task result preview unavailable. Open Details to inspect the full result.</p>`),vR=h(`<section class="grid gap-1" aria-label="Task startup output"><!></section>`),yR=h(`<!> <!>`,1);function bR(e,t){a(t,!0);let n=J(()=>t.view.action===`start`?`Task started; process state is shown below.`:t.view.action===`restart`?`Task restarted; process state is shown below.`:`Cancellation completed.`),r=J(()=>t.view.tasks??(t.view.task?[t.view.task]:[])),i=J(()=>t.view.outcomes??[]),o=J(()=>W(r).length>0||W(i).length>0);var c=yR(),l=R(c),u=e=>{var a=gR(),o=V(a),c=e=>{var t=pR(),r=V(t,!0);d(t),F(()=>A(r,W(n))),g(e,t)};k(o,e=>{t.toolCall.status===`completed`&&e(c)});var l=L(o,2),u=e=>{var t=U();_(R(t),19,()=>W(i),(e,t)=>`${e.task?.id??`none`}-${t}`,(e,t)=>{var n=mR(),r=V(n),i=e=>{tR(e,{get task(){return W(t).task}})};k(r,e=>{W(t).task&&e(i)});var a=L(r,2);let o;var c=V(a,!0);d(a),d(n),F(()=>{o=s(a,1,`m-0 break-words text-xs`,null,o,{"text-warning":W(t).outcome===`already_terminal`||W(t).outcome===`became_terminal_before_cancel`,"text-muted-foreground":W(t).outcome!==`already_terminal`&&W(t).outcome!==`became_terminal_before_cancel`}),A(c,W(t).message)}),g(e,n)}),g(e,t)},f=e=>{var t=U();_(R(t),17,()=>W(r),e=>e.id,(e,t)=>{tR(e,{get task(){return W(t)}})}),g(e,t)};k(l,e=>{t.view.action===`cancel`?e(u):e(f,-1)});var p=L(l,2),m=e=>{var n=hR(),r=L(V(n)),i=V(r,!0);d(r);var a=L(r,2),o=V(a,!0);d(a),w(),d(n),F(()=>{A(i,t.view.task.id),A(o,t.view.restartedFromTaskId)}),g(e,n)};k(p,e=>{t.view.action===`restart`&&t.view.task&&t.view.restartedFromTaskId&&e(m)}),d(a),g(e,a)},f=e=>{g(e,_R())};k(l,e=>{W(o)?e(u):t.toolCall.status===`completed`&&t.view.previewUnavailable&&e(f,1)});var p=L(l,2),m=e=>{var n=vR();XA(V(n),{get text(){return t.view.liveLog},direction:`tail`,terminal:!0}),d(n),g(e,n)};k(p,e=>{t.view.liveLog&&e(m)}),g(e,c),z()}function xR(e,t){a(t,!0);var n=U(),r=R(n),i=e=>{gv(e,{get items(){return t.view.items}})},o=e=>{gv(e,{items:[],emptyLabel:`No todos.`})};k(r,e=>{t.view.items.length>0?e(i):t.toolCall.status===`completed`&&e(o,1)}),g(e,n),z()}var SR=h(`<p class="m-0 text-xs text-muted-foreground">No content.</p>`);function CR(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>t.view.converted?`markdown`:void 0);var i=U(),o=R(i),s=e=>{XA(e,{get text(){return t.view.content},get language(){return W(r)},get expanded(){return n()}})},c=e=>{g(e,SR())};k(o,e=>{t.view.content!==void 0&&t.view.content.length>0?e(s):t.toolCall.status===`completed`&&e(c,1)}),g(e,i),z()}var wR=new Set([`$$slots`,`$$events`,`$$legacy`]);function TR(e,t){let n=H(t,wR),r=[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`}],[`path`,{d:`M20 2v4`}],[`path`,{d:`M22 4h-4`}],[`circle`,{cx:`4`,cy:`20`,r:`2`}]];P(e,B({name:`sparkles`},()=>n,{get iconNode(){return r}}))}var ER=h(`<div class="grid gap-1 rounded-sm border bg-sidebar px-2.5 py-2"><span class="inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground"><!> Answer</span> <p> </p></div>`),DR=h(`<span class="line-clamp-2 pl-6 text-xs leading-snug text-muted-foreground"> </span>`),OR=h(`<li><a class="group flex flex-col gap-0.5 px-2.5 py-1.5 text-inherit no-underline hover:bg-muted/40" target="_blank" rel="noreferrer"><span class="flex min-w-0 items-baseline gap-2"><span class="w-4 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground/70"> </span> <span class="min-w-0 flex-1 truncate text-xs font-medium text-foreground group-hover:underline"> </span> <span class="shrink-0 font-mono text-xs text-muted-foreground"> </span></span> <!></a></li>`),kR=h(`<ul class="m-0 grid list-none gap-0 divide-y overflow-hidden rounded-sm border bg-sidebar p-0"></ul>`),AR=h(`<p class="m-0 text-xs text-muted-foreground">No results.</p>`),jR=h(`<!> <!>`,1);function MR(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>n()?t.view.results:t.view.results.slice(0,6));function i(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}var o=jR(),c=R(o),l=e=>{var r=ER(),i=V(r);TR(V(i),{size:12,strokeWidth:2,class:`text-info`}),w(),d(i);var a=L(i,2);let o;var c=V(a,!0);d(a),d(r),F(()=>{o=s(a,1,`m-0 text-xs leading-normal text-sidebar-foreground`,null,o,{"line-clamp-6":!n()}),A(c,t.view.answer)}),g(e,r)};k(c,e=>{t.view.answer&&e(l)});var u=L(c,2),f=e=>{var t=kR();_(t,23,()=>W(r),e=>e.url,(e,t,n)=>{var r=OR(),a=V(r),o=V(a),s=V(o),c=V(s,!0);d(s);var l=L(s,2),u=V(l,!0);d(l);var f=L(l,2),p=V(f,!0);d(f),d(o);var m=L(o,2),h=e=>{var n=DR(),r=V(n,!0);d(n),F(()=>A(r,W(t).content)),g(e,n)};k(m,e=>{W(t).content&&e(h)}),d(a),d(r),F(e=>{q(a,`href`,W(t).url),q(a,`title`,W(t).url),A(c,W(n)+1),A(u,W(t).title),A(p,e)},[()=>i(W(t).url)]),g(e,r)}),d(t),g(e,t)},p=e=>{g(e,AR())};k(u,e=>{W(r).length>0?e(f):!t.view.answer&&t.toolCall.status===`completed`&&e(p,1)}),g(e,o),z()}var NR=h(`<p class="m-0 text-xs text-muted-foreground">Empty file written.</p>`);function PR(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>zL(t.view.relPath));var i=U(),o=R(i),s=e=>{XA(e,{get text(){return t.view.content},get language(){return W(r)},direction:`tail`,get expanded(){return n()}})},c=e=>{g(e,NR())};k(o,e=>{t.view.content!==void 0&&t.view.content.length>0?e(s):t.toolCall.status===`completed`&&e(c,1)}),g(e,i),z()}var FR={read:HL,bash:tj,python:LL,edit:LN,write:PR,grep:DF,find:_F,ls:ZI,ask_user:cA,todos:xR,task_action:bR,task_status:iR,task_logs:fR,explore:pF,plan_mode:ML,jira:GI,confluence:FN,web_search:MR,web_fetch:CR,generic:SF};function IR(e){return FR[e]??SF}function LR(e){return e.replace(/\r\n/g,`
105
+ `).replace(/\r/g,`
106
+ `)}function RR(e,t){if(e.length===0)return``;let n=LR(e).split(`
107
+ `);return n.length<=t?n.join(`
108
+ `):n.slice(-t).join(`
109
+ `)}function zR(e,t){return e.length<=t?e:e.slice(-t)}function BR(e,t){let n=LR(e).trimEnd();if(n.length!==0)return RR(zR(n,t.maxChars),t.maxLines)}function VR(e){let t=``,n=0,r=!1,i=!1,a=()=>{t+=` `.repeat(n)},o=()=>{t=t.trimEnd(),t+=`
110
+ `,a()};for(let a of e){if(r){t+=a,i?i=!1:a===`\\`?i=!0:a===`"`&&(r=!1);continue}if(a===`"`){r=!0,t+=a;continue}if(a===`{`||a===`[`){t+=a,n+=1,o();continue}if(a===`}`||a===`]`){n=Math.max(0,n-1),o(),t+=a;continue}if(a===`,`){t+=a,o();continue}if(a===`:`){t+=`: `;continue}a===` `||a===`
111
+ `||a===`\r`||a===` `||(t+=a)}return t.trimEnd()}function HR(e,t){let n=UR(e,t).argsPreview;return n?{kind:`code`,language:`json`,text:n,tail:!0}:void 0}function UR(e,t){if(e.toolName&&Lx(e.toolName))return{};if(e.args!==void 0){let n=BR(JSON.stringify(e.args,null,2),t);return n?{argsPreview:n,argsPreviewLanguage:`json`}:{}}let n=e.argsText.trim();if(!n)return{};let r=BR(VR(n),t);return r?{argsPreview:r,argsPreviewLanguage:`json`}:{}}function WR(e,t){let n=new Set;return[...e,...t].filter(e=>n.has(e.text)?!1:(n.add(e.text),!0))}function GR(e){if(e.preview)return e.kind===`edit`?{kind:`diff`,text:e.preview,tail:!0}:{kind:`code`,text:e.preview,language:`text`,tail:!0};if(e.inputPreview)return{kind:`code`,text:e.inputPreview,language:e.language??`text`,tail:!0}}function KR(e,t){let n=e.argumentBody,r=n?.kind===`atlassian-draft`?!e.done||n.fields.some(e=>e.value!==void 0)||n.text?.text!==void 0:!!(n&&n.kind!==`none`);return!!(e.preview?.length||e.inputPreview?.length||r||t?.length&&!t.includes(`Waiting for arguments…`))}function qR(e){return e&&typeof e==`object`?e:{}}function JR(e){return typeof e==`string`?e:void 0}function YR(e,t,n=`s`){return`${e} ${t}${e===1?``:n}`}function XR(e){if(e!==void 0)return e.length===0?0:e.split(`
112
+ `).length}function ZR(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function QR(e){return RegExp(`"${ZR(e)}"\\s*:\\s*"`,`g`)}function $R(e,t,n={}){let r=[],i=QR(t),a=i.exec(e);for(;a;){let t=n.maxChars??1/0,o=``,s=a.index+a[0].length;for(;s<e.length;){let n=e[s];if(n===`\\`){if(s+1>=e.length)break;let n=e[s+1];o.length<t&&(n===`n`?o+=`
113
+ `:n===`r`?o+=`\r`:n===`t`?o+=` `:o+=n),s+=2;continue}if(n===`"`)break;o.length<t&&(o+=n),s+=1}r.push(o),a=i.exec(e)}return r}function ez(e,t){let n=[],r=QR(t),i=r.exec(e);for(;i;){let t=0,a=!1,o=i.index+i[0].length;for(;o<e.length;){let n=e[o];if(n===`\\`){if(o+1>=e.length)break;let n=e[o+1];n===`n`?(t=Math.max(t,1)+1,a=!0):n!==`r`&&(a=!0),o+=2;continue}if(n===`"`)break;n===`
114
+ `?t=Math.max(t,1)+1:n!==`\r`&&(a=!0),o+=1}n.push(Math.max(t,+!!a)),i=r.exec(e)}return n}var tz=24e3;function nz(e){return e===`n`?`
115
+ `:e===`r`?`\r`:e===`t`?` `:e}function rz(e,t,n){return e.length+t.length<=n?e+t:`${e}${t}`.slice(-n)}function iz(e){return RegExp(`"(${e.map(ZR).join(`|`)})"\\s*:\\s*"`,`g`)}function az(e,t,n={}){if(t.length===0)return[];let r=[],i=iz(t),a=i.exec(e);for(;a;){let t=n.maxChars??tz,o=``,s=!1,c=a.index+a[0].length;for(;c<e.length;){let n=e[c];if(n===`\\`){if(c+1>=e.length)break;o=rz(o,nz(e[c+1]),t),c+=2;continue}if(n===`"`){s=!0;break}o=rz(o,n,t),c+=1}r.push({property:a[1],value:o,complete:s,index:a.index}),a=i.exec(e)}return r.sort((e,t)=>e.index-t.index)}function oz(e){return e.replace(/\r\n/g,`
116
+ `).replace(/\r/g,`
117
+ `)}function sz(e,t){let n=oz(e);if(t)return n;let r=n.lastIndexOf(`
118
+ `);return r<0?``:n.slice(0,r)}function cz(e,t=6){if(e.length===0)return``;let n=oz(e).split(`
119
+ `);return n.length<=t?n.join(`
120
+ `):n.slice(-t).join(`
121
+ `)}function lz(e){return!oz(e).includes(`
122
+ `)}function uz(e){if(e===void 0||e.length===0)return{};let t=oz(e),n=XR(t);return lz(t)?{inlineInput:t,inputLineCount:n}:{inputPreview:cz(t),inputLineCount:n}}function dz(e){let t=e.filter(e=>e.length>0).join(`
123
+ `);return t.length>0?cz(t):void 0}function fz(e,t){let n=oz(e);return n.length===0?``:n.split(`
124
+ `).map(e=>`${t}${e}`).join(`
125
+ `)}function pz(e,t){return dz(e.map(e=>{let n=sz(e.text,e.complete||t);return e.kind===`patch`?n:fz(n,e.kind===`added`?`+`:`-`)}))}function mz(e,t){return dz(e.map(e=>sz(e.value,e.complete||t)))}function hz(e,t){let n=JR(qR(e.args).path)??e.progress?.path??$R(e.argsText,`path`,{maxChars:240})[0];return n&&t?ri(n,t)??n:n}function gz(e,t){let n=JR(qR(e.args).content),r=e.argsText?ez(e.argsText,`content`)[0]:void 0,i=e.progress?.lineCount??e.progress?.generatedLineCount,a=XR(n)??r??i,o=e.progress?.generatedPreview?cz(e.progress.generatedPreview):void 0,s=n===void 0?(e.argsText?mz(az(e.argsText,[`content`]),!!e.done):void 0)??o:dz([oz(n)]),c=n===void 0&&!!e.progress?.estimated,l=[];return a!==void 0&&a>0&&l.push({text:`+${a}`,tone:`success`}),{kind:`write`,toolName:`write`,path:hz(e,t),statusText:e.done?`Submitting`:`Generating`,meta:l,lineCount:a,generatedLineCount:a,estimated:c,preview:s,done:!!e.done}}function _z(e){let t=0,n=0;for(let r of e.split(/\r?\n/))r.startsWith(`+`)&&!r.startsWith(`+++`)?t+=1:r.startsWith(`-`)&&!r.startsWith(`---`)&&(n+=1);return{additions:t,deletions:n}}function vz(e){return Array.isArray(e)?e:[]}function yz(e){if(!Array.isArray(e.replacements)&&!Array.isArray(e.insertions)&&!Array.isArray(e.lineReplacements)&&!Array.isArray(e.lineInsertions)&&typeof e.patch!=`string`)return;let t=0,n=0,r=0,i=vz(e.replacements);t+=i.length;for(let e of i){let t=qR(e);n+=XR(JR(t.newText))??0,r+=XR(JR(t.oldText))??0}let a=vz(e.insertions);t+=a.length;for(let e of a)n+=XR(JR(qR(e).text))??0;let o=vz(e.lineReplacements);t+=o.length;for(let e of o)n+=XR(JR(qR(e).newText))??0;let s=vz(e.lineInsertions);t+=s.length;for(let e of s)n+=XR(JR(qR(e).text))??0;let c=JR(e.patch);if(c){t+=1;let e=_z(c);n+=e.additions,r+=e.deletions}return{operations:t,generatedLines:n,estimatedAdditions:n,estimatedDeletions:r,estimated:!1}}function bz(e){let t=[];for(let n of vz(e.replacements)){let e=qR(n),r=JR(e.oldText),i=JR(e.newText);r!==void 0&&t.push({text:r,kind:`removed`,complete:!0}),i!==void 0&&t.push({text:i,kind:`added`,complete:!0})}for(let n of vz(e.insertions)){let e=JR(qR(n).text);e!==void 0&&t.push({text:e,kind:`added`,complete:!0})}for(let n of vz(e.lineReplacements)){let e=JR(qR(n).newText);e!==void 0&&t.push({text:e,kind:`added`,complete:!0})}for(let n of vz(e.lineInsertions)){let e=JR(qR(n).text);e!==void 0&&t.push({text:e,kind:`added`,complete:!0})}let n=JR(e.patch);n!==void 0&&t.push({text:n,kind:`patch`,complete:!0});let r=pz(t,!0);return{preview:r,previewLanguage:r?`diff`:void 0}}function xz(e,t){let n=pz(az(e,[`oldText`,`newText`,`text`,`patch`]).map(e=>({text:e.value,kind:e.property===`oldText`?`removed`:e.property===`patch`?`patch`:`added`,complete:e.complete})),t);return{preview:n,previewLanguage:n?`diff`:void 0}}function Sz(e){let t=e.progress;if(t)return{operations:t.operationCount??0,generatedLines:t.generatedLineCount??0,estimatedAdditions:t.estimatedAdditions,estimatedDeletions:t.estimatedDeletions,estimated:t.estimated}}function Cz(e){let t=ez(e,`oldText`),n=ez(e,`newText`),r=ez(e,`text`),i=$R(e,`patch`,{maxChars:24e3}),a=i.reduce((e,t)=>{let n=_z(t);return{additions:e.additions+n.additions,deletions:e.deletions+n.deletions}},{additions:0,deletions:0}),o=n.reduce((e,t)=>e+t,0)+r.reduce((e,t)=>e+t,0)+a.additions,s=t.reduce((e,t)=>e+t,0)+a.deletions;return{operations:Math.max(t.length,n.length)+r.length+i.length,generatedLines:o,estimatedAdditions:o,estimatedDeletions:s,estimated:!0}}function wz(e,t){let n=qR(e.args),r=yz(n),i=e.argsText?Cz(e.argsText):void 0,a=Sz(e),o=r??i??a??{operations:0,generatedLines:0,estimated:!1},s=e.progress?.generatedPreview?{preview:cz(e.progress.generatedPreview),previewLanguage:e.progress.generatedPreviewLanguage}:{},c=e.argsText?xz(e.argsText,!!e.done):void 0,l=r?bz(n):c?.preview?c:s,u=[];o.operations>0&&u.push({text:YR(o.operations,`operation`)});let d=o.estimatedAdditions??o.generatedLines;return d>0&&u.push({text:`+${d}`,tone:`success`}),o.estimatedDeletions!==void 0&&o.estimatedDeletions>0&&u.push({text:`-${o.estimatedDeletions}`,tone:`error`}),{kind:`edit`,toolName:`edit`,path:hz(e,t),statusText:e.done?`Submitting`:`Generating`,meta:u,operationCount:o.operations,generatedLineCount:o.generatedLines,estimatedAdditions:o.estimatedAdditions,estimatedDeletions:o.estimatedDeletions,estimated:o.estimated,preview:l.preview,previewLanguage:l.previewLanguage,done:!!e.done}}function Tz(e){let t=JR(qR(e.args).command),n=az(e.argsText,[`command`])[0]?.value,r=t??n,i=uz(r),a=XR(r),o=r!==void 0&&r.length>0,s=[];return a!==void 0&&a>1&&s.push({text:YR(a,`command line`),tone:`info`}),{kind:`bash`,toolName:`bash`,statusText:o?e.done?`Submitting command…`:`Generating command…`:`Waiting for command…`,meta:s,command:r,inputMode:`inline`,...i,language:`bash`,done:!!e.done}}function Ez(e,t){let n=qR(e.args),r=hz(e,t),i=JR(n.code),a=az(e.argsText,[`code`])[0]?.value,o=i??a,s=uz(o),c=XR(o),l=o!==void 0&&o.length>0,u=r!==void 0&&r.length>0,d=u&&!l?`file`:`inline`,f=[];return c!==void 0&&c>0&&f.push({text:YR(c,`code line`),tone:`info`}),u&&!l&&f.push({text:`file`,tone:`info`}),{kind:`python`,toolName:`python_exec`,path:d===`file`?r:void 0,statusText:d===`file`?e.done?`Submitting Python file…`:`Preparing Python file…`:l?e.done?`Submitting Python code…`:`Generating Python code…`:`Waiting for Python code or path…`,meta:f,code:o,codeLineCount:c,inputMode:d,...s,language:`python`,done:!!e.done}}function Dz(e,t,n){let r=t.toolName??`tool`,i=zx(r,{args:t.args,argsText:t.argsText},`drafting`,n),a=GR(e),o=i.body.kind===`none`?Lx(r)?void 0:HR(t,{maxLines:6,maxChars:tz}):i.body;return{...e,path:e.path??i.primaryArg?.text,primaryArg:i.primaryArg,meta:WR(e.meta,i.secondary),argumentBody:a??o??i.body,safetyNotes:i.safetyNotes}}function Oz(e,t){if(e.toolName===`write`)return Dz(gz(e,t),e,t);if(e.toolName===`edit`)return Dz(wz(e,t),e,t);if(e.toolName===`bash`)return Dz(Tz(e),e,t);if(e.toolName===`python_exec`)return Dz(Ez(e,t),e,t);let n=e.toolName??`tool`,r=zx(n,{args:e.args,argsText:e.argsText},`drafting`,t);return Dz({kind:`generic`,toolName:n,path:r.primaryArg?.text,statusText:e.done?`${n} arguments prepared.`:`Preparing ${n} arguments…`,meta:r.secondary,primaryArg:r.primaryArg,argumentBody:r.body,safetyNotes:r.safetyNotes,done:!!e.done},e,t)}var kz=new Set([`INVALID_TOOL_ARGUMENTS`,`TOOL_ARGUMENT_INVALID`]);function Az(e){if(e.status!==`error`)return!1;let t=e.errorDetails?.code.toUpperCase();return t?kz.has(t)||t.endsWith(`_ARGUMENT_INVALID`):!1}function jz(e){if(!e.toolCall)return e.draft?.done?`prepared`:`drafting`;switch(e.toolCall.status){case`pending_approval`:return`approval`;case`waiting_for_user`:return`interaction`;case`requested`:case`running`:return`executing`;case`completed`:return`completed`;case`error`:case`denied`:return`failed`}}function Mz(e,t){return[...(e??[]).map(e=>`${e.tone??`default`}:${e.mono?`mono`:`text`}:${e.openPath?`file`:e.href?`link`:`label`}`),t?`details`:``].join(`,`)}function Nz(e){let t=e.toolCall?e.toolCall.status:e.draft?.done?`prepared`:`drafting`,n=e.toolCall?.status===`error`||e.toolCall?.status===`denied`,r=!!(e.toolCall&&(e.toolCall.status===`requested`||e.toolCall.status===`running`)),i;i=!e.toolCall||n||e.hasApproval||e.toolCall.status===`pending_approval`?`none`:e.hasInteraction?`output`:r&&!e.hasDurableBodyContent?e.resultPlaceholder?`placeholder`:`none`:`output`;let a=i===`output`;i===`output`&&!e.bodyHydrated&&(i=`none`);let o=e.argumentRegion===`none`?!1:e.argumentRegion===`persistent`?!!e.hasArgumentBody:!!(e.hasArgumentBody&&!a),s=e.hasApproval?`approval`:`none`,c=!!(n&&e.toolCall?.error?.trim()),l=s===`none`&&!e.hasInteraction&&((e.footerItems?.length??0)>0||!!e.hasDetailsAction),u=Mz(e.footerItems,!!e.hasDetailsAction);return{phase:t,argumentVisible:o,interactionMode:s,resultMode:i,errorVisible:c,footerVisible:l,structuralRevision:[o?`arg`:`no-arg`,`interaction:${s}`,i===`placeholder`?`result:placeholder:${e.resultPlaceholder?.variant}:${e.resultPlaceholder?.rows}`:`result:${i}`,c?`error`:`no-error`,l?`footer:${u}`:`no-footer`].join(`|`)}}function Pz(e){return e?`${e.openPath?`file`:e.href?`link`:`text`}:${e.preserveWhitespace?`preserve`:`wrap`}`:`none`}function Fz(e){return[e.stage,e.activityRevision,`badge:${e.badge}`,`arg:${Pz(e.arg)}`].join(`|`)}var Iz=h(`<button type="button"> </button>`),Lz=h(`<a target="_blank" rel="noreferrer noopener"> </a>`),Rz=h(`<span> </span>`),zz=h(`<div class="tool-header svelte-jnd58a"><!> <span class="badge svelte-jnd58a"> </span> <!></div>`);function Bz(e,t){a(t,!0);let n=I(t,`dotPulse`,3,!1),i=I(t,`waitingForUser`,3,!1);var o=zz(),c=V(o);VP(c,{get tone(){return t.dotTone},get pulse(){return n()},get waitingForUser(){return i()},get label(){return t.statusLabel},size:14,class:`mr-1.5 align-middle`});var l=L(c,2),u=V(l,!0);d(l);var f=L(l,2),p=e=>{var n=U(),i=R(n),a=e=>{var n=Iz();let i;var a=V(n,!0);d(n),F(()=>{i=s(n,1,`arg link svelte-jnd58a`,null,i,{"whitespace-pre-wrap":t.arg.preserveWhitespace}),q(n,`title`,t.arg.text),A(a,t.arg.text)}),r(`click`,n,()=>t.onOpenFile?.(t.arg.openPath,t.arg.line)),g(e,n)},o=e=>{var n=Lz();let r;var i=V(n,!0);d(n),F(()=>{r=s(n,1,`arg link svelte-jnd58a`,null,r,{"whitespace-pre-wrap":t.arg.preserveWhitespace}),q(n,`href`,t.arg.href),q(n,`title`,t.arg.text),A(i,t.arg.text)}),g(e,n)},c=e=>{var n=Rz();let r;var i=V(n,!0);d(n),F(()=>{r=s(n,1,`arg svelte-jnd58a`,null,r,{"whitespace-pre-wrap":t.arg.preserveWhitespace}),q(n,`title`,t.arg.text),A(i,t.arg.text)}),g(e,n)};k(i,e=>{t.arg.openPath?e(a):t.arg.href?e(o,1):e(c,-1)}),g(e,n)};k(f,e=>{t.arg&&e(p)}),d(o),F(()=>A(u,t.badge)),g(e,o),z()}T([`click`]);var Vz=new Ce(`(prefers-reduced-motion: reduce)`),Hz=Symbol(`conversation-motion-budget`);function Uz(e){_e(Hz,e)}function Wz(){return c(Hz)}var Gz={standard:{durationMs:180,easing:`cubic-bezier(0.2, 0.8, 0.2, 1)`,settleOffsetPx:2,fromOpacity:.88},compact:{durationMs:120,easing:`cubic-bezier(0.2, 0.8, 0.2, 1)`,settleOffsetPx:0,fromOpacity:.9},minimal:{durationMs:90,easing:`ease-out`,settleOffsetPx:0,fromOpacity:.92}};function Kz(e){let t=Gz[e.profile],n=e.reducedMotion||!e.visible;return{animateHeight:!n&&e.profile!==`minimal`&&Math.abs(e.fromHeight-e.targetHeight)>.5,animateContent:!n&&e.targetHeight>0,durationMs:n?0:t.durationMs,easing:t.easing,settleOffsetPx:t.settleOffsetPx,fromOpacity:t.fromOpacity}}function qz(e,t){let n,r,i=!1;function a(){e.style.removeProperty(`overflow`),e.style.removeProperty(`will-change`)}function o(){t.style.removeProperty(`will-change`)}function s(){n?.cancel(),r?.cancel(),n=void 0,r=void 0,a(),o()}function c(){i||s()}function l(c,l,u){if(i)return;let d=t.getBoundingClientRect().height,f=Kz({profile:u,fromHeight:c,targetHeight:d,reducedMotion:l,visible:e.getClientRects().length>0});if(s(),f.animateHeight){e.style.overflow=`hidden`,e.style.willChange=`height`;let t=e.animate([{height:`${Math.max(0,c)}px`},{height:`${Math.max(0,d)}px`}],{duration:f.durationMs,easing:f.easing});n=t,t.finished.then(()=>{n===t&&(n=void 0,a())}).catch(()=>void 0)}if(f.animateContent){t.style.willChange=`transform, opacity`;let e=t.animate([{opacity:f.fromOpacity,transform:`translateY(${f.settleOffsetPx}px)`},{opacity:1,transform:`translateY(0)`}],{duration:f.durationMs,easing:f.easing});r=e,e.finished.then(()=>{r===e&&(r=void 0,o())}).catch(()=>void 0)}}return{transition:l,snap:c,destroy(){i||=(s(),!0)}}}var Jz=h(`<div class="min-w-0"><div class="min-w-0"><!></div></div>`);function Yz(e,t){a(t,!0);let n=Wz(),r=Y(void 0),i=Y(void 0),o,s,c;function l(){return!o&&W(r)&&W(i)&&(o=qz(W(r),W(i))),o}Ae(()=>{let e=t.revision;if(s===void 0){s=e;return}e!==s&&(c=W(r)?.getBoundingClientRect().height,s=e)}),be(()=>{if(t.revision,c===void 0)return;let e=c;c=void 0;let i=Vz.current,a=!!W(r)?.getClientRects().length,o=!i&&a?n?.claim()??`standard`:`standard`;l()?.transition(e,i,o)}),be(()=>{Vz.current&&o?.snap()}),be(()=>()=>o?.destroy());var f=Jz(),p=V(f),m=V(p),h=e=>{var n=U();u(R(n),()=>t.children),g(e,n)};k(m,e=>{t.children&&e(h)}),d(p),fe(p,e=>K(i,e),()=>W(i)),d(f),fe(f,e=>K(r,e),()=>W(r)),g(e,f),z()}var Xz=h(`<pre class="tool-error svelte-ga7hcf"> </pre>`),Zz=h(`<div class="tool-body grid gap-1.5 svelte-ga7hcf"><!></div>`),Qz=h(`<article class="tool-card svelte-ga7hcf"><!> <div><!> <!> <!></div></article>`);function $z(e,t){a(t,!0);let n=I(t,`dotPulse`,3,!1),r=I(t,`meta`,19,()=>[]),i=I(t,`footer`,3,!0),o=I(t,`bodyVisible`,3,!1),c=I(t,`layoutRevision`,3,`static`),l=J(()=>{if(t.draftPhase)return`running`;switch(t.status){case`requested`:case`pending_approval`:case`waiting_for_user`:case`running`:return`running`;case`completed`:return`complete`;case`error`:case`denied`:return`error`;default:return`idle`}}),f=J(()=>t.draftPhase?`Preparing tool call`:t.status===`pending_approval`?`Needs approval`:t.status===`waiting_for_user`?`Waiting for user feedback`:t.status===`requested`||t.status===`running`?`Executing tool call`:t.status===`completed`?`Tool call completed`:t.status===`denied`?`Tool call denied`:t.status===`error`?`Tool call failed`:`Tool call status`),p=J(()=>i()&&(r().length>0||!!t.detailsAction)),m=J(()=>!!t.error||o()||W(p));Yz(e,{get revision(){return c()},children:(e,i)=>{var a=Qz(),c=V(a);{let e=J(()=>t.status===`waiting_for_user`||t.status===`pending_approval`);Bz(c,{get dotTone(){return t.dotTone},get dotPulse(){return n()},get waitingForUser(){return W(e)},get statusLabel(){return W(f)},get badge(){return t.badge},get arg(){return t.arg},get onOpenFile(){return t.onOpenFile}})}var h=L(c,2),_=V(h),v=e=>{var n=Xz(),r=V(n,!0);d(n),F(()=>A(r,t.error)),g(e,n)};k(_,e=>{t.error&&e(v)});var y=L(_,2),b=e=>{var n=Zz();u(V(n),()=>t.children),d(n),g(e,n)};k(y,e=>{o()&&t.children&&e(b)});var x=L(y,2),S=e=>{Kk(e,{get meta(){return r()},get detailsAction(){return t.detailsAction},get onOpenFile(){return t.onOpenFile}})};k(x,e=>{W(p)&&e(S)}),d(h),d(a),F(()=>{q(a,`data-state`,t.draftPhase??W(l)),s(h,1,`grid min-w-0 gap-1.5${W(m)?` pt-1.5`:``}`,`svelte-ga7hcf`)}),g(e,a)},$$slots:{default:!0}}),z()}var eB=h(`<div class="grid gap-1.5 rounded-sm border border-border bg-sidebar p-2.5" aria-hidden="true"></div>`),tB=h(`<div class="grid gap-1.5" aria-hidden="true"></div>`);function nB(e,t){let n=I(t,`variant`,3,`list`),r=I(t,`rows`,3,3),i=J(()=>Array.from({length:Math.max(1,r())},(e,t)=>t));var a=U(),o=R(a),s=e=>{var t=eB();_(t,20,()=>W(i),e=>e,(e,t)=>{{let n=J(()=>t%2==0?`h-3 w-full`:`h-3 w-2/3`);gN(e,{get class(){return W(n)}})}}),d(t),g(e,t)},c=e=>{var t=tB();_(t,20,()=>W(i),e=>e,(e,t)=>{gN(e,{class:`h-9 w-full rounded-sm`})}),d(t),g(e,t)};k(o,e=>{n()===`text`?e(s):e(c,-1)}),g(e,a)}var rB=h(`<div class="flex min-h-40 items-center justify-center text-sm text-muted-foreground">Loading full tool call…</div>`),iB=h(`<div class="grid gap-3"><p class="m-0 text-sm text-destructive"> </p> <!></div>`),aB=h(`<span> </span>`),oB=h(`<div class="flex flex-wrap gap-1.5"></div>`),sB=h(`<details class="rounded-sm border bg-muted/20"><summary class="cursor-pointer px-2.5 py-2 text-xs font-medium text-muted-foreground">Arguments</summary> <div class="border-t p-2"><!></div></details>`),cB=h(`<details class="rounded-sm border bg-muted/20"><summary class="cursor-pointer px-2.5 py-2 text-xs font-medium text-muted-foreground">Result</summary> <div class="border-t p-2"><!></div></details>`),lB=h(`<div class="grid gap-2"><!> <!></div>`),uB=h(`<div class="grid gap-3"><!> <!> <!></div>`);function dB(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`loading`,3,!1),i=I(t,`planReviewModels`,19,()=>[]),o=I(t,`planReviewModelKey`,3,``),c=I(t,`planReviewThinkingLevel`,3,`off`),l=J(()=>t.toolCall??t.previewToolCall),u=J(()=>Qb(W(l))),f=J(()=>Vx(W(u),W(l))),p=J(()=>IR(W(u).kind)),m=J(()=>t.pendingUserQuestion?.toolCallId===W(l).id?t.pendingUserQuestion:void 0),h=J(()=>t.pendingPlanReview?.toolCallId===W(l).id?t.pendingPlanReview:void 0);function v(e,t,n){let r=e;return r[t]??r[n]}function y(e){if(e!==void 0){if(typeof e==`string`)return e.length>0?{text:e}:void 0;try{let t=JSON.stringify(e,null,2);if(t!==void 0)return{text:t,language:`json`}}catch{}return{text:String(e)}}}let b=J(()=>y(v(W(l),`args`,`argsPreview`))),x=J(()=>y(v(W(l),`result`,`resultPreview`))),S=J(()=>[W(l).status,W(f).primaryArg?.text].filter(Boolean).join(` · `));{let a=J(()=>`${W(l).toolName} details`);sP(e,{get title(){return W(a)},get description(){return W(S)},size:`wide`,get onOpenChange(){return t.onOpenChange},get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=U(),v=R(a),y=e=>{g(e,rB())},S=e=>{var n=iB(),r=V(n),i=V(r,!0);d(r),G(L(r,2),{size:`sm`,variant:`outline`,class:`w-fit`,onclick:()=>void t.onRetry?.(),children:(e,t)=>{w(),g(e,M(`Retry`))},$$slots:{default:!0}}),d(n),F(()=>A(i,t.error)),g(e,n)},T=e=>{var n=uB(),r=V(n),a=e=>{var t=oB();_(t,21,()=>W(f).meta,E,(e,t)=>{var n=aB();let r;var i=V(n,!0);d(n),F(()=>{r=s(n,1,`rounded-sm border bg-muted/30 px-1.5 py-0.5 text-xs text-muted-foreground`,null,r,{"font-mono":W(t).mono}),A(i,W(t).text)}),g(e,n)}),d(t),g(e,t)};k(r,e=>{W(f).meta.length>0&&e(a)});var v=L(r,2);C(v,()=>W(p),(e,n)=>{n(e,{get toolCall(){return W(l)},get view(){return W(u)},expanded:!0,get onOpenFile(){return t.onOpenFile},get questionRecord(){return W(m)},get planReview(){return W(h)},get onAnswerUserQuestion(){return t.onAnswerUserQuestion},get planReviewModels(){return i()},get planReviewModelKey(){return o()},get planReviewThinkingLevel(){return c()},get onDismissUserQuestion(){return t.onDismissUserQuestion},get onAcceptPlanReview(){return t.onAcceptPlanReview},get onAcceptPlanReviewInNewChat(){return t.onAcceptPlanReviewInNewChat},get onRejectPlanReview(){return t.onRejectPlanReview}})});var y=L(v,2),S=e=>{var t=lB(),n=V(t),r=e=>{var t=sB(),n=L(V(t),2);qA(V(n),{get code(){return W(b).text},get language(){return W(b).language},maxHeight:`22rem`,trim:!1}),d(n),d(t),g(e,t)};k(n,e=>{W(b)&&e(r)});var i=L(n,2),a=e=>{var t=cB(),n=L(V(t),2);qA(V(n),{get code(){return W(x).text},get language(){return W(x).language},maxHeight:`22rem`,trim:!1}),d(n),d(t),g(e,t)};k(i,e=>{W(x)&&e(a)}),d(t),g(e,t)};k(y,e=>{(W(b)||W(x))&&e(S)}),d(n),g(e,n)};k(v,e=>{r()&&!t.toolCall?e(y):t.error&&!t.toolCall?e(S,1):e(T,-1)}),g(e,a)},$$slots:{default:!0}})}z()}var fB=h(`<span class="font-normal text-muted-foreground"> </span>`),pB=h(`<li> </li>`),mB=h(`<ul class="m-0 grid list-disc gap-1 pl-5 text-xs text-muted-foreground"></ul>`),hB=h(`<div class="grid gap-2" aria-label="Approval operation summary"><p class="m-0 text-sm font-medium text-foreground"> <!></p> <!> <!></div>`);function gB(e,t){a(t,!0);let n=I(t,`includeBody`,3,!0);var r=hB(),i=V(r),o=V(i),s=L(o),c=e=>{var n=fB(),r=V(n);d(n),F(()=>A(r,`— ${t.presentation.primaryArg.text??``}`)),g(e,n)};k(s,e=>{t.presentation.primaryArg&&e(c)}),d(i);var l=L(i,2),u=e=>{DN(e,{get body(){return t.presentation.body}})};k(l,e=>{n()&&t.presentation.body.kind!==`none`&&e(u)});var f=L(l,2),p=e=>{var n=mB();_(n,23,()=>t.presentation.safetyNotes,(e,t)=>`${e}:${t}`,(e,t)=>{var n=pB(),r=V(n,!0);d(n),F(()=>A(r,W(t))),g(e,n)}),d(n),g(e,n)};k(f,e=>{t.presentation.safetyNotes.length>0&&e(p)}),d(r),F(()=>A(o,`${t.toolName??``} `)),g(e,r),z()}var _B=h(`<p class="m-0 text-sm text-muted-foreground"> </p>`),vB=h(`<!>Approving…`,1),yB=h(`<!>Approve`,1),bB=h(`<!>Denying…`,1),xB=h(`<!>Deny`,1),SB=h(`<!> <!>`,1),CB=h(`<p class="m-0 text-xs text-destructive" role="alert"> </p>`),wB=h(`<div class="grid gap-2" aria-label="Tool approval"><!> <!> <!> <!></div>`);function TB(e,t){a(t,!0);let n=I(t,`includeBody`,3,!0),r=Y(void 0),i=Y(void 0);async function o(e){if(W(r))return;let n=e===`approve`?t.onGrantApproval:t.onDenyApproval;if(n){K(r,e,!0),K(i,void 0);try{await n(t.approval.id)}catch(e){K(i,e instanceof Error&&e.message.trim()?e.message:`Could not resolve the approval.`,!0)}finally{K(r,void 0)}}}function s(e){return e===`destructive`||e===`secret`||e===`deployment`?`error`:e===`command`||e===`network`||e===`workspace_write`?`warning`:e===`agent_spawn`?`info`:`default`}let c=J(()=>[...t.presentation.secondary,{text:t.approval.risk,tone:s(t.approval.risk)}]);var l=wB(),u=V(l);gB(u,{get toolName(){return t.toolName},get presentation(){return t.presentation},get includeBody(){return n()}});var f=L(u,2),p=e=>{var n=_B(),r=V(n,!0);d(n),F(()=>A(r,t.approval.reason)),g(e,n)};k(f,e=>{t.approval.reason&&e(p)});var m=L(f,2);Kk(m,{get meta(){return W(c)},get detailsAction(){return t.detailsAction},actions:e=>{var t=SB(),n=R(t);{let e=J(()=>!!W(r));G(n,{size:`sm`,get disabled(){return W(e)},onclick:()=>void o(`approve`),children:(e,t)=>{var n=U(),i=R(n),a=e=>{var t=vB();Fi(R(t),{class:`size-3.5`}),w(),g(e,t)},o=e=>{var t=yB();$I(R(t),{size:14,strokeWidth:2.4}),w(),g(e,t)};k(i,e=>{W(r)===`approve`?e(a):e(o,-1)}),g(e,n)},$$slots:{default:!0}})}var i=L(n,2);{let e=J(()=>!!W(r));G(i,{size:`sm`,variant:`secondary`,get disabled(){return W(e)},onclick:()=>void o(`deny`),children:(e,t)=>{var n=U(),i=R(n),a=e=>{var t=bB();Fi(R(t),{class:`size-3.5`}),w(),g(e,t)},o=e=>{var t=xB();yl(R(t),{size:14,strokeWidth:2.4}),w(),g(e,t)};k(i,e=>{W(r)===`deny`?e(a):e(o,-1)}),g(e,n)},$$slots:{default:!0}})}g(e,t)},$$slots:{actions:!0}});var h=L(m,2),_=e=>{var t=CB(),n=V(t,!0);d(t),F(()=>A(n,W(i))),g(e,t)};k(h,e=>{W(i)&&e(_)}),d(l),g(e,l),z()}var EB=h(`<!> <!> <!>`,1),DB=h(`<!> <!>`,1);function OB(e,t){a(t,!0);let n=I(t,`hydrateBody`,3,!0),r=I(t,`detailsEnabled`,3,!0),i=I(t,`planReviewModels`,19,()=>[]),o=I(t,`planReviewModelKey`,3,``),s=I(t,`planReviewThinkingLevel`,3,`off`),c=Y(!1),l=Y(!1),u=Y(void 0),d=Y(void 0),f=Y(void 0),p,m=Y(!1),h=J(()=>n()||W(m)),_=Rk(),v=ie(()=>t.liveOutput),y=Y(N(v)),b=v?.text??``,x=new jk(e=>{K(y,e,!0)});be(()=>{let e=t.liveOutput,n=e?.text??``,r=n.slice(b.length),i=!!(t.toolCall&&![`requested`,`pending_approval`,`running`].includes(t.toolCall.status));b=n,x.enqueue(e,{priority:i||r.includes(`
126
+ `)})}),be(()=>()=>x.destroy());let S=J(()=>t.toolCall?Qb(t.toolCall,W(y)):void 0),w=J(()=>t.toolCall&&W(S)?Vx(W(S),t.toolCall):void 0),T=J(()=>W(S)?IR(W(S).kind):void 0),E=J(()=>t.draft?Oz(t.draft.block,t.cwd):void 0),D=J(()=>W(E)?KR(W(E)):!1);function O(e){if(!e)return!1;switch(e.kind){case`read`:return!!(e.image||e.content?.length);case`bash`:case`python`:return e.output.length>0;case`edit`:return!!e.diff;case`write`:return!!e.content?.length;case`grep`:return e.matchCount>0;case`find`:return e.count>0;case`ls`:return e.total>0;case`todos`:return e.items.length>0;case`task_action`:return!!(e.task||e.tasks?.length||e.liveLog?.length);case`task_status`:return e.tasks.length>0;case`task_logs`:return e.events.length>0;case`explore`:return!!(e.reports.length||e.liveUpdates.length||e.liveLog?.length);case`web_search`:return!!(e.answer||e.results.length);case`web_fetch`:return!!e.content?.length;case`generic`:return!!(e.resultText||e.result.length);case`jira`:case`confluence`:return t.toolCall?.resultPreview!==void 0;case`ask_user`:case`plan_mode`:return!0}}let ee=J(()=>O(W(S))),te=J(()=>t.toolCall&&t.pendingApproval?.toolCallId===t.toolCall.id&&t.toolCall.status===`pending_approval`?t.pendingApproval:void 0),A=J(()=>Rx(t.toolCall?.toolName??t.draft?.block.toolName??`tool`)),ne=J(()=>({args:t.draft?.block.args,argsText:t.draft?.block.argsText,argsPreview:t.toolCall?.argsPreview}));function j(){return t.toolCall?t.toolCall.status===`error`||t.toolCall.status===`denied`?`failed`:t.toolCall.status===`completed`?`completed`:`executing`:`drafting`}let M=J(()=>{let e=t.toolCall?.toolName??t.draft?.block.toolName;if(e)return zx(e,W(ne),j(),t.cwd)}),re=J(()=>{if(!t.toolCall)return W(E)?.argumentBody;if(!Az(t.toolCall))return W(M)?.body}),P=J(()=>t.toolCall?!!(W(re)&&W(re).kind!==`none`):W(D)),ae=J(()=>{let e=t.toolCall?.toolName??t.draft?.block.toolName;if(e)return zx(e,W(ne),`approval`,t.cwd)}),oe=J(()=>(t.toolCall?.toolName??t.draft?.block.toolName)===`explore`),se=J(()=>W(S)?.kind===`ask_user`||W(S)?.kind===`plan_mode`&&W(S).action===`present`),F=J(()=>t.toolCall&&t.pendingUserQuestion?.toolCallId===t.toolCall.id?t.pendingUserQuestion:void 0),ce=J(()=>t.toolCall&&t.pendingPlanReview?.toolCallId===t.toolCall.id?t.pendingPlanReview:void 0);function le(...e){let t=[];return e.flat().filter(e=>t.includes(e.text)?!1:(t.push(e.text),!0))}let ue=J(()=>t.toolCall?t.toolCall.status===`completed`?W(w)?.meta??[]:le(W(E)?.meta??[],W(M)?.secondary??[],W(w)?.meta??[]):W(E)?.meta??[]),de=J(()=>Nz({draft:t.draft?.block,toolCall:t.toolCall,argumentRegion:W(A).argumentRegion,hasArgumentBody:W(P),hasDurableBodyContent:W(ee),bodyHydrated:W(h),hasApproval:!!W(te),hasInteraction:W(se),resultPlaceholder:W(A).resultPlaceholder,footerItems:W(ue),hasDetailsAction:!!(t.toolCall&&r())})),fe=J(()=>{if(W(E))return W(E).primaryArg?W(E).primaryArg:W(E).path?{text:W(E).path}:{text:`Preparing arguments…`}}),pe=J(()=>W(w)?.badge??W(E)?.toolName??t.draft?.block.toolName??`tool`),me=J(()=>W(se)?W(w)?.primaryArg:W(w)?.primaryArg??W(M)?.primaryArg??W(fe)),he=J(()=>jz({draft:t.draft?.block,toolCall:t.toolCall})),ge=J(()=>Fz({stage:W(he),activityRevision:W(de).structuralRevision,badge:W(pe),arg:W(me)})),_e=J(()=>W(w)?.dotTone??`running`),ve=J(()=>W(w)?.dotPulse??!0),ye=J(()=>W(ue)),B=J(()=>t.toolCall&&r()?{label:W(w)?.detailsAction?.label??`Details`,onClick:Se}:void 0),V=J(()=>({label:W(w)?.detailsAction?.label??`Details`,onClick:Se})),xe=J(()=>t.toolCall?.error?ii(t.toolCall.error,{headLines:4,tailLines:2,maxChars:2e3}).text:void 0);be(()=>{n()&&K(m,!0)}),be(()=>{let e=t.toolCall?.id;e!==p&&(p=e,K(c,!1),K(l,!1),K(u,void 0),K(d,void 0),K(f,void 0))});async function Se(){if(t.toolCall&&(K(c,!0),!(W(d)&&W(f)===t.toolCall.updatedAt))){K(l,!0),K(u,void 0);try{let e=_.fetchToolCall;if(!e)throw Error(`Tool details are unavailable here.`);K(d,await e(t.toolCall.id),!0),K(f,t.toolCall.updatedAt,!0)}catch(e){K(u,e instanceof Error?e.message:String(e),!0)}finally{K(l,!1)}}}var Ce=DB(),we=R(Ce);{let e=J(()=>t.toolCall?.status),n=J(()=>t.toolCall?void 0:W(de).phase===`prepared`?`prepared`:`drafting`),r=J(()=>W(de).errorVisible?W(xe):void 0),a=J(()=>W(oe)||W(de).argumentVisible||W(de).interactionMode!==`none`||W(de).resultMode!==`none`);$z(we,{get status(){return W(e)},get draftPhase(){return W(n)},get dotTone(){return W(_e)},get dotPulse(){return W(ve)},get badge(){return W(pe)},get arg(){return W(me)},get error(){return W(r)},get meta(){return W(ye)},get footer(){return W(de).footerVisible},get bodyVisible(){return W(a)},get layoutRevision(){return W(ge)},get detailsAction(){return W(B)},get onOpenFile(){return t.onOpenFile},children:(e,n)=>{var r=EB(),a=R(r),c=e=>{{let n=J(()=>W(S)?.kind===`explore`?W(S):void 0);pF(e,{get draft(){return t.draft},get toolCall(){return t.toolCall},get view(){return W(n)},get onOpenFile(){return t.onOpenFile}})}},l=e=>{{let n=J(()=>!!(t.toolCall||t.draft?.block.done)),r=J(()=>!t.toolCall&&!t.draft?.block.done);DN(e,{get body(){return W(re)},get highlight(){return W(n)},get streaming(){return W(r)}})}};k(a,e=>{W(oe)?e(c):W(de).argumentVisible&&W(re)&&e(l,1)});var u=L(a,2),d=e=>{{let n=J(()=>!W(de).argumentVisible);TB(e,{get approval(){return W(te)},get toolName(){return t.toolCall.toolName},get presentation(){return W(ae)},get includeBody(){return W(n)},get detailsAction(){return W(V)},get onGrantApproval(){return t.onGrantApproval},get onDenyApproval(){return t.onDenyApproval}})}};k(u,e=>{W(de).interactionMode===`approval`&&W(te)&&W(ae)&&t.toolCall&&e(d)});var f=L(u,2),p=e=>{nB(e,{get variant(){return W(A).resultPlaceholder.variant},get rows(){return W(A).resultPlaceholder.rows}})},m=e=>{var n=U(),r=R(n);{let e=J(()=>W(se)?W(V):void 0);C(r,()=>W(T),(n,r)=>{r(n,{get toolCall(){return t.toolCall},get view(){return W(S)},expanded:!1,get onOpenFile(){return t.onOpenFile},get detailsAction(){return W(e)},get questionRecord(){return W(F)},get planReview(){return W(ce)},get onAnswerUserQuestion(){return t.onAnswerUserQuestion},get planReviewModels(){return i()},get planReviewModelKey(){return o()},get planReviewThinkingLevel(){return s()},get onDismissUserQuestion(){return t.onDismissUserQuestion},get onAcceptPlanReview(){return t.onAcceptPlanReview},get onAcceptPlanReviewInNewChat(){return t.onAcceptPlanReviewInNewChat},get onRejectPlanReview(){return t.onRejectPlanReview}})})}g(e,n)};k(f,e=>{!W(oe)&&W(de).resultMode===`placeholder`&&W(A).resultPlaceholder?e(p):!W(oe)&&W(de).resultMode===`output`&&t.toolCall&&W(S)&&W(T)&&e(m,1)}),g(e,r)},$$slots:{default:!0}})}var H=L(we,2),Te=e=>{dB(e,{get open(){return W(c)},get previewToolCall(){return t.toolCall},get toolCall(){return W(d)},get loading(){return W(l)},get error(){return W(u)},get pendingUserQuestion(){return t.pendingUserQuestion},get pendingPlanReview(){return t.pendingPlanReview},get onOpenFile(){return t.onOpenFile},get planReviewModels(){return i()},get planReviewModelKey(){return o()},get planReviewThinkingLevel(){return s()},get onAnswerUserQuestion(){return t.onAnswerUserQuestion},get onDismissUserQuestion(){return t.onDismissUserQuestion},get onAcceptPlanReview(){return t.onAcceptPlanReview},get onAcceptPlanReviewInNewChat(){return t.onAcceptPlanReviewInNewChat},get onRejectPlanReview(){return t.onRejectPlanReview},onRetry:Se,onOpenChange:e=>K(c,e,!0)})};k(H,e=>{t.toolCall&&r()&&e(Te)}),g(e,Ce),z()}function kB(e){return e.bodyVisible?e.previewVisible?`preview`:`status`:`none`}function AB(e){return[e.state,`body:${e.bodyKind}`,e.errorVisible?`error`:`no-error`,e.footerItemCount>0?`footer:${e.footerItemCount}`:`no-footer`].join(`|`)}var jB=h(`<p class="m-0 text-sm leading-6 text-muted-foreground">Summarizing recent work…</p>`),MB=h(`<p class="m-0 text-sm leading-6 text-muted-foreground">Compaction stopped.</p>`),NB=h(`<div class="my-2"><!></div>`);function PB(e,t){a(t,!0);function n(e){return e&&typeof e==`object`?e:void 0}let r=J(()=>n(t.notice.details)),i=J(()=>typeof W(r)?.compactedMessages==`number`?W(r).compactedMessages:void 0),o=J(()=>t.notice.reason===`threshold`?`auto compact`:t.notice.reason===`overflow`?`overflow recovery`:`manual`),s=J(()=>t.notice.state===`failed`?`danger`:t.notice.state===`cancelled`?`warn`:t.notice.state===`running`?`running`:`good`),c=J(()=>{let e=t.notice.contextTokens??t.notice.tokensBefore;if(!(!e||!t.notice.contextWindow))return Math.round(e/t.notice.contextWindow*100)}),l=J(()=>{if(t.notice.state===`running`)return t.notice.summaryPreview?.trimEnd()??``;if(t.notice.state!==`completed`)return``;let e=(t.notice.summary??t.notice.text??``).trimEnd();return e?Jt(e).slice(-6).join(`
127
+ `):``}),u=Y(N(Date.now()));be(()=>{if(t.notice.state!==`running`)return;let e=setInterval(()=>{K(u,Date.now(),!0)},250);return()=>clearInterval(e)});let f=J(()=>t.notice.createdAt?Date.parse(t.notice.createdAt):NaN),p=J(()=>{if(!(t.notice.state!==`running`||Number.isNaN(W(f))))return Math.max(0,Math.floor((W(u)-W(f))/1e3))}),m=J(()=>W(p)===void 0?void 0:`${Math.floor(W(p)/60)}:${String(W(p)%60).padStart(2,`0`)}`),h=J(()=>W(p)!==void 0&&W(p)>=1),_=J(()=>{let e=[];return typeof t.notice.tokensBefore==`number`&&e.push({text:`${K_(t.notice.tokensBefore)} before`}),typeof t.notice.tokensAfter==`number`&&e.push({text:`≈${K_(t.notice.tokensAfter)} after`}),typeof t.notice.freedTokens==`number`&&t.notice.freedTokens>0&&e.push({text:`${K_(t.notice.freedTokens)} freed`,tone:`success`}),typeof W(i)==`number`&&e.push({text:`${W(i)} messages`}),typeof W(c)==`number`&&e.push({text:`${W(c)}% context`}),e}),v=J(()=>{let e=[],n=t.notice.contextTokens??t.notice.tokensBefore;return typeof n==`number`&&e.push({text:`${K_(n)} before`}),typeof W(c)==`number`&&e.push({text:`${W(c)}% context`}),typeof t.notice.generatedLines==`number`&&t.notice.generatedLines>0&&e.push({text:`${t.notice.generatedLines} lines`}),W(h)&&W(m)&&e.push({text:W(m)}),e}),y=J(()=>t.notice.state===`completed`?W(_):t.notice.state===`running`?W(v):[]),b=J(()=>t.notice.errorMessage?.trim()||`Could not compact this conversation.`),x=J(()=>t.notice.state===`running`||t.notice.state===`cancelled`||t.notice.state===`completed`&&W(l).length>0),S=J(()=>AB({state:t.notice.state,bodyKind:kB({bodyVisible:W(x),previewVisible:W(l).length>0}),errorVisible:t.notice.state===`failed`,footerItemCount:W(y).length}));var C=NB(),w=V(C);{let e=J(()=>t.notice.state===`completed`?void 0:t.notice.state),n=J(()=>t.notice.state===`running`),r=J(()=>({text:W(o)})),i=J(()=>t.notice.state===`failed`?W(b):void 0);$z(w,{get status(){return W(e)},get dotTone(){return W(s)},get dotPulse(){return W(n)},badge:`compact`,get arg(){return W(r)},get error(){return W(i)},get meta(){return W(y)},get bodyVisible(){return W(x)},get layoutRevision(){return W(S)},children:(e,n)=>{var r=U(),i=R(r),a=e=>{qA(e,{get code(){return W(l)},language:`markdown`,trim:!1,wrap:!0,overflow:`hidden`,tail:!0,get fixedRows(){return 6}})},o=e=>{g(e,jB())},s=e=>{g(e,MB())};k(i,e=>{W(l)?e(a):t.notice.state===`running`?e(o,1):t.notice.state===`cancelled`&&e(s,2)}),g(e,r)},$$slots:{default:!0}})}d(C),g(e,C),z()}var FB=h(`<span class="arg svelte-1ey3ztt"> </span>`),IB=h(`<div class="flex min-w-0 items-center gap-2.5 rounded-md border bg-card px-2.5 py-2"><div class="min-w-0 flex-1 truncate font-mono text-xs text-foreground"> </div> <!> <!></div>`),LB=h(`<article class="task-event svelte-1ey3ztt"><div class="task-event-header svelte-1ey3ztt"><!> <span class="badge svelte-1ey3ztt"> </span> <!></div> <!></article>`);function RB(e,t){a(t,!0);let n=J(()=>vf(t.notice.status)),r=J(()=>t.notice.exitCode!==void 0&&t.notice.exitCode!==null),i=J(()=>t.notice.event?`task ${t.notice.event}`:`task update`);var o=LB(),s=V(o),c=V(s);{let e=J(()=>yf(t.notice.status));ht(c,{get tone(){return W(n)},get pulse(){return W(e)},size:`xs`,class:`mr-1.5 align-middle`})}var l=L(c,2),u=V(l,!0);d(l);var f=L(l,2),p=e=>{var n=FB(),r=V(n,!0);d(n),F(()=>A(r,t.notice.taskName)),g(e,n)};k(f,e=>{t.notice.taskName&&e(p)}),d(s);var m=L(s,2),h=e=>{var i=IB(),a=V(i),o=V(a,!0);d(a);var s=L(a,2),c=e=>{{let n=J(()=>t.notice.exitCode===0?`neutral`:`danger`);Ri(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`exit ${t.notice.exitCode??``}`)),g(e,r)},$$slots:{default:!0}})}},l=e=>{Ri(e,{tone:`warn`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`signal ${t.notice.signal??``}`)),g(e,r)},$$slots:{default:!0}})};k(s,e=>{W(r)?e(c):t.notice.signal&&e(l,1)});var u=L(s,2),f=e=>{{let r=J(()=>W(n)===`neutral`?`border-border bg-muted text-muted-foreground`:``);Ri(e,{get tone(){return W(n)},size:`xs`,get class(){return W(r)},children:(e,n)=>{w();var r=M();F(()=>A(r,t.notice.status)),g(e,r)},$$slots:{default:!0}})}};k(u,e=>{t.notice.status&&e(f)}),d(i),F(()=>A(o,t.notice.commandPreview??``)),g(e,i)};k(m,e=>{(t.notice.commandPreview||W(r)||t.notice.signal||t.notice.status)&&e(h)}),d(o),F(()=>A(u,W(i))),g(e,o),z()}var zB=h(`<div class="status-actions svelte-qhsjll"><!></div>`),BB=h(`<article><div class="run-status-header svelte-qhsjll"><!> <span class="badge svelte-qhsjll"> </span> <span class="arg svelte-qhsjll"> </span></div> <p class="status-summary svelte-qhsjll"> </p> <!></article>`);function VB(e,t){a(t,!0);let n=Y(N(Date.now()));be(()=>{if(t.notice.state!==`retrying`||!t.notice.retryAt)return;K(n,Date.now(),!0);let e=setInterval(()=>{K(n,Date.now(),!0)},250);return()=>clearInterval(e)});let r=J(()=>t.notice.state!==`retrying`&&t.isLast&&!t.sending&&t.notice.retryable===!0&&!!t.notice.runId&&!!t.onContinueFromFailure),i=J(()=>t.notice.state===`retrying`?`running`:`warn`),o=J(()=>t.notice.state===`retrying`?`retrying`:`run`),c=J(()=>{switch(t.notice.state){case`retrying`:return`model request`;case`interrupted`:return`interrupted`;default:return`failed`}}),l=J(()=>{let e=t.notice.retryAt?Date.parse(t.notice.retryAt):NaN;if(Number.isFinite(e))return Math.max(0,Math.ceil((e-W(n))/1e3));if(typeof t.notice.delayMs==`number`&&t.notice.delayMs>0)return Math.ceil(t.notice.delayMs/1e3)}),u=J(()=>t.notice.errorMessage?.trim()?t.notice.errorMessage.trim():void 0),f=J(()=>typeof t.notice.attempt==`number`&&typeof t.notice.maxRetries==`number`?`retry ${t.notice.attempt}/${t.notice.maxRetries}`:typeof t.notice.attempt==`number`?`retry ${t.notice.attempt}`:void 0),p=J(()=>t.notice.state===`retrying`?`${W(u)?`Request failed with ${W(u)}`:`Request failed`}, ${typeof W(l)==`number`?W(l)>0?`retry in ${W(l)}s`:`retrying now`:`retrying soon`}${W(f)?` (${W(f)})`:``}`:t.notice.state===`interrupted`?`${W(u)??`Nerve stopped this run after the host restarted.`} Nothing will resume until you choose Continue.`:`${W(u)?`Request failed with ${W(u)}`:`Request failed`}. Click Continue to retry.`);function m(){!t.notice.runId||!W(r)||t.onContinueFromFailure?.(t.notice.runId)}var h=BB(),_=V(h),v=V(_);{let e=J(()=>t.notice.state===`retrying`);ht(v,{get tone(){return W(i)},get pulse(){return W(e)},size:`xs`,class:`mr-1.5 align-middle`})}var y=L(v,2),b=V(y,!0);d(y);var x=L(y,2),S=V(x,!0);d(x),d(_);var C=L(_,2),T=V(C,!0);d(C);var E=L(C,2),D=e=>{var t=zB();G(V(t),{size:`sm`,variant:`default`,onclick:m,children:(e,t)=>{w(),g(e,M(`Continue`))},$$slots:{default:!0}}),d(t),g(e,t)};k(E,e=>{W(r)&&e(D)}),d(h),F(()=>{s(h,1,`run-status-line state-${t.notice.state}`,`svelte-qhsjll`),A(b,W(o)),A(S,W(c)),A(T,W(p))}),g(e,h),z()}var HB=h(`<div class="relative min-w-0 px-3"><!></div>`),UB=h(`<article class="transcript-entry assistant thinking-entry svelte-1tpvsz2" data-state="static"><div class="message-body svelte-1tpvsz2"><!></div></article>`),WB=h(`<span class="stream-caret svelte-1tpvsz2" aria-hidden="true"></span>`),GB=h(`<div class="message-content svelte-1tpvsz2"><!> <!></div>`),KB=h(`<pre class="mt-2 whitespace-pre-wrap break-words rounded-md border border-destructive/40 bg-destructive/10 p-3 font-mono text-xs text-destructive"> </pre>`),qB=h(`<article><div class="message-body svelte-1tpvsz2"><!> <!></div></article>`),JB=h(`<div><!></div>`);function YB(e,t){a(t,!0);let n=I(t,`approvalsByToolCallId`,19,()=>new Map),r=I(t,`questionsByToolCallId`,19,()=>new Map),i=I(t,`reviewsByToolCallId`,19,()=>new Map),o=I(t,`hydrateToolBodies`,3,!0),c=I(t,`planReviewModels`,19,()=>[]),u=I(t,`planReviewModelKey`,3,``),f=I(t,`planReviewThinkingLevel`,3,`off`),p=J(()=>{if(t.node.kind!==`thinking_group`)return;let e=t.node.items[0]?.item;if(e)return{kind:`thinking`,item:{...e,text:t.node.items.map(e=>e.item.text).join(`
128
+
129
+ `)}}}),m=J(()=>{if(t.node.kind!==`message`)return`static`;let e=t.node.item;return e.role===`assistant`&&e.live?e.done?`complete`:`running`:`static`}),h=Y(!1),_=Y(void 0),v;be(()=>{let e=t.entranceMotion;!e||e.token===v||(v=e.token,t.onClaimEntrance?.(e.token)&&(K(_,e,!0),K(h,!0)))});var y=JB();let b,x;var S=V(y),C=e=>{var a=HB(),s=V(a);{let e=J(()=>t.node.toolCall?{kind:`tool`,anchorEntryId:t.node.anchorEntryId,toolCall:t.node.toolCall}:{kind:`tool_result_error`,toolName:t.node.draft?.block.toolName??`tool`,error:``}),a=J(()=>!t.node.toolCall);ey(s,{get target(){return W(e)},get menu(){return t.transcriptMenu},get disabled(){return W(a)},triggerClass:`block min-w-0`,children:(e,a)=>{{let a=J(()=>t.activeProject?.dir),s=J(()=>t.node.toolCall&&n().get(t.node.toolCall.id)?.status===`pending`?n().get(t.node.toolCall.id):void 0),l=J(()=>t.node.toolCall?r().get(t.node.toolCall.id):void 0),d=J(()=>t.node.toolCall?i().get(t.node.toolCall.id):void 0);OB(e,{get draft(){return t.node.draft},get toolCall(){return t.node.toolCall},get liveOutput(){return t.node.liveOutput},get cwd(){return W(a)},get pendingApproval(){return W(s)},get pendingUserQuestion(){return W(l)},get hydrateBody(){return o()},get pendingPlanReview(){return W(d)},get onOpenFile(){return t.onOpenFile},get planReviewModels(){return c()},get planReviewModelKey(){return u()},get planReviewThinkingLevel(){return f()},get onAnswerUserQuestion(){return t.onAnswerUserQuestion},get onDismissUserQuestion(){return t.onDismissUserQuestion},get onGrantApproval(){return t.onGrantApproval},get onDenyApproval(){return t.onDenyApproval},get onAcceptPlanReview(){return t.onAcceptPlanReview},get onAcceptPlanReviewInNewChat(){return t.onAcceptPlanReviewInNewChat},get onRejectPlanReview(){return t.onRejectPlanReview}})}},$$slots:{default:!0}})}d(a),g(e,a)},w=e=>{{let n=J(()=>({kind:`tool_result_error`,toolName:t.node.toolName,error:t.node.error}));ey(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{var r=HB();UP(V(r),{get toolName(){return t.node.toolName},get error(){return t.node.error}}),d(r),g(e,r)},$$slots:{default:!0}})}},T=e=>{{let n=J(()=>({kind:`run_status`,notice:t.node.notice}));ey(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{{let n=J(()=>t.node.key===t.lastTimelineKey);VB(e,{get notice(){return t.node.notice},get isLast(){return W(n)},get sending(){return t.sending},get onContinueFromFailure(){return t.onContinueFromFailure}})}},$$slots:{default:!0}})}},E=e=>{{let n=J(()=>({kind:`compaction`,notice:t.node.notice}));ey(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{var r=HB();PB(V(r),{get notice(){return t.node.notice}}),d(r),g(e,r)},$$slots:{default:!0}})}},D=e=>{{let n=J(()=>({kind:`task_event`,notice:t.node.notice}));ey(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{RB(e,{get notice(){return t.node.notice}})},$$slots:{default:!0}})}},O=e=>{ey(e,{get target(){return W(p)},get menu(){return t.transcriptMenu},triggerClass:`select-text`,children:(e,n)=>{var r=UB(),i=V(r),a=V(i);{let e=J(()=>t.node.items.map(e=>e.item));kP(a,{get items(){return W(e)}})}d(i),d(r),g(e,r)},$$slots:{default:!0}})},ee=e=>{{let n=J(()=>({kind:`message`,item:t.node.item})),r=J(()=>`select-text ${t.node.item.role===`user`?`block`:``}`);ey(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},get triggerClass(){return W(r)},children:(e,n)=>{var r=qB(),i=V(r),a=V(i),o=e=>{var n=GB(),r=V(n),i=e=>{{let n=J(()=>!!t.node.item.optimistic);my(e,{get text(){return t.node.item.text},get pending(){return W(n)}})}},a=e=>{{let n=J(()=>t.node.item.role!==`assistant`),r=J(()=>!!(t.node.item.live&&!t.node.item.done)),i=J(()=>t.activeProject?.dir);Fk(e,{get text(){return t.node.item.text},get trimCodeBlocks(){return W(n)},get streaming(){return W(r)},get linkBasePath(){return W(i)},get onOpenFile(){return t.onOpenFile},get onCopy(){return Xx}})}};k(r,e=>{t.node.item.role===`user`?e(i):e(a,-1)});var o=L(r,2),s=e=>{g(e,WB())};k(o,e=>{t.node.item.live&&!t.node.item.done&&e(s)}),d(n),g(e,n)};k(a,e=>{t.node.item.text&&e(o)});var c=L(a,2),l=e=>{var n=KB(),r=V(n,!0);d(n),F(e=>A(r,e),[()=>t.node.item.errorMessage.trim()]),g(e,n)},u=J(()=>t.node.item.stopReason===`error`&&t.node.item.errorMessage?.trim());k(c,e=>{W(u)&&e(l)}),d(i),d(r),F(()=>{s(r,1,`transcript-entry ${t.node.item.role} ${t.node.item.live?`streaming`:``}`,`svelte-1tpvsz2`),q(r,`data-state`,W(m))}),g(e,r)},$$slots:{default:!0}})}};k(S,e=>{t.node.kind===`tool`?e(C):t.node.kind===`tool_result_error`?e(w,1):t.node.kind===`run_status`?e(T,2):t.node.kind===`compaction`?e(E,3):t.node.kind===`task_event`?e(D,4):t.node.kind===`thinking_group`&&W(p)?e(O,5):t.node.kind===`message`&&e(ee,6)}),d(y),F(()=>{b=s(y,1,`transcript-row-content svelte-1tpvsz2`,null,b,{"transcript-enter-standard":W(h)&&W(_)?.profile===`standard`,"transcript-enter-compact":W(h)&&W(_)?.profile===`compact`,"transcript-enter-minimal":W(h)&&W(_)?.profile===`minimal`}),x=l(y,``,x,{"--transcript-enter-delay":W(_)?`${W(_).delayMs}ms`:void 0})}),ue(`animationend`,y,e=>{e.target===e.currentTarget&&(K(h,!1),K(_,void 0))}),g(e,y),z()}function XB(e){return{profile:`standard`,delaysMs:Array.from({length:e},()=>0)}}var ZB=class{allocateMotion;scope;seeded=!1;sequence=0;seen=new Set;pending=new Map;constructor(e=XB){this.allocateMotion=e}project(e,t){if(e!==this.scope&&this.reset(e),!this.seeded){for(let e of t)this.seen.add(e.key);return this.seeded=!0,new Map}let n=[];for(let e of t)this.seen.has(e.key)||(this.seen.add(e.key),e.eligible&&(this.sequence+=1,n.push({key:e.key,token:`${this.sequence}`})));if(n.length>0){let e=this.allocateMotion(n.length);n.forEach((t,n)=>{this.pending.set(t.key,{token:t.token,profile:e.profile,delayMs:e.delaysMs[n]??0})})}let r=new Set(t.map(e=>e.key));for(let e of this.pending.keys())r.has(e)||this.pending.delete(e);return new Map(t.flatMap(e=>{let t=this.pending.get(e.key);return t?[[e.key,t]]:[]}))}claim(e,t){return this.pending.get(e)?.token===t?(this.pending.delete(e),!0):!1}reset(e){this.scope=e,this.seeded=!1,this.seen.clear(),this.pending.clear()}},QB={burstWindowMs:160,cooldownMs:240,compactThreshold:4,minimalThreshold:9,compactDelayStepMs:12,compactDelayCapMs:60},$B={standard:0,compact:1,minimal:2};function eV(e,t){return $B[t]>$B[e]?t:e}function tV(e){return e>=QB.minimalThreshold?`minimal`:e>=QB.compactThreshold?`compact`:`standard`}var nV=class{now;eventTimes=[];lastEventAt;activeProfile=`standard`;constructor(e=()=>performance.now()){this.now=e}allocateBatch(e){if(e<=0)return{profile:`standard`,delaysMs:[]};let t=this.now();this.prepareWindow(t);for(let n=0;n<e;n+=1)this.eventTimes.push(t);this.lastEventAt=t,this.activeProfile=eV(this.activeProfile,tV(this.eventTimes.length));let n=Array.from({length:e},(e,t)=>this.activeProfile===`compact`?Math.min(t*QB.compactDelayStepMs,QB.compactDelayCapMs):0);return{profile:this.activeProfile,delaysMs:n}}claim(){return this.allocateBatch(1).profile}reset(){this.eventTimes.length=0,this.lastEventAt=void 0,this.activeProfile=`standard`}prepareWindow(e){this.lastEventAt!==void 0&&e-this.lastEventAt>=QB.cooldownMs&&this.reset();let t=e-QB.burstWindowMs;for(;this.eventTimes.length>0&&this.eventTimes[0]<t;)this.eventTimes.shift()}};function rV(e){return e.timelineLength>0||!!e.streamingText||e.sending||e.queuedPromptCount>0}var iV=h(`<div class="inline-flex max-w-md items-center gap-1.5 rounded-md border bg-muted px-2 py-1 text-xs text-muted-foreground"><!> <span class="shrink-0">Project:</span> <span class="truncate font-mono text-foreground"> </span></div>`),aV=h(`<article class="waiting-entry svelte-96a2zm"><!></article>`);function oV(e,t){a(t,!0);function n(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}:duplicate:${n}`}let r=I(t,`controller`,15),i=I(t,`atEnd`,15,!0),o=I(t,`paddingEnd`,3,0),s=I(t,`contentVisibility`,3,!1),c=I(t,`transcriptLabel`,3,`Conversation transcript`),l=I(t,`followBottom`,3,!0),u=I(t,`approvals`,19,()=>[]),f=I(t,`pendingUserQuestions`,19,()=>[]),p=I(t,`pendingPlanReviews`,19,()=>[]),m=I(t,`active`,3,!0),h=I(t,`planReviewModels`,19,()=>[]),_=I(t,`planReviewModelKey`,3,``),v=I(t,`planReviewThinkingLevel`,3,`off`),y=new nV;Uz(y);let b=new ZB(e=>y.allocateBatch(e)),x;function S(e){return e.kind===`message`?!!e.item.live:e.kind===`thinking_group`?e.items.some(e=>!!e.item.live):e.kind===`tool`&&!!e.draft}let C=0,w=J(()=>{let e=new Map,r=CP(t.timelinePrefix).map(t=>({kind:`timeline`,key:n(t.key,e),node:t}));return C+=1,{revision:C,rows:r,seenKeys:e}}),T=J(()=>CP(t.timelineTail)),E=J(()=>t.timelinePrefix.some(e=>e.kind===`compaction`&&e.notice.state===`running`)),D=J(()=>t.timelineTail.some(e=>e.kind===`compaction`&&e.notice.state===`running`)),O=J(()=>W(E)||W(D)),ee,te=new se,ne=J(()=>{let e=new se(W(w).seenKeys),r=[...W(w).rows],i=[...W(T)],a=r.at(-1),o=i[0];if(a?.node.kind===`thinking_group`&&o?.kind===`thinking_group`){r.pop(),i.shift();let t=e.get(a.node.key)??0;t<=1?e.delete(a.node.key):e.set(a.node.key,t-1),i.unshift({kind:`thinking_group`,key:a.node.key,items:[...a.node.items,...o.items]})}let s=i.map(t=>({kind:`timeline`,key:n(t.key,e),node:t})),c=[...r,...s],l=t.heightCacheKey??`__default-transcript__`;l!==x&&(x=l,y.reset());let u=s.map(e=>`${e.key}:${+!!S(e.node)}`).join(`|`),d=`${l}\0${W(w).revision}\0${u}`;d!==ee&&(ee=d,te=b.project(l,c.map(e=>({key:e.key,eligible:S(e.node)}))));let f=[...r,...s.map(e=>({...e,entranceMotion:te.get(e.key)}))];t.sending&&!t.hasActiveTurnOutput&&!W(O)&&f.push({kind:`waiting`,key:`__waiting__`});for(let e of t.queuedPrompts)f.push({kind:`queued`,key:`__queued__:${e.id}`,prompt:e});return f}),j=J(()=>new Map(u().map(e=>[e.toolCallId,e]))),M=J(()=>new Map(f().map(e=>[e.toolCallId,e]))),re=J(()=>new Map(p().map(e=>[e.toolCallId,e]))),N=J(()=>`${W(w).revision}\0${W(T).map(e=>e.key).join(`|`)}\0${t.sending&&!t.hasActiveTurnOutput&&!W(O)?`waiting`:``}\0${t.queuedPrompts.map(e=>e.id).join(`|`)}`);function P(e,t){return b.claim(e,t)}function ie(e){if(e.kind===`waiting`)return`waiting`;if(e.kind===`queued`)return`${e.prompt.status}:${e.prompt.updatedAt}`;let t=e.node;if(t.kind===`thinking_group`)return t.items.map(e=>`${e.item.text.length}:${e.item.live?`live`:`stored`}:${e.item.done?`done`:`open`}`).join(`|`);if(t.kind===`message`){let e=t.item;return[e.text.length,e.live?`live`:`stored`,e.done?`done`:`open`,e.optimistic?`optimistic`:`settled`,e.stopReason??`ok`,e.errorMessage?.length??0].join(`:`)}if(t.kind===`tool`){if(!t.toolCall){let e=t.draft?.block,n=e?.progress,r=Rx(e?.toolName??`tool`);return[`draft`,`arg:${r.argumentRegion}`,`placeholder:${r.resultPlaceholder?.variant??`none`}`,e?.argsText.length??0,e?.done?`done`:`open`,n?.lineCount??0,n?.generatedLineCount??0,n?.generatedPreview?.length??0,e?.argsText||n?.generatedPreview?`activity-visible`:`header-only`].join(`:`)}let e=t.toolCall.id,n=Rx(t.toolCall.toolName),r=W(j).get(e),i=W(M).get(e),a=W(re).get(e);return[`tool`,`arg:${n.argumentRegion}`,`placeholder:${n.resultPlaceholder?.variant??`none`}`,t.toolCall.status,t.toolCall.updatedAt,t.liveOutput?.updatedAt??`no-output`,m()?`body-hydrated`:`body-deferred`,t.toolCall.status===`error`||t.toolCall.status===`denied`?`activity-error`:`activity-visible`,r?`${r.id}:${r.status}`:`no-approval`,i?`${i.id}:${i.status}`:`no-question`,a?`${a.id}:${a.status}`:`no-plan`].join(`:`)}if(t.kind===`compaction`){let e=t.notice;return[`compaction`,e.state,e.summaryPreview?.length??0,e.summary?.length??0,e.errorMessage?.length??0].join(`:`)}return t.key}let ae=J(()=>!rV({timelineLength:t.timelinePrefix.length+t.timelineTail.length,streamingText:t.streamingText,sending:t.sending,queuedPromptCount:t.queuedPrompts.length}));var oe=U(),ce=R(oe),le=e=>{Gv(e,{title:`Where should we start?`,message:`Ask Nerve to explore, plan, or build in this project.`,footer:e=>{var n=U(),r=R(n),i=e=>{var n=iV(),r=V(n);fn(r,{class:`size-3.5 shrink-0`,strokeWidth:2.2,"aria-hidden":`true`});var i=L(r,4),a=V(i,!0);d(i),d(n),F(()=>{q(n,`title`,t.activeProject?.dir),q(n,`aria-label`,`Conversation will be created in project ${t.activeProject?.dir}`),A(a,t.activeProjectLabel)}),g(e,n)};k(r,e=>{t.activeProjectLabel&&e(i)}),g(e,n)},$$slots:{footer:!0}})},ue=e=>{Ii(e,{get items(){return W(ne)},getKey:e=>e.key,get structureVersion(){return W(N)},get heightCacheKey(){return t.heightCacheKey},getMeasurementVersion:ie,get contentVisibility(){return s()},estimateSize:()=>120,overscan:10,anchor:`end`,get followOutput(){return l()},scrollEndThreshold:32,paddingStart:12,get paddingEnd(){return o()},gap:2,viewportTabIndex:0,get viewportAriaLabel(){return c()},viewportClass:`@container h-full px-3`,get controller(){return r()},set controller(e){r(e)},get atEnd(){return i()},set atEnd(e){i(e)},row:(e,n)=>{let r=()=>n?.().item;var i=U(),a=R(i),o=e=>{YB(e,{get node(){return r().node},get entranceMotion(){return r().entranceMotion},onClaimEntrance:e=>P(r().key,e),get sending(){return t.sending},get hydrateToolBodies(){return m()},get activeProject(){return t.activeProject},get approvalsByToolCallId(){return W(j)},get questionsByToolCallId(){return W(M)},get reviewsByToolCallId(){return W(re)},get lastTimelineKey(){return t.lastTimelineKey},get planReviewModels(){return h()},get planReviewModelKey(){return _()},get planReviewThinkingLevel(){return v()},get onOpenFile(){return t.onOpenFile},get onAnswerUserQuestion(){return t.onAnswerUserQuestion},get onDismissUserQuestion(){return t.onDismissUserQuestion},get onGrantApproval(){return t.onGrantApproval},get onDenyApproval(){return t.onDenyApproval},get onAcceptPlanReview(){return t.onAcceptPlanReview},get onAcceptPlanReviewInNewChat(){return t.onAcceptPlanReviewInNewChat},get onRejectPlanReview(){return t.onRejectPlanReview},get onContinueFromFailure(){return t.onContinueFromFailure},get transcriptMenu(){return t.transcriptMenu}})},s=e=>{var t=aV();MP(V(t),{}),d(t),g(e,t)},c=e=>{ky(e,{get prompt(){return r().prompt},get onDiscard(){return t.onDiscardQueuedPrompt},get onMoveToComposer(){return t.onMoveQueuedPromptToComposer},get transcriptMenu(){return t.transcriptMenu}})};k(a,e=>{r().kind===`timeline`?e(o):r().kind===`waiting`?e(s,1):e(c,-1)}),g(e,i)},$$slots:{row:!0}})};k(ce,e=>{W(ae)?e(le):e(ue,-1)}),g(e,oe),z()}var sV=h(`<div><span class="font-medium text-foreground"> </span> <!></div>`);function cV(e,t){let n=I(t,`tone`,3,`muted`);var r=sV(),i=V(r),a=V(i,!0);d(i);var o=L(i,2),c=e=>{var n=M();F(()=>A(n,t.message)),g(e,n)};k(o,e=>{t.message&&e(c)}),d(r),F(()=>{s(r,1,`flex-none border-b px-4 py-2 text-xs text-muted-foreground ${n()===`warning`?`bg-warning/10`:`bg-muted/40`}`),A(a,t.title)}),g(e,r)}var lV=new Set([`$$slots`,`$$events`,`$$legacy`]);function uV(e,t){let n=H(t,lV),r=[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`}]];P(e,B({name:`message-square-off`},()=>n,{get iconNode(){return r}}))}var dV=h(`<p class="max-w-md text-xs text-muted-foreground"> </p>`),fV=h(`<div class="flex min-h-0 flex-col items-center justify-center gap-2 p-4 text-center"><!> <p class="text-sm text-muted-foreground"> </p> <!></div>`);function pV(e,t){let n=I(t,`title`,3,`No conversation selected.`);var r=fV(),i=V(r);uV(i,{class:`size-8 text-muted-foreground`});var a=L(i,2),o=V(a,!0);d(a);var s=L(a,2),c=e=>{var n=dV(),r=V(n,!0);d(n),F(()=>A(r,t.message)),g(e,n)};k(s,e=>{t.message&&e(c)}),d(r),F(()=>A(o,n())),g(e,r)}var mV=h(`<div class="flex h-full min-h-0 flex-col"><!> <div class="min-h-0 flex-1"><!></div></div>`);function hV(e,t){a(t,!0);let n=J(()=>t.model.active??!0),r=J(()=>t.model.timeline.tail.at(-1)?.key??t.model.timeline.prefix.at(-1)?.key),i=J(()=>t.model.approvals?.filter(e=>e.status===`pending`)??[]),o=J(()=>W(i)[0]?.id),s=J(()=>W(i).length),c=J(()=>t.model.pendingUserQuestions?.filter(e=>e.status===`pending`).map(e=>e.id)??[]),l=J(()=>t.model.pendingPlanReviews?.filter(e=>e.status===`pending`).map(e=>e.id)??[]),f=J(()=>rV({timelineLength:t.model.timeline.prefix.length+t.model.timeline.tail.length,streamingText:t.model.streamingText,sending:t.model.sending,queuedPromptCount:t.model.queuedPrompts.length})),p=xP({active:()=>W(n),conversationOpen:()=>t.model.open,conversationId:()=>t.model.conversationId,contentReady:()=>W(f)});{let i=e=>{Iv(e,{get active(){return W(n)},get sending(){return t.model.sending},get pendingApprovalId(){return W(o)},get pendingApprovalCount(){return W(s)},get pendingQuestionIds(){return W(c)},get pendingPlanReviewIds(){return W(l)}})},a=e=>{var i=mV(),a=V(i),o=e=>{cV(e,B(()=>t.model.banner))};k(a,e=>{t.model.banner&&e(o)});var s=L(a,2),c=V(s);{let e=J(()=>t.model.transcriptHeightCacheKey??t.model.conversationId),i=J(()=>W(n)?p.followBottom:!1);oV(c,{paddingEnd:18,get heightCacheKey(){return W(e)},get transcriptLabel(){return t.model.transcriptLabel},get timelinePrefix(){return t.model.timeline.prefix},get timelineTail(){return t.model.timeline.tail},get streamingText(){return t.model.streamingText},get sending(){return t.model.sending},get hasActiveTurnOutput(){return t.model.hasActiveTurnOutput},get queuedPrompts(){return t.model.queuedPrompts},get followBottom(){return W(i)},get activeProject(){return t.model.activeProject},get activeProjectLabel(){return t.model.activeProjectLabel},get approvals(){return t.model.approvals},get pendingUserQuestions(){return t.model.pendingUserQuestions},get pendingPlanReviews(){return t.model.pendingPlanReviews},get active(){return W(n)},get planReviewModels(){return t.model.planReviewModels},get planReviewModelKey(){return t.model.planReviewModelKey},get planReviewThinkingLevel(){return t.model.planReviewThinkingLevel},get lastTimelineKey(){return W(r)},get onOpenFile(){return t.actions.onOpenFile},get onAnswerUserQuestion(){return t.actions.onAnswerUserQuestion},get onDismissUserQuestion(){return t.actions.onDismissUserQuestion},get onGrantApproval(){return t.actions.onGrantApproval},get onDenyApproval(){return t.actions.onDenyApproval},get onAcceptPlanReview(){return t.actions.onAcceptPlanReview},get onAcceptPlanReviewInNewChat(){return t.actions.onAcceptPlanReviewInNewChat},get onRejectPlanReview(){return t.actions.onRejectPlanReview},get onContinueFromFailure(){return t.actions.onContinueFromFailure},get onDiscardQueuedPrompt(){return t.actions.onDiscardQueuedPrompt},get onMoveQueuedPromptToComposer(){return t.actions.onMoveQueuedPromptToComposer},get transcriptMenu(){return t.menus.transcriptMenu},get controller(){return p.controller},set controller(e){p.controller=e},get atEnd(){return p.atEnd},set atEnd(e){p.atEnd=e}})}d(s),d(i),g(e,i)},f=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.composer),g(e,n)},a=e=>{Tv(e,{get model(){return t.model.composer},get actions(){return t.actions}})};k(r,e=>{t.composer?e(i):e(a,-1)}),g(e,n)},m=e=>{var n=U(),r=R(n),i=e=>{var n=U();u(R(n),()=>t.emptyExtension),g(e,n)},a=e=>{pV(e,{get title(){return t.model.emptyTitle},get message(){return t.model.emptyMessage}})};k(r,e=>{t.emptyExtension?e(i):e(a,-1)}),g(e,n)},h=J(()=>W(n)&&!p.atEnd);jv(e,{get open(){return t.model.open},get showScrollButton(){return W(h)},get composerHeight(){return p.composerHeight},onJumpToBottom:()=>p.jumpToBottom(),get composerWrapRef(){return p.composerWrapEl},set composerWrapRef(e){p.composerWrapEl=e},announcer:i,transcript:a,composer:f,empty:m,$$slots:{announcer:!0,transcript:!0,composer:!0,empty:!0}})}z()}async function gV(e,t){let n=(await Ar(`agent.configure`,{agentId:e,...t})).result;if(!(`agent`in n))throw Error(`Workbench agent configuration returned an async result`);return n.agent}async function _V(e,t){return(await Ar(`agent.subagentTranscript.get`,{parentAgentId:e,childAgentId:t})).result.transcript}function vV(e){switch(e.split(`;`)[0]?.trim().toLowerCase()){case`audio/wav`:case`audio/wave`:case`audio/x-wav`:return`wav`;case`audio/mp4`:case`audio/m4a`:case`audio/x-m4a`:return`mp4`;case`audio/mpeg`:case`audio/mp3`:case`audio/x-mpeg`:return`mp3`;case`audio/mpga`:return`mpga`;case`audio/flac`:case`audio/x-flac`:return`flac`;case`audio/ogg`:case`audio/oga`:return`ogg`;default:return`webm`}}async function yV(e){if(!e.ok){let t=await e.text().catch(()=>``),n=Yee(t);throw new zi(e.status,n.code,n.message||t||e.statusText||`Transcription failed.`)}let t=e.headers.get(`content-type`)??``;if(!t.includes(`application/json`)){let n=await e.text();throw new zi(e.status,void 0,`Expected JSON response from transcription API, received ${t||`unknown content type`}. ${n.slice(0,80)}`)}return await e.json()}async function bV(e,t,n={}){let r=new FormData;return r.append(`file`,e,`composer-recording.${vV(e.type)}`),r.append(`durationMs`,String(Math.max(1,Math.round(t)))),(await yV(await fetch(`/api/transcription/audio`,{method:`POST`,credentials:`same-origin`,body:r,signal:n.signal}))).text}async function xV(){return(await Ar(`auth.providers.list`,{})).result.providers}async function SV(){return Ui(`/api/auth/credential-key`)}async function CV(e,t){await ete(`/api/provider-keys`,{provider:e,encryptedApiKey:t})}async function wV(e){await Xee(`/api/auth/providers/${Bi(e)}`)}async function TV(e){return(await Vi(`/api/auth/oauth/flows`,{provider:e})).flow}async function EV(e){return(await Ui(`/api/auth/oauth/flows/${Bi(e)}`)).flow}async function DV(e,t){return(await Vi(`/api/auth/oauth/flows/${Bi(e)}/respond`,t)).flow}async function OV(e){return(await Vi(`/api/auth/oauth/flows/${Bi(e)}/cancel`,{})).flow}async function kV(){return(await Ar(`providerCatalog.get`,{})).result}async function AV(e){return(await Ar(`providerCatalog.custom.upsert`,e)).result}async function jV(e){return(await Ar(`providerCatalog.custom.delete`,{id:e})).result}async function MV(e){return(await Ar(`providerCatalog.model.upsert`,e)).result}async function NV(e,t){return(await Ar(`providerCatalog.model.delete`,{provider:e,modelId:t})).result}async function PV(){return Ui(`/api/client-config`)}async function FV(){return(await Ar(`model.list`,{})).result.models}async function IV(){return(await Ar(`completion.slash.list`,{})).result.items}async function LV(e,t){return e?(await Ar(`completion.files.list`,{projectId:e,q:t})).result.items:[]}async function RV(e){let{result:t}=await Ar(`snapshot.conversation.get`,{conversationId:e});return t}async function zV(e){return(await Ar(`conversation.contextUsage.get`,{conversationId:e})).result.contextUsage}async function BV(e){return(await Ar(`conversation.compact`,{conversationId:e})).result}async function VV(e){await Ar(`conversation.compaction.cancel`,{conversationId:e})}async function HV(e){await Ar(`conversation.delete`,{conversationId:e})}async function UV(e){return(await Vi(`/api/filesystem/clipboard-image`,{name:e.name,type:e.type,dataBase64:await Zee(e)})).path}async function WV(e,t=!1){return(await Ar(`filesystem.directories.list`,{path:e,showHidden:t})).result}async function GV(e){return(await Ar(`filesystem.project.entries.list`,e)).result}async function KV(e){return(await Ar(`filesystem.project.entries.create`,e)).result}async function qV(e,t,n){let r=new URLSearchParams({projectId:e,path:t});return n!==void 0&&r.set(`line`,String(n)),Ui(`/api/filesystem/file?${r.toString()}`)}async function JV(e){return(await Ar(`git.repos.discover`,{projectId:e})).result}async function YV(e,t){return(await Ar(`git.overview.get`,{projectId:e,repo:t})).result}async function XV(e){return(await Ar(`git.project.files.status.get`,{projectId:e})).result}async function ZV(e,t){return(await Ar(`git.branches.list`,{projectId:e,repo:t})).result}async function QV(e,t,n){return(await Ar(`git.branch.create`,{projectId:e,repo:t,name:n})).result}async function $V(e,t,n){return(await Ar(`git.branch.switch`,{projectId:e,repo:t,name:n})).result}async function eH(e,t){return(await Ar(`git.sync`,{projectId:e,repo:t})).result}async function tH(e,t){return(await Ar(`git.push`,{projectId:e,repo:t})).result}async function nH(e,t){return(await Ar(`git.pull`,{projectId:e,repo:t})).result}async function rH(e,t){return(await Ar(`git.fetch`,{projectId:e,repo:t})).result}async function iH(e,t){return(await Ar(`git.switchBaseAndPull`,{projectId:e,repo:t})).result}async function aH(e,t,n,r){return(await Ar(`git.file.diff.get`,{projectId:e,repo:t,path:n,area:r})).result}async function oH(e,t,n){return(await Ar(`git.file.stage`,{projectId:e,repo:t,path:n})).result}async function sH(e,t,n){return(await Ar(`git.file.unstage`,{projectId:e,repo:t,path:n})).result}async function cH(e,t,n){return(await Ar(`git.file.discard`,{projectId:e,repo:t,path:n})).result}async function lH(e,t){return(await Ar(`github.status.get`,{projectId:e,repo:t})).result}async function uH(e,t,n){return(await Ar(`github.pr.list`,{projectId:e,repo:t,filters:n})).result}async function dH(e,t,n,r){return(await Ar(e,{projectId:t,repo:n,number:r})).result}async function fH(e,t,n){return(await Ar(`github.pr.initial.get`,{projectId:e,repo:t,number:n})).result}var pH=(e,t,n)=>dH(`github.pr.core.get`,e,t,n),mH=(e,t,n)=>dH(`github.pr.conversation.get`,e,t,n),hH=(e,t,n)=>dH(`github.pr.overview.get`,e,t,n),gH=(e,t,n)=>dH(`github.pr.commits.get`,e,t,n),_H=(e,t,n)=>dH(`github.pr.checks.get`,e,t,n);async function vH(e){return(await Ar(`github.pr.file.diff.get`,{projectId:e.projectId,repo:e.repo,number:e.number,path:e.path,...e.previousPath?{previousPath:e.previousPath}:{},status:e.status,expectedBaseRefOid:e.expectedBaseRefOid,expectedHeadRefOid:e.expectedHeadRefOid,...e.expectedHeadRepository?{expectedHeadRepository:e.expectedHeadRepository}:{}})).result}async function yH(e,t,n){return(await Ar(`github.pr.files.get`,{projectId:e,repo:t,number:n})).result}async function bH(e,t,n,r,i){return(await Ar(`github.pr.merge`,{projectId:e,repo:t,number:n,method:r,expectedHeadOid:i})).result}async function xH(e,t,n){return(await Ar(`github.pr.checkout`,{projectId:e,repo:t,number:n})).result}async function SH(e={}){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&String(r).length>0&&t.set(n,String(r));return Ui(`/api/logs${t.size?`?${t.toString()}`:``}`)}async function CH(e){return(await Ar(`applicationLog.prune`,e)).result}async function wH(e){return(await Ar(`project.create`,{dir:e})).result.project}async function TH(e){return(await Ar(`project.get`,{projectId:e})).result.project}async function EH(e){await Ar(`project.delete`,{projectId:e})}async function DH(e,t){return(await Ar(`project.conversations.prune`,{projectId:e,...t})).result}async function OH(e,t){return(await Ar(`project.openEditor`,{projectId:e,editor:t})).result}async function kH(e){return(await Ar(`taskDefinition.list`,{projectId:e})).result.definitions.map(e=>br.parse(e))}async function AH(e,t){let n=(await Ar(`taskDefinition.create`,{projectId:e,...t})).result.definition;return br.parse(n)}async function jH(e,t,n){let r=(await Ar(`taskDefinition.update`,{projectId:e,definitionId:t,...n})).result.definition;return br.parse(r)}async function MH(e,t){await Ar(`taskDefinition.delete`,{projectId:e,definitionId:t})}async function NH(e,t={}){return(await Ar(`promptSuggestion.listForProject`,{projectId:e,...t})).result}async function PH(e){return(await Ar(`promptSuggestion.statuses.list`,{projectId:e})).result.statuses}async function FH(e){return(await Ar(`promptSuggestion.create`,e)).result}async function IH(e){await Ar(`promptSuggestion.enabled.update`,e)}async function LH(e){await Ar(`promptSuggestion.trust.update`,e)}async function RH(e){let t=(await Ar(`scratchNote.list`,{projectId:e})).result;return Dr.parse(t).notes}async function zH(e,t={}){let n=(await Ar(`scratchNote.create`,{projectId:e,...t})).result.note;return hr.parse(n)}async function BH(e,t,n){let r=(await Ar(`scratchNote.update`,{projectId:e,noteId:t,...n})).result.note;return hr.parse(r)}async function VH(e,t){await Ar(`scratchNote.delete`,{projectId:e,noteId:t})}async function HH(){return(await Ar(`settings.get`,{})).result}async function UH(e){return(await Ar(`settings.update`,e)).result.settings}async function WH(e){return(await Ar(`skill.list`,{projectId:e})).result}async function GH(e){let t=(await Ar(`toolCall.get`,{toolCallId:e})).result;return mr.parse(t.toolCall)}async function KH(){return(await Ar(`userQuestion.list`,{status:`pending`})).result.questions}async function qH(e,t){let n=(await Ar(`approval.grant`,{approvalId:e,note:t})).result;if(!(`toolCall`in n))throw nU(`approval.grant`);return mr.parse(n.toolCall)}async function JH(e,t){let n=(await Ar(`approval.deny`,{approvalId:e,note:t})).result;if(!(`toolCall`in n))throw nU(`approval.deny`);return mr.parse(n.toolCall)}async function YH(e,t={}){let n=(await Ar(`planReview.accept`,{reviewId:e,...t})).result;if(!(`planReview`in n))throw nU(`planReview.accept`);return fr.parse(n.planReview)}async function XH(e,t={}){return(await Ar(`planReview.acceptInNewChat`,{reviewId:e,...t})).result}async function ZH(e,t){let n=(await Ar(`planReview.reject`,{reviewId:e,feedback:t})).result;if(!(`planReview`in n))throw nU(`planReview.reject`);return fr.parse(n.planReview)}async function QH(e,t){let n=(await Ar(`planReview.requestChanges`,{reviewId:e,feedback:t})).result;if(!(`planReview`in n))throw nU(`planReview.requestChanges`);return fr.parse(n.planReview)}async function $H(e,t){let n=(await Ar(`planReview.discard`,{reviewId:e,feedback:t})).result;if(!(`planReview`in n))throw nU(`planReview.discard`);return fr.parse(n.planReview)}async function eU(e,t){let n=(await Ar(`userQuestion.answer`,{questionId:e,answer:t})).result;if(!(`question`in n))throw nU(`userQuestion.answer`);return gr.parse(n.question)}async function tU(e,t){let n=(await Ar(`userQuestion.dismiss`,{questionId:e,reason:t})).result;if(!(`question`in n))throw nU(`userQuestion.dismiss`);return gr.parse(n.question)}function nU(e){return Error(`Workbench operation ${e} returned an async result`)}async function rU(){return(await Ar(`usage.subscription.get`,{})).result.usage}async function iU(){let{result:e}=await Ar(`snapshot.workspace.get`,{});return{...e,snapshot:{...e.snapshot,conversations:[...e.snapshot.conversations].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}}}var aU=h(`<div aria-live="polite"><span class="activity-sr svelte-9ds0r"> </span> <span aria-hidden="true"> </span></div>`);function oU(e,t){a(t,!0);let n=I(t,`recording`,3,!1),r=I(t,`transcribing`,3,!1),i=I(t,`elapsedMs`,3,0),o=I(t,`maxDurationMs`,3,1),c=I(t,`retryAttempt`,3,0),l=I(t,`maxRetries`,3,0),u=I(t,`class`,3,``),f=J(()=>n()||r()),p=J(()=>b(i())),m=J(()=>b(o())),h=J(()=>Math.max(0,Math.min(1,o()>0?i()/o():0))),_=J(()=>W(h)>=.85),v=J(()=>n()?`${W(p)} / ${W(m)}`:c()>0?`Retry ${c()}/${l()}`:`Transcribing…`),y=J(()=>n()?`Recording ${W(p)} of ${W(m)}`:c()>0?`Retrying transcription ${c()} of ${l()}`:`Transcribing audio`);function b(e){let t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)}`}var x=U(),S=R(x),C=e=>{var t=aU(),r=V(t),i=V(r,!0);d(r);var a=L(r,2),o=V(a,!0);d(a),d(t),F(()=>{s(t,1,`transcription-activity rounded-full ${u()}`,`svelte-9ds0r`),q(t,`data-state`,n()?`recording`:`transcribing`),q(t,`data-near-limit`,W(_)?`true`:void 0),A(i,W(y)),A(o,W(v))}),g(e,t)};k(S,e=>{W(f)&&e(C)}),g(e,x),z()}function sU(e){let t=Yr(e);return Z.conversationViews[t]??={conversationId:e,activeEntryId:void 0,activeEntryIds:[],entries:[],toolCalls:[],treeNodes:[],optimisticMessages:[],queuedPrompts:[],cursorSeq:0,sending:!1,stopping:!1,composerText:``,loading:!1},Z.conversationViews[t]}function cU(){Qf()}function lU(e){Cp({kind:`conversation`,id:e}),sU(e)}var uU=0;function dU(){return uU+=1,`pending_${Date.now().toString(36)}_${uU.toString(36)}`}function fU(){let e=Q.activeCenterTab;if(e?.kind===`pending-conversation`)return Z.pendingConversations[Qr(e.id)]}function pU(){Q.error=void 0}function mU(){Af(),Z.activeConversationTabId=void 0,pU(),kf.text=``}var hU=16e3,gU=`audio/wav`,_U=4096;function vU(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Float32Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function yU(e,t,n=hU){if(e.length===0)return new Float32Array;if(t===n)return new Float32Array(e);if(t<=0||n<=0)throw Error(`Sample rates must be positive.`);let r=Math.max(1,Math.round(e.length*n/t)),i=new Float32Array(r),a=t/n;for(let t=0;t<r;t+=1){let n=t*a,r=Math.floor(n),o=Math.min(r+1,e.length-1),s=n-r;i[t]=e[r]*(1-s)+e[o]*s}return i}function bU(e){let t=Math.max(-1,Math.min(1,e));return Math.round(t<0?t*32768:t*32767)}function xU(e,t,n){if(!n)return e;let r=Math.max(1,Math.round(t*n/1e3));return e.length<=r?e:e.slice(0,r)}function SU(e,t=hU){let n=t*2,r=e.length*2,i=new ArrayBuffer(44+r),a=new DataView(i);CU(a,0,`RIFF`),a.setUint32(4,36+r,!0),CU(a,8,`WAVE`),CU(a,12,`fmt `),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,t,!0),a.setUint32(28,n,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),CU(a,36,`data`),a.setUint32(40,r,!0);let o=44;for(let t of e)a.setInt16(o,bU(t),!0),o+=2;return new Uint8Array(i)}function CU(e,t,n){for(let r=0;r<n.length;r+=1)e.setUint8(t+r,n.charCodeAt(r))}function wU(e){let t=e.numberOfChannels,n=e.length;if(t===1)return new Float32Array(e.getChannelData(0));let r=new Float32Array(n);for(let i=0;i<t;i+=1){let a=e.getChannelData(i);for(let e=0;e<n;e+=1)r[e]+=a[e]/t}return r}function TU(){if(!(typeof window>`u`))return window.AudioContext??window.webkitAudioContext}function EU(e){try{return new e({sampleRate:hU})}catch{return new e}}var DU=class e{audioContext;processor;source;stream;chunks=[];startedAt=0;stopped=!0;static isSupported(){return!!(typeof navigator<`u`&&navigator.mediaDevices?.getUserMedia&&TU())}async start(){if(!e.isSupported())throw Error(`Audio recording is not supported in this browser.`);if(!this.stopped)throw Error(`Recording is already in progress.`);let t=TU();if(!t)throw Error(`Web Audio is not supported in this browser.`);this.chunks=[],this.stopped=!1,this.startedAt=Date.now();try{this.stream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:{ideal:1},sampleRate:{ideal:hU},sampleSize:{ideal:16},echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}}),this.audioContext=EU(t),this.audioContext.state===`suspended`&&await this.audioContext.resume(),this.source=this.audioContext.createMediaStreamSource(this.stream),this.processor=this.audioContext.createScriptProcessor(_U,1,1),this.processor.onaudioprocess=e=>{if(!this.stopped){this.chunks.push(wU(e.inputBuffer));for(let t=0;t<e.outputBuffer.numberOfChannels;t+=1)e.outputBuffer.getChannelData(t).fill(0)}},this.source.connect(this.processor),this.processor.connect(this.audioContext.destination)}catch(e){throw await this.cleanup(),e}}async stop(e={}){if(this.stopped)throw Error(`No recording is in progress.`);this.stopped=!0;let t=Math.max(1,Date.now()-this.startedAt),n=e.maxDurationMs?Math.min(t,e.maxDurationMs):t,r=this.audioContext?.sampleRate??16e3,i=this.chunks;this.chunks=[],await this.cleanup();let a=vU(i);if(a.length===0)throw Error(`No audio was captured.`);let o=SU(xU(yU(a,r,hU),hU,e.maxDurationMs),hU),s=new ArrayBuffer(o.byteLength);return new Uint8Array(s).set(o),{blob:new Blob([s],{type:gU}),durationMs:n,mimeType:gU}}async cancel(){this.stopped=!0,this.chunks=[],await this.cleanup()}async cleanup(){this.processor?.disconnect(),this.processor=void 0,this.source?.disconnect(),this.source=void 0,this.stream?.getTracks().forEach(e=>{e.stop()}),this.stream=void 0;let e=this.audioContext;this.audioContext=void 0,e&&e.state!==`closed`&&await e.close().catch(()=>void 0)}},OU=[500,1e3,2e3];function kU(e){return e instanceof DOMException&&e.name===`AbortError`}function AU(e){return OU[e-1]??OU.at(-1)??2e3}function jU(e,t){return new Promise((n,r)=>{if(t.aborted){r(new DOMException(`Transcription was cancelled.`,`AbortError`));return}let i=window.setTimeout(n,e);t.addEventListener(`abort`,()=>{window.clearTimeout(i),r(new DOMException(`Transcription was cancelled.`,`AbortError`))},{once:!0})})}function MU(e){return kU(e)?!1:e instanceof zi&&e.status?e.status===408||e.status===429||e.status>=500:!0}function NU(e){return e instanceof Error?e.message:String(e)}var PU=class e{#e=Y(!1);get recording(){return W(this.#e)}set recording(e){K(this.#e,e,!0)}#t=Y(!1);get transcribing(){return W(this.#t)}set transcribing(e){K(this.#t,e,!0)}#n=Y(void 0);get error(){return W(this.#n)}set error(e){K(this.#n,e,!0)}#r=Y(0);get elapsedMs(){return W(this.#r)}set elapsedMs(e){K(this.#r,e,!0)}#i=Y(0);get retryAttempt(){return W(this.#i)}set retryAttempt(e){K(this.#i,e,!0)}maxDurationMs=Mr;maxRetries=3;#a=Y(!1);#o;#s=0;#c;#l;#u;#d;#f;constructor(e){this.#d=e.onTranscript,this.#f=e.onError}static isSupported(){return DU.isSupported()}get pending(){return this.transcribing||W(this.#a)}#p(e){this.error=e,this.#f?.(e)}toggle(){this.recording?this.stop():this.start()}async start(){if(!(this.recording||this.pending)){if(!e.isSupported()){this.#p(`Audio recording is not supported in this browser.`);return}this.error=void 0,this.retryAttempt=0,this.elapsedMs=0;try{let e=new DU;await e.start(),this.#o=e,this.recording=!0,this.#m()}catch(e){await this.#o?.cancel(),this.#o=void 0,this.#h(),this.recording=!1,this.#p(NU(e))}}}async stop(){if(!this.#o||W(this.#a))return!1;let e=this.#o;K(this.#a,!0),this.#o=void 0,this.#h();try{let t=await e.stop({maxDurationMs:this.maxDurationMs});return this.recording=!1,this.elapsedMs=t.durationMs,await this.#_(t)}catch(e){return this.recording=!1,this.#p(NU(e)),!1}finally{K(this.#a,!1)}}async cancel(){this.#u?.abort();let e=this.#o;this.#o=void 0,this.#h(),this.recording=!1,this.transcribing=!1,this.retryAttempt=0,this.elapsedMs=0,await e?.cancel()}#m(){this.#h(),this.#s=Date.now(),this.#g(),this.#c=window.setInterval(()=>this.#g(),250),this.#l=window.setTimeout(()=>{this.recording&&this.stop()},this.maxDurationMs)}#h(){this.#c&&window.clearInterval(this.#c),this.#l&&window.clearTimeout(this.#l),this.#c=void 0,this.#l=void 0}#g(){this.#s&&(this.elapsedMs=Math.min(Math.max(0,Date.now()-this.#s),this.maxDurationMs))}async#_(e){let t=new AbortController;this.#u=t,this.transcribing=!0,this.error=void 0,this.retryAttempt=0;let n=!1;try{for(let r=0;r<=this.maxRetries;r+=1){r>0&&(this.retryAttempt=r,await jU(AU(r),t.signal));try{let n=await bV(e.blob,e.durationMs,{signal:t.signal});return t.signal.aborted||!n.trim()?!1:(this.#d(n),!0)}catch(e){if(t.signal.aborted||kU(e))return!1;if(r>=this.maxRetries||!MU(e))throw n=r>=this.maxRetries,e}}}catch(e){if(t.signal.aborted||kU(e))return!1;let r=NU(e);this.#p(n?`Transcription failed after ${this.maxRetries} retries: ${r}`:r)}finally{this.#u===t&&(this.#u=void 0),this.transcribing=!1,this.retryAttempt=0}return!1}};function FU(e){return`${e.kind}:${e.id}`}function IU(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function LU(e,t){let n=t.trim();return n?`${e}${e.trim()?/\s$/.test(e)?``:`
130
+
131
+ `:``}${n} `:e}function RU(e){Kn.error(`Voice input failed`,{description:e})}var zU=new class{#e=Y(void 0);#t=Y(!1);#n=new Map;#r=new PU({onTranscript:e=>this.#o(e),onError:e=>this.#a(e)});get activeTarget(){return W(this.#e)}get recording(){return this.#r.recording}get transcribing(){return this.#r.transcribing}get pending(){return W(this.#t)||this.#r.pending}get elapsedMs(){return this.#r.elapsedMs}get retryAttempt(){return this.#r.retryAttempt}get maxDurationMs(){return this.#r.maxDurationMs}get maxRetries(){return this.#r.maxRetries}isSupported(){return PU.isSupported()}isTargetActive(e){return IU(W(this.#e),e)}isBusyForOtherTarget(e){return!!(W(this.#e)&&!IU(W(this.#e),e))}registerTargetHandlers(e,t){let n=FU(e);return this.#n.set(n,t),()=>{this.#n.get(n)===t&&this.#n.delete(n)}}async toggle(e){if(this.isTargetActive(e)&&this.recording){await this.stop(e);return}await this.start(e)}async start(e){if(W(this.#e))return!1;if(!this.isSupported())return this.#a(`Audio recording is not supported in this browser.`,e),!1;K(this.#e,e,!0),K(this.#t,!0);try{await this.#r.start()}finally{K(this.#t,!1)}return!this.#r.recording&&!this.#r.pending?(IU(W(this.#e),e)&&K(this.#e,void 0),!1):!0}async stop(e){let t=W(this.#e);if(!t||e&&!IU(t,e))return!1;let n=await this.#r.stop();return IU(W(this.#e),t)&&K(this.#e,void 0),n}async cancel(e){let t=W(this.#e);e&&!IU(t,e)||(K(this.#e,void 0),K(this.#t,!1),await this.#r.cancel())}async cancelIfTarget(e){this.isTargetActive(e)&&await this.cancel(e)}async cancelIfTargets(e){let t=W(this.#e);t&&e.some(e=>IU(t,e))&&await this.cancel(t)}#i(e=W(this.#e)){return e?this.#n.get(FU(e)):void 0}#a(e,t=W(this.#e)){let n=this.#i(t)?.onError;n?n(e):RU(e)}#o(e){let t=W(this.#e);if(!t)return;let n=this.#i(t);if(n?.appendTranscript){n.appendTranscript(e);return}if(t.kind===`conversation`){let n=sU(t.id);n.composerText=LU(n.composerText,e);return}if(t.kind===`pending-conversation`){let n=Z.pendingConversations[Qr(t.id)];n&&(n.composerText=LU(n.composerText,e))}}},BU=new Set([`$$slots`,`$$events`,`$$legacy`]);function VU(e,t){let n=H(t,BU),r=[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}]];P(e,B({name:`key-round`},()=>n,{get iconNode(){return r}}))}var HU=new Set([`$$slots`,`$$events`,`$$legacy`]);function UU(e,t){let n=H(t,HU),r=[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}],[`path`,{d:`m9 12 2 2 4-4`}]];P(e,B({name:`shield-check`},()=>n,{get iconNode(){return r}}))}var WU=`nerve-color-theme`,GU=1.1,KU=N({theme:`nerve`,colorMode:`system`}),qU=N({level:0});function JU(e){try{localStorage.setItem(WU,e)}catch{}}function YU(){try{return localStorage.getItem(WU)}catch{return}}function XU(e=KU.theme){KU.theme=e,typeof document<`u`&&(document.documentElement.dataset.theme=e),typeof localStorage<`u`&&JU(e)}function ZU(e=KU.colorMode){KU.colorMode=e,wo(e)}function QU(e,t){XU(e),ZU(t)}function $U(e){return Number.isFinite(e)?Math.min(8,Math.max(-8,Math.round(e))):0}function eW(e){return GU**$U(e)}function tW(e){return Math.round(eW(e)*100)}function nW(e){let t=$U(e),n=eW(t);qU.level=t,!(typeof document>`u`)&&(document.documentElement.style.setProperty(`--nerve-zoom-scale`,n.toFixed(4)),document.documentElement.style.setProperty(`--nerve-inverse-zoom-scale`,(1/n).toFixed(4)))}function rW(){let e=typeof localStorage>`u`?void 0:YU(),t=xee.safeParse(e);return{theme:t.success?t.data:`nerve`,colorMode:ao.current??`system`}}function iW(e){return e.rememberLastAgentSelection?e.lastAgentSelection:{mode:e.defaultMode,permissionLevel:e.defaultPermissionLevel,approvalPolicy:e.defaultApprovalPolicy,model:e.defaultModel,thinkingLevel:e.defaultThinkingLevel}}function aW(e,t,n){let r=iW(e),i=lr(t,n,e.scopedModels),a=r.model,o=(a?i.find(e=>Xn(e)===Xn(a)):void 0)??i[0];return{selectedModelKey:o?Xn(o):``,selectedThinkingLevel:Bt(r.thinkingLevel,o),selectedMode:r.mode,selectedPermissionLevel:r.permissionLevel,selectedApprovalPolicy:r.approvalPolicy}}var oW=N({subscriptionUsage:{}}),sW,cW,lW=!1,uW=!1,dW=0,fW,pW,mW=!1;function hW(){return Q.agents.find(e=>e.id===Of.agentId)}function gW(){return rr.models.find(e=>Xn(e)===Z.selectedModelKey)}function _W(e,t){e&&(rr.activePageId=e),t&&(rr.activeSectionId=t)}async function vW(e,t){_W(e,t),Cp({kind:`settings`,id:`settings`}),Op({kind:`settings`,id:`settings`}),await OW()}async function yW(e,t){_W(e,t),Cp({kind:`settings`,id:`settings`}),Op({kind:`settings`,id:`settings`}),rr.settingsDraft||await OW()}function bW(){let e={kind:`settings`,id:`settings`},t=Q.activeCenterTab?.kind===`settings`,n=Tp(e);Ep(e),t&&Ap(n)}async function xW(){let e=await rU();return oW.subscriptionUsage=Object.fromEntries(e.map(e=>[e.provider,e])),e}async function SW(e=Of.projectId){let t=++dW;rr.skillsLoading=!0,rr.skillsError=void 0,rr.skillsProjectId=e??null;try{let n=await WH(e);if(t!==dW)return;rr.agentBrowserSkills=n.agentBrowserSkills,rr.globalSkills=n.globalSkills,rr.projectSkills=n.projectSkills}catch(e){if(t!==dW)return;rr.skillsError=e instanceof Error?e.message:`Could not load skills.`}finally{t===dW&&(rr.skillsLoading=!1)}}async function CW(){let[e,t,n]=await Promise.all([HH(),FV(),xV()]);rr.settingsDraft=e,QU(e.ui.theme,e.ui.colorMode),nW(e.ui.zoomLevel),rr.models=t,rr.authProviders=n,TW(),NW()||(uW=!1,rr.settingsSaveStatus=`idle`,rr.settingsMessage=void 0)}function wW(){return fW||(fW=CW().finally(()=>{fW=void 0}),fW)}function TW(){let e=rr.settingsDraft;if(!e)return;let t=rr.models,n=rr.authProviders,r=lr(t,n,e.scopedModels),i=aW(e,t,n),a=hW();if(a){Z.selectedMode=a.mode,Z.selectedPermissionLevel=a.permissionLevel,Z.selectedApprovalPolicy=a.approvalPolicy;let e=a.model;e&&r.some(t=>Xn(t)===Xn(e))?(Z.selectedModelKey=Xn(e),Z.selectedThinkingLevel=a.thinkingLevel):(Z.selectedModelKey=i.selectedModelKey,Z.selectedThinkingLevel=i.selectedThinkingLevel)}else Z.selectedMode=i.selectedMode,Z.selectedPermissionLevel=i.selectedPermissionLevel,Z.selectedApprovalPolicy=i.selectedApprovalPolicy,Z.selectedModelKey=i.selectedModelKey,Z.selectedThinkingLevel=i.selectedThinkingLevel;Z.selectedThinkingLevel=Bt(Z.selectedThinkingLevel,gW())}function EW(){xW().catch(()=>void 0),SW()}async function DW(e){e&&await e;do mW=!1,await wW(),EW();while(mW)}function OW(){return pW?(mW=!0,pW):(pW=DW(fW).finally(()=>{pW=void 0}),pW)}function kW(e,t){let n={...e??{},...t};return(e?.server||t.server)&&(n.server={...e?.server??{},...t.server??{}}),(e?.ui||t.ui)&&(n.ui={...e?.ui??{},...t.ui??{}}),(e?.desktop||t.desktop)&&(n.desktop={...e?.desktop??{},...t.desktop??{}}),(e?.notifications||t.notifications)&&(n.notifications={...e?.notifications??{},...t.notifications??{},...e?.notifications?.events||t.notifications?.events?{events:{...e?.notifications?.events??{},...t.notifications?.events??{}}}:{}}),(e?.lastAgentSelection||t.lastAgentSelection)&&(n.lastAgentSelection={...e?.lastAgentSelection??{},...t.lastAgentSelection??{},...e?.lastAgentSelection?.approvalPolicy||t.lastAgentSelection?.approvalPolicy?{approvalPolicy:{...e?.lastAgentSelection?.approvalPolicy??{},...t.lastAgentSelection?.approvalPolicy??{}}}:{}}),(e?.defaultApprovalPolicy||t.defaultApprovalPolicy)&&(n.defaultApprovalPolicy={...e?.defaultApprovalPolicy??{},...t.defaultApprovalPolicy??{}}),(e?.exploreAgent||t.exploreAgent)&&(n.exploreAgent={...e?.exploreAgent??{},...t.exploreAgent??{}}),(e?.compaction||t.compaction)&&(n.compaction={...e?.compaction??{},...t.compaction??{}}),(e?.runtime||t.runtime)&&(n.runtime={...e?.runtime??{},...t.runtime??{}}),(e?.skills||t.skills)&&(n.skills={...e?.skills??{},...t.skills??{},...e?.skills?.agentBrowser||t.skills?.agentBrowser?{agentBrowser:{...e?.skills?.agentBrowser??{},...t.skills?.agentBrowser??{}}}:{}}),(e?.tools||t.tools)&&(n.tools={...e?.tools??{},...t.tools??{},...e?.tools?.bash||t.tools?.bash?{bash:{...e?.tools?.bash??{},...t.tools?.bash??{},...e?.tools?.bash?.autoPromotion||t.tools?.bash?.autoPromotion?{autoPromotion:{...e?.tools?.bash?.autoPromotion??{},...t.tools?.bash?.autoPromotion??{}}}:{}}}:{}}),n}function AW(e){return!!(e?.server&&Object.keys(e.server).length>0)}function jW(e){return!!(e?.runtime&&Object.keys(e.runtime).length>0)}function MW(){cW&&=(clearTimeout(cW),void 0)}function NW(){return!!(sW||cW||lW)}function PW(e){let t=lr(rr.models,rr.authProviders,e);t.some(e=>Xn(e)===Z.selectedModelKey)||(Z.selectedModelKey=t.length>0?Xn(t[0]):``,Z.selectedThinkingLevel=Bt(Z.selectedThinkingLevel,gW()))}function FW(e,t={}){if(sW=kW(sW,e),`scopedModels`in e&&PW(e.scopedModels),rr.settingsSaveStatus=`dirty`,rr.settingsMessage=`Unsaved changes`,MW(),t.immediate){IW();return}cW=setTimeout(()=>void IW(),t.debounceMs??600)}async function IW(){if(MW(),lW||!sW)return;let e=sW;sW=void 0,lW=!0,rr.settingsSaveStatus=`saving`,rr.settingsMessage=`Saving…`;try{let t=await UH(e);if(uW||=AW(e),jW(e)){let e=await PV().catch(()=>void 0);e&&(Q.config=e,Q.status=e.status)}sW||(rr.settingsDraft=t,rr.settingsSaveStatus=`saved`,rr.settingsMessage=uW?`Saved — restart the daemon to apply server binding changes.`:`Saved`)}catch(t){let n=t instanceof Error?t.message:String(t);sW=kW(e,sW??{}),rr.settingsSaveStatus=`error`,rr.settingsMessage=n,Kn.error(`Could not save settings`,{description:n})}finally{lW=!1,sW&&rr.settingsSaveStatus!==`error`&&IW()}}function LW(e){XU(e)}function RW(e){ZU(e)}function zW(e){let t=$U(e);nW(t),rr.settingsDraft&&(rr.settingsDraft.ui.zoomLevel=t),FW({ui:{zoomLevel:t}})}var BW={kind:`auth`,id:`auth`};function VW(e,t){e&&(ir.activePageId=e),t&&(ir.activeSectionId=t)}async function HW(e,t){VW(e,t),Cp(BW),Op(BW),await GW()}function UW(e,t){VW(e,t),Cp(BW),Op(BW),ir.catalogLoaded||GW()}function WW(){let e=Q.activeCenterTab?.kind===`auth`,t=Tp(BW);Ep(BW),e&&Ap(t)}async function GW(){let[e]=await Promise.all([kV(),OW()]);ir.customProviders=e.providers,ir.modelDefinitions=e.models,ir.catalogLoaded=!0}async function KW(){let e=await kV();ir.customProviders=e.providers,ir.modelDefinitions=e.models,ir.catalogLoaded=!0,await OW()}var qW=new Map,JW=new Set,YW=new Set;function XW(e){return`seq`in e}function ZW(){return tG.length}function QW(e,t){let n=qW.get(e);return n||(n=new Set,qW.set(e,n)),n.add(t),()=>{n?.delete(t),n?.size===0&&qW.delete(e)}}function $W(e){return JW.add(e),()=>JW.delete(e)}function eG(e){let t=[...qW.get(e.type)??[],...JW];for(let n of t)try{let t=n(e);t instanceof Promise&&t.catch(t=>sG(e,t))}catch(t){sG(e,t)}}var tG=[],nG=!1;function rG(){if(nG)return;nG=!0;let e=()=>{nG=!1,oG()};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):queueMicrotask(e)}function iG(e){tG.push(e),rG()}async function aG(e){let t=[...qW.get(e.type)??[],...JW];for(let n of t)await n(e);for(let t of YW)t([e])}function oG(){let e=[];for(let t=0;t<tG.length;t+=1){let n=tG[t];e.push(n),eG(n)}if(tG.length=0,e.length!==0)for(let t of YW)try{t(e)}catch(e){console.error(`Workbench notify flush handler failed`,e)}}function sG(e,t){console.error(`Workbench event handler failed`,{type:e.type,seq:XW(e)?e.seq:void 0,error:t})}function cG(){return $W(lG)}function lG(e){ir.catalogLoaded&&e.type.startsWith(`providers.`)&&KW()}var uG=h(`<!> Open authentication`,1),dG=h(`<!> <!>`,1),fG=h(`<div class="audio-auth-body svelte-8zh17m"><div class="audio-auth-summary svelte-8zh17m"><span class="audio-auth-icon rounded-full svelte-8zh17m" aria-hidden="true"><!></span> <div><h3 class="svelte-8zh17m">Audio input is not configured yet</h3> <p class="svelte-8zh17m">Nerve records from your microphone locally, then sends the captured
132
+ audio to ChatGPT for transcription through the OpenAI Codex OAuth
133
+ provider.</p></div></div> <div class="audio-auth-detail svelte-8zh17m"><!> <p class="svelte-8zh17m">A free or paid ChatGPT account can be used. It just needs to be
134
+ connected so the orchestrator can request transcription securely.</p></div> <p class="audio-auth-path svelte-8zh17m">To enable it, open <strong class="svelte-8zh17m">Authentication</strong> → <strong class="svelte-8zh17m">Subscriptions</strong>, then connect <strong class="svelte-8zh17m">OpenAI Codex</strong>.</p></div>`);function pG(e,t){a(t,!0);let n=I(t,`open`,15,!1);function r(){n(!1)}function i(){r(),HW()}sP(e,{title:`Connect ChatGPT to use voice input`,description:`Voice input needs a ChatGPT OAuth connection before Nerve can transcribe recordings.`,size:`sm`,get open(){return n()},set open(e){n(e)},footer:e=>{var t=dG(),n=R(t);G(n,{size:`sm`,variant:`ghost`,onclick:r,children:(e,t)=>{w(),g(e,M(`Close`))},$$slots:{default:!0}}),G(L(n,2),{size:`sm`,onclick:i,children:(e,t)=>{var n=uG();VU(R(n),{size:15,strokeWidth:2.1}),w(),g(e,n)},$$slots:{default:!0}}),g(e,t)},children:(e,t)=>{var n=fG(),r=V(n),i=V(r);qx(V(i),{size:18,strokeWidth:2.2}),d(i),w(2),d(r);var a=L(r,2);UU(V(a),{size:16,strokeWidth:2.1,"aria-hidden":`true`}),w(2),d(a),w(2),d(n),g(e,n)},$$slots:{footer:!0,default:!0}}),z()}function mG(e){return!!e?.some(e=>e.provider===`openai-codex`&&e.configured&&e.credentialType===`oauth`)}var hG={get configured(){return mG(rr.authProviders)}},gG=new Set([`$$slots`,`$$events`,`$$legacy`]);function _G(e,t){let n=H(t,gG),r=[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`}],[`path`,{d:`M9 18h6`}],[`path`,{d:`M10 22h4`}]];P(e,B({name:`lightbulb`},()=>n,{get iconNode(){return r}}))}var vG=h(`<button type="button" class="inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-3 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-default disabled:opacity-55"><!> <span> </span></button>`),yG=h(`<div class="flex flex-wrap gap-1 px-0.5" role="group" aria-label="Suggested prompt actions"></div>`);function bG(e,t){a(t,!0);let n=I(t,`suggestions`,19,()=>[]),i=I(t,`disabled`,3,!1);var o=U(),s=R(o),c=e=>{var a=yG();_(a,21,n,e=>e.id,(e,n)=>{let a=J(()=>W(n).icon??_G);var o=vG(),s=V(o);C(s,()=>W(a),(e,t)=>{t(e,{class:`size-3.5 text-primary`,strokeWidth:2.2,"aria-hidden":`true`})});var c=L(s,2),l=V(c,!0);d(c),d(o),F(()=>{o.disabled=i(),q(o,`title`,`Click to send. Right-click to insert into composer.\n\n${W(n).prompt}`),q(o,`aria-label`,`${W(n).label}. Click to send. Right-click to insert into composer.`),A(l,W(n).label)}),r(`click`,o,()=>t.onSend?.(W(n))),r(`contextmenu`,o,e=>{e.preventDefault(),t.onDraft?.(W(n))}),g(e,o)}),d(a),g(e,a)};k(s,e=>{n().length>0&&e(c)}),g(e,o),z()}T([`click`,`contextmenu`]);function xG(e){let t=e.hasProject&&e.hasConversation,n=!!(e.interactive&&t&&!e.blockedForReview&&!e.compacting&&!e.stopping),r=n&&e.hasModels;return{hasTarget:t,canEdit:n,canPrompt:r,canSubmit:!!(r&&!e.voiceSubmitPending&&!(e.commandMode&&e.sending))}}function SG(e){return/\s/.test(e)?`"${e.replaceAll(`"`,`\\"`)}"`:e}function CG(e,t,n){return e.length===0?[]:e.map(e=>{let r=n(e).trim();if(!r)throw Error(`Could not resolve the native path for ${e.name||`a dropped item`}.`);return SG(ri(r,t)??r)})}var wG=h(`<!> <!>`,1);function TG(e,t){a(t,!0);let n=I(t,`text`,3,``),r=I(t,`pendingConversationActive`,3,!1),i=I(t,`approvals`,19,()=>[]),o=I(t,`pendingUserQuestions`,19,()=>[]),s=I(t,`pendingPlanReviews`,19,()=>[]),c=I(t,`interactive`,3,!0),l=I(t,`sending`,3,!1),u=I(t,`stopping`,3,!1),d=I(t,`compacting`,3,!1),f=I(t,`models`,19,()=>[]),p=I(t,`selectedModelKey`,3,``),m=I(t,`contextWindow`,3,0),h=I(t,`todos`,19,()=>[]),_=I(t,`focusToken`,3,0),v=I(t,`composerEscapeToken`,3,0),y=I(t,`micShortcutToken`,3,0),b=I(t,`thinkingLevel`,3,`off`),x=I(t,`mode`,3,`coding`),S=I(t,`permissionLevel`,3,`autonomous`),C=I(t,`approvalPolicy`,19,()=>({autoApproveReadOnly:!0})),w=I(t,`slashCompletions`,19,()=>[]),T=I(t,`composerSuggestions`,19,()=>[]),E=Y(0),D=Y(!1),O=Y(void 0),ee=Y(void 0),te=Y(void 0),A=Y(!1),ne=Vd(`composer.toggleMic`),j=Hd(`composer.toggleMic`),M=Vd(`composer.cancelMic`),re=Vd(`composer.toggleMode`),N=Hd(`composer.toggleMode`),P=Vd(`composer.cyclePermission`),ie=Hd(`composer.cyclePermission`),ae=Vd(`composer.cycleThinking`),oe=Vd(`composer.stopRun`),se=Hd(`composer.stopRun`),F=J(()=>{if(t.activeConversation)return{kind:`conversation`,id:t.activeConversation.id};if(t.activePendingConversation)return{kind:`pending-conversation`,id:t.activePendingConversation.id}}),ce=J(()=>!!(W(F)&&zU.isTargetActive(W(F))&&zU.recording)),le=J(()=>!!(W(F)&&zU.isTargetActive(W(F))&&zU.transcribing)),ue=J(()=>!!(W(F)&&zU.isBusyForOtherTarget(W(F)))),de=J(()=>i().length>0),fe=J(()=>o().length>0),pe=J(()=>s().length>0),me=J(()=>W(de)||W(fe)||W(pe)),he=J(()=>Fr(n())),ge=J(()=>xG({interactive:c(),hasProject:!!t.activeProject,hasConversation:!!(t.activeConversation||r()),hasModels:f().length>0,blockedForReview:W(me),compacting:d(),stopping:u(),sending:l(),commandMode:W(he),voiceSubmitPending:W(D)})),_e=J(()=>W(ge).canPrompt),ve=J(()=>!W(ge).canEdit),ye=J(()=>!W(ge).canSubmit),B=J(()=>hG.configured),V=J(()=>!!Fn()?.files),xe=J(()=>zU.isSupported()),Se=J(()=>!c()||u()||!W(F)||zU.pending||!W(ce)&&(!W(_e)||!W(xe)||W(ue))),Ce=J(()=>W(ce)?`Stop recording${ne?` (${ne})`:``} — ${M??`Esc`} to cancel; right-click to cancel (${Te(zU.elapsedMs)} / ${Te(zU.maxDurationMs)})`:W(ue)?`Voice recording is active in another conversation`:zU.retryAttempt>0&&W(F)&&zU.isTargetActive(W(F))?`Retrying transcription ${zU.retryAttempt}/${zU.maxRetries}…`:W(le)?`Transcribing audio…`:W(B)?ne?`Record voice prompt (${ne})`:`Record voice prompt`:`Connect ChatGPT to use voice input`),we=J(()=>W(D)?`Transcribing and sending prompt`:W(ce)?`Transcribe and send prompt`:d()?`Compacting context`:W(ge).canEdit&&f().length===0?`Waiting for an available model`:W(he)?`Run command`:l()?`Queue prompt`:`Send prompt`),H=J(()=>W(D)?`Transcribing audio, then sending prompt`:W(ce)?`Stop recording, transcribe, and send prompt`:d()?`Compacting context`:W(ge).canEdit&&f().length===0?`Models are loading; you can continue drafting`:W(he)?l()?`Wait for the current agent turn before running a command`:`Run command`:l()?`Queue prompt for the next agent turn`:`Send prompt`);function Te(e){let t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)}`}async function Ee(){if(W(ge).canSubmit){if(W(ce)&&W(F)){K(D,!0);try{await zU.stop(W(F))&&t.onSubmit?.()}finally{K(D,!1)}return}t.onSubmit?.()}}async function De(e){return UV(e)}async function Oe(e){try{let n=Fn();if(!n?.files||!t.activeProject)throw Error(`Native file paths are unavailable in this window.`);return CG(e,t.activeProject.dir,n.files.getPathForFile)}catch(e){let t=e instanceof Error?e.message:String(e);throw Kn.error(`Could not add dropped paths`,{description:t}),e}}let ke=J(()=>!c()||!(t.activeConversation||r())||u()||d()||W(me)),Ae=J(()=>!c()||!(t.activeConversation||r())),je=J(()=>!c()||!(t.activeConversation||r())||f().length===0||d()||u()),q=J(()=>l()?`Changes apply to the next model request`:void 0);function Me(){if(!(!c()||W(Se)||d()||u()||!W(F))){if(!W(ce)&&!W(B)){K(A,!0);return}zU.toggle(W(F))}}function Ne(){return!W(ce)||!W(F)?!1:(zU.cancel(W(F)),!0)}be(()=>{if(W(O)===void 0||!c()){K(O,_());return}_()!==W(O)&&(K(O,_()),K(E,W(E)+1))}),be(()=>{if(W(ee)===void 0||!c()){K(ee,v());return}v()!==W(ee)&&(K(ee,v()),Ne()||K(E,W(E)+1))}),be(()=>{if(W(te)===void 0||!c()){K(te,y());return}y()!==W(te)&&(K(te,y()),Me())});function Pe(e){!W(ce)||!W(F)||(e.preventDefault(),zU.cancel(W(F)))}var Fe=wG(),Ie=R(Fe);{let e=e=>{var n=U(),r=R(n),i=e=>{bG(e,{get suggestions(){return T()},get disabled(){return l()},get onSend(){return t.onSendSuggestion},get onDraft(){return t.onDraftSuggestion}})};k(r,e=>{T().length>0&&!W(me)&&!d()&&W(_e)&&e(i)}),g(e,n)},r=e=>{var t=wG(),n=R(t);{let e=J(()=>W(F)&&zU.isTargetActive(W(F))?zU.retryAttempt:0);oU(n,{get recording(){return W(ce)},get transcribing(){return W(le)},get elapsedMs(){return zU.elapsedMs},get maxDurationMs(){return zU.maxDurationMs},get retryAttempt(){return W(e)},get maxRetries(){return zU.maxRetries},class:`composer-transcription-status`})}var r=L(n,2);{let e=J(()=>W(ce)?`destructive`:`secondary`),t=J(()=>`rounded-full ${W(ce)?`inset-ring-1 inset-ring-destructive/28`:``}`),n=J(()=>W(ce)?`Stop recording; right-click to cancel`:W(B)?`Record voice prompt`:`Connect ChatGPT to use voice input`);G(r,{get variant(){return W(e)},size:`icon-sm`,get class(){return W(t)},type:`button`,get disabled(){return W(Se)},onclick:Me,oncontextmenu:Pe,get"aria-label"(){return W(n)},get"aria-keyshortcuts"(){return j},get title(){return W(Ce)},children:(e,t)=>{var n=U(),r=R(n),i=e=>{Fi(e,{class:`size-3.5`})},a=e=>{qx(e,{size:14,strokeWidth:2.4})};k(r,e=>{W(le)?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}g(e,t)},i=J(()=>({text:n(),disabled:W(ve),editorDisabled:W(ve),submitDisabled:W(ye),sending:l(),stopping:u(),compacting:d(),showStop:l()||u()||d(),pendingApproval:W(de),pendingQuestion:W(fe),pendingPlan:W(pe),models:f(),selectedModelKey:p(),thinkingLevel:b(),mode:x(),permissionLevel:S(),approvalPolicy:C(),contextUsage:t.contextUsage,contextWindow:m(),placeholder:W(de)?`Approval required before the agent can continue`:W(pe)?`Review the plan in the transcript before the agent can continue`:W(fe)?`Reply in the transcript before the agent can continue`:d()?`Compacting context…`:l()?`Queue a prompt for the next agent turn`:`Ask the local Nerve agent`,focusToken:W(E),controlsDisabled:W(ke),modeDisabled:W(Ae),modelDisabled:W(je),runtimeChangeHint:W(q),sendAriaLabel:W(we),sendTitle:W(H),stopAriaLabel:d()?`Stop compaction`:`Stop generation`,stopShortcutAria:se,stopTitle:u()?d()?`Stopping compaction`:`Stopping generation`:d()?oe?`Stop compaction (${oe})`:`Stop compaction`:oe?`Stop generation (${oe})`:`Stop generation`,permissionShortcut:P,permissionShortcutAria:ie,modeShortcut:re,modeShortcutAria:N,thinkingShortcut:ae,todos:h(),slashCompletions:w(),fileCompletions:t.fileCompletions,capabilities:{voice:!0,imagePaste:!0,fileDrop:W(V),completions:!0,suggestions:!0,shortcuts:!0,todos:!0,queueing:!0}})),a=J(()=>({onComposerChange:t.onChange,onSubmit:Ee,onAbort:t.onAbort,onCompact:t.onCompact,onModelChange:t.onModelChange,onThinkingLevelChange:t.onThinkingLevelChange,onModeChange:t.onModeChange,onPermissionChange:t.onPermissionChange,onApprovalPolicyChange:t.onApprovalPolicyChange,onPasteImage:De,onDropFiles:W(V)?Oe:void 0}));Tv(Ie,{get model(){return W(i)},get actions(){return W(a)},header:e,sendLeading:r,$$slots:{header:!0,sendLeading:!0}})}pG(L(Ie,2),{get open(){return W(A)},set open(e){K(A,e,!0)}}),g(e,Fe),z()}var EG=`agent.subagent_transcript.`,DG=`agent.subagent_transcript.run.completed`;function OG(e){return e&&typeof e==`object`?e:void 0}function kG(e,t,n,r){let i=OG(e.data);return!i||r&&(i.conversationId!==r.conversationId||i.projectId!==r.projectId)?!1:e.type.startsWith(EG)?i.parentAgentId===t&&i.childAgentId===n:e.type===`toolCall.updated`&&i.agentId===n}function AG(e){return function(t,n,r){let i=!1,a=!1,o,s=-1,c=[],l,u=!1,d=!1,f=!1,p=e=>{e.seq<=s||(s=e.seq,r.event(e)===!1&&m(),e.type===DG&&!f&&(d=!0,m()))},m=()=>{if(i)return;if(l){u=!0;return}let h=d;l=e.fetch(t,n).then(e=>{if(i)return;if(e.parentAgentId!==t||e.agentId!==n)throw Error(`Subagent transcript ownership mismatch.`);o={conversationId:e.conversationId,projectId:e.projectId},r.snapshot(e);let l=s;if(s=Math.max(s,e.cursorSeq),e.cursorSeq>=l&&(u=!1),!a){a=!0;let r=c.filter(r=>r.seq>e.cursorSeq&&kG(r,t,n,o)).sort((e,t)=>e.seq-t.seq);c=[];for(let e of r)p(e)}h&&(d=!1,f=!0)}).catch(e=>{i||r.error(e instanceof Error?e.message:String(e))}).finally(()=>{l=void 0,u&&!i&&(u=!1,m())})},h=e.subscribe(e=>{if(i||!XW(e))return;let r=e;if(kG(r,t,n,o)){if(!a){c.push(r);return}p(r)}});return m(),()=>{i=!0,c=[],h()}}}var jG=AG({fetch:_V,subscribe:$W});function MG(){return rr.settingsDraft?.tools?.jira?.siteUrl}function NG(){return rr.settingsDraft?.tools?.confluence?.siteUrl}var PG=new _a({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}),FG={clientConfig:[`client-config`],workspace:[`workspace`],latestRelease:[`status`,`latest-release`],slashCompletions:[`completions`,`slash`],fileCompletions:(e,t)=>[`completions`,`files`,e??`none`,t],git:{project:e=>[`git`,e],repos:e=>[`git`,e,`repos`],repo:(e,t)=>[`git`,e,`repo`,t],overview:(e,t)=>[`git`,e,`repo`,t,`overview`],branches:(e,t)=>[`git`,e,`repo`,t,`branches`],githubStatus:(e,t)=>[`git`,e,`repo`,t,`github-status`],prs:(e,t,n)=>[`git`,e,`repo`,t,`prs`,n],pr:(e,t,n)=>[`git`,e,`repo`,t,`pr`,n],prInitial:(e,t,n)=>[`git`,e,`repo`,t,`pr`,n,`initial`],prSection:(e,t,n,r)=>[`git`,e,`repo`,t,`pr`,n,r],prFileDiff:(e,t,n,r,i,a,o,s)=>[`git`,e,`repo`,t,`pr`,n,`file-diff`,r,i,a,o??``,s],prFiles:(e,t,n,r,i)=>[`git`,e,`repo`,t,`pr`,n,`files`,r,i],prHeadSection:(e,t,n,r,i)=>[`git`,e,`repo`,t,`pr`,n,r,i]}};async function IG(e){let t=await e.fetch(),n=await e.apply(t);return e.cache?.(t),n}function LG(e,t){return!t||e.updatedAt>=t.updatedAt}function RG(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return!t||LG(e,t)?e:t})}function zG(e,t){let n=t.findIndex(t=>t.id===e.id);if(n===-1)return[...t,e];let r=t[n];return LG(e,r)?t.map(t=>t.id===e.id?e:t):t}function BG(e){return e&&typeof e==`object`?e:void 0}function VG(e){return typeof e==`string`?e:void 0}function HG(e){let t=BG(e);return!!(t&&typeof t.id==`string`&&typeof t.updatedAt==`string`)}function UG(e){let t=BG(e);return!!(t&&typeof t.id==`string`&&typeof t.projectId==`string`&&typeof t.updatedAt==`string`)}function WG(e){let t=BG(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.status==`string`)}function GG(e){let t=BG(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.role==`string`&&typeof t.createdAt==`string`)}function KG(e){let t=BG(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.status==`string`&&typeof t.updatedAt==`string`)}function qG(e){let t=BG(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.status==`string`&&typeof t.updatedAt==`string`)}function JG(e){let t=BG(e);return!!(t&&typeof t.id==`string`)}function YG(e){Q.conversations=Q.conversations.findIndex(t=>t.id===e.id)===-1?[e,...Q.conversations]:Q.conversations.map(t=>t.id===e.id?e:t)}function XG(e){Q.conversations=Q.conversations.filter(t=>t.id!==e)}function ZG(e){let t=Q.conversations.findIndex(t=>t.id===e.conversationId);if(t===-1)return;let n=Q.conversations[t];if(!n)return;let r=e.role===`user`&&(!n.lastUserMessageAt||e.createdAt>n.lastUserMessageAt)?e.createdAt:n.lastUserMessageAt;Q.conversations=Q.conversations.map(t=>t.id===e.conversationId?{...t,activeEntryId:e.id,updatedAt:e.createdAt,lastUserMessageAt:r}:t)}function QG(e){Q.agents=zG(e,Q.agents)}function $G(e,t,n){if(!e)return;let r=Q.agents.find(t=>t.id===e);!r||r.updatedAt>n||QG({...r,status:t,updatedAt:n})}function eK(e){if(e.status!==`pending`){tK(e.id);return}Q.approvals=Q.approvals.findIndex(t=>t.id===e.id)===-1?[e,...Q.approvals]:Q.approvals.map(t=>t.id===e.id?{...t,...e}:t)}function tK(e){Q.approvals=Q.approvals.filter(t=>t.id!==e)}function nK(e){if(e.status!==`pending`){rK(e.id);return}Q.userQuestions=Q.userQuestions.findIndex(t=>t.id===e.id)===-1?[e,...Q.userQuestions]:Q.userQuestions.map(t=>t.id===e.id?e:t)}function rK(e){Q.userQuestions=Q.userQuestions.filter(t=>t.id!==e)}function iK(e){if(e.status!==`pending`){aK(e.id);return}Q.planReviews=Q.planReviews.findIndex(t=>t.id===e.id)===-1?[e,...Q.planReviews]:Q.planReviews.map(t=>t.id===e.id?e:t)}function aK(e){Q.planReviews=Q.planReviews.filter(t=>t.id!==e)}function oK(e){Q.planReviews=Q.planReviews.filter(t=>t.agentId!==e)}function sK(e){let t=e.data??{},n=BG(t.agent),r=BG(t.conversation),i=BG(t.entry),a=BG(t.approval),o=BG(t.question),s=BG(t.planReview);if(UG(r)&&YG(r),e.type===`conversation.entry.appended`&&GG(i)&&ZG(i),e.type===`conversation.deleted`){let e=VG(t.conversationId)??VG(t.id);e&&XG(e)}if(HG(n)&&QG(n),WG(a)){let e=JG(t.toolCall)?t.toolCall:void 0;eK({...a,toolCall:e})}if(KG(o)&&nK(o),qG(s)&&iK(s),e.type===`planReview.updated`&&t.status===`force_exited`){let e=VG(t.agentId);e&&oK(e)}}var cK=[`model`,`thinkingLevel`,`mode`,`permissionLevel`,`approvalPolicy`],lK=class{deps;entries=new Map;constructor(e){this.deps=e}desired(e){let t=this.entries.get(e);return t&&uK(t.desired)?{...t.desired}:void 0}enqueue(e,t){if(!uK(t))return;let n=this.entries.get(e)??{desired:{},generation:0};this.entries.set(e,n),n.desired={...n.desired,...dK(t)},n.generation+=1,this.publishDesired(e,n),n.pump||=Promise.resolve().then(()=>this.pump(e,n)).finally(()=>{n.pump=void 0})}async flush(e){for(;;){let t=this.entries.get(e)?.pump;if(!t)return;await t}}async pump(e,t){for(;uK(t.desired);){let n={...t.desired},r=t.generation;try{let i,a=n.mode===void 0?void 0:{mode:n.mode},o=fK(n);a&&(i=await this.deps.configure(e,a),this.deps.onAgentRecord?.(i)),o&&(i=await this.deps.configure(e,o),this.deps.onAgentRecord?.(i)),t.generation===r&&(t.desired={},this.publishDesired(e,t),i&&this.deps.onConfirmed?.(e,i))}catch(r){t.desired=pK(t.desired,n),this.publishDesired(e,t),this.deps.onFailed?.(e,r,n)}}}publishDesired(e,t){this.deps.onDesiredChanged?.(e,uK(t.desired)?{...t.desired}:void 0)}};function uK(e){return cK.some(t=>e[t]!==void 0)}function dK(e){let t={};for(let n of cK)e[n]!==void 0&&(t[n]=e[n]);return t}function fK(e){let t={};return e.model!==void 0&&(t.model=e.model),e.thinkingLevel!==void 0&&(t.thinkingLevel=e.thinkingLevel),e.permissionLevel!==void 0&&(t.permissionLevel=e.permissionLevel),e.approvalPolicy!==void 0&&(t.approvalPolicy=e.approvalPolicy),uK(t)?t:void 0}function pK(e,t){let n={};for(let r of cK){let i=e[r];i!==void 0&&(mK(r,i,t[r])||(n[r]=i))}return n}function mK(e,t,n){if(t===n)return!0;if(e===`model`){let e=t,r=n;return!!(e&&r&&e.provider===r.provider&&e.modelId===r.modelId)}if(e===`approvalPolicy`){let e=t,r=n;return!!(e&&r&&e.autoApproveReadOnly===r.autoApproveReadOnly)}return!1}var hK=N({byAgentId:{}}),gK=new lK({configure:(e,t)=>gV(e,t),onDesiredChanged:(e,t)=>{t?hK.byAgentId[e]=t:delete hK.byAgentId[e]},onAgentRecord:e=>{QG(e)},onConfirmed:(e,t)=>{Of.agentId===e&&(t.model&&(Z.selectedModelKey=Xn(t.model)),Z.selectedThinkingLevel=t.thinkingLevel,Z.selectedMode=t.mode,Z.selectedPermissionLevel=t.permissionLevel,Z.selectedApprovalPolicy=t.approvalPolicy)},onFailed:(e,t)=>{let n=Q.agents.find(t=>t.id===e);n&&Of.agentId===e&&(n.model&&(Z.selectedModelKey=Xn(n.model)),Z.selectedThinkingLevel=n.thinkingLevel,Z.selectedMode=n.mode,Z.selectedPermissionLevel=n.permissionLevel,Z.selectedApprovalPolicy=n.approvalPolicy);let r=t instanceof Error?t.message:String(t);Kn.error(`Could not update agent settings`,{description:r})}});function _K(e,t){gK.enqueue(e,t)}function vK(e){return gK.flush(e)}function yK(e){return e?hK.byAgentId[e]:void 0}function bK(e){async function t(t,n){try{return await n()}catch(n){let r=n instanceof Error?n.message:String(n);throw e.notify.error(t,{description:r}),n}}return{async grantApproval(n){await t(`Could not grant approval`,()=>e.requests.grantApproval(n)),e.reconcile.removeApproval(n),e.notify.success(`Approval granted`)},async denyApproval(n){await t(`Could not deny approval`,()=>e.requests.denyApproval(n,`Denied from UI.`)),e.reconcile.removeApproval(n),e.notify.message(`Approval denied`)},async acceptPendingPlanReview(n,r={}){let i=await t(`Could not accept plan`,()=>e.requests.acceptPlanReview(n,r));e.reconcile.upsertPlanReview(i),e.notify.success(`Plan accepted`)},async acceptPendingPlanReviewInNewChat(n,r={}){let i=await t(`Could not accept plan in new chat`,()=>e.requests.acceptPlanReviewInNewChat(n,r));e.reconcile.upsertConversation(i.conversation),e.reconcile.upsertAgent(i.agent),e.reconcile.upsertPlanReview(i.planReview),await e.openConversation(i.conversation.id),e.notify.success(`Plan accepted in new chat`)},async rejectPendingPlanReview(n){let r=await t(`Could not reject plan`,()=>e.requests.rejectPlanReview(n,`Rejected from UI.`));e.reconcile.upsertPlanReview(r),e.notify.message(`Plan rejected`)},async requestPendingPlanChanges(n,r){let i=await t(`Could not request plan changes`,()=>e.requests.requestPlanChanges(n,r));e.reconcile.upsertPlanReview(i),e.notify.message(`Change request sent`)},async discardPendingPlanReview(n){let r=await t(`Could not discard plan`,()=>e.requests.discardPlanReview(n,`Discarded from UI.`));e.reconcile.upsertPlanReview(r),e.notify.message(`Plan discarded`)},async answerUserQuestionById(n,r){let i=r.trim();if(!i)return;let a=await t(`Could not send reply`,()=>e.requests.answerUserQuestion(n,i));e.reconcile.upsertUserQuestion(a),e.notify.success(`Reply sent`)},async dismissUserQuestionById(n){let r=await t(`Could not dismiss question`,()=>e.requests.dismissUserQuestion(n,`Dismissed from UI.`));e.reconcile.upsertUserQuestion(r),e.notify.message(`Question dismissed`)}}}var xK=1e3,SK,CK=!1,wK;function TK(){return[...Q.eventCursors].map(([e,t])=>({stream:e,processedSeq:t})).sort((e,t)=>e.stream.localeCompare(t.stream))}function EK(e,t={}){t.replace&&Q.eventCursors.clear();for(let t of e)Q.eventCursors.set(t.stream,t.processedSeq);t.sync!==!1&&AK()}function DK(e,t){t>(Q.eventCursors.get(e)??0)&&Q.eventCursors.set(e,t)}function OK(e){Q.eventCursors.delete(e)&&AK()}function kK(e){return SK=e,()=>{SK===e&&(SK=void 0,NK())}}function AK(){!SK||CK||(CK=!0,queueMicrotask(()=>void jK()))}async function jK(){CK=!1,NK();let e=SK;if(e)try{await e(TK())===`skipped`&&MK()}catch(e){console.error(`Stream subscription update failed; retrying`,e),MK()}}function MK(){wK!==void 0||!SK||(wK=setTimeout(()=>{wK=void 0,AK()},xK))}function NK(){wK!==void 0&&(clearTimeout(wK),wK=void 0)}function PK(e,t){let n=e.activeRun;n&&n.runId===t&&(n.status=`waiting`,n.queuedPrompts=[]),e.sending=!1,e.queuedPrompts=[],e.error=void 0}function FK(e){e.optimisticMessages=[],e.stopping=!1}function IK(e,t,n){return e&&!!(t&&n===t)}function LK(e,t,n){let r=n?t.find(e=>e.id===n):void 0,i=e.activeAgentId?t.find(t=>t.id===e.activeAgentId):void 0;for(let n of[r,i]){if(!n||n.conversationId!==e.id)continue;if(!n.parentAgentId)return n;let r=t.find(t=>t.id===n.rootAgentId&&!t.parentAgentId&&t.conversationId===e.id);if(r)return r}return t.filter(t=>t.conversationId===e.id&&!t.parentAgentId).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]}async function RK(e){return Q.projects.find(t=>t.id===e.projectId)??await TH(e.projectId)}async function zK(e){Of.conversationId=e.id,Of.projectId=e.projectId;let t=LK(e,Q.agents);Of.agentId=t?.id,Of.entryId=e.activeEntryId,kf.projectDir=(await RK(e)).dir;let n=yK(t?.id),r=n?.model??void 0;r?Z.selectedModelKey=Xn(r):t?.model&&(Z.selectedModelKey=Xn(t.model)),Z.selectedThinkingLevel=n?.thinkingLevel??t?.thinkingLevel??`off`,Z.selectedMode=n?.mode??t?.mode??e.mode,Z.selectedPermissionLevel=n?.permissionLevel??t?.permissionLevel??e.permissionLevel,Z.selectedApprovalPolicy=n?.approvalPolicy??t?.approvalPolicy??e.approvalPolicy}async function BK(e){let t=sU(e);t.loading=!0;try{let n=await RV(e),r=n.snapshot,i=It(r),a=t.activeRun?.runId;t.activeEntryId=r.tree.activeEntryId,t.activeEntryIds=i.activeEntryIds,t.entries=i.entries,t.toolCalls=i.toolCalls,t.treeNodes=r.tree.nodes,t.activeRun=i.activeRun,t.transient=void 0,t.optimisticMessages=[],t.queuedPrompts=i.queuedPrompts??[],t.contextUsage=i.contextUsage,t.cursorSeq=i.cursorSeq,t.stopping=IK(t.stopping,a,i.activeRun?.runId),Q.conversations=Q.conversations.map(t=>t.id===e?r.conversation:t),t.sending=i.sending??!1,EK(n.cursor.streams),Of.conversationId===e&&(Of.entryId=r.tree.activeEntryId),VK()}finally{t.loading=!1}}async function VK(){try{Q.userQuestions=await KH()}catch(e){console.warn(`Failed to refresh pending user questions`,e)}}function HK(e){Q.conversations=[e,...Q.conversations.filter(t=>t.id!==e.id)]}function UK(e){Q.agents=[e,...Q.agents.filter(t=>t.id!==e.id)]}async function WK(e){let t=Q.conversations.find(t=>t.id===e)??(await Ar(`conversation.get`,{conversationId:e})).result.conversation;if(t.projectId!==Q.selectedProjectId){let{selectProject:e}=await Qx(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>SJ);return{selectProject:e}},void 0);await e(t.projectId)}lU(t.id),Z.activeConversationTabId=t.id,Op({kind:`conversation`,id:t.id}),cU(),await zK(t),await BK(t.id),Q.error=sU(t.id).error}async function GK(e=Q.activeCenterTab){let t=Q.openCenterTabs.filter(e=>e.kind===`conversation`).map(e=>e.id);for(let e of t)sU(e);return Z.activeConversationTabId=e?.kind===`conversation`?e.id:t[0],e?.kind===`conversation`?(await Ap(e),!0):!1}async function KK(e){let t=Z.openConversationTabIds,n=t.indexOf(e);if(n===-1)return;let r={kind:`conversation`,id:e},i=Tp(r),a=t.filter(t=>t!==e),o=a[n]??a[n-1];await zU.cancelIfTarget({kind:`conversation`,id:e}),Ep(r),delete Z.conversationViews[Yr(e)],OK(Pr(e));let s=Q.activeCenterTab?.kind===`conversation`&&Q.activeCenterTab.id===e;Z.activeConversationTabId===e&&(Z.activeConversationTabId=o),Of.conversationId===e&&!o&&mU(),cU(),s&&await Ap(i)}async function qK(e){if(!Z.pendingConversations[Qr(e)])return;let t={kind:`pending-conversation`,id:e},n=Tp(t),r=Q.activeCenterTab?.kind===`pending-conversation`&&Q.activeCenterTab.id===e;await zU.cancelIfTarget({kind:`pending-conversation`,id:e}),Ep(t),delete Z.pendingConversations[Qr(e)],r&&(mU(),await Ap(n)),cU()}async function JK(e){let t=new Set(e),n=Of.conversationId?t.has(Of.conversationId):!1;await zU.cancelIfTargets(e.map(e=>({kind:`conversation`,id:e}))),Sp(Q.openCenterTabs.filter(e=>e.kind!==`conversation`||!t.has(e.id)));for(let e of t)delete Z.conversationViews[Yr(e)],OK(Pr(e));if(!n){cU();return}let r=Z.openConversationTabIds[0];if(r){Z.activeConversationTabId=r,cU(),await WK(r);return}mU(),await Ap(Q.openCenterTabs[0]),cU()}var YK=bK({requests:{grantApproval:qH,denyApproval:JH,acceptPlanReview:YH,acceptPlanReviewInNewChat:XH,rejectPlanReview:ZH,requestPlanChanges:QH,discardPlanReview:$H,answerUserQuestion:eU,dismissUserQuestion:tU},reconcile:{removeApproval:tK,upsertUserQuestion:nK,upsertPlanReview:iK,upsertConversation:YG,upsertAgent:QG},notify:Kn,openConversation:WK});async function XK(e){await YK.grantApproval(e)}async function ZK(e){await YK.denyApproval(e)}async function QK(e,t={}){await YK.acceptPendingPlanReview(e,t)}async function $K(e,t={}){await YK.acceptPendingPlanReviewInNewChat(e,t)}async function eq(e){await YK.rejectPendingPlanReview(e)}async function tq(e,t){await YK.answerUserQuestionById(e,t)}async function nq(e){await YK.dismissUserQuestionById(e)}function rq(e){let t=dU(),n=rr.settingsDraft?aW(rr.settingsDraft,rr.models,rr.authProviders):{selectedModelKey:Z.selectedModelKey,selectedThinkingLevel:Z.selectedThinkingLevel,selectedMode:Z.selectedMode,selectedPermissionLevel:Z.selectedPermissionLevel,selectedApprovalPolicy:Z.selectedApprovalPolicy};Z.pendingConversations[Qr(t)]={id:t,projectId:e.id,projectDir:e.dir,title:`New Conversation`,composerText:``,selectedModelKey:n.selectedModelKey,thinkingLevel:n.selectedThinkingLevel,mode:n.selectedMode,permissionLevel:n.selectedPermissionLevel,approvalPolicy:n.selectedApprovalPolicy,sending:!1,createdAt:new Date().toISOString()},Cp({kind:`pending-conversation`,id:t}),iq(t)}function iq(e){let t=Z.pendingConversations[Qr(e)];t&&(Op({kind:`pending-conversation`,id:t.id}),Z.activeConversationTabId=void 0,Af(),Of.projectId=t.projectId,kf.projectDir=t.projectDir,Z.selectedModelKey=t.selectedModelKey,Z.selectedThinkingLevel=t.thinkingLevel,Z.selectedMode=t.mode,Z.selectedPermissionLevel=t.permissionLevel,Z.selectedApprovalPolicy=t.approvalPolicy,pU(),Q.error=t.error)}function aq(){let e=Q.conversations.find(e=>e.id===Of.conversationId);if(e)return LK(e,Q.agents,Of.agentId)}function oq(){return ur(Z.selectedModelKey)}function sq(){return rr.models.find(e=>Xn(e)===Z.selectedModelKey)}function cq(e){let t=rr.settingsDraft;t?.rememberLastAgentSelection&&(t.lastAgentSelection={...t.lastAgentSelection,...e},FW({lastAgentSelection:e},{immediate:!0}))}function lq(){let e=Q.activeCenterTab;if(e?.kind===`pending-conversation`)return Z.pendingConversations[Qr(e.id)]}function uq(){return Bt(Z.selectedThinkingLevel,sq())}function dq(e){Z.selectedModelKey=e;let t=Bt(Z.selectedThinkingLevel,sq());Z.selectedThinkingLevel=t;let n=lq();n&&(n.selectedModelKey=e,n.thinkingLevel=t);let r=oq();cq({...r?{model:r}:{},thinkingLevel:t});let i=aq()?.id;n||!i||_K(i,{model:r??null,thinkingLevel:t})}function fq(e){let t=Bt(e,sq());Z.selectedThinkingLevel=t;let n=lq();n&&(n.thinkingLevel=t),cq({thinkingLevel:t});let r=aq()?.id;n||!r||_K(r,{thinkingLevel:t})}function pq(e){Z.selectedMode=e;let t=lq();t&&(t.mode=e),cq({mode:e});let n=aq()?.id;t||!n||_K(n,{mode:e})}function mq(e){Z.selectedPermissionLevel=e;let t=lq();t&&(t.permissionLevel=e),cq({permissionLevel:e});let n=aq()?.id;t||!n||_K(n,{permissionLevel:e})}function hq(e){Z.selectedApprovalPolicy=e;let t=lq();t&&(t.approvalPolicy=e),cq({approvalPolicy:e});let n=aq()?.id;t||!n||_K(n,{approvalPolicy:e})}function gq(e,t){return e?.autoApproveReadOnly===t.autoApproveReadOnly}function _q(e){let t=oq(),n=uq();return{desired:t,thinkingLevel:n,needsModel:t&&Xn(e?.model??{provider:``,modelId:``})!==Xn(t),needsMode:e?.mode!==Z.selectedMode,needsPermission:e?.permissionLevel!==Z.selectedPermissionLevel,needsApprovalPolicy:!gq(e?.approvalPolicy,Z.selectedApprovalPolicy),needsThinking:e?.thinkingLevel!==n}}async function vq(e,t){let n=Mee(e);if(!n)return!1;switch(t.clearComposer(),n.name){case`plan`:t.setMode(`planning`);break;case`code`:t.setMode(`coding`);break;case`compact`:await t.compact();break;case`abort`:await t.abort();break}return!0}function yq(e){return e&&typeof e==`object`?e:void 0}function bq(e){let t=yq(e.details);if(t?.type!==`inline_command_result`)return new Set;let n=typeof t.command==`string`?t.command.trim():``;return n?new Set([`!${n}`,`! ${n}`]):new Set}function xq(e){return{role:`user`,text:e,optimistic:!0}}function Sq(e,t){if(e.length===0)return e;let n=bq(t),r=e.filter(e=>e.role===`user`?t.role===`user`?!1:!n.has(e.text.trim()):!0);return r.length===e.length?e:r}async function Cq(e){await e.hydrate();let t=e.view();t.sending=!0,t.error=void 0,t.optimisticMessages=e.optimisticMessages,await e.start()}function wq(e){let t=new Set;return async function(){let n=e.agentId();if(!n||t.has(n))return;let r=e.view();if(r?.activeRun?.status===`aborting`)return;let i=r?.conversationId,a=r?.activeRun?.runId,o=r?{activeRun:r.activeRun,queuedPrompts:r.queuedPrompts,sending:r.sending,stopping:r.stopping}:void 0;r&&(r.activeRun&&={...r.activeRun,status:`aborting`},r.stopping=!0,r.queuedPrompts=[]),t.add(n);try{await e.cancelRun(n,a)}catch(t){let n=i?e.view(i):void 0,r=!!(n?.stopping&&(a?n.activeRun?.runId===a:!n.activeRun));n&&o&&r&&(n.activeRun=o.activeRun,n.queuedPrompts=o.queuedPrompts,n.sending=o.sending,n.stopping=o.stopping);let s=!!(n&&a&&!n.activeRun&&!n.stopping);n?.activeRun&&(!a||n.activeRun.runId!==a)&&(n.stopping=!1),s||e.notifyError(`Could not stop the run`,{description:t instanceof Error?t.message:String(t)});return}finally{t.delete(n)}let s=i?e.view(i):void 0;if(!s)return;let c=s.activeRun?.runId;if(!(a?!c||c===a:!c)){s.stopping=!1;return}s.sending=!1,s.stopping=!1,s.activeRun=void 0,s.queuedPrompts=[]}}async function Tq(e,t=!1){if(!Of.conversationId)return;let n=Of.conversationId;await Ar(`conversation.navigate`,{conversationId:n,activeEntryId:e??null,summarize:t}),await PG.invalidateQueries({queryKey:FG.workspace}),await CJ(),await WK(n)}async function Eq(){if(!Of.conversationId)return;let e=Of.conversationId;Oq.delete(e);let t=sU(e),n={id:`local:compaction:${e}:${Date.now()}`,state:`running`,reason:`manual`,conversationId:e,createdAt:new Date().toISOString()};t.transient={...t.transient,compaction:n},t.error=void 0;try{await BV(e),t.transient={...t.transient,compaction:void 0},await PG.invalidateQueries({queryKey:FG.workspace}),await CJ(),await WK(e)}catch(r){if(Oq.delete(e))return;let i=r instanceof Error?r.message:String(r);t.transient={...t.transient,compaction:{...n,state:`failed`,errorMessage:i}},Kn.error(`Compaction failed`,{description:i})}}var Dq=new Set,Oq=new Set;async function kq(){if(!Of.conversationId)return;let e=Of.conversationId,t=sU(e),n=t.transient?.compaction;if(!(n?.state!==`running`||Dq.has(e))){Dq.add(e),Oq.add(e),t.stopping=!0;try{await Promise.all([VV(e),n.runId?jq():Promise.resolve()])}catch(t){Oq.delete(e);let n=t instanceof Error?t.message:String(t);Kn.error(`Could not stop compaction`,{description:n})}finally{Dq.delete(e);let t=Z.conversationViews[Yr(e)];t&&(t.stopping=!1)}}}async function Aq(e){if(!Of.agentId||!Of.conversationId)return;let t=Of.agentId,n=Of.conversationId,r=sU(n);r.sending=!0,r.error=void 0,Q.error=void 0;try{await vK(t),await Ar(`run.continue`,{agentId:t,conversationId:n,runId:e,reason:`manual`},{idempotencyKey:crypto.randomUUID()})}catch(e){let t=e instanceof Error?e.message:String(e);r.sending=!1,r.error=t,Q.error=t,Kn.error(`Continue failed`,{description:t})}}var jq=wq({agentId:()=>Of.agentId,view:(e=Of.conversationId)=>e?Z.conversationViews[Yr(e)]:void 0,cancelRun:async(e,t)=>{await Ar(`run.cancel`,{agentId:e,runId:t},{idempotencyKey:crypto.randomUUID()})},notifyError:(e,t)=>Kn.error(e,t)});function Mq(e){let t=fU();if(t){t.composerText=e;return}if(!Of.conversationId){kf.text=e;return}sU(Of.conversationId).composerText=e}function Nq(){let e=fU();e&&(e.composerText=``),Of.conversationId&&(sU(Of.conversationId).composerText=``),kf.text=``}async function Pq(){let e=aq();if(e){let t=e.id;Of.agentId=t,await vK(t);let{desired:n,thinkingLevel:r,needsModel:i,needsMode:a,needsPermission:o,needsApprovalPolicy:s,needsThinking:c}=_q(e),l={...i&&n?{model:n}:{},...c?{thinkingLevel:r}:{},...a?{mode:Z.selectedMode}:{},...o?{permissionLevel:Z.selectedPermissionLevel}:{},...s?{approvalPolicy:Z.selectedApprovalPolicy}:{}};return Object.keys(l).length>0&&_K(t,l),await vK(t),t}if(Of.projectId&&Of.conversationId){let{agent:e}=(await Ar(`agent.create`,{projectId:Of.projectId,conversationId:Of.conversationId,model:oq(),thinkingLevel:uq(),mode:Z.selectedMode,permissionLevel:Z.selectedPermissionLevel,approvalPolicy:Z.selectedApprovalPolicy})).result;return Of.agentId=e.id,await PG.invalidateQueries({queryKey:FG.workspace}),await CJ(),e.id}throw Q.projectPickerOpen=!0,Error(`Select a project directory before starting a conversation.`)}function Fq(){return lr(rr.models,rr.authProviders,rr.settingsDraft?.scopedModels).length>0}function Iq(e,t){Kn.error(e,{description:t})}async function Lq(e,t,n={}){let r=n.clearComposer??!0;if(!Fq()){vW();let t=`Configure a model provider or adjust Scoped Models in Settings before prompting.`;e.error=t,Q.error=t,Iq(`No usable model configured`,t);return}e.selectedModelKey=Z.selectedModelKey,e.thinkingLevel=uq(),e.mode=Z.selectedMode,e.permissionLevel=Z.selectedPermissionLevel,e.approvalPolicy=Z.selectedApprovalPolicy,e.sending=!0,e.error=void 0,Q.error=void 0;let i,a;try{let{conversation:n}=(await Ar(`conversation.create`,{projectId:e.projectId,title:Wr(t),mode:e.mode,permissionLevel:e.permissionLevel,approvalPolicy:e.approvalPolicy})).result;a=n.id;let{agent:o}=(await Ar(`agent.create`,{projectId:e.projectId,conversationId:n.id,model:oq(),thinkingLevel:e.thinkingLevel,mode:e.mode,permissionLevel:e.permissionLevel,approvalPolicy:e.approvalPolicy})).result;HK(n),UK(o),wp({kind:`pending-conversation`,id:e.id},{kind:`conversation`,id:n.id}),Z.activeConversationTabId=n.id,Of.projectId=n.projectId,Of.conversationId=n.id,Of.entryId=n.activeEntryId,Of.agentId=o.id,kf.projectDir=e.projectDir;let s=r?``:e.composerText;delete Z.pendingConversations[Qr(e.id)],i=sU(n.id),i.composerText=s,Q.error=void 0,r&&(kf.text=``),cU(),await PG.invalidateQueries({queryKey:FG.workspace}),await CJ(),await Cq({hydrate:()=>BK(n.id),view:()=>sU(n.id),optimisticMessages:Fr(t)?[]:[xq(t)],start:async()=>{await Ar(`run.start`,{agentId:o.id,text:t},{idempotencyKey:crypto.randomUUID()})}})}catch(t){let n=t instanceof Error?t.message:String(t);i?(i.error=n,i.sending=!1):(a&&await HV(a).catch(()=>void 0),e.error=n,e.sending=!1),Q.error=n,Iq(`Prompt failed`,n)}}async function Rq(e,t={}){let n=t.clearComposer??!0,r=fU(),i=Of.conversationId?sU(Of.conversationId):void 0,a=e.trim();if(!a||r?.sending)return;if(r){await Lq(r,a,{clearComposer:n});return}if(!Of.projectId||!Of.conversationId||!i){Q.projectPickerOpen=!0;let e=`Select a project directory before starting a conversation.`;Q.error=e,Iq(`Select a project directory`,e);return}if(!Fq()){vW();let e=`Configure a model provider or adjust Scoped Models in Settings before prompting.`;i.error=e,Q.error=e,Iq(`No usable model configured`,e);return}if(i.transient?.compaction?.state===`running`){Iq(`Compaction in progress`,`Wait for context compaction to finish before sending another prompt.`);return}let o=!!i.sending;i.error=void 0,Q.error=void 0,o||(i.sending=!0);try{let e=await Pq();if(n&&(i.composerText=``,kf.text=``),o){await Ar(`run.steer`,{agentId:e,text:a},{idempotencyKey:crypto.randomUUID()});return}Fr(a)||(i.optimisticMessages=[...i.optimisticMessages,xq(a)]),await Ar(`run.start`,{agentId:e,text:a},{idempotencyKey:crypto.randomUUID()})}catch(e){let t=e instanceof Error?e.message:String(e);i.error=t,Q.error=t,o||(i.sending=!1),Iq(`Prompt failed`,t)}}async function zq(){let e=fU(),t=Of.conversationId?sU(Of.conversationId):void 0,n=(e?.composerText??t?.composerText??kf.text).trim();!n||e?.sending||await vq(n,{clearComposer:Nq,setMode:pq,compact:Eq,abort:jq})||await Rq(n,{clearComposer:!0})}var Bq=h(`<button type="button" class="rounded-sm text-destructive underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50">Could not load earlier output. Retry</button>`),Vq=h(`<div class="pb-2 text-center text-muted-foreground"><!></div>`),Hq=h(`<pre> </pre>`),Uq=h(`<pre>No logs captured.</pre>`),Wq=h(`<pre><!></pre>`),Gq=h(`<div class="relative h-full min-h-0 bg-sidebar font-mono text-xs" role="log" aria-label="Task output"><!> <!></div>`);function Kq(e,t){a(t,!0);let n=Y(void 0),i=Y(!0),o=Y(!1),c=Y(void 0),l=J(()=>t.taskLogs?.events??[]),u=J(()=>{let e=[{kind:`history`,key:`history`}];t.command&&e.push({kind:`command`,key:`command`,command:t.command}),W(l).length===0&&e.push({kind:`empty`,key:`empty`});for(let t of W(l))e.push({kind:`event`,key:`event:${t.seq}`,event:t});return e}),f=`whitespace-pre-wrap break-words`;function p(e){return e.stream===`stderr`||e.level===`error`?`text-destructive`:e.level===`warn`?`text-warning`:`text-foreground`}async function m(){if(!(W(o)||!t.taskLogs?.hasMoreBefore||!t.onLoadEarlier)){K(o,!0),K(c,void 0);try{await t.onLoadEarlier()}catch(e){K(c,e instanceof Error?e.message:String(e),!0)}finally{K(o,!1)}}}function h(e){return e.scrollTop<=48}be(()=>{let e=W(n)?.getViewportElement(),r=!!(t.taskLogs?.hasMoreBefore&&t.onLoadEarlier&&!W(c));if(!e||!r)return;let i=()=>{h(e)&&m()};e.addEventListener(`scroll`,i,{passive:!0});let a=requestAnimationFrame(i);return()=>{cancelAnimationFrame(a),e.removeEventListener(`scroll`,i)}});var _=Gq(),v=V(_);{let e=(e,n)=>{let i=()=>n?.().item;var a=U(),l=R(a),u=e=>{var n=Vq(),i=V(n),a=e=>{g(e,M(`Loading earlier output…`))},s=e=>{var t=Bq();r(`click`,t,()=>void m()),g(e,t)},l=e=>{g(e,M(`Scroll up to load earlier output`))},u=e=>{g(e,M(`Earlier output is no longer retained.`))},f=e=>{g(e,M(`Beginning of output`))};k(i,e=>{W(o)?e(a):W(c)?e(s,1):t.taskLogs?.hasMoreBefore?e(l,2):t.taskLogs?.truncated?e(u,3):e(f,-1)}),d(n),g(e,n)},h=e=>{var t=Hq();s(t,1,`pb-2 text-foreground ${f}`);var n=V(t);d(t),F(()=>A(n,`$ ${i().command??``}`)),g(e,t)},_=e=>{var t=Uq();s(t,1,`text-muted-foreground ${f}`),g(e,t)},v=e=>{var t=Wq();oR(V(t),{get text(){return i().event.line},get stream(){return i().event.stream},get level(){return i().event.level}}),d(t),F(e=>s(t,1,e),[()=>`${f} ${p(i().event)}`]),g(e,t)};k(l,e=>{i().kind===`history`?e(u):i().kind===`command`?e(h,1):i().kind===`empty`?e(_,2):e(v,-1)}),g(e,a)},a=J(()=>`task-log:${t.taskId}`);Ii(v,{get items(){return W(u)},getKey:e=>e.key,getMeasurementVersion:e=>e.kind===`event`?`${e.event.level}:${e.event.line}`:e.kind,get heightCacheKey(){return W(a)},estimateSize:()=>20,overscan:16,anchor:`end`,get followOutput(){return W(i)},scrollEndThreshold:24,paddingStart:12,paddingEnd:12,viewportTabIndex:0,viewportAriaLabel:`Scrollable task output`,viewportClass:`h-full px-3`,get controller(){return W(n)},set controller(e){K(n,e,!0)},get atEnd(){return W(i)},set atEnd(e){K(i,e,!0)},row:e,$$slots:{row:!0}})}var y=L(v,2),b=e=>{G(e,{size:`icon-sm`,variant:`outline`,class:`absolute right-4 bottom-3 rounded-full shadow-sm`,ariaLabel:`Jump to latest output`,title:`Jump to latest output`,onclick:()=>W(n)?.scrollToEnd({behavior:`smooth`}),children:(e,t)=>{Dv(e,{class:`size-4`,strokeWidth:2.2})},$$slots:{default:!0}})};k(y,e=>{W(i)||e(b)}),d(_),g(e,_),z()}T([`click`]);var qq=h(`<span class="ml-2 font-mono"> </span>`),Jq=h(`<div class="border-b border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning"> <!></div>`),Yq=h(`<!> <div class="min-h-0 flex-1"><!></div>`,1),Xq=h(`<div class="grid min-h-full place-content-center gap-1 text-center text-muted-foreground"><!> <p class="mt-1 text-foreground">Task not found.</p> <span class="text-xs">The task may have been removed or is no longer available.</span></div>`),Zq=h(`<section class="flex h-full min-h-0 flex-col bg-background"><!></section>`);function Qq(e,t){a(t,!0);var n=Zq(),r=V(n),i=e=>{var n=Yq(),r=R(n),i=e=>{var n=Jq(),r=V(n),i=L(r),a=e=>{var n=qq(),r=V(n);d(n),F(()=>A(r,`PID ${t.task.runtime.childPid??``}`)),g(e,n)};k(i,e=>{t.task.runtime?.childPid&&e(a)}),d(n),F(()=>A(r,`${(t.task.status===`recovered`?`Process recovered after host restart. Captured output is frozen; stop or restart to resume supervised logs.`:t.task.error??`Process identity could not be verified safely. Destructive PID actions are restricted.`)??``} `)),g(e,n)};k(r,e=>{(t.task.status===`recovered`||t.task.status===`recovery_unknown`||t.task.status===`orphaned`)&&e(i)});var a=L(r,2);o(V(a),()=>t.task.id,e=>{Kq(e,{get taskId(){return t.task.id},get taskLogs(){return t.taskLogs},get command(){return t.task.command},get onLoadEarlier(){return t.onLoadEarlier}})}),d(a),g(e,n)},s=e=>{var t=Xq();qu(V(t),{class:`mx-auto size-7 text-primary`,strokeWidth:1.7}),w(4),d(t),g(e,t)};k(r,e=>{t.task?e(i):e(s,-1)}),d(n),g(e,n),z()}var $q=5e3;function eJ(e,t){return{...e,task:t.task,events:nJ(t.events,e.events),hasMoreBefore:t.hasMoreBefore,truncated:!!(e.truncated||t.truncated),previewPath:e.previewPath??t.previewPath}}function tJ(e,t){let n=nJ(e.events,t.events),r=Math.max(0,n.length-$q);return{...e,task:t.task,events:r>0?n.slice(r):n,nextCursor:t.nextCursor,hasMoreAfter:t.hasMoreAfter,hasMoreBefore:r>0?!0:e.hasMoreBefore,truncated:!!(e.truncated||t.truncated),previewPath:t.previewPath??e.previewPath}}function nJ(e,t){let n=new Map;for(let t of e)n.set(t.seq,t);for(let e of t)n.set(e.seq,e);return[...n.values()].sort((e,t)=>e.seq-t.seq)}var rJ=500,iJ=0,aJ=new se,oJ,sJ=!1;async function cJ(e){let t=++iJ,n=await Hi(e,{mode:`recent`,limit:rJ});t!==iJ||sr.selectedTaskId!==e||(sr.taskLogs=n)}function lJ(e){let t=aJ.get(e);if(t)return t;let n=sr.taskLogs,r=n?.events[0]?.seq;if(sr.selectedTaskId!==e||n?.task.id!==e||!n.hasMoreBefore||r===void 0||n.events.length>=5e3)return Promise.resolve();let i=Hi(e,{mode:`recent`,beforeSeq:r,limit:rJ}).then(t=>{let n=sr.taskLogs;sr.selectedTaskId!==e||n?.task.id!==e||(sr.taskLogs=eJ(n,t))}).finally(()=>aJ.delete(e));return aJ.set(e,i),i}function uJ(e=sr.selectedTaskId){return e?(sJ=!0,oJ||(oJ=(async()=>{do{sJ=!1;let t=sr.taskLogs;if(sr.selectedTaskId!==e||t?.task.id!==e)return;let n=await Hi(e,{mode:`since_cursor`,sinceSeq:t.nextCursor,limit:rJ});for(;;){if(t=sr.taskLogs,sr.selectedTaskId!==e||t?.task.id!==e)return;if(sr.taskLogs=tJ(t,n),!n.hasMoreAfter)break;n=await Hi(e,{mode:`since_cursor`,sinceSeq:n.nextCursor,limit:rJ})}}while(sJ)})().finally(()=>{oJ=void 0}),oJ)):Promise.resolve()}function dJ(e,t){return t&&e.some(e=>e.id===t)?t:e[0]?.id}function fJ(e,t){if(t.visibility===`foreground`)return e.filter(e=>e.id!==t.id);let n=e.findIndex(e=>e.id===t.id);return n<0?[t,...e]:e.map((e,r)=>r===n?t:e)}function pJ(e,t){return e.find(e=>e.dir===t)}function mJ(e){return Q.openCenterTabs.findIndex(t=>mp(t,e))}function hJ(e,t){return!!(e&&t.some(t=>mp(t,e)))}function gJ(e){return new Set(e.map(pp))}function _J(){Af(),Q.error=void 0,kf.text=``}function vJ(e){let t=mJ(e);return t<=0?[]:Q.openCenterTabs.slice(0,t)}function yJ(e){let t=mJ(e);return t===-1?[]:Q.openCenterTabs.slice(t+1)}function bJ(e){return Q.openCenterTabs.filter(t=>!mp(t,e))}async function xJ(e,t){let n=gJ(e);if(!n.size)return;let r=[...Q.openCenterTabs];if(!r.map((e,t)=>n.has(pp(e))?t:-1).filter(e=>e!==-1).length)return;let i=r.filter(e=>!n.has(pp(e))),a=!!(Q.activeCenterTab&&n.has(pp(Q.activeCenterTab))),o=!!(Of.conversationId&&n.has(pp({kind:`conversation`,id:Of.conversationId}))),s=!!(Q.activeCenterTab?.kind===`pending-conversation`&&n.has(pp(Q.activeCenterTab))),c=hJ(t,i)?t:ip(e),l=[];for(let e of r)n.has(pp(e))&&(e.kind===`conversation`&&l.push({kind:`conversation`,id:e.id}),e.kind===`pending-conversation`&&l.push({kind:`pending-conversation`,id:e.id}));await zU.cancelIfTargets(l);for(let t of e)Yf(t)&&rp(t);Sp(i);for(let e of r)n.has(pp(e))&&(e.kind===`file`&&delete $r.fileViews[Jr(e.id)],e.kind===`diff`&&delete tr.diffViews[Zr(e.id)],e.kind===`conversation`&&delete Z.conversationViews[Yr(e.id)],e.kind===`pending-conversation`&&delete Z.pendingConversations[Qr(e.id)]);sr.selectedTaskId&&n.has(pp({kind:`task`,id:sr.selectedTaskId}))&&(sr.selectedTaskId=void 0,sr.taskLogs=void 0);let u=i.filter(e=>e.kind===`conversation`).map(e=>e.id);Z.activeConversationTabId&&n.has(pp({kind:`conversation`,id:Z.activeConversationTabId}))&&(Z.activeConversationTabId=c?.kind===`conversation`?c.id:u[0]),(o||s)&&c?.kind!==`conversation`&&c?.kind!==`pending-conversation`&&_J(),a&&(Op(void 0),c&&await Ap(c))}var SJ=e({completeFiles:()=>AJ,createConversationForDirectory:()=>BJ,deleteConversationAndRefresh:()=>IJ,deleteProjectAndRefresh:()=>FJ,exportUrl:()=>OJ,loadSlashCommands:()=>DJ,loadWorkspaceState:()=>CJ,newConversation:()=>NJ,newConversationInProject:()=>PJ,openProjectDirectory:()=>MJ,openProjectInEditorAndNotify:()=>LJ,pruneProjectConversationsAndRefresh:()=>RJ,recoverWorkspaceSnapshotFromNetwork:()=>wJ,selectProject:()=>jJ,systemPromptUrl:()=>kJ});async function CJ(){return TJ(await PG.fetchQuery({queryKey:FG.workspace,queryFn:iU}))}async function wJ(e={}){let t;return{cursor:await IG({fetch:iU,apply:async n=>{let r=await TJ(n,e);return t=r.desiredTab,r.cursor},cache:e=>PG.setQueryData(FG.workspace,e)}),desiredTab:t}}async function TJ(e,t={}){let n=RG(e.snapshot.agents,Q.agents);Q.projects=e.snapshot.projects,Q.conversations=e.snapshot.conversations,Q.agents=n,sr.tasks=e.snapshot.tasks;let r=dp({projects:e.snapshot.projects,conversations:e.snapshot.conversations,tasks:e.snapshot.tasks},{deferActivation:t.deferTabActivation}),i=new ye(sr.tasks.map(e=>e.definitionId??e.restartRootTaskId??e.id)),a=sr.openTaskTabIds.filter(e=>!i.has(e));a.length&&await xJ(a.map(e=>({kind:`task`,id:e})));let o=dJ(sr.tasks,sr.selectedTaskId);o!==sr.selectedTaskId&&(sr.selectedTaskId=o,sr.taskLogs=void 0),Q.approvals=e.snapshot.approvals,Q.userQuestions=e.snapshot.userQuestions,Q.planReviews=e.snapshot.planReviews,EJ(n,e.snapshot.conversations);let s=new ye(e.snapshot.conversations.map(e=>e.id)),c=Z.openConversationTabIds.filter(e=>!s.has(e));if(c.length&&await JK(c),o&&!t.deferTabActivation&&await cJ(o),!Q.projects.some(e=>cr(e)===Q.selectedProjectKey)){let e=[...Q.projects].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0];e&&(r=await jJ(e.id,{deferTabActivation:t.deferTabActivation})??r)}else if(Q.selectedProjectKey&&!Q.selectedProjectId){let e=Q.projects.find(e=>cr(e)===Q.selectedProjectKey);e&&(r=await jJ(e.id,{deferTabActivation:t.deferTabActivation})??r)}return{cursor:e.cursor,desiredTab:r}}function EJ(e,t){let n=Of.agentId?e.find(e=>e.id===Of.agentId):void 0;if(n){let e=yK(n.id),t=e?.model??void 0;t?Z.selectedModelKey=Xn(t):n.model&&(Z.selectedModelKey=Xn(n.model)),Z.selectedThinkingLevel=e?.thinkingLevel??n.thinkingLevel,Z.selectedMode=e?.mode??n.mode,Z.selectedPermissionLevel=e?.permissionLevel??n.permissionLevel,Z.selectedApprovalPolicy=e?.approvalPolicy??n.approvalPolicy;return}let r=Of.conversationId?t.find(e=>e.id===Of.conversationId):void 0;r&&(Z.selectedMode=r.mode,Z.selectedPermissionLevel=r.permissionLevel,Z.selectedApprovalPolicy=r.approvalPolicy)}async function DJ(){Z.slashCompletions=await PG.fetchQuery({queryKey:FG.slashCompletions,queryFn:IV})}function OJ(e){if(!Of.conversationId)return;let t=e===`json`?`export`:`export.${e}`;return`/api/conversations/${Bi(Of.conversationId)}/${t}`}function kJ(){if(Of.agentId)return`/api/agents/${Bi(Of.agentId)}/system-prompt`}async function AJ(e){return PG.fetchQuery({queryKey:FG.fileCompletions(Of.projectId,e),queryFn:()=>LV(Of.projectId,e),staleTime:2e3})}async function jJ(e,t={}){let n=Q.projects.find(t=>t.id===e);if(!n)return;let r=cr(n);if(Q.selectedProjectKey===r&&Q.selectedProjectId){Q.selectedProjectId=n.id,Of.projectId=n.id,Q.projectRecency[r]=Date.now(),fp();return}Q.selectedProjectId&&Qf(),Q.selectedProjectId=n.id,Q.selectedProjectKey=r,Q.projectRecency[r]=Date.now();let i=ep(r,{deferActivation:t.deferTabActivation});return Of.projectId=n.id,Of.conversationId=void 0,Of.agentId=void 0,Of.entryId=void 0,fp(),t.deferTabActivation||(i.active?await Ap(i.active):Op(void 0)),i.active}async function MJ(e){try{let t=await wH(e);await PG.invalidateQueries({queryKey:FG.workspace}),await CJ();let n=Q.projects.find(e=>cr(e)===cr(t))??t;Q.projects.some(e=>e.id===n.id)||(Q.projects=[...Q.projects,n]),await jJ(n.id)}catch(e){let t=e instanceof Error?e.message:String(e);Q.error=t,Kn.error(`Could not open project`,{description:t})}}function NJ(){let e=Q.projects.find(e=>e.id===Q.selectedProjectId);if(!e){Q.projectPickerOpen=!0;return}zJ(e)}function PJ(e){let t=pJ(Q.projects,e);if(t){zJ(t);return}BJ(e)}async function FJ(e){try{let t=Q.projects.find(t=>t.id===e),n=t?cr(t):void 0,r=new ye(Q.projects.filter(e=>n&&cr(e)===n).map(e=>e.id)),i=Q.conversations.filter(e=>r.has(e.projectId)).map(e=>e.id);await EH(e),n&&delete Q.projectTabSessions[n],await JK(i),await PG.invalidateQueries({queryKey:FG.workspace}),await CJ(),Kn.success(`Project removed`)}catch(e){let t=e instanceof Error?e.message:String(e);Q.error=t,Kn.error(`Could not remove project`,{description:t})}}async function IJ(e){try{await HV(e),op(t=>t.kind===`conversation`&&t.id===e),await JK([e]),await PG.invalidateQueries({queryKey:FG.workspace}),await CJ(),Kn.success(`Conversation removed`)}catch(e){let t=e instanceof Error?e.message:String(e);Q.error=t,Kn.error(`Could not remove conversation`,{description:t})}}async function LJ(e,t){try{await OH(e,t),Kn.success(t===`vscode`?`Opening project in VS Code`:`Opening project in Zed`)}catch(e){let n=e instanceof Error?e.message:String(e);Q.error=n,Kn.error(t===`vscode`?`Could not open VS Code`:`Could not open Zed`,{description:n})}}async function RJ(e,t){try{let n=await DH(e,t);await JK(n.prunedConversationIds),await PG.invalidateQueries({queryKey:FG.workspace}),await CJ();let r=n.prunedConversationIds.length,i=n.skipped.length;Kn.success(r===1?`Cleaned up 1 conversation`:`Cleaned up ${r} conversations`,i>0?{description:i===1?`Skipped 1 active conversation`:`Skipped ${i} active conversations`}:{})}catch(e){let t=e instanceof Error?e.message:String(e);Q.error=t,Kn.error(`Could not clean up conversations`,{description:t})}}async function zJ(e){Q.error=void 0,Q.projectPickerOpen=!1,await jJ(e.id,{deferTabActivation:!0}),rq(e)}async function BJ(e){Q.error=void 0;try{let t=await wH(e);Q.projects=[t,...Q.projects.filter(e=>e.id!==t.id)],await zJ(t)}catch(e){let t=e instanceof Error?e.message:String(e);Q.error=t,Kn.error(`Could not open project`,{description:t})}}function VJ(){return{fetchToolCall:e=>GH(e),watchSubagentTranscript:jG,atlassian:{jiraSiteUrl:MG,confluenceSiteUrl:NG},voice:{session:zU,targetKey:FU,appendTranscriptText:LU,chatGptConfigured:()=>hG.configured,micShortcutLabel:Vd(`composer.toggleMic`),micShortcutAria:Hd(`composer.toggleMic`),TranscriptionActivity:oU,AudioAuthDialog:pG},askReply:{pasteImage:UV,dropFiles:async e=>{let t=Fn(),n=Q.projects.find(e=>e.id===Of.projectId);if(!t?.files||!n)throw Error(`Native file paths are unavailable in this window.`);return CG(e,n.dir,t.files.getPathForFile)},slashCompletions:()=>Z.slashCompletions,fileCompletions:AJ}}}h(`<span class="ctx-stat svelte-ads8qc"> </span>`),h(`<span class="ctx-context svelte-ads8qc"> </span>`),h(`<span class="context-chip svelte-ads8qc"><!> <!></span>`);var HJ=new Set([`$$slots`,`$$events`,`$$legacy`]);function UJ(e,t){let n=H(t,HJ),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];P(e,B({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var WJ=new Set([`$$slots`,`$$events`,`$$legacy`]);function GJ(e,t){let n=H(t,WJ),r=[[`path`,{d:`M12 13v8l-4-4`}],[`path`,{d:`m12 21 4-4`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`}]];P(e,B({name:`cloud-download`},()=>n,{get iconNode(){return r}}))}var KJ=new Set([`$$slots`,`$$events`,`$$legacy`]);function qJ(e,t){let n=H(t,KJ),r=[[`circle`,{cx:`5`,cy:`6`,r:`3`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`}],[`path`,{d:`m15 9-3-3 3-3`}],[`circle`,{cx:`19`,cy:`18`,r:`3`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`}],[`path`,{d:`m9 15 3 3-3 3`}]];P(e,B({name:`git-compare-arrows`},()=>n,{get iconNode(){return r}}))}var JJ=new Set([`$$slots`,`$$events`,`$$legacy`]);function YJ(e,t){let n=H(t,JJ),r=[[`path`,{d:`M12 17V3`}],[`path`,{d:`m6 11 6 6 6-6`}],[`path`,{d:`M19 21H5`}]];P(e,B({name:`arrow-down-to-line`},()=>n,{get iconNode(){return r}}))}var XJ=new Set([`$$slots`,`$$events`,`$$legacy`]);function ZJ(e,t){let n=H(t,XJ),r=[[`path`,{d:`m18 9-6-6-6 6`}],[`path`,{d:`M12 3v14`}],[`path`,{d:`M5 21h14`}]];P(e,B({name:`arrow-up-from-line`},()=>n,{get iconNode(){return r}}))}var QJ=[{minCount:9,maxLength:12},{minCount:5,maxLength:16},{minCount:0,maxLength:22}];function $J(e){return e.relativePath===`.`?`project root`:e.relativePath}function eY(e,t){if(e.length<=t)return e;let n=Math.max(4,t-1),r=Math.ceil(n/2),i=Math.floor(n/2);return`${e.slice(0,r)}…${e.slice(-i)}`}function tY(e,t){return eY(t.some(t=>t.relativePath!==e.relativePath&&t.name===e.name)?$J(e):e.name,QJ.find(e=>t.length>=e.minCount)?.maxLength??22)}function nY(e){return e.untracked?`text-muted-foreground`:e.index===`A`?`text-success`:e.index===`D`||e.worktree===`D`?`text-destructive`:`text-info`}function rY(e,t){if(e.untracked)return`?`;let n=t===`staged`?e.index:e.worktree;return n===` `?e.index===` `?`M`:e.index:n}function iY(e,t){let n=t===`staged`?e.index:e.worktree;if(e.untracked)return`untracked`;switch(n){case`A`:return`added`;case`D`:return`deleted`;case`R`:return`renamed`;case`M`:return`modified`;case`U`:return`conflict`;default:return t}}function aY(e){switch(e.status){case`passing`:return`good`;case`failing`:return`danger`;case`pending`:return`warn`;default:return`neutral`}}var oY=h(`<span> </span>`),sY=h(`<!> <!>`,1),cY=h(`<p class="py-1 text-xs text-muted-foreground">Loading…</p>`),lY=h(`<p class="py-1 text-xs text-muted-foreground">Working tree clean.</p>`),uY=h(`<div class="flex min-h-0 flex-1 flex-col"><!></div>`);function dY(e,t){a(t,!0);let n=(e,n=D,r=D,i=D,a=D,o=D)=>{var c=sY(),l=R(c);{let e=e=>{var t=U(),n=R(t),r=e=>{ln(e,{class:`-mr-1 size-3`,"aria-hidden":`true`})},i=e=>{ut(e,{class:`-mr-1 size-3`,"aria-hidden":`true`})};k(n,e=>{a()?e(r):e(i,-1)}),g(e,t)},s=e=>{var t=oY(),n=V(t,!0);d(t),F(()=>A(n,r().length)),g(e,t)},c=e=>{{let n=J(()=>i()===`staged`?YJ:ZJ),a=J(()=>i()===`staged`?`Unstage all`:`Stage all`),o=J(()=>t.bulkMutation===(i()===`staged`?`unstage-all`:`stage-all`)),s=J(()=>r().length===0||!t.capabilities.bulkMutateFiles.enabled||!!t.bulkMutation||!!t.fileMutation);Dn(e,{get icon(){return W(n)},get label(){return W(a)},dense:!0,get loading(){return W(o)},get disabled(){return W(s)},onclick:e=>{e.stopPropagation(),t.onBulkStage(t.selectedRepo,i()===`staged`?`unstage-all`:`stage-all`)}})}},u=J(()=>`${a()?`Collapse`:`Expand`} ${n().toLowerCase()} changes`);vn(l,{get label(){return n()},get title(){return W(u)},dense:!0,flush:!0,hoverable:!1,alwaysShowActions:!0,get ariaExpanded(){return a()},role:`none`,class:`font-medium`,get onclick(){return o()},leading:e,badges:s,actions:c,$$slots:{leading:!0,badges:!0,actions:!0}})}var u=L(l,2),f=e=>{{let a=(e,t=D)=>{var n=oY(),r=V(n,!0);d(n),F((e,t,i)=>{s(n,1,e),q(n,`title`,t),A(r,i)},[()=>x(me(`font-mono font-semibold`,nY(t()))),()=>iY(t(),i()),()=>rY(t(),i())]),g(e,n)},o=(e,n=D)=>{let r=J(()=>t.fileMutation?.path===n().path);var a=sY(),o=R(a);{let e=J(()=>i()===`staged`?YJ:ZJ),a=J(()=>i()===`staged`?`Unstage ${n().path}`:`Stage ${n().path}`),s=J(()=>i()===`staged`?`Unstage`:`Stage`),c=J(()=>W(r)&&t.fileMutation?.action===(i()===`staged`?`unstage`:`stage`)),l=J(()=>!t.capabilities.mutateFiles.enabled||W(r));Dn(o,{get icon(){return W(e)},get label(){return W(a)},get title(){return W(s)},dense:!0,get loading(){return W(c)},get disabled(){return W(l)},onclick:e=>{e.stopPropagation(),t.onMutateFile(t.selectedRepo,n(),i()===`staged`?`unstage`:`stage`)}})}var s=L(o,2);{let e=J(()=>`Discard ${n().path}`),i=J(()=>W(r)&&t.fileMutation?.action===`discard`),a=J(()=>!t.capabilities.mutateFiles.enabled||W(r));Dn(s,{get icon(){return yl},get label(){return W(e)},title:`Discard`,dense:!0,get loading(){return W(i)},get disabled(){return W(a)},onclick:e=>{e.stopPropagation(),t.onRequestDiscard(n())}})}g(e,a)},c=J(()=>_n(r(),{getPath:e=>e.path.split(`/`),getKey:e=>`${i()}:${e.path}`})),l=J(()=>`${n()} file tree`);yn(e,{get nodes(){return W(c)},get ariaLabel(){return W(l)},baseIndent:0,getItemTitle:e=>`${iY(e,i())} · ${e.renamedFrom?`${e.renamedFrom} → `:``}${e.path}`,onItemActivate:e=>t.onOpenDiff(t.selectedRepo,e,i()),itemLeading:a,itemActions:o,$$slots:{itemLeading:!0,itemActions:!0}})}};k(u,e=>{a()&&e(f)}),g(e,c)},r=Y(!0),i=Y(!0);var o=uY(),c=V(o),l=e=>{g(e,cY())},u=e=>{g(e,lY())},f=e=>{kn(e,{class:`min-h-0 flex-1`,viewportClass:`min-w-0`,children:(e,a)=>{hn(e,{role:`none`,class:`py-0.5`,children:(e,a)=>{var o=sY(),s=R(o),c=e=>{n(e,()=>`Staged`,()=>t.stagedFiles,()=>`staged`,()=>W(r),()=>()=>K(r,!W(r)))};k(s,e=>{t.stagedFiles.length>0&&e(c)});var l=L(s,2),u=e=>{n(e,()=>`Unstaged`,()=>t.unstagedFiles,()=>`unstaged`,()=>W(i),()=>()=>K(i,!W(i)))};k(l,e=>{t.unstagedFiles.length>0&&e(u)}),g(e,o)},$$slots:{default:!0}})},$$slots:{default:!0}})};k(c,e=>{t.changes?t.changes.files.length===0?e(u,1):e(f,-1):e(l)}),d(o),g(e,o),z()}var fY=new Set([`$$slots`,`$$events`,`$$legacy`]);function pY(e,t){let n=H(t,fY),r=[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}],[`path`,{d:`M12 9v4`}],[`path`,{d:`M12 17h.01`}]];P(e,B({name:`triangle-alert`},()=>n,{get iconNode(){return r}}))}function mY(e,t){a(t,!0);var n=U(),r=R(n),i=e=>{dn(e,{tone:`muted`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.model.availability.message)),g(e,r)},$$slots:{default:!0}})},o=e=>{dn(e,{tone:`destructive`,get icon(){return pY},children:(e,n)=>{w();var r=M();F(()=>A(r,t.model.cachedError)),g(e,r)},$$slots:{default:!0}})},s=e=>{dn(e,{tone:`warning`,get icon(){return pY},children:(e,n)=>{w();var r=M();F(()=>A(r,`Using cached Git data. Refresh failed: ${t.model.cachedError??``}`)),g(e,r)},$$slots:{default:!0}})},c=e=>{dn(e,{tone:`muted`,children:(e,t)=>{w(),g(e,M(`Loading Git repositories…`))},$$slots:{default:!0}})},l=e=>{dn(e,{tone:`muted`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.model.emptyMessage??`No Git repositories found.`)),g(e,r)},$$slots:{default:!0}})};k(r,e=>{t.model.availability.available?t.model.cachedError&&t.model.repositories.length===0?e(o,1):t.model.cachedError?e(s,2):t.model.initialLoading?e(c,3):t.model.repositories.length===0&&e(l,4):e(i)}),g(e,n),z()}var hY=new Set([`$$slots`,`$$events`,`$$legacy`]);function gY(e,t){let n=H(t,hY),r=[[`path`,{d:`M6 3v12`}],[`path`,{d:`M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`}],[`path`,{d:`M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`}],[`path`,{d:`M15 6a9 9 0 0 0-9 9`}],[`path`,{d:`M18 15v6`}],[`path`,{d:`M21 18h-6`}]];P(e,B({name:`git-branch-plus`},()=>n,{get iconNode(){return r}}))}var _Y=h(`<!> New branch`,1),vY=h(`<!> <!>`,1),yY=h(`<!> Create`,1),bY=h(`<span class="text-xs text-muted-foreground">You're here</span>`),xY=h(`<!> Switch to base`,1),SY=h(`<div class="flex items-center gap-2 rounded-md border border-info/40 bg-info/10 px-3 py-2"><!> <div class="flex min-w-0 flex-1 flex-col"><span class="text-xs font-medium text-foreground">Base branch</span> <span class="truncate font-mono text-xs text-muted-foreground"> </span></div> <!></div>`),CY=h(`<div class="flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground"><!> Loading branches…</div>`),wY=h(`<div class="px-3 py-2 text-xs text-muted-foreground">No branches found.</div>`),TY=h(`<button type="button" class="flex w-full items-center gap-2 border-b px-2.5 py-1.5 text-left text-xs last:border-b-0 hover:bg-muted/60 disabled:opacity-60"><!> <span class="min-w-0 flex-1 truncate font-mono text-foreground"> </span> <!> <!></button>`),EY=h(`<div class="grid gap-4"><!> <!> <div class="max-h-72 overflow-y-auto rounded-md border"><!></div></div>`),DY=h(`<p class="text-xs text-destructive">Enter a valid branch name (no spaces or special characters).</p>`),OY=h(`<p class="text-xs text-muted-foreground">The new branch is created from the current branch.</p>`),kY=h(`<form class="grid gap-1.5"><!> <!></form>`);function AY(e,t){a(t,!0);let n=I(t,`open`,15,!1),i=I(t,`branchFilter`,15,``),o=I(t,`newBranchName`,15,``),s=Y(`switch`),c=J(()=>t.repoSummary.currentBranch??`detached`),l=J(()=>t.repoSummary.baseBranch),u=J(()=>!t.repoSummary.detached&&!!W(l)),f=J(()=>o().trim()),p=J(()=>W(f).length>0&&!/\s/.test(W(f))&&!W(f).startsWith(`-`)&&!W(f).startsWith(`/`)&&!W(f).endsWith(`/`)&&!W(f).includes(`..`)&&!/[\u0000-\u001f~^:?*[\\]/.test(W(f))),m=J(()=>W(f).length>0&&!W(p)),h=J(()=>W(s)===`switch`?`Switch branch`:`Create branch`),v=J(()=>W(s)===`switch`?`Current branch: ${W(c)}`:`Create from: ${W(c)}`);sP(e,{get title(){return W(h)},get description(){return W(v)},size:`sm`,onOpenChange:e=>{e||K(s,`switch`)},get open(){return n()},set open(e){n(e)},footer:e=>{var r=U(),i=R(r),a=e=>{var r=vY(),i=R(r);G(i,{size:`sm`,variant:`ghost`,onclick:()=>n(!1),children:(e,t)=>{w(),g(e,M(`Close`))},$$slots:{default:!0}});var a=L(i,2);{let e=J(()=>!t.branchesEnabled);G(a,{size:`sm`,get disabled(){return W(e)},onclick:()=>K(s,`create`),children:(e,t)=>{var n=_Y();gY(R(n),{}),w(),g(e,n)},$$slots:{default:!0}})}g(e,r)},o=e=>{var n=vY(),r=R(n);G(r,{size:`sm`,variant:`ghost`,onclick:()=>K(s,`switch`),children:(e,t)=>{w(),g(e,M(`Back`))},$$slots:{default:!0}});var i=L(r,2);{let e=J(()=>!t.branchesEnabled||t.creatingBranch||!W(p));G(i,{size:`sm`,get disabled(){return W(e)},onclick:()=>t.onCreateBranch(t.selectedRepo),children:(e,n)=>{var r=yY(),i=R(r),a=e=>{Fi(e,{})},o=e=>{oI(e,{})};k(i,e=>{t.creatingBranch?e(a):e(o,-1)}),w(),g(e,r)},$$slots:{default:!0}})}g(e,n)};k(i,e=>{W(s)===`switch`?e(a):e(o,-1)}),g(e,r)},children:(e,n)=>{var a=U(),c=R(a),f=e=>{var n=EY(),a=V(n),o=e=>{var n=SY(),r=V(n);oI(r,{size:14,class:`shrink-0 text-info`});var i=L(r,2),a=L(V(i),2),o=V(a,!0);d(a),d(i);var s=L(i,2),c=e=>{g(e,bY())},u=e=>{{let n=J(()=>!t.branchesEnabled||t.switchingBranch===t.baseBranchSummary.name);G(e,{size:`xs`,get disabled(){return W(n)},onclick:()=>t.onSwitchBranch(t.selectedRepo,t.baseBranchSummary),children:(e,n)=>{var r=xY(),i=R(r),a=e=>{Fi(e,{class:`size-3`})},o=e=>{oI(e,{})};k(i,e=>{t.switchingBranch===t.baseBranchSummary.name?e(a):e(o,-1)}),w(),g(e,r)},$$slots:{default:!0}})}};k(s,e=>{t.repoSummary.onBaseBranch?e(c):t.baseBranchSummary&&e(u,1)}),d(n),F(()=>A(o,W(l))),g(e,n)};k(a,e=>{W(u)&&e(o)});var s=L(a,2);t_(s,{placeholder:`Filter branches`,ariaLabel:`Filter branches`,get value(){return i()},set value(e){i(e)}});var c=L(s,2),f=V(c),p=e=>{var t=CY();Fi(V(t),{class:`size-3.5`}),w(),d(t),g(e,t)},m=e=>{g(e,wY())},h=e=>{var n=U();_(R(n),17,()=>t.filteredBranches,e=>e.name,(e,n)=>{var i=TY(),a=V(i),o=e=>{Fi(e,{class:`text-muted-foreground size-3.5`})},s=e=>{$I(e,{size:13,class:`text-success`})},c=e=>{oI(e,{size:13,class:`text-muted-foreground`})};k(a,e=>{t.switchingBranch===W(n).name?e(o):W(n).current?e(s,1):e(c,-1)});var u=L(a,2),f=V(u,!0);d(u);var p=L(u,2),m=e=>{Ri(e,{tone:`running`,size:`xs`,children:(e,t)=>{w(),g(e,M(`base`))},$$slots:{default:!0}})};k(p,e=>{W(n).name===W(l)&&e(m)});var h=L(p,2),_=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,t)=>{w(),g(e,M(`remote`))},$$slots:{default:!0}})};k(h,e=>{W(n).remote&&e(_)}),d(i),F(()=>{i.disabled=W(n).current||t.switchingBranch===W(n).name,A(f,W(n).name)}),r(`click`,i,()=>t.onSwitchBranch(t.selectedRepo,W(n))),g(e,i)}),g(e,n)};k(f,e=>{t.loadingBranches?e(p):t.filteredBranches.length===0?e(m,1):e(h,-1)}),d(c),d(n),g(e,n)},h=e=>{var n=kY(),r=V(n);$g(r,{placeholder:`feature/branch-name`,autofocus:!0,class:`h-9 font-mono text-sm`,"aria-label":`New branch name`,get"aria-invalid"(){return W(m)},get value(){return o()},set value(e){o(e)}});var i=L(r,2),a=e=>{g(e,DY())},s=e=>{g(e,OY())};k(i,e=>{W(m)?e(a):e(s,-1)}),d(n),ue(`submit`,n,e=>{e.preventDefault(),W(p)&&!t.creatingBranch&&t.onCreateBranch(t.selectedRepo)}),g(e,n)};k(c,e=>{W(s)===`switch`?e(f):e(h,-1)}),g(e,a)},$$slots:{footer:!0,default:!0}}),z()}T([`click`]);var jY=h(`<span class="block truncate font-mono"> </span>`);function MY(e,t){a(t,!0);var n=U(),r=R(n),i=e=>{tn(e,{type:`single`,get value(){return t.selectedRepo},variant:`outline`,size:`sm`,spacing:1,class:`flex w-full flex-wrap items-start gap-1`,onValueChange:e=>{e&&t.onSelectRepo(e)},children:(e,n)=>{var r=U();_(R(r),17,()=>t.repos,e=>e.relativePath,(e,n)=>{{let r=J(()=>!t.selectCapability.enabled),i=J(()=>`Switch to ${$J(W(n))}`),a=J(()=>$J(W(n)));$t(e,{get value(){return W(n).relativePath},get disabled(){return W(r)},get"aria-label"(){return W(i)},get title(){return W(a)},class:`h-6 max-w-28 min-w-0 rounded-md px-2 text-xs data-[state=on]:border-primary/40 data-[state=on]:bg-primary/10 data-[state=on]:text-primary`,children:(e,r)=>{var i=jY(),a=V(i,!0);d(i),F(e=>A(a,e),[()=>tY(W(n),t.repos)]),g(e,i)},$$slots:{default:!0}})}}),g(e,r)},$$slots:{default:!0}})};k(r,e=>{t.repos.length>1&&e(i)}),g(e,n),z()}var NY=h(`<p class="text-xs text-muted-foreground">Remote actions are unavailable for local-only repositories.</p>`),PY=h(`<!> <button type="button"><!> <span class="truncate font-mono"> </span> <!></button> <!> <!>`,1),FY=h(`<p class="text-xs text-muted-foreground">Loading…</p>`),IY=h(`<div class="flex shrink-0 flex-col gap-1.5 pt-1.5"><!></div>`);function LY(e,t){a(t,!0);let n=I(t,`branchFilter`,15,``),i=I(t,`newBranchName`,15,``),o=I(t,`branchDialogOpen`,15,!1);var c=IY(),l=V(c),u=e=>{let a=J(()=>t.repoSummary);var c=PY(),l=R(c);MY(l,{get repos(){return t.repos},get selectedRepo(){return t.selectedRepo},get selectCapability(){return t.capabilities.selectRepository},get onSelectRepo(){return t.onSelectRepo}});var u=L(l,2),f=V(u);oI(f,{class:`size-3 shrink-0`,"aria-hidden":`true`});var p=L(f,2),m=V(p,!0);d(p),ln(L(p,2),{class:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),d(u);var h=L(u,2),_=e=>{g(e,NY())};k(h,e=>{W(a).hasRemote||e(_)}),AY(L(h,2),{get repoSummary(){return W(a)},get selectedRepo(){return t.selectedRepo},get filteredBranches(){return t.filteredBranches},get baseBranchSummary(){return t.baseBranchSummary},get loadingBranches(){return t.loadingBranches},get switchingBranch(){return t.switchingBranch},get creatingBranch(){return t.creatingBranch},get branchesEnabled(){return t.capabilities.branches.enabled},get onSwitchBranch(){return t.onSwitchBranch},get onCreateBranch(){return t.onCreateBranch},get open(){return o()},set open(e){o(e)},get branchFilter(){return n()},set branchFilter(e){n(e)},get newBranchName(){return i()},set newBranchName(e){i(e)}}),F(e=>{u.disabled=!t.capabilities.branches.enabled,q(u,`title`,t.capabilities.branches.enabled?`Switch or create a branch`:t.capabilities.branches.reason),s(u,1,e),A(m,W(a).currentBranch??`(detached)`)},[()=>x(me(`inline-flex max-w-full min-w-0 items-center gap-1.5 self-start rounded-md border bg-background px-2 py-0.5 text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,W(a).detached&&`text-muted-foreground`))]),r(`click`,u,function(...e){t.onOpenBranchDialog?.apply(this,e)}),g(e,c)},f=e=>{g(e,FY())};k(l,e=>{t.repoSummary?e(u):e(f,-1)}),d(c),g(e,c),z()}T([`click`]);function RY(e){return{staged:e.filter(e=>e.staged),unstaged:e.filter(e=>e.untracked||e.worktree!==` `)}}function zY(e,t,n){let r=t.trim().toLocaleLowerCase();return e.filter(e=>e.name.toLocaleLowerCase().includes(r)).sort((e,t)=>{if(e.current!==t.current)return e.current?-1:1;let r=n!==void 0&&e.name===n;return r===(n!==void 0&&t.name===n)?e.name.localeCompare(t.name):r?-1:1})}var BY={author:`any`,username:``,drafts:`include`,title:``,currentBranchOnly:!1,labels:[],sort:`updated-desc`};function VY(e){let t=[...new Set(e.labels.map(e=>e.trim()))].filter(Boolean).slice(0,20);return{author:e.author,username:e.username.trim(),drafts:e.drafts,title:e.title.trim(),currentBranchOnly:e.currentBranchOnly,labels:t,sort:e.sort}}function HY(e){let t=VY(e);return{...t,labels:t.labels.join(`, `)}}function UY(e,t){return VY({...e,currentBranchOnly:t&&e.currentBranchOnly,labels:e.labels.split(`,`)})}function WY(e,t){let n=VY(e),r=VY(t);return n.author===r.author&&n.username===r.username&&n.drafts===r.drafts&&n.title===r.title&&n.currentBranchOnly===r.currentBranchOnly&&n.sort===r.sort&&n.labels.length===r.labels.length&&n.labels.every((e,t)=>e===r.labels[t])}function GY(e){let t=VY(e);return Number(t.author!==BY.author)+Number(t.drafts!==BY.drafts)+Number(t.title.length>0)+Number(t.currentBranchOnly)+t.labels.length+Number(t.sort!==BY.sort)}function KY(e){let t=VY(e);return t.author!==BY.author||t.drafts!==BY.drafts||t.title!==BY.title||t.currentBranchOnly||t.labels.length>0||t.sort!==BY.sort}function qY(e){return e.slice(0,10)}function JY(e,t){let n=()=>e().availability.available,r=t=>n()&&e().capabilities.remote[t].enabled;return{refreshAll:()=>{if(n()&&e().capabilities.refresh.enabled)return t.refreshAll()},refreshRepository:r=>{if(n()&&e().capabilities.refresh.enabled)return t.refreshRepository(r)},refreshBranches:r=>{if(n()&&e().capabilities.refresh.enabled)return t.refreshBranches(r)},refreshPullRequests:r=>{if(n()&&e().capabilities.refresh.enabled)return t.refreshPullRequests(r)},configurePullRequests:(r,i)=>{if(n()&&e().capabilities.refresh.enabled)return t.configurePullRequests(r,i)},resetPullRequestConfig:r=>{if(n()&&e().capabilities.refresh.enabled)return t.resetPullRequestConfig(r)},selectRepository:r=>{if(n()&&e().capabilities.selectRepository.enabled)return t.selectRepository(r)},createBranch:(r,i)=>n()&&e().capabilities.branches.enabled?t.createBranch(r,i):!1,switchBranch:(r,i)=>n()&&e().capabilities.branches.enabled?t.switchBranch(r,i):!1,openDiff:(e,r,i)=>{if(n())return t.openDiff(e,r,i)},mutateFile:(r,i,a)=>{if(n()&&e().capabilities.mutateFiles.enabled)return t.mutateFile(r,i,a)},bulkMutateFiles:(r,i)=>{if(n()&&e().capabilities.bulkMutateFiles.enabled)return t.bulkMutateFiles(r,i)},runRemoteOperation:(e,n)=>{if(r(n))return t.runRemoteOperation(e,n)},selectPullRequest:e=>{if(n())return t.selectPullRequest(e)},openPullRequest:(r,i)=>{if(n()&&e().capabilities.openPullRequest.enabled)return t.openPullRequest(r,i)}}}function YY(e,t){return t||!e.hasRemote}function XY(e,t){return YY(e,t)||e.detached||!e.hasUpstream||e.dirty}function ZY(e,t){return YY(e,t)||e.detached||(e.ahead??0)<=0}function QY(e,t){return YY(e,t)||e.detached}function $Y(e,t){return YY(e,t)||e.dirty}function eX(e){return e.hasUpstream&&!e.detached&&(e.behind??0)>0}function tX(e){return!e.detached&&(e.ahead??0)>0}var nX=h(`<!> <!> <!> <!> <!>`,1),rX=h(`<!> <!> <!> <!>`,1),iX=h(`<!> <!>`,1);function aX(e,t){a(t,!0);let n=Y(!1),r=Y(``),i=Y(``),o=Y(void 0),s=J(()=>RY(t.model.changes?.files??[])),c=J(()=>t.model.changes?.files.length??0),l=J(()=>zY(t.model.branches,W(r),t.model.repositorySummary?.baseBranch)),u=J(()=>t.model.branches.find(e=>e.name===t.model.repositorySummary?.baseBranch)),d=J(()=>t.model.operations.fetching||t.model.operations.pulling||t.model.operations.pushing||t.model.operations.syncing||t.model.operations.switchingBaseAndPulling);function f(){K(r,``),K(i,``)}function p(e){e!==t.model.selectedRepository&&(f(),t.actions.selectRepository(e))}async function m(e,r){await t.actions.switchBranch(e,r)!==!1&&(K(n,!1),f())}async function h(e){let r=W(i).trim();r&&await t.actions.createBranch(e,r)!==!1&&(K(n,!1),f())}function _(){K(n,!0),f(),t.actions.refreshBranches(t.model.selectedRepository)}var v=iX(),y=R(v);wn(y,{padded:!1,scroll:!1,banner:e=>{mY(e,{get model(){return t.model}})},children:(e,a)=>{var f=U(),v=R(f),y=e=>{var a=rX(),f=R(a);gn(f,{title:`Git changes`,get count(){return W(c)},trailing:e=>{{let n=J(()=>!t.model.capabilities.refresh.enabled||t.model.refreshing);Dn(e,{get icon(){return _l},label:`Refresh Git changes`,get loading(){return t.model.refreshing},get disabled(){return W(n)},onclick:()=>void t.actions.refreshRepository(t.model.selectedRepository)})}},$$slots:{trailing:!0}});var v=L(f,2);{let e=J(()=>[...t.model.repositories]);LY(v,{get repoSummary(){return t.model.repositorySummary},get repos(){return W(e)},get selectedRepo(){return t.model.selectedRepository},get filteredBranches(){return W(l)},get loadingBranches(){return t.model.loadingBranches},get switchingBranch(){return t.model.operations.switchingBranch},get creatingBranch(){return t.model.operations.creatingBranch},get capabilities(){return t.model.capabilities},get baseBranchSummary(){return W(u)},onSelectRepo:p,onOpenBranchDialog:_,onSwitchBranch:(e,t)=>void m(e,t),onCreateBranch:e=>void h(e),get branchFilter(){return W(r)},set branchFilter(e){K(r,e,!0)},get newBranchName(){return W(i)},set newBranchName(e){K(i,e,!0)},get branchDialogOpen(){return W(n)},set branchDialogOpen(e){K(n,e,!0)}})}var y=L(v,2),b=e=>{let n=J(()=>t.model.repositorySummary);pn(e,{dense:!0,class:`h-auto flex-wrap border-b-0 bg-transparent py-1.5`,children:(e,r)=>{var i=nX(),a=R(i);{let e=J(()=>W(n).hasRemote?`Fetch from remote and prune deleted refs`:`Add a remote before fetching`),r=J(()=>!t.model.capabilities.remote.fetch.enabled||YY(W(n),W(d)));Dn(a,{get icon(){return GJ},label:`Fetch`,variant:`outline`,showLabel:!0,get title(){return W(e)},get loading(){return t.model.operations.fetching},get disabled(){return W(r)},onclick:()=>void t.actions.runRemoteOperation(t.model.selectedRepository,`fetch`)})}var o=L(a,2),s=e=>{{let r=J(()=>`Pull${(W(n).behind??0)>0?` (${W(n).behind})`:``}`),i=J(()=>W(n).dirty?`Commit or stash changes before pulling`:`Pull current branch with fast-forward only`),a=J(()=>!t.model.capabilities.remote.pull.enabled||XY(W(n),W(d)));Dn(e,{get icon(){return Dv},get label(){return W(r)},variant:`outline`,showLabel:!0,get title(){return W(i)},get loading(){return t.model.operations.pulling},get disabled(){return W(a)},onclick:()=>void t.actions.runRemoteOperation(t.model.selectedRepository,`pull`)})}},c=J(()=>eX(W(n)));k(o,e=>{W(c)&&e(s)});var l=L(o,2),u=e=>{{let r=J(()=>`Push${(W(n).ahead??0)>0?` (${W(n).ahead})`:``}`),i=J(()=>!t.model.capabilities.remote.push.enabled||ZY(W(n),W(d)));Dn(e,{get icon(){return UJ},get label(){return W(r)},variant:`outline`,showLabel:!0,title:`Push current branch`,get loading(){return t.model.operations.pushing},get disabled(){return W(i)},onclick:()=>void t.actions.runRemoteOperation(t.model.selectedRepository,`push`)})}},f=J(()=>tX(W(n)));k(l,e=>{W(f)&&e(u)});var p=L(l,2);{let e=J(()=>W(n).hasRemote?W(n).detached?`Check out a branch before syncing`:`Fetch, then pull and push the current branch when needed`:`Add a remote before syncing`),r=J(()=>!t.model.capabilities.remote.sync.enabled||QY(W(n),W(d)));Dn(p,{get icon(){return _l},label:`Sync`,variant:`outline`,showLabel:!0,get title(){return W(e)},get loading(){return t.model.operations.syncing},get disabled(){return W(r)},onclick:()=>void t.actions.runRemoteOperation(t.model.selectedRepository,`sync`)})}var m=L(p,2),h=e=>{{let r=J(()=>`${W(n).baseBranch} + pull`),i=J(()=>W(n).dirty?`Commit or stash changes before switching branches`:`Switch to ${W(n).baseBranch} and pull with fast-forward only`),a=J(()=>!t.model.capabilities.remote[`switch-base-and-pull`].enabled||$Y(W(n),W(d)));Dn(e,{get icon(){return qJ},get label(){return W(r)},variant:`outline`,showLabel:!0,get title(){return W(i)},get loading(){return t.model.operations.switchingBaseAndPulling},get disabled(){return W(a)},onclick:()=>void t.actions.runRemoteOperation(t.model.selectedRepository,`switch-base-and-pull`)})}};k(m,e=>{!W(n).detached&&!W(n).onBaseBranch&&e(h)}),g(e,i)},$$slots:{default:!0}})};k(y,e=>{t.model.repositorySummary&&e(b)}),dY(L(y,2),{get changes(){return t.model.changes},get stagedFiles(){return W(s).staged},get unstagedFiles(){return W(s).unstaged},get fileMutation(){return t.model.operations.fileMutation},get bulkMutation(){return t.model.operations.bulkMutation},get selectedRepo(){return t.model.selectedRepository},get capabilities(){return t.model.capabilities},onOpenDiff:(e,n,r)=>void t.actions.openDiff(e,n,r),onMutateFile:(e,n,r)=>void t.actions.mutateFile(e,n,r),onBulkStage:(e,n)=>void t.actions.bulkMutateFiles(e,n),onRequestDiscard:e=>K(o,{repository:t.model.selectedRepository,file:e},!0)}),g(e,a)};k(v,e=>{t.model.availability.available&&t.model.repositories.length>0&&e(y)}),g(e,f)},$$slots:{banner:!0,default:!0}});var b=L(y,2);{let e=J(()=>!!W(o)),n=J(()=>W(o)?`This will permanently discard all uncommitted changes for ${W(o).file.path}.`:`This will permanently discard this uncommitted change.`);B_(b,{get open(){return W(e)},title:`Discard change?`,get description(){return W(n)},confirmLabel:`Discard`,destructive:!0,onConfirm:()=>{let e=W(o);K(o,void 0),e&&t.actions.mutateFile(e.repository,e.file,`discard`)},onCancel:()=>K(o,void 0),onOpenChange:e=>{e||K(o,void 0)}})}g(e,v),z()}var oX={enabled:!0};function sX(e){return{enabled:!1,reason:e}}var cX=new Set([`$$slots`,`$$events`,`$$legacy`]);function lX(e,t){let n=H(t,cX),r=[[`path`,{d:`M13 5h8`}],[`path`,{d:`M13 12h8`}],[`path`,{d:`M13 19h8`}],[`path`,{d:`m3 17 2 2 4-4`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`}]];P(e,B({name:`list-todo`},()=>n,{get iconNode(){return r}}))}var uX=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function dX(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,uX);var i=U(),o=R(i);{let e=J(()=>me(`gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed`,t.class));C(o,()=>Ys,(t,i)=>{i(t,B({"data-slot":`label`,get class(){return W(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}g(e,i),z()}var fX=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`class`,`data-slot`]),pX=h(`<textarea></textarea>`);function mX(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`value`,15),i=I(t,`data-slot`,3,`textarea`),o=H(t,fX);var s=pX();le(s),O(s,e=>({"data-slot":i(),class:e,...o}),[()=>me(`border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] focus-visible:ring-3 aria-invalid:ring-3 md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50`,t.class)]),fe(s,e=>n(e),()=>n()),Ne(s,r),g(e,s),z()}var hX=h(`<!> <!>`,1),gX=h(`<div class="grid gap-4"><div class="grid gap-1.5"><!> <!></div> <div class="grid gap-1.5"><!> <!> <p class="text-xs text-muted-foreground">This is the shell command run by the play button.</p></div> <div class="grid gap-1.5"><!> <!> <p class="text-xs text-muted-foreground">Single run focuses an existing process. Concurrent runs may start
135
+ another process.</p></div> <div class="grid gap-1.5"><!> <!> <p class="text-xs text-muted-foreground">Leave blank to use the default working directory.</p></div></div>`);function _X(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`saving`,3,!1),i=Y(``),o=Y(``),s=Y(``),c=Y(`single`),l=J(()=>t.title??(t.definition?`Edit task`:`Create task`)),u=J(()=>t.description??(t.definition?`Update this task definition and its launch policy. Existing runs keep their original command.`:`Create a reusable task definition for this workspace.`)),f=J(()=>t.submitLabel??(t.definition?`Save task`:`Create task`)),p=J(()=>!r()&&W(o).trim().length>0);be(()=>{if(!n())return;let e=t.definition??t.initial;K(i,e?.label??``,!0),K(o,e?.command??``,!0),K(s,e?.cwd??``,!0),K(c,t.definition?.runPolicy??`single`,!0)});function m(){if(!W(p))return;let e=W(i).trim(),n=W(s).trim();t.onSave?.({command:W(o).trim(),...e.length>0?{label:e}:{},...n.length>0?{cwd:n}:{},runPolicy:W(c)})}sP(e,{get title(){return W(l)},get description(){return W(u)},class:`max-w-xl`,get onOpenChange(){return t.onOpenChange},get open(){return n()},set open(e){n(e)},footer:e=>{var t=hX(),i=R(t);G(i,{size:`sm`,variant:`ghost`,onclick:()=>n(!1),get disabled(){return r()},children:(e,t)=>{w(),g(e,M(`Cancel`))},$$slots:{default:!0}});var a=L(i,2);{let e=J(()=>!W(p));G(a,{size:`sm`,onclick:m,get disabled(){return W(e)},children:(e,t)=>{w();var n=M();F(()=>A(n,r()?`Saving…`:W(f))),g(e,n)},$$slots:{default:!0}})}g(e,t)},children:(e,n)=>{var a=gX(),l=V(a),u=V(l);dX(u,{for:`task-definition-label`,children:(e,t)=>{w(),g(e,M(`Label`))},$$slots:{default:!0}}),$g(L(u,2),{id:`task-definition-label`,placeholder:`web-dev`,get disabled(){return r()},get value(){return W(i)},set value(e){K(i,e,!0)}}),d(l);var f=L(l,2),p=V(f);dX(p,{for:`task-definition-command`,children:(e,t)=>{w(),g(e,M(`Command`))},$$slots:{default:!0}}),mX(L(p,2),{id:`task-definition-command`,rows:4,placeholder:`pnpm dev`,class:`font-mono text-xs`,get disabled(){return r()},get value(){return W(o)},set value(e){K(o,e,!0)}}),w(2),d(f);var m=L(f,2),h=V(m);dX(h,{for:`task-run-policy`,children:(e,t)=>{w(),g(e,M(`Run policy`))},$$slots:{default:!0}}),nn(L(h,2),{ariaLabel:`Task run policy`,items:[{value:`single`,label:`Single run`},{value:`concurrent`,label:`Concurrent runs`}],get disabled(){return r()},get value(){return W(c)},set value(e){K(c,e,!0)}}),w(2),d(m);var _=L(m,2),v=V(_);dX(v,{for:`task-definition-cwd`,children:(e,t)=>{w(),g(e,M(`Working directory`))},$$slots:{default:!0}});var y=L(v,2);{let e=J(()=>t.projectCwd?`Default: ${t.projectCwd}`:`Default working directory`);$g(y,{id:`task-definition-cwd`,get placeholder(){return W(e)},class:`font-mono text-xs`,get disabled(){return r()},get value(){return W(s)},set value(e){K(s,e,!0)}})}w(2),d(_),d(a),g(e,a)},$$slots:{footer:!0,default:!0}}),z()}var vX=new Set([`$$slots`,`$$events`,`$$legacy`]);function yX(e,t){let n=H(t,vX),r=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}],[`path`,{d:`M12 7v5l4 2`}]];P(e,B({name:`history`},()=>n,{get iconNode(){return r}}))}var bX=new Set([`$$slots`,`$$events`,`$$legacy`]);function xX(e,t){let n=H(t,bX),r=[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`}]];P(e,B({name:`play`},()=>n,{get iconNode(){return r}}))}var SX=new Set([`$$slots`,`$$events`,`$$legacy`]);function CX(e,t){let n=H(t,SX),r=[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}]];P(e,B({name:`rotate-cw`},()=>n,{get iconNode(){return r}}))}var wX=new Set([`$$slots`,`$$events`,`$$legacy`]);function TX(e,t){let n=H(t,wX),r=[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`}],[`circle`,{cx:`15`,cy:`12`,r:`1`}],[`circle`,{cx:`9`,cy:`12`,r:`1`}]];P(e,B({name:`skull`},()=>n,{get iconNode(){return r}}))}var EX=new Set([`starting`,`running`,`ready`,`stopping`,`recovered`]),DX=new Set([`recovered`,`recovery_unknown`,`orphaned`]),OX=new Set([`completed`,`failed`,`timed_out`,`cancelled`,`orphaned`,`interrupted`]);function kX(e){return{id:e.id,label:e.label,command:e.command,cwd:e.cwd,createdAt:e.createdAt,updatedAt:e.updatedAt,runPolicy:e.runPolicy}}function AX(e){let t=e.definition.label;if(t&&t.trim().length>0)return{text:t,isCommand:!1};let n=e.definition.command;return{text:n||`Task`,isCommand:n.length>0}}function jX(e){let t=e.run.displayName??e.run.name;if(t&&t.trim().length>0)return{text:t,isCommand:!1};let n=e.run.command;return{text:n||`Task`,isCommand:n.length>0}}function MX(e){let t=new Date(e);return t.toDateString()===new Date().toDateString()?t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}):t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function NX(e,t){let n=new Map;for(let e of t){if(!e.definitionId)continue;let t=n.get(e.definitionId)??[];t.push(e),n.set(e.definitionId,t)}return{definitions:e.map(e=>FX(e,n.get(e.id)??[])).sort((e,t)=>Number(t.needsRecovery)-Number(e.needsRecovery)||(t.latestRun?.startedAt??t.definition.updatedAt).localeCompare(e.latestRun?.startedAt??e.definition.updatedAt)),runs:t.filter(e=>!e.definitionId).map(e=>PX(e)).sort((e,t)=>Number(t.needsRecovery)-Number(e.needsRecovery)||t.run.startedAt.localeCompare(e.run.startedAt))}}function PX(e,t){return{key:e.id,run:e,definition:t,isActive:EX.has(e.status),canForceKill:e.status===`recovered`||e.status===`stopping`,isRemovable:OX.has(e.status),needsRecovery:DX.has(e.status)}}function FX(e,t){let n=[...t].sort((e,t)=>t.startedAt.localeCompare(e.startedAt)).map(t=>PX(t,e));return{key:e.id,definition:e,runs:n,activeRuns:n.filter(e=>e.isActive).map(e=>e.run),latestRun:n[0]?.run,needsRecovery:n.some(e=>e.needsRecovery)}}function IX(e,t){let n=()=>e().availability.available,r=t=>n()&&e().capabilities[t].enabled;return{selectTask:e=>t.selectTask(e),openTaskOutput:e=>{if(r(`logs`))return t.openTaskOutput(e)},startTask:e=>{if(r(`start`))return t.startTask(e)},runDefinition:e=>{if(r(`start`))return t.runDefinition(e)},cancelTask:(e,n)=>{if(r(`cancel`))return t.cancelTask(e,n)},forceKillTask:e=>{if(r(`cancel`))return t.cancelTask(e,{signal:`SIGKILL`,reason:`force_kill`})},restartTask:e=>{if(r(`restart`))return t.restartTask(e)},removeTask:e=>{if(r(`remove`))return t.removeTask(e)},pruneTasks:()=>{if(r(`prune`))return t.pruneTasks()},copyText:e=>{if(r(`copy`))return t.copyText(e)},createDefinition:e=>{if(r(`manageDefinitions`))return t.createDefinition(e)},updateDefinition:(e,n)=>{if(r(`manageDefinitions`))return t.updateDefinition(e,n)},deleteDefinition:e=>{if(r(`manageDefinitions`))return t.deleteDefinition(e)},loadLogs:(e,n)=>{if(r(`logs`))return t.loadLogs(e,n)}}}var LX=h(`<!> `,1),RX=h(`<!> <!> <!>`,1);function zX(e,t){a(t,!0);let n=I(t,`expanded`,3,!1),r=J(()=>t.entry.latestRun),i=J(()=>t.entry.runs.length>0),o=J(()=>W(r)?.status??`saved`),s=J(()=>AX(t.entry)),c=J(()=>t.entry.definition.command),l=J(()=>t.entry.definition.cwd),u=J(()=>t.entry.definition.runPolicy===`concurrent`),d=J(()=>W(u)||t.entry.activeRuns.length===0),f=J(()=>t.entry.activeRuns[0]),p=J(()=>t.entry.needsRecovery?W(r)?.status===`recovered`?`Process recovered; live output disconnected.`:`Process identity needs recovery review.`:void 0),m=J(()=>[W(c),W(l),W(p)].filter(Boolean).join(`
136
+ `)),h=J(()=>W(u)&&W(f)?`Start another run`:`Run task`),_=J(()=>{let e=[];W(r)&&e.push({label:`Open logs`,icon:qu,disabled:!t.capabilities.logs,onSelect:()=>t.onOpen?.(W(r).id)}),W(i)&&e.push({label:n()?`Hide runs`:`Show runs`,icon:yX,onSelect:()=>t.onToggleExpanded?.()}),W(d)&&e.push({label:W(h),icon:xX,disabled:!t.capabilities.start,onSelect:()=>t.onRun?.()}),W(f)&&(e.push({label:`Restart`,icon:CX,disabled:!t.capabilities.restart,onSelect:()=>t.onRestart?.(W(f).id)}),W(f).status!==`stopping`&&e.push({label:`Stop`,icon:fg,disabled:!t.capabilities.cancel,onSelect:()=>t.onCancel?.(W(f).id)}),(W(f).status===`recovered`||W(f).status===`stopping`)&&e.push({label:`Force kill`,icon:TX,destructive:!0,disabled:!t.capabilities.cancel,onSelect:()=>t.onForceKill?.(W(f).id)})),e.length>0&&e.push({type:`separator`}),e.push({label:`Edit task`,icon:Yv,disabled:!t.capabilities.manageDefinitions,onSelect:()=>t.onEdit?.()}),e.push({label:`Delete task`,icon:Zv,destructive:!0,disabled:!t.capabilities.manageDefinitions,onSelect:()=>t.onDelete?.()});let a=[];return W(c)&&a.push({label:`Copy command`,icon:Bu,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(c))}),W(l)&&a.push({label:`Copy working directory`,icon:En,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(l))}),a.length>0&&e.push({type:`separator`},...a),e});{let a=e=>{var n=RX(),i=R(n),a=e=>{Ri(e,{tone:`accent`,size:`xs`,children:(e,n)=>{w();var r=M();F(()=>A(r,`${t.entry.activeRuns.length??``} running`)),g(e,r)},$$slots:{default:!0}})};k(i,e=>{t.entry.activeRuns.length>1&&e(a)});var s=L(i,2),c=e=>{Ri(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{var r=LX(),i=R(r);yX(i,{class:`mr-1 size-3`});var a=L(i,1,!0);F(()=>A(a,t.entry.runs.length)),g(e,r)},$$slots:{default:!0}})};k(s,e=>{t.entry.runs.length>1&&e(c)});var l=L(s,2);{let e=J(()=>W(r)?vf(W(r).status):`neutral`);Ri(l,{get tone(){return W(e)},size:`xs`,children:(e,t)=>{w();var n=M();F(()=>A(n,W(o))),g(e,n)},$$slots:{default:!0}})}g(e,n)},c=e=>{var n=U(),r=R(n),i=e=>{{let n=J(()=>!t.capabilities.cancel);Dn(e,{get icon(){return TX},label:`Force kill task`,get disabled(){return W(n)},onclick:()=>t.onForceKill?.(W(f).id)})}},a=e=>{{let n=J(()=>!t.capabilities.cancel);Dn(e,{get icon(){return fg},label:`Stop task`,get disabled(){return W(n)},onclick:()=>t.onCancel?.(W(f).id)})}},o=e=>{{let n=J(()=>!t.capabilities.start);Dn(e,{get icon(){return xX},get label(){return W(h)},get disabled(){return W(n)},onclick:()=>t.onRun?.()})}};k(r,e=>{W(f)?.status===`stopping`?e(i):W(f)?e(a,1):W(d)&&e(o,2)}),g(e,n)},l=J(()=>W(s).isCommand?`muted`:`default`),u=J(()=>t.entry.needsRecovery?`warn`:W(r)?vf(W(r).status):`neutral`),p=J(()=>n()?`outline`:`solid`),v=J(()=>W(r)?yf(W(r).status):!1),y=J(()=>!W(i)),b=J(()=>W(i)?n():void 0);vn(e,{get label(){return W(s).text},get title(){return W(m)},get mono(){return W(s).isCommand},get tone(){return W(l)},get status(){return W(u)},get statusVariant(){return W(p)},get pulse(){return W(v)},get disabled(){return W(y)},get ariaExpanded(){return W(b)},indent:0,alwaysShowActions:!0,get menuItems(){return W(_)},onclick:()=>W(i)&&t.onToggleExpanded?.(),badges:a,actions:c,$$slots:{badges:!0,actions:!0}})}z()}var BX=new Set([`$$slots`,`$$events`,`$$legacy`]);function VX(e,t){let n=H(t,BX),r=[[`path`,{d:`M12 7v6`}],[`path`,{d:`M15 10H9`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`}]];P(e,B({name:`bookmark-plus`},()=>n,{get iconNode(){return r}}))}function HX(e,t){a(t,!0);let n=I(t,`nested`,3,!1),r=J(()=>t.entry.run),i=J(()=>jX(t.entry)),o=J(()=>MX(W(r).startedAt)),s=J(()=>t.entry.needsRecovery?W(r).status===`recovered`?`Process recovered; live output disconnected.`:`Process identity needs recovery review.`:void 0),c=J(()=>[W(r).command,W(r).cwd,W(s)].filter(Boolean).join(`
137
+ `)),l=J(()=>{let e=[{label:`Open logs`,icon:qu,disabled:!t.capabilities.logs,onSelect:()=>t.onOpen?.(W(r).id)},{label:`Restart`,icon:CX,disabled:!t.capabilities.restart,onSelect:()=>t.onRestart?.(W(r).id)}];t.entry.definition&&t.entry.isRemovable&&e.push({label:`Run saved task again`,icon:CX,disabled:!t.capabilities.start,onSelect:()=>t.onRerunDefinition?.()}),t.entry.isActive&&W(r).status!==`stopping`&&e.push({label:`Stop`,icon:fg,disabled:!t.capabilities.cancel,onSelect:()=>t.onCancel?.(W(r).id)}),t.entry.canForceKill&&e.push({label:`Force kill`,icon:TX,destructive:!0,disabled:!t.capabilities.cancel,onSelect:()=>t.onForceKill?.(W(r).id)}),t.entry.definition||e.push({type:`separator`},{label:`Save as task definition`,icon:VX,disabled:!t.capabilities.manageDefinitions,onSelect:()=>t.onSaveAsDefinition?.(W(r))});let n=[{label:`Copy command`,icon:Bu,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(r).command)},{label:`Copy working directory`,icon:En,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(r).cwd)}];return t.entry.isRemovable&&n.push({label:`Remove run`,icon:yl,destructive:!0,disabled:!t.capabilities.remove,onSelect:()=>t.onRemove?.(W(r).id)}),e.push({type:`separator`},...n),e});{let a=e=>{{let t=J(()=>vf(W(r).status));Ri(e,{get tone(){return W(t)},size:`xs`,children:(e,t)=>{w();var n=M();F(()=>A(n,W(r).status)),g(e,n)},$$slots:{default:!0}})}},s=e=>{var n=U(),a=R(n),o=e=>{{let n=J(()=>`Force kill ${W(i).text}`),a=J(()=>!t.capabilities.cancel);Dn(e,{get icon(){return TX},get label(){return W(n)},get disabled(){return W(a)},onclick:()=>t.onForceKill?.(W(r).id)})}},s=e=>{{let n=J(()=>`Stop ${W(i).text}`),a=J(()=>!t.capabilities.cancel);Dn(e,{get icon(){return fg},get label(){return W(n)},get disabled(){return W(a)},onclick:()=>t.onCancel?.(W(r).id)})}},c=e=>{{let n=J(()=>`Restart ${W(i).text}`),a=J(()=>!t.capabilities.restart);Dn(e,{get icon(){return CX},get label(){return W(n)},get disabled(){return W(a)},onclick:()=>t.onRestart?.(W(r).id)})}};k(a,e=>{W(r).status===`stopping`?e(o):t.entry.isActive?e(s,1):e(c,-1)}),g(e,n)},u=J(()=>n()?W(o):W(i).text),d=J(()=>n()?void 0:W(o)),f=J(()=>!n()&&W(i).isCommand),p=J(()=>n()||W(i).isCommand?`muted`:`default`),m=J(()=>t.entry.needsRecovery?`warn`:vf(W(r).status)),h=J(()=>yf(W(r).status)),_=J(()=>+!!n());vn(e,{get label(){return W(u)},get description(){return W(d)},get title(){return W(c)},get mono(){return W(f)},get tone(){return W(p)},get status(){return W(m)},get pulse(){return W(h)},get indent(){return W(_)},alwaysShowActions:!0,get menuItems(){return W(l)},onclick:()=>t.onOpen?.(W(r).id),badges:a,actions:s,$$slots:{badges:!0,actions:!0}})}z()}var UX=h(`<p class="p-2 text-xs text-muted-foreground">No runs match.</p>`),WX=h(`<div class="flex min-h-0 flex-col"><div class="flex shrink-0 items-center border-b border-border/60 p-2"><!></div> <div class="min-h-0 flex-1 p-1"><!></div></div>`);function GX(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=Y(``),i=J(()=>{let e=W(r).trim().toLowerCase();return e.length===0?t.runs:t.runs.filter(t=>`${jX(t).text} ${t.run.command}`.toLowerCase().includes(e))});be(()=>{n()&&K(r,``)});function o(e){n(e),t.onOpenChange?.(e)}function s(e){t.onOpen(e),o(!1)}{let a=J(()=>`${t.runs.length} task runs`);sP(e,{flush:!0,size:`wide`,title:`Runs`,get description(){return W(a)},class:`h-[min(40rem,calc(100vh-6rem))]`,onOpenChange:o,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=WX(),o=V(a);t_(V(o),{class:`flex-1`,placeholder:`Filter runs`,ariaLabel:`Filter runs`,get value(){return W(r)},set value(e){K(r,e,!0)}}),d(o);var c=L(o,2),l=V(c),u=e=>{g(e,UX())},f=e=>{kn(e,{class:`h-full`,children:(e,n)=>{hn(e,{ariaLabel:`All runs`,class:`gap-1`,children:(e,n)=>{var r=U();_(R(r),17,()=>W(i),e=>e.key,(e,n)=>{mn(e,{children:(e,r)=>{HX(e,{get entry(){return W(n)},get capabilities(){return t.capabilities},onOpen:s,get onCancel(){return t.onCancel},get onForceKill(){return t.onForceKill},get onRestart(){return t.onRestart},onRerunDefinition:()=>t.onRerunDefinition(W(n)),get onRemove(){return t.onRemove},get onCopy(){return t.onCopy},get onSaveAsDefinition(){return t.onSaveAsDefinition}})},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}})},$$slots:{default:!0}})};k(l,e=>{W(i).length===0?e(u):e(f,-1)}),d(c),d(a),g(e,a)},$$slots:{default:!0}})}z()}var KX=h(`<p class="py-1 text-xs text-muted-foreground">Loading tasks…</p>`),qX=h(`<div class="flex min-w-0 flex-col border-t border-border/60 pt-0.5"></div>`),JX=h(`<!> <!>`,1),YX=h(`<div class="mt-auto shrink-0 p-1"><!></div>`),XX=h(`<div class="flex min-h-0 min-w-0 flex-1 basis-0 flex-col overflow-hidden"><!> <!> <!></div>`),ZX=h(`<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden"><div class="flex min-w-0 shrink flex-col overflow-y-auto"><!></div> <!></div>`),QX=h(`<div class="flex h-full min-h-0 flex-col"><!></div>`),$X=h(`<!> <!> <!>`,1),eZ=h(`<div class="h-full min-h-0"><!></div> <!> <!> <!> <!> <!> <!> <!>`,1);function tZ(e,t){a(t,!0);let n=e=>{var n=ZX(),i=V(n),a=V(i),o=e=>{g(e,KX())},p=e=>{xn(e,{get icon(){return lX},title:`No saved tasks`,description:`Create a task to run it anytime.`})},x=e=>{hn(e,{role:`none`,class:`gap-1`,children:(e,n)=>{var i=U();_(R(i),17,()=>W(r).definitions,e=>e.key,(e,n)=>{let r=J(()=>y.has(W(n).key));mn(e,{children:(e,i)=>{var a=JX(),o=R(a);zX(o,{get entry(){return W(n)},get capabilities(){return W(D)},get expanded(){return W(r)},onToggleExpanded:()=>b(W(n).key),onOpen:e=>void t.actions.openTaskOutput(e),onRun:()=>void t.actions.runDefinition(W(n).definition),onCancel:e=>void t.actions.cancelTask(e),onForceKill:e=>K(c,t.model.tasks.find(t=>t.id===e),!0),onRestart:e=>void t.actions.restartTask(e),onEdit:()=>K(l,W(n).definition,!0),onDelete:()=>K(u,W(n).definition,!0),onCopy:e=>void t.actions.copyText(e)});var s=L(o,2),f=e=>{var r=qX();_(r,21,()=>W(n).runs,e=>e.key,(e,n)=>{HX(e,{nested:!0,get entry(){return W(n)},get capabilities(){return W(D)},onOpen:e=>void t.actions.openTaskOutput(e),onCancel:e=>void t.actions.cancelTask(e),onForceKill:e=>K(c,t.model.tasks.find(t=>t.id===e),!0),onRestart:e=>void t.actions.restartTask(e),onRerunDefinition:()=>j(W(n)),onRemove:e=>void t.actions.removeTask(e),onCopy:e=>void t.actions.copyText(e)})}),d(r),g(e,r)};k(s,e=>{W(r)&&e(f)}),g(e,a)},$$slots:{default:!0}})}),g(e,i)},$$slots:{default:!0}})};k(a,e=>{t.model.definitionsLoading&&t.model.definitions.length===0?e(o):W(r).definitions.length===0?e(p,1):e(x,-1)}),d(i);var C=L(i,2),O=e=>{var n=XX(),i=V(n);bn(i,{title:`Runs`,get count(){return W(r).runs.length},actions:e=>{{let n=J(()=>!t.model.capabilities.prune.enabled||W(S)===0);Dn(e,{get icon(){return Zv},label:`Prune history`,title:`Prune finished ad-hoc task runs`,get disabled(){return W(n)},onclick:()=>K(s,!0)})}},$$slots:{actions:!0}});var a=L(i,2);hn(a,{ariaLabel:`Runs`,class:`shrink-0 gap-1`,children:(e,n)=>{var r=U();_(R(r),17,()=>W(T),e=>e.key,(e,n)=>{mn(e,{children:(e,r)=>{HX(e,{get entry(){return W(n)},get capabilities(){return W(D)},onOpen:e=>void t.actions.openTaskOutput(e),onCancel:e=>void t.actions.cancelTask(e),onForceKill:e=>K(c,t.model.tasks.find(t=>t.id===e),!0),onRestart:e=>void t.actions.restartTask(e),onRemove:e=>void t.actions.removeTask(e),onCopy:e=>void t.actions.copyText(e),onSaveAsDefinition:e=>K(f,e,!0)})},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}});var o=L(a,2),l=e=>{var t=YX();G(V(t),{variant:`ghost`,size:`xs`,class:`w-full text-muted-foreground`,onclick:()=>K(v,!0),children:(e,t)=>{w(),g(e,M(`See More`))},$$slots:{default:!0}}),d(t),fe(t,e=>K(h,e),()=>W(h)),g(e,t)};k(o,e=>{W(E)>0&&e(l)}),d(n),fe(n,e=>K(m,e),()=>W(m)),g(e,n)};k(C,e=>{W(r).runs.length>0&&e(O)}),d(n),g(e,n)},r=J(()=>NX(t.model.definitions,t.model.tasks)),i=Y(!1),o=Y(!1),s=Y(!1),c=Y(void 0),l=Y(void 0),u=Y(void 0),f=Y(void 0),p=Y(0),m=Y(null),h=Y(null),v=Y(!1),y=new ye;function b(e){y.delete(e)||y.add(e)}let x=J(()=>W(p)>=720),S=J(()=>W(r).runs.filter(e=>e.isRemovable).length),C=Cn({region:()=>W(m),footer:()=>W(h),total:()=>W(r).runs.length}),T=J(()=>W(r).runs.slice(0,C.count)),E=J(()=>W(r).runs.length-W(T).length),D=J(()=>({start:t.model.capabilities.start.enabled,cancel:t.model.capabilities.cancel.enabled,restart:t.model.capabilities.restart.enabled,remove:t.model.capabilities.remove.enabled,logs:t.model.capabilities.logs.enabled,copy:t.model.capabilities.copy.enabled,manageDefinitions:t.model.capabilities.manageDefinitions.enabled}));async function O(e){K(o,!0);try{await t.actions.createDefinition(e),K(i,!1),K(f,void 0)}finally{K(o,!1)}}async function ee(e){if(W(l)){K(o,!0);try{await t.actions.updateDefinition(W(l),e),K(l,void 0)}finally{K(o,!1)}}}async function te(){W(u)&&(await t.actions.deleteDefinition(W(u)),K(u,void 0))}async function ne(){if(!W(c))return;let e=W(c).id;K(c,void 0),await t.actions.forceKillTask(e)}function j(e){e.definition&&t.actions.runDefinition(e.definition)}var N=eZ(),P=R(N);wn(V(P),{scroll:!1,padded:!1,banner:e=>{var n=JX(),a=R(n);{let e=e=>{var n=U(),r=R(n),a=e=>{{let n=J(()=>!t.model.capabilities.manageDefinitions.enabled);Dn(e,{get icon(){return hl},label:`Create task`,get disabled(){return W(n)},onclick:()=>K(i,!0)})}};k(r,e=>{t.model.availability.available&&e(a)}),g(e,n)},n=J(()=>t.model.availability.available?W(r).definitions.length:void 0);gn(a,{title:`Tasks`,get count(){return W(n)},trailing:e,$$slots:{trailing:!0}})}var o=L(a,2),s=e=>{dn(e,{tone:`muted`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.model.availability.message)),g(e,r)},$$slots:{default:!0}})},c=e=>{dn(e,{tone:`info`,children:(e,n)=>{w();var r=M();F(()=>A(r,t.model.notice)),g(e,r)},$$slots:{default:!0}})};k(o,e=>{t.model.availability.available?t.model.notice&&e(c,1):e(s)}),g(e,n)},children:(e,r)=>{var i=U(),a=R(i),o=e=>{var r=U(),i=R(r),a=e=>{Au(e,{direction:`horizontal`,class:`min-h-0 flex-1`,children:(e,r)=>{var i=$X(),a=R(i);Ou(a,{defaultSize:38,minSize:24,maxSize:60,children:(e,t)=>{var r=QX();n(V(r)),d(r),g(e,r)},$$slots:{default:!0}});var o=L(a,2);ku(o,{"aria-label":`Resize task output`}),Ou(L(o,2),{defaultSize:62,minSize:30,children:(e,n)=>{Qq(e,{get task(){return t.model.selectedTask},get taskLogs(){return t.model.selectedLogs}})},$$slots:{default:!0}}),g(e,i)},$$slots:{default:!0}})},o=e=>{n(e)};k(i,e=>{W(x)?e(a):e(o,-1)}),g(e,r)};k(a,e=>{t.model.availability.available&&e(o)}),g(e,i)},$$slots:{banner:!0,default:!0}}),d(P);var ie=L(P,2);GX(ie,{get runs(){return W(r).runs},get capabilities(){return W(D)},onOpen:e=>void t.actions.openTaskOutput(e),onCancel:e=>void t.actions.cancelTask(e),onForceKill:e=>K(c,t.model.tasks.find(t=>t.id===e),!0),onRestart:e=>void t.actions.restartTask(e),onRerunDefinition:j,onRemove:e=>void t.actions.removeTask(e),onCopy:e=>void t.actions.copyText(e),onSaveAsDefinition:e=>K(f,e,!0),get open(){return W(v)},set open(e){K(v,e,!0)}});var ae=L(ie,2);_X(ae,{get projectCwd(){return t.model.defaultCwd},get saving(){return W(o)},onSave:e=>void O(e),get open(){return W(i)},set open(e){K(i,e,!0)}});var oe=L(ae,2);{let e=J(()=>!!W(l));_X(oe,{get open(){return W(e)},get definition(){return W(l)},get projectCwd(){return t.model.defaultCwd},get saving(){return W(o)},onSave:e=>void ee(e),onOpenChange:e=>{e||K(l,void 0)}})}var se=L(oe,2);{let e=J(()=>!!W(f)),n=J(()=>W(f)?{label:W(f).displayName??W(f).name,command:W(f).command,cwd:W(f).cwd===t.model.defaultCwd?void 0:W(f).cwd}:void 0);_X(se,{get open(){return W(e)},get projectCwd(){return t.model.defaultCwd},get initial(){return W(n)},title:`Save as task definition`,description:`Create a reusable definition from this run. The run stays linked to it.`,submitLabel:`Save task`,get saving(){return W(o)},onSave:e=>W(f)&&void O({...e,sourceTaskId:W(f).id}),onOpenChange:e=>{e||K(f,void 0)}})}var ce=L(se,2);{let e=J(()=>!!W(c)),t=J(()=>`Immediately terminates ${W(c)?.displayName??W(c)?.name??W(c)?.command??`this task`}. Buffered output and process cleanup may be lost.`);B_(ce,{get open(){return W(e)},destructive:!0,title:`Force kill task?`,get description(){return W(t)},confirmLabel:`Force kill`,onConfirm:()=>void ne(),onCancel:()=>K(c,void 0),onOpenChange:e=>{e||K(c,void 0)}})}var le=L(ce,2);{let e=J(()=>!!W(u));B_(le,{get open(){return W(e)},destructive:!0,title:`Delete saved task?`,description:`The saved definition is removed. Existing run history and logs are retained.`,confirmLabel:`Delete`,onConfirm:()=>void te(),onCancel:()=>K(u,void 0),onOpenChange:e=>{e||K(u,void 0)}})}B_(L(le,2),{destructive:!0,title:`Prune task history`,description:`This removes completed ad-hoc task runs and their captured logs. Saved tasks and recovery warnings are retained.`,confirmLabel:`Prune`,onConfirm:()=>void t.actions.pruneTasks(),get open(){return W(s)},set open(e){K(s,e,!0)}}),re(P,`clientWidth`,e=>K(p,e)),g(e,N),z()}var nZ=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),rZ=h(`<kbd><!></kbd>`);function iZ(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=H(t,nZ);var i=rZ();O(i,e=>({"data-slot":`kbd`,class:e,...r}),[()=>me(`bg-muted text-muted-foreground in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-sm px-1 font-sans text-xs font-medium [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none`,t.class)]),u(V(i),()=>t.children??D),d(i),fe(i,e=>n(e),()=>n()),g(e,i),z()}h(`<kbd><!></kbd>`);var aZ=h(`<!> New chat`,1),oZ=h(`<div class="mt-3 flex items-center gap-1.5 text-xs text-muted-foreground"><span>or press</span> <!></div>`),sZ=h(`<!> <!>`,1);function cZ(e,t){a(t,!0);let n=I(t,`projectSelected`,3,!1),r=Vd(`conversation.new`);{let i=e=>{var i=sZ(),a=R(i);{let e=J(()=>!n());G(a,{get onclick(){return t.onNewChat},get disabled(){return W(e)},children:(e,t)=>{var n=aZ();hl(R(n),{"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}var o=L(a,2),s=e=>{var t=oZ();iZ(L(V(t),2),{children:(e,t)=>{w();var n=M();F(()=>A(n,r)),g(e,n)},$$slots:{default:!0}}),d(t),g(e,t)};k(o,e=>{r&&e(s)}),g(e,i)},a=J(()=>n()?`Begin a conversation in the selected project to explore, plan, and build.`:`Select a project from the top header to begin a conversation.`);Gv(e,{title:`Where should we start?`,get message(){return W(a)},footer:i,$$slots:{footer:!0}})}z()}var lZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function uZ(e,t){let n=H(t,lZ),r=[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}]];P(e,B({name:`clipboard`},()=>n,{get iconNode(){return r}}))}var dZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function fZ(e,t){let n=H(t,dZ),r=[[`path`,{d:`M17 5H3`}],[`path`,{d:`M21 12H8`}],[`path`,{d:`M21 19H8`}],[`path`,{d:`M3 12v7`}]];P(e,B({name:`text-quote`},()=>n,{get iconNode(){return r}}))}function pZ(e){if(e)return e.split(`:thinking:`)[0]}function mZ(e){if(e!=null){if(typeof e==`string`)return e.trim()||void 0;try{return JSON.stringify(e,null,2)}catch{return String(e)}}}function hZ(e){let t=e.filter(e=>!!e?.trim());return t.length>0?t.join(`
138
+ `):void 0}function gZ(e,t){switch(e.kind){case`message`:case`thinking`:{let n=pZ(e.item.id),r=n?t.get(n):void 0;return{content:e.item.text,id:e.item.id,idLabel:`message id`,quote:e.item.text,entryId:r?n:void 0,entry:r}}case`tool`:{let t=mZ(e.toolCall.argsPreview),n=mZ(e.toolCall.resultPreview);return{content:hZ([e.toolCall.toolName,t?`Arguments:\n${t}`:void 0,n?`Result:\n${n}`:void 0,e.toolCall.error?`Error:\n${e.toolCall.error}`:void 0]),id:e.toolCall.id,idLabel:`tool id`,entryId:e.anchorEntryId}}case`tool_result_error`:return{content:hZ([e.toolName,e.error])};case`run_status`:return{content:hZ([`Run ${e.notice.state.replaceAll(`_`,` `)}`,e.notice.errorMessage]),id:e.notice.runId,idLabel:`run id`};case`compaction`:return{content:hZ([`Compaction ${e.notice.state}`,e.notice.summary,e.notice.text,e.notice.errorMessage]),id:e.notice.id,idLabel:`compaction id`};case`task_event`:return{content:hZ([e.notice.taskName?`Task: ${e.notice.taskName}`:`Task update`,e.notice.commandPreview,e.notice.status?`Status: ${e.notice.status}`:void 0,e.notice.exitCode===void 0?void 0:`Exit: ${e.notice.exitCode}`,e.notice.signal?`Signal: ${e.notice.signal}`:void 0]),id:e.notice.taskId??e.notice.entryId,idLabel:e.notice.taskId?`task id`:`entry id`};case`queued_prompt`:return{content:e.prompt.text,id:e.prompt.id,idLabel:`queued prompt id`}}}function _Z(e){return e.filter(e=>e.length>0).flatMap((e,t)=>t===0?e:[{type:`separator`},...e])}function vZ(e,t,n){let r=gZ(e,n.treeEntriesById),i=r.content?.trim()?r.content:void 0,a=t?.trim()?t:void 0,o=[{label:`Copy selection`,disabled:!a,onSelect:()=>{a&&n.copyText(a,`selection`)}},{label:`Copy content`,disabled:!i,onSelect:()=>{i&&n.copyText(i,`content`)}}];r.quote?.trim()&&o.push({label:`Quote`,onSelect:()=>n.quoteInComposer(r.quote??``)});let s=[];e.kind===`message`&&r.entry?.role===`user`&&n.onEditEntry&&s.push({label:`Edit message`,onSelect:()=>n.onEditEntry?.(r.entry)}),e.kind===`queued_prompt`&&s.push({label:`Edit prompt`,disabled:e.busy||!e.canEdit,onSelect:e.onEdit},{label:`Discard`,destructive:!0,disabled:e.busy||!e.canDiscard,onSelect:e.onDiscard}),r.entryId&&n.onNavigateToEntry&&s.push({label:`Continue from here`,onSelect:()=>n.onNavigateToEntry?.(r.entryId)});let c=[];return r.id&&c.push({label:`Copy ID`,onSelect:()=>void n.copyText(r.id??``,r.idLabel??`id`)}),n.onOpenHistory&&c.push({label:`Branch history`,onSelect:n.onOpenHistory}),_Z([o,s,c])}var yZ={"Copy selection":Bu,"Copy content":uZ,Quote:fZ,"Edit message":Yv,"Edit prompt":Yv,Discard:Zv,"Continue from here":kI,"Copy ID":Bu,"Branch history":oI};function bZ(e){return e.map(e=>e.type===`separator`||e.type===`label`?e:e.type===`submenu`?{...e,items:bZ(e.items)}:{...e,icon:yZ[e.label]})}function xZ(e,t,n){return bZ(vZ(e,t,n))}function SZ(e){let t={cancelled:!1},n=()=>{t.cancelled||e()};return typeof requestAnimationFrame==`function`?t.animationFrame=requestAnimationFrame(n):queueMicrotask(n),t}function CZ(e){e.cancelled=!0,e.animationFrame!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(e.animationFrame)}var wZ=class{commit;schedule;cancel;pending;hasPending=!1;frame;destroyed=!1;constructor(e,t=SZ,n=CZ){this.commit=e,this.schedule=t,this.cancel=n}enqueue(e){this.destroyed||(this.pending=e,this.hasPending=!0,this.frame===void 0&&(this.frame=this.schedule(()=>this.flushPending())))}hold(e){this.destroyed||(this.pending=e,this.hasPending=!0,this.cancelFrame())}flushNow(e){this.destroyed||(arguments.length>0&&(this.pending=e,this.hasPending=!0),this.cancelFrame(),this.flushPending())}destroy(){this.destroyed||(this.destroyed=!0,this.cancelFrame(),this.pending=void 0,this.hasPending=!1)}cancelFrame(){this.frame!==void 0&&(this.cancel(this.frame),this.frame=void 0)}flushPending(){if(this.frame=void 0,this.destroyed||!this.hasPending)return;let e=this.pending;this.pending=void 0,this.hasPending=!1,this.commit(e)}};function TZ(e){let t=Y(e.initialValue),n=e.initialScope,r=e.initialActive,i=new wZ(e=>{K(t,e)});return{get current(){return W(t)},update(e,t,a){let o=e!==n,s=t&&!r;n=e,r=t,o||s?i.flushNow(a):t?i.enqueue(a):i.hold(a)},destroy(){i.destroy()}}}function EZ(e,t){a(t,!0),Lk(VJ());let n=I(t,`pendingConversationActive`,3,!1),r=I(t,`approvals`,19,()=>[]),i=I(t,`pendingUserQuestions`,19,()=>[]),o=I(t,`pendingPlanReviews`,19,()=>[]),s=I(t,`active`,3,!0),c=I(t,`entries`,19,()=>[]),l=I(t,`optimisticMessages`,19,()=>[]),u=I(t,`toolCalls`,19,()=>[]),d=I(t,`treeNodes`,19,()=>[]),f=I(t,`queuedPrompts`,19,()=>[]),p=I(t,`live`,3,!1),m=I(t,`sending`,3,!1),h=I(t,`stopping`,3,!1),g=I(t,`composerText`,3,``),_=I(t,`models`,19,()=>[]),v=I(t,`selectedModelKey`,3,``),y=I(t,`planReviewModels`,19,()=>[]),b=I(t,`planReviewModelKey`,3,``),x=I(t,`planReviewThinkingLevel`,3,`off`),S=I(t,`contextWindow`,3,0),C=I(t,`composerFocusToken`,3,0),w=I(t,`composerEscapeToken`,3,0),T=I(t,`micShortcutToken`,3,0),E=I(t,`thinkingLevel`,3,`off`),D=I(t,`mode`,3,`coding`),O=I(t,`permissionLevel`,3,`autonomous`),ee=I(t,`approvalPolicy`,19,()=>({autoApproveReadOnly:!0})),te=I(t,`slashCompletions`,19,()=>[]),k=I(t,`composerSuggestions`,19,()=>[]),A=J(()=>Vt(u(),t.activeAgent?.id)),ne=J(()=>!!(t.activeConversation||n())),j=J(()=>t.activeProject?er(t.activeProject.dir,t.homeDir):void 0),M=J(()=>t.activeConversation?.id??(n()?t.activePendingConversation?.id??`pending`:void 0));function re(){return{entries:c(),optimisticMessages:l(),toolCalls:u(),activeRun:t.activeRun,transient:t.transient,queuedPrompts:f(),sending:m(),approvals:r(),pendingUserQuestions:i(),pendingPlanReviews:o()}}let N=TZ({initialScope:ie(()=>W(M)),initialActive:ie(()=>s()),initialValue:ie(re)});be(()=>{N.update(W(M),s(),re())}),be(()=>()=>N.destroy());let P=J(()=>N.current),ae=new Gt,oe=J(()=>ae.project({entries:W(P).entries,optimisticMessages:W(P).optimisticMessages,toolCalls:W(P).toolCalls,includeUnanchoredTerminalToolCalls:!W(P).activeRun})),se=J(()=>Rt(W(P).activeRun,W(P).transient,W(oe).context)),F=J(()=>Kt(W(oe).items,W(P).activeRun,W(P).transient,W(oe).context)),ce=J(()=>({prefix:W(F),tail:W(se)})),le=J(()=>[...W(F),...W(se)]),ue=J(()=>t.transient?.compaction?.state===`running`),de=J(()=>h()||t.activeRun?.status===`aborting`),fe=J(()=>Et(W(P).activeRun)),L=J(()=>new Map(d().map(e=>[e.entry.id,e.entry]))),pe=J(()=>dee(W(le),W(P).activeRun));async function R(e,t=`message`){try{await Ju(e),Kn.success(`Copied ${t}`)}catch{Kn.error(`Could not copy to clipboard`)}}function me(e){let n=e.split(`
139
+ `).map(e=>`> ${e}`).join(`
140
+ `),r=g()?`${g()}\n\n`:``;t.onComposerChange?.(`${r}${n}\n\n`)}function he(e,n){return xZ(e,n,{treeEntriesById:W(L),copyText:R,quoteInComposer:me,onNavigateToEntry:t.onNavigateToEntry,onEditEntry:t.onEditEntry,onOpenHistory:t.onOpenHistory})}{let a=e=>{{let a=J(()=>t.activeConversation?t.onCompact:void 0);TG(e,{get text(){return g()},get activeProject(){return t.activeProject},get activeConversation(){return t.activeConversation},get activePendingConversation(){return t.activePendingConversation},get pendingConversationActive(){return n()},get approvals(){return r()},get pendingUserQuestions(){return i()},get pendingPlanReviews(){return o()},get interactive(){return s()},get live(){return p()},get sending(){return m()},get stopping(){return W(de)},get compacting(){return W(ue)},get models(){return _()},get selectedModelKey(){return v()},get contextUsage(){return t.contextUsage},get contextWindow(){return S()},get todos(){return W(A)},get focusToken(){return C()},get composerEscapeToken(){return w()},get micShortcutToken(){return T()},get thinkingLevel(){return E()},get mode(){return D()},get permissionLevel(){return O()},get approvalPolicy(){return ee()},get slashCompletions(){return te()},get fileCompletions(){return t.fileCompletions},get composerSuggestions(){return k()},get onSendSuggestion(){return t.onSendSuggestion},get onDraftSuggestion(){return t.onDraftSuggestion},get onChange(){return t.onComposerChange},get onSubmit(){return t.onSubmit},get onAbort(){return t.onAbort},get onCompact(){return W(a)},get onModelChange(){return t.onModelChange},get onThinkingLevelChange(){return t.onThinkingLevelChange},get onModeChange(){return t.onModeChange},get onPermissionChange(){return t.onPermissionChange},get onApprovalPolicyChange(){return t.onApprovalPolicyChange}})}},c=e=>{{let n=J(()=>!!(t.activeProject&&t.onNewConversationInProject));cZ(e,{get projectSelected(){return W(n)},onNewChat:()=>{t.activeProject&&t.onNewConversationInProject?.(t.activeProject.dir)}})}},l=J(()=>({conversationId:W(M),open:W(ne),active:s(),timeline:W(ce),streamingText:W(fe),sending:W(P).sending,hasActiveTurnOutput:W(pe),queuedPrompts:W(P).queuedPrompts,approvals:W(P).approvals,pendingUserQuestions:W(P).pendingUserQuestions,pendingPlanReviews:W(P).pendingPlanReviews,activeProject:t.activeProject,activeProjectLabel:W(j),planReviewModels:y(),planReviewModelKey:b(),planReviewThinkingLevel:x(),emptyTitle:`Open a conversation or start a new one.`,composer:{text:g(),disabled:!s(),sending:m(),stopping:W(de),compacting:W(ue),models:_(),selectedModelKey:v(),thinkingLevel:E(),mode:D(),permissionLevel:O(),approvalPolicy:ee(),contextUsage:t.contextUsage,contextWindow:S(),capabilities:{voice:!0,imagePaste:!0,fileDrop:!!Fn()?.files,completions:!0,suggestions:!0,shortcuts:!0,todos:!0,queueing:!0}}})),u=J(()=>({onOpenFile:t.onOpenFile,onAnswerUserQuestion:t.onAnswerUserQuestion,onDismissUserQuestion:t.onDismissUserQuestion,onGrantApproval:t.onGrantApproval,onDenyApproval:t.onDenyApproval,onAcceptPlanReview:t.onAcceptPlanReview,onAcceptPlanReviewInNewChat:t.onAcceptPlanReviewInNewChat,onRejectPlanReview:t.onRejectPlanReview,onContinueFromFailure:t.onContinueFromFailure,onDiscardQueuedPrompt:t.onDiscardQueuedPrompt,onMoveQueuedPromptToComposer:t.onMoveQueuedPromptToComposer}));hV(e,{get model(){return W(l)},get actions(){return W(u)},menus:{transcriptMenu:he},composer:a,emptyExtension:c,$$slots:{composer:!0,emptyExtension:!0}})}z()}var DZ=N({focusToken:0,escapeToken:0,micToken:0,historyDialogOpen:!1});function OZ(){DZ.focusToken+=1}function kZ(){DZ.escapeToken+=1}function AZ(){DZ.micToken+=1}function jZ(){DZ.historyDialogOpen=!0}function MZ(e,t){return`${e}:${encodeURIComponent(t)}`}function NZ(e){Cp({kind:`file`,id:e})}async function PZ(e){let t=$r.fileViews[Jr(e)];if(t){t.loading=!0,t.error=void 0;try{t.content=await qV(t.projectId,t.path,t.line),t.path=t.content.path}catch(e){let n=e instanceof Error?e.message:String(e);t.error=n,Kn.error(`Could not open file`,{description:n})}finally{t.loading=!1}}}async function FZ(e){if(e.projectId!==Q.selectedProjectId){let{selectProject:t}=await Qx(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>SJ);return{selectProject:e}},void 0);await t(e.projectId)}let t=MZ(e.projectId,e.path),n=Jr(t);NZ(t),$r.fileViews[n]??={id:t,projectId:e.projectId,path:e.path,line:e.line,loading:!1},$r.fileViews[n].line=e.line,Op({kind:`file`,id:t}),await PZ(t)}async function IZ(e){let t=$r.fileViews[Jr(e)];t&&(NZ(e),Op({kind:`file`,id:e}),!t.content&&!t.loading&&await PZ(e))}async function LZ(e){await PZ(e)}function RZ(e){let t=$r.fileViews[Jr(e)];t&&(t.displayMode=(t.displayMode??wf(t.content?.relativePath??t.path))===`raw`?`rendered`:`raw`)}function zZ(e){let t=$r.fileViews[Jr(e)];t&&(t.wrapLines=!t.wrapLines)}function BZ(e){let t=new ye(Object.values($r.fileViews).filter(t=>{let n=t.content?.relativePath??t.path;return t.projectId===e.projectId&&(n===e.path||e.descendants&&n.startsWith(`${e.path}/`))}).map(e=>e.id));if(t.size===0)return;let n=Q.activeCenterTab,r=n?.kind===`file`&&t.has(n.id),i=Q.openCenterTabs.filter(e=>e.kind!==`file`||!t.has(e.id));for(let e of t)delete $r.fileViews[Jr(e)];Sp(i),r&&Ap(i.at(-1))}function VZ(e){let t={kind:`file`,id:e},n=Q.activeCenterTab?.kind===`file`&&Q.activeCenterTab.id===e,r=Tp(t);Ep(t),delete $r.fileViews[Jr(e)],n&&Ap(r)}var HZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function UZ(e,t){let n=H(t,HZ),r=[[`circle`,{cx:`12`,cy:`12`,r:`3`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`}]];P(e,B({name:`git-commit-horizontal`},()=>n,{get iconNode(){return r}}))}function WZ(e){return JSON.stringify({projectId:e.projectId,projectIsRepo:e.projectIsRepo,repos:e.repos.map(e=>({relativePath:e.relativePath,currentBranch:e.currentBranch,detached:e.detached,ahead:e.ahead,behind:e.behind,hasUpstream:e.hasUpstream,hasRemote:e.hasRemote,hasGithubRemote:e.hasGithubRemote,baseBranch:e.baseBranch,onBaseBranch:e.onBaseBranch,mergedToBase:e.mergedToBase,dirty:e.dirty,changeCount:e.changeCount})),github:e.github?{available:e.github.available,authenticated:e.github.authenticated}:void 0})}function GZ(e){return e?.status===`pending`}function KZ(e){return e.some(e=>GZ(e.checks))}var qZ={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},JZ=class{cooldownMs;dispatch;clock;#e=new Map;constructor(e,t,n=qZ){this.cooldownMs=e,this.dispatch=t,this.clock=n}schedule(e,t){let n=this.#t(e);n.pending.overview||=!!t.overview,n.pending.prs||=!!t.prs,this.#n(n)}noteDirectStart(e,t){let n=this.#t(e),r=this.clock.now();for(let e of YZ(t))n.lastStartedAt[e]=r,n.pending[e]=!1;this.#r(n)}#t(e){let t=this.#e.get(e);if(t)return t;let n={key:e,pending:{overview:!1,prs:!1},lastStartedAt:{overview:void 0,prs:void 0}};return this.#e.set(e,n),n}#n(e){let t=this.clock.now(),n={};for(let r of YZ(e.pending)){let i=e.lastStartedAt[r];(i===void 0||t-i>=this.cooldownMs[r])&&(n[r]=!0,e.pending[r]=!1,e.lastStartedAt[r]=t)}this.#r(e),(n.overview||n.prs)&&this.dispatch(e.key,n)}#r(e){e.timer!==void 0&&(this.clock.clearTimeout(e.timer),e.timer=void 0);let t=this.clock.now(),n=YZ(e.pending).map(n=>{let r=e.lastStartedAt[n];return r===void 0?0:Math.max(0,this.cooldownMs[n]-(t-r))});n.length!==0&&(e.timer=this.clock.setTimeout(()=>{e.timer=void 0,this.#n(e)},Math.min(...n)))}};function YZ(e){return Object.keys(e).filter(t=>!!e[t])}function XZ(e,t){return e.reposRequestInFlight?(e.activeRequestLoadsDetails||=t,!0):!1}function ZZ(e){return[e.status,e.total,e.passed,e.failed,e.pending,e.runs.map(e=>`${e.name}:${e.status}`).sort().join(`|`)].join(`,`)}function QZ(e){return[e.number,e.title,e.url,e.state,e.isDraft,e.headRefName,e.baseRefName,e.updatedAt,ZZ(e.checks)].join(`\0`)}function $Z(e,t){return e!==void 0&&ZZ(e)===ZZ(t)}function eQ(e,t){return e.number===t.number&&e.title===t.title&&e.url===t.url&&e.state===t.state&&e.isDraft===t.isDraft&&e.headRefName===t.headRefName&&e.baseRefName===t.baseRefName&&e.updatedAt===t.updatedAt}function tQ(e){return JSON.stringify({relativePath:e.relativePath,absDir:e.absDir,name:e.name,currentBranch:e.currentBranch,detached:e.detached,ahead:e.ahead,behind:e.behind,hasUpstream:e.hasUpstream,hasRemote:e.hasRemote,hasGithubRemote:e.hasGithubRemote,baseBranch:e.baseBranch,onBaseBranch:e.onBaseBranch,mergedToBase:e.mergedToBase,dirty:e.dirty,changeCount:e.changeCount})}function nQ(e){return{files:e.files,stagedCount:e.stagedCount,unstagedCount:e.unstagedCount,untrackedCount:e.untrackedCount,insertions:e.insertions,deletions:e.deletions}}function rQ(e){return JSON.stringify({counts:{staged:e.stagedCount,unstaged:e.unstagedCount,untracked:e.untrackedCount,insertions:e.insertions,deletions:e.deletions},files:e.files.map(e=>({path:e.path,renamedFrom:e.renamedFrom,index:e.index,worktree:e.worktree,staged:e.staged,untracked:e.untracked}))})}function iQ(e){return JSON.stringify(e.map(e=>({hash:e.hash,subject:e.subject,relativeDate:e.relativeDate})))}function aQ(e){return JSON.stringify(e.map(e=>({name:e.name,current:e.current,remote:e.remote,upstream:e.upstream})))}function oQ(e){if(e)return JSON.stringify({available:e.available,authenticated:e.authenticated,login:e.login,reason:e.reason})}function sQ(e){return e.map(QZ).join(`
141
+ `)}function cQ(e){return JSON.stringify(e.map(e=>tQ(e)))}var lQ=N({projects:{}}),uQ=8,dQ=new ye;function fQ(e,t,n){return`${e}:${encodeURIComponent(t)}:${n}`}function pQ(e,t,n){return n.filter(n=>!dQ.has(fQ(e,t,n.number)))}function mQ(){return{fetching:!1,pulling:!1,pushing:!1,syncing:!1,switchingBaseAndPulling:!1,switchingBranch:void 0,creatingBranch:!1,fileMutation:void 0,bulkMutation:void 0}}function hQ(e,t){return{repoSummary:void 0,changes:void 0,recentCommits:[],github:void 0,prs:[],prFilters:e&&t?bQ(e,t):BY,branches:[],operations:mQ(),loadingOverview:!1,loadingPrs:!1,prsError:void 0,loadingBranches:!1,prsRequestInFlight:!1,prsRefreshQueued:!1,prsQueuedVisible:!1,prsRequestSeq:0,overviewRequestInFlight:!1,overviewRefreshQueued:!1,overviewInvalidated:!1,lastRepoSummaryFingerprint:void 0,lastChangesFingerprint:void 0,lastRecentCommitsFingerprint:void 0,lastBranchesFingerprint:void 0,lastPrsFingerprint:void 0,lastGithubFingerprint:void 0,loaded:!1,loadedAt:void 0,prsLoadedAt:void 0,requestSeq:0}}function gQ(e){return{projectId:e.id,projectDir:e.dir,projectIsRepo:!1,repos:[],selectedRepo:`.`,repoStates:{},discoverError:void 0,loadingRepos:!1,refreshingRepos:!1,reposRequestInFlight:!1,activeRequestLoadsDetails:!1,projectRefreshQueued:!1,queuedRefreshLoadsDetails:!1,lastReposFingerprint:void 0,loaded:!1,loadedAt:void 0,requestSeq:0,touchedAt:Date.now()}}function _Q(e){return`nerve.git.repo.${e}`}function vQ(e,t){return`nerve.git.prFilters.${e}.${encodeURIComponent(t)}`}function yQ(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return[`any`,`me`,`username`].includes(String(t.author))&&typeof t.username==`string`&&[`include`,`exclude`,`only`].includes(String(t.drafts))&&typeof t.title==`string`&&typeof t.currentBranchOnly==`boolean`&&Array.isArray(t.labels)&&t.labels.every(e=>typeof e==`string`)&&[`updated-desc`,`updated-asc`].includes(String(t.sort))}function bQ(e,t){if(typeof localStorage>`u`)return BY;try{let n=localStorage.getItem(vQ(e,t));if(!n)return BY;let r=JSON.parse(n);return yQ(r)?VY(r):BY}catch{return BY}}function xQ(e,t,n){if(!(typeof localStorage>`u`))try{localStorage.setItem(vQ(e,t),JSON.stringify(VY(n)))}catch{}}function SQ(e){let t=lQ.projects[Kr(e)];t&&(t.touchedAt=Date.now(),CQ())}function CQ(){let e=Object.values(lQ.projects).sort((e,t)=>t.touchedAt-e.touchedAt);for(let t of e.slice(uQ))delete lQ.projects[Kr(t.projectId)]}function wQ(e){let t=Kr(e.id);lQ.projects[t]??=gQ(e);let n=lQ.projects[t];return n.projectDir!==e.dir&&(n.projectDir=e.dir),SQ(e.id),n}function TQ(e,t){let n=lQ.projects[Kr(e)];if(!n)return hQ();let r=Xr(t);return n.repoStates[r]??=hQ(e,t),n.repoStates[r]}function EQ(e){if(e instanceof Error){try{let t=JSON.parse(e.message);if(t?.error?.message)return String(t.error.message)}catch{}return e.message}return String(e)}function DQ(e){let t=e?.operations;return!!(t&&(t.fetching||t.pulling||t.pushing||t.syncing||t.switchingBaseAndPulling||t.creatingBranch||t.switchingBranch||t.fileMutation||t.bulkMutation))}function OQ(e,t){let n=tQ(t);return e.lastRepoSummaryFingerprint===n&&e.repoSummary?!1:(e.repoSummary=t,e.lastRepoSummaryFingerprint=n,!0)}function kQ(e,t){let n=rQ(t);return e.lastChangesFingerprint===n&&e.changes?!1:(e.changes=t,e.lastChangesFingerprint=n,!0)}function AQ(e,t){let n=iQ(t);return e.lastRecentCommitsFingerprint===n?!1:(e.recentCommits=t,e.lastRecentCommitsFingerprint=n,!0)}function jQ(e,t){let n=OQ(e,t.repo),r=kQ(e,nQ(t)),i=AQ(e,t.recentCommits),a=n||r||i;return e.loaded||=!0,e.loadedAt=Date.now(),{changed:a,repoChanged:n,changesChanged:r,recentCommitsChanged:i}}function MQ(e,t){let n=cQ(t);return e.lastReposFingerprint===n?!1:(e.repos=t,e.lastReposFingerprint=n,!0)}function NQ(e,t){let n=aQ(t);return e.lastBranchesFingerprint===n?!1:(e.branches=t,e.lastBranchesFingerprint=n,!0)}function PQ(e,t){let n=oQ(t);return e.lastGithubFingerprint===n?!1:(e.github=t,e.lastGithubFingerprint=n,!0)}function FQ(e,t){let n=sQ(t);return e.lastPrsFingerprint===n?!1:(e.prs=t,e.lastPrsFingerprint=n,!0)}function IQ(e,t,n){return lQ.projects[Kr(e)]?.repoStates[Xr(t)]?.prs.find(e=>e.number===n)}function LQ(e,t,n){let r=lQ.projects[Kr(e)]?.repoStates[Xr(t)];r&&r.prs.find(e=>e.number===n.number)&&FQ(r,r.prs.map(e=>e.number===n.number?{...e,title:n.title,url:n.url,state:n.state,isDraft:n.isDraft,headRefName:n.headRefName,baseRefName:n.baseRefName,updatedAt:n.updatedAt}:e))}function RQ(e,t,n,r){let i=lQ.projects[Kr(e)]?.repoStates[Xr(t)];i&&FQ(i,i.prs.map(e=>e.number===n?{...e,checks:r}:e))}function zQ(e,t,n){dQ.add(fQ(e,t,n));let r=lQ.projects[Kr(e)]?.repoStates[Xr(t)];r&&FQ(r,r.prs.filter(e=>e.number!==n))}function BQ(e,t){let n=lQ.projects[Kr(e)];if(!n)return;let r=n.repos.find(e=>e.relativePath===t.relativePath);r?tQ(r)!==tQ(t)&&MQ(n,n.repos.map(e=>e.relativePath===t.relativePath?t:e)):MQ(n,[...n.repos,t]);let i=n.repoStates[Xr(t.relativePath)];i&&OQ(i,t),i&&(!t.hasRemote||!t.hasGithubRemote)&&UQ(e,i),qQ(e)}function VQ(e,t){let n=lQ.projects[Kr(e)];if(n)return n.repoStates[Xr(t)]?.repoSummary??n.repos.find(e=>e.relativePath===t)}function HQ(e,t){let n=VQ(e,t);return!!(n?.hasRemote&&n.hasGithubRemote)}function UQ(e,t){let n=!1;(t.github!==void 0||t.lastGithubFingerprint!==void 0)&&(t.github=void 0,t.lastGithubFingerprint=void 0,n=!0);let r=sQ([]);(t.prs.length>0||t.lastPrsFingerprint!==void 0&&t.lastPrsFingerprint!==r)&&(t.prs=[],t.lastPrsFingerprint=r,n=!0),t.loadingPrs&&(t.loadingPrs=!1,n=!0),t.prsRequestInFlight&&(t.prsRequestInFlight=!1,n=!0),t.prsRefreshQueued&&(t.prsRefreshQueued=!1,n=!0),t.prsQueuedVisible&&(t.prsQueuedVisible=!1,n=!0),t.prsError&&(t.prsError=void 0,n=!0),n&&qQ(e)}function WQ(e){if(!(typeof localStorage>`u`))return localStorage.getItem(_Q(e))??void 0}function GQ(e,t){typeof localStorage>`u`||localStorage.setItem(_Q(e),t)}function KQ(e){if(!e.loaded&&e.repos.length===0)return;let t=e.repoStates[Xr(e.selectedRepo)];return{projectId:e.projectId,projectIsRepo:e.projectIsRepo,repos:e.repos,github:t?.github?{available:t.github.available,authenticated:t.github.authenticated}:void 0,loadedAt:e.loadedAt??Date.now()}}function qQ(e){let t=lQ.projects[Kr(e)];if(!t)return;let n=KQ(t);if(!n)return;let r=tr.gitContext;(!r||r.projectId!==n.projectId||WZ(r)!==WZ(n))&&(tr.gitContext=n)}var JQ=3e4,YQ=3e3,XQ=3e4,ZQ=5*6e4,QQ=1e4;function $Q(e){return JSON.stringify({author:e.author,username:e.username??``,drafts:e.drafts,title:e.title,head:e.head??``,labels:[...e.labels].sort(),sort:e.sort})}function e$(e,t,n){return e!==void 0&&t-e<n}function t$(e){if(!e.visible)return{pollActiveDetail:!1,pollList:!1};let t=e.prs.filter(e=>e.checks.status===`pending`),n=e.activePrPending;return{pollActiveDetail:n,pollList:t.some(t=>t.number!==e.activePrNumber)||!n&&t.length>0}}function n$(e,t,n){return JSON.stringify([e,t,n.path,n.previousPath??``,n.status])}var r$=JQ,i$=6e4,a$=1/0,o$=5*6e4,s$=new se,c$=new se;function l$(e){let t=JSON.stringify(e),n=(c$.get(t)??0)+1;return c$.set(t,n),n}function u$(e,t){return c$.get(JSON.stringify(e))===t}function d$(e){return e instanceof Error?e.message:String(e)}async function f$(e){let t=JSON.stringify(e.key),n=s$.get(t);if(n)return n;let r=l$(e.key);if(!e.options?.force){let t=PG.getQueryState(e.key),n=PG.getQueryData(e.key);if(n!==void 0&&u$(e.key,r)&&(e.resource.data!==n&&(e.resource.data=n,e.apply?.(n)),e.resource.error=void 0),n!==void 0&&t?.dataUpdatedAt!==void 0&&Date.now()-t.dataUpdatedAt<e.staleTime)return n}let i=(async()=>{let t=e.resource.data!==void 0;e.resource.loading=!t,e.resource.refreshing=t,e.options?.silent||(e.resource.error=void 0);try{e.options?.force&&await PG.invalidateQueries({queryKey:e.key});let t=await PG.fetchQuery({queryKey:e.key,queryFn:e.query,staleTime:e.staleTime,gcTime:o$});return u$(e.key,r)&&(e.resource.data!==t&&(e.resource.data=t,e.apply?.(t)),e.resource.error=void 0),t}catch(n){u$(e.key,r)&&(!e.options?.silent||!t)&&(e.resource.error=d$(n));return}finally{u$(e.key,r)&&(e.resource.loading=!1,e.resource.refreshing=!1)}})();s$.set(t,i);try{return await i}finally{s$.get(t)===i&&s$.delete(t)}}function p$(e){let t=e?.core.data,n=e?.files.data?.files.find(t=>t.path===e.selectedFilePath);if(!(!e||!t||!n))return e.fileDiffs[n$(t.baseRefOid,t.headRefOid,n)]}async function m$(e,t,n){let r=e.core.data,i=e.files.data?.files.find(e=>e.path===t);if(!r||!i)return;let a=n$(r.baseRefOid,r.headRefOid,i);e.fileDiffs[a]??={loading:!1,refreshing:!1};let o=e.fileDiffs[a];return f$({key:FG.git.prFileDiff(e.projectId,e.repo,e.number,r.baseRefOid,r.headRefOid,i.path,i.previousPath,i.status),query:()=>vH({projectId:e.projectId,repo:e.repo,number:e.number,path:i.path,...i.previousPath?{previousPath:i.previousPath}:{},status:i.status,expectedBaseRefOid:r.baseRefOid,expectedHeadRefOid:r.headRefOid,...r.headRepository?{expectedHeadRepository:r.headRepository}:{}}),staleTime:a$,resource:o,options:n})}function h$(e,t){return FG.git.prSection(e.projectId,e.repo,e.number,t)}function g$(e,t){LQ(e.projectId,e.repo,t),v$(e)}function _$(e,t){v$(e,t.mergeSettings.allowedMethods)}function v$(e,t=e.overview.data?.mergeSettings.allowedMethods??[]){(!e.selectedMergeMethod||!t.includes(e.selectedMergeMethod))&&(e.selectedMergeMethod=[`merge`,`squash`,`rebase`].find(e=>t.includes(e)))}function y$(e){if(!u$(e.key,e.version)||(PG.getQueryState(e.key)?.dataUpdatedAt??0)>e.initialUpdatedAt)return;let t=PG.setQueryData(e.key,e.data)??e.data;e.resource.data!==t&&(e.resource.data=t,e.apply?.(t)),e.resource.error=void 0}async function b$(e,t={}){let n=FG.git.prInitial(e.projectId,e.repo,e.number),r=JSON.stringify(n),i=s$.get(r);if(i)return i;let a=h$(e,`core`),o=h$(e,`conversation`),s=h$(e,`overview`),c={core:l$(a),conversation:l$(o),overview:l$(s)},l=t=>{let r=PG.getQueryState(n)?.dataUpdatedAt??Date.now();y$({key:a,version:c.core,initialUpdatedAt:r,resource:e.core,data:t.core,apply:t=>g$(e,t)}),y$({key:o,version:c.conversation,initialUpdatedAt:r,resource:e.conversation,data:t.conversation}),y$({key:s,version:c.overview,initialUpdatedAt:r,resource:e.overview,data:t.overview,apply:t=>_$(e,t)})};if(!t.force){let e=PG.getQueryState(n),t=PG.getQueryData(n);if(t!==void 0&&l(t),t!==void 0&&e?.dataUpdatedAt!==void 0&&Date.now()-e.dataUpdatedAt<r$)return t}let u=[e.core,e.conversation,e.overview];for(let e of u){let n=e.data!==void 0;e.loading=!n,e.refreshing=n,t.silent||(e.error=void 0)}let d=(async()=>{try{t.force&&await PG.invalidateQueries({queryKey:n});let r=await PG.fetchQuery({queryKey:n,queryFn:()=>fH(e.projectId,e.repo,e.number),staleTime:r$,gcTime:o$});return l(r),r}catch(n){let r=d$(n);for(let[n,i,l]of[[e.core,a,c.core],[e.conversation,o,c.conversation],[e.overview,s,c.overview]])u$(i,l)&&(!t.silent||n.data===void 0)&&(n.error=r);return}finally{for(let[t,n,r]of[[e.core,a,c.core],[e.conversation,o,c.conversation],[e.overview,s,c.overview]])u$(n,r)&&(t.loading=!1,t.refreshing=!1)}})();s$.set(r,d);try{return await d}finally{s$.get(r)===d&&s$.delete(r)}}async function x$(e,t={}){return f$({key:FG.git.prSection(e.projectId,e.repo,e.number,`core`),query:()=>pH(e.projectId,e.repo,e.number),staleTime:r$,resource:e.core,options:t,apply:t=>g$(e,t)})}async function S$(e,t,n={}){if(t===`conversation`)return f$({key:FG.git.prSection(e.projectId,e.repo,e.number,`conversation`),query:()=>mH(e.projectId,e.repo,e.number),staleTime:i$,resource:e.conversation,options:n});if(t===`overview`)return f$({key:FG.git.prSection(e.projectId,e.repo,e.number,`overview`),query:()=>hH(e.projectId,e.repo,e.number),staleTime:r$,resource:e.overview,options:n,apply:t=>_$(e,t)});if(t===`checks`)return f$({key:FG.git.prSection(e.projectId,e.repo,e.number,`checks`),query:()=>_H(e.projectId,e.repo,e.number),staleTime:e.checks.data?.checks.status===`pending`?0:r$,resource:e.checks,options:n,apply:({checks:t})=>RQ(e.projectId,e.repo,e.number,t)});let r=e.core.data?.baseRefOid,i=e.core.data?.headRefOid;if(!(!r||!i))return f$(t===`commits`?{key:FG.git.prHeadSection(e.projectId,e.repo,e.number,`commits`,i),query:()=>gH(e.projectId,e.repo,e.number),staleTime:a$,resource:e.commits,options:n}:{key:FG.git.prFiles(e.projectId,e.repo,e.number,r,i),query:()=>yH(e.projectId,e.repo,e.number),staleTime:a$,resource:e.files,options:n,apply:t=>{(!e.selectedFilePath||!t.files.some(t=>t.path===e.selectedFilePath))&&(e.selectedFilePath=t.files[0]?.path),e.selectedFilePath&&m$(e,e.selectedFilePath,{silent:!0})}})}function C$(e){if(e.activeTab===`conversation`){Promise.all([S$(e,`conversation`,{silent:!0}),S$(e,`overview`,{silent:!0}),...e.checks.data?[]:[S$(e,`checks`,{silent:!0})]]);return}S$(e,e.activeTab,{silent:!0})}async function w$(e){if(e.refreshing)return;e.refreshing=!0,e.refreshError=void 0;let t=e.core.data?.baseRefOid,n=e.core.data?.headRefOid;try{await x$(e,{force:!0}),t&&n&&e.core.data?.baseRefOid&&e.core.data?.headRefOid&&(t!==e.core.data?.baseRefOid||n!==e.core.data?.headRefOid)&&(e.commits.data=void 0,e.commits.error=void 0,e.files.data=void 0,e.files.error=void 0,e.fileDiffs={},e.selectedFilePath=void 0);let r=e.activeTab===`conversation`?[`conversation`,`overview`,`checks`]:[e.activeTab];await Promise.all(r.map(t=>S$(e,t,{force:!0}))),e.refreshError=e.core.error??r.map(t=>e[t].error).find(Boolean)}finally{e.refreshing=!1}}var T$,E$,D$;function O$(e){T$=e}function k$(){if(typeof document<`u`&&document.visibilityState!==`visible`)return;let e=T$?tr.prViews[qr(T$)]:void 0;e?.checks.data?.checks.status===`pending`&&!e.checks.loading&&!e.checks.refreshing&&S$(e,`checks`,{force:!0,silent:!0})}function A$(){k$(),document.visibilityState===`visible`&&D$?.()}function j$(e){return typeof window>`u`||E$!==void 0?M$:(D$=e,E$=window.setInterval(k$,QQ),window.addEventListener(`focus`,A$),document.addEventListener(`visibilitychange`,A$),M$)}function M$(){typeof window>`u`||(E$!==void 0&&window.clearInterval(E$),E$=void 0,D$=void 0,window.removeEventListener(`focus`,A$),document.removeEventListener(`visibilitychange`,A$))}async function N$(e){e.core.data&&(e.core.data={...e.core.data,state:`MERGED`}),zQ(e.projectId,e.repo,e.number);let t=[`git`,e.projectId,`repo`,e.repo,`prs`];for(let[n,r]of PG.getQueriesData({queryKey:t}))r&&PG.setQueryData(n,{...r,prs:r.prs.filter(t=>t.number!==e.number)});await PG.invalidateQueries({queryKey:FG.git.pr(e.projectId,e.repo,e.number)}),await PG.invalidateQueries({queryKey:t})}function P$(e,t,n){return`${e}:${encodeURIComponent(t)}:${n}`}function F$(){return{loading:!1,refreshing:!1}}function I$(e){return{...e,core:F$(),conversation:F$(),overview:F$(),commits:F$(),checks:F$(),files:F$(),fileDiffs:{},activeTab:`conversation`,refreshing:!1,merging:!1}}function L$(e){Cp({kind:`pr`,id:e})}async function R$(e){if(e.activeTab===`conversation`&&(!e.core.data||!e.conversation.data||!e.overview.data)){await b$(e,{silent:!!(e.core.data||e.conversation.data||e.overview.data)})&&C$(e);return}await x$(e,{silent:!!e.core.data}),C$(e)}function z$(e,t,n){for(let r of Object.values(tr.prViews)){if(r.projectId!==e||r.repo!==t)continue;let i=n.find(e=>e.number===r.number);i&&(r.summary=i,$Z(r.checks.data?.checks,i.checks)||(r.checks.data={checks:i.checks}),r.core.data&&!eQ(r.core.data,i)&&(r.core.data={...r.core.data,title:i.title,url:i.url,state:i.state,isDraft:i.isDraft,headRefName:i.headRefName,baseRefName:i.baseRefName,updatedAt:i.updatedAt}))}}async function B$(e){if(e.projectId!==Q.selectedProjectId){let{selectProject:t}=await Qx(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>SJ);return{selectProject:e}},void 0);await t(e.projectId)}let t=P$(e.projectId,e.repo,e.number),n=qr(t);L$(t);let r=IQ(e.projectId,e.repo,e.number);tr.prViews[n]??=I$({id:t,...e,summary:r});let i=tr.prViews[n];r&&(i.summary=r),r&&!i.checks.data&&(i.checks.data={checks:r.checks}),Op({kind:`pr`,id:t}),await R$(i)}async function V$(e){let t=tr.prViews[qr(e)];t&&(L$(e),Op({kind:`pr`,id:e}),await R$(t))}async function H$(e){let t=tr.prViews[qr(e)];t&&await w$(t)}function U$(e,t){let n=tr.prViews[qr(e)];n&&(n.activeTab=t,C$(n))}function W$(e,t){let n=tr.prViews[qr(e)];n&&(n.selectedFilePath=t,m$(n,t,{silent:!0}))}function G$(e){let t=tr.prViews[qr(e)];t?.selectedFilePath&&m$(t,t.selectedFilePath,{force:!0})}function K$(e,t){let n=tr.prViews[qr(e)];n&&(n.selectedMergeMethod=t)}function q$(e){let t={kind:`pr`,id:e},n=Q.activeCenterTab?.kind===`pr`&&Q.activeCenterTab.id===e,r=Tp(t);Ep(t),delete tr.prViews[qr(e)],n&&Ap(r)}function J$(e,t){return JSON.stringify([e,t])}var Y$=new ye,X$=new JZ({overview:YQ,prs:XQ},(e,t)=>{let[n,r]=JSON.parse(e),i=TQ(n,r);if(DQ(i)){X$.schedule(e,t);return}Promise.all([...t.overview?[n1(n,r,{force:!0,silent:!0,onlyIfChanged:!0})]:[],...t.prs&&i.github?.authenticated?[s1(n,r,!0,!0)]:[]])});function Z$(e,t,n){let r=J$(e,t);n?Y$.add(r):Y$.delete(r)}function Q$(e,t){let n=lQ.projects[Kr(e)]?.repoStates[Xr(t)];n&&(n.overviewInvalidated=!0,Y$.has(J$(e,t))&&(typeof document>`u`||document.visibilityState===`visible`)&&$$(e,t,{overview:!0}))}function $$(e,t,n){X$.schedule(J$(e,t),n)}function e1(e,t){if(!e)return;let n=lQ.projects[Kr(e)];n?.selectedRepo&&$$(e,n.selectedRepo,t)}async function t1(e,t={}){let n=wQ(e),r=t.loadDetails!==!1;if(XZ(n,r)){t.force&&(n.projectRefreshQueued=!0,n.queuedRefreshLoadsDetails||=r);return}let i=n.requestSeq+1;n.requestSeq=i,n.reposRequestInFlight=!0,n.activeRequestLoadsDetails=r,n.discoverError=void 0;let a=!n.loaded&&!t.silent;n.loadingRepos=a,n.refreshingRepos=!a&&!t.silent;try{t.force&&await PG.invalidateQueries({queryKey:FG.git.repos(e.id)});let r=await PG.fetchQuery({queryKey:FG.git.repos(e.id),queryFn:()=>JV(e.id),staleTime:JQ});if(n.requestSeq!==i)return;n.projectIsRepo!==r.projectIsRepo&&(n.projectIsRepo=r.projectIsRepo),MQ(n,r.repos);for(let t of r.repos)TQ(e.id,t.relativePath);let a=WQ(e.id),o=r.repos.some(e=>e.relativePath===n.selectedRepo),s=r.repos[0]?.relativePath??`.`,c=n.selectedRepo;if(a&&r.repos.some(e=>e.relativePath===a)?c=a:o||(c=s),n.selectedRepo!==c&&(n.selectedRepo=c),n.loaded||=!0,n.loadedAt=Date.now(),qQ(e.id),r.repos.length>0&&n.activeRequestLoadsDetails){let t=TQ(e.id,n.selectedRepo).loaded?{silent:!0,onlyIfChanged:!0}:{};await Promise.all([n1(e.id,n.selectedRepo,t),i1(e.id,n.selectedRepo),s1(e.id,n.selectedRepo,!0,!1,!0)])}}catch(e){if(n.requestSeq!==i)return;n.discoverError=EQ(e),n.loaded||MQ(n,[])}finally{if(n.requestSeq===i&&(n.loadingRepos=!1,n.refreshingRepos=!1,n.reposRequestInFlight=!1,n.activeRequestLoadsDetails=!1,n.projectRefreshQueued)){let t=n.queuedRefreshLoadsDetails;n.projectRefreshQueued=!1,n.queuedRefreshLoadsDetails=!1,queueMicrotask(()=>void t1(e,{force:!1,silent:!0,onlyIfChanged:!0,loadDetails:t}))}}}async function n1(e,t,n={}){let r=TQ(e,t);if(r.overviewRequestInFlight){n.force&&(r.overviewRefreshQueued=!0);return}X$.noteDirectStart(J$(e,t),{overview:!0});let i=r.requestSeq+1;r.requestSeq=i,r.overviewRequestInFlight=!0,n.silent||(r.loadingOverview=!0),r.overviewInvalidated=!1;try{n.force&&await PG.invalidateQueries({queryKey:FG.git.overview(e,t)});let a=await PG.fetchQuery({queryKey:FG.git.overview(e,t),queryFn:()=>YV(e,t),staleTime:JQ});if(r.requestSeq!==i)return;BQ(e,a.repo),jQ(r,a)}catch(e){r.overviewInvalidated=!0,n.silent||Kn.error(`Git overview failed: ${EQ(e)}`)}finally{r.requestSeq===i&&(n.silent||(r.loadingOverview=!1),r.overviewRequestInFlight=!1,r.overviewRefreshQueued&&(r.overviewRefreshQueued=!1,queueMicrotask(()=>void n1(e,t,{silent:!0,onlyIfChanged:!0}))))}}async function r1(e,t){let n=TQ(e,t);n.loadingBranches=!0;try{NQ(n,(await PG.fetchQuery({queryKey:FG.git.branches(e,t),queryFn:()=>ZV(e,t),staleTime:JQ})).branches)}catch(e){Kn.error(`Could not list branches: ${EQ(e)}`)}finally{n.loadingBranches=!1}}async function i1(e,t,n=!1){let r=TQ(e,t);if(!HQ(e,t)){UQ(e,r);return}try{let i=FG.git.githubStatus(e,t);n&&await PG.invalidateQueries({queryKey:i});let a=await PG.fetchQuery({queryKey:i,queryFn:()=>lH(e,t),staleTime:r.github?.authenticated?ZQ:JQ});PQ(r,a),qQ(e),a.authenticated?await s1(e,t,!0,n):FQ(r,[])}catch(t){PQ(r,{available:!1,authenticated:!1,login:null,reason:EQ(t)}),FQ(r,[]),qQ(e)}}var a1=new se;function o1(e){return{author:e.prFilters.author,...e.prFilters.author===`username`?{username:e.prFilters.username}:{},drafts:e.prFilters.drafts,title:e.prFilters.title,...e.prFilters.currentBranchOnly&&e.repoSummary?.currentBranch?{head:e.repoSummary.currentBranch}:{},labels:[...e.prFilters.labels],sort:e.prFilters.sort}}async function s1(e,t,n=!1,r=!1,i=!n){let a=TQ(e,t);if(!HQ(e,t)){UQ(e,a);return}let o=J$(e,t),s=a1.get(o);if(s)return a.prsRefreshQueued||=r,a.prsQueuedVisible||=i,i&&(a.loadingPrs=!0,a.prsError=void 0),s;i&&(a.loadingPrs=!0,a.prsError=void 0),a.prsRequestInFlight=!0,X$.noteDirectStart(o,{prs:!0});let c=(async()=>{let i=n,o=r;try{do{a.prsRefreshQueued=!1,a.prsQueuedVisible=!1;let n=a.prsRequestSeq+1;a.prsRequestSeq=n;try{let r=o1(a),i=FG.git.prs(e,t,$Q(r));o&&await PG.invalidateQueries({queryKey:i});let s=await PG.fetchQuery({queryKey:i,queryFn:()=>uH(e,t,r),staleTime:KZ(a.prs)?QQ:JQ});if(a.prsRequestSeq===n&&$Q(r)===$Q(o1(a))){let n=pQ(e,t,s.prs);FQ(a,n),z$(e,t,n),a.prsError=void 0,a.prsLoadedAt=Date.now()}}catch(e){a.prsRequestSeq===n&&!i&&(a.prsError=EQ(e),Kn.error(`Could not list PRs: ${a.prsError}`))}o=a.prsRefreshQueued,i=!a.prsQueuedVisible}while(a.prsRefreshQueued&&(typeof document>`u`||document.visibilityState===`visible`))}finally{a.prsRequestInFlight=!1,a.prsRefreshQueued=!1,a.prsQueuedVisible=!1,a.loadingPrs=!1}})();a1.set(o,c);try{await c}finally{a1.get(o)===c&&a1.delete(o)}}function c1(e,t){if(typeof document<`u`&&document.visibilityState!==`visible`)return;let n=lQ.projects[Kr(e)]?.repoStates[Xr(t)];if(n?.overviewInvalidated){$$(e,t,{overview:!0});return}!n||e$(n.loadedAt,Date.now(),3e4)||$$(e,t,{overview:!0})}function l1(e,t){if(typeof document<`u`&&document.visibilityState!==`visible`)return;let n=lQ.projects[Kr(e)]?.repoStates[Xr(t)];!n?.github?.authenticated||e$(n.prsLoadedAt,Date.now(),6e4)||$$(e,t,{prs:!0})}function u1(e){let t=wQ(e);if(!t.loaded){t1(e);return}t.reposRequestInFlight||t1(e,{silent:!0,onlyIfChanged:!0})}function d1(e,t){let n=lQ.projects[Kr(e)];if(!n||t===n.selectedRepo)return;n.selectedRepo=t,GQ(e,t);let r=TQ(e,t);r.loaded?DQ(r)||(n1(e,t,{silent:!0,onlyIfChanged:!0}),r.github?.authenticated&&s1(e,t,!0)):(n1(e,t),i1(e,t)),qQ(e)}function f1(e,t){$$(e,t,{overview:!0,prs:!0})}function p1(e,t){Kn.error(e,{description:EQ(t)})}async function m1(e,t){let n=TQ(e,t);n.operations.fetching=!0;try{BQ(e,(await rH(e,t)).repo),Kn.success(`Fetched from remote`),f1(e,t)}catch(e){p1(`Fetch failed`,e)}finally{n.operations.fetching=!1}}async function h1(e,t){let n=TQ(e,t);n.operations.pulling=!0;try{BQ(e,(await nH(e,t)).repo),Kn.success(`Pulled from upstream`),f1(e,t)}catch(e){p1(`Pull failed`,e)}finally{n.operations.pulling=!1}}async function g1(e,t){let n=TQ(e,t);n.operations.pushing=!0;try{BQ(e,(await tH(e,t)).repo),Kn.success(`Pushed to upstream`),f1(e,t)}catch(e){p1(`Push failed`,e)}finally{n.operations.pushing=!1}}async function _1(e,t){let n=TQ(e,t);n.operations.syncing=!0;try{BQ(e,(await eH(e,t)).repo),Kn.success(`Branch synced`),f1(e,t)}catch(e){p1(`Sync failed`,e)}finally{n.operations.syncing=!1}}async function v1(e,t){let n=TQ(e,t);n.operations.switchingBaseAndPulling=!0;try{let r=await iH(e,t);BQ(e,r.repo),NQ(n,[]),Kn.success(`Switched to ${r.repo.baseBranch} and pulled`),f1(e,t)}catch(e){p1(`Switch and pull failed`,e)}finally{n.operations.switchingBaseAndPulling=!1}}async function y1(e,t,n){if(n.current)return!1;let r=TQ(e,t);r.operations.switchingBranch=n.name;try{let i=await $V(e,t,n.name);return BQ(e,i.repo),NQ(r,[]),Kn.success(`Switched to ${i.repo.currentBranch??n.name}`),f1(e,t),!0}catch(e){return p1(`Switch branch failed`,e),!1}finally{r.operations.switchingBranch=void 0}}async function b1(e,t,n){if(n.trim().length===0)return!1;let r=TQ(e,t);r.operations.creatingBranch=!0;try{return BQ(e,(await QV(e,t,n.trim())).repo),NQ(r,[]),Kn.success(`Created branch ${n.trim()}`),f1(e,t),!0}catch(e){return p1(`Create branch failed`,e),!1}finally{r.operations.creatingBranch=!1}}async function x1(e,t,n,r){let i=TQ(e,t);i.operations.fileMutation={path:n.path,action:r};try{BQ(e,(await(r===`stage`?oH:r===`unstage`?sH:cH)(e,t,n.path)).repo),await n1(e,t)}catch(e){p1(`${r[0].toUpperCase()}${r.slice(1)} failed`,e)}finally{i.operations.fileMutation=void 0}}async function S1(e,t,n){let r=TQ(e,t),i=r.changes?.files??[],a=n===`stage-all`?i.filter(e=>e.untracked||e.worktree!==` `):i.filter(e=>e.staged);if(a.length===0)return;let o=n===`stage-all`?oH:sH;r.operations.bulkMutation=n;try{for(let n of a)await o(e,t,n.path);await n1(e,t)}catch(e){p1(`${n===`stage-all`?`Stage all`:`Unstage all`} failed`,e)}finally{r.operations.bulkMutation=void 0}}var C1=2e3,w1=new ye,T1,E1=0;function D1(){T1===void 0||typeof window>`u`||(window.clearTimeout(T1),T1=void 0)}function O1(e,t,n){T1!==void 0||typeof window>`u`||(T1=window.setTimeout(()=>{T1=void 0,j1(e,{...t,force:!1})},n))}function k1(e){let t=tr.gitContext;!t||t.projectId!==e.projectId||WZ(t)!==WZ(e)?tr.gitContext=e:tr.gitContext={...t,loadedAt:e.loadedAt}}async function A1(e,t={}){let n=Q.projects.find(t=>t.id===e);if(!n)return;await t1(n,{force:t.force,silent:!0,onlyIfChanged:!t.force,loadDetails:!1}),qQ(e);let r=tr.gitContext;return r?.projectId===e?r:void 0}async function j1(e,t={}){let n=e??Of.projectId;if(!n)return;t.force&&D1();let r=Date.now(),i=r-E1;if(!t.force&&E1>0&&i<C1){O1(n,t,C1-i);return}if(w1.has(n)){t.force&&O1(n,t,C1);return}E1=r,w1.add(n);try{let e=await A1(n,t);e&&k1(e)}catch{tr.gitContext?.projectId===n&&(tr.gitContext=void 0)}finally{w1.delete(n)}}function M1(){D1(),tr.gitContext=void 0}function N1(e){e1(e,{overview:!0,prs:!0})}var P1=N({suggestions:[],trustRequests:[],statuses:[],diagnostics:[],loading:!1,error:void 0,lastProjectId:void 0,dismissedTrustIds:[]}),F1={idle:0,critical:1,"core-ready":2,progressive:3};function I1(e){return e===`core-ready`||e===`progressive`||e===`failed`}var L1=class{phase=`idle`;generation=0;error;begin(){return this.generation+=1,this.phase=`idle`,this.error=void 0,this.generation}isCurrent(e){return this.generation===e&&this.phase!==`stopped`}transition(e,t,n){if(!this.isCurrent(e))return!1;if(t===`failed`)return this.phase===`progressive`?!1:(this.phase=t,n!==void 0&&(this.error=n),!0);if(t===`stopped`)return this.stop(e);let r=F1[this.phase],i=F1[t];return r===void 0||i===void 0||i!==r+1?!1:(this.phase=t,!0)}stop(e){return e!==void 0&&e!==this.generation?!1:(this.generation+=1,this.phase=`stopped`,!0)}},R1=class{#e=Y(`idle`);get phase(){return W(this.#e)}set phase(e){K(this.#e,e,!0)}#t=Y(0);get generation(){return W(this.#t)}set generation(e){K(this.#t,e,!0)}#n=Y();get error(){return W(this.#n)}set error(e){K(this.#n,e,!0)}get coreReady(){return this.phase===`core-ready`||this.phase===`progressive`}get progressiveActive(){return this.phase===`progressive`}},z1=new L1,B1=new R1;function V1(){B1.phase=z1.phase,B1.generation=z1.generation,B1.error=z1.error}function H1(){let e=z1.begin();return V1(),e}function U1(e){return z1.isCurrent(e)}function W1(e,t,n){let r=z1.transition(e,t,n);return r&&V1(),r}function G1(e,t){return W1(e,`failed`,t)}function K1(e){let t=z1.stop(e);return t&&V1(),t}async function q1(e,t={}){if(!e){P1.suggestions=[],P1.trustRequests=[],P1.lastProjectId=void 0;return}P1.loading=!0,P1.error=void 0;try{let n=await NH(e,t);P1.suggestions=n.suggestions,P1.trustRequests=n.trustRequests.filter(e=>!P1.dismissedTrustIds.includes(e.trustId)),P1.statuses=n.statuses,P1.diagnostics=n.diagnostics??[],P1.lastProjectId=e}catch(e){P1.error=$1(e)}finally{P1.loading=!1}}async function J1(e){P1.loading=!0,P1.error=void 0;try{P1.statuses=await PH(e)}catch(e){P1.error=$1(e)}finally{P1.loading=!1}}async function Y1(e,t){await IH(e),await J1(t),Kn.success(e.enabled?`Prompt suggestion enabled`:`Prompt suggestion disabled`)}async function X1(e,t){let n=await FH(e);return await J1(t),Kn.success(`Prompt suggestion created`),n.suggestion}function Z1(e){P1.dismissedTrustIds.includes(e)||(P1.dismissedTrustIds=[...P1.dismissedTrustIds,e]),P1.trustRequests=P1.trustRequests.filter(t=>t.trustId!==e)}async function Q1(e){await LH(e),P1.dismissedTrustIds=P1.dismissedTrustIds.filter(t=>t!==e.trustId),Kn.success(e.status===`unset`?`Prompt suggestion trust reset`:`Prompt suggestion ${e.status}`)}function $1(e){return e instanceof Error?e.message:String(e)}var e0=h(`<!> <!> <!>`,1),t0=h(`<p class="text-xs text-muted-foreground"> </p>`),n0=h(`<section class="grid gap-1 rounded-md border border-border bg-transparent p-3"><div class="flex items-center justify-between gap-3"><strong class="text-sm font-medium text-foreground"> </strong> <span class="rounded-full border border-border px-2 py-0.5 text-xs text-muted-foreground"> </span></div> <p class="font-mono text-xs text-muted-foreground"> </p> <!></section>`),r0=h(`<div class="grid gap-4"><div class="flex gap-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-sm"><!> <p class="text-muted-foreground">Only allow JavaScript from suggestion files you trust. Nerve runs it
142
+ locally in the daemon with a limited context and timeout, but it is
143
+ still local code from the listed Markdown file.</p></div> <div class="grid gap-2"></div></div>`);function i0(e,t){a(t,!0);let n=Y(!1),r=J(()=>P1.trustRequests),i=J(()=>W(r).length>0);async function o(e){K(n,!0);try{for(let t of W(r))await Q1({trustId:t.trustId,status:e});t.projectId&&await q1(t.projectId,{conversationId:t.conversationId,agentId:t.agentId})}finally{K(n,!1)}}function s(){for(let e of W(r))Z1(e.trustId)}sP(e,{get open(){return W(i)},title:`Allow prompt suggestion JavaScript?`,description:`Some prompt suggestions include JavaScript that decides when the suggestion appears.`,size:`md`,onOpenChange:e=>{e||s()},footer:e=>{var t=e0(),r=R(t);G(r,{size:`sm`,variant:`ghost`,get disabled(){return W(n)},onclick:s,children:(e,t)=>{w(),g(e,M(`Decide later`))},$$slots:{default:!0}});var i=L(r,2);G(i,{size:`sm`,variant:`destructive`,get disabled(){return W(n)},onclick:()=>o(`denied`),children:(e,t)=>{w(),g(e,M(`Deny`))},$$slots:{default:!0}}),G(L(i,2),{size:`sm`,get disabled(){return W(n)},onclick:()=>o(`allowed`),children:(e,t)=>{w(),g(e,M(`Allow`))},$$slots:{default:!0}}),g(e,t)},children:(e,t)=>{var n=r0(),i=V(n);pY(V(i),{class:`mt-0.5 size-4 flex-none text-warning`,strokeWidth:2.2}),w(2),d(i);var a=L(i,2);_(a,21,()=>W(r),e=>e.trustId,(e,t)=>{var n=n0(),r=V(n),i=V(r),a=V(i,!0);d(i);var o=L(i,2),s=V(o,!0);d(o),d(r);var c=L(r,2),l=V(c,!0);d(c);var u=L(c,2),f=e=>{var n=t0(),r=V(n,!0);d(n),F(()=>A(r,W(t).description)),g(e,n)};k(u,e=>{W(t).description&&e(f)}),d(n),F(()=>{A(a,W(t).label),A(s,W(t).sourceKind),A(l,W(t).path)}),g(e,n)}),d(a),d(n),g(e,n)},$$slots:{footer:!0,default:!0}}),z()}var a0=h(`<!> <!>`,1);function o0(e,t){a(t,!0);let n=I(t,`active`,3,!0),r=J(()=>t.tab??Q.activeCenterTab),i=J(()=>W(r)?.kind===`conversation`?W(r).id:void 0),o=J(()=>W(r)?.kind===`pending-conversation`?W(r).id:void 0),s=J(()=>W(i)?Z.conversationViews[Yr(W(i))]:void 0),c=J(()=>W(o)?Z.pendingConversations[Qr(W(o))]:void 0),l=J(()=>W(i)?Q.conversations.find(e=>e.id===W(i)):void 0),u=J(()=>W(l)?Q.agents.find(e=>e.id===W(l).activeAgentId||e.conversationId===W(l).id):void 0),d=J(()=>{let e=W(c)?.projectId??W(l)?.projectId;return e?Q.projects.find(t=>t.id===e):W(r)?void 0:If.activeProject}),f=J(()=>!!W(c)),p=J(()=>{let e=W(u)?.id;return Q.userQuestions.filter(t=>W(i)&&t.conversationId===W(i)?!0:!!(e&&t.agentId===e))}),m=J(()=>{let e=W(u)?.id;return Q.planReviews.filter(t=>W(i)&&t.conversationId===W(i)?!0:!!(e&&t.agentId===e))}),h=J(()=>{let e=W(u)?.id;return Q.approvals.filter(t=>W(i)&&t.conversationId===W(i)?!0:!!(e&&t.agentId===e))}),_=J(()=>W(m)[0]?Q.agents.find(e=>e.id===W(m)[0]?.agentId):void 0),v=J(()=>yK(W(u)?.id)),y=J(()=>W(c)?.selectedModelKey??(W(v)?.model?Xn(W(v).model):W(u)?.model?Xn(W(u).model):Z.selectedModelKey)),b=J(()=>rr.models.find(e=>Xn(e)===W(y))),x=J(()=>W(u)?.model),S=J(()=>W(x)?rr.models.find(e=>Xn(e)===Xn(W(x))):void 0),C=J(()=>W(c)?.thinkingLevel??W(v)?.thinkingLevel??W(u)?.thinkingLevel??`off`),w=J(()=>W(c)?.mode??W(v)?.mode??W(u)?.mode??W(l)?.mode??Z.selectedMode),T=J(()=>W(c)?.permissionLevel??W(v)?.permissionLevel??W(u)?.permissionLevel??W(l)?.permissionLevel??Z.selectedPermissionLevel),E=J(()=>W(c)?.approvalPolicy??W(v)?.approvalPolicy??W(u)?.approvalPolicy??W(l)?.approvalPolicy??Z.selectedApprovalPolicy),D=J(()=>W(c)?.composerText??W(s)?.composerText??``),O=J(()=>lr(rr.models,rr.authProviders,rr.settingsDraft?.scopedModels)),ee=J(()=>W(_)?.model?Xn(W(_).model):W(y)),te=J(()=>W(_)?.thinkingLevel??W(C)),k=J(()=>W(b)?.contextWindow??W(S)?.contextWindow??W(s)?.contextUsage?.contextWindow??0),A={"commit-changes":UZ,"commit-on-feature-branch":gY,"create-pull-request":Uu},ne=J(()=>P1.suggestions.map(e=>({id:`prompt:${e.id}`,label:e.label,prompt:e.prompt,icon:e.source.kind===`builtin`?A[e.name]??TR:TR}))),j=J(()=>{let e=tr.gitContext;return e?`${e.projectId}:${WZ(e)}`:`none`}),M=J(()=>n()?Z.slashCompletions:[]);function re(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}async function N(){let e=W(r);!e||re(Q.activeCenterTab,e)||await Ap(e)}function P(e){let t=W(c);if(t){t.composerText=e;return}if(W(i)){sU(W(i)).composerText=e;return}if(n()&&re(Q.activeCenterTab,W(r))){Mq(e);return}kf.text=e}async function ie(e){await N(),await e()}async function ae(e,t=!1){await ie(()=>Tq(e,t)),OZ()}async function oe(e){await ie(()=>Tq(e.parentEntryId)),P(e.text),OZ()}function se(e,t){W(d)&&FZ({projectId:W(d).id,path:e,line:t})}be(()=>{!B1.progressiveActive||!n()||!W(d)?.id||(W(j),q1(W(d).id,{conversationId:W(i),agentId:W(u)?.id}))});function F(e){P(W(D).trim()?`${W(D)}\n\n${e.prompt}`:e.prompt)}function ce(e){ie(()=>Rq(e.prompt,{clearComposer:!1}))}async function le(e){try{await Ar(`agent.promptQueue.cancel`,{agentId:e.agentId,queuedPromptId:e.id});let t=sU(e.conversationId);return t.queuedPrompts=t.queuedPrompts.filter(t=>t.id!==e.id),!0}catch(e){let t=e instanceof Error?e.message:String(e);return Kn.error(`Queued prompt action failed`,{description:t}),!1}}function ue(e){ie(async()=>{await le(e)&&Kn.message(`Queued prompt discarded`)})}function de(e){ie(async()=>{await le(e)&&(P(e.text),OZ(),Kn.success(`Moved queued prompt to composer`))})}var fe=a0(),pe=R(fe);{let e=J(()=>Q.status?.storage.userHome),t=J(()=>W(s)?.entries??[]),r=J(()=>W(s)?.optimisticMessages??[]),i=J(()=>W(s)?.toolCalls??[]),a=J(()=>W(s)?.treeNodes??[]),o=J(()=>W(s)?.activeRun),g=J(()=>W(s)?.transient),_=J(()=>W(s)?.queuedPrompts??[]),v=J(()=>Q.connection===`live`),b=J(()=>W(c)?.sending??W(s)?.sending??!1),x=J(()=>W(s)?.stopping??!1),S=J(()=>W(s)?.contextUsage),A=J(()=>n()?AJ:void 0);EZ(pe,{get active(){return n()},get activeProject(){return W(d)},get activeConversation(){return W(l)},get activeAgent(){return W(u)},get activePendingConversation(){return W(c)},get pendingConversationActive(){return W(f)},get projects(){return Q.projects},get conversations(){return Q.conversations},get agents(){return Q.agents},get homeDir(){return W(e)},get approvals(){return W(h)},get pendingUserQuestions(){return W(p)},get pendingPlanReviews(){return W(m)},get entries(){return W(t)},get optimisticMessages(){return W(r)},get toolCalls(){return W(i)},get treeNodes(){return W(a)},get activeRun(){return W(o)},get transient(){return W(g)},get queuedPrompts(){return W(_)},get live(){return W(v)},get sending(){return W(b)},get stopping(){return W(x)},get composerText(){return W(D)},get composerSuggestions(){return W(ne)},onSendSuggestion:ce,onDraftSuggestion:F,get models(){return W(O)},get selectedModelKey(){return W(y)},get thinkingLevel(){return W(C)},get planReviewModels(){return W(O)},get planReviewModelKey(){return W(ee)},get planReviewThinkingLevel(){return W(te)},get mode(){return W(w)},get permissionLevel(){return W(T)},get approvalPolicy(){return W(E)},get slashCompletions(){return W(M)},get contextUsage(){return W(S)},get contextWindow(){return W(k)},get composerFocusToken(){return DZ.focusToken},get composerEscapeToken(){return DZ.escapeToken},get micShortcutToken(){return DZ.micToken},get fileCompletions(){return W(A)},onComposerChange:P,onSubmit:()=>{ie(zq)},get onAnswerUserQuestion(){return tq},get onDismissUserQuestion(){return nq},onAbort:()=>{ie(W(s)?.transient?.compaction?.state===`running`?kq:jq)},onCompact:()=>{ie(Eq)},get onNewConversationInProject(){return PJ},onOpenFile:se,onModelChange:e=>{ie(()=>dq(e))},onThinkingLevelChange:e=>{ie(()=>fq(e))},onModeChange:e=>{ie(()=>pq(e))},onPermissionChange:e=>{ie(()=>mq(e))},onApprovalPolicyChange:e=>{ie(()=>hq(e))},get onGrantApproval(){return XK},get onDenyApproval(){return ZK},onAcceptPlanReview:(e,t)=>QK(e,t),onAcceptPlanReviewInNewChat:(e,t)=>$K(e,t),get onRejectPlanReview(){return eq},onContinueFromFailure:e=>{ie(()=>Aq(e))},onDiscardQueuedPrompt:ue,onMoveQueuedPromptToComposer:de,onNavigateToEntry:(e,t)=>{ae(e,t)},onEditEntry:e=>{oe(e)},onOpenHistory:()=>{ie(jZ)}})}var me=L(pe,2);{let e=J(()=>W(d)?.id),t=J(()=>W(u)?.id);i0(me,{get projectId(){return W(e)},get conversationId(){return W(i)},get agentId(){return W(t)}})}g(e,fe),z()}var s0=h(`<div class="lazy-shell-pending svelte-1iqc6q3" aria-busy="true"><!></div>`);function c0(e){var t=s0();Fi(V(t),{class:`size-5`}),d(t),g(e,t)}function l0(e){return`${e.projectId}:${encodeURIComponent(e.repo)}:${e.area}:${encodeURIComponent(e.path)}`}function u0(e){Cp({kind:`diff`,id:e})}async function d0(e){e.data?e.refreshing=!0:e.loading=!0,e.error=void 0;try{e.data=await aH(e.projectId,e.repo,e.path,e.area),e.path=e.data.path,e.renamedFrom=e.data.renamedFrom}catch(t){let n=t instanceof Error?t.message:String(t);e.error=n,Kn.error(`Could not load diff`,{description:n})}finally{e.loading=!1,e.refreshing=!1}}async function f0(e){if(e.projectId!==Q.selectedProjectId){let{selectProject:t}=await Qx(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>SJ);return{selectProject:e}},void 0);await t(e.projectId)}let t=l0(e),n=Zr(t);tr.diffViews[n]??={id:t,...e,loading:!1,refreshing:!1},u0(t),Op({kind:`diff`,id:t}),await d0(tr.diffViews[n])}async function p0(e){let t=tr.diffViews[Zr(e)];t&&(u0(e),Op({kind:`diff`,id:e}),!t.data&&!t.loading&&await d0(t))}async function m0(e){let t=tr.diffViews[Zr(e)];t&&!t.loading&&!t.refreshing&&await d0(t)}function Vce(e){let t={kind:`diff`,id:e},n=Q.activeCenterTab?.kind===`diff`&&Q.activeCenterTab.id===e,r=Tp(t);Ep(t),delete tr.diffViews[Zr(e)],n&&Ap(r)}var h0={kind:`logs`,id:`logs`};function Hce(){Q.status?.capabilities.applicationLogs&&(Cp(h0),Op(h0))}function Uce(){Q.status?.capabilities.applicationLogs&&(Cp(h0),Op(h0))}function Wce(){let e=Q.activeCenterTab?.kind===`logs`,t=Tp(h0);Ep(h0),e&&Ap(t)}function g0(e){let t=sr.tasks.find(t=>t.id===e);return t?.definitionId??t?.restartRootTaskId??t?.id??e}function Gce(e){let t=sr.selectedRunByEntry[e],n=sr.tasks.filter(t=>(t.definitionId??t.restartRootTaskId??t.id)===e).sort((e,t)=>t.startedAt.localeCompare(e.startedAt));return n.find(e=>e.id===t)??n[0]}function _0(e,t){sr.selectedRunByEntry[e]=t}async function Kce(e){let t=sr.tasks.find(t=>t.id===e);if(t?.projectId&&t.projectId!==Q.selectedProjectId){let{selectProject:e}=await Qx(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>SJ);return{selectProject:e}},void 0);await e(t.projectId)}let n=g0(e);_0(n,e),Cp({kind:`task`,id:n}),await v0(n)}async function v0(e){let t=Gce(e);Cp({kind:`task`,id:e}),Op({kind:`task`,id:e}),sr.selectedTaskId=t?.id,t&&await cJ(t.id)}async function qce(e){let t={kind:`task`,id:e},n=Q.activeCenterTab?.kind===`task`&&Q.activeCenterTab.id===e,r=Tp(t);Ep(t),delete sr.selectedRunByEntry[e],sr.selectedTaskId&&g0(sr.selectedTaskId)===e&&(sr.selectedTaskId=void 0,sr.taskLogs=void 0),n&&await Ap(r)}_p({select:{conversation:e=>WK(e.id),"pending-conversation":e=>iq(e.id),task:e=>v0(e.id),file:e=>IZ(e.id),pr:e=>V$(e.id),diff:e=>p0(e.id),settings:()=>yW(),auth:()=>UW(),logs:()=>Uce()},close:{conversation:e=>KK(e.id),"pending-conversation":e=>qK(e.id),task:e=>qce(e.id),file:e=>VZ(e.id),pr:e=>q$(e.id),diff:e=>Vce(e.id),settings:()=>bW(),auth:()=>WW(),logs:()=>Wce()}});var Jce={get activeCenterFileView(){let e=Q.activeCenterTab;if(e?.kind===`file`)return $r.fileViews[Jr(e.id)]},get openFileTabs(){return $r.openFileTabIds}};function y0(e){return e?.kind===`conversation`||e?.kind===`pending-conversation`}function b0(e){return`${e.kind}:${e.id}`}function x0(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function Yce(e,t){return e.length===t.length&&e.every((e,n)=>x0(e,t[n]))}function Xce(e,t,n,r=4){let i=new Set(n.filter(y0).map(b0)),a=e.filter(e=>i.has(b0(e)));if(!y0(t))return a.slice(0,r);let o=b0(t);return i.has(o)?[t,...a.filter(e=>b0(e)!==o)].slice(0,r):a.slice(0,r)}function Zce(e,t,n=4){if(!y0(t))return e.slice(0,n);let r=b0(t);return e.some(e=>b0(e)===r)?e.slice(0,n):[t,...e].slice(0,n)}var Qce=new Set([`$$slots`,`$$events`,`$$legacy`]);function S0(e,t){let n=H(t,Qce),r=[[`path`,{d:`M12 8V4H8`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}],[`path`,{d:`M2 14h2`}],[`path`,{d:`M20 14h2`}],[`path`,{d:`M15 13v2`}],[`path`,{d:`M9 13v2`}]];P(e,B({name:`bot`},()=>n,{get iconNode(){return r}}))}var $ce={read_only:`read only`,supervised:`supervised`,autonomous:`autonomous`};function C0(e){return $ce[e]??e}function ele({status:e,activeProject:t,activeConversation:n}){return[{label:`Project`,value:t?.name},{label:`Directory`,value:t?.dir,mono:!0},{label:`Conversation`,value:n?.id,mono:!0},{label:`Daemon`,value:e?.daemonId,mono:!0},{label:`Data`,value:e?.dataDir,mono:!0}]}function tle(e){return e.map(e=>`${e.label}: ${e.value??`—`}`).join(`
144
+ `)}function nle(e,t){a(t,!0);let n=I(t,`conversationAgents`,19,()=>[]);function r(e){return e.status===`running`||e.status===`awaiting_user`}function i(e){return[...e].sort((e,n)=>{let i=+(e.id===t.activeAgent?.id),a=+(n.id===t.activeAgent?.id);if(i!==a)return a-i;let o=+!!r(e),s=+!!r(n);if(o!==s)return s-o;let c=new Date(e.updatedAt).getTime(),l=new Date(n.updatedAt).getTime();return c===l?new Date(n.createdAt).getTime()-new Date(e.createdAt).getTime():l-c})}function o(e){return e.parentAgentId?`Subagent`:`Main agent`}let s={minimal:`min`,low:`low`,medium:`med`,high:`high`,xhigh:`xhi`,max:`max`};function c(e){let t=$n(e),n=s[e.thinkingLevel??`off`];return n?`${t} (${n})`:t}function l(e){return`${e.mode} · ${C0(e.permissionLevel)} · ${c(e)}`}function u(e){let t=e.model?`${e.model.provider}/${e.model.modelId}`:`model pending`,n=e.thinkingLevel&&e.thinkingLevel!==`off`?`thinking: ${e.thinkingLevel}`:void 0;return[e.id,`status: ${e.status}`,`mode: ${e.mode} · ${C0(e.permissionLevel)}`,`model: ${t}`,n].filter(Boolean).join(`
145
+ `)}let d=J(()=>Sn(i(n()),{getKey:e=>e.id,getParentKey:e=>e.parentAgentId??void 0,getLabel:o}));var f=U(),p=R(f),m=e=>{xn(e,{get icon(){return S0},title:`No agents yet`,description:`Agents appear once a run starts.`})},h=e=>{yn(e,{get nodes(){return W(d)},ariaLabel:`Conversation agents`,itemStacked:!0,itemMetaMono:!0,itemVariant:`card`,indentItems:!1,getItemDescription:l,getItemMeta:e=>e.id,getItemTitle:u,getItemSelected:e=>e.id===t.activeAgent?.id,onItemActivate:e=>t.onSelectAgent?.(e),itemLabelTrailing:(e,t=D)=>{{let n=J(()=>gf(t().status,!1,t().mode)),r=J(()=>_f(t().status));ht(e,{get tone(){return W(n)},get pulse(){return W(r)}})}},$$slots:{itemLabelTrailing:!0}})};k(p,e=>{n().length===0?e(m):e(h,-1)}),g(e,f),z()}var rle=new Set([`$$slots`,`$$events`,`$$legacy`]);function w0(e,t){let n=H(t,rle),r=[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]];P(e,B({name:`download`},()=>n,{get iconNode(){return r}}))}var ile=new Set([`$$slots`,`$$events`,`$$legacy`]);function T0(e,t){let n=H(t,ile),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 12.5 8 15l2 2.5`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`}]];P(e,B({name:`file-code`},()=>n,{get iconNode(){return r}}))}var ale=new Set([`$$slots`,`$$events`,`$$legacy`]);function ole(e,t){let n=H(t,ale),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`}]];P(e,B({name:`file-braces`},()=>n,{get iconNode(){return r}}))}var sle=new Set([`$$slots`,`$$events`,`$$legacy`]);function cle(e,t){let n=H(t,sle),r=[[`path`,{d:`M15 12h-5`}],[`path`,{d:`M15 8h-5`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`}]];P(e,B({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var lle=h(`<!> <span> </span>`,1),ule=h(`<!> <!>`,1);function dle(e,t){a(t,!0);let n=J(()=>{if(!t.activeConversation)return[];let e=t.activeConversation.id;return[{id:`json`,label:`JSON`,icon:ole,href:t.exportUrl?.(`json`),filename:`conversation-${e}.json`},{id:`md`,label:`Markdown`,icon:Hu,href:t.exportUrl?.(`md`),filename:`conversation-${e}.md`},{id:`html`,label:`HTML`,icon:T0,href:t.exportUrl?.(`html`),filename:`conversation-${e}.html`},{id:`system-prompt`,label:`System prompt`,icon:cle,href:t.systemPromptUrl?.()}]});function r(e){if(!e.href)return;let t=document.createElement(`a`);t.href=e.href,e.filename&&(t.download=e.filename),t.rel=`noopener`,document.body.append(t),t.click(),t.remove()}var i=U();C(R(i),()=>tL,(e,i)=>{i(e,{children:(e,i)=>{var a=ule(),o=R(a);{let e=J(()=>xe({variant:`ghost`,size:`icon-xs`})),n=J(()=>!t.activeConversation);C(o,()=>dL,(t,r)=>{r(t,{get class(){return W(e)},"aria-label":`Export conversation`,title:`Export conversation`,get disabled(){return W(n)},children:(e,t)=>{w0(e,{class:`size-4`,"aria-hidden":`true`})},$$slots:{default:!0}})})}C(L(o,2),()=>aL,(e,t)=>{t(e,{align:`end`,class:`w-48`,children:(e,t)=>{var i=U();_(R(i),17,()=>W(n),e=>e.id,(e,t)=>{let n=J(()=>W(t).icon);var i=U(),a=R(i);{let e=J(()=>!W(t).href);C(a,()=>sL,(i,a)=>{a(i,{get disabled(){return W(e)},onSelect:()=>r(W(t)),children:(e,r)=>{var i=lle(),a=R(i);C(a,()=>W(n),(e,t)=>{t(e,{})});var o=L(a,2),s=V(o,!0);d(o),F(()=>A(s,W(t).label)),g(e,i)},$$slots:{default:!0}})})}g(e,i)}),g(e,i)},$$slots:{default:!0}})}),g(e,a)},$$slots:{default:!0}})}),g(e,i),z()}function fle(e,t){var n=U();_(R(n),17,()=>t.fields,e=>e.label,(e,t)=>{{let n=J(()=>W(t).mono??!1);Tn(e,{get label(){return W(t).label},get value(){return W(t).value},get title(){return W(t).value},get mono(){return W(n)},dense:!0})}}),g(e,n)}var ple=j(`<path fill="none" stroke-width="8" stroke-linecap="round"></path>`),mle=h(`<div class="relative mx-auto w-full max-w-56"><svg viewBox="0 0 120 66" class="w-full" role="img"><path fill="none" stroke-width="8" stroke-linecap="round" class="stroke-muted"></path><!></svg> <div class="absolute inset-x-4 bottom-0.5 flex min-w-0 flex-col items-center gap-1"><span> </span> <span class="max-w-full truncate text-xs text-muted-foreground"> </span> <!></div></div>`),hle=h(`<p class="py-1.5 text-xs text-muted-foreground">Context usage is available after the first run.</p>`);function gle(e,t){a(t,!0);let n=I(t,`contextWindow`,3,0),r=Math.PI*50,i=`M 10 60 A 50 50 0 0 1 110 60`,o=J(()=>n()||t.contextUsage?.contextWindow||0),c=J(()=>t.contextUsage?.tokens??null),l=J(()=>W(c)!=null&&W(o)>0?W(c)/W(o)*100:t.contextUsage?.percent??null),f=J(()=>W(o)>0||W(l)!=null),p=J(()=>W(l)==null?0:Math.max(0,Math.min(100,W(l)))),m=J(()=>W(l)==null?`—`:`${Math.round(W(l))}%`),h=J(()=>W(c)!=null&&W(o)>0?`${K_(W(c))} / ${K_(W(o))} tokens`:W(o)>0?`${K_(W(o))} token window`:`Usage unknown`),_=J(()=>q_(W(l))),v=J(()=>W(_)===`error`?`stroke-destructive-solid`:W(_)===`warning`?`stroke-warning`:`stroke-primary`),y=J(()=>W(_)===`error`?`text-destructive`:W(_)===`warning`?`text-warning`:`text-foreground`);var b=U(),S=R(b),C=e=>{var n=mle(),a=V(n),o=V(a);q(o,`d`,i);var c=L(o),f=e=>{var t=ple();q(t,`d`,i),q(t,`stroke-dasharray`,r),F(()=>{s(t,0,x(W(v))),q(t,`stroke-dashoffset`,r*(1-W(p)/100))}),g(e,t)};k(c,e=>{W(l)!=null&&e(f)}),d(a);var _=L(a,2),b=V(_),S=V(b,!0);d(b);var C=L(b,2),w=V(C,!0);d(C);var T=L(C,2),E=e=>{var n=U();u(R(n),()=>t.children),g(e,n)};k(T,e=>{t.children&&e(E)}),d(_),d(n),F(e=>{q(a,`aria-label`,`Context window usage: ${W(m)} of ${W(h)}`),s(b,1,e),A(S,W(m)),A(w,W(h))},[()=>x(me(`text-xl leading-none font-semibold`,W(y)))]),g(e,n)},w=e=>{g(e,hle())};k(S,e=>{W(f)?e(C):e(w,-1)}),g(e,b),z()}var E0=h(`<!> <!>`,1),_le=h(`<!> `,1),vle=h(`<div class="flex flex-col gap-4 py-1"><!> <div class="flex min-w-0 flex-col"><!></div> <!></div>`);function yle(e,t){a(t,!0);let n=I(t,`contextWindow`,3,0),r=I(t,`conversationAgents`,19,()=>[]),i=I(t,`compacting`,3,!1),o=Y(!1),s=J(()=>ele({status:t.status,activeProject:t.activeProject,activeConversation:t.activeConversation})),c=J(()=>t.activeConversation?i()?`Conversation compaction is in progress`:`Summarize earlier messages to reduce context usage`:`Select a conversation to compact its context`);async function l(){try{await Ju(tle(W(s))),Kn.success(`Copied session details`)}catch{Kn.error(`Could not copy to clipboard`)}}var u=E0(),f=R(u);wn(f,{padded:!1,banner:e=>{var n=E0(),r=R(n);gn(r,{title:`Context`,trailing:e=>{var n=E0(),r=R(n);{let e=J(()=>!t.activeProject);Dn(r,{get icon(){return Bu},label:`Copy session details`,get disabled(){return W(e)},onclick:()=>void l()})}dle(L(r,2),{get activeConversation(){return t.activeConversation},get exportUrl(){return t.exportUrl},get systemPromptUrl(){return t.systemPromptUrl}}),g(e,n)},$$slots:{trailing:!0}});var i=L(r,2),a=e=>{dn(e,{tone:`muted`,children:(e,t)=>{w(),g(e,M(`Select a project to view context.`))},$$slots:{default:!0}})};k(i,e=>{t.activeProject||e(a)}),g(e,n)},children:(e,a)=>{var l=U(),u=R(l),f=e=>{var a=vle(),l=V(a);gle(l,{get contextUsage(){return t.contextUsage},get contextWindow(){return n()},children:(e,n)=>{{let n=J(()=>!t.activeConversation||i());G(e,{size:`xs`,variant:`outline`,class:`rounded-full`,get title(){return W(c)},get disabled(){return W(n)},onclick:()=>K(o,!0),children:(e,t)=>{var n=_le(),r=R(n);h_(r,{});var a=L(r);F(()=>A(a,` ${i()?`Compacting…`:`Compact`}`)),g(e,n)},$$slots:{default:!0}})}},$$slots:{default:!0}});var u=L(l,2);fle(V(u),{get fields(){return W(s)}}),d(u),nle(L(u,2),{get conversationAgents(){return r()},get activeAgent(){return t.activeAgent},get onSelectAgent(){return t.onSelectAgent}}),d(a),g(e,a)};k(u,e=>{t.activeProject&&e(f)}),g(e,l)},$$slots:{banner:!0,default:!0}}),B_(L(f,2),{title:`Compact conversation`,description:`This summarizes earlier messages to reduce context size. The full history stays available in the branch tree.`,confirmLabel:`Compact context`,onConfirm:()=>t.onCompact?.(),get open(){return W(o)},set open(e){K(o,e,!0)}}),g(e,u),z()}function D0(){let e=Of.conversationId??Z.activeConversationTabId;if(e)return Z.conversationViews[Yr(e)]}function O0(){let e=Q.activeCenterTab;if(e?.kind===`pending-conversation`)return Z.pendingConversations[Qr(e.id)]}var k0={get activeProject(){return If.activeProject},get activeConversation(){return If.activeConversation},get activeAgent(){return If.activeAgent},get activePendingConversation(){return O0()},get pendingConversationActive(){return!!O0()},get activeUserQuestion(){let e=Of.conversationId,t=Of.agentId;return Q.userQuestions.find(n=>e&&n.conversationId===e?!0:!!(t&&n.agentId===t))},get activePlanReview(){let e=Of.conversationId,t=Of.agentId;return Q.planReviews.find(n=>e&&n.conversationId===e?!0:!!(t&&n.agentId===t))},get conversationActivityById(){return If.conversationActivityById},get conversationAgents(){return Q.agents.filter(e=>e.conversationId===Of.conversationId)},get pendingApprovalCount(){return Q.approvals.length},get conversationActiveRun(){return D0()?.activeRun},get compacting(){return D0()?.transient?.compaction?.state===`running`},get entries(){return D0()?.entries??[]},get toolCalls(){return D0()?.toolCalls??[]},get treeNodes(){return D0()?.treeNodes??[]},get streamingText(){return Et(D0()?.activeRun)},get queuedPrompts(){return D0()?.queuedPrompts??[]},get activeComposerText(){return O0()?.composerText??D0()?.composerText??``},get slashCompletions(){return Z.slashCompletions},get selectedModelKey(){return Z.selectedModelKey},get selectedThinkingLevel(){return Z.selectedThinkingLevel},get selectedMode(){return Z.selectedMode},get selectedPermissionLevel(){return Z.selectedPermissionLevel},get selectedApprovalPolicy(){return Z.selectedApprovalPolicy},get activeContextUsage(){return D0()?.contextUsage},get activeModelInfo(){let e=Q.agents.find(e=>e.id===Of.agentId)?.model;if(e)return rr.models.find(t=>t.provider===e.provider&&t.modelId===e.modelId)},get activeContextWindow(){let e=rr.models.find(e=>Xn(e)===Z.selectedModelKey);return e?.contextWindow?e.contextWindow:this.activeModelInfo?.contextWindow?this.activeModelInfo.contextWindow:D0()?.contextUsage?.contextWindow??0},get activeConversationUsage(){let e={input:0,output:0,cacheRead:0,cacheWrite:0,cost:0};for(let t of D0()?.entries??[])t.usage&&(e.input+=t.usage.input,e.output+=t.usage.output,e.cacheRead+=t.usage.cacheRead,e.cacheWrite+=t.usage.cacheWrite,e.cost+=t.usage.cost);return e},get usableModels(){return lr(rr.models,rr.authProviders,rr.settingsDraft?.scopedModels)},get live(){return Q.connection===`live`},get sending(){return O0()?.sending??D0()?.sending??!1},get activeSubscriptionProvider(){return Q.agents.find(e=>e.id===Of.agentId)?.model?.provider??ur(Z.selectedModelKey)?.provider},get activeSubscriptionUsage(){let e=this.activeSubscriptionProvider;if(e)return oW.subscriptionUsage[e]}};function ble(){let e=Of.conversationId??Z.activeConversationTabId;if(e)return Z.conversationViews[Yr(e)]}var A0={get activeCenterPrView(){let e=Q.activeCenterTab;if(e?.kind===`pr`)return tr.prViews[qr(e.id)]},get gitStatus(){let e=If.activeProject?.id,t=e?lQ.projects[Kr(e)]:void 0;if(!t||t.repos.length===0)return;let n=t.repoStates[Xr(t.selectedRepo)]?.repoSummary??t.repos.find(e=>e.relativePath===t.selectedRepo)??t.repos[0];return{branch:n.currentBranch??`detached`,dirty:n.dirty,changeCount:n.changeCount,ahead:n.ahead,behind:n.behind,detached:n.detached,hasUpstream:n.hasUpstream,relativePath:n.relativePath,repoName:n.name,repoCount:t.repos.length}},get branchDepth(){return ble()?.treeNodes.length??0}};function xle(e){let t,n=!1;return{update(r,i){r&&(n&&i===t||(n=!0,t=i,e(i)))}}}function Sle(e){return!!(e.progressiveActive&&e.enabled&&e.projectId&&e.projectId!==e.lastProjectId)}var j0=sX(`Select a project to use Git operations.`);function Cle(e,t=()=>!0,n=t){let r={get model(){let t=e(),n=t?lQ.projects[Kr(t.id)]:void 0,r=n?.repos??[],i=n?.selectedRepo??`.`,a=n?.repoStates[Xr(i)],o=t?{refresh:oX,selectRepository:oX,branches:oX,mutateFiles:oX,bulkMutateFiles:oX,remote:{fetch:oX,pull:oX,push:oX,sync:oX,"switch-base-and-pull":oX},openPullRequest:oX}:{refresh:j0,selectRepository:j0,branches:j0,mutateFiles:j0,bulkMutateFiles:j0,remote:{fetch:j0,pull:j0,push:j0,sync:j0,"switch-base-and-pull":j0},openPullRequest:j0};return{availability:t?{available:!0}:{available:!1,message:`Select a project to inspect its Git repositories.`},emptyMessage:`No Git repositories found in this directory (searched up to 2 levels deep).`,repositories:r,selectedRepository:i,repositorySummary:a?.repoSummary,changes:a?.changes,branches:a?.branches??[],github:a?.github,pullRequests:a?.prs??[],pullRequestFilters:a?.prFilters??BY,initialLoading:!!(t&&!n)||!!n?.loadingRepos||!!(n?.reposRequestInFlight&&!n.loaded&&r.length===0),cachedError:n?.discoverError,refreshing:!!n?.refreshingRepos||!!((a?.loadingOverview||a?.loadingPrs)&&(a.repoSummary||a.changes)),loadingOverview:a?.loadingOverview??!1,loadingBranches:a?.loadingBranches??!1,loadingPullRequests:a?.loadingPrs??!1,pullRequestError:a?.prsError,operations:a?.operations??{fetching:!1,pulling:!1,pushing:!1,syncing:!1,switchingBaseAndPulling:!1,creatingBranch:!1},capabilities:o}},actions:void 0};r.actions=JY(()=>r.model,{refreshAll:()=>{let t=e();if(t)return t1(t,{force:!0})},refreshRepository:async t=>{let n=e();n&&await Promise.all([n1(n.id,t,{force:!0}),i1(n.id,t,!0)])},refreshBranches:t=>{let n=e();if(n)return r1(n.id,t)},refreshPullRequests:async t=>{let n=e();n&&await Promise.all([n1(n.id,t,{force:!0}),i1(n.id,t,!0)])},configurePullRequests:(t,n)=>{let r=e();if(!r)return;let i=lQ.projects[Kr(r.id)]?.repoStates[Xr(t)];if(i)return i.prFilters=VY(n),xQ(r.id,t,i.prFilters),s1(r.id,t,!1,!0)},resetPullRequestConfig:t=>{let n=e();if(!n)return;let r=lQ.projects[Kr(n.id)]?.repoStates[Xr(t)];if(r)return r.prFilters=BY,xQ(n.id,t,r.prFilters),s1(n.id,t,!1,!0)},selectRepository:t=>{let n=e();n&&d1(n.id,t)},createBranch:(t,n)=>{let r=e();return r?b1(r.id,t,n):!1},switchBranch:(t,n)=>{let r=e();return r?y1(r.id,t,n):!1},openDiff:(t,n,r)=>{let i=e();if(i)return f0({projectId:i.id,repo:t,path:n.path,renamedFrom:n.renamedFrom,area:r})},mutateFile:(t,n,r)=>{let i=e();if(i)return x1(i.id,t,n,r)},bulkMutateFiles:(t,n)=>{let r=e();if(r)return S1(r.id,t,n)},runRemoteOperation:(t,n)=>{let r=e();if(r)return{fetch:()=>m1(r.id,t),pull:()=>h1(r.id,t),push:()=>g1(r.id,t),sync:()=>_1(r.id,t),"switch-base-and-pull":()=>v1(r.id,t)}[n]()},selectPullRequest:()=>void 0,openPullRequest:(t,n)=>{let r=e();if(r)return B$({projectId:r.id,repo:t,number:n})}});let i;return be(()=>{let n=e(),r=t();Sle({progressiveActive:B1.progressiveActive,enabled:r,projectId:n?.id,lastProjectId:i})&&(i=n?.id,n&&queueMicrotask(()=>{B1.progressiveActive&&t()&&u1(n)}))}),be(()=>{let r=B1.progressiveActive&&t(),i=e(),a=i?lQ.projects[Kr(i.id)]:void 0,o=a?.selectedRepo;if(!r||!i||!a?.repos.length||!o)return;Z$(i.id,o,!0);let s=()=>{c1(i.id,o),n()&&l1(i.id,o)},c=()=>{document.visibilityState===`visible`&&s()};return s(),window.addEventListener(`focus`,s),document.addEventListener(`visibilitychange`,c),()=>{Z$(i.id,o,!1),window.removeEventListener(`focus`,s),document.removeEventListener(`visibilitychange`,c)}}),be(()=>{let r=B1.progressiveActive&&t()&&n(),i=e(),a=i?lQ.projects[Kr(i.id)]:void 0,o=a?.selectedRepo,s=o?a?.repoStates[Xr(o)]:void 0,c=s?.prs??[],l=A0.activeCenterPrView;if(!r||!i||!a?.repos.length||!o||!s?.repoSummary?.hasGithubRemote||!s.github?.authenticated)return;let u=l?.projectId===i.id&&l.repo===o;if(!t$({visible:document.visibilityState===`visible`,prs:c,activePrNumber:u?l?.number:void 0,activePrPending:u&&l?.checks.data?.checks.status===`pending`}).pollList)return;let d=window.setInterval(()=>{document.visibilityState===`visible`&&s1(i.id,o,!0,!0)},QQ);return()=>window.clearInterval(d)}),r}var M0=N({request:0});function wle(){M0.request+=1}var N0={get settingsDraft(){return rr.settingsDraft},get settingsSaveStatus(){return rr.settingsSaveStatus},get settingsMessage(){return rr.settingsMessage},get selectedModelKey(){return Z.selectedModelKey}};function Tle(e){return t=>{switch(t.kind){case`conversation`:e.refreshConversation(t.id);return;case`pending-conversation`:case`task`:e.selectTab(t);return;case`file`:e.refreshFile(t.id);return;case`pr`:e.refreshPullRequest(t.id);return;case`diff`:e.refreshDiff(t.id);return;case`settings`:e.loadSettings();return;case`auth`:e.loadAuth();return;case`logs`:e.refreshLogs();return}}}var P0=Tle({refreshConversation:e=>void BK(e),selectTab:e=>void Ap(e),refreshFile:e=>void LZ(e),refreshPullRequest:e=>void H$(e),refreshDiff:e=>void m0(e),loadSettings:()=>void OW(),loadAuth:()=>void GW(),refreshLogs:wle}),Ele=h(`<div class="conversation-pane-layer svelte-198ko60"><!></div>`),Dle=h(`<div class="center-workspace-content h-full svelte-198ko60"><!> <!></div>`);function Ole(e,t){a(t,!0);let n=J(()=>If.status),r=J(()=>If.centerTabs),i=J(()=>If.activeCenterTab),o=J(()=>Q.openCenterTabs),s=J(()=>y0(W(i))?W(i):void 0),c=Y(N([])),l=J(()=>Zce(W(c),W(s)));be(()=>{let e=Xce(W(c),W(i),W(o));Yce(W(c),e)||K(c,e,!0)});function u(e){xJ(bJ(e),e)}let p={task:()=>Qx(()=>import(`./TaskShell-BzR6YXIn.js`),__vite__mapDeps([29,30])),file:()=>Qx(()=>import(`./FileShell-DoQAVVCz.js`),__vite__mapDeps([31,30,32,33,34,35,36])),pr:()=>Qx(()=>import(`./PrShell-CmVdW2dh.js`),__vite__mapDeps([37,38,35,30,39,40,41,32,42,43,44,33,45,34,46,47,48,49])),diff:()=>Qx(()=>import(`./DiffShell-CiuEqHmo.js`),__vite__mapDeps([50,38,35,30,39,40,41,32,42,43,44,33,45,34,46,51,52])),settings:()=>Qx(()=>import(`./SettingsShell-D9_ahajy.js`),__vite__mapDeps([53,30,41,54,40,32,45,55,56,57,42,43,44,58,59,60,61,62,33,52,47,48,49])),auth:()=>Qx(()=>import(`./AuthShell-DzpCms9n.js`),__vite__mapDeps([63,30,54,40,41,32,45,55,58,59,61,33,52,64])),logs:()=>Qx(()=>import(`./LogsShell-Ck34Zk9s.js`),__vite__mapDeps([65,30,41,32,57,66]))},m=N({});be(()=>{let e=W(i)?.kind;!e||!(e in p)||m[e]||(m[e]=p[e]())});function h(e){xJ(yJ(e),e)}function v(e){xJ(vJ(e),e)}Ate(e,{contentVisible:!0,tabStrip:e=>{{let t=J(()=>W(n)?.storage.userHome);uf(e,{get tabs(){return W(r)},get homeDir(){return W(t)},onSelect:e=>void Ap(e),onClose:e=>void jp(e),get onRefresh(){return P0},onCloseOther:u,onCloseRight:h,onCloseLeft:v,get onToggleFileDisplayMode(){return RZ},get onToggleFileLineWrap(){return zZ},get onNew(){return NJ},get onReorder(){return Dp}})}},content:e=>{var t=Dle(),n=V(t),r=e=>{var t=U();f(R(t),()=>m.task,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},a=e=>{var t=U();f(R(t),()=>m.file,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},o=e=>{var t=U();f(R(t),()=>m.pr,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},c=e=>{var t=U();f(R(t),()=>m.diff,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},u=e=>{var t=U();f(R(t),()=>m.settings,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},p=e=>{var t=U();f(R(t),()=>m.auth,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},h=e=>{var t=U();f(R(t),()=>m.logs,e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)};k(n,e=>{W(i)?.kind===`task`?e(r):W(i)?.kind===`file`?e(a,1):W(i)?.kind===`pr`?e(o,2):W(i)?.kind===`diff`?e(c,3):W(i)?.kind===`settings`?e(u,4):W(i)?.kind===`auth`?e(p,5):W(i)?.kind===`logs`&&e(h,6)});var v=L(n,2),y=e=>{var t=U();_(R(t),17,()=>W(l),e=>b0(e),(e,t)=>{let n=J(()=>x0(W(s),W(t)));var r=Ele();o0(V(r),{get tab(){return W(t)},get active(){return W(n)}}),d(r),F(()=>q(r,`hidden`,!W(n))),g(e,r)}),g(e,t)},b=e=>{o0(e,{active:!0})};k(v,e=>{W(l).length>0?e(y):W(i)||e(b,1)}),d(t),g(e,t)},$$slots:{tabStrip:!0,content:!0}}),z()}function kle(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return e}}function F0(e){if(!e)return``;let t=new Date(e).getTime();if(Number.isNaN(t))return``;let n=Date.now()-t,r=Math.round(n/1e3);if(r<45)return`now`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);if(a<24)return`${a}h`;let o=Math.round(a/24);if(o<7)return`${o}d`;let s=Math.round(o/7);if(s<5)return`${s}w`;let c=Math.round(o/30);return c<12?`${c}mo`:`${Math.round(o/365)}y`}function I0(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function L0(e,t){a(t,!0);let n=I(t,`isOpen`,3,!1),r=I(t,`isActive`,3,!1),i=J(()=>t.row.agent?.status??`idle`),o=J(()=>t.activity??Ef({conversationId:t.row.conversation.id,agent:t.row.agent,mode:t.row.agent?.mode??t.row.conversation.mode})),s=J(()=>t.row.agent?.mode??t.row.conversation.mode),c=J(()=>t.row.agent?.permissionLevel??t.row.conversation.permissionLevel),l=J(()=>[t.row.conversation.title,`status: ${W(i)}`,`mode: ${W(s)} · ${W(c)}`,`model: ${$n(t.row.agent)}`,`updated: ${I0(t.row.conversation.updatedAt)}`,t.row.conversation.id].join(`
146
+ `));{let i=J(()=>n()?`solid`:`outline`);vn(e,{get label(){return t.row.conversation.title},get title(){return W(l)},get status(){return W(o).tone},get statusVariant(){return W(i)},get pulse(){return W(o).pulse},class:`px-2`,get active(){return r()},get menuItems(){return t.menuItems},onclick:()=>t.onOpenConversation?.(t.row.conversation.id)})}z()}var Ale=h(`<p class="mx-2 my-3 grid min-h-48 place-items-center gap-1 text-center font-mono text-xs text-muted-foreground">No conversations match.</p>`),jle=h(`<div class="conversations-modal svelte-1m5r4e2"><div class="search-box svelte-1m5r4e2"><!></div> <div class="list-region svelte-1m5r4e2"><!></div></div>`);function Mle(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`projectLabel`,3,``),i=I(t,`projectIds`,19,()=>[]),o=I(t,`conversations`,19,()=>[]),s=I(t,`agents`,19,()=>[]),c=I(t,`conversationActivityById`,19,()=>({})),l=Y(``),u=Y(null),f=J(()=>or({conversations:o(),agents:s(),projectIds:i(),filter:W(l)}));be(()=>{if(!n())return;K(l,``);let e,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>W(u)?.focus())});return()=>{cancelAnimationFrame(t),e!==void 0&&cancelAnimationFrame(e)}});function p(e){n(e),t.onOpenChange?.(e)}function m(e){t.onOpenConversation?.(e),p(!1)}{let i=J(()=>`${W(f).length} in ${r()}`);sP(e,{flush:!0,title:`Conversations`,get description(){return W(i)},class:`project-conversations-dialog`,onOpenChange:p,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var r=U();C(R(r),()=>Ey,(e,n)=>{n(e,{delayDuration:300,disableHoverableContent:!0,children:(e,n)=>{var r=jle(),i=V(r);t_(V(i),{placeholder:`Filter conversations`,ariaLabel:`Filter conversations`,get ref(){return W(u)},set ref(e){K(u,e,!0)},get value(){return W(l)},set value(e){K(l,e,!0)}}),d(i);var a=L(i,2),o=V(a),s=e=>{g(e,Ale())},p=e=>{Ii(e,{get items(){return W(f)},getKey:e=>e.conversation.id,estimateSize:()=>32,viewportClass:`h-full px-0.5`,row:(e,n)=>{let r=()=>n?.().item;{let n=J(()=>t.openConversationTabIds?.has(r().conversation.id)??!1),i=J(()=>r().conversation.id===t.selectedConversationId),a=J(()=>t.buildMenu?.(r().conversation)??[]);L0(e,{get row(){return r()},get isOpen(){return W(n)},get isActive(){return W(i)},get activity(){return c()[r().conversation.id]},get menuItems(){return W(a)},onOpenConversation:m})}},$$slots:{row:!0}})};k(o,e=>{W(f).length===0?e(s):e(p,-1)}),d(a),d(r),g(e,r)},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}})}z()}var Nle=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
147
+ <path d="M0.228341 8.36915C0.228341 8.36915 -0.356212 7.94324 0.345251 7.37453L1.97956 5.89736C1.97956 5.89736 2.44721 5.40004 2.94164 5.83334L18.0231 17.375V22.9094C18.0231 22.9094 18.0158 23.7785 16.9124 23.6825L0.228341 8.36915Z" fill="currentColor" />
148
+ <path d="M4.11555 11.9367L0.228273 15.5089C0.228273 15.5089 -0.171172 15.8093 0.228273 16.346L2.03308 18.0053C2.03308 18.0053 2.46175 18.4706 3.09502 17.9413L7.21611 14.7827L4.11555 11.9367Z" fill="currentColor" />
149
+ <path d="M10.94 11.9661L18.0691 6.46362L18.0228 0.95865C18.0228 0.95865 17.7183 -0.242793 16.7027 0.382548L7.21589 9.11025L10.94 11.9661Z" fill="currentColor" />
150
+ <path d="M16.9121 23.69C17.3261 24.1183 17.8279 23.978 17.8279 23.978L23.3838 21.2108C24.0951 20.7208 23.9952 20.1127 23.9952 20.1127V3.58803C23.9952 2.86175 23.2596 2.61063 23.2596 2.61063L18.4441 0.264377C17.3919 -0.392968 16.7027 0.382548 16.7027 0.382548C16.7027 0.382548 17.5892 -0.262484 18.0228 0.95865L18.0228 22.8086C18.0228 22.9588 17.9911 23.1065 17.9278 23.2394C17.8011 23.4979 17.5259 23.7392 16.8658 23.6383L16.9121 23.69Z" fill="currentColor" />
151
+ </svg>
152
+ `;function Ple(e,t){a(t,!1);let n=Nle.replace(`<svg `,`<svg class="size-3.5" `);pe();var r=U();p(R(r),()=>n),g(e,r),z()}var Fle=`<svg viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
153
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M8.4375 5.625C6.8842 5.625 5.625 6.8842 5.625 8.4375V70.3125H0V8.4375C0 3.7776 3.7776 0 8.4375 0H83.7925C87.551 0 89.4333 4.5442 86.7756 7.20186L40.3642 53.6133H53.4375V47.8125H59.0625V55.0195C59.0625 57.3495 57.1737 59.2383 54.8438 59.2383H34.7392L25.0712 68.9062H68.9062V33.75H74.5312V68.9062C74.5312 72.0128 72.0128 74.5312 68.9062 74.5312H19.4462L9.60248 84.375H81.5625C83.1158 84.375 84.375 83.1158 84.375 81.5625V19.6875H90V81.5625C90 86.2224 86.2224 90 81.5625 90H6.20749C2.44898 90 0.566723 85.4558 3.22438 82.7981L49.46 36.5625H36.5625V42.1875H30.9375V35.1562C30.9375 32.8263 32.8263 30.9375 35.1562 30.9375H55.085L64.9288 21.0938H21.0938V56.25H15.4688V21.0938C15.4688 17.9871 17.9871 15.4688 21.0938 15.4688H70.5538L80.3975 5.625H8.4375Z" fill="currentColor" />
154
+ </svg>
155
+ `;function Ile(e,t){a(t,!1);let n=Fle.replace(`<svg `,`<svg class="size-3.5" `);pe();var r=U();p(R(r),()=>n),g(e,r),z()}function R0(e,t){return e.filter(e=>e.projectId===t).length}function Lle(e,t,n){let r=Date.now()-n*24*60*60*1e3;return e.filter(e=>{let n=Date.parse(e.updatedAt);return e.projectId===t&&Number.isFinite(n)&&n<r}).length}function Rle(e,t,n){return Math.max(0,R0(e,t)-n)}async function z0(e,t){try{await Ju(e),Kn.success(`Copied ${t}`)}catch{Kn.error(`Could not copy to clipboard`)}}function zle(e,t){let n=[];return t.editorAvailability?.vscode.available&&n.push({label:`Open in VS Code`,icon:Ple,onSelect:()=>t.onOpenProjectInEditor?.(e.id,`vscode`)}),t.editorAvailability?.zed.available&&n.push({label:`Open in Zed`,icon:Ile,onSelect:()=>t.onOpenProjectInEditor?.(e.id,`zed`)}),n}function Ble(e,t){let n=zle(e,t),r=[{label:`New chat`,icon:hl,shortcut:t.newConversationShortcut,onSelect:()=>t.onNewConversationInProject?.(e.dir)}];return n.length>0&&r.push({type:`separator`},...n),r.push({type:`separator`},{label:`Copy path`,icon:Bu,onSelect:()=>void z0(e.dir,`path`)},{label:`Clean up`,icon:Zv,destructive:!0,disabled:t.conversationCount(e.id)===0,onSelect:()=>t.requestPrune(e)},{label:`Remove project`,icon:Zv,destructive:!0,onSelect:()=>t.requestDelete({kind:`project`,id:e.id,label:er(e.dir,t.homeDir)})}),r}function B0(e,t,n){return[{label:`Open conversation`,icon:kI,onSelect:()=>n.onOpenConversation?.(t.id)},{label:`New chat`,icon:hl,shortcut:n.newConversationShortcut,onSelect:()=>n.onNewConversationInProject?.(e.dir)},{type:`separator`},{label:`Copy conversation id`,icon:Bu,onSelect:()=>void z0(t.id,`conversation id`)},{label:`Delete conversation`,icon:Zv,destructive:!0,onSelect:()=>n.requestDelete({kind:`conversation`,id:t.id,label:t.title})}]}var Vle=h(`<span class="inline-flex" data-tour-id="panel-new-conversation"><!></span>`),Hle=h(`<div class="mt-auto shrink-0 p-1"><!></div>`),Ule=h(`<div class="flex min-h-0 flex-1 flex-col overflow-hidden"><!> <!></div>`),Wle=h(`<!> <!>`,1),Gle=h(`<!> <!> <!>`,1);function Kle(e,t){a(t,!0);let n=I(t,`projects`,19,()=>[]),r=I(t,`conversations`,19,()=>[]),i=I(t,`agents`,19,()=>[]),o=I(t,`conversationActivityById`,19,()=>({})),s=I(t,`searchFocusToken`,3,0),c=Y(void 0),l=Y(!1),u=Y(null),f=Y(null),p=J(()=>n().find(e=>e.id===t.selectedProjectId)??n()[0]),m=J(()=>n().map(e=>e.id)),h=J(()=>or({conversations:r(),agents:i(),projectIds:W(m)})),v=Cn({region:()=>W(u),footer:()=>W(f),total:()=>W(h).length}),y=J(()=>W(h).slice(0,v.count)),b=J(()=>W(y).length<W(h).length),x=Vd(`conversation.new`),S=Vd(`conversation.newFromProject`),T=S?`Use the folder button in the header (${S}) to get started.`:`Use the folder button in the header to get started.`,E=0;be(()=>{s()!==E&&(E=s(),K(l,!0))});let D=J(()=>({homeDir:t.homeDir,newConversationShortcut:x,editorAvailability:t.editorAvailability,conversationCount:e=>r().filter(t=>t.projectId===e).length,onOpenConversation:t.onOpenConversation,onNewConversationInProject:t.onNewConversationInProject,onOpenProjectInEditor:t.onOpenProjectInEditor,requestPrune:e=>t.onPruneProjectConversations?.(e.id,{strategy:`keepLatest`,keepLatest:20}),requestDelete:e=>K(c,e,!0)}));var O=Gle(),ee=R(O);C(ee,()=>Ey,(e,r)=>{r(e,{delayDuration:300,disableHoverableContent:!0,children:(e,r)=>{wn(e,{padded:!1,scroll:!1,children:(e,r)=>{var i=Wle(),a=R(i);gn(a,{title:`Conversations`,get count(){return W(h).length},trailing:e=>{var n=Vle(),r=V(n);{let e=J(()=>x?`New chat (${x})`:`New chat`),n=J(()=>!W(p)||!t.onNewConversationInProject);Dn(r,{get icon(){return hl},label:`New chat`,get title(){return W(e)},get disabled(){return W(n)},onclick:()=>{W(p)&&t.onNewConversationInProject?.(W(p).dir)}})}d(n),g(e,n)},$$slots:{trailing:!0}});var s=L(a,2),c=e=>{xn(e,{title:`No project selected.`,get description(){return T}})},m=e=>{xn(e,{title:`No conversations in this project yet.`,action:e=>{G(e,{variant:`outline`,size:`sm`,onclick:()=>t.onNewConversationInProject?.(W(p).dir),children:(e,t)=>{w(),g(e,M(`New chat`))},$$slots:{default:!0}})},$$slots:{action:!0}})},v=e=>{var r=Ule(),i=V(r);hn(i,{ariaLabel:`Conversations`,class:`shrink-0 py-1`,children:(e,r)=>{var i=U();_(R(i),17,()=>W(y),e=>e.conversation.id,(e,r)=>{let i=J(()=>n().find(e=>e.id===W(r).conversation.projectId)??W(p));{let n=J(()=>t.openConversationTabIds?.has(W(r).conversation.id)??!1),a=J(()=>W(r).conversation.id===t.selectedConversationId),s=J(()=>B0(W(i),W(r).conversation,W(D)));L0(e,{get row(){return W(r)},get isOpen(){return W(n)},get isActive(){return W(a)},get activity(){return o()[W(r).conversation.id]},get menuItems(){return W(s)},get onOpenConversation(){return t.onOpenConversation}})}}),g(e,i)},$$slots:{default:!0}});var a=L(i,2),s=e=>{var t=Hle();G(V(t),{variant:`ghost`,size:`xs`,class:`w-full text-muted-foreground`,onclick:()=>K(l,!0),children:(e,t)=>{w(),g(e,M(`See More`))},$$slots:{default:!0}}),d(t),fe(t,e=>K(f,e),()=>W(f)),g(e,t)};k(a,e=>{W(b)&&e(s)}),d(r),fe(r,e=>K(u,e),()=>W(u)),g(e,r)};k(s,e=>{W(p)?W(h).length===0?e(m,1):e(v,-1):e(c)}),g(e,i)},$$slots:{default:!0}})},$$slots:{default:!0}})});var te=L(ee,2);{let e=J(()=>W(c)?.kind===`conversation`),n=J(()=>W(c)?`This permanently removes “${W(c).label}”.`:``);B_(te,{get open(){return W(e)},title:`Delete conversation?`,get description(){return W(n)},confirmLabel:`Delete`,destructive:!0,onConfirm:()=>{W(c)?.kind===`conversation`&&t.onDeleteConversation?.(W(c).id)},onOpenChange:e=>{e||K(c,void 0)}})}var A=L(te,2),ne=e=>{Mle(e,{get open(){return W(l)},get projectLabel(){return W(p).name},get project(){return W(p)},get projectIds(){return W(m)},get conversations(){return r()},get agents(){return i()},get selectedConversationId(){return t.selectedConversationId},get openConversationTabIds(){return t.openConversationTabIds},get conversationActivityById(){return o()},get onOpenConversation(){return t.onOpenConversation},buildMenu:e=>B0(n().find(t=>t.id===e.projectId)??W(p),e,W(D)),onOpenChange:e=>K(l,e,!0)})};k(A,e=>{W(p)&&e(ne)}),g(e,O),z()}var V0=N({searchFocusToken:0});function qle(){V0.searchFocusToken+=1}function Jle(e,t){a(t,!0);let n=J(()=>If.status),r=J(()=>new Set(If.selectedProjectIds)),i=J(()=>If.projects.filter(e=>W(r).has(e.id))),o=J(()=>If.selectedProjectConversations),s=J(()=>If.agents),c=J(()=>If.openConversationTabIds),l=J(()=>k0.conversationActivityById);{let t=J(()=>W(n)?.storage.userHome),r=J(()=>W(n)?.runtime.editors);Kle(e,{get projects(){return W(i)},get conversations(){return W(o)},get agents(){return W(s)},get homeDir(){return W(t)},get selectedProjectId(){return Of.projectId},get selectedConversationId(){return Of.conversationId},get openConversationTabIds(){return W(c)},get conversationActivityById(){return W(l)},get searchFocusToken(){return V0.searchFocusToken},get editorAvailability(){return W(r)},get onOpenConversation(){return WK},get onNewConversationInProject(){return PJ},onOpenProjectInEditor:(e,t)=>void LJ(e,t),onDeleteProject:e=>void FJ(e),onDeleteConversation:e=>void IJ(e),onPruneProjectConversations:(e,t)=>void RJ(e,t)})}z()}var Yle=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xle(e,t){let n=H(t,Yle),r=[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}]];P(e,B({name:`layout-grid`},()=>n,{get iconNode(){return r}}))}var Zle=h(`<!> <span class="truncate"> </span>`,1),Qle=h(`<nav class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden" aria-label="Projects"><!> <div class="flex min-w-0 flex-1 items-center gap-0.5 overflow-hidden"></div></nav>`);function $le(e,t){a(t,!0);let n=I(t,`items`,19,()=>[]),r=Vd(`conversation.newFromProject`),i=r?`Switch project (${r})`:`Switch project`,o=Hd(`conversation.newFromProject`);function s(e){let t=ff(e.activity);return t?`${e.label}: ${t.summary}`:e.label}var c=Qle(),l=V(c);G(l,{variant:`ghost`,size:`icon-sm`,class:`shrink-0 [-webkit-app-region:no-drag]`,ariaLabel:`Switch project`,get title(){return i},"data-tour-id":`guide-project-open`,get"aria-keyshortcuts"(){return o},onclick:()=>t.onOpenPicker?.(),children:(e,t)=>{Xle(e,{class:`size-4`,"aria-hidden":`true`})},$$slots:{default:!0}});var u=L(l,2);_(u,21,n,e=>e.key,(e,n)=>{let r=J(()=>ff(W(n).activity)),i=J(()=>W(n).key===t.activeKey);{let a=J(()=>t.buildMenuItems?.(W(n))??[]),o=J(()=>!t.buildMenuItems);un(e,{get items(){return W(a)},get disabled(){return W(o)},triggerClass:`block min-w-0 max-w-56 overflow-hidden [-webkit-app-region:no-drag]`,children:(e,a)=>{{let a=J(()=>`w-full min-w-0 gap-1.5 px-2 ${W(i)?``:`text-muted-foreground`}`),o=J(()=>W(i)?`page`:void 0),c=J(()=>s(W(n))),l=J(()=>`${W(n).project.dir}${W(r)?` — ${W(r).summary}`:``}`);G(e,{variant:`ghost`,size:`sm`,get class(){return W(a)},get active(){return W(i)},get pressed(){return W(i)},get"aria-current"(){return W(o)},get ariaLabel(){return W(c)},get title(){return W(l)},onclick:()=>t.onSelect?.(W(n).project.id),children:(e,t)=>{var i=Zle(),a=R(i),o=e=>{ht(e,{get tone(){return W(r).tone},size:`xs`,get pulse(){return W(r).pulse}})};k(a,e=>{W(r)&&e(o)});var s=L(a,2),c=V(s,!0);d(s),F(()=>A(c,W(n).label)),g(e,i)},$$slots:{default:!0}})}},$$slots:{default:!0}})}}),d(u),d(c),g(e,c),z()}var H0={get tasks(){return sr.tasks},get scopedTasks(){let e=If.activeProject?.dir;return e?sr.tasks.filter(t=>Jd(t.cwd,e)):[]},get selectedTask(){return sr.tasks.find(e=>e.id===sr.selectedTaskId)},get activeCenterTask(){let e=Q.activeCenterTab;if(e?.kind!==`task`)return;let t=sr.tasks.filter(t=>(t.definitionId??t.restartRootTaskId??t.id)===e.id).sort((e,t)=>t.startedAt.localeCompare(e.startedAt));return t.find(t=>t.id===sr.selectedRunByEntry[e.id])??t[0]},get taskLogs(){return sr.taskLogs}};async function eue(e){sr.selectedTaskId=e,await cJ(e)}async function tue(e,t={}){let n=sr.tasks.find(t=>t.id===e)?.status===`orphaned`;await nte(e,t),await CJ(),sr.selectedTaskId&&await cJ(sr.selectedTaskId),Kn.success(t.signal===`SIGKILL`?`Task force killed`:n?`Orphaned task cleanup completed`:`Task cancelled`)}async function nue(e){let t=g0(e),n=await $ee(e);_0(t,n.id),sr.selectedTaskId=n.id,await CJ(),await cJ(n.id),Kn.success(`Task restarted`,{description:n.name??n.command??n.id})}function U0(e){let t=g0(e),n=sr.tasks.filter(n=>n.id!==e&&(n.definitionId??n.restartRootTaskId??n.id)===t).sort((e,t)=>t.startedAt.localeCompare(e.startedAt));n[0]?_0(t,n[0].id):Ep({kind:`task`,id:t}),Q.activeCenterTab?.kind===`task`&&Q.activeCenterTab.id===e&&Mp(),sr.selectedTaskId===e&&(sr.selectedTaskId=void 0,sr.taskLogs=void 0)}async function rue(e){await Qee(e),U0(e),await CJ(),Kn.success(`Task removed`)}async function iue(){let{removed:e}=await Jee();for(let t of e)U0(t);await CJ(),Kn.success(e.length===1?`Removed 1 finished task`:`Removed ${e.length} finished tasks`)}async function aue(e){let t=await tte(e);return await CJ(),await eue(t.id),Kn.success(`Command started`,{description:e.name??e.command}),t}var oue=`max-width: 1023px`,sue=`max-width: 639px`,W0,G0;typeof window<`u`&&typeof window.matchMedia==`function`&&(W0=new Ce(oue),G0=new Ce(sue));var K0={get isCompact(){return W0?.current??!1},get isPhone(){return G0?.current??!1}},cue=new Set([`$$slots`,`$$events`,`$$legacy`]);function q0(e,t){let n=H(t,cue),r=[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`}]];P(e,B({name:`folder-tree`},()=>n,{get iconNode(){return r}}))}var lue=new Set([`$$slots`,`$$events`,`$$legacy`]);function J0(e,t){let n=H(t,lue),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 16v-4`}],[`path`,{d:`M12 8h.01`}]];P(e,B({name:`info`},()=>n,{get iconNode(){return r}}))}var uue=new Set([`$$slots`,`$$events`,`$$legacy`]);function Y0(e,t){let n=H(t,uue),r=[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`}],[`path`,{d:`M2 6h4`}],[`path`,{d:`M2 10h4`}],[`path`,{d:`M2 14h4`}],[`path`,{d:`M2 18h4`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`}]];P(e,B({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var X0=[{id:`conversations`,title:`Conversations`,icon:zN,defaultDock:`left`,defaultOrder:0,hideable:!1},{id:`files`,title:`Files`,icon:q0,defaultDock:`left`,defaultOrder:1},{id:`git`,title:`Git Changes`,icon:oI,defaultDock:`right`,defaultOrder:0},{id:`pull-requests`,title:`Pull Requests`,icon:Uu,defaultDock:`right`,defaultOrder:1},{id:`context`,title:`Context`,icon:J0,defaultDock:`right`,defaultOrder:2},{id:`tasks`,title:`Tasks`,icon:qu,defaultDock:`left`,defaultOrder:2},{id:`notes`,title:`Scratch Notes`,icon:Y0,defaultDock:`left`,defaultOrder:3}],Z0=`nerve.layout.v1`,due=200,Q0={collapsed:[`bottom`]};function fue(){if(typeof localStorage>`u`)return Ml(void 0,X0,{collapsed:[...Q0.collapsed]});let e;try{let t=localStorage.getItem(Z0);e=t?JSON.parse(t):void 0}catch{e=void 0}return Ml(e,X0,{collapsed:[...Q0.collapsed]})}var $0=N({layout:fue()}),e2=N({primary:!1,secondary:!1}),t2={get current(){return $0.layout}};function n2(){if(!(typeof localStorage>`u`))try{localStorage.setItem(Z0,JSON.stringify($0.layout))}catch{}}function r2(e,t=!0){e!==$0.layout&&($0.layout=e,t&&n2())}function pue(){return{layout:JSON.parse(JSON.stringify($0.layout)),sheets:{primary:e2.primary,secondary:e2.secondary}}}function mue(e){$0.layout=Ml(e.layout,X0,{collapsed:[...Q0.collapsed]}),e2.primary=e.sheets.primary,e2.secondary=e.sheets.secondary,n2()}function i2(e){r2(Fte($0.layout,e))}function hue(e,t){r2(Pte($0.layout,e,t))}function gue(e){r2(Ite($0.layout,e))}function a2(e){r2(Rte($0.layout,e))}function _ue(e){return Fl($0.layout,e)}var o2;function vue(e,t){let n=zte($0.layout,e,t);n!==$0.layout&&($0.layout=n,o2&&clearTimeout(o2),o2=setTimeout(n2,due))}function s2(e,t){e2[e]=t,t&&(e2[e===`primary`?`secondary`:`primary`]=!1)}function c2(){e2.primary=!1,e2.secondary=!1}function l2(e,t){if(!t){a2(e);return}let n=e===`left`?`primary`:`secondary`;s2(n,!e2[n])}function u2(e,t){d2(e,t,!0)}function yue(e,t){d2(e,t,!1)}function d2(e,t,n){if(r2(Lte($0.layout,e),n),!t)return;let r=[`left`,`right`,`bottom`].find(t=>$0.layout.docks[t].views.includes(e));r&&s2(r===`left`?`primary`:`secondary`,!0)}function bue(e,t){a(t,!0);let n=Y(void 0),r=Y(void 0),i=Y(void 0),o=Y(void 0),s=J(()=>If.status),c=J(()=>If.activeProject),l=J(()=>k0.activeConversation),u=J(()=>k0.activeAgent),d=J(()=>k0.conversationAgents),p=J(()=>k0.compacting),m=J(()=>k0.activeContextUsage),h=J(()=>k0.activeContextWindow),_=J(()=>H0.scopedTasks),v=J(()=>H0.selectedTask);be(()=>{t.viewId===`files`?K(n,W(n)??Qx(()=>import(`./FilesPanelView-BbI7dxQA.js`),__vite__mapDeps([67,30,39,40,41,32,42,43,44,33,49,47,48])),!0):t.viewId===`tasks`?K(r,W(r)??Qx(()=>import(`./TasksPanelView-BnWJjqs-.js`),__vite__mapDeps([68,30,69,61,52,47,48,49])),!0):t.viewId===`notes`?K(i,W(i)??Qx(()=>import(`./scratch-notes-BGV5WcII.js`),__vite__mapDeps([70,30,39,40,41,32,42,43,44,33,61,47,48,49])),!0):t.viewId===`pull-requests`&&K(o,W(o)??Qx(()=>import(`./GitPullRequestsPanelView-BAueBEFa.js`),__vite__mapDeps([71,30,39,40,41,32,42,43,44,33,54,45,55,56,57,46])),!0)});function y(e){Of.agentId=e.id,Of.projectId=e.projectId,Of.conversationId=e.conversationId,u2(`context`,K0.isCompact)}function b(){u2(`tasks`,K0.isCompact),i2(`tasks`)}var x=U(),S=R(x),w=e=>{var t=U();f(R(t),()=>W(n),e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{get activeProject(){return W(c)}})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},T=e=>{Jle(e,{})},E=e=>{aX(e,{get model(){return t.gitModel},get actions(){return t.gitActions}})},D=e=>{var n=U();f(R(n),()=>W(o),e=>{c0(e,{})},(e,n)=>{let r=J(()=>W(n)?.default);var i=U(),a=R(i),o=e=>{var n=U();C(R(n),()=>W(r),(e,n)=>{n(e,{get model(){return t.gitModel},get actions(){return t.gitActions}})}),g(e,n)};k(a,e=>{W(r)&&e(o)}),g(e,i)}),g(e,n)},O=e=>{yle(e,{get status(){return W(s)},get contextUsage(){return W(m)},get contextWindow(){return W(h)},get activeProject(){return W(c)},get activeConversation(){return W(l)},get activeAgent(){return W(u)},get conversationAgents(){return W(d)},get compacting(){return W(p)},get exportUrl(){return OJ},get systemPromptUrl(){return kJ},onSelectAgent:y,onCompact:()=>void Eq()})},ee=e=>{var t=U();f(R(t),()=>W(i),e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.NotesPanelView);var r=U(),i=R(r),a=e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{get activeProject(){return W(c)}})}),g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)},te=e=>{var t=U();f(R(t),()=>W(r),e=>{c0(e,{})},(e,t)=>{let n=J(()=>W(t)?.default);var r=U(),i=R(r),a=e=>{var t=U(),r=R(t);{let e=J(()=>W(s)?.storage.userHome);C(r,()=>W(n),(t,n)=>{n(t,{get activeProject(){return W(c)},get tasks(){return W(_)},get selectedTask(){return W(v)},get homeDir(){return W(e)},onOpenTaskOutput:e=>{b(),Kce(e)},onCancelTask:(e,t)=>void tue(e,t),onRestartTask:e=>void nue(e),onRemoveTask:e=>void rue(e),onPruneTasks:()=>void iue(),onRunCommand:e=>{b(),aue(e)}})})}g(e,t)};k(i,e=>{W(n)&&e(a)}),g(e,r)}),g(e,t)};k(S,e=>{t.viewId===`files`?e(w):t.viewId===`conversations`?e(T,1):t.viewId===`git`?e(E,2):t.viewId===`pull-requests`?e(D,3):t.viewId===`context`?e(O,4):t.viewId===`notes`?e(ee,5):t.viewId===`tasks`&&e(te,6)}),g(e,x),z()}var xue={value:()=>{}};function f2(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new p2(n)}function p2(e){this._=e}function Sue(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}p2.prototype=f2.prototype={constructor:p2,on:function(e,t){var n=this._,r=Sue(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Cue(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=m2(n[i],e.name,t);else if(t==null)for(i in n)n[i]=m2(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new p2(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function Cue(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function m2(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=xue,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var h2={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function g2(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),h2.hasOwnProperty(t)?{space:h2[t],local:e}:e}function wue(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Tue(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _2(e){var t=g2(e);return(t.local?Tue:wue)(t)}function Eue(){}function v2(e){return e==null?Eue:function(){return this.querySelector(e)}}function Due(e){typeof e!=`function`&&(e=v2(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new N2(r,this._parents)}function Oue(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function kue(){return[]}function y2(e){return e==null?kue:function(){return this.querySelectorAll(e)}}function Aue(e){return function(){return Oue(e.apply(this,arguments))}}function jue(e){e=typeof e==`function`?Aue(e):y2(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new N2(r,i)}function b2(e){return function(){return this.matches(e)}}function x2(e){return function(t){return t.matches(e)}}var Mue=Array.prototype.find;function Nue(e){return function(){return Mue.call(this.children,e)}}function Pue(){return this.firstElementChild}function Fue(e){return this.select(e==null?Pue:Nue(typeof e==`function`?e:x2(e)))}var Iue=Array.prototype.filter;function Lue(){return Array.from(this.children)}function Rue(e){return function(){return Iue.call(this.children,e)}}function zue(e){return this.selectAll(e==null?Lue:Rue(typeof e==`function`?e:x2(e)))}function Bue(e){typeof e!=`function`&&(e=b2(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new N2(r,this._parents)}function S2(e){return Array(e.length)}function Vue(){return new N2(this._enter||this._groups.map(S2),this._parents)}function C2(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}C2.prototype={constructor:C2,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Hue(e){return function(){return e}}function Uue(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new C2(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Wue(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new C2(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Gue(e){return e.__data__}function Kue(e,t){if(!arguments.length)return Array.from(this,Gue);var n=t?Wue:Uue,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Hue(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=que(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new N2(o,r),o._enter=s,o._exit=c,o}function que(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Jue(){return new N2(this._exit||this._groups.map(S2),this._parents)}function Yue(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Xue(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new N2(s,this._parents)}function Zue(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Que(e){e||=$ue;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new N2(i,this._parents).order()}function $ue(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ede(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tde(){return Array.from(this)}function nde(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function rde(){let e=0;for(let t of this)++e;return e}function ide(){return!this.node()}function ade(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function ode(e){return function(){this.removeAttribute(e)}}function sde(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cde(e,t){return function(){this.setAttribute(e,t)}}function lde(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ude(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function dde(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function fde(e,t){var n=g2(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?sde:ode:typeof t==`function`?n.local?dde:ude:n.local?lde:cde)(n,t))}function w2(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pde(e){return function(){this.style.removeProperty(e)}}function mde(e,t,n){return function(){this.style.setProperty(e,t,n)}}function hde(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function gde(e,t,n){return arguments.length>1?this.each((t==null?pde:typeof t==`function`?hde:mde)(e,t,n??``)):T2(this.node(),e)}function T2(e,t){return e.style.getPropertyValue(t)||w2(e).getComputedStyle(e,null).getPropertyValue(t)}function _de(e){return function(){delete this[e]}}function vde(e,t){return function(){this[e]=t}}function yde(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function bde(e,t){return arguments.length>1?this.each((t==null?_de:typeof t==`function`?yde:vde)(e,t)):this.node()[e]}function E2(e){return e.trim().split(/^|\s+/)}function D2(e){return e.classList||new O2(e)}function O2(e){this._node=e,this._names=E2(e.getAttribute(`class`)||``)}O2.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function k2(e,t){for(var n=D2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function A2(e,t){for(var n=D2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function xde(e){return function(){k2(this,e)}}function Sde(e){return function(){A2(this,e)}}function Cde(e,t){return function(){(t.apply(this,arguments)?k2:A2)(this,e)}}function wde(e,t){var n=E2(e+``);if(arguments.length<2){for(var r=D2(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Cde:t?xde:Sde)(n,t))}function Tde(){this.textContent=``}function Ede(e){return function(){this.textContent=e}}function Dde(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Ode(e){return arguments.length?this.each(e==null?Tde:(typeof e==`function`?Dde:Ede)(e)):this.node().textContent}function kde(){this.innerHTML=``}function Ade(e){return function(){this.innerHTML=e}}function jde(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Mde(e){return arguments.length?this.each(e==null?kde:(typeof e==`function`?jde:Ade)(e)):this.node().innerHTML}function Nde(){this.nextSibling&&this.parentNode.appendChild(this)}function Pde(){return this.each(Nde)}function Fde(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ide(){return this.each(Fde)}function Lde(e){var t=typeof e==`function`?e:_2(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Rde(){return null}function zde(e,t){var n=typeof e==`function`?e:_2(e),r=t==null?Rde:typeof t==`function`?t:v2(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Bde(){var e=this.parentNode;e&&e.removeChild(this)}function Vde(){return this.each(Bde)}function Hde(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ude(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Wde(e){return this.select(e?Ude:Hde)}function Gde(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Kde(e){return function(t){e.call(this,t,this.__data__)}}function qde(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Jde(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Yde(e,t,n){return function(){var r=this.__on,i,a=Kde(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Xde(e,t,n){var r=qde(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Yde:Jde,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function j2(e,t,n){var r=w2(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Zde(e,t){return function(){return j2(this,e,t)}}function Qde(e,t){return function(){return j2(this,e,t.apply(this,arguments))}}function $de(e,t){return this.each((typeof t==`function`?Qde:Zde)(e,t))}function*efe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var M2=[null];function N2(e,t){this._groups=e,this._parents=t}function P2(){return new N2([[document.documentElement]],M2)}function tfe(){return this}N2.prototype=P2.prototype={constructor:N2,select:Due,selectAll:jue,selectChild:Fue,selectChildren:zue,filter:Bue,data:Kue,enter:Vue,exit:Jue,join:Yue,merge:Xue,selection:tfe,order:Zue,sort:Que,call:ede,nodes:tde,node:nde,size:rde,empty:ide,each:ade,attr:fde,style:gde,property:bde,classed:wde,text:Ode,html:Mde,raise:Pde,lower:Ide,append:Lde,insert:zde,remove:Vde,clone:Wde,datum:Gde,on:Xde,dispatch:$de,[Symbol.iterator]:efe};function F2(e){return typeof e==`string`?new N2([[document.querySelector(e)]],[document.documentElement]):new N2([[e]],M2)}function nfe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function I2(e,t){if(e=nfe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var rfe={passive:!1},L2={capture:!0,passive:!1};function R2(e){e.stopImmediatePropagation()}function z2(e){e.preventDefault(),e.stopImmediatePropagation()}function B2(e){var t=e.document.documentElement,n=F2(e).on(`dragstart.drag`,z2,L2);`onselectstart`in t?n.on(`selectstart.drag`,z2,L2):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function V2(e,t){var n=e.document.documentElement,r=F2(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,z2,L2),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var H2=e=>()=>e;function U2(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}U2.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ife(e){return!e.ctrlKey&&!e.button}function afe(){return this.parentNode}function ofe(e,t){return t??{x:e.x,y:e.y}}function sfe(){return navigator.maxTouchPoints||`ontouchstart`in this}function cfe(){var e=ife,t=afe,n=ofe,r=sfe,i={},a=f2(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,rfe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(F2(n.view).on(`mousemove.drag`,m,L2).on(`mouseup.drag`,h,L2),B2(n.view),R2(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(z2(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){F2(e.view).on(`mousemove.drag mouseup.drag`,null),V2(e.view,l),z2(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(R2(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(z2(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(R2(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=I2(l||r,t),p,m,h;if((h=n.call(e,new U2(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=I2(l||a,t),_=o;break}u.call(r,e,new U2(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:H2(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:H2(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:H2(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:H2(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function W2(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function G2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function K2(){}var q2=.7,J2=1/q2,Y2=`\\s*([+-]?\\d+)\\s*`,X2=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Z2=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,lfe=/^#([0-9a-f]{3,8})$/,ufe=RegExp(`^rgb\\(${Y2},${Y2},${Y2}\\)$`),dfe=RegExp(`^rgb\\(${Z2},${Z2},${Z2}\\)$`),ffe=RegExp(`^rgba\\(${Y2},${Y2},${Y2},${X2}\\)$`),pfe=RegExp(`^rgba\\(${Z2},${Z2},${Z2},${X2}\\)$`),mfe=RegExp(`^hsl\\(${X2},${Z2},${Z2}\\)$`),hfe=RegExp(`^hsla\\(${X2},${Z2},${Z2},${X2}\\)$`),Q2={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};W2(K2,t4,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$2,formatHex:$2,formatHex8:gfe,formatHsl:_fe,formatRgb:e4,toString:e4});function $2(){return this.rgb().formatHex()}function gfe(){return this.rgb().formatHex8()}function _fe(){return p4(this).formatHsl()}function e4(){return this.rgb().formatRgb()}function t4(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=lfe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?n4(t):n===3?new o4(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?r4(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?r4(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ufe.exec(e))?new o4(t[1],t[2],t[3],1):(t=dfe.exec(e))?new o4(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ffe.exec(e))?r4(t[1],t[2],t[3],t[4]):(t=pfe.exec(e))?r4(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mfe.exec(e))?f4(t[1],t[2]/100,t[3]/100,1):(t=hfe.exec(e))?f4(t[1],t[2]/100,t[3]/100,t[4]):Q2.hasOwnProperty(e)?n4(Q2[e]):e===`transparent`?new o4(NaN,NaN,NaN,0):null}function n4(e){return new o4(e>>16&255,e>>8&255,e&255,1)}function r4(e,t,n,r){return r<=0&&(e=t=n=NaN),new o4(e,t,n,r)}function i4(e){return e instanceof K2||(e=t4(e)),e?(e=e.rgb(),new o4(e.r,e.g,e.b,e.opacity)):new o4}function a4(e,t,n,r){return arguments.length===1?i4(e):new o4(e,t,n,r??1)}function o4(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}W2(o4,a4,G2(K2,{brighter(e){return e=e==null?J2:J2**+e,new o4(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?q2:q2**+e,new o4(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new o4(u4(this.r),u4(this.g),u4(this.b),l4(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:s4,formatHex:s4,formatHex8:vfe,formatRgb:c4,toString:c4}));function s4(){return`#${d4(this.r)}${d4(this.g)}${d4(this.b)}`}function vfe(){return`#${d4(this.r)}${d4(this.g)}${d4(this.b)}${d4((isNaN(this.opacity)?1:this.opacity)*255)}`}function c4(){let e=l4(this.opacity);return`${e===1?`rgb(`:`rgba(`}${u4(this.r)}, ${u4(this.g)}, ${u4(this.b)}${e===1?`)`:`, ${e})`}`}function l4(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function u4(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function d4(e){return e=u4(e),(e<16?`0`:``)+e.toString(16)}function f4(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new m4(e,t,n,r)}function p4(e){if(e instanceof m4)return new m4(e.h,e.s,e.l,e.opacity);if(e instanceof K2||(e=t4(e)),!e)return new m4;if(e instanceof m4)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new m4(o,s,c,e.opacity)}function yfe(e,t,n,r){return arguments.length===1?p4(e):new m4(e,t,n,r??1)}function m4(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}W2(m4,yfe,G2(K2,{brighter(e){return e=e==null?J2:J2**+e,new m4(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?q2:q2**+e,new m4(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new o4(_4(e>=240?e-240:e+120,i,r),_4(e,i,r),_4(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new m4(h4(this.h),g4(this.s),g4(this.l),l4(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=l4(this.opacity);return`${e===1?`hsl(`:`hsla(`}${h4(this.h)}, ${g4(this.s)*100}%, ${g4(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function h4(e){return e=(e||0)%360,e<0?e+360:e}function g4(e){return Math.max(0,Math.min(1,e||0))}function _4(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var v4=e=>()=>e;function y4(e,t){return function(n){return e+n*t}}function bfe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function xfe(e,t){var n=t-e;return n?y4(e,n>180||n<-180?n-360*Math.round(n/360):n):v4(isNaN(e)?t:e)}function Sfe(e){return(e=+e)==1?b4:function(t,n){return n-t?bfe(t,n,e):v4(isNaN(t)?n:t)}}function b4(e,t){var n=t-e;return n?y4(e,n):v4(isNaN(e)?t:e)}var x4=(function e(t){var n=Sfe(t);function r(e,t){var r=n((e=a4(e)).r,(t=a4(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=b4(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Cfe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function wfe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Tfe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=E4(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Efe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function S4(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Dfe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=E4(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var C4=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,w4=new RegExp(C4.source,`g`);function Ofe(e){return function(){return e}}function kfe(e){return function(t){return e(t)+``}}function T4(e,t){var n=C4.lastIndex=w4.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=C4.exec(e))&&(i=w4.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:S4(r,i)})),n=w4.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?kfe(c[0].x):Ofe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function E4(e,t){var n=typeof t,r;return t==null||n===`boolean`?v4(t):(n===`number`?S4:n===`string`?(r=t4(t))?(t=r,x4):T4:t instanceof t4?x4:t instanceof Date?Efe:wfe(t)?Cfe:Array.isArray(t)?Tfe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Dfe:S4)(e,t)}var D4=180/Math.PI,O4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function k4(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*D4,skewX:Math.atan(c)*D4,scaleX:o,scaleY:s}}var A4;function Afe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?O4:k4(t.a,t.b,t.c,t.d,t.e,t.f)}function jfe(e){return e==null||(A4||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),A4.setAttribute(`transform`,e),!(e=A4.transform.baseVal.consolidate()))?O4:(e=e.matrix,k4(e.a,e.b,e.c,e.d,e.e,e.f))}function j4(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:S4(e,i)},{i:c-2,x:S4(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:S4(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:S4(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:S4(e,n)},{i:s-2,x:S4(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Mfe=j4(Afe,`px, `,`px)`,`deg)`),Nfe=j4(jfe,`, `,`)`,`)`),Pfe=1e-12;function M4(e){return((e=Math.exp(e))+1/e)/2}function Ffe(e){return((e=Math.exp(e))-1/e)/2}function Ife(e){return((e=Math.exp(2*e))-1)/(e+1)}var N4=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Pfe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=M4(y),c=s/(n*g)*(i*Ife(t*r+y)-Ffe(y));return[a+c*d,o+c*f,s*i/M4(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),P4=0,F4=0,I4=0,L4=1e3,R4,z4,B4=0,V4=0,H4=0,U4=typeof performance==`object`&&performance.now?performance:Date,W4=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function G4(){return V4||=(W4(Lfe),U4.now()+H4)}function Lfe(){V4=0}function K4(){this._call=this._time=this._next=null}K4.prototype=q4.prototype={constructor:K4,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?G4():+n)+(t==null?0:+t),!this._next&&z4!==this&&(z4?z4._next=this:R4=this,z4=this),this._call=e,this._time=n,Y4()},stop:function(){this._call&&(this._call=null,this._time=1/0,Y4())}};function q4(e,t,n){var r=new K4;return r.restart(e,t,n),r}function Rfe(){G4(),++P4;for(var e=R4,t;e;)(t=V4-e._time)>=0&&e._call.call(void 0,t),e=e._next;--P4}function J4(){V4=(B4=U4.now())+H4,P4=F4=0;try{Rfe()}finally{P4=0,Bfe(),V4=0}}function zfe(){var e=U4.now(),t=e-B4;t>L4&&(H4-=t,B4=e)}function Bfe(){for(var e,t=R4,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:R4=n);z4=e,Y4(r)}function Y4(e){P4||(F4&&=clearTimeout(F4),e-V4>24?(e<1/0&&(F4=setTimeout(J4,e-U4.now()-H4)),I4&&=clearInterval(I4)):(I4||=(B4=U4.now(),setInterval(zfe,L4)),P4=1,W4(J4)))}function X4(e,t,n){var r=new K4;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Vfe=f2(`start`,`end`,`cancel`,`interrupt`),Hfe=[];function Z4(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ufe(e,n,{name:t,index:r,group:i,on:Vfe,tween:Hfe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Q4(e,t){var n=e3(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function $4(e,t){var n=e3(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function e3(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ufe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=q4(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return X4(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(X4(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function t3(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Wfe(e){return this.each(function(){t3(this,e)})}function Gfe(e,t){var n,r;return function(){var i=$4(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Kfe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=$4(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function qfe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=e3(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Gfe:Kfe)(n,e,t))}function n3(e,t,n){var r=e._id;return e.each(function(){var e=$4(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return e3(e,r).value[t]}}function r3(e,t){var n;return(typeof t==`number`?S4:t instanceof t4?x4:(n=t4(t))?(t=n,x4):T4)(e,t)}function Jfe(e){return function(){this.removeAttribute(e)}}function Yfe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xfe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Zfe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Qfe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function $fe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function epe(e,t){var n=g2(e),r=n===`transform`?Nfe:r3;return this.attrTween(e,typeof t==`function`?(n.local?$fe:Qfe)(n,r,n3(this,`attr.`+e,t)):t==null?(n.local?Yfe:Jfe)(n):(n.local?Zfe:Xfe)(n,r,t))}function tpe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function npe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function rpe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&npe(e,i)),n}return i._value=t,i}function ipe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&tpe(e,i)),n}return i._value=t,i}function ape(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=g2(e);return this.tween(n,(r.local?rpe:ipe)(r,t))}function ope(e,t){return function(){Q4(this,e).delay=+t.apply(this,arguments)}}function spe(e,t){return t=+t,function(){Q4(this,e).delay=t}}function cpe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ope:spe)(t,e)):e3(this.node(),t).delay}function lpe(e,t){return function(){$4(this,e).duration=+t.apply(this,arguments)}}function upe(e,t){return t=+t,function(){$4(this,e).duration=t}}function dpe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?lpe:upe)(t,e)):e3(this.node(),t).duration}function fpe(e,t){if(typeof t!=`function`)throw Error();return function(){$4(this,e).ease=t}}function ppe(e){var t=this._id;return arguments.length?this.each(fpe(t,e)):e3(this.node(),t).ease}function mpe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();$4(this,e).ease=n}}function hpe(e){if(typeof e!=`function`)throw Error();return this.each(mpe(this._id,e))}function gpe(e){typeof e!=`function`&&(e=b2(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new a3(r,this._parents,this._name,this._id)}function _pe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new a3(o,this._parents,this._name,this._id)}function vpe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ype(e,t,n){var r,i,a=vpe(t)?Q4:$4;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function bpe(e,t){var n=this._id;return arguments.length<2?e3(this.node(),n).on.on(e):this.each(ype(n,e,t))}function xpe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Spe(){return this.on(`end.remove`,xpe(this._id))}function Cpe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=v2(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Z4(l[f],t,n,f,l,e3(u,n)));return new a3(a,this._parents,t,n)}function wpe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=y2(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=e3(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Z4(p,t,n,h,f,m);a.push(f),o.push(u)}return new a3(a,o,t,n)}var Tpe=P2.prototype.constructor;function Epe(){return new Tpe(this._groups,this._parents)}function Dpe(e,t){var n,r,i;return function(){var a=T2(this,e),o=(this.style.removeProperty(e),T2(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function i3(e){return function(){this.style.removeProperty(e)}}function Ope(e,t,n){var r,i=n+``,a;return function(){var o=T2(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function kpe(e,t,n){var r,i,a;return function(){var o=T2(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),T2(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Ape(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=$4(this,e),l=c.on,u=c.value[a]==null?s||=i3(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function jpe(e,t,n){var r=(e+=``)==`transform`?Mfe:r3;return t==null?this.styleTween(e,Dpe(e,r)).on(`end.style.`+e,i3(e)):typeof t==`function`?this.styleTween(e,kpe(e,r,n3(this,`style.`+e,t))).each(Ape(this._id,e)):this.styleTween(e,Ope(e,r,t),n).on(`end.style.`+e,null)}function Mpe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Npe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Mpe(e,a,n)),r}return a._value=t,a}function Ppe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Npe(e,t,n??``))}function Fpe(e){return function(){this.textContent=e}}function Ipe(e){return function(){var t=e(this);this.textContent=t??``}}function Lpe(e){return this.tween(`text`,typeof e==`function`?Ipe(n3(this,`text`,e)):Fpe(e==null?``:e+``))}function Rpe(e){return function(t){this.textContent=e.call(this,t)}}function zpe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Rpe(r)),t}return r._value=e,r}function Bpe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,zpe(e))}function Vpe(){for(var e=this._name,t=this._id,n=o3(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=e3(c,t);Z4(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new a3(r,this._parents,e,n)}function Hpe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=$4(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Upe=0;function a3(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Wpe(e){return P2().transition(e)}function o3(){return++Upe}var s3=P2.prototype;a3.prototype=Wpe.prototype={constructor:a3,select:Cpe,selectAll:wpe,selectChild:s3.selectChild,selectChildren:s3.selectChildren,filter:gpe,merge:_pe,selection:Epe,transition:Vpe,call:s3.call,nodes:s3.nodes,node:s3.node,size:s3.size,empty:s3.empty,each:s3.each,on:bpe,attr:epe,attrTween:ape,style:jpe,styleTween:Ppe,text:Lpe,textTween:Bpe,remove:Spe,tween:qfe,delay:cpe,duration:dpe,ease:ppe,easeVarying:hpe,end:Hpe,[Symbol.iterator]:s3[Symbol.iterator]};function Gpe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kpe={time:null,delay:0,duration:250,ease:Gpe};function qpe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Jpe(e){var t,n;e instanceof a3?(t=e._id,e=e._name):(t=o3(),(n=Kpe).time=G4(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Z4(c,e,t,l,o,n||qpe(c,t));return new a3(r,this._parents,e,t)}P2.prototype.interrupt=Wfe,P2.prototype.transition=Jpe;var c3=e=>()=>e;function Ype(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function l3(e,t,n){this.k=e,this.x=t,this.y=n}l3.prototype={constructor:l3,scale:function(e){return e===1?this:new l3(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new l3(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var u3=new l3(1,0,0);d3.prototype=l3.prototype;function d3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return u3;return e.__zoom}function f3(e){e.stopImmediatePropagation()}function p3(e){e.preventDefault(),e.stopImmediatePropagation()}function Xpe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Zpe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function m3(){return this.__zoom||u3}function Qpe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $pe(){return navigator.maxTouchPoints||`ontouchstart`in this}function eme(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function h3(){var e=Xpe,t=Zpe,n=eme,r=Qpe,i=$pe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=N4,l=f2(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,m3).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,ee).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,m3),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(u3.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new l3(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new l3(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new l3(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=F2(this.that).datum();l.call(e,this.that,new Ype(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=I2(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],t3(this),s.start();p3(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=F2(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=I2(t,i),l=t.clientX,u=t.clientY;B2(t.view),f3(t),a.mouse=[c,this.__zoom.invert(c)],t3(this),a.start();function d(e){if(p3(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=I2(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),V2(e.view,a.moved),p3(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=I2(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);p3(r),s>0?F2(this).transition().duration(s).call(x,d,c,r):F2(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(f3(t),s=0;s<i;++s)c=r[s],l=I2(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),t3(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(p3(e),s=0;s<a;++s)c=i[s],l=I2(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function ee(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(f3(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=I2(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=F2(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:c3(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:c3(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:c3(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:c3([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var g3={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},_3=[[-1/0,-1/0],[1/0,1/0]],v3=[`Enter`,` `,`Escape`],tme={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},y3;(function(e){e.Strict=`strict`,e.Loose=`loose`})(y3||={});var b3;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(b3||={});var x3;(function(e){e.Partial=`partial`,e.Full=`full`})(x3||={});var S3={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},C3;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(C3||={});var w3;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(w3||={});var T3;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(T3||={});var E3={[T3.Left]:T3.Right,[T3.Right]:T3.Left,[T3.Top]:T3.Bottom,[T3.Bottom]:T3.Top};function nme(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(let n of e.keys())if(!t.has(n))return!1;return!0}function D3(e,t,n){if(!n)return;let r=[];e.forEach((e,n)=>{t?.has(n)||r.push(e)}),r.length&&n(r)}function rme(e){return e===null?null:e?`valid`:`invalid`}var O3=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,ime=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),k3=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),A3=(e,t=[0,0])=>{let{width:n,height:r}=r6(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ame=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:V3(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):k3(n)?n:t.nodeLookup.get(n.id)),z3(e,i?U3(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),j3=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=z3(n,U3(e)),r=!0)}),r?V3(n):{x:0,y:0,width:0,height:0}},M3=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=G3(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},ome=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function sme(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=r6(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function cme({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=e6(j3(sme(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function N3({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,g3.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&n6(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=n6(d)?F3(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,g3.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function lme({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=ome(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var P3=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),F3=(e={x:0,y:0},t,n)=>({x:P3(e.x,t[0][0],t[1][0]-(n?.width??0)),y:P3(e.y,t[0][1],t[1][1]-(n?.height??0))});function I3(e,t,n){let{width:r,height:i}=r6(n),{x:a,y:o}=n.internals.positionAbsolute;return F3(e,[[a,o],[a+r,o+i]],t)}var L3=(e,t,n)=>e<t?P3(Math.abs(e-t),1,t)/t:e>n?-P3(Math.abs(e-n),1,t)/t:0,R3=(e,t,n=15,r=40)=>[L3(e.x,r,t.width-r)*n,L3(e.y,r,t.height-r)*n],z3=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),B3=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),V3=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),H3=(e,t=[0,0])=>{let{x:n,y:r}=k3(e)?e.internals.positionAbsolute:A3(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},U3=(e,t=[0,0])=>{let{x:n,y:r}=k3(e)?e.internals.positionAbsolute:A3(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},W3=(e,t)=>V3(z3(B3(e),B3(t))),G3=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},K3=(e,t)=>G3(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),q3=e=>J3(e.width)&&J3(e.height)&&J3(e.x)&&J3(e.y),J3=e=>!isNaN(e)&&isFinite(e),Y3=(e,t)=>(e,t)=>{},X3=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Z3=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?X3(s,o):s},Q3=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function $3(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ume(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=$3(e,n),i=$3(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=$3(e.top??e.y??0,n),i=$3(e.bottom??e.y??0,n),a=$3(e.left??e.x??0,t),o=$3(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function dme(e,t,n,r,i,a){let{x:o,y:s}=Q3(e,[t,n,r]),{x:c,y:l}=Q3({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var e6=(e,t,n,r,i,a)=>{let o=ume(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=P3(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=dme(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},t6=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function n6(e){return e!=null&&e!==`parent`}function r6(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function i6(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function fme(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function pme(e){return{...tme,...e||{}}}function a6(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=u6(e),s=Z3({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?X3(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var o6=e=>({width:e.offsetWidth,height:e.offsetHeight}),s6=e=>e?.getRootNode?.()||window?.document,mme=[`INPUT`,`SELECT`,`TEXTAREA`];function c6(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?mme.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var l6=e=>`clientX`in e,u6=(e,t)=>{let n=l6(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},d6=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...o6(t)}})};function hme({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function f6(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function p6({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case T3.Left:return[t-f6(t-r,a),n];case T3.Right:return[t+f6(r-t,a),n];case T3.Top:return[t,n-f6(n-i,a)];case T3.Bottom:return[t,n+f6(i-n,a)]}}function m6({sourceX:e,sourceY:t,sourcePosition:n=T3.Bottom,targetX:r,targetY:i,targetPosition:a=T3.Top,curvature:o=.25}){let[s,c]=p6({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=p6({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=hme({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function h6({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function gme({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function _me({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=z3(U3(e),U3(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),K3({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},V3(a))>0}var vme=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,yme=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),bme=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,g3.error006()),t;let r=n.getEdgeId||vme,i;return i=O3(e)?{...e}:{...e,id:r(e)},yme(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function g6({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=h6({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var _6={[T3.Left]:{x:-1,y:0},[T3.Right]:{x:1,y:0},[T3.Top]:{x:0,y:-1},[T3.Bottom]:{x:0,y:1}},xme=({source:e,sourcePosition:t=T3.Bottom,target:n})=>t===T3.Left||t===T3.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},v6=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Sme({source:e,sourcePosition:t=T3.Bottom,target:n,targetPosition:r=T3.Top,center:i,offset:a,stepPosition:o}){let s=_6[t],c=_6[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=xme({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=h6({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Cme(e,t,n,r){let i=Math.min(v6(e,t)/2,v6(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function y6({sourceX:e,sourceY:t,sourcePosition:n=T3.Bottom,targetX:r,targetY:i,targetPosition:a=T3.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Sme({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Cme(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function b6(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function wme(e){let{sourceNode:t,targetNode:n}=e;if(!b6(t)||!b6(n))return null;let r=t.internals.handleBounds||x6(t.handles),i=n.internals.handleBounds||x6(n.handles),a=C6(r?.source??[],e.sourceHandle),o=C6(e.connectionMode===y3.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,g3.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||T3.Bottom,c=o?.position||T3.Top,l=S6(t,a,s),u=S6(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function x6(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function S6(e,t,n=T3.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??r6(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case T3.Top:return{x:i+o/2,y:a};case T3.Right:return{x:i+o,y:a+s/2};case T3.Bottom:return{x:i+o/2,y:a+s};case T3.Left:return{x:i,y:a+s/2}}}function C6(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function w6(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Tme(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=w6(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var T6=1e3,Eme=10,E6={nodeOrigin:[0,0],nodeExtent:_3,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Dme={...E6,checkEquality:!0};function D6(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Ome(e,t,n){let r=D6(E6,n);for(let n of e.values())if(n.parentId)k6(n,e,t,r);else{let e=F3(A3(n,r.nodeOrigin),n6(n.extent)?n.extent:r.nodeExtent,r6(n));n.internals.positionAbsolute=e}}function kme(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function O6(e){return e===`manual`}function Ame(e,t,n,r={}){let i=D6(Dme,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!O6(i.zIndexMode)?T6:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=F3(A3(u,i.nodeOrigin),n6(u.extent)?u.extent:i.nodeExtent,r6(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:kme(u,e),z:A6(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&k6(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function jme(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function k6(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=D6(E6,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jme(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Eme),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Mme(e,u,o,s,a&&!O6(c)?T6:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function A6(e,t,n){let r=J3(e.zIndex)?e.zIndex:0;return O6(n)?r:r+(e.selected?t:0)}function Mme(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=r6(e),l=A3(e,n),u=n6(e.extent)?F3(l,e.extent,c):l,d=F3({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=I3(d,c,t));let f=A6(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Nme(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=W3(a.get(n.parentId)?.expandedRect??H3(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=r6(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Pme(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=o6(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=n6(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=I3(h,s,n))}else m&&(h=F3(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:d6(`source`,r.nodeElement,p,d,e.id),target:d6(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&k6(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:H3(g,i)}))}}if(f.length>0){let e=Nme(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Fme({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function j6(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Ime(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;j6(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),j6(`target`,s,c,e,i,o),t.set(r.id,r)}}function M6(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:M6(n,t):!1}function N6(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Lme(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!M6(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function P6({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Rme({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=X3(a,t);return{x:o.x-a.x,y:o.y-a.y}}function zme({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=F2(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?B3(j3(s)):null,x=v&&l?Rme({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:X3(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=N3({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=P6({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=R3(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=a6(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Lme(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=P6({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=cfe().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=a6(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=u6(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=a6(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=u6(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=u6(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=P6({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!N6(t,`.${g}`,v))&&(!_||N6(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Bme(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())K3(i,H3(e))>0&&r.push(e);return r}var Vme=250;function Hme(e,t,n,r){let i=[],a=1/0,o=Bme(e,n,t+Vme);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=S6(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function F6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...S6(o,c,c.position,!0)}:c}function I6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Ume(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var L6=()=>!0;function Wme(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=L6,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=s6(e.target),E=0,D,{x:O,y:ee}=u6(e),te=I6(a,w),k=s?.getBoundingClientRect(),A=!1;if(!k||!te)return;let ne=F6(i,te,r,c,t);if(!ne)return;let j=u6(e,k),M=!1,re=null,N=!1,P=null;function ie(){if(!u||!k)return;let[e,t]=R3(j,k,S);f({x:e,y:t}),E=requestAnimationFrame(ie)}let ae={...ne,nodeId:i,type:te,position:ne.position},oe=c.get(i),se={inProgress:!0,isValid:null,from:S6(oe,ae,T3.Left,!0),fromHandle:ae,fromPosition:ae.position,fromNode:oe,to:j,toHandle:null,toPosition:E3[ae.position],toNode:null,pointer:j};function F(){A=!0,y(se),m?.(e,{nodeId:i,handleId:r,handleType:te})}C===0&&F();function ce(e){if(!A){let{x:t,y:n}=u6(e),r=t-O,i=n-ee;if(!(r*r+i*i>C*C))return;F()}if(!x()||!ae){le(e);return}let a=b();j=u6(e,k),D=Hme(Z3(j,a,!1,[1,1]),n,c,ae),M||=(ie(),!0);let s=R6(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});P=s.handleDomNode,re=s.connection,N=Ume(!!D,s.isValid);let u=c.get(i),f=u?S6(u,ae,T3.Left,!0):se.from,p={...se,from:f,isValid:N,to:s.toHandle&&N?Q3({x:s.toHandle.x,y:s.toHandle.y},a):j,toHandle:s.toHandle,toPosition:N&&s.toHandle?s.toHandle.position:E3[ae.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:j};y(p),se=p}function le(e){if(!(`touches`in e&&e.touches.length>0)){if(A){(D||P)&&re&&N&&h?.(re);let{inProgress:t,...n}=se,r={...n,toPosition:se.toHandle?se.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),M=!1,N=!1,re=null,P=null,T.removeEventListener(`mousemove`,ce),T.removeEventListener(`mouseup`,le),T.removeEventListener(`touchmove`,ce),T.removeEventListener(`touchend`,le)}}T.addEventListener(`mousemove`,ce),T.addEventListener(`mouseup`,le),T.addEventListener(`touchmove`,ce),T.addEventListener(`touchend`,le)}function R6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=L6,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=u6(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=I6(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===y3.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=F6(t,e,a,u,n,!0)}return _}var z6={onPointerDown:Wme,isValid:R6};function Gme({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=F2(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&t6()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=h3().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:I2}}var B6=e=>({x:e.x,y:e.y,zoom:e.k}),V6=({x:e,y:t,zoom:n})=>u3.translate(e,t).scale(n),H6=(e,t)=>e.target.closest(`.${t}`),U6=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kme=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,W6=(e,t=0,n=Kme,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},G6=e=>{let t=e.ctrlKey&&t6()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qme({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(H6(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=I2(u),t=d*2**G6(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===b3.Vertical?0:u.deltaX*f,m=i===b3.Horizontal?0:u.deltaY*f;!t6()&&u.shiftKey&&i!==b3.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=B6(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function Jme({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=H6(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Yme({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=B6(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function Xme({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&U6(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,B6(a.transform))}}function Zme({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&U6(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=B6(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Qme({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(H6(d,`${l}-flow__node`)||H6(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||H6(d,s)&&m||H6(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function $me({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=h3().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=F2(e).call(f);y({x:i.x,y:i.y,zoom:P3(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(G6);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?E4:N4).transform(W6(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!J3(E)||E<0?0:E);let ee=O?qme({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Jme({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,ee,{passive:!1});let te=Yme({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,te);let k=Xme({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,k);let A=Zme({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,A);let ne=Qme({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(ne),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=V6(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=V6(e);return await g(n,t),n}function x(e){if(p){let t=V6(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?d3(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?E4:N4).scaleTo(W6(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?E4:N4).scaleBy(W6(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!J3(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var ehe;(function(e){e.Line=`line`,e.Handle=`handle`})(ehe||={});var the=Y3(`Svelte Flow`,`https://svelteflow.dev/`);function nhe(e,t,n={}){return bme(e,t,{...n,onError:n.onError??the})}function K6(){let e={};return[t=>{if(t&&!S(e))throw Error(t);return c(e)},t=>_e(e,t)]}var[rhe,ihe]=K6(),[ahe,ohe]=K6(),[she,che]=K6(),lhe=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`type`,`position`,`style`,`class`,`isConnectable`,`isConnectableStart`,`isConnectableEnd`,`isValidConnection`,`onconnect`,`ondisconnect`,`children`]),uhe=h(`<div><!></div>`);function q6(e,t){a(t,!0);let n=I(t,`id`,3,null),r=I(t,`type`,3,`source`),i=I(t,`position`,19,()=>T3.Top),o=I(t,`isConnectableStart`,3,!0),s=I(t,`isConnectableEnd`,3,!0),c=H(t,lhe),l=rhe(`Handle must be used within a Custom Node component`),f=ahe(`Handle must be used within a Custom Node component`),p=J(()=>r()===`target`),m=J(()=>t.isConnectable===void 0?f.value:t.isConnectable),h=i8(),_=J(()=>h.ariaLabelConfig),v=null;Ae(()=>{if(t.onconnect||t.ondisconnect){h.edges;let e=h.connectionLookup.get(`${l}-${r()}${n()?`-${n()}`:``}`);if(v&&!nme(e,v)){let n=e??new Map;D3(v,n,t.ondisconnect),D3(n,v,t.onconnect)}v=new Map(e)}});let b=J(()=>{if(!h.connection.inProgress)return[!1,!1,!1,!1,null];let{fromHandle:e,toHandle:t,isValid:i}=h.connection,a=e&&e.nodeId===l&&e.type===r()&&e.id===n(),o=t&&t.nodeId===l&&t.type===r()&&t.id===n();return[!0,a,o,h.connectionMode===y3.Strict?e?.type!==r():l!==e?.nodeId||n()!==e?.id,o&&i]}),x=J(()=>Fe(W(b),5)),S=J(()=>W(x)[0]),C=J(()=>W(x)[1]),w=J(()=>W(x)[2]),T=J(()=>W(x)[3]),E=J(()=>W(x)[4]);function ee(e){let t=h.onbeforeconnect?h.onbeforeconnect(e):e;t&&(h.addEdge(t),h.onconnect?.(e))}function te(e){let r=l6(e);e.currentTarget&&(r&&e.button===0||!r)&&z6.onPointerDown(e,{handleId:n(),nodeId:l,isTarget:W(p),connectionRadius:h.connectionRadius,domNode:h.domNode,nodeLookup:h.nodeLookup,connectionMode:h.connectionMode,lib:`svelte`,autoPanOnConnect:h.autoPanOnConnect,autoPanSpeed:h.autoPanSpeed,flowId:h.flowId,isValidConnection:t.isValidConnection||((...e)=>h.isValidConnection?.(...e)??!0),updateConnection:h.updateConnection,cancelConnection:h.cancelConnection,panBy:h.panBy,onConnect:ee,onConnectStart:h.onconnectstart,onConnectEnd:(...e)=>h.onconnectend?.(...e),getTransform:()=>[h.viewport.x,h.viewport.y,h.viewport.zoom],getFromHandle:()=>h.connection.fromHandle,dragThreshold:h.connectionDragThreshold,handleDomNode:e.currentTarget})}function k(e){if(!l||!h.clickConnectStartHandle&&!o())return;if(!h.clickConnectStartHandle){h.onclickconnectstart?.(e,{nodeId:l,handleId:n(),handleType:r()}),h.clickConnectStartHandle={nodeId:l,type:r(),id:n()};return}let i=s6(e.target),a=t.isValidConnection??h.isValidConnection,{connectionMode:s,clickConnectStartHandle:c,flowId:u,nodeLookup:d}=h,{connection:f,isValid:p}=z6.isValid(e,{handle:{nodeId:l,id:n(),type:r()},connectionMode:s,fromNodeId:c.nodeId,fromHandleId:c.id??null,fromType:c.type,isValidConnection:a,flowId:u,doc:i,lib:`svelte`,nodeLookup:d});p&&f&&ee(f);let m=structuredClone(y(h.connection));delete m.inProgress,m.toPosition=m.toHandle?m.toHandle.position:null,h.onclickconnectend?.(e,m),h.clickConnectStartHandle=null}var A=uhe(),ne=()=>{};O(A,()=>({"data-handleid":n(),"data-nodeid":l,"data-handlepos":i(),"data-id":`${h.flowId??``}-${l??``}-${n()??`null`??``}-${r()??``}`,class:[`svelte-flow__handle`,`svelte-flow__handle-${i()}`,h.noDragClass,h.noPanClass,i(),t.class],onmousedown:te,ontouchstart:te,onclick:h.clickConnect?k:void 0,onkeypress:ne,style:t.style,role:`button`,"aria-label":W(_)[`handle.ariaLabel`],tabindex:`-1`,...c,[ae]:{valid:W(E),connectingto:W(w),connectingfrom:W(C),source:!W(p),target:W(p),connectablestart:o(),connectableend:s(),connectable:W(m),connectionindicator:W(m)&&(!W(S)||W(T))&&(W(S)||h.clickConnectStartHandle?s():o())}})),u(V(A),()=>t.children??D),d(A),g(e,A),z()}var dhe=h(`<!> <!>`,1);function J6(e,t){a(t,!0);let n=I(t,`targetPosition`,19,()=>T3.Top),r=I(t,`sourcePosition`,19,()=>T3.Bottom);var i=dhe(),o=R(i);q6(o,{type:`target`,get position(){return n()}});var s=L(o);q6(L(s),{type:`source`,get position(){return r()}}),F(()=>A(s,` ${t.data?.label??``} `)),g(e,i),z()}var fhe=h(` <!>`,1);function phe(e,t){a(t,!0);let n=I(t,`data`,19,()=>({label:`Node`})),r=I(t,`sourcePosition`,19,()=>T3.Bottom);w();var i=fhe(),o=R(i);q6(L(o),{type:`source`,get position(){return r()}}),F(()=>A(o,`${n()?.label??``} `)),g(e,i),z()}var mhe=h(` <!>`,1);function hhe(e,t){a(t,!0);let n=I(t,`data`,19,()=>({label:`Node`})),r=I(t,`targetPosition`,19,()=>T3.Top);w();var i=mhe(),o=R(i);q6(L(o),{type:`target`,get position(){return r()}}),F(()=>A(o,`${n()?.label??``} `)),g(e,i),z()}function ghe(e,t){}function Y6(e,t,n){if(!n||!t)return;let r=n===`root`?t:t.querySelector(`.svelte-flow__${n}`);r&&r.appendChild(e)}function _he(e,t){let n=J(i8),r=J(()=>W(n).domNode),i;return W(r)?Y6(e,W(r),t):i=De(()=>{be(()=>{Y6(e,W(r),t),i?.()})}),{async update(t){Y6(e,W(r),t)},destroy(){e.parentNode&&e.parentNode.removeChild(e),i?.()}}}function vhe(){let e=Y(typeof window>`u`);if(W(e)){let t=De(()=>{be(()=>{K(e,!1),t?.()})})}return{get value(){return W(e)}}}var X6=e=>ime(e),yhe=e=>O3(e);function Z6(e){return e===void 0?void 0:`${e}px`}var Q6={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bhe=new Set([`$$slots`,`$$events`,`$$legacy`,`x`,`y`,`width`,`height`,`selectEdgeOnClick`,`transparent`,`class`,`children`]),xhe=h(`<div><!></div>`);function She(e,t){a(t,!0);let n=I(t,`x`,3,0),r=I(t,`y`,3,0),o=I(t,`selectEdgeOnClick`,3,!1),s=I(t,`transparent`,3,!1),c=H(t,bhe),l=i8(),f=she(`EdgeLabel must be used within a Custom Edge component`),p=J(()=>l.visible.edges.get(f)?.zIndex);var m=xhe(),h=()=>{o()&&f&&l.handleEdgeSelection(f)};O(m,e=>({class:[`svelte-flow__edge-label`,{transparent:s()},t.class],tabindex:`-1`,onclick:h,...c,[Me]:e}),[()=>({display:vhe().value?`none`:void 0,cursor:o()?`pointer`:void 0,transform:`translate(-50%, -50%) translate(${n()??``}px,${r()??``}px)`,"pointer-events":`all`,width:Z6(t.width),height:Z6(t.height),"z-index":W(p)})],void 0,void 0,`svelte-lqczsv`),u(V(m),()=>t.children??D),d(m),i(m,(e,t)=>_he?.(e,t),()=>`edge-labels`),g(e,m),z()}var Che=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`path`,`label`,`labelX`,`labelY`,`labelStyle`,`markerStart`,`markerEnd`,`style`,`interactionWidth`,`class`]),whe=j(`<path></path>`),The=j(`<path fill="none"></path><!><!>`,1);function $6(e,t){let n=I(t,`interactionWidth`,3,20),r=H(t,Che);var i=The(),a=R(i),o=L(a),c=e=>{var i=whe();O(i,()=>({d:t.path,"stroke-opacity":0,"stroke-width":n(),fill:`none`,class:`svelte-flow__edge-interaction`,...r})),g(e,i)};k(o,e=>{n()>0&&e(c)});var u=L(o),d=e=>{She(e,{get x(){return t.labelX},get y(){return t.labelY},get style(){return t.labelStyle},selectEdgeOnClick:!0,children:(e,n)=>{w();var r=M();F(()=>A(r,t.label)),g(e,r)},$$slots:{default:!0}})};k(u,e=>{t.label&&e(d)}),F(()=>{q(a,`id`,t.id),q(a,`d`,t.path),s(a,0,x([`svelte-flow__edge-path`,t.class])),q(a,`marker-start`,t.markerStart),q(a,`marker-end`,t.markerEnd),l(a,t.style)}),g(e,i)}function e8(e,t){a(t,!0);let n=J(()=>m6({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,curvature:t.pathOptions?.curvature})),r=J(()=>Fe(W(n),3)),i=J(()=>W(r)[0]),o=J(()=>W(r)[1]),s=J(()=>W(r)[2]);$6(e,{get id(){return t.id},get path(){return W(i)},get labelX(){return W(o)},get labelY(){return W(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),z()}function Ehe(e,t){a(t,!0);let n=J(()=>y6({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition})),r=J(()=>Fe(W(n),3)),i=J(()=>W(r)[0]),o=J(()=>W(r)[1]),s=J(()=>W(r)[2]);$6(e,{get path(){return W(i)},get labelX(){return W(o)},get labelY(){return W(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),z()}function Dhe(e,t){a(t,!0);let n=J(()=>g6({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY})),r=J(()=>Fe(W(n),3)),i=J(()=>W(r)[0]),o=J(()=>W(r)[1]),s=J(()=>W(r)[2]);$6(e,{get path(){return W(i)},get labelX(){return W(o)},get labelY(){return W(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),z()}function Ohe(e,t){a(t,!0);let n=J(()=>y6({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,borderRadius:0})),r=J(()=>Fe(W(n),3)),i=J(()=>W(r)[0]),o=J(()=>W(r)[1]),s=J(()=>W(r)[2]);$6(e,{get path(){return W(i)},get labelX(){return W(o)},get labelY(){return W(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),z()}function khe(e,t,n,r){let i=new Map;return M3(e,{x:0,y:0,width:n,height:r},t,!0).forEach(e=>{i.set(e.id,e)}),i}function t8(e){let{edges:t,defaultEdgeOptions:n,nodeLookup:r,previousEdges:i,connectionMode:a,onerror:o,onlyRenderVisible:s,elevateEdgesOnSelect:c,zIndexMode:l}=e,u=new Map;for(let d of t){let t=r.get(d.source),f=r.get(d.target);if(!t||!f)continue;if(s){let{visibleNodes:n,transform:r,width:i,height:a}=e;if(_me({sourceNode:t,targetNode:f,width:i,height:a,transform:r}))n.set(t.id,t),n.set(f.id,f);else continue}let p=i.get(d.id);if(p&&d===p.edge&&t==p.sourceNode&&f==p.targetNode){u.set(d.id,p);continue}let m=wme({id:d.id,sourceNode:t,targetNode:f,sourceHandle:d.sourceHandle||null,targetHandle:d.targetHandle||null,connectionMode:a,onError:o});m&&u.set(d.id,{...n,...d,...m,zIndex:gme({selected:d.selected,zIndex:d.zIndex??n.zIndex,sourceNode:t,targetNode:f,elevateOnSelect:c,zIndexMode:l}),sourceNode:t,targetNode:f,edge:d})}return u}var Ahe=Y3(`Svelte Flow`,`https://svelteflow.dev/`),n8={input:phe,output:hhe,default:J6,group:ghe},r8={straight:Dhe,smoothstep:Ehe,default:e8,step:Ohe};function jhe(e,t,n,r,i,a){return t&&!n&&r&&i?e6(j3(a,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),r,i,.5,2,.1):n??{x:0,y:0,zoom:1}}function Mhe(e){class t{#e=J(()=>e.props.id??`1`);get flowId(){return W(this.#e)}set flowId(e){K(this.#e,e)}#t=Y(null);get domNode(){return W(this.#t)}set domNode(e){K(this.#t,e)}#n=Y(null);get panZoom(){return W(this.#n)}set panZoom(e){K(this.#n,e)}#r=Y(e.width??0);get width(){return W(this.#r)}set width(e){K(this.#r,e)}#i=Y(e.height??0);get height(){return W(this.#i)}set height(e){K(this.#i,e)}#a=Y(e.props.zIndexMode??`basic`);get zIndexMode(){return W(this.#a)}set zIndexMode(e){K(this.#a,e)}#o=J(()=>{let{nodesInitialized:t}=Ame(e.nodes,this.nodeLookup,this.parentLookup,{nodeExtent:this.nodeExtent,nodeOrigin:this.nodeOrigin,elevateNodesOnSelect:e.props.elevateNodesOnSelect??!0,checkEquality:!0,zIndexMode:this.zIndexMode});return this.fitViewQueued&&t&&(this.fitViewOptions?.duration?this.resolveFitView():queueMicrotask(()=>{this.resolveFitView()})),t});get nodesInitialized(){return W(this.#o)}set nodesInitialized(e){K(this.#o,e)}#s=J(()=>this.panZoom!==null);get viewportInitialized(){return W(this.#s)}set viewportInitialized(e){K(this.#s,e)}#c=J(()=>(Ime(this.connectionLookup,this.edgeLookup,e.edges),e.edges));get _edges(){return W(this.#c)}set _edges(e){K(this.#c,e)}get nodes(){return this.nodesInitialized,e.nodes}set nodes(t){e.nodes=t}get edges(){return this._edges}set edges(t){e.edges=t}_prevSelectedNodes=[];_prevSelectedNodeIds=new Set;#l=J(()=>{let e=this._prevSelectedNodeIds.size,t=new Set,n=this.nodes.filter(e=>(e.selected&&(t.add(e.id),this._prevSelectedNodeIds.delete(e.id)),e.selected));return(e!==t.size||this._prevSelectedNodeIds.size>0)&&(this._prevSelectedNodes=n),this._prevSelectedNodeIds=t,this._prevSelectedNodes});get selectedNodes(){return W(this.#l)}set selectedNodes(e){K(this.#l,e)}_prevSelectedEdges=[];_prevSelectedEdgeIds=new Set;#u=J(()=>{let e=this._prevSelectedEdgeIds.size,t=new Set,n=this.edges.filter(e=>(e.selected&&(t.add(e.id),this._prevSelectedEdgeIds.delete(e.id)),e.selected));return(e!==t.size||this._prevSelectedEdgeIds.size>0)&&(this._prevSelectedEdges=n),this._prevSelectedEdgeIds=t,this._prevSelectedEdges});get selectedEdges(){return W(this.#u)}set selectedEdges(e){K(this.#u,e)}selectionChangeHandlers=new Map;nodeLookup=new Map;parentLookup=new Map;connectionLookup=new Map;edgeLookup=new Map;_prevVisibleEdges=new Map;#d=J(()=>{let{nodes:t,_edges:n,_prevVisibleEdges:r,nodeLookup:i,connectionMode:a,onerror:o,onlyRenderVisibleElements:s,defaultEdgeOptions:c,zIndexMode:l}=this,u,d,f={edges:n,defaultEdgeOptions:c,previousEdges:r,nodeLookup:i,connectionMode:a,elevateEdgesOnSelect:e.props.elevateEdgesOnSelect??!0,zIndexMode:l,onerror:o};if(s){let{viewport:e,width:t,height:n}=this,r=[e.x,e.y,e.zoom];u=khe(i,r,t,n),d=t8({...f,onlyRenderVisible:!0,visibleNodes:u,transform:r,width:t,height:n})}else u=this.nodeLookup,d=t8(f);return{nodes:u,edges:d}});get visible(){return W(this.#d)}set visible(e){K(this.#d,e)}#f=J(()=>e.props.nodesDraggable??!0);get nodesDraggable(){return W(this.#f)}set nodesDraggable(e){K(this.#f,e)}#p=J(()=>e.props.nodesConnectable??!0);get nodesConnectable(){return W(this.#p)}set nodesConnectable(e){K(this.#p,e)}#m=J(()=>e.props.elementsSelectable??!0);get elementsSelectable(){return W(this.#m)}set elementsSelectable(e){K(this.#m,e)}#h=J(()=>e.props.nodesFocusable??!0);get nodesFocusable(){return W(this.#h)}set nodesFocusable(e){K(this.#h,e)}#g=J(()=>e.props.edgesFocusable??!0);get edgesFocusable(){return W(this.#g)}set edgesFocusable(e){K(this.#g,e)}#_=J(()=>e.props.disableKeyboardA11y??!1);get disableKeyboardA11y(){return W(this.#_)}set disableKeyboardA11y(e){K(this.#_,e)}#v=J(()=>e.props.minZoom??.5);get minZoom(){return W(this.#v)}set minZoom(e){K(this.#v,e)}#y=J(()=>e.props.maxZoom??2);get maxZoom(){return W(this.#y)}set maxZoom(e){K(this.#y,e)}#b=J(()=>e.props.nodeOrigin??[0,0]);get nodeOrigin(){return W(this.#b)}set nodeOrigin(e){K(this.#b,e)}#x=J(()=>e.props.nodeExtent??_3);get nodeExtent(){return W(this.#x)}set nodeExtent(e){K(this.#x,e)}#S=J(()=>e.props.translateExtent??_3);get translateExtent(){return W(this.#S)}set translateExtent(e){K(this.#S,e)}#C=J(()=>e.props.defaultEdgeOptions??{});get defaultEdgeOptions(){return W(this.#C)}set defaultEdgeOptions(e){K(this.#C,e)}#w=J(()=>e.props.nodeDragThreshold??1);get nodeDragThreshold(){return W(this.#w)}set nodeDragThreshold(e){K(this.#w,e)}#T=J(()=>e.props.autoPanOnNodeDrag??!0);get autoPanOnNodeDrag(){return W(this.#T)}set autoPanOnNodeDrag(e){K(this.#T,e)}#E=J(()=>e.props.autoPanOnConnect??!0);get autoPanOnConnect(){return W(this.#E)}set autoPanOnConnect(e){K(this.#E,e)}#D=J(()=>e.props.autoPanOnNodeFocus??!0);get autoPanOnNodeFocus(){return W(this.#D)}set autoPanOnNodeFocus(e){K(this.#D,e)}#O=J(()=>e.props.autoPanSpeed??15);get autoPanSpeed(){return W(this.#O)}set autoPanSpeed(e){K(this.#O,e)}#k=J(()=>e.props.connectionDragThreshold??1);get connectionDragThreshold(){return W(this.#k)}set connectionDragThreshold(e){K(this.#k,e)}fitViewQueued=e.props.fitView??!1;fitViewOptions=e.props.fitViewOptions;fitViewResolver=null;#A=J(()=>e.props.snapGrid??null);get snapGrid(){return W(this.#A)}set snapGrid(e){K(this.#A,e)}#j=Y(!1);get dragging(){return W(this.#j)}set dragging(e){K(this.#j,e)}#M=Y(null);get selectionRect(){return W(this.#M)}set selectionRect(e){K(this.#M,e)}#N=Y(!1);get selectionKeyPressed(){return W(this.#N)}set selectionKeyPressed(e){K(this.#N,e)}#P=Y(!1);get multiselectionKeyPressed(){return W(this.#P)}set multiselectionKeyPressed(e){K(this.#P,e)}#F=Y(!1);get deleteKeyPressed(){return W(this.#F)}set deleteKeyPressed(e){K(this.#F,e)}#I=Y(!1);get panActivationKeyPressed(){return W(this.#I)}set panActivationKeyPressed(e){K(this.#I,e)}#L=Y(!1);get zoomActivationKeyPressed(){return W(this.#L)}set zoomActivationKeyPressed(e){K(this.#L,e)}#R=Y(null);get selectionRectMode(){return W(this.#R)}set selectionRectMode(e){K(this.#R,e)}#z=Y(``);get ariaLiveMessage(){return W(this.#z)}set ariaLiveMessage(e){K(this.#z,e)}#B=J(()=>e.props.selectionMode??x3.Partial);get selectionMode(){return W(this.#B)}set selectionMode(e){K(this.#B,e)}#V=J(()=>({...n8,...e.props.nodeTypes}));get nodeTypes(){return W(this.#V)}set nodeTypes(e){K(this.#V,e)}#H=J(()=>({...r8,...e.props.edgeTypes}));get edgeTypes(){return W(this.#H)}set edgeTypes(e){K(this.#H,e)}#U=J(()=>e.props.noPanClass??`nopan`);get noPanClass(){return W(this.#U)}set noPanClass(e){K(this.#U,e)}#W=J(()=>e.props.noDragClass??`nodrag`);get noDragClass(){return W(this.#W)}set noDragClass(e){K(this.#W,e)}#G=J(()=>e.props.noWheelClass??`nowheel`);get noWheelClass(){return W(this.#G)}set noWheelClass(e){K(this.#G,e)}#K=J(()=>pme(e.props.ariaLabelConfig));get ariaLabelConfig(){return W(this.#K)}set ariaLabelConfig(e){K(this.#K,e)}#q=Y(jhe(this.nodesInitialized,e.props.fitView,e.props.initialViewport,this.width,this.height,this.nodeLookup));get _viewport(){return W(this.#q)}set _viewport(e){K(this.#q,e)}get viewport(){return e.viewport??this._viewport}set viewport(t){e.viewport&&=t,this._viewport=t}#J=Y(S3);get _connection(){return W(this.#J)}set _connection(e){K(this.#J,e)}#Y=J(()=>this._connection.inProgress?{...this._connection,to:Z3(this._connection.to,[this.viewport.x,this.viewport.y,this.viewport.zoom])}:this._connection);get connection(){return W(this.#Y)}set connection(e){K(this.#Y,e)}#X=J(()=>e.props.connectionMode??y3.Strict);get connectionMode(){return W(this.#X)}set connectionMode(e){K(this.#X,e)}#Z=J(()=>e.props.connectionRadius??20);get connectionRadius(){return W(this.#Z)}set connectionRadius(e){K(this.#Z,e)}#Q=J(()=>e.props.isValidConnection??(()=>!0));get isValidConnection(){return W(this.#Q)}set isValidConnection(e){K(this.#Q,e)}#$=J(()=>e.props.selectNodesOnDrag??!0);get selectNodesOnDrag(){return W(this.#$)}set selectNodesOnDrag(e){K(this.#$,e)}#ee=J(()=>e.props.defaultMarkerColor===void 0?`#b1b1b7`:e.props.defaultMarkerColor);get defaultMarkerColor(){return W(this.#ee)}set defaultMarkerColor(e){K(this.#ee,e)}#te=J(()=>Tme(e.edges,{defaultColor:this.defaultMarkerColor,id:this.flowId,defaultMarkerStart:this.defaultEdgeOptions.markerStart,defaultMarkerEnd:this.defaultEdgeOptions.markerEnd}));get markers(){return W(this.#te)}set markers(e){K(this.#te,e)}#ne=J(()=>e.props.onlyRenderVisibleElements??!1);get onlyRenderVisibleElements(){return W(this.#ne)}set onlyRenderVisibleElements(e){K(this.#ne,e)}#re=J(()=>e.props.onflowerror??Ahe);get onerror(){return W(this.#re)}set onerror(e){K(this.#re,e)}#ie=J(()=>e.props.ondelete);get ondelete(){return W(this.#ie)}set ondelete(e){K(this.#ie,e)}#ae=J(()=>e.props.onbeforedelete);get onbeforedelete(){return W(this.#ae)}set onbeforedelete(e){K(this.#ae,e)}#oe=J(()=>e.props.onbeforeconnect);get onbeforeconnect(){return W(this.#oe)}set onbeforeconnect(e){K(this.#oe,e)}#se=J(()=>e.props.onconnect);get onconnect(){return W(this.#se)}set onconnect(e){K(this.#se,e)}#ce=J(()=>e.props.onconnectstart);get onconnectstart(){return W(this.#ce)}set onconnectstart(e){K(this.#ce,e)}#le=J(()=>e.props.onconnectend);get onconnectend(){return W(this.#le)}set onconnectend(e){K(this.#le,e)}#ue=J(()=>e.props.onbeforereconnect);get onbeforereconnect(){return W(this.#ue)}set onbeforereconnect(e){K(this.#ue,e)}#de=J(()=>e.props.onreconnect);get onreconnect(){return W(this.#de)}set onreconnect(e){K(this.#de,e)}#fe=J(()=>e.props.onreconnectstart);get onreconnectstart(){return W(this.#fe)}set onreconnectstart(e){K(this.#fe,e)}#pe=J(()=>e.props.onreconnectend);get onreconnectend(){return W(this.#pe)}set onreconnectend(e){K(this.#pe,e)}#me=J(()=>e.props.clickConnect??!0);get clickConnect(){return W(this.#me)}set clickConnect(e){K(this.#me,e)}#he=J(()=>e.props.onclickconnectstart);get onclickconnectstart(){return W(this.#he)}set onclickconnectstart(e){K(this.#he,e)}#ge=J(()=>e.props.onclickconnectend);get onclickconnectend(){return W(this.#ge)}set onclickconnectend(e){K(this.#ge,e)}#_e=Y(null);get clickConnectStartHandle(){return W(this.#_e)}set clickConnectStartHandle(e){K(this.#_e,e)}#ve=J(()=>e.props.onselectiondrag);get onselectiondrag(){return W(this.#ve)}set onselectiondrag(e){K(this.#ve,e)}#ye=J(()=>e.props.onselectiondragstart);get onselectiondragstart(){return W(this.#ye)}set onselectiondragstart(e){K(this.#ye,e)}#be=J(()=>e.props.onselectiondragstop);get onselectiondragstop(){return W(this.#be)}set onselectiondragstop(e){K(this.#be,e)}resolveFitView=async()=>{this.panZoom&&(await cme({nodes:this.nodeLookup,width:this.width,height:this.height,panZoom:this.panZoom,minZoom:this.minZoom,maxZoom:this.maxZoom},this.fitViewOptions),this.fitViewResolver?.resolve(!0),this.fitViewQueued=!1,this.fitViewOptions=void 0,this.fitViewResolver=null)};_prefersDark=new Ce(`(prefers-color-scheme: dark)`,e.props.colorModeSSR===`dark`);#xe=J(()=>e.props.colorMode===`system`?this._prefersDark.current?`dark`:`light`:e.props.colorMode??`light`);get colorMode(){return W(this.#xe)}set colorMode(e){K(this.#xe,e)}constructor(){}resetStoreValues(){this.dragging=!1,this.selectionRect=null,this.selectionRectMode=null,this.selectionKeyPressed=!1,this.multiselectionKeyPressed=!1,this.deleteKeyPressed=!1,this.panActivationKeyPressed=!1,this.zoomActivationKeyPressed=!1,this._connection=S3,this.clickConnectStartHandle=null,this.viewport=e.props.initialViewport??{x:0,y:0,zoom:1},this.ariaLiveMessage=``}}return new t}var Nhe=g3.error001(`svelte`);function i8(){let e=c(a8);if(!e)throw Error(Nhe);return e.getStore()}var a8=Symbol();function Phe(e){let t=Mhe(e);function n(e){t.nodeTypes={...n8,...e}}function r(e){t.edgeTypes={...r8,...e}}function i(e){t.edges=nhe(e,t.edges,{onError:t.onerror})}let a=(e,n=!1)=>{t.nodes=t.nodes.map(r=>{if(t.connection.inProgress&&t.connection.fromNode.id===r.id){let e=t.nodeLookup.get(r.id);e&&(t.connection={...t.connection,from:S6(e,t.connection.fromHandle,T3.Left,!0)})}let i=e.get(r.id);return i?{...r,position:i.position,dragging:n}:r})};function o(e){let{changes:n,updatedInternals:r}=Pme(e,t.nodeLookup,t.parentLookup,t.domNode,t.nodeOrigin,t.nodeExtent,t.zIndexMode);if(!r)return;Ome(t.nodeLookup,t.parentLookup,{nodeOrigin:t.nodeOrigin,nodeExtent:t.nodeExtent,zIndexMode:t.zIndexMode}),t.fitViewQueued&&t.resolveFitView();let i=new Map;for(let e of n){let n=t.nodeLookup.get(e.id)?.internals.userNode;if(!n)continue;let r={...n};switch(e.type){case`dimensions`:{let t={...r.measured,...e.dimensions};e.setAttributes&&(r.width=e.dimensions?.width??r.width,r.height=e.dimensions?.height??r.height),r.measured=t;break}case`position`:r.position=e.position??r.position;break}i.set(e.id,r)}t.nodes=t.nodes.map(e=>i.get(e.id)??e)}function s(e){let n=t.fitViewResolver??Promise.withResolvers();return t.fitViewQueued=!0,t.fitViewOptions=e,t.fitViewResolver=n,t.nodes=[...t.nodes],n.promise}async function c(e,n,r){let i=r?.zoom===void 0?t.maxZoom:r.zoom,a=t.panZoom;return a?(await a.setViewport({x:t.width/2-e*i,y:t.height/2-n*i,zoom:i},{duration:r?.duration,ease:r?.ease,interpolate:r?.interpolate}),!0):!1}async function l(e,n){let r=t.panZoom;return r?r.scaleBy(e,n):!1}async function u(e){return l(1.2,e)}function d(e){return l(1/1.2,e)}function f(e){let n=t.panZoom;n&&(n.setScaleExtent([e,t.maxZoom]),t.minZoom=e)}function p(e){let n=t.panZoom;n&&(n.setScaleExtent([t.minZoom,e]),t.maxZoom=e)}function m(e){let n=t.panZoom;n&&(n.setTranslateExtent(e),t.translateExtent=e)}function h(e,t=null){let n=!1,r=e.map(e=>(!t||t.has(e.id))&&e.selected?(n=!0,{...e,selected:!1}):e);return[n,r]}function g(e){let n=e?.nodes?new Set(e.nodes.map(e=>e.id)):null,[r,i]=h(t.nodes,n);r&&(t.nodes=i);let a=e?.edges?new Set(e.edges.map(e=>e.id)):null,[o,s]=h(t.edges,a);o&&(t.edges=s)}function _(e){let n=t.multiselectionKeyPressed;t.nodes=t.nodes.map(t=>{let r=e.includes(t.id),i=n&&t.selected||r;return!!t.selected===i?t:{...t,selected:i}}),n||g({nodes:[]})}function v(e){let n=t.multiselectionKeyPressed;t.edges=t.edges.map(t=>{let r=e.includes(t.id),i=n&&t.selected||r;return!!t.selected===i?t:{...t,selected:i}}),n||g({edges:[]})}function y(e,n,r){let i=t.nodeLookup.get(e);if(!i){t.onerror(`012`,g3.error012(e));return}t.selectionRect=null,t.selectionRectMode=null,i.selected?(n||i.selected&&t.multiselectionKeyPressed)&&(g({nodes:[i.internals.userNode],edges:[]}),requestAnimationFrame(()=>r?.blur())):_([e])}function b(e){let n=t.edgeLookup.get(e);if(!n){t.onerror(`016`,g3.error016(e));return}(n.selectable||t.elementsSelectable&&n.selectable===void 0)&&(t.selectionRect=null,t.selectionRectMode=null,n.selected?n.selected&&t.multiselectionKeyPressed&&g({nodes:[],edges:[n]}):v([e]))}function x(e,n){let{nodeExtent:r,snapGrid:i,nodeOrigin:o,nodeLookup:s,nodesDraggable:c,onerror:l}=t,u=new Map,d=i?.[0]??5,f=i?.[1]??5,p=e.x*d*n,m=e.y*f*n;for(let e of s.values()){if(!(e.selected&&(e.draggable||c&&e.draggable===void 0)))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+m};i&&(t=X3(t,i));let{position:n,positionAbsolute:a}=N3({nodeId:e.id,nextPosition:t,nodeLookup:s,nodeExtent:r,nodeOrigin:o,onError:l});e.position=n,e.internals.positionAbsolute=a,u.set(e.id,e)}a(u)}function S(e){return Fme({delta:e,panZoom:t.panZoom,transform:[t.viewport.x,t.viewport.y,t.viewport.zoom],translateExtent:t.translateExtent,width:t.width,height:t.height})}let C=e=>{t._connection={...e}};function w(){t._connection=S3}function T(){t.resetStoreValues(),g()}return Object.assign(t,{setNodeTypes:n,setEdgeTypes:r,addEdge:i,updateNodePositions:a,updateNodeInternals:o,zoomIn:u,zoomOut:d,fitView:s,setCenter:c,setMinZoom:f,setMaxZoom:p,setTranslateExtent:m,unselectNodesAndEdges:g,addSelectedNodes:_,addSelectedEdges:v,handleNodeSelection:y,handleEdgeSelection:b,moveSelectedNodes:x,panBy:S,updateConnection:C,cancelConnection:w,reset:T})}function Fhe(e,t){let{minZoom:n,maxZoom:r,initialViewport:i,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:s,translateExtent:c,setPanZoomInstance:l,onDraggingChange:u,onTransformChange:d}=t,f=$me({domNode:e,minZoom:n,maxZoom:r,translateExtent:c,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:u}),p=f.getViewport();return(i.x!==p.x||i.y!==p.y||i.zoom!==p.zoom)&&d([p.x,p.y,p.zoom]),l(f),f.update(t),{update(e){f.update(e)}}}var Ihe=h(`<div class="svelte-flow__zoom svelte-flow__container"><!></div>`);function Lhe(e,t){a(t,!0);let n=I(t,`store`,15),r=J(()=>n().panActivationKeyPressed||t.panOnDrag),o=J(()=>n().panActivationKeyPressed||t.panOnScroll),{viewport:s}=n(),c=!1;be(()=>{!c&&n().viewportInitialized&&(t.oninit?.(),c=!0)});var l=Ihe();u(V(l),()=>t.children),d(l),i(l,(e,t)=>Fhe?.(e,t),()=>({viewport:n().viewport,minZoom:n().minZoom,maxZoom:n().maxZoom,initialViewport:s,onDraggingChange:e=>{n(n().dragging=e,!0)},setPanZoomInstance:e=>{n(n().panZoom=e,!0)},onPanZoomStart:t.onmovestart,onPanZoom:t.onmove,onPanZoomEnd:t.onmoveend,zoomOnScroll:t.zoomOnScroll,zoomOnDoubleClick:t.zoomOnDoubleClick,zoomOnPinch:t.zoomOnPinch,panOnScroll:W(o),panOnDrag:W(r),panOnScrollSpeed:t.panOnScrollSpeed,panOnScrollMode:t.panOnScrollMode,zoomActivationKeyPressed:n().zoomActivationKeyPressed,preventScrolling:typeof t.preventScrolling==`boolean`?t.preventScrolling:!0,noPanClassName:n().noPanClass,noWheelClassName:n().noWheelClass,userSelectionActive:!!n().selectionRect,translateExtent:n().translateExtent,lib:`svelte`,paneClickDistance:t.paneClickDistance,selectionOnDrag:t.selectionOnDrag,onTransformChange:e=>{n(n().viewport={x:e[0],y:e[1],zoom:e[2]},!0)},connectionInProgress:n().connection.inProgress})),g(e,l),z()}function o8(e,t){return n=>{n.target===t&&e?.(n)}}function s8(e){return t=>{let n=e.has(t.id);return!!t.selected===n?t:{...t,selected:n}}}function c8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}var Rhe=h(`<div><!></div>`);function zhe(e,t){a(t,!0);let n=I(t,`store`,15),i=I(t,`panOnDrag`,3,!0),o=I(t,`paneClickDistance`,3,1),c=I(t,`autoPanOnSelection`,3,!0),l,f=null,p=!1,m=new Set,h=new Set,_=J(()=>n().panActivationKeyPressed||i()),v=J(()=>n().selectionKeyPressed||!!n().selectionRect||t.selectionOnDrag&&W(_)!==!0),y=J(()=>n().elementsSelectable&&(W(v)||n().selectionRectMode===`user`)),b=!1,x=0,S={x:0,y:0},C=!1;function w(e){if(f=l?.getBoundingClientRect(),!f)return;let r=e.target===l,i=!r&&!!e.target.closest(`.nokey`),a=t.selectionOnDrag&&r||n().selectionKeyPressed;if(i||!W(v)||!a||e.button!==0||!e.isPrimary)return;e.target?.setPointerCapture?.(e.pointerId),b=!1,C=!1;let{x:o,y:s}=u6(e,f),c=Z3({x:o,y:s},[n().viewport.x,n().viewport.y,n().viewport.zoom]);n(n().selectionRect={width:0,height:0,startX:c.x,startY:c.y,x:o,y:s},!0),r||(e.stopPropagation(),e.preventDefault())}function T(e,t){if(n().selectionRect?.startX===void 0||n().selectionRect.startY===void 0)return;let r={x:n().selectionRect?.startX,y:n().selectionRect?.startY},i=Q3(r,[n().viewport.x,n().viewport.y,n().viewport.zoom]),a={startX:r.x,startY:r.y,x:e<i.x?e:i.x,y:t<i.y?t:i.y,width:Math.abs(e-i.x),height:Math.abs(t-i.y)},o=m,s=h;m=new Set(M3(n().nodeLookup,a,[n().viewport.x,n().viewport.y,n().viewport.zoom],n().selectionMode===x3.Partial,!0).map(e=>e.id));let c=n().defaultEdgeOptions.selectable??!0;h=new Set;for(let e of m){let t=n().connectionLookup.get(e);if(t)for(let{edgeId:e}of t.values()){let t=n().edgeLookup.get(e);t&&(t.selectable??c)&&h.add(e)}}c8(o,m)||n(n().nodes=n().nodes.map(s8(m)),!0),c8(s,h)||n(n().edges=n().edges.map(s8(h)),!0),n(n().selectionRectMode=`user`,!0),n(n().selectionRect=a,!0)}function E(){if(!c()||!f)return;let[e,t]=R3(S,f,n().autoPanSpeed);n().panBy({x:e,y:t}).then(e=>{if(!b||!e){x=requestAnimationFrame(E);return}T(S.x,S.y),x=requestAnimationFrame(E)})}function D(){cancelAnimationFrame(x),x=0,C=!1}ke(()=>{typeof window<`u`&&D()});function O(e){if(!W(v)||!f||!n().selectionRect)return;let r=u6(e,f);S={x:r.x,y:r.y};let i=Q3({x:n().selectionRect.startX,y:n().selectionRect.startY},[n().viewport.x,n().viewport.y,n().viewport.zoom]);if(!b){let a=n().selectionKeyPressed?0:o();if(Math.hypot(r.x-i.x,r.y-i.y)<=a)return;n().unselectNodesAndEdges(),t.onselectionstart?.(e)}b=!0,C||=(E(),!0),T(r.x,r.y)}function ee(e){if(!W(y)){e.target===l&&n().connection.inProgress&&(p=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===l&&ne?.(e),n(n().selectionRect=null,!0),b&&n(n().selectionRectMode=m.size>0?`nodes`:null,!0),b&&t.onselectionend?.(e),D())}function te(e){e.target?.releasePointerCapture?.(e.pointerId),D()}let k=e=>{if(Array.isArray(W(_))&&W(_).includes(2)){e.preventDefault();return}t.onpanecontextmenu?.({event:e})},A=e=>{b&&=(e.stopPropagation(),!1)};function ne(e){if(b||n().connection.inProgress||p){b=!1,p=!1;return}t.onpaneclick?.({event:e}),n().unselectNodesAndEdges(),n(n().selectionRectMode=null,!0),n(n().selectionRect=null,!0)}var j=Rhe();let M;var re=J(()=>W(y)?void 0:o8(ne,l)),N=J(()=>o8(k,l));u(V(j),()=>t.children),d(j),fe(j,e=>l=e,()=>l),F(e=>M=s(j,1,`svelte-flow__pane svelte-flow__container`,null,M,e),[()=>({draggable:i()===!0||Array.isArray(i())&&i().includes(0),dragging:n().dragging,selection:W(v)})]),r(`click`,j,function(...e){W(re)?.apply(this,e)}),ue(`pointerdown`,j,function(...e){(W(y)?w:void 0)?.apply(this,e)},!0),r(`pointermove`,j,function(...e){(W(y)?O:void 0)?.apply(this,e)}),r(`pointerup`,j,ee),ue(`pointercancel`,j,function(...e){(W(y)?te:void 0)?.apply(this,e)}),r(`contextmenu`,j,function(...e){W(N)?.apply(this,e)}),ue(`click`,j,function(...e){(W(y)?A:void 0)?.apply(this,e)},!0),g(e,j),z()}T([`click`,`pointermove`,`pointerup`,`contextmenu`]);var Bhe=h(`<div class="svelte-flow__viewport xyflow__viewport svelte-flow__container"><!></div>`);function Vhe(e,t){a(t,!0);var n=Bhe();let r;u(V(n),()=>t.children),d(n),F(()=>r=l(n,``,r,{transform:`translate(${t.store.viewport.x??``}px, ${t.store.viewport.y??``}px) scale(${t.store.viewport.zoom??``})`})),g(e,n),z()}function l8(e,t){let{store:n,onDrag:r,onDragStart:i,onDragStop:a,onNodeMouseDown:o}=t,s=zme({onDrag:r,onDragStart:i,onDragStop:a,onNodeMouseDown:o,getStoreItems:()=>{let{snapGrid:e,viewport:t}=n;return{nodes:n.nodes,nodeLookup:n.nodeLookup,edges:n.edges,nodeExtent:n.nodeExtent,snapGrid:e||[0,0],snapToGrid:!!e,nodeOrigin:n.nodeOrigin,multiSelectionActive:n.multiselectionKeyPressed,domNode:n.domNode,transform:[t.x,t.y,t.zoom],autoPanOnNodeDrag:n.autoPanOnNodeDrag,nodesDraggable:n.nodesDraggable,selectNodesOnDrag:n.selectNodesOnDrag,nodeDragThreshold:n.nodeDragThreshold,unselectNodesAndEdges:n.unselectNodesAndEdges,updateNodePositions:n.updateNodePositions,onSelectionDrag:n.onselectiondrag,onSelectionDragStart:n.onselectiondragstart,onSelectionDragStop:n.onselectiondragstop,panBy:n.panBy}}});function c(e,t){if(t.disabled){s.destroy();return}s.update({domNode:e,noDragClassName:t.noDragClass,handleSelector:t.handleSelector,nodeId:t.nodeId,isSelectable:t.isSelectable,nodeClickDistance:t.nodeClickDistance})}return c(e,t),{update(t){c(e,t)},destroy(){s.destroy()}}}var Hhe=h(`<div aria-live="assertive" aria-atomic="true" class="a11y-live-msg svelte-pnzxrn"> </div>`),Uhe=h(`<div class="a11y-hidden svelte-pnzxrn"> </div> <div class="a11y-hidden svelte-pnzxrn"> </div> <!>`,1);function Whe(e,t){a(t,!0);var n=Uhe(),r=R(n),i=V(r,!0);d(r);var o=L(r,2),s=V(o,!0);d(o);var c=L(o,2),l=e=>{var n=Hhe(),r=V(n,!0);d(n),F(()=>{q(n,`id`,`${Ghe}-${t.store.flowId}`),A(r,t.store.ariaLiveMessage)}),g(e,n)};k(c,e=>{t.store.disableKeyboardA11y||e(l)}),F(()=>{q(r,`id`,`${u8}-${t.store.flowId}`),A(i,t.store.disableKeyboardA11y?t.store.ariaLabelConfig[`node.a11yDescription.default`]:t.store.ariaLabelConfig[`node.a11yDescription.keyboardDisabled`]),q(o,`id`,`${d8}-${t.store.flowId}`),A(s,t.store.ariaLabelConfig[`edge.a11yDescription.default`])}),g(e,n),z()}var u8=`svelte-flow__node-desc`,d8=`svelte-flow__edge-desc`,Ghe=`svelte-flow__aria-live`,Khe=h(`<div><!></div>`);function qhe(e,t){a(t,!0);let n=I(t,`store`,15),r=J(()=>v(t.node.data,()=>({}),!0)),o=J(()=>v(t.node.selected,!1)),s=J(()=>t.node.draggable),c=J(()=>t.node.selectable),l=J(()=>v(t.node.deletable,!0)),u=J(()=>t.node.connectable),f=J(()=>t.node.focusable),p=J(()=>v(t.node.hidden,!1)),m=J(()=>v(t.node.dragging,!1)),h=J(()=>v(t.node.style,``)),_=J(()=>t.node.class),y=J(()=>v(t.node.type,`default`)),b=J(()=>t.node.parentId),x=J(()=>t.node.sourcePosition),S=J(()=>t.node.targetPosition),w=J(()=>v(t.node.measured,()=>({width:0,height:0}),!0).width),T=J(()=>v(t.node.measured,()=>({width:0,height:0}),!0).height),E=J(()=>t.node.initialWidth),D=J(()=>t.node.initialHeight),ee=J(()=>t.node.width),te=J(()=>t.node.height),A=J(()=>t.node.dragHandle),ne=J(()=>v(t.node.internals.z,0)),j=J(()=>t.node.internals.positionAbsolute.x),M=J(()=>t.node.internals.positionAbsolute.y),re=J(()=>t.node.internals.userNode),{id:N}=t.node,P=J(()=>W(s)??n().nodesDraggable),ie=J(()=>W(c)??n().elementsSelectable),oe=J(()=>W(u)??n().nodesConnectable),se=J(()=>i6(t.node)),F=J(()=>!!t.node.internals.handleBounds),ce=J(()=>W(se)&&W(F)),le=J(()=>W(f)??n().nodesFocusable);function ue(e){return n().parentLookup.has(e)}let de=J(()=>ue(N)),L=Y(null),pe=null,me=W(y),he=W(x),ge=W(S),_e=J(()=>n().nodeTypes[W(y)]??J6),ve=J(()=>n().ariaLabelConfig);ihe(N),ohe({get value(){return W(oe)}});let ye=J(()=>{let e=W(w)===void 0?W(ee)??W(E):W(ee),t=W(T)===void 0?W(te)??W(D):W(te);if(!(e===void 0&&t===void 0&&W(h)===void 0))return`${W(h)};${e?`width:${Z6(e)};`:``}${t?`height:${Z6(t)};`:``}`});be(()=>{(W(y)!==me||W(x)!==he||W(S)!==ge)&&W(L)!==null&&requestAnimationFrame(()=>{W(L)!==null&&n().updateNodeInternals(new Map([[N,{id:N,nodeElement:W(L),force:!0}]]))}),me=W(y),he=W(x),ge=W(S)}),be(()=>{t.resizeObserver&&(!W(ce)||W(L)!==pe)&&(pe&&t.resizeObserver.unobserve(pe),W(L)&&t.resizeObserver.observe(W(L)),pe=W(L))}),ke(()=>{pe&&t.resizeObserver?.unobserve(pe)});function B(e){W(ie)&&(!n().selectNodesOnDrag||!W(P)||n().nodeDragThreshold>0)&&n().handleNodeSelection(N),t.onnodeclick?.({node:W(re),event:e})}function xe(e){if(!(c6(e)||n().disableKeyboardA11y))if(v3.includes(e.key)&&W(ie)){let t=e.key===`Escape`;n().handleNodeSelection(N,t,W(L))}else W(P)&&t.node.selected&&Object.prototype.hasOwnProperty.call(Q6,e.key)&&(e.preventDefault(),n(n().ariaLiveMessage=W(ve)[`node.a11yDescription.ariaLiveMessage`]({direction:e.key.replace(`Arrow`,``).toLowerCase(),x:~~t.node.internals.positionAbsolute.x,y:~~t.node.internals.positionAbsolute.y}),!0),n().moveSelectedNodes(Q6[e.key],e.shiftKey?4:1))}let Se=()=>{if(n().disableKeyboardA11y||!n().autoPanOnNodeFocus||!W(L)?.matches(`:focus-visible`))return;let{width:e,height:r,viewport:i}=n();M3(new Map([[N,t.node]]),{x:0,y:0,width:e,height:r},[i.x,i.y,i.zoom],!0).length>0||n().setCenter(t.node.position.x+(t.node.measured.width??0)/2,t.node.position.y+(t.node.measured.height??0)/2,{zoom:i.zoom})};var Ce=U(),we=R(Ce),H=e=>{var a=Khe();O(a,()=>({"data-id":N,class:[`svelte-flow__node`,`svelte-flow__node-${W(y)}`,W(_)],style:W(ye),onclick:B,onpointerenter:t.onnodepointerenter?e=>t.onnodepointerenter({node:W(re),event:e}):void 0,onpointerleave:t.onnodepointerleave?e=>t.onnodepointerleave({node:W(re),event:e}):void 0,onpointermove:t.onnodepointermove?e=>t.onnodepointermove({node:W(re),event:e}):void 0,oncontextmenu:t.onnodecontextmenu?e=>t.onnodecontextmenu({node:W(re),event:e}):void 0,onkeydown:W(le)?xe:void 0,onfocus:W(le)?Se:void 0,tabIndex:W(le)?0:void 0,role:t.node.ariaRole??(W(le)?`group`:void 0),"aria-label":t.node.ariaLabel,"aria-roledescription":`node`,"aria-describedby":n().disableKeyboardA11y?void 0:`${u8}-${n().flowId}`,...t.node.domAttributes,[ae]:{dragging:W(m),selected:W(o),draggable:W(P),connectable:W(oe),selectable:W(ie),nopan:W(P),parent:W(de)},[Me]:{"z-index":W(ne),transform:`translate(${W(j)??``}px, ${W(M)??``}px)`,visibility:W(se)?`visible`:`hidden`}})),C(V(a),()=>W(_e),(e,t)=>{t(e,{get data(){return W(r)},get id(){return N},get selected(){return W(o)},get selectable(){return W(ie)},get deletable(){return W(l)},get sourcePosition(){return W(x)},get targetPosition(){return W(S)},get zIndex(){return W(ne)},get dragging(){return W(m)},get draggable(){return W(P)},get dragHandle(){return W(A)},get parentId(){return W(b)},get type(){return W(y)},get isConnectable(){return W(oe)},get positionAbsoluteX(){return W(j)},get positionAbsoluteY(){return W(M)},get width(){return W(ee)},get height(){return W(te)}})}),d(a),i(a,(e,t)=>l8?.(e,t),()=>({nodeId:N,isSelectable:W(ie),disabled:!W(P),handleSelector:W(A),noDragClass:n().noDragClass,nodeClickDistance:t.nodeClickDistance,onNodeMouseDown:n().handleNodeSelection,onDrag:(e,n,r,i)=>{t.onnodedrag?.({event:e,targetNode:r,nodes:i})},onDragStart:(e,n,r,i)=>{t.onnodedragstart?.({event:e,targetNode:r,nodes:i})},onDragStop:(e,n,r,i)=>{t.onnodedragstop?.({event:e,targetNode:r,nodes:i})},store:n()})),fe(a,e=>K(L,e),()=>W(L)),g(e,a)};k(we,e=>{W(p)||e(H)}),g(e,Ce),z()}var Jhe=h(`<div class="svelte-flow__nodes"></div>`);function Yhe(e,t){a(t,!0);let n=I(t,`store`,15),r=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{let t=new Map;e.forEach(e=>{let n=e.target.getAttribute(`data-id`);t.set(n,{id:n,nodeElement:e.target,force:!0})}),n().updateNodeInternals(t)});ke(()=>{r?.disconnect()});var i=Jhe();_(i,21,()=>n().visible.nodes.values(),e=>e.id,(e,i)=>{qhe(e,{get node(){return W(i)},get resizeObserver(){return r},get nodeClickDistance(){return t.nodeClickDistance},get onnodeclick(){return t.onnodeclick},get onnodepointerenter(){return t.onnodepointerenter},get onnodepointermove(){return t.onnodepointermove},get onnodepointerleave(){return t.onnodepointerleave},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get onnodecontextmenu(){return t.onnodecontextmenu},get store(){return n()},set store(e){n(e)}})}),d(i),g(e,i),z()}var Xhe=j(`<svg class="svelte-flow__edge-wrapper"><g><!></g></svg>`);function Zhe(e,t){a(t,!0);let n=J(()=>t.edge.id),r=J(()=>t.edge.source),i=J(()=>t.edge.target),o=J(()=>t.edge.sourceX),s=J(()=>t.edge.sourceY),c=J(()=>t.edge.targetX),u=J(()=>t.edge.targetY),f=J(()=>t.edge.sourcePosition),p=J(()=>t.edge.targetPosition),m=J(()=>v(t.edge.animated,!1)),h=J(()=>v(t.edge.selected,!1)),_=J(()=>t.edge.label),y=J(()=>t.edge.labelStyle),b=J(()=>v(t.edge.data,()=>({}),!0)),x=J(()=>t.edge.style),S=J(()=>t.edge.interactionWidth),w=J(()=>v(t.edge.type,`default`)),T=J(()=>t.edge.sourceHandle),E=J(()=>t.edge.targetHandle),D=J(()=>t.edge.markerStart),ee=J(()=>t.edge.markerEnd),te=J(()=>t.edge.selectable),A=J(()=>t.edge.focusable),ne=J(()=>v(t.edge.deletable,!0)),j=J(()=>t.edge.hidden),M=J(()=>t.edge.zIndex),re=J(()=>t.edge.class),N=J(()=>t.edge.ariaLabel);che(W(n));let P=null,ie=J(()=>W(te)??t.store.elementsSelectable),oe=J(()=>W(A)??t.store.edgesFocusable),se=J(()=>t.store.edgeTypes[W(w)]??e8),ce=J(()=>W(D)?`url('#${w6(W(D),t.store.flowId)}')`:void 0),le=J(()=>W(ee)?`url('#${w6(W(ee),t.store.flowId)}')`:void 0);function ue(e){let r=t.store.edgeLookup.get(W(n));r&&(W(ie)&&t.store.handleEdgeSelection(W(n)),t.onedgeclick?.({event:e,edge:r}))}function I(e,r){let i=t.store.edgeLookup.get(W(n));i&&r({event:e,edge:i})}function de(e){if(!t.store.disableKeyboardA11y&&v3.includes(e.key)&&W(ie)){let{unselectNodesAndEdges:r,addSelectedEdges:i}=t.store;e.key===`Escape`?(P?.blur(),r({edges:[t.edge]})):i([W(n)])}}var L=U(),pe=R(L),me=e=>{var a=Xhe();let v;var D=V(a);O(D,()=>({class:[`svelte-flow__edge`,W(re)],"data-id":W(n),onclick:ue,oncontextmenu:t.onedgecontextmenu?e=>{I(e,t.onedgecontextmenu)}:void 0,onpointerenter:t.onedgepointerenter?e=>{I(e,t.onedgepointerenter)}:void 0,onpointerleave:t.onedgepointerleave?e=>{I(e,t.onedgepointerleave)}:void 0,"aria-label":W(N)===null?void 0:W(N)?W(N):`Edge from ${W(r)} to ${W(i)}`,"aria-describedby":W(oe)?`${d8}-${t.store.flowId}`:void 0,role:t.edge.ariaRole??(W(oe)?`group`:`img`),"aria-roledescription":`edge`,onkeydown:W(oe)?de:void 0,tabindex:W(oe)?0:void 0,...t.edge.domAttributes,[ae]:{animated:W(m),selected:W(h),selectable:W(ie)}})),C(V(D),()=>W(se),(e,t)=>{t(e,{get id(){return W(n)},get source(){return W(r)},get target(){return W(i)},get sourceX(){return W(o)},get sourceY(){return W(s)},get targetX(){return W(c)},get targetY(){return W(u)},get sourcePosition(){return W(f)},get targetPosition(){return W(p)},get animated(){return W(m)},get selected(){return W(h)},get label(){return W(_)},get labelStyle(){return W(y)},get data(){return W(b)},get style(){return W(x)},get interactionWidth(){return W(S)},get selectable(){return W(ie)},get deletable(){return W(ne)},get type(){return W(w)},get sourceHandleId(){return W(T)},get targetHandleId(){return W(E)},get markerStart(){return W(ce)},get markerEnd(){return W(le)}})}),d(D),fe(D,e=>P=e,()=>P),d(a),F(()=>v=l(a,``,v,{"z-index":W(M)})),g(e,a)};k(pe,e=>{W(j)||e(me)}),g(e,L),z()}var Qhe=j(`<defs></defs>`);function $he(e,t){a(t,!1);let n=i8();pe();var r=Qhe();_(r,5,()=>n.markers,e=>e.id,(e,t)=>{rge(e,B(()=>W(t)))}),d(r),g(e,r),z()}var ege=j(`<polyline class="arrow" fill="none" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4"></polyline>`),tge=j(`<polyline class="arrowclosed" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4"></polyline>`),nge=j(`<marker class="svelte-flow__arrowhead" viewBox="-10 -10 20 20" refX="0" refY="0"><!></marker>`);function rge(e,t){a(t,!0);let n=I(t,`width`,3,12.5),r=I(t,`height`,3,12.5),i=I(t,`markerUnits`,3,`strokeWidth`),o=I(t,`orient`,3,`auto-start-reverse`),s=I(t,`color`,3,`none`);var c=nge(),u=V(c),f=e=>{var n=ege();let r;F(()=>{q(n,`stroke-width`,t.strokeWidth),r=l(n,``,r,{stroke:s()})}),g(e,n)},p=e=>{var n=tge();let r;F(()=>{q(n,`stroke-width`,t.strokeWidth),r=l(n,``,r,{stroke:s(),fill:s()})}),g(e,n)};k(u,e=>{t.type===w3.Arrow?e(f):t.type===w3.ArrowClosed&&e(p,1)}),d(c),F(()=>{q(c,`id`,t.id),q(c,`markerWidth`,`${n()}`),q(c,`markerHeight`,`${r()}`),q(c,`markerUnits`,i()),q(c,`orient`,o())}),g(e,c),z()}var ige=h(`<div class="svelte-flow__edges"><svg class="svelte-flow__marker"><!></svg> <!></div>`);function age(e,t){a(t,!0);let n=I(t,`store`,15);var r=ige(),i=V(r);$he(V(i),{}),d(i),_(L(i,2),17,()=>n().visible.edges.values(),e=>e.id,(e,r)=>{Zhe(e,{get edge(){return W(r)},get onedgeclick(){return t.onedgeclick},get onedgecontextmenu(){return t.onedgecontextmenu},get onedgepointerenter(){return t.onedgepointerenter},get onedgepointerleave(){return t.onedgepointerleave},get store(){return n()},set store(e){n(e)}})}),d(r),g(e,r),z()}var oge=h(`<div class="svelte-flow__selection svelte-1fy294n"></div>`);function f8(e,t){a(t,!0);let n=I(t,`x`,3,0),r=I(t,`y`,3,0),i=I(t,`width`,3,0),o=I(t,`height`,3,0),s=I(t,`isVisible`,3,!0);var c=U(),u=R(c),d=e=>{var t=oge();let a;F(e=>a=l(t,``,a,e),[()=>({width:typeof i()==`string`?i():Z6(i()),height:typeof o()==`string`?o():Z6(o()),transform:`translate(${n()}px, ${r()}px)`})]),g(e,t)};k(u,e=>{s()&&e(d)}),g(e,c),z()}var sge=h(`<div><!></div>`);function cge(e,t){a(t,!0);let n=Y(void 0);be(()=>{t.store.disableKeyboardA11y||W(n)?.focus({preventScroll:!0})});let o=J(()=>{if(t.store.selectionRectMode===`nodes`){t.store.nodes;let e=j3(t.store.nodeLookup,{filter:e=>!!e.selected});if(e.width>0&&e.height>0)return e}return null});function c(e){let n=t.store.nodes.filter(e=>e.selected);t.onselectioncontextmenu?.({nodes:n,event:e})}function u(e){let n=t.store.nodes.filter(e=>e.selected);t.onselectionclick?.({nodes:n,event:e})}function f(e){Object.prototype.hasOwnProperty.call(Q6,e.key)&&(e.preventDefault(),t.store.moveSelectedNodes(Q6[e.key],e.shiftKey?4:1))}var p=U(),m=R(p),h=e=>{var a=sge();let p;f8(V(a),{width:`100%`,height:`100%`,x:0,y:0}),d(a),i(a,(e,t)=>l8?.(e,t),()=>({disabled:!1,store:t.store,onDrag:(e,n,r,i)=>{t.onnodedrag?.({event:e,targetNode:null,nodes:i})},onDragStart:(e,n,r,i)=>{t.onnodedragstart?.({event:e,targetNode:null,nodes:i})},onDragStop:(e,n,r,i)=>{t.onnodedragstop?.({event:e,targetNode:null,nodes:i})}})),fe(a,e=>K(n,e),()=>W(n)),F(e=>{s(a,1,x([`svelte-flow__selection-wrapper`,t.store.noPanClass]),`svelte-1lxk677`),q(a,`role`,t.store.disableKeyboardA11y?void 0:`button`),q(a,`tabindex`,t.store.disableKeyboardA11y?void 0:-1),p=l(a,``,p,e)},[()=>({width:Z6(W(o).width),height:Z6(W(o).height),transform:`translate(${W(o).x??``}px, ${W(o).y??``}px)`})]),r(`contextmenu`,a,c),r(`click`,a,u),r(`keydown`,a,function(...e){(t.store.disableKeyboardA11y?void 0:f)?.apply(this,e)}),g(e,a)},_=J(()=>t.store.selectionRectMode===`nodes`&&W(o)&&J3(W(o).x)&&J3(W(o).y));k(m,e=>{W(_)&&e(h)}),g(e,p),z()}T([`contextmenu`,`click`,`keydown`]);function lge(e){switch(e){case`none`:return 0;case`ctrl`:return 8;case`shift`:return 4;case`alt`:return 2;case`meta`:return 1}}function p8(e,t){let{enabled:n=!0,trigger:r,type:i=`keydown`}=t;function a(t){let n=Array.isArray(r)?r:[r],i=[t.metaKey,t.altKey,t.shiftKey,t.ctrlKey].reduce((e,t,n)=>t?e|1<<n:e,0);for(let r of n){let n={preventDefault:!1,enabled:!0,...r},{modifier:a,key:o,code:s,callback:c,preventDefault:l,enabled:u}=n;if(!o&&!s&&console.warn("[svelte-put/shortcut] Trigger should have either `key` or `code`, a trigger missing both was detected! Check your configuration"),u&&(o||s)){if(s&&t.code!==s||o&&t.key!==o)continue;if(a===null||a===!1){if(i!==0)continue}else if(a!==void 0&&a?.[0]?.length>0){let e=Array.isArray(a)?a:[a],t=!1;for(let n of e)if((Array.isArray(n)?n:[n]).reduce((e,t)=>e|lge(t),0)===i){t=!0;break}if(!t)continue}l&&t.preventDefault();let r={node:e,trigger:n,originalEvent:t};e.dispatchEvent(new CustomEvent(`shortcut`,{detail:r})),c?.(r)}}}let o;return n&&(o=Oe(e,i,a)),{update:t=>{let{enabled:s=!0,type:c=`keydown`}=t;n&&(!s||i!==c)?o?.():!n&&s&&(o=Oe(e,c,a)),n=s,i=c,r=t.trigger},destroy:()=>{o?.()}}}function m8(){let e=J(i8),t=t=>{let n=X6(t)?t:W(e).nodeLookup.get(t.id),r=n.parentId?fme(n.position,n.measured,n.parentId,W(e).nodeLookup,W(e).nodeOrigin):n.position;return H3({...n,position:r,width:n.measured?.width??n.width,height:n.measured?.height??n.height})};function n(t,n,r={replace:!1}){W(e).nodes=ie(()=>W(e).nodes).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r?.replace&&X6(t)?t:{...e,...t}}return e})}function r(t,n,r={replace:!1}){W(e).edges=ie(()=>W(e).edges).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r.replace&&yhe(t)?t:{...e,...t}}return e})}let i=t=>W(e).nodeLookup.get(t);return{zoomIn:W(e).zoomIn,zoomOut:W(e).zoomOut,getInternalNode:i,getNode:e=>i(e)?.internals.userNode,getNodes:t=>t===void 0?W(e).nodes:h8(W(e).nodeLookup,t),getEdge:t=>W(e).edgeLookup.get(t),getEdges:t=>t===void 0?W(e).edges:h8(W(e).edgeLookup,t),setZoom:async(t,n)=>{let r=W(e).panZoom;return r?r.scaleTo(t,n):!1},getZoom:()=>W(e).viewport.zoom,setViewport:async(t,n)=>{let r=W(e).viewport;return W(e).panZoom?(await W(e).panZoom.setViewport({x:t.x??r.x,y:t.y??r.y,zoom:t.zoom??r.zoom},n),!0):!1},getViewport:()=>y(W(e).viewport),setCenter:async(t,n,r)=>W(e).setCenter(t,n,r),fitView:t=>W(e).fitView(t),fitBounds:async(t,n)=>{if(!W(e).panZoom)return!1;let r=e6(t,W(e).width,W(e).height,W(e).minZoom,W(e).maxZoom,n?.padding??.1);return await W(e).panZoom.setViewport(r,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},getIntersectingNodes:(n,r=!0,i)=>{let a=q3(n),o=a?n:t(n);return o?(i||W(e).nodes).filter(t=>{let i=W(e).nodeLookup.get(t.id);if(!i||!a&&t.id===n.id)return!1;let s=H3(i),c=K3(s,o);return r&&c>0||c>=s.width*s.height||c>=o.width*o.height}):[]},isNodeIntersecting:(e,n,r=!0)=>{let i=q3(e)?e:t(e);if(!i)return!1;let a=K3(i,n);return r&&a>0||a>=n.width*n.height||a>=i.width*i.height},deleteElements:async({nodes:t=[],edges:n=[]})=>{let{nodes:r,edges:i}=await lme({nodesToRemove:t,edgesToRemove:n,nodes:W(e).nodes,edges:W(e).edges,onBeforeDelete:W(e).onbeforedelete});return r&&(W(e).nodes=ie(()=>W(e).nodes).filter(e=>!r.some(({id:t})=>t===e.id))),i&&(W(e).edges=ie(()=>W(e).edges).filter(e=>!i.some(({id:t})=>t===e.id))),(r.length>0||i.length>0)&&W(e).ondelete?.({nodes:r,edges:i}),{deletedNodes:r,deletedEdges:i}},screenToFlowPosition:(t,n={snapToGrid:!0})=>{if(!W(e).domNode)return t;let r=n.snapToGrid?W(e).snapGrid:!1,{x:i,y:a,zoom:o}=W(e).viewport,{x:s,y:c}=W(e).domNode.getBoundingClientRect();return Z3({x:t.x-s,y:t.y-c},[i,a,o],r!==null,r||[1,1])},flowToScreenPosition:t=>{if(!W(e).domNode)return t;let{x:n,y:r,zoom:i}=W(e).viewport,{x:a,y:o}=W(e).domNode.getBoundingClientRect(),s=Q3(t,[n,r,i]);return{x:s.x+a,y:s.y+o}},toObject:()=>structuredClone({nodes:[...W(e).nodes],edges:[...W(e).edges],viewport:{...W(e).viewport}}),updateNode:n,updateNodeData:(t,r,i)=>{let a=W(e).nodeLookup.get(t)?.internals.userNode;if(!a)return;let o=typeof r==`function`?r(a):r;n(t,e=>({...e,data:i?.replace?o:{...e.data,...o}}))},updateEdge:r,getNodesBounds:t=>ame(t,{nodeLookup:W(e).nodeLookup,nodeOrigin:W(e).nodeOrigin}),getHandleConnections:({type:t,id:n,nodeId:r})=>Array.from(W(e).connectionLookup.get(`${r}-${t}-${n??null}`)?.values()??[])}}function h8(e,t){let n=[];for(let r of t){let t=e.get(r);if(t){let e=`internals`in t?t.internals?.userNode:t;n.push(e)}}return n}function uge(e,t){a(t,!0);let n=I(t,`store`,15),r=I(t,`selectionKey`,3,`Shift`),o=I(t,`multiSelectionKey`,19,()=>t6()?`Meta`:`Control`),s=I(t,`deleteKey`,3,`Backspace`),c=I(t,`panActivationKey`,3,` `),l=I(t,`zoomActivationKey`,19,()=>t6()?`Meta`:`Control`),{deleteElements:u}=m8();function d(e){return typeof e==`object`&&!!e}function f(e){return d(e)&&e.modifier||[]}function p(e){return e==null?``:d(e)?e.key:e}function m(e,t){return(Array.isArray(e)?e:[e]).map(e=>{let n=p(e);return{key:n,modifier:f(e),enabled:n!==null,callback:t}})}function h(){n(n().selectionRect=null,!0),n(n().selectionKeyPressed=!1,!0),n(n().multiselectionKeyPressed=!1,!0),n(n().deleteKeyPressed=!1,!0),n(n().panActivationKeyPressed=!1,!0),n(n().zoomActivationKeyPressed=!1,!0)}function g(){u({nodes:n().nodes.filter(e=>e.selected),edges:n().edges.filter(e=>e.selected)})}ue(`blur`,Te,h),ue(`contextmenu`,Te,h),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(r(),()=>n(n().selectionKeyPressed=!0,!0)),type:`keydown`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(r(),()=>n(n().selectionKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(o(),()=>{n(n().multiselectionKeyPressed=!0,!0)}),type:`keydown`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(o(),()=>n(n().multiselectionKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(s(),e=>{!(e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)&&!c6(e.originalEvent)&&(n(n().deleteKeyPressed=!0,!0),g())}),type:`keydown`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(s(),()=>n(n().deleteKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(c(),()=>n(n().panActivationKeyPressed=!0,!0)),type:`keydown`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(c(),()=>n(n().panActivationKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(l(),()=>n(n().zoomActivationKeyPressed=!0,!0)),type:`keydown`})),i(Te,(e,t)=>p8?.(e,t),()=>({trigger:m(l(),()=>n(n().zoomActivationKeyPressed=!1,!0)),type:`keyup`})),z()}var dge=j(`<path fill="none" class="svelte-flow__connection-path"></path>`),fge=j(`<svg class="svelte-flow__connectionline"><g><!></g></svg>`);function pge(e,t){a(t,!0);let n=J(()=>{if(!t.store.connection.inProgress)return``;let e={sourceX:t.store.connection.from.x,sourceY:t.store.connection.from.y,sourcePosition:t.store.connection.fromPosition,targetX:t.store.connection.to.x,targetY:t.store.connection.to.y,targetPosition:t.store.connection.toPosition};switch(t.type){case C3.Bezier:{let[t]=m6(e);return t}case C3.Straight:{let[t]=g6(e);return t}case C3.Step:case C3.SmoothStep:{let[n]=y6({...e,borderRadius:t.type===C3.Step?0:void 0});return n}}});var r=U(),i=R(r),o=e=>{var r=fge(),i=V(r),a=V(i),o=e=>{var n=U();C(R(n),()=>t.LineComponent,(e,t)=>{t(e,{})}),g(e,n)},c=e=>{var r=dge();F(()=>{q(r,`d`,W(n)),l(r,t.style)}),g(e,r)};k(a,e=>{t.LineComponent?e(o):e(c,-1)}),d(i),d(r),F(e=>{q(r,`width`,t.store.width),q(r,`height`,t.store.height),l(r,t.containerStyle),s(i,0,e)},[()=>x([`svelte-flow__connection`,rme(t.store.connection.isValid)])]),g(e,r)};k(i,e=>{t.store.connection.inProgress&&e(o)}),g(e,r),z()}var mge=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`style`,`class`,`children`]),hge=h(`<div><!></div>`);function g8(e,t){a(t,!0);let n=I(t,`position`,3,`top-right`),r=H(t,mge),i=J(()=>`${n()}`.split(`-`));var o=hge();O(o,e=>({class:e,style:t.style,...r}),[()=>[`svelte-flow__panel`,t.class,...W(i)]]),u(V(o),()=>t.children??D),d(o),g(e,o),z()}var gge=h(`<a target="_blank" rel="noopener noreferrer" aria-label="Svelte Flow attribution">Svelte Flow</a>`);function _ge(e,t){a(t,!0);let n=I(t,`position`,3,`bottom-right`),r=`https://svelteflow.dev?utm_source=attribution`;var i=U(),o=R(i),s=e=>{{let t=J(()=>`Please only hide this attribution when you are subscribed to Svelte Flow Pro: ${r}`);g8(e,{get position(){return n()},class:`svelte-flow__attribution`,get"data-message"(){return W(t)},children:(e,t)=>{var n=gge();F(()=>q(n,`href`,r)),g(e,n)},$$slots:{default:!0}})}};k(o,e=>{t.proOptions?.hideAttribution||e(s)}),g(e,i),z()}var vge=h(`<div><!></div>`);function yge(e,t){a(t,!0);let n=I(t,`domNode`,15),r=I(t,`clientWidth`,15),i=I(t,`clientHeight`,15);J(()=>t.rest.id);let o=J(()=>t.rest.class);J(()=>t.rest.nodeTypes),J(()=>t.rest.edgeTypes),J(()=>t.rest.colorMode),J(()=>t.rest.isValidConnection),J(()=>t.rest.onmove),J(()=>t.rest.onmovestart),J(()=>t.rest.onmoveend),J(()=>t.rest.onflowerror),J(()=>t.rest.ondelete),J(()=>t.rest.onbeforedelete),J(()=>t.rest.onbeforeconnect),J(()=>t.rest.onconnect),J(()=>t.rest.onconnectstart),J(()=>t.rest.onconnectend),J(()=>t.rest.onbeforereconnect),J(()=>t.rest.onreconnect),J(()=>t.rest.onreconnectstart),J(()=>t.rest.onreconnectend),J(()=>t.rest.onclickconnectstart),J(()=>t.rest.onclickconnectend),J(()=>t.rest.oninit),J(()=>t.rest.onselectionchange),J(()=>t.rest.onselectiondragstart),J(()=>t.rest.onselectiondrag),J(()=>t.rest.onselectiondragstop),J(()=>t.rest.onselectionstart),J(()=>t.rest.onselectionend),J(()=>t.rest.clickConnect),J(()=>t.rest.fitView),J(()=>t.rest.fitViewOptions),J(()=>t.rest.nodeOrigin),J(()=>t.rest.nodeDragThreshold),J(()=>t.rest.connectionDragThreshold),J(()=>t.rest.minZoom),J(()=>t.rest.maxZoom),J(()=>t.rest.initialViewport),J(()=>t.rest.connectionRadius),J(()=>t.rest.connectionMode),J(()=>t.rest.selectionMode),J(()=>t.rest.selectNodesOnDrag),J(()=>t.rest.snapGrid),J(()=>t.rest.defaultMarkerColor),J(()=>t.rest.translateExtent),J(()=>t.rest.nodeExtent),J(()=>t.rest.onlyRenderVisibleElements),J(()=>t.rest.autoPanOnConnect),J(()=>t.rest.autoPanOnNodeDrag),J(()=>t.rest.colorModeSSR),J(()=>t.rest.defaultEdgeOptions),J(()=>t.rest.elevateNodesOnSelect),J(()=>t.rest.elevateEdgesOnSelect),J(()=>t.rest.nodesDraggable),J(()=>t.rest.autoPanOnNodeFocus),J(()=>t.rest.nodesConnectable),J(()=>t.rest.elementsSelectable),J(()=>t.rest.nodesFocusable),J(()=>t.rest.edgesFocusable),J(()=>t.rest.disableKeyboardA11y),J(()=>t.rest.noDragClass),J(()=>t.rest.noPanClass),J(()=>t.rest.noWheelClass),J(()=>t.rest.ariaLabelConfig),J(()=>t.rest.autoPanSpeed),J(()=>t.rest.panOnScrollSpeed),J(()=>t.rest.zIndexMode),J(()=>t.rest.autoPanOnSelection);let s=J(()=>m(t.rest,`id.class.nodeTypes.edgeTypes.colorMode.isValidConnection.onmove.onmovestart.onmoveend.onflowerror.ondelete.onbeforedelete.onbeforeconnect.onconnect.onconnectstart.onconnectend.onbeforereconnect.onreconnect.onreconnectstart.onreconnectend.onclickconnectstart.onclickconnectend.oninit.onselectionchange.onselectiondragstart.onselectiondrag.onselectiondragstop.onselectionstart.onselectionend.clickConnect.fitView.fitViewOptions.nodeOrigin.nodeDragThreshold.connectionDragThreshold.minZoom.maxZoom.initialViewport.connectionRadius.connectionMode.selectionMode.selectNodesOnDrag.snapGrid.defaultMarkerColor.translateExtent.nodeExtent.onlyRenderVisibleElements.autoPanOnConnect.autoPanOnNodeDrag.colorModeSSR.defaultEdgeOptions.elevateNodesOnSelect.elevateEdgesOnSelect.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.elementsSelectable.nodesFocusable.edgesFocusable.disableKeyboardA11y.noDragClass.noPanClass.noWheelClass.ariaLabelConfig.autoPanSpeed.panOnScrollSpeed.zIndexMode.autoPanOnSelection`.split(`.`)));function c(e){e.currentTarget.scrollTo({top:0,left:0,behavior:`auto`}),t.rest.onscroll&&t.rest.onscroll(e)}var l=vge();O(l,e=>({class:[`svelte-flow`,`svelte-flow__container`,t.colorMode,W(o)],"data-testid":`svelte-flow__wrapper`,role:`application`,onscroll:c,...W(s),[Me]:e}),[()=>({width:Z6(t.width),height:Z6(t.height)})],void 0,void 0,`svelte-k1b1ck`),u(V(l),()=>t.children??D),d(l),fe(l,e=>n(e),()=>n()),re(l,`clientHeight`,i),re(l,`clientWidth`,r),g(e,l),z()}var bge=new Set(`$$slots.$$events.$$legacy.width.height.proOptions.selectionKey.deleteKey.panActivationKey.multiSelectionKey.zoomActivationKey.paneClickDistance.nodeClickDistance.onmovestart.onmoveend.onmove.oninit.onnodeclick.onnodecontextmenu.onnodedrag.onnodedragstart.onnodedragstop.onnodepointerenter.onnodepointermove.onnodepointerleave.onselectionclick.onselectioncontextmenu.onselectionstart.onselectionend.onedgeclick.onedgecontextmenu.onedgepointerenter.onedgepointerleave.onpaneclick.onpanecontextmenu.panOnScrollMode.preventScrolling.zoomOnScroll.zoomOnDoubleClick.zoomOnPinch.panOnScroll.panOnScrollSpeed.panOnDrag.selectionOnDrag.autoPanOnSelection.connectionLineComponent.connectionLineStyle.connectionLineContainerStyle.connectionLineType.attributionPosition.children.nodes.edges.viewport`.split(`.`)),xge=h(`<div class="svelte-flow__viewport-back svelte-flow__container"></div> <!> <div class="svelte-flow__edge-labels svelte-flow__container"></div> <!> <!> <!> <div class="svelte-flow__viewport-front svelte-flow__container"></div>`,1),Sge=h(`<!> <!>`,1),Cge=h(`<!> <!> <!> <!> <!>`,1);function wge(e,t){a(t,!0);let n=I(t,`paneClickDistance`,3,1),r=I(t,`nodeClickDistance`,3,1),i=I(t,`panOnScrollMode`,19,()=>b3.Free),o=I(t,`preventScrolling`,3,!0),s=I(t,`zoomOnScroll`,3,!0),l=I(t,`zoomOnDoubleClick`,3,!0),d=I(t,`zoomOnPinch`,3,!0),f=I(t,`panOnScroll`,3,!1),p=I(t,`panOnScrollSpeed`,3,.5),m=I(t,`panOnDrag`,3,!0),h=I(t,`selectionOnDrag`,3,!1),_=I(t,`autoPanOnSelection`,3,!0),v=I(t,`connectionLineType`,19,()=>C3.Bezier),y=I(t,`nodes`,31,()=>N([])),b=I(t,`edges`,31,()=>N([])),x=I(t,`viewport`,15,void 0),S=H(t,bge),C=Phe({props:S,width:t.width,height:t.height,get nodes(){return y()},set nodes(e){y(e)},get edges(){return b()},set edges(e){b(e)},get viewport(){return x()},set viewport(e){x(e)}}),T=c(a8);T&&T.setStore&&T.setStore(C),_e(a8,{provider:!1,getStore(){return C}}),be(()=>{let e={nodes:C.selectedNodes,edges:C.selectedEdges};ie(()=>t.onselectionchange)?.(e);for(let t of C.selectionChangeHandlers.values())t(e)}),ke(()=>{C.reset()}),yge(e,{get colorMode(){return C.colorMode},get width(){return t.width},get height(){return t.height},get rest(){return S},get domNode(){return C.domNode},set domNode(e){C.domNode=e},get clientWidth(){return C.width},set clientWidth(e){C.width=e},get clientHeight(){return C.height},set clientHeight(e){C.height=e},children:(e,a)=>{var c=Cge(),y=R(c);uge(y,{get selectionKey(){return t.selectionKey},get deleteKey(){return t.deleteKey},get panActivationKey(){return t.panActivationKey},get multiSelectionKey(){return t.multiSelectionKey},get zoomActivationKey(){return t.zoomActivationKey},get store(){return C},set store(e){C=e}});var b=L(y,2);Lhe(b,{get panOnScrollMode(){return i()},get preventScrolling(){return o()},get zoomOnScroll(){return s()},get zoomOnDoubleClick(){return l()},get zoomOnPinch(){return d()},get panOnScroll(){return f()},get panOnScrollSpeed(){return p()},get panOnDrag(){return m()},get paneClickDistance(){return n()},get selectionOnDrag(){return h()},get onmovestart(){return t.onmovestart},get onmove(){return t.onmove},get onmoveend(){return t.onmoveend},get oninit(){return t.oninit},get store(){return C},set store(e){C=e},children:(e,i)=>{zhe(e,{get onpaneclick(){return t.onpaneclick},get onpanecontextmenu(){return t.onpanecontextmenu},get onselectionstart(){return t.onselectionstart},get onselectionend(){return t.onselectionend},get panOnDrag(){return m()},get paneClickDistance(){return n()},get selectionOnDrag(){return h()},get autoPanOnSelection(){return _()},get store(){return C},set store(e){C=e},children:(e,n)=>{var i=Sge(),a=R(i);Vhe(a,{get store(){return C},set store(e){C=e},children:(e,n)=>{var i=xge(),a=L(R(i),2);age(a,{get onedgeclick(){return t.onedgeclick},get onedgecontextmenu(){return t.onedgecontextmenu},get onedgepointerenter(){return t.onedgepointerenter},get onedgepointerleave(){return t.onedgepointerleave},get store(){return C},set store(e){C=e}});var o=L(a,4);pge(o,{get type(){return v()},get LineComponent(){return t.connectionLineComponent},get containerStyle(){return t.connectionLineContainerStyle},get style(){return t.connectionLineStyle},get store(){return C},set store(e){C=e}});var s=L(o,2);Yhe(s,{get nodeClickDistance(){return r()},get onnodeclick(){return t.onnodeclick},get onnodecontextmenu(){return t.onnodecontextmenu},get onnodepointerenter(){return t.onnodepointerenter},get onnodepointermove(){return t.onnodepointermove},get onnodepointerleave(){return t.onnodepointerleave},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get store(){return C},set store(e){C=e}}),cge(L(s,2),{get onselectionclick(){return t.onselectionclick},get onselectioncontextmenu(){return t.onselectioncontextmenu},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get store(){return C},set store(e){C=e}}),w(2),g(e,i)},$$slots:{default:!0}});var o=L(a,2);{let e=J(()=>!!(C.selectionRect&&C.selectionRectMode===`user`)),t=J(()=>C.selectionRect?.width),n=J(()=>C.selectionRect?.height),r=J(()=>C.selectionRect?.x),i=J(()=>C.selectionRect?.y);f8(o,{get isVisible(){return W(e)},get width(){return W(t)},get height(){return W(n)},get x(){return W(r)},get y(){return W(i)}})}g(e,i)},$$slots:{default:!0}})},$$slots:{default:!0}});var x=L(b,2);_ge(x,{get proOptions(){return t.proOptions},get position(){return t.attributionPosition}});var S=L(x,2);Whe(S,{get store(){return C}}),u(L(S,2),()=>t.children??D),g(e,c)},$$slots:{default:!0}}),z()}var _8;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(_8||={});var Tge=j(`<circle></circle>`);function Ege(e,t){var n=Tge();F(()=>{q(n,`cx`,t.radius),q(n,`cy`,t.radius),q(n,`r`,t.radius),s(n,0,x([`svelte-flow__background-pattern`,`dots`,t.class]))}),g(e,n)}var Dge=j(`<path></path>`);function Oge(e,t){a(t,!0);var n=Dge();F(()=>{q(n,`stroke-width`,t.lineWidth),q(n,`d`,`M${t.dimensions[0]/2} 0 V${t.dimensions[1]} M0 ${t.dimensions[1]/2} H${t.dimensions[0]}`),s(n,0,x([`svelte-flow__background-pattern`,t.variant,t.class]))}),g(e,n),z()}var kge={[_8.Dots]:1,[_8.Lines]:1,[_8.Cross]:6},Age=j(`<svg data-testid="svelte-flow__background"><pattern patternUnits="userSpaceOnUse"><!></pattern><rect x="0" y="0" width="100%" height="100%"></rect></svg>`);function jge(e,t){a(t,!0);let n=I(t,`variant`,19,()=>_8.Dots),r=I(t,`gap`,3,20),i=I(t,`lineWidth`,3,1),o=J(i8),c=J(()=>n()===_8.Dots),u=J(()=>n()===_8.Cross),f=J(()=>Array.isArray(r())?r():[r(),r()]),p=J(()=>`background-pattern-${W(o).flowId}-${t.id??``}`),m=J(()=>[W(f)[0]*W(o).viewport.zoom||1,W(f)[1]*W(o).viewport.zoom||1]),h=J(()=>(t.size??kge[n()])*W(o).viewport.zoom),_=J(()=>W(u)?[W(h),W(h)]:W(m)),v=J(()=>W(c)?[W(h)/2,W(h)/2]:[W(_)[0]/2,W(_)[1]/2]);var y=Age();let b;var S=V(y),C=V(S),w=e=>{{let n=J(()=>W(h)/2);Ege(e,{get radius(){return W(n)},get class(){return t.patternClass}})}},T=e=>{Oge(e,{get dimensions(){return W(_)},get variant(){return n()},get lineWidth(){return i()},get class(){return t.patternClass}})};k(C,e=>{W(c)?e(w):e(T,-1)}),d(S);var E=L(S);d(y),F(()=>{s(y,0,x([`svelte-flow__background`,`svelte-flow__container`,t.class])),b=l(y,``,b,{"--xy-background-color-props":t.bgColor,"--xy-background-pattern-color-props":t.patternColor}),q(S,`id`,W(p)),q(S,`x`,W(o).viewport.x%W(m)[0]),q(S,`y`,W(o).viewport.y%W(m)[1]),q(S,`width`,W(m)[0]),q(S,`height`,W(m)[1]),q(S,`patternTransform`,`translate(-${W(v)[0]},-${W(v)[1]})`),q(E,`fill`,`url(#${W(p)})`)}),g(e,y),z()}function Mge(e){let t=J(i8),n=J(()=>W(t).nodeLookup),r=J(()=>W(t).nodes),i=J(()=>(W(r),W(n).get(e)));return{get current(){return W(i)}}}var Nge=j(`<rect></rect>`);function Pge(e,t){a(t,!0);let n=I(t,`borderRadius`,3,5),r=I(t,`strokeWidth`,3,2),i=J(()=>Mge(t.id)),o=J(()=>{if(!W(i).current)return{width:0,height:0,x:0,y:0};let{width:e,height:n}=r6(W(i).current);return{width:t.width??e,height:t.height??n,x:t.x??W(i).current.internals.positionAbsolute.x,y:t.y??W(i).current.internals.positionAbsolute.y}}),c=J(()=>W(o).width),u=J(()=>W(o).height),d=J(()=>W(o).x),f=J(()=>W(o).y);var p=U(),m=R(p),h=e=>{let i=J(()=>t.nodeComponent);var a=U();C(R(a),()=>W(i),(e,i)=>{i(e,{get id(){return t.id},get x(){return W(d)},get y(){return W(f)},get width(){return W(c)},get height(){return W(u)},get borderRadius(){return n()},get class(){return t.class},get color(){return t.color},get shapeRendering(){return t.shapeRendering},get strokeColor(){return t.strokeColor},get strokeWidth(){return r()},get selected(){return t.selected}})}),g(e,a)},_=e=>{var i=Nge();let a,o;F(()=>{a=s(i,0,x([`svelte-flow__minimap-node`,t.class]),null,a,{selected:t.selected}),q(i,`x`,W(d)),q(i,`y`,W(f)),q(i,`rx`,n()),q(i,`ry`,n()),q(i,`width`,W(c)),q(i,`height`,W(u)),q(i,`shape-rendering`,t.shapeRendering),o=l(i,``,o,{fill:t.color,stroke:t.strokeColor,"stroke-width":r()})}),g(e,i)};k(m,e=>{t.nodeComponent?e(h):e(_,-1)}),g(e,p),z()}function Fge(e,t){let n=Gme({domNode:e,panZoom:t.panZoom,getTransform:()=>{let{viewport:e}=t.store;return[e.x,e.y,e.zoom]},getViewScale:t.getViewScale});n.update({translateExtent:t.translateExtent,width:t.width,height:t.height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:t.pannable,zoomable:t.zoomable});function r(e){n.update({translateExtent:e.translateExtent,width:e.width,height:e.height,inversePan:e.inversePan,zoomStep:e.zoomStep,pannable:e.pannable,zoomable:e.zoomable})}return{update:r,destroy(){n.destroy()}}}var v8=e=>e instanceof Function?e:()=>e,Ige=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`ariaLabel`,`nodeStrokeColor`,`nodeColor`,`nodeClass`,`nodeBorderRadius`,`nodeStrokeWidth`,`nodeComponent`,`bgColor`,`maskColor`,`maskStrokeColor`,`maskStrokeWidth`,`width`,`height`,`pannable`,`zoomable`,`inversePan`,`zoomStep`,`class`]),Lge=j(`<title> </title>`),Rge=j(`<svg class="svelte-flow__minimap-svg" role="img"><!><!><path class="svelte-flow__minimap-mask" fill-rule="evenodd" pointer-events="none"></path></svg>`),zge=h(`<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>`,1);function Bge(e,t){a(t,!0);let n=I(t,`position`,3,`bottom-right`),r=I(t,`nodeStrokeColor`,3,`transparent`),o=I(t,`nodeClass`,3,``),s=I(t,`nodeBorderRadius`,3,5),c=I(t,`nodeStrokeWidth`,3,2),u=I(t,`width`,3,200),f=I(t,`height`,3,150),p=I(t,`pannable`,3,!0),m=I(t,`zoomable`,3,!0),h=H(t,Ige),v=J(i8),y=J(()=>W(v).ariaLabelConfig),b=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`,x=J(()=>`svelte-flow__minimap-desc-${W(v).flowId}`),S=J(()=>({x:-W(v).viewport.x/W(v).viewport.zoom,y:-W(v).viewport.y/W(v).viewport.zoom,width:W(v).width/W(v).viewport.zoom,height:W(v).height/W(v).viewport.zoom})),C=J(()=>W3(j3(W(v).nodeLookup,{filter:e=>!e.hidden}),W(S))),w=J(()=>W(C).width/u()),T=J(()=>W(C).height/f()),E=J(()=>Math.max(W(w),W(T))),D=J(()=>W(E)*u()),O=J(()=>W(E)*f()),ee=J(()=>5*W(E)),te=J(()=>W(C).x-(W(D)-W(C).width)/2-W(ee)),ne=J(()=>W(C).y-(W(O)-W(C).height)/2-W(ee)),j=J(()=>W(D)+W(ee)*2),M=J(()=>W(O)+W(ee)*2),re=()=>W(E);var N=zge(),P=R(N);{let e=J(()=>[`svelte-flow__minimap`,t.class]);Pe(P,()=>({"--xy-minimap-background-color-props":t.bgColor})),g8(P.lastChild,B({get position(){return n()},get class(){return W(e)},"data-testid":`svelte-flow__minimap`},()=>h,{children:(e,n)=>{var a=U(),h=R(a),C=e=>{var n=Rge();let a;var h=V(n),C=e=>{var n=Lge(),r=V(n,!0);d(n),F(()=>{q(n,`id`,W(x)),A(r,t.ariaLabel??W(y)[`minimap.ariaLabel`])}),g(e,n)};k(h,e=>{(t.ariaLabel??W(y)[`minimap.ariaLabel`])&&e(C)});var w=L(h);_(w,17,()=>W(v).nodes,e=>e.id,(e,n)=>{let i=J(()=>W(v).nodeLookup.get(W(n).id));var a=U(),l=R(a),u=e=>{{let a=J(()=>t.nodeColor===void 0?void 0:v8(t.nodeColor)(W(n))),l=J(()=>v8(r())(W(n))),u=J(()=>v8(o())(W(n)));Pge(e,{get id(){return W(i).id},get selected(){return W(i).selected},get nodeComponent(){return t.nodeComponent},get color(){return W(a)},get borderRadius(){return s()},get strokeColor(){return W(l)},get strokeWidth(){return c()},get shapeRendering(){return b},get class(){return W(u)}})}},d=J(()=>W(i)&&i6(W(i))&&!W(i).hidden);k(l,e=>{W(d)&&e(u)}),g(e,a)});var T=L(w);d(n),i(n,(e,t)=>Fge?.(e,t),()=>({store:W(v),panZoom:W(v).panZoom,getViewScale:re,translateExtent:W(v).translateExtent,width:W(v).width,height:W(v).height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:p(),zoomable:m()})),F(()=>{q(n,`width`,u()),q(n,`height`,f()),q(n,`viewBox`,`${W(te)??``} ${W(ne)??``} ${W(j)??``} ${W(M)??``}`),q(n,`aria-labelledby`,W(x)),a=l(n,``,a,{"--xy-minimap-mask-background-color-props":t.maskColor,"--xy-minimap-mask-stroke-color-props":t.maskStrokeColor,"--xy-minimap-mask-stroke-width-props":t.maskStrokeWidth?t.maskStrokeWidth*W(E):void 0}),q(T,`d`,`M${W(te)-W(ee)},${W(ne)-W(ee)}h${W(j)+W(ee)*2}v${W(M)+W(ee)*2}h${-W(j)-W(ee)*2}z
156
+ M${W(S).x??``},${W(S).y??``}h${W(S).width??``}v${W(S).height??``}h${-W(S).width}z`)}),g(e,n)};k(h,e=>{W(v).panZoom&&e(C)}),g(e,a)},$$slots:{default:!0}})),d(P)}g(e,N),z()}var Vge=/^\[Tool call:([\s\S]*)\]$/,y8=new Set([`ask_user`,`plan_mode_present`]),Hge={read:`file-text`,bash:`terminal`,python:`terminal`,edit:`file-pen`,write:`file-plus`,grep:`search`,find:`folder-search`,ls:`folder-tree`,web_search:`globe`,web_fetch:`download`,task_start:`cpu`,task_status:`cpu`,task_logs:`cpu`,task_cancel:`cpu`,task_restart:`cpu`,explore:`search`,ask_user:`message-circle-question`,plan_mode_enter:`clipboard-list`,plan_mode_present:`clipboard-check`,plan_mode_force_exit:`clipboard-list`,todos_set:`list-todo`,todos_get:`list-todo`};function b8(e){return e&&Hge[e]||`wrench`}function x8(e){return e&&typeof e==`object`?e:void 0}function Uge(e){return typeof e==`string`&&e.length>0?e:void 0}function S8(e){return typeof e==`string`&&e.startsWith(`tool_`)?e:void 0}function Wge(e){let t=e?.thinkingBlocks;return Array.isArray(t)?t.some(e=>{let t=x8(e);return t?typeof t.text==`string`&&t.text.length>0||t.redacted===!0:!1}):!1}function C8(e,t){if(!e)return;let n=x8(x8(e.details)?.toolCall),r=S8(e.toolRecordId)??S8(n?.id);return r?t.get(r):void 0}function Gge(e,t){return C8(x8(e.details),t)}function w8(e){let t=e.trim().match(Vge);return t?[...t[1].matchAll(/([a-z_][a-z0-9_]*)\s*\(/gi)].map(e=>e[1]):[]}function T8(e){let t=e.replace(/\s+/g,` `).trim();return t.length>160?`${t.slice(0,160)}…`:t}function E8(e,t){let n=x8(e.details),r=[],i=e.usage?.totalTokens,a=()=>i&&i>0?{icon:`sparkles`,label:i>=1e3?`${Math.round(i/1e3)}k`:`${i}`,tone:`default`,title:`${i.toLocaleString()} tokens`}:void 0;if(e.kind===`compaction`)return{type:`compaction`,icon:`fold-vertical`,label:`Compacted`,preview:T8(e.summary||e.text),tone:`info`,mono:!1,badges:r};if(e.kind===`branch_summary`)return{type:`branch_summary`,icon:`git-branch`,label:`Branch summary`,preview:T8(e.summary||e.text),tone:`info`,mono:!1,badges:r};if(e.kind===`explore_report`)return{type:`explore_report`,icon:`search`,label:`Explore`,preview:T8(e.summary||e.text),tone:`info`,mono:!1,badges:r};if(e.role===`user`)return{type:`user`,icon:`user`,label:`You`,preview:T8(e.text)||`empty message`,tone:`default`,mono:!1,badges:r};if(e.role===`assistant`){Wge(n)&&r.push({icon:`brain`,tone:`info`,title:`Includes thinking`});let t=w8(e.text);if(t.length>0){let e=t[0],n=t.some(e=>y8.has(e)),i=t.length>1?` +${t.length-1}`:``;return{type:n?`human_loop`:`tool_call`,icon:b8(e),label:`${e}${i}`,preview:t.slice(0,4).join(`, `),tone:n?`warning`:`default`,mono:!0,badges:n?[{icon:`hand`,label:`input`,tone:`warning`},...r]:r}}let i=a();return i&&r.push(i),{type:`assistant`,icon:`sparkles`,label:`Assistant`,preview:T8(e.text)||`(thinking)`,tone:`default`,mono:!1,badges:r}}let o=Uge(n?.toolName);if(o){let i=C8(n,t),a=n?.isError===!0||i?.status===`error`||i?.status===`denied`,s=y8.has(o)||i?.risk===`interaction`||!!i?.approvalId;return s&&r.push({icon:`hand`,label:`human`,tone:`warning`}),a&&r.push({icon:`triangle-alert`,label:`error`,tone:`danger`}),{type:s?`human_loop`:`tool_result`,icon:b8(o),label:o,preview:T8(e.text),tone:a?`danger`:s?`warning`:`success`,mono:!0,badges:r}}return{type:`system`,icon:`info`,label:`System`,preview:T8(e.text)||`system entry`,tone:`default`,mono:!1,badges:r}}function Kge(e,t){let n=new Map(e.map(e=>[e.entry.id,e])),r=e=>e.entry.parentEntryId!==void 0&&n.has(e.entry.parentEntryId),i=e.filter(e=>!r(e)),a=new Set;if(t){let e=t;for(;e;){let t=n.get(e);if(!t)break;a.add(t.entry.id),e=t.entry.parentEntryId}}let o=[],s=new Set,c=0,l=e=>e.childEntryIds.map(e=>n.get(e)).filter(e=>!!e),u=e=>{if(s.has(e.entry.id))return;s.add(e.entry.id);let n=l(e);o.push({node:e,index:++c,isOnActivePath:a.has(e.entry.id),isActive:e.entry.id===t,isLeaf:n.length===0,isBranchPoint:n.length>1}),n.forEach(u)};return i.forEach(u),e.forEach(u),{rows:o}}function qge(e){let t=e.details;return Array.isArray(t?.thinkingBlocks)?t.thinkingBlocks:void 0}function D8(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Jge(e,t=560){let n=e.trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}…`}function O8(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e==`object`?Object.keys(e).length>0:!0}function k8(e,t){let n=E8(e,t),r=Gge(e,t),i=(qge(e)??[]).map(e=>e?.text??``).filter(Boolean).join(`
157
+
158
+ `),a=e.summary||e.text,o=n.type===`tool_call`||n.type===`tool_result`||n.type===`human_loop`,s=r?.toolName??w8(e.text)[0]??e.details?.toolName,c=O8(r?.argsPreview)?D8(r?.argsPreview):``,l=e.role===`system`&&e.text?e.text:r?.resultPreview,u=O8(l)?D8(l):``,d=r?.error??``;return{descriptor:n,record:r,thinkingText:i,messageText:a,isToolEntry:o,toolName:s,argsText:c,resultText:u,errorText:d,detailPreview:Jge(o?d?`Error\n${d}`:e.role===`system`&&u?`Result\n${u}`:c?`Arguments\n${c}`:u?`Result\n${u}`:n.preview:a||i||n.preview)}}var A8=Object.defineProperty,Yge=(e,t,n)=>t in e?A8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xge=(e,t)=>{for(var n in t)A8(e,n,{get:t[n],enumerable:!0})},Zge=(e,t,n)=>Yge(e,typeof t==`symbol`?t:t+``,n),j8={};Xge(j8,{Graph:()=>N8,alg:()=>z8,json:()=>R8,version:()=>e_e});var Qge=Object.defineProperty,M8=(e,t)=>{for(var n in t)Qge(e,n,{get:t[n],enumerable:!0})},N8=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e?e.multigraph:!1,this._isCompound=`compound`in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e==`function`?this._defaultNodeLabelFn=e:this._defaultNodeLabelFn=()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return typeof e==`function`?this._defaultEdgeLabelFn=e:this._defaultEdgeLabelFn=()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=I8(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=$ge(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,P8(this._preds[a],i),P8(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?L8(this._isDirected,e):I8(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r==`object`?r:{label:r}}hasEdge(e,t,n){return(arguments.length===1?L8(this._isDirected,e):I8(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?L8(this._isDirected,e):I8(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],F8(this._preds[t],e),F8(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function P8(e,t){e[t]?e[t]++:e[t]=1}function F8(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function I8(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function $ge(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function L8(e,t){return I8(e,t.v,t.w,t.name)}var e_e=`4.0.1`,R8={};M8(R8,{read:()=>i_e,write:()=>t_e});function t_e(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n_e(e),edges:r_e(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function n_e(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function r_e(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function i_e(e){let t=new N8(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var z8={};M8(z8,{CycleException:()=>W8,bellmanFord:()=>B8,components:()=>s_e,dijkstra:()=>H8,dijkstraAll:()=>u_e,findCycles:()=>d_e,floydWarshall:()=>p_e,isAcyclic:()=>h_e,postorder:()=>__e,preorder:()=>v_e,prim:()=>y_e,shortestPaths:()=>b_e,tarjan:()=>U8,topsort:()=>G8});var a_e=()=>1;function B8(e,t,n,r){return o_e(e,String(t),n||a_e,r||function(t){return e.outEdges(t)})}function o_e(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w;c({v:n,w:n===t.v?t.w:t.v})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function s_e(e){let t={},n=[],r;function i(n){n in t||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var V8=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},c_e=()=>1;function H8(e,t,n,r){return l_e(e,String(t),n||c_e,r||function(t){return e.outEdges(t)})}function l_e(e,t,n,r){let i={},a=new V8,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t],c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0&&(o=a.removeMin(),s=i[o],s.distance!==1/0);)r(o).forEach(c);return i}function u_e(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=H8(e,i,t,n),r},{})}function U8(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do t=n.pop(),r[t].onStack=!1,e.push(t);while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function d_e(e){return U8(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var f_e=()=>1;function p_e(e,t,n){return m_e(e,t||f_e,n||function(t){return e.outEdges(t)})}function m_e(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}var W8=class extends Error{constructor(...e){super(...e)}};function G8(e){let t={},n={},r=[];function i(a){if(a in n)throw new W8;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new W8;return r}function h_e(e){try{G8(e)}catch(e){if(e instanceof W8)return!1;throw e}return!0}function g_e(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=K8(e,t,n===`post`,o,a,r,i)}),i}function K8(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=K8(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function q8(e,t,n){return g_e(e,t,n,function(e,t){return e.push(t),e},[])}function __e(e,t){return q8(e,t,`post`)}function v_e(e,t){return q8(e,t,`pre`)}function y_e(e,t){let n=new N8,r={},i=new V8,a;function o(e){let n=e.v===a?e.w:e.v,o=i.priority(n);if(o!==void 0){let s=t(e);s<o&&(r[n]=a,i.decrease(n,s))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){i.add(e,1/0),n.setNode(e)}),i.decrease(e.nodes()[0],0);let s=!1;for(;i.size()>0;){if(a=i.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw Error(`Input graph is not connected: `+e);s=!0}e.nodeEdges(a).forEach(o)}return n}function b_e(e,t,n,r){return x_e(e,t,n,r??(t=>e.outEdges(t)??[]))}function x_e(e,t,n,r){if(n===void 0)return H8(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return B8(e,t,n,r)}return H8(e,t,n,r)}function J8(e,t,n,r){let i=r;for(;e.hasNode(i);)i=i5(r);return n.dummy=t,e.setNode(i,n),i}function S_e(e){let t=new N8().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function Y8(e){let t=new N8({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function X8(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function Z8(e){let t=a5(t5(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function C_e(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=e5(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function w_e(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=e5(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function Q8(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),J8(e,`border`,i,t)}function T_e(e,t=$8){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var $8=65535;function e5(e,t){return t.length>$8?e(...T_e(t).map(t=>e(...t))):e(...t)}function t5(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return e5(Math.max,t)}function E_e(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function n5(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function r5(e,t){return t()}var D_e=0;function i5(e){return e+(``+ ++D_e)}function a5(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function o5(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function s5(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function O_e(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var c5=`\0`,k_e=`3.0.0`,A_e=class{constructor(){Zge(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return l5(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&l5(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,j_e)),n=n._prev;return`[`+e.join(`, `)+`]`}};function l5(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function j_e(e,t){if(e!==`_next`&&e!==`_prev`)return t}var M_e=A_e,N_e=()=>1;function P_e(e,t){if(e.nodeCount()<=1)return[];let n=I_e(e,t||N_e);return F_e(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function F_e(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)u5(e,t,n,o);for(;o=i.dequeue();)u5(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(u5(e,t,n,o,!0)||[]);break}}}return r}function u5(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,d5(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,d5(t,n,o)}),e.removeNode(r.v),o}function I_e(e,t){let n=new N8,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=L_e(i+r+3).map(()=>new M_e),o=r+1;return n.nodes().forEach(e=>{d5(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function d5(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function L_e(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function R_e(e){(e.graph().acyclicer===`greedy`?P_e(e,t(e)):z_e(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,i5(`rev`))});function t(e){return t=>e.edge(t).weight}}function z_e(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function B_e(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function V_e(e){e.graph().dummyChains=[],e.edges().forEach(t=>H_e(e,t))}function H_e(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=J8(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function U_e(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function f5(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=e5(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function p5(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var m5=W_e;function W_e(e){let t=new N8({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;G_e(t,e)<i&&(a=K_e(t,e),a);)o=t.hasNode(a.v)?p5(e,a):-p5(e,a),q_e(t,e,o);return t}function G_e(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!p5(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function K_e(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=p5(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function q_e(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:J_e,postorder:Y_e}=z8,X_e=h5;h5.initLowLimValues=v5,h5.initCutValues=g5,h5.calcCutValue=_5,h5.leaveEdge=b5,h5.enterEdge=x5,h5.exchangeEdges=S5;function h5(e){e=S_e(e),f5(e);let t=m5(e);v5(t),g5(t,e);let n,r;for(;n=b5(t);)r=x5(t,e,n),S5(t,e,n,r)}function g5(e,t){let n=Y_e(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Z_e(e,t,n))}function Z_e(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=_5(e,t,n)}function _5(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,$_e(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function v5(e,t){arguments.length<2&&(t=e.nodes()[0]),y5(e,{},1,t)}function y5(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=y5(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function b5(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function x5(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===C5(e,e.node(t.v),s)&&c!==C5(e,e.node(t.w),s)).reduce((e,n)=>p5(t,n)<p5(t,e)?n:e)}function S5(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),v5(e),g5(e,t),Q_e(e,t)}function Q_e(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=J_e(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function $_e(e,t,n){return e.hasEdge(t,n)}function C5(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var eve=tve;function tve(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:w5(e);break;case`tight-tree`:rve(e);break;case`longest-path`:nve(e);break;case`none`:break;default:w5(e)}}var nve=f5;function rve(e){f5(e),m5(e)}function w5(e){X_e(e)}var ive=ave;function ave(e){let t=sve(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=ove(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function ove(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function sve(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(c5).forEach(r),t}function cve(e){let t=J8(e,`root`,{},`_root`),n=lve(e),r=Object.values(n),i=e5(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=uve(e)+1;e.children(c5).forEach(r=>T5(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function T5(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=Q8(e,`_bt`),l=Q8(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{T5(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function lve(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(c5).forEach(e=>n(e,1)),t}function uve(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function dve(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var fve=pve;function pve(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)E5(e,`borderLeft`,`_bl`,n,i,t),E5(e,`borderRight`,`_br`,n,i,t)}}e.children(c5).forEach(t)}function E5(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=J8(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function mve(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&D5(e)}function hve(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&gve(e),(t===`lr`||t===`rl`)&&(_ve(e),D5(e))}function D5(e){e.nodes().forEach(t=>O5(e.node(t))),e.edges().forEach(t=>O5(e.edge(t)))}function O5(e){let t=e.width;e.width=e.height,e.height=t}function gve(e){e.nodes().forEach(t=>k5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(k5),Object.hasOwn(r,`y`)&&k5(r)})}function k5(e){e.y=-e.y}function _ve(e){e.nodes().forEach(t=>A5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(A5),Object.hasOwn(r,`x`)&&A5(r)})}function A5(e){let t=e.x;e.x=e.y,e.y=t}function vve(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=a5(e5(Math.max,r)+1).map(()=>[]);function a(n){if(t[n])return;t[n]=!0,i[e.node(n).rank].push(n);let r=e.successors(n);r&&r.forEach(a)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(a),i}function yve(e,t){let n=0;for(let r=1;r<t.length;++r)n+=bve(e,t[r-1],t[r]);return n}function bve(e,t,n){let r=O_e(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function xve(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Sve(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Cve(Object.values(n).filter(e=>!e.indegree))}function Cve(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&wve(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>o5(e,[`vs`,`i`,`barycenter`,`weight`]))}function wve(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Tve(e,t){let n=E_e(e,e=>Object.hasOwn(e,`barycenter`)),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,c=0;r.sort(Eve(!!t)),c=j5(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=j5(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function j5(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Eve(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function M5(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=i.filter(e=>e!==o&&e!==s));let l=xve(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=M5(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&Ove(t,i)}});let u=Sve(l,n);Dve(u,c);let d=Tve(u,r);if(o&&s){d.vs=[o,d.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+n.order+i.order)/(d.weight+2),d.weight+=2}}return d}function Dve(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Ove(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function kve(e,t,n,r){r||=e.nodes();let i=Ave(e),a=new N8({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Ave(e){let t;for(;e.hasNode(t=i5(`_root`)););return t}function jve(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function N5(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,N5);return}let n=t5(e),r=P5(e,a5(1,n+1),`inEdges`),i=P5(e,a5(n-1,-1,-1),`outEdges`),a=vve(e);if(F5(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){Mve(t%2?r:i,t%4>=2,c),a=Z8(e);let l=yve(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}F5(e,s)}function P5(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return kve(e,t,n,r.get(t)||[])})}function Mve(e,t,n){let r=new N8;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=M5(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),jve(e,r,a.vs)})}function F5(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Nve(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=Fve(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&I5(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function Pve(e,t){let n={};function r(t,r,i,a,o){a5(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&I5(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function Fve(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function I5(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Ive(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function Lve(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(n===void 0?0:n)-(r===void 0?0:r)}),c=(r.length-1)/2;for(let s=Math.floor(c),l=Math.ceil(c);s<=l;++s){let c=r[s];if(c===void 0)continue;let l=o[c];if(l!==void 0&&a[e]===e&&t<l&&!Ive(n,e,c)){let n=i[c];n!==void 0&&(a[c]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}}function Rve(e,t,n,r,i=!1){let a={},o=zve(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function zve(e,t,n,r){let i=new N8,a=e.graph(),o=Wve(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function Bve(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=Gve(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function Vve(e,t){let n=Object.values(t),r=e5(Math.min,n),i=e5(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-e5(Math.min,c);a!==`l`&&(l=i-e5(Math.max,c)),l&&(e[o]=s5(s,e=>e+l))})})}function Hve(e,t=void 0){let n=e.ul;return n?s5(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function Uve(e){let t=Z8(e),n=Object.assign(Nve(e,t),Pve(e,t)),r={},i;return[`u`,`d`].forEach(a=>{i=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(i=i.map(e=>Object.values(e).reverse()));let o=Lve(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=Rve(e,i,o.root,o.align,t===`r`);t===`r`&&(s=s5(s,e=>-e)),r[a+t]=s})}),Vve(r,Bve(e,r)),Hve(r,e.graph().align)}function Wve(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),c}}function Gve(e,t){return e.node(t).width}function Kve(e){e=Y8(e),qve(e),Object.entries(Uve(e)).forEach(([t,n])=>e.node(t).x=n)}function qve(e){let t=Z8(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);i===`top`?r.y=a+r.height/2:i===`bottom`?r.y=a+n-r.height/2:r.y=a+n/2}),a+=n+r})}function Jve(e,t={}){let n=t.debugTiming?n5:r5;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>iye(e));return n(` runLayout`,()=>Yve(r,n,t)),n(` updateInputGraph`,()=>Xve(e,r)),r})}function Yve(e,t,n){t(` makeSpaceForEdgeLabels`,()=>aye(e)),t(` removeSelfEdges`,()=>mye(e)),t(` acyclic`,()=>R_e(e)),t(` nestingGraph.run`,()=>cve(e)),t(` rank`,()=>eve(Y8(e))),t(` injectEdgeLabelProxies`,()=>oye(e)),t(` removeEmptyRanks`,()=>w_e(e)),t(` nestingGraph.cleanup`,()=>dve(e)),t(` normalizeRanks`,()=>C_e(e)),t(` assignRankMinMax`,()=>sye(e)),t(` removeEdgeLabelProxies`,()=>cye(e)),t(` normalize.run`,()=>V_e(e)),t(` parentDummyChains`,()=>ive(e)),t(` addBorderSegments`,()=>fve(e)),t(` order`,()=>N5(e,n)),t(` insertSelfEdges`,()=>hye(e)),t(` adjustCoordinateSystem`,()=>mve(e)),t(` position`,()=>Kve(e)),t(` positionSelfEdges`,()=>gye(e)),t(` removeBorderNodes`,()=>pye(e)),t(` normalize.undo`,()=>U_e(e)),t(` fixupEdgeLabelCoords`,()=>dye(e)),t(` undoCoordinateSystem`,()=>hve(e)),t(` translateGraph`,()=>lye(e)),t(` assignNodeIntersects`,()=>uye(e)),t(` reversePoints`,()=>fye(e)),t(` acyclic.undo`,()=>B_e(e))}function Xve(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Zve=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Qve={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},$ve=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],eye=[`width`,`height`,`rank`],L5={width:0,height:0},tye=[`minlen`,`weight`,`width`,`height`,`labeloffset`],nye={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},rye=[`labelpos`];function iye(e){let t=new N8({multigraph:!0,compound:!0}),n=z5(e.graph());return t.setGraph(Object.assign({},Qve,R5(n,Zve),o5(n,$ve))),e.nodes().forEach(n=>{let r=R5(z5(e.node(n)),eye);Object.keys(L5).forEach(e=>{r[e]===void 0&&(r[e]=L5[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=z5(e.edge(n));t.setEdge(n,Object.assign({},nye,R5(r,tye),o5(r,rye)))}),t}function aye(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function oye(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);J8(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function sye(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function cye(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function lye(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function uye(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(X8(r,a)),n.points.push(X8(i,o))})}function dye(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function fye(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function pye(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function mye(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function hye(e){Z8(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{J8(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function gye(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`selfedge`){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-c},{x:a+5*s/6,y:o-c},{x:a+s,y:o},{x:a+5*s/6,y:o+c},{x:a+2*s/3,y:o+c}],r.label.x=n.x,r.label.y=n.y}})}function R5(e,t){return s5(o5(e,t),Number)}function z5(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function _ye(e){let t=Z8(e),n=new N8({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var B5={graphlib:j8,version:k_e,layout:Jve,debug:_ye,util:{time:n5,notime:r5}},V5=`history-root`,vye=`top`,yye=`bottom`,H5={root:{width:320,height:80},segment:{width:320,height:112},entry:{width:320,height:192},nodeGap:48,rankGap:64};function U5(e){return`history-entry:${e}`}function W5(e){return`history-segment:${e}`}function bye(e){return e.kind===`root`?`root`:e.kind===`entry`?`e:${e.row.node.entry.id}`:`s:${e.segment.id}`}function G5(e){return H5[e.kind]}function xye(e){if(e.kind===`root`)return`Start of conversation`;if(e.kind===`segment`)return`${e.segment.total} collapsed conversation steps`;let t=e.isActive?`, active entry`:``;return`Step ${e.row.index}: ${e.view.descriptor.label}${t}`}function K5(e,t,n){let r=G5(t);return{id:e,type:`history`,position:{x:0,y:0},initialWidth:r.width,initialHeight:r.height,data:t,selected:bye(t.selection)===n,draggable:!1,connectable:!1,deletable:!1,selectable:!0,focusable:!0,sourcePosition:yye,targetPosition:vye,ariaLabel:xye(t),class:[t.isActive&&`history-node-active`,t.isOnActivePath&&`history-node-on-path`]}}function Sye(e,t){let n=new B5.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:`TB`,ranker:`tight-tree`,nodesep:H5.nodeGap,ranksep:H5.rankGap,marginx:H5.nodeGap,marginy:H5.nodeGap});for(let t of e){let e=G5(t.data);n.setNode(t.id,{...e})}for(let e of t)n.setEdge(e.source,e.target);return B5.layout(n),e.map(e=>{let t=n.node(e.id),r=G5(e.data);return{...e,position:t?{x:t.x-r.width/2,y:t.y-r.height/2}:e.position}})}function Cye({visible:e,hasConversation:t,rootActive:n,rootOnActivePath:r,selectedKey:i,entryViewById:a}){if(!t)return{nodes:[],edges:[],visibleNodeIdByEntryId:new Map};let o=new Map;for(let t of e.items)if(t.type===`entry`)o.set(t.row.node.entry.id,U5(t.row.node.entry.id));else{let e=W5(t.segment.id);for(let n of t.segment.rows)o.set(n.node.entry.id,e)}let s=[K5(V5,{kind:`root`,selection:{kind:`root`},zoomTier:`summary`,isActive:n,isOnActivePath:r},i)];for(let t of e.items)if(t.type===`entry`){let e=t.row.node.entry.id,n=a.get(e);if(!n)continue;let r={kind:`entry`,row:t.row};s.push(K5(U5(e),{kind:`entry`,selection:r,row:t.row,view:n,zoomTier:`summary`,isActive:t.row.isActive,isOnActivePath:t.row.isOnActivePath},i))}else{let e={kind:`segment`,segment:t.segment};s.push(K5(W5(t.segment.id),{kind:`segment`,selection:e,segment:t.segment,zoomTier:`summary`,isActive:!1,isOnActivePath:t.segment.isOnActivePath},i))}let c=[];for(let e of s){if(e.id===`history-root`)continue;let t=e.data.kind===`entry`?e.data.row.node.entry.parentEntryId:e.data.kind===`segment`?e.data.segment.headParentEntryId:void 0,n=t?o.get(t)??`history-root`:V5;if(n===e.id)continue;let r=e.data.isOnActivePath;c.push({id:`history-edge:${n}->${e.id}`,source:n,target:e.id,type:`default`,data:{isOnActivePath:r},class:r?`history-edge-active`:void 0,selectable:!1,deletable:!1,focusable:!1,ariaLabel:r?`Conversation branch connection on active path`:`Conversation branch connection`})}return{nodes:Sye(s,c),edges:c,visibleNodeIdByEntryId:o}}function wye(e,t,n){return{...e,nodes:e.nodes.map(e=>({...e,data:{...e.data,zoomTier:t,actions:n}}))}}function Tye(e){return e<.4?`overview`:e<.85?`summary`:`detail`}var Eye=new Set([`$$slots`,`$$events`,`$$legacy`]);function q5(e,t){let n=H(t,Eye),r=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3 3-3-3`}],[`path`,{d:`m15 5-3-3-3 3`}]];P(e,B({name:`unfold-vertical`},()=>n,{get iconNode(){return r}}))}var Dye=new Set([`$$slots`,`$$events`,`$$legacy`]);function J5(e,t){let n=H(t,Dye),r=[[`path`,{d:`M12 18V5`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`}]];P(e,B({name:`brain`},()=>n,{get iconNode(){return r}}))}var Oye=new Set([`$$slots`,`$$events`,`$$legacy`]);function kye(e,t){let n=H(t,Oye),r=[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}],[`path`,{d:`m9 14 2 2 4-4`}]];P(e,B({name:`clipboard-check`},()=>n,{get iconNode(){return r}}))}var Aye=new Set([`$$slots`,`$$events`,`$$legacy`]);function jye(e,t){let n=H(t,Aye),r=[[`path`,{d:`M12 20v2`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M17 20v2`}],[`path`,{d:`M17 2v2`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M2 17h2`}],[`path`,{d:`M2 7h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`M20 17h2`}],[`path`,{d:`M20 7h2`}],[`path`,{d:`M7 20v2`}],[`path`,{d:`M7 2v2`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`}]];P(e,B({name:`cpu`},()=>n,{get iconNode(){return r}}))}var Mye=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nye(e,t){let n=H(t,Mye),r=[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`}]];P(e,B({name:`file-pen`},()=>n,{get iconNode(){return r}}))}var Pye=new Set([`$$slots`,`$$events`,`$$legacy`]);function Y5(e,t){let n=H(t,Pye),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M9 15h6`}],[`path`,{d:`M12 18v-6`}]];P(e,B({name:`file-plus`},()=>n,{get iconNode(){return r}}))}var Fye=new Set([`$$slots`,`$$events`,`$$legacy`]);function X5(e,t){let n=H(t,Fye),r=[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`}],[`path`,{d:`m21 21-1.9-1.9`}],[`circle`,{cx:`17`,cy:`17`,r:`3`}]];P(e,B({name:`folder-search`},()=>n,{get iconNode(){return r}}))}var Iye=new Set([`$$slots`,`$$events`,`$$legacy`]);function Lye(e,t){let n=H(t,Iye),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}],[`path`,{d:`M2 12h20`}]];P(e,B({name:`globe`},()=>n,{get iconNode(){return r}}))}var Rye=new Set([`$$slots`,`$$events`,`$$legacy`]);function zye(e,t){let n=H(t,Rye),r=[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`}]];P(e,B({name:`hand`},()=>n,{get iconNode(){return r}}))}var Bye=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vye(e,t){let n=H(t,Bye),r=[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];P(e,B({name:`message-circle-question-mark`},()=>n,{get iconNode(){return r}}))}var Hye=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uye(e,t){let n=H(t,Hye),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];P(e,B({name:`search`},()=>n,{get iconNode(){return r}}))}var Wye=new Set([`$$slots`,`$$events`,`$$legacy`]);function Z5(e,t){let n=H(t,Wye),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];P(e,B({name:`wrench`},()=>n,{get iconNode(){return r}}))}var Q5={user:RF,sparkles:TR,brain:J5,wrench:Z5,"file-text":Hu,terminal:qu,"file-pen":Nye,"file-plus":Y5,search:Uye,"folder-search":X5,"folder-tree":q0,globe:Lye,download:w0,cpu:jye,bot:S0,"message-circle-question":Vye,"clipboard-list":gg,"clipboard-check":kye,"list-todo":lX,"fold-vertical":h_,"git-branch":oI,info:J0,hand:zye,"triangle-alert":pY},$5={default:`text-muted-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,danger:`text-destructive`},Gye=h(`<div class="flex h-full items-center justify-center p-6 text-center text-xs text-muted-foreground">Select an entry on the left to preview it here.</div>`),Kye=h(`<!> New branch from beginning`,1),qye=h(`<div class="flex h-full flex-col gap-4 overflow-y-auto p-5"><div class="flex items-center gap-2 text-primary"><!> <h3 class="text-sm font-semibold text-foreground">Start of conversation</h3></div> <p class="text-sm text-muted-foreground">Branch from the beginning to start a new path. Your next message becomes
159
+ the first entry of that branch; the existing history stays available in
160
+ the tree.</p> <div><!></div></div>`),Jye=h(`<span class="flex items-center gap-1 rounded-full border bg-muted/40 px-2 py-0.5 text-xs text-muted-foreground"><!> <span class="font-medium text-foreground"> </span> </span>`),Yye=h(`<!> Expand in tree`,1),Xye=h(`<button class="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted/60" type="button"><span><!></span> <span class="shrink-0 text-xs font-medium text-foreground"> </span> <span> </span></button>`),Zye=h(`<div class="flex h-full flex-col gap-4 overflow-y-auto p-5"><div class="flex flex-col gap-1"><h3 class="text-sm font-semibold text-foreground"> </h3> <p class="text-xs text-muted-foreground"> </p></div> <div class="flex flex-wrap gap-1.5"></div> <div class="flex"><!></div> <div class="flex flex-col gap-0.5 border-t pt-3"></div></div>`),Qye=h(`<span><!> <!></span>`),$ye=h(`<span class="flex items-center gap-1"><!> </span>`),ebe=h(`<!> Branch from here`,1),tbe=h(`<!> Edit & resend`,1),nbe=h(`<span class="rounded-full border px-1.5 py-0.5"> </span>`),rbe=h(`<div class="flex items-center gap-2 text-xs text-muted-foreground"><span class="font-medium text-foreground">Tool</span> <span class="font-mono"> </span> <!></div>`),ibe=h(`<div class="flex flex-col gap-1"><span class="text-xs font-medium text-muted-foreground">Arguments</span> <pre class="overflow-x-auto rounded-md border bg-muted/40 p-3 font-mono text-xs whitespace-pre-wrap break-words"> </pre></div>`),abe=h(`<div class="flex flex-col gap-1"><span class="text-xs font-medium text-muted-foreground">Result</span> <pre class="overflow-x-auto rounded-md border bg-muted/40 p-3 font-mono text-xs whitespace-pre-wrap break-words"> </pre></div>`),obe=h(`<div class="flex flex-col gap-1"><span class="text-xs font-medium text-destructive">Error</span> <pre class="overflow-x-auto rounded-md border border-destructive/40 bg-destructive/10 p-3 font-mono text-xs whitespace-pre-wrap break-words"> </pre></div>`),sbe=h(`<p class="text-xs text-muted-foreground">No tool details available for this entry.</p>`),cbe=h(`<div class="flex flex-col gap-3"><!> <!> <!> <!> <!></div>`),lbe=h(`<div class="text-sm text-muted-foreground"><!></div>`),ube=h(`<div class="mt-4 border-t pt-3 text-sm text-muted-foreground"><span class="mb-1 block text-xs font-medium">Thinking</span> <!></div>`),dbe=h(`<div class="text-sm text-foreground"><!></div> <!>`,1),fbe=h(`<p class="text-xs text-muted-foreground">This entry has no text content.</p>`),pbe=h(`<div class="flex h-full flex-col"><div class="flex flex-col gap-3 border-b p-5"><div class="flex items-center gap-2"><span><!></span> <h3 class="text-sm font-semibold text-foreground"> </h3> <!></div> <div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground"><span> </span> <!> <button class="flex min-w-0 max-w-full items-center gap-1 font-mono hover:text-foreground" type="button" aria-label="Copy entry id"><!> <span class="truncate"> </span></button></div> <div class="flex flex-wrap gap-2"><!> <!></div></div> <div class="min-h-0 flex-1 overflow-y-auto p-5"><!></div></div>`);function mbe(e,t){a(t,!0);let n=J(()=>t.selection?.kind===`entry`?t.selection.row.node.entry:void 0),i=J(()=>W(n)?k8(W(n),t.toolCallsById):void 0),o=J(()=>W(i)?.descriptor),c=J(()=>W(i)?.record);async function l(e){try{await Ju(e),Kn.success(`Copied entry id`)}catch{Kn.error(`Could not copy to clipboard`)}}var u=U(),f=R(u),p=e=>{g(e,Gye())},m=e=>{var n=qye(),r=V(n);oI(V(r),{class:`size-5`,strokeWidth:2}),w(2),d(r);var i=L(r,4);G(V(i),{size:`sm`,onclick:()=>t.onNavigateToEntry?.(void 0),children:(e,t)=>{var n=Kye();oI(R(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}}),d(i),d(n),g(e,n)},h=e=>{let n=J(()=>t.selection.segment);var i=Zye(),a=V(i),o=V(a),c=V(o);d(o);var l=L(o,2),u=V(l);d(l),d(a);var f=L(a,2);_(f,21,()=>W(n).parts,E,(e,t)=>{let n=J(()=>Q5[W(t).icon]);var r=Jye(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{class:`size-3.5`,strokeWidth:2})});var a=L(i,2),o=V(a,!0);d(a);var s=L(a);d(r),F(()=>{A(o,W(t).count),A(s,` ${W(t).label??``}`)}),g(e,r)}),d(f);var p=L(f,2);G(V(p),{variant:`outline`,size:`sm`,onclick:()=>t.onExpandSegment?.(W(n).id),children:(e,t)=>{var n=Yye();q5(R(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}}),d(p);var m=L(p,2);_(m,21,()=>W(n).rows,e=>e.node.entry.id,(e,n)=>{let i=J(()=>k8(W(n).node.entry,t.toolCallsById).descriptor),a=J(()=>Q5[W(i).icon]);var o=Xye(),c=V(o);C(V(c),()=>W(a),(e,t)=>{t(e,{class:`size-3.5`,strokeWidth:2})}),d(c);var l=L(c,2),u=V(l,!0);d(l);var f=L(l,2);let p;var m=V(f,!0);d(f),d(o),F(()=>{s(c,1,`flex size-4 shrink-0 items-center justify-center ${$5[W(i).tone]}`),A(u,W(i).label),p=s(f,1,`min-w-0 flex-1 truncate text-xs text-muted-foreground`,null,p,{"font-mono":W(i).mono}),A(m,W(i).preview)}),r(`click`,o,()=>t.onSelectRow?.(W(n))),g(e,o)}),d(m),d(i),F((e,t)=>{A(c,`${W(n).total??``} collapsed steps`),A(u,`${e??``} — ${t??``}`)},[()=>I0(W(n).startedAt),()=>I0(W(n).endedAt)]),g(e,i)},v=e=>{let a=J(()=>Q5[W(o).icon]),u=J(()=>W(i)?.thinkingText??``);var f=pbe(),p=V(f),m=V(p),h=V(m);C(V(h),()=>W(a),(e,t)=>{t(e,{class:`size-5`,strokeWidth:2})}),d(h);var v=L(h,2),y=V(v,!0);d(v),_(L(v,2),17,()=>W(o).badges,E,(e,t)=>{let n=J(()=>Q5[W(t).icon]);var r=Qye(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{class:`size-3.5`,strokeWidth:2})});var a=L(i,2),o=e=>{var n=M();F(()=>A(n,W(t).label)),g(e,n)};k(a,e=>{W(t).label&&e(o)}),d(r),F(()=>{s(r,1,`flex items-center gap-0.5 text-xs ${$5[W(t).tone]}`),q(r,`title`,W(t).title??W(t).label)}),g(e,r)}),d(m);var b=L(m,2),x=V(b),S=V(x);d(x);var T=L(x,2),D=e=>{var t=$ye(),r=V(t);TR(r,{class:`size-3.5`,strokeWidth:2});var i=L(r);d(t),F(e=>A(i,` ${e??``} tokens`),[()=>W(n).usage.totalTokens.toLocaleString()]),g(e,t)};k(T,e=>{W(n).usage?.totalTokens&&e(D)});var O=L(T,2),ee=V(O);Bu(ee,{class:`size-3 shrink-0`,strokeWidth:2});var te=L(ee,2),ne=V(te,!0);d(te),d(O),d(b);var j=L(b,2),re=V(j);G(re,{size:`sm`,onclick:()=>t.onNavigateToEntry?.(W(n).id),children:(e,t)=>{var n=ebe();oI(R(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}});var N=L(re,2),P=e=>{G(e,{variant:`outline`,size:`sm`,onclick:()=>t.onEditEntry?.(W(n)),children:(e,t)=>{var n=tbe();Yv(R(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}})};k(N,e=>{W(n).role===`user`&&e(P)}),d(j),d(p);var ie=L(p,2),ae=V(ie),oe=e=>{var t=cbe(),n=V(t),r=e=>{var t=rbe(),n=L(V(t),2),r=V(n,!0);d(n);var a=L(n,2),o=e=>{var t=nbe(),n=V(t,!0);d(t),F(()=>A(n,W(c).status)),g(e,t)};k(a,e=>{W(c)?.status&&e(o)}),d(t),F(()=>A(r,W(i).toolName)),g(e,t)};k(n,e=>{W(i).toolName&&e(r)});var a=L(n,2),o=e=>{var t=ibe(),n=L(V(t),2),r=V(n,!0);d(n),d(t),F(()=>A(r,W(i).argsText)),g(e,t)};k(a,e=>{W(i).argsText&&e(o)});var s=L(a,2),l=e=>{var t=abe(),n=L(V(t),2),r=V(n,!0);d(n),d(t),F(()=>A(r,W(i).resultText)),g(e,t)};k(s,e=>{W(i).resultText&&e(l)});var u=L(s,2),f=e=>{var t=obe(),n=L(V(t),2),r=V(n,!0);d(n),d(t),F(()=>A(r,W(i).errorText)),g(e,t)};k(u,e=>{W(i).errorText&&e(f)});var p=L(u,2),m=e=>{g(e,sbe())};k(p,e=>{!W(i).argsText&&!W(i).resultText&&!W(i).errorText&&e(m)}),d(t),g(e,t)},se=e=>{var t=lbe();Fk(V(t),{get text(){return W(u)}}),d(t),g(e,t)},ce=e=>{var t=dbe(),r=R(t),i=V(r),a=e=>{{let t=J(()=>W(n).summary||W(n).text);ny(e,{get text(){return W(t)}})}},o=e=>{{let t=J(()=>W(n).summary||W(n).text),r=J(()=>W(n).role!==`assistant`);Fk(e,{get text(){return W(t)},get trimCodeBlocks(){return W(r)}})}};k(i,e=>{W(n).role===`user`?e(a):e(o,-1)}),d(r);var s=L(r,2),c=e=>{var t=ube();Fk(L(V(t),2),{get text(){return W(u)}}),d(t),g(e,t)};k(s,e=>{W(u)&&e(c)}),g(e,t)},le=e=>{g(e,fbe())};k(ae,e=>{W(i)?.isToolEntry?e(oe):W(u)&&!W(n).text?e(se,1):W(n).summary||W(n).text?e(ce,2):e(le,-1)}),d(ie),d(f),F((e,t)=>{s(h,1,`flex size-5 shrink-0 items-center justify-center ${$5[W(o).tone]}`),A(y,W(o).label),q(x,`title`,e),A(S,`${t??``} ago`),q(O,`title`,W(n).id),A(ne,W(n).id)},[()=>I0(W(n).createdAt),()=>F0(W(n).createdAt)]),r(`click`,O,()=>l(W(n).id)),g(e,f)};k(f,e=>{t.selection?t.selection.kind===`root`?e(m,1):t.selection.kind===`segment`?e(h,2):W(n)&&W(o)&&e(v,3):e(p)}),g(e,u),z()}T([`click`]);var hbe=new Set([`$$slots`,`$$events`,`$$legacy`]);function gbe(e,t){let n=H(t,hbe),r=[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`}],[`circle`,{cx:`12`,cy:`12`,r:`7`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];P(e,B({name:`locate-fixed`},()=>n,{get iconNode(){return r}}))}var _be=new Set([`$$slots`,`$$events`,`$$legacy`]);function vbe(e,t){let n=H(t,_be),r=[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`}]];P(e,B({name:`scan`},()=>n,{get iconNode(){return r}}))}var ybe=new Set([`$$slots`,`$$events`,`$$legacy`]);function e7(e,t){let n=H(t,ybe),r=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];P(e,B({name:`zoom-in`},()=>n,{get iconNode(){return r}}))}var bbe=new Set([`$$slots`,`$$events`,`$$legacy`]);function t7(e,t){let n=H(t,bbe),r=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];P(e,B({name:`zoom-out`},()=>n,{get iconNode(){return r}}))}var xbe=h(`<span class="mx-0.5 h-5 w-px bg-border" aria-hidden="true"></span> <!>`,1),Sbe=h(`<div class="nopan flex items-center gap-1 rounded-md border bg-card p-1 shadow-sm" aria-label="Conversation graph controls"><!> <!> <!> <!> <!></div>`);function Cbe(e,t){a(t,!0);let{fitView:n,getNode:r,getZoom:i,setCenter:o,zoomIn:s,zoomOut:c}=m8(),l=0,u=0;function f(){n({padding:.12,minZoom:.12,maxZoom:1,duration:200})}function p(){let e=r(t.activeNodeId);e&&n({nodes:[e],padding:.8,maxZoom:1,duration:200})}be(()=>{t.fitRequest<=l||(l=t.fitRequest,queueMicrotask(f))}),be(()=>{!t.centerRequest||t.centerRequest.serial<=u||(u=t.centerRequest.serial,queueMicrotask(()=>{let e=r(t.centerRequest.id);if(!e)return;let n=e.measured?.width??e.initialWidth??0,a=e.measured?.height??e.initialHeight??0;o(e.position.x+n/2,e.position.y+a/2,{zoom:i(),duration:180})}))}),g8(e,{position:`top-left`,children:(e,n)=>{var r=Sbe(),i=V(r);G(i,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Zoom in`,title:`Zoom in`,onclick:()=>void s({duration:120}),children:(e,t)=>{e7(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var a=L(i,2);G(a,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Zoom out`,title:`Zoom out`,onclick:()=>void c({duration:120}),children:(e,t)=>{t7(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var o=L(a,2);G(o,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Fit entire graph`,title:`Fit entire graph`,onclick:f,children:(e,t)=>{vbe(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var l=L(o,2);G(l,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Focus active entry`,title:`Focus active entry`,onclick:p,children:(e,t)=>{gbe(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var u=L(l,2),m=e=>{var n=xbe(),r=L(R(n),2);{let e=J(()=>t.allExpanded?`Collapse all tool runs`:`Expand all tool runs`),n=J(()=>t.allExpanded?`Collapse all tool runs`:`Expand all tool runs`);G(r,{variant:`ghost`,size:`icon-sm`,get ariaLabel(){return W(e)},get title(){return W(n)},get onclick(){return t.onToggleAll},children:(e,n)=>{var r=U(),i=R(r),a=e=>{h_(e,{class:`size-4`,strokeWidth:2})},o=e=>{q5(e,{class:`size-4`,strokeWidth:2})};k(i,e=>{t.allExpanded?e(a):e(o,-1)}),g(e,r)},$$slots:{default:!0}})}g(e,n)};k(u,e=>{t.hasSegments&&e(m)}),d(r),g(e,r)},$$slots:{default:!0}}),z()}var wbe=h(`<span><!></span>`),Tbe=h(`<span class="flex size-10 items-center justify-center rounded-full border border-dashed bg-card text-muted-foreground"><!></span>`),Ebe=h(`<span class="flex size-10 items-center justify-center rounded-full border bg-card text-primary"><!></span>`),Dbe=h(`<div class="flex h-full items-center justify-center"><!></div>`),Obe=h(`<div class="flex h-full items-center gap-3 px-4"><span class="flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary"><!></span> <div class="min-w-0"><p class="text-sm font-semibold">Start of conversation</p> <p class="truncate text-xs text-muted-foreground">Fork a new branch from the beginning</p></div></div>`),kbe=h(`<span class="rounded-full border bg-muted/40 px-1.5 py-0.5 text-xs text-muted-foreground"> </span>`),Abe=h(`<div class="flex flex-wrap gap-1 overflow-hidden"></div>`),jbe=h(`<div class="flex h-full flex-col justify-center gap-2 px-4 py-3"><div class="flex items-center gap-2"><span class="flex size-7 shrink-0 items-center justify-center rounded-full border border-dashed text-muted-foreground"><!></span> <div class="min-w-0 flex-1"><p class="text-sm font-semibold"> </p> <p class="truncate text-xs text-muted-foreground"> </p></div> <!></div> <!></div>`),Mbe=h(`<span><!> <!></span>`),Nbe=h(`<span class="truncate font-mono"> </span>`),Pbe=h(`<pre> </pre>`),Fbe=h(`<p> </p>`),Ibe=h(`<div class="flex items-center justify-end gap-1 border-t px-2 py-1.5"><!> <!></div>`),Lbe=h(`<div class="flex items-center gap-2 border-b px-3 py-2.5"><span><!></span> <div class="min-w-0 flex-1"><div class="flex items-center gap-1.5"><span class="font-mono text-xs text-muted-foreground/60"> </span> <p class="truncate text-sm font-semibold"> </p> <!></div> <div class="flex items-center gap-2 text-xs text-muted-foreground"><span> </span> <!></div></div></div> <div class="min-h-0 flex-1 px-3 py-2.5"><!></div> <!>`,1),Rbe=h(`<div role="group"><!> <!> <!></div>`);function zbe(e,t){a(t,!0);let n=e=>{var n=Rbe();let a;var c=V(n),l=e=>{q6(e,{type:`target`,get position(){return T3.Top},isConnectable:!1})};k(c,e=>{t.data.kind!==`root`&&e(l)});var f=L(c,2),p=e=>{var n=Dbe(),r=V(n),i=e=>{let n=J(()=>Q5[t.data.view.descriptor.icon]);var r=wbe();C(V(r),()=>W(n),(e,t)=>{t(e,{class:`size-5`,strokeWidth:2})}),d(r),F(()=>s(r,1,`flex size-10 items-center justify-center rounded-full border bg-card ${$5[t.data.view.descriptor.tone]}`)),g(e,r)},a=e=>{var t=Tbe();q5(V(t),{class:`size-5`,strokeWidth:2}),d(t),g(e,t)},o=e=>{var t=Ebe();oI(V(t),{class:`size-5`,strokeWidth:2}),d(t),g(e,t)};k(r,e=>{t.data.kind===`entry`?e(i):t.data.kind===`segment`?e(a,1):e(o,-1)}),d(n),g(e,n)},m=e=>{var t=Obe(),n=V(t);oI(V(n),{class:`size-4`,strokeWidth:2}),d(n),w(2),d(t),g(e,t)},h=e=>{var n=jbe(),r=V(n),i=V(r);q5(V(i),{class:`size-4`,strokeWidth:2}),d(i);var a=L(i,2),s=V(a),c=V(s);d(s);var l=L(s,2),u=V(l,!0);d(l),d(a),G(L(a,2),{class:`nodrag nopan`,variant:`ghost`,size:`icon-xs`,ariaLabel:`Expand collapsed steps`,title:`Expand collapsed steps`,onclick:e=>{o(e),t.data.actions?.onToggleSegment(t.data.segment)},children:(e,t)=>{q5(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}}),d(r);var f=L(r,2),p=e=>{var n=Abe();_(n,21,()=>t.data.segment.parts.slice(0,4),e=>e.label,(e,t)=>{var n=kbe(),r=V(n);d(n),F(()=>A(r,`${W(t).count??``} ${W(t).label??``}`)),g(e,n)}),d(n),g(e,n)};k(f,e=>{t.data.zoomTier===`detail`&&e(p)}),d(n),F(e=>{A(c,`${t.data.segment.total??``} collapsed steps`),A(u,e)},[()=>t.data.segment.parts.map(e=>`${e.count} ${e.label}`).join(` · `)]),g(e,n)},v=e=>{let n=J(()=>t.data.view.descriptor),r=J(()=>Q5[W(n).icon]);var i=Lbe(),a=R(i),c=V(a);C(V(c),()=>W(r),(e,t)=>{t(e,{class:`size-4`,strokeWidth:2})}),d(c);var l=L(c,2),f=V(l),p=V(f),m=V(p,!0);d(p);var h=L(p,2),v=V(h,!0);d(h),_(L(h,2),17,()=>W(n).badges,E,(e,t)=>{let n=J(()=>Q5[W(t).icon]);var r=Mbe(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{class:`size-3`,strokeWidth:2})});var a=L(i,2),o=e=>{var n=M();F(()=>A(n,W(t).label)),g(e,n)};k(a,e=>{W(t).label&&e(o)}),d(r),F(()=>{s(r,1,`flex shrink-0 items-center gap-0.5 text-xs ${$5[W(t).tone]}`),q(r,`title`,W(t).title??W(t).label)}),g(e,r)}),d(f);var y=L(f,2),b=V(y),x=V(b);d(b);var S=L(b,2),w=e=>{var n=Nbe(),r=V(n,!0);d(n),F(()=>A(r,t.data.view.record.status)),g(e,n)};k(S,e=>{t.data.view.record?.status&&e(w)}),d(y),d(l),d(a);var T=L(a,2),D=V(T),O=e=>{var r=Pbe();let i;var a=V(r,!0);d(r),F(()=>{i=s(r,1,`line-clamp-5 font-sans text-xs leading-relaxed whitespace-pre-wrap break-words text-foreground`,null,i,{"font-mono":W(n).mono}),A(a,t.data.view.detailPreview)}),g(e,r)},ee=e=>{var t=Fbe();let r;var i=V(t,!0);d(t),F(()=>{r=s(t,1,`line-clamp-3 text-xs leading-relaxed text-muted-foreground`,null,r,{"font-mono":W(n).mono}),A(i,W(n).preview||`No preview available`)}),g(e,t)};k(D,e=>{t.data.zoomTier===`detail`?e(O):e(ee,-1)}),d(T);var te=L(T,2),ne=e=>{var n=Ibe(),r=V(n);G(r,{class:`nodrag nopan`,variant:`ghost`,size:`icon-xs`,ariaLabel:`Branch from here`,title:`Branch from here`,onclick:e=>{o(e),u(t.data)},children:(e,t)=>{oI(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}});var i=L(r,2),a=e=>{G(e,{class:`nodrag nopan`,variant:`ghost`,size:`icon-xs`,ariaLabel:`Edit and resend`,title:`Edit and resend`,onclick:e=>{o(e),t.data.actions?.onEditEntry?.(t.data.row.node.entry)},children:(e,t)=>{Yv(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}})};k(i,e=>{t.data.row.node.entry.role===`user`&&e(a)}),d(n),g(e,n)};k(te,e=>{t.data.zoomTier===`detail`&&e(ne)}),F((e,t)=>{s(c,1,`flex size-7 shrink-0 items-center justify-center rounded-md bg-muted/50 ${$5[W(n).tone]}`),A(m,e),A(v,W(n).label),A(x,`${t??``} ago`)},[()=>String(t.data.row.index).padStart(2,`0`),()=>F0(t.data.row.node.entry.createdAt)]),g(e,i)};k(f,e=>{t.data.zoomTier===`overview`?e(p):t.data.kind===`root`?e(m,1):t.data.kind===`segment`?e(h,2):e(v,-1)});var y=L(f,2),b=e=>{q6(e,{type:`source`,get position(){return T3.Bottom},isConnectable:!1})};k(y,e=>{(t.data.kind===`root`||t.data.kind===`segment`||t.data.kind===`entry`&&!t.data.row.isLeaf)&&e(b)}),d(n),F(()=>a=s(n,1,`relative flex ${W(i)} cursor-pointer flex-col overflow-hidden rounded-lg border bg-card text-foreground shadow-sm transition-[border-color,box-shadow,opacity]`,null,a,{"border-primary":t.data.isOnActivePath,"border-border":!t.data.isOnActivePath,"ring-2":t.selected,"ring-ring":t.selected,"opacity-65":!t.data.isOnActivePath&&!t.selected})),r(`dblclick`,n,()=>u(t.data)),g(e,n)},i=J(()=>t.data.kind===`entry`?`h-48 w-80`:t.data.kind===`segment`?`h-28 w-80`:`h-20 w-80`);function o(e){e.stopPropagation()}async function c(e){try{await Ju(e),Kn.success(`Copied entry id`)}catch{Kn.error(`Could not copy to clipboard`)}}function l(e){let t=e.row.node.entry,n=[{label:`Branch from here`,icon:oI,onSelect:()=>e.actions?.onNavigateToEntry?.(t.id)}];return t.role===`user`&&n.push({label:`Edit & resend`,icon:Yv,onSelect:()=>e.actions?.onEditEntry?.(t)}),n.push({type:`separator`},{label:`Copy entry id`,icon:Bu,onSelect:()=>c(t.id)}),n}function u(e){e.kind===`entry`?e.actions?.onNavigateToEntry?.(e.row.node.entry.id):e.kind===`root`&&e.actions?.onNavigateToEntry?.(void 0)}var f=U(),p=R(f),m=e=>{{let r=J(()=>l(t.data));un(e,{get items(){return W(r)},triggerClass:`block h-full w-full`,children:(e,t)=>{n(e)},$$slots:{default:!0}})}},h=e=>{n(e)};k(p,e=>{t.data.kind===`entry`?e(m):e(h,-1)}),g(e,f),z()}T([`dblclick`]);var Bbe=new Set([`assistant`,`tool_call`,`tool_result`,`system`]);function Vbe(e,t,n){let r=t[e[0]],i=t[e[e.length-1]],a=new Map;for(let t of e){let e=n[t],r=a.get(e.label);r?r.count+=1:a.set(e.label,{icon:e.icon,label:e.label,count:1})}return{id:r.node.entry.id,headParentEntryId:r.node.entry.parentEntryId,rows:e.map(e=>t[e]),isOnActivePath:e.some(e=>t[e].isOnActivePath),total:e.length,parts:[...a.values()].sort((e,t)=>t.count-e.count),startedAt:r.node.entry.createdAt,endedAt:i.node.entry.createdAt}}function Hbe(e,t,n){let r=e.map(e=>E8(e.node.entry,t)),i=t=>{let n=e[t];return!n.isActive&&!n.isLeaf&&!n.isBranchPoint&&Bbe.has(r[t].type)},a=[],o=[],s=()=>{o.length&&(a.push({kind:`run`,indices:o}),o=[])};for(let t=0;t<e.length;t++){if(!i(t)){s(),a.push({kind:`row`,index:t});continue}let n=o.at(-1),r=n===void 0?void 0:e[n],c=r!==void 0&&e[t].node.entry.parentEntryId===r.node.entry.id;o.length&&!c&&s(),o.push(t)}s();let c=[],l=[],u=new Map,d=t=>{u.set(e[t].node.entry.id,c.length),c.push({type:`entry`,row:e[t]})};for(let t of a){if(t.kind===`row`){d(t.index);continue}if(t.indices.length<3){for(let e of t.indices)d(e);continue}let i=Vbe(t.indices,e,r);if(l.push(i),n.has(i.id))for(let e of t.indices)d(e);else{let n=c.length;c.push({type:`segment`,segment:i});for(let r of t.indices)u.set(e[r].node.entry.id,n)}}return{items:c,visibleIndexById:u,segments:l}}function Ube(e){switch(e.kind){case`root`:return`root`;case`entry`:return`e:${e.row.node.entry.id}`;case`segment`:return`s:${e.segment.id}`}}var Wbe=h(`<!> <!> <!>`,1),Gbe=h(`<aside class="flex min-w-80 w-1/3 max-w-md shrink-0 flex-col overflow-hidden border-l bg-card max-[900px]:absolute max-[900px]:inset-y-0 max-[900px]:right-0 max-[900px]:z-10 max-[900px]:w-[min(24rem,70%)] max-[900px]:shadow-lg max-[640px]:w-full max-[640px]:min-w-0 max-[640px]:max-w-none" aria-label="Conversation entry details"><div class="flex items-center justify-between border-b px-3 py-2"><span class="text-xs font-medium text-muted-foreground">Entry details</span> <!></div> <div class="min-h-0 flex-1 overflow-hidden"><!></div></aside>`),Kbe=h(`<div class="flex h-full min-h-0"><div class="relative min-w-0 flex-1"><!></div> <!></div>`),qbe=h(`<div class="flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground">No conversation history loaded.</div>`),Jbe=h(`<div class="history-graph relative h-full min-h-0 overflow-hidden bg-transparent svelte-xljnpe"><!></div>`);function Ybe(e,t){a(t,!0);let n=I(t,`treeNodes`,19,()=>[]),r=I(t,`toolCalls`,19,()=>[]),i={history:zbe},o=J(()=>new Map(r().map(e=>[e.id,e]))),s=J(()=>Kge(n(),t.activeConversation?.activeEntryId)),c=J(()=>!!t.activeConversation),l=J(()=>!!(t.activeConversation&&!t.activeConversation.activeEntryId)),u=J(()=>W(l)||W(s).rows.some(e=>e.isOnActivePath)),f=J(()=>new Map(n().map(({entry:e})=>[e.id,k8(e,W(o))]))),p=Y(N(new Set)),m=Y(void 0),h=Y(!1),_=Y(`summary`),v=Y(0),y=Y(0),b=Y(void 0),x=Y(!1),S=J(()=>Hbe(W(s).rows,W(o),W(p))),C=J(()=>W(m)?Ube(W(m)):``),w=J(()=>W(S).segments.length>0&&W(S).segments.every(e=>W(p).has(e.id))),T=J(()=>Cye({visible:W(S),hasConversation:W(c),rootActive:W(l),rootOnActivePath:W(u),selectedKey:W(C),entryViewById:W(f)})),E=J(()=>({onToggleSegment:j,onNavigateToEntry:t.onNavigateToEntry,onEditEntry:t.onEditEntry})),D=J(()=>wye(W(T),W(_),W(E))),O=J(()=>t.activeConversation?.activeEntryId?W(T).visibleNodeIdByEntryId.get(t.activeConversation.activeEntryId)??U5(t.activeConversation.activeEntryId):V5),ee;be(()=>{let e=t.activeConversation?.id;if(e===ee)return;ee=e,K(p,new Set,!0),K(h,!1),e||K(x,!1);let n=t.activeConversation?.activeEntryId,r=n?W(s).rows.find(e=>e.node.entry.id===n):void 0;K(m,t.activeConversation?r?{kind:`entry`,row:r}:{kind:`root`}:void 0,!0),K(v,W(v)+1)});function te(e){K(b,{id:e,serial:oe(y)},!0)}function A(e){K(m,e,!0),K(h,!0)}function ne(e){return W(S).segments.find(t=>t.rows.some(t=>t.node.entry.id===e))}function j(e){let t=new ye(W(p));if(t.has(e.id)){t.delete(e.id);let n=W(m)?.kind===`entry`?W(m).row.node.entry.id:void 0;n&&e.rows.some(e=>e.node.entry.id===n)&&K(m,{kind:`segment`,segment:e},!0),K(p,t,!0),te(`history-segment:${e.id}`);return}t.add(e.id),K(p,t,!0);let n=e.rows[0];n&&K(m,{kind:`entry`,row:n},!0),te(n?U5(n.node.entry.id):W(O))}function M(){if(W(w)){let e=W(m)?.kind===`entry`?ne(W(m).row.node.entry.id):void 0;K(p,new Set,!0),e&&(K(m,{kind:`segment`,segment:e},!0),te(`history-segment:${e.id}`));return}if(K(p,new Set(W(S).segments.map(e=>e.id)),!0),W(m)?.kind===`segment`){let e=W(m).segment.rows[0];e&&(K(m,{kind:`entry`,row:e},!0),te(U5(e.node.entry.id)))}}function re(e){let t=W(S).segments.find(t=>t.id===e);t&&!W(p).has(e)&&j(t)}function P(e){let t=ne(e.node.entry.id);if(t&&!W(p).has(t.id)){let e=new ye(W(p));e.add(t.id),K(p,e,!0)}K(m,{kind:`entry`,row:e},!0),te(U5(e.node.entry.id))}function ie(e,t){let n=Tye(t.zoom);n!==W(_)&&K(_,n,!0)}function ae(e){A(e.data.selection)}function se(e){!W(x)||e.length!==1||A(e[0].data.selection)}function F(e){return e.data.isActive||e.data.isOnActivePath?`var(--primary)`:`var(--muted-foreground)`}var ce=Jbe(),le=V(ce),ue=e=>{var n=Kbe(),r=V(n);wge(V(r),{get nodes(){return W(D).nodes},get edges(){return W(D).edges},get nodeTypes(){return i},minZoom:.12,maxZoom:1.75,onlyRenderVisibleElements:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,nodesFocusable:!0,edgesFocusable:!1,selectionOnDrag:!1,selectNodesOnDrag:!1,deleteKey:null,multiSelectionKey:null,zoomOnDoubleClick:!1,onmove:ie,onnodeclick:({node:e})=>ae(e),onselectionchange:({nodes:e})=>se(e),onpaneclick:()=>K(h,!1),oninit:()=>queueMicrotask(()=>{K(x,!0)}),children:(e,t)=>{var n=Wbe(),r=R(n);jge(r,{gap:24,size:1});var i=L(r,2);Bge(i,{position:`bottom-left`,pannable:!0,zoomable:!0,nodeColor:F,nodeStrokeColor:F,nodeStrokeWidth:2,nodeBorderRadius:6,ariaLabel:`Conversation graph minimap`});var a=L(i,2);{let e=J(()=>W(S).segments.length>0);Cbe(a,{get activeNodeId(){return W(O)},get hasSegments(){return W(e)},get allExpanded(){return W(w)},onToggleAll:M,get fitRequest(){return W(v)},get centerRequest(){return W(b)}})}g(e,n)},$$slots:{default:!0}}),d(r);var a=L(r,2),s=e=>{var n=Gbe(),r=V(n);G(L(V(r),2),{variant:`ghost`,size:`icon-xs`,ariaLabel:`Close details`,title:`Close details`,onclick:()=>K(h,!1),children:(e,t)=>{yl(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}}),d(r);var i=L(r,2);mbe(V(i),{get selection(){return W(m)},get toolCallsById(){return W(o)},get onNavigateToEntry(){return t.onNavigateToEntry},get onEditEntry(){return t.onEditEntry},onSelectRow:P,onExpandSegment:re}),d(i),d(n),g(e,n)};k(a,e=>{W(h)&&W(m)&&e(s)}),d(n),g(e,n)},de=e=>{g(e,qbe())};k(le,e=>{W(c)?e(ue):e(de,-1)}),d(ce),g(e,ce),z()}var Xbe=h(`<div data-tour-id="conversation-history" class="h-full min-h-0"><!></div>`);function Zbe(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`treeNodes`,19,()=>[]),i=I(t,`toolCalls`,19,()=>[]);function o(e){n(e),t.onOpenChange?.(e)}function s(e){t.onNavigateToEntry?.(e),n(!1),t.onOpenChange?.(!1)}function c(e){t.onEditEntry?.(e),n(!1),t.onOpenChange?.(!1)}sP(e,{flush:!0,size:`viewport`,title:`Conversation history`,description:`Explore branches, inspect message and tool details, then branch from any point.`,onOpenChange:o,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=Xbe();Ybe(V(a),{get activeConversation(){return t.activeConversation},get treeNodes(){return r()},get toolCalls(){return i()},onNavigateToEntry:s,onEditEntry:c}),d(a),g(e,a)},$$slots:{default:!0}}),z()}var Qbe=h(`<!> `,1),$be=h(`<!> Open`,1),exe=h(`<div class="flex min-w-0 flex-1 items-center gap-1.5 text-muted-foreground"><!> <span class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs text-foreground"> </span> <span class="flex flex-none items-center gap-1"></span></div> <div class="flex flex-none items-center gap-2.5"><!></div>`,1);function txe(e,t){a(t,!0);let n=I(t,`signals`,19,()=>[]),r=I(t,`loading`,3,!1);var i=exe(),o=R(i),s=V(o);En(s,{size:14,strokeWidth:2.1,"aria-hidden":`true`,class:`flex-none text-primary`});var c=L(s,2),l=V(c,!0);d(c);var u=L(c,2);_(u,20,n,e=>e,(e,n)=>{let r=J(()=>t.signalMeta[n]),i=J(()=>W(r).icon);{let t=J(()=>W(r).tone??`neutral`);Ri(e,{get tone(){return W(t)},size:`xs`,get title(){return W(r).title},children:(e,t)=>{var n=Qbe(),a=R(n);C(a,()=>W(i),(e,t)=>{t(e,{size:11,strokeWidth:2.2})});var o=L(a,1,!0);F(()=>A(o,W(r).label)),g(e,n)},$$slots:{default:!0}})}}),d(u),d(o);var f=L(o,2),p=V(f);{let e=J(()=>!t.path||r()),n=J(()=>t.path?`Open ${t.path}`:`Open`);G(p,{size:`sm`,get disabled(){return W(e)},get title(){return W(n)},get onclick(){return t.onOpen},children:(e,t)=>{var n=$be();En(R(n),{size:14,strokeWidth:2.2}),w(),g(e,n)},$$slots:{default:!0}})}d(f),F(e=>{q(o,`title`,t.path),A(l,e)},[()=>t.path?Ud(t.path,t.homeDir):`—`]),g(e,i),z()}var nxe=h(`<span class="ml-auto text-muted-foreground tabular-nums"> </span>`),rxe=h(`<span class="skeleton-row svelte-cb8hzu"></span>`),ixe=h(`<div class="grid gap-0.5" aria-label="Loading directories"></div>`),axe=h(`<!>Opened`,1),oxe=h(`<!> `,1),sxe=h(`<div role="option" tabindex="-1"><!> <span class="grid min-w-0 gap-px"><strong class="overflow-hidden text-sm font-medium text-ellipsis whitespace-nowrap"> </strong></span> <span class="flex items-center justify-end gap-1.5"><!> <!> <button class="row-drill svelte-cb8hzu" type="button" title="Open folder" aria-label="Open folder"><!></button></span></div>`),cxe=h(`<div class="grid gap-0.5" role="listbox" aria-label="Folders"></div>`),lxe=h(`<div class="grid min-h-48 place-items-center gap-1 text-center text-muted-foreground"><!> <p class="mt-1 text-sm text-foreground"> </p> <span class="font-mono text-xs"> </span></div>`),uxe=h(`<div class="min-h-0 overflow-auto p-2"><section><header class="flex items-center gap-2 px-1 pt-1 pb-1.5 font-mono text-xs tracking-wide text-muted-foreground uppercase"><span>Folders</span> <!></header> <!></section></div>`);function dxe(e,t){a(t,!0);let n=I(t,`listEl`,15);var i=uxe(),o=V(i),c=V(o),l=L(V(c),2),u=e=>{var n=nxe(),r=V(n,!0);d(n),F(()=>A(r,t.filteredEntries.length)),g(e,n)};k(l,e=>{!t.loading&&t.filteredEntries.length&&e(u)}),d(c);var f=L(c,2),p=e=>{var t=ixe();_(t,20,()=>[0,1,2,3,4,5,6],e=>e,(e,t)=>{g(e,rxe())}),d(t),g(e,t)},m=e=>{var n=cxe();q(n,`tabindex`,-1),_(n,23,()=>t.filteredEntries,e=>e.path,(e,n,i)=>{let a=J(()=>W(i));var o=sxe();let c;var l=V(o);fn(l,{size:15,strokeWidth:2.1,"aria-hidden":`true`,class:`flex-none text-muted-foreground`});var u=L(l,2),f=V(u),p=V(f,!0);d(f),d(u);var m=L(u,2),h=V(m),v=e=>{Ri(e,{tone:`good`,size:`xs`,children:(e,t)=>{var n=axe();fv(R(n),{size:11}),w(),g(e,n)},$$slots:{default:!0}})},y=J(()=>t.isOpened(W(n).path));k(h,e=>{W(y)&&e(v)});var b=L(h,2);_(b,16,()=>t.uniqueSignals(W(n).signals),e=>e,(e,n)=>{let r=J(()=>t.signalMeta[n]),i=J(()=>W(r).icon);{let t=J(()=>W(r).tone??`neutral`);Ri(e,{get tone(){return W(t)},size:`xs`,get title(){return W(r).title},children:(e,t)=>{var n=oxe(),a=R(n);C(a,()=>W(i),(e,t)=>{t(e,{size:11,strokeWidth:2.2})});var o=L(a,1,!0);F(()=>A(o,W(r).label)),g(e,n)},$$slots:{default:!0}})}});var x=L(b,2);ut(V(x),{size:15,strokeWidth:2.2,"aria-hidden":`true`}),d(x),d(m),d(o),F(()=>{q(o,`id`,`folder:${W(n).path}`),c=s(o,1,`row svelte-cb8hzu`,null,c,{selected:t.selectedIndex===W(a)}),q(o,`aria-selected`,t.selectedIndex===W(a)),q(o,`title`,W(n).path),A(p,W(n).name)}),r(`click`,o,()=>t.onSelectedIndexChange?.(W(a))),r(`dblclick`,o,()=>void t.load(W(n).path)),r(`keydown`,o,e=>t.onRowKeydown(e,W(a),{kind:`folder`,id:`folder:${W(n).path}`,path:W(n).path,entry:W(n)})),r(`click`,x,e=>{e.stopPropagation(),t.load(W(n).path)}),g(e,o)}),d(n),F(()=>q(n,`aria-activedescendant`,t.selectedItem?.kind===`folder`?t.activeDescendant:void 0)),g(e,n)},h=e=>{var n=lxe(),r=V(n);En(r,{size:26,strokeWidth:1.8});var i=L(r,2),a=V(i,!0);d(i);var o=L(i,2),s=V(o,!0);d(o),d(n),F((e,t)=>{A(a,e),A(s,t)},[()=>t.query.trim()?`No folders match your filter.`:`No subfolders here.`,()=>t.query.trim()?`Clear the filter or paste a path.`:`Use Open below to choose this folder as the project.`]),g(e,n)};k(f,e=>{t.loading?e(p):t.filteredEntries.length?e(m,1):e(h,-1)}),d(o),d(i),fe(i,e=>n(e),()=>n()),g(e,i),z()}T([`click`,`dblclick`,`keydown`]);var fxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function n7(e,t){let n=H(t,fxe),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];P(e,B({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var pxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function mxe(e,t){let n=H(t,pxe),r=[[`path`,{d:`M8 6L12 2L16 6`}],[`path`,{d:`M12 2V22`}]];P(e,B({name:`move-up`},()=>n,{get iconNode(){return r}}))}var hxe=h(`<!> <span class="h-4.5 w-px bg-border/70" aria-hidden="true"></span>`,1),gxe=h(`<span class="max-w-48 cursor-default overflow-hidden px-1 py-0.5 font-medium text-ellipsis whitespace-nowrap text-foreground max-[560px]:max-w-28"> </span>`),_xe=h(`<button class="max-w-48 cursor-pointer overflow-hidden rounded-sm border-0 bg-transparent px-1 py-0.5 text-ellipsis whitespace-nowrap text-muted-foreground transition-[color,background-color,border-color,box-shadow] duration-120 not-disabled:hover:bg-accent not-disabled:hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground focus-visible:outline-none max-[560px]:max-w-28 max-[520px]:hidden" type="button"> </button>`),vxe=h(`<!> <!>`,1),yxe=h(`<div class="flex items-center gap-2 border-b border-b-border/60 py-1.5 pr-2.5 pl-3 max-[520px]:gap-1 max-[520px]:pr-1.5 max-[520px]:pl-2"><!> <nav class="flex min-w-0 flex-1 items-center gap-0.5 overflow-hidden font-mono text-xs" aria-label="Current location"></nav> <div class="flex flex-none items-center gap-1"><!> <!> <span class="h-4.5 w-px bg-border/70" aria-hidden="true"></span> <!></div></div> <form class="grid items-center border-b border-b-border/60 px-3 py-2.5"><!></form>`,1);function bxe(e,t){a(t,!0);let n=I(t,`query`,15),i=I(t,`showHidden`,15);var o=yxe(),s=R(o),c=V(s),l=e=>{var n=hxe();G(R(n),{variant:`ghost`,size:`icon-sm`,title:`Back to recents`,ariaLabel:`Back to recents`,get onclick(){return t.onBack},children:(e,t)=>{n7(e,{size:15,strokeWidth:2.2})},$$slots:{default:!0}}),w(2),g(e,n)};k(c,e=>{t.onBack&&e(l)});var u=L(c,2);_(u,23,()=>t.crumbs,e=>e.path,(e,n,i)=>{var a=vxe(),o=R(a),s=e=>{ut(e,{class:`flex-none text-muted-foreground/55 max-[520px]:hidden`,size:13,strokeWidth:2.2,"aria-hidden":`true`})};k(o,e=>{W(i)>0&&e(s)});var c=L(o,2),l=e=>{var t=gxe(),r=V(t,!0);d(t),F(()=>{q(t,`title`,W(n).path),A(r,W(n).label)}),g(e,t)},u=e=>{var i=_xe(),a=V(i,!0);d(i),F(()=>{q(i,`title`,W(n).path),i.disabled=t.loading,A(a,W(n).label)}),r(`click`,i,()=>t.onLoad?.(W(n).path)),g(e,i)};k(c,e=>{W(i)===t.crumbs.length-1?e(l):e(u,-1)}),g(e,a)}),d(u);var f=L(u,2),p=V(f);{let e=J(()=>!t.parent||t.loading);G(p,{variant:`ghost`,size:`icon-sm`,get disabled(){return W(e)},title:`Parent directory`,ariaLabel:`Parent directory`,onclick:()=>t.onLoad?.(t.parent),children:(e,t)=>{mxe(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}})}var m=L(p,2);G(m,{variant:`ghost`,size:`icon-sm`,get disabled(){return t.loading},title:`Refresh`,ariaLabel:`Refresh`,get onclick(){return t.onReload},children:(e,t)=>{_l(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}}),Kg(L(m,4),{label:`Hidden`,class:`h-7 gap-1.5 rounded-sm border border-border/60 bg-input px-1.5 text-xs max-[520px]:gap-1 max-[520px]:px-1`,get checked(){return i()},set checked(e){i(e)}}),d(f),d(s);var h=L(s,2);t_(V(h),{onValueChange:()=>t.onQueryChange?.(n()),placeholder:`Filter folders or paste a path`,get disabled(){return t.loading},inputClass:`font-mono`,ariaLabel:`Filter folders or enter a path`,get value(){return n()},set value(e){n(e)}}),d(h),ue(`submit`,h,function(...e){t.onSubmit?.apply(this,e)}),g(e,o),z()}T([`click`]);var xxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sxe(e,t){let n=H(t,xxe),r=[[`rect`,{width:`7`,height:`18`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`}]];P(e,B({name:`layout-panel-left`},()=>n,{get iconNode(){return r}}))}var Cxe=h(`<button type="button" class="group flex w-full items-center gap-2.5 rounded-md border border-transparent bg-transparent px-2.5 py-2 text-left hover:bg-accent/60 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none"><span class="grid size-8 flex-none place-items-center rounded-md border border-border/60 bg-muted/40 text-muted-foreground group-hover:text-foreground"><!></span> <span class="grid min-w-0 flex-1 gap-0.5"><span class="text-sm font-medium text-foreground">Browse path</span> <span class="truncate font-mono text-xs text-muted-foreground"> </span></span> <!></button>`),wxe=h(`<span class="sr-only">Current project</span>`),Txe=h(`<div role="option" tabindex="-1"><span><!> <!></span> <span class="grid min-w-0 flex-1 gap-px"><span class="flex min-w-0 items-center gap-1.5"><strong class="min-w-0 truncate text-sm font-normal text-foreground"> </strong> <!></span> <span class="min-w-0 truncate font-mono text-xs text-muted-foreground"> </span></span> <span class="flex-none pl-2 text-xs whitespace-nowrap text-muted-foreground tabular-nums"> <span class="max-[520px]:hidden"><span class="px-1 text-muted-foreground/50" aria-hidden="true">·</span> </span></span></div>`),Exe=h(`<div class="grid gap-px" role="listbox" aria-label="Recent projects"></div>`),Dxe=h(`<div class="grid min-h-40 place-items-center gap-1 p-6 text-center text-muted-foreground"><!> <p class="m-0 mt-1 text-sm text-foreground"> </p> <span class="text-xs">Use Browse below to open a project folder.</span></div>`),Oxe=h(`<form class="grid items-center border-b border-b-border/60 px-3 py-2.5"><!></form> <div class="min-h-0 overflow-auto p-2"><!></div>`,1);function kxe(e,t){a(t,!0);let n=I(t,`scrollEl`,15),i=I(t,`query`,15);function o(e){return e===void 0?`—`:F0(new Date(e).toISOString())}function c(e){return e===void 0?`Last access not recorded`:`Last accessed ${I0(new Date(e).toISOString())}`}function l(e){let n=[{label:`New chat`,icon:hl,onSelect:()=>t.onNewChat(e.dir)},{label:`Copy path`,icon:Bu,onSelect:()=>t.onCopyPath(e.dir)}];return t.onForget&&n.push({type:`separator`},{label:`Forget project`,icon:Zv,destructive:!0,onSelect:()=>t.onForget?.(e.id)}),n}var u=Oxe(),f=R(u);t_(V(f),{onValueChange:()=>t.onQueryChange?.(),placeholder:`Search recent projects or paste a path`,get disabled(){return t.loading},ariaLabel:`Search recent projects or enter a path`,get value(){return i()},set value(e){i(e)}}),d(f);var p=L(f,2),m=V(p),h=e=>{var n=Cxe(),a=V(n);En(V(a),{class:`size-4`,"aria-hidden":`true`}),d(a);var o=L(a,2),s=L(V(o),2),c=V(s,!0);d(s),d(o),kI(L(o,2),{class:`size-3.5 flex-none text-muted-foreground group-hover:text-foreground`,strokeWidth:2.2,"aria-hidden":`true`}),d(n),F(e=>A(c,e),[()=>i().trim()]),r(`click`,n,function(...e){t.onBrowsePath?.apply(this,e)}),g(e,n)},v=e=>{var n=Exe();q(n,`tabindex`,-1),_(n,23,()=>t.recentProjects,e=>e.id,(e,n,i)=>{let a=J(()=>t.conversationCountFor(W(n))),u=J(()=>t.activityFor?.(W(n))),f=J(()=>W(u)?ff(W(u)):void 0),p=J(()=>t.isCurrent?.(W(n))??!1),m=J(()=>t.lastAccessedFor?.(W(n))),h=J(()=>t.selectedIndex===W(i));{let u=J(()=>l(W(n)));un(e,{get items(){return W(u)},triggerClass:`contents`,children:(e,l)=>{var u=Txe(),_=V(u),v=V(_);Sxe(v,{class:`size-3.5`,"aria-hidden":`true`});var y=L(v,2),b=e=>{g(e,wxe())};k(y,e=>{W(p)&&e(b)}),d(_);var x=L(_,2),S=V(x),C=V(S),w=V(C,!0);d(C);var T=L(C,2),E=e=>{ht(e,{get tone(){return W(f).tone},size:`xs`,get pulse(){return W(f).pulse},get label(){return W(f).summary}})};k(T,e=>{W(f)&&e(E)}),d(S);var D=L(S,2),O=V(D,!0);d(D),d(x);var ee=L(x,2),te=V(ee),ne=L(te),j=L(V(ne));d(ne),d(ee),d(u),F((e,t,r)=>{q(u,`id`,`recent:${W(n).id}`),s(u,1,`group flex w-full cursor-pointer items-center gap-2 rounded-md border px-2 py-1.5 text-left focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none ${W(h)?`border-border bg-accent`:`border-transparent hover:bg-accent/60`}`),q(u,`aria-selected`,W(h)),q(u,`title`,e),s(_,1,`grid size-7 flex-none place-items-center rounded-md border ${W(p)?`border-primary/40 bg-primary/10 text-primary`:`border-border/60 bg-muted/40 ${W(h)?`text-foreground`:`text-muted-foreground group-hover:text-foreground`}`}`),q(_,`title`,W(p)?`Current project`:void 0),A(w,W(n).name),A(O,t),A(te,`${W(a)??``} chat${W(a)===1?``:`s`} `),A(j,` ${r??``}`)},[()=>`${W(n).dir}\n${c(W(m))}${W(f)?`\n${W(f).summary}`:``}`,()=>Yd(W(n).dir,t.homeDir),()=>W(m)===void 0?`Not accessed`:`Accessed ${o(W(m))}`]),r(`click`,u,()=>t.onOpen(W(n))),r(`keydown`,u,e=>t.onRowKeydown(e,W(i),W(n))),g(e,u)},$$slots:{default:!0}})}}),d(n),F(()=>q(n,`aria-activedescendant`,t.activeDescendant)),g(e,n)},y=e=>{var n=Dxe(),r=V(n);En(r,{size:26,strokeWidth:1.8,"aria-hidden":`true`});var i=L(r,2),a=V(i,!0);d(i),w(2),d(n),F(()=>A(a,t.totalRecentCount?`No recent projects match your search.`:`No recent projects yet.`)),g(e,n)};k(m,e=>{t.pathQuery?e(h):t.recentProjects.length?e(v,1):e(y,-1)}),d(p),fe(p,e=>n(e),()=>n()),ue(`submit`,f,function(...e){t.onSubmit?.apply(this,e)}),g(e,u),z()}T([`click`,`keydown`]);var Axe=new Set([`$$slots`,`$$events`,`$$legacy`]);function r7(e,t){let n=H(t,Axe),r=[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`}],[`path`,{d:`M12 22V12`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`}],[`path`,{d:`m7.5 4.27 9 5.15`}]];P(e,B({name:`package`},()=>n,{get iconNode(){return r}}))}var i7={git:{label:`Git`,title:`Git repository`,tone:`accent`,icon:oI},package:{label:`Pkg`,title:`JavaScript package`,icon:r7},workspace:{label:`Workspace`,title:`Workspace marker`,tone:`accent`,icon:r7},python:{label:`Py`,title:`Python project`,icon:qu},rust:{label:`Rust`,title:`Rust project`,icon:qu},go:{label:`Go`,title:`Go module`,icon:qu}};function a7(e){return[...new Set(e??[])]}function o7(e,t){let n=e.trim();if(!t)return n;if(n===`~`)return t;if(n.startsWith(`~/`)||n.startsWith(`~\\`)){let e=t.includes(`\\`)?`\\`:`/`;return`${t.replace(/[\\/]+$/,``)}${e}${n.slice(2)}`}return n}var jxe=h(`<!> Browse`,1),Mxe=h(`<span class="flex-1 text-xs text-muted-foreground"> </span> <!>`,1),Nxe=h(`<p class="m-0 border-b border-b-border/60 px-3 py-2 text-xs text-destructive"> </p>`),Pxe=h(`<!> <!> <!>`,1),Fxe=h(`<div role="presentation"><!></div>`);function Ixe(e,t){a(t,!0);let n=I(t,`open`,15,!1),i=I(t,`projects`,19,()=>[]),o=I(t,`conversations`,19,()=>[]),c=I(t,`switcherItems`,19,()=>[]),l=Y(`recent`),u=Y(``),f=Y(void 0),p=Y(!1),m=Y(void 0),h=Y(!1),_=Y(-1),v=Y(-1),y=Y(!1),b=Y(!1),x=Y(void 0),S=Y(void 0),C=J(()=>new Set(i().map(e=>Xd(e.dir)))),T=J(()=>{let e=new se;for(let t of c())for(let n of t.projectIds)e.set(n,t.activity);return e}),E=J(()=>new ye(c().find(e=>e.key===t.activeProjectKey)?.projectIds??[])),D=J(()=>{let e=new se;for(let t of c())if(t.lastAccessedAt!==void 0)for(let n of t.projectIds)e.set(n,t.lastAccessedAt);return e}),O=J(()=>{let e=new se;for(let t of o())e.set(t.projectId,(e.get(t.projectId)??0)+1);return e}),ee=J(()=>{let e=new ye;return[...i()].sort((e,t)=>(W(D).get(t.id)??0)-(W(D).get(e.id)??0)||t.updatedAt.localeCompare(e.updatedAt)).filter(t=>{let n=Xd(t.dir);return e.has(n)?!1:(e.add(n),!0)}).slice(0,24)}),te=J(()=>Zd(W(u).trim())),ne=J(()=>{if(W(te))return[];let e=W(u).trim().toLowerCase();return e?W(ee).filter(t=>t.name.toLowerCase().includes(e)||t.dir.toLowerCase().includes(e)):W(ee)}),j=J(()=>W(v)>=0?`recent:${W(ne)[W(v)]?.id}`:void 0),M=J(()=>{let e=W(f)?.entries??[],t=W(u).trim();if(!t||Zd(t))return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n))}),re=J(()=>W(M).map(e=>({kind:`folder`,id:`folder:${e.path}`,path:e.path,entry:e}))),N=J(()=>W(_)>=0?W(re)[W(_)]:void 0),P=J(()=>W(N)?.entry),ie=J(()=>W(N)?.path??W(f)?.path??``),ae=J(()=>a7(W(P)?.signals??(W(N)?[]:W(f)?.signals))),oe=J(()=>W(N)?.id),ce=J(()=>tf(W(f)?.path,t.homeDir));function le(e){return W(C).has(Xd(e))}function ue(e){return W(O).get(e.id)??0}async function de(e){K(p,!0),K(m,void 0);try{K(f,await WV(e,W(h)),!0),K(u,``),K(_,-1)}catch(e){K(m,e instanceof Error?e.message:String(e),!0)}finally{K(p,!1)}}function fe(){de(W(f)?.path||void 0)}function pe(){requestAnimationFrame(()=>{W(x)?.querySelector(`.row.selected`)?.scrollIntoView({block:`nearest`})})}function me(){requestAnimationFrame(()=>{W(S)?.querySelector(`[role="option"][aria-selected="true"]`)?.scrollIntoView({block:`nearest`})})}function he(e){K(l,`browse`),K(u,``),K(_,-1),e?de(e):W(f)||de(t.homeDir||void 0)}function ge(){K(l,`recent`),K(u,``),K(v,-1)}function _e(e){n(e),e||t.onClose?.()}async function ve(e){await t.onSelectProject?.(e),_e(!1)}function B(e){e.preventDefault();let n=W(u).trim();if(!n)return;if(Zd(n)){he(o7(n,t.homeDir));return}if(W(l)===`recent`){let e=W(ne)[W(v)>=0?W(v):0];e&&ve(e.id);return}let r=W(re)[0];r&&de(r.path)}async function xe(){let e=W(ie);e&&(await t.onOpenDirectory?.(e),_e(!1))}function Se(e,t,n){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),K(_,t,!0),de(n.path))}function Ce(e,t,n){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),K(v,t,!0),ve(n.id))}async function we(e){try{await Ju(e),Kn.success(`Path copied`)}catch{Kn.error(`Could not copy to clipboard`)}}function H(e){let n=e.target?.tagName===`INPUT`,r=W(ne).length;switch(e.key){case`ArrowDown`:e.preventDefault(),r&&(K(v,W(v)<0?0:Math.min(W(v)+1,r-1),!0),me());break;case`ArrowUp`:e.preventDefault(),r&&(K(v,W(v)<=0?0:W(v)-1,!0),me());break;case`Enter`:if(n)return;if(e.preventDefault(),W(te)){he(o7(W(u),t.homeDir));return}{let e=W(ne)[W(v)>=0?W(v):0];e&&ve(e.id)}break}}function Te(e){let t=e.target?.tagName===`INPUT`,n=W(re).length;switch(e.key){case`ArrowDown`:e.preventDefault(),n&&(K(_,W(_)<0?0:Math.min(W(_)+1,n-1),!0),pe());break;case`ArrowUp`:e.preventDefault(),n&&(K(_,W(_)<=0?0:W(_)-1,!0),pe());break;case`ArrowRight`:!t&&W(P)&&(e.preventDefault(),de(W(P).path));break;case`Enter`:e.metaKey||e.ctrlKey?(e.preventDefault(),xe()):!t&&W(N)&&(e.preventDefault(),de(W(N).path));break;case`ArrowLeft`:!t&&W(f)?.parent&&(e.preventDefault(),de(W(f).parent));break;case`Backspace`:W(u).length===0&&W(f)?.parent&&(e.preventDefault(),de(W(f).parent));break}}function Ee(e){W(l)===`recent`?H(e):Te(e)}be(()=>{n()&&!W(y)&&(K(l,W(ee).length?`recent`:`browse`,!0),K(v,-1),K(_,-1),K(u,``),de(W(f)?.path||void 0)),K(y,n(),!0)}),be(()=>{n()&&W(h)!==W(b)&&fe(),K(b,W(h),!0)}),sP(e,{flush:!0,title:`Switch project`,description:`Choose a recent project or browse for a folder.`,class:`project-picker-dialog`,onOpenChange:_e,get open(){return n()},set open(e){n(e)},footer:e=>{var n=U(),r=R(n),i=e=>{var t=Mxe(),n=R(t),r=V(n);d(n),G(L(n,2),{variant:`outline`,size:`sm`,"data-tour-id":`guide-project-browse`,onclick:()=>he(),children:(e,t)=>{var n=jxe();X5(R(n),{size:14,strokeWidth:2.2}),w(),g(e,n)},$$slots:{default:!0}}),F(()=>A(r,`${W(ee).length??``} recent project${W(ee).length===1?``:`s`}`)),g(e,t)},a=e=>{txe(e,{get path(){return W(ie)},get homeDir(){return t.homeDir},get signals(){return W(ae)},get signalMeta(){return i7},get loading(){return W(p)},onOpen:()=>void xe()})};k(r,e=>{W(l)===`recent`?e(i):e(a,-1)}),g(e,n)},children:(e,n)=>{var i=Fxe(),a=V(i),o=e=>{kxe(e,{get recentProjects(){return W(ne)},get totalRecentCount(){return W(ee).length},get pathQuery(){return W(te)},get selectedIndex(){return W(v)},get activeDescendant(){return W(j)},get homeDir(){return t.homeDir},get loading(){return W(p)},conversationCountFor:ue,activityFor:e=>W(T).get(e.id),lastAccessedFor:e=>W(D).get(e.id),isCurrent:e=>W(E).has(e.id),onOpen:e=>void ve(e.id),onNewChat:e=>void t.onNewChat?.(e),onCopyPath:e=>void we(e),get onForget(){return t.onForget},onBrowsePath:()=>he(o7(W(u),t.homeDir)),onQueryChange:()=>K(v,-1),onSubmit:B,onRowKeydown:Ce,get scrollEl(){return W(S)},set scrollEl(e){K(S,e,!0)},get query(){return W(u)},set query(e){K(u,e,!0)}})},c=e=>{var t=Pxe(),n=R(t);{let e=J(()=>W(f)?.parent),t=J(()=>W(ee).length?ge:void 0);bxe(n,{get crumbs(){return W(ce)},get loading(){return W(p)},get parent(){return W(e)},onLoad:e=>void de(e),onReload:fe,onQueryChange:()=>K(_,-1),onSubmit:B,get onBack(){return W(t)},get query(){return W(u)},set query(e){K(u,e,!0)},get showHidden(){return W(h)},set showHidden(e){K(h,e,!0)}})}var r=L(n,2),i=e=>{var t=Nxe(),n=V(t,!0);d(t),F(()=>A(n,W(m))),g(e,t)};k(r,e=>{W(m)&&e(i)}),dxe(L(r,2),{get filteredEntries(){return W(M)},get loading(){return W(p)},get query(){return W(u)},get selectedIndex(){return W(_)},get selectedItem(){return W(N)},get activeDescendant(){return W(oe)},get signalMeta(){return i7},isOpened:le,get uniqueSignals(){return a7},load:e=>void de(e),onSelectedIndexChange:e=>K(_,e,!0),onRowKeydown:Se,get listEl(){return W(x)},set listEl(e){K(x,e,!0)}}),g(e,t)};k(a,e=>{W(l)===`recent`?e(o):e(c,-1)}),d(i),F(()=>s(i,1,`grid h-full min-h-0 ${W(l)===`recent`?`grid-rows-[auto_minmax(0,1fr)]`:`grid-rows-[auto_auto_minmax(0,1fr)]`}`)),r(`keydown`,i,Ee),g(e,i)},$$slots:{footer:!0,default:!0}}),z()}T([`keydown`]);var Lxe=h(`<!> <!>`,1);function Rxe(e,t){a(t,!0);let n=J(()=>If.status),r=J(()=>If.projects),i=J(()=>If.conversations),o=J(()=>If.projectSwitcherItems),s=J(()=>k0.activeConversation),c=J(()=>k0.treeNodes),l=J(()=>k0.toolCalls);async function u(e){await Tq(e),OZ()}async function d(e){await Tq(e.parentEntryId),Mq(e.text),OZ()}var f=Lxe(),p=R(f);{let e=J(()=>W(n)?.storage.userHome);Ixe(p,{get projects(){return W(r)},get conversations(){return W(i)},get switcherItems(){return W(o)},get activeProjectKey(){return Q.selectedProjectKey},get homeDir(){return W(e)},onSelectProject:e=>void jJ(e),onOpenDirectory:e=>void MJ(e),onNewChat:e=>void BJ(e),onForget:e=>void FJ(e),get open(){return Q.projectPickerOpen},set open(e){Q.projectPickerOpen=e}})}Zbe(L(p,2),{get activeConversation(){return W(s)},get treeNodes(){return W(c)},get toolCalls(){return W(l)},onNavigateToEntry:e=>{u(e)},onEditEntry:e=>{d(e)},get open(){return DZ.historyDialogOpen},set open(e){DZ.historyDialogOpen=e}}),g(e,f),z()}var zxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bxe(e,t){let n=H(t,zxe),r=[[`path`,{d:`M12 3v14`}],[`path`,{d:`M5 10h14`}],[`path`,{d:`M5 21h14`}]];P(e,B({name:`diff`},()=>n,{get iconNode(){return r}}))}var Vxe=h(`<span> </span>`),Hxe=h(`<span class="status-trigger svelte-1bl2f4l"><!> <!></span>`),Uxe=h(`<span class="flex items-center gap-1.5"><!> </span>`),Wxe=h(`<!> <!> <!> <!> <!>`,1),Gxe=h(`<!> <!>`,1);function Kxe(e,t){a(t,!0);let n=I(t,`connection`,3,`connecting`),r=I(t,`live`,3,!1),i=I(t,`side`,3,`top`),o=I(t,`compact`,3,!1),s=J(()=>r()?`good`:n()===`error`?`danger`:n()===`closed`?`warn`:`running`),c=J(()=>r()?`Connected`:n()),l=J(()=>{if(!t.status?.startedAt)return null;let e=new Date(t.status.startedAt).getTime();return Number.isNaN(e)?null:Z_((Date.now()-e)/6e4)});wg(e,{size:`sm`,triggerClass:`h-5.5 rounded-sm px-1.5 text-muted-foreground hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground`,ariaLabel:`Open daemon status`,get side(){return i()},align:`end`,trigger:e=>{var t=Hxe(),n=V(t);ht(n,{get tone(){return W(s)},get pulse(){return r()}});var i=L(n,2),a=e=>{var t=Vxe(),n=V(t,!0);d(t),F(()=>A(n,W(c))),g(e,t)};k(i,e=>{o()||e(a)}),d(t),F(()=>q(t,`title`,`Nerve daemon · ${W(c)}`)),g(e,t)},children:(e,r)=>{Eg(e,{children:(e,r)=>{var i=Gxe(),a=R(i);kg(a,{title:`Nerve daemon`,action:e=>{Ri(e,{size:`xs`,get tone(){return W(s)},children:(e,t)=>{w();var n=M();F(()=>A(n,W(c))),g(e,n)},$$slots:{default:!0}})},$$slots:{action:!0}}),Rg(L(a,2),{children:(e,r)=>{var i=Wxe(),a=R(i);Bg(a,{label:`Connection`,children:(e,t)=>{var r=Uxe(),i=V(r);ht(i,{get tone(){return W(s)},size:`xs`});var a=L(i,1,!0);d(r),F(()=>A(a,n())),g(e,r)},$$slots:{default:!0}});var o=L(a,2);{let e=J(()=>t.status?.version);Bg(o,{label:`Version`,get value(){return W(e)},valueClass:`font-mono`})}var c=L(o,2);{let e=J(()=>W(l)??void 0);Bg(c,{label:`Uptime`,get value(){return W(e)}})}var u=L(c,2);{let e=J(()=>t.status==null?void 0:t.status.storage.indexHealthy?`healthy`:`rebuilding`),n=J(()=>t.status?.storage.indexHealthy?`text-success`:`text-warning`);Bg(u,{label:`Index`,get value(){return W(e)},get valueClass(){return W(n)}})}var f=L(u,2);{let e=J(()=>t.status?.storage.home),n=J(()=>t.status?.storage.home);Bg(f,{label:`Data dir`,get value(){return W(e)},valueClass:`font-mono`,get title(){return W(n)}})}g(e,i)},$$slots:{default:!0}}),g(e,i)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}}),z()}var qxe=h(`<span class="text-xs text-muted-foreground"> </span>`),Jxe=h(`<div class="flex flex-col gap-1"><div class="flex items-center justify-between gap-2 text-xs"><span class="text-muted-foreground"> </span> <span> </span></div> <div class="h-1 overflow-hidden rounded-full bg-muted"><div></div></div> <!></div>`),Yxe=h(`<span class="usage-meter svelte-fvy830"><span class="usage-meter-label svelte-fvy830"> </span> <span class="usage-meter-track svelte-fvy830"><span></span></span> <span> </span></span>`),Xxe=h(`<span class="usage-reset svelte-fvy830"> </span>`),Zxe=h(`<span class="usage-trigger svelte-fvy830"><!> <!></span>`),Qxe=h(`<span class="font-normal text-muted-foreground"> </span>`),s7=h(`<span class="text-muted-foreground">No data</span>`),$xe=h(`<div class="flex items-baseline justify-between gap-2"><span class="flex items-baseline gap-1.5 text-xs font-medium"> <!></span> <!></div> <!>`,1),eSe=h(`<!> <!>`,1);function c7(e,t){a(t,!0);let n=(e,t=D)=>{let n=J(()=>t().window.usedPercent??null),r=J(()=>o(t().window));var i=Jxe(),a=V(i),f=V(a),p=V(f,!0);d(f);var _=L(f,2),v=V(_,!0);d(_),d(a);var y=L(a,2),b=V(y);d(y);var S=L(y,2),C=e=>{var t=qxe(),n=V(t);d(t),F(()=>A(n,`resets in ${W(r)??``}`)),g(e,t)};k(S,e=>{W(r)&&e(C)}),d(i),F((e,n,r,i)=>{A(p,t().label),s(_,1,e,`svelte-fvy830`),A(v,n),s(b,1,r,`svelte-fvy830`),l(b,`width: ${i??``}%`)},[()=>x(me(`font-medium tabular-nums`,m(W(n)))),()=>c(W(n)),()=>x(me(`h-full rounded-full`,h(W(n)))),()=>u(W(n))]),g(e,i)},r=I(t,`usages`,19,()=>[]),i=I(t,`compact`,3,!1);function o(e){return e?Q_(e.resetsAt)??$_(e.resetAfterSeconds):null}function c(e){return e==null?`—`:`${Math.round(e)}%`}function u(e){return e==null?0:Math.min(100,Math.max(0,e))}function f(e){return e===`openai-codex`?`Codex`:e===`anthropic`?`Anthropic`:e}function p(e){if(!e)return[];let t=[];return e.session&&t.push({slot:`session`,window:e.session,...Y_(e.session.windowMinutes,{label:`Session`,abbreviation:`S`})}),e.weekly&&t.push({slot:`weekly`,window:e.weekly,...Y_(e.weekly.windowMinutes,{label:`Weekly`,abbreviation:`W`})}),t}function m(e){let t=q_(e);return t===`error`?`text-destructive`:t===`warning`?`text-warning`:``}function h(e){let t=q_(e);return t===`error`?`bg-destructive-solid`:t===`warning`?`bg-warning`:`bg-success`}function v(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}let y=J(r),b=J(()=>W(y).some(e=>p(e.usage).length>0)),S=J(()=>W(y).find(e=>e.active&&p(e.usage).length>0)??W(y).find(e=>p(e.usage).length>0)),C=J(()=>p(W(S)?.usage)),T=J(()=>!i()||W(C).length<=1?W(C):[W(C).reduce((e,t)=>(t.window.usedPercent??0)>(e.window.usedPercent??0)?t:e)]),E=J(()=>i()?null:o(W(T)[0]?.window)),O=J(()=>v(W(y).map(e=>e.usage?.updatedAt).filter(e=>!!e).sort().at(-1))),ee=J(()=>{let e=[];for(let t of W(y)){let n=p(t.usage);if(n.length===0)continue;let r=n.map(e=>`${e.label.toLowerCase()} ${c(e.window.usedPercent)}`).join(` / `);e.push(`${f(t.provider)} — ${r}`)}return e.join(`
161
+ `)});var te=U(),ne=R(te),j=e=>{wg(e,{size:`md`,triggerClass:`h-5.5 rounded-sm px-1.5 text-muted-foreground hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground`,ariaLabel:`Open subscription usage details`,side:`top`,align:`end`,trigger:e=>{var t=Zxe(),n=V(t);_(n,17,()=>W(T),e=>e.slot,(e,t)=>{let n=J(()=>W(t).window.usedPercent);var r=Yxe(),i=V(r),a=V(i,!0);d(i);var o=L(i,2),f=V(o);d(o);var p=L(o,2),_=V(p,!0);d(p),d(r),F((e,n,r,i)=>{A(a,W(t).abbreviation),s(f,1,e,`svelte-fvy830`),l(f,`width: ${n??``}%`),s(p,1,r,`svelte-fvy830`),A(_,i)},[()=>x(me(`usage-meter-fill`,h(W(n)))),()=>u(W(n)),()=>x(me(`usage-meter-value`,m(W(n)))),()=>c(W(n))]),g(e,r)});var r=L(n,2),i=e=>{var t=Xxe(),n=V(t,!0);d(t),F(()=>A(n,W(E))),g(e,t)};k(r,e=>{W(E)&&e(i)}),d(t),F(()=>q(t,`title`,W(ee))),g(e,t)},children:(e,t)=>{Eg(e,{children:(e,t)=>{var r=eSe(),i=R(r);{let e=J(()=>W(O)?`Updated ${W(O)}`:void 0);kg(i,{title:`Subscription usage`,get meta(){return W(e)}})}_(L(i,2),19,()=>W(y),e=>e.provider,(e,t,r)=>{{let i=J(()=>W(r)>0);Ng(e,{get separated(){return W(i)},children:(e,r)=>{var i=$xe(),a=R(i),o=V(a),s=V(o),c=L(s),l=e=>{var n=Qxe(),r=V(n);d(n),F(()=>A(r,`· ${W(t).usage.planType??``}`)),g(e,n)};k(c,e=>{W(t).usage?.planType&&e(l)}),d(o);var u=L(o,2),m=e=>{Ri(e,{size:`xs`,tone:`neutral`,children:(e,t)=>{w(),g(e,M(`Active`))},$$slots:{default:!0}})};k(u,e=>{W(t).active&&e(m)}),d(a);var h=L(a,2),v=e=>{let r=J(()=>p(W(t).usage));var i=U(),a=R(i),o=e=>{var t=U();_(R(t),17,()=>W(r),e=>e.slot,(e,t)=>{n(e,()=>W(t))}),g(e,t)},s=e=>{g(e,s7())};k(a,e=>{W(r).length>0?e(o):e(s,-1)}),g(e,i)},y=e=>{g(e,s7())};k(h,e=>{W(t).usage?e(v):e(y,-1)}),F(e=>A(s,`${e??``} `),[()=>f(W(t).provider)]),g(e,i)},$$slots:{default:!0}})}}),g(e,r)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}})};k(ne,e=>{W(b)&&e(j)}),g(e,te),z()}var tSe=new Set([`$$slots`,`$$events`,`$$legacy`]);function l7(e,t){let n=H(t,tSe),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 9h18`}],[`path`,{d:`M9 21V9`}]];P(e,B({name:`panels-top-left`},()=>n,{get iconNode(){return r}}))}var nSe=new Set([`$$slots`,`$$events`,`$$legacy`]);function u7(e,t){let n=H(t,nSe),r=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}]];P(e,B({name:`rotate-ccw`},()=>n,{get iconNode(){return r}}))}var rSe=h(`<span class="layout-trigger svelte-14ergwt"><!> <span> </span></span>`),iSe=h(`<span class="flex-none text-sm font-semibold tabular-nums"> </span>`),aSe=h(`<!> <div class="flex items-center justify-between gap-2"><div class="flex items-center gap-1" aria-label="Zoom controls"><!> <!> <!></div> <span class="text-muted-foreground"> </span></div> <!>`,1);function oSe(e,t){a(t,!0);let n=I(t,`zoomLevel`,3,0),r=I(t,`dockToggles`,19,()=>[]),i={left:qo,right:Yo,bottom:Go},o={left:`view.toggleLeftDock`,right:`view.toggleRightDock`,bottom:`view.toggleBottomDock`};function s(e){let t=zd(o[e]);return t?Id(t.defaultBinding):void 0}let c=J(()=>$U(n())),l=J(()=>tW(W(c))),u=J(()=>W(c)>0?`+${W(c)}`:String(W(c)));function f(e){t.onZoomLevelChange?.($U(e))}function p(e){f(W(c)+e)}wg(e,{size:`md`,triggerClass:`h-5.5 rounded-sm px-1.5 text-muted-foreground hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground`,ariaLabel:`Open layout controls`,side:`top`,align:`end`,trigger:e=>{var t=rSe(),n=V(t);l7(n,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var r=L(n,2),i=V(r);d(r),d(t),F(()=>{q(t,`title`,`Layout · Zoom ${W(l)}%`),A(i,`${W(l)??``}%`)}),g(e,t)},children:(e,t)=>{Eg(e,{children:(e,t)=>{var n=aSe(),a=R(n);kg(a,{title:`Layout`,action:e=>{var t=iSe(),n=V(t);d(t),F(()=>A(n,`${W(l)??``}%`)),g(e,t)},$$slots:{action:!0}});var o=L(a,2),m=V(o),h=V(m);{let e=J(()=>W(c)<=-8);G(h,{variant:`ghost`,size:`icon-xs`,ariaLabel:`Zoom out`,title:`Zoom out`,get disabled(){return W(e)},onclick:()=>p(-1),children:(e,t)=>{t7(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}var v=L(h,2);{let e=J(()=>W(c)===0);G(v,{variant:`ghost`,size:`icon-xs`,ariaLabel:`Reset zoom`,title:`Reset zoom`,get disabled(){return W(e)},onclick:()=>f(0),children:(e,t)=>{u7(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}var y=L(v,2);{let e=J(()=>W(c)>=8);G(y,{variant:`ghost`,size:`icon-xs`,ariaLabel:`Zoom in`,title:`Zoom in`,get disabled(){return W(e)},onclick:()=>p(1),children:(e,t)=>{e7(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}d(m);var b=L(m,2),x=V(b);d(b),d(o),Ng(L(o,2),{label:`Panels`,separated:!0,children:(e,t)=>{var n=U();_(R(n),17,r,e=>e.dock,(e,t)=>{let n=J(()=>i[W(t).dock]),r=J(()=>s(W(t).dock));Ig(e,{get label(){return Fo[W(t).dock]},get selected(){return W(t).open},get onclick(){return W(t).onToggle},icon:e=>{var t=U();C(R(t),()=>W(n),(e,t)=>{t(e,{class:`size-4 flex-none text-muted-foreground`,"aria-hidden":`true`})}),g(e,t)},trailing:e=>{var t=U(),n=R(t),i=e=>{iZ(e,{class:`flex-none`,children:(e,t)=>{w();var n=M();F(()=>A(n,W(r))),g(e,n)},$$slots:{default:!0}})};k(n,e=>{W(r)&&e(i)}),g(e,t)},$$slots:{icon:!0,trailing:!0}})}),g(e,n)},$$slots:{default:!0}}),F(()=>A(x,`Zoom level ${W(u)??``}`)),g(e,n)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}}),z()}var sSe=h(`<span class="footer-project-path svelte-y7e2kl"> </span>`),d7=h(`<span class="footer-git-detail svelte-y7e2kl"><!> </span>`),cSe=h(`<span class="footer-git-dot svelte-y7e2kl" aria-label="Uncommitted changes">•</span>`),lSe=h(`<span class="footer-item footer-git svelte-y7e2kl"><!> <span class="footer-git-branch svelte-y7e2kl"> </span> <!> <!> <!></span>`),uSe=h(`<!> <!>`,1),dSe=h(`<span class="footer-item svelte-y7e2kl" title="Running tasks"><!> <span> </span></span>`),fSe=h(`<span class="footer-item warn svelte-y7e2kl" title="Pending approvals"><!> <span> </span></span>`),pSe=h(`<!> <!> <!> <!>`,1),mSe=h(`<span class="inline-flex items-center gap-1" data-tour-id="status-controls"><!> <!></span>`);function hSe(e,t){a(t,!0);let n=I(t,`connection`,3,`connecting`),r=I(t,`live`,3,!1),i=I(t,`pendingApprovals`,3,0),o=I(t,`tasks`,19,()=>[]),s=I(t,`subscriptionUsages`,19,()=>[]),c=I(t,`zoomLevel`,3,0),l=I(t,`dockToggles`,19,()=>[]),u=I(t,`phone`,3,!1),f=J(()=>o().filter(e=>[`starting`,`running`,`ready`,`stopping`].includes(e.status)).length),p=J(()=>t.activeProject?Yd(t.activeProject.dir,t.homeDir):`No project`),m=J(()=>s().some(e=>!!(e.usage?.session??e.usage?.weekly))),h=J(()=>u()&&W(m));function _(e){return`${e} ${e===1?`change`:`changes`}`}function v(e){let t=[e.detached?`Detached HEAD`:`Branch: ${e.branch}`];return e.repoCount>1&&t.unshift(`Repo: ${e.relativePath===`.`?e.repoName:e.relativePath}`),e.changeCount>0&&t.push(_(e.changeCount)),(e.ahead??0)>0&&t.push(`${e.ahead} ahead`),(e.behind??0)>0&&t.push(`${e.behind} behind`),!e.hasUpstream&&!e.detached&&t.push(`No upstream`),t.join(` • `)}qte(e,{get toggles(){return l()},left:e=>{var n=uSe(),r=R(n),i=e=>{c7(e,{get usages(){return s()},compact:!0})},a=e=>{var n=sSe(),r=V(n,!0);d(n),F(()=>{q(n,`title`,t.activeProject?.dir),A(r,W(p))}),g(e,n)};k(r,e=>{W(h)?e(i):e(a,-1)});var o=L(r,2),c=e=>{var n=lSe(),r=V(n);oI(r,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var i=L(r,2),a=V(i,!0);d(i);var o=L(i,2),s=e=>{var n=d7(),r=V(n);Bxe(r,{size:11,strokeWidth:2.1,"aria-hidden":`true`});var i=L(r,1,!0);d(n),F(e=>{q(n,`aria-label`,e),A(i,t.gitStatus.changeCount)},[()=>_(t.gitStatus.changeCount)]),g(e,n)},c=e=>{g(e,cSe())};k(o,e=>{t.gitStatus.changeCount>0?e(s):t.gitStatus.dirty&&e(c,1)});var l=L(o,2),u=e=>{var n=d7(),r=V(n);UJ(r,{size:11,strokeWidth:2.1,"aria-hidden":`true`});var i=L(r,1,!0);d(n),F(()=>{q(n,`aria-label`,`${t.gitStatus.ahead} ahead`),A(i,t.gitStatus.ahead)}),g(e,n)};k(l,e=>{(t.gitStatus.ahead??0)>0&&e(u)});var f=L(l,2),p=e=>{var n=d7(),r=V(n);Dv(r,{size:11,strokeWidth:2.1,"aria-hidden":`true`});var i=L(r,1,!0);d(n),F(()=>{q(n,`aria-label`,`${t.gitStatus.behind} behind`),A(i,t.gitStatus.behind)}),g(e,n)};k(f,e=>{(t.gitStatus.behind??0)>0&&e(p)}),d(n),F(e=>{q(n,`title`,e),A(a,t.gitStatus.branch)},[()=>v(t.gitStatus)]),g(e,n)};k(o,e=>{!u()&&t.gitStatus&&e(c)}),g(e,n)},right:e=>{var a=mSe(),o=V(a),p=e=>{var n=pSe(),r=R(n),a=e=>{var t=dSe(),n=V(t);qu(n,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var r=L(n,2),i=V(r,!0);d(r),d(t),F(()=>A(i,W(f))),g(e,t)};k(r,e=>{W(f)>0&&e(a)});var o=L(r,2),u=e=>{var t=fSe(),n=V(t);pY(n,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var r=L(n,2),a=V(r,!0);d(r),d(t),F(()=>A(a,i())),g(e,t)};k(o,e=>{i()>0&&e(u)});var p=L(o,2);c7(p,{get usages(){return s()}}),oSe(L(p,2),{get zoomLevel(){return c()},get dockToggles(){return l()},get onZoomLevelChange(){return t.onZoomLevelChange}}),g(e,n)};k(o,e=>{u()||e(p)}),Kxe(L(o,2),{get connection(){return n()},get live(){return r()},get status(){return t.status},side:`top`,get compact(){return u()}}),d(a),g(e,a)},$$slots:{left:!0,right:!0}}),z()}var gSe=[`anthropic`,`openai-codex`],_Se={get activeSubscriptionProvider(){return k0.activeSubscriptionProvider},get activeSubscriptionUsage(){return k0.activeSubscriptionUsage},get subscriptionUsages(){let e=k0.activeSubscriptionProvider;return gSe.map(t=>({provider:t,usage:oW.subscriptionUsage[t],active:t===e}))}};function vSe(e,t){a(t,!0);let n=J(()=>If.activeProject),r=J(()=>If.connection),i=J(()=>k0.live),o=J(()=>k0.pendingApprovalCount),s=J(()=>H0.scopedTasks),c=J(()=>A0.gitStatus),l=J(()=>_Se.subscriptionUsages),u=J(()=>If.status),d=J(()=>N0.settingsDraft),f=J(()=>W(d)?.ui.zoomLevel??qU.level),p=J(()=>K0.isCompact),m=J(()=>K0.isPhone),h=J(()=>Po.map(e=>({dock:e,label:Fo[e].toLowerCase(),open:W(p)?e===`left`?e2.primary:e2.secondary:_ue(e),onToggle:()=>l2(e,W(p))})));{let t=J(()=>W(u)?.storage.userHome);hSe(e,{get activeProject(){return W(n)},get connection(){return W(r)},get live(){return W(i)},get pendingApprovals(){return W(o)},get tasks(){return W(s)},get gitStatus(){return W(c)},get subscriptionUsages(){return W(l)},get status(){return W(u)},get homeDir(){return W(t)},get zoomLevel(){return W(f)},get dockToggles(){return W(h)},get phone(){return W(m)},get onZoomLevelChange(){return zW}})}z()}function ySe(e){let t=e-1;return t*t*t+1}function f7(e,{delay:t=0,duration:n=400,easing:r=ySe,start:i=0,opacity:a=0}={}){let o=getComputedStyle(e),s=+o.opacity,c=o.transform===`none`?``:o.transform,l=1-i,u=s*(1-a);return{delay:t,duration:n,easing:r,css:(e,t)=>`
162
+ transform: ${c} scale(${1-l*t});
163
+ opacity: ${s-u*t}
164
+ `}}var p7=N({latest:void 0}),m7=[],h7,g7=!1,_7=!1,v7=!1,y7=1e3,b7=500,bSe=1e4,xSe=[/ResizeObserver loop completed with undelivered notifications\./i,/ResizeObserver loop limit exceeded/i];function SSe(e){return typeof e==`string`&&xSe.some(t=>t.test(e))}function CSe(){g7||typeof window>`u`||(g7=!0,_7=!0,window.addEventListener(`error`,e=>{SSe((e.error instanceof Error?e.error.message:void 0)??e.message)||x7(`error`,`web-runtime`,`Unhandled browser error`,{context:{filename:e.filename,lineno:e.lineno,colno:e.colno},error:e.error??e.message})}),window.addEventListener(`unhandledrejection`,e=>{x7(`error`,`web-runtime`,`Unhandled promise rejection`,{error:e.reason})}))}function x7(e,t,n,r={}){_7&&(m7.push({level:e,component:t,message:n,ts:new Date().toISOString(),durationMs:r.durationMs,context:r.context,error:r.error?TSe(r.error):void 0}),m7.length>200&&m7.splice(0,m7.length-200),S7())}function S7(e=b7){h7===void 0&&(h7=setTimeout(()=>{h7=void 0,wSe()},e))}async function wSe(){if(v7||m7.length===0)return;v7=!0;let e=m7.splice(0,50),t=b7;try{let t=await fetch(`/api/logs/client`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({logs:e})});if(!t.ok)throw Error(`${t.status} ${t.statusText}`);y7=1e3}catch(n){m7.unshift(...e),m7.length>200&&m7.splice(0,m7.length-200),t=y7,y7=Math.min(y7*2,bSe),console.warn(`Failed to submit Nerve client logs`,n)}finally{v7=!1,m7.length>0&&S7(t)}}function TSe(e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(typeof e==`string`)return{message:e};if(e&&typeof e==`object`){let t=ESe(e);return{message:typeof e.message==`string`?e.message:t.split(`
165
+ `,1)[0],stack:t}}return{message:String(e)}}function ESe(e){try{let t=new WeakSet;return JSON.stringify(e,(e,n)=>{if(n&&typeof n==`object`){if(t.has(n))return`[Circular]`;t.add(n)}return n},2)}catch{return String(e)}}async function DSe(){return(await Ar(`status.latestRelease.get`,{})).result}var OSe=60*6e4,C7,w7=!1;function kSe(){T7(),E7(),C7=setInterval(()=>void E7(),OSe)}function T7(){C7!==void 0&&clearInterval(C7),C7=void 0}async function E7(){if(!w7){w7=!0;try{p7.latest=await PG.fetchQuery({queryKey:FG.latestRelease,queryFn:DSe,staleTime:0})}catch(e){x7(`warn`,`releases`,`Latest release check failed`,{error:e})}finally{w7=!1}}}var ASe=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function D7(e){return`v${e.replace(/^v/,``)}`}function jSe(e,t){let n=O7(e),r=O7(t);return!n||!r?!1:MSe(n,r)<0}function O7(e){if(!e)return;let t=ASe.exec(e.trim());if(!t)return;let n=t[4]?.split(`.`)??[];if(!n.some(e=>e.length===0))return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:n}}function MSe(e,t){for(let n of[`major`,`minor`,`patch`])if(e[n]!==t[n])return e[n]<t[n]?-1:1;if(e.prerelease.length===0&&t.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(t.prerelease.length===0)return-1;let n=Math.max(e.prerelease.length,t.prerelease.length);for(let r=0;r<n;r+=1){let n=e.prerelease[r],i=t.prerelease[r];if(n===void 0)return-1;if(i===void 0)return 1;if(n===i)continue;let a=/^\d+$/.test(n),o=/^\d+$/.test(i);return a&&o?Number(n)<Number(i)?-1:1:a===o?n<i?-1:1:a?-1:1}return 0}var NSe=h(`<a target="_blank" rel="noreferrer" class="flex-none cursor-pointer text-xs text-muted-foreground underline-offset-2 hover:underline focus-visible:underline focus-visible:outline-none"> </a>`),k7=h(`<span class="inline-flex"><!></span>`),PSe=h(`<span class="text-muted-foreground">Run the latest release</span> <div class="flex items-center rounded-sm bg-muted pl-2 pr-1"><code class="min-w-0 flex-1 select-text py-1.5 text-foreground"></code> <!></div> <span class="mt-1 text-muted-foreground">Or pin this release</span> <div class="flex items-center rounded-sm bg-muted pl-2 pr-1"><code class="min-w-0 flex-1 select-text py-1.5 text-foreground"> </code> <!></div>`,1),FSe=h(`<p class="text-warning"> </p> <!> <span class="text-muted-foreground">Select the latest version above to open the release notes.</span>`,1),ISe=h(`<p class="text-muted-foreground">No newer stable release is available. Select the latest version above
166
+ to open the release notes.</p>`),LSe=h(`<p class="text-muted-foreground">The latest release could not be checked. Nerve will retry
167
+ automatically.</p>`),RSe=h(`<!> <!>`,1),zSe=h(`<span><!></span>`);function BSe(e,t){a(t,!0);let n=J(()=>D7(t.currentVersion)),r=J(()=>t.latestRelease?D7(t.latestRelease.version):void 0),i=J(()=>jSe(t.currentVersion,t.latestRelease?.version)),c=J(()=>W(i)&&W(r)?`Nerve ${W(n)}; update available: ${W(r)}`:W(r)?`Nerve ${W(n)}; no newer stable release detected`:`Nerve ${W(n)}; latest release check unavailable`),l=J(()=>t.latestRelease?`npx @nervekit/desktop@${t.latestRelease.version}`:``),u=Y(void 0),f;async function p(e,t){try{await Ju(e)}catch{return}K(u,t,!0),f!==void 0&&clearTimeout(f),f=setTimeout(()=>{K(u,void 0),f=void 0},1500)}ke(()=>{f!==void 0&&clearTimeout(f)});var m=zSe(),h=V(m);{let e=e=>{w();var t=M();F(()=>A(t,W(n))),g(e,t)},a=J(()=>`cursor-pointer rounded-sm border border-border bg-transparent px-1.5 py-0.5 font-mono text-xs font-medium leading-none text-muted-foreground transition-colors hover:bg-accent ${W(i)?`is-outdated`:``}`);wg(h,{get ariaLabel(){return W(c)},side:`bottom`,align:`end`,size:`md`,get triggerClass(){return W(a)},trigger:e,children:(e,a)=>{Eg(e,{children:(e,a)=>{var s=RSe(),c=R(s);{let e=e=>{var n=U(),i=R(n),a=e=>{var n=NSe(),i=V(n);d(n),F(()=>{q(n,`href`,t.latestRelease.releaseUrl),A(i,`Latest ${W(r)??``}`)}),g(e,n)};k(i,e=>{W(r)&&t.latestRelease&&e(a)}),g(e,n)},i=J(()=>`Nerve ${W(n)}`);kg(c,{get title(){return W(i)},action:e,$$slots:{action:!0}})}var f=L(c,2),m=e=>{var t=FSe(),n=R(t),i=V(n);d(n),Ng(L(n,2),{separated:!0,children:(e,t)=>{var n=PSe(),r=L(R(n),2),i=V(r);i.textContent=`npx @nervekit/desktop@latest`;var a=L(i,2);{let e=J(()=>W(u)===`latest`?`Latest release command copied`:`Copy latest release command`),t=J(()=>W(u)===`latest`?`Copied`:`Copy command`);G(a,{variant:`ghost`,size:`icon-xs`,get ariaLabel(){return W(e)},get title(){return W(t)},onclick:()=>void p(`npx @nervekit/desktop@latest`,`latest`),children:(e,t)=>{var n=U();o(R(n),()=>W(u)===`latest`,e=>{var t=U(),n=R(t),r=e=>{var t=k7();$I(V(t),{class:`size-3.5 text-success`,"aria-hidden":`true`}),d(t),b(3,t,()=>f7,()=>({duration:120})),g(e,t)},i=e=>{var t=k7();Bu(V(t),{class:`size-3.5`,"aria-hidden":`true`}),d(t),b(3,t,()=>f7,()=>({duration:120})),g(e,t)};k(n,e=>{W(u)===`latest`?e(r):e(i,-1)}),g(e,t)}),g(e,n)},$$slots:{default:!0}})}d(r);var s=L(r,4),c=V(s),f=V(c,!0);d(c);var m=L(c,2);{let e=J(()=>W(u)===`pinned`?`Pinned release command copied`:`Copy pinned release command`),t=J(()=>W(u)===`pinned`?`Copied`:`Copy command`);G(m,{variant:`ghost`,size:`icon-xs`,get ariaLabel(){return W(e)},get title(){return W(t)},onclick:()=>void p(W(l),`pinned`),children:(e,t)=>{var n=U();o(R(n),()=>W(u)===`pinned`,e=>{var t=U(),n=R(t),r=e=>{var t=k7();$I(V(t),{class:`size-3.5 text-success`,"aria-hidden":`true`}),d(t),b(3,t,()=>f7,()=>({duration:120})),g(e,t)},i=e=>{var t=k7();Bu(V(t),{class:`size-3.5`,"aria-hidden":`true`}),d(t),b(3,t,()=>f7,()=>({duration:120})),g(e,t)};k(n,e=>{W(u)===`pinned`?e(r):e(i,-1)}),g(e,t)}),g(e,n)},$$slots:{default:!0}})}d(s),F(()=>A(f,W(l))),g(e,n)},$$slots:{default:!0}}),w(2),F(()=>A(i,`This version is out of date. Update to ${W(r)??``} to use the latest stable
168
+ release.`)),g(e,t)},h=e=>{g(e,ISe())},_=e=>{g(e,LSe())};k(f,e=>{W(i)&&W(r)&&t.latestRelease?e(m):W(r)?e(h,1):e(_,-1)}),g(e,s)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}})}d(m),F(()=>s(m,1,`version-indicator inline-flex ${W(i)?``:`max-sm:hidden`}`,`svelte-10mwu6d`)),g(e,m),z()}var VSe=new Set([`$$slots`,`$$events`,`$$legacy`]);function HSe(e,t){let n=H(t,VSe),r=[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`}]];P(e,B({name:`diamond`},()=>n,{get iconNode(){return r}}))}var USe=new Set([`$$slots`,`$$events`,`$$legacy`]);function WSe(e,t){let n=H(t,USe),r=[[`path`,{d:`M5 12h14`}]];P(e,B({name:`minus`},()=>n,{get iconNode(){return r}}))}var GSe=j(`<path d="m22.5 57.8 35.3-35.3c1.4-1.4 3.6-1.4 5 0l.1.1c1.4 1.4 1.4 3.6 0 5L27.6 62.9c-1.4 1.4-3.6 1.4-5 0l-.1-.1c-1.3-1.4-1.3-3.6 0-5Z"></path><path d="m27.6 22.5 35.3 35.3c1.4 1.4 1.4 3.6 0 5l-.1.1c-1.4 1.4-3.6 1.4-5 0L22.5 27.6c-1.4-1.4-1.4-3.6 0-5l.1-.1c1.4-1.3 3.6-1.3 5 0Z"></path>`,1),KSe=j(`<path d="M17.8 39.1h49.9c1.9 0 3.5 1.6 3.5 3.5v.1c0 1.9-1.6 3.5-3.5 3.5H17.8c-1.9 0-3.5-1.6-3.5-3.5v-.1c0-1.9 1.5-3.5 3.5-3.5Z"></path>`),qSe=j(`<path d="M31.2 20.8h26.7c3.6 0 6.5 2.9 6.5 6.5V54Zm23.2 43.7H27.6c-3.6 0-6.5-2.9-6.5-6.5V31.2Z"></path>`),JSe=j(`<svg viewBox="0 0 85.4 85.4" aria-hidden="true" focusable="false"><circle cx="42.7" cy="42.7" r="42.7"></circle><circle cx="42.7" cy="42.7" r="39.1"></circle><g class="opacity-0 group-hover/window-controls:opacity-100 group-focus-within/window-controls:opacity-100"><!></g></svg>`);function A7(e,t){let n={close:{border:`#e24b41`,fill:`#ed6a5f`,symbol:`#460804`},minimize:{border:`#e1a73e`,fill:`#f6be50`,symbol:`#90591d`},maximize:{border:`#2dac2f`,fill:`#61c555`,symbol:`#2a6218`}};var r=JSe(),i=V(r),a=L(i),o=L(a),c=V(o),l=e=>{var t=GSe();w(),g(e,t)},u=e=>{g(e,KSe())},f=e=>{g(e,qSe())};k(c,e=>{t.kind===`close`?e(l):t.kind===`minimize`?e(u,1):e(f,-1)}),d(o),d(r),F(()=>{s(r,0,x(t.class)),q(i,`fill`,n[t.kind].border),q(a,`fill`,n[t.kind].fill),q(o,`fill`,n[t.kind].symbol)}),g(e,r)}var YSe=h(`<div class="group/window-controls mr-1.5 flex flex-none items-center gap-2 [-webkit-app-region:no-drag]" aria-label="Window controls"><button type="button" class="size-3.5 rounded-full p-0 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50"><!></button> <button type="button" class="size-3.5 rounded-full p-0 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50" aria-label="Minimize window" title="Minimize"><!></button> <button type="button" class="size-3.5 rounded-full p-0 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50"><!></button></div>`),j7=h(`<div class="flex flex-none items-center gap-0.5 [-webkit-app-region:no-drag]" aria-label="Window controls"><!> <!> <!></div>`),M7=h(`<span class="flex size-4.5 items-center justify-center rounded-full group-hover/linux-control:bg-foreground group-hover/linux-control:text-background group-focus-visible/linux-control:bg-foreground group-focus-visible/linux-control:text-background"><!></span>`),XSe=h(`<span class="flex size-4.5 items-center justify-center rounded-full group-hover/linux-control:bg-destructive/20 group-hover/linux-control:text-destructive group-focus-visible/linux-control:bg-destructive/20 group-focus-visible/linux-control:text-destructive"><!></span>`);function N7(e,t){a(t,!0);let n=I(t,`maximized`,3,!1),i=I(t,`closeToTray`,3,!0),o=I(t,`quitting`,3,!1),s=J(()=>o()?`Closing Nerve`:i()?`Close window to tray`:`Close Nerve`),c=J(()=>o()?`Closing Nerve…`:i()?`Close to tray`:`Close Nerve`);var l=U(),u=R(l),f=e=>{var i=YSe(),a=V(i),l=V(a),u=e=>{Fi(e,{class:`size-3.5`})},f=e=>{A7(e,{kind:`close`,class:`size-3.5`})};k(l,e=>{o()?e(u):e(f,-1)}),d(a);var p=L(a,2);A7(V(p),{kind:`minimize`,class:`size-3.5`}),d(p);var m=L(p,2);A7(V(m),{kind:`maximize`,class:`size-3.5`}),d(m),d(i),F(()=>{q(a,`aria-label`,W(s)),q(a,`title`,W(c)),a.disabled=o(),p.disabled=o(),q(m,`aria-label`,n()?`Restore window`:`Maximize window`),q(m,`title`,n()?`Restore`:`Maximize`),m.disabled=o()}),r(`click`,a,()=>t.onClose?.()),r(`click`,p,()=>t.onMinimize?.()),r(`click`,m,()=>t.onToggleMaximize?.()),g(e,i)},p=e=>{var r=j7(),i=V(r);G(i,{variant:`ghost`,size:`icon-sm`,class:`size-7 rounded-full`,ariaLabel:`Minimize window`,title:`Minimize`,get disabled(){return o()},onclick:()=>t.onMinimize?.(),children:(e,t)=>{WSe(e,{class:`size-3.5`,strokeWidth:1.75})},$$slots:{default:!0}});var a=L(i,2);{let e=J(()=>n()?`Restore window`:`Maximize window`),r=J(()=>n()?`Restore`:`Maximize`);G(a,{variant:`ghost`,size:`icon-sm`,class:`size-7 rounded-full`,get ariaLabel(){return W(e)},get title(){return W(r)},get disabled(){return o()},onclick:()=>t.onToggleMaximize?.(),children:(e,t)=>{var r=U(),i=R(r),a=e=>{Bu(e,{class:`size-3`,strokeWidth:1.75})},o=e=>{fg(e,{class:`size-3`,strokeWidth:1.75})};k(i,e=>{n()?e(a):e(o,-1)}),g(e,r)},$$slots:{default:!0}})}G(L(a,2),{variant:`ghost`,size:`icon-sm`,class:`size-7 rounded-full hover:bg-destructive-solid hover:text-destructive-solid-foreground focus-visible:bg-destructive-solid focus-visible:text-destructive-solid-foreground`,get ariaLabel(){return W(s)},get title(){return W(c)},get disabled(){return o()},onclick:()=>t.onClose?.(),children:(e,t)=>{var n=U(),r=R(n),i=e=>{Fi(e,{})},a=e=>{yl(e,{class:`size-3.5`,strokeWidth:1.75})};k(r,e=>{o()?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}}),d(r),g(e,r)},m=e=>{var r=j7(),i=V(r);G(i,{variant:`ghost`,size:`icon-sm`,class:`group/linux-control size-7 rounded-full hover:bg-transparent focus-visible:bg-transparent`,ariaLabel:`Minimize window`,title:`Minimize`,get disabled(){return o()},onclick:()=>t.onMinimize?.(),children:(e,t)=>{var n=M7();ln(V(n),{class:`size-3.5`,strokeWidth:2}),d(n),g(e,n)},$$slots:{default:!0}});var a=L(i,2);{let e=J(()=>n()?`Restore window`:`Maximize window`),r=J(()=>n()?`Restore`:`Maximize`);G(a,{variant:`ghost`,size:`icon-sm`,class:`group/linux-control size-7 rounded-full hover:bg-transparent focus-visible:bg-transparent`,get ariaLabel(){return W(e)},get title(){return W(r)},get disabled(){return o()},onclick:()=>t.onToggleMaximize?.(),children:(e,t)=>{var r=M7(),i=V(r),a=e=>{HSe(e,{class:`size-2.5`,strokeWidth:2})},o=e=>{XF(e,{class:`size-3.5`,strokeWidth:2})};k(i,e=>{n()?e(a):e(o,-1)}),d(r),g(e,r)},$$slots:{default:!0}})}G(L(a,2),{variant:`ghost`,size:`icon-sm`,class:`group/linux-control size-7 rounded-full hover:bg-transparent focus-visible:bg-transparent`,get ariaLabel(){return W(s)},get title(){return W(c)},get disabled(){return o()},onclick:()=>t.onClose?.(),children:(e,t)=>{var n=U(),r=R(n),i=e=>{Fi(e,{})},a=e=>{var t=XSe();yl(V(t),{class:`size-3.5`,strokeWidth:2}),d(t),g(e,t)};k(r,e=>{o()?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}}),d(r),g(e,r)};k(u,e=>{t.headerType===`macos`?e(f):t.headerType===`windows`?e(p,1):e(m,-1)}),g(e,l),z()}T([`click`]);var P7=h(`<span class="inline-flex items-center gap-1.5 text-foreground"><span class="brand-mark svelte-a35yzb"><!></span></span> <span class="h-5 w-px bg-border" aria-hidden="true"></span> <!>`,1),ZSe=h(`<span class="absolute -right-1 -top-1 inline-flex min-w-4 items-center justify-center rounded-full bg-info px-1 text-xs font-medium text-info-foreground" aria-hidden="true"> </span>`),QSe=h(`<!> <!>`,1),$Se=h(`<span class="mx-0.5 h-5 w-px bg-border" aria-hidden="true"></span> <!>`,1),eCe=h(`<!> <!> <!> <!> <!> <!>`,1);function tCe(e,t){a(t,!0);let n=I(t,`projects`,19,()=>[]),r=I(t,`desktop`,3,!1),i=I(t,`headerType`,3,`linux`),o=I(t,`maximized`,3,!1),s=I(t,`closeToTray`,3,!0),c=I(t,`quitting`,3,!1),l=I(t,`settingsActive`,3,!1),u=I(t,`guideActive`,3,!1),f=I(t,`incompleteGuideCount`,3,0),p=I(t,`authActive`,3,!1),m=I(t,`logsActive`,3,!1),h=I(t,`applicationLogsEnabled`,3,!1);Yte(e,{get desktop(){return r()},leadingControls:e=>{var n=U(),a=R(n),l=e=>{N7(e,{get headerType(){return i()},get maximized(){return o()},get closeToTray(){return s()},get quitting(){return c()},get onMinimize(){return t.onMinimize},get onToggleMaximize(){return t.onToggleMaximize},get onClose(){return t.onClose}})};k(a,e=>{r()&&i()===`macos`&&e(l)}),g(e,n)},left:e=>{var r=P7(),i=R(r),a=V(i);Bv(V(a),{compact:!0}),d(a),d(i),$le(L(i,4),{get items(){return n()},get activeKey(){return t.activeProjectKey},get buildMenuItems(){return t.buildProjectMenuItems},get onSelect(){return t.onSelectProject},get onOpenPicker(){return t.onOpenProject}}),g(e,r)},actions:e=>{var n=U();C(R(n),()=>Pc,(e,n)=>{n(e,{class:`flex min-w-0 flex-none items-center gap-1.5 [-webkit-app-region:no-drag]`,"aria-label":`Application actions`,children:(e,n)=>{var a=eCe(),_=R(a),v=e=>{BSe(e,{get currentVersion(){return t.currentVersion},get latestRelease(){return t.latestRelease}})};k(_,e=>{t.currentVersion&&e(v)});var y=L(_,2);{let e=J(()=>f()>0?`Open Nerve guides, ${f()} incomplete`:`Open Nerve guides`);G(y,{variant:`ghost`,size:`icon-sm`,class:`relative max-sm:hidden`,"data-tour-id":`help`,get ariaLabel(){return W(e)},title:`Open Nerve guides`,get active(){return u()},get pressed(){return u()},onclick:()=>t.onOpenGuide?.(),children:(e,t)=>{var n=QSe(),r=R(n);IP(r,{size:16,strokeWidth:2.1});var i=L(r,2),a=e=>{var t=ZSe(),n=V(t,!0);d(t),F(()=>A(n,f())),g(e,t)};k(i,e=>{f()>0&&e(a)}),g(e,n)},$$slots:{default:!0}})}var b=L(y,2),x=e=>{G(e,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Open Nerve logs`,title:`Open Nerve logs`,get active(){return m()},get pressed(){return m()},onclick:()=>t.onOpenLogs?.(),children:(e,t)=>{Gu(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}})};k(b,e=>{h()&&e(x)});var S=L(b,2);G(S,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Open authentication`,title:`Providers & authentication`,"data-tour-id":`providers`,get active(){return p()},get pressed(){return p()},onclick:()=>t.onOpenAuth?.(),children:(e,t)=>{Wu(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}});var C=L(S,2);G(C,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Open settings`,title:`Open settings`,"data-tour-id":`settings`,get active(){return l()},get pressed(){return l()},onclick:()=>t.onOpenSettings?.(),children:(e,t)=>{Ku(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}});var w=L(C,2),T=e=>{var n=$Se();N7(L(R(n),2),{get headerType(){return i()},get maximized(){return o()},get closeToTray(){return s()},get quitting(){return c()},get onMinimize(){return t.onMinimize},get onToggleMaximize(){return t.onToggleMaximize},get onClose(){return t.onClose}}),g(e,n)};k(w,e=>{r()&&i()!==`macos`&&e(T)}),g(e,a)},$$slots:{default:!0}})}),g(e,n)},$$slots:{leadingControls:!0,left:!0,actions:!0}}),z()}var nCe=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`value`]);function F7(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`value`,15,``),i=H(t,nCe);var o=U(),s=R(o);{let e=J(()=>me(`grid gap-3 w-full`,t.class));C(s,()=>fc,(t,a)=>{a(t,B({"data-slot":`radio-group`,get class(){return W(e)}},()=>i,{get ref(){return n()},set ref(e){n(e)},get value(){return r()},set value(e){r(e)}}))})}g(e,o),z()}var rCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function iCe(e,t){let n=H(t,rCe),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]];On(e,B({name:`circle`},()=>n,{get iconNode(){return r}}))}var aCe=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`size`]),oCe=h(`<div data-slot="radio-group-indicator" class="flex size-full items-center justify-center"><!></div>`);function I7(e,t){a(t,!0);let n=I(t,`ref`,15,null),r=I(t,`size`,3,`default`),i=H(t,aCe);var o=U(),s=R(o);{let e=(e,t)=>{let n=()=>t?.().checked;var i=oCe(),a=V(i),o=e=>{{let t=J(()=>me(`bg-primary-foreground absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full`,r()===`sm`?`size-1.5`:`size-2`));iCe(e,{get class(){return W(t)}})}};k(a,e=>{n()&&e(o)}),d(i),g(e,i)},a=J(()=>me(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex rounded-full data-[size=default]:size-4 data-[size=sm]:size-3.5 focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,t.class));C(s,()=>hc,(t,o)=>{o(t,B({"data-slot":`radio-group-item`,get"data-size"(){return r()},get class(){return W(a)}},()=>i,{get ref(){return n()},set ref(e){n(e)},children:e,$$slots:{default:!0}}))})}g(e,o),z()}var sCe=h(`<span class="text-xs leading-snug text-muted-foreground"> </span>`),cCe=h(`<!> <span class="grid min-w-0 gap-0.5"><span class="text-sm font-medium leading-tight"> </span> <!></span>`,1);function lCe(e,t){a(t,!0);let n=I(t,`items`,19,()=>[]),r=I(t,`value`,15,``),i=I(t,`orientation`,3,`vertical`),o=I(t,`disabled`,3,!1);var s=U(),c=R(s);{let e=J(()=>me(`grid gap-2`,i()===`horizontal`&&`grid-cols-[repeat(auto-fit,minmax(9rem,1fr))]`,t.class));C(c,()=>F7,(a,s)=>{s(a,{get orientation(){return i()},get disabled(){return o()},get"aria-label"(){return t.ariaLabel},get onValueChange(){return t.onValueChange},get class(){return W(e)},get value(){return r()},set value(e){r(e)},children:(e,t)=>{var r=U();_(R(r),17,n,e=>e.value,(e,t)=>{dX(e,{class:`flex cursor-pointer items-start gap-2.5 rounded-md border border-border bg-input/30 p-3 transition-colors hover:bg-accent/50 has-data-[state=checked]:border-primary has-data-[state=checked]:bg-accent`,children:(e,n)=>{var r=cCe(),i=R(r);C(i,()=>I7,(e,n)=>{n(e,{get value(){return W(t).value},get disabled(){return W(t).disabled},class:`mt-0.5`})});var a=L(i,2),o=V(a),s=V(o,!0);d(o);var c=L(o,2),l=e=>{var n=sCe(),r=V(n,!0);d(n),F(()=>A(r,W(t).detail)),g(e,n)};k(c,e=>{W(t).detail&&e(l)}),d(a),F(()=>A(s,W(t).label)),g(e,r)},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}})})}g(e,s),z()}var uCe=h(`<!> <!>`,1),dCe=h(`<div class="prune-body svelte-1bkj6xz"><!> <div class="prune-control svelte-1bkj6xz"><!></div> <p class="prune-summary svelte-1bkj6xz">Removes up to <strong class="svelte-1bkj6xz"> </strong> </p></div>`);function fCe(e,t){a(t,!0);let n=I(t,`open`,15,!1),r=I(t,`projectLabel`,3,``),i=I(t,`totalCount`,3,0),o=I(t,`ageEligible`,3,()=>0),s=I(t,`keepEligible`,3,()=>0),c=[{value:`olderThanDays`,label:`By age`,detail:`Remove conversations not updated within the selected window.`},{value:`keepLatest`,label:`By count`,detail:`Keep the most recent conversations and remove the rest.`}],l=[{value:`1`,label:`Older than 1 day`},{value:`2`,label:`Older than 2 days`},{value:`3`,label:`Older than 3 days`},{value:`7`,label:`Older than 7 days`},{value:`14`,label:`Older than 14 days`},{value:`30`,label:`Older than 30 days`},{value:`90`,label:`Older than 90 days`}],u=[{value:`5`,label:`Keep the latest 5`},{value:`10`,label:`Keep the latest 10`},{value:`20`,label:`Keep the latest 20`},{value:`50`,label:`Keep the latest 50`},{value:`100`,label:`Keep the latest 100`}],f=Y(`olderThanDays`),p=Y(`7`),m=Y(`20`),h=J(()=>W(f)===`olderThanDays`?o()(Number(W(p))):s()(Number(W(m))));function _(){return W(f)===`olderThanDays`?{strategy:`olderThanDays`,olderThanDays:Number(W(p))}:{strategy:`keepLatest`,keepLatest:Number(W(m))}}function v(){t.onConfirm?.(_()),n(!1),t.onOpenChange?.(!1)}function y(e){n(e),t.onOpenChange?.(e)}{let t=e=>{var t=uCe(),n=R(t);G(n,{size:`sm`,variant:`ghost`,onclick:()=>y(!1),children:(e,t)=>{w(),g(e,M(`Cancel`))},$$slots:{default:!0}});var r=L(n,2);{let e=J(()=>W(h)===0);G(r,{size:`sm`,variant:`destructive`,onclick:v,get disabled(){return W(e)},children:(e,t)=>{w(),g(e,M(`Clean up`))},$$slots:{default:!0}})}g(e,t)},a=J(()=>r()?`Choose how to clean up conversations in “${r()}”.`:`Choose how to clean up conversations.`);sP(e,{title:`Clean up conversations`,get description(){return W(a)},size:`sm`,onOpenChange:y,get open(){return n()},set open(e){n(e)},footer:t,children:(e,t)=>{var n=dCe(),r=V(n);lCe(r,{get items(){return c},ariaLabel:`Cleanup strategy`,get value(){return W(f)},set value(e){K(f,e,!0)}});var a=L(r,2),o=V(a),s=e=>{nn(e,{get items(){return l},ariaLabel:`Age window`,get value(){return W(p)},set value(e){K(p,e,!0)}})},_=e=>{nn(e,{get items(){return u},ariaLabel:`Conversations to keep`,get value(){return W(m)},set value(e){K(m,e,!0)}})};k(o,e=>{W(f)===`olderThanDays`?e(s):e(_,-1)}),d(a);var v=L(a,2),y=L(V(v)),b=V(y,!0);d(y);var x=L(y);d(v),d(n),F(()=>{A(b,W(h)),A(x,` of ${i()??``} conversation${i()===1?``:`s`}. Active conversations and tasks are skipped.`)}),g(e,n)},$$slots:{footer:!0,default:!0}})}z()}var L7=[{id:`open-project`,version:1,title:`Open a project`,description:`Choose a project folder so Nerve can keep conversations, files, Git changes, and agent work together.`,priority:`must-do`,lifecycle:`available`,actionLabel:`Start guide`,run:{kind:`setup-coach`,area:`open-project`},completionSignal:`project-open`},{id:`provider`,version:1,title:`Connect a model provider`,description:`Authenticate a subscription, API key, or compatible custom provider before prompting an agent.`,priority:`must-do`,lifecycle:`available`,actionLabel:`Start guide`,run:{kind:`setup-coach`,area:`provider`},completionSignal:`provider-ready`},{id:`voice`,version:1,title:`Enable voice input`,description:`Connect an OpenAI Codex subscription to dictate prompts from the composer.`,priority:`highly-recommended`,lifecycle:`available`,actionLabel:`Start guide`,run:{kind:`setup-coach`,area:`voice`},completionSignal:`voice-ready`},{id:`scoped-models`,version:1,title:`Configure scoped models`,description:`Choose which authenticated models appear in the composer so model selection stays focused.`,priority:`highly-recommended`,lifecycle:`available`,actionLabel:`Start guide`,run:{kind:`setup-coach`,area:`scoped-models`}},{id:`agent-defaults`,version:1,title:`Configure agent defaults`,description:`Choose the mode, permissions, model, and thinking defaults used by new agents.`,priority:`highly-recommended`,lifecycle:`available`,actionLabel:`Start guide`,run:{kind:`setup-coach`,area:`agent-defaults`}},{id:`workbench`,version:1,title:`Work through the Workbench`,description:`Tour conversations, composer controls, panels, Git workflows, tasks, providers, settings, and Help.`,priority:`highly-recommended`,lifecycle:`available`,actionLabel:`Start tour`,run:{kind:`workbench-tour`}}];function pCe(e,t,n){let r=e.completionSignal?n[e.completionSignal]:void 0;return{...e,available:e.lifecycle!==`upcoming`,ready:r,completed:(t[e.id]??0)>=e.version||r===!0}}function mCe(e,t,n){return e.map(e=>pCe(e,t,n))}function hCe(e,t){return e.filter(e=>e.available&&e.ready===!0&&(t[e.id]??0)<e.version).map(e=>e.id)}function gCe(e){return e.filter(e=>e.available&&!e.completed).length}function R7(e){let t=e.findIndex(e=>e.available&&!e.completed);return t<0?0:t}function _Ce(e,t,n){return t<=0?0:Math.min(t-1,Math.max(0,e+n))}function vCe(e){return e.progressiveActive&&e.settingsLoaded&&e.incompleteCount>0&&e.consideredGeneration!==e.generation}var z7=`nerve.guides.completion`,yCe=`nerve.product-tour.completed-version`,bCe=new Set(L7.map(e=>e.id));function B7(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}function V7(e){return Number.isSafeInteger(e)&&Number(e)>=0}function H7(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))bCe.has(n)&&V7(r)&&(t[n]=r);return t}function xCe(e=B7()){if(!e)return{};try{let t=e.getItem(z7);if(t){let e=JSON.parse(t);return e.schemaVersion===1?H7(e.guides):{}}let n=e.getItem(yCe);if(!n||!/^(0|[1-9]\d*)$/.test(n))return{};let r=Number(n);return Number.isSafeInteger(r)?{workbench:r}:{}}catch{return{}}}function SCe(e,t=B7()){if(t)try{let n={schemaVersion:1,guides:H7(e)};t.setItem(z7,JSON.stringify(n))}catch{}}function U7(e,t,n){return!V7(n)||(e[t]??0)>=n?e:{...e,[t]:n}}var W7=[{id:`conversations`,introducedIn:1,title:`Your project conversations`,description:`The Conversations panel keeps every saved conversation for the active project together. Return here to reopen previous work or start something new.`,targetId:`conversations-tab`},{id:`panel-new-conversation`,introducedIn:1,title:`Start from the Conversations panel`,description:`Use New chat in the Conversations panel header to create a conversation in the active project.`,targetId:`panel-new-conversation`},{id:`tab-new-conversation`,introducedIn:1,title:`Start from the editor tabs`,description:`The plus action beside the center editor tabs creates the same new conversation without leaving your current workspace.`,targetId:`tab-new-conversation`},{id:`composer`,introducedIn:1,title:`Write the first prompt`,description:`The tour has opened a pending conversation. Type a prompt here, drop files into the composer, paste images, or use suggestions to begin.`,targetId:`composer`},{id:`permission`,introducedIn:1,title:`Choose a permission level`,description:`Permission controls whether the agent can only read, asks before tool calls, or works autonomously. You can change it before sending a prompt.`,targetId:`composer-permission`},{id:`mode`,introducedIn:1,title:`Switch between coding and planning`,description:`Coding mode implements changes. Planning mode inspects and prepares a reviewed approach before edits.`,targetId:`composer-mode`},{id:`context`,introducedIn:1,title:`Watch context usage`,description:`Open context details to inspect the active model window and compact a long conversation when needed.`,targetId:`composer-context`},{id:`model`,introducedIn:1,title:`Pick the model and thinking level`,description:`Choose an available scoped model and its thinking level for this conversation before the run starts.`,targetId:`composer-model`},{id:`send`,introducedIn:1,title:`Send or dictate your prompt`,description:`Use voice input to dictate when it is configured, then send the prompt to start the agent run.`,targetId:`composer-send-actions`},{id:`history`,introducedIn:1,title:`Navigate and branch conversations`,description:`Conversation History is a graph of messages and branches. Jump to an earlier point or edit from the middle without losing the original path.`,targetId:`conversation-history`},{id:`git`,introducedIn:1,title:`Review Git changes`,description:`Inspect the working tree, review file diffs, and use branch, fetch, and sync actions from the Git Changes panel.`,targetId:`git-workflow`,fallback:`Open a Git project to review local changes.`},{id:`pull-requests`,introducedIn:1,title:`Manage pull requests`,description:`Open GitHub pull requests to inspect checks, commits, changed files, linked conversations, and merge readiness.`,targetId:`pull-request-workflow`,fallback:`Open a GitHub project to use pull request workflows.`},{id:`tasks`,introducedIn:1,title:`Track reusable tasks`,description:`The Tasks panel organizes saved task definitions and their runs so you can launch, monitor, and revisit repeatable agent work.`,targetId:`tasks-panel`},{id:`files`,introducedIn:1,title:`Browse project files`,description:`Use the Files panel to navigate the active project tree, inspect Git status, and open files in the center workspace.`,targetId:`files-panel`},{id:`scratch-notes`,introducedIn:1,title:`Keep scratch notes`,description:`Scratch Notes keeps lightweight project notes close to the conversation without mixing them into agent history.`,targetId:`scratch-notes-panel`},{id:`context-panel`,introducedIn:1,title:`Inspect conversation context`,description:`The Context panel shows the files and other context attached to the active conversation so you can understand what the agent can use.`,targetId:`context-panel`},{id:`providers`,introducedIn:1,title:`Manage model providers`,description:`Open Providers and authentication from the titlebar to connect subscriptions, API keys, and custom model providers.`,targetId:`providers`},{id:`settings`,introducedIn:1,title:`Customize Nerve`,description:`Settings is the central place for workbench preferences, scoped models, agent defaults, suggestions, tools, skills, storage, and system options.`,targetId:`settings`},{id:`status`,introducedIn:1,title:`Usage and live status`,description:`The status bar tracks subscription usage, background tasks, pending approvals, Git state, connection health, layout controls, and zoom.`,targetId:`status-controls`},{id:`help`,introducedIn:1,title:`Return to Nerve guides`,description:`Use Help in the titlebar whenever you want to reopen the Guides catalog or replay a completed guide.`,targetId:`help`},{id:`finish`,introducedIn:1,title:`You are ready to explore`,description:`Your project and Workbench are ready. Return to Nerve guides whenever you want a refresher or new guidance appears.`}];function CCe(e,t,n){return e.filter(e=>n||e.introducedIn>t)}function wCe(e,t,n){return t<=0?0:Math.min(t-1,Math.max(0,e+n))}function TCe(e){let t=e.gap??12,n=e.margin??12,r=Math.max(n,e.viewportWidth-e.calloutWidth-n),i=Math.min(r,Math.max(n,(e.viewportWidth-e.calloutWidth)/2));if(e.centered)return{top:Math.max(n,(e.viewportHeight-e.calloutHeight)/2),left:i,side:`center`};if(e.compact||!e.target)return{top:Math.max(n,e.viewportHeight-e.calloutHeight-n),left:i,side:`center`};let a=e.target.left+e.target.width/2,o=Math.min(r,Math.max(n,a-e.calloutWidth/2));if(e.target.bottom+t+e.calloutHeight<=e.viewportHeight-n)return{top:e.target.bottom+t,left:o,side:`bottom`};if(e.target.top-t-e.calloutHeight>=n)return{top:e.target.top-t-e.calloutHeight,left:o,side:`top`};let s=Math.max(n,e.viewportHeight-e.calloutHeight-n),c=e.target.top+e.target.height/2,l=Math.min(s,Math.max(n,c-e.calloutHeight/2));return e.target.right+t+e.calloutWidth<=e.viewportWidth-n?{top:l,left:e.target.right+t,side:`right`}:e.target.left-t-e.calloutWidth>=n?{top:l,left:e.target.left-t-e.calloutWidth,side:`left`}:{top:Math.max(n,(e.viewportHeight-e.calloutHeight)/2),left:i,side:`center`}}var ECe={"open-project":[{id:`open-project-switcher`,title:`Open the project switcher`,description:`Use the project control in the titlebar to open or switch projects.`,targetId:`guide-project-open`,fallback:`Choose the project icon in the titlebar.`,advanceByClickingTarget:!0},{id:`open-project-browse`,title:`Browse for a project`,description:`Choose Browse to find and open a project folder from your computer.`,targetId:`guide-project-browse`,fallback:`The project browser is already open when there are no recent projects.`}],provider:[{id:`provider-subscription`,title:`Connect a subscription`,description:`Use Connections to authenticate a supported subscription provider.`,targetId:`setup-auth-connect-subscription`,fallback:`Open Connections → Subscriptions and choose Connect subscription.`,preparation:{kind:`auth`,pageId:`connections`,sectionId:`subscriptions`}},{id:`provider-api-key`,title:`Add an API key`,description:`API keys are another direct way to connect a model provider. Compatible local or self-hosted endpoints can instead be added from Custom providers.`,targetId:`setup-auth-add-api-key`,fallback:`Open Connections → API keys and choose Add API key. Custom providers remain available separately for compatible local or self-hosted endpoints.`,preparation:{kind:`auth`,pageId:`connections`,sectionId:`api-keys`}}],voice:[{id:`voice-connect`,title:`Connect a subscription`,description:`Voice input uses an OpenAI Codex/ChatGPT subscription connection.`,targetId:`setup-auth-connect-subscription`,fallback:`Open Connections → Subscriptions and choose Connect subscription.`,preparation:{kind:`auth`,pageId:`connections`,sectionId:`subscriptions`},advanceByClickingTarget:!0},{id:`voice-codex-choice`,title:`Choose OpenAI Codex`,description:`Select OpenAI Codex and complete the ChatGPT subscription sign-in. The composer microphone becomes available after connection.`,targetId:`setup-auth-openai-codex-choice`,fallback:`In the provider dialog, select OpenAI Codex. If it is already connected, close the dialog to see the connected row.`,preparation:{kind:`auth`,pageId:`connections`,sectionId:`subscriptions`}}],"scoped-models":[{id:`scoped-models-add`,title:`Choose Add models`,description:`Open the scoped-model catalog to limit which authenticated models appear in the composer.`,targetId:`setup-scoped-models-add`,fallback:`Open Settings → Models and choose Add models.`,preparation:{kind:`settings`,pageId:`models`,sectionId:`models`},advanceByClickingTarget:!0},{id:`scoped-models-catalog`,title:`Search and select models`,description:`Search, filter by provider, and check the models you want in scope.`,targetId:`setup-scoped-models-catalog`,fallback:`Click Add models first; the search, filters, and model catalog will appear in the dialog.`,preparation:{kind:`settings`,pageId:`models`,sectionId:`models`}},{id:`scoped-models-save`,title:`Save the selection`,description:`Save your choices. Leaving every model unchecked is valid and keeps all authenticated models available.`,targetId:`setup-scoped-models-save`,fallback:`In the Add models dialog, choose Save selection when ready.`,preparation:{kind:`settings`,pageId:`models`,sectionId:`models`}}],"agent-defaults":[{id:`agent-default-mode`,title:`Choose the default mode`,description:`Set whether new agents begin in coding or planning mode.`,targetId:`setup-agent-default-mode`,fallback:`Open Settings → Agents → Defaults to choose a mode.`,preparation:{kind:`settings`,pageId:`agents`,sectionId:`defaults`}},{id:`agent-default-permission`,title:`Choose default permissions`,description:`Set the approval level new agents use by default.`,targetId:`setup-agent-default-permission`,fallback:`Open Settings → Agents → Defaults to choose a permission level.`,preparation:{kind:`settings`,pageId:`agents`,sectionId:`defaults`}},{id:`agent-explore-model`,title:`Choose the Explore model`,description:`Pick the model and thinking level used by Explore subagents.`,targetId:`setup-agent-explore-model`,fallback:`Open Settings → Agents → Explore agent and use the model picker.`,preparation:{kind:`settings`,pageId:`agents`,sectionId:`explore-agent`}},{id:`agent-default-model`,title:`Choose the main model`,description:`Finish with the main agent model and its default thinking level—the settings you will use most often. Additional approval and compaction controls remain available nearby.`,targetId:`setup-agent-default-model`,fallback:`Open Settings → Agents → Defaults and use the main model picker.`,preparation:{kind:`settings`,pageId:`agents`,sectionId:`defaults`}}]};function DCe(e,t){let n=[...ECe[e]];return e!==`voice`||!t.codexConnected?n:[{id:`voice-connected`,title:`OpenAI Codex is connected`,description:`Your ChatGPT subscription is ready, so the composer microphone is available for voice input.`,targetId:`setup-auth-openai-codex-connected`,fallback:`Open Connections → Subscriptions to review the connected OpenAI Codex provider.`,preparation:{kind:`auth`,pageId:`connections`,sectionId:`subscriptions`}}]}function OCe(e,t,n){return t<=0?0:Math.min(t-1,Math.max(0,e+n))}function G7(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function K7(e,t,n){if(!e)return n;let r=t.find(t=>t.provider===e.provider&&t.modelId===e.modelId);return r?.name||r?.label||e.modelId}function kCe(e,t){let n=K7(e.defaultModel,t,`First available scoped model`),r=K7(e.exploreAgent.model,t,`Default model`);return{configured:!!(e.defaultModel&&e.exploreAgent.model),text:`${G7(e.defaultMode)} · ${G7(e.defaultPermissionLevel)} · Main: ${n} (${e.defaultThinkingLevel}) · Explore: ${r} (${e.exploreAgent.thinkingLevel})`}}function ACe(e){return e===`conversation`||e===`pending-conversation`}var q7=N({mode:`closed`,manual:!1,selectedGuideIndex:0,consideredGeneration:void 0,preparing:!1,targetAvailable:!1,runSteps:[],stepIndex:0,activeGuideId:void 0,setupArea:void 0,setupSteps:[],setupStepIndex:0,completionVersions:xCe()}),J7,Y7=0;function X7(){return rr.authProviders.some(e=>e.configured)}function Z7(){return mG(rr.authProviders)}function jCe(){let e=rr.settingsDraft?.scopedModels.length??0;return e===0?`All authenticated models are currently available`:`${e} scoped ${e===1?`model`:`models`} selected`}function MCe(){let e=rr.settingsDraft;return e?kCe(e,rr.models):{configured:!1,text:`Agent defaults are loading.`}}function NCe(){return{"project-open":!!If.activeProject,"provider-ready":X7(),"voice-ready":Z7()}}function Q7(){return mCe(L7,q7.completionVersions,NCe())}function $7(){return gCe(Q7())}function e9(){return Q7()[q7.selectedGuideIndex]}function PCe(e){if(e===`open-project`)return If.activeProject?`A project is open and ready.`:`No project is open yet.`;if(e===`provider`)return X7()?`A model provider is connected.`:`No model provider is connected.`;if(e===`voice`)return Z7()?`Voice input is ready.`:`Voice input is not connected yet.`;if(e===`scoped-models`)return jCe();if(e===`agent-defaults`)return MCe().text;if(e===`workbench`)return`Covers conversations, composer controls, panels, Git, tasks, and settings.`}function t9(e){q7.completionVersions=e,SCe(e)}function n9(e){let t=L7.find(t=>t.id===e);if(!t||t.lifecycle===`upcoming`)return;let n=U7(q7.completionVersions,e,t.version);n!==q7.completionVersions&&t9(n)}function FCe(){let e=Q7(),t=q7.completionVersions;for(let n of hCe(e,t)){let e=L7.find(e=>e.id===n);e&&(t=U7(t,n,e.version))}t!==q7.completionVersions&&t9(t)}function ICe(){if(!B1.progressiveActive||!rr.settingsDraft)return;FCe();let e=B1.generation;vCe({progressiveActive:B1.progressiveActive,settingsLoaded:!!rr.settingsDraft,incompleteCount:$7(),generation:e,consideredGeneration:q7.consideredGeneration})&&(q7.consideredGeneration=e,q7.manual=!1,q7.selectedGuideIndex=R7(Q7()),q7.mode=`catalog`)}function LCe(){q7.manual=!0,q7.selectedGuideIndex=R7(Q7()),q7.mode=`catalog`}function r9(e){q7.selectedGuideIndex=_Ce(q7.selectedGuideIndex,L7.length,e)}function RCe(e){let t=L7.findIndex(t=>t.id===e);t>=0&&(q7.selectedGuideIndex=t),q7.mode=`catalog`}function zCe(){return{shell:pue(),tabs:bp(),settingsPageId:rr.activePageId,settingsSectionId:rr.activeSectionId,historyOpen:!!document.querySelector(`[data-tour-id="conversation-history"]`)}}function i9(){document.querySelector(`[data-tour-id="conversation-history"]`)?.closest(`[data-slot="dialog-content"]`)?.querySelector(`[aria-label="Close dialog"]`)?.click()}function a9(){let e=J7;J7=void 0,e&&(mue(e.shell),xp(e.tabs),rr.activePageId=e.settingsPageId,rr.activeSectionId=e.settingsSectionId,e.historyOpen||i9())}function o9(e){if(e)return[...document.querySelectorAll(`[data-tour-id="${e}"]`)].find(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0})}function s9(){return q7.runSteps[q7.stepIndex]}function c9(){return q7.setupSteps[q7.setupStepIndex]}var BCe={conversations:`conversations`,"panel-new-conversation":`conversations`,git:`git`,"pull-requests":`pull-requests`,tasks:`tasks`,files:`files`,"scratch-notes":`notes`,"context-panel":`context`};async function l9(){await he(),await new Promise(e=>requestAnimationFrame(()=>e()))}async function u9(e){let t=++Y7;q7.preparing=!0,q7.targetAvailable=!1,e.id!==`history`&&i9();let n=BCe[e.id];n?yue(n,K0.isCompact):e.id===`composer`?ACe(If.activeCenterTab?.kind)||(NJ(),await he()):e.id===`history`&&k0.activeConversation&&jZ(),await l9(),!(t!==Y7||q7.mode!==`tour`)&&(q7.targetAvailable=!!o9(e.targetId),q7.preparing=!1)}async function d9(e,t){let n=performance.now()+t;do{let t=o9(e);if(t)return t;await new Promise(e=>requestAnimationFrame(()=>e()))}while(performance.now()<n)}async function f9(e,t=!1){let n=++Y7;q7.preparing=!0,q7.targetAvailable=!1;let r=o9(e.targetId),i=e.preparation;t&&!r&&i?.kind===`auth`?await HW(i.pageId,i.sectionId):t&&!r&&i?.kind===`settings`&&await vW(i.pageId,i.sectionId),await l9(),r=await d9(e.targetId,t?3e3:150),!(n!==Y7||![`preparing-coach`,`coach`].includes(q7.mode))&&(r?.scrollIntoView({behavior:`instant`,block:`nearest`,inline:`nearest`}),await l9(),!(n!==Y7||![`preparing-coach`,`coach`].includes(q7.mode))&&(q7.mode=`coach`,q7.targetAvailable=!!o9(e.targetId),q7.preparing=!1))}function VCe(e,t){q7.activeGuideId=e,q7.setupArea=t,q7.setupSteps=DCe(t,{codexConnected:Z7()}),q7.setupStepIndex=0,q7.mode=`preparing-coach`;let n=c9();n&&f9(n,!0)}async function p9(e){let t=c9(),n=OCe(q7.setupStepIndex,q7.setupSteps.length,e);if(n===q7.setupStepIndex)return;let r=q7.setupSteps[n];e===1&&t?.advanceByClickingTarget&&r&&!o9(r.targetId)&&(q7.preparing=!0,o9(t.targetId)?.click(),await d9(r.targetId,3e3)),q7.setupStepIndex=n,r&&await f9(r)}function m9(){if(q7.activeGuideId===`open-project`&&Q.projectPickerOpen){q7.mode=`closed`;return}q7.mode=`catalog`}function h9(){Y7+=1,q7.preparing=!1,q7.mode===`tour`&&a9(),m9()}function g9(){let e=q7.activeGuideId;e&&n9(e),Y7+=1,q7.preparing=!1,q7.mode===`tour`&&a9(),m9()}function HCe(){let e=L7.find(e=>e.id===`workbench`);if(!e)return;J7??=zCe();let t=q7.completionVersions.workbench??0;q7.runSteps=CCe(W7,t,t>=e.version).filter(e=>e.id!==`history`||k0.activeConversation),q7.runSteps.length===0&&(q7.runSteps=[...W7]),q7.activeGuideId=`workbench`,q7.stepIndex=0,q7.mode=`tour`;let n=s9();n&&u9(n)}function UCe(){let e=e9();if(!(!e||!e.available)){if(!e.run){n9(e.id);return}if(e.run.kind===`setup-coach`){VCe(e.id,e.run.area);return}if(!If.activeProject){RCe(`open-project`);return}HCe()}}function _9(e){let t=wCe(q7.stepIndex,q7.runSteps.length,e);if(t===q7.stepIndex)return;q7.stepIndex=t;let n=s9();n&&u9(n)}function WCe(){Y7+=1,q7.mode=`closed`,q7.preparing=!1,a9(),requestAnimationFrame(()=>{document.querySelector(`[data-tour-id="help"]`)?.focus({preventScroll:!0})})}function GCe(){WCe()}var KCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function qCe(e,t){let n=H(t,KCe),r=[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`}]];P(e,B({name:`circle-dashed`},()=>n,{get iconNode(){return r}}))}var JCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function YCe(e,t){let n=H(t,JCe),r=[[`path`,{d:`M10 5H3`}],[`path`,{d:`M12 19H3`}],[`path`,{d:`M14 3v4`}],[`path`,{d:`M16 17v4`}],[`path`,{d:`M21 12h-9`}],[`path`,{d:`M21 19h-5`}],[`path`,{d:`M21 5h-7`}],[`path`,{d:`M8 10v4`}],[`path`,{d:`M8 12H3`}]];P(e,B({name:`sliders-horizontal`},()=>n,{get iconNode(){return r}}))}var XCe=h(`<!> Back`,1),ZCe=h(`<!> Done`,1),QCe=h(`Next <!>`,1),$Ce=h(`<div class="flex w-full flex-wrap items-center justify-between gap-2"><!> <div class="flex items-center gap-2"><!> <!></div></div>`),ewe=h(`<span class="text-info">New</span>`),twe=h(`<span class="text-muted-foreground">Upcoming</span>`),nwe=h(`<!> Completed`,1),rwe=h(`<!> Not completed`,1),iwe=h(`<div class="border-l-2 border-border pl-3 text-xs text-muted-foreground"><!></div>`),awe=h(`<!> Mark completed`,1),owe=h(`<div class="flex flex-wrap items-center gap-2"><!> <!></div>`),swe=h(`<p class="text-sm text-muted-foreground">This guide will become available with a future release.</p>`),cwe=h(`<div class="grid gap-6"><div class="grid gap-2"><div class="flex items-center justify-between gap-3 text-xs text-muted-foreground"><span> </span> <span> </span></div> <!></div> <section class="grid min-h-56 content-center gap-4 px-2 py-3 sm:grid-cols-[auto_1fr] sm:items-start sm:px-5" aria-live="polite" aria-labelledby="current-guide-title"><div class="flex size-11 items-center justify-center rounded-lg bg-muted text-foreground"><!></div> <div class="grid max-w-lg gap-4"><div class="grid gap-1.5"><div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs"><span> </span> <!> <span class="text-border" aria-hidden="true">·</span> <span><!></span></div> <h2 id="current-guide-title" class="text-lg font-semibold"> </h2> <p class="text-sm leading-relaxed text-muted-foreground"> </p></div> <!> <!></div></section></div>`);function lwe(e,t){a(t,!0);let n={"open-project":En,provider:VU,voice:qx,"scoped-models":YCe,"agent-defaults":S0,workbench:l7},r=J(()=>n[t.guide.id]),i=J(()=>t.index===t.count-1),o=J(()=>t.guide.id===`workbench`&&t.workbenchBlocked?`Open project guide`:t.guide.completed?t.guide.run?.kind===`workbench-tour`?`Replay tour`:`Replay guide`:t.guide.actionLabel??`Got it`),c=J(()=>t.guide.priority===`must-do`?`Must do`:t.guide.priority===`highly-recommended`?`Highly recommended`:`Optional`),l=J(()=>t.guide.completed||!t.guide.available);sP(e,{open:!0,size:`md`,title:`Nerve guides`,description:`Learn the essentials and explore Workbench features at your own pace.`,closeLabel:`Later`,onOpenChange:e=>{e||t.onLater()},footer:e=>{var n=$Ce(),r=V(n);G(r,{variant:`ghost`,size:`sm`,get onclick(){return t.onLater},children:(e,t)=>{w(),g(e,M(`Later`))},$$slots:{default:!0}});var a=L(r,2),o=V(a);{let e=J(()=>t.index===0);G(o,{variant:`outline`,size:`sm`,get onclick(){return t.onBack},get disabled(){return W(e)},children:(e,t)=>{var n=XCe();n7(R(n),{class:`size-4`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}var s=L(o,2),c=e=>{{let n=J(()=>W(l)?`default`:`outline`);G(e,{get variant(){return W(n)},size:`sm`,get onclick(){return t.onLater},children:(e,t)=>{var n=ZCe();$I(R(n),{class:`size-4`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}},u=e=>{{let n=J(()=>W(l)?`default`:`outline`);G(e,{get variant(){return W(n)},size:`sm`,get onclick(){return t.onNext},children:(e,t)=>{w();var n=QCe();kI(L(R(n)),{class:`size-4`,"aria-hidden":`true`}),g(e,n)},$$slots:{default:!0}})}};k(s,e=>{W(i)?e(c):e(u,-1)}),d(a),d(n),g(e,n)},children:(e,n)=>{var i=cwe(),a=V(i),l=V(a),u=V(l),f=V(u);d(u);var p=L(u,2),m=V(p,!0);d(p),d(l);var h=L(l,2);{let e=J(()=>t.index+1),n=J(()=>`Guide ${t.index+1} of ${t.count}`);U_(h,{get value(){return W(e)},get max(){return t.count},get"aria-label"(){return W(n)}})}d(a);var _=L(a,2),v=V(_);C(V(v),()=>W(r),(e,t)=>{t(e,{class:`size-5`,"aria-hidden":`true`})}),d(v);var y=L(v,2),b=V(y),S=V(b),T=V(S),E=V(T,!0);d(T);var D=L(T,2),O=e=>{g(e,ewe())},ee=e=>{g(e,twe())};k(D,e=>{t.guide.lifecycle===`new`?e(O):t.guide.lifecycle===`upcoming`&&e(ee,1)});var te=L(D,4),ne=V(te),j=e=>{var t=nwe();fv(R(t),{class:`size-3.5`,"aria-hidden":`true`}),w(),g(e,t)},re=e=>{var t=rwe();qCe(R(t),{class:`size-3.5`,"aria-hidden":`true`}),w(),g(e,t)};k(ne,e=>{t.guide.completed?e(j):e(re,-1)}),d(te),d(S);var N=L(S,2),P=V(N,!0);d(N);var ie=L(N,2),ae=V(ie,!0);d(ie),d(b);var oe=L(b,2),se=e=>{var n=iwe(),r=V(n),i=e=>{g(e,M(`Open a project before starting this tour.`))},a=e=>{var n=M();F(()=>A(n,t.summary)),g(e,n)};k(r,e=>{t.guide.id===`workbench`&&t.workbenchBlocked?e(i):e(a,-1)}),d(n),g(e,n)};k(oe,e=>{(t.summary||t.guide.id===`workbench`&&t.workbenchBlocked)&&e(se)});var ce=L(oe,2),le=e=>{var n=owe(),r=V(n),i=e=>{{let n=J(()=>t.guide.completed?`outline`:`default`);G(e,{get variant(){return W(n)},size:`sm`,get onclick(){return t.onStart},children:(e,t)=>{w();var n=M();F(()=>A(n,W(o))),g(e,n)},$$slots:{default:!0}})}};k(r,e=>{(t.guide.run||!t.guide.completed)&&e(i)});var a=L(r,2),s=e=>{G(e,{variant:`ghost`,size:`sm`,get onclick(){return t.onMarkCompleted},children:(e,t)=>{var n=awe();$I(R(n),{class:`size-4`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})};k(a,e=>{t.guide.run&&!t.guide.completed&&e(s)}),d(n),g(e,n)},ue=e=>{g(e,swe())};k(ce,e=>{t.guide.available?e(le):e(ue,-1)}),d(y),d(_),d(i),F(()=>{A(f,`Guide ${t.index+1} of ${t.count??``}`),A(m,t.guide.title),s(T,1,x(t.guide.priority===`must-do`?`font-medium text-warning`:`font-medium text-muted-foreground`)),A(E,W(c)),s(te,1,x(t.guide.completed?`inline-flex items-center gap-1 text-success`:`inline-flex items-center gap-1 text-muted-foreground`)),A(P,t.guide.title),A(ae,t.guide.description)}),g(e,i)},$$slots:{footer:!0,default:!0}}),z()}var uwe=h(`<div></div> <div></div> <div></div> <div></div> <div class="fixed rounded-lg ring-2 ring-primary ring-offset-2 ring-offset-background/80" aria-hidden="true"></div>`,1),dwe=h(`<div></div>`),fwe=h(`<p class="rounded-md bg-muted p-3 text-xs text-muted-foreground"> </p>`),pwe=h(`<p class="text-xs text-muted-foreground">Opening this feature…</p>`),mwe=h(`<!> Back`,1),hwe=h(`<!> `,1),gwe=h(`Next <!>`,1),_we=h(`<div role="presentation"><!> <div role="dialog" aria-labelledby="guided-tour-title" aria-describedby="guided-tour-description"><div class="grid gap-2"><div class="flex items-center justify-between gap-3 text-xs text-muted-foreground"><span> </span> <span> </span></div> <!></div> <div class="grid gap-2" aria-live="polite"><h2 id="guided-tour-title" class="text-base font-semibold text-foreground"> </h2> <p id="guided-tour-description" class="text-sm leading-relaxed text-muted-foreground"> </p> <!></div> <div class="flex flex-wrap items-center justify-between gap-2"><!> <div class="flex items-center gap-2"><!> <!></div></div></div></div>`);function v9(e,t){a(t,!0);let n=I(t,`variant`,3,`modal`),r=I(t,`preparing`,3,!1),i=I(t,`compact`,3,!1),o=Y(void 0),c=Y(null),u=Y(384),f=Y(220),p=Y(N(typeof window>`u`?1024:window.innerWidth)),m=Y(N(typeof window>`u`?768:window.innerHeight)),h=J(()=>n()===`modal`),_=J(()=>t.index===t.count-1),v=J(()=>`introducedIn`in t.step&&t.step.id===`finish`),y=J(()=>TCe({target:W(o),viewportWidth:W(p),viewportHeight:W(m),calloutWidth:W(u),calloutHeight:W(f),compact:i(),centered:W(v)}));function b(){if(t.step.targetId)return[...document.querySelectorAll(`[data-tour-id="${t.step.targetId}"]`)].find(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0})}function x(){K(p,window.innerWidth,!0),K(m,window.innerHeight,!0);let e=b();if(!e)K(o,void 0);else{let t=e.getBoundingClientRect(),n=Math.max(0,t.left-6),r=Math.max(0,t.top-6),i=Math.min(window.innerWidth,t.right+6),a=Math.min(window.innerHeight,t.bottom+6);K(o,{top:r,right:i,bottom:a,left:n,width:i-n,height:a-r},!0)}if(W(c)){let e=W(c).getBoundingClientRect();K(u,e.width,!0),K(f,e.height,!0)}}be(()=>{let e=t.step.targetId,n=W(h);he().then(()=>{x(),n&&W(c)?.focus({preventScroll:!0})});let r=e?b():void 0,i=new ResizeObserver(x),a=new MutationObserver(x);return r?i.observe(r):e&&a.observe(document.body,{childList:!0,subtree:!0}),W(c)&&i.observe(W(c)),()=>{i.disconnect(),a.disconnect()}});function S(e){if(e.key===`Escape`){e.preventDefault(),t.onClose();return}if(!W(h)||e.key!==`Tab`||!W(c))return;let n=[...W(c).querySelectorAll(`button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])`)];if(n.length===0)return;let r=n.indexOf(document.activeElement);e.shiftKey&&r<=0?(e.preventDefault(),n.at(-1)?.focus()):!e.shiftKey&&r===n.length-1&&(e.preventDefault(),n[0]?.focus())}var C=_we();ue(`resize`,Te,x),ue(`scroll`,Te,x),ue(`keydown`,Te,S);var T=V(C),E=e=>{var t=uwe(),n=R(t);let r;var i=L(n,2);let a;var c=L(i,2);let u;var d=L(c,2);let f;var p=L(d,2);let m;F(()=>{s(n,1,`fixed left-0 right-0 top-0 ${W(h)?`bg-background/60`:`bg-background/30`}`),r=l(n,``,r,{height:`${W(o).top}px`}),s(i,1,`fixed bottom-0 left-0 right-0 ${W(h)?`bg-background/60`:`bg-background/30`}`),a=l(i,``,a,{top:`${W(o).bottom}px`}),s(c,1,`fixed left-0 ${W(h)?`bg-background/60`:`bg-background/30`}`),u=l(c,``,u,{top:`${W(o).top}px`,width:`${W(o).left}px`,height:`${W(o).height}px`}),s(d,1,`fixed right-0 ${W(h)?`bg-background/60`:`bg-background/30`}`),f=l(d,``,f,{top:`${W(o).top}px`,left:`${W(o).right}px`,height:`${W(o).height}px`}),m=l(p,``,m,{top:`${W(o).top}px`,left:`${W(o).left}px`,width:`${W(o).width}px`,height:`${W(o).height}px`})}),g(e,t)},D=e=>{var t=dwe();F(()=>s(t,1,`fixed inset-0 ${W(h)?`bg-background/60`:`bg-background/30`}`)),g(e,t)};k(T,e=>{W(o)?e(E):e(D,-1)});var O=L(T,2);let ee;var te=V(O),ne=V(te),j=V(ne),re=V(j,!0);d(j);var P=L(j,2),ie=V(P);d(P),d(ne);var ae=L(ne,2);{let e=J(()=>t.index+1),n=J(()=>`${W(h)?`Workbench tour`:`Guide`} progress`);U_(ae,{get value(){return W(e)},get max(){return t.count},get"aria-label"(){return W(n)}})}d(te);var oe=L(te,2),se=V(oe),ce=V(se,!0);d(se);var le=L(se,2),de=V(le,!0);d(le);var pe=L(le,2),me=e=>{var n=fwe(),r=V(n,!0);d(n),F(()=>A(r,t.step.fallback)),g(e,n)},ge=e=>{g(e,pwe())};k(pe,e=>{!W(o)&&t.step.fallback?e(me):r()&&e(ge,1)}),d(oe);var _e=L(oe,2),ve=V(_e);G(ve,{variant:`ghost`,size:`sm`,get onclick(){return t.onClose},children:(e,t)=>{w();var n=M();F(()=>A(n,W(h)?`Not now`:`Close guide`)),g(e,n)},$$slots:{default:!0}});var ye=L(ve,2),B=V(ye);{let e=J(()=>t.index===0||r());G(B,{variant:`outline`,size:`sm`,get disabled(){return W(e)},get onclick(){return t.onBack},children:(e,t)=>{var n=mwe();n7(R(n),{class:`size-3.5`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}var xe=L(B,2),Se=e=>{G(e,{size:`sm`,get disabled(){return r()},get onclick(){return t.onComplete},children:(e,t)=>{var n=hwe(),r=R(n);$I(r,{class:`size-3.5`,"aria-hidden":`true`});var i=L(r);F(()=>A(i,` ${W(h)?`Finish`:`Finish guide`}`)),g(e,n)},$$slots:{default:!0}})},Ce=e=>{G(e,{size:`sm`,get disabled(){return r()},get onclick(){return t.onNext},children:(e,t)=>{w();var n=gwe();kI(L(R(n)),{class:`size-3.5`,"aria-hidden":`true`}),g(e,n)},$$slots:{default:!0}})};k(xe,e=>{W(_)?e(Se):e(Ce,-1)}),d(ye),d(_e),d(O),fe(O,e=>K(c,e),()=>W(c)),d(C),F(()=>{s(C,1,`fixed inset-0 z-100 ${W(h)?``:`pointer-events-none`}`),s(O,1,`fixed grid max-w-[calc(100vw-1.5rem)] gap-4 rounded-xl border border-border bg-popover p-5 text-popover-foreground shadow-xl outline-none ${W(h)?`w-96`:`pointer-events-auto w-80`}`),q(O,`aria-modal`,W(h)?`true`:`false`),q(O,`tabindex`,W(h)?-1:void 0),ee=l(O,``,ee,{top:`${W(y).top}px`,left:`${W(y).left}px`}),A(re,W(h)?`Workbench tour`:`Guide`),A(ie,`Step ${t.index+1} of ${t.count??``}`),A(ce,t.step.title),A(de,t.step.description)}),g(e,C),z()}function vwe(e,t){a(t,!0),be(()=>{K0.isPhone||ICe()});let n=J(s9),r=J(c9),i=J(Q7),o=J(e9);var s=U(),c=R(s),l=e=>{{let t=J(()=>PCe(W(o).id)),n=J(()=>!If.activeProject);lwe(e,{get guide(){return W(o)},get summary(){return W(t)},get index(){return q7.selectedGuideIndex},get count(){return W(i).length},get workbenchBlocked(){return W(n)},onBack:()=>r9(-1),onNext:()=>r9(1),get onStart(){return UCe},onMarkCompleted:()=>n9(W(o).id),get onLater(){return GCe}})}},u=e=>{v9(e,{get step(){return W(n)},variant:`modal`,get index(){return q7.stepIndex},get count(){return q7.runSteps.length},get preparing(){return q7.preparing},get compact(){return K0.isCompact},onBack:()=>_9(-1),onNext:()=>_9(1),get onComplete(){return g9},get onClose(){return h9}})},d=e=>{v9(e,{get step(){return W(r)},variant:`coach`,get index(){return q7.setupStepIndex},get count(){return q7.setupSteps.length},get preparing(){return q7.preparing},compact:!1,onBack:()=>void p9(-1),onNext:()=>void p9(1),get onComplete(){return g9},get onClose(){return h9}})};k(c,e=>{!K0.isPhone&&q7.mode===`catalog`&&W(o)?e(l):!K0.isPhone&&q7.mode===`tour`&&W(n)?e(u,1):!K0.isPhone&&q7.mode===`coach`&&W(r)&&e(d,2)}),g(e,s),z()}function ywe(e,t){return e===`auto`?t===`darwin`?`macos`:t===`win32`?`windows`:`linux`:e}var bwe=h(`<!> <!> <!>`,1);function xwe(e,t){a(t,!0);let n=J(()=>If.projectSwitcherItems),r=J(()=>If.status),i=J(()=>If.conversations),o=Vd(`conversation.new`),s=Y(void 0),c=Y(void 0),l=J(()=>K0.isPhone?1:K0.isCompact?2:5),u=J(()=>mf(W(n),Q.selectedProjectKey,W(l))),d=J(()=>If.activeCenterTab),f=J(()=>N0.settingsDraft),p=J(()=>ywe(W(f)?.desktop.headerType??`auto`,Nn.platform)),m=J($7),h=J(()=>Nn.quitting||Ru.quitRequested),_=J(()=>({homeDir:W(r)?.storage.userHome,newConversationShortcut:o,editorAvailability:W(r)?.runtime.editors,conversationCount:e=>R0(W(i),e),onNewConversationInProject:PJ,onOpenProjectInEditor:(e,t)=>void LJ(e,t),requestPrune:e=>{K(c,{id:e.id,label:er(e.dir,W(r)?.storage.userHome)},!0)},requestDelete:e=>K(s,e,!0)}));function v(e){return Ble(e.project,W(_))}function y(){W(s)?.kind===`project`&&FJ(W(s).id)}function b(e){W(c)&&RJ(W(c).id,e)}function x(){Q.projectPickerOpen=!0}async function S(){let e=W(f)?.desktop.closeToTray??!0;e||(Ru.quitRequested=!0,Nn.quitting=!0);try{await In({closeToTray:e})}catch(t){e||(Ru.quitRequested=!1,Nn.quitting=!1),Q.error=t instanceof Error?t.message:String(t)}}var C=bwe(),w=R(C);{let e=J(()=>W(f)?.desktop.closeToTray??!0),t=J(()=>W(d)?.kind===`settings`),n=J(()=>q7.mode===`catalog`||q7.mode===`tour`||q7.mode===`preparing-coach`||q7.mode===`coach`),i=J(()=>W(d)?.kind===`auth`),a=J(()=>W(d)?.kind===`logs`),o=J(()=>W(r)?.capabilities.applicationLogs??!1),s=J(()=>W(r)?.version);tCe(w,{get projects(){return W(u)},get activeProjectKey(){return Q.selectedProjectKey},get desktop(){return Nn.isDesktop},get headerType(){return W(p)},get maximized(){return Nn.windowState.maximized},get closeToTray(){return W(e)},get quitting(){return W(h)},get settingsActive(){return W(t)},get guideActive(){return W(n)},get incompleteGuideCount(){return W(m)},get authActive(){return W(i)},get logsActive(){return W(a)},get applicationLogsEnabled(){return W(o)},get currentVersion(){return W(s)},get latestRelease(){return p7.latest},buildProjectMenuItems:v,onOpenProject:x,onSelectProject:e=>void jJ(e),onOpenLogs:()=>Hce(),get onOpenGuide(){return LCe},onOpenAuth:()=>HW(),onOpenSettings:()=>void vW(),onMinimize:()=>void Pn(),onToggleMaximize:()=>void Mn(),onClose:()=>void S()})}var T=L(w,2);{let e=J(()=>W(s)?.kind===`project`),t=J(()=>W(s)?`This removes “${W(s).label}” from Nerve and deletes its Nerve conversations. Files on disk are not deleted.`:``);B_(T,{get open(){return W(e)},title:`Remove project?`,get description(){return W(t)},confirmLabel:`Remove`,destructive:!0,onConfirm:y,onOpenChange:e=>{e||K(s,void 0)}})}var E=L(T,2);{let e=J(()=>!!W(c)),t=J(()=>W(c)?.label??``),n=J(()=>W(c)?R0(W(i),W(c).id):0);fCe(E,{get open(){return W(e)},get projectLabel(){return W(t)},get totalCount(){return W(n)},ageEligible:e=>W(c)?Lle(W(i),W(c).id,e):0,keepEligible:e=>W(c)?Rle(W(i),W(c).id,e):0,onConfirm:b,onOpenChange:e=>{e||K(c,void 0)}})}g(e,C),z()}var Swe=new Set([`$$slots`,`$$events`,`$$legacy`]);function y9(e,t){let n=H(t,Swe),r=[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`}]];P(e,B({name:`bell`},()=>n,{get iconNode(){return r}}))}var Cwe=h(`<aside class="fixed right-4 bottom-4 z-50 w-[min(24rem,calc(100vw-2rem))] rounded-lg border border-border bg-card p-4 text-card-foreground shadow-lg" aria-live="polite" aria-label="Notification permission"><div class="flex gap-3"><div class="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground"><!></div> <div class="min-w-0 flex-1 space-y-3"><div class="space-y-1"><h2 class="text-sm font-medium">Enable desktop notifications</h2> <p class="text-sm text-muted-foreground">Let Nerve alert you when an agent needs approval, asks a question,
169
+ or finishes in the background.</p></div> <div class="flex flex-wrap justify-end gap-2"><!> <!></div></div></div></aside>`);function wwe(e,t){a(t,!1),pe();var n=U(),r=R(n),i=e=>{var t=Cwe(),n=V(t),r=V(n);y9(V(r),{class:`size-4`,strokeWidth:2}),d(r);var i=L(r,2),a=L(V(i),2),o=V(a);G(o,{variant:`ghost`,size:`sm`,get onclick(){return Gn},children:(e,t)=>{w(),g(e,M(`Not now`))},$$slots:{default:!0}}),G(L(o,2),{size:`sm`,onclick:()=>void Un(),children:(e,t)=>{w(),g(e,M(`Enable notifications`))},$$slots:{default:!0}}),d(a),d(i),d(n),d(t),g(e,t)};k(r,e=>{Hn.promptVisible&&e(i)}),g(e,n),z()}var Twe=h(`<!> <!> <!>`,1),Ewe=h(`<!> <!>`,1);function Dwe(e,t){a(t,!0);let n=J(()=>K0.isCompact),r=J(()=>If.activeCenterTab);function i(e){return Object.entries(t2.current.docks).some(([t,r])=>!r.activeViewId||!e.includes(r.activeViewId)?!1:W(n)?t===`left`?e2.primary:e2.secondary:!r.collapsed)}let o=J(()=>i([`git`,`pull-requests`])),s=J(()=>i([`pull-requests`])),c=Cle(()=>If.activeProject,()=>W(o),()=>W(s)),l;be(()=>{let e=W(r)?`${W(r).kind}:${W(r).id}`:void 0;e!==l&&(l=e,e2.primary&&c2())}),be(()=>{!W(n)&&(e2.primary||e2.secondary)&&c2()});var u=Ewe(),d=R(u);{let e=e=>{xwe(e,{})},t=e=>{Ole(e,{})},r=(e,t=D)=>{bue(e,{get viewId(){return t()},get gitModel(){return c.model},get gitActions(){return c.actions}})},i=e=>{vSe(e,{})},a=e=>{var t=Twe(),n=R(t);wwe(n,{});var r=L(n,2);vwe(r,{}),jre(L(r,2),{}),g(e,t)},o=J(()=>({onActivateView:i2,onMoveView:hue,onHideView:gue,onToggleDock:a2,onDockResize:vue,onSheetOpenChange:s2}));kre(d,{get layout(){return t2.current},get descriptors(){return X0},get compact(){return W(n)},get primarySheetOpen(){return e2.primary},get secondarySheetOpen(){return e2.secondary},get actions(){return W(o)},titlebar:e,editor:t,panelView:r,statusBar:i,overlays:a,$$slots:{titlebar:!0,editor:!0,panelView:!0,statusBar:!0,overlays:!0}})}Rxe(L(d,2),{}),g(e,u),z()}function Owe(e){let t=b9(e);return t?xr(e.type,e.data)===Pr(t):!1}function b9(e){let t=e.data?.conversationId;if(typeof t==`string`)return t;let n=e.data?.entry;if(typeof n?.conversationId==`string`)return n.conversationId;let r=e.data?.toolCall;if(typeof r?.conversationId==`string`)return r.conversationId}function x9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function S9(e){return Of.conversationId===e}function C9(e){return Q.openCenterTabs.some(t=>t.kind===`conversation`&&t.id===e)}function kwe(e){S9(e.conversationId)&&(Q.error=e.error)}function Awe(e,t){if(e.activeEntryIds.indexOf(t.id)!==-1)return!0;let n=e.activeEntryId??e.activeEntryIds.at(-1);return n?t.parentEntryId===n:e.activeEntryIds.length===0&&!t.parentEntryId}function jwe(e,t){Q.conversations=Q.conversations.map(n=>n.id===e?{...n,activeEntryId:t,updatedAt:new Date().toISOString()}:n)}function Mwe(e,t){if(e.treeNodes.find(e=>e.entry.id===t.id)){e.treeNodes=e.treeNodes.map(e=>e.entry.id===t.id?{...e,entry:t}:e);return}e.treeNodes=[...e.treeNodes.map(e=>t.parentEntryId&&e.entry.id===t.parentEntryId?{...e,childEntryIds:Array.from(new Set([...e.childEntryIds,t.id]))}:e),{entry:t,childEntryIds:[]}]}var w9=new Map,Nwe=1e3;function T9(e){let t=w9.get(e);t&&(clearTimeout(t),w9.delete(e))}function E9(e){if(!C9(e))return;T9(e);let t=setTimeout(()=>{w9.delete(e),Pwe(e)},Nwe);w9.set(e,t)}async function Pwe(e){if(!C9(e))return;let t=await zV(e).catch(()=>void 0),n=Z.conversationViews[Yr(e)];!t||!n||(n.contextUsage=t)}function D9(e){return e&&typeof e==`object`?e:void 0}function Fwe(e){let t=D9(e.details),n=D9(t?.details);for(let e of[t?.toolCall,n?.toolCall]){let t=Nr.safeParse(e);if(t.success)return t.data}}function Iwe(e,t){if(t){if(t.hidden){e.toolCalls=e.toolCalls.filter(e=>e.id!==t.id);return}e.toolCalls=e.toolCalls.findIndex(e=>e.id===t.id)===-1?[...e.toolCalls,t]:e.toolCalls.map(e=>e.id===t.id?t:e)}}function Lwe(e){let t=b9(e);if(!t||!C9(t))return;let n=sU(t),r=e.type===`conversation.entry.appended`?e.data?.entry:void 0;if(e.type===`conversation.entry.appended`&&r&&e.seq>n.cursorSeq&&!Awe(n,r)){O9(n,t,Error(`Conversation branch diverged from the active snapshot`)),E9(t);return}let i=!1,a;try{a=Ct(n,e,{consumeUnhandled:!0,onGap:()=>{i=!0}})}catch(e){if(!(e instanceof Hr))throw e;O9(n,t,e);return}if(i){O9(n,t,Error(`Conversation event gap at ${e.type}`));return}let o=n;if(a!==n){let e=Yr(t);Z.conversationViews[e]=a,o=Z.conversationViews[e]}Rwe(o,e,r),kwe(o)}function O9(e,t,n){e.error=`Conversation state corrupted — resyncing`,console.error(`Conversation event invariant violated`,{conversationId:t,error:n}),OK(Pr(t)),BK(t)}function Rwe(e,t,n){let r=e.conversationId;switch(t.type){case`conversation.entry.appended`:if(!n)break;e.activeEntryId=n.id,Mwe(e,n),jwe(r,n.id),S9(r)&&(Of.entryId=n.id),e.optimisticMessages=Sq(e.optimisticMessages,n),Iwe(e,Fwe(n)),E9(r);break;case`conversation.context.updated`:T9(r);break;case`run.completed`:FK(e),BK(r).then(()=>{Of.conversationId===r&&WK(r)}),S9(r)&&N1(x9(t.data?.projectId));break;case`run.cancelled`:FK(e);break;case`run.failed`:FK(e);break;case`run.suspended`:e.optimisticMessages=[];break;case`run.waiting`:PK(e,x9(t.data?.runId));break}}function zwe(){return $W(Bwe)}function Bwe(e){if(!XW(e))return;let t=b9(e);if(t&&C9(t)&&Owe(e)){Lwe(e),(e.type===`conversation.compacted`||e.type===`conversation.navigated`)&&BK(t);return}if(e.type===`agent.configured`){let t=e.data?.agent;typeof t?.conversationId==`string`&&E9(t.conversationId)}}function Vwe(e,t){switch(e.type){case`approval.updated`:return M9(e.data.approval)?.status===`pending`?Hwe(e,t):void 0;case`userQuestion.updated`:return M9(e.data.question)?.status===`pending`?Uwe(e,t):void 0;case`planReview.updated`:return M9(e.data.planReview)?.status===`pending`?Wwe(e,t):void 0;case`run.completed`:return Gwe(e,t);case`run.failed`:return Kwe(e,t);case`run.suspended`:return;default:return}}function Hwe(e,t){let n=M9(e.data?.approval),r=M9(e.data?.toolCall),i=N9(r?.toolName),a=N9(n?.risk)??N9(r?.risk),o=N9(n?.reason);return{backgroundOnly:!1,kind:`error`,soundEvent:`approval`,tag:P9(`approval`,N9(n?.id)),payload:{title:i?`Approval needed: ${i}`:`Approval needed`,body:j9([a?`Risk: ${a}`:void 0,o??`An agent is waiting for tool approval.`,k9(e,t)]),urgency:`attention`}}}function Uwe(e,t){let n=M9(e.data?.question),r=N9(n?.question),i=N9(n?.context),a=N9(n?.recommendation);return{backgroundOnly:!1,kind:`error`,soundEvent:`question`,tag:P9(`question`,N9(n?.id)),payload:{title:`Nerve needs your answer`,body:j9([r??`An agent asked a question.`,i?`Context: ${i}`:void 0,a?`Recommendation: ${a}`:void 0,k9(e,t)]),urgency:`attention`}}}function Wwe(e,t){let n=M9(e.data?.planReview),r=N9(n?.title),i=N9(n?.summary),a=N9(n?.planPath);return{backgroundOnly:!1,kind:`error`,soundEvent:`planReview`,tag:P9(`plan-review`,N9(n?.id)),payload:{title:r?`Plan ready: ${r}`:`Plan ready for review`,body:j9([r,i??`An agent submitted a plan for review.`,a?`Plan: ${a}`:void 0,k9(e,t)]),urgency:`attention`}}}function Gwe(e,t){return{backgroundOnly:!0,kind:`success`,soundEvent:`completed`,tag:P9(`run-completed`,N9(e.data?.runId)),payload:{title:`Agent run completed`,body:j9([k9(e,t)])??`Nerve finished a run.`,urgency:`normal`}}}function Kwe(e,t){if(e.data?.aborted===!0)return;let n=M9(e.data?.retryExhausted);if(n){let r=Xwe(n.maxRetries),i=N9(n.errorMessage)??N9(e.data?.message);return{backgroundOnly:!1,kind:`error`,soundEvent:`failed`,tag:P9(`run-retry-exhausted`,N9(e.data?.runId)),payload:{title:`Model request needs retry`,body:j9([r===void 0?`Model request failed after retries. Open Nerve and click Continue.`:`Model request failed after ${r} ${r===1?`retry`:`retries`}. Open Nerve and click Continue.`,i,k9(e,t)]),urgency:`attention`}}}return{backgroundOnly:!0,kind:`error`,soundEvent:`failed`,tag:P9(`run-failed`,N9(e.data?.runId)),payload:{title:`Agent run failed`,body:j9([N9(e.data?.message)??`Nerve hit an agent error.`,k9(e,t)]),urgency:`attention`}}}function k9(e,t){return j9([qwe(e,t),Jwe(e,t)])}function qwe(e,t){let n=A9(e,`conversationId`);if(!n)return;let r=t.conversations.find(e=>e.id===n)?.title;return r?`Chat: ${r}`:void 0}function Jwe(e,t){let n=A9(e,`projectId`);if(!n)return;let r=t.projects.find(e=>e.id===n);if(r)return`Project: ${r.name||r.dir}`}function A9(e,t){let n=N9(e.data?.[t]);if(n)return n;for(let n of[`approval`,`question`,`planReview`,`toolCall`]){let r=N9(M9(e.data?.[n])?.[t]);if(r)return r}}function j9(e){let t=e.filter(Boolean).join(` · `);return t?Ywe(t):void 0}function Ywe(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=220?t:`${t.slice(0,219)}…`}function M9(e){return e&&typeof e==`object`?e:void 0}function N9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Xwe(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function P9(e,t){return t?`nerve:${e}:${t}`:void 0}var F9;function Zwe(){return F9||(F9=$W(Qwe),()=>{F9?.(),F9=void 0})}function Qwe(e){if(!XW(e)||!$we(e))return;let t=Vwe(e,{projects:Q.projects,conversations:Q.conversations});t&&Jn(t.payload,{backgroundOnly:t.backgroundOnly,kind:t.kind,soundEvent:t.soundEvent,tag:t.tag})}function $we(e){let t=Date.parse(e.ts);return Number.isFinite(t)&&Date.now()-t<6e4}var eTe=new Set([`branch.created`,`branch.switched`,`branch.synced`,`base.updated`,`remote.fetched`,`remote.pulled`,`remote.pushed`,`github.pr.checked_out`]);function tTe(e){let t=I9(e.data?.projectId),n=I9(e.data?.repo);if(!t?.startsWith(`proj_`)||!n)return;if(e.type===`git.repository.invalidated`)return{projectId:t,repo:n,demand:{overview:!0}};if(e.type!==`git.repository.changed`)return;let r=I9(e.data?.reason);return{projectId:t,repo:n,demand:{overview:!0,...r&&eTe.has(r)?{prs:!0}:{}}}}function I9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function nTe(e=$$){let t=t=>{try{let n=tTe(t);if(!n)return;if(t.type===`git.repository.invalidated`){Q$(n.projectId,n.repo);return}e(n.projectId,n.repo,n.demand)}catch{}},n=QW(`git.repository.invalidated`,t),r=QW(`git.repository.changed`,t);return()=>{n(),r()}}function rTe(){let e=()=>{J1(Of.projectId),q1(Of.projectId,{conversationId:Of.conversationId,agentId:Of.agentId})},t=[QW(`prompt_suggestions.trust_updated`,e),QW(`prompt_suggestions.enabled_updated`,e),QW(`prompt_suggestions.created`,e)];return()=>{for(let e of t)e()}}function iTe(e,t){switch(e){case`run.started`:case`run.resumed`:case`run.retrying`:return`running`;case`run.waiting`:case`run.suspended`:return`awaiting_user`;case`run.completed`:return`idle`;case`run.cancelled`:return`aborted`;case`run.failed`:return t?.aborted?`aborted`:`error`;default:return}}function aTe(e){return e===`conversation.created`||e===`conversation.updated`||e===`conversation.deleted`||e===`conversation.compacted`||e===`conversation.branch_summarized`||e===`conversation.navigated`||e===`project.deleted`||e===`agent.created`||e===`agent.subagent_started`||e===`agent.subagent_completed`||e.startsWith(`agent.explore_`)||e===`project.created`||e===`plan.written`||e===`toolCall.updated`||e.startsWith(`task.`)||L9(e)}function L9(e){return e.startsWith(`settings.`)||e.startsWith(`secrets.`)||e.startsWith(`auth.`)||e.startsWith(`providers.`)}function oTe(){return $W(sTe)}function sTe(e){L9(e.type)&&!(e.type.startsWith(`settings.`)&&NW())&&OW()}function cTe(){let e=[QW(`task.output`,uTe),QW(`task.removed`,lTe),QW(`task.created`,R9),QW(`task.started`,R9),QW(`task.runtime_updated`,R9),QW(`task.ready`,R9),QW(`task.timed_out`,R9),QW(`task.promoted`,R9),QW(`task.completed`,R9),QW(`task.failed`,R9),QW(`task.cancelled`,R9),QW(`task.orphaned`,R9),QW(`task.recovered`,R9),QW(`task.interrupted`,R9),QW(`task.recovery_unknown`,R9),QW(`task.updated`,R9),QW(`task.orphan_cleanup_succeeded`,R9)];return()=>{for(let t of e.splice(0))t()}}function R9(e){let t=e.data?.task;t?.id&&(sr.tasks=fJ(sr.tasks,t))}function lTe(e){let t=String(e.data?.taskId??``);t&&(sr.tasks=sr.tasks.filter(e=>e.id!==t),sr.selectedTaskId===t&&(sr.selectedTaskId=void 0,sr.taskLogs=void 0))}function uTe(e){R9(e);let t=String(e.data?.taskId??``),n=sr.tasks.find(e=>e.id===t),r=n?.definitionId??n?.restartRootTaskId??t,i=Q.activeCenterTab?.kind===`task`&&Q.activeCenterTab.id===r;t&&t===sr.selectedTaskId&&i&&uJ(t).catch(()=>void 0)}function dTe(){return QW(`usage.subscription.updated`,fTe)}function fTe(e){let t=e.data;t?.provider&&(oW.subscriptionUsage={...oW.subscriptionUsage,[t.provider]:t})}var pTe=150,z9;function mTe(){return $W(hTe)}function hTe(e){if(XW(e)&&(sK(e),yTe(e)),e.type===`conversation.deleted`){let t=B9(e.data?.conversationId);t&&OK(Pr(t))}if(_Te(e.type)){let t=vTe(e.data?.agent);t&&QG(t)}aTe(e.type)&&gTe()}function gTe(){z9&&clearTimeout(z9),z9=setTimeout(()=>{z9=void 0,PG.invalidateQueries({queryKey:FG.workspace}),CJ()},pTe)}function B9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function _Te(e){return e===`agent.created`||e===`agent.configured`||e===`agent.mode_changed`||e===`agent.status_changed`}function vTe(e){if(!e||typeof e!=`object`)return;let t=e;return typeof t.id==`string`&&typeof t.updatedAt==`string`?t:void 0}function yTe(e){let t=iTe(e.type,e.data);t&&$G(B9(e.data?.agentId),t,e.ts)}function bTe(){let e=[mTe(),zwe(),cTe(),oTe(),cG(),dTe(),Zwe(),rTe(),nTe()];return()=>{for(let t of e.splice(0))t()}}function xTe(e){function t(t){return!(t.metaKey||t.ctrlKey)||t.altKey?!1:t.key===`=`||t.key===`+`?(t.preventDefault(),e.setUiZoomLevel(e.currentZoomLevel()+1),!0):t.key===`-`||t.key===`_`?(t.preventDefault(),e.setUiZoomLevel(e.currentZoomLevel()-1),!0):t.key===`0`?(t.preventDefault(),e.setUiZoomLevel(0),!0):!1}function n(e){return e.kind===`settings`?{kind:`settings`,id:`settings`}:e.kind===`logs`?{kind:`logs`,id:`logs`}:{kind:e.kind,id:e.id}}function r(){let t=e.activeCenterTab();return t?e.centerTabs().findIndex(e=>e.kind===t.kind&&e.id===t.id):-1}function i(t){let i=e.centerTabs();if(i.length===0)return!1;let a=r(),o=((a===-1?0:a)+t+i.length)%i.length;return e.selectCenterTab(n(i[o])),!0}function a(t){let r=e.centerTabs()[t];return r?(e.selectCenterTab(n(r)),!0):!1}function o(){if(!e.hasConversationComposer())return!1;let t=[`read_only`,`supervised`,`autonomous`],n=t[(t.indexOf(e.selectedPermissionLevel())+1)%t.length]??t[0];return e.setComposerPermission(n),!0}function s(){if(!e.hasConversationComposer())return!1;let t=e.usableModels().find(t=>`${t.provider}:${t.modelId}`===e.selectedModelKey()),n=t?.supportedThinkingLevels?.length?t.supportedThinkingLevels:[`off`],r=n[(n.indexOf(e.selectedThinkingLevel())+1)%n.length]??n[0]??`off`;return e.setComposerThinkingLevel(r),!0}function c(){return e.hasConversationComposer()?(e.setComposerMode(e.selectedMode()===`coding`?`planning`:`coding`),!0):!1}function l(t){if(t.startsWith(`pane.focusByIndex.`)){let e=Number(t.split(`.`).at(-1))-1;return Number.isInteger(e)&&a(e)}let n=e.activeCenterTab();switch(t){case`conversation.new`:return e.newConversation(),!0;case`conversation.newFromProject`:return e.openProjectPicker(),!0;case`pane.close`:return n?(e.closeCenterTab(n),!0):!1;case`pane.closeOthers`:return n?(e.closeCenterTabs(e.centerTabsExcept(n),n),!0):!1;case`pane.refresh`:return n?(e.refreshCenterTab(n),!0):!1;case`pane.previous`:return i(-1);case`pane.next`:return i(1);case`projectSearch.focus`:return e.focusProjectSearch(),!0;case`composer.focus`:case`composer.cancelMic`:return e.hasConversationComposer()?(e.composerEscape(),!0):!1;case`composer.stopRun`:return e.sending()?(e.abortActiveRun(),!0):!1;case`composer.toggleMic`:return e.hasConversationComposer()?(e.toggleMic(),!0):!1;case`composer.toggleMode`:return c();case`composer.cyclePermission`:return o();case`composer.cycleThinking`:return s();case`view.toggleLeftDock`:return e.togglePanelDock(`left`),!0;case`view.toggleRightDock`:return e.togglePanelDock(`right`),!0;case`view.toggleBottomDock`:return e.togglePanelDock(`bottom`),!0;case`zoom.in`:case`zoom.out`:case`zoom.reset`:case`composer.send`:return!1}return!1}function u(e){if(t(e))return;let n=Rd.find(t=>Pd(e,t.defaultBinding));if(!n)return;let r=n.id===`pane.close`;r&&e.preventDefault(),!(Nd(e.target)&&!n.allowInEditable)&&l(n.id)&&!r&&n.id!==`composer.focus`&&n.id!==`composer.cancelMic`&&e.preventDefault()}return{activeCenterTabIndex:r,centerTabIdentity:n,cyclePermissionLevel:o,cycleThinkingLevel:s,handleWorkbenchShortcut:u,handleZoomShortcut:t,runShortcutCommand:l,selectCenterTabByIndex:a,selectRelativeCenterTab:i,toggleComposerModeShortcut:c}}async function STe(e){let t=e.now??(()=>performance.now()),n=[],r=r=>{let i={name:r,at:t()};n.push(i),e.observeMilestone?.(i)},i=t(),a;try{r(`config:start`);let o=await e.loadClientConfig();if(!e.isCurrent()||(e.applyClientConfig(o),r(`config:ready`),!e.transition(`critical`)))return V9(n,i,t());a=t(),r(`critical:start`);let s=e.loadCoreSettings().then(()=>r(`core-settings:ready`));s.catch(()=>void 0);let c=e.recoverWorkspace().then(e=>(r(`workspace:ready`),e));r(`critical:started-concurrently`);let l=await c;if(!e.isCurrent())return V9(n,i,t());let u=e.restoreCriticalConversation(l).then(e=>(r(`conversation-restoration:ready`),e)),[,d]=await Promise.all([s,u]);if(!e.isCurrent()||(await e.reconcileComposerSelection(),r(`composer-selection:reconciled`),!e.transition(`core-ready`))||(r(`core-ready`),!e.transition(`progressive`)))return V9(n,i,t());r(`progressive`);try{Promise.resolve(e.activateDeferredTab(l,d)).catch(()=>void 0)}catch{}try{e.startProgressiveWork()}catch{}return r(`progressive-work:started`),{milestones:n,phaseDurations:[{phase:`config`,durationMs:a-i},{phase:`critical`,durationMs:t()-a}],criticalBeforeProgressive:!0}}catch(t){throw e.isCurrent()&&e.transition(`failed`),r(`failed`),t}}function V9(e,t,n){return{milestones:e,phaseDurations:[{phase:`config`,durationMs:n-t},{phase:`critical`,durationMs:0}],criticalBeforeProgressive:!0}}var H9=[`encoding.json`,`event.batch`,`event.notify`,Rr,`snapshot.workspace`],CTe=[250,500,1e3,1500,2500,4e3,5e3],wTe=1e4,TTe={role:`workbench_server`},U9,W9,G9=!1,K9=!1,q9;async function ETe(){G9=!1,K9=!1;let e=H1(),t=rW();QU(t.theme,t.colorMode);try{let t=await STe({loadClientConfig:()=>jTe(`load client config`,PV),applyClientConfig:e=>{Q.config=e,e.status.capabilities.applicationLogs&&CSe(),Q.status=e.status,Q.error=void 0,kf.projectDir=e.status.storage.home},loadCoreSettings:wW,recoverWorkspace:()=>OTe(Q.config.wsUrl),restoreCriticalConversation:GK,reconcileComposerSelection:TW,activateDeferredTab:async(e,t)=>{e&&!t&&await Ap(e)},startProgressiveWork:()=>{DJ().catch(()=>void 0),kSe(),EW(),MTe()},transition:t=>W1(e,t),isCurrent:()=>U1(e)});return U1(e)?(x7(`info`,`workbench`,`Workbench initialized`,{context:t}),!0):!1}catch(t){if(!U1(e))return!1;throw G1(e,t),Q.error=J9(t),Q.connection=`error`,x7(`error`,`workbench`,`Workbench initialization failed`,{context:{criticalBeforeProgressive:!0},error:t}),t}}function DTe(){return{role:`ui`,id:kr(),instanceId:Sr(),name:`Nerve Web UI`}}async function OTe(e){await U9?.close(),W9?.();let t=Ir({source:DTe(),target:TTe}),n,r,i=new Promise((e,t)=>{n=e,r=t});return U9=new zee({transport:Br(ATe(e)),onStateChange:kTe,onError:e=>{G9||(Q.error=J9(e),x7(`warn`,`websocket`,`Protocol transport error`,{error:e})),K9||r(e)},createSession:({send:e,onDisconnect:r})=>new Cr({createMessage:t,capabilities:H9,requiredCapabilities:H9,cursors:TK,send:e,onDisconnect:r,onReady:async e=>{Q.protocolSessionId=e.sessionId;let t;if(!K9){let e=await wJ({deferTabActivation:!0});EK(e.cursor.streams,{replace:!0,sync:!1}),t=e.desiredTab,K9=!0}Q.connection=`live`,AK(),n(t)},onSnapshotRequired:async e=>{if(e===`workspace`){EK((await wJ()).cursor.streams,{sync:!1}),AK();return}let t=Or(e);t&&await BK(t)},onStreamUnavailable:e=>{x7(`warn`,`websocket`,`Event stream unavailable`,{context:{stream:e}}),OK(e)},applyEvent:async(e,t)=>{oG(),await aG(t),DK(e,t.seq)},onNotify:e=>{for(let t of e)iG(t)},diagnostics:{publish(e){x7(`warn`,`websocket`,`Protocol diagnostic`,{context:{...e,pendingNotifyEvents:ZW()}})}}})}),W9=kK(async e=>{let t=U9?.session;return!t||t.state!==`ready`?`skipped`:(await t.subscribe(e),`applied`)}),U9.start().catch(r),i}function kTe(e){e===`ready`?Q.connection=`live`:e===`closed`&&G9?Q.connection=`closed`:e===`closed`?Q.connection=`error`:Q.connection=`connecting`}function ATe(e){if(globalThis.location?.protocol===`http:`||globalThis.location?.protocol===`https:`){let e=new Ee(`/ws`,globalThis.location.href);return e.protocol=globalThis.location.protocol===`https:`?`wss:`:`ws:`,e}return new URL(e)}async function jTe(e,t){for(let[n,r]of CTe.entries())try{return await t()}catch(t){if(G9)throw t;Q.connection=`connecting`,Q.error=`Waiting for Nerve daemon to start (${J9(t)})`,x7(`warn`,`workbench`,`Workbench initialization retrying`,{context:{label:e,attempt:n+1,delayMs:r},error:t}),await new Promise(e=>setTimeout(e,r))}return t()}function J9(e){return e instanceof Error?e.message:String(e)}function MTe(){Y9(),q9=setInterval(()=>void xW().catch(()=>void 0),wTe)}function Y9(){q9!==void 0&&clearInterval(q9),q9=void 0}function NTe(){G9=!0,K1(),Y9(),T7(),oG(),W9?.(),W9=void 0,U9?.close(),U9=void 0,Q.protocolSessionId=void 0,Q.connection=`closed`}var PTe=h(`<main class="fixed inset-0 grid place-items-center bg-background text-foreground" aria-busy="true" aria-label="Starting Nerve"><div class="grid w-full max-w-lg justify-items-center p-6 text-center" style="transform: scale(var(--nerve-inverse-zoom-scale, 1)); transform-origin: center;"><!> <div class="mt-6 w-full max-w-48"><p class="mb-2 text-sm leading-relaxed text-muted-foreground" role="status" aria-live="polite"> </p> <div class="h-1 w-full overflow-hidden rounded-full bg-border" role="progressbar" aria-label="Starting Nerve"><span class="block h-full w-full rounded-full bg-primary"></span></div></div></div></main>`);function FTe(e,t){let n=I(t,`status`,3,`Opening Nerve`);var r=PTe(),i=V(r),a=V(i);Hv(a,{class:`startup-breathe size-12`});var o=L(a,2),s=V(o),c=V(s,!0);d(s),w(2),d(o),d(i),d(r),F(()=>A(c,n())),g(e,r)}function ITe(e,t){a(t,!0);let n=J(()=>If.activeProject),r=J(()=>k0.activeConversation),i=J(()=>If.activeCenterTab),o=J(()=>If.centerTabs),s=J(()=>k0.pendingConversationActive),c=J(()=>k0.selectedMode),l=J(()=>k0.selectedModelKey),d=J(()=>k0.selectedPermissionLevel),f=J(()=>k0.selectedThinkingLevel),p=J(()=>k0.sending),m=J(()=>k0.compacting),h=J(()=>N0.settingsDraft),_=J(()=>k0.usableModels),v=J(()=>W(h)?.ui.zoomLevel??qU.level),y=J(()=>I1(B1.phase));function b(){Q.projectPickerOpen=!0}function x(){u2(`conversations`,K0.isCompact),qle()}let S=xTe({currentZoomLevel:()=>W(v),setUiZoomLevel:zW,centerTabs:()=>W(o),activeCenterTab:()=>W(i),selectCenterTab:Ap,newConversation:NJ,openProjectPicker:b,closeCenterTab:jp,closeCenterTabs:xJ,centerTabsExcept:bJ,refreshCenterTab:P0,focusProjectSearch:x,hasConversationComposer:()=>!!(W(r)||W(s)),sending:()=>W(p)||W(m),abortActiveRun:()=>W(m)?kq():jq(),composerEscape:kZ,toggleMic:AZ,selectedPermissionLevel:()=>W(d),setComposerPermission:mq,usableModels:()=>W(_),selectedModelKey:()=>W(l),selectedThinkingLevel:()=>W(f),setComposerThinkingLevel:fq,selectedMode:()=>W(c),setComposerMode:pq,togglePanelDock:e=>l2(e,K0.isCompact)});be(()=>{let e=W(h)?.notifications;e&&Yn(e)});let C;be(()=>{let e=W(h)?.desktop.closeToTray;!Nn.isDesktop||e===void 0||e===C||(C=e,An(e))});let w=xle(e=>{e?j1(e,{reason:`project`,force:!0}):M1()});be(()=>{w.update(B1.progressiveActive,W(n)?.id)}),be(()=>{if(B1.progressiveActive)return j$(()=>void j1(void 0,{reason:`focus`}))}),ce(()=>{let e=bTe(),t=qn(),n=jn(),r=window.location.pathname===`/settings`||window.location.pathname===`/settings/`;return r&&window.history.replaceState({},``,`/${window.location.search}${window.location.hash}`),window.addEventListener(`keydown`,S.handleWorkbenchShortcut,{capture:!0}),ETe().then(e=>{e&&(Wn(),r&&vW())}).catch(()=>void 0),()=>{window.removeEventListener(`keydown`,S.handleWorkbenchShortcut,{capture:!0}),n(),t(),e(),NTe()}});var T=U(),E=R(T),O=e=>{var n=U();u(R(n),()=>t.children??D),g(e,n)},ee=e=>{FTe(e,{})};k(E,e=>{W(y)?e(O):e(ee,-1)}),g(e,T),z()}function LTe(e){ge(`629kra`,e=>{we(()=>{de.title=`nerve`})}),ITe(e,{children:(e,t)=>{Dwe(e,{})},$$slots:{default:!0}})}function RTe(e){LTe(e,{})}var zTe=new Set([`$$slots`,`$$events`,`$$legacy`]);function BTe(e,t){let n=H(t,zTe),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]];On(e,B({name:`circle-check`},()=>n,{get iconNode(){return r}}))}var VTe=new Set([`$$slots`,`$$events`,`$$legacy`]);function HTe(e,t){let n=H(t,VTe),r=[[`path`,{d:`m15 9-6 6`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`}],[`path`,{d:`m9 9 6 6`}]];On(e,B({name:`octagon-x`},()=>n,{get iconNode(){return r}}))}var UTe=new Set([`$$slots`,`$$events`,`$$legacy`]);function WTe(e,t){let n=H(t,UTe),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 16v-4`}],[`path`,{d:`M12 8h.01`}]];On(e,B({name:`info`},()=>n,{get iconNode(){return r}}))}var GTe=new Set([`$$slots`,`$$events`,`$$legacy`]);function KTe(e,t){let n=H(t,GTe),r=[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}],[`path`,{d:`M12 9v4`}],[`path`,{d:`M12 17h.01`}]];On(e,B({name:`triangle-alert`},()=>n,{get iconNode(){return r}}))}var qTe=new Set([`$$slots`,`$$events`,`$$legacy`]);function JTe(e,t){a(t,!0);let n=H(t,qTe);kd(e,B({get theme(){return So.current},class:`toaster group`,style:`--normal-bg: var(--color-popover); --normal-text: var(--color-popover-foreground); --normal-border: var(--color-border);`},()=>n,{loadingIcon:e=>{Fi(e,{class:`size-4`})},successIcon:e=>{BTe(e,{class:`size-4`})},errorIcon:e=>{HTe(e,{class:`size-4`})},infoIcon:e=>{WTe(e,{class:`size-4`})},warningIcon:e=>{KTe(e,{class:`size-4`})},$$slots:{loadingIcon:!0,successIcon:!0,errorIcon:!0,infoIcon:!0,warningIcon:!0}})),z()}var X9=h(`<!> <!>`,1);function YTe(e,t){a(t,!1),pe();var n=X9(),r=R(n);No(r,{}),va(L(r,2),{get client(){return PG},children:(e,t)=>{var n=X9(),r=R(n);RTe(r,{});var i=L(r,2),a=e=>{JTe(e,{position:`bottom-right`,closeButton:!0})};k(i,e=>{Nn.isDesktop||e(a)}),g(e,n)},$$slots:{default:!0}}),g(e,n),z()}var XTe=`false`,ZTe=`false`,Z9=XTe===`true`,QTe=ZTe===`true`;function $Te(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:a,onRegisteredSW:o,onRegisterError:s}=e,c,l,u,d=async(e=!0)=>{await l,Z9||u?.()};async function f(){if(`serviceWorker`in navigator){if(c=await Qx(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{s?.(e)}),!c)return;if(u=()=>{c?.messageSkipWaiting()},!QTe)if(Z9)c.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),c.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,c?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};c.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),c.addEventListener(`waiting`,t)}c.register({immediate:t}).then(e=>{o?o(`/sw.js`,e):a?.(e)}).catch(e=>{s?.(e)})}}return l=f(),d}function eEe(e){let t=e.window??window,n=e.document??document,r=e.now??Date.now,i=e.minimumCheckIntervalMs??6e4,a=-1/0,o=!1,s=()=>{if(n.visibilityState!==`visible`||o)return;let t=r();t-a<i||(a=t,o=!0,Promise.resolve().then(e.checkForUpdate).catch(()=>void 0).finally(()=>{o=!1}))},c=t.setInterval(s,e.intervalMs??60*6e4);return t.addEventListener(`focus`,s),t.addEventListener(`online`,s),n.addEventListener(`visibilitychange`,s),()=>{t.clearInterval(c),t.removeEventListener(`focus`,s),t.removeEventListener(`online`,s),n.removeEventListener(`visibilitychange`,s)}}var tEe=`nerve-pwa-update`;function nEe(){if(!rEe())return;let e,t=$Te({immediate:!0,onNeedRefresh:()=>{zn.message(`Update available`,{id:tEe,description:`A new version of Nerve is ready.`,duration:1/0,dismissible:!1,action:{label:`Reload`,onClick:()=>{t().catch(e=>{console.error(`Failed to activate the Nerve update.`,e)})}}})},onRegisteredSW:(t,n)=>{e?.(),e=n?eEe({checkForUpdate:async()=>{await n.update()}}):void 0},onRegisterError:e=>{console.error(`Failed to register the Nerve service worker.`,e)}})}function rEe(){return`serviceWorker`in navigator&&window.nerveDesktop?.kind!==`electron`}var Q9=null;try{Q9=window.sessionStorage.getItem(`nerve.initialZoomLevel`),window.sessionStorage.removeItem(`nerve.initialZoomLevel`)}catch{}Q9!==null&&nW(Number(Q9));var $9=document.getElementById(`app`);if(!$9)throw Error(`Missing #app mount target.`);nEe();var iEe=document.getElementById(`startup-bootstrap`);te(YTe,{target:$9}),iEe?.remove();export{IX as $,Ds as $n,xV as $t,X1 as A,B_ as An,UU as At,W$ as B,bf as Bn,SH as Bt,N0 as C,wy as Cn,QW as Ct,S0 as D,Yv as Dn,FW as Dt,T0 as E,Zv as En,SW as Et,P1 as F,$g as Fn,BH as Ft,S$ as G,Hu as Gn,KV as Gt,U$ as H,Id as Hn,xH as Ht,N1 as I,Hg as In,AH as It,UZ as J,yl as Jn,NV as Jt,p$ as K,Vu as Kn,GV as Kt,s1 as L,If as Ln,MH as Lt,Y1 as M,r_ as Mn,zH as Mt,Q1 as N,i_ as Nn,VH as Nt,Jce as O,fv as On,RW as Ot,B1 as P,t_ as Pn,RH as Pt,tZ as Q,Xs as Qn,wV as Qt,H$ as R,wf as Rn,kH as Rt,kle as S,Ey as Sn,_G as St,A0 as T,gy as Tn,KW as Tt,N$ as U,Ju as Un,XV as Ut,K$ as V,Rd as Vn,CH as Vt,x$ as W,Uu as Wn,bH as Wt,FZ as X,hl as Xn,MV as Xt,BZ as Y,_l as Yn,AV as Yt,iZ as Z,pl as Zn,OV as Zt,G2 as _,xC as _n,ZJ as _t,n7 as a,TR as an,oX as at,J0 as b,Qx as bn,lJ as bt,J5 as c,$I as cn,HY as ct,xfe as d,kF as dn,KY as dt,SV as en,ws as er,kX as et,b4 as f,PP as fn,qY as ft,W2 as g,Fk as gn,aY as gt,i4 as h,YM as hn,pY as ht,u7 as i,TV as in,sX as it,J1 as j,n_ as jn,VU as jt,m0 as k,U_ as kn,LW as kt,E4 as l,kI as ln,BY as lt,o4 as m,gN as mn,mY as mt,I7 as n,DV as nn,mX as nt,Z5 as o,mL as on,GY as ot,K2 as p,sP as pn,MY as pt,O$ as q,Bu as qn,jV as qt,F7 as r,CV as rn,dX as rt,Y5 as s,sL as sn,UY as st,y9 as t,EV as tn,xX as tt,S4 as u,nI as un,WY as ut,F2 as v,lS as vn,YJ as vt,M0 as w,vy as wn,GW as wt,H0 as x,Xx as xn,Qq as xt,Y0 as y,cS as yn,CJ as yt,G$ as z,Cf as zn,jH as zt};