@nervekit/desktop 0.21.0 → 0.23.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 (343) hide show
  1. package/README.md +1 -1
  2. package/dist/daemon/urls.d.ts +2 -5
  3. package/dist/daemon/urls.d.ts.map +1 -1
  4. package/dist/daemon/urls.js +4 -25
  5. package/dist/daemon/urls.js.map +1 -1
  6. package/dist/electron-download-env.d.ts +0 -1
  7. package/dist/electron-download-env.d.ts.map +1 -1
  8. package/dist/electron-download-env.js +1 -38
  9. package/dist/electron-download-env.js.map +1 -1
  10. package/dist/logging.d.ts.map +1 -1
  11. package/dist/logging.js +1 -5
  12. package/dist/logging.js.map +1 -1
  13. package/node_modules/@nervekit/contracts/dist/domains/completions/index.d.ts +1 -0
  14. package/node_modules/@nervekit/contracts/dist/domains/completions/index.d.ts.map +1 -1
  15. package/node_modules/@nervekit/contracts/dist/domains/completions/index.js +1 -0
  16. package/node_modules/@nervekit/contracts/dist/domains/completions/index.js.map +1 -1
  17. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.d.ts +13 -0
  18. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.d.ts.map +1 -0
  19. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.js +36 -0
  20. package/node_modules/@nervekit/contracts/dist/domains/completions/slash-command.js.map +1 -0
  21. package/node_modules/@nervekit/contracts/dist/domains/git/git.events.schema.d.ts.map +1 -1
  22. package/node_modules/@nervekit/contracts/dist/domains/git/git.events.schema.js +11 -1
  23. package/node_modules/@nervekit/contracts/dist/domains/git/git.events.schema.js.map +1 -1
  24. package/node_modules/@nervekit/contracts/dist/domains/protocol/operation-catalog.schema.d.ts +18 -0
  25. package/node_modules/@nervekit/contracts/dist/domains/protocol/operation-catalog.schema.d.ts.map +1 -1
  26. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.operations.schema.d.ts +18 -0
  27. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.operations.schema.d.ts.map +1 -1
  28. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.d.ts +19 -0
  29. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.d.ts.map +1 -1
  30. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.js +4 -0
  31. package/node_modules/@nervekit/contracts/dist/domains/settings/settings.schema.js.map +1 -1
  32. package/node_modules/@nervekit/contracts/package.json +1 -1
  33. package/node_modules/@nervekit/harness/dist/node.d.ts +1 -0
  34. package/node_modules/@nervekit/harness/dist/node.d.ts.map +1 -1
  35. package/node_modules/@nervekit/harness/dist/node.js +1 -0
  36. package/node_modules/@nervekit/harness/dist/node.js.map +1 -1
  37. package/node_modules/@nervekit/harness/package.json +4 -3
  38. package/node_modules/@nervekit/protocol/package.json +2 -2
  39. package/node_modules/@nervekit/tools/dist/catalog/core/confluence.tools.d.ts.map +1 -1
  40. package/node_modules/@nervekit/tools/dist/catalog/core/confluence.tools.js.map +1 -1
  41. package/node_modules/@nervekit/tools/dist/catalog/core/filesystem.tools.d.ts.map +1 -1
  42. package/node_modules/@nervekit/tools/dist/catalog/core/filesystem.tools.js.map +1 -1
  43. package/node_modules/@nervekit/tools/dist/catalog/core/interaction.tools.d.ts.map +1 -1
  44. package/node_modules/@nervekit/tools/dist/catalog/core/interaction.tools.js.map +1 -1
  45. package/node_modules/@nervekit/tools/dist/catalog/core/jira.tools.d.ts.map +1 -1
  46. package/node_modules/@nervekit/tools/dist/catalog/core/jira.tools.js.map +1 -1
  47. package/node_modules/@nervekit/tools/dist/catalog/core/python.tools.d.ts.map +1 -1
  48. package/node_modules/@nervekit/tools/dist/catalog/core/python.tools.js.map +1 -1
  49. package/node_modules/@nervekit/tools/dist/catalog/core/shell.tools.d.ts.map +1 -1
  50. package/node_modules/@nervekit/tools/dist/catalog/core/shell.tools.js.map +1 -1
  51. package/node_modules/@nervekit/tools/dist/catalog/core/web.tools.d.ts.map +1 -1
  52. package/node_modules/@nervekit/tools/dist/catalog/core/web.tools.js.map +1 -1
  53. package/node_modules/@nervekit/tools/dist/catalog/orchestration/explore.tools.d.ts.map +1 -1
  54. package/node_modules/@nervekit/tools/dist/catalog/orchestration/explore.tools.js.map +1 -1
  55. package/node_modules/@nervekit/tools/dist/catalog/orchestration/plan-mode.tools.d.ts.map +1 -1
  56. package/node_modules/@nervekit/tools/dist/catalog/orchestration/plan-mode.tools.js.map +1 -1
  57. package/node_modules/@nervekit/tools/dist/catalog/orchestration/task.tools.d.ts.map +1 -1
  58. package/node_modules/@nervekit/tools/dist/catalog/orchestration/task.tools.js.map +1 -1
  59. package/node_modules/@nervekit/tools/dist/catalog/types.d.ts +0 -2
  60. package/node_modules/@nervekit/tools/dist/catalog/types.d.ts.map +1 -1
  61. package/node_modules/@nervekit/tools/dist/catalog/types.js.map +1 -1
  62. package/node_modules/@nervekit/tools/dist/execution/shell/bash.d.ts.map +1 -1
  63. package/node_modules/@nervekit/tools/dist/execution/shell/bash.js +0 -1
  64. package/node_modules/@nervekit/tools/dist/execution/shell/bash.js.map +1 -1
  65. package/node_modules/@nervekit/tools/dist/git/git-overview.d.ts.map +1 -1
  66. package/node_modules/@nervekit/tools/dist/git/git-overview.js +7 -1
  67. package/node_modules/@nervekit/tools/dist/git/git-overview.js.map +1 -1
  68. package/node_modules/@nervekit/tools/dist/git/git-service.d.ts.map +1 -1
  69. package/node_modules/@nervekit/tools/dist/git/git-service.js +7 -2
  70. package/node_modules/@nervekit/tools/dist/git/git-service.js.map +1 -1
  71. package/node_modules/@nervekit/tools/package.json +2 -2
  72. package/node_modules/@nervekit/workbench-server/dist/domains/projects/index.d.ts +1 -0
  73. package/node_modules/@nervekit/workbench-server/dist/domains/projects/index.d.ts.map +1 -1
  74. package/node_modules/@nervekit/workbench-server/dist/domains/projects/index.js +1 -0
  75. package/node_modules/@nervekit/workbench-server/dist/domains/projects/index.js.map +1 -1
  76. package/node_modules/@nervekit/workbench-server/dist/domains/projects/project-icon.service.d.ts +28 -0
  77. package/node_modules/@nervekit/workbench-server/dist/domains/projects/project-icon.service.d.ts.map +1 -0
  78. package/node_modules/@nervekit/workbench-server/dist/domains/projects/project-icon.service.js +387 -0
  79. package/node_modules/@nervekit/workbench-server/dist/domains/projects/project-icon.service.js.map +1 -0
  80. package/node_modules/@nervekit/workbench-server/dist/domains/storage/storage-usage.service.d.ts.map +1 -1
  81. package/node_modules/@nervekit/workbench-server/dist/domains/storage/storage-usage.service.js +1 -4
  82. package/node_modules/@nervekit/workbench-server/dist/domains/storage/storage-usage.service.js.map +1 -1
  83. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/index.d.ts +0 -1
  84. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/index.d.ts.map +1 -1
  85. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/index.js +0 -1
  86. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/index.js.map +1 -1
  87. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/process-runtime/shell.d.ts.map +1 -1
  88. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/process-runtime/shell.js +0 -1
  89. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/process-runtime/shell.js.map +1 -1
  90. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-supervisor.d.ts.map +1 -1
  91. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-supervisor.js +0 -1
  92. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-supervisor.js.map +1 -1
  93. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.d.ts +35 -0
  94. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.d.ts.map +1 -0
  95. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.js +202 -0
  96. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watcher.js.map +1 -0
  97. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.d.ts +5 -0
  98. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.d.ts.map +1 -0
  99. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.js +16 -0
  100. package/node_modules/@nervekit/workbench-server/dist/domains/tools/git-repository-watching.js.map +1 -0
  101. package/node_modules/@nervekit/workbench-server/dist/index.d.ts +1 -0
  102. package/node_modules/@nervekit/workbench-server/dist/index.d.ts.map +1 -1
  103. package/node_modules/@nervekit/workbench-server/dist/index.js +1 -0
  104. package/node_modules/@nervekit/workbench-server/dist/index.js.map +1 -1
  105. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/host.d.ts +10 -0
  106. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/host.d.ts.map +1 -0
  107. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/host.js +30 -0
  108. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/host.js.map +1 -0
  109. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/index.d.ts +3 -0
  110. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/index.d.ts.map +1 -0
  111. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/index.js +3 -0
  112. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/index.js.map +1 -0
  113. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/proxy-environment.d.ts +11 -0
  114. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/proxy-environment.d.ts.map +1 -0
  115. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/proxy-environment.js +45 -0
  116. package/node_modules/@nervekit/workbench-server/dist/infrastructure/network/proxy-environment.js.map +1 -0
  117. package/node_modules/@nervekit/workbench-server/dist/infrastructure/storage/initialize.d.ts.map +1 -1
  118. package/node_modules/@nervekit/workbench-server/dist/infrastructure/storage/initialize.js +0 -1
  119. package/node_modules/@nervekit/workbench-server/dist/infrastructure/storage/initialize.js.map +1 -1
  120. package/node_modules/@nervekit/workbench-server/dist/main.js +5 -64
  121. package/node_modules/@nervekit/workbench-server/dist/main.js.map +1 -1
  122. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.d.ts +6 -7
  123. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.d.ts.map +1 -1
  124. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.js +4 -27
  125. package/node_modules/@nervekit/workbench-server/dist/protocol/method-handlers/platform-method-handlers.js.map +1 -1
  126. package/node_modules/@nervekit/workbench-server/dist/routes/completion-routes.d.ts.map +1 -1
  127. package/node_modules/@nervekit/workbench-server/dist/routes/completion-routes.js +2 -28
  128. package/node_modules/@nervekit/workbench-server/dist/routes/completion-routes.js.map +1 -1
  129. package/node_modules/@nervekit/workbench-server/dist/routes/project-routes.d.ts.map +1 -1
  130. package/node_modules/@nervekit/workbench-server/dist/routes/project-routes.js +21 -0
  131. package/node_modules/@nervekit/workbench-server/dist/routes/project-routes.js.map +1 -1
  132. package/node_modules/@nervekit/workbench-server/dist/routes/settings-routes.d.ts.map +1 -1
  133. package/node_modules/@nervekit/workbench-server/dist/routes/settings-routes.js +0 -12
  134. package/node_modules/@nervekit/workbench-server/dist/routes/settings-routes.js.map +1 -1
  135. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.d.ts +4 -1
  136. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.d.ts.map +1 -1
  137. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.js +13 -3
  138. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-composition.js.map +1 -1
  139. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.d.ts +1 -0
  140. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.d.ts.map +1 -1
  141. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.js +4 -0
  142. package/node_modules/@nervekit/workbench-server/dist/runtime/runtime-registry.js.map +1 -1
  143. package/node_modules/@nervekit/workbench-server/dist/web/assets/AuthShell-GogBMM7S.js +7 -0
  144. package/node_modules/@nervekit/workbench-server/dist/web/assets/DiffShell-DJOeYrRj.js +1 -0
  145. package/node_modules/@nervekit/workbench-server/dist/web/assets/FileShell-51rdTc2O.js +1 -0
  146. package/node_modules/@nervekit/workbench-server/dist/web/assets/FilesPanelView-CRi7ktm1.js +1 -0
  147. package/node_modules/@nervekit/workbench-server/dist/web/assets/GitPullRequestsPanelView-piJz3lXy.js +1 -0
  148. package/node_modules/@nervekit/workbench-server/dist/web/assets/LogsShell-CtA5DDqm.js +3 -0
  149. package/node_modules/@nervekit/workbench-server/dist/web/assets/PrShell-D0xu74Xe.js +1 -0
  150. package/node_modules/@nervekit/workbench-server/dist/web/assets/SettingsShell-3yiDBypm.js +4 -0
  151. package/node_modules/@nervekit/workbench-server/dist/web/assets/TaskOutputPane-BwdNMYln.css +1 -0
  152. package/node_modules/@nervekit/workbench-server/dist/web/assets/TaskOutputPane-D278A8_j.js +4 -0
  153. package/node_modules/@nervekit/workbench-server/dist/web/assets/TaskShell-6yD46EEs.js +1 -0
  154. package/node_modules/@nervekit/workbench-server/dist/web/assets/TasksPanelView-Bpimx72m.js +1 -0
  155. package/node_modules/@nervekit/workbench-server/dist/web/assets/{abnfDiagram-N423BO3Z-BQvGwAOZ.js → abnfDiagram-N423BO3Z-D_hWhAcq.js} +1 -1
  156. package/node_modules/@nervekit/workbench-server/dist/web/assets/api-B4t7L3Vi.js +1 -0
  157. package/node_modules/@nervekit/workbench-server/dist/web/assets/architecture-TIHT7OUA-CJMiZFOA.js +1 -0
  158. package/node_modules/@nervekit/workbench-server/dist/web/assets/{architectureDiagram-T3A2C74G-T_gGQddN.js → architectureDiagram-T3A2C74G-CxY90Oec.js} +1 -1
  159. package/node_modules/@nervekit/workbench-server/dist/web/assets/{blockDiagram-VBNYF7ZC-ysKluxsM.js → blockDiagram-VBNYF7ZC-CLIL9DLE.js} +1 -1
  160. package/node_modules/@nervekit/workbench-server/dist/web/assets/{c4Diagram-5PPSVZJV-BUsC8IqR.js → c4Diagram-5PPSVZJV-tbEjli1O.js} +1 -1
  161. package/node_modules/@nervekit/workbench-server/dist/web/assets/channel-DjPccr-e.js +1 -0
  162. package/node_modules/@nervekit/workbench-server/dist/web/assets/check-DoPBuCxK.js +1 -0
  163. package/node_modules/@nervekit/workbench-server/dist/web/assets/checkbox-BIKfbY36.js +1 -0
  164. package/node_modules/@nervekit/workbench-server/dist/web/assets/chevron-down-PAPkYMv8.js +1 -0
  165. package/node_modules/@nervekit/workbench-server/dist/web/assets/chevron-up-By6xmI8s.js +1 -0
  166. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-2GRJ4B5K-BW2k3PNn.js → chunk-2GRJ4B5K-C9rVgQoY.js} +1 -1
  167. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-3NCLNEKW-D4_YVfD7.js +1 -0
  168. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-4I5QYGJK-C-C1wGYE.js → chunk-4I5QYGJK-BPTCKvEl.js} +1 -1
  169. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-5RXB4S5H-Cuj4Wyyi.js → chunk-5RXB4S5H-BFkZe3w7.js} +1 -1
  170. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-6Q2QTUOP-CfSX9zzr.js → chunk-6Q2QTUOP-Cbxnd_rm.js} +1 -1
  171. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-7Z6QIM7H-BBVpK819.js → chunk-7Z6QIM7H-BQZtz9rb.js} +1 -1
  172. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-GF5L2VYU-Bz29O6Fm.js → chunk-GF5L2VYU-CA61ww5L.js} +1 -1
  173. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-I66GZJ75-BoWypIh9.js +125 -0
  174. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-J7OUQ5F2-CSauaRMe.js +2 -0
  175. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-JQJVKLGR-BbaEwyz9.js → chunk-JQJVKLGR-BVxJfe4w.js} +1 -1
  176. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-KBJHAD2P-D4ajrZj0.js → chunk-KBJHAD2P-B7S50seK.js} +1 -1
  177. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-NSK5VX7P-BxAErRSL.js → chunk-NSK5VX7P-YZFIso__.js} +1 -1
  178. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-QR6OTTB3-CqwhByxV.js → chunk-QR6OTTB3-DyTnqZsr.js} +1 -1
  179. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-RYQCIY6F-AsrcnhOn.js → chunk-RYQCIY6F-CopinFcf.js} +1 -1
  180. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-UBXNYLIW-CFryZrPK.js → chunk-UBXNYLIW-C1emy36W.js} +1 -1
  181. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-W5SLKNZC-DdNs-ICd.js → chunk-W5SLKNZC-BnKQ6wYv.js} +1 -1
  182. package/node_modules/@nervekit/workbench-server/dist/web/assets/{chunk-WRU74C26-DaFT3tfi.js → chunk-WRU74C26-cfekww3v.js} +1 -1
  183. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-XXDRQBXY-DlmHFBEL.js +1 -0
  184. package/node_modules/@nervekit/workbench-server/dist/web/assets/circle-check-BZN2Yiy8.js +1 -0
  185. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-JCYQIIEL-C8Pw9eC_.js +1 -0
  186. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-v2-OCEON4UE-C8Pw9eC_.js +1 -0
  187. package/node_modules/@nervekit/workbench-server/dist/web/assets/code-BBTFHMHm.js +2 -0
  188. package/node_modules/@nervekit/workbench-server/dist/web/assets/confirm-dialog-BIwgdBR1.js +25 -0
  189. package/node_modules/@nervekit/workbench-server/dist/web/assets/{cose-bilkent-JH36ORCC-jfIOeXSF.js → cose-bilkent-JH36ORCC-BnRg9jNe.js} +1 -1
  190. package/node_modules/@nervekit/workbench-server/dist/web/assets/credential-crypto-Dh0i163n.js +1 -0
  191. package/node_modules/@nervekit/workbench-server/dist/web/assets/{cynefin-VYW2F7L2-DyO273Nb.js → cynefin-VYW2F7L2-DLScjhCl.js} +1 -1
  192. package/node_modules/@nervekit/workbench-server/dist/web/assets/{cynefinDiagram-MW4NZA55-DKqr7fNe.js → cynefinDiagram-MW4NZA55-IzU41stp.js} +1 -1
  193. package/node_modules/@nervekit/workbench-server/dist/web/assets/{dagre-VZM6K2ZE-fXJK6FeK.js → dagre-VZM6K2ZE-BeAq1sUz.js} +1 -1
  194. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-7IWD3JNH-_EVqtb48.js → diagram-7IWD3JNH-Bv6pyOTt.js} +1 -1
  195. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-B4RE2ZJO-WRJJ90ty.js → diagram-B4RE2ZJO-Dkq-jhUq.js} +1 -1
  196. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-LBJQPF4R-Bj_ldaRJ.js → diagram-LBJQPF4R-C5rxqfvC.js} +1 -1
  197. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-Q27KOJAE-DMuukQW3.js → diagram-Q27KOJAE-DVK1ojPJ.js} +1 -1
  198. package/node_modules/@nervekit/workbench-server/dist/web/assets/{diagram-UB23O5K3-CeCKQgiY.js → diagram-UB23O5K3-BneMibzq.js} +1 -1
  199. package/node_modules/@nervekit/workbench-server/dist/web/assets/dialog-description-CtQUBFDt.js +5 -0
  200. package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-Ci71hNpt.js → dist-DYAlPOZA.js} +1 -1
  201. package/node_modules/@nervekit/workbench-server/dist/web/assets/{ebnfDiagram-BXEA7PRR-TqJirFSZ.js → ebnfDiagram-BXEA7PRR-Dyia633q.js} +1 -1
  202. package/node_modules/@nervekit/workbench-server/dist/web/assets/{erDiagram-JOGREHBK-Bwe7PPhP.js → erDiagram-JOGREHBK-Dn7oyqoC.js} +1 -1
  203. package/node_modules/@nervekit/workbench-server/dist/web/assets/eventmodeling-45OFAUF4-BsAOJJbH.js +1 -0
  204. package/node_modules/@nervekit/workbench-server/dist/web/assets/file-state.svelte-B5pdWaCW.js +1 -0
  205. package/node_modules/@nervekit/workbench-server/dist/web/assets/flowDiagram-UKHOOZJN-ygLGZULZ.js +1 -0
  206. package/node_modules/@nervekit/workbench-server/dist/web/assets/ganttDiagram-PKOTCBZU-45_2NisB.js +292 -0
  207. package/node_modules/@nervekit/workbench-server/dist/web/assets/git-B-Ea_lVe.js +5 -0
  208. package/node_modules/@nervekit/workbench-server/dist/web/assets/git.api-CVPZVH69.js +1 -0
  209. package/node_modules/@nervekit/workbench-server/dist/web/assets/{gitGraph-TEB2WS4Q-Didn8YFH.js → gitGraph-TEB2WS4Q-Dg98PJ1l.js} +1 -1
  210. package/node_modules/@nervekit/workbench-server/dist/web/assets/{gitGraphDiagram-DS77QQ5N-DQIfPJ2s.js → gitGraphDiagram-DS77QQ5N-BIj2rZt5.js} +1 -1
  211. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-CT_EqKhl.js +156 -0
  212. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-gQ7szeLR.css +1 -0
  213. package/node_modules/@nervekit/workbench-server/dist/web/assets/{info-DKCQHKI2-DYcoAuHZ.js → info-DKCQHKI2-_QY3CJxa.js} +1 -1
  214. package/node_modules/@nervekit/workbench-server/dist/web/assets/{infoDiagram-6WML65LV-CpW6nqFl.js → infoDiagram-6WML65LV-BitxSh5S.js} +1 -1
  215. package/node_modules/@nervekit/workbench-server/dist/web/assets/{ishikawaDiagram-WSZJBQD7-FQbW3RyQ.js → ishikawaDiagram-WSZJBQD7-BbcMCsDB.js} +1 -1
  216. package/node_modules/@nervekit/workbench-server/dist/web/assets/{journeyDiagram-NVQOT4AX-DZXcglnz.js → journeyDiagram-NVQOT4AX-WeNcR_i1.js} +1 -1
  217. package/node_modules/@nervekit/workbench-server/dist/web/assets/{kanban-definition-27J2QSJJ-BDSIU4Cq.js → kanban-definition-27J2QSJJ-DTVs4K26.js} +1 -1
  218. package/node_modules/@nervekit/workbench-server/dist/web/assets/{line-BnVa8ftx.js → line-CotFvITj.js} +1 -1
  219. package/node_modules/@nervekit/workbench-server/dist/web/assets/{linear-DpDBHYTx.js → linear-B5o1HJum.js} +1 -1
  220. package/node_modules/@nervekit/workbench-server/dist/web/assets/logs.api-H6CPKT0t.js +1 -0
  221. package/node_modules/@nervekit/workbench-server/dist/web/assets/{mermaid-parser.core-DKgsfEdo.js → mermaid-parser.core-DLGMGA-3.js} +3 -3
  222. package/node_modules/@nervekit/workbench-server/dist/web/assets/mermaid.core-oRWj6taj.js +11 -0
  223. package/node_modules/@nervekit/workbench-server/dist/web/assets/{mindmap-definition-FAOFIHXS-CS634_fL.js → mindmap-definition-FAOFIHXS-CJNa1EIY.js} +1 -1
  224. package/node_modules/@nervekit/workbench-server/dist/web/assets/notify.svelte-DzzVV73k.js +1 -0
  225. package/node_modules/@nervekit/workbench-server/dist/web/assets/{packet-7NZHBO7P-Oc6wU-dc.js → packet-7NZHBO7P-BpYG_d_t.js} +1 -1
  226. package/node_modules/@nervekit/workbench-server/dist/web/assets/panel-Du8LwaMN.js +1 -0
  227. package/node_modules/@nervekit/workbench-server/dist/web/assets/panel-pO-d12Zt.css +1 -0
  228. package/node_modules/@nervekit/workbench-server/dist/web/assets/{pegDiagram-VL7TDLO6-CQGfupoV.js → pegDiagram-VL7TDLO6-TC1fCPkO.js} +1 -1
  229. package/node_modules/@nervekit/workbench-server/dist/web/assets/{pie-RZYD4A2V-Bk0OOpw0.js → pie-RZYD4A2V-CjMHeN_l.js} +1 -1
  230. package/node_modules/@nervekit/workbench-server/dist/web/assets/{pieDiagram-7S7Q4E2Y-Cxdep5t3.js → pieDiagram-7S7Q4E2Y-RMErWNi_.js} +1 -1
  231. package/node_modules/@nervekit/workbench-server/dist/web/assets/popper-layer-force-mount-BJxHYiEI.js +1 -0
  232. package/node_modules/@nervekit/workbench-server/dist/web/assets/preload-helper-zJ_50EbN.js +1 -0
  233. package/node_modules/@nervekit/workbench-server/dist/web/assets/purify.es-Bs0Imjnk.js +3 -0
  234. package/node_modules/@nervekit/workbench-server/dist/web/assets/{quadrantDiagram-CIZ2JOQS-Dk7BCP9d.js → quadrantDiagram-CIZ2JOQS-Dn7Qg8zF.js} +1 -1
  235. package/node_modules/@nervekit/workbench-server/dist/web/assets/{radar-I7S5WNFK-CFB6_yvT.js → radar-I7S5WNFK-BLMbO1kY.js} +1 -1
  236. package/node_modules/@nervekit/workbench-server/dist/web/assets/{railroad-3IZDKUUU-BZgdTfjv.js → railroad-3IZDKUUU-ByW0VI2-.js} +1 -1
  237. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-abnf-AHOZXSZD-DtI5E8Ba.js +1 -0
  238. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-ebnf-EBAXGLYW-evumEePh.js +1 -0
  239. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-peg-LSFZ7HO6-DsxZzr6-.js +1 -0
  240. package/node_modules/@nervekit/workbench-server/dist/web/assets/{railroadDiagram-AXF67PYL-B39qNFfy.js → railroadDiagram-AXF67PYL-CZgz_LXR.js} +1 -1
  241. package/node_modules/@nervekit/workbench-server/dist/web/assets/{requirementDiagram-LRYGKXZP-fSJxTsD3.js → requirementDiagram-LRYGKXZP-BFVYIaJT.js} +1 -1
  242. package/node_modules/@nervekit/workbench-server/dist/web/assets/rotate-ccw-C7To98zz.js +1 -0
  243. package/node_modules/@nervekit/workbench-server/dist/web/assets/{sankeyDiagram-W5VNT64P-le1jhrbo.js → sankeyDiagram-W5VNT64P-SPAGMzSX.js} +1 -1
  244. package/node_modules/@nervekit/workbench-server/dist/web/assets/scratch-notes-Cxtj6KmK.js +1 -0
  245. package/node_modules/@nervekit/workbench-server/dist/web/assets/scratch-notes.api-HLM2PdFq.js +1 -0
  246. package/node_modules/@nervekit/workbench-server/dist/web/assets/scroll-area-KDadRCXu.js +1 -0
  247. package/node_modules/@nervekit/workbench-server/dist/web/assets/select-field-Ci7rKvBU.js +1 -0
  248. package/node_modules/@nervekit/workbench-server/dist/web/assets/{sequenceDiagram-SI44F4Z6-B8sy98rq.js → sequenceDiagram-SI44F4Z6-y-07t8Cc.js} +1 -1
  249. package/node_modules/@nervekit/workbench-server/dist/web/assets/settings-actions.svelte-qpLxl9Wc.js +9 -0
  250. package/node_modules/@nervekit/workbench-server/dist/web/assets/spinner-4Ehx2P3o.js +2 -0
  251. package/node_modules/@nervekit/workbench-server/dist/web/assets/{src-Bdf7luT7.js → src-BNlArFnY.js} +1 -1
  252. package/node_modules/@nervekit/workbench-server/dist/web/assets/state-CzQbNY28.js +10 -0
  253. package/node_modules/@nervekit/workbench-server/dist/web/assets/{stateDiagram-OKZ733FA-gcUtfVyX.js → stateDiagram-OKZ733FA-BGRv83TA.js} +1 -1
  254. package/node_modules/@nervekit/workbench-server/dist/web/assets/stateDiagram-v2-UEYNNEHI-BqurxSO4.js +1 -0
  255. package/node_modules/@nervekit/workbench-server/dist/web/assets/status-dot-CNXeV1P6.js +1 -0
  256. package/node_modules/@nervekit/workbench-server/dist/web/assets/swimlanes-SLNWSIFB-wzOkZXex.js +2 -0
  257. package/node_modules/@nervekit/workbench-server/dist/web/assets/swimlanesDiagram-ULZ7WXOC-DI7cWfWq.js +8 -0
  258. package/node_modules/@nervekit/workbench-server/dist/web/assets/{timeline-definition-Z64GVDOM-CpW4XBbR.js → timeline-definition-Z64GVDOM-qiE89aw7.js} +1 -1
  259. package/node_modules/@nervekit/workbench-server/dist/web/assets/toast-state.svelte-xRrQk15E.js +1 -0
  260. package/node_modules/@nervekit/workbench-server/dist/web/assets/toggle-group-DDKj7Oao.js +1 -0
  261. package/node_modules/@nervekit/workbench-server/dist/web/assets/trash-2-CCYVhwm2.js +1 -0
  262. package/node_modules/@nervekit/workbench-server/dist/web/assets/{treeView-QDETBFTQ-CT4Ibeho.js → treeView-QDETBFTQ-pFWeafk8.js} +1 -1
  263. package/node_modules/@nervekit/workbench-server/dist/web/assets/{treemap-6X3UGDF4-BFY78XhI.js → treemap-6X3UGDF4-C3SXF7X9.js} +1 -1
  264. package/node_modules/@nervekit/workbench-server/dist/web/assets/{vennDiagram-T6HMQDX7-DC485Kqf.js → vennDiagram-T6HMQDX7-DBGe1CHe.js} +1 -1
  265. package/node_modules/@nervekit/workbench-server/dist/web/assets/virtual-list-DPBJTpm6.js +1 -0
  266. package/node_modules/@nervekit/workbench-server/dist/web/assets/{wardley-OPB4EBWU-B_zkNB3a.js → wardley-OPB4EBWU-B5mrobWh.js} +1 -1
  267. package/node_modules/@nervekit/workbench-server/dist/web/assets/{wardleyDiagram-T6FBY63Y-QgSIC1tM.js → wardleyDiagram-T6FBY63Y-BpkRBNnM.js} +1 -1
  268. package/node_modules/@nervekit/workbench-server/dist/web/assets/workspace-actions.svelte-fmfCaU70.js +3 -0
  269. package/node_modules/@nervekit/workbench-server/dist/web/assets/x-BHsG-mGK.js +1 -0
  270. package/node_modules/@nervekit/workbench-server/dist/web/assets/{xychartDiagram-ELKLHX3M-J-dhsbdt.js → xychartDiagram-ELKLHX3M-PU2_XpYt.js} +1 -1
  271. package/node_modules/@nervekit/workbench-server/dist/web/index.html +33 -20
  272. package/node_modules/@nervekit/workbench-server/dist/web/sw.js +1 -1
  273. package/node_modules/@nervekit/workbench-server/package.json +5 -5
  274. package/package.json +6 -6
  275. package/node_modules/@nervekit/contracts/dist/domains/pinned-commands/pinned-command.operations.schema.d.ts +0 -71
  276. package/node_modules/@nervekit/contracts/dist/domains/pinned-commands/pinned-command.operations.schema.d.ts.map +0 -1
  277. package/node_modules/@nervekit/contracts/dist/domains/pinned-commands/pinned-command.operations.schema.js +0 -25
  278. package/node_modules/@nervekit/contracts/dist/domains/pinned-commands/pinned-command.operations.schema.js.map +0 -1
  279. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-readiness.service.d.ts +0 -7
  280. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-readiness.service.d.ts.map +0 -1
  281. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-readiness.service.js +0 -27
  282. package/node_modules/@nervekit/workbench-server/dist/domains/tasks/task-readiness.service.js.map +0 -1
  283. package/node_modules/@nervekit/workbench-server/dist/web/assets/AuthShell-NbeFRi_q.js +0 -7
  284. package/node_modules/@nervekit/workbench-server/dist/web/assets/DiffShell-CXbZJlLG.js +0 -1
  285. package/node_modules/@nervekit/workbench-server/dist/web/assets/FileShell-Cg2bNpS1.js +0 -1
  286. package/node_modules/@nervekit/workbench-server/dist/web/assets/FilesPanelView-CnNkKGX2.js +0 -1
  287. package/node_modules/@nervekit/workbench-server/dist/web/assets/GitPullRequestsPanelView-DYC3T8A7.js +0 -1
  288. package/node_modules/@nervekit/workbench-server/dist/web/assets/LogsShell-Bn6B-So1.js +0 -2
  289. package/node_modules/@nervekit/workbench-server/dist/web/assets/LogsShell-Cu3zYRGe.css +0 -1
  290. package/node_modules/@nervekit/workbench-server/dist/web/assets/PrShell-Dsng-Aya.js +0 -1
  291. package/node_modules/@nervekit/workbench-server/dist/web/assets/SettingsShell-C9rL1szU.js +0 -3
  292. package/node_modules/@nervekit/workbench-server/dist/web/assets/TaskShell-CCAZjK9o.js +0 -1
  293. package/node_modules/@nervekit/workbench-server/dist/web/assets/TasksPanelView-BV2VovlR.js +0 -1
  294. package/node_modules/@nervekit/workbench-server/dist/web/assets/architecture-TIHT7OUA-Z4OQU5Fu.js +0 -1
  295. package/node_modules/@nervekit/workbench-server/dist/web/assets/button-CVO5fNBi.js +0 -2
  296. package/node_modules/@nervekit/workbench-server/dist/web/assets/channel-DKA3-9I6.js +0 -1
  297. package/node_modules/@nervekit/workbench-server/dist/web/assets/checkbox-DTiwSGQF.js +0 -1
  298. package/node_modules/@nervekit/workbench-server/dist/web/assets/chevron-down-B7JAcl1j.js +0 -1
  299. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-3NCLNEKW-D5KXKJA5.js +0 -1
  300. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-I66GZJ75-C1Uf6uvM.js +0 -125
  301. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-J7OUQ5F2-MaDAPO1H.js +0 -2
  302. package/node_modules/@nervekit/workbench-server/dist/web/assets/chunk-XXDRQBXY-DXC-pGHz.js +0 -1
  303. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-JCYQIIEL-MnQb-u9c.js +0 -1
  304. package/node_modules/@nervekit/workbench-server/dist/web/assets/classDiagram-v2-OCEON4UE-MnQb-u9c.js +0 -1
  305. package/node_modules/@nervekit/workbench-server/dist/web/assets/code-Cz4NuT3w.js +0 -2
  306. package/node_modules/@nervekit/workbench-server/dist/web/assets/credential-crypto-Cs2Lsmdw.js +0 -1
  307. package/node_modules/@nervekit/workbench-server/dist/web/assets/desktop-bridge.svelte-CDIrP8Lg.js +0 -1
  308. package/node_modules/@nervekit/workbench-server/dist/web/assets/dist-DTR83M_W.js +0 -25
  309. package/node_modules/@nervekit/workbench-server/dist/web/assets/eventmodeling-45OFAUF4-BKcq2yaq.js +0 -1
  310. package/node_modules/@nervekit/workbench-server/dist/web/assets/file-state.svelte-fK_ncpqb.js +0 -1
  311. package/node_modules/@nervekit/workbench-server/dist/web/assets/flowDiagram-UKHOOZJN-DBGaVxY1.js +0 -1
  312. package/node_modules/@nervekit/workbench-server/dist/web/assets/ganttDiagram-PKOTCBZU-BRaAo0_G.js +0 -292
  313. package/node_modules/@nervekit/workbench-server/dist/web/assets/git-Cwqv44-m.js +0 -5
  314. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-DIWu29rF.js +0 -169
  315. package/node_modules/@nervekit/workbench-server/dist/web/assets/index-YSHHqi_A.css +0 -1
  316. package/node_modules/@nervekit/workbench-server/dist/web/assets/legacy-rAg2dwjR.js +0 -1
  317. package/node_modules/@nervekit/workbench-server/dist/web/assets/mermaid.core-mWIFQm8i.js +0 -11
  318. package/node_modules/@nervekit/workbench-server/dist/web/assets/notify.svelte-DvUTOP7s.js +0 -1
  319. package/node_modules/@nervekit/workbench-server/dist/web/assets/panel-DE9divB9.js +0 -1
  320. package/node_modules/@nervekit/workbench-server/dist/web/assets/popper-layer-force-mount-DHU7ILEx.js +0 -1
  321. package/node_modules/@nervekit/workbench-server/dist/web/assets/purify.es--UZZef80.js +0 -2
  322. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-abnf-AHOZXSZD-BNfX4t04.js +0 -1
  323. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-ebnf-EBAXGLYW-B7eMhM4S.js +0 -1
  324. package/node_modules/@nervekit/workbench-server/dist/web/assets/railroad-peg-LSFZ7HO6-B1ZB-7vK.js +0 -1
  325. package/node_modules/@nervekit/workbench-server/dist/web/assets/scratch-notes-Dp9Qv2DB.js +0 -1
  326. package/node_modules/@nervekit/workbench-server/dist/web/assets/scroll-area-7H4ZayRq.js +0 -1
  327. package/node_modules/@nervekit/workbench-server/dist/web/assets/select-field-u8QUBe4W.js +0 -1
  328. package/node_modules/@nervekit/workbench-server/dist/web/assets/spinner-BjfTQcTY.js +0 -1
  329. package/node_modules/@nervekit/workbench-server/dist/web/assets/state-DGmj3MVW.js +0 -10
  330. package/node_modules/@nervekit/workbench-server/dist/web/assets/stateDiagram-v2-UEYNNEHI-Scr7HccZ.js +0 -1
  331. package/node_modules/@nervekit/workbench-server/dist/web/assets/status-dot-5fTmlMf5.js +0 -5
  332. package/node_modules/@nervekit/workbench-server/dist/web/assets/swimlanes-SLNWSIFB-QSeWxhjb.js +0 -2
  333. package/node_modules/@nervekit/workbench-server/dist/web/assets/swimlanesDiagram-ULZ7WXOC-CDejUJab.js +0 -8
  334. package/node_modules/@nervekit/workbench-server/dist/web/assets/task-state.svelte-WTxmxGsR.js +0 -1
  335. package/node_modules/@nervekit/workbench-server/dist/web/assets/tasks.api-B8W55vtY.js +0 -1
  336. package/node_modules/@nervekit/workbench-server/dist/web/assets/toast-state.svelte-Cc86Tnw4.js +0 -1
  337. package/node_modules/@nervekit/workbench-server/dist/web/assets/virtual-list-y3Fa09LY.js +0 -1
  338. /package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-BNb8NB8T.js → dist-BNb8NB8T2.js} +0 -0
  339. /package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-BaUAMSAA.js → dist-BaUAMSAA2.js} +0 -0
  340. /package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-DKZNABaU.js → dist-DKZNABaU2.js} +0 -0
  341. /package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-DoE1YLtA.js → dist-DoE1YLtA2.js} +0 -0
  342. /package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-DrXYFU-o.js → dist-DrXYFU-o2.js} +0 -0
  343. /package/node_modules/@nervekit/workbench-server/dist/web/assets/{dist-Go0hY8Nc.js → dist-Go0hY8Nc2.js} +0 -0
@@ -1,169 +0,0 @@
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-mWIFQm8i.js","assets/chunk-4I5QYGJK-C-C1wGYE.js","assets/src-Bdf7luT7.js","assets/chunk-QTnfLwEv.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/chunk-I66GZJ75-C1Uf6uvM.js","assets/purify.es--UZZef80.js","assets/chunk-NSK5VX7P-BxAErRSL.js","assets/dist-lRkD-JPF.js","assets/chunk-WRU74C26-DaFT3tfi.js","assets/chunk-3NCLNEKW-D5KXKJA5.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-7Z6QIM7H-BBVpK819.js","assets/line-BnVa8ftx.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-QR6OTTB3-CqwhByxV.js","assets/chunk-UBXNYLIW-CFryZrPK.js","assets/chunk-W5SLKNZC-DdNs-ICd.js","assets/rough.esm-CSKSodPl.js","assets/chunk-J7OUQ5F2-MaDAPO1H.js","assets/chunk-ZIRB5QZD-H-kepumB.js","assets/TaskShell-CCAZjK9o.js","assets/button-CVO5fNBi.js","assets/FileShell-Cg2bNpS1.js","assets/scroll-area-7H4ZayRq.js","assets/spinner-BjfTQcTY.js","assets/code-Cz4NuT3w.js","assets/dist-CuX9uX_B.js","assets/FileShell-Dp-BAGcK.css","assets/PrShell-Dsng-Aya.js","assets/git-Cwqv44-m.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-CXbZJlLG.js","assets/file-state.svelte-fK_ncpqb.js","assets/task-state.svelte-WTxmxGsR.js","assets/SettingsShell-C9rL1szU.js","assets/select-field-u8QUBe4W.js","assets/select-field-CV-KWLNP.css","assets/checkbox-DTiwSGQF.js","assets/legacy-rAg2dwjR.js","assets/credential-crypto-Cs2Lsmdw.js","assets/credential-crypto-BDCyIX5i.css","assets/state-DGmj3MVW.js","assets/dist-DTR83M_W.js","assets/text-preview-BB9zMOPI.js","assets/AuthShell-NbeFRi_q.js","assets/AuthShell-CI3W44sI.css","assets/LogsShell-Bn6B-So1.js","assets/LogsShell-Cu3zYRGe.css","assets/FilesPanelView-CnNkKGX2.js","assets/TasksPanelView-BV2VovlR.js","assets/tasks.api-B8W55vtY.js","assets/scratch-notes-Dp9Qv2DB.js","assets/GitPullRequestsPanelView-DYC3T8A7.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 ie,a as N,at as ae,b as oe,bt as se,c as ce,ct as P,d as le,dt as ue,et as de,f as F,ft as fe,g as pe,gt as I,h as me,ht as L,i as he,it as ge,j as _e,jt as ve,k as ye,kt as R,l as be,lt as z,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 Oe,tt as ke,u as Ae,ut as je,v as Me,vt as G,w as K,x as Ne,xt as q,y as Pe,yt as J,z as Fe,zt as Ie}from"./button-CVO5fNBi.js";import"./legacy-rAg2dwjR.js";import{B as Le,Ct as Re,Dt as ze,F as Be,Ft as Ve,G as He,H as Ue,I as eee,L as tee,N as We,Nt as Y,Ot as Ge,P as Ke,Pt as qe,R as Je,U as Ye,V as Xe,W as Ze,Y as Qe,_t as $e,a as et,b as nee,bt as tt,c as nt,ft as rt,gt as it,ht as ree,i as at,j as iee,kt as ot,l as st,lt as ct,m as lt,mt as ut,n as dt,o as ft,p as aee,pt,r as mt,s as ht,t as gt,u as _t,ut as vt,v as yt,vt as bt,wt as xt,yt as St,z as Ct}from"./status-dot-5fTmlMf5.js";import{A as wt,C as Tt,D as Et,E as Dt,M as Ot,N as oee,O as see,P as kt,S as At,T as jt,_ as cee,a as lee,b as Mt,c as uee,d as Nt,f as Pt,g as Ft,h as It,i as Lt,j as Rt,k as zt,l as Bt,m as Vt,n as Ht,o as Ut,p as Wt,r as Gt,s as Kt,t as qt,u as Jt,v as Yt,w as Xt,x as Zt,y as Qt}from"./state-DGmj3MVW.js";import{a as $t,i as en,n as tn,o as nn,r as rn,t as an}from"./select-field-u8QUBe4W.js";import{a as dee,i as on,n as sn,o as cn,r as ln,t as un}from"./popper-layer-force-mount-DHU7ILEx.js";import{C as dn,D as fee,E as fn,O as pee,S as pn,T as mn,a as hn,c as gn,d as _n,f as vn,i as yn,l as bn,n as xn,o as Sn,p as Cn,r as wn,s as Tn,t as En,u as Dn,w as On,x as kn}from"./panel-DE9divB9.js";import{n as An,t as jn}from"./scroll-area-7H4ZayRq.js";import{c as Mn,i as Nn,l as Pn,n as Fn,o as In,r as Ln,t as Rn}from"./desktop-bridge.svelte-CDIrP8Lg.js";import{a as zn,i as Bn,n as Vn,r as Hn,t as Un}from"./toast-state.svelte-Cc86Tnw4.js";import{a as Wn,c as Gn,i as Kn,n as qn,o as Jn,r as Yn,s as Xn,t as Zn}from"./notify.svelte-DvUTOP7s.js";import{_ as Qn,a as X,b as $n,c as er,d as tr,f as nr,g as mee,i as rr,l as ir,m as hee,n as ar,o as or,r as sr,s as cr,t as lr,u as ur,v as gee,x as dr,y as fr}from"./task-state.svelte-WTxmxGsR.js";import{$ as _ee,A as vee,B as yee,D as bee,E as xee,F as See,H as Cee,I as wee,J as Tee,L as Eee,M as pr,N as Dee,O as mr,P as Oee,Q as kee,R as Aee,S as hr,T as jee,U as Mee,V as Nee,W as Pee,X as Fee,Y as Iee,Z as gr,a as _r,at as vr,c as yr,dt as br,et as xr,ft as Sr,g as Cr,h as wr,i as Tr,it as Er,j as Dr,k as Or,l as kr,lt as Ar,m as jr,mt as Mr,n as Nr,nt as Pr,o as Fr,ot as Ir,p as Lr,pt as Rr,r as zr,rt as Br,s as Vr,st as Hr,t as Ur,tt as Wr,u as Gr,ut as Kr,x as qr,z as Jr}from"./dist-DTR83M_W.js";import{a as Yr,c as Xr,i as Zr,l as Z,n as Qr,o as $r,r as ei,s as ti,t as ni}from"./file-state.svelte-fK_ncpqb.js";import{a as ri,i as ii,n as ai,r as oi,t as si}from"./text-preview-BB9zMOPI.js";import{Ct as ci,F as li,H as ui,K as di,O as fi,Q as pi,S as mi,St as hi,T as gi,U as _i,W as vi,_ as yi,_t as bi,at as xi,ct as Si,dt as Ci,gt as wi,ht as Ti,it as Ei,lt as Di,n as Oi,ot as ki,rt as Ai,st as ji,tt as Mi,v as Ni,vt as Pi,x as Fi,xt as Ii}from"./dist-CuX9uX_B.js";import{i as Lee,l as Ree,n as zee,o as Li,r as Bee,s as Ri,u as Vee}from"./dist-B-6VYEsK.js";import{n as Hee}from"./dist-Ji_a5TTJ.js";import{t as zi}from"./spinner-BjfTQcTY.js";import{t as Bi}from"./virtual-list-y3Fa09LY.js";import{t as Vi}from"./lru-cache-RFDR4GSx.js";import{n as Hi,t as Uee}from"./chevron-down-B7JAcl1j.js";import{a as Wee,c as Ui,d as Wi,f as Gi,h as Gee,l as Kee,m as qee,n as Jee,o as Yee,p as Xee,r as Ki,s as Zee,t as Qee,u as qi}from"./tasks.api-B8W55vtY.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 Ji=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(){}},$ee={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yi=new class{#e=$ee;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 ete(e){setTimeout(e,0)}var Xi=typeof window>`u`||`Deno`in globalThis;function Zi(){}function tte(e,t){return typeof e==`function`?e(t):e}function nte(e){return typeof e==`number`&&e>=0&&e!==1/0}function rte(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qi(e,t){return typeof e==`function`?e(t):e}function ite(e,t){return typeof e==`function`?e(t):e}function $i(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ta(o,t.options))return!1}else if(!ra(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 ea(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(na(t.options.mutationKey)!==na(a))return!1}else if(!ra(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ta(e,t){return(t?.queryKeyHashFn||na)(e)}function na(e){return JSON.stringify(e,(e,t)=>oa(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ra(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>ra(e[n],t[n])):!1}var ate=Object.prototype.hasOwnProperty;function ia(e,t){if(e===t)return e;let n=aa(e)&&aa(t);if(!n&&!(oa(e)&&oa(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:ate.call(e,a))&&s++;continue}if(l===null||u===null||typeof l!=`object`||typeof u!=`object`){o[a]=u;continue}let d=ia(l,u);o[a]=d,d===l&&s++}return r===a&&s===r?e:o}function aa(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function oa(e){if(!sa(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!sa(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function sa(e){return Object.prototype.toString.call(e)===`[object Object]`}function ote(e){return new Promise(t=>{Yi.setTimeout(t,e)})}function ste(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ia(e,t)}function cte(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function lte(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ca=Symbol();function la(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ca?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var ua=new class extends Ji{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Xi&&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 ute(){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 dte=ete;function fte(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=dte,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 da=fte(),fa=new class extends Ji{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Xi&&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 pte(e){return Math.min(1e3*2**e,3e4)}function pa(e){return(e??`online`)===`online`?fa.isOnline():!0}var ma=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ha(e){let t=!1,n=0,r,i=ute(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ma(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ua.isFocused()&&(e.networkMode===`always`||fa.isOnline())&&e.canRun(),u=()=>pa(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??(Xi?0:3),o=e.retryDelay??pte,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),ote(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 ga=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),nte(this.gcTime)&&(this.#e=Yi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xi?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Yi.clearTimeout(this.#e),void 0)}},mte=class extends ga{#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=_a(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=_a(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=ste(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(Zi).catch(Zi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>ite(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ca||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Qi(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:!rte(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=la(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=ha({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ma&&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 ma){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,...hte(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),da.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function hte(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pa(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function _a(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 va(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=la(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?lte:cte;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?gte:ya,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:ya(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 ya(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 gte(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var _te=class extends ga{#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||ba(),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=ha({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),da.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ba(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var xa=class extends Ji{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 _te({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=Sa(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=Sa(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=Sa(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=Sa(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){da.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=>ea(t,e))}findAll(e={}){return this.getAll().filter(t=>ea(e,t))}notify(e){da.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return da.batch(()=>Promise.all(e.map(e=>e.continue().catch(Zi))))}};function Sa(e){return e.options.scope?.id}var Ca=class extends Ji{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ta(r,t),a=this.get(i);return a||(a=new mte({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(){da.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=>$i(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>$i(e,t)):t}notify(e){da.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){da.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){da.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wa=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ca,this.#t=e.mutationCache||new xa,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ua.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fa.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(Qi(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=tte(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return da.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;da.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return da.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=da.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Zi).catch(Zi)}invalidateQueries(e,t={}){return da.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=da.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(Zi)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Zi)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Qi(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Zi).catch(Zi)}fetchInfiniteQuery(e){return e.behavior=va(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Zi).catch(Zi)}ensureInfiniteQueryData(e){return e.behavior=va(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return fa.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(na(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ra(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(na(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ra(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||=ta(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===ca&&(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()}},Ta=Symbol(`QueryClient`),Ea=e=>{ve(Ta,e)};function Da(e,t){a(t,!0);let n=F(t,`client`,19,()=>new wa);le(()=>{n().mount()}),Ea(n()),Ae(()=>{n().unmount()});var r=U();u(L(r),()=>t.children),g(e,r),R()}var Oa=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function ka(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=Oa,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=ee(e=>{let n=ke(t,`focusin`,e),r=ke(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?ka(this.#e):null}};function Aa(e,t){switch(e){case`post`:z(t);break;case`pre`:je(t);break}}function ja(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;Aa(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=ae(()=>n(t,o));return o=t,r})}function Ma(e,t,n){let r=De(()=>{let i=!1;ja(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});z(()=>r)}function Na(e,t,n){ja(e,`post`,t,n)}function Pa(e,t,n){ja(e,`pre`,t,n)}Na.pre=Pa;function Fa(e,t){Ma(e,`post`,t)}function Ia(e,t){Ma(e,`pre`,t)}Fa.pre=Ia;function La(e,t){switch(e){case`local`:return t.localStorage;case`session`:return t.sessionStorage}}var Ra=class{#e;#t;#n;#r;#i;#a=J(0);constructor(e,t,n={}){let{storage:r=`local`,serializer:i={serialize:JSON.stringify,deserialize:JSON.parse},syncTabs:a=!0,window:o=Oa}=n;if(this.#e=t,this.#t=e,this.#n=i,o===void 0)return;let s=La(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(()=>ke(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)=>(G(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),G(this.#a,W(this.#a)+1)}#o=e=>{e.key!==this.#t||e.newValue===null||(this.#e=this.#s(e.newValue),G(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 za(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 Ba(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 Va(e,t,n={},r){let{lazy:i=!1,once:a=!1,initialValue:o,debounce:s,throttle:c}=n,l=J(ie(o)),u=J(!1),d=J(void 0),f=J(ie([])),p=()=>{W(f).forEach(e=>e()),G(f,[],!0)},m=e=>{G(f,[...W(f),e],!0)},h=async(e,n,r=!1)=>{try{G(u,!0),G(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 G(l,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||G(d,e,!0);return}finally{G(u,!1)}},g=s?za(h,s):c?Ba(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=>{G(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 Ha(e,t,n){return Va(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Na(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function Ua(e,t,n){return Va(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Na.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}Ha.pre=Ua;function Wa(e){return e.filter(e=>e.length>0)}var Ga={getItem:e=>null,setItem:(e,t)=>{}},Ka=typeof document<`u`;function qa(e){return typeof e==`function`}function Ja(e){return typeof e==`object`&&!!e}var Ya=Symbol(`box`),Xa=Symbol(`is-writable`);function Za(e){return Ja(e)&&Ya in e}function Qa(e){return $a.isBox(e)&&Xa in e}function $a(e){let t=J(ie(e));return{[Ya]:!0,[Xa]:!0,get current(){return W(t)},set current(e){G(t,e,!0)}}}function eo(e,t){let n=q(e);return t?{[Ya]:!0,[Xa]:!0,get current(){return W(n)},set current(e){t(e)}}:{[Ya]:!0,get current(){return e()}}}function to(e){return $a.isBox(e)?e:qa(e)?$a.with(e):$a(e)}function no(e){return Object.entries(e).reduce((e,[t,n])=>$a.isBox(n)?($a.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 ro(e){return $a.isWritableBox(e)?{[Ya]:!0,get current(){return e.current}}:e}$a.from=to,$a.with=eo,$a.flatten=no,$a.readonly=ro,$a.isBox=Za,$a.isWritableBox=Qa;function io(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 ao=io(/[A-Z]/,e=>`-${e.toLowerCase()}`);function oo(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=>`${ao(t)}: ${e[t]};`).join(`
3
- `)}function so(e={}){return oo(e).replace(`
4
- `,` `)}so({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 co=$a(`mode-watcher-mode`),lo=$a(`mode-watcher-theme`),uo=[`dark`,`light`,`system`];function fo(e){return typeof e==`string`?uo.includes(e):!1}var po=class{#e=`system`;#t=Ka?localStorage:Ga;#n=this.#t.getItem(co.current);#r=fo(this.#n)?this.#n:this.#e;#i=J(ie(this.#a()));#a(e=this.#r){return new Ra(co.current,e,{serializer:{serialize:e=>e,deserialize:e=>fo(e)?e:this.#e}})}constructor(){De(()=>Na.pre(()=>co.current,(e,t)=>{let n=W(this.#i).current;G(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}},mo=class{#e=void 0;#t=!0;#n=J(ie(this.#e));#r=typeof window<`u`&&typeof window.matchMedia==`function`?new Ce(`prefers-color-scheme: light`):{current:!1};query(){Ka&&G(this.#n,this.#r.current?`light`:`dark`,!0)}tracking(e){this.#t=e}constructor(){De(()=>{je(()=>{this.#t&&this.query()})}),this.query=this.query.bind(this),this.tracking=this.tracking.bind(this)}get current(){return W(this.#n)}},ho=new po,go=new mo,_o=new class{#e=Ka?localStorage:Ga;#t=this.#e.getItem(lo.current);#n=this.#t===null||this.#t===void 0?``:this.#t;#r=J(ie(this.#i()));#i(e=this.#n){return new Ra(lo.current,e,{serializer:{serialize:e=>typeof e==`string`?e:``,deserialize:e=>e}})}constructor(){De(()=>Na.pre(()=>lo.current,(e,t)=>{let n=W(this.#r).current;G(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}},vo,yo,bo=!1,xo=null;function So(){return xo||(xo=document.createElement(`style`),xo.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
- }`)),xo)}function Co(e,t=!1){if(typeof document>`u`)return;if(!bo){bo=!0,e();return}if(typeof window<`u`&&window.__vitest_worker__){e();return}clearTimeout(vo),clearTimeout(yo);let n=So(),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(),vo=window.setTimeout(()=>{e(),yo=window.setTimeout(i,16)},16)}var wo=$a(void 0),To=$a(!0),Eo=$a(!1),Do=$a([]),Oo=$a([]);function ko(){let e=q(()=>{if(!Ka)return;let e=ho.current===`system`?go.current:ho.current,t=Wa(Do.current),n=Wa(Oo.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&&wo.current&&i.setAttribute(`content`,wo.current.light)):(n.length&&r.classList.remove(...n),t.length&&r.classList.add(...t),r.style.colorScheme=`dark`,i&&wo.current&&i.setAttribute(`content`,wo.current.dark))}return To.current?Co(r,Eo.current):r(),e});return{get current(){return W(e)}}}function Ao(){let e=q(()=>{if(_o.current,!Ka)return;function e(){document.documentElement.setAttribute(`data-theme`,_o.current)}return To.current?Co(e,ae(()=>Eo.current)):e(),_o.current});return{get current(){return W(e)}}}var jo=ko(),Mo=Ao();function No(e){ho.current=e}function Po(e){_o.current=e}function Fo(e){return e}function Io({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 Lo=h(`<meta name="theme-color"/>`);function Ro(e,t){a(t,!0);var n=U(),r=L(n),i=e=>{var n=Lo();P(()=>K(n,`content`,t.themeColors.dark)),g(e,n)};k(r,e=>{t.themeColors&&e(i)}),g(e,n),R()}var zo=h(`<meta name="theme-color"/>`),Bo=h(`<!> <!>`,1);function Vo(e,t){a(t,!0);let n=F(t,`trueNonce`,3,``);_e(`26pea3`,e=>{var r=Bo(),i=L(r),a=e=>{var n=zo();P(()=>K(n,`content`,t.themeColors.dark)),g(e,n)};k(i,e=>{t.themeColors&&e(a)}),p(I(i,2),()=>`<script${n()?` nonce=${n()}`:``}>(`+Io.toString()+`)(`+JSON.stringify(t.initConfig)+`);<\/script>`),g(e,r)}),R()}function Ho(e,t){a(t,!0);let n=F(t,`track`,3,!0),r=F(t,`defaultMode`,3,`system`),i=F(t,`disableTransitions`,3,!0),o=F(t,`darkClassNames`,19,()=>[`dark`]),s=F(t,`lightClassNames`,19,()=>[]),c=F(t,`defaultTheme`,3,``),l=F(t,`nonce`,3,``),u=F(t,`themeStorageKey`,3,`mode-watcher-theme`),d=F(t,`modeStorageKey`,3,`mode-watcher-mode`),f=F(t,`disableHeadScriptInjection`,3,!1),p=F(t,`synchronousModeChanges`,3,!1);co.current=d(),lo.current=u(),Do.current=o(),Oo.current=s(),To.current=i(),wo.current=t.themeColors,Eo.current=p(),je(()=>{Eo.current=p()}),je(()=>{To.current=i()}),je(()=>{wo.current=t.themeColors}),je(()=>{Do.current=o()}),je(()=>{Oo.current=s()}),je(()=>{co.current=d()}),je(()=>{lo.current=u()}),je(()=>{jo.current,co.current,lo.current,Mo.current}),le(()=>{go.tracking(n()),go.query();let e=localStorage.getItem(co.current);No(fo(e)?e:r()),Po(localStorage.getItem(lo.current)||c())});let m=Fo({defaultMode:r(),themeColors:t.themeColors,darkClassNames:o(),lightClassNames:s(),defaultTheme:c(),modeStorageKey:d(),themeStorageKey:u()}),h=q(()=>typeof window>`u`?l():``);var _=U(),v=L(_),y=e=>{Ro(e,{get themeColors(){return wo.current}})},b=e=>{Vo(e,{get trueNonce(){return W(h)},get initConfig(){return m},get themeColors(){return wo.current}})};k(v,e=>{f()?e(y):e(b,-1)}),g(e,_),R()}var Uo=[`left`,`right`,`bottom`],Wo={left:`Left Panel`,right:`Right Panel`,bottom:`Bottom Panel`},Go=h(`<div aria-hidden="true"><span class="dock-drop-label svelte-p8iqem"> </span></div>`);function Ko(e,t){a(t,!0);let n=F(t,`hovered`,3,!1);var r=Go();let i;var o=V(r),c=V(o);d(o),d(r),P(()=>{i=s(r,1,`dock-drop-indicator svelte-p8iqem`,null,i,{hovered:n()}),A(c,`Move to ${Wo[t.dock]??``}`)}),g(e,r),R()}var qo=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jo(e,t){let n=H(t,qo),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`}]];N(e,B({name:`eye-off`},()=>n,{get iconNode(){return r}}))}var Yo=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xo(e,t){let n=H(t,Yo),r=[[`path`,{d:`M6 8L2 12L6 16`}],[`path`,{d:`M2 12H22`}]];N(e,B({name:`move-left`},()=>n,{get iconNode(){return r}}))}var Zo=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qo(e,t){let n=H(t,Zo),r=[[`path`,{d:`M18 8L22 12L18 16`}],[`path`,{d:`M2 12H22`}]];N(e,B({name:`move-right`},()=>n,{get iconNode(){return r}}))}var $o=new Set([`$$slots`,`$$events`,`$$legacy`]);function es(e,t){let n=H(t,$o),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 15h18`}]];N(e,B({name:`panel-bottom`},()=>n,{get iconNode(){return r}}))}var ts=new Set([`$$slots`,`$$events`,`$$legacy`]);function ns(e,t){let n=H(t,ts),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]];N(e,B({name:`panel-left`},()=>n,{get iconNode(){return r}}))}var rs=new Set([`$$slots`,`$$events`,`$$legacy`]);function is(e,t){let n=H(t,rs),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}]];N(e,B({name:`panel-right`},()=>n,{get iconNode(){return r}}))}function as(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`onOpenChange`,3,Xe),i=F(t,`onOpenChangeComplete`,3,Xe);Ct.create({variant:Y(()=>`alert-dialog`),open:Y(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:Y(()=>i())});var o=U();u(L(o),()=>t.children??D),g(e,o),R()}var os=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`]),ss=h(`<button><!></button>`);function cs(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=H(t,os),s=eee.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e))}),c=q(()=>ot(o,s.props));var l=U(),f=L(l),p=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(c)})),g(e,n)},m=e=>{var n=ss();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),R()}var ls=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`,`disabled`]),us=h(`<button><!></button>`);function ds(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`disabled`,3,!1),s=H(t,ls),c=Be.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e)),disabled:Y(()=>!!o())}),l=q(()=>ot(s,c.props));var f=U(),p=L(f),m=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(l)})),g(e,n)},h=e=>{var n=us();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),R()}var fs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`interactOutsideBehavior`,`onCloseAutoFocus`,`onEscapeKeydown`,`onOpenAutoFocus`,`onInteractOutside`,`preventScroll`,`trapFocus`,`restoreScrollDelay`]),ps=h(`<!> <!>`,1),ms=h(`<!> <div><!></div>`,1);function hs(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`forceMount`,3,!1),s=F(t,`interactOutsideBehavior`,3,`ignore`),c=F(t,`onCloseAutoFocus`,3,Xe),l=F(t,`onEscapeKeydown`,3,Xe),f=F(t,`onOpenAutoFocus`,3,Xe),p=F(t,`onInteractOutside`,3,Xe),m=F(t,`preventScroll`,3,!0),h=F(t,`trapFocus`,3,!0),_=F(t,`restoreScrollDelay`,3,null),v=H(t,fs),y=Je.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e))}),b=q(()=>ot(v,y.props));var x=U(),S=L(x),C=e=>{nt(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(),Re(0,()=>y.opts.ref.current?.focus()))},focusScope:(e,n)=>{let r=()=>n?.().props;st(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)=>{_t(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)=>{ht(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=L(i),o=e=>{var n=ps(),i=L(n),a=e=>{et(e,{get preventScroll(){return m()},get restoreScrollDelay(){return _()}})};k(i,e=>{y.root.opts.open.current&&e(a)});var o=I(i,2);{let e=q(()=>({props:ot(W(b),r()),...y.snippetProps}));u(o,()=>t.child,()=>W(e))}g(e,n)},s=e=>{var n=ms(),i=L(n);et(i,{get preventScroll(){return m()}});var a=I(i,2);O(a,e=>({...e}),[()=>ot(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),R()}var gs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`width`,`height`]),_s=j(`<svg viewBox="0 0 30 10" preserveAspectRatio="none" data-arrow=""><polygon points="0,0 30,0 15,10" fill="currentColor"></polygon></svg>`),vs=h(`<span><!></span>`);function ys(e,t){a(t,!0);let n=F(t,`id`,19,ft),r=F(t,`width`,3,10),i=F(t,`height`,3,5),o=H(t,gs),s=q(()=>ot(o,{id:n()}));var c=U(),l=L(c),f=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(s)})),g(e,n)},p=e=>{var n=vs();O(n,()=>({...W(s)}));var a=V(n),o=e=>{var n=U();u(L(n),()=>t.children??D),g(e,n)},c=e=>{var t=_s();P(()=>{K(t,`width`,r()),K(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),R()}var bs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`]);function xs(e,t){a(t,!0);let n=F(t,`id`,19,ft),r=F(t,`ref`,15,null),i=H(t,bs),o=dee.create({id:Y(()=>n()),ref:Y(()=>r(),e=>r(e))}),s=q(()=>ot(i,o.props));ys(e,B(()=>W(s))),R()}function Ss(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 Cs(e,t){return e[0]>=t.left&&e[0]<=t.right&&e[1]>=t.top&&e[1]<=t.bottom}function ws(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 Ts=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,ze([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,[ke(tt(e),`pointermove`,n=>{this.#p([n.clientX,n.clientY],e,t)}),ke(e,`pointerleave`,e=>{let n=e.relatedTarget;if(Ze(n)&&t.contains(n))return;let r=this.#e.ignoredTargets?.()??[];Ze(n)&&r.some(e=>e===n||e.contains(n))||(this.#a=Ze(n)&&r.length>0?r.filter(e=>n.contains(e)):[],this.#r=[e.clientX,e.clientY],this.#i=`content`,this.#u())}),ke(e,`pointerenter`,()=>{this.#m()}),ke(t,`pointerenter`,()=>{this.#m()}),ke(t,`pointerleave`,t=>{let n=t.relatedTarget;Ze(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`&&Cs(e,i)){this.#m();return}if(this.#i===`trigger`&&Cs(e,r)){this.#m();return}if(this.#i===`content`&&this.#a.length>0)for(let t of this.#a){let n=t.getBoundingClientRect();if(Cs(e,n))return;let i=ws(r,n),a=this.#h(r,n,i);if(a&&Ss(e,a))return}let a=ws(r,i),o=this.#h(r,i,a);if(o&&Ss(e,o))return;let s=this.#i===`content`?i:r;Ss(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`}}},Es=pt({component:`popover`,parts:[`root`,`trigger`,`content`,`close`,`overlay`]}),Ds=new Ge(`Popover.Root`),Os=class e{static create(t){return Ds.set(new e(t))}opts;#e=J(null);get contentNode(){return W(this.#e)}set contentNode(e){G(this.#e,e,!0)}contentPresence;#t=J(null);get triggerNode(){return W(this.#t)}set triggerNode(e){G(this.#t,e,!0)}#n=J(null);get overlayNode(){return W(this.#n)}set overlayNode(e){G(this.#n,e,!0)}overlayPresence;#r=J(!1);get openedViaHover(){return W(this.#r)}set openedViaHover(e){G(this.#r,e,!0)}#i=J(!1);get hasInteractedWithContent(){return W(this.#i)}set hasInteractedWithContent(e){G(this.#i,e,!0)}#a=J(!1);get hoverCooldown(){return W(this.#a)}set hoverCooldown(e){G(this.#a,e,!0)}#o=J(0);get closeDelay(){return W(this.#o)}set closeDelay(e){G(this.#o,e,!0)}#s=null;#c=null;constructor(e){this.opts=e,this.contentPresence=new Ue({ref:Y(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new Ue({ref:Y(()=>this.overlayNode),open:this.opts.open}),ze(()=>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()}},ks=class e{static create(t){return new e(t,Ds.get())}opts;root;attachment;domContext;#e=null;#t=null;#n=J(!1);constructor(e,t){this.opts=e,this.root=t,this.attachment=bt(this.opts.ref,e=>this.root.triggerNode=e),this.domContext=new St(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),ze(()=>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||Qe(e)||(G(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&&(Qe(e)||(G(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=q(()=>({id:this.opts.id.current,"aria-haspopup":`dialog`,"aria-expanded":vt(this.root.opts.open.current),"data-state":it(this.root.opts.open.current),"aria-controls":this.#o(),[Es.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){G(this.#s,e)}},As=class e{static create(t){return new e(t,Ds.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bt(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 Ts({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;Ze(t)&&iee(t)&&this.root.markInteraction()}onpointerenter(e){Qe(e)||this.root.cancelDelayedClose()}onpointerleave(e){Qe(e)}onInteractOutside=e=>{if(this.opts.onInteractOutside.current(e),e.defaultPrevented||!Ze(e.target))return;let t=e.target.closest(Es.selector(`trigger`));if(!(t&&t===this.root.triggerNode)){if(this.opts.customAnchor.current){if(Ze(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=q(()=>({open:this.root.opts.open.current}));get snippetProps(){return W(this.#e)}set snippetProps(e){G(this.#e,e)}#t=q(()=>({id:this.opts.id.current,tabindex:-1,"data-state":it(this.root.opts.open.current),...$e(this.root.contentPresence.transitionStatus),[Es.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){G(this.#t,e)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown}},js=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`forceMount`,`onOpenAutoFocus`,`onCloseAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`customAnchor`,`style`]),Ms=h(`<div><div><!></div></div>`);function Ns(e,t){let n=ne();a(t,!0);let r=F(t,`ref`,15,null),i=F(t,`id`,19,()=>Le(n)),o=F(t,`forceMount`,3,!1),s=F(t,`onOpenAutoFocus`,3,Xe),c=F(t,`onCloseAutoFocus`,3,Xe),l=F(t,`onEscapeKeydown`,3,Xe),f=F(t,`onInteractOutside`,3,Xe),p=F(t,`trapFocus`,3,!0),m=F(t,`preventScroll`,3,!1),h=F(t,`customAnchor`,3,null),_=H(t,js),v=As.create({id:Y(()=>i()),ref:Y(()=>r(),e=>r(e)),onInteractOutside:Y(()=>f()),onEscapeKeydown:Y(()=>l()),customAnchor:Y(()=>h())}),y=q(()=>ot(_,v.props)),b=q(()=>p()&&v.shouldTrapFocus);function x(e){v.shouldTrapFocus||e.preventDefault(),s()(e)}var S=U(),C=L(S),w=e=>{un(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=q(()=>ot(r(),{style:cn(`popover`)},{style:t.style}));var o=U(),s=L(o),c=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(a),wrapperProps:i(),...v.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Ms();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=>{sn(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=q(()=>ot(r(),{style:cn(`popover`)},{style:t.style}));var o=U(),s=L(o),c=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(a),wrapperProps:i(),...v.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Ms();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),R()}var Ps=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`type`,`disabled`,`openOnHover`,`openDelay`,`closeDelay`]),Fs=h(`<button><!></button>`);function Is(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`type`,3,`button`),s=F(t,`disabled`,3,!1),c=F(t,`openOnHover`,3,!1),l=F(t,`openDelay`,3,700),f=F(t,`closeDelay`,3,300),p=H(t,Ps),m=ks.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e)),disabled:Y(()=>!!s()),openOnHover:Y(()=>c()),openDelay:Y(()=>l()),closeDelay:Y(()=>f())}),h=q(()=>ot(p,m.props,{type:o()}));ln(e,{get id(){return r()},get ref(){return m.opts.ref},children:(e,n)=>{var r=U(),i=L(r),a=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(h)})),g(e,n)},o=e=>{var n=Fs();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}}),R()}var Ls=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function Rs(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,Ls);xs(e,B(()=>r,{"data-popover-arrow":``,get ref(){return n()},set ref(e){n(e)}})),R()}function zs(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`onOpenChange`,3,Xe),i=F(t,`onOpenChangeComplete`,3,Xe);Ct.create({variant:Y(()=>`dialog`),open:Y(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:Y(()=>i())});var o=U();u(L(o),()=>t.children??D),g(e,o),R()}var Bs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`disabled`]),Vs=h(`<button><!></button>`);function Hs(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`disabled`,3,!1),s=H(t,Bs),c=tee.create({variant:Y(()=>`close`),id:Y(()=>r()),ref:Y(()=>i(),e=>i(e)),disabled:Y(()=>!!o())}),l=q(()=>ot(s,c.props));var f=U(),p=L(f),m=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(l)})),g(e,n)},h=e=>{var n=Vs();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),R()}var Us=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`onCloseAutoFocus`,`onOpenAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`restoreScrollDelay`]),Ws=h(`<!> <!>`,1),Gs=h(`<!> <div><!></div>`,1);function Ks(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`forceMount`,3,!1),s=F(t,`onCloseAutoFocus`,3,Xe),c=F(t,`onOpenAutoFocus`,3,Xe),l=F(t,`onEscapeKeydown`,3,Xe),f=F(t,`onInteractOutside`,3,Xe),p=F(t,`trapFocus`,3,!0),m=F(t,`preventScroll`,3,!0),h=F(t,`restoreScrollDelay`,3,null),_=H(t,Us),v=Je.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e))}),y=q(()=>ot(_,v.props));var b=U(),x=L(b),S=e=>{nt(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;st(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)=>{_t(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)=>{ht(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=L(i),o=e=>{var n=Ws(),i=L(n),a=e=>{et(e,{get preventScroll(){return m()},get restoreScrollDelay(){return h()}})};k(i,e=>{v.root.opts.open.current&&e(a)});var o=I(i,2);{let e=q(()=>({props:ot(W(y),r()),...v.snippetProps}));u(o,()=>t.child,()=>W(e))}g(e,n)},s=e=>{var n=Gs(),i=L(n);et(i,{get preventScroll(){return m()}});var a=I(i,2);O(a,e=>({...e}),[()=>ot(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),R()}function qs(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`dir`,3,`ltr`),i=F(t,`onOpenChange`,3,Xe),o=F(t,`onOpenChangeComplete`,3,Xe),s=F(t,`_internal_variant`,3,`dropdown-menu`),c=F(t,`_internal_should_skip_exit_animation`,3,void 0),l=nee.create({variant:Y(()=>s()),dir:Y(()=>r()),onClose:()=>{n(!1),i()(!1)},shouldSkipExitAnimation:()=>c()?.()??!1});yt.create({open:Y(()=>n(),e=>{n(e),i()(e)}),onOpenChangeComplete:Y(()=>o())},l),on(e,{children:(e,n)=>{var r=U();u(L(r),()=>t.children??D),g(e,r)},$$slots:{default:!0}}),R()}var Js=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`child`,`children`,`ref`,`loop`,`onInteractOutside`,`onEscapeKeydown`,`onCloseAutoFocus`,`forceMount`,`trapFocus`,`style`]),Ys=h(`<div><div><!></div></div>`);function Xs(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`loop`,3,!0),s=F(t,`onInteractOutside`,3,Xe),c=F(t,`onEscapeKeydown`,3,Xe),l=F(t,`onCloseAutoFocus`,3,Xe),f=F(t,`forceMount`,3,!1),p=F(t,`trapFocus`,3,!1),m=H(t,Js),h=lt.create({id:Y(()=>r()),loop:Y(()=>o()),ref:Y(()=>i(),e=>i(e)),onCloseAutoFocus:Y(()=>l())}),_=q(()=>ot(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=L(b),S=e=>{un(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=q(()=>ot(r(),{style:cn(`dropdown-menu`)},{style:t.style}));var o=U(),s=L(o),c=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(a),wrapperProps:i(),...h.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Ys();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=>{sn(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=q(()=>ot(r(),{style:cn(`dropdown-menu`)},{style:t.style}));var o=U(),s=L(o),c=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(a),wrapperProps:i(),...h.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},l=e=>{var n=Ys();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),R()}var Zs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`disabled`,`type`]),Qs=h(`<button><!></button>`);function $s(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`disabled`,3,!1),s=F(t,`type`,3,`button`),c=H(t,Zs),l=aee.create({id:Y(()=>r()),disabled:Y(()=>o()??!1),ref:Y(()=>i(),e=>i(e))}),f=q(()=>ot(c,l.props,{type:s()}));ln(e,{get id(){return r()},get ref(){return l.opts.ref},children:(e,n)=>{var r=U(),i=L(r),a=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(f)})),g(e,n)},o=e=>{var n=Qs();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}}),R()}var ec=pt({component:`label`,parts:[`root`]}),tc=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=bt(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}onmousedown(e){e.detail>1&&e.preventDefault()}#e=q(()=>({id:this.opts.id.current,[ec.root]:``,onmousedown:this.onmousedown,...this.attachment}));get props(){return W(this.#e)}set props(e){G(this.#e,e)}},nc=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`for`]),rc=h(`<label><!></label>`);function ic(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=H(t,nc),s=tc.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e))}),c=q(()=>ot(o,s.props,{for:t.for}));var l=U(),f=L(l),p=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(c)})),g(e,n)},m=e=>{var n=rc();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),R()}function ac(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`onOpenChange`,3,Xe),i=F(t,`onOpenChangeComplete`,3,Xe);Os.create({open:Y(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:Y(()=>i())}),on(e,{children:(e,n)=>{var r=U();u(L(r),()=>t.children??D),g(e,r)},$$slots:{default:!0}}),R()}var oc=pt({component:`progress`,parts:[`root`]}),sc=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=bt(this.opts.ref)}#e=q(()=>({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":cc(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,[oc.root]:``,...this.attachment}));get props(){return W(this.#e)}set props(e){G(this.#e,e)}};function cc(e,t){return e===null?`indeterminate`:e===t?`loaded`:`loading`}var lc=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`value`,`max`,`min`,`id`,`ref`]),uc=h(`<div><!></div>`);function dc(e,t){let n=ne();a(t,!0);let r=F(t,`value`,3,0),i=F(t,`max`,3,100),o=F(t,`min`,3,0),s=F(t,`id`,19,()=>Le(n)),c=F(t,`ref`,15,null),l=H(t,lc),f=sc.create({value:Y(()=>r()),max:Y(()=>i()),min:Y(()=>o()),id:Y(()=>s()),ref:Y(()=>c(),e=>c(e))}),p=q(()=>ot(l,f.props));var m=U(),h=L(m),_=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(p)})),g(e,n)},v=e=>{var n=uc();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),R()}var fc=pt({component:`radio-group`,parts:[`root`,`item`]}),pc=new Ge(`RadioGroup.Root`),mc=class e{static create(t){return pc.set(new e(t))}opts;#e=q(()=>this.opts.value.current!==``);get hasValue(){return W(this.#e)}set hasValue(e){G(this.#e,e)}rovingFocusGroup;attachment;constructor(e){this.opts=e,this.attachment=bt(this.opts.ref),this.rovingFocusGroup=new Ye({rootNode:this.opts.ref,candidateAttr:fc.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=q(()=>({id:this.opts.id.current,role:`radiogroup`,"aria-required":vt(this.opts.required.current),"aria-disabled":vt(this.opts.disabled.current),"aria-readonly":this.opts.readonly.current?`true`:void 0,"data-disabled":ct(this.opts.disabled.current),"data-readonly":ct(this.opts.readonly.current),"data-orientation":this.opts.orientation.current,[fc.root]:``,...this.attachment}));get props(){return W(this.#t)}set props(e){G(this.#t,e)}},hc=class e{static create(t){return new e(t,pc.get())}opts;root;attachment;#e=q(()=>this.root.opts.value.current===this.opts.value.current);get checked(){return W(this.#e)}set checked(e){G(this.#e,e)}#t=q(()=>this.opts.disabled.current||this.root.opts.disabled.current);#n=q(()=>this.root.opts.readonly.current);#r=q(()=>this.root.isChecked(this.opts.value.current));#i=J(-1);constructor(e,t){this.opts=e,this.root=t,this.attachment=bt(this.opts.ref),this.opts.value.current===this.root.opts.value.current?(this.root.rovingFocusGroup.setCurrentTabStopId(this.opts.id.current),G(this.#i,0)):this.root.opts.value.current||G(this.#i,0),z(()=>{G(this.#i,this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current),!0)}),ze([()=>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),G(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=q(()=>({checked:W(this.#r)}));get snippetProps(){return W(this.#a)}set snippetProps(e){G(this.#a,e)}#o=q(()=>({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":ct(W(this.#t)),"data-readonly":ct(W(this.#n)),"data-state":W(this.#r)?`checked`:`unchecked`,"aria-checked":ut(W(this.#r),!1),[fc.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){G(this.#o,e)}},gc=class e{static create(){return new e(pc.get())}root;#e=q(()=>this.root.opts.name.current!==void 0);get shouldRender(){return W(this.#e)}set shouldRender(e){G(this.#e,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){this.root.rovingFocusGroup.focusCurrentTabStop()}#t=q(()=>({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){G(this.#t,e)}};function _c(e,t){a(t,!1);let n=gc.create();me();var r=U(),i=L(r),o=e=>{$t(e,B(()=>n.props))};k(i,e=>{n.shouldRender&&e(o)}),g(e,r),R()}var vc=new Set([`$$slots`,`$$events`,`$$legacy`,`disabled`,`children`,`child`,`value`,`ref`,`orientation`,`loop`,`name`,`required`,`readonly`,`id`,`onValueChange`]),yc=h(`<div><!></div>`),bc=h(`<!> <!>`,1);function xc(e,t){let n=ne();a(t,!0);let r=F(t,`disabled`,3,!1),i=F(t,`value`,15,``),o=F(t,`ref`,15,null),s=F(t,`orientation`,3,`vertical`),c=F(t,`loop`,3,!0),l=F(t,`name`,3,void 0),f=F(t,`required`,3,!1),p=F(t,`readonly`,3,!1),m=F(t,`id`,19,()=>Le(n)),h=F(t,`onValueChange`,3,Xe),_=H(t,vc),v=mc.create({orientation:Y(()=>s()),disabled:Y(()=>r()),loop:Y(()=>c()),name:Y(()=>l()),required:Y(()=>f()),readonly:Y(()=>p()),id:Y(()=>m()),value:Y(()=>i(),e=>{e!==i()&&(i(e),h()?.(e))}),ref:Y(()=>o(),e=>o(e))}),y=q(()=>ot(_,v.props));var b=bc(),x=L(b),S=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(y)})),g(e,n)},C=e=>{var n=yc();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)}),_c(I(x,2),{}),g(e,b),R()}var Sc=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`value`,`disabled`,`ref`]),Cc=h(`<button><!></button>`);function wc(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`disabled`,3,!1),o=F(t,`ref`,15,null),s=H(t,Sc),c=hc.create({value:Y(()=>t.value),disabled:Y(()=>i()??!1),id:Y(()=>r()),ref:Y(()=>o(),e=>o(e))}),l=q(()=>ot(s,c.props));var f=U(),p=L(f),m=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(l),...c.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},h=e=>{var n=Cc();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),R()}var Tc=pt({component:`switch`,parts:[`root`,`thumb`]}),Ec=new Ge(`Switch.Root`),Dc=class e{static create(t){return Ec.set(new e(t))}opts;attachment;constructor(e){this.opts=e,this.attachment=bt(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=q(()=>({"data-disabled":ct(this.opts.disabled.current),"data-state":ree(this.opts.checked.current),"data-required":ct(this.opts.required.current)}));get sharedProps(){return W(this.#t)}set sharedProps(e){G(this.#t,e)}#n=q(()=>({checked:this.opts.checked.current}));get snippetProps(){return W(this.#n)}set snippetProps(e){G(this.#n,e)}#r=q(()=>({...this.sharedProps,id:this.opts.id.current,role:`switch`,disabled:rt(this.opts.disabled.current),"aria-checked":ut(this.opts.checked.current,!1),"aria-required":vt(this.opts.required.current),[Tc.root]:``,onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return W(this.#r)}set props(e){G(this.#r,e)}},Oc=class e{static create(){return new e(Ec.get())}root;#e=q(()=>this.root.opts.name.current!==void 0);get shouldRender(){return W(this.#e)}set shouldRender(e){G(this.#e,e)}constructor(e){this.root=e}#t=q(()=>({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){G(this.#t,e)}},kc=class e{static create(t){return new e(t,Ec.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bt(e.ref)}#e=q(()=>({checked:this.root.opts.checked.current}));get snippetProps(){return W(this.#e)}set snippetProps(e){G(this.#e,e)}#t=q(()=>({...this.root.sharedProps,id:this.opts.id.current,[Tc.thumb]:``,...this.attachment}));get props(){return W(this.#t)}set props(e){G(this.#t,e)}};function Ac(e,t){a(t,!1);let n=Oc.create();me();var r=U(),i=L(r),o=e=>{$t(e,B(()=>n.props))};k(i,e=>{n.shouldRender&&e(o)}),g(e,r),R()}var jc=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`required`,`checked`,`value`,`name`,`type`,`onCheckedChange`]),Mc=h(`<button><!></button>`),Nc=h(`<!> <!>`,1);function Pc(e,t){let n=ne();a(t,!0);let r=F(t,`ref`,15,null),i=F(t,`id`,19,()=>Le(n)),o=F(t,`disabled`,3,!1),s=F(t,`required`,3,!1),c=F(t,`checked`,15,!1),l=F(t,`value`,3,`on`),f=F(t,`name`,3,void 0),p=F(t,`type`,3,`button`),m=F(t,`onCheckedChange`,3,Xe),h=H(t,jc),_=Dc.create({checked:Y(()=>c(),e=>{c(e),m()?.(e)}),disabled:Y(()=>o()??!1),required:Y(()=>s()),value:Y(()=>l()),name:Y(()=>f()),id:Y(()=>i()),ref:Y(()=>r(),e=>r(e))}),v=q(()=>ot(h,_.props,{type:p()}));var y=Nc(),b=L(y),x=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(v),..._.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},S=e=>{var n=Mc();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)}),Ac(I(b,2),{}),g(e,y),R()}var Fc=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`]),Ic=h(`<span><!></span>`);function Lc(e,t){let n=ne();a(t,!0);let r=F(t,`ref`,15,null),i=F(t,`id`,19,()=>Le(n)),o=H(t,Fc),s=kc.create({id:Y(()=>i()),ref:Y(()=>r(),e=>r(e))}),c=q(()=>ot(o,s.props));var l=U(),f=L(l),p=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(c),...s.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},m=e=>{var n=Ic();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),R()}var Rc=pt({component:`toolbar`,parts:[`root`,`item`,`group`,`group-item`,`link`,`button`]}),zc=new Ge(`Toolbar.Root`);new Ge(`Toolbar.Group`);var Bc=class e{static create(t){return zc.set(new e(t))}opts;rovingFocusGroup;attachment;constructor(e){this.opts=e,this.attachment=bt(this.opts.ref),this.rovingFocusGroup=new Ye({orientation:this.opts.orientation,loop:this.opts.loop,rootNode:this.opts.ref,candidateAttr:Rc.item})}#e=q(()=>({id:this.opts.id.current,role:`toolbar`,"data-orientation":this.opts.orientation.current,[Rc.root]:``,...this.attachment}));get props(){return W(this.#e)}set props(e){G(this.#e,e)}},Vc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`id`,`orientation`,`loop`,`child`,`children`]),Hc=h(`<div><!></div>`);function Uc(e,t){let n=ne();a(t,!0);let r=F(t,`ref`,15,null),i=F(t,`id`,19,()=>Le(n)),o=F(t,`orientation`,3,`horizontal`),s=F(t,`loop`,3,!0),c=H(t,Vc),l=Bc.create({id:Y(()=>i()),orientation:Y(()=>o()),loop:Y(()=>s()),ref:Y(()=>r(),e=>r(e))}),f=q(()=>ot(c,l.props));var p=U(),m=L(p),h=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(f)})),g(e,n)},_=e=>{var n=Hc();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),R()}var Wc=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),xt(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)}},Gc=pt({component:`tooltip`,parts:[`content`,`trigger`]}),Kc=new Ge(`Tooltip.Provider`),qc=new Ge(`Tooltip.Root`),Jc=class{#e=J(ie(new Map));get triggers(){return W(this.#e)}set triggers(e){G(this.#e,e,!0)}#t=J(null);get activeTriggerId(){return W(this.#t)}set activeTriggerId(e){G(this.#t,e,!0)}#n=q(()=>{let e=this.activeTriggerId;return e===null?null:this.triggers.get(e)?.node??null});get activeTriggerNode(){return W(this.#n)}set activeTriggerNode(e){G(this.#n,e)}#r=q(()=>{let e=this.activeTriggerId;return e===null?null:this.triggers.get(e)?.payload??null});get activePayload(){return W(this.#r)}set activePayload(e){G(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))}},Yc=class e{static create(t){return Kc.set(new e(t))}opts;#e=J(!0);get isOpenDelayed(){return W(this.#e)}set isOpenDelayed(e){G(this.#e,e,!0)}isPointerInTransit=qe(!1);#t;#n=J(null);constructor(e){this.opts=e,this.#t=new Wc(()=>{this.isOpenDelayed=!0},this.opts.skipDelayDuration.current),nn(()=>ke(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,G(this.#n,e,!0)};onClose=e=>{W(this.#n)===e&&(G(this.#n,null),this.#r())};isTooltipOpen=e=>W(this.#n)===e},Xc=class e{static create(t){return qc.set(new e(t,Kc.get()))}opts;provider;#e=q(()=>this.opts.delayDuration.current??this.provider.opts.delayDuration.current);get delayDuration(){return W(this.#e)}set delayDuration(e){G(this.#e,e)}#t=q(()=>this.opts.disableHoverableContent.current??this.provider.opts.disableHoverableContent.current);get disableHoverableContent(){return W(this.#t)}set disableHoverableContent(e){G(this.#t,e)}#n=q(()=>this.opts.disableCloseOnTriggerClick.current??this.provider.opts.disableCloseOnTriggerClick.current);get disableCloseOnTriggerClick(){return W(this.#n)}set disableCloseOnTriggerClick(e){G(this.#n,e)}#r=q(()=>this.opts.disabled.current??this.provider.opts.disabled.current);get disabled(){return W(this.#r)}set disabled(e){G(this.#r,e)}#i=q(()=>this.opts.ignoreNonKeyboardFocus.current??this.provider.opts.ignoreNonKeyboardFocus.current);get ignoreNonKeyboardFocus(){return W(this.#i)}set ignoreNonKeyboardFocus(e){G(this.#i,e)}registry;tether;#a=J(null);get contentNode(){return W(this.#a)}set contentNode(e){G(this.#a,e,!0)}contentPresence;#o=J(!1);#s;#c=q(()=>this.opts.open.current?W(this.#o)?`delayed-open`:`instant-open`:`closed`);get stateAttr(){return W(this.#c)}set stateAttr(e){G(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 Jc,this.#s=new Wc(()=>{G(this.#o,!0),this.opts.open.current=!0},this.delayDuration??0),this.tether&&(this.tether.root=this,nn(()=>()=>{this.tether?.root===this&&(this.tether.root=null)})),this.contentPresence=new Ue({open:this.opts.open,ref:Y(()=>this.contentNode),onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),ze(()=>this.delayDuration,()=>{this.delayDuration!==void 0&&(this.#s=new Wc(()=>{G(this.#o,!0),this.opts.open.current=!0},this.delayDuration))}),ze(()=>this.opts.open.current,e=>{e?(this.ensureActiveTrigger(),this.provider.onOpen(this)):this.provider.onClose(this)},{lazy:!0}),ze(()=>this.opts.triggerId.current,e=>{e!==this.registry.activeTriggerId&&this.registry.setActiveTrigger(e)}),ze(()=>this.registry.activeTriggerId,e=>{this.opts.triggerId.current!==e&&(this.opts.triggerId.current=e)})}handleOpen=()=>{this.#s.stop(),G(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?(G(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}},Zc=class e{static create(t){return t.tether.current?new e(t,null,t.tether.current.state):new e(t,qc.get(),null)}opts;root;tether;attachment;#e=qe(!1);#t=J(!1);domContext;#n=null;#r=!1;#i=null;constructor(e,t,n){this.opts=e,this.root=t,this.tether=n,this.domContext=new St(e.ref),this.attachment=bt(this.opts.ref,e=>this.#s(e)),ze(()=>this.opts.id.current,()=>{this.#s(this.opts.ref.current)}),ze(()=>this.opts.payload.current,()=>{this.#s(this.opts.ref.current)}),ze(()=>this.opts.disabled.current,()=>{this.#s(this.opts.ref.current)}),nn(()=>(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),G(this.#t,!0))},250);return}t.onTriggerEnter(this.opts.id.current),G(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),G(this.#t,!0)))}};#p=e=>{let t=this.#a();if(!t||this.#o())return;if(this.#c(),!t.isActiveTrigger(this.opts.id.current)){G(this.#t,!1);return}let n=e.relatedTarget;if(Ze(n)){for(let e of t.registry.triggers.values())if(e.node===n){if(t.provider.opts.skipDelayDuration.current>0){G(this.#t,!1);return}t.handleClose(),G(this.#t,!1);return}}t.onTriggerLeave(),G(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&&!He(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()};#_=q(()=>{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":ct(n),"data-delay-duration":`${e?.delayDuration??0}`,[Gc.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){G(this.#_,e)}},Qc=class e{static create(t){return new e(t,qc.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bt(this.opts.ref,e=>this.root.contentNode=e),new Ts({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(Ze(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=q(()=>({open:this.root.opts.open.current}));get snippetProps(){return W(this.#e)}set snippetProps(e){G(this.#e,e)}#t=q(()=>({id:this.opts.id.current,"data-state":this.root.stateAttr,"data-disabled":ct(this.root.disabled),...$e(this.root.contentPresence.transitionStatus),style:{outline:`none`},[Gc.content]:``,...this.attachment}));get props(){return W(this.#t)}set props(e){G(this.#t,e)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown,onOpenAutoFocus:this.onOpenAutoFocus,onCloseAutoFocus:this.onCloseAutoFocus}};function $c(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`triggerId`,15,null),i=F(t,`onOpenChange`,3,Xe),o=F(t,`onOpenChangeComplete`,3,Xe),s=Xc.create({open:Y(()=>n(),e=>{n(e),i()(e)}),triggerId:Y(()=>r(),e=>{r(e)}),delayDuration:Y(()=>t.delayDuration),disableCloseOnTriggerClick:Y(()=>t.disableCloseOnTriggerClick),disableHoverableContent:Y(()=>t.disableHoverableContent),ignoreNonKeyboardFocus:Y(()=>t.ignoreNonKeyboardFocus),disabled:Y(()=>t.disabled),onOpenChangeComplete:Y(()=>o()),tether:Y(()=>t.tether)});on(e,{tooltip:!0,children:(e,n)=>{var r=U();u(L(r),()=>t.children??D,()=>({open:s.opts.open.current,triggerId:s.activeTriggerId,payload:s.activePayload})),g(e,r)},$$slots:{default:!0}}),R()}var el=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`side`,`sideOffset`,`align`,`avoidCollisions`,`arrowPadding`,`sticky`,`strategy`,`hideWhenDetached`,`customAnchor`,`collisionPadding`,`onInteractOutside`,`onEscapeKeydown`,`forceMount`,`style`]),tl=h(`<div><div><!></div></div>`);function nl(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`ref`,15,null),o=F(t,`side`,3,`top`),s=F(t,`sideOffset`,3,0),c=F(t,`align`,3,`center`),l=F(t,`avoidCollisions`,3,!0),f=F(t,`arrowPadding`,3,0),p=F(t,`sticky`,3,`partial`),m=F(t,`hideWhenDetached`,3,!1),h=F(t,`collisionPadding`,3,0),_=F(t,`onInteractOutside`,3,Xe),v=F(t,`onEscapeKeydown`,3,Xe),y=F(t,`forceMount`,3,!1),b=H(t,el),x=Qc.create({id:Y(()=>r()),ref:Y(()=>i(),e=>i(e)),onInteractOutside:Y(()=>_()),onEscapeKeydown:Y(()=>v())}),S=q(()=>({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=q(()=>ot(b,W(S),x.props));var w=U(),T=L(w),E=e=>{{let n=(e,n)=>{let r=()=>n?.().props,i=()=>n?.().wrapperProps,a=q(()=>ot(i(),{style:{pointerEvents:x.root.disableHoverableContent?`none`:void 0}})),o=q(()=>ot(r(),{style:cn(`tooltip`)},{style:t.style}));var s=U(),c=L(s),l=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(o),wrapperProps:W(a),...x.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},f=e=>{var n=tl();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=q(()=>x.root.disableHoverableContent?`none`:`auto`);un(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=q(()=>ot(i(),{style:{pointerEvents:x.root.disableHoverableContent?`none`:void 0}})),o=q(()=>ot(r(),{style:cn(`tooltip`)},{style:t.style}));var s=U(),c=L(s),l=e=>{var n=U(),r=L(n);{let e=q(()=>({props:W(o),wrapperProps:W(a),...x.snippetProps}));u(r,()=>t.child,()=>W(e))}g(e,n)},f=e=>{var n=tl();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=q(()=>x.root.disableHoverableContent?`none`:`auto`);sn(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),R()}var rl=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`disabled`,`payload`,`tether`,`type`,`tabindex`,`ref`]),il=h(`<button><!></button>`);function al(e,t){let n=ne();a(t,!0);let r=F(t,`id`,19,()=>Le(n)),i=F(t,`disabled`,3,!1),o=F(t,`type`,3,`button`),s=F(t,`tabindex`,3,0),c=F(t,`ref`,15,null),l=H(t,rl),f=Zc.create({id:Y(()=>r()),disabled:Y(()=>i()??!1),tabindex:Y(()=>s()??0),payload:Y(()=>t.payload),tether:Y(()=>t.tether),ref:Y(()=>c(),e=>c(e))}),p=q(()=>ot(l,f.props,{type:o()}));var m=U(),h=L(m),_=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(p)})),g(e,n)},v=e=>{var n=il();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),R()}var ol=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function sl(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,ol);xs(e,B(()=>r,{get ref(){return n()},set ref(e){n(e)}})),R()}function cl(e,t){a(t,!0);let n=F(t,`delayDuration`,3,700),r=F(t,`disableCloseOnTriggerClick`,3,!1),i=F(t,`disableHoverableContent`,3,!1),o=F(t,`disabled`,3,!1),s=F(t,`ignoreNonKeyboardFocus`,3,!1),c=F(t,`skipDelayDuration`,3,300);Yc.create({delayDuration:Y(()=>n()),disableCloseOnTriggerClick:Y(()=>r()),disableHoverableContent:Y(()=>i()),disabled:Y(()=>o()),ignoreNonKeyboardFocus:Y(()=>s()),skipDelayDuration:Y(()=>c())});var l=U();u(L(l),()=>t.children??D),g(e,l),R()}var ll=`application/x-nerve-panel-view`,ul=ie({});function dl(e){ul.viewId=e,ul.hoverDock=void 0,ul.hoverIndex=void 0}function fl(e,t){ul.hoverDock=e,ul.hoverIndex=t}function pl(e){ul.hoverDock===e&&(ul.hoverDock=void 0,ul.hoverIndex=void 0)}function ml(){ul.viewId=void 0,ul.hoverDock=void 0,ul.hoverIndex=void 0}var hl=h(`<button type="button" role="tab"><!></button>`),gl=h(`<span class="dock-tab-drop-end svelte-l43sst" aria-hidden="true"></span>`),_l=h(`<div role="presentation"><div class="dock-tabs svelte-l43sst" role="tablist"><!> <!></div> <span class="sr-only" aria-live="polite"> </span></div>`);function vl(e,t){a(t,!0);let n=F(t,`registry`,19,()=>t.views),i=F(t,`draggable`,3,!0),o=J(null),c=J(``),l={left:ns,right:is,bottom:es},u=q(()=>!!(i()&&ul.viewId)),f=q(()=>ul.hoverDock===t.dock?ul.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=Wo[r.dock].toLowerCase();G(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`),fl(t.dock,p(e)))}function v(e){if(!W(u))return;e.preventDefault();let n=ul.viewId??e.dataTransfer?.getData(`application/x-nerve-panel-view`),r=p(e);ml(),n&&m(n,{dock:t.dock,index:r})}function y(e,n){let r=Uo.map(r=>({label:`Move to ${Wo[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:Xo,disabled:n===0||!t.onMove,onSelect:()=>m(e.id,{dock:t.dock,index:n-1})},{label:`Move Right`,icon:Qo,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:Jo,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}var x=_l();let S;var w=V(x),T=V(w);_(T,19,()=>t.views,e=>e.id,(e,n,a)=>{let o=q(()=>W(n).icon);{let c=q(()=>b(W(n),W(a)));fn(e,{get items(){return W(c)},triggerClass:`contents`,children:(e,c)=>{var l=hl();let u;C(V(l),()=>W(o),(e,t)=>{t(e,{size:14,strokeWidth:2.1,"aria-hidden":`true`})}),d(l),P(e=>{u=s(l,1,`dock-tab svelte-l43sst`,null,u,{active:W(n).id===t.activeViewId,dragging:ul.viewId===W(n).id,"drop-before":W(f)===W(a)}),K(l,`data-view-id`,W(n).id),K(l,`aria-selected`,W(n).id===t.activeViewId),K(l,`aria-label`,W(n).title),K(l,`title`,W(n).title),K(l,`draggable`,e)},[()=>i()&&!!t.onMove]),de(`dragstart`,l,e=>{t.onMove&&(dl(W(n).id),e.dataTransfer?.setData(ll,W(n).id),e.dataTransfer?.setData(`text/plain`,W(n).title),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`))}),de(`dragend`,l,function(...e){ml?.apply(this,e)}),r(`click`,l,()=>t.onSelect?.(W(n).id)),g(e,l)},$$slots:{default:!0}})}});var E=I(T,2),D=e=>{g(e,gl())};k(E,e=>{W(u)&&W(f)!==void 0&&W(f)>=t.views.length&&e(D)}),d(w);var O=I(w,2),ee=V(O,!0);d(O),d(x),pe(x,e=>G(o,e),()=>W(o)),P(()=>{S=s(x,1,`dock-tab-strip svelte-l43sst`,null,S,{"drag-active":W(u)}),K(w,`aria-label`,`${Wo[t.dock]} views`),A(ee,W(c))}),de(`dragover`,x,h),de(`dragleave`,x,()=>pl(t.dock)),de(`drop`,x,v),g(e,x),R()}T([`click`]);var yl=h(`<section class="dock-panel"><!> <div class="dock-body" role="presentation"><!> <!></div></section>`);function bl(e,t){a(t,!0);let n=F(t,`registry`,19,()=>t.views),r=F(t,`draggable`,3,!0),i=q(()=>!!(r()&&ul.viewId&&t.onMove));function o(e){W(i)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),fl(t.dock,t.views.length))}function s(e){if(!W(i))return;e.preventDefault();let n=ul.viewId??e.dataTransfer?.getData(`application/x-nerve-panel-view`);ml(),n&&t.onMove?.(n,{dock:t.dock,index:t.views.length})}var c=yl(),l=V(c);vl(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=I(l,2),p=V(f),m=e=>{var n=U();u(L(n),()=>t.panelView,()=>t.activeViewId),g(e,n)};k(p,e=>{t.activeViewId&&e(m)});var h=I(p,2),_=e=>{{let n=q(()=>ul.hoverDock===t.dock);Ko(e,{get dock(){return t.dock},get hovered(){return W(n)}})}};k(h,e=>{W(i)&&e(_)}),d(f),d(c),P(()=>{K(c,`data-dock`,t.dock),K(c,`aria-label`,Wo[t.dock])}),de(`dragover`,f,o),de(`dragleave`,f,()=>pl(t.dock)),de(`drop`,f,s),g(e,c),R()}var xl=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sl(e,t){let n=H(t,xl),r=[[`path`,{d:`m15 18-6-6 6-6`}]];N(e,B({name:`chevron-left`},()=>n,{get iconNode(){return r}}))}var Cl=new Set([`$$slots`,`$$events`,`$$legacy`]);function wl(e,t){let n=H(t,Cl),r=[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]];N(e,B({name:`plus`},()=>n,{get iconNode(){return r}}))}var Tl=new Set([`$$slots`,`$$events`,`$$legacy`]);function El(e,t){let n=H(t,Tl),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`}]];N(e,B({name:`refresh-cw`},()=>n,{get iconNode(){return r}}))}var Dl=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ol(e,t){let n=H(t,Dl),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];N(e,B({name:`x`},()=>n,{get iconNode(){return r}}))}var kl=h(`<button type="button" class="tab-file-toggle svelte-cucb0v"><!></button>`),Al=h(`<span class="tab-status svelte-cucb0v" aria-hidden="true"></span>`),jl=h(`<span class="tab-kind-icon flex-none svelte-cucb0v"><!></span>`),Ml=h(`<span class="draft-dot svelte-cucb0v" title="Draft" aria-label="Draft"></span>`),Nl=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>`),Pl=h(`<div class="flex items-center border-l border-l-border/62 px-1"><!></div>`),Fl=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 Il(e,t){a(t,!0);let n=F(t,`tabs`,19,()=>[]),i=F(t,`newLabel`,3,`New chat`),o=J(null),s=J(!1),c=J(!1),l=J(void 0),u=J(void 0),f=J(``);function p(){W(o)&&(G(s,W(o).scrollLeft>1),G(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&&(G(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),G(f,`${a.label} moved to position ${r+1}`)),G(l,void 0),G(u,void 0)}z(()=>{if(!W(o))return;let e=new ResizeObserver(p);return e.observe(W(o)),p(),()=>e.disconnect()}),z(()=>{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:El,shortcut:t.refreshShortcut,disabled:!t.onRefresh,onSelect:()=>t.onRefresh?.(i)}];return t.onReorder&&s.push({type:`separator`},{label:`Move Left`,icon:Xo,disabled:!a,onSelect:()=>t.onReorder(i,r-1)},{label:`Move Right`,icon:Qo,disabled:!o,onSelect:()=>t.onReorder(i,r+1)}),s.push({type:`separator`},{label:`Close Pane`,icon:Ol,shortcut:t.closeShortcut,disabled:e.closeable===!1||!t.onClose,onSelect:()=>t.onClose?.(i)},{label:`Close Other Panes`,icon:Ol,shortcut:t.closeOthersShortcut,disabled:n().length<=1||!t.onCloseOther,onSelect:()=>t.onCloseOther?.(i)},{label:`Close Panes on Right`,icon:Ol,disabled:!o||!t.onCloseRight,onSelect:()=>t.onCloseRight?.(i)},{label:`Close Panes on Left`,icon:Ol,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=Fl(),T=V(w),E=e=>{{let t=q(()=>!W(s));Oe(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)=>{Sl(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}})}};k(T,e=>{(W(s)||W(c))&&e(E)});var D=I(T,2);_(D,23,n,e=>b(e),(e,n,i)=>{let a=q(()=>W(n).icon),o=q(()=>W(n).selectIcon),s=q(()=>W(n).toggle?.icon);{let c=q(()=>S(W(n),W(i))),f=q(()=>`h-8 min-w-0 flex-none ${W(n).wide?`w-54 basis-54`:`w-50 basis-50`}`);fn(e,{get items(){return W(c)},get triggerClass(){return W(f)},children:(e,c)=>{var f=Nl(),p=V(f),m=V(p),_=e=>{var t=kl();C(V(t),()=>W(s),(e,t)=>{t(e,{size:12,strokeWidth:2.2,"aria-hidden":`true`})}),d(t),P(()=>{K(t,`aria-label`,W(n).toggle.label),K(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=>{gt(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=Al();P(()=>K(t,`title`,W(n).status?.label)),g(e,t)},w=e=>{var t=jl();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=I(p,2),E=V(T),D=e=>{var t=jl();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=I(E,2),ee=V(O,!0);d(O);var te=I(O,2),ne=e=>{g(e,Ml())};k(te,e=>{W(n).draft&&e(ne)}),d(T);var j=I(T,2);Ol(V(j),{size:13,strokeWidth:2.2}),d(j),d(f),P((e,t,r,i)=>{K(f,`data-active`,W(n).active?``:void 0),K(f,`data-running`,W(n).running?``:void 0),K(f,`data-errored`,W(n).error?``:void 0),K(f,`data-dragging`,e),K(f,`data-drop-target`,t),K(f,`data-tab-key`,r),K(f,`draggable`,i),K(T,`aria-selected`,W(n).active),K(T,`title`,W(n).title??W(n).label),A(ee,W(n).label),K(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]),de(`dragstart`,f,e=>h(e,W(n))),de(`dragover`,f,e=>{t.onReorder&&(e.preventDefault(),G(u,W(i),!0))}),de(`drop`,f,e=>v(e,W(i))),de(`dragend`,f,()=>{G(l,void 0),G(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),pe(D,e=>G(o,e),()=>W(o));var O=I(D,2),ee=e=>{{let t=q(()=>!W(c));Oe(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)=>{dt(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}})}};k(O,e=>{(W(s)||W(c))&&e(ee)});var te=I(O,2),ne=e=>{var n=Pl(),r=V(n);{let e=q(()=>t.newShortcut?`${i()} (${t.newShortcut})`:i());Oe(r,{variant:`ghost`,size:`icon-sm`,get ariaLabel(){return i()},get"aria-keyshortcuts"(){return t.newShortcutAria},get title(){return W(e)},get onclick(){return t.onNew},children:(e,t)=>{wl(e,{size:13,strokeWidth:2.25})},$$slots:{default:!0}})}d(n),g(e,n)};k(te,e=>{t.onNew&&e(ne)});var j=I(te,2),M=V(j,!0);d(j),d(w),P(()=>A(M,W(f))),de(`scroll`,D,p),g(e,w),R()}T([`click`]);var vte=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 yte(e,t){a(t,!0);let n=F(t,`tabs`,19,()=>[]);var r=vte(),i=V(r),o=e=>{var n=U();u(L(n),()=>t.tabStrip),g(e,n)},s=e=>{Il(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=I(i,2),l=V(c),f=e=>{var n=U();u(L(n),()=>t.content),g(e,n)},p=e=>{var n=U();u(L(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),R()}var Ll={left:{min:14,max:34},right:{min:16,max:40},bottom:{min:12,max:70}},Rl={left:19,right:24,bottom:30};function zl(e,t){let n=Ll[e];return typeof t!=`number`||!Number.isFinite(t)?Rl[e]:Math.min(n.max,Math.max(n.min,t))}function bte(e){return Uo.includes(e)}function Bl(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 xte(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:zl(e,t.size),collapsed:r.length===0?!0:t.collapsed}}function Vl(e){let t=Bl(e);for(let e of Uo)t.docks[e]=xte(e,t.docks[e],t.hidden);return t}function Ste(e,t={}){let n={};for(let r of Uo){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:zl(r,t.sizes?.[r]??Rl[r]),collapsed:t.collapsed?.includes(r)??!1}}return Vl({version:1,docks:n,hidden:[]})}function Hl(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Ul(e,t,n={}){let r=Ste(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 Uo){let t=a[e],n=t&&typeof t==`object`?t:{};c[e]={views:Hl(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:zl(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=Hl(i.hidden).filter(e=>o.has(e));return Vl({version:1,docks:c,hidden:[...new Set(l)]})}function Wl(e,t){return Uo.find(n=>e.docks[n].views.includes(t))}function Cte(e,t,n){if(!bte(n.dock))return e;let r=Wl(e,t);if(!r)return e;let i=Bl(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,Vl(i)}function wte(e,t){let n=Wl(e,t);if(!n)return e;let r=Bl(e);return r.hidden=r.hidden.filter(e=>e!==t),r.docks[n].activeViewId=t,r.docks[n].collapsed=!1,Vl(r)}function Tte(e,t){if(!Wl(e,t)||e.hidden.includes(t))return e;let n=Bl(e);return n.hidden.push(t),Vl(n)}function Ete(e,t){let n=Wl(e,t);if(!n)return e;let r=Bl(e);return r.hidden=r.hidden.filter(e=>e!==t),r.docks[n].activeViewId=t,r.docks[n].collapsed=!1,Vl(r)}function Dte(e,t){let n=Bl(e);return n.docks[t].collapsed=!n.docks[t].collapsed,Vl(n)}function Ote(e,t,n){let r=zl(t,n);if(e.docks[t].size===r)return e;let i=Bl(e);return i.docks[t].size=r,i}function Gl(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 Kl(e,t){return e.docks[t].collapsed?!1:e.docks[t].views.some(t=>!e.hidden.includes(t))}var kte=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ate(e,t){let n=H(t,kte),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 15h18`}],[`path`,{d:`m15 8-3 3-3-3`}]];N(e,B({name:`panel-bottom-close`},()=>n,{get iconNode(){return r}}))}var jte=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mte(e,t){let n=H(t,jte),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}],[`path`,{d:`m16 15-3-3 3-3`}]];N(e,B({name:`panel-left-close`},()=>n,{get iconNode(){return r}}))}var Nte=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pte(e,t){let n=H(t,Nte),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}],[`path`,{d:`m8 9 3 3-3 3`}]];N(e,B({name:`panel-right-close`},()=>n,{get iconNode(){return r}}))}var Fte=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 Ite(e,t){a(t,!0);let n=(e,t=D)=>{let n=q(()=>t().open?i[t().dock].open:i[t().dock].closed);{let r=q(()=>`Toggle ${t().label}`),i=q(()=>t().open?`Hide ${t().label}`:`Show ${t().label}`);Oe(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(L(r),()=>W(n),(e,t)=>{t(e,{size:13,strokeWidth:2.1,"aria-hidden":`true`})}),g(e,r)},$$slots:{default:!0}})}},r=F(t,`toggles`,19,()=>[]),i={left:{open:Mte,closed:ns},right:{open:Pte,closed:is},bottom:{open:Ate,closed:es}},o=q(()=>r().filter(e=>e.dock===`left`)),s=q(()=>r().filter(e=>e.dock!==`left`));var c=Fte(),l=V(c),f=V(l);_(f,17,()=>W(o),e=>e.dock,(e,t)=>{n(e,()=>W(t))});var p=I(f,2),m=e=>{var n=U();u(L(n),()=>t.left),g(e,n)};k(p,e=>{t.left&&e(m)}),d(l);var h=I(l,2),v=V(h),y=e=>{var n=U();u(L(n),()=>t.right),g(e,n)};k(v,e=>{t.right&&e(y)}),_(I(v,2),17,()=>W(s),e=>e.dock,(e,t)=>{n(e,()=>W(t))}),d(h),d(c),g(e,c),R()}var Lte=h(`<header><div class="flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden"><!></div> <!></header>`);function Rte(e,t){let n=F(t,`desktop`,3,!1);var r=Lte(),i=V(r);u(V(i),()=>t.left),d(i);var a=I(i,2),o=e=>{var n=U();u(L(n),()=>t.actions),g(e,n)};k(a,e=>{t.actions&&e(o)}),d(r),P(()=>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 zte=h(`<main class="app-frame svelte-qbdwib"><!> <!> <!></main>`);function Bte(e,t){var n=zte(),r=V(n);u(r,()=>t.titlebar);var i=I(r,2);u(i,()=>t.workspace),u(I(i,2),()=>t.footer),d(n),g(e,n)}function Vte(e){return typeof e==`function`}function ql(e){return typeof e==`object`&&!!e}var Hte=[`string`,`number`,`bigint`,`boolean`];function Jl(e){return e==null||Hte.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>Jl(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var Yl=Symbol(`box`),Xl=Symbol(`is-writable`);function Ute(e){return ql(e)&&Yl in e}function Wte(e){return Zl.isBox(e)&&Xl in e}function Zl(e){let t=J(ie(e));return{[Yl]:!0,[Xl]:!0,get current(){return W(t)},set current(e){G(t,e,!0)}}}function Gte(e,t){let n=q(e);return t?{[Yl]:!0,[Xl]:!0,get current(){return W(n)},set current(e){t(e)}}:{[Yl]:!0,get current(){return e()}}}function Kte(e){return Zl.isBox(e)?e:Vte(e)?Zl.with(e):Zl(e)}function qte(e){return Object.entries(e).reduce((e,[t,n])=>Zl.isBox(n)?(Zl.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 Jte(e){return Zl.isWritableBox(e)?{[Yl]:!0,get current(){return e.current}}:e}Zl.from=Kte,Zl.with=Gte,Zl.flatten=qte,Zl.readonly=Jte,Zl.isBox=Ute,Zl.isWritableBox=Wte;function Yte(...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 Xte=/\d/,Zte=[`-`,`_`,`/`,`.`];function Qte(e=``){if(!Xte.test(e))return e!==e.toLowerCase()}function $te(e){let t=[],n=``,r,i;for(let a of e){let e=Zte.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=Qte(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 Ql(e){return e?$te(e).map(e=>tne(e)).join(``):``}function ene(e){return nne(Ql(e||``))}function tne(e){return e?e[0].toUpperCase()+e.slice(1):``}function nne(e){return e?e[0].toLowerCase()+e.slice(1):``}function $l(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[Ql(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[ene(e)]=n}return Ve(e,n),t}function eu(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function rne(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 ine(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 ane=ine(/[A-Z]/,e=>`-${e.toLowerCase()}`);function one(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=>`${ane(t)}: ${e[t]};`).join(`
11
- `)}function tu(e={}){return one(e).replace(`
12
- `,` `)}tu({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 sne=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 cne(e){return sne.has(e)}function nu(...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&&cne(e))t[e]=Yte(n,i);else if(a&&o)t[e]=eu(n,i);else if(e===`class`){let r=Jl(n),a=Jl(i);r&&a?t[e]=ye(n,i):r?t[e]=ye(n):a&&(t[e]=ye(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=$l(i);t[e]={...n,...r}}else if(o&&a)t[e]={...$l(n),...i};else if(o&&s){let r=$l(n),a=$l(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=tu(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 lne=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function une(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=lne,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=ee(e=>{let n=ke(t,`focusin`,e),r=ke(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?une(this.#e):null}};function dne(e,t){switch(e){case`post`:z(t);break;case`pre`:je(t);break}}function ru(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;dne(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=ae(()=>n(t,o));return o=t,r})}function iu(e,t,n){let r=De(()=>{let i=!1;ru(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});z(()=>r)}function au(e,t,n){ru(e,`post`,t,n)}function fne(e,t,n){ru(e,`pre`,t,n)}au.pre=fne;function pne(e,t){iu(e,`post`,t)}function mne(e,t){iu(e,`pre`,t)}pne.pre=mne;function hne(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 gne(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 ou(e,t,n={},r){let{lazy:i=!1,once:a=!1,initialValue:o,debounce:s,throttle:c}=n,l=J(ie(o)),u=J(!1),d=J(void 0),f=J(ie([])),p=()=>{W(f).forEach(e=>e()),G(f,[],!0)},m=e=>{G(f,[...W(f),e],!0)},h=async(e,n,r=!1)=>{try{G(u,!0),G(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 G(l,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||G(d,e,!0);return}finally{G(u,!1)}},g=s?hne(h,s):c?gne(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=>{G(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 _ne(e,t,n){return ou(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];au(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function vne(e,t,n){return ou(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];au.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}_ne.pre=vne;function yne(e){ge().then(e)}var bne=9;function xne(e){return ql(e)&&e.nodeType===bne}function Sne(e){return ql(e)&&e.constructor?.name===`VisualViewport`}function Cne(e){return xne(e)?e:Sne(e)?e.document:e?.ownerDocument??document}function wne(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var su=class{element;#e=q(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return W(this.#e)}set root(e){G(this.#e,e)}constructor(e){typeof e==`function`?this.element=Zl.with(e):this.element=e}getDocument=()=>Cne(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>wne(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 cu(e,t){return{[Se()]:n=>Zl.isBox(e)?(e.current=n,ae(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e.current=null,t?.(null))}):(e(n),ae(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e(null),t?.(null))})}}function Tne({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 lu(e,t=`Assertion failed!`){if(!e)throw console.error(t),Error(t)}function uu(e,t,n=10){return du(e,t,n)===0}function du(e,t,n=10){let r=pu(e,n),i=pu(t,n);return Math.sign(r-i)}function fu(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 pu(e,t){return Number.parseFloat(e.toFixed(t))}var mu=typeof document<`u`;function Ene(e){return e instanceof HTMLElement}function hu(e){return e.type===`keydown`}function gu(e){return e.type.startsWith(`mouse`)}function _u(e){return e.type.startsWith(`touch`)}function vu({paneConstraints:e,paneIndex:t,initialSize:n}){let r=e[t];lu(r!=null,`Pane constraints should not be null.`);let{collapsedSize:i=0,collapsible:a,maxSize:o=100,minSize:s=0}=r,c=n;return du(c,s)<0&&(c=Dne(c,a,i,s)),c=Math.min(o,c),Number.parseFloat(c.toFixed(10))}function Dne(e,t,n,r){return t&&du(e,(n+r)/2)<0?n:r}function yu(){}function One({groupId:e,layout:t,panesArray:n,domContext:r}){let i=bu(e,r);for(let e=0;e<n.length-1;e++){let{valueMax:r,valueMin:a,valueNow:o}=Tne({layout:t,panesArray:n,pivotIndices:[e,e+1]}),s=i[e];if(Ene(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 bu(e,t){return mu?Array.from(t.querySelectorAll(`[data-pane-resizer-id][data-pane-group-id="${e}"]`)):[]}function xu({groupId:e,id:t,domContext:n}){return mu?bu(e,n).findIndex(e=>e.getAttribute(`data-pane-resizer-id`)===t)??null:null}function Su({groupId:e,dragHandleId:t,domContext:n}){let r=xu({groupId:e,id:t,domContext:n});return r==null?[-1,-1]:[r,r+1]}function Cu(e,t,n){let r=e.map(e=>e.constraints),i=wu(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 wu(e,t){return e.findIndex(e=>e.opts.id.current===t.opts.id.current)}function Tu(e,t,n){for(let r=0;r<t.length;r++){let i=t[r],a=e[r];lu(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 kne({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];lu(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];lu(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 Ane({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(!uu(r,100))for(let e=0;e<t.length;e++){let t=n[e];lu(t!=null),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];lu(r!=null);let a=vu({paneConstraints:t,paneIndex:e,initialSize:r});r!==a&&(i+=r-a,n[e]=a)}if(!uu(i,0))for(let e=0;e<t.length;e++){let r=n[e];lu(r!=null);let a=r+i,o=vu({paneConstraints:t,paneIndex:e,initialSize:a});if(r!==o&&(i-=o-r,n[e]=o,uu(i,0)))break}return n}function jne(e,t){return mu&&t.querySelector(`[data-pane-group][data-pane-group-id="${e}"]`)||null}function Eu(e,t){return mu&&t.querySelector(`[data-pane-resizer-id="${e}"]`)||null}function Mne({event:e,dragHandleId:t,dir:n,initialDragState:r,domContext:i}){let a=n===`horizontal`,o=Eu(t,i);lu(o);let s=o.getAttribute(`data-pane-group-id`);lu(s);let{initialCursorPosition:c}=r,l=Du(n,e),u=jne(s,i);lu(u);let d=u.getBoundingClientRect(),f=a?d.width:d.height;return(l-c)/f*100}function Nne({event:e,dragHandleId:t,dir:n,initialDragState:r,keyboardResizeBy:i,domContext:a}){if(hu(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:Mne({event:e,dragHandleId:t,dir:n,initialDragState:r,domContext:a})}function Du(e,t){let n=e===`horizontal`;if(gu(t))return n?t.clientX:t.clientY;if(_u(t)){let e=t.touches[0];return lu(e),n?e.screenX:e.screenY}else throw Error(`Unsupported event type "${t.type}"`)}function Pne({groupId:e,handleId:t,panesArray:n,domContext:r}){let i=Eu(t,r),a=bu(e,r),o=i?a.indexOf(i):-1;return[n[o]?.opts.id.current??null,n[o+1]?.opts.id.current??null]}function Ou({delta:e,layout:t,paneConstraints:n,pivotIndices:r,trigger:i}){if(uu(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(lu(i),i.collapsible){let i=t[r];lu(i!=null);let a=n[r];lu(a);let{collapsedSize:o=0,minSize:s=0}=a;if(uu(i,o)){let t=s-i;du(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?o:s,i=n[r];lu(i);let{collapsible:a}=i;if(a){let i=t[r];lu(i!=null);let a=n[r];lu(a);let{collapsedSize:o=0,minSize:s=0}=a;if(uu(i,s)){let t=i-o;du(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];lu(e!=null);let o=vu({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];lu(o!=null);let s=o-i,l=vu({paneConstraints:n,paneIndex:r,initialSize:s});if(!uu(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(uu(c,0))return t;{let r=e<0?s:o,i=t[r];lu(i!=null);let l=i+c,u=vu({paneConstraints:n,paneIndex:r,initialSize:l});if(a[r]=u,!uu(u,l)){let t=l-u,r=e<0?s:o;for(;r>=0&&r<n.length;){let i=a[r];lu(i!=null);let o=i+t,s=vu({paneConstraints:n,paneIndex:r,initialSize:o});if(uu(i,s)||(t-=s-i,a[r]=s),uu(t,0))break;e>0?r--:r++}}}return uu(a.reduce((e,t)=>t+e,0),100)?a:t}var ku=null,Au=null;function ju(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 Fne(){Au!==null&&(document.head.removeChild(Au),ku=null,Au=null)}function Ine(e,t){if(ku===e)return;ku=e;let n=ju(e);Au===null&&(Au=t.createElement(`style`),t.head.appendChild(Au)),Au.innerHTML=`*{cursor: ${n}!important;}`}function Lne({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 Mu(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 Nu(e){return`paneforge:${e}`}function Pu(e){return e.map(e=>e.opts.order.current?`${e.opts.order.current}:${JSON.stringify(e.constraints)}`:JSON.stringify(e.constraints)).sort().join(`,`)}function Fu(e,t){try{let n=Nu(e),r=t.getItem(n),i=JSON.parse(r||``);if(typeof i==`object`&&i)return i}catch{}return null}function Rne(e,t,n){return(Fu(e,n)||{})[Pu(t)]||null}function zne(e,t,n,r,i){let a=Nu(e),o=Pu(t),s=Fu(e,i)||{};s[o]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(a,JSON.stringify(s))}catch(e){console.error(e)}}var Iu={};function Bne(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function Vne({autoSaveId:e,layout:t,storage:n,panesArray:r,paneSizeBeforeCollapse:i}){if(t.length===0||t.length!==r.length)return;let a=Iu[e];a??(a=Bne(zne,100),Iu[e]=a);let o=[...r],s=new Map(i);a(e,o,s,t,n)}var Lu={getItem:e=>(Mu(Lu),Lu.getItem(e)),setItem:(e,t)=>{Mu(Lu),Lu.setItem(e,t)}},Ru=new oee(`PaneGroup`),Hne=class e{static create(t){return Ru.set(new e(t))}opts;attachment;domContext;#e=J(null);get dragState(){return W(this.#e)}set dragState(e){G(this.#e,e)}#t=J([]);get layout(){return W(this.#t)}set layout(e){G(this.#t,e)}#n=J([]);get panesArray(){return W(this.#n)}set panesArray(e){G(this.#n,e)}#r=J(!1);get panesArrayChanged(){return W(this.#r)}set panesArrayChanged(e){G(this.#r,e,!0)}#i=J(ie({}));get paneIdToLastNotifiedSizeMap(){return W(this.#i)}set paneIdToLastNotifiedSizeMap(e){G(this.#i,e,!0)}paneSizeBeforeCollapseMap=new Map;prevDelta=0;constructor(e){this.opts=e,this.attachment=cu(this.opts.ref),this.domContext=new su(this.opts.ref),kt([()=>this.opts.id.current,()=>this.layout,()=>this.panesArray],()=>One({groupId:this.opts.id.current,layout:this.layout,panesArray:this.panesArray,domContext:this.domContext})),z(()=>ae(()=>this.#a())),kt([()=>this.opts.autoSaveId.current,()=>this.layout,()=>this.opts.storage.current],()=>{this.opts.autoSaveId.current&&Vne({autoSaveId:this.opts.autoSaveId.current,layout:this.layout,storage:this.opts.storage.current,panesArray:this.panesArray,paneSizeBeforeCollapse:this.paneSizeBeforeCollapseMap})}),kt(()=>this.panesArrayChanged,()=>{if(!this.panesArrayChanged)return;this.panesArrayChanged=!1;let e=this.layout,t=null;if(this.opts.autoSaveId.current){let e=Rne(this.opts.autoSaveId.current,this.panesArray,this.opts.storage.current);e&&(this.paneSizeBeforeCollapseMap=new Map(Object.entries(e.expandToSizes)),t=e.layout)}t??=kne({panesArray:this.panesArray});let n=Ane({layout:t,paneConstraints:this.panesArray.map(e=>e.constraints)});fu(e,n)||(this.layout=n,this.opts.onLayout.current?.(n),Tu(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=Su({groupId:i,dragHandleId:e,domContext:this.domContext}),d=Nne({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=Ou({delta:d,layout:c??o,paneConstraints:p,pivotIndices:u,trigger:hu(t)?`keyboard`:`mouse-or-touch`}),h=!fu(o,m);(gu(t)||_u(t))&&this.prevDelta!==d&&(this.prevDelta=d,Ine(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),Tu(s,m,this.paneIdToLastNotifiedSizeMap))};resizePane=(e,t)=>{let n=this.layout,r=this.panesArray,i=r.map(e=>e.constraints),{paneSize:a,pivotIndices:o}=Cu(r,e,n);lu(a!=null);let s=Ou({delta:wu(r,e)===r.length-1?a-t:t-a,layout:n,paneConstraints:i,pivotIndices:o,trigger:`imperative-api`});fu(n,s)||(this.setLayout(s),this.opts.onLayout.current?.(s),Tu(r,s,this.paneIdToLastNotifiedSizeMap))};startDragging=(e,t)=>{let n=this.opts.direction.current,r=this.layout,i=Eu(e,this.domContext);lu(i);let a=Du(n,t);this.dragState={dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r}};stopDragging=()=>{Fne(),this.dragState=null};isPaneCollapsed=e=>{let t=this.panesArray,n=this.layout,{collapsedSize:r=0,collapsible:i,paneSize:a}=Cu(t,e,n);return typeof a!=`number`||typeof r!=`number`?!1:i===!0&&uu(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}=Cu(n,e,t);if(a!==i)return;let c=this.paneSizeBeforeCollapseMap.get(e.opts.id.current),l=c!=null&&c>=o?c:o,u=Ou({delta:wu(n,e)===n.length-1?a-l:l-a,layout:t,paneConstraints:r,pivotIndices:s,trigger:`imperative-api`});fu(t,u)||(this.setLayout(u),this.opts.onLayout.current?.(u),Tu(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}=Cu(n,e,t);if(lu(a!=null),a===i)return;this.paneSizeBeforeCollapseMap.set(e.opts.id.current,a);let s=Ou({delta:wu(n,e)===n.length-1?a-i:i-a,layout:t,paneConstraints:r,pivotIndices:o,trigger:`imperative-api`});fu(t,s)||(this.layout=s,this.opts.onLayout.current?.(s),Tu(n,s,this.paneIdToLastNotifiedSizeMap))};getPaneSize=e=>Cu(this.panesArray,e,this.layout).paneSize;getPaneStyle=(e,t)=>{let n=this.panesArray,r=this.layout,i=this.dragState;return Lne({defaultSize:t,dragState:i,layout:r,panesArray:n,paneIndex:wu(n,e)})};isPaneExpanded=e=>{let{collapsedSize:t=0,collapsible:n,paneSize:r}=Cu(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=wu(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=bu(e,this.domContext),n=this.panesArray,r=t.map(t=>{let r=t.getAttribute(`data-pane-resizer-id`);if(!r)return yu;let[i,a]=Pne({groupId:e,handleId:r,panesArray:n,domContext:this.domContext});if(i==null||a==null)return yu;let o=rne(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];lu(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=Ou({delta:uu(c,l)?d-c:l-c,layout:s,paneConstraints:n.map(e=>e.constraints),pivotIndices:Su({groupId:e,dragHandleId:r,domContext:this.domContext}),trigger:`keyboard`});s!==f&&(this.layout=f)});return()=>{o()}});return()=>{for(let e of r)e()}};#o=q(()=>({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){G(this.#o,e)}},Une=[`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`],Wne=class e{static create(t){return new e(t,Ru.get())}opts;#e;attachment;domContext;#t=q(()=>this.#e.dragState?.dragHandleId===this.opts.id.current);#n=J(!1);resizeHandler=null;constructor(e,t){this.opts=e,this.#e=t,this.attachment=cu(this.opts.ref),this.domContext=new su(this.opts.ref),z(()=>{this.opts.disabled.current?this.resizeHandler=null:this.resizeHandler=this.#e.registerResizeHandle(this.opts.id.current)}),z(()=>{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 eu(ke(s,`contextmenu`,o),ke(s,`mousemove`,i),ke(s,`touchmove`,i,{passive:!1}),ke(s,`mouseleave`,a),ke(c,`mouseup`,o),ke(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(Une.includes(e.key)){e.preventDefault(),this.resizeHandler(e);return}if(e.key!==`F6`)return;e.preventDefault();let t=bu(this.#e.opts.id.current,this.domContext),n=xu({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=()=>{G(this.#n,!1)};#s=()=>{G(this.#n,!0)};#c=e=>{this.#r(e)};#l=()=>{this.#i()};#u=()=>{this.#i()};#d=()=>{this.#i()};#f=e=>{this.#r(e)};#p=q(()=>({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:ju(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){G(this.#p,e)}},Gne=class e{static create(t){return new e(t,Ru.get())}opts;group;attachment;domContext;#e=J(``);#t=q(()=>({onCollapse:this.opts.onCollapse.current,onExpand:this.opts.onExpand.current,onResize:this.opts.onResize.current}));get callbacks(){return W(this.#t)}set callbacks(e){G(this.#t,e)}#n=q(()=>({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){G(this.#n,e)}#r=e=>{G(this.#e,e,!0),yne(()=>{if(this.opts.ref.current){let e=this.opts.ref.current;if(getComputedStyle(e).transitionDuration===`0s`){G(this.#e,``);return}let t=n=>{n.propertyName===`flex-grow`&&(G(this.#e,``),e.removeEventListener(`transitionend`,t))};e.addEventListener(`transitionend`,t)}else G(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=cu(this.opts.ref),this.domContext=new su(this.opts.ref),le(()=>this.group.registerPane(this)),kt(()=>y(this.constraints),()=>{this.group.panesArrayChanged=!0})}#i=q(()=>this.group.isPaneCollapsed(this));#a=q(()=>W(this.#e)===``?W(this.#i)?`collapsed`:`expanded`:W(this.#e));#o=q(()=>({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){G(this.#o,e)}},Kne=new Set([`$$slots`,`$$events`,`$$legacy`,`autoSaveId`,`direction`,`id`,`keyboardResizeBy`,`onLayoutChange`,`storage`,`ref`,`child`,`children`]),qne=h(`<div><!></div>`);function Jne(e,t){let n=ne();a(t,!0);let r=F(t,`autoSaveId`,3,null),i=F(t,`id`,3,n),o=F(t,`keyboardResizeBy`,3,null),s=F(t,`onLayoutChange`,3,yu),c=F(t,`storage`,3,Lu),l=F(t,`ref`,15,null),f=H(t,Kne),p=Hne.create({id:Zl.with(()=>i()??n),ref:Zl.with(()=>l(),e=>l(e)),autoSaveId:Zl.with(()=>r()),direction:Zl.with(()=>t.direction),keyboardResizeBy:Zl.with(()=>o()),onLayout:Zl.with(()=>s()),storage:Zl.with(()=>c())}),m=()=>p.layout,h=p.setLayout,_=()=>p.opts.id.current,v=q(()=>nu(f,p.props));var y={getLayout:m,setLayout:h,getId:_},b=U(),x=L(b),S=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(v)})),g(e,n)},C=e=>{var n=qne();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),R(y)}var Yne=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`collapsedSize`,`collapsible`,`defaultSize`,`maxSize`,`minSize`,`onCollapse`,`onExpand`,`onResize`,`order`,`child`,`children`]),Xne=h(`<div><!></div>`);function zu(e,t){let n=ne();a(t,!0);let r=F(t,`id`,3,n),i=F(t,`ref`,15,null),o=F(t,`onCollapse`,3,yu),s=F(t,`onExpand`,3,yu),c=F(t,`onResize`,3,yu),l=H(t,Yne),f=Gne.create({id:Zl.with(()=>r()),ref:Zl.with(()=>i(),e=>i(e)),collapsedSize:Zl.with(()=>t.collapsedSize),collapsible:Zl.with(()=>t.collapsible),defaultSize:Zl.with(()=>t.defaultSize),maxSize:Zl.with(()=>t.maxSize),minSize:Zl.with(()=>t.minSize),onCollapse:Zl.with(()=>o()),onExpand:Zl.with(()=>s()),onResize:Zl.with(()=>c()),order:Zl.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=q(()=>nu(l,f.props));var S={collapse:p,expand:m,getSize:h,isCollapsed:_,isExpanded:v,resize:y,getId:b},C=U(),w=L(C),T=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(x)})),g(e,n)},E=e=>{var n=Xne();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),R(S)}var Zne=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`disabled`,`onDraggingChange`,`tabindex`,`child`,`children`]),Qne=h(`<div><!></div>`);function $ne(e,t){let n=ne();a(t,!0);let r=F(t,`id`,3,n),i=F(t,`ref`,15,null),o=F(t,`disabled`,3,!1),s=F(t,`onDraggingChange`,3,yu),c=F(t,`tabindex`,3,0),l=H(t,Zne),f=Wne.create({id:Zl.with(()=>r()),ref:Zl.with(()=>i(),e=>i(e)),disabled:Zl.with(()=>o()),onDraggingChange:Zl.with(()=>s()),tabIndex:Zl.with(()=>c())}),p=q(()=>nu(l,f.props));var m=U(),h=L(m),_=e=>{var n=U();u(L(n),()=>t.child,()=>({props:W(p)})),g(e,n)},v=e=>{var n=Qne();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),R()}var ere=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`withHandle`]),tre=h(`<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>`);function Bu(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`withHandle`,3,!1),i=H(t,ere);var o=U(),s=L(o);{let e=q(()=>he(`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,()=>$ne,(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=L(n),a=e=>{g(e,tre())};k(i,e=>{r()&&e(a)}),g(e,n)},$$slots:{default:!0}}))})}g(e,o),R()}var nre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`this`,`class`]);function Vu(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`this`,15),i=H(t,nre);var o=U(),s=L(o);{let e=q(()=>he(`cn-resizable-panel-group flex h-full w-full data-[direction=vertical]:flex-col`,t.class));C(s,()=>Jne,(t,a)=>{pe(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),R()}var rre=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function Hu(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=H(t,rre);var i=U();C(L(i),()=>zs,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),R()}var ire=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function are(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,ire);var i=U(),o=L(i);{let e=q(()=>he(`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,()=>at,(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),R()}var ore=new Set([`$$slots`,`$$events`,`$$legacy`]);function sre(e,t){let n=H(t,ore);var r=U();C(L(r),()=>We,(e,t)=>{t(e,B(()=>n))}),g(e,r)}function Uu(e){return e===`left`?-1:1}function Wu(e,t){return Number.isFinite(t)?Math.max(0,t*Uu(e)):0}function cre(e,t){let n=Wu(e,t);return n===0?0:n*Uu(e)}function lre({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 ure=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`style`,`side`,`portalProps`,`swipeToDismiss`,`onSwipeDismiss`,`children`]),dre=h(`<!> <!>`,1);function Gu(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`side`,3,`right`),i=F(t,`swipeToDismiss`,3,!1),o=H(t,ure),s=q(()=>i()&&(r()===`left`||r()===`right`)),c=J(void 0),l=J(!1),d=J(!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,G(d,!1),G(l,!1),G(c,void 0),e&&t.onSwipeDismiss?.()}function v(){m=void 0,h(),p=!1,G(d,!1),G(l,!1),G(c,void 0)}z(()=>{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),G(l,!1),G(d,!0),p=e,G(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),G(l,!0)}e.preventDefault(),G(c,cre(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=Wu(i,e.clientX-n.startX),a=Math.max(1,e.timeStamp-n.startTime);o(lre({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()}}),sre(e,B(()=>t.portalProps,{children:(e,i)=>{var a=dre(),f=L(a);are(f,{});var p=I(f,2);{let e=q(()=>he(`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=q(()=>W(c)===void 0?t.style:`${t.style?`${t.style};`:``}translate:${W(c)}px 0`);C(p,()=>Ks,(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(L(r),()=>t.children??D),g(e,r)},$$slots:{default:!0}}))})}g(e,a)},$$slots:{default:!0}})),R()}h(`<div><!></div>`);var fre=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Ku(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,fre);var i=U(),o=L(i);{let e=q(()=>he(`text-foreground font-medium`,t.class));C(o,()=>Ke,(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),R()}var pre=h(`<div role="presentation"><span class="dock-drop-label svelte-17tnf9a"> </span></div>`),qu=h(`<!> <!>`,1),mre=h(`<!> <section class="dock-panel" data-dock="right" aria-label="Panels"><!> <div class="dock-body"><!></div></section>`,1),hre=h(`<div class="workspace-shell compact svelte-17tnf9a"><div class="workbench-editor-area svelte-17tnf9a"><!></div></div> <!> <!>`,1),gre=h(`<div class="workbench-editor-area svelte-17tnf9a"><!></div>`),Ju=h(`<!> <!> <!>`,1),_re=h(`<div class="workspace-shell svelte-17tnf9a"><!> <!></div>`);function vre(e,t){a(t,!0);let n=(e,t=D)=>{var n=pre();let r;var i=V(n),a=V(i,!0);d(i),d(n),P(()=>{r=s(n,1,`dock-drop-strip svelte-17tnf9a`,null,r,{hovered:ul.hoverDock===t()}),K(n,`data-dock`,t()),A(a,Wo[t()])}),de(`dragover`,n,e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),fl(t(),2**53-1)}),de(`dragleave`,n,()=>pl(t())),de(`drop`,n,e=>O(e,t())),g(e,n)},r=F(t,`compact`,3,!1),i=F(t,`primarySheetOpen`,3,!1),c=F(t,`secondarySheetOpen`,3,!1),l=F(t,`keyboardResizeBy`,3,8),f=F(t,`actions`,19,()=>({})),p=q(()=>Gl(t.layout,`left`,t.descriptors)),m=q(()=>Gl(t.layout,`right`,t.descriptors)),h=q(()=>Gl(t.layout,`bottom`,t.descriptors)),_=q(()=>!r()&&Kl(t.layout,`left`)),v=q(()=>!r()&&Kl(t.layout,`right`)),y=q(()=>!r()&&Kl(t.layout,`bottom`)),b=q(()=>[...W(m),...W(h)]),x=J(void 0),S=q(()=>W(x)&&W(b).some(e=>e.id===W(x))?W(x):W(b)[0]?.id);function T(e){G(x,e,!0),f().onActivateView?.(e)}let E=q(()=>!r()&&!!ul.viewId);function O(e,t){e.preventDefault();let n=ul.viewId??e.dataTransfer?.getData(`application/x-nerve-panel-view`);ml(),n&&f().onMoveView?.(n,{dock:t,index:2**53-1})}Bte(e,{titlebar:e=>{var n=U();u(L(n),()=>t.titlebar),g(e,n)},workspace:e=>{var a=qu(),s=L(a),x=e=>{var n=hre(),r=L(n),a=V(r);u(V(a),()=>t.editor),d(a),d(r);var o=I(r,2);C(o,()=>Hu,(e,n)=>{n(e,{get open(){return i()},onOpenChange:e=>f().onSheetOpenChange?.(`primary`,e),children:(e,n)=>{var r=U();C(L(r),()=>Gu,(e,n)=>{n(e,{side:`left`,class:`sheet-pane`,swipeToDismiss:!0,onSwipeDismiss:()=>f().onSheetOpenChange?.(`primary`,!1),children:(e,n)=>{var r=qu(),i=L(r);C(i,()=>Ku,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{w();var n=M();P(()=>A(n,Wo.left)),g(e,n)},$$slots:{default:!0}})}),bl(I(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(I(o,2),()=>Hu,(e,n)=>{n(e,{get open(){return c()},onOpenChange:e=>f().onSheetOpenChange?.(`secondary`,e),children:(e,n)=>{var r=U();C(L(r),()=>Gu,(e,n)=>{n(e,{side:`right`,class:`sheet-pane`,swipeToDismiss:!0,onSwipeDismiss:()=>f().onSheetOpenChange?.(`secondary`,!1),children:(e,n)=>{var r=mre(),i=L(r);C(i,()=>Ku,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{w(),g(e,M(`Panels`))},$$slots:{default:!0}})});var a=I(i,2),o=V(a);vl(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=I(o,2),c=V(s),l=e=>{var n=U();u(L(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=_re(),i=V(r);Vu(i,{direction:`horizontal`,get keyboardResizeBy(){return l()},children:(e,n)=>{var r=Ju(),i=L(r),a=e=>{var n=qu(),r=L(n);zu(r,{get defaultSize(){return t.layout.docks.left.size},get minSize(){return Ll.left.min},get maxSize(){return Ll.left.max},order:1,onResize:e=>f().onDockResize?.(`left`,e),children:(e,n)=>{bl(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}}),Bu(I(r,2),{"aria-label":`Resize left panel`}),g(e,n)};k(i,e=>{W(_)&&e(a)});var s=I(i,2);zu(s,{minSize:25,order:2,children:(e,n)=>{var r=U();o(L(r),()=>W(y),e=>{Vu(e,{direction:`vertical`,get keyboardResizeBy(){return l()},children:(e,n)=>{var r=qu(),i=L(r);{let e=q(()=>100-(W(y)?t.layout.docks.bottom.size:0));zu(i,{get defaultSize(){return W(e)},minSize:25,order:1,children:(e,n)=>{var r=gre();u(V(r),()=>t.editor),d(r),g(e,r)},$$slots:{default:!0}})}var a=I(i,2),o=e=>{var n=qu(),r=L(n);Bu(r,{"aria-label":`Resize bottom panel`}),zu(I(r,2),{get defaultSize(){return t.layout.docks.bottom.size},get minSize(){return Ll.bottom.min},get maxSize(){return Ll.bottom.max},order:2,onResize:e=>f().onDockResize?.(`bottom`,e),children:(e,n)=>{bl(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=I(s,2),b=e=>{var n=qu(),r=L(n);Bu(r,{"aria-label":`Resize right panel`}),zu(I(r,2),{get defaultSize(){return t.layout.docks.right.size},get minSize(){return Ll.right.min},get maxSize(){return Ll.right.max},order:3,onResize:e=>f().onDockResize?.(`right`,e),children:(e,n)=>{bl(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=I(i,2),s=e=>{var t=Ju(),r=L(t),i=e=>{n(e,()=>`left`)};k(r,e=>{W(_)||e(i)});var a=I(r,2),o=e=>{n(e,()=>`right`)};k(a,e=>{W(v)||e(o)});var s=I(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=I(s,2),ee=e=>{var n=U();u(L(n),()=>t.overlays),g(e,n)};k(O,e=>{t.overlays&&e(ee)}),g(e,a)},footer:e=>{var n=U();u(L(n),()=>t.statusBar),g(e,n)},$$slots:{titlebar:!0,workspace:!0,footer:!0}}),R()}var Yu=ie({quitRequested:!1}),yre=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 bre(e,t){a(t,!0);let n=q(()=>Fn.quitting||Yu.quitRequested);var r=U(),i=L(r),o=e=>{g(e,yre())};k(i,e=>{Fn.isDesktop&&W(n)&&e(o)}),g(e,r),R()}var xre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sre(e,t){let n=H(t,xre),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`}]];N(e,B({name:`book-open-text`},()=>n,{get iconNode(){return r}}))}var Cre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xu(e,t){let n=H(t,Cre),r=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]];N(e,B({name:`code-xml`},()=>n,{get iconNode(){return r}}))}var wre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zu(e,t){let n=H(t,wre),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`}]];N(e,B({name:`copy`},()=>n,{get iconNode(){return r}}))}var Tre=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qu(e,t){let n=H(t,Tre),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`}]];N(e,B({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var Ere=new Set([`$$slots`,`$$events`,`$$legacy`]);function $u(e,t){let n=H(t,Ere),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`}]];N(e,B({name:`file-text`},()=>n,{get iconNode(){return r}}))}var Dre=new Set([`$$slots`,`$$events`,`$$legacy`]);function ed(e,t){let n=H(t,Dre),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`}]];N(e,B({name:`git-pull-request`},()=>n,{get iconNode(){return r}}))}var Ore=new Set([`$$slots`,`$$events`,`$$legacy`]);function td(e,t){let n=H(t,Ore),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`}]];N(e,B({name:`cloud-cog`},()=>n,{get iconNode(){return r}}))}var nd=new Set([`$$slots`,`$$events`,`$$legacy`]);function rd(e,t){let n=H(t,nd),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`}]];N(e,B({name:`logs`},()=>n,{get iconNode(){return r}}))}var id=new Set([`$$slots`,`$$events`,`$$legacy`]);function ad(e,t){let n=H(t,id),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`}]];N(e,B({name:`settings`},()=>n,{get iconNode(){return r}}))}var od=new Set([`$$slots`,`$$events`,`$$legacy`]);function sd(e,t){let n=H(t,od),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];N(e,B({name:`terminal`},()=>n,{get iconNode(){return r}}))}async function cd(e){let t=Ln();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 ld=Array(12).fill(0),ud=h(`<div class="sonner-loading-bar"></div>`),dd=h(`<div><div class="sonner-spinner"></div></div>`);function fd(e,t){a(t,!0);var n=dd(),r=V(n);_(r,23,()=>ld,(e,t)=>`spinner-bar-${t}`,(e,t)=>{g(e,ud())}),d(r),d(n),P(e=>{s(n,1,e),K(n,`data-visible`,t.visible)},[()=>x([`sonner-loading-wrapper`,t.class].filter(Boolean).join(` `))]),g(e,n),R()}function pd(e){return e.label!==void 0}function md(){let e=J(ie(typeof document<`u`?document.hidden:!1));return z(()=>ke(document,`visibilitychange`,()=>{G(e,document.hidden,!0)})),{get current(){return W(e)}}}var hd=4e3,gd=14,_d=45,vd=200,yd=.05,bd={toast:``,title:``,description:``,loader:``,closeButton:``,cancelButton:``,actionButton:``,action:``,warning:``,error:``,success:``,default:``,info:``,loading:``};function xd(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}function Sd(e){return 1/(1.5+Math.abs(e)/20)}var Cd=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(`.`)),wd=h(`<div><!></div>`),Td=h(`<button data-close-button=""><!></button>`),Ed=h(`<div data-icon=""><!> <!></div>`),Dd=h(`<div data-description=""><!></div>`),Od=h(`<button data-button="" data-cancel=""> </button>`),kd=h(`<button data-button=""> </button>`),Ad=h(`<!> <div data-content=""><div data-title=""><!></div> <!></div> <!> <!>`,1),jd=h(`<li aria-atomic="true" data-sonner-toast=""><!> <!></li>`);function Md(e,t){a(t,!0);let n=e=>{var n=U(),r=L(n),i=e=>{var n=wd();u(V(n),()=>t.loadingIcon),d(n),P(e=>{s(n,1,e),K(n,`data-visible`,W(j)===`loading`)},[()=>x(zn(W(ve)?.loader,t.toast?.classes?.loader,`sonner-loader`))]),g(e,n)},a=e=>{{let n=q(()=>zn(W(ve)?.loader,t.toast.classes?.loader)),r=q(()=>W(j)===`loading`);fd(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=F(t,`cancelButtonStyle`,3,``),o=F(t,`actionButtonStyle`,3,``),c=F(t,`descriptionClass`,3,``),f=F(t,`unstyled`,3,!1),p=F(t,`defaultRichColors`,3,!1);H(t,Cd);let m={...bd},h=J(!1),_=J(!1),v=J(!1),y=J(!1),b=J(!1),S=J(0),w=J(0),T=t.toast.duration||t.duration||hd,E=J(void 0),O=J(null),ee=J(null),te=q(()=>t.index===0),ne=q(()=>t.index+1<=t.visibleToasts),j=q(()=>t.toast.type),re=q(()=>t.toast.dismissible===void 0?t.toast.dismissable!==!1:t.toast.dismissible!==!1),ie=q(()=>t.toast.class||``),N=q(()=>t.toast.descriptionClass||``),oe=q(()=>Hn.heights.findIndex(e=>e.toastId===t.toast.id)||0),se=q(()=>t.toast.closeButton??t.closeButton),ce=q(()=>t.toast.duration??t.duration??hd),ue=null,fe=q(()=>t.position.split(`-`)),me=q(()=>Hn.heights.reduce((e,t,n)=>n>=W(oe)?e:e+t.height,0)),he=md(),ge=q(()=>t.toast.invert||t.invert),_e=q(()=>W(j)===`loading`),ve=q(()=>({...m,...t.classes})),ye=q(()=>t.toast.title),be=q(()=>t.toast.description),xe=J(0),Se=J(0),Ce=q(()=>Math.round(W(oe)*gd+W(me)));z(()=>{W(ye),W(be);let e;e=t.expanded||t.expandByDefault?1:1-t.index*yd;let n=ae(()=>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,G(w,o,!0),Hn.setHeight({toastId:t.toast.id,height:o})});function we(){G(_,!0),G(S,W(Ce),!0),Hn.removeHeight(t.toast.id),setTimeout(()=>{Hn.remove(t.toast.id)},vd)}let Te,Ee=q(()=>t.toast.promise&&W(j)===`loading`||t.toast.duration===1/0);function De(){G(xe,new Date().getTime(),!0),Te=setTimeout(()=>{t.toast.onAutoClose?.(t.toast),we()},T)}function Oe(){if(W(Se)<W(xe)){let e=new Date().getTime()-W(xe);T-=e}G(Se,new Date().getTime(),!0)}z(()=>{t.toast.updated&&(clearTimeout(Te),T=W(ce),W(Ee)||De())}),z(()=>(W(Ee)||(t.expanded||t.interacting||t.pauseWhenPageIsHidden&&he.current?Oe():De()),()=>clearTimeout(Te))),le(()=>{G(h,!0);let e=W(E)?.getBoundingClientRect().height;return G(w,e,!0),Hn.setHeight({toastId:t.toast.id,height:e}),()=>{Hn.removeHeight(t.toast.id)}}),z(()=>{t.toast.delete&&ae(()=>{we(),t.toast.onDismiss?.(t.toast)})});let ke=e=>{if(W(_e))return;G(S,W(Ce),!0);let t=e.target;t.setPointerCapture(e.pointerId),t.tagName!==`BUTTON`&&(G(v,!0),ue={x:e.clientX,y:e.clientY})},Ae=()=>{if(W(y)||!W(re))return;ue=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)>=_d||a>.11){G(S,W(Ce),!0),t.toast.onDismiss?.(t.toast),W(O)===`x`?G(ee,e>0?`right`:`left`,!0):G(ee,n>0?`down`:`up`,!0),we(),G(y,!0);return}else W(E)?.style.setProperty(`--swipe-amount-x`,`0px`),W(E)?.style.setProperty(`--swipe-amount-y`,`0px`);G(b,!1),G(v,!1),G(O,null)},je=e=>{if(!ue||!W(re)||(window.getSelection()?.toString().length??-1)>0)return;let n=e.clientY-ue.y,r=e.clientX-ue.x,i=t.swipeDirections??xd(t.position);!W(O)&&(Math.abs(r)>1||Math.abs(n)>1)&&G(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*Sd(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*Sd(r);a.x=Math.abs(e)<Math.abs(r)?e:r}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&G(b,!0),W(E)?.style.setProperty(`--swipe-amount-x`,`${a.x}px`),W(E)?.style.setProperty(`--swipe-amount-y`,`${a.y}px`)},Me=()=>{G(v,!1),G(O,null),ue=null},Ne=q(()=>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 Pe=jd();K(Pe,`tabindex`,0);let Fe;var Ie=V(Pe),Le=e=>{var n=Td();u(V(n),()=>t.closeIcon??D),d(n),P(e=>{K(n,`aria-label`,t.closeButtonAriaLabel),K(n,`data-disabled`,W(_e)),s(n,1,e)},[()=>x(zn(W(ve)?.closeButton,t.toast?.classes?.closeButton))]),r(`click`,n,()=>{W(_e)||!W(re)||(we(),t.toast.onDismiss?.(t.toast))}),g(e,n)};k(Ie,e=>{W(se)&&!t.toast.component&&W(j)!==`loading`&&t.closeIcon!==null&&e(Le)});var Re=I(Ie,2),ze=e=>{let n=q(()=>t.toast.component);var r=U();C(L(r),()=>W(n),(e,n)=>{n(e,B(()=>t.toast.componentProps,{closeToast:we}))}),g(e,r)},Be=e=>{var a=Ad(),f=L(a),p=e=>{var r=Ed(),i=V(r),a=e=>{var r=U(),i=L(r),a=e=>{var n=U();C(L(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=I(i,2),c=e=>{var n=U(),r=L(n),i=e=>{var n=U();C(L(n),()=>t.toast.icon,(e,t)=>{t(e,{})}),g(e,n)},a=e=>{var n=U();u(L(n),()=>t.successIcon??D),g(e,n)},o=e=>{var n=U();u(L(n),()=>t.errorIcon??D),g(e,n)},s=e=>{var n=U();u(L(n),()=>t.warningIcon??D),g(e,n)},c=e=>{var n=U();u(L(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),P(e=>s(r,1,e),[()=>x(zn(W(ve)?.icon,t.toast?.classes?.icon))]),g(e,r)};k(f,e=>{(W(j)||t.toast.icon||t.toast.promise)&&t.toast.icon!==null&&(W(Ne)!==null||t.toast.icon)&&e(p)});var m=I(f,2),h=V(m),_=V(h),v=e=>{var n=U(),r=L(n),i=e=>{let n=q(()=>t.toast.title);var r=U();C(L(r),()=>W(n),(e,n)=>{n(e,B(()=>t.toast.componentProps))}),g(e,r)},a=e=>{var n=M();P(()=>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=I(h,2),b=e=>{var n=Dd(),r=V(n),i=e=>{let n=q(()=>t.toast.description);var r=U();C(L(r),()=>W(n),(e,n)=>{n(e,B(()=>t.toast.componentProps))}),g(e,r)},a=e=>{var n=M();P(()=>A(n,t.toast.description)),g(e,n)};k(r,e=>{typeof t.toast.description==`string`?e(a,-1):e(i)}),d(n),P(e=>s(n,1,e),[()=>x(zn(c(),W(N),W(ve)?.description,t.toast.classes?.description))]),g(e,n)};k(y,e=>{t.toast.description&&e(b)}),d(m);var S=I(m,2),w=e=>{var n=U(),a=L(n),o=e=>{var n=U();C(L(n),()=>t.toast.cancel,(e,t)=>{t(e,{})}),g(e,n)},c=e=>{var n=Od(),a=V(n,!0);d(n),P(e=>{l(n,t.toast.cancelButtonStyle??i()),s(n,1,e),A(a,t.toast.cancel.label)},[()=>x(zn(W(ve)?.cancelButton,t.toast?.classes?.cancelButton))]),r(`click`,n,e=>{pd(t.toast.cancel)&&W(re)&&(t.toast.cancel?.onClick?.(e),we())}),g(e,n)},u=q(()=>pd(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=I(S,2),E=e=>{var n=U(),i=L(n),a=e=>{var n=U();C(L(n),()=>t.toast.action,(e,t)=>{t(e,{})}),g(e,n)},c=e=>{var n=kd(),i=V(n,!0);d(n),P(e=>{l(n,t.toast.actionButtonStyle??o()),s(n,1,e),A(i,t.toast.action.label)},[()=>x(zn(W(ve)?.actionButton,t.toast?.classes?.actionButton))]),r(`click`,n,e=>{pd(t.toast.action)&&(t.toast.action?.onClick(e),!e.defaultPrevented&&we())}),g(e,n)},u=q(()=>pd(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)}),P((e,t)=>{s(m,1,e),s(h,1,t)},[()=>x(zn(W(ve)?.content,t.toast?.classes?.content)),()=>x(zn(W(ve)?.title,t.toast?.classes?.title))]),g(e,a)};k(Re,e=>{t.toast.component?e(ze):e(Be,-1)}),d(Pe),pe(Pe,e=>G(E,e),()=>W(E)),P((e,n,r)=>{s(Pe,1,e),K(Pe,`aria-live`,t.toast.important?`assertive`:`polite`),K(Pe,`data-rich-colors`,t.toast.richColors??p()),K(Pe,`data-styled`,!(t.toast.component||t.toast.unstyled||f())),K(Pe,`data-mounted`,W(h)),K(Pe,`data-promise`,n),K(Pe,`data-swiped`,W(b)),K(Pe,`data-removed`,W(_)),K(Pe,`data-visible`,W(ne)),K(Pe,`data-y-position`,W(fe)[0]),K(Pe,`data-x-position`,W(fe)[1]),K(Pe,`data-index`,t.index),K(Pe,`data-front`,W(te)),K(Pe,`data-swiping`,W(v)),K(Pe,`data-dismissible`,W(re)),K(Pe,`data-type`,W(j)),K(Pe,`data-invert`,W(ge)),K(Pe,`data-swipe-out`,W(y)),K(Pe,`data-swipe-direction`,W(ee)),K(Pe,`data-expanded`,r),Fe=l(Pe,`${t.style} ${t.toast.style}`,Fe,{"--index":t.index,"--toasts-before":t.index,"--z-index":Hn.toasts.length-t.index,"--offset":`${W(_)?W(S):W(Ce)}px`,"--initial-height":t.expandByDefault?`auto`:`${W(w)}px`})},[()=>x(zn(t.class,W(ie),W(ve)?.toast,t.toast?.classes?.toast,W(ve)?.[W(j)],t.toast?.classes?.[W(j)])),()=>!!t.toast.promise,()=>!!(t.expanded||t.expandByDefault&&W(h))]),r(`pointermove`,Pe,je),r(`pointerup`,Pe,Ae),r(`pointerdown`,Pe,ke),de(`dragend`,Pe,Me),g(e,Pe),R()}T([`pointermove`,`pointerup`,`pointerdown`,`click`]);var Nd=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 Pd(e){g(e,Nd())}var Fd=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 Id(e){g(e,Fd())}var Ld=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 Rd(e){g(e,Ld())}var zd=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 Bd(e){g(e,zd())}var Vd=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 Hd(e){g(e,Vd())}var Ud=3,Wd=`24px`,Gd=`16px`,Kd=4e3,qd=356,Jd=14,Yd=`dark`,Xd=`light`;function Zd(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Gd:Wd;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 Qd=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(`.`)),$d=h(`<ol></ol>`),ef=h(`<section aria-live="polite" aria-relevant="additions text" aria-atomic="false" class="svelte-q7vsul"><!></section>`);function tf(e,t){a(t,!0);function n(e){return e===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?Yd:Xd:e}let r=F(t,`invert`,3,!1),i=F(t,`position`,3,`bottom-right`),o=F(t,`hotkey`,19,()=>[`altKey`,`KeyT`]),s=F(t,`expand`,3,!1),c=F(t,`closeButton`,3,!1),l=F(t,`offset`,3,Wd),f=F(t,`mobileOffset`,3,Gd),p=F(t,`theme`,3,`light`),m=F(t,`richColors`,3,!1),h=F(t,`duration`,3,Kd),v=F(t,`visibleToasts`,3,Ud),y=F(t,`toastOptions`,19,()=>({})),b=F(t,`dir`,7,`auto`),x=F(t,`gap`,3,Jd),S=F(t,`pauseWhenPageIsHidden`,3,!1),C=F(t,`containerAriaLabel`,3,`Notifications`),w=F(t,`closeButtonAriaLabel`,3,`Close toast`),T=H(t,Qd);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?(ae(()=>b(window.getComputedStyle(document.documentElement).direction??`ltr`)),b()):(ae(()=>b(e)),e)}let ee=q(()=>Array.from(new Set([i(),...Hn.toasts.filter(e=>e.position).map(e=>e.position)].filter(Boolean)))),te=J(!1),A=J(!1),ne=J(ie(n(p()))),j=J(void 0),M=J(null),re=J(!1),N=q(()=>o().join(`+`).replace(/Key/g,``).replace(/Digit/g,``));z(()=>{Hn.toasts.length<=1&&G(te,!1)}),z(()=>{let e=Hn.toasts.filter(e=>e.dismiss&&!e.delete);e.length>0&&(Hn.toasts=Hn.toasts.map(t=>e.find(e=>e.id===t.id)?{...t,delete:!0}:t))}),z(()=>()=>{W(j)&&W(M)&&(W(M).focus({preventScroll:!0}),G(M,null),G(re,!1))}),le(()=>(Hn.reset(),ke(document,`keydown`,e=>{o().every(t=>e[t]||e.code===t)&&(G(te,!0),W(j)?.focus()),e.code===`Escape`&&(document.activeElement===W(j)||W(j)?.contains(document.activeElement))&&G(te,!1)}))),z(()=>{if(p()!==`system`&&G(ne,p()),typeof window<`u`){p()===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?G(ne,Yd):G(ne,Xd));let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=({matches:e})=>{p()===`system`&&G(ne,e?Yd:Xd,!0)};`addEventListener`in e?e.addEventListener(`change`,t):e.addListener(t)}});let oe=e=>{t.onblur?.(e),W(re)&&!e.currentTarget.contains(e.relatedTarget)&&(G(re,!1),W(M)&&(W(M).focus({preventScroll:!0}),G(M,null)))},se=e=>{t.onfocus?.(e),!(e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`)&&(W(re)||(G(re,!0),G(M,e.relatedTarget,!0)))},ce=e=>{t.onpointerdown?.(e),!(e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`)&&G(A,!0)},ue=e=>{t.onmouseenter?.(e),G(te,!0)},de=e=>{t.onmouseleave?.(e),W(A)||G(te,!1)},fe=e=>{t.onmousemove?.(e),G(te,!0)},I=e=>{t.ondragend?.(e),G(te,!1)},me=e=>{t.onpointerup?.(e),G(A,!1)};Bn.set(new Un);var he=ef();K(he,`tabindex`,-1);var ge=V(he),_e=e=>{var n=U();_(L(n),18,()=>W(ee),e=>e,(e,n,i,a)=>{let o=q(()=>{let[e,t]=n.split(`-`);return{y:e,x:t}}),p=q(()=>Zd(l(),f()));var b=$d();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:oe,onfocus:se,onmouseenter:ue,onmousemove:fe,onmouseleave:de,ondragend:I,onpointerdown:ce,onpointerup:me,...T,[Ne]:{"--front-toast-height":`${Hn.heights[0]?.height}px`,"--width":`${qd}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,()=>Hn.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=L(n),i=e=>{var n=U();u(L(n),()=>t.successIcon??D),g(e,n)},a=e=>{Pd(e,{})};k(r,e=>{t.successIcon?e(i):t.successIcon!==null&&e(a,1)}),g(e,n)},l=e=>{var n=U(),r=L(n),i=e=>{var n=U();u(L(n),()=>t.errorIcon??D),g(e,n)},a=e=>{Id(e,{})};k(r,e=>{t.errorIcon?e(i):t.errorIcon!==null&&e(a,1)}),g(e,n)},d=e=>{var n=U(),r=L(n),i=e=>{var n=U();u(L(n),()=>t.warningIcon??D),g(e,n)},a=e=>{Rd(e,{})};k(r,e=>{t.warningIcon?e(i):t.warningIcon!==null&&e(a,1)}),g(e,n)},f=e=>{var n=U(),r=L(n),i=e=>{var n=U();u(L(n),()=>t.infoIcon??D),g(e,n)},a=e=>{Bd(e,{})};k(r,e=>{t.infoIcon?e(i):t.infoIcon!==null&&e(a,1)}),g(e,n)},p=e=>{var n=U(),r=L(n),i=e=>{var n=U();u(L(n),()=>t.closeIcon??D),g(e,n)},a=e=>{Hd(e,{})};k(r,e=>{t.closeIcon?e(i):t.closeIcon!==null&&e(a,1)}),g(e,n)},_=q(()=>y()?.duration??h()),b=q(()=>y()?.class??``),x=q(()=>y()?.descriptionClass||``),C=q(()=>y()?.style??``),T=q(()=>y().classes||{}),E=q(()=>y().unstyled??!1),O=q(()=>y()?.cancelButtonStyle??``),ee=q(()=>y()?.actionButtonStyle??``),ne=q(()=>y()?.closeButtonAriaLabel??w());Md(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),pe(b,e=>G(j,e),()=>W(j)),P(()=>b.dir=b.dir),g(e,b)}),g(e,n)};k(ge,e=>{Hn.toasts.length>0&&e(_e)}),d(he),P(()=>K(he,`aria-label`,`${C()??``} ${W(N)??``}`)),g(e,he),R()}function nf(){return typeof navigator>`u`?!1:navigator.platform.toLowerCase().includes(`mac`)||navigator.userAgent.includes(`Mac OS X`)}function rf(e){return e===` `?`space`:e===`Esc`?`escape`:e.toLowerCase()}function af(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 of(e){return e instanceof Element?!!e.closest(`input, textarea, select, [contenteditable="true"], .cm-editor`):!1}function sf(e,t){let n=nf(),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=rf(t.key);return rf(e.key)===s||rf(af(e.code)??``)===s}function cf(e){let t=rf(e);return t===`escape`?`Esc`:t===`enter`?`Enter`:t===`space`?`Space`:t.length===1?t.toUpperCase():e}function lf(e){let t=nf(),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(cf(e.key)),t?n.join(``):n.join(`+`)}function uf(e){let t=nf(),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(cf(e.key)),n.join(`+`)}var df=[{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 ff(e){return df.find(t=>t.id===e)}function pf(e){return ff(e)?.defaultBinding}function mf(e){let t=pf(e);return t?lf(t):void 0}function hf(e){let t=pf(e);return t?uf(t):void 0}function gf(e,t){if(!e)return``;let n=_f(e),r=``,i=t?_f(t):void 0;i&&(yf(n,i)||bf(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 _f(e){return e.replace(/\\/g,`/`).replace(/\/+$/,``)||e}function vf(e){let t=_f(e);return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function yf(e,t){return vf(e)===vf(t)}function bf(e,t){return vf(e).startsWith(`${vf(t)}/`)}function xf(e,t){if(!e||!t)return!1;let n=_f(e),r=_f(t);return yf(n,r)||bf(n,r)}function Sf(e,t){if(!e)return``;let n=_f(e),r=t?_f(t):void 0;return r&&yf(n,r)?`~`:r&&bf(n,r)?`~${n.slice(r.length)}`:n||e||`/`}function Cf(e){return vf(e)}function wf(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 Tf(e){return(/^[A-Za-z]:[\\/]/.test(e)||e.startsWith(`\\\\`))&&e.includes(`\\`)?`\\`:`/`}function Ef(e,t,n){return e.endsWith(n)?`${e}${t}`:`${e}${n}${t}`}function Df(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 Of(e,t){if(!e)return[];let n=e.trim();if(!n)return[];let r=Tf(n),i=_f(n),a=[],o,s,c=t?_f(t):void 0;if(c&&(yf(i,c)||bf(i,c)))o=t?.replace(/[\\/]+$/,``)||(t??`~`),a.push({label:`~`,path:o}),s=i.slice(c.length);else{let e=Df(n,r);e?(o=e.path,a.push({label:e.label,path:e.path}),s=i.slice(_f(e.path).length)):(o=``,s=i)}for(let e of s.split(`/`).filter(Boolean))o=o?Ef(o,e,r):e,a.push({label:e,path:o});return a}function kf(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 Af(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 jf(e,t){if(e.kind===`task`)return e.task?`${e.task.name??e.task.command} · ${e.task.status} · ${gf(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?nr(e.project.dir,t):e.kind===`pending-conversation`?nr(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 Mf(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 Nf(e){return e.kind===`file`?e.displayMode===`rendered`?`Show code`:`Show preview`:``}function Pf(e){return e.kind===`file`?e.wrapLines?`Disable line wrap`:`Wrap long lines`:``}function Ff(e,t){let n=kf(t);return e.findIndex(e=>{let t=kf(e);return t.kind===n.kind&&t.id===n.id})}function If(e,t){a(t,!0);let n=F(t,`tabs`,19,()=>[]),r=mf(`pane.refresh`),i=mf(`pane.close`),o=mf(`pane.closeOthers`),s=mf(`conversation.new`),c=hf(`conversation.new`),l=q(()=>n().map(f));function u(e){return e}function d(e){return n().find(t=>{let n=kf(t);return n.kind===e.kind&&n.id===e.id})}function f(e){let n={...kf(e),label:Af(e),title:jf(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:Mf(e)}:e.kind===`task`?(n.status={label:Mf(e)},n.selectIcon=sd):e.kind===`file`?e.renderKind?n.toggle={label:Nf(e),icon:e.displayMode===`rendered`?Sre:Xu,disabled:!t.onToggleFileDisplayMode,onClick:()=>t.onToggleFileDisplayMode?.(e.id)}:n.icon=$u:e.kind===`pr`?n.icon=ed:e.kind===`diff`?n.icon=Qu:e.kind===`settings`?n.icon=ad:e.kind===`auth`?n.icon=td:e.kind===`logs`&&(n.icon=rd),n}async function p(e,t){if(e)try{await cd(e),Jn.success(`Copied ${t}`)}catch{Jn.error(`Could not copy to clipboard`)}}function m(e){let a=d(e);if(!a)return[];let s=kf(a),c=Ff(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:Zu,disabled:!e,onSelect:()=>void p(e,`path`)},{label:`Copy Relative Path`,icon:Zu,disabled:!n,onSelect:()=>void p(n,`relative path`)},{type:`separator`},{label:Pf(a),icon:Xu,disabled:!t.onToggleFileLineWrap,onSelect:()=>t.onToggleFileLineWrap?.(a.id)})}return f.push({label:`Refresh`,icon:El,shortcut:r,disabled:!t.onRefresh,onSelect:()=>t.onRefresh?.(s)}),t.onReorder&&f.push({type:`separator`},{label:`Move Left`,icon:Xo,disabled:!l,onSelect:()=>t.onReorder(s,c-1)},{label:`Move Right`,icon:Qo,disabled:!u,onSelect:()=>t.onReorder(s,c+1)}),f.push({type:`separator`},{label:`Close Pane`,icon:Ol,shortcut:i,onSelect:()=>t.onClose?.(s)},{label:`Close Other Panes`,icon:Ol,shortcut:o,disabled:n().length<=1||!t.onCloseOther,onSelect:()=>t.onCloseOther?.(s)},{label:`Close Panes on Right`,icon:Ol,disabled:!u||!t.onCloseRight,onSelect:()=>t.onCloseRight?.(s)},{label:`Close Panes on Left`,icon:Ol,disabled:!l||!t.onCloseLeft,onSelect:()=>t.onCloseLeft?.(s)}),f}Il(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)}),R()}function Lf(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 Rf(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 zf(e){let t=new Map;for(let n of e.projects){let e=ur(n);t.set(e,[...t.get(e)??[],n])}let n=new Map;for(let e of t.values()){let t=ir(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(er).sort((e,t)=>t.localeCompare(e))[0],l=ir(i.dir);return{key:t,project:i,projectIds:a,label:(n.get(l)??0)>1?nr(i.dir,e.homeDir):l,sortAt:c&&c>i.updatedAt?c:i.updatedAt,activity:Lf(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 Bf(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 Vf(e){return e===`planning`?`good`:`running`}function Hf(e,t=!1,n){return e===`awaiting_user`?`warn`:e===`running`||t?Vf(n):`neutral`}function Uf(e,t=!1){return e===`awaiting_user`?!1:e===`running`||t}function Wf(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 Gf(e){return e===`running`||e===`ready`||e===`starting`||e===`stopping`||e===`recovered`}function Kf(e){return e===`error`?`danger`:e===`warn`?`warn`:`neutral`}var qf=new Set([`.md`,`.markdown`,`.mdown`,`.mkd`]),Jf=new Set([`.mmd`,`.mermaid`]);function Yf(e){if(!e)return;let t=e.split(/[?#]/,1)[0]?.toLowerCase()??``,n=t.lastIndexOf(`.`);if(n===-1)return;let r=t.slice(n);if(qf.has(r))return`markdown`;if(Jf.has(r))return`mermaid`}function Xf(e){return Yf(e)?`rendered`:`raw`}var Zf={tone:`neutral`,pulse:!1,busy:!1,needsUser:!1,source:`none`};function Qf(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:Vf(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`}:Zf}function $f(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]=Qf({conversationId:a.id,agent:o,mode:o?.mode??a.mode,view:e.views[Qr(a.id)],hasPendingHumanInput:r.has(a.id)})}return i}var Q=ie({projectId:void 0,conversationId:void 0,agentId:void 0,entryId:void 0});ie({items:[]});var ep=ie({text:``,projectDir:``});function tp(){Q.projectId=void 0,Q.conversationId=void 0,Q.agentId=void 0,Q.entryId=void 0}function np(e,t){return Z.activeCenterTab?.kind===e&&Z.activeCenterTab.id===t}function rp(){let e=Z.activeCenterTab;if(e?.kind===`pending-conversation`)return X.pendingConversations[ti(e.id)]}function ip(e){return[`starting`,`running`,`ready`,`stopping`].includes(e)}var ap=q(()=>$f({conversations:Z.conversations,agents:Z.agents,views:X.conversationViews,approvals:Z.approvals,userQuestions:Z.userQuestions,planReviews:Z.planReviews}));function op(e){return`${e.kind}\0${e.id}`}var sp={get status(){return Z.status},get connection(){return Z.connection},get error(){let e=Q.conversationId??X.activeConversationTabId,t=e?X.conversationViews[Qr(e)]:void 0;return rp()?.error??t?.error??Z.error},get projects(){return Z.projects},get conversations(){return Z.conversations},get agents(){return Z.agents},get approvals(){return Z.approvals},get userQuestions(){return Z.userQuestions},get planReviews(){return Z.planReviews},get activeProject(){return Z.projects.find(e=>e.id===Z.selectedProjectId)??Z.projects.find(e=>ur(e)===Z.selectedProjectKey)},get selectedProjectIds(){let e=Z.selectedProjectKey;return Z.projects.filter(t=>e&&ur(t)===e).map(e=>e.id)},get selectedProjectConversations(){let e=new be(this.selectedProjectIds);return Z.conversations.filter(t=>e.has(t.projectId))},get projectSwitcherItems(){return zf({projects:Z.projects,conversations:Z.conversations,activityById:this.conversationActivityById,homeDir:Z.status?.storage.userHome,recency:Z.projectRecency})},get activeConversation(){return Z.conversations.find(e=>e.id===Q.conversationId)},get activeAgent(){return Z.agents.find(e=>e.id===Q.agentId)},get conversationActivityById(){return W(ap)},get openConversationTabs(){let e=[],t=Object.fromEntries(Z.conversations.map(e=>[e.id,e])),n=Object.fromEntries(Z.projects.map(e=>[e.id,e])),r=Object.fromEntries(Z.agents.map(e=>[e.id,e])),i=Object.create(null);for(let e of Z.agents)e.conversationId&&!i[e.conversationId]&&(i[e.conversationId]=e);let a=W(ap);for(let o of X.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=X.conversationViews[Qr(s.id)],d=a[s.id]??Zf;e.push({kind:`conversation`,id:s.id,conversation:s,project:c,agent:l,active:np(`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 Z.openCenterTabs){if(t.kind!==`pending-conversation`)continue;let n=X.pendingConversations[ti(t.id)];n&&e.push({kind:`pending-conversation`,id:n.id,title:n.title,project:Z.projects.find(e=>e.id===n.projectId),projectDir:n.projectDir,active:np(`pending-conversation`,n.id),hasDraft:!!n.composerText.trim(),sending:n.sending,activity:n.sending?{tone:Vf(n.mode),pulse:!0,label:`Agent running`,busy:!0,needsUser:!1,source:`live-view`}:Zf,error:n.error})}return e},get openTaskTabs(){let e=[];for(let t of lr.openTaskTabIds){let n=lr.selectedRunByEntry[t],r=lr.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:np(`task`,t),sending:i?ip(i.status):!1,error:i?i.status===`failed`?i.error??`Task failed`:void 0:`Task not found`})}return e},get openFileTabs(){return ni.openFileTabIds.map(e=>{let t=ni.fileViews[Zr(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??Xf(n),wrapLines:!!t?.wrapLines,renderKind:Yf(n),active:np(`file`,e),sending:!!t?.loading,error:t?.error}})},get openDiffTabs(){return rr.openDiffTabIds.map(e=>{let t=rr.diffViews[ei(e)];return{kind:`diff`,id:e,path:t?.path,repo:t?.repo,area:t?.area,active:np(`diff`,e),sending:!!(t?.loading||t?.refreshing),error:t?.error}})},get openPrTabs(){return rr.openPrTabIds.map(e=>{let t=rr.prViews[Xr(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:np(`pr`,e),sending:!!(t?.core.loading||t?.core.refreshing),error:t?.core.error}})},get openSettingsTabs(){return ar.settingsTabOpen?[{kind:`settings`,id:`settings`,active:np(`settings`,`settings`),sending:ar.settingsSaveStatus===`saving`,error:ar.settingsSaveStatus===`error`?ar.settingsMessage:void 0}]:[]},get openAuthTabs(){return or.authTabOpen?[{kind:`auth`,id:`auth`,active:np(`auth`,`auth`),sending:!1}]:[]},get openLogsTabs(){return sr.logsTabOpen?[{kind:`logs`,id:`logs`,active:np(`logs`,`logs`),sending:!1}]:[]},get openConversationTabIds(){let e=new be;for(let t of Z.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[op(t)]=t;return Z.openCenterTabs.flatMap(t=>{let n=e[op(t)];return n?[n]:[]})},get activeCenterTab(){return Z.activeCenterTab}};function cp(){X.openConversationTabIds=Z.openCenterTabs.filter(e=>e.kind===`conversation`).map(e=>e.id),lr.openTaskTabIds=Z.openCenterTabs.filter(e=>e.kind===`task`).map(e=>e.id),ni.openFileTabIds=Z.openCenterTabs.filter(e=>e.kind===`file`).map(e=>e.id),rr.openPrTabIds=Z.openCenterTabs.filter(e=>e.kind===`pr`).map(e=>e.id),rr.openDiffTabIds=Z.openCenterTabs.filter(e=>e.kind===`diff`).map(e=>e.id),ar.settingsTabOpen=Z.openCenterTabs.some(e=>e.kind===`settings`),or.authTabOpen=Z.openCenterTabs.some(e=>e.kind===`auth`),sr.logsTabOpen=Z.openCenterTabs.some(e=>e.kind===`logs`)}function lp(e){return`${e.kind}:${e.id}`}function up(e,t,n){let r=lp(t),i=e.findIndex(e=>lp(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 dp(e,t,n){let r=new Set(n.map(lp)),i=e.filter(e=>!r.has(lp(e)));for(let e of t){let t=i.find(t=>lp(t)===e);if(t)return t}return i[0]}var fp=`nerve.workspaceTabs.v2`,pp=`nerve.conversationTabs.v1`,mp=24,hp=30,gp=new Set([`settings`,`auth`,`logs`]),_p=!1,vp=lp;function yp(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function bp(e){return gp.has(e.kind)}function xp(e){let t=new Set;return e.filter(e=>{let n=vp(e);return t.has(n)?!1:(t.add(n),!0)}).slice(0,hp)}function Sp(e){let t=xp(e.tabs),n=new Set(t.map(vp)),r=[...new Set(e.mru)].filter(e=>n.has(e));for(let e of t)r.includes(vp(e))||r.push(vp(e));return{tabs:t,active:e.active&&n.has(vp(e.active))?e.active:t[0],mru:r}}function Cp(){let e=Z.selectedProjectKey;e&&(Z.projectTabSessions[e]=Sp({tabs:[...Z.openCenterTabs],active:Z.activeCenterTab,mru:[...Z.centerTabMru]}),Lp())}function wp(e){let t=Sp(Z.projectTabSessions[e]??{tabs:[],mru:[]}),n=new Set(t.tabs.map(vp));for(let e of Z.globalCenterTabs)n.has(vp(e))||t.tabs.push(e);return Sp(t)}function Tp(e,t={}){let n=wp(e);return Z.selectedProjectKey=e,Z.openCenterTabs=[...n.tabs],Z.activeCenterTab=t.deferActivation?void 0:n.active,Z.centerTabMru=[...n.mru],Z.projectTabSessions[e]=n,cp(),n}function Ep(e){let t=vp(e);Z.centerTabMru=[t,...Z.centerTabMru.filter(e=>e!==t)],bp(e)&&!Z.globalCenterTabs.some(t=>yp(t,e))&&(Z.globalCenterTabs=[...Z.globalCenterTabs,e]),Z.selectedProjectKey?Cp():Lp()}function Dp(){let e=new Set(Z.openCenterTabs.map(vp));Z.centerTabMru=Z.centerTabMru.filter(t=>e.has(t)),Cp()}function Op(e){Z.globalCenterTabs=Z.globalCenterTabs.filter(t=>!yp(t,e));for(let[t,n]of Object.entries(Z.projectTabSessions))Z.projectTabSessions[t]=Sp({tabs:n.tabs.filter(t=>!yp(t,e)),active:yp(n.active,e)?void 0:n.active,mru:n.mru.filter(t=>t!==vp(e))});Lp()}function kp(e){return dp(Z.openCenterTabs,Z.centerTabMru,Array.isArray(e)?e:[e])}function Ap(e,t){Z.openCenterTabs=up(Z.openCenterTabs,e,t),Cp()}function jp(e){for(let[t,n]of Object.entries(Z.projectTabSessions)){let r=n.tabs.filter(t=>!e(t)),i=new Set(r.map(vp));Z.projectTabSessions[t]=Sp({tabs:r,active:n.active&&i.has(vp(n.active))?n.active:void 0,mru:n.mru.filter(e=>i.has(e))})}Z.openCenterTabs=Z.openCenterTabs.filter(t=>!e(t)),Dp()}function Mp(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 Np(e){if(!e||typeof e!=`object`)return;let t=e,n=Array.isArray(t.tabs)?t.tabs.filter(Mp):[],r=[];for(let e of n){if(e.kind===`file`){if(!e.projectId||!e.path)continue;ni.fileViews[Zr(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;rr.prViews[Xr(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;rr.diffViews[ei(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 Sp({tabs:r,active:Mp(t.active)?t.active:void 0,mru:Array.isArray(t.mru)?t.mru.filter(e=>typeof e==`string`):[]})}function Pp(){if(!(typeof localStorage>`u`))try{return JSON.parse(localStorage.getItem(fp)??`null`)}catch{return}}function Fp(e,t){if(typeof localStorage>`u`)return{};try{let n=JSON.parse(localStorage.getItem(pp)??`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=ur(o);i[s]??={tabs:[],mru:[]};let c={kind:`conversation`,id:a};i[s].tabs.push(c),i[s].mru.push(vp(c)),n?.activeId===a&&(i[s].active=c)}return i}catch{return{}}}function Ip(e,t={}){if(_p)return;_p=!0;let n=new Set(e.projects.map(ur)),r=new Set(e.conversations.map(e=>e.id)),i=new Set(e.tasks.map(e=>e.definitionId??e.restartRootTaskId??e.id)),a=Pp(),o=a?.sessions??Fp(e.projects,e.conversations),s={};for(let[e,t]of Object.entries(o).slice(0,mp)){if(!n.has(e))continue;let a=Np(t);a&&(a.tabs=a.tabs.filter(e=>e.kind===`pending-conversation`?!1:e.kind===`file`?!!ni.fileViews[Zr(e.id)]:e.kind===`pr`?!!rr.prViews[Xr(e.id)]:e.kind===`diff`?!!rr.diffViews[ei(e.id)]:e.kind===`conversation`?r.has(e.id):e.kind===`task`?i.has(e.id):!0),s[e]=Sp(a))}Z.projectTabSessions=s,Z.globalCenterTabs=(a?.globals??[]).filter(Mp).filter(bp);let c;return a?.selectedProjectKey||(Z.openCenterTabs=[...Z.globalCenterTabs],c=Z.globalCenterTabs[0],Z.activeCenterTab=t.deferActivation?void 0:c,Z.centerTabMru=Z.globalCenterTabs.map(vp),cp()),Z.projectRecency=a?.projectRecency??{},Z.selectedProjectKey=a?.selectedProjectKey&&n.has(a.selectedProjectKey)?a.selectedProjectKey:void 0,typeof localStorage<`u`&&!a&&localStorage.removeItem(pp),c}function Lp(){if(typeof localStorage>`u`)return;let e=Object.fromEntries(Object.entries(Z.projectTabSessions).slice(0,mp).map(([e,t])=>{let n=t.tabs.flatMap(e=>{if(e.kind===`pending-conversation`)return[];if(e.kind===`file`){let t=ni.fileViews[Zr(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=rr.prViews[Xr(e.id)];return t?[{...e,projectId:t.projectId,repo:t.repo,number:t.number}]:[]}if(e.kind===`diff`){let t=rr.diffViews[ei(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(vp));return[e,{tabs:n,active:t.active&&r.has(vp(t.active))?t.active:void 0,mru:t.mru.filter(e=>r.has(e))}]})),t={selectedProjectKey:Z.selectedProjectKey,projectRecency:Z.projectRecency,sessions:e,globals:Z.globalCenterTabs};localStorage.setItem(fp,JSON.stringify(t))}function Rp(e){return`${e.kind}:${e.id}`}function zp(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}var Bp,Vp;function Hp(e){Bp=e.select,Vp=e.close}function Up(e,t){return e?.[t.kind]}function Wp(e,t){let n=t instanceof Error?t.message:String(t);Z.error=n,Jn.error(`Could not ${e} pane`,{description:n})}function Gp(e){let t=new be;Z.openCenterTabs=e.filter(e=>{let n=Rp(e);return t.has(n)?!1:(t.add(n),!0)}),cp(),Dp()}function Kp(e){Z.openCenterTabs.some(t=>zp(t,e))||(Z.openCenterTabs=[...Z.openCenterTabs,e],cp())}function qp(e,t){Gp(Z.openCenterTabs.map(n=>zp(n,e)?t:n)),zp(Z.activeCenterTab,e)&&Zp(t)}function Jp(e){return kp(e)}function Yp(e){bp(e)&&Op(e),Gp(Z.openCenterTabs.filter(t=>!zp(t,e)))}function Xp(e,t){Ap(e,t),cp()}function Zp(e){e&&Kp(e),Z.activeCenterTab=e,e?Ep(e):Dp()}function Qp(e){return Z.openCenterTabs.find(t=>!e||!zp(t,e))}async function $p(e){if(!e){Zp(void 0);return}try{let t=Up(Bp,e);if(!t)throw Error(`No select handler for ${e.kind} panes`);await t(e)}catch(e){Wp(`switch`,e)}}async function em(e){try{let t=Up(Vp,e);if(!t)throw Error(`No close handler for ${e.kind} panes`);await t(e)}catch(e){Wp(`close`,e)}}function tm(){Zp(Qp())}var nm=new Set([`$$slots`,`$$events`,`$$legacy`]);function rm(e,t){let n=H(t,nm),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`}]];N(e,B({name:`file`},()=>n,{get iconNode(){return r}}))}var im=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=lm(e.state,n.from);return r.line?om(e):r.block?cm(e):!1};function am(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 om=am(mm,0),sm=am(pm,0),cm=am((e,t)=>pm(e,t,fm(t)),0);function lm(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var um=50;function dm(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-um,r),o=e.sliceDoc(i,i+um),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*um?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+um),d=e.sliceDoc(i-um,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 fm(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 pm(e,t,n=t.selection.ranges){let r=n.map(e=>lm(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>dm(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 mm(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=lm(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 hm=Ai.define(),gm=Ai.define(),_m=Di.define(),vm=Di.define({combine(e){return Ii(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)})}}),ym=wi.define({create(){return Rm.empty},update(e,t){let n=t.state.facet(vm),r=t.annotation(hm);if(r){let i=Em.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Dm(o,o.length,n.minDepth,i):Nm(o,t.startState.selection),new Rm(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(gm);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Pi.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Em.fromTransaction(t),o=t.annotation(Pi.time),s=t.annotation(Pi.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 Rm(e.done.map(Em.fromJSON),e.undone.map(Em.fromJSON))}});function bm(e={}){return[ym,vm.of(e),vi.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Sm:e.inputType==`historyRedo`?Cm:null;return n?(e.preventDefault(),n(t)):!1}})]}function xm(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(ym,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Sm=xm(0,!1),Cm=xm(1,!1),wm=xm(0,!0),Tm=xm(1,!0),Em=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&&xi.fromJSON(t.changes),[],t.mapped&&Ei.fromJSON(t.mapped),t.startSelection&&ji.fromJSON(t.startSelection),t.selectionsAfter.map(ji.fromJSON))}static fromTransaction(t,n){let r=jm;for(let e of t.startState.facet(_m)){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,jm)}static selection(t){return new e(void 0,jm,void 0,void 0,t)}};function Dm(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 Om(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 km(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Am(e,t){return e.length?t.length?e.concat(t):e:t}var jm=[],Mm=200;function Nm(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Mm));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Dm(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Em.selection([t])]}function Pm(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=jm;for(;n;){let i=Im(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?[Em.selection(r)]:jm}function Im(e,t,n){let r=Am(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):jm,n);if(!e.changes)return Em.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Em(i,Ti.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Lm=/^(input\.type|delete)($|\.)/,Rm=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||Lm.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Om(s.changes,t.changes))||r==`input.type.compose`)?Dm(o,o.length-1,i.minDepth,new Em(t.changes.compose(s.changes),Am(Ti.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,jm)):Dm(o,o.length,i.minDepth,t),new e(o,jm,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:jm;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&km(a[a.length-1],t)?this:new e(Nm(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:hm.of({side:e,rest:Pm(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?jm: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:hm.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};Rm.empty=new Rm(jm,jm);var zm=[{key:`Mod-z`,run:Sm,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Cm,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Cm,preventDefault:!0},{key:`Mod-u`,run:wm,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Tm,preventDefault:!0}];function Bm(e,t){return ji.create(e.ranges.map(t),e.mainIndex)}function Vm(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function Hm({state:e,dispatch:t},n){let r=Bm(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Vm(e,r)),!0)}function Um(e,t){return ji.cursor(t?e.to:e.from)}function Wm(e,t){return Hm(e,n=>n.empty?e.moveByChar(n,t):Um(n,t))}function Gm(e){return e.textDirectionAt(e.state.selection.main.head)==_i.LTR}var Km=e=>Wm(e,!Gm(e)),qm=e=>Wm(e,Gm(e));function Jm(e,t){return Hm(e,n=>n.empty?e.moveByGroup(n,t):Um(n,t))}var Ym=e=>Jm(e,!Gm(e)),Xm=e=>Jm(e,Gm(e));typeof Intl<`u`&&Intl.Segmenter;function Zm(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 Qm(e,t,n){let r=fi(e).resolveInner(t.head),i=n?li.closedBy:li.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Zm(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?gi(e,r.from,1):gi(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,ji.cursor(s,n?-1:1)}var $m=e=>Hm(e,t=>Qm(e.state,t,!Gm(e))),eh=e=>Hm(e,t=>Qm(e.state,t,Gm(e)));function th(e,t){return Hm(e,n=>{if(!n.empty)return Um(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var nh=e=>th(e,!1),rh=e=>th(e,!0);function ih(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(vi.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 ah(e,t){let n=ih(e),{state:r}=e,i=Bm(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Um(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=vi.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(Vm(r,i),{effects:a}),!0}var oh=e=>ah(e,!1),sh=e=>ah(e,!0);function ch(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=ji.cursor(r.from+n))}return i}var lh=e=>Hm(e,t=>ch(e,t,!0)),uh=e=>Hm(e,t=>ch(e,t,!1)),dh=e=>Hm(e,t=>ch(e,t,!Gm(e))),fh=e=>Hm(e,t=>ch(e,t,Gm(e))),ph=e=>Hm(e,t=>ji.cursor(e.lineBlockAt(t.head).from,1)),mh=e=>Hm(e,t=>ji.cursor(e.lineBlockAt(t.head).to,-1));function hh(e,t,n){let r=!1,i=Bm(e.selection,t=>{let i=gi(e,t.head,-1)||gi(e,t.head,1)||t.head>0&&gi(e,t.head-1,1)||t.head<e.doc.length&&gi(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?ji.range(t.anchor,a):ji.cursor(a)});return r?(t(Vm(e,i)),!0):!1}var gh=({state:e,dispatch:t})=>hh(e,t,!1);function _h(e,t){let n=Bm(e.state.selection,e=>{let n=t(e);return ji.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 vh(e,t){return _h(e,n=>e.moveByChar(n,t))}var yh=e=>vh(e,!Gm(e)),bh=e=>vh(e,Gm(e));function xh(e,t){return _h(e,n=>e.moveByGroup(n,t))}var Sh=e=>xh(e,!Gm(e)),Ch=e=>xh(e,Gm(e)),wh=e=>_h(e,t=>Qm(e.state,t,!Gm(e))),Th=e=>_h(e,t=>Qm(e.state,t,Gm(e)));function Eh(e,t){return _h(e,n=>e.moveVertically(n,t))}var Dh=e=>Eh(e,!1),Oh=e=>Eh(e,!0);function kh(e,t){return _h(e,n=>e.moveVertically(n,t,ih(e).height))}var Ah=e=>kh(e,!1),jh=e=>kh(e,!0),Mh=e=>_h(e,t=>ch(e,t,!0)),Nh=e=>_h(e,t=>ch(e,t,!1)),Ph=e=>_h(e,t=>ch(e,t,!Gm(e))),Fh=e=>_h(e,t=>ch(e,t,Gm(e))),Ih=e=>_h(e,t=>ji.cursor(e.lineBlockAt(t.head).from)),Lh=e=>_h(e,t=>ji.cursor(e.lineBlockAt(t.head).to)),Rh=({state:e,dispatch:t})=>(t(Vm(e,{anchor:0})),!0),zh=({state:e,dispatch:t})=>(t(Vm(e,{anchor:e.doc.length})),!0),Bh=({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),Hh=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Uh=({state:e,dispatch:t})=>{let n=cg(e).map(({from:t,to:n})=>ji.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:ji.create(n),userEvent:`select`})),!0},Wh=({state:e,dispatch:t})=>{let n=Bm(e.selection,t=>{let n=fi(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 ji.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(Vm(e,n)),!0)};function Gh(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,ji.create(i,i.length-1))),!0)}var Kh=e=>Gh(e,!1),qh=e=>Gh(e,!0),Jh=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=ji.create([n.main]):n.main.empty||(r=ji.create([ji.cursor(n.main.head)])),r?(t(Vm(e,r)),!0):!1};function Yh(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=Xh(e,o,!1)):o>i&&(n=`delete.forward`,o=Xh(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Xh(e,i,!1),a=Xh(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:ji.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`?vi.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Xh(e,t,n){if(e instanceof vi)for(let r of e.state.facet(vi.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Zh=(e,t,n)=>Yh(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=hi(s,a.tabSize)%yi(a)||yi(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=ci(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=ci(o.text,c-o.from,!1,!1)+o.from);return c}),Qh=e=>Zh(e,!1,!0),$h=e=>Zh(e,!0,!1),eg=(e,t)=>Yh(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=ci(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}),tg=e=>eg(e,!1),ng=e=>eg(e,!0),rg=e=>Yh(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ig=e=>Yh(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),ag=e=>Yh(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),og=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:bi.of([``,``])},range:ji.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},sg=({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:ci(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:ci(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:ji.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function cg(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 lg(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of cg(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(ji.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(ji.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:ji.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var ug=({state:e,dispatch:t})=>lg(e,t,!1),dg=({state:e,dispatch:t})=>lg(e,t,!0);function fg(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of cg(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 pg=({state:e,dispatch:t})=>fg(e,t,!1),mg=({state:e,dispatch:t})=>fg(e,t,!0),hg=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(cg(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Bm(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 gg(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=fi(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(li.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 _g=yg(!1),vg=yg(!0);function yg(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&&gg(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Oi(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Ni(s,r);for(c??=hi(/^\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=[``,Fi(t,c)];return o&&l.push(Fi(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:bi.of(l)},range:ji.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function bg(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:ji.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var xg=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Oi(e,{overrideIndentation:e=>n[e]??-1}),i=bg(e,(t,i,a)=>{let o=Ni(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=Fi(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},Sg=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(bg(e,(t,n)=>{n.push({from:t.from,insert:e.facet(mi)})}),{userEvent:`input.indent`})),!0),Cg=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(bg(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=hi(r,e.tabSize),a=0,o=Fi(e,Math.max(0,i-yi(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),wg=e=>(e.setTabFocusMode(),!0),Tg=[{key:`Ctrl-b`,run:Km,shift:yh,preventDefault:!0},{key:`Ctrl-f`,run:qm,shift:bh},{key:`Ctrl-p`,run:nh,shift:Dh},{key:`Ctrl-n`,run:rh,shift:Oh},{key:`Ctrl-a`,run:ph,shift:Ih},{key:`Ctrl-e`,run:mh,shift:Lh},{key:`Ctrl-d`,run:$h},{key:`Ctrl-h`,run:Qh},{key:`Ctrl-k`,run:rg},{key:`Ctrl-Alt-h`,run:tg},{key:`Ctrl-o`,run:og},{key:`Ctrl-t`,run:sg},{key:`Ctrl-v`,run:sh}],Eg=[{key:`ArrowLeft`,run:Km,shift:yh,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ym,shift:Sh,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:dh,shift:Ph,preventDefault:!0},{key:`ArrowRight`,run:qm,shift:bh,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Xm,shift:Ch,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:fh,shift:Fh,preventDefault:!0},{key:`ArrowUp`,run:nh,shift:Dh,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Rh,shift:Bh},{mac:`Ctrl-ArrowUp`,run:oh,shift:Ah},{key:`ArrowDown`,run:rh,shift:Oh,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:zh,shift:Vh},{mac:`Ctrl-ArrowDown`,run:sh,shift:jh},{key:`PageUp`,run:oh,shift:Ah},{key:`PageDown`,run:sh,shift:jh},{key:`Home`,run:uh,shift:Nh,preventDefault:!0},{key:`Mod-Home`,run:Rh,shift:Bh},{key:`End`,run:lh,shift:Mh,preventDefault:!0},{key:`Mod-End`,run:zh,shift:Vh},{key:`Enter`,run:_g,shift:_g},{key:`Mod-a`,run:Hh},{key:`Backspace`,run:Qh,shift:Qh,preventDefault:!0},{key:`Delete`,run:$h,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:tg,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ng,preventDefault:!0},{mac:`Mod-Backspace`,run:ig,preventDefault:!0},{mac:`Mod-Delete`,run:ag,preventDefault:!0}].concat(Tg.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Dg=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:$m,shift:wh},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:eh,shift:Th},{key:`Alt-ArrowUp`,run:ug},{key:`Shift-Alt-ArrowUp`,run:pg},{key:`Alt-ArrowDown`,run:dg},{key:`Shift-Alt-ArrowDown`,run:mg},{key:`Mod-Alt-ArrowUp`,run:Kh},{key:`Mod-Alt-ArrowDown`,run:qh},{key:`Escape`,run:Jh},{key:`Mod-Enter`,run:vg},{key:`Alt-l`,mac:`Ctrl-l`,run:Uh},{key:`Mod-i`,run:Wh,preventDefault:!0},{key:`Mod-[`,run:Cg},{key:`Mod-]`,run:Sg},{key:`Mod-Alt-\\`,run:xg},{key:`Shift-Mod-k`,run:hg},{key:`Shift-Mod-\\`,run:gh},{key:`Mod-/`,run:im},{key:`Alt-A`,run:sm},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:wg}].concat(Eg),Og={key:`Tab`,run:Sg,shift:Cg},kg=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>`),Ag=h(`<div role="group"><div></div> <!></div>`);function jg(e,t){a(t,!0);let n={name:`Commands`,rank:0},r={name:`Project references`,rank:10},i=F(t,`placeholder`,3,`Ask the Nerve agent`),o=F(t,`ariaLabel`,3,`Prompt editor drop area`),c=F(t,`disabled`,3,!1),l=F(t,`focusToken`,3,0),u=F(t,`slashCompletions`,19,()=>[]),f,p,m=J(``),h=0,_=0,v=J(!1),y=new ki,b=new ki,x=new ki,S=q(()=>u().length>0||!!t.fileCompletions);function C(e){return[Si.readOnly.of(e),vi.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 ie(e){let t=[],n=ui.line({class:`cm-executable-command-block-line`}),r=ui.mark({class:`cm-executable-command-block-command`});for(let i of Ar(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 ui.set(t.sort((e,t)=>e.from-t.from||e.to-t.to),!0)}let N=di.fromClass(class{lastOptions;update(e){if(Li(e.state)!==`active`){this.lastOptions=void 0;return}let t=Ri(e.state);!t.some(e=>{let t=e.nerveKind;return t===`file`||t===`directory`})||t===this.lastOptions||(this.lastOptions=t,queueMicrotask(()=>{if(!p||Li(p.state)!==`active`||Ri(p.state)!==t)return;let e=t.length-1;e<0||Ree(p.state)===e||p.dispatch({effects:Vee(e)})}))}}),ae=di.fromClass(class{decorations;constructor(e){this.decorations=ie(e.state)}update(e){e.docChanged&&(this.decorations=ie(e.state))}},{decorations:e=>e.decorations});function oe(){return W(S)?Bee({override:[re],icons:!1,aboveCursor:!0,maxRenderedOptions:8,tooltipClass:()=>`nerve-composer-completions`,optionClass:ee,addToOptions:[{render:M,position:20}]}):[]}function se(){return c()?!1:(t.onSubmit?.(),!0)}function ce(e){return Li(e.state)===`active`?!1:se()}function ue(e){return Li(e.state)===`active`?zee(e):!1}function fe(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 me(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)?` `:``;fe(`${s}${e.join(` `)}${c}`,r,i)}function L(e){return e?Array.from(e.items).some(e=>e.kind===`file`)||Array.from(e.types).includes(`Files`):!1}function he(e){return!!(!c()&&t.onDropFiles&&L(e.dataTransfer))}function ge(e){he(e)&&(e.preventDefault(),e.stopPropagation(),_+=1,G(v,!0))}function _e(e){he(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))}function ve(e){W(v)&&(e.preventDefault(),e.stopPropagation(),_=Math.max(0,_-1),_===0&&G(v,!1))}function ye(e){if(!he(e)||!t.onDropFiles||!p)return;e.preventDefault(),e.stopPropagation(),_=0,G(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=>me(e,{from:r,to:i})).catch(e=>{console.error(`Failed to resolve dropped file paths`,e)})}function be(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=>fe(e.join(`
14
- `))).catch(e=>{console.error(`Failed to paste clipboard image`,e)}),!0):!1}le(()=>{G(m,t.value,!0),p=new vi({parent:f,state:Si.create({doc:t.value,extensions:[bm(),Hee(),x.of(Mi(i())),y.of(C(c())),b.of(oe()),ae,N,Ci.highest(pi.of([{key:`Enter`,run:ce},{key:`Tab`,run:ue},{key:`Escape`,run:Lee},{key:`Mod-Enter`,run:se},{key:`Ctrl-Enter`,run:se},Og])),pi.of([...Dg,...zm]),vi.lineWrapping,vi.domEventHandlers({paste:be}),vi.updateListener.of(e=>{e.docChanged&&(G(m,e.state.doc.toString(),!0),t.onChange?.(W(m)))}),vi.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)`}})]})})}),z(()=>{p&&(p.dispatch({effects:y.reconfigure(C(c()))}),c()&&(_=0,G(v,!1)))}),z(()=>{p&&(u(),t.fileCompletions,p.dispatch({effects:b.reconfigure(oe())}))}),z(()=>{p&&p.dispatch({effects:x.reconfigure(Mi(i()))})}),z(()=>{!p||c()||l()===h||(h=l(),p.focus())}),z(()=>{!p||t.value===W(m)||(p.dispatch({changes:{from:0,to:p.state.doc.length,insert:t.value}}),G(m,t.value,!0))}),Ae(()=>p?.destroy());var B=Ag();let xe;var Se=V(B);pe(Se,e=>f=e,()=>f);var Ce=I(Se,2),we=e=>{var t=kg();rm(V(t),{class:`size-4 text-primary`}),w(2),d(t),g(e,t)};k(Ce,e=>{W(v)&&e(we)}),d(B),P(()=>{xe=s(B,1,`composer-editor relative svelte-18og541`,null,xe,{disabled:c()}),K(B,`aria-label`,o())}),de(`dragenter`,B,ge,!0),de(`dragover`,B,_e,!0),de(`dragleave`,B,ve,!0),de(`drop`,B,ye,!0),g(e,B),R()}var Mg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ng(e,t){let n=H(t,Mg),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`}]];N(e,B({name:`send`},()=>n,{get iconNode(){return r}}))}var Pg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fg(e,t){let n=H(t,Pg),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];N(e,B({name:`square`},()=>n,{get iconNode(){return r}}))}var Ig=h(`<form class="composer svelte-dbq0fc"><!> <div class="composer-surface svelte-dbq0fc"><div class="editor-shell svelte-dbq0fc"><!> <!> <div class="composer-send svelte-dbq0fc"><!> <!> <!></div></div></div></form>`);function Lg(e,t){a(t,!0);let n=F(t,`commandMode`,3,!1),r=F(t,`executableBlocks`,3,!1),i=F(t,`pendingApproval`,3,!1),o=F(t,`pendingQuestion`,3,!1),s=F(t,`pendingPlan`,3,!1),c=F(t,`showStop`,3,!1),l=F(t,`stopping`,3,!1),f=F(t,`stopDisabled`,3,!1),p=F(t,`stopAriaLabel`,3,`Stop generation`),m=F(t,`stopTitle`,3,`Stop generation`);var h=Ig(),_=V(h),v=e=>{var n=U();u(L(n),()=>t.header),g(e,n)};k(_,e=>{t.header&&e(v)});var y=I(_,2),b=V(y),x=V(b);u(x,()=>t.toolbar);var S=I(x,2);u(S,()=>t.editor);var C=I(S,2),w=V(C),T=e=>{var n=U();u(L(n),()=>t.sendLeading),g(e,n)};k(w,e=>{t.sendLeading&&e(T)});var E=I(w,2),D=e=>{{let n=q(()=>f()||l()),r=q(()=>l()?`Stopping generation`:p()),i=q(()=>l()?`Stopping generation`:m());Oe(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=L(n),i=e=>{zi(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)}),Oe(I(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)=>{Ng(e,{size:14,strokeWidth:2.4})},$$slots:{default:!0}}),d(C),d(b),d(y),d(h),P(()=>{K(h,`data-pending-approval`,i()?`true`:void 0),K(h,`data-pending-question`,o()?`true`:void 0),K(h,`data-pending-plan`,s()?`true`:void 0),K(y,`data-mode`,t.mode),K(y,`data-command-mode`,n()?`true`:void 0),K(y,`data-executable-blocks`,r()?`true`:void 0)}),de(`submit`,h,e=>{e.preventDefault(),t.onSubmit()}),g(e,h),R()}var Rg=new Set([`$$slots`,`$$events`,`$$legacy`]);function zg(e,t){let n=H(t,Rg),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`}]];N(e,B({name:`clipboard-list`},()=>n,{get iconNode(){return r}}))}var Bg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vg(e,t){let n=H(t,Bg),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];N(e,B({name:`lock`},()=>n,{get iconNode(){return r}}))}var Hg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ug(e,t){let n=H(t,Hg),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`}]];N(e,B({name:`shield`},()=>n,{get iconNode(){return r}}))}var Wg=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gg(e,t){let n=H(t,Wg),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`}]];N(e,B({name:`zap`},()=>n,{get iconNode(){return r}}))}var Kg=h(`<!> <!>`,1);function qg(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`class`,3,``),i=F(t,`triggerClass`,3,``),o=F(t,`size`,3,`xl`),s=F(t,`side`,3,`bottom`),c=F(t,`align`,3,`end`),l=F(t,`sideOffset`,3,7),d=F(t,`collisionPadding`,3,8),f=F(t,`trapFocus`,3,!0);function p(e){n(e),t.onOpenChange?.(e)}var m=U();C(L(m),()=>ac,(e,a)=>{a(e,{onOpenChange:p,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=Kg(),p=L(a);{let e=q(()=>he(`popover-trigger`,i()));C(p,()=>Is,(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(L(r),()=>t.trigger??D),g(e,r)},$$slots:{default:!0}})})}C(I(p,2),()=>We,(e,n)=>{n(e,{children:(e,n)=>{var i=U(),a=L(i);{let e=q(()=>he(`popover-content`,`popover-${o()}`,r()));C(a,()=>Ns,(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=Kg(),i=L(r);u(i,()=>t.children??D),C(I(i,2),()=>Rs,(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),R()}var Jg=h(`<div><!></div>`);function Yg(e,t){a(t,!0);var n=Jg();u(V(n),()=>t.children??D),d(n),P(e=>s(n,1,e),[()=>x(he(`grid gap-3 p-3 text-xs`,t.class))]),g(e,n),R()}var Xg=h(`<span class="flex-none text-xs text-muted-foreground"> </span>`),Zg=h(`<div><strong class="text-sm font-semibold"> </strong> <!></div>`);function Qg(e,t){a(t,!0);var n=Zg(),r=V(n),i=V(r,!0);d(r);var o=I(r,2),c=e=>{var n=U();u(L(n),()=>t.action),g(e,n)},l=e=>{var n=Xg(),r=V(n,!0);d(n),P(()=>A(r,t.meta)),g(e,n)};k(o,e=>{t.action?e(c):t.meta&&e(l,1)}),d(n),P(e=>{s(n,1,e),A(i,t.title)},[()=>x(he(`flex items-baseline justify-between gap-3`,t.class))]),g(e,n),R()}var $g=h(`<span class="text-xs text-muted-foreground"> </span>`),e_=h(`<div class="flex items-baseline justify-between gap-3"><!> <!></div>`),t_=h(`<div><!> <!></div>`);function n_(e,t){a(t,!0);let n=F(t,`separated`,3,!1);var r=t_(),i=V(r),o=e=>{var n=e_(),r=V(n),i=e=>{var n=$g(),r=V(n,!0);d(n),P(()=>A(r,t.label)),g(e,n)};k(r,e=>{t.label&&e(i)});var a=I(r,2),o=e=>{var n=U();u(L(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(I(i,2),()=>t.children??D),d(r),P(e=>s(r,1,e),[()=>x(he(`grid gap-1.5`,n()&&`border-t border-border/60 pt-3`,t.class))]),g(e,r),R()}var r_=h(`<span class="truncate text-xs text-muted-foreground"> </span>`),i_=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 a_(e,t){a(t,!0);let n=F(t,`selected`,3,!1),i=F(t,`disabled`,3,!1);var o=i_(),c=V(o);u(c,()=>t.icon??D);var l=I(c,2),f=V(l),p=V(f,!0);d(f);var m=I(f,2),h=e=>{var n=r_(),r=V(n,!0);d(n),P(()=>A(r,t.detail)),g(e,n)},_=e=>{var n=U();u(L(n),()=>t.detail),g(e,n)};k(m,e=>{typeof t.detail==`string`?e(h):t.detail&&e(_,1)}),d(l);var v=I(l,2);u(v,()=>t.trailing??D);var y=I(v,2),b=e=>{en(e,{class:`size-3.5 flex-none text-primary`,"aria-hidden":`true`})};k(y,e=>{n()&&e(b)}),d(o),P(e=>{o.disabled=i(),K(o,`title`,t.title),K(o,`aria-pressed`,n()),s(o,1,e),A(p,t.label)},[()=>x(he(`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),R()}T([`click`]);var o_=h(`<dl><!></dl>`);function s_(e,t){a(t,!0);var n=o_();u(V(n),()=>t.children??D),d(n),P(e=>s(n,1,e),[()=>x(he(`grid gap-1.5 text-xs`,t.class))]),g(e,n),R()}var c_=h(`<div class="flex items-center justify-between gap-4"><dt class="flex-none text-muted-foreground"> </dt> <dd><!></dd></div>`);function l_(e,t){a(t,!0);var n=c_(),r=V(n),i=V(r,!0);d(r);var o=I(r,2),c=V(o),l=e=>{var n=U();u(L(n),()=>t.children),g(e,n)},f=e=>{var n=M();P(()=>A(n,t.value??`—`)),g(e,n)};k(c,e=>{t.children?e(l):e(f,-1)}),d(o),d(n),P(e=>{A(i,t.label),s(o,1,e),K(o,`title`,t.title)},[()=>x(he(`min-w-0 truncate tabular-nums text-foreground`,t.valueClass))]),g(e,n),R()}var u_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`checked`,`size`]);function d_(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`checked`,15,!1),i=F(t,`size`,3,`default`),o=H(t,u_);var s=U(),c=L(s);{let e=q(()=>he(`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,()=>Pc,(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(L(n),()=>Lc,(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),R()}var f_=h(`<span> </span>`),p_=h(`<small class="text-xs text-muted-foreground"> </small>`),m_=h(`<label><span class="grid min-w-0 gap-0.5"><!> <!></span> <!></label>`);function h_(e,t){a(t,!0);let n=F(t,`checked`,15,!1),r=F(t,`disabled`,3,!1),i=F(t,`class`,3,``);function o(e){n(e),t.onCheckedChange?.(e)}var c=m_(),l=V(c),u=V(l),f=e=>{var n=f_(),r=V(n,!0);d(n),P(()=>A(r,t.label)),g(e,n)};k(u,e=>{t.label&&e(f)});var p=I(u,2),m=e=>{var n=p_(),r=V(n,!0);d(n),P(()=>A(r,t.description)),g(e,n)};k(p,e=>{t.description&&e(m)}),d(l),d_(I(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),P(e=>s(c,1,e),[()=>x(he(`flex items-center justify-between gap-3 text-sm text-foreground`,i()))]),g(e,c),R()}var g_=new Set([`$$slots`,`$$events`,`$$legacy`]);function __(e,t){let n=H(t,g_),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];An(e,B({name:`search`},()=>n,{get iconNode(){return r}}))}var v_=new Set([`$$slots`,`$$events`,`$$legacy`]);function y_(e,t){let n=H(t,v_),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];An(e,B({name:`x`},()=>n,{get iconNode(){return r}}))}var b_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`type`,`files`,`class`,`size`,`ariaLabel`,`data-slot`]),x_=h(`<input/>`);function S_(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`value`,15),i=F(t,`files`,15),o=F(t,`size`,3,`default`),s=F(t,`data-slot`,3,`input`),c=H(t,b_),l=q(()=>o()===`xs`?`h-7 px-2 text-xs md:text-xs`:o()===`sm`?`h-8`:`h-9`);var u=U(),d=L(u),f=e=>{var a=x_();O(a,e=>({"data-slot":s(),"aria-label":t.ariaLabel,class:e,type:`file`,...c}),[()=>he(`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),pe(a,e=>n(e),()=>n()),Me(a,i),Pe(a,r),g(e,a)},p=e=>{var i=x_();O(i,e=>({"data-slot":s(),"aria-label":t.ariaLabel,class:e,type:t.type,...c}),[()=>he(`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),pe(i,e=>n(e),()=>n()),Pe(i,r),g(e,i)};k(d,e=>{t.type===`file`?e(f):e(p,-1)}),g(e,u),R()}var C_=h(`<div><div class="relative min-w-0 flex-1"><!> <!> <!></div> <!></div>`);function w_(e,t){a(t,!0);let n=F(t,`value`,15,``),r=F(t,`placeholder`,3,`Search`),i=F(t,`ariaLabel`,3,`Search`),o=F(t,`size`,3,`xs`),c=F(t,`icon`,3,__),l=F(t,`clearable`,3,!0),f=F(t,`disabled`,3,!1),p=F(t,`ref`,15,null);function m(e){n(e),t.onValueChange?.(e)}var h=C_(),_=V(h),v=V(_);{let e=q(()=>he(`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=I(v,2);{let e=q(()=>he(`pl-7`,l()&&n()?`pr-7`:void 0,t.inputClass));S_(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=I(y,2),S=e=>{{let t=q(()=>`Clear ${i().toLowerCase()}`);Oe(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)=>{y_(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}};k(b,e=>{l()&&n()&&e(S)}),d(_);var w=I(_,2),T=e=>{var n=U();u(L(n),()=>t.trailing),g(e,n)};k(w,e=>{t.trailing&&e(T)}),d(h),P(e=>s(h,1,e),[()=>x(he(`flex min-w-0 items-center gap-2`,t.class))]),g(e,h),R()}function T_(e){let t=gee(e);return e.map(e=>{let n=mee(e),r=$n(e.provider);return{key:Qn(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 E_(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 D_(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 O_=h(`<span class="model-tab-suffix svelte-1u8q75"> </span>`),k_=h(`<span class="model-tab-short-suffix svelte-1u8q75"> </span>`),A_=h(`<span><span class="model-tab-label svelte-1u8q75"> </span> <!> <!></span>`),j_=h(`<p class="text-muted-foreground"> </p>`),M_=h(` <span class="text-muted-foreground"> </span>`,1),N_=h(`<!> <!>`,1),P_=h(`<p class="text-muted-foreground">No models match.</p>`),F_=h(`<div class="grid gap-2"><!> <!></div>`);function I_(e,t){a(t,!0);let n=F(t,`models`,19,()=>[]),r=F(t,`selectedModelKey`,3,``),i=F(t,`thinkingLevel`,3,`off`),o=F(t,`disabled`,3,!1),c=F(t,`emptyMessage`,3,`No models available. Configure a provider or adjust Scoped Models in Settings.`),l=J(!1),u=J(``),f=J(`all`),p=q(()=>T_(n())),m=q(()=>D_(W(p))),h=q(()=>E_(W(p),n().length>10?W(u):``,n().length>10?W(f):`all`)),v=q(()=>n().find(e=>Qn(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=q(()=>W(v)?.supportedThinkingLevels?.length?W(v).supportedThinkingLevels:[`off`]),T=q(()=>W(S).length>1),E=q(()=>W(v)?hee(W(v),n()):`Select model`),D=q(()=>W(T)&&i()!==`off`?b(i()):void 0),O=q(()=>W(T)&&i()!==`off`?x(i()):void 0),ee=q(()=>`${W(D)?`${W(E)} (${W(D)})`:W(E)}${t.runtimeChangeHint?` · ${t.runtimeChangeHint}`:``}${t.shortcutLabel?` · Cycle thinking ${t.shortcutLabel}`:``}`);function te(e){G(l,o()?!1:e,!0),W(l)&&(G(u,``),G(f,`all`))}function ne(e){if(o())return;let n=Qn(e);n!==r()&&t.onModelChange?.(n)}function j(e){o()||e!==i()&&t.onThinkingLevelChange?.(e)}z(()=>{o()&&G(l,!1)}),qg(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=A_();let n;var r=V(t),i=V(r,!0);d(r);var a=I(r,2),c=e=>{var t=O_(),n=V(t);d(t),P(()=>A(n,`(${W(D)??``})`)),g(e,t)};k(a,e=>{W(D)&&e(c)});var l=I(a,2),u=e=>{var t=k_(),n=V(t);d(t),P(()=>A(n,`(${W(O)??``})`)),g(e,t)};k(l,e=>{W(O)&&e(u)}),d(t),P(()=>{n=s(t,1,`model-tab-inner svelte-1u8q75`,null,n,{disabled:o()}),K(t,`aria-disabled`,o()),A(i,W(E))}),g(e,t)},children:(e,t)=>{Yg(e,{children:(e,t)=>{var a=N_(),s=L(a);n_(s,{label:`Model`,children:(e,t)=>{var i=U(),a=L(i),s=e=>{var t=j_(),n=V(t,!0);d(t),P(()=>A(n,c())),g(e,t)},l=e=>{var t=F_(),i=V(t),a=e=>{var t=N_(),n=L(t);w_(n,{placeholder:`Search models`,ariaLabel:`Search models`,get value(){return W(u)},set value(e){G(u,e,!0)}});var r=I(n,2),i=e=>{var t=U();C(L(t),()=>rn,(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&&G(f,e,!0)},children:(e,t)=>{var n=U();_(L(n),17,()=>W(m),e=>e.id,(e,t)=>{var n=U();C(L(n),()=>tn,(e,n)=>{n(e,{get value(){return W(t).id},class:`flex-none gap-1.5 text-xs`,children:(e,n)=>{w();var r=M_(),i=L(r),a=I(i),o=V(a,!0);d(a),P(()=>{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=I(i,2),c=e=>{g(e,P_())},l=e=>{Bi(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=q(()=>n().key===r());a_(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=I(s,2),p=e=>{n_(e,{label:`Thinking level`,separated:!0,children:(e,t)=>{var n=U();C(L(n),()=>rn,(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();_(L(n),16,()=>W(S),e=>e,(e,t)=>{var n=U();C(L(n),()=>tn,(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();P(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}}),R()}var L_=new Set([`$$slots`,`$$events`,`$$legacy`]);function R_(e,t){let n=H(t,L_),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`}]];N(e,B({name:`fold-vertical`},()=>n,{get iconNode(){return r}}))}var z_=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function B_(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=H(t,z_);var i=U();C(L(i),()=>as,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),R()}var V_=new Set([`$$slots`,`$$events`,`$$legacy`]);function H_(e,t){let n=H(t,V_);var r=U();C(L(r),()=>We,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var U_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function W_(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,U_);var i=U(),o=L(i);{let e=q(()=>he(`dialog-title`,t.class));C(o,()=>Ke,(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),R()}var G_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`variant`,`size`]);function K_(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`variant`,3,`default`),i=F(t,`size`,3,`default`),o=H(t,G_);var s=U(),c=L(s);{let e=q(()=>he(xe({variant:r(),size:i()}),`cn-alert-dialog-action`,t.class));C(c,()=>cs,(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),R()}var q_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`variant`,`size`]);function J_(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`variant`,3,`outline`),i=F(t,`size`,3,`default`),o=H(t,q_);var s=U(),c=L(s);{let e=q(()=>he(xe({variant:r(),size:i()}),`cn-alert-dialog-cancel`,t.class));C(c,()=>ds,(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),R()}var Y_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),X_=h(`<div><!></div>`);function Z_(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,Y_);var i=X_();O(i,e=>({"data-slot":`alert-dialog-footer`,class:e,...r}),[()=>he(`dialog-footer gap-2`,t.class)]),u(V(i),()=>t.children??D),d(i),pe(i,e=>n(e),()=>n()),g(e,i),R()}var Q_=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),$_=h(`<div><div class="dialog-title-block"><!></div></div>`);function ev(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,Q_);var i=$_();O(i,e=>({"data-slot":`alert-dialog-header`,class:e,...r}),[()=>he(`dialog-header`,t.class)]);var o=V(i);u(V(o),()=>t.children??D),d(o),d(i),pe(i,e=>n(e),()=>n()),g(e,i),R()}var tv=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function nv(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,tv);var i=U(),o=L(i);{let e=q(()=>he(`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,()=>at,(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),R()}var rv=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`portalProps`]),iv=h(`<!> <!>`,1);function av(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,rv);H_(e,B(()=>t.portalProps,{children:(e,i)=>{var a=iv(),o=L(a);nv(o,{});var s=I(o,2);{let e=q(()=>he(`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,()=>hs,(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}})),R()}var ov=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function sv(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,ov);var i=U(),o=L(i);{let e=q(()=>he(`dialog-description *:[a]:hover:text-foreground text-pretty *:[a]:underline *:[a]:underline-offset-3`,t.class));C(o,()=>mt,(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),R()}h(`<div><!></div>`);var cv=h(`<!> <!>`,1);function lv(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`confirmLabel`,3,`Confirm`),i=F(t,`cancelLabel`,3,`Cancel`),o=F(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(L(u),()=>B_,(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(L(a),()=>av,(e,n)=>{n(e,{get class(){return t.class},children:(e,n)=>{var a=cv(),s=L(a);C(s,()=>ev,(e,n)=>{n(e,{children:(e,n)=>{var r=cv(),i=L(r);C(i,()=>W_,(e,n)=>{n(e,{children:(e,n)=>{w();var r=M();P(()=>A(r,t.title)),g(e,r)},$$slots:{default:!0}})});var a=I(i,2),o=e=>{var n=U();C(L(n),()=>sv,(e,n)=>{n(e,{children:(e,n)=>{w();var r=M();P(()=>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(I(s,2),()=>Z_,(e,n)=>{n(e,{children:(e,n)=>{var a=cv(),s=L(a);C(s,()=>J_,(e,t)=>{t(e,{size:`sm`,onclick:l,children:(e,t)=>{w();var n=M();P(()=>A(n,i())),g(e,n)},$$slots:{default:!0}})});var u=I(s,2);{let e=q(()=>t.confirmVariant??(o()?`destructive`:`default`));C(u,()=>K_,(t,n)=>{n(t,{size:`sm`,get variant(){return W(e)},onclick:c,children:(e,t)=>{w();var n=M();P(()=>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),R()}var uv=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`max`,`value`]),dv=h(`<div data-slot="progress-indicator" class="bg-primary size-full flex-1 transition-all"></div>`);function fv(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`max`,3,100),i=H(t,uv);var o=U(),s=L(o);{let e=q(()=>he(`bg-muted h-1.5 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class));C(s,()=>dc,(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=dv();P(()=>l(i,`transform: translateX(-${100-100*(t.value??0)/(r()??1)}%)`)),g(e,i)},$$slots:{default:!0}}))})}g(e,o),R()}var pv=h(`<span aria-hidden="true"><span class="progress-ring-core size-2 rounded-full svelte-k86mvk"></span></span>`);function mv(e,t){a(t,!0);let n=F(t,`percent`,3,0),r=F(t,`tone`,3,`neutral`),i=q(()=>Math.min(100,Math.max(0,n()??0)));var o=pv();P(e=>{s(o,1,e,`svelte-k86mvk`),K(o,`data-tone`,r()),l(o,`--progress-ring-fill: ${W(i)}%;`)},[()=>x(he(`progress-ring inline-grid size-3 flex-none place-items-center rounded-full`,t.class))]),g(e,o),R()}function hv(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 gv(e){return e==null?`neutral`:e>90?`error`:e>70?`warning`:`neutral`}var _v=[{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 vv(e,t){if(e==null||!Number.isFinite(e))return t;for(let t of _v)if(yv(e,t.minutes))return{label:t.label,abbreviation:t.abbreviation};return t}function yv(e,t){return e>=t*.95&&e<=t*1.05}function bv(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 xv(e){if(!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:Cv(t-Date.now())}function Sv(e){return e==null||e<=0?null:Cv(e*1e3)}function Cv(e){return e<=0?null:bv(Math.floor(e/6e4))}var wv=h(`<span class="context-usage-tab-inner inline-flex items-center gap-1 svelte-icoso1"><!> <span class="ctx-percent svelte-icoso1"> </span> <span class="ctx-window font-medium text-muted-foreground svelte-icoso1"> </span></span>`),Tv=h(`<span> </span>`),Ev=h(`<p class="text-muted-foreground">Usage will be available after the next response.</p>`),Dv=h(`<!> <!>`,1),Ov=h(`<!> <!> <!>`,1),kv=h(`<!> `,1),Av=h(`<!> <!> <!> <!>`,1);function jv(e,t){a(t,!0);let n=F(t,`contextWindow`,3,0),r=F(t,`compacting`,3,!1),i=F(t,`compactDisabled`,3,!1),o=J(!1),c=J(!1),l=q(()=>n()||t.contextUsage?.contextWindow||0),u=q(()=>t.contextUsage?.tokens??null),f=q(()=>W(u)!=null&&W(l)>0?W(u)/W(l)*100:t.contextUsage?.percent??null),p=q(()=>W(f)==null?0:Math.max(0,Math.min(100,W(f)))),m=q(()=>W(u)!=null&&W(l)>0?Math.max(0,W(l)-W(u)):null),h=q(()=>gv(W(f))),_=q(()=>W(h)===`error`?`danger`:W(h)===`warning`?`warn`:`neutral`),v=q(()=>W(f)==null?`?%`:`${Math.round(W(f))}%`),y=q(()=>W(f)==null?`Usage unavailable`:`${W(v)} used`),b=q(()=>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=q(()=>W(l)>0?hv(W(l)):`—`),C=q(()=>r()||i()||!t.onCompact),w=q(()=>W(h)===`error`?`[&_[data-slot=progress-indicator]]:bg-destructive-solid`:W(h)===`warning`?`[&_[data-slot=progress-indicator]]:bg-warning`:``);function T(){W(C)||(G(o,!1),G(c,!0))}var E=Dv(),D=L(E),O=e=>{qg(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){G(o,e,!0)},trigger:e=>{var t=wv(),n=V(t);mv(n,{get percent(){return W(p)},get tone(){return W(_)}});var r=I(n,2),i=V(r,!0);d(r);var a=I(r,2),o=V(a);d(a),d(t),P(()=>{K(t,`data-tone`,W(h)),A(i,W(v)),A(o,`/${W(S)??``}`)}),g(e,t)},children:(e,t)=>{Yg(e,{children:(e,t)=>{var n=Av(),i=L(n);Qg(i,{title:`Context window`,action:e=>{var t=Tv(),n=V(t,!0);d(t),P(e=>{s(t,1,e,`svelte-icoso1`),A(n,W(y))},[()=>x(he(`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=I(i,2);n_(a,{children:(e,t)=>{var n=Dv(),r=L(n);{let e=q(()=>he(`h-1`,W(w))),t=q(()=>W(f)==null?`Context usage unavailable`:`${W(v)} of context window used`);fv(r,{get value(){return W(p)},get class(){return W(e)},get"aria-label"(){return W(t)}})}var i=I(r,2),a=e=>{g(e,Ev())};k(i,e=>{W(f)??e(a)}),g(e,n)},$$slots:{default:!0}});var o=I(a,2);n_(o,{separated:!0,children:(e,t)=>{s_(e,{children:(e,t)=>{var n=Ov(),r=L(n);{let e=q(()=>W(u)==null?`Unavailable`:`${W(u).toLocaleString()} tokens`);l_(r,{label:`Used`,get value(){return W(e)}})}var i=I(r,2);{let e=q(()=>W(m)==null?`Unavailable`:`${W(m).toLocaleString()} tokens`);l_(i,{label:`Remaining`,get value(){return W(e)}})}var a=I(i,2);{let e=q(()=>W(l)>0?`${W(l).toLocaleString()} tokens`:`Unknown`);l_(a,{label:`Window`,get value(){return W(e)}})}g(e,n)},$$slots:{default:!0}})},$$slots:{default:!0}});var c=I(o,2);{let e=q(()=>r()?`Conversation compaction is in progress`:`Summarize earlier messages to reduce context usage`);Oe(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=kv(),i=L(n);R_(i,{});var a=I(i);P(()=>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)}),lv(I(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){G(c,e,!0)}}),g(e,E),R()}var Mv=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nv(e,t){let n=H(t,Mv),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]];N(e,B({name:`circle`},()=>n,{get iconNode(){return r}}))}var Pv=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fv(e,t){let n=H(t,Pv),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]];N(e,B({name:`circle-check`},()=>n,{get iconNode(){return r}}))}var Iv=h(`<p> </p>`),Lv=h(`<li><!> <span> </span></li>`),Rv=h(`<ul class="m-0 grid list-none gap-1.5 p-0" aria-label="Todo list"></ul>`);function zv(e,t){a(t,!0);let n=F(t,`emptyLabel`,3,`No todos set.`),r=F(t,`dense`,3,!1),i=q(()=>r()?`text-xs`:`text-sm`),o=q(()=>r()?13:15);var c=U(),l=L(c),u=e=>{var t=Iv(),r=V(t,!0);d(t),P(()=>{s(t,1,`m-0 text-muted-foreground ${W(i)}`),A(r,n())}),g(e,t)},f=e=>{var n=Rv();_(n,23,()=>t.items,(e,t)=>`${e.todo}:${e.done}:${t}`,(e,t)=>{var n=Lv(),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=>{Nv(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=I(r,2);let u;var f=V(l,!0);d(l),d(n),P(()=>{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),R()}var Bv=h(`<span class="todo-tab-inner svelte-1kjsgm3"><!> <span class="todo-count svelte-1kjsgm3"> </span></span>`),Vv=h(`<!> <!>`,1);function Hv(e,t){a(t,!0);let n=J(!1),r=q(()=>t.todos.length),i=q(()=>t.todos.filter(e=>e.done).length),o=q(()=>W(r)>0?W(i)/W(r)*100:0),s=q(()=>W(r)>0&&W(i)===W(r)),c=q(()=>`Todos: ${W(i)} of ${W(r)} complete`);var l=U(),u=L(l),f=e=>{qg(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){G(n,e,!0)},trigger:e=>{var t=Bv(),n=V(t);{let e=q(()=>W(s)?`good`:`primary`);mv(n,{get percent(){return W(o)},get tone(){return W(e)}})}var a=I(n,2),c=V(a);d(a),d(t),P(()=>A(c,`${W(i)??``}/${W(r)??``}`)),g(e,t)},children:(e,n)=>{Yg(e,{class:`max-h-[min(48vh,20rem)] overflow-y-auto`,children:(e,n)=>{var a=Vv(),o=L(a);{let e=q(()=>`${W(i)}/${W(r)}`);Qg(o,{title:`Todo list`,get meta(){return W(e)}})}zv(I(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),R()}var Uv=h(`<span><!></span>`),Wv=h(`<!> <!> <!>`,1),Gv=h(`<div class="composer-tabs svelte-11h85zl"><!> <button type="button" class="composer-tab mode-tab svelte-11h85zl"><span class="mode-tab-icon svelte-11h85zl" aria-hidden="true"><!></span> <span class="mode-tab-label svelte-11h85zl"> </span></button> <!> <!> <!></div>`);function Kv(e,t){a(t,!0);let n=F(t,`compacting`,3,!1),i=F(t,`compactDisabled`,3,!1),o=F(t,`todos`,19,()=>[]),c=q(()=>[{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:Ug,iconClass:`text-muted-foreground`},{value:`autonomous`,label:`Autonomous`,detail:`Allow tool calls without approval`,icon:Gg,iconClass:`text-warning`}]),l=q(()=>W(c).find(e=>e.value===t.permissionLevel)??W(c)[2]),u=J(!1);function f(e){e!==t.permissionLevel&&t.onPermissionChange?.(e),G(u,!1)}function p(e){t.onApprovalPolicyChange?.({...t.approvalPolicy,autoApproveReadOnly:e})}var m=Gv(),h=V(m);{let e=e=>{let n=q(()=>W(l).icon);var r=Uv();let i;C(V(r),()=>W(n),(e,t)=>{t(e,{size:13,strokeWidth:2.2})}),d(r),P(()=>i=s(r,1,`permission-tab-inner svelte-11h85zl`,null,i,{disabled:t.controlsDisabled})),g(e,r)},n=q(()=>t.permissionShortcut?`Permission: ${W(l).label} (${t.permissionShortcut})`:`Permission: ${W(l).label}`);qg(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){G(u,e,!0)},trigger:e,children:(e,n)=>{Yg(e,{children:(e,n)=>{var r=Wv(),i=L(r);Qg(i,{title:`Permission level`});var a=I(i,2);n_(a,{children:(e,n)=>{var r=U();_(L(r),17,()=>W(c),e=>e.value,(e,n)=>{let r=q(()=>W(n).icon);{let i=e=>{var t=U(),i=L(t);{let e=q(()=>`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=q(()=>W(n).value===t.permissionLevel);a_(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=I(a,2),s=e=>{n_(e,{separated:!0,children:(e,n)=>{h_(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=I(h,2),y=V(v),b=V(y),x=e=>{zg(e,{size:13,strokeWidth:2.2})},S=e=>{Xu(e,{size:13,strokeWidth:2.2})};k(b,e=>{t.modePlanning?e(x):e(S,-1)}),d(y);var w=I(y,2),T=V(w,!0);d(w),d(v);var E=I(v,2);Hv(E,{get todos(){return o()}});var D=I(E,2);jv(D,{get contextUsage(){return t.contextUsage},get contextWindow(){return t.contextWindow},get compacting(){return n()},get compactDisabled(){return i()},get onCompact(){return t.onCompact}}),I_(I(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),P(()=>{v.disabled=t.modeDisabled,K(v,`title`,t.modeShortcut?`Mode: ${t.modeLabel} (${t.modeShortcut})`:`Mode: ${t.modeLabel} (click to switch)`),K(v,`aria-keyshortcuts`,t.modeShortcutAria),A(T,t.modeLabel)}),r(`click`,v,()=>t.onToggleMode?.()),g(e,m),R()}T([`click`]);var qv=h(`<p class="flex items-center gap-1 text-xs text-muted-foreground"> </p>`);function Jv(e,t){a(t,!0);let n=q(()=>Sr(t.model.text)),r=q(()=>br(t.model.text)),i=q(()=>!!(t.model.disabled||t.model.compacting)),o=q(()=>t.model.editorDisabled??W(i)),s=q(()=>t.model.submitDisabled??!!(W(i)||W(n)&&t.model.sending)),c=q(()=>t.model.controlsDisabled??(W(i)||!!t.model.sending)),l=q(()=>t.model.mode===`planning`),f=q(()=>t.model.runtimeChangeHint??(t.model.sending?`Changes apply to the next model request`:void 0)),p=q(()=>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=q(()=>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=L(n),i=e=>{var n=U();u(L(n),()=>t.header),g(e,n)},a=e=>{var n=qv(),r=V(n,!0);d(n),P(()=>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=q(()=>t.model.modeDisabled??W(i)),r=q(()=>t.model.modelDisabled??(W(i)||t.model.models.length===0)),a=q(()=>W(l)?`Planning`:`Coding`),o=q(()=>t.model.contextWindow??0),s=q(()=>W(i)||!t.actions.onCompact),u=q(()=>t.model.modelEmptyMessage??`No models available. Configure a provider in this host.`);Kv(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=q(()=>t.model.focusToken??0);jg(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=L(n),i=e=>{var n=U();u(L(n),()=>t.sendLeading),g(e,n)};k(r,e=>{t.sendLeading&&e(i)}),g(e,n)},b=q(()=>t.model.showStop??t.model.sending),x=q(()=>!t.actions.onAbort||t.model.stopping),S=q(()=>t.model.sendAriaLabel??(W(n)?`Run command`:`Send prompt`));Lg(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}})}R()}var Yv=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xv(e,t){let n=H(t,Yv),r=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]];N(e,B({name:`arrow-down`},()=>n,{get iconNode(){return r}}))}var Zv=h(`<span>Latest</span> <!>`,1),Qv=h(`<div class="transcript svelte-10b0laq"><!></div> <!> <div><!></div> <div class="composer-wrap svelte-10b0laq"><!></div>`,1),$v=h(`<section class="conversation-pane svelte-10b0laq"><!></section>`);function ey(e,t){a(t,!0);let n=F(t,`showScrollButton`,3,!1),r=F(t,`composerHeight`,3,0),i=F(t,`composerWrapRef`,15);var o=$v(),c=V(o),f=e=>{var a=Qv(),o=L(a);u(V(o),()=>t.transcript),d(o);var c=I(o,2),f=e=>{var n=U();u(L(n),()=>t.announcer),g(e,n)};k(c,e=>{t.announcer&&e(f)});var p=I(c,2);let m;var h=V(p);{let e=q(()=>n()&&r()>0?void 0:-1);Oe(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=Zv();Xv(I(L(n),2),{size:15,strokeWidth:2.4,"aria-hidden":`true`}),g(e,n)},$$slots:{default:!0}})}d(p);var _=I(p,2);u(V(_),()=>t.composer),d(_),pe(_,e=>i(e),()=>i()),P(()=>{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;`),K(p,`aria-hidden`,!n()||r()<=0)}),g(e,a)},p=e=>{var n=U();u(L(n),()=>t.empty),g(e,n)};k(c,e=>{t.open?e(f):e(p,-1)}),d(o),g(e,o),R()}function ty(e){return[...e??[]].sort().join(`\0`)}function ny(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&&ty(t.pendingQuestionIds)!==ty(e.pendingQuestionIds))return r===1?`Nerve is waiting for your answer.`:`${r} answers required.`;let i=t.pendingPlanReviewIds?.length??0;if(i>0&&ty(t.pendingPlanReviewIds)!==ty(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 ry=h(`<span> </span>`),iy=h(`<div class="sr-only" role="status" aria-live="polite" aria-atomic="true"><!></div>`);function ay(e,t){a(t,!0);let n=J(``),r=J(0),i;z(()=>{let e={active:t.active,sending:t.sending,pendingApprovalId:t.pendingApprovalId,pendingApprovalCount:t.pendingApprovalCount,pendingQuestionIds:t.pendingQuestionIds,pendingPlanReviewIds:t.pendingPlanReviewIds},a=ny(i,e);i=e,a&&(G(n,a,!0),G(r,W(r)+1))});var s=iy();o(V(s),()=>W(r),e=>{var t=ry(),r=V(t,!0);d(t),P(()=>A(r,W(n))),g(e,t)}),d(s),g(e,s),R()}var oy=j(`<path d="M150 162L232 235L258 208L284 288L362 350"></path>`),sy=j(`<path d="M150 162L222 226L246 194L272 300L296 262L362 350"></path>`),cy=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 ly(e,t){let n=F(t,`compact`,3,!1);var r=cy(),i=V(r),a=I(V(i),2),o=e=>{g(e,oy())},c=e=>{g(e,sy())};k(a,e=>{n()?e(o):e(c,-1)}),d(i),d(r),P(()=>{s(r,0,x(t.class)),K(r,`role`,t.label?`img`:void 0),K(r,`aria-label`,t.label),K(r,`aria-hidden`,t.label?void 0:`true`),K(i,`stroke-width`,n()?32:28)}),g(e,r)}var uy=h(`<span><!></span>`);function dy(e,t){a(t,!0);var n=uy();ly(V(n),{compact:!0,get label(){return t.label}}),d(n),P(e=>s(n,1,e,`svelte-1mk3yeo`),[()=>x(he(`nerve-badge inline-flex items-center justify-center rounded-lg bg-foreground text-background`,t.class))]),g(e,n),R()}var fy=h(`<div class="mt-6 flex flex-col items-center"><!></div>`),py=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 my(e,t){var n=py(),r=V(n),i=V(r);dy(i,{class:`size-12`});var a=I(i,2),o=V(a,!0);d(a);var s=I(a,2),c=V(s,!0);d(s);var l=I(s,2),f=e=>{var n=fy();u(V(n),()=>t.footer),d(n),g(e,n)};k(l,e=>{t.footer&&e(f)}),d(r),d(n),P(()=>{A(o,t.title),A(c,t.message)}),g(e,n)}var hy=new Set([`$$slots`,`$$events`,`$$legacy`]);function gy(e,t){let n=H(t,hy),r=[[`path`,{d:`M16 5H3`}],[`path`,{d:`M11 12H3`}],[`path`,{d:`M16 19H3`}],[`path`,{d:`M18 9v6`}],[`path`,{d:`M21 12h-6`}]];N(e,B({name:`list-plus`},()=>n,{get iconNode(){return r}}))}var _y=new Set([`$$slots`,`$$events`,`$$legacy`]);function vy(e,t){let n=H(t,_y),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`}]];N(e,B({name:`pencil`},()=>n,{get iconNode(){return r}}))}var yy=new Set([`$$slots`,`$$events`,`$$legacy`]);function by(e,t){let n=H(t,yy),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`}]];N(e,B({name:`trash-2`},()=>n,{get iconNode(){return r}}))}function xy(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 Sy=h(`<div class="contents" role="presentation"><!></div>`);function Cy(e,t){a(t,!0);let n=F(t,`disabled`,3,!1),i=J(void 0),o=q(()=>t.menu(t.target,W(i)));function s(e){G(i,xy(window.getSelection(),e.currentTarget),!0)}var c=Sy();fn(V(c),{get items(){return W(o)},get triggerClass(){return t.triggerClass},get disabled(){return n()},children:(e,n)=>{var r=U();u(L(r),()=>t.children),g(e,r)},$$slots:{default:!0}}),d(c),r(`contextmenu`,c,s),g(e,c),R()}T([`contextmenu`]);var wy=h(`<div> </div>`);function Ty(e,t){a(t,!0);let n=F(t,`class`,3,``);var r=wy(),i=V(r,!0);d(r),P(e=>{s(r,1,e),A(i,t.text)},[()=>x(he(`min-w-0 max-w-full whitespace-pre-wrap break-words`,n()))]),g(e,r),R()}var Ey=h(`<span class="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground"><!> Running…</span>`),Dy=h(`<span> </span>`),Oy=h(`<pre class="min-w-0 font-mono text-xs leading-4 whitespace-pre-wrap break-words text-muted-foreground"> </pre>`),ky=h(`<p class="font-mono text-xs italic text-muted-foreground">(no output)</p>`),Ay=h(`<div class="border-t border-border px-2.5 py-1.5"><!></div>`),jy=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 My(e,t){let n=F(t,`output`,3,``),r=q(()=>t.exitCode===0||t.exitCode===void 0&&t.status===`completed`),i=q(()=>t.exitCode===void 0?t.status??``:`exit ${t.exitCode}`);var a=jy(),o=V(a),c=V(o);sd(c,{size:14,strokeWidth:2,class:`mt-0.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`});var l=I(c,2),u=V(l);d(l);var f=I(l,2),p=e=>{var t=Ey();zi(V(t),{class:`size-3`,"aria-label":`Running command`}),w(),d(t),g(e,t)},m=e=>{var n=Dy(),a=V(n,!0);d(n),P(()=>{s(n,1,`shrink-0 font-mono text-xs leading-5 ${W(r)?`text-success`:`text-destructive`}`),K(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=I(o,2),_=e=>{var t=Ay(),r=V(t),i=e=>{var t=Oy(),r=V(t,!0);d(t),P(()=>A(r,n())),g(e,t)},a=e=>{g(e,ky())};k(r,e=>{n()?e(i):e(a,-1)}),d(t),g(e,t)};k(h,e=>{t.phase===`done`&&e(_)}),d(a),P(()=>A(u,`$ ${t.command??``}`)),g(e,a)}var Ny=`(no output)`;function Py(e){let t=Kr(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===Ny?``:e.output}})),n=Ar(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 Iy=h(`<div class="flex min-w-0 flex-col gap-2"></div>`);function Ly(e,t){a(t,!0);let n=F(t,`pending`,3,!1),r=q(()=>Py(t.text)),i=q(()=>W(r).length===1&&W(r)[0].kind===`text`);var o=U(),s=L(o),c=e=>{Ty(e,{get text(){return t.text}})},l=e=>{var t=Iy();_(t,21,()=>W(r),E,(e,t)=>{var r=U(),i=L(r),a=e=>{Ty(e,{get text(){return W(t).text}})},o=e=>{My(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=q(()=>n()?`running`:`static`);My(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),R()}var Ry=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function zy(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=H(t,Ry);var i=U();C(L(i),()=>$c,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),R()}var By=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function Vy(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,By);var i=U();C(L(i),()=>al,(e,t)=>{t(e,B({"data-slot":`tooltip-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),g(e,i),R()}var Hy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uy(e,t){let n=H(t,Hy);var r=U();C(L(r),()=>We,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var Wy=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`sideOffset`,`side`,`children`,`arrowClasses`,`portalProps`]),Gy=h(`<div></div>`),Ky=h(`<!> <!>`,1);function qy(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`sideOffset`,3,0),i=F(t,`side`,3,`top`),o=H(t,Wy);Uy(e,B(()=>t.portalProps,{children:(e,a)=>{var s=U(),c=L(s);{let e=q(()=>he(`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,()=>nl,(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=Ky(),i=L(r);u(i,()=>t.children??D);var a=I(i,2);{let e=(e,n)=>{let r=()=>n?.().props;var i=Gy();O(i,e=>({class:e,...r()}),[()=>he(`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,()=>sl,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}g(e,r)},$$slots:{default:!0}}))})}g(e,s)},$$slots:{default:!0}})),R()}var Jy=new Set([`$$slots`,`$$events`,`$$legacy`,`delayDuration`]);function Yy(e,t){let n=F(t,`delayDuration`,3,0),r=H(t,Jy);var i=U();C(L(i),()=>cl,(e,t)=>{t(e,B({get delayDuration(){return n()}},()=>r))}),g(e,i)}var Xy=h(`<!> <!>`,1),Zy=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 Qy(e,t){a(t,!0);let n=J(void 0);async function r(e){if(!W(n)){G(n,e,!0);try{e===`edit`?await t.onMoveToComposer?.(t.prompt):await t.onDiscard?.(t.prompt)}catch{}finally{G(n,void 0)}}}let i=q(()=>({kind:`queued_prompt`,prompt:t.prompt,busy:!!W(n),canEdit:!!t.onMoveToComposer,canDiscard:!!t.onDiscard,onEdit:()=>void r(`edit`),onDiscard:()=>void r(`discard`)}));Cy(e,{get target(){return W(i)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,i)=>{var a=Zy(),o=V(a);gy(V(o),{size:13,strokeWidth:2.2,"aria-hidden":`true`}),w(2),d(o);var s=I(o,2);C(V(s),()=>Yy,(e,i)=>{i(e,{delayDuration:300,disableHoverableContent:!0,children:(e,i)=>{var a=Xy(),o=L(a);C(o,()=>zy,(e,i)=>{i(e,{children:(e,i)=>{var a=Xy(),o=L(a);{let e=(e,i)=>{let a=()=>i?.().props;{let i=q(()=>!t.onMoveToComposer||!!W(n));Oe(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)=>{vy(e,{"aria-hidden":`true`})},$$slots:{default:!0}}))}};C(o,()=>Vy,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}C(I(o,2),()=>qy,(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(I(o,2),()=>zy,(e,i)=>{i(e,{children:(e,i)=>{var a=Xy(),o=L(a);{let e=(e,i)=>{let a=()=>i?.().props;{let i=q(()=>!t.onDiscard||!!W(n));Oe(e,B(a,{variant:`ghost`,size:`icon-xs`,get disabled(){return W(i)},ariaLabel:`Discard queued prompt`,onclick:()=>void r(`discard`),children:(e,t)=>{by(e,{"aria-hidden":`true`})},$$slots:{default:!0}}))}};C(o,()=>Vy,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}C(I(o,2),()=>qy,(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=I(s,2);Ly(V(c),{get text(){return t.prompt.text}}),d(c),d(a),g(e,a)},$$slots:{default:!0}}),R()}var $y=/(?:api[_-]?key|access[_-]?token|authorization|auth[_-]?token|bearer|cookie|credential|password|private[_-]?key|secret|session|token)/i,eb=/^(?:bearer\s+\S+|(?:gh[opusr]|sk|pk)_[A-Za-z0-9_-]{16,}|[A-Za-z0-9+/=_-]{40,})$/i,tb=24e3,nb=12,rb=240;function ib(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function ab(e){if(typeof e!=`string`)return ib(e);try{return ib(JSON.parse(e))}catch{return{}}}function ob(e){try{return JSON.parse(`"${e}"`)}catch{return e.replaceAll(`\\n`,`
15
- `).replaceAll(`\\r`,`\r`).replaceAll(`\\t`,` `).replace(/\\(["\\/])/g,`$1`)}}function sb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function cb(e,t){let n=[],r=RegExp(`"${sb(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<tb;){let n=e[o];if(!a&&n===`"`)break;t+=n,a?a=!1:n===`\\`&&(a=!0),o+=1}n.push(ob(t)),i=r.exec(e)}return n}function lb(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,ob(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+tb))),l=-1,o.length>=nb)))break}return l>=0&&o.length<nb&&o.push(e.slice(l,Math.min(e.length,l+tb))),o}function ub(e,t){let n=cb(e,t)[0];if(n!==void 0)return n;let r=e.match(RegExp(`"${sb(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 db(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 fb(e){return $y.test(e)}function pb(e){return eb.test(e.trim())}function mb(e,t){if(fb(e))return`[redacted]`;let n=db(t)??`[unavailable]`;return pb(n)?`[redacted]`:n}var hb=class e{argsText;records;constructor(e={}){this.argsText=e.argsText??``;let t=ib(e.args),n=ab(this.argsText),r=ab(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 ub(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=cb(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(ib).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,nb).map(t=>new e({args:ib(t)})):[]}return lb(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:cb(this.argsText,e)}structuredEntries(e=nb){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=mb(e,t);return{key:e,value:n.length>rb?`${n.slice(0,rb-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=mb(e,ub(this.argsText,e));return{key:e,value:t,redacted:t===`[redacted]`}})}};function gb(e={}){return new hb(e)}var _b=20;function vb(e,t,n,r){let i=yb(e.toolName);if(!i)return{kind:`generic`,toolName:e.toolName,args:[],result:[]};let a=Mt(n),o=Qt(a?.details),s=Yt(a?.details),c=Dr.safeParse(a?.details),l=c.success?c.data:Nt(a?.details)??{},u=Tt(a,n,r),d=bb(l.spaces,e=>pr.parse(e)),f=bb(l.pages,e=>Or.parse(e)),p=bb(l.attachments,e=>mr.parse(e)),m=bb(l.outcomes,e=>vee.parse(e)),h=Or.safeParse(l.page),g=pr.safeParse(l.space),_=mr.safeParse(l.attachment);return{kind:`confluence`,action:i,toolName:e.toolName,content:u,contentLineCount:o?.model?.displayedLines??Sb(u),messageLines:Cb(u),query:jt(l.query)??jt(t.query),cql:jt(l.cql)??jt(t.cql),pageId:jt(l.pageId)??(h.success?h.data.id:void 0)??jt(t.page_id),spaceId:jt(l.spaceId)??(g.success?g.data.id:void 0)??jt(t.space_id),spaceKey:jt(l.spaceKey)??(g.success?g.data.key:void 0)??jt(t.space_key),title:jt(l.title)??(h.success?h.data.title:void 0)??jt(t.title),status:jt(l.status)??jt(t.status),bodyFormat:jt(l.bodyFormat)??jt(t.body_format),spaces:d.slice(0,_b),space:g.success?g.data:d[0],spaceCount:xb(l.spaceCount)??(d.length>0?d.length:void 0),displayedSpaceCount:xb(l.displayedSpaceCount)??(d.length>0?Math.min(d.length,_b):void 0),pages:f.slice(0,_b),page:h.success?h.data:f[0],pageCount:xb(l.pageCount)??(f.length>0?f.length:void 0),displayedPageCount:xb(l.displayedPageCount)??(f.length>0?Math.min(f.length,_b):void 0),attachments:p.slice(0,_b),attachment:_.success?_.data:p[0],attachmentCount:xb(l.attachmentCount)??(p.length>0?p.length:void 0),displayedAttachmentCount:xb(l.displayedAttachmentCount)??(p.length>0?Math.min(p.length,_b):void 0),includedCounts:c.success?c.data.includedCounts:void 0,downloadDir:jt(l.downloadDir),manifestPath:jt(l.manifestPath),pagesJsonlPath:jt(l.pagesJsonlPath),inputPath:jt(l.inputPath)??jt(t.input_path),nextCursor:jt(l.nextCursor),outcomes:m.slice(0,_b),outcomeCount:xb(l.outcomeCount)??(m.length>0?m.length:void 0),displayedOutcomeCount:xb(l.displayedOutcomeCount)??(m.length>0?Math.min(m.length,_b):void 0),dryRun:typeof l.dryRun==`boolean`?l.dryRun:void 0,payload:l.payload,outputLimits:o,outputArtifacts:s}}function yb(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 bb(e,t){return Array.isArray(e)?e.flatMap(e=>{try{return[t(e)]}catch{return[]}}):[]}function xb(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Sb(e){return e?e.length===0?0:e.split(`
16
- `).length:0}function Cb(e){return e?e.split(`
17
- `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`- `)).slice(0,8):[]}function wb(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=Nt(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:jt(n.agentId),taskIndex:typeof n.taskIndex==`number`?n.taskIndex:void 0,taskCount:typeof n.taskCount==`number`?n.taskCount:void 0,label:jt(n.label),model:jt(n.model),thinkingLevel:jt(n.thinkingLevel),phase:n.phase,message:n.message,report:Oee.safeParse(n.report).data});continue}}catch{}n.push(r)}}return{updates:t,fallback:n.length>0?n.join(`
18
- `):void 0}}var Tb=new Set([`Final report received.`]);function Eb(e){return/\bcompleted\b/i.test(e)&&!/\b(?:failed|error)\b/i.test(e)}function Db(e){if(!Tb.has(e.message))switch(e.phase){case`tool_call`:return{text:e.message,mono:!1};case`tool_result`:return Eb(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 Ob(e){let t=e.updates.map(Db).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 kb=new WeakMap;function Ab(e){let t=kb.get(e);if(t)return t;let n=jb(e);return kb.set(e,n),n}function jb(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(Db).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:Ob({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 Mb=20,Nb=20,Pb=300;function Fb(e,t,n,r){let i=Ib(e.toolName);if(!i)return{kind:`generic`,toolName:e.toolName,args:[],result:[]};let a=Mt(n),o=Qt(a?.details),s=Yt(a?.details),c=Xb(a?.details),l=Tt(a,n,r),u=jt(c.projectKey)??jt(t.project_key),d=Gb(c.issue),f=$b(l).slice(0,Mb),p=d??(i===`get_issue`?f[0]:void 0),m=Zb(c.issues,Gb).slice(0,Mb),h=m.length>0?m:f,g=ex(l).slice(0,Mb),_=Zb(c.transitions,qb).slice(0,Mb),v=_.length>0?_:g,y=Zb(c.users,Jb).slice(0,Mb),b=Zb(c.fields,Yb).slice(0,Nb),x=rx(c.includedCounts,l),S=Bb(c.updatedFields).filter(e=>typeof e==`string`).slice(0,Nb);return{kind:`jira`,action:i,toolName:e.toolName,content:l,contentLineCount:zb(l,e,`lines`,`head`,o),messageLines:nx(l),query:jt(c.query)??jt(t.query),jql:jt(c.jql)??jt(t.jql),issueKey:jt(c.issueKey)??p?.key??jt(t.issue_key)??jt(t.parent_key),projectKey:u,issueType:jt(c.issueType)??jt(t.issue_type),summary:Hb(jt(c.summary)??jt(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:jt(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:Kb(c.project,u),includedCounts:x,dryRun:typeof c.dryRun==`boolean`?c.dryRun:void 0,resolvedAssignee:Jb(c.resolvedAssignee),updatedFields:S,updatedFieldCount:Vb(c.updatedFieldCount)??(S.length>0?S.length:void 0),commentId:jt(c.commentId),transition:qb(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 Ib(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 Lb(e){return e?e.length===0?0:e.split(`
19
- `).length:0}function Rb(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 zb(e,t,n,r,i){return i?.model?.displayedLines??Lb(e)+Rb(t,n,r)}function Bb(e){return Array.isArray(e)?e:[]}function Vb(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Hb(e){if(e===void 0)return;let t=e.replace(/\s+/g,` `).trim();return t.length<=Pb?t:`${t.slice(0,Pb-1)}…`}function Ub(e){return jt(Nt(e).name)}function Wb(e){return jt(Nt(e).displayName)??Ub(e)}function Gb(e){let t=Eee.safeParse(e);if(t.success)return t.data;let n=Nt(e),r=Nt(n.fields),i=jt(n.key)??jt(n.id);if(i)return{key:i,id:jt(n.id),summary:Hb(jt(r.summary)),issueType:Hb(Ub(r.issuetype)),status:Hb(Ub(r.status)),statusCategory:Hb(jt(Nt(Nt(r.status).statusCategory).key)),assignee:Hb(Wb(r.assignee)),priority:Hb(Ub(r.priority)),updated:Hb(jt(r.updated))}}function Kb(e,t){let n=Aee.safeParse(e);if(n.success)return n.data;let r=Nt(e),i=jt(r.key)??t??jt(r.id);return i?{key:i,id:jt(r.id),name:Hb(jt(r.name)),projectTypeKey:Hb(jt(r.projectTypeKey)),lead:Hb(Wb(r.lead))}:t?{key:t}:void 0}function qb(e){let t=yee.safeParse(e);if(t.success)return t.data;let n=Nt(e),r=jt(n.id);if(r)return{id:r,name:Hb(jt(n.name)),to:Hb(Ub(n.to)??jt(n.to)),toStatusCategory:Hb(jt(Nt(Nt(n.to).statusCategory).key))}}function Jb(e){let t=Nee.safeParse(e);if(t.success)return t.data;let n=Nt(e),r=jt(n.accountId);if(r)return{accountId:r,displayName:Hb(Wb(n)),emailAddress:Hb(jt(n.emailAddress)),active:typeof n.active==`boolean`?n.active:void 0,accountType:Hb(jt(n.accountType))}}function Yb(e){let t=wee.safeParse(e);if(t.success)return t.data;let n=Nt(e),r=jt(n.id)??jt(n.key);if(r)return{id:r,name:Hb(jt(n.name)),key:Hb(jt(n.key)),required:typeof n.required==`boolean`?n.required:void 0,type:Hb(jt(n.type)),custom:typeof n.custom==`boolean`?n.custom:void 0}}function Xb(e){let t=Jr.safeParse(e);return t.success?t.data:Nt(e)}function Zb(e,t){return Bb(e).flatMap(e=>{let n=t(e);return n?[n]:[]})}function Qb(e){return!!(e&&/^[A-Z][A-Z0-9]+-\d+$/.test(e))}function $b(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(!Qb(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:Hb(o),status:Hb(s),priority:Hb(c),assignee:Hb(l),summary:Hb(r.join(` — `))}]}):[]}function ex(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||Qb(r)?[]:[{id:r,name:Hb(n[2]?.trim()),to:Hb(n[3]?.trim())}]}):[]}function tx(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 nx(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,Mb):[]}function rx(e,t){let n=Nt(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:tx(t)}function ix(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function ax(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 ox(e){let t=Wr.safeParse(e);if(t.success)return t.data;let n=Br.safeParse(e);return n.success?ax(n.data):void 0}function sx(e){if(!Array.isArray(e))return{tasks:[],valid:!1};let t=[],n=!0;for(let r of e){let e=ox(r);e?t.push(e):n=!1}return{tasks:t,valid:n}}function cx(e){if(!Array.isArray(e))return{events:[],valid:!1};let t=[],n=!0;for(let r of e){let e=Pr.safeParse(r);e.success?t.push(e.data):n=!1}return{events:t,valid:n}}function lx(e){let t=_ee.safeParse(e);if(t.success)return{task:t.data.task,previewUnavailable:!1};let n=ox(ix(e).task);return{task:n,previewUnavailable:!n}}function ux(e){let t=kee.safeParse(e);if(t.success)return{task:t.data.task,restartedFromTaskId:t.data.restartedFromTaskId,previewUnavailable:!1};let n=ix(e),r=ox(n.task),i=typeof n.restartedFromTaskId==`string`?n.restartedFromTaskId:r?.lineage?.restartedFromTaskId;return{task:r,restartedFromTaskId:i,previewUnavailable:!r||!i}}function dx(e){let t=Fee.safeParse(e);if(t.success)return{tasks:t.data.outcomes.flatMap(e=>e.task?[e.task]:[]),outcomes:t.data.outcomes,previewUnavailable:!1};let n=ix(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=Mee.safeParse(n.cancelResults[e]);if(!t.success){a=!1;continue}let o=r[e],s=o===void 0?void 0:ox(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 fx(e){let t=xr.safeParse(e);if(t.success)return{tasks:t.data.tasks,previewUnavailable:!1};let n=sx(ix(e).tasks);return{tasks:n.tasks,previewUnavailable:!n.valid}}function px(e){let t=gr.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=ix(e),r=ox(n.task),i=cx(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 mx(e){return Array.isArray(e)?e:[]}function kre(e){return mx(e.replacements).length+mx(e.insertions).length+mx(e.lineReplacements).length+mx(e.lineInsertions).length+ +(typeof e.patch==`string`&&e.patch.length>0)}function hx(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 gx(e,t,n,r){return e+hx(t,n,r)}function Are(e){return e?.model?.displayedLines}function _x(e,t,n,r,i){return Are(i)??gx(Pt(e),t,n,r)}var vx=new Vi(300);function yx(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 jre(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,yx(n.argsPreview??n.args),yx(n.resultPreview??n.result),i?`${i.hidden}:${i.noun}:${i.direction}`:``,t?.updatedAt??``,t?.text.length??0].join(`\0`)}function bx(e,t){let n=jre(e,t),r=vx.get(n);if(r!==void 0)return r;let i=Mre(e,t);return vx.set(n,i),i}function Mre(e,t){let n=e,r=n.argsPreview??n.args,i=n.resultPreview??n.result,a=Nt(r),o=e.cwd,s=Mt(i),c=Qt(s?.details),l=Yt(s?.details);switch(e.toolName){case`read`:{let t=At(s?.path??jt(a.path),o),n=Zt(t,o),r=s?.contentBlocks?.find(e=>e.type===`image`);if(r&&r.type===`image`)return{kind:`read`,path:t,relPath:n,image:{dataUrl:cee(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:_x(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:Wt(s?.details),outputLimits:c,outputArtifacts:l}}case`bash`:{let n=jt(a.command),r=bee.safeParse(s?.details),o=Tt(s,i,t),u=_x(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:Wt(s?.details),live:!s&&!!t?.text,outputLimits:t?.outputLimits?{...c,live:{...t.outputLimits}}:c,outputArtifacts:l}}case`python`:case`python_exec`:{let n=jt(a.code),r=jt(a.path),u=Cee.safeParse(s?.details),d=At((u.success?u.data.scriptPath:void 0)??r,o),f=Tt(s,i,t),p=n?gx(Pt(n),e,`lines`,`head`):0,m=_x(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:Zt(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:Wt(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=At(s?.path??jt(a.path),o),n=Zt(t,o),r=Dee.safeParse(s?.details),i=r.success?r.data.operationCount:kre(a),c=r.success?r.data.diff:void 0,l=gx(Pt(c),e,`lines`,`tail`),{additions:u,deletions:d}=Vt(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=At(s?.path??jt(a.path),o),n=Zt(t,o),r=jt(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:gx(Pt(r),e,`lines`,`tail`),charCount:r?.length,content:r}}case`grep`:{let t=jt(a.pattern),n=At(s?.path,o)??At(jt(a.path)??`.`,o)??o,r=(s?.matches??[]).map(e=>zt({...e,openPath:At(e.path,n)??e.path})),i=Ft(r);return{kind:`grep`,pattern:t,matchCount:gx(r.length,e,`matches`,`head`),fileCount:i.length,allMatches:i}}case`find`:{let t=jt(a.pattern),n=s?.entries??[],r=At(s?.path,o)??At(jt(a.path)??`.`,o)??o,i=n.map(e=>e.path);return{kind:`find`,pattern:t,paths:i,openPaths:n.map(e=>At(e.path,r)??e.path),count:gx(i.length,e,`files`,`head`)}}case`ls`:{let t=At(s?.path??jt(a.path),o),n=Zt(t,o)??`.`,r=(s?.entries??[]).map(e=>({...e,openPath:At(e.path,t??o)??e.path}));return{kind:`ls`,path:t,relPath:n,entries:r,total:gx(r.length,e,`entries`,`head`)}}case`ask_user`:{let e=xee.safeParse(i),t=e.success?e.data:void 0;return{kind:`ask_user`,question:t?.question??jt(a.question),context:t?.context??jt(a.context),recommendation:t?.recommendation??jt(a.recommendation),answer:t?.response,dismissed:!!t?.dismissed,dismissedReason:t?.dismissedReason}}case`todos_set`:case`todos_get`:{let e=Pee.safeParse(i),t=(e.success?e.data.details?.todos:void 0)??see(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`,...lx(i),liveLog:t?.text};case`task_cancel`:{let n=dx(i),r=n.outcomes?.length??0;return{kind:`task_action`,action:`cancel`,task:n.tasks?.[0],...n,outcomeCount:r+hx(e,`tasks`,`head`),liveLog:t?.text}}case`task_restart`:return{kind:`task_action`,action:`restart`,...ux(i),liveLog:t?.text};case`task_status`:{let t=fx(i),n=hx(e,`tasks`,`head`);return{kind:`task_status`,...t,hiddenTaskCount:n,taskCount:t.tasks.length+n}}case`task_logs`:{let t=px(i);return{kind:`task_logs`,...t,eventCount:gx(t.events.length,e,`events`,`tail`)}}case`explore`:{let e=See.safeParse(i),n=e.success?e.data:void 0,r=jt(a.task),o=wb(t?.text);return{kind:`explore`,task:r,reports:n?.reports??[],liveUpdates:o.updates,liveLog:o.fallback}}case`plan_mode_enter`:{let e=jt(Nt(i).planDir);return{kind:`plan_mode`,action:`enter`,summary:It(i),planPath:e}}case`plan_mode_present`:{let e=Nt(i),t=Nt(e.review),n=jt(t.planPath)??jt(a.file_path),r=jt(e.outcome)??jt(t.status);return{kind:`plan_mode`,action:`present`,summary:jt(e.feedback)??It(i),planPath:n,outcome:r}}case`plan_mode_force_exit`:return{kind:`plan_mode`,action:`force_exit`,summary:jt(Nt(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 vb(e,a,i,t);case`web_search`:{let e=Iee.safeParse(s?.details),t=e.success?e.data.query:jt(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=Tee.safeParse(s?.details),t=e.success?e.data:void 0;return{kind:`web_fetch`,url:t?.url??jt(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=Tt(s,i,t),a=n?mb(`result`,n).slice(0,6e3):void 0;return{kind:`generic`,toolName:e.toolName,args:gb({args:r}).structuredEntries(),result:gb({args:i}).structuredEntries(),resultText:a}}}}function xx(e){return e.split(/[\\/]/).pop()||e}function Nre(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 Pre(e){if(e!==void 0)return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Sx(e,t,n=`s`){return`${e} ${t}${e===1?``:n}`}function Cx(e){return Pt(e)}function wx(e,t,n=`head`,r=6){let i=e-r;if(!(i<=0))return Tx(i,t,n)}function Tx(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 Fre(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`&&Ab(t).summary.failed>0?{tone:`danger`,pulse:!1}:{tone:`good`,pulse:!1}}var Ex=300,Ire=6e3;function Lre(e){if(e===void 0)return;let t=e.replace(/\s+/g,` `).trim();return t.length<=Ex?t:`${t.slice(0,Ex-1)}…`}function Rre(e){if(e!==void 0)return e.length<=Ire?e:e.slice(-6e3)}function Dx(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 kx(e){return e.boolean(`dry_run`)===!0?[{label:`Mode`,value:`dry run`,tone:`info`}]:[]}function Ax(e){let t=new Set,n=e.fields.flatMap(e=>t.has(e.label)?[]:(t.add(e.label),[{...e,value:Lre(e.value)}])),r=e.text?{...e.text,text:Rre(e.text.text)}:void 0;return n.length===0&&!r?{kind:`none`}:{kind:`atlassian-draft`,fields:n,text:r}}function zre(e){if(!(e===void 0||e.length===0))return e.replace(/\r\n/g,`
20
- `).replace(/\r/g,`
21
- `).split(`
22
- `).length}var Bre=()=>({kind:`none`});function jx(e={}){return{primaryArg:e.primaryArg,secondary:e.secondary??[],body:e.body??Bre(),safetyNotes:e.safetyNotes??[]}}var Mx=6,Vre=6e3;function Nx(e,t,n=`s`){return`${e} ${t}${e===1?``:n}`}function Px(e){if(!e)return;let t=e.replace(/\r\n/g,`
23
- `).replace(/\r/g,`
24
- `),n=t.split(`
25
- `),r=n.length>Mx?n.slice(-Mx).join(`
26
- `):t;return r.length>Vre?r.slice(-6e3):r}function Fx(e){return e===void 0?void 0:e.length===0?0:e.split(/\r?\n/).length}function Ix(e,t,n=`path`,r){let i=e.string(n)??r;if(i)return{text:t&&oi(i,t)||i,openPath:i===`.`?void 0:t?ii(i,t):i}}function Lx(e,t){let n=e||t;if(n)return{text:n.length>500?`${n.slice(0,499)}…`:n}}function Hre(e){if(e)return{text:e.length>500?`${e.slice(0,499)}…`:e,href:e}}function Rx(e,t,n={}){let r=Px(e);return!r||!n.force&&!r.includes(`
27
- `)?{kind:`none`}:{kind:`code`,text:r,language:t,label:n.label,tail:!0}}function zx(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 Bx(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 Ure(e){return Px(Bx(e).join(`
32
- `))}function Wre(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 Bx(e))t.startsWith(`+`)&&!t.startsWith(`+++`)&&(n+=1),t.startsWith(`-`)&&!t.startsWith(`---`)&&(r+=1);return{operations:t,additions:n,deletions:r}}function Vx(e){return e}function Gre(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}`}`}),jx({primaryArg:Ix(e,n),secondary:s,body:t===`approval`?zx([[`Path`,e.string(`path`),!0],[`Line start`,r],[`Line limit`,i],[`Byte offset`,a],[`Byte limit`,o]]):void 0})}function Kre(e){let t=e.string(`command`),n=Fx(t)??0,r=e.string(`cwd`),i=e.number(`timeout`);return jx({primaryArg:Lx(n<=1?t:void 0,t?`inline command`:`Command`),secondary:[...r?[{text:`cwd ${r}`,mono:!0}]:[],...i===void 0?[]:[{text:`timeout ${i}s`}]],body:Rx(t,`bash`,{force:(t?.length??0)>500,label:`Command`}),safetyNotes:[`Runs a Bash-compatible command in the selected working directory.`]})}function qre(e,t,n){let r=e.string(`path`),i=e.string(`code`),a=Fx(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:Nx(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=Rx(i,`python`,{force:(i?.length??0)>500,label:`Python`});return jx({primaryArg:r?Ix(e,n):Lx(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 Jre(e,t,n){let r=e.string(`content`),i=r===void 0?void 0:new TextEncoder().encode(r).length;return jx({primaryArg:Ix(e,n),secondary:[...i===void 0?[]:[{text:Nx(i,`byte`)}]],body:t!==`failed`&&r?{kind:`code`,text:Px(r),language:`text`,tail:!0}:void 0,safetyNotes:[`Creates the file or overwrites it if it already exists.`]})}function Yre(e,t,n){let r=Wre(e),i=Ure(e),a=[];return r.operations>0&&a.push({text:Nx(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`}),jx({primaryArg:Ix(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 Xre={read:Vx({name:`read`,argumentRegion:`none`,completedView:`read`,present:Gre}),bash:Vx({name:`bash`,argumentRegion:`persistent`,completedView:`bash`,resultPlaceholder:{variant:`text`,rows:2},emptyResult:`No output`,present:Kre}),python_exec:Vx({name:`python_exec`,argumentRegion:`persistent`,completedView:`python`,resultPlaceholder:{variant:`text`,rows:2},emptyResult:`No output`,present:qre}),edit:Vx({name:`edit`,argumentRegion:`until-result`,completedView:`edit`,present:Yre}),write:Vx({name:`write`,argumentRegion:`until-result`,completedView:`write`,present:Jre}),grep:Vx({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`)}`}),jx({primaryArg:Lx(e.string(`pattern`),`Pattern`),secondary:i,body:t===`approval`?zx([[`Scope`,r??`project root`,!0],[`Pattern mode`,e.boolean(`literal`)?`literal`:`regular expression`]]):void 0})}}),find:Vx({name:`find`,argumentRegion:`none`,completedView:`find`,emptyResult:`No files found`,present:(e,t,n)=>jx({primaryArg:Lx(e.string(`pattern`),`Glob pattern`),secondary:[...e.string(`path`)?[{text:n&&oi(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`?zx([[`Search root`,e.string(`path`)??`project root`,!0]]):void 0})}),ls:Vx({name:`ls`,argumentRegion:`none`,completedView:`ls`,emptyResult:`Empty directory`,present:(e,t,n)=>jx({primaryArg:Ix(e,n,`path`,`.`),secondary:e.number(`limit`)!==void 0&&e.number(`limit`)!==500?[{text:`max ${e.number(`limit`)}`}]:[],body:t===`approval`?zx([[`Directory`,e.string(`path`)??`project root`,!0]]):void 0})}),ask_user:Vx({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 jx({primaryArg:Lx(e.string(`question`),`Question`),body:t.length>0?{kind:`text-summary`,text:Px(t.join(`
33
-
34
- `))}:void 0})}}),todos_set:Vx({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 jx({primaryArg:Lx(`todos`),secondary:r.length>0?[{text:Nx(r.filter(e=>e.done).length,`done`)},{text:`${r.length} total`}]:[],body:r.length>0?{kind:`checklist`,items:r}:void 0})}}),todos_get:Vx({name:`todos_get`,argumentRegion:`none`,completedView:`todos`,emptyResult:`No todos`,present:()=>jx({primaryArg:Lx(`Get todos`)})}),web_search:Vx({name:`web_search`,argumentRegion:`none`,completedView:`web_search`,resultPlaceholder:{variant:`list`,rows:3},emptyResult:`No results`,present:(e,t)=>jx({primaryArg:Lx(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`?zx([[`External search`,e.string(`query`)]]):void 0,safetyNotes:[`Sends the query to the configured external search provider.`]})}),web_fetch:Vx({name:`web_fetch`,argumentRegion:`none`,completedView:`web_fetch`,resultPlaceholder:{variant:`text`,rows:3},present:(e,t)=>jx({primaryArg:Hre(e.string(`url`))??Lx(`URL`),secondary:[{text:e.boolean(`raw`)?`raw download`:`converted`}],body:t===`approval`?zx([[`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 Hx(e){return e}function Ux(e){return e&&e.length>0?e.join(`, `):void 0}function Zre(e){let t=Px(e.join(`
35
- `));return t?{kind:`atlassian-summary`,text:t}:{kind:`none`}}function Wx(e){return e.boolean(`dry_run`)===!0?[{text:`dry run`,tone:`info`}]:[]}function Gx(e,t){return[e.boolean(`dry_run`)===!0?`Dry run only; Confluence will not ${t}.`:`This will ${t} in Confluence.`]}function Kx(e,t){return e===`approval`?Zre(t):void 0}function qx(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=zre(r);return o!==void 0&&i.push({text:`+${o}`,tone:`success`}),t?{body:{kind:`none`},chips:i}:{body:Ax({fields:[],text:{label:`Page body`,text:r,language:n===void 0||n===`storage`?`xml`:void 0}}),chips:i}}var Qre={confluence_search_spaces:Hx({name:`confluence_search_spaces`,argumentRegion:`none`,resultPlaceholder:{variant:`list`,rows:3},completedView:`confluence`,emptyResult:`No spaces found`,present:(e,t)=>{let n=Ux(e.strings(`keys`))??Ux(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`)}`}),jx({primaryArg:Lx(e.string(`query`)??n,`Spaces`),secondary:r,body:Kx(t,[`Query: ${e.string(`query`)??n??`all spaces`}`])})}}),confluence_search_pages:Hx({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`}),jx({primaryArg:Lx(n,`Page query`),secondary:r,body:Kx(t,[`${e.string(`cql`)?`CQL`:`Query`}: ${n??``}`,...e.string(`space_key`)?[`Space: ${e.string(`space_key`)}`]:[]])})}}),confluence_get_page:Hx({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 jx({primaryArg:Lx(n,`Page`),secondary:[...e.string(`body_format`)?[{text:e.string(`body_format`)}]:[],...r.map(e=>({text:e}))],body:Kx(t,[`Page: ${n??``}`,...r.length?[`Include: ${r.join(`, `)}`]:[]])})}}),confluence_download_pages:Hx({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}),jx({primaryArg:Lx(n,`Page download`),secondary:i,body:Kx(t,[`Scope: ${n??``}`,...r?[`Destination: ${r}`]:[],...e.boolean(`download_attachments`)?[`Attachments: download`]:[]]),safetyNotes:r?[`Writes downloaded files under ${r}.`]:[]})}}),confluence_create_page:Hx({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}=qx(e);return jx({primaryArg:Lx([t,n].filter(Boolean).join(` · `),`New Confluence page`),secondary:[...Wx(e),...e.string(`parent_id`)?[{text:`parent ${e.string(`parent_id`)}`,mono:!0}]:[],...i],body:r,safetyNotes:Gx(e,`create the page`)})}}),confluence_update_page:Hx({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}=qx(e);return jx({primaryArg:Lx(t,`Confluence page`),secondary:[...Wx(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:Gx(e,`update the page`)})}}),confluence_publish_pages:Hx({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=Ax({fields:[Dx(`Source`,t,{mono:!0}),...Ox(`Pages`,n.length?`${Nx(n.length,`page`)}: ${n.slice(0,5).join(`, `)}${n.length>5?`, …`:``}`:void 0),...Ox(`Version message`,e.string(`version_message`)),Dx(`Conflict handling`,r?`allow stale`:`enforce versions`,r?{tone:`warning`}:{}),...e.boolean(`create_missing`)===!0?[Dx(`Create missing`,`yes`)]:[],...kx(e)]});return jx({primaryArg:t?{text:t.split(/[\\/]/).pop()||t,openPath:t}:Lx(`Page bundle`),secondary:[...Wx(e),...n.length?[{text:Nx(n.length,`page`)}]:[],...e.boolean(`create_missing`)?[{text:`create missing`}]:[],...e.boolean(`allow_stale`)?[{text:`allow stale`,tone:`warning`}]:[]],body:i,safetyNotes:Gx(e,`publish the pages`)})}}),confluence_upload_attachment:Hx({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`}),jx({primaryArg:Lx([r,i].filter(Boolean).join(` · `),`Attachment`),secondary:a,body:t===`approval`?Ax({fields:[Dx(`Target page`,i,{mono:!0}),Dx(`Source file`,n,{mono:!0}),...Ox(`Filename`,r),...Ox(`Comment`,e.string(`comment`)),Dx(`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 Jx(e){return e}function Yx(e){return e&&e.length>0?e.join(`, `):void 0}function Xx(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 $re(e){let t=Px(e.join(`
36
- `));return t?{kind:`atlassian-summary`,text:t}:{kind:`none`}}function Zx(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 Qx(e,t){let n=e.objectKeys(t);return n.length>0?n.join(`, `):void 0}function $x(e){return e.boolean(`dry_run`)===!0?[{text:`dry run`,tone:`info`}]:[]}function eS(e,t){return[e.boolean(`dry_run`)===!0?`Dry run only; Jira will not ${t}.`:`This will ${t} in Jira.`]}function tS(e,t,n){return t===`approval`?$re(n):void 0}var eie={jira_search_users:Jx({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`}),jx({primaryArg:Lx(e.string(`query`),`User query`),secondary:n,body:tS(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:Jx({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:Nx(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`}),jx({primaryArg:Lx(e.string(`jql`),`JQL`),secondary:r,body:tS(e,t,[`JQL: ${e.string(`jql`)??``}`,...n?.length?[`Fields: ${n.join(`, `)}`]:[]])})}}),jira_get_issue:Jx({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 jx({primaryArg:Lx(e.string(`issue_key`),`Issue`),secondary:n.map(e=>({text:e})),body:tS(e,t,[`Issue: ${e.string(`issue_key`)??``}`,...n.length>0?[`Include: ${n.join(`, `)}`]:[]])})}}),jira_get_project:Jx({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 jx({primaryArg:Lx(n),secondary:r.map(e=>({text:e})),body:tS(e,t,[`Project: ${n}`,...r.length>0?[`Include: ${r.join(`, `)}`]:[]])})}}),jira_create_issue:Jx({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=Ax({fields:[Dx(`Project`,t,{mono:!0}),Dx(`Type`,n),Dx(`Summary`,r),...Ox(`Parent`,e.string(`parent_key`),{mono:!0}),...Ox(`Priority`,e.string(`priority`)),...Ox(`Assignee`,Zx(e)),...Ox(`Labels`,Yx(e.strings(`labels`))),...Ox(`Components`,Yx(e.strings(`components`))),...Ox(`Custom fields`,Qx(e,`fields`),{mono:!0}),...kx(e)],text:{label:`Description`,text:e.string(`description`)??Xx(e.value(`description_adf`))}});return jx({primaryArg:Lx([t,n,r].filter(Boolean).join(` · `),`New Jira issue`),secondary:[...$x(e),...e.strings(`labels`)?[{text:Nx(e.strings(`labels`).length,`label`)}]:[]],body:i,safetyNotes:eS(e,`create an issue`)})}}),jira_update_issue:Jx({name:`jira_update_issue`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.string(`description`)??Xx(e.value(`description_adf`)),n=[...Ox(`Summary`,e.string(`summary`)),...Ox(`Priority`,e.string(`priority`)),...Ox(`Assignee`,Zx(e)),...Ox(`Labels`,Yx(e.strings(`labels`))),...Ox(`Field keys`,Qx(e,`fields`),{mono:!0}),...Ox(`Update ops`,Qx(e,`update`),{mono:!0})],r=n.length+(t===void 0?0:1),i=Ax({fields:[Dx(`Issue`,e.string(`issue_key`),{mono:!0}),...n,...e.boolean(`notify_users`)===!1?[Dx(`Notify users`,`no`)]:[],...kx(e)],text:t===void 0?void 0:{label:`Description`,text:t}});return jx({primaryArg:Lx(e.string(`issue_key`),`Issue`),secondary:[...$x(e),...r>0?[{text:Nx(r,`change`)}]:[]],body:i,safetyNotes:eS(e,`update the issue`)})}}),jira_add_comment:Jx({name:`jira_add_comment`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.record(`visibility`),n=Ax({fields:[Dx(`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`)??Xx(e.value(`body_adf`))}});return jx({primaryArg:Lx(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:Jx({name:`jira_transition_issue`,argumentRegion:`until-result`,completedView:`jira`,present:e=>{let t=e.string(`transition`)??`list available transitions`,n=e.string(`comment`)??Xx(e.value(`comment_adf`)),r=Ax({fields:[Dx(`Issue`,e.string(`issue_key`),{mono:!0}),Dx(`Transition`,e.string(`transition`)),...Ox(`Resolution`,e.string(`resolution`)),...Ox(`Field keys`,Qx(e,`fields`),{mono:!0}),...Ox(`Update ops`,Qx(e,`update`),{mono:!0}),...kx(e)],text:n===void 0?void 0:{label:`Comment`,text:n}});return jx({primaryArg:Lx([e.string(`issue_key`),t].filter(Boolean).join(` · `),`Issue transition`),secondary:$x(e),body:r,safetyNotes:eS(e,`transition the issue`)})}})};function nS(e){return e}function rS(e){if(e!==void 0)return e<1e3?`${e}ms`:`${e/1e3}s`}function iS(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 tie(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 ${rS(e.number(`timeoutMs`))}`}),a.length>0&&s.push({text:Nx(a.length,`env key`)}),e.boolean(`notify`)===!1&&s.push({text:`notifications off`});let c=Fx(n)??0,l=Rx(n,`bash`,{force:(n?.length??0)>500,label:`Command`});return l.kind===`none`&&t===`approval`&&(l=zx([[`Working directory`,i??`project root`,!0],[`Readiness`,o],[`Readiness timeout`,rS(e.number(`readyTimeoutMs`))],[`Runtime timeout`,rS(e.number(`timeoutMs`))],[`Environment keys`,a.join(`, `)],[`Notifications`,e.boolean(`notify`)===!1?`off`:`on`]])),jx({primaryArg:Lx(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 nie={task_start:nS({name:`task_start`,argumentRegion:`until-result`,completedView:`task_action`,present:tie}),task_status:nS({name:`task_status`,argumentRegion:`none`,completedView:`task_status`,emptyResult:`No tasks`,present:(e,t)=>{let n=iS(e),r=[];return n.count>1&&r.push({text:Nx(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`)}`}),jx({primaryArg:Lx(n.primary),secondary:r,body:t===`approval`?zx([[`Task selector`,n.primary]]):void 0})}}),task_logs:nS({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`)}`}),jx({primaryArg:Lx(e.string(`taskId`),`Task logs`),secondary:n,body:t===`approval`?zx([[`Task`,e.string(`taskId`)],[`Mode`,e.string(`mode`)??`recent`],[`Contains`,e.string(`contains`)],[`Regular expression`,e.string(`regex`)]]):void 0})}}),task_cancel:nS({name:`task_cancel`,argumentRegion:`none`,completedView:`task_action`,present:(e,t)=>{let n=iS(e),r=e.string(`signal`)??`SIGTERM`,i=[];return n.count>1&&i.push({text:Nx(n.count,`target`)}),i.push({text:r,tone:r===`SIGKILL`?`error`:`warning`}),e.number(`timeoutMs`)!==void 0&&i.push({text:`escalate after ${rS(e.number(`timeoutMs`))}`}),jx({primaryArg:Lx(n.primary),secondary:i,body:t===`approval`?zx([[`Targets`,(e.strings(`taskIds`)??[]).join(`, `)||n.primary],[`Signal`,r],[`Escalation timeout`,rS(e.number(`timeoutMs`))],[`Reason`,e.string(`reason`)]]):void 0,safetyNotes:[`Requests cancellation of the selected supervised task process.`]})}}),task_restart:nS({name:`task_restart`,argumentRegion:`none`,completedView:`task_action`,present:(e,t)=>jx({primaryArg:Lx(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:nS({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?[Px(i)]:[],c=e.string(`split_rationale`);return jx({primaryArg:Lx(a??(o>0?Nx(o,`agent`):void 0),`Explore`),secondary:o>0?[{text:Nx(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: ${Px(c)}`]:[]]})}}),plan_mode_enter:nS({name:`plan_mode_enter`,argumentRegion:`until-result`,completedView:`plan_mode`,present:e=>jx({primaryArg:Lx(`Enter planning mode`),body:e.string(`reason`)?{kind:`text-summary`,text:Px(e.string(`reason`))}:void 0})}),plan_mode_present:nS({name:`plan_mode_present`,argumentRegion:`until-result`,completedView:`plan_mode`,present:e=>{let t=e.string(`file_path`);return jx({primaryArg:t?{text:t.split(/[\\/]/).pop()||t,openPath:t}:Lx(`Plan review`),secondary:t?[{text:t,mono:!0,openPath:t}]:[],body:e.string(`summary`)?{kind:`text-summary`,text:Px(e.string(`summary`))}:void 0})}}),plan_mode_force_exit:nS({name:`plan_mode_force_exit`,argumentRegion:`until-result`,completedView:`plan_mode`,present:e=>jx({primaryArg:Lx(`Exit planning mode`),body:e.string(`reason`)?{kind:`text-summary`,text:Px(e.string(`reason`))}:void 0})})},rie={...Xre,...nie,...eie,...Qre},iie={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 jx({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 aS(e){return Ir.safeParse(e).success}function oS(e){return aS(e)?rie[e]:iie}function sS(e,t,n,r){return oS(e).present(gb(t),n,r)}var cS=new WeakMap;function lS(e,t){let n=cS.get(e);if(n)return n;let r=sie(e,t);return cS.set(e,r),r}function uS(e,t){if(!(e===void 0||e<=0))return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function dS(e,t){for(let[t,n]of e)if(t>5)return wx(t,n,`head`,5);return wx(t,`lines`)}function fS(e){return!!(e&&!e.replace(/\r\n/g,`
38
- `).replace(/\r/g,`
39
- `).includes(`
40
- `))}function pS(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:xx(e.downloadDir),openPath:e.downloadDir}:e.pageId?{text:e.pageId}:void 0;case`publish_pages`:return e.inputPath?{text:xx(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 oie(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 mS(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=uS(n.model.omittedLines,`line`),t=uS(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=uS(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 sie(e,t){let n=`previewOverflow`in t?t.previewOverflow:void 0,r=n?Tx(n.hidden,n.noun,n.direction):void 0,{tone:i,pulse:a}=Fre(t,e),o=t,s=sS(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(...mS(e)),{...c,primaryArg:t,meta:n,detailsAction:r??wx(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:Sx(n,`line`)}),e.live&&t.push({text:`streaming`,tone:`info`}),e.truncated&&t.push({text:`truncated`,tone:`warning`}),t.push(...mS(e,{includeLiveLimit:!1})),e.savedTo&&!pS(e,e.savedTo)&&t.push({text:`saved ${xx(e.savedTo)}`,mono:!0,openPath:e.savedTo});let i=Cx(e.command),a=Math.max(0,i-6),o=a+Math.max(0,n-6);return{...c,primaryArg:e.command?fS(e.command)?{text:e.command}:{text:`inline`}:void 0,meta:t,detailsAction:r??(a>0?Tx(o,`lines`,`mixed`):wx(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=Pre(e.durationMs);i&&t.push({text:i}),n>0&&t.push({text:Sx(n,`line`)}),e.live&&t.push({text:`streaming`,tone:`info`}),e.artifacts&&e.artifacts.length>0&&t.push({text:Sx(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(...mS(e)),e.savedTo&&!pS(e,e.savedTo)&&t.push({text:`saved ${xx(e.savedTo)}`,mono:!0,openPath:e.savedTo});let a=Math.max(0,e.codeLineCount-6)+Math.max(0,n-6),o=r??Tx(a,`lines`,`mixed`),s=e.inputMode===`file`&&e.relScriptPath?{text:e.relScriptPath,openPath:e.scriptPath}:e.code&&fS(e.code)?{text:e.code}:{text:`inline`};return{...c,primaryArg:s,meta:t,detailsAction:o}}case`edit`:{let t=[{text:Sx(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:Sx(e.diffLineCount,`diff line`)}),{...c,primaryArg:e.relPath?{text:e.relPath,openPath:e.path}:void 0,meta:t,detailsAction:r??wx(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:Sx(e.lineCount,`line`)}),e.charCount!==void 0&&t.push({text:Sx(e.charCount,`char`)}),{...c,primaryArg:e.relPath?{text:e.relPath,openPath:e.path}:void 0,meta:t,detailsAction:r??wx(e.lineCount??0,`lines`)}}case`grep`:return{...c,primaryArg:e.pattern?{text:e.pattern}:void 0,meta:[{text:Sx(e.matchCount,`match`,`es`)},{text:Sx(e.fileCount,`file`)}],detailsAction:r??wx(e.matchCount,`matches`)};case`find`:return{...c,primaryArg:e.pattern?{text:e.pattern}:void 0,meta:[{text:Sx(e.count,`file`)}],detailsAction:r??wx(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??wx(e.total,`entries`)};case`task_logs`:{let t=[{text:Sx(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??wx(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=Nre(e.size);return n&&t.push({text:n}),e.converted&&t.push({text:`markdown`,tone:`info`}),e.savedTo&&!pS(e,e.savedTo)&&t.push({text:`saved ${xx(e.savedTo)}`,mono:!0,openPath:e.savedTo}),t.push(...mS(e)),{...c,primaryArg:e.url?{text:e.url,href:e.url}:void 0,meta:t,detailsAction:r??wx(Cx(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:Sx(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:`${Sx(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(...mS(e));let i=r??dS([[e.issues.length,`issues`],[e.users.length,`users`],[e.transitions.length,`transitions`]],e.contentLineCount);return{...c,primaryArg:oie(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:Sx(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(...mS(e));let i=r??dS([[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:Sx(e.results.length,`result`)},...mS(e)],detailsAction:wx(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:Sx(e.outcomeCount??0,`outcome`)}]:[],detailsAction:r}}case`task_status`:return{...c,meta:[{text:Sx(e.taskCount,`task`,`s`)}],detailsAction:Tx(e.hiddenTaskCount,`tasks`,`head`)};case`explore`:{let{summary:t}=Ab(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 cie=new Set([`$$slots`,`$$events`,`$$legacy`]);function hS(e,t){let n=H(t,cie),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`}]];N(e,B({name:`mic`},()=>n,{get iconNode(){return r}}))}function gS(e,t,n){let r=n?{description:n}:void 0;e===`success`?Vn.success(t,r):e===`error`?Vn.error(t,r):Vn(t,r)}var _S={success(e,t={}){gS(`success`,e,t.description)},error(e,t={}){gS(`error`,e,t.description)},message(e,t={}){gS(`message`,e,t.description)}};function vS(e,t=`code block`){e?_S.success(`Copied ${t}`):_S.error(`Could not copy ${t}`)}async function lie(e){let t=globalThis.navigator?.clipboard;if(t?.writeText){await t.writeText(e);return}throw Error(`Clipboard API is not available.`)}var uie=`modulepreload`,die=function(e){return`/`+e},yS={},bS=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=die(t,n),t in yS)return;yS[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`:uie,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)})},xS={bash:()=>bS(()=>import(`./bash-B7CDPTg5.js`),__vite__mapDeps([0,1])),css:()=>bS(()=>import(`./css-BsVw1vtW.js`),[]),diff:()=>bS(()=>import(`./diff-woXpYk--.js`),[]),html:()=>bS(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([2,3,4])),javascript:()=>bS(()=>import(`./javascript-BgS3c2Ky.js`),[]),json:()=>bS(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>bS(()=>import(`./jsonc-CYpm1nAK.js`),[]),jsx:()=>bS(()=>import(`./jsx-Bz0zcwM4.js`),[]),markdown:()=>bS(()=>import(`./markdown-BYOwaDjH.js`),[]),python:()=>bS(()=>import(`./python-gzcpVVnB.js`),[]),shellscript:()=>bS(()=>import(`./shellscript-CLZ0U2zV.js`),[]),svelte:()=>bS(()=>import(`./svelte-Uaf2W_lJ.js`),__vite__mapDeps([5,3,4,6])),tsx:()=>bS(()=>import(`./tsx-udAQXfEw.js`),[]),typescript:()=>bS(()=>import(`./typescript-bsJCZSQ-.js`),[]),xml:()=>bS(()=>import(`./xml-DMbpbO54.js`),[]),yaml:()=>bS(()=>import(`./yaml-rwi0_p6S.js`),[])},fie={"github-light":()=>bS(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-dark-dimmed":()=>bS(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[])},pie=new Map([[``,`markdown`],[`text`,`markdown`],[`plain`,`markdown`],[`plaintext`,`markdown`],[`sh`,`bash`],[`shell`,`shellscript`],[`zsh`,`shellscript`],[`js`,`javascript`],[`ts`,`typescript`],[`md`,`markdown`],[`yml`,`yaml`]]),mie=new Set(Object.keys(xS)),SS,CS=new Vi(500);function wS(e){let t=(e??``).toLowerCase().trim();return pie.get(t)||(mie.has(t)?t:void 0)}function hie(e){return typeof window>`u`||typeof window.requestIdleCallback!=`function`?e():new Promise((t,n)=>{window.requestIdleCallback(()=>{e().then(t,n)},{timeout:750})})}async function gie(){return SS??=Promise.all([bS(()=>import(`./dist-Ci71hNpt.js`),[]),bS(()=>import(`./dist-FQvzRocB.js`),[])]).then(([e,t])=>{let n=e.createBundledHighlighter({langs:xS,themes:fie,engine:()=>t.createJavaScriptRegexEngine()});return e.createSingletonShorthands(n)}),SS}async function _ie(e,t){let n=wS(t);if(n)return hie(async()=>(await gie()).codeToHtml(e,{lang:n,themes:{light:`github-light`,dark:`github-dark-dimmed`},defaultColor:!1}))}function vie(e,t){return`${t}\0${e}`}function TS(e,t){let n=wS(t);if(!n)return;let r=vie(e,n),i=CS.get(r);if(i!==void 0||CS.has(r))return i;let a=_ie(e,n).then(e=>(CS.set(r,e),e)).catch(()=>{CS.delete(r)});return CS.set(r,a),a}var yie=0,ES=Promise.resolve();function DS(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 bie(e){let t=e.ownerDocument,n=t.documentElement,r=getComputedStyle(n),i=n.classList.contains(`dark`),a=DS(r,`--foreground`,`#000000`,t),o=DS(r,`--card`,`#ffffff`,t),s=DS(r,`--border`,`#808080`,t),c={dark:i,fontFamily:r.fontFamily||`sans-serif`,background:DS(r,`--background`,`#ffffff`,t),foreground:a,card:o,surface:i?OS(o,a,.1):o,primary:DS(r,`--primary`,`#000000`,t),border:s,strongBorder:i?OS(s,a,.3):s,mutedForeground:DS(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 kS(e){return e?.trim().toLowerCase()===`mermaid`}async function xie(e){let{default:t}=await bS(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 Sie(e,t){let{default:n}=await bS(async()=>{let{default:e}=await import(`./mermaid.core-mWIFQm8i.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-${++yie}`,{svg:i}=await n.render(r,e);return xie(i)}function AS(e,t){let n=bie(t),r=async()=>{try{let t=await Sie(e,n);return t?{ok:!0,svg:t,themeFingerprint:n.fingerprint}:{ok:!1,themeFingerprint:n.fingerprint}}catch{return{ok:!1,themeFingerprint:n.fingerprint}}},i=ES.then(r,r);return ES=i.then(()=>void 0,()=>void 0),i}function jS(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 Cie(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`,AS(i.source,i.host).then(n=>{if(r!==t||!i.host.isConnected||!e.contains(i.host))return;if(n.ok&&jS(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 wie=typeof self==`object`?self:globalThis,MS=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new wie[e](t)},Tie=(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(MS(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(MS(a,o),i)};return r},NS=e=>Tie(new Map,e)(0),PS=``,{toString:Eie}={},{keys:Die}=Object,FS=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Eie.call(e).slice(8,-1);switch(n){case`Array`:return[1,PS];case`Object`:return[2,PS];case`Date`:return[3,PS];case`RegExp`:return[4,PS];case`Map`:return[5,PS];case`Set`:return[6,PS];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},IS=([e,t])=>e===0&&(t===`function`||t===`symbol`),Oie=(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]=FS(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 Die(r))(e||!IS(FS(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||!(IS(FS(n))||IS(FS(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!IS(FS(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},LS=(e,{json:t,lossy:n}={})=>{let r=[];return Oie(!(t||n),!!t,new Map,r)(e),r},RS=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?NS(LS(e,t)):structuredClone(e):(e,t)=>NS(LS(e,t)),zS=VS(`end`),BS=VS(`start`);function VS(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 HS(e){let t=BS(e),n=zS(e);if(t&&n)return{start:t,end:n}}var US=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],WS={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...US,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...US],h2:[[`className`,`sr-only`]],img:[...US,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...US,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...US],table:[...US],ul:[...US,[`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(`.`)},GS={}.hasOwnProperty;function kie(e,t){let n={type:`root`,children:[]},r=KS({schema:t?{...WS,...t}:WS,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function KS(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return Aie(e,n);case`doctype`:return jie(e,n);case`element`:return Mie(e,n);case`root`:return Nie(e,n);case`text`:return Pie(e,n);default:}}}function Aie(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 XS(r,t),r}}function jie(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return XS(e,t),e}}function Mie(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=qS(e,t.children),i=Fie(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&&GS.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 XS(o,t),o}function Nie(e,t){let n={type:`root`,children:qS(e,t.children)};return XS(n,t),n}function Pie(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return XS(n,t),n}function qS(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=KS(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function Fie(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&GS.call(r,n)?r[n]:void 0,o=r&&GS.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(GS.call(s,l)){let t=s[l],n=JS(e,ZS(a,l),l,t);n??=JS(e,ZS(o,l),l,t),n!=null&&(c[l]=n)}if(i&&GS.call(i,n)){let e=i[n];for(l in e)GS.call(e,l)&&!GS.call(c,l)&&(c[l]=e[l])}return c}function JS(e,t,n,r){return t?Array.isArray(r)?Iie(e,t,n,r):YS(e,t,n,r):void 0}function Iie(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=YS(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function YS(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&Lie(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 Lie(e,t,n){let r=e.schema.protocols&&GS.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 XS(e,t){let n=HS(t);t.data&&(e.data=RS(t.data)),n&&(e.position=n)}function ZS(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 Rie(e){return function(t){return kie(t,e)}}var zie=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],QS=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};QS.prototype.normal={},QS.prototype.property={},QS.prototype.space=void 0;function $S(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new QS(n,r,t)}function eC(e){return e.toLowerCase()}var tC=class{constructor(e,t){this.attribute=t,this.property=e}};tC.prototype.attribute=``,tC.prototype.booleanish=!1,tC.prototype.boolean=!1,tC.prototype.commaOrSpaceSeparated=!1,tC.prototype.commaSeparated=!1,tC.prototype.defined=!1,tC.prototype.mustUseProperty=!1,tC.prototype.number=!1,tC.prototype.overloadedBoolean=!1,tC.prototype.property=``,tC.prototype.spaceSeparated=!1,tC.prototype.space=void 0;var nC=e({boolean:()=>rC,booleanish:()=>iC,commaOrSpaceSeparated:()=>lC,commaSeparated:()=>cC,number:()=>oC,overloadedBoolean:()=>aC,spaceSeparated:()=>sC}),Bie=0,rC=uC(),iC=uC(),aC=uC(),oC=uC(),sC=uC(),cC=uC(),lC=uC();function uC(){return 2**++Bie}var dC=Object.keys(nC),fC=class extends tC{constructor(e,t,n,r){let i=-1;if(super(e,t),pC(this,`space`,r),typeof n==`number`)for(;++i<dC.length;){let e=dC[i];pC(this,dC[i],(n&nC[e])===nC[e])}}};fC.prototype.defined=!0;function pC(e,t,n){n&&(e[t]=n)}function mC(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new fC(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[eC(r)]=r,n[eC(a.attribute)]=r}return new QS(t,n,e.space)}var hC=mC({properties:{ariaActiveDescendant:null,ariaAtomic:iC,ariaAutoComplete:null,ariaBusy:iC,ariaChecked:iC,ariaColCount:oC,ariaColIndex:oC,ariaColSpan:oC,ariaControls:sC,ariaCurrent:null,ariaDescribedBy:sC,ariaDetails:null,ariaDisabled:iC,ariaDropEffect:sC,ariaErrorMessage:null,ariaExpanded:iC,ariaFlowTo:sC,ariaGrabbed:iC,ariaHasPopup:null,ariaHidden:iC,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:sC,ariaLevel:oC,ariaLive:null,ariaModal:iC,ariaMultiLine:iC,ariaMultiSelectable:iC,ariaOrientation:null,ariaOwns:sC,ariaPlaceholder:null,ariaPosInSet:oC,ariaPressed:iC,ariaReadOnly:iC,ariaRelevant:null,ariaRequired:iC,ariaRoleDescription:sC,ariaRowCount:oC,ariaRowIndex:oC,ariaRowSpan:oC,ariaSelected:iC,ariaSetSize:oC,ariaSort:null,ariaValueMax:oC,ariaValueMin:oC,ariaValueNow:oC,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function gC(e,t){return t in e?e[t]:t}function _C(e,t){return gC(e,t.toLowerCase())}var Vie=mC({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:cC,acceptCharset:sC,accessKey:sC,action:null,allow:null,allowFullScreen:rC,allowPaymentRequest:rC,allowUserMedia:rC,alt:null,as:null,async:rC,autoCapitalize:null,autoComplete:sC,autoFocus:rC,autoPlay:rC,blocking:sC,capture:null,charSet:null,checked:rC,cite:null,className:sC,cols:oC,colSpan:null,content:null,contentEditable:iC,controls:rC,controlsList:sC,coords:oC|cC,crossOrigin:null,data:null,dateTime:null,decoding:null,default:rC,defer:rC,dir:null,dirName:null,disabled:rC,download:aC,draggable:iC,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:rC,formTarget:null,headers:sC,height:oC,hidden:aC,high:oC,href:null,hrefLang:null,htmlFor:sC,httpEquiv:sC,id:null,imageSizes:null,imageSrcSet:null,inert:rC,inputMode:null,integrity:null,is:null,isMap:rC,itemId:null,itemProp:sC,itemRef:sC,itemScope:rC,itemType:sC,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:rC,low:oC,manifest:null,max:null,maxLength:oC,media:null,method:null,min:null,minLength:oC,multiple:rC,muted:rC,name:null,nonce:null,noModule:rC,noValidate:rC,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:rC,optimum:oC,pattern:null,ping:sC,placeholder:null,playsInline:rC,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:rC,referrerPolicy:null,rel:sC,required:rC,reversed:rC,rows:oC,rowSpan:oC,sandbox:sC,scope:null,scoped:rC,seamless:rC,selected:rC,shadowRootClonable:rC,shadowRootDelegatesFocus:rC,shadowRootMode:null,shape:null,size:oC,sizes:null,slot:null,span:oC,spellCheck:iC,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oC,step:null,style:null,tabIndex:oC,target:null,title:null,translate:null,type:null,typeMustMatch:rC,useMap:null,value:iC,width:oC,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:sC,axis:null,background:null,bgColor:null,border:oC,borderColor:null,bottomMargin:oC,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:rC,declare:rC,event:null,face:null,frame:null,frameBorder:null,hSpace:oC,leftMargin:oC,link:null,longDesc:null,lowSrc:null,marginHeight:oC,marginWidth:oC,noResize:rC,noHref:rC,noShade:rC,noWrap:rC,object:null,profile:null,prompt:null,rev:null,rightMargin:oC,rules:null,scheme:null,scrolling:iC,standby:null,summary:null,text:null,topMargin:oC,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oC,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:rC,disableRemotePlayback:rC,prefix:null,property:null,results:oC,security:null,unselectable:null},space:`html`,transform:_C}),Hie=mC({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:lC,accentHeight:oC,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oC,amplitude:oC,arabicForm:null,ascent:oC,attributeName:null,attributeType:null,azimuth:oC,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oC,by:null,calcMode:null,capHeight:oC,className:sC,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:oC,diffuseConstant:oC,direction:null,display:null,dur:null,divisor:oC,dominantBaseline:null,download:rC,dx:null,dy:null,edgeMode:null,editable:null,elevation:oC,enableBackground:null,end:null,event:null,exponent:oC,externalResourcesRequired:null,fill:null,fillOpacity:oC,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:cC,g2:cC,glyphName:cC,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oC,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oC,horizOriginX:oC,horizOriginY:oC,id:null,ideographic:oC,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oC,k:oC,k1:oC,k2:oC,k3:oC,k4:oC,kernelMatrix:lC,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oC,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:oC,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:oC,overlineThickness:oC,paintOrder:null,panose1:null,path:null,pathLength:oC,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:sC,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oC,pointsAtY:oC,pointsAtZ:oC,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:lC,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:lC,rev:lC,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:lC,requiredFeatures:lC,requiredFonts:lC,requiredFormats:lC,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:oC,specularExponent:oC,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oC,strikethroughThickness:oC,string:null,stroke:null,strokeDashArray:lC,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oC,strokeOpacity:oC,strokeWidth:null,style:null,surfaceScale:oC,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:lC,tabIndex:oC,tableValues:null,target:null,targetX:oC,targetY:oC,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:lC,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oC,underlineThickness:oC,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oC,values:null,vAlphabetic:oC,vMathematical:oC,vectorEffect:null,vHanging:oC,vIdeographic:oC,version:null,vertAdvY:oC,vertOriginX:oC,vertOriginY:oC,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oC,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:gC}),vC=mC({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()}}),yC=mC({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:_C}),bC=mC({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Uie=/[A-Z]/g,xC=/-[a-z]/g,Wie=/^data[-\w.:]+$/i;function Gie(e,t){let n=eC(t),r=t,i=tC;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Wie.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(xC,qie);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!xC.test(e)){let n=e.replace(Uie,Kie);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=fC}return new i(r,t)}function Kie(e){return`-`+e.toLowerCase()}function qie(e){return e.charAt(1).toUpperCase()}var Jie=$S([hC,Vie,vC,yC,bC],`html`),SC=$S([hC,Hie,vC,yC,bC],`svg`),CC={}.hasOwnProperty;function Yie(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&CC.call(t,e)){let n=String(t[e]);i=CC.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 Xie=/["&'<>`]/g,Zie=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Qie=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$ie=/[|\\{}()[\]^$+*?.]/g,wC=new WeakMap;function eae(e,t){if(e=e.replace(t.subset?tae(t.subset):Xie,r),t.subset||t.escapeOnly)return e;return e.replace(Zie,n).replace(Qie,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 tae(e){let t=wC.get(e);return t||(t=nae(e),wC.set(e,t)),t}function nae(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace($ie,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var rae=/[\dA-Fa-f]/;function iae(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!rae.test(String.fromCharCode(t))?r:r+`;`}var aae=/\d/;function oae(e,t,n){let r=`&#`+String(e);return n&&t&&!aae.test(String.fromCharCode(t))?r:r+`;`}var sae=`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(`.`),TC={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:`€`},cae=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],EC={}.hasOwnProperty,DC={},OC;for(OC in TC)EC.call(TC,OC)&&(DC[TC[OC]]=OC);var lae=/[^\dA-Za-z]/;function uae(e,t,n,r){let i=String.fromCharCode(e);if(EC.call(DC,i)){let e=DC[i],a=`&`+e;return n&&sae.includes(e)&&!cae.includes(e)&&(!r||t&&t!==61&&lae.test(String.fromCharCode(t)))?a:a+`;`}return``}function dae(e,t,n){let r=iae(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=uae(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=oae(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function kC(e,t){return eae(e,Object.assign({format:dae},t))}var fae=/^>|^->|<!--|-->|--!>|<!-$/g,pae=[`>`],mae=[`<`,`>`];function hae(e,t,n,r){return r.settings.bogusComments?`<?`+kC(e.value,Object.assign({},r.settings.characterReferences,{subset:pae}))+`>`:`<!--`+e.value.replace(fae,i)+`-->`;function i(e){return kC(e,Object.assign({},r.settings.characterReferences,{subset:mae}))}}function gae(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function AC(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 _ae(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function vae(e){return e.join(` `).trim()}var yae=/[ \t\n\f\r]/g;function jC(e){return typeof e==`object`?e.type===`text`?MC(e.value):!1:MC(e)}function MC(e){return e.replace(yae,``)===``}var NC=FC(1),PC=FC(-1),bae=[];function FC(e){return t;function t(t,n,r){let i=t?t.children:bae,a=(n||0)+e,o=i[a];if(!r)for(;o&&jC(o);)a+=e,o=i[a];return o}}var xae={}.hasOwnProperty;function IC(e){return t;function t(t,n,r){return xae.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var LC=IC({body:Cae,caption:RC,colgroup:RC,dd:Dae,dt:Eae,head:RC,html:Sae,li:Tae,optgroup:Oae,option:kae,p:wae,rp:zC,rt:zC,tbody:jae,td:BC,tfoot:Mae,th:BC,thead:Aae,tr:Nae});function RC(e,t,n){let r=NC(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&jC(r.value.charAt(0)))}function Sae(e,t,n){let r=NC(n,t);return!r||r.type!==`comment`}function Cae(e,t,n){let r=NC(n,t);return!r||r.type!==`comment`}function wae(e,t,n){let r=NC(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 Tae(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Eae(e,t,n){let r=NC(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Dae(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function zC(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Oae(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function kae(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Aae(e,t,n){let r=NC(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function jae(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Mae(e,t,n){return!NC(n,t)}function Nae(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function BC(e,t,n){let r=NC(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Pae=IC({body:Lae,colgroup:Rae,head:Iae,html:Fae,tbody:zae});function Fae(e){let t=NC(e,-1);return!t||t.type!==`comment`}function Iae(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 Lae(e){let t=NC(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&jC(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function Rae(e,t,n){let r=PC(n,t),i=NC(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&LC(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function zae(e,t,n){let r=PC(n,t),i=NC(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&LC(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var VC={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 Bae(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=SC);let l=Vae(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Pae(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||!LC(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Vae(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Hae(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 Hae(e,t,n){let r=Gie(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=kC(r.attribute,Object.assign({},e.settings.characterReferences,{subset:VC.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?_ae:vae)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=kC(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:VC.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&AC(n,o)>AC(n,e.alternative)&&(o=e.alternative),s=o+kC(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?VC.single:VC.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Uae=[`<`,`&`];function HC(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:kC(e.value,Object.assign({},r.settings.characterReferences,{subset:Uae}))}function Wae(e,t,n,r){return r.settings.allowDangerousHtml?e.value:HC(e,t,n,r)}function Gae(e,t,n,r){return r.all(e)}var Kae=Yie(`type`,{invalid:qae,unknown:Jae,handlers:{comment:hae,doctype:gae,element:Bae,raw:Wae,root:Gae,text:HC}});function qae(e){throw Error("Expected node, not `"+e+"`")}function Jae(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Yae={},Xae={},Zae=[];function UC(e,t){let n=t||Yae,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Qae,all:$ae,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||zie,characterReferences:n.characterReferences||Xae,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?SC:Jie,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Qae(e,t,n){return Kae(e,t,n,this)}function $ae(e){let t=[],n=e&&e.children||Zae,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}function eoe(e){let t=this,n={...t.data(`settings`),...e};t.compiler=r;function r(e){return UC(e,n)}}function toe(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}var WC=(function(e){if(e==null)return aoe;if(typeof e==`function`)return GC(e);if(typeof e==`object`)return Array.isArray(e)?noe(e):roe(e);if(typeof e==`string`)return ioe(e);throw Error(`Expected function, string, or object as test`)});function noe(e){let t=[],n=-1;for(;++n<e.length;)t[n]=WC(e[n]);return GC(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function roe(e){let t=e;return GC(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ioe(e){return GC(t);function t(t){return t&&t.type===e}}function GC(e){return t;function t(t,n,r){return!!(ooe(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function aoe(){return!0}function ooe(e){return typeof e==`object`&&!!e&&`type`in e}function soe(e){return e}var KC=[];function qC(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=WC(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 (`+soe(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=KC,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=coe(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 coe(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?KC:[e]}function JC(e,t,n){let r=WC((n||{}).ignore||[]),i=loe(t),a=-1;for(;++a<i.length;)qC(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 loe(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([uoe(e[0]),doe(e[1])])}return t}function uoe(e){return typeof e==`string`?new RegExp(toe(e),`g`):e}function doe(e){return typeof e==`function`?e:function(){return e}}function foe(e){JC(e,[/\r?\n|\r/g,poe])}function poe(){return{type:`break`}}function moe(){return function(e){foe(e)}}var YC=iw(/[A-Za-z]/),XC=iw(/[\dA-Za-z]/),hoe=iw(/[#-'*+\--9=?A-Z^-~]/);function ZC(e){return e!==null&&(e<32||e===127)}var QC=iw(/\d/),goe=iw(/[\dA-Fa-f]/),_oe=iw(/[!-/:-@[-`{-~]/);function $C(e){return e!==null&&e<-2}function ew(e){return e!==null&&(e<0||e===32)}function tw(e){return e===-2||e===-1||e===32}var nw=iw(/\p{P}|\p{S}/u),rw=iw(/\s/);function iw(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var aw=`phrasing`,ow=[`autolink`,`link`,`image`,`label`];function voe(){return{transforms:[Toe],enter:{literalAutolink:boe,literalAutolinkEmail:sw,literalAutolinkHttp:sw,literalAutolinkWww:sw},exit:{literalAutolink:woe,literalAutolinkEmail:Coe,literalAutolinkHttp:xoe,literalAutolinkWww:Soe}}}function yoe(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:aw,notInConstruct:ow},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:aw,notInConstruct:ow},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:aw,notInConstruct:ow}]}}function boe(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function sw(e){this.config.enter.autolinkProtocol.call(this,e)}function xoe(e){this.config.exit.autolinkProtocol.call(this,e)}function Soe(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 Coe(e){this.config.exit.autolinkEmail.call(this,e)}function woe(e){this.exit(e)}function Toe(e){JC(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Eoe],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Doe]],{ignore:[`link`,`linkReference`]})}function Eoe(e,t,n,r,i){let a=``;if(!cw(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Ooe(n)))return!1;let o=koe(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 Doe(e,t,n,r){return!cw(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Ooe(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 koe(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=AC(e,`(`),a=AC(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 cw(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||rw(n)||nw(n))&&(!t||n!==47)}function lw(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}uw.peek=Roe;function Aoe(){this.buffer()}function joe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Moe(){this.buffer()}function Noe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Poe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=lw(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Foe(e){this.exit(e)}function Ioe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=lw(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Loe(e){this.exit(e)}function Roe(){return`[`}function uw(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 zoe(){return{enter:{gfmFootnoteCallString:Aoe,gfmFootnoteCall:joe,gfmFootnoteDefinitionLabelString:Moe,gfmFootnoteDefinition:Noe},exit:{gfmFootnoteCallString:Poe,gfmFootnoteCall:Foe,gfmFootnoteDefinitionLabelString:Ioe,gfmFootnoteDefinition:Loe}}}function Boe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:uw},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?dw:Voe))),s(),o}}function Voe(e,t,n){return t===0?e:dw(e,t,n)}function dw(e,t,n){return(n?``:` `)+e}var Hoe=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];fw.peek=qoe;function Uoe(){return{canContainEols:[`delete`],enter:{strikethrough:Goe},exit:{strikethrough:Koe}}}function Woe(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Hoe}],handlers:{delete:fw}}}function Goe(e){this.enter({type:`delete`,children:[]},e)}function Koe(e){this.exit(e)}function fw(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 qoe(){return`~`}function Joe(e){return e.length}function Yoe(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Joe,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=Xoe(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]=pw(r[d]);else{let e=pw(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 Xoe(e){return e==null?``:String(e)}function pw(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 Zoe(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()),Qoe);return i(),o}function Qoe(e,t,n){return`>`+(n?``:` `)+e}function $oe(e,t){return mw(e,t.inConstruct,!0)&&!mw(e,t.notInConstruct,!1)}function mw(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 hw(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
51
- `&&$oe(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
52
- `}function ese(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 tse(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 nse(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rse(e,t,n,r){let i=nse(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(tse(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,ise);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(ese(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 ise(e,t,n){return(n?``:` `)+e}function gw(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=gw(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 ose(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function _w(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function vw(e){if(e===null||ew(e)||rw(e))return 1;if(nw(e))return 2}function yw(e,t,n){let r=vw(e),i=vw(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}}bw.peek=sse;function bw(e,t,n,r){let i=ose(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=yw(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=_w(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yw(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+_w(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function sse(e,t,n){return n.options.emphasis||`*`}function xw(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),qC(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 cse={};function Sw(e,t){let n=t||cse;return Cw(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Cw(e,t,n){if(lse(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 ww(e.children,t,n)}return Array.isArray(e)?ww(e,t,n):``}function ww(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Cw(e[i],t,n);return r.join(``)}function lse(e){return!!(e&&typeof e==`object`)}function use(e,t){let n=!1;return xw(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)&&Sw(e)&&(t.options.setext||n))}function dse(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(use(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=_w(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Tw.peek=fse;function Tw(e){return e.value||``}function fse(){return`<`}Ew.peek=pse;function Ew(e,t,n,r){let i=gw(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 pse(){return`!`}Dw.peek=mse;function Dw(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 mse(){return`!`}Ow.peek=hse;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 hse(){return"`"}function kw(e,t){let n=Sw(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))}Aw.peek=gse;function Aw(e,t,n,r){let i=gw(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(kw(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 gse(e,t,n){return kw(e,n)?`<`:`[`}jw.peek=_se;function jw(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 _se(){return`[`}function Mw(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 vse(e){let t=Mw(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 yse(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Nw(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 bse(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?yse(n):Mw(n),s=e.ordered?o===`.`?`)`:`.`:vse(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),Nw(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 xse(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 Sse(e,t,n,r){let i=xse(n),a=n.bulletCurrent||Mw(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 Cse(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var wse=WC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Tse(e,t,n,r){return(e.children.some(function(e){return wse(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Ese(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Pw.peek=Dse;function Pw(e,t,n,r){let i=Ese(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=yw(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=_w(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yw(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+_w(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Dse(e,t,n){return n.options.strong||`*`}function Ose(e,t,n,r){return n.safe(e.value,r)}function kse(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 Ase(e,t,n){let r=(Nw(n)+(n.options.ruleSpaces?` `:``)).repeat(kse(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Fw={blockquote:Zoe,break:hw,code:rse,definition:ase,emphasis:bw,hardBreak:hw,heading:dse,html:Tw,image:Ew,imageReference:Dw,inlineCode:Ow,link:Aw,linkReference:jw,list:bse,listItem:Sse,paragraph:Cse,root:Tse,strong:Pw,text:Ose,thematicBreak:Ase},Iw=document.createElement(`i`);function Lw(e){let t=`&`+e+`;`;Iw.innerHTML=t;let n=Iw.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Rw(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 jse=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Mse(e){return e.replace(jse,Nse)}function Nse(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Rw(n.slice(t?2:1),t?16:10)}return Lw(n)||e}function Pse(){return{enter:{table:Fse,tableData:Bw,tableHeader:Bw,tableRow:Lse},exit:{codeText:Rse,table:Ise,tableData:zw,tableHeader:zw,tableRow:zw}}}function Fse(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 Ise(e){this.exit(e),this.data.inTable=void 0}function Lse(e){this.enter({type:`tableRow`,children:[]},e)}function zw(e){this.exit(e)}function Bw(e){this.enter({type:`tableCell`,children:[]},e)}function Rse(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zse));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function zse(e,t){return t===`|`?t:e}function Bse(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 Yoe(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=Fw.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Vse(){return{exit:{taskListCheckValueChecked:Vw,taskListCheckValueUnchecked:Vw,paragraph:Use}}}function Hse(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Wse}}}function Vw(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Use(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 Wse(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=Fw.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 Gse(){return[voe(),zoe(),Uoe(),Pse(),Vse()]}function Kse(e){return{extensions:[yoe(),Boe(e),Woe(),Bse(e),Hse()]}}function Hw(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 Uw(e,t){return e.length>0?(Hw(e,e.length,0,t),e):t}var Ww={}.hasOwnProperty;function Gw(e){let t={},n=-1;for(;++n<e.length;)qse(t,e[n]);return t}function qse(e,t){let n;for(n in t){let r=(Ww.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ww.call(r,a)||(r[a]=[]);let e=i[a];Kw(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Kw(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Hw(e,0,0,r)}var qw={tokenize:sT,partial:!0},Jw={tokenize:cT,partial:!0},Yw={tokenize:lT,partial:!0},Xw={tokenize:uT,partial:!0},Zw={tokenize:dT,partial:!0},Qw={name:`wwwAutolink`,tokenize:aT,previous:fT},$w={name:`protocolAutolink`,tokenize:oT,previous:pT},eT={name:`emailAutolink`,tokenize:iT,previous:mT},tT={};function nT(){return{text:tT}}for(var rT=48;rT<123;)tT[rT]=eT,rT++,rT===58?rT=65:rT===91&&(rT=97);tT[43]=eT,tT[45]=eT,tT[46]=eT,tT[95]=eT,tT[72]=[eT,$w],tT[104]=[eT,$w],tT[87]=[eT,Qw],tT[119]=[eT,Qw];function iT(e,t,n){let r=this,i,a;return o;function o(t){return!hT(t)||!mT.call(r,r.previous)||gT(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return hT(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Zw,u,l)(t):t===45||t===95||XC(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&&YC(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function aT(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!fT.call(r,r.previous)||gT(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(qw,e.attempt(Jw,e.attempt(Yw,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function oT(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&pT.call(r,r.previous)&&!gT(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(YC(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||ZC(t)||ew(t)||rw(t)||nw(t)?n(t):e.attempt(Jw,e.attempt(Yw,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function sT(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 cT(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Xw,c,s)(t):t===null||ew(t)||rw(t)||t!==45&&nw(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 lT(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(Xw,t,a)(o):o===null||ew(o)||rw(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function uT(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||ew(o)||rw(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||ew(e)||rw(e)?t(e):r(e)}function a(e){return YC(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):YC(t)?(e.consume(t),o):n(t)}}function dT(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return XC(e)?n(e):t(e)}}function fT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ew(e)}function pT(e){return!YC(e)}function mT(e){return!(e===47||hT(e))}function hT(e){return e===43||e===45||e===46||e===95||XC(e)}function gT(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 _T(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&XC(e.charCodeAt(n+1))&&XC(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 vT(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 yT={name:`attention`,resolveAll:bT,tokenize:xT};function bT(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};ST(d,-c),ST(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=Uw(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Uw(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Uw(l,vT(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Uw(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=Uw(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Hw(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 xT(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=vw(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=vw(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 ST(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var CT={name:`autolink`,tokenize:wT};function wT(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 YC(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||XC(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||XC(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||ZC(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):hoe(t)?(e.consume(t),l):n(t)}function u(e){return XC(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||XC(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function TT(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return tw(r)?(e.enter(n),s(r)):t(r)}function s(r){return tw(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var ET={partial:!0,tokenize:DT};function DT(e,t,n){return r;function r(t){return tw(t)?TT(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$C(e)?t(e):n(e)}}var OT={continuation:{tokenize:AT},exit:jT,name:`blockQuote`,tokenize:kT};function kT(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 tw(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function AT(e,t,n){let r=this;return i;function i(t){return tw(t)?TT(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(OT,t,n)(r)}}function jT(e){e.exit(`blockQuote`)}var MT={name:`characterEscape`,tokenize:NT};function NT(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 _oe(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var PT={name:`characterReference`,tokenize:FT};function FT(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=XC,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=goe,u):(e.enter(`characterReferenceValue`),a=7,o=QC,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===XC&&!Lw(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 IT={partial:!0,tokenize:zT},LT={concrete:!0,name:`codeFenced`,tokenize:RT};function RT(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`),tw(t)?TT(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$C(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(IT,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$C(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):tw(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),TT(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$C(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$C(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&&tw(t)?TT(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$C(t)?e.check(IT,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$C(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`),tw(t)?TT(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`),tw(t)?TT(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$C(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function zT(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 BT={name:`codeIndented`,tokenize:HT},VT={partial:!0,tokenize:UT};function HT(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),TT(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):$C(t)?e.attempt(VT,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||$C(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function UT(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):$C(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):TT(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):$C(e)?i(e):n(e)}}var WT={name:`codeText`,previous:KT,resolve:GT,tokenize:qT};function GT(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 KT(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function qT(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)):$C(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||$C(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 JT=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&&YT(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),YT(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),YT(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);YT(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);YT(this.left,t.reverse())}}};function YT(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 XT(e){let t={},n=-1,r,i,a,o,s,c,l,u=new JT(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,ZT(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 Hw(e,0,1/0,u.slice(0)),!l}function ZT(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 QT={resolve:eE,tokenize:tE},$T={partial:!0,tokenize:nE};function eE(e){return XT(e),e}function tE(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):$C(t)?e.check($T,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 nE(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),TT(e,a,`linePrefix`)}function a(i){if(i===null||$C(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 rE(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||ZC(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||$C(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||ew(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||ZC(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 iE(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):$C(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||$C(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!tw(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function aE(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):$C(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),TT(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$C(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 oE(e,t){let n;return r;function r(i){return $C(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):tw(i)?TT(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var sE={name:`definition`,tokenize:lE},cE={partial:!0,tokenize:uE};function lE(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return iE.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=lw(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 ew(t)?oE(e,l)(t):l(t)}function l(t){return rE(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(cE,d,d)(t)}function d(t){return tw(t)?TT(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$C(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function uE(e,t,n){return r;function r(t){return ew(t)?oE(e,i)(t):n(t)}function i(t){return aE(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return tw(t)?TT(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$C(e)?t(e):n(e)}}var dE={name:`hardBreakEscape`,tokenize:fE};function fE(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $C(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var pE={name:`headingAtx`,resolve:mE,tokenize:hE};function mE(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`},Hw(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function hE(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||ew(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$C(n)?(e.exit(`atxHeading`),t(n)):tw(n)?TT(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||ew(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var gE=`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(`.`),_E=[`pre`,`script`,`style`,`textarea`],vE={concrete:!0,name:`htmlFlow`,resolveTo:xE,tokenize:SE},yE={partial:!0,tokenize:wE},bE={partial:!0,tokenize:CE};function xE(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 SE(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):YC(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):YC(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 YC(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||ew(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&_E.includes(l)?(i=1,r.interrupt?t(s):O(s)):gE.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||XC(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 tw(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||YC(t)?(e.consume(t),b):tw(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||XC(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):tw(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):tw(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$C(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||ew(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||tw(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$C(t)?O(t):tw(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),ie):t===63&&i===3?(e.consume(t),re):t===93&&i===5?(e.consume(t),M):$C(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(yE,N,ee)(t)):t===null||$C(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(bE,te,N)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),k}function k(t){return t===null||$C(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 _E.includes(n)?(e.consume(t),ie):O(t)}return YC(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),ie):t===45&&i===2?(e.consume(t),re):O(t)}function ie(t){return t===null||$C(t)?(e.exit(`htmlFlowData`),N(t)):(e.consume(t),ie)}function N(n){return e.exit(`htmlFlow`),t(n)}}function CE(e,t,n){let r=this;return i;function i(t){return $C(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 wE(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(ET,t,n)}}var TE={name:`htmlText`,tokenize:EE};function EE(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):YC(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):YC(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):$C(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):$C(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):$C(t)?(o=v,ne(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$C(t)?(o=y,ne(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return YC(t)?(e.consume(t),S):n(t)}function S(t){return t===45||XC(t)?(e.consume(t),S):C(t)}function C(t){return $C(t)?(o=C,ne(t)):tw(t)?(e.consume(t),C):A(t)}function w(t){return t===45||XC(t)?(e.consume(t),w):t===47||t===62||ew(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||YC(t)?(e.consume(t),E):$C(t)?(o=T,ne(t)):tw(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||XC(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$C(t)?(o=D,ne(t)):tw(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):$C(t)?(o=O,ne(t)):tw(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):$C(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||ew(t)?T(t):(e.consume(t),te)}function k(e){return e===47||e===62||ew(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 tw(t)?TT(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 DE={name:`labelEnd`,resolveAll:jE,resolveTo:ME,tokenize:NE},OE={tokenize:PE},kE={tokenize:FE},AE={tokenize:IE};function jE(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&&Hw(e,0,e.length,n),e}function ME(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=Uw(s,e.slice(a+1,a+r+3)),s=Uw(s,[[`enter`,u,t]]),s=Uw(s,vT(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Uw(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Uw(s,e.slice(o+1)),s=Uw(s,[[`exit`,c,t]]),Hw(e,a,e.length,s),e}function NE(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(lw(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(OE,u,o?u:d)(t):t===91?e.attempt(kE,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(AE,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function PE(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 ew(t)?oE(e,a)(t):a(t)}function a(t){return t===41?u(t):rE(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return ew(t)?oE(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?aE(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return ew(t)?oE(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 FE(e,t,n){let r=this;return i;function i(t){return iE.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(lw(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function IE(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 LE={name:`labelStartImage`,resolveAll:DE.resolveAll,tokenize:RE};function RE(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 zE={name:`labelStartLink`,resolveAll:DE.resolveAll,tokenize:BE};function BE(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 VE={name:`lineEnding`,tokenize:HE};function HE(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),TT(e,t,`linePrefix`)}}var UE={name:`thematicBreak`,tokenize:WE};function WE(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||$C(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),tw(t)?TT(e,s,`whitespace`)(t):s(t))}}var GE={continuation:{tokenize:YE},exit:ZE,name:`list`,tokenize:JE},KE={partial:!0,tokenize:QE},qE={partial:!0,tokenize:XE};function JE(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:QC(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(UE,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 QC(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(ET,r.interrupt?n:u,e.attempt(KE,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return tw(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 YE(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ET,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,TT(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!tw(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(qE,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,TT(e,e.attempt(GE,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function XE(e,t,n){let r=this;return TT(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 ZE(e){e.exit(this.containerState.type)}function QE(e,t,n){let r=this;return TT(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!tw(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var $E={name:`setextUnderline`,resolveTo:eD,tokenize:tD};function eD(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 tD(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`),tw(t)?TT(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$C(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var nD={tokenize:uD,partial:!0};function rD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:sD,continuation:{tokenize:cD},exit:lD}},text:{91:{name:`gfmFootnoteCall`,tokenize:oD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:iD,resolveTo:aD}}}}function iD(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=lw(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 aD(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 oD(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||ew(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(lw(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return ew(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 sD(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||ew(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=lw(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return ew(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),TT(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function cD(e,t,n){return e.check(ET,t,e.attempt(nD,t,n))}function lD(e){e.exit(`gfmFootnoteDefinition`)}function uD(e,t,n){let r=this;return TT(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 dD(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&&Hw(o,o.length,0,vT(s,e.slice(r+1,n),t)),Hw(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Hw(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=vw(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=vw(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var fD=class{constructor(){this.map=[]}add(e,t,n){pD(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 pD(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 mD(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 hD(){return{flow:{null:{name:`table`,tokenize:gD,resolveAll:_D}}}}function gD(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):$C(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):tw(t)?TT(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||ew(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,tw(t)?TT(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 tw(t)?TT(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||$C(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 tw(t)?TT(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$C(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||$C(n)?(e.exit(`tableRow`),t(n)):tw(n)?TT(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||ew(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 _D(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 fD;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(yD(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=vD(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=vD(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=vD(f,t,o,i,n,d)):(o[0]=o[1],d=vD(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&yD(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=mD(t.events,n))}return e}function vD(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},bD(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=bD(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=bD(t.events,n[2]),a=bD(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({},bD(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function yD(e,t,n,r,i){let a=[],o=bD(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 bD(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var xD={name:`tasklistCheck`,tokenize:CD};function SD(){return{text:{91:xD}}}function CD(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 ew(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 $C(r)?t(r):tw(r)?e.check({tokenize:wD},t,n)(r):n(r)}}function wD(e,t,n){return TT(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function TD(e){return Gw([nT(),rD(),dD(e),hD(),SD()])}var ED={};function DD(e){let t=this,n=e||ED,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(TD(n)),a.push(Gse()),o.push(Kse(n))}var OD={tokenize:kD};function kD(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`),TT(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 $C(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var AD={tokenize:MD},jD={tokenize:ND};function MD(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 Hw(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(jD,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(jD,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 $C(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++;Hw(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 ND(e,t,n){return TT(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var PD={tokenize:FD};function FD(e){let t=this,n=e.attempt(ET,r,e.attempt(this.parser.constructs.flowInitial,i,TT(e,e.attempt(this.parser.constructs.flow,i,e.attempt(QT,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 ID={resolveAll:BD()},LD=zD(`string`),RD=zD(`text`);function zD(e){return{resolveAll:BD(e===`text`?VD: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 BD(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 VD(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 HD=e({attentionMarkers:()=>XD,contentInitial:()=>WD,disable:()=>ZD,document:()=>UD,flow:()=>KD,flowInitial:()=>GD,insideSpan:()=>YD,string:()=>qD,text:()=>JD}),UD={42:GE,43:GE,45:GE,48:GE,49:GE,50:GE,51:GE,52:GE,53:GE,54:GE,55:GE,56:GE,57:GE,62:OT},WD={91:sE},GD={[-2]:BT,[-1]:BT,32:BT},KD={35:pE,42:UE,45:[$E,UE],60:vE,61:$E,95:UE,96:LT,126:LT},qD={38:PT,92:MT},JD={[-5]:VE,[-4]:VE,[-3]:VE,33:LE,38:PT,42:yT,60:[CT,TE],91:zE,92:[dE,MT],93:DE,95:yT,96:WT},YD={null:[yT,ID]},XD={null:[42,95]},ZD={null:[]};function QD(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=Uw(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=vT(a,l.events,l),l.events):[]}function f(e,t){return eO(p(e),t)}function p(e){return $D(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){$C(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&&Hw(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 $D(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 eO(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 tO(e){let t={constructs:Gw([HD,...(e||{}).extensions||[]]),content:n(OD),defined:[],document:n(AD),flow:n(PD),lazy:{},string:n(LD),text:n(RD)};return t;function n(e){return n;function n(n){return QD(t,e,n)}}}function nO(e){for(;!XT(e););return e}var rO=/[\0\t\n\r]/g;function iO(){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(rO.lastIndex=u,c=rO.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 aO(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?sO(e.position):`start`in e||`end`in e?sO(e):`line`in e||`column`in e?oO(e):``}function oO(e){return cO(e&&e.line)+`:`+cO(e&&e.column)}function sO(e){return oO(e&&e.start)+`-`+oO(e&&e.end)}function cO(e){return e&&typeof e==`number`?e:1}var lO={}.hasOwnProperty;function uO(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),dO(n)(nO(tO(n).document().write(iO()(e,t,!0))))}function dO(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(_e),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(de),characterEscape:T,characterReference:T,codeFenced:a(F),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(F,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(I),hardBreakEscape:a(L),hardBreakTrailing:a(L),htmlFlow:a(he,o),htmlFlowData:T,htmlText:a(he,o),htmlTextData:T,image:a(ge),label:o,link:a(_e),listItem:a(ye),listItemValue:f,listOrdered:a(ve,d),listUnordered:a(ve),paragraph:a(R),reference:ae,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(be),thematicBreak:a(B)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ue,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:ce,characterReference:P,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:oe,resourceDestinationString:re,resourceTitleString:ie,resource:N,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};pO(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]];lO.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]||hO).call(a,void 0,e[0])}for(r.position={start:fO(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:fO(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:fO(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]||hO).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+aO({start:e.start,end:e.end})+`): it’s not open`);n.position.end=fO(e.end)}function u(){return Sw(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=lw(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=z(),n.position={start:fO(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=fO(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=fO(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=Mse(t),n.identifier=lw(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 ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function N(){this.data.inReference=void 0}function ae(){this.data.referenceType=`collapsed`}function oe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=lw(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function se(e){this.data.characterReferenceType=e.type}function ce(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Rw(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Lw(t);let i=this.stack[this.stack.length-1];i.value+=r}function P(e){let t=this.stack.pop();t.position.end=fO(e.end)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function de(){return{type:`blockquote`,children:[]}}function F(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function I(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function L(){return{type:`break`}}function he(){return{type:`html`,value:``}}function ge(){return{type:`image`,title:null,url:``,alt:null}}function _e(){return{type:`link`,title:null,url:``,children:[]}}function ve(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ye(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function R(){return{type:`paragraph`,children:[]}}function be(){return{type:`strong`,children:[]}}function z(){return{type:`text`,value:``}}function B(){return{type:`thematicBreak`}}}function fO(e){return{line:e.line,column:e.column,offset:e.offset}}function pO(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?pO(e,r):mO(e,r)}}function mO(e,t){let n;for(n in t)if(lO.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 hO(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+aO({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+aO({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+aO({start:t.start,end:t.end})+`) is still open`)}function gO(e){let t=this;t.parser=n;function n(n){return uO(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function _O(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 vO(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
66
- `}]}function yO(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 bO(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xO(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SO(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=_T(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 CO(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 wO(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function TO(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 EO(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return TO(e,t);let i={src:_T(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 DO(e,t){let n={src:_T(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 OO(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 kO(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return TO(e,t);let i={href:_T(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 AO(e,t){let n={href:_T(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 jO(e,t,n){let r=e.all(t),i=n?MO(n):NO(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 MO(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=NO(n[r])}return t}function NO(e){return e.spread??e.children.length>1}function PO(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 FO(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IO(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function LO(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function RO(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=BS(t.children[1]),o=zS(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 zO(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 BO(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var VO=9,HO=32;function UO(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(WO(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(WO(t.slice(i),i>0,!1)),a.join(``)}function WO(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===VO||t===HO;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===VO||t===HO;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function GO(e,t){let n={type:`text`,value:UO(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function KO(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var qO={blockquote:_O,break:vO,code:yO,delete:bO,emphasis:xO,footnoteReference:SO,heading:CO,html:wO,imageReference:EO,image:DO,inlineCode:OO,linkReference:kO,link:AO,listItem:jO,list:PO,paragraph:FO,root:IO,strong:LO,table:RO,tableCell:BO,tableRow:zO,text:GO,thematicBreak:KO,toml:JO,yaml:JO,definition:JO,footnoteDefinition:JO};function JO(){}function YO(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 XO(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ZO(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||YO,r=e.options.footnoteBackLabel||XO,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=_T(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:{...RS(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 QO={}.hasOwnProperty,$O={};function ek(e,t){let n=t||$O,r=new Map,i=new Map,a={all:s,applyData:nk,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...qO,...n.handlers},one:o,options:n,patch:tk,wrap:ik};return xw(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(QO.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=RS(n);return r.children=a.all(e),r}return RS(e)}return(a.options.unknownHandler||rk)(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=ak(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=ak(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function tk(e,t){e.position&&(t.position=HS(e))}function nk(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,RS(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function rk(e,t){let n=t.data||{},r=`value`in t&&!(QO.call(n,`hProperties`)||QO.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 ik(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 ak(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ok(e,t){let n=ek(e,t),r=n.one(e,void 0),i=ZO(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 sk(e,t){return e&&`run`in e?async function(n,r){let i=ok(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ok(n,{file:r,...e||t})}}function ck(e){if(e)throw e}var lk=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 uk(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 dk(){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?fk(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 fk(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 pk=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=aO(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}};pk.prototype.file=``,pk.prototype.name=``,pk.prototype.reason=``,pk.prototype.message=``,pk.prototype.stack=``,pk.prototype.column=void 0,pk.prototype.line=void 0,pk.prototype.ancestors=void 0,pk.prototype.cause=void 0,pk.prototype.fatal=void 0,pk.prototype.place=void 0,pk.prototype.ruleId=void 0,pk.prototype.source=void 0;var mk={basename:hk,dirname:gk,extname:_k,join:vk,sep:`/`};function hk(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);xk(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 gk(e){if(xk(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 _k(e){xk(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 vk(...e){let t=-1,n;for(;++t<e.length;)xk(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:yk(n)}function yk(e){xk(e);let t=e.codePointAt(0)===47,n=bk(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function bk(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 xk(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Sk={cwd:Ck};function Ck(){return`/`}function wk(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Tk(e){if(typeof e==`string`)e=new URL(e);else if(!wk(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 Ek(e)}function Ek(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 Dk=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Ok=class{constructor(e){let t;t=e?wk(e)?{path:e}:typeof e==`string`||Mk(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Sk.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Dk.length;){let e=Dk[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)Dk.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?mk.basename(this.path):void 0}set basename(e){Ak(e,`basename`),kk(e,`basename`),this.path=mk.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?mk.dirname(this.path):void 0}set dirname(e){jk(this.basename,`dirname`),this.path=mk.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?mk.extname(this.path):void 0}set extname(e){if(kk(e,`extname`),jk(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=mk.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){wk(e)&&(e=Tk(e)),Ak(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?mk.basename(this.path,this.extname):void 0}set stem(e){Ak(e,`stem`),kk(e,`stem`),this.path=mk.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 pk(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 kk(e,t){if(e&&e.includes(mk.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+mk.sep+"`")}function Ak(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function jk(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Mk(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Nk=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Pk=t(lk(),1),Fk={}.hasOwnProperty,Ik=new class e extends Nk{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=dk()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Pk.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(zk(`data`,this.frozen),this.namespace[e]=t,this):Fk.call(this.namespace,e)&&this.namespace[e]||void 0:e?(zk(`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=Hk(e),n=this.parser||this.Parser;return Lk(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Lk(`process`,this.parser||this.Parser),Rk(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Hk(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);Wk(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(),Lk(`processSync`,this.parser||this.Parser),Rk(`processSync`,this.compiler||this.Compiler),this.process(e,r),Vk(`processSync`,`process`,t),n;function r(e,r){t=!0,ck(e),n=r}}run(e,t,n){Bk(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=Hk(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),Vk(`runSync`,`run`,n),r;function i(e,t){ck(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Hk(t),r=this.compiler||this.Compiler;return Rk(`stringify`,r),Bk(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(zk(`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,Pk.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];uk(o)&&uk(r)&&(r=(0,Pk.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Lk(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Rk(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function zk(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 Bk(e){if(!uk(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Vk(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Hk(e){return Uk(e)?e:new Ok(e)}function Uk(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Wk(e){return typeof e==`string`||Gk(e)}function Gk(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function Kk(e){let t=Ik().use(gO).use(DD);return e&&t.use(moe),t.use(sk).use(Rie).use(eoe)}var qk=Kk(!1),Jk=Kk(!0),Yk=400,Xk=new Vi(Yk),Zk=new Vi(Yk),Qk=new Vi(Yk),$k=new Map;function eA(e,t){return`${t?`breaks`:`standard`}\0${e}`}function tA(e,t,n){return`${t?`t`:`f`}\0${eA(e,n)}`}function nA(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function rA(e,t={}){let n=t.cache??!0,r=t.preserveLineBreaks??!1,i=eA(e,r);if(n){let e=Xk.get(i);if(e!==void 0)return e}let a;try{a=String((r?Jk:qk).processSync(e))}catch{a=nA(e)}return n&&Xk.set(i,a),a}function iA(e){return e.match(/language-([\w-]+)/)?.[1]??`text`}function aA(e,t){let n=e.textContent??``;return t?si(n).text:n}function oA(e,t){let n=e.cloneNode(!0),r=n.querySelector(`code`);return r?r.textContent=t:n.textContent=t,n}function sA(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 cA(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 lA(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(kS(iA(e.getAttribute(`class`)??``))){n.replaceWith(cA(n));continue}n.replaceWith(sA(oA(n,aA(e,t))))}}return n.innerHTML}function uA(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 dA(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=iA(e.getAttribute(`class`)??``);if(kS(n)){let t=e.parentElement;t&&t.replaceWith(cA(t));return}try{let r=await TS(aA(e,t),n);if(r){let t=document.createElement(`div`);t.innerHTML=r;let n=t.firstElementChild;n&&e.parentElement?.replaceWith(sA(n));return}}catch{}let r=e.parentElement;r&&r.replaceWith(sA(oA(r,aA(e,t))))})),n.innerHTML}function fA(e,t){return uA(lA(e,t))}async function pA(e,t){return uA(await dA(e,t))}function mA(e,t,n=!1){let r=tA(e,t,n),i=Zk.get(r);if(i!==void 0)return i;let a=fA(rA(e,{preserveLineBreaks:n}),t);return Zk.set(r,a),a}function hA(e,t,n=!1){return Qk.get(tA(e,t,n))}function gA(e,t,n=!1){return hA(e,t,n)??mA(e,t,n)}function _A(e,t,n=!1){let r=tA(e,t,n),i=Qk.get(r);if(i!==void 0)return Promise.resolve(i);let a=$k.get(r);if(a)return a;let o=pA(rA(e,{preserveLineBreaks:n}),t).then(e=>(Qk.set(r,e),$k.delete(r),e)).catch(e=>{throw $k.delete(r),e});return $k.set(r,o),o}function vA(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 yA(e,t){return t.length>e.length&&t.slice(e.length).includes(`
77
- `)}var bA={now:()=>Date.now(),schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)},xA=class{commit;intervalMs;clock;pending;hasPending=!1;timer;lastCommitAt;destroyed=!1;constructor(e,t=75,n=bA){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)}},SA=h(`<span class="whitespace-pre-wrap break-words"> </span>`),CA=h(`<div class="markdown svelte-ss9wg9"><!> <!></div>`),wA=h(`<div class="markdown svelte-ss9wg9"></div>`);function TA(e,t){a(t,!0);let n=F(t,`trimCodeBlocks`,3,!0),r=F(t,`preserveLineBreaks`,3,!1),o=F(t,`streaming`,3,!1);function s(e,t,n){return e?fA(rA(e,{cache:!1,preserveLineBreaks:n}),t):``}let c=ae(()=>{let e=o()?vA(t.text):void 0;return{html:o()?``:gA(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=J(ie(c.html)),u=J(ie(c.prefixHtml)),f=c.prefixSource,m=c.trim,h=c.preserveLineBreaks,_=J(ie(c.tail)),v=J(ie(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 lie(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=ai(i);if(!a)return;let o=ri(a),s=t.linkBasePath?ii(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 ge(),i===n&&(r=Cie(e)))}return i(t),{update:i,destroy(){n+=1,r?.destroy()}}}function E(e){let t=vA(e.source);(t.prefix!==f||e.trim!==m||e.preserveLineBreaks!==h)&&(G(u,s(t.prefix,e.trim,e.preserveLineBreaks),!0),f=t.prefix,m=e.trim,h=e.preserveLineBreaks),G(_,t.tail,!0),G(v,!0),S+=1}let D=new xA(E);function O(e,t,n){let r=hA(e,t,n);if(r!==void 0){G(l,r,!0),S+=1;return}G(l,mA(e,t,n),!0);let i=S+=1;_A(e,t,n).then(e=>{i===S&&G(l,e,!0)}).catch(()=>{i===S&&G(l,mA(e,t,n),!0)})}z(()=>{let e=t.text,i=n(),a=r();if(!o()){W(v)&&D.flushNow({source:e,trim:i,preserveLineBreaks:a}),G(v,!1),O(e,i,a),y=e,b=i,x=a;return}let s=!W(v)||i!==b||a!==x||yA(y,e);y=e,b=i,x=a,D.enqueue({source:e,trim:i,preserveLineBreaks:a},{priority:s})}),z(()=>()=>D.destroy());var ee=U(),te=L(ee),ne=e=>{var t=CA(),n=V(t);p(n,()=>W(u));var r=I(n,2),a=e=>{var t=SA(),n=V(t,!0);d(t),P(()=>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=wA();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),R()}var EA=Symbol.for(`nerve.conversationUi.capabilities`);function DA(e){return ve(EA,e)}function OA(){return c(EA)??{}}var kA=h(`<button type="button"> </button>`),AA=h(`<a target="_blank" rel="noreferrer noopener"> </a>`),jA=h(`<span> </span>`),MA=h(`<div class="chips svelte-1xvwd06"></div>`),NA=h(`<button class="more svelte-1xvwd06" type="button"> </button>`),PA=h(`<div class="footer-actions svelte-1xvwd06"><!></div>`),FA=h(`<div><!> <!> <!></div>`);function IA(e,t){a(t,!0);let n=F(t,`meta`,19,()=>[]),i=q(()=>!!t.actions),o=q(()=>n().length>0||!!t.detailsAction||W(i));var c=U(),l=L(c),f=e=>{var a=FA(),o=V(a),c=e=>{var i=MA();_(i,21,n,E,(e,n)=>{var i=U(),a=L(i),o=e=>{var i=kA(),a=V(i,!0);d(i),P(()=>{s(i,1,`chip chip-action tone-${W(n).tone??`default`}`,`svelte-1xvwd06`),K(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=AA(),r=V(t,!0);d(t),P(()=>{s(t,1,`chip chip-action tone-${W(n).tone??`default`}`,`svelte-1xvwd06`),K(t,`href`,W(n).href),A(r,W(n).text)}),g(e,t)},l=e=>{var t=jA(),r=V(t,!0);d(t),P(()=>{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=I(o,2),f=e=>{var n=NA(),i=V(n,!0);d(n),P(()=>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=I(l,2),m=e=>{var n=PA();u(V(n),()=>t.actions),d(n),g(e,n)};k(p,e=>{t.actions&&e(m)}),d(a),P(()=>s(a,1,`tool-footer${W(i)?` has-actions`:``}`,`svelte-1xvwd06`)),g(e,a)};k(l,e=>{W(o)&&e(f)}),g(e,c),R()}T([`click`]);var LA=h(`<div class="question svelte-q82h90"><!></div>`),RA=h(`<div class="meta svelte-q82h90"><span class="meta-label svelte-q82h90">context</span> <div class="meta-body svelte-q82h90"><!></div></div>`),zA=h(`<div class="meta svelte-q82h90"><span class="meta-label svelte-q82h90">recommendation</span> <div class="meta-body svelte-q82h90"><!></div></div>`),BA=h(`<button type="button" class="quick-reply rounded-full svelte-q82h90"> </button>`),VA=h(`<div class="reply-voice-controls svelte-q82h90"><!> <!></div>`),HA=h(`<!>Dismissing…`,1),UA=h(`<!>Dismiss`,1),WA=h(`<!>Sending…`,1),GA=h(`<!>Reply`,1),KA=h(`<!> <!>`,1),qA=h(`<p class="m-0 text-xs text-destructive" role="alert"> </p>`),JA=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),YA=h(`<div class="meta answer svelte-q82h90"><span class="meta-label svelte-q82h90">answer</span> <div class="meta-body svelte-q82h90"><!></div></div>`),XA=h(`<p class="meta svelte-q82h90"><span class="meta-label svelte-q82h90">dismissed</span> </p>`),ZA=h(`<div class="ask select-text svelte-q82h90"><!> <!> <!> <!></div> <!>`,1);function QA(e,t){a(t,!0);let n=OA(),o=n.voice,s=o?.TranscriptionActivity,c=o?.AudioAuthDialog,l=[`Yes, go ahead`,`I agree`,`Can you explain further?`,`No, hold on`],u=J(``),f=J(void 0),p=J(void 0),m=J(void 0),h=J(!1),v=J(0),y=J(void 0),b,x,S,C=o?.micShortcutLabel,T=o?.micShortcutAria,E=q(()=>t.toolCall.status===`waiting_for_user`&&t.questionRecord?.status===`pending`),D=q(()=>t.questionRecord?.question??t.view.question),O=q(()=>t.questionRecord?.context??t.view.context),ee=q(()=>t.questionRecord?.recommendation??t.view.recommendation),te=n.askReply,ne=q(()=>te?.slashCompletions?.()??[]),j=q(()=>te?.fileCompletions),M=q(()=>te?.pasteImage),re=q(()=>te?.dropFiles),ie=q(()=>t.questionRecord?.answer??t.view.answer??(W(m)?.kind===`answered`?W(m).answer:void 0)),N=q(()=>t.questionRecord?.status===`dismissed`||t.view.dismissed||W(m)?.kind===`dismissed`),ae=q(()=>t.questionRecord?.dismissedReason??t.view.dismissedReason),oe=q(()=>W(u).trim()),se=q(()=>W(E)&&t.questionRecord?t.questionRecord.id:void 0),ce=q(()=>o&&W(se)?{kind:`ask-user`,id:W(se)}:void 0),le=q(()=>!!(o&&W(ce)&&o.session.isTargetActive(W(ce))&&o.session.recording)),ue=q(()=>!!(o&&W(ce)&&o.session.isTargetActive(W(ce))&&o.session.transcribing)),F=q(()=>!!(o&&W(ce)&&o.session.isBusyForOtherTarget(W(ce)))),fe=q(()=>!!o?.chatGptConfigured()),pe=q(()=>!!o?.session.isSupported()),me=q(()=>!o||!W(ce)||!!W(f)||o.session.pending||!W(le)&&(!W(E)||W(F))),he=q(()=>o?W(le)?`Stop recording${C?` (${C})`:``} — right-click to cancel (${_e(o.session.elapsedMs)} / ${_e(o.session.maxDurationMs)})`:W(F)?`Voice recording is active elsewhere`:o.session.retryAttempt>0&&W(ce)&&o.session.isTargetActive(W(ce))?`Retrying transcription ${o.session.retryAttempt}/${o.session.maxRetries}…`:W(ue)?`Transcribing audio…`:W(fe)?C?`Record voice reply (${C})`:`Record voice reply`:`Connect ChatGPT to use voice input`:``);function ge(e){let t=x;S?.(),S=void 0,x=void 0,b=void 0,e&&t&&o?.session.cancelIfTarget(t)}z(()=>{if(!o)return;let e=W(ce),t=e?o.targetKey(e):void 0;t!==b&&(ge(!0),!(!e||!t)&&(x=e,b=t,S=o.session.registerTargetHandlers(e,{appendTranscript:e=>{G(u,o.appendTranscriptText(W(u),e),!0)},onError:e=>_S.error(`Voice input failed`,{description:e})})))}),z(()=>{let e=W(E)&&t.questionRecord?t.questionRecord.id:void 0;!e||e===W(y)||(G(y,e,!0),W(E)&&t.questionRecord?.id===e&&G(v,W(v)+1))}),Ae(()=>ge(!0));function _e(e){let t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)}`}async function ve(e){if(!W(E)||!t.questionRecord||W(f)||!t.onAnswerUserQuestion)return;let n=t.questionRecord.id;G(f,`answer`),G(p,void 0);try{await t.onAnswerUserQuestion(n,e),G(m,{kind:`answered`,answer:e},!0)}catch(e){G(p,xe(e,`Could not send the reply.`),!0)}finally{G(f,void 0)}}function ye(){W(oe)&&ve(W(oe))}function be(e){ve(e)}async function B(){if(!W(E)||!t.questionRecord||W(f)||!t.onDismissUserQuestion)return;let e=t.questionRecord.id;G(f,`dismiss`),G(p,void 0);try{await t.onDismissUserQuestion(e),G(m,{kind:`dismissed`},!0)}catch(e){G(p,xe(e,`Could not dismiss the question.`),!0)}finally{G(f,void 0)}}function xe(e,t){return e instanceof Error&&e.message.trim()?e.message:t}function Se(){if(!(!o||W(me)||!W(ce))){if(!W(le)&&!W(fe)){G(h,!0);return}o.session.toggle(W(ce))}}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(le)||!W(ce)||(e.preventDefault(),o.session.cancel(W(ce)))}function H(e){return e.addEventListener(`keydown`,Ce),{destroy(){e.removeEventListener(`keydown`,Ce)}}}var Te=ZA(),Ee=L(Te),De=V(Ee),ke=e=>{var n=LA();TA(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(ke)});var je=I(De,2),Me=e=>{var n=RA(),r=I(V(n),2);TA(V(r),{get text(){return W(O)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(r),d(n),g(e,n)};k(je,e=>{W(O)&&e(Me)});var K=I(je,2),Ne=e=>{var n=zA(),r=I(V(n),2);TA(V(r),{get text(){return W(ee)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(r),d(n),g(e,n)};k(K,e=>{W(ee)&&e(Ne)});var Pe=I(K,2),Fe=e=>{var n=JA(),a=L(n);_(a,20,()=>l,e=>e,(e,t)=>{var n=BA(),i=V(n,!0);d(n),P(e=>{n.disabled=e,A(i,t)},[()=>!!W(f)]),r(`click`,n,()=>be(t)),g(e,n)}),d(a);var c=I(a,2),m=V(c),h=V(m);{let e=q(()=>!!W(f));jg(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=>{G(u,e,!0)},onSubmit:ye,get onPasteImage(){return W(M)},get onDropFiles(){return W(re)}})}var y=I(h,2),b=e=>{var t=VA(),n=V(t);{let e=q(()=>W(ce)&&o.session.isTargetActive(W(ce))?o.session.retryAttempt:0);s(n,{get recording(){return W(le)},get transcribing(){return W(ue)},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=I(n,2);{let e=q(()=>W(le)?`destructive`:`ghost`),t=q(()=>`rounded-full ${W(le)?`inset-ring-1 inset-ring-destructive/28`:``}`),n=q(()=>W(le)?`Stop recording; right-click to cancel`:W(fe)?`Record voice reply`:`Connect ChatGPT to use voice input`);Oe(r,{get variant(){return W(e)},size:`icon-sm`,get class(){return W(t)},type:`button`,get disabled(){return W(me)},onclick:Se,oncontextmenu:we,get"aria-label"(){return W(n)},get"aria-keyshortcuts"(){return T},get title(){return W(he)},children:(e,t)=>{var n=U(),r=L(n),i=e=>{zi(e,{class:`size-3.5`})},a=e=>{hS(e,{size:14,strokeWidth:2.4})};k(r,e=>{W(ue)?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}d(t),g(e,t)};k(y,e=>{o&&W(pe)&&s&&e(b)}),d(m),i(m,e=>H?.(e));var x=I(m,2);IA(x,{get detailsAction(){return t.detailsAction},actions:e=>{var t=KA(),n=L(t);{let e=q(()=>!!W(f));Oe(n,{size:`sm`,variant:`secondary`,type:`button`,get disabled(){return W(e)},onclick:()=>void B(),children:(e,t)=>{var n=U(),r=L(n),i=e=>{var t=HA();zi(L(t),{class:`size-3.5`}),w(),g(e,t)},a=e=>{var t=UA();Ol(L(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=I(n,2);{let e=q(()=>!W(oe)||!!W(f));Oe(r,{size:`sm`,type:`submit`,get disabled(){return W(e)},children:(e,t)=>{var n=U(),r=L(n),i=e=>{var t=WA();zi(L(t),{class:`size-3.5`}),w(),g(e,t)},a=e=>{var t=GA();Ng(L(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=I(x,2),C=e=>{var t=qA(),n=V(t,!0);d(t),P(()=>A(n,W(p))),g(e,t)};k(S,e=>{W(p)&&e(C)}),d(c),de(`submit`,c,e=>{e.preventDefault(),ye()}),g(e,n)},Ie=e=>{var n=YA(),r=I(V(n),2);TA(V(r),{get text(){return W(ie)},preserveLineBreaks:!0,get onOpenFile(){return t.onOpenFile}}),d(r),d(n),g(e,n)},Le=e=>{var t=XA(),n=I(V(t));d(t),P(()=>A(n,` ${W(ae)??`No answer provided`??``}`)),g(e,t)};k(Pe,e=>{W(E)&&t.questionRecord?e(Fe):W(ie)?e(Ie,1):W(N)&&e(Le,2)}),d(Ee);var Re=I(Ee,2),ze=e=>{c(e,{get open(){return W(h)},set open(e){G(h,e,!0)}})};k(Re,e=>{c&&e(ze)}),g(e,Te),R()}T([`click`]);var $A=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`],ej=/[\x40-\x7e]/,tj=/https?:\/\/[^\s<>"']+/giu,nj=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),rj={")":`(`,"]":`[`,"}":`{`};function ij(){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 aj(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`)}function oj(e,t){if(t>=30&&t<=37)return`ansi-${e}-${$A[t-30]}`;if(t>=90&&t<=97)return`ansi-${e}-bright-${$A[t-90]}`;if(t>=40&&t<=47)return`ansi-${e}-${$A[t-40]}`;if(t>=100&&t<=107)return`ansi-${e}-bright-${$A[t-100]}`}function sj(e){return Number.isFinite(e)?Math.max(0,Math.min(255,Math.round(e))):0}function cj(e,t,n){return`rgb(${sj(e)} ${sj(t)} ${sj(n)})`}function lj(e){let t=sj(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 cj(e[0],e[1],e[2])}if(t>=232){let e=8+(t-232)*10;return cj(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 cj(o(r),o(i),o(a))}function uj(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 dj(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]=lj(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]=cj(t,n,s),i+3}return i}function fj(e,t){let n={...e},r=uj(t);for(let e=0;e<r.length;e+=1){let t=r[e];Number.isFinite(t)&&(t===0?Object.assign(n,ij()):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=oj(`fg`,t),n.fgColor=void 0):t>=40&&t<=47||t>=100&&t<=107?(n.bgClass=oj(`bg`,t),n.bgColor=void 0):t===38?e=dj(n,`fg`,r[e+1],r,e+1):t===48&&(e=dj(n,`bg`,r[e+1],r,e+1)))}return n}function pj(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 mj(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 hj(e,t){let n=0;for(let r of e)r===t&&(n+=1);return n}function gj(e){let t=e.length;for(;t>0;){let n=e[t-1];if(nj.has(n)){--t;continue}let r=rj[n],i=e.slice(0,t);if(r&&hj(i,n)>hj(i,r)){--t;continue}break}return{url:e.slice(0,t),trailing:e.slice(t)}}function _j(e){try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function vj(e){let t=[];tj.lastIndex=0;for(let n of e.matchAll(tj)){let e=n[0],{url:r}=gj(e);r&&_j(r)&&t.push({start:n.index,end:n.index+r.length,url:r})}return t}function yj(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 bj(e){let t=aj(e.text),n=pj(e.state),r=mj(e.state);return n.length===0&&r===void 0?t:`<span${n.length>0?` class="${n.join(` `)}"`:``}${r?` style="${r}"`:``}>${t}</span>`}function xj(e){let t=``,n;for(let r of e){if(r.url!==n){if(n&&(t+=`</a>`),r.url){let e=aj(r.url);t+=`<a href="${e}" target="_blank" rel="noopener noreferrer">`}n=r.url}t+=bj(r)}return n&&(t+=`</a>`),t}function Sj(e,t){for(let n=t;n<e.length;n+=1)if(ej.test(e[n]))return n;return-1}function Cj(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 wj(e){let t=[],n=ij(),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=Sj(e,i+2);if(t===-1){r=e.length;break}let a=e.slice(i+2,t+1);a.endsWith(`m`)&&(n=fj(n,a)),i=t+1,r=i;continue}if(t===`]`){let t=Cj(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 Tj(e,t={}){let n=wj(e),r=n.map(e=>e.text).join(``),i=t.linkifyUrls?vj(r):[],a=0,o=[];for(let e of n)o.push(...yj(e,a,i)),a+=e.text.length;return xj(o)}function Ej(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 Dj(e,t,n=16){let r=Ej(e);if(r>0)return r;let i=Ej(t,n);return i>0?i*1.4:n*1.4}function Oj(e){let t=e.borderBoxWidth-e.paddingLeft-e.paddingRight-e.borderLeftWidth-e.borderRightWidth;return Math.max(0,t)}function kj(e,t){return!Number.isFinite(t)||t<=0?!1:e===void 0||Math.abs(e-t)>.5}function Aj(e,t){return e<=0||t<=0?0:Math.max(1,Math.round(e/t))}function jj(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 Mj=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>`),Nj=h(`<span class="diff-line svelte-ytenc0"> </span>`),Pj=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>`),Fj=h(`<div class="code-block svelte-ytenc0"><div class="code-block__viewport svelte-ytenc0"><div class="code-block__content svelte-ytenc0"></div></div></div>`),Ij=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 Lj(e,t){a(t,!0);let n=F(t,`maxHeight`,3,`18rem`),r=F(t,`trim`,3,!0),i=F(t,`highlight`,3,!0),o=F(t,`wrap`,3,!0),s=F(t,`overflow`,3,`auto`),c=F(t,`terminal`,3,!1),u=F(t,`tail`,3,!1),f=J(void 0),m=J(void 0),h=J(void 0),v=J(void 0),y=J(void 0),b=J(void 0),x=J(void 0),S=q(()=>r()?si(t.code):{text:t.code}),C=q(()=>`${t.language??``}\0${W(S).text}`),w=q(()=>t.fixedRows!==void 0&&t.fixedRows>0),T=q(()=>Tj(W(S).text)),E=q(()=>!c()&&(t.language??``).toLowerCase().trim()===`diff`),D=q(()=>W(E)?ne(W(S).text):[]),O=q(()=>{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=J(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||G(ee,jj({previousRows:W(ee),measuredRows:e,fallbackRows:W(O),fixedRows:t.fixedRows}),!0)}function M(){W(x)!==void 0&&(cancelAnimationFrame(W(x)),G(x,void 0))}function re(){if(G(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=Oj({borderBoxWidth:t.width,paddingLeft:Ej(n.paddingLeft),paddingRight:Ej(n.paddingRight),borderLeftWidth:Ej(n.borderLeftWidth),borderRightWidth:Ej(n.borderRightWidth)})}if(e<=0)return;let t=getComputedStyle(W(b)),n=Dj(t.lineHeight,t.fontSize);j(Aj(W(b).scrollHeight,n))}function ie(){if(W(w)&&W(x)===void 0){if(typeof requestAnimationFrame>`u`){re();return}G(x,requestAnimationFrame(re),!0)}}z(()=>{if(!W(w)){G(ee,0),M();return}j()}),z(()=>{let e=`${W(S).text}\0${W(f)??``}\0${W(T)}\0${t.fixedRows??``}`;!W(w)||e===void 0||ie()}),z(()=>{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;kj(e,r)&&(e=r,ie())});return t.observe(W(y)),ie(),()=>t.disconnect()}),z(()=>()=>M());let N=q(()=>W(w)?String(t.fixedRows):void 0),ae=q(()=>W(w)?String(Math.max(W(ee),1)):void 0);z(()=>{if(c()||!i()||W(E)){G(f,void 0),G(m,void 0),G(h,void 0);return}let e=W(C);if(W(m)===e||W(h)===e)return;let n=TS(W(S).text,t.language);if(typeof n==`string`){G(f,n,!0),G(m,e,!0),G(h,void 0);return}if(!n){G(h,e,!0);return}let r=!1;return n.then(t=>{r||W(C)!==e||(t?(G(f,t,!0),G(m,e,!0),G(h,void 0)):G(h,e,!0))}),()=>{r=!0}});var oe=U(),se=L(oe),ce=e=>{var t=Mj();let r;var i=V(t);let a;var c=V(i);p(c,()=>W(T),!0),d(c),pe(c,e=>G(b,e),()=>W(b)),d(i),pe(i,e=>G(y,e),()=>W(y)),d(t),pe(t,e=>G(v,e),()=>W(v)),P(()=>{K(t,`data-wrap`,o()?`true`:`false`),K(t,`data-overflow`,s()),K(t,`data-fixed-rows`,W(w)?`true`:void 0),K(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(N),"--code-block-visible-rows":W(ae)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()})}),g(e,t)},le=e=>{var t=Pj();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=Nj(),r=V(n,!0);d(n),P(()=>{K(n,`data-tone`,W(t).tone),A(r,W(t).text)}),g(e,n)}),d(c),pe(c,e=>G(b,e),()=>W(b)),d(i),pe(i,e=>G(y,e),()=>W(y)),d(t),pe(t,e=>G(v,e),()=>W(v)),P(()=>{K(t,`data-wrap`,o()?`true`:`false`),K(t,`data-overflow`,s()),K(t,`data-fixed-rows`,W(w)?`true`:void 0),K(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(N),"--code-block-visible-rows":W(ae)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()})}),g(e,t)},ue=e=>{var t=Fj();let r;var i=V(t);let a;var c=V(i);p(c,()=>W(f),!0),d(c),pe(c,e=>G(b,e),()=>W(b)),d(i),pe(i,e=>G(y,e),()=>W(y)),d(t),pe(t,e=>G(v,e),()=>W(v)),P(()=>{K(t,`data-wrap`,o()?`true`:`false`),K(t,`data-overflow`,s()),K(t,`data-fixed-rows`,W(w)?`true`:void 0),K(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(N),"--code-block-visible-rows":W(ae)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()})}),g(e,t)},de=e=>{var t=Ij();let r;var i=V(t);let a;var c=V(i),f=V(c,!0);d(c),pe(c,e=>G(b,e),()=>W(b)),d(i),pe(i,e=>G(y,e),()=>W(y)),d(t),pe(t,e=>G(v,e),()=>W(v)),P(()=>{K(t,`data-wrap`,o()?`true`:`false`),K(t,`data-overflow`,s()),K(t,`data-fixed-rows`,W(w)?`true`:void 0),K(t,`data-tail`,u()?`true`:void 0),r=l(t,``,r,{"--code-block-fixed-rows":W(N),"--code-block-visible-rows":W(ae)}),a=l(i,``,a,{"max-height":W(w)?void 0:n()}),A(f,W(S).text)}),g(e,t)};k(se,e=>{c()?e(ce):W(E)?e(le,1):i()&&W(f)&&W(m)===W(C)?e(ue,2):e(de,-1)}),g(e,oe),R()}var Rj=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),zj=h(`<!> <!>`,1);function Bj(e,t){a(t,!0);let n=F(t,`direction`,3,`head`),r=F(t,`collapsedLines`,3,6),i=F(t,`expanded`,3,!1),o=F(t,`terminal`,3,!1),s=q(()=>{if(i())return t.text;if(n()===`tail`)return Et(t.text,r());let e=Xt(t.text);return e.length<=r()?t.text:e.slice(0,r()).join(`
82
- `)});var c=zj(),l=L(c),u=e=>{var n=Rj(),r=V(n);d(n),P(()=>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=I(l,2);{let e=q(()=>i()?void 0:r()),a=q(()=>!i()&&n()===`tail`);Lj(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),R()}var Vj=h(`<section class="grid gap-1" aria-label="Bash command"><!></section>`),Hj=h(`<section class="grid gap-1" aria-label="Command output"><!></section>`),Uj=h(`<p class="m-0 text-xs text-muted-foreground">No output.</p>`),Wj=h(`<div class="grid gap-1.5"><!> <!></div>`);function Gj(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>!!t.view.command?.match(/[\r\n]/));var i=Wj(),o=V(i),s=e=>{var r=Vj();Bj(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=I(o,2),l=e=>{var r=Hj();Bj(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,Uj())};k(c,e=>{t.view.output.length>0?e(l):t.toolCall.status===`completed`&&e(u,1)}),d(i),g(e,i),R()}var Kj=new Set([`$$slots`,`$$events`,`$$legacy`]);function qj(e,t){let n=H(t,Kj),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`}]];N(e,B({name:`flask-conical`},()=>n,{get iconNode(){return r}}))}var Jj=5,Yj=20,Xj=4,Zj=12,Qj=600,$j=2e3;function eM(e){return e.expanded?{itemLimit:Yj,excerptLines:Zj,excerptChars:$j}:{itemLimit:Jj,excerptLines:Xj,excerptChars:Qj}}function tM(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 nM(e){let t=e;return{args:BM(t.args??t.argsPreview),status:e.status}}function rM(e){let t=e;return BM(BM(t.result??t.resultPreview).details)}function iM(e,t,n){if(n?.resolvedAssignee){$(e,`Resolved assignee`,EM(n.resolvedAssignee));return}let r=IM(t,`assignee_account_id`),i=IM(t,`assignee_query`);r?$(e,`Assignee`,`account ${r}`):i&&$(e,`Assignee`,`query "${i}"`)}function aM(e,t){t.resolvedAssignee&&$(e,`Resolved assignee`,EM(t.resolvedAssignee))}function oM(e,t,n,r){(r??RM(t,`dry_run`))===!0?$(e,`Mode`,`dry run / no mutation`):t.status!==`completed`&&$(e,`Mode`,`will ${n}`)}function sM(e,t){RM(t,`save_to_file`)===!1&&$(e,`Raw JSON`,`not saved`)}function cM(e,t,n){for(let[r,i]of n)$(e,r,zM(t,i))}function lM(e,t,n){let r=IM(t,`page_file`),i=IM(t,`body_file`),a=IM(t,`body`);r&&$(e,`Page file`,r),i&&$(e,`Body file`,i),a&&bM(e,`Body`,a,n)}function uM(e,t){t&&($(e,`Storage`,t.storagePath),$(e,`Markdown`,t.markdownPath),$(e,`Attachments dir`,t.attachmentDir))}function dM(e,t,n){return IM(e,t)??WM(e.args[n])}function fM(e,t){return Object.entries(t).flatMap(([t,n])=>RM(e,t)===!0?[n]:[])}function pM(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 mM(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 hM(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 gM(e,t,n){let r=BM(t);if(Object.keys(r).length===0)return;_M(e,`Payload fields`,BM(r.fields),n),_M(e,`Payload update ops`,BM(r.update),n);let i=Object.keys(r).filter(e=>e!==`fields`&&e!==`update`);i.length>0&&$(e,`Payload keys`,SM(i,n.itemLimit))}function _M(e,t,n,r){let i=Object.keys(BM(n));i.length>0&&$(e,t,SM(i,r.itemLimit))}function vM(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 yM(e,t,n,r){!n||n.length===0||$(e,t,SM(n,r.itemLimit))}function $(e,t,n){n==null||n===``||e.push(`${t}: ${String(n)}`)}function bM(e,t,n,r){let i=xM(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 xM(e,t){let n=UM(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 SM(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 CM(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 wM(e){return[e.key,e.name,e.projectTypeKey,e.lead?`lead ${e.lead}`:void 0].filter(Boolean).join(` · `)}function TM(e){return[e.id,e.name,e.to?`→ ${e.to}`:void 0].filter(Boolean).join(` · `)}function EM(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 DM(e){return[e.id,e.name,e.required?`required`:void 0,e.type].filter(Boolean).join(` · `)}function OM(e){return[e.key,e.name,e.id,e.status].filter(Boolean).join(` · `)}function kM(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 AM(e){return[e.filename??e.title??e.id??e.fileId,e.mediaType,e.fileSize===void 0?void 0:NM(e.fileSize),e.versionNumber===void 0?void 0:`v${e.versionNumber}`].filter(Boolean).join(` · `)}function jM(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 MM(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 NM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function PM(e,t){if(e!==void 0)return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function FM(e){if(e!==void 0)return e?`yes`:`no`}function IM(e,t){return VM(e.args[t])??KM(e.argsText,t,{maxChars:1e3})[0]}function LM(e,t){let n=e.args[t];return Array.isArray(n)?n.flatMap(e=>typeof e==`string`?[e]:[]):void 0}function RM(e,t){let n=e.args[t];return typeof n==`boolean`?n:void 0}function zM(e,t){let n=e.args[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function BM(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function VM(e){return typeof e==`string`&&e.trim().length>0?e:void 0}function HM(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 UM(e){return e?.replace(/\r\n/g,`
89
- `).replace(/\r/g,`
90
- `)??``}function WM(e){let t=[],n=e=>{if(Array.isArray(e)){for(let t of e)n(t);return}let r=BM(e);if(Object.keys(r).length===0)return;let i=VM(r.type);if(i===`text`){let e=VM(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 GM(e){return RegExp(`"${JM(e)}"\\s*:\\s*"`,`g`)}function KM(e,t,n={}){if(!e)return[];let r=[],i=GM(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+=qM(n)),s+=2;continue}if(n===`"`)break;o.length<t&&(o+=n),s+=1}r.push(o),a=i.exec(e)}return r}function qM(e){return e===`n`?`
99
- `:e===`r`?`\r`:e===`t`?` `:e}function JM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var YM={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`},XM={pages:`pages`,spaces:`spaces`,labels:`labels`,properties:`properties`,operations:`operations`,versions:`versions`,directChildren:`direct children`,attachments:`attachments`,downloadedAttachments:`downloaded attachments`};function ZM(e,t,n={}){let r=eM(n),i=nM(e),a=rM(e),o=[tM(`Confluence`,YM[t.action],e.status,t.dryRun)];return QM(o,t.action,i,t,r),$M(o,t,a,r),mM(o,t,r),hM(o,e,n),HM(o).join(`
100
- `)}function QM(e,t,n,r,i){switch(t){case`search_spaces`:$(e,`Query`,r?.query??IM(n,`query`)),yM(e,`Keys`,LM(n,`keys`),i),yM(e,`Ids`,LM(n,`ids`),i),$(e,`Limit`,zM(n,`limit`)),$(e,`Cursor`,IM(n,`cursor`)),sM(e,n);break;case`search_pages`:bM(e,`CQL`,r?.cql??IM(n,`cql`),i),$(e,`Query`,r?.query??IM(n,`query`)),$(e,`Space`,r?.spaceKey??IM(n,`space_key`)??r?.spaceId??IM(n,`space_id`)),$(e,`Title`,r?.title??IM(n,`title`)),$(e,`Status`,r?.status??IM(n,`status`)),$(e,`Body format`,r?.bodyFormat??IM(n,`body_format`)),$(e,`Limit`,zM(n,`limit`)),$(e,`Cursor`,IM(n,`cursor`)),sM(e,n);break;case`get_page`:$(e,`Page`,r?.pageId??IM(n,`page_id`)),$(e,`Body format`,r?.bodyFormat??IM(n,`body_format`)),yM(e,`Includes`,fM(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),sM(e,n);break;case`download_pages`:$(e,`Root page`,r?.pageId??IM(n,`page_id`)),$(e,`Space`,r?.spaceKey??IM(n,`space_key`)??r?.spaceId??IM(n,`space_id`)),bM(e,`CQL`,r?.cql??IM(n,`cql`),i),$(e,`Recurse`,FM(RM(n,`recurse`))),$(e,`Depth`,zM(n,`depth`)),$(e,`Limit`,zM(n,`limit`)),$(e,`Body format`,r?.bodyFormat??IM(n,`body_format`)),yM(e,`Outputs`,fM(n,{markdown:`markdown sidecars`,include_attachments:`attachment metadata`,download_attachments:`download attachments`}),i),sM(e,n);break;case`create_page`:$(e,`Space`,r?.spaceKey??IM(n,`space_key`)??r?.spaceId??IM(n,`space_id`)??`default space`),$(e,`Title`,r?.title??IM(n,`title`)),$(e,`Parent`,IM(n,`parent_id`)),$(e,`Status`,r?.status??IM(n,`status`)),lM(e,n,i),$(e,`Representation`,IM(n,`body_representation`)),oM(e,n,`create page`,r?.dryRun),$(e,`Return page`,FM(RM(n,`return_page`))),sM(e,n);break;case`update_page`:$(e,`Page`,r?.pageId??IM(n,`page_id`)??IM(n,`page_file`)),$(e,`Title`,r?.title??IM(n,`title`)),$(e,`Parent`,IM(n,`parent_id`)),$(e,`Status`,r?.status??IM(n,`status`)),lM(e,n,i),$(e,`Representation`,IM(n,`body_representation`)),bM(e,`Version message`,IM(n,`version_message`),i),$(e,`Allow stale`,FM(RM(n,`allow_stale`))),oM(e,n,`update page`,r?.dryRun),$(e,`Return page`,FM(RM(n,`return_page`))),sM(e,n);break;case`publish_pages`:$(e,`Input`,r?.inputPath??IM(n,`input_path`)),$(e,`Create missing`,FM(RM(n,`create_missing`))),$(e,`Allow stale`,FM(RM(n,`allow_stale`))),bM(e,`Version message`,IM(n,`version_message`),i),$(e,`Limit`,zM(n,`limit`)),oM(e,n,`publish pages`,r?.dryRun),sM(e,n);break;case`upload_attachment`:$(e,`Page`,r?.pageId??IM(n,`page_id`)),$(e,`File`,IM(n,`file_path`)),$(e,`Filename`,r?.attachment?.filename??IM(n,`filename`)),bM(e,`Comment`,IM(n,`comment`),i),$(e,`Minor edit`,FM(RM(n,`minor_edit`))),$(e,`Update existing`,FM(RM(n,`update_existing`))),$(e,`Status`,r?.status??IM(n,`status`)),sM(e,n);break}}function $M(e,t,n,r){if(eN(t))switch(t.action){case`search_spaces`:$(e,`Returned`,PM(t.spaceCount??t.spaces.length,`space`)),$(e,`Next cursor`,t.nextCursor??VM(n.nextCursor)),vM(e,`Spaces`,t.spaces.map(OM),r);break;case`search_pages`:$(e,`Returned`,PM(t.pageCount??t.pages.length,`page`)),$(e,`Next cursor`,t.nextCursor??VM(n.nextCursor)),vM(e,`Pages`,t.pages.map(kM),r);break;case`get_page`:t.page&&$(e,`Fetched`,kM(t.page)),pM(e,t.includedCounts,XM,`Included`),uM(e,t.page),vM(e,`Attachments`,t.attachments.map(AM),r);break;case`download_pages`:$(e,`Bundle`,t.downloadDir),$(e,`Manifest`,t.manifestPath),$(e,`Pages JSONL`,t.pagesJsonlPath),$(e,`Downloaded`,PM(t.pageCount??t.pages.length,`page`)),pM(e,t.includedCounts,XM,`Included`),vM(e,`Pages`,t.pages.map(kM),r);break;case`create_page`:$(e,t.dryRun?`Would create`:`Created`,t.pageId),t.page&&$(e,`Page`,kM(t.page)),gM(e,t.payload??n.payload,r);break;case`update_page`:$(e,t.dryRun?`Would update`:`Updated`,t.pageId),t.page&&$(e,`Page`,kM(t.page)),gM(e,t.payload??n.payload,r);break;case`publish_pages`:$(e,`Processed`,PM(t.outcomeCount??t.outcomes.length,`outcome`)),$(e,`Outcome statuses`,MM(t.outcomes)),vM(e,`Outcomes`,t.outcomes.map(jM),r);break;case`upload_attachment`:{$(e,`Page`,t.pageId);let n=t.attachment??t.attachments[0];n&&$(e,`Attachment`,AM(n)),n?.snippet&&bM(e,`Storage snippet`,n.snippet,r);break}}}function eN(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 tN={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`},nN={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 rN(e,t,n={}){let r=eM(n),i=nM(e),a=rM(e),o=[tM(`Jira`,tN[t.action],e.status,t.dryRun)];return iN(o,t.action,i,t,r),aN(o,t,a,r),mM(o,t,r),hM(o,e,n),HM(o).join(`
101
- `)}function iN(e,t,n,r,i){switch(t){case`search_users`:$(e,`Query`,r?.query??IM(n,`query`)),$(e,`Project`,r?.projectKey??IM(n,`project_key`)),$(e,`Issue`,r?.issueKey??IM(n,`issue_key`)),$(e,`Limit`,zM(n,`max_results`)),$(e,`Include inactive`,FM(RM(n,`include_inactive`))),sM(e,n);break;case`search_issues`:bM(e,`JQL`,r?.jql??IM(n,`jql`),i),yM(e,`Fields`,LM(n,`fields`),i),yM(e,`Expand`,LM(n,`expand`),i),$(e,`Limit`,zM(n,`max_results`)),$(e,`Next page token`,IM(n,`next_page_token`)),$(e,`Validate query`,FM(RM(n,`validate_query`))),sM(e,n);break;case`get_issue`:$(e,`Issue`,r?.issueKey??IM(n,`issue_key`)),yM(e,`Fields`,LM(n,`fields`),i),yM(e,`Expand`,LM(n,`expand`),i),yM(e,`Includes`,fM(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),cM(e,n,[[`Comment limit`,`comment_limit`],[`Comment start`,`comment_start_at`],[`Worklog limit`,`worklog_limit`],[`Changelog limit`,`changelog_limit`]]),sM(e,n);break;case`get_project`:$(e,`Project`,r?.projectKey??IM(n,`project_key`)??`default project`),yM(e,`Includes`,fM(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`,IM(n,`issue_type_id`)),$(e,`Issue type`,IM(n,`issue_type_name`)),$(e,`Field query`,IM(n,`field_query`)),$(e,`Field limit`,zM(n,`field_limit`)),sM(e,n);break;case`create_issue`:$(e,`Project`,r?.projectKey??IM(n,`project_key`)??`default project`),$(e,`Type`,r?.issueType??IM(n,`issue_type`)),bM(e,`Summary`,r?.summary??IM(n,`summary`),i),$(e,`Parent`,IM(n,`parent_key`)),bM(e,`Description`,dM(n,`description`,`description_adf`),i),yM(e,`Labels`,LM(n,`labels`),i),yM(e,`Components`,LM(n,`components`),i),$(e,`Priority`,IM(n,`priority`)),iM(e,n,r),_M(e,`Custom fields`,n.args.fields,i),oM(e,n,`create issue`,r?.dryRun),$(e,`Return issue`,FM(RM(n,`return_issue`)));break;case`update_issue`:$(e,`Issue`,r?.issueKey??IM(n,`issue_key`)),bM(e,`New summary`,IM(n,`summary`),i),bM(e,`Description`,dM(n,`description`,`description_adf`),i),yM(e,`Labels`,LM(n,`labels`),i),$(e,`Priority`,IM(n,`priority`)),iM(e,n,r),_M(e,`Field keys`,n.args.fields,i),_M(e,`Update ops`,n.args.update,i),$(e,`Notify users`,FM(RM(n,`notify_users`))),oM(e,n,`update issue`,r?.dryRun),$(e,`Return issue`,FM(RM(n,`return_issue`)));break;case`add_comment`:{$(e,`Issue`,r?.issueKey??IM(n,`issue_key`)),bM(e,`Comment`,dM(n,`body`,`body_adf`),i);let t=BM(n.args.visibility);Object.keys(t).length>0&&$(e,`Visibility`,[VM(t.type),VM(t.value)].filter(Boolean).join(` · `)),$(e,`Return comment`,FM(RM(n,`return_comment`))),n.status!==`completed`&&$(e,`Mode`,`will add comment`);break}case`transition_issue`:{$(e,`Issue`,r?.issueKey??IM(n,`issue_key`));let t=IM(n,`transition`);$(e,`Transition`,t??(r?.transition?void 0:`list available transitions`)),$(e,`Resolution`,IM(n,`resolution`)),bM(e,`Comment`,dM(n,`comment`,`comment_adf`),i),_M(e,`Field keys`,n.args.fields,i),_M(e,`Update ops`,n.args.update,i),t&&oM(e,n,`transition issue`,r?.dryRun);break}}}function aN(e,t,n,r){if(oN(t))switch(t.action){case`search_users`:$(e,`Returned`,PM(t.userCount??t.users.length,`user`)),vM(e,`Users`,t.users.map(EM),r);break;case`search_issues`:{let n=PM(t.issueCount??t.issues.length,`issue`);$(e,`Returned`,t.total!==void 0&&n?`${n} (${t.total} total)`:n),$(e,`Next page token`,t.nextPageToken),vM(e,`Issues`,t.issues.map(CM),r);break}case`get_issue`:t.issue&&$(e,`Fetched`,CM(t.issue)),pM(e,t.includedCounts,nN,`Included`),vM(e,`Transitions`,t.transitions.map(TM),r);break;case`get_project`:t.project&&$(e,`Project`,wM(t.project)),pM(e,t.includedCounts,nN,`Included`),vM(e,`Fields`,t.fields.map(DM),r);break;case`create_issue`:$(e,t.dryRun?`Would create`:`Created`,t.issueKey??VM(n.id)),$(e,`Jira id`,VM(n.id)),t.issue&&$(e,`Returned issue`,CM(t.issue)),aM(e,t),gM(e,t.payload??n.payload,r);break;case`update_issue`:$(e,t.dryRun?`Would update`:`Updated`,t.issueKey),$(e,`Updated fields`,PM(t.updatedFieldCount??t.updatedFields?.length,`field`)),yM(e,`Updated field keys`,t.updatedFields,r),t.issue&&$(e,`Returned issue`,CM(t.issue)),aM(e,t),gM(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`,TM(t.transition)),gM(e,t.payload??n.payload,r)):($(e,`Available`,PM(t.transitionCount??t.transitions.length,`transition`)),vM(e,`Transitions`,t.transitions.map(TM),r)),vM(e,`Transition fields`,t.fields.map(DM),r);break}}function oN(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 sN(e,t){return{text:e,tone:t?`info`:`success`}}function cN(e,t){if(t===`completed`)switch(e.action){case`create_issue`:{if(e.dryRun)return sN(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 sN(`Created ${e.issueKey}${t}`,!1)}case`update_issue`:{if(!e.issueKey)return;if(e.dryRun)return sN(`Dry run — would update ${e.issueKey}`,!0);let t=e.updatedFieldCount??e.updatedFields?.length,n=t===void 0?``:` · ${t} field${t===1?``:`s`}`;return sN(`Updated ${e.issueKey}${n}`,!1)}case`add_comment`:{if(!e.issueKey)return;let t=e.commentId?` · id ${e.commentId}`:``;return sN(`Comment added to ${e.issueKey}${t}`,!1)}case`transition_issue`:return!e.transition||!e.issueKey?void 0:e.dryRun?sN(`Dry run — would transition ${e.issueKey}`,!0):sN(`Transitioned ${e.issueKey}`,!1);default:return}}function lN(e,t){if(t===`completed`)switch(e.action){case`create_page`:{let t=e.title??e.page?.title;return e.dryRun?sN(t?`Dry run — would create page "${t}"`:`Dry run — would create page`,!0):t?sN(`Created page "${t}"`,!1):void 0}case`update_page`:{let t=e.title??e.page?.title;if(e.dryRun)return sN(t?`Dry run — would update page "${t}"`:`Dry run — would update page`,!0);if(!t)return;let n=e.page?.versionNumber;return sN(`Updated page "${t}"${n===void 0?``:` · v${n}`}`,!1)}case`upload_attachment`:{let t=e.attachment?.filename??e.attachment?.title;return t?sN(`Uploaded ${t}`,e.dryRun):void 0}case`download_pages`:{let t=e.pageCount??e.pages.length;return t<=0?void 0:sN(`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?sN(`Dry run — ${n}`,!0):sN(`Published ${n}`,!1)}default:return}}function uN(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 dN(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 fN(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||cN(e,t)||uN(e,t))}function pN(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||lN(e,t)||dN(e,t))}var mN=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 hN(e,t){let n=F(t,`tone`,3,`default`),r={success:`text-success`,info:`text-info`,default:`text-muted-foreground`},i=q(()=>t.icon);var a=mN(),o=V(a),s=e=>{var t=U(),a=L(t);{let e=q(()=>`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=I(o,2),l=V(c,!0);d(c),d(a),P(()=>A(l,t.text)),g(e,a)}var gN=new Set([`$$slots`,`$$events`,`$$legacy`]);function _N(e,t){let n=H(t,gN),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`}]];N(e,B({name:`paperclip`},()=>n,{get iconNode(){return r}}))}var vN={success:`good`,warning:`warn`,info:`running`,muted:`neutral`,default:`neutral`};function yN(e){return vN[xN(e)]}function bN(e){return vN[SN(e)]}function xN(e){let t=e?.trim().toLowerCase();return t?t===`current`?`success`:t===`draft`?`warning`:t===`archived`||t===`deleted`?`muted`:`info`:`muted`}function SN(e){let t=e?.trim().toLowerCase();return t===`created`||t===`updated`?`success`:t===`dry_run`||t===`skipped`||t===`error`?`warning`:`muted`}function CN(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 wN(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 TN=h(`<span class="text-xs text-muted-foreground"> </span>`),EN=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!> <!></div>`),DN=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>`),ON=h(`<code class="block break-all text-xs text-muted-foreground"> </code>`),kN=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 AN(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),i=q(()=>t.attachment.filename??t.attachment.title??t.attachment.id??`attachment`),o=q(()=>wN(t.attachment.fileSize)),s=q(()=>!!(t.attachment.mediaType||W(o)||t.attachment.versionNumber!==void 0));var c=kN(),l=V(c),u=V(l);_N(u,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var f=I(u,2),p=V(f,!0);d(f),d(l);var m=I(l,2),h=e=>{var n=EN(),r=V(n),i=e=>{var n=TN(),r=V(n,!0);d(n),P(()=>A(r,t.attachment.mediaType)),g(e,n)};k(r,e=>{t.attachment.mediaType&&e(i)});var a=I(r,2),s=e=>{var t=TN(),n=V(t,!0);d(t),P(()=>A(n,W(o))),g(e,t)};k(a,e=>{W(o)&&e(s)});var c=I(a,2),l=e=>{Hi(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>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 _=I(m,2),v=e=>{var n=DN(),i=I(V(n),2),a=V(i,!0);d(i),d(n),P(e=>{K(n,`title`,t.attachment.path),A(a,e)},[()=>xx(t.attachment.path)]),r(`click`,n,()=>t.onOpenFile?.(t.attachment.path)),g(e,n)};k(_,e=>{n()&&t.attachment.path&&e(v)});var y=I(_,2),b=e=>{var n=ON(),r=V(n,!0);d(n),P(()=>A(r,t.attachment.snippet)),g(e,n)};k(y,e=>{n()&&t.attachment.snippet&&e(b)}),d(c),P(()=>A(p,W(i))),g(e,c),R()}T([`click`]);var jN=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>`),MN=h(`<div class="flex flex-wrap gap-1.5"></div>`);function NN(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=q(()=>n.flatMap(([e,n])=>{let r=t.counts[e];return typeof r==`number`?[{label:n,value:r}]:[]}));var i=U(),o=L(i),s=e=>{var t=MN();_(t,21,()=>W(r),e=>e.label,(e,t)=>{var n=jN(),r=V(n),i=V(r,!0);d(r);var a=I(r,2),o=V(a,!0);d(a),d(n),P(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),R()}var PN=h(`<code class="font-mono text-xs text-sidebar-foreground"> </code>`),FN=h(`<span> </span>`),IN=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 LN(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>t.outcome.status??t.outcome.operation??`row`);var i=IN(),o=V(i);{let e=q(()=>bN(t.outcome.status));Hi(o,{get tone(){return W(e)},size:`xs`,children:(e,t)=>{w();var n=M();P(()=>A(n,W(r))),g(e,n)},$$slots:{default:!0}})}var c=I(o,2),l=e=>{var n=PN(),r=V(n,!0);d(n),P(()=>A(r,t.outcome.id)),g(e,n)};k(c,e=>{t.outcome.id&&e(l)});var u=I(c,2),f=e=>{var r=FN(),i=V(r,!0);d(r),P(()=>{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=I(u,2),m=e=>{var r=FN(),i=V(r,!0);d(r),P(()=>{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),R()}var RN=new Set([`$$slots`,`$$events`,`$$legacy`]);function zN(e,t){let n=H(t,RN),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`}]];N(e,B({name:`external-link`},()=>n,{get iconNode(){return r}}))}var BN=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>`),VN=h(`<span class="font-mono text-xs font-semibold text-sidebar-foreground"> </span>`),HN=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>`),WN=h(`<span class="text-xs text-muted-foreground">Parent <code> </code></span>`),GN=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!> <!> <!></div>`),KN=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>`),qN=h(`<div class="flex flex-wrap gap-x-3 gap-y-1 text-xs"></div>`),JN=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 YN(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),i=q(()=>CN(t.siteUrl,t.page.webui)),o=q(()=>!!(t.page.status||t.page.versionNumber!==void 0||t.page.spaceKey||t.page.parentId)),s=q(()=>[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=JN(),l=V(c),u=V(l),f=V(u);$u(f,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var p=I(f,2),m=e=>{var n=BN(),r=V(n);zN(I(r),{size:11,strokeWidth:2,class:`opacity-70`}),d(n),P(()=>{K(n,`href`,W(i)),K(n,`title`,`Open ${t.page.id} in Confluence`),A(r,`${t.page.id??``} `)}),g(e,n)},h=e=>{var n=VN(),r=V(n,!0);d(n),P(()=>A(r,t.page.id)),g(e,n)};k(p,e=>{W(i)?e(m):e(h,-1)}),d(u);var v=I(u,2),y=e=>{var n=HN(),r=V(n,!0);d(n),P(()=>A(r,t.page.title)),g(e,n)};k(v,e=>{t.page.title&&e(y)}),d(l);var b=I(l,2),x=e=>{var n=GN(),r=V(n),i=e=>{{let n=q(()=>yN(t.page.status));Hi(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.page.status)),g(e,r)},$$slots:{default:!0}})}};k(r,e=>{t.page.status&&e(i)});var a=I(r,2),o=e=>{Hi(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,`v${t.page.versionNumber??``}`)),g(e,r)},$$slots:{default:!0}})};k(a,e=>{t.page.versionNumber!==void 0&&e(o)});var s=I(a,2),c=e=>{var n=UN(),r=V(n);d(n),P(()=>A(r,`Space ${t.page.spaceKey??``}`)),g(e,n)};k(s,e=>{t.page.spaceKey&&e(c)});var l=I(s,2),u=e=>{var n=WN(),r=I(V(n)),i=V(r,!0);d(r),d(n),P(()=>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=I(b,2),C=e=>{var n=qN();_(n,21,()=>W(s),e=>e.path,(e,n)=>{var i=KN(),a=V(i),o=V(a,!0);d(a);var s=I(a,2),c=V(s,!0);d(s),d(i),P(e=>{K(i,`title`,W(n).path),A(o,W(n).label),A(c,e)},[()=>xx(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),R()}T([`click`]);var XN=new Set([`$$slots`,`$$events`,`$$legacy`]);function ZN(e,t){let n=H(t,XN),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`}]];N(e,B({name:`database`},()=>n,{get iconNode(){return r}}))}var QN=h(`<span class="font-mono text-xs font-semibold text-sidebar-foreground"> </span>`),$N=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),eP=h(`<span class="text-xs text-muted-foreground"> </span>`),tP=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!></div>`),nP=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 rP(e,t){a(t,!0);let n=q(()=>!!(t.space.status||t.space.type));var r=nP(),i=V(r),o=V(i),s=V(o);ZN(s,{size:13,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var c=I(s,2),l=e=>{var n=QN(),r=V(n,!0);d(n),P(()=>A(r,t.space.key)),g(e,n)};k(c,e=>{t.space.key&&e(l)});var u=I(c,2),f=V(u,!0);d(u),d(o);var p=I(o,2),m=e=>{var n=$N(),r=V(n,!0);d(n),P(()=>A(r,t.space.name)),g(e,n)};k(p,e=>{t.space.name&&e(m)}),d(i);var h=I(i,2),_=e=>{var n=tP(),r=V(n),i=e=>{{let n=q(()=>yN(t.space.status));Hi(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.space.status)),g(e,r)},$$slots:{default:!0}})}};k(r,e=>{t.space.status&&e(i)});var a=I(r,2),o=e=>{var n=eP(),r=V(n,!0);d(n),P(()=>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),P(()=>A(f,t.space.id)),g(e,r),R()}var iP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]),aP=h(`<div></div>`);function oP(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,iP);var i=aP();O(i,e=>({"data-slot":`skeleton`,class:e,...r}),[()=>he(`bg-muted rounded-md animate-pulse`,t.class)]),pe(i,e=>n(e),()=>n()),g(e,i),R()}var sP=h(`<!> <!>`,1),cP=h(`<div class="grid gap-1.5"><span class="text-xs font-medium text-muted-foreground"> </span> <!></div>`),lP=h(`<dt class="text-muted-foreground"> </dt> <dd><!></dd>`,1),uP=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 dP(e,t){a(t,!0);let n=e=>{var n=U(),a=L(n),o=e=>{var n=cP(),a=V(n),o=V(a,!0);d(a);var s=I(a,2),c=e=>{{let n=q(()=>!r()&&!!t.body.text.language);Lj(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=sP(),n=L(t);oP(n,{class:`h-3 w-full`}),oP(I(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),P(()=>A(o,t.body.text.label)),g(e,n)};k(a,e=>{t.body.text&&e(o)}),g(e,n)},r=F(t,`streaming`,3,!1),i=F(t,`fixedRows`,3,6),o=q(()=>t.body.fields.filter(e=>e.value!==void 0||r())),c=q(()=>!!(t.body.text&&(t.body.text.text!==void 0||r())));var l=U(),u=L(l),f=e=>{var t=uP(),r=V(t);_(r,21,()=>W(o),e=>e.label,(e,t)=>{var n=lP(),r=L(n),i=V(r,!0);d(r);var a=I(r,2);let o;var c=V(a),l=e=>{var n=M();P(()=>A(n,W(t).value)),g(e,n)},u=e=>{oP(e,{class:`h-3 w-24`})};k(c,e=>{W(t).value===void 0?e(u,-1):e(l)}),d(a),P(()=>{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=I(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),R()}var fP=h(`<p class="m-0 text-xs font-medium text-muted-foreground"> </p>`),pP=h(`<div class="grid gap-1.5"><!> <!></div>`),mP=h(`<dt class="text-muted-foreground"> </dt> <dd> </dd>`,1),hP=h(`<dl class="m-0 grid gap-x-3 gap-y-1 text-sm sm:grid-cols-[max-content_minmax(0,1fr)]"></dl>`),gP=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 _P(e,t){a(t,!0);let n=F(t,`fixedRows`,3,6),r=F(t,`highlight`,3,!0),i=F(t,`streaming`,3,!1);var o=U(),c=L(o),l=e=>{var i=pP(),a=V(i),o=e=>{var n=fP(),r=V(n,!0);d(n),P(()=>A(r,t.body.label)),g(e,n)};k(a,e=>{t.body.label&&e(o)});var s=I(a,2);{let e=q(()=>t.body.language===`text`?void 0:t.body.language),i=q(()=>r()&&t.body.language!==`text`);Lj(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=pP(),i=V(r),a=e=>{var n=fP(),r=V(n,!0);d(n),P(()=>A(r,t.body.label)),g(e,n)};k(i,e=>{t.body.label&&e(a)}),Lj(I(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=hP();_(n,23,()=>t.body.items,(e,t)=>`${e.label}:${t}`,(e,t)=>{var n=mP(),r=L(n),i=V(r,!0);d(r);var a=I(r,2);let o;var c=V(a,!0);d(a),P(()=>{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=q(()=>t.body.items.map(e=>({todo:e.text,done:e.done})));zv(e,{get items(){return W(n)}})}},m=e=>{dP(e,{get body(){return t.body},get streaming(){return i()},get fixedRows(){return n()}})},h=e=>{var n=gP(),r=V(n),i=e=>{var n=fP(),r=V(n,!0);d(n),P(()=>A(r,t.body.label)),g(e,n)};k(r,e=>{t.body.kind===`text-summary`&&t.body.label&&e(i)});var a=I(r,2),o=V(a,!0);d(a),d(n),P(()=>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),R()}var vP=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>`),yP=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>`),bP=h(`<p class="m-0 text-xs text-muted-foreground">More results available.</p>`),xP=h(`<!> <!>`,1),SP=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),CP=h(`<div class="grid gap-1.5"><!> <!> <!></div>`),wP=h(`<p class="m-0 text-xs text-muted-foreground">No Confluence summary available. Open Details for raw arguments and result.</p>`);function TP(e,t){a(t,!0);let n=(e,n=D)=>{var i=U(),a=L(i),o=e=>{var i=vP(),a=V(i);On(a,{size:12,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var o=I(a,2),s=V(o,!0);d(o),d(i),P(()=>{K(i,`title`,n()),A(s,n())}),r(`click`,i,()=>t.onOpenFile?.(n())),g(e,i)},s=e=>{var t=yP(),r=V(t);On(r,{size:12,strokeWidth:2,class:`shrink-0 text-muted-foreground`});var i=I(r,2),a=V(i,!0);d(i),d(t),P(()=>{K(t,`title`,n()),A(a,n())}),g(e,t)};k(a,e=>{t.onOpenFile?e(o):e(s,-1)}),g(e,i)},i=F(t,`expanded`,3,!1),o=OA(),s=q(()=>o.atlassian?.confluenceSiteUrl()),c=q(()=>i()?1/0:5),l=q(()=>lN(t.view,t.toolCall.status)),u=q(()=>dN(t.view,t.toolCall.status)),f=q(()=>pN(t.view,t.toolCall.status)),p=q(()=>W(f)?void 0:ZM(t.toolCall,t.view,{expanded:i()})),m=q(()=>{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=q(()=>t.view.action===`download_pages`?[t.view.downloadDir,...i()?[t.view.manifestPath,t.view.pagesJsonlPath]:[]].filter(e=>!!e):[]);var v=U(),y=L(v),b=e=>{var r=CP(),a=V(r),o=e=>{{let t=q(()=>W(l).tone===`info`?qj:Fv);hN(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=I(a,2),p=e=>{var n=xP(),r=L(n);_(r,17,()=>t.view.pages.slice(0,W(c)),e=>e.id,(e,n)=>{YN(e,{get page(){return W(n)},get siteUrl(){return W(s)},get expanded(){return i()},get onOpenFile(){return t.onOpenFile}})});var a=I(r,2),o=e=>{g(e,bP())};k(a,e=>{t.view.nextCursor&&e(o)}),g(e,n)},v=e=>{var n=U();_(L(n),17,()=>t.view.spaces.slice(0,W(c)),e=>e.id,(e,t)=>{rP(e,{get space(){return W(t)}})}),g(e,n)},y=e=>{var n=xP(),r=L(n),a=e=>{YN(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=I(r,2),c=e=>{NN(e,{get counts(){return W(m)}})};k(o,e=>{W(m)&&e(c)}),g(e,n)},b=e=>{var r=xP(),a=L(r);_(a,16,()=>W(h),e=>e,(e,t)=>{n(e,()=>t)}),_(I(a,2),17,()=>t.view.pages.slice(0,W(c)),e=>e.id,(e,n)=>{YN(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=L(n),a=e=>{YN(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();_(L(n),19,()=>t.view.outcomes.slice(0,W(c)),(e,t)=>e.id??e.index??t,(e,t)=>{LN(e,{get outcome(){return W(t)},get expanded(){return i()}})}),g(e,n)},C=e=>{var n=U(),r=L(n),a=e=>{AN(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=I(f,2),T=e=>{var t=SP(),n=V(t,!0);d(t),P(()=>A(n,W(u))),g(e,t)};k(w,e=>{W(u)&&e(T)}),d(r),g(e,r)},x=e=>{{let t=q(()=>({kind:`atlassian-summary`,text:W(p)}));_P(e,{get body(){return W(t)}})}},S=e=>{g(e,wP())};k(y,e=>{W(f)?e(b):W(p)?e(x,1):t.toolCall.status===`completed`&&e(S,2)}),g(e,v),R()}T([`click`]);var EP=h(`<p class="m-0 text-xs text-muted-foreground">No changes.</p>`);function DP(e,t){a(t,!0);let n=F(t,`expanded`,3,!1);var r=U(),i=L(r),o=e=>{Bj(e,{get text(){return t.view.diff},language:`diff`,direction:`tail`,get expanded(){return n()}})},s=e=>{g(e,EP())};k(i,e=>{t.view.diff?e(o):t.toolCall.status===`completed`&&e(s,1)}),g(e,r),R()}var OP=new Set([`$$slots`,`$$events`,`$$legacy`]);function kP(e,t){let n=H(t,OP),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`}]];N(e,B({name:`messages-square`},()=>n,{get iconNode(){return r}}))}function AP(e){let t=gb(e),n=t.objectArraySources(`tasks`);if(n.length===0){let e=t.string(`task`);return[jP(0,1,t.string(`label`),e)]}let r=n.length;return n.map((e,t)=>jP(t,r,e.string(`label`),e.string(`task`)))}function jP(e,t,n,r){return{key:`task-${e}`,index:e,count:t,label:n,task:r,status:`drafting`}}var MP=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function NP(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=H(t,MP);var i=U();C(L(i),()=>zs,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),R()}var PP=new Set([`$$slots`,`$$events`,`$$legacy`]);function FP(e,t){let n=H(t,PP);var r=U();C(L(r),()=>We,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var IP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function LP(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,IP);var i=U(),o=L(i);{let e=q(()=>he(`leading-none font-medium`,t.class));C(o,()=>Ke,(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),R()}h(`<div><!> <!></div>`),h(`<div><!></div>`);var RP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function zP(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,RP);var i=U(),o=L(i);{let e=q(()=>he(`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,()=>at,(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),R()}var BP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`portalProps`,`children`,`showCloseButton`,`layout`]),VP=h(`<!> <span class="sr-only">Close</span>`,1),HP=h(`<!> <!>`,1);function UP(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`showCloseButton`,3,!0),i=F(t,`layout`,3,`default`),o=H(t,BP);FP(e,B(()=>t.portalProps,{children:(e,a)=>{var s=HP(),c=L(s);C(c,()=>zP,(e,t)=>{t(e,{})});var l=I(c,2);{let e=q(()=>he(`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,()=>Ks,(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=HP(),a=L(i);u(a,()=>t.children??D);var o=I(a,2),s=e=>{var t=U(),n=L(t);{let e=(e,t)=>{Oe(e,B({variant:`ghost`,class:`absolute top-4 right-4`,size:`icon-sm`},()=>t?.().props,{children:(e,t)=>{var n=VP();y_(L(n),{}),w(2),g(e,n)},$$slots:{default:!0}}))};C(n,()=>Hs,(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}})),R()}var WP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function GP(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,WP);var i=U(),o=L(i);{let e=q(()=>he(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,t.class));C(o,()=>mt,(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),R()}var KP=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`type`]);function qP(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`type`,3,`button`),i=H(t,KP);var o=U();C(L(o),()=>Hs,(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),R()}var JP=h(`<div class="dialog-header-actions"><!></div>`),YP=h(`<footer class="dialog-footer"><!></footer>`),XP=h(`<header class="dialog-header"><div class="dialog-title-block"><!> <!></div> <!> <!></header> <div><!></div> <!>`,1);function ZP(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`title`,3,`Dialog`),i=F(t,`class`,3,``),o=F(t,`closeLabel`,3,`Close dialog`),c=F(t,`size`,3,`default`),l=F(t,`flush`,3,!1);function f(e){n(e),t.onOpenChange?.(e)}var p=U();C(L(p),()=>NP,(e,a)=>{a(e,{onOpenChange:f,get open(){return n()},set open(e){n(e)},children:(e,n)=>{var a=U(),f=L(a);{let e=q(()=>he(`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(f,()=>UP,(n,i)=>{i(n,{showCloseButton:!1,layout:`shell`,get class(){return W(e)},children:(e,n)=>{var i=XP(),a=L(i),c=V(a),f=V(c);C(f,()=>LP,(e,t)=>{t(e,{class:`dialog-title`,children:(e,t)=>{w();var n=M();P(()=>A(n,r())),g(e,n)},$$slots:{default:!0}})});var p=I(f,2),m=e=>{var n=U();C(L(n),()=>GP,(e,n)=>{n(e,{class:`dialog-description`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.description)),g(e,r)},$$slots:{default:!0}})}),g(e,n)};k(p,e=>{t.description&&e(m)}),d(c);var h=I(c,2),_=e=>{var n=JP();u(V(n),()=>t.headerActions),d(n),g(e,n)};k(h,e=>{t.headerActions&&e(_)}),C(I(h,2),()=>qP,(e,t)=>{t(e,{class:`dialog-close`,get"aria-label"(){return o()},children:(e,t)=>{y_(e,{size:14,strokeWidth:2.25,"aria-hidden":`true`})},$$slots:{default:!0}})}),d(a);var v=I(a,2);u(V(v),()=>t.children??D),d(v);var y=I(v,2),b=e=>{var n=YP();u(V(n),()=>t.footer),d(n),g(e,n)};k(y,e=>{t.footer&&e(b)}),P(e=>s(v,1,e),[()=>x(he(`dialog-body`,l()&&`dialog-body-flush`))]),g(e,i)},$$slots:{default:!0}})})}g(e,a)},$$slots:{default:!0}})}),g(e,p),R()}function QP({atEnd:e,scrollDelta:t,userScrollAwayIntent:n,scrollbarPointerActive:r,epsilon:i=1}){return e?!1:r?!0:n&&t<-i}var $P=30,eF=2400,tF=32,nF=100,rF=350,iF=120,aF=1,oF=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),sF=new Set([`ArrowUp`,`Home`,`PageUp`]);function cF(e){return Math.max(e.scrollHeight-e.clientHeight-e.scrollTop,0)}function lF(e,t=tF){return cF(e)<=t}function uF(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 dF(e){let t=J(void 0),n=J(0),r=J(void 0),i=J(!0),a=J(!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},iF)}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(lF(e,tF)){G(a,!0);return}u&&cF(e)>nF&&(G(a,!1),_());return}if(t?.isAtEnd(tF)){G(a,!0);return}u&&(t?.getDistanceFromEnd()??0)>nF&&(G(a,!1),_())}function b(){G(a,!1),_()}function x(e){f||(u=e?.scrollAwayIntent??!!e?.disableFollowImmediately,e?.disableFollowImmediately&&b(),m(),d=setTimeout(()=>{u=!1,d=void 0},rF),requestAnimationFrame(()=>y(e?.viewport)))}function S(){let e=W(r);e&&(G(a,!0),e.getDistanceFromEnd()<=eF?v({behavior:`smooth`}):C())}function C(){_(),G(a,!0);let e=0,t=()=>{l=void 0,e+=1;let n=W(r);if(!n){e<$P&&(l=requestAnimationFrame(t));return}v({behavior:`instant`}),!n.isAtEnd(tF)&&e<$P&&(l=requestAnimationFrame(t))};l=requestAnimationFrame(t)}return z(()=>{if(!W(i))return;let e=W(r)?.getViewportElement();e&&!lF(e,tF)||G(a,!0)}),z(()=>{let t=e.active?.()??!0,n=e.conversationId(),r=e.contentReady(),i=t&&!s;if(s=t,n!==o&&(o=n,c=!1,G(a,!0),_()),!t){_();return}if(!(!e.conversationOpen()||!n||!r)){if(!c){c=!0,ge().then(C);return}i&&W(a)&&ge().then(C)}}),z(()=>{let r=W(t),i=e.active?.()??!0;if(!r||typeof ResizeObserver>`u`)return;let a=()=>{G(n,i?r.offsetHeight:0,!0)};a();let o=new ResizeObserver(a);return o.observe(r),()=>o.disconnect()}),z(()=>{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=lF(e,tF);if(o){G(a,!0);return}QP({atEnd:o,scrollDelta:i,userScrollAwayIntent:u,scrollbarPointerActive:n,epsilon:aF})&&b()},o=t=>{n=uF(t,e),n&&x({disableFollowImmediately:!0,viewport:e})},s=()=>{n&&x({disableFollowImmediately:!0,viewport:e})},c=()=>{n&&lF(e,tF)&&G(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(!oF.has(t.key))return;let n=sF.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)}}),z(()=>()=>{_(),m(),h(),u=!1,f=!1}),{get composerWrapEl(){return W(t)},set composerWrapEl(e){G(t,e,!0)},get composerHeight(){return W(n)},get controller(){return W(r)},set controller(e){G(r,e,!0)},get atEnd(){return W(i)},set atEnd(e){G(i,e,!0)},get followBottom(){return W(a)},scrollToEnd:v,jumpToBottom:S}}function fF(e){return e.kind===`message`&&e.item.role===`assistant`&&e.item.displayKind===`thinking`}function pF(e){let t=[];for(let n of e){if(!fF(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 mF=h(`<p>Provider returned redacted thinking.</p>`),hF=h(`<span class="stream-caret svelte-ngmo3" aria-hidden="true"></span>`),gF=h(`<div><!> <!></div>`),_F=h(`<div><!></div>`),vF=h(`<div class="thinking-group svelte-ngmo3"><div class="thinking-content svelte-ngmo3"></div></div>`);function yF(e,t){var n=vF(),r=V(n);_(r,23,()=>t.items,(e,t)=>e.id??t,(e,t)=>{let n=q(()=>!!(W(t).live&&!W(t).done));var r=_F();let i;var a=V(r),o=e=>{var t=mF();let r;P(()=>r=s(t,1,`redacted svelte-ngmo3`,null,r,{"live-caret":W(n)})),g(e,t)},c=e=>{var r=gF();let i;var a=V(r);TA(a,{get text(){return W(t).text},get streaming(){return W(n)},get onCopy(){return vS}});var o=I(a,2),c=e=>{g(e,hF())};k(o,e=>{W(n)&&!W(t).text&&e(c)}),d(r),P(()=>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),P(()=>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 bF=h(`<span class="elapsed svelte-8dfbf0"> </span>`),xF=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 SF(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=J(0);z(()=>{let e=Date.now(),t=setInterval(()=>{G(i,Math.floor((Date.now()-e)/1e3),!0)},250);return()=>clearInterval(t)});let o=q(()=>`${Math.floor(W(i)/60)}:${String(W(i)%60).padStart(2,`0`)}`);var s=xF(),c=I(V(s),2),l=V(c,!0);d(c);var u=I(c,2),f=e=>{var t=bF(),n=V(t,!0);d(t),P(()=>A(n,W(o))),g(e,t)};k(u,e=>{W(i)>=3&&e(f)}),d(s),P(()=>A(l,r)),g(e,s),R()}var CF=new Set([`$$slots`,`$$events`,`$$legacy`]);function wF(e,t){let n=H(t,CF),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`}]];N(e,B({name:`circle-alert`},()=>n,{get iconNode(){return r}}))}var TF=new Set([`$$slots`,`$$events`,`$$legacy`]);function EF(e,t){let n=H(t,TF),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`}]];N(e,B({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var DF=new Set([`$$slots`,`$$events`,`$$legacy`]);function OF(e,t){let n=H(t,DF),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m15 9-6 6`}],[`path`,{d:`m9 9 6 6`}]];N(e,B({name:`circle-x`},()=>n,{get iconNode(){return r}}))}var kF=h(`<span class="tool-status-glyph inline-flex size-full items-center justify-center svelte-1ya8e7m"><!></span>`),AF=h(`<span><!></span>`);function jF(e,t){a(t,!0);let n=F(t,`pulse`,3,!1),r=F(t,`waitingForUser`,3,!1),i=F(t,`size`,3,14),c=q(()=>!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:Nv,good:Fv,warn:wF,danger:OF,neutral:Nv,accent:Nv},p=q(()=>r()?EF:f[t.tone]),m=q(()=>`${r()?`waiting`:W(c)?`spin`:`static`}:${t.tone}`);var h=AF();let _;o(V(h),()=>W(m),e=>{var n=kF(),r=V(n),a=e=>{{let n=q(()=>`width:${i()}px;height:${i()}px`),r=q(()=>he(`block`,u[t.tone])),a=q(()=>t.label?void 0:`true`);zi(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=L(n);{let e=q(()=>he(`block`,u[t.tone])),n=q(()=>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),P(e=>{s(h,1,e,`svelte-1ya8e7m`),_=l(h,``,_,{width:`${i()}px`,height:`${i()}px`})},[()=>x(he(`inline-flex shrink-0 items-center justify-center`,t.class))]),g(e,h),R()}var MF=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 NF(e,t){a(t,!0);let n=q(()=>si(t.error,{headLines:18,tailLines:6,maxChars:6e3}).text);var r=MF(),i=V(r),o=V(i);jF(o,{tone:`danger`,size:14,class:`mr-1.5 align-middle`});var s=I(o,2),c=V(s,!0);d(s),d(i);var l=I(i,2),u=V(l,!0);d(l),d(r),P(()=>{A(c,t.toolName),A(u,W(n))}),g(e,r),R()}var PF=h(`<div class="grid gap-3 p-6" aria-label="Loading subagent transcript"><!> <!> <!></div>`),FF=h(`<div class="grid place-items-center gap-3 p-8 text-center"><p class="m-0 text-sm text-destructive"> </p> <!></div>`),IF=h(`<span class="text-destructive"> </span>`),LF=h(`<div class="border-b bg-muted/30 px-4 py-2 text-xs text-muted-foreground"><!> <!></div>`),RF=h(`<div class="grid place-items-center p-8 text-sm text-muted-foreground">No transcript activity yet.</div>`),zF=h(`<article class="relative w-full min-w-0 p-3 text-sm"><!></article>`),BF=h(`<div class="min-w-0 px-3"><!></div>`),VF=h(`<article class="min-w-0 p-3 text-sm"><!></article>`),HF=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>`),UF=h(`<article><!> <!></article>`),WF=h(`<div class="relative min-h-0"><!> <!></div>`),GF=h(`<div class="grid h-full min-h-0 grid-rows-[auto_1fr]"><!> <!></div>`);function KF(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=OA(),i=J(void 0),o=J(void 0),c=J(!1),l=J(void 0),u=J(0),f=q(()=>Kt(W(o))),p=q(()=>{let e=pF(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=dF({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}z(()=>{let e=t.parentAgentId,a=t.childAgentId;if(W(u),!n()||!e||!a)return;let s=r.watchSubagentTranscript;if(!s){G(l,`Subagent transcripts are unavailable here.`);return}return G(c,!W(i)),G(l,void 0),s(e,a,{snapshot:t=>{t.parentAgentId!==e||t.agentId!==a||(G(i,t,!0),G(o,lee(t),!0),G(c,!1),G(l,void 0))},event:e=>{if(!W(o))return;let t=!1;return G(o,Lt(W(o),e,()=>{t=!0,G(l,`Live activity was interrupted; recovering the transcript.`)}),!0),!t},error:e=>{G(c,!1),G(l,e,!0)}})}),z(()=>{t.childAgentId&&(G(i,void 0),G(o,void 0),G(l,void 0))});function _(e){n(e),t.onOpenChange?.(e)}{let r=q(()=>`${t.label} transcript`),a=q(()=>W(i)?[W(i).status,W(i).model,W(i).thinkingLevel].filter(Boolean).join(` · `):`Read-only child-agent activity`);ZP(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=L(r),o=e=>{var t=PF(),n=V(t);oP(n,{class:`h-16 w-3/4`});var r=I(n,2);oP(r,{class:`h-24 w-full`}),oP(I(r,2),{class:`h-20 w-4/5`}),d(t),g(e,t)},f=e=>{var t=FF(),n=V(t),r=V(n,!0);d(n),Oe(I(n,2),{size:`sm`,variant:`outline`,onclick:()=>G(u,W(u)+1),children:(e,t)=>{w(),g(e,M(`Retry`))},$$slots:{default:!0}}),d(t),P(()=>A(r,W(l))),g(e,t)},_=e=>{var n=GF(),r=V(n),a=e=>{var t=LF(),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=I(n,2),o=e=>{var t=IF(),n=V(t,!0);d(t),P(()=>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=I(r,2),c=e=>{g(e,RF())},u=e=>{var n=WF(),r=V(n);{let e=(e,t)=>{let n=()=>t?.().item;var r=U(),i=L(r),a=e=>{var t=zF();SF(V(t),{}),d(t),g(e,t)},o=e=>{var t=BF();vV(V(t),{get toolCall(){return n().node.toolCall},detailsEnabled:!1}),d(t),g(e,t)},c=e=>{var t=BF();NF(V(t),{get toolName(){return n().node.toolName},get error(){return n().node.error}}),d(t),g(e,t)},l=e=>{var t=VF(),r=V(t);{let e=q(()=>n().node.items.map(e=>e.item));yF(r,{get items(){return W(e)}})}d(t),g(e,t)},u=e=>{var t=UF(),r=V(t),i=e=>{Ly(e,{get text(){return n().node.item.text},pending:!1})},a=e=>{{let t=q(()=>n().node.item.role!==`assistant`);TA(e,{get text(){return n().node.item.text},get trimCodeBlocks(){return W(t)},get onCopy(){return vS}})}};k(r,e=>{n().node.item.role===`user`?e(i):e(a,-1)});var o=I(r,2),c=e=>{var t=HF(),r=V(t,!0);d(t),P(()=>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),P(()=>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=q(()=>t.parentAgentId&&t.childAgentId?`subagent-transcript:${t.parentAgentId}:${t.childAgentId}`:void 0),i=q(()=>`${t.label} subagent transcript`);Bi(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=I(r,2),a=e=>{Oe(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)=>{Xv(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}})}R()}var qF=h(`<strong class="min-w-0 truncate text-sm font-medium leading-tight"> </strong>`),JF=h(`<span class="shrink-0 rounded border px-1.5 py-0.5 text-xs leading-none text-muted-foreground"> </span>`),YF=h(`<span class="shrink-0 text-xs tabular-nums text-muted-foreground"> </span>`),XF=h(`<div class="grid gap-1" aria-hidden="true"><!> <!></div>`),ZF=h(`<!> Transcript`,1),QF=h(`<!> Report`,1),$F=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>`),eI=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),tI=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>`),nI=h(`<div class="grid gap-2"><p class="sr-only" aria-live="polite"> </p> <ol class="grid gap-2"></ol></div> <!>`,1);function rI(e,t){a(t,!0);let n=q(()=>t.view?Ab(t.view):void 0),r=q(()=>W(n)?.tasks??AP({args:t.draft?.block.args,argsText:t.draft?.block.argsText})),i=q(()=>W(n)?.summary),o=J(void 0),c=J(!1);z(()=>{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||G(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||(G(o,{taskKey:e.key,parentAgentId:t.toolCall.agentId,childAgentId:e.agentId,label:f(e),status:e.status},!0),G(c,!0))}let S=q(()=>{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=nI(),T=L(C),E=V(T),D=V(E,!0);d(E);var O=I(E,2);_(O,21,()=>W(r),e=>e.key,(e,n)=>{let r=q(()=>p(W(n)));var i=tI(),a=V(i),o=V(a),c=V(o),u=e=>{oP(e,{class:`h-4 w-2/5`})},S=e=>{var t=qF(),r=V(t,!0);d(t),P(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=I(c,2),T=e=>{var t=JF(),n=V(t,!0);d(t),P(()=>A(n,W(r))),g(e,t)};k(C,e=>{W(r)&&e(T)}),d(o);var E=I(o,2),D=V(E,!0);d(E);var O=I(E,2),ee=e=>{var t=YF(),r=V(t);d(t),P(()=>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=I(a,2),ne=e=>{var t=XF(),n=V(t);oP(n,{class:`h-3 w-full`}),oP(I(n,2),{class:`h-3 w-2/3`}),d(t),g(e,t)},j=e=>{var r=eI(),i=L(r),a=V(i),o=V(a,!0);d(a);var s=I(a,2),c=e=>{var t=YF(),r=V(t,!0);d(t),P(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=I(i,2),p=V(u),v=e=>{{let t=q(()=>`View transcript for ${f(W(n))}`);Oe(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=ZF();kP(L(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=I(p,2),S=e=>{{let r=q(()=>`Open report ${l(W(n).report.reportPath)}`);Oe(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=QF();$u(L(n),{class:`size-3`,"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}};k(y,e=>{W(n).report?.reportPath&&e(S)}),_(I(y,2),16,()=>h(W(n)),e=>e,(e,t)=>{var n=$F(),r=V(n,!0);d(n),P(()=>A(r,t)),g(e,n)}),d(u),P(e=>A(o,e),[()=>b(W(n))]),g(e,r)};k(te,e=>{W(n).status===`drafting`?e(ne):e(j,-1)}),d(i),P((e,t)=>{K(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=I(T,2),te=e=>{KF(e,{get parentAgentId(){return W(o).parentAgentId},get childAgentId(){return W(o).childAgentId},get label(){return W(o).label},onOpenChange:e=>G(c,e,!0),get open(){return W(c)},set open(e){G(c,e,!0)}})};k(ee,e=>{W(o)&&e(te)}),P(()=>A(D,W(S))),g(e,C),R()}var iI=h(`<p class="m-0 text-xs text-muted-foreground">No files found.</p>`),aI=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>`),oI=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 sI(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),i=q(()=>(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=L(o),c=e=>{g(e,iI())},l=e=>{var n=oI();_(n,21,()=>W(i),e=>e.path,(e,n)=>{var i=aI(),a=V(i),o=V(a,!0);d(a),d(i),P(()=>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),R()}T([`click`]);var cI=h(`<div class="grid gap-1.5"><p class="m-0 text-xs font-medium text-muted-foreground">Result</p> <p> </p></div>`),lI=h(`<p class="m-0 text-xs text-muted-foreground">No output.</p>`),uI=h(`<div class="grid gap-1.5"><p class="m-0 text-xs font-medium text-muted-foreground">Recorded arguments</p> <!></div>`),dI=h(`<div class="grid gap-2" aria-label="Recorded tool output"><!> <!></div>`);function fI(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>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=q(()=>({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=dI(),c=V(o),l=e=>{var r=cI(),i=I(V(r),2);let a;var o=V(i,!0);d(i),d(r),P(()=>{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=>{_P(e,{get body(){return W(r)}})},f=e=>{g(e,lI())};k(c,e=>{t.view.resultText?e(l):W(r)?e(u,1):t.toolCall.status===`completed`&&e(f,2)});var p=I(c,2),m=e=>{var t=uI();_P(I(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),R()}var pI=h(`<button class="match svelte-17w44lw" type="button"><span class="line-no svelte-17w44lw"> </span><span class="line-text svelte-17w44lw"> </span></button>`),mI=h(`<div class="file"><button class="file-path svelte-17w44lw" type="button" title="Open file pane"> </button> <!></div>`),hI=h(`<div class="matches svelte-17w44lw"></div>`),gI=h(`<p class="note svelte-17w44lw">No matches.</p>`);function _I(e,t){a(t,!0);let n=(e,n=D)=>{var i=hI();_(i,21,n,e=>e.path,(e,n)=>{var i=mI(),a=V(i),o=V(a,!0);d(a),_(I(a,2),19,()=>W(n).matches,(e,t)=>`${W(n).path}:${e.line}:${t}:${e.text}`,(e,i)=>{var a=pI(),o=V(a),s=V(o,!0);d(o);var c=I(o),l=V(c,!0);d(c),d(a),P(()=>{K(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),P(()=>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=F(t,`expanded`,3,!1),o=q(()=>{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=L(s),l=e=>{g(e,gI())},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),R()}T([`click`]);var vI=new Set([`$$slots`,`$$events`,`$$legacy`]);function yI(e,t){let n=H(t,vI),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`}]];N(e,B({name:`tag`},()=>n,{get iconNode(){return r}}))}var bI=h(`<span class="min-w-0 break-words text-xs font-medium text-sidebar-foreground"> </span>`),xI=h(`<span class="inline-flex items-center gap-1 text-xs text-muted-foreground"><!> </span>`),SI=h(`<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>`),CI=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 wI(e,t){a(t,!0);let n=q(()=>t.field.allowedValues??[]);var r=CI(),i=V(r),o=V(i),s=e=>{var n=bI(),r=V(n,!0);d(n),P(()=>A(r,t.field.name)),g(e,n)};k(o,e=>{t.field.name&&e(s)});var c=I(o,2),l=V(c,!0);d(c),d(i);var u=I(i,2),f=e=>{var r=SI(),i=V(r),a=e=>{Hi(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.field.type)),g(e,r)},$$slots:{default:!0}})};k(i,e=>{t.field.type&&e(a)});var o=I(i,2),s=e=>{Hi(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=I(o,2),l=e=>{Hi(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=I(c,2),f=e=>{var t=xI(),r=V(t);yI(r,{size:11,strokeWidth:2});var i=I(r);d(t),P(e=>{K(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),P(()=>A(l,t.field.id)),g(e,r),R()}var TI=new Set([`$$slots`,`$$events`,`$$legacy`]);function EI(e,t){let n=H(t,TI),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 6v6l4 2`}]];N(e,B({name:`clock`},()=>n,{get iconNode(){return r}}))}var DI=new Set([`$$slots`,`$$events`,`$$legacy`]);function OI(e,t){let n=H(t,DI),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`}]];N(e,B({name:`user`},()=>n,{get iconNode(){return r}}))}function kI(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 AI(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function jI(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 MI(e){switch(e?.toLowerCase()){case`highest`:return`danger`;case`high`:return`warn`;case`medium`:case`low`:case`lowest`:return`neutral`;default:return}}function NI(e,t){let n=e?.trim().replace(/\/+$/,``);if(n)return`${n}/browse/${encodeURIComponent(t)}`}function PI(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 FI=new Set([`$$slots`,`$$events`,`$$legacy`]);function II(e,t){let n=H(t,FI),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`}]];N(e,B({name:`book-marked`},()=>n,{get iconNode(){return r}}))}var LI=new Set([`$$slots`,`$$events`,`$$legacy`]);function RI(e,t){let n=H(t,LI),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`}]];N(e,B({name:`bug`},()=>n,{get iconNode(){return r}}))}var zI=new Set([`$$slots`,`$$events`,`$$legacy`]);function BI(e,t){let n=H(t,zI),r=[[`path`,{d:`m18 15-6-6-6 6`}]];N(e,B({name:`chevron-up`},()=>n,{get iconNode(){return r}}))}var VI=new Set([`$$slots`,`$$events`,`$$legacy`]);function HI(e,t){let n=H(t,VI),r=[[`path`,{d:`m7 6 5 5 5-5`}],[`path`,{d:`m7 13 5 5 5-5`}]];N(e,B({name:`chevrons-down`},()=>n,{get iconNode(){return r}}))}var UI=new Set([`$$slots`,`$$events`,`$$legacy`]);function WI(e,t){let n=H(t,UI),r=[[`path`,{d:`m17 11-5-5-5 5`}],[`path`,{d:`m17 18-5-5-5 5`}]];N(e,B({name:`chevrons-up`},()=>n,{get iconNode(){return r}}))}var GI=new Set([`$$slots`,`$$events`,`$$legacy`]);function KI(e,t){let n=H(t,GI),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`circle`,{cx:`12`,cy:`12`,r:`1`}]];N(e,B({name:`circle-dot`},()=>n,{get iconNode(){return r}}))}var qI=new Set([`$$slots`,`$$events`,`$$legacy`]);function JI(e,t){let n=H(t,qI),r=[[`line`,{x1:`5`,x2:`19`,y1:`9`,y2:`9`}],[`line`,{x1:`5`,x2:`19`,y1:`15`,y2:`15`}]];N(e,B({name:`equal`},()=>n,{get iconNode(){return r}}))}var YI=new Set([`$$slots`,`$$events`,`$$legacy`]);function XI(e,t){let n=H(t,YI),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`}]];N(e,B({name:`git-branch`},()=>n,{get iconNode(){return r}}))}var ZI=new Set([`$$slots`,`$$events`,`$$legacy`]);function QI(e,t){let n=H(t,ZI),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`}]];N(e,B({name:`square-check-big`},()=>n,{get iconNode(){return r}}))}function $I(e){let t=e?.toLowerCase()??``;return t.includes(`epic`)?Gg:t.includes(`story`)?II:t.includes(`bug`)?RI:t.includes(`subtask`)||t.includes(`sub-task`)?XI:t.includes(`task`)?QI:KI}function eL(e){let t=MI(e);if(t)return{icon:{highest:WI,high:BI,medium:JI,low:dn,lowest:HI}[e?.toLowerCase()??``],tone:t}}var tL=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>`),nL=h(`<span class="font-mono text-xs font-semibold text-primary"> </span>`),rL=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),iL=h(`<span><!> </span>`),aL=h(`<span class="inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground"><!> <span class="truncate"> </span></span>`),oL=h(`<span class="ml-auto inline-flex items-center gap-1 text-xs text-muted-foreground"><!> </span>`),sL=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!> <!> <!></div>`),cL=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 lL(e,t){a(t,!0);let n=q(()=>NI(t.siteUrl,t.issue.key)),r=q(()=>$I(t.issue.issueType)),i=q(()=>jI(t.issue.status,t.issue.statusCategory)),o=q(()=>eL(t.issue.priority)),c=q(()=>t.issue.assignee??t.assigneeFallback),l=q(()=>kI(t.issue.updated)),u=q(()=>!!(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=q(()=>W(o)?f[W(o).tone??`neutral`]:`text-muted-foreground`);var m=cL(),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=I(v,2),b=e=>{var r=tL(),i=V(r);zN(I(i),{size:11,strokeWidth:2,class:`opacity-70`}),d(r),P(()=>{K(r,`href`,W(n)),K(r,`title`,`Open ${t.issue.key} in Jira`),A(i,`${t.issue.key??``} `)}),g(e,r)},x=e=>{var n=nL(),r=V(n,!0);d(n),P(()=>A(r,t.issue.key)),g(e,n)};k(y,e=>{W(n)?e(b):e(x,-1)}),d(_);var S=I(_,2),T=e=>{var n=rL(),r=V(n,!0);d(n),P(()=>A(r,t.issue.summary)),g(e,n)};k(S,e=>{t.issue.summary&&e(T)}),d(h);var E=I(h,2),D=e=>{var n=sL(),r=V(n),a=e=>{Hi(e,{get tone(){return W(i)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.issue.status)),g(e,r)},$$slots:{default:!0}})};k(r,e=>{t.issue.status&&e(a)});var u=I(r,2),f=e=>{let n=q(()=>W(o).icon);var r=iL(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{size:13,strokeWidth:2.2})});var a=I(i);d(r),P(()=>{s(r,1,`inline-flex items-center gap-1 text-xs ${W(p)}`),K(r,`title`,`Priority: ${t.issue.priority}`),A(a,` ${t.issue.priority??``}`)}),g(e,r)};k(u,e=>{W(o)&&e(f)});var m=I(u,2),h=e=>{var t=aL(),n=V(t);OI(n,{size:12,strokeWidth:2,class:`shrink-0`});var r=I(n,2),i=V(r,!0);d(r),d(t),P(()=>A(i,W(c))),g(e,t)};k(m,e=>{W(c)&&e(h)});var _=I(m,2),v=e=>{var n=oL(),r=V(n);EI(r,{size:12,strokeWidth:2});var i=I(r);d(n),P(e=>{K(n,`title`,e),A(i,` ${W(l)??``}`)},[()=>`Updated ${AI(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),R()}var uL=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>`),dL=h(`<div class="flex flex-wrap gap-1.5"></div>`);function fL(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=q(()=>n.flatMap(([e,n])=>{let r=t.counts[e];return typeof r==`number`?[{label:n,value:r}]:[]}));var i=U(),o=L(i),s=e=>{var t=dL();_(t,21,()=>W(r),e=>e.label,(e,t)=>{var n=uL(),r=V(n),i=V(r,!0);d(r);var a=I(r,2),o=V(a,!0);d(a),d(n),P(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),R()}var pL=h(`<span class="min-w-0 break-words text-xs font-medium leading-snug text-sidebar-foreground"> </span>`),mL=h(`<span class="inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground"><!> <span class="truncate"> </span></span>`),hL=h(`<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1"><!> <!></div>`),gL=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 _L(e,t){a(t,!0);var n=gL(),r=V(n),i=V(r),o=V(i,!0);d(i);var s=I(i,2),c=e=>{var n=pL(),r=V(n,!0);d(n),P(()=>A(r,t.project.name)),g(e,n)};k(s,e=>{t.project.name&&e(c)}),d(r);var l=I(r,2),u=e=>{var n=hL(),r=V(n),i=e=>{Hi(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.project.projectTypeKey)),g(e,r)},$$slots:{default:!0}})};k(r,e=>{t.project.projectTypeKey&&e(i)});var a=I(r,2),o=e=>{var n=mL(),r=V(n);OI(r,{size:12,strokeWidth:2,class:`shrink-0`});var i=I(r,2),a=V(i,!0);d(i),d(n),P(()=>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),P(()=>A(o,t.project.key)),g(e,n),R()}var vL=new Set([`$$slots`,`$$events`,`$$legacy`]);function yL(e,t){let n=H(t,vL),r=[[`path`,{d:`M5 12h14`}],[`path`,{d:`m12 5 7 7-7 7`}]];N(e,B({name:`arrow-right`},()=>n,{get iconNode(){return r}}))}var bL=h(`<!> <!>`,1),xL=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 SL(e,t){a(t,!0);let n=q(()=>t.transition.name??`(unnamed)`),r=q(()=>jI(t.transition.to,t.transition.toStatusCategory)),i=q(()=>!!(t.transition.to&&t.transition.to!==t.transition.name));var o=xL(),s=V(o),c=V(s,!0);d(s);var l=I(s,2),u=V(l,!0);d(l);var f=I(l,2),p=e=>{var n=bL(),i=L(n);yL(i,{size:13,strokeWidth:2,class:`text-muted-foreground`}),Hi(I(i,2),{get tone(){return W(r)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.transition.to)),g(e,r)},$$slots:{default:!0}}),g(e,n)},m=e=>{Hi(e,{get tone(){return W(r)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>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),P(()=>{A(c,t.transition.id),A(u,W(n))}),g(e,o),R()}var CL=h(`<span class="min-w-0 truncate font-mono text-xs text-muted-foreground"> </span>`),wL=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 TL(e,t){a(t,!0);let n=q(()=>PI(t.user)),r=q(()=>t.user.displayName??t.user.emailAddress??t.user.accountId);var i=wL(),o=V(i),s=V(o,!0);d(o);var c=I(o,2),l=V(c),u=V(l),f=V(u,!0);d(u);var p=I(u,2),m=e=>{var n=CL(),r=V(n,!0);d(n),P(()=>A(r,t.user.emailAddress)),g(e,n)};k(p,e=>{t.user.emailAddress&&t.user.emailAddress!==W(r)&&e(m)});var h=I(p,2),_=e=>{Hi(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.user.accountType)),g(e,r)},$$slots:{default:!0}})};k(h,e=>{t.user.accountType&&e(_)});var v=I(h,2),y=e=>{Hi(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=I(l,2),x=V(b,!0);d(b),d(c),d(i),P(()=>{A(s,W(n)),A(f,W(r)),A(x,t.user.accountId)}),g(e,i),R()}var EL=(e,t=D)=>{var n=DL(),r=V(n,!0);d(n),P(()=>A(r,t())),g(e,n)},DL=h(`<span class="text-xs font-medium text-muted-foreground"> </span>`),OL=h(`<!> <!>`,1),kL=h(`<!> <!> <!>`,1),AL=h(`<span class="text-xs text-muted-foreground"> </span>`),jL=h(`<div class="flex flex-wrap items-center gap-1"><!> <!></div>`),ML=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),NL=h(`<div class="grid gap-1.5"><!> <!> <!></div>`),PL=h(`<p class="m-0 text-xs text-muted-foreground">No Jira summary available. Open Details for raw arguments and result.</p>`);function FL(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=OA(),i=q(()=>r.atlassian?.jiraSiteUrl()),o=q(()=>n()?1/0:5),s=q(()=>cN(t.view,t.toolCall.status)),c=q(()=>uN(t.view,t.toolCall.status)),l=q(()=>fN(t.view,t.toolCall.status)),u=q(()=>W(l)?void 0:rN(t.toolCall,t.view,{expanded:n()})),f=q(()=>t.view.updatedFields??[]),p=q(()=>Math.max(0,W(f).length-W(o)));var m=U(),h=L(m),v=e=>{var n=NL(),r=V(n),a=e=>{{let t=q(()=>W(s).tone===`info`?qj:Fv);hN(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=I(r,2),u=e=>{var n=U();_(L(n),17,()=>t.view.issues.slice(0,W(o)),e=>e.key,(e,t)=>{lL(e,{get issue(){return W(t)},get siteUrl(){return W(i)}})}),g(e,n)},m=e=>{var n=U();_(L(n),17,()=>t.view.users.slice(0,W(o)),e=>e.accountId,(e,t)=>{TL(e,{get user(){return W(t)}})}),g(e,n)},h=e=>{var n=kL(),r=L(n),a=e=>{lL(e,{get issue(){return t.view.issue},get siteUrl(){return W(i)}})};k(r,e=>{t.view.issue&&e(a)});var s=I(r,2),c=e=>{fL(e,{get counts(){return t.view.includedCounts}})};k(s,e=>{t.view.includedCounts&&e(c)});var l=I(s,2),u=e=>{var n=OL(),r=L(n);EL(r,()=>`Transitions`),_(I(r,2),17,()=>t.view.transitions.slice(0,W(o)),e=>e.id,(e,t)=>{SL(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=kL(),r=L(n),i=e=>{_L(e,{get project(){return t.view.project}})};k(r,e=>{t.view.project&&e(i)});var a=I(r,2),s=e=>{fL(e,{get counts(){return t.view.includedCounts}})};k(a,e=>{t.view.includedCounts&&e(s)});var c=I(a,2),l=e=>{var n=OL(),r=L(n);EL(r,()=>`Fields`),_(I(r,2),17,()=>t.view.fields.slice(0,W(o)),e=>e.id,(e,t)=>{wI(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=OL(),r=L(n),a=e=>{lL(e,{get issue(){return t.view.issue},get siteUrl(){return W(i)}})};k(r,e=>{t.view.issue&&e(a)});var o=I(r,2),s=e=>{var n=OL(),r=L(n);EL(r,()=>`Assignee`),TL(I(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=kL(),r=L(n),a=e=>{var t=jL(),n=V(t);_(n,16,()=>W(f).slice(0,W(o)),e=>e,(e,t)=>{Hi(e,{tone:`neutral`,size:`xs`,class:`font-mono`,children:(e,n)=>{w();var r=M();P(()=>A(r,t)),g(e,r)},$$slots:{default:!0}})});var r=I(n,2),i=e=>{var t=AL(),n=V(t);d(t),P(()=>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=I(r,2),c=e=>{lL(e,{get issue(){return t.view.issue},get siteUrl(){return W(i)}})};k(s,e=>{t.view.issue&&e(c)});var l=I(s,2),u=e=>{var n=OL(),r=L(n);EL(r,()=>`Assignee`),TL(I(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=OL(),r=L(n),i=e=>{SL(e,{get transition(){return t.view.transition}})},a=e=>{var n=OL(),r=L(n);EL(r,()=>`Available transitions`),_(I(r,2),17,()=>t.view.transitions.slice(0,W(o)),e=>e.id,(e,t)=>{SL(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=I(r,2),c=e=>{var n=OL(),r=L(n);EL(r,()=>`Transition fields`),_(I(r,2),17,()=>t.view.fields.slice(0,W(o)),e=>e.id,(e,t)=>{wI(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=I(l,2),C=e=>{var t=ML(),n=V(t,!0);d(t),P(()=>A(n,W(c))),g(e,t)};k(S,e=>{W(c)&&e(C)}),d(n),g(e,n)},y=e=>{{let t=q(()=>({kind:`atlassian-summary`,text:W(u)}));_P(e,{get body(){return W(t)}})}},b=e=>{g(e,PL())};k(h,e=>{W(l)?e(v):W(u)?e(y,1):t.toolCall.status===`completed`&&e(b,2)}),g(e,m),R()}var IL=h(`<p class="m-0 text-xs text-muted-foreground">Empty directory.</p>`),LL=h(`<button type="button" class="cursor-pointer border-0 bg-transparent p-0 text-left font-mono text-xs text-primary hover:underline"> </button>`),RL=h(`<span> </span>`),zL=h(`<li class="flex items-center gap-1.5"><!> <!></li>`),BL=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 VL(e,t){a(t,!0);let n=F(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=q(()=>i(t.view.entries)),s=q(()=>n()?W(o):W(o).slice(0,6));var c=U(),l=L(c),u=e=>{g(e,IL())},f=e=>{var n=BL();_(n,21,()=>W(s),e=>e.path,(e,n)=>{var i=zL(),a=V(i),o=e=>{mn(e,{size:12,strokeWidth:2,class:`flex-none text-muted-foreground`})},s=e=>{rm(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=I(a,2),l=e=>{var i=LL(),a=V(i,!0);d(i),P(()=>A(a,W(n).path)),r(`click`,i,()=>t.onOpenFile?.(W(n).openPath??W(n).path)),g(e,i)},u=e=>{var t=RL(),r=V(t,!0);d(t),P(()=>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),R()}T([`click`]);var HL=new Set([`$$slots`,`$$events`,`$$legacy`]);function UL(e,t){let n=H(t,HL),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];N(e,B({name:`check`},()=>n,{get iconNode(){return r}}))}var WL=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function GL(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=H(t,WL);var i=U();C(L(i),()=>qs,(e,t)=>{t(e,B(()=>r,{get open(){return n()},set open(e){n(e)}}))}),g(e,i),R()}h(`<span class="absolute right-2 flex items-center justify-center pointer-events-none" data-slot="dropdown-menu-checkbox-item-indicator"><!></span> <!>`,1);var KL=new Set([`$$slots`,`$$events`,`$$legacy`]);function qL(e,t){let n=H(t,KL);var r=U();C(L(r),()=>We,(e,t)=>{t(e,B(()=>n))}),g(e,r)}var JL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`sideOffset`,`align`,`portalProps`,`class`]);function YL(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`sideOffset`,3,4),i=F(t,`align`,3,`start`),o=H(t,JL);qL(e,B(()=>t.portalProps,{children:(e,a)=>{var s=U(),c=L(s);{let e=q(()=>he(`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,()=>Xs,(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}})),R()}var XL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`variant`]);function ZL(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`variant`,3,`default`),i=H(t,XL);var o=U(),s=L(o);{let e=q(()=>he(`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,()=>pee,(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),R()}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 QL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function $L(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,QL);var i=U(),o=L(i);{let e=q(()=>he(`bg-border -mx-1 my-1 h-px`,t.class));C(o,()=>fee,(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),R()}h(`<span><!></span>`);var eR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function tR(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,eR);var i=U();C(L(i),()=>$s,(e,t)=>{t(e,B({"data-slot":`dropdown-menu-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),g(e,i),R()}h(`<!> <!>`,1);var nR=h(`<!> <!>`,1),rR=h(`<div class="inline-flex" role="group"><!> <!></div>`);function iR(e,t){a(t,!0);let n=F(t,`variant`,3,`default`),r=F(t,`size`,3,`sm`),i=F(t,`disabled`,3,!1),o=F(t,`menuAlign`,3,`end`),s=q(()=>n()==="default"||n()===`success`?`border-l-primary-foreground/25`:`border-l-border/70`);var c=rR(),l=V(c);Oe(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(L(r),()=>t.children),g(e,r)},$$slots:{default:!0}}),C(I(l,2),()=>GL,(e,a)=>{a(e,{children:(e,a)=>{var c=nR(),l=L(c);{let e=q(()=>he(xe({variant:n(),size:r()}),`-ml-px rounded-l-none border-l px-1.5`,W(s)));C(l,()=>tR,(n,r)=>{r(n,{get class(){return W(e)},get disabled(){return i()},get"aria-label"(){return t.triggerLabel},children:(e,t)=>{Uee(e,{class:`size-3.5`,strokeWidth:2.3})},$$slots:{default:!0}})})}C(I(l,2),()=>YL,(e,n)=>{n(e,{get align(){return o()},get class(){return t.menuClass},children:(e,n)=>{var r=U();u(L(r),()=>t.menu),g(e,r)},$$slots:{default:!0}})}),g(e,c)},$$slots:{default:!0}})}),d(c),g(e,c),R()}var aR=h(`<!> <!>`,1),oR=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>`),sR=h(` <span class="text-muted-foreground"> </span>`,1),cR=h(`<p class="m-0 px-1 py-2 text-sm text-muted-foreground">No models match the current filters.</p>`),lR=h(`<button type="button" role="option"><span class="min-w-0 truncate font-medium"> </span> <!></button>`),uR=h(`<div class="grid gap-2"><!> <!> <!></div>`),dR=h(`<button type="button"> </button>`),fR=h(`<section class="grid gap-2 border-t border-border pt-4"><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>`),pR=h(`<div class="grid gap-4"><section class="grid gap-2"><p class="m-0 text-xs font-semibold uppercase tracking-wide text-muted-foreground">Model</p> <!></section> <!></div>`);function mR(e,t){a(t,!0);let n=F(t,`open`,15,!1),i=J(``),o=J(`off`),c=J(``),l=J(`all`),u=q(()=>T_(t.models)),f=q(()=>D_(W(u))),p=q(()=>E_(W(u),W(c),W(l))),m=q(()=>t.models.find(e=>Qn(e)===W(i))),h=q(()=>Gt(W(m))),v=q(()=>!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(){G(c,``),G(l,`all`);let e=t.models.find(e=>Qn(e)===t.initialModelKey)??t.models[0];G(i,e?Qn(e):``,!0),G(o,Ht(t.initialThinkingLevel,e),!0)}function S(e){n(e),t.onOpenChange?.(e)}function T(e){G(i,Qn(e),!0),G(o,Ht(W(o),e),!0)}function E(e){G(o,Ht(e,W(m)),!0)}function D(){if(!W(m))return;let e=fr(W(i));if(!e)return;let n={implementationModel:e,implementationThinkingLevel:W(o)};S(!1),t.onConfirm?.(n)}z(()=>{n()&&x()}),ZP(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=aR(),r=L(n);Oe(r,{size:`sm`,variant:`ghost`,onclick:()=>S(!1),children:(e,t)=>{w(),g(e,M(`Cancel`))},$$slots:{default:!0}}),Oe(I(r,2),{size:`sm`,onclick:D,get disabled(){return W(v)},children:(e,n)=>{w();var r=M();P(()=>A(r,t.confirmLabel)),g(e,r)},$$slots:{default:!0}}),g(e,n)},children:(e,n)=>{var a=pR(),u=V(a),v=I(V(u),2),x=e=>{g(e,oR())},S=e=>{var t=uR(),n=V(t);w_(n,{placeholder:`Search models`,ariaLabel:`Search models`,get value(){return W(c)},set value(e){G(c,e,!0)}});var a=I(n,2),o=e=>{var t=U();C(L(t),()=>rn,(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&&G(l,e,!0)},children:(e,t)=>{var n=U();_(L(n),17,()=>W(f),e=>e.id,(e,t)=>{var n=U();C(L(n),()=>tn,(e,n)=>{n(e,{get value(){return W(t).id},class:`flex-none gap-1.5 text-xs`,children:(e,n)=>{w();var r=sR(),i=L(r),a=I(i),o=V(a,!0);d(a),P(()=>{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=I(a,2),m=e=>{g(e,cR())},h=e=>{Bi(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=q(()=>n().key===W(i));var o=lR(),c=V(o),l=V(c,!0);d(c);var u=I(c,2),f=e=>{UL(e,{class:`size-4`,strokeWidth:2.4})};k(u,e=>{W(a)&&e(f)}),d(o),P(()=>{s(o,1,`flex w-full items-center justify-between gap-3 rounded-md border px-3 py-2 text-left text-sm transition-colors ${W(a)?`border-primary/40 bg-primary/10 text-primary`:`border-transparent text-foreground hover:bg-accent`}`),K(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=I(u,2),O=e=>{var t=fR(),n=I(V(t),2);_(n,20,()=>W(h),e=>e,(e,t)=>{let n=q(()=>t===W(o));var i=dR(),a=V(i,!0);d(i),P(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`}`),K(i,`aria-pressed`,W(n)),K(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}}),R()}T([`click`]);var hR=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>`),gR=h(`<!> <!> <!> <!> <!> <!> <!>`,1),_R=h(`<!> `,1),vR=h(`<!> <!>`,1),yR=h(`<p class="m-0 text-xs text-destructive" role="alert"> </p>`),bR=h(`<div class="grid gap-2" aria-label="Plan review"><!> <!> <!> <!> <!> <!></div>`),xR=h(`<p class="m-0 text-sm text-muted-foreground"> </p>`);function SR(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=F(t,`planReviewModels`,19,()=>[]),i=F(t,`planReviewModelKey`,3,``),o=F(t,`planReviewThinkingLevel`,3,`off`),s=J(void 0),c=J(void 0),l=J(!1),u=J(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=q(()=>h(t.toolCall)),y=q(()=>m(W(v))),b=q(()=>t.planReview?{...W(y),...t.planReview,content:W(y)?.content??t.planReview.content}:W(y)),x=q(()=>t.toolCall.toolName===`plan_mode_present`&&t.toolCall.status===`waiting_for_user`&&t.planReview?.status===`pending`),S=q(()=>W(b)?.status??p(f(W(v)).outcome)),T=q(()=>W(S)===`accepted`),E=q(()=>W(S)===`accepted_in_new_chat`),D=q(()=>W(S)===`changes_requested`||W(S)===`discarded`),O=q(()=>W(y)?.content??W(b)?.content??``),ee=q(()=>n()?W(b)?.content??``:_(W(O),6)),te=q(()=>t.toolCall.toolName===`plan_mode_present`&&!!W(b)),ne=q(()=>!W(x)||!!W(c)||W(l)),j=q(()=>W(T)||W(E)?`success`:`default`),re=q(()=>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 ie(e){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onAcceptPlanReview)){G(c,`same`),G(u,void 0);try{await t.onAcceptPlanReview(t.planReview.id,e)}catch(e){G(u,le(e,`Could not accept the plan.`),!0)}finally{G(c,void 0)}}}async function N(e){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onAcceptPlanReview)){G(c,`compact`),G(u,void 0);try{await t.onAcceptPlanReview(t.planReview.id,{...e,compactBeforeImplementation:!0})}catch(e){G(u,le(e,`Could not compact and accept the plan.`),!0)}finally{G(c,void 0)}}}async function ae(e){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onAcceptPlanReviewInNewChat)){G(c,`new-chat`),G(u,void 0);try{await t.onAcceptPlanReviewInNewChat(t.planReview.id,e)}catch(e){G(u,le(e,`Could not accept the plan.`),!0)}finally{G(c,void 0)}}}function oe(){!W(x)||W(c)||W(l)||G(s,`same`)}function se(){!W(x)||W(c)||W(l)||G(s,`compact`)}function ce(){!W(x)||W(c)||W(l)||G(s,`new-chat`)}function le(e,t){return e instanceof Error&&e.message.trim()?e.message:t}async function ue(){if(!(!t.planReview||!W(x)||W(c)||W(l)||!t.onRejectPlanReview)){G(l,!0),G(u,void 0);try{await t.onRejectPlanReview(t.planReview.id)}catch(e){G(u,le(e,`Could not reject the plan.`),!0)}finally{G(l,!1)}}}var de=U(),fe=L(de),pe=e=>{var n=bR(),a=V(n),f=e=>{var t=hR(),n=V(t,!0);d(t),P(()=>A(n,W(ee))),g(e,t)},p=q(()=>W(ee).trim());k(a,e=>{W(p)&&e(f)});var m=I(a,2);IA(m,{get meta(){return W(re)},get detailsAction(){return t.detailsAction},actions:e=>{var n=vR(),r=L(n);iR(r,{get variant(){return W(j)},size:`sm`,get disabled(){return W(ne)},menuAlign:`end`,menuClass:`w-60`,triggerLabel:`Accept options`,onclick:()=>void ie(),menu:e=>{var n=gR(),r=L(n);C(r,()=>ZL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:()=>void ie(),children:(e,t)=>{w(),g(e,M(`Accept & implement`))},$$slots:{default:!0}})});var i=I(r,2);C(i,()=>ZL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:()=>void N(),children:(e,t)=>{w(),g(e,M(`Compact & implement`))},$$slots:{default:!0}})});var a=I(i,2),o=e=>{var t=U();C(L(t),()=>ZL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:()=>void ae(),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=I(a,2);C(s,()=>$L,(e,t)=>{t(e,{})});var c=I(s,2);C(c,()=>ZL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:oe,children:(e,t)=>{w(),g(e,M(`Choose model & implement`))},$$slots:{default:!0}})});var l=I(c,2);C(l,()=>ZL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:se,children:(e,t)=>{w(),g(e,M(`Choose model & compact`))},$$slots:{default:!0}})});var u=I(l,2),d=e=>{var t=U();C(L(t),()=>ZL,(e,t)=>{t(e,{get disabled(){return W(ne)},onSelect:ce,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=_R(),r=L(n),i=e=>{UL(e,{class:`size-3.5`,strokeWidth:2.4})};k(r,e=>{(W(T)||W(E))&&e(i)});var a=I(r);P(()=>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}}),Oe(I(r,2),{size:`sm`,variant:`secondary`,get disabled(){return W(ne)},onclick:ue,children:(e,t)=>{var n=_R(),r=L(n),i=e=>{UL(e,{class:`size-3.5`,strokeWidth:2.4})};k(r,e=>{W(D)&&e(i)});var a=I(r);P(()=>A(a,` ${W(l)?`Rejecting…`:`Reject Plan`}`)),g(e,n)},$$slots:{default:!0}}),g(e,n)},$$slots:{actions:!0}});var h=I(m,2),_=e=>{var t=yR(),n=V(t,!0);d(t),P(()=>A(n,W(u))),g(e,t)};k(h,e=>{W(u)&&e(_)});var v=I(h,2);{let e=q(()=>W(s)===`same`);mR(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=>{G(s,e?`same`:void 0,!0)},onConfirm:ie})}var y=I(v,2);{let e=q(()=>W(s)===`compact`);mR(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=>{G(s,e?`compact`:void 0,!0)},onConfirm:N})}var b=I(y,2),x=e=>{{let t=q(()=>W(s)===`new-chat`);mR(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=>{G(s,e?`new-chat`:void 0,!0)},onConfirm:ae})}};k(b,e=>{t.onAcceptPlanReviewInNewChat&&e(x)}),d(n),g(e,n)},me=e=>{var n=xR(),r=V(n,!0);d(n),P(()=>A(r,t.view.summary)),g(e,n)};k(fe,e=>{W(te)&&W(b)?e(pe):t.view.summary&&e(me,1)}),g(e,de),R()}var CR=h(`<section class="grid gap-1" aria-label="Python script"><!></section>`),wR=h(`<section class="grid gap-1" aria-label="Python output"><!></section>`),TR=h(`<section class="grid gap-1" aria-label="Python output"><p class="m-0 text-xs text-muted-foreground">No output.</p></section>`),ER=h(`<div class="grid gap-1.5"><!> <!></div>`);function DR(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>t.view.inputMode!==`file`&&!!t.view.code?.match(/[\r\n]/));var i=ER(),o=V(i),s=e=>{var r=CR();Bj(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=I(o,2),l=e=>{var r=wR();Bj(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,TR())};k(c,e=>{t.view.output.length>0?e(l):t.toolCall.status===`completed`&&e(u,1)}),d(i),g(e,i),R()}var OR={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 kR(e){if(!e)return;let t=e.split(/[\\/]/).pop()??e,n=t.lastIndexOf(`.`);if(!(n<=0))return OR[t.slice(n+1).toLowerCase()]}var AR=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>`),jR=h(`<p class="m-0 text-xs text-muted-foreground">Empty file.</p>`);function MR(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),i=q(()=>kR(t.view.relPath));var o=U(),s=L(o),c=e=>{var n=AR(),i=V(n);d(n),P(()=>{K(i,`src`,t.view.image.dataUrl),K(i,`alt`,t.view.relPath??`image`)}),r(`click`,n,()=>t.view.path&&t.onOpenFile?.(t.view.path)),g(e,n)},l=e=>{Bj(e,{get text(){return t.view.content},get language(){return W(i)},get expanded(){return n()}})},u=e=>{g(e,jR())};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),R()}T([`click`]);var NR=/https?:\/\/[^\s)'"]+/i;function PR(e){if(e.readiness.readyUrl)return e.readiness.readyUrl;if(!e.readiness.readyOnUrl)return;let t=e.readiness.matched;return t&&NR.test(t)?t:void 0}var FR=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>`),IR=h(`<div><!> <div> </div> <!> <!> <!></div>`),LR=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">group</span> </span>`),RR=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">finished</span> </span>`),zR=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">exit</span> </span>`),BR=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">signal</span> </span>`),VR=h(`<span class="tt-row svelte-1462m86"><span class="tt-key svelte-1462m86">error</span> </span>`),HR=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),UR=h(`<!> <!>`,1),WR=h(`<p class="m-0 break-words text-xs text-destructive"> </p>`);function GR(e,t){a(t,!0);let n=F(t,`dense`,3,!1),r=q(()=>PR(t.task)),i=q(()=>Wf(t.task.status)),o=q(()=>t.task.termination?.exitCode!==void 0&&t.task.termination.exitCode!==null);var c=UR(),l=L(c);C(l,()=>Yy,(e,a)=>{a(e,{delayDuration:300,disableHoverableContent:!0,children:(e,a)=>{var c=U();C(L(c),()=>zy,(e,a)=>{a(e,{children:(e,a)=>{var c=UR(),l=L(c);{let e=(e,a)=>{let c=()=>a?.().props;var l=IR();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=q(()=>Gf(t.task.status));gt(u,{get tone(){return W(i)},get pulse(){return W(e)},size:`xs`,class:`flex-none`})}var f=I(u,2),p=V(f,!0);d(f);var m=I(f,2),h=e=>{var t=FR(),n=V(t);zN(n,{size:12,strokeWidth:2});var i=I(n,1,!0);d(t),P(()=>{K(t,`href`,W(r)),A(i,W(r))}),g(e,t)};k(m,e=>{W(r)&&e(h)});var _=I(m,2),v=e=>{{let n=q(()=>t.task.termination?.exitCode===0?`neutral`:`danger`);Hi(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,`exit ${t.task.termination?.exitCode??``}`)),g(e,r)},$$slots:{default:!0}})}},y=e=>{Hi(e,{tone:`warn`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>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=I(_,2);{let e=q(()=>W(i)===`neutral`?`border-border bg-muted text-muted-foreground`:``);Hi(b,{get tone(){return W(i)},size:`xs`,get class(){return W(e)},children:(e,n)=>{w();var r=M();P(()=>A(r,t.task.status)),g(e,r)},$$slots:{default:!0}})}d(l),P(()=>{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(I(l,2),()=>qy,(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=HR(),i=L(r),a=V(i,!0);d(i);var s=I(i,2),c=I(V(s),1,!0);d(s);var l=I(s,2),u=I(V(l),1,!0);d(l);var f=I(l,2),p=I(V(f),1,!0);d(f);var m=I(f,2),h=I(V(m),1,!0);d(m);var _=I(m,2),v=e=>{var n=LR(),r=I(V(n),1,!0);d(n),P(()=>A(r,t.task.lineage.groupId)),g(e,n)};k(_,e=>{t.task.lineage?.groupId&&e(v)});var y=I(_,2),b=e=>{var n=RR(),r=I(V(n),1,!0);d(n),P(e=>A(r,e),[()=>AI(t.task.timing.finishedAt)]),g(e,n)};k(y,e=>{t.task.timing.finishedAt&&e(b)});var x=I(y,2),S=e=>{var n=zR(),r=I(V(n),1,!0);d(n),P(()=>A(r,t.task.termination?.exitCode)),g(e,n)},C=e=>{var n=BR(),r=I(V(n),1,!0);d(n),P(()=>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=I(x,2),T=e=>{var n=VR(),r=I(V(n),1,!0);d(n),P(()=>A(r,t.task.termination.error)),g(e,n)};k(w,e=>{t.task.termination?.error&&e(T)});var E=I(w,2),D=V(E,!0);d(E),P(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)},[()=>AI(t.task.timing.startedAt)]),g(e,r)},$$slots:{default:!0}})}),g(e,c)},$$slots:{default:!0}})}),g(e,c)},$$slots:{default:!0}})});var u=I(l,2),f=e=>{var n=WR(),r=V(n,!0);d(n),P(()=>A(r,t.task.termination.error)),g(e,n)};k(u,e=>{t.task.termination?.error&&e(f)}),g(e,c),R()}var KR=h(`<p> </p>`),qR=h(`<div class="grid gap-1"></div>`);function JR(e,t){a(t,!0);var n=U(),r=L(n),i=e=>{var n=KR();let r;var i=V(n,!0);d(n),P(()=>{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=qR();_(n,21,()=>t.view.tasks,e=>e.id,(e,t)=>{GR(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),R()}var YR=h(`<span class="terminal-text terminal-output svelte-24sjlk"></span>`);function XR(e,t){a(t,!0);let n=q(()=>Tj(t.text,{linkifyUrls:!0}));var r=YR();p(r,()=>W(n),!0),d(r),P(()=>{K(r,`data-stream`,t.stream),K(r,`data-level`,t.level)}),g(e,r),R()}var ZR=h(`<p class="m-0 text-xs text-warning">Log preview is incomplete. Open Details to inspect the full result.</p>`),QR=h(`<div><span class="text-right text-muted-foreground"> </span> <span class="whitespace-pre-wrap break-words"><!></span></div>`),$R=h(`<div class="terminal-output rounded-sm border bg-sidebar px-2.5 py-1.5 font-mono text-xs text-sidebar-foreground"></div>`),ez=h(`<p class="m-0 text-xs text-muted-foreground"> </p>`),tz=h(`<!> <!>`,1);function nz(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>n()?t.view.events:Dt(t.view.events,6));var i=tz(),o=L(i),c=e=>{g(e,ZR())};k(o,e=>{t.view.previewUnavailable&&t.toolCall.status===`completed`&&e(c)});var l=I(o,2),u=e=>{var t=$R();_(t,21,()=>W(r),e=>e.seq,(e,t)=>{var n=QR();let r;var i=V(n),a=V(i,!0);d(i);var o=I(i,2),c=V(o);{let e=q(()=>W(t).line||`\xA0`);XR(c,{get text(){return W(e)},get stream(){return W(t).stream},get level(){return W(t).level}})}d(o),d(n),P(()=>{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=ez(),r=V(n);d(n),P(()=>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),R()}var rz=h(`<p class="m-0 text-xs font-medium text-muted-foreground"> </p>`),iz=h(`<div class="grid gap-1"><!> <p> </p></div>`),az=h(`<p class="m-0 text-xs text-muted-foreground">Replacement <span class="font-mono"> </span> restarted <span class="font-mono"> </span>.</p>`),oz=h(`<div class="grid gap-1.5"><!> <!> <!></div>`),sz=h(`<p class="m-0 text-xs text-warning">Task result preview unavailable. Open Details to inspect the full result.</p>`),cz=h(`<section class="grid gap-1" aria-label="Task startup output"><!></section>`),lz=h(`<!> <!>`,1);function uz(e,t){a(t,!0);let n=q(()=>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=q(()=>t.view.tasks??(t.view.task?[t.view.task]:[])),i=q(()=>t.view.outcomes??[]),o=q(()=>W(r).length>0||W(i).length>0);var c=lz(),l=L(c),u=e=>{var a=oz(),o=V(a),c=e=>{var t=rz(),r=V(t,!0);d(t),P(()=>A(r,W(n))),g(e,t)};k(o,e=>{t.toolCall.status===`completed`&&e(c)});var l=I(o,2),u=e=>{var t=U();_(L(t),19,()=>W(i),(e,t)=>`${e.task?.id??`none`}-${t}`,(e,t)=>{var n=iz(),r=V(n),i=e=>{GR(e,{get task(){return W(t).task}})};k(r,e=>{W(t).task&&e(i)});var a=I(r,2);let o;var c=V(a,!0);d(a),d(n),P(()=>{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();_(L(t),17,()=>W(r),e=>e.id,(e,t)=>{GR(e,{get task(){return W(t)}})}),g(e,t)};k(l,e=>{t.view.action===`cancel`?e(u):e(f,-1)});var p=I(l,2),m=e=>{var n=az(),r=I(V(n)),i=V(r,!0);d(r);var a=I(r,2),o=V(a,!0);d(a),w(),d(n),P(()=>{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,sz())};k(l,e=>{W(o)?e(u):t.toolCall.status===`completed`&&t.view.previewUnavailable&&e(f,1)});var p=I(l,2),m=e=>{var n=cz();Bj(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),R()}function dz(e,t){a(t,!0);var n=U(),r=L(n),i=e=>{zv(e,{get items(){return t.view.items}})},o=e=>{zv(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),R()}var fz=h(`<p class="m-0 text-xs text-muted-foreground">No content.</p>`);function pz(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>t.view.converted?`markdown`:void 0);var i=U(),o=L(i),s=e=>{Bj(e,{get text(){return t.view.content},get language(){return W(r)},get expanded(){return n()}})},c=e=>{g(e,fz())};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),R()}var mz=new Set([`$$slots`,`$$events`,`$$legacy`]);function hz(e,t){let n=H(t,mz),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`}]];N(e,B({name:`sparkles`},()=>n,{get iconNode(){return r}}))}var gz=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>`),_z=h(`<span class="line-clamp-2 pl-6 text-xs leading-snug text-muted-foreground"> </span>`),vz=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>`),yz=h(`<ul class="m-0 grid list-none gap-0 divide-y overflow-hidden rounded-sm border bg-sidebar p-0"></ul>`),bz=h(`<p class="m-0 text-xs text-muted-foreground">No results.</p>`),xz=h(`<!> <!>`,1);function Sz(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>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=xz(),c=L(o),l=e=>{var r=gz(),i=V(r);hz(V(i),{size:12,strokeWidth:2,class:`text-info`}),w(),d(i);var a=I(i,2);let o;var c=V(a,!0);d(a),d(r),P(()=>{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=I(c,2),f=e=>{var t=yz();_(t,23,()=>W(r),e=>e.url,(e,t,n)=>{var r=vz(),a=V(r),o=V(a),s=V(o),c=V(s,!0);d(s);var l=I(s,2),u=V(l,!0);d(l);var f=I(l,2),p=V(f,!0);d(f),d(o);var m=I(o,2),h=e=>{var n=_z(),r=V(n,!0);d(n),P(()=>A(r,W(t).content)),g(e,n)};k(m,e=>{W(t).content&&e(h)}),d(a),d(r),P(e=>{K(a,`href`,W(t).url),K(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,bz())};k(u,e=>{W(r).length>0?e(f):!t.view.answer&&t.toolCall.status===`completed`&&e(p,1)}),g(e,o),R()}var Cz=h(`<p class="m-0 text-xs text-muted-foreground">Empty file written.</p>`);function wz(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>kR(t.view.relPath));var i=U(),o=L(i),s=e=>{Bj(e,{get text(){return t.view.content},get language(){return W(r)},direction:`tail`,get expanded(){return n()}})},c=e=>{g(e,Cz())};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),R()}var Tz={read:MR,bash:Gj,python:DR,edit:DP,write:wz,grep:_I,find:sI,ls:VL,ask_user:QA,todos:dz,task_action:uz,task_status:JR,task_logs:nz,explore:rI,plan_mode:SR,jira:FL,confluence:TP,web_search:Sz,web_fetch:pz,generic:fI};function Ez(e){return Tz[e]??fI}function Dz(e){return e.replace(/\r\n/g,`
105
- `).replace(/\r/g,`
106
- `)}function Oz(e,t){if(e.length===0)return``;let n=Dz(e).split(`
107
- `);return n.length<=t?n.join(`
108
- `):n.slice(-t).join(`
109
- `)}function kz(e,t){return e.length<=t?e:e.slice(-t)}function Az(e,t){let n=Dz(e).trimEnd();if(n.length!==0)return Oz(kz(n,t.maxChars),t.maxLines)}function jz(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 Mz(e,t){let n=Nz(e,t).argsPreview;return n?{kind:`code`,language:`json`,text:n,tail:!0}:void 0}function Nz(e,t){if(e.toolName&&aS(e.toolName))return{};if(e.args!==void 0){let n=Az(JSON.stringify(e.args,null,2),t);return n?{argsPreview:n,argsPreviewLanguage:`json`}:{}}let n=e.argsText.trim();if(!n)return{};let r=Az(jz(n),t);return r?{argsPreview:r,argsPreviewLanguage:`json`}:{}}function Pz(e,t){let n=new Set;return[...e,...t].filter(e=>n.has(e.text)?!1:(n.add(e.text),!0))}function Fz(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 Iz(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 Lz(e){return e&&typeof e==`object`?e:{}}function Rz(e){return typeof e==`string`?e:void 0}function zz(e,t,n=`s`){return`${e} ${t}${e===1?``:n}`}function Bz(e){if(e!==void 0)return e.length===0?0:e.split(`
112
- `).length}function Vz(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Hz(e){return RegExp(`"${Vz(e)}"\\s*:\\s*"`,`g`)}function Uz(e,t,n={}){let r=[],i=Hz(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 Wz(e,t){let n=[],r=Hz(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 Gz=24e3;function Kz(e){return e===`n`?`
115
- `:e===`r`?`\r`:e===`t`?` `:e}function qz(e,t,n){return e.length+t.length<=n?e+t:`${e}${t}`.slice(-n)}function Jz(e){return RegExp(`"(${e.map(Vz).join(`|`)})"\\s*:\\s*"`,`g`)}function Yz(e,t,n={}){if(t.length===0)return[];let r=[],i=Jz(t),a=i.exec(e);for(;a;){let t=n.maxChars??Gz,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=qz(o,Kz(e[c+1]),t),c+=2;continue}if(n===`"`){s=!0;break}o=qz(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 Xz(e){return e.replace(/\r\n/g,`
116
- `).replace(/\r/g,`
117
- `)}function Zz(e,t){let n=Xz(e);if(t)return n;let r=n.lastIndexOf(`
118
- `);return r<0?``:n.slice(0,r)}function Qz(e,t=6){if(e.length===0)return``;let n=Xz(e).split(`
119
- `);return n.length<=t?n.join(`
120
- `):n.slice(-t).join(`
121
- `)}function $z(e){return!Xz(e).includes(`
122
- `)}function eB(e){if(e===void 0||e.length===0)return{};let t=Xz(e),n=Bz(t);return $z(t)?{inlineInput:t,inputLineCount:n}:{inputPreview:Qz(t),inputLineCount:n}}function tB(e){let t=e.filter(e=>e.length>0).join(`
123
- `);return t.length>0?Qz(t):void 0}function nB(e,t){let n=Xz(e);return n.length===0?``:n.split(`
124
- `).map(e=>`${t}${e}`).join(`
125
- `)}function rB(e,t){return tB(e.map(e=>{let n=Zz(e.text,e.complete||t);return e.kind===`patch`?n:nB(n,e.kind===`added`?`+`:`-`)}))}function iB(e,t){return tB(e.map(e=>Zz(e.value,e.complete||t)))}function aB(e,t){let n=Rz(Lz(e.args).path)??e.progress?.path??Uz(e.argsText,`path`,{maxChars:240})[0];return n&&t?oi(n,t)??n:n}function oB(e,t){let n=Rz(Lz(e.args).content),r=e.argsText?Wz(e.argsText,`content`)[0]:void 0,i=e.progress?.lineCount??e.progress?.generatedLineCount,a=Bz(n)??r??i,o=e.progress?.generatedPreview?Qz(e.progress.generatedPreview):void 0,s=n===void 0?(e.argsText?iB(Yz(e.argsText,[`content`]),!!e.done):void 0)??o:tB([Xz(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:aB(e,t),statusText:e.done?`Submitting`:`Generating`,meta:l,lineCount:a,generatedLineCount:a,estimated:c,preview:s,done:!!e.done}}function sB(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 cB(e){return Array.isArray(e)?e:[]}function lB(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=cB(e.replacements);t+=i.length;for(let e of i){let t=Lz(e);n+=Bz(Rz(t.newText))??0,r+=Bz(Rz(t.oldText))??0}let a=cB(e.insertions);t+=a.length;for(let e of a)n+=Bz(Rz(Lz(e).text))??0;let o=cB(e.lineReplacements);t+=o.length;for(let e of o)n+=Bz(Rz(Lz(e).newText))??0;let s=cB(e.lineInsertions);t+=s.length;for(let e of s)n+=Bz(Rz(Lz(e).text))??0;let c=Rz(e.patch);if(c){t+=1;let e=sB(c);n+=e.additions,r+=e.deletions}return{operations:t,generatedLines:n,estimatedAdditions:n,estimatedDeletions:r,estimated:!1}}function uB(e){let t=[];for(let n of cB(e.replacements)){let e=Lz(n),r=Rz(e.oldText),i=Rz(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 cB(e.insertions)){let e=Rz(Lz(n).text);e!==void 0&&t.push({text:e,kind:`added`,complete:!0})}for(let n of cB(e.lineReplacements)){let e=Rz(Lz(n).newText);e!==void 0&&t.push({text:e,kind:`added`,complete:!0})}for(let n of cB(e.lineInsertions)){let e=Rz(Lz(n).text);e!==void 0&&t.push({text:e,kind:`added`,complete:!0})}let n=Rz(e.patch);n!==void 0&&t.push({text:n,kind:`patch`,complete:!0});let r=rB(t,!0);return{preview:r,previewLanguage:r?`diff`:void 0}}function dB(e,t){let n=rB(Yz(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 fB(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 pB(e){let t=Wz(e,`oldText`),n=Wz(e,`newText`),r=Wz(e,`text`),i=Uz(e,`patch`,{maxChars:24e3}),a=i.reduce((e,t)=>{let n=sB(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 mB(e,t){let n=Lz(e.args),r=lB(n),i=e.argsText?pB(e.argsText):void 0,a=fB(e),o=r??i??a??{operations:0,generatedLines:0,estimated:!1},s=e.progress?.generatedPreview?{preview:Qz(e.progress.generatedPreview),previewLanguage:e.progress.generatedPreviewLanguage}:{},c=e.argsText?dB(e.argsText,!!e.done):void 0,l=r?uB(n):c?.preview?c:s,u=[];o.operations>0&&u.push({text:zz(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:aB(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 hB(e){let t=Rz(Lz(e.args).command),n=Yz(e.argsText,[`command`])[0]?.value,r=t??n,i=eB(r),a=Bz(r),o=r!==void 0&&r.length>0,s=[];return a!==void 0&&a>1&&s.push({text:zz(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 gB(e,t){let n=Lz(e.args),r=aB(e,t),i=Rz(n.code),a=Yz(e.argsText,[`code`])[0]?.value,o=i??a,s=eB(o),c=Bz(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:zz(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 _B(e,t,n){let r=t.toolName??`tool`,i=sS(r,{args:t.args,argsText:t.argsText},`drafting`,n),a=Fz(e),o=i.body.kind===`none`?aS(r)?void 0:Mz(t,{maxLines:6,maxChars:Gz}):i.body;return{...e,path:e.path??i.primaryArg?.text,primaryArg:i.primaryArg,meta:Pz(e.meta,i.secondary),argumentBody:a??o??i.body,safetyNotes:i.safetyNotes}}function vB(e,t){if(e.toolName===`write`)return _B(oB(e,t),e,t);if(e.toolName===`edit`)return _B(mB(e,t),e,t);if(e.toolName===`bash`)return _B(hB(e),e,t);if(e.toolName===`python_exec`)return _B(gB(e,t),e,t);let n=e.toolName??`tool`,r=sS(n,{args:e.args,argsText:e.argsText},`drafting`,t);return _B({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 yB=new Set([`INVALID_TOOL_ARGUMENTS`,`TOOL_ARGUMENT_INVALID`]);function bB(e){if(e.status!==`error`)return!1;let t=e.errorDetails?.code.toUpperCase();return t?yB.has(t)||t.endsWith(`_ARGUMENT_INVALID`):!1}function xB(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 SB(e,t){return[...(e??[]).map(e=>`${e.tone??`default`}:${e.mono?`mono`:`text`}:${e.openPath?`file`:e.href?`link`:`label`}`),t?`details`:``].join(`,`)}function CB(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=SB(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 wB(e){return e?`${e.openPath?`file`:e.href?`link`:`text`}:${e.preserveWhitespace?`preserve`:`wrap`}`:`none`}function TB(e){return[e.stage,e.activityRevision,`badge:${e.badge}`,`arg:${wB(e.arg)}`].join(`|`)}var EB=h(`<button type="button"> </button>`),DB=h(`<a target="_blank" rel="noreferrer noopener"> </a>`),OB=h(`<span> </span>`),kB=h(`<div class="tool-header svelte-jnd58a"><!> <span class="badge svelte-jnd58a"> </span> <!></div>`);function AB(e,t){a(t,!0);let n=F(t,`dotPulse`,3,!1),i=F(t,`waitingForUser`,3,!1);var o=kB(),c=V(o);jF(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=I(c,2),u=V(l,!0);d(l);var f=I(l,2),p=e=>{var n=U(),i=L(n),a=e=>{var n=EB();let i;var a=V(n,!0);d(n),P(()=>{i=s(n,1,`arg link svelte-jnd58a`,null,i,{"whitespace-pre-wrap":t.arg.preserveWhitespace}),K(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=DB();let r;var i=V(n,!0);d(n),P(()=>{r=s(n,1,`arg link svelte-jnd58a`,null,r,{"whitespace-pre-wrap":t.arg.preserveWhitespace}),K(n,`href`,t.arg.href),K(n,`title`,t.arg.text),A(i,t.arg.text)}),g(e,n)},c=e=>{var n=OB();let r;var i=V(n,!0);d(n),P(()=>{r=s(n,1,`arg svelte-jnd58a`,null,r,{"whitespace-pre-wrap":t.arg.preserveWhitespace}),K(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),P(()=>A(u,t.badge)),g(e,o),R()}T([`click`]);var jB=new Ce(`(prefers-reduced-motion: reduce)`),MB=Symbol(`conversation-motion-budget`);function NB(e){ve(MB,e)}function PB(){return c(MB)}var FB={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 IB(e){let t=FB[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 LB(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=IB({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 RB=h(`<div class="min-w-0"><div class="min-w-0"><!></div></div>`);function zB(e,t){a(t,!0);let n=PB(),r=J(void 0),i=J(void 0),o,s,c;function l(){return!o&&W(r)&&W(i)&&(o=LB(W(r),W(i))),o}je(()=>{let e=t.revision;if(s===void 0){s=e;return}e!==s&&(c=W(r)?.getBoundingClientRect().height,s=e)}),z(()=>{if(t.revision,c===void 0)return;let e=c;c=void 0;let i=jB.current,a=!!W(r)?.getClientRects().length,o=!i&&a?n?.claim()??`standard`:`standard`;l()?.transition(e,i,o)}),z(()=>{jB.current&&o?.snap()}),z(()=>()=>o?.destroy());var f=RB(),p=V(f),m=V(p),h=e=>{var n=U();u(L(n),()=>t.children),g(e,n)};k(m,e=>{t.children&&e(h)}),d(p),pe(p,e=>G(i,e),()=>W(i)),d(f),pe(f,e=>G(r,e),()=>W(r)),g(e,f),R()}var BB=h(`<pre class="tool-error svelte-ga7hcf"> </pre>`),VB=h(`<div class="tool-body grid gap-1.5 svelte-ga7hcf"><!></div>`),HB=h(`<article class="tool-card svelte-ga7hcf"><!> <div><!> <!> <!></div></article>`);function UB(e,t){a(t,!0);let n=F(t,`dotPulse`,3,!1),r=F(t,`meta`,19,()=>[]),i=F(t,`footer`,3,!0),o=F(t,`bodyVisible`,3,!1),c=F(t,`layoutRevision`,3,`static`),l=q(()=>{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=q(()=>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=q(()=>i()&&(r().length>0||!!t.detailsAction)),m=q(()=>!!t.error||o()||W(p));zB(e,{get revision(){return c()},children:(e,i)=>{var a=HB(),c=V(a);{let e=q(()=>t.status===`waiting_for_user`||t.status===`pending_approval`);AB(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=I(c,2),_=V(h),v=e=>{var n=BB(),r=V(n,!0);d(n),P(()=>A(r,t.error)),g(e,n)};k(_,e=>{t.error&&e(v)});var y=I(_,2),b=e=>{var n=VB();u(V(n),()=>t.children),d(n),g(e,n)};k(y,e=>{o()&&t.children&&e(b)});var x=I(y,2),S=e=>{IA(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),P(()=>{K(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}}),R()}var WB=h(`<div class="grid gap-1.5 rounded-sm border border-border bg-sidebar p-2.5" aria-hidden="true"></div>`),GB=h(`<div class="grid gap-1.5" aria-hidden="true"></div>`);function KB(e,t){let n=F(t,`variant`,3,`list`),r=F(t,`rows`,3,3),i=q(()=>Array.from({length:Math.max(1,r())},(e,t)=>t));var a=U(),o=L(a),s=e=>{var t=WB();_(t,20,()=>W(i),e=>e,(e,t)=>{{let n=q(()=>t%2==0?`h-3 w-full`:`h-3 w-2/3`);oP(e,{get class(){return W(n)}})}}),d(t),g(e,t)},c=e=>{var t=GB();_(t,20,()=>W(i),e=>e,(e,t)=>{oP(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 qB=h(`<div class="flex min-h-40 items-center justify-center text-sm text-muted-foreground">Loading full tool call…</div>`),JB=h(`<div class="grid gap-3"><p class="m-0 text-sm text-destructive"> </p> <!></div>`),YB=h(`<span> </span>`),XB=h(`<div class="flex flex-wrap gap-1.5"></div>`),ZB=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>`),QB=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>`),$B=h(`<div class="grid gap-2"><!> <!></div>`),eV=h(`<div class="grid gap-3"><!> <!> <!></div>`);function tV(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`loading`,3,!1),i=F(t,`planReviewModels`,19,()=>[]),o=F(t,`planReviewModelKey`,3,``),c=F(t,`planReviewThinkingLevel`,3,`off`),l=q(()=>t.toolCall??t.previewToolCall),u=q(()=>bx(W(l))),f=q(()=>lS(W(u),W(l))),p=q(()=>Ez(W(u).kind)),m=q(()=>t.pendingUserQuestion?.toolCallId===W(l).id?t.pendingUserQuestion:void 0),h=q(()=>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=q(()=>y(v(W(l),`args`,`argsPreview`))),x=q(()=>y(v(W(l),`result`,`resultPreview`))),S=q(()=>[W(l).status,W(f).primaryArg?.text].filter(Boolean).join(` · `));{let a=q(()=>`${W(l).toolName} details`);ZP(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=L(a),y=e=>{g(e,qB())},S=e=>{var n=JB(),r=V(n),i=V(r,!0);d(r),Oe(I(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),P(()=>A(i,t.error)),g(e,n)},T=e=>{var n=eV(),r=V(n),a=e=>{var t=XB();_(t,21,()=>W(f).meta,E,(e,t)=>{var n=YB();let r;var i=V(n,!0);d(n),P(()=>{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=I(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=I(v,2),S=e=>{var t=$B(),n=V(t),r=e=>{var t=ZB(),n=I(V(t),2);Lj(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=I(n,2),a=e=>{var t=QB(),n=I(V(t),2);Lj(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}})}R()}var nV=h(`<span class="font-normal text-muted-foreground"> </span>`),rV=h(`<li> </li>`),iV=h(`<ul class="m-0 grid list-disc gap-1 pl-5 text-xs text-muted-foreground"></ul>`),aV=h(`<div class="grid gap-2" aria-label="Approval operation summary"><p class="m-0 text-sm font-medium text-foreground"> <!></p> <!> <!></div>`);function oV(e,t){a(t,!0);let n=F(t,`includeBody`,3,!0);var r=aV(),i=V(r),o=V(i),s=I(o),c=e=>{var n=nV(),r=V(n);d(n),P(()=>A(r,`— ${t.presentation.primaryArg.text??``}`)),g(e,n)};k(s,e=>{t.presentation.primaryArg&&e(c)}),d(i);var l=I(i,2),u=e=>{_P(e,{get body(){return t.presentation.body}})};k(l,e=>{n()&&t.presentation.body.kind!==`none`&&e(u)});var f=I(l,2),p=e=>{var n=iV();_(n,23,()=>t.presentation.safetyNotes,(e,t)=>`${e}:${t}`,(e,t)=>{var n=rV(),r=V(n,!0);d(n),P(()=>A(r,W(t))),g(e,n)}),d(n),g(e,n)};k(f,e=>{t.presentation.safetyNotes.length>0&&e(p)}),d(r),P(()=>A(o,`${t.toolName??``} `)),g(e,r),R()}var sV=h(`<p class="m-0 text-sm text-muted-foreground"> </p>`),cV=h(`<!>Approving…`,1),lV=h(`<!>Approve`,1),uV=h(`<!>Denying…`,1),dV=h(`<!>Deny`,1),fV=h(`<!> <!>`,1),pV=h(`<p class="m-0 text-xs text-destructive" role="alert"> </p>`),mV=h(`<div class="grid gap-2" aria-label="Tool approval"><!> <!> <!> <!></div>`);function hV(e,t){a(t,!0);let n=F(t,`includeBody`,3,!0),r=J(void 0),i=J(void 0);async function o(e){if(W(r))return;let n=e===`approve`?t.onGrantApproval:t.onDenyApproval;if(n){G(r,e,!0),G(i,void 0);try{await n(t.approval.id)}catch(e){G(i,e instanceof Error&&e.message.trim()?e.message:`Could not resolve the approval.`,!0)}finally{G(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=q(()=>[...t.presentation.secondary,{text:t.approval.risk,tone:s(t.approval.risk)}]);var l=mV(),u=V(l);oV(u,{get toolName(){return t.toolName},get presentation(){return t.presentation},get includeBody(){return n()}});var f=I(u,2),p=e=>{var n=sV(),r=V(n,!0);d(n),P(()=>A(r,t.approval.reason)),g(e,n)};k(f,e=>{t.approval.reason&&e(p)});var m=I(f,2);IA(m,{get meta(){return W(c)},get detailsAction(){return t.detailsAction},actions:e=>{var t=fV(),n=L(t);{let e=q(()=>!!W(r));Oe(n,{size:`sm`,get disabled(){return W(e)},onclick:()=>void o(`approve`),children:(e,t)=>{var n=U(),i=L(n),a=e=>{var t=cV();zi(L(t),{class:`size-3.5`}),w(),g(e,t)},o=e=>{var t=lV();UL(L(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=I(n,2);{let e=q(()=>!!W(r));Oe(i,{size:`sm`,variant:`secondary`,get disabled(){return W(e)},onclick:()=>void o(`deny`),children:(e,t)=>{var n=U(),i=L(n),a=e=>{var t=uV();zi(L(t),{class:`size-3.5`}),w(),g(e,t)},o=e=>{var t=dV();Ol(L(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=I(m,2),_=e=>{var t=pV(),n=V(t,!0);d(t),P(()=>A(n,W(i))),g(e,t)};k(h,e=>{W(i)&&e(_)}),d(l),g(e,l),R()}var gV=h(`<!> <!> <!>`,1),_V=h(`<!> <!>`,1);function vV(e,t){a(t,!0);let n=F(t,`hydrateBody`,3,!0),r=F(t,`detailsEnabled`,3,!0),i=F(t,`planReviewModels`,19,()=>[]),o=F(t,`planReviewModelKey`,3,``),s=F(t,`planReviewThinkingLevel`,3,`off`),c=J(!1),l=J(!1),u=J(void 0),d=J(void 0),f=J(void 0),p,m=J(!1),h=q(()=>n()||W(m)),_=OA(),v=ae(()=>t.liveOutput),y=J(ie(v)),b=v?.text??``,x=new xA(e=>{G(y,e,!0)});z(()=>{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
- `)})}),z(()=>()=>x.destroy());let S=q(()=>t.toolCall?bx(t.toolCall,W(y)):void 0),w=q(()=>t.toolCall&&W(S)?lS(W(S),t.toolCall):void 0),T=q(()=>W(S)?Ez(W(S).kind):void 0),E=q(()=>t.draft?vB(t.draft.block,t.cwd):void 0),D=q(()=>W(E)?Iz(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=q(()=>O(W(S))),te=q(()=>t.toolCall&&t.pendingApproval?.toolCallId===t.toolCall.id&&t.toolCall.status===`pending_approval`?t.pendingApproval:void 0),A=q(()=>oS(t.toolCall?.toolName??t.draft?.block.toolName??`tool`)),ne=q(()=>({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=q(()=>{let e=t.toolCall?.toolName??t.draft?.block.toolName;if(e)return sS(e,W(ne),j(),t.cwd)}),re=q(()=>{if(!t.toolCall)return W(E)?.argumentBody;if(!bB(t.toolCall))return W(M)?.body}),N=q(()=>t.toolCall?!!(W(re)&&W(re).kind!==`none`):W(D)),oe=q(()=>{let e=t.toolCall?.toolName??t.draft?.block.toolName;if(e)return sS(e,W(ne),`approval`,t.cwd)}),se=q(()=>(t.toolCall?.toolName??t.draft?.block.toolName)===`explore`),ce=q(()=>W(S)?.kind===`ask_user`||W(S)?.kind===`plan_mode`&&W(S).action===`present`),P=q(()=>t.toolCall&&t.pendingUserQuestion?.toolCallId===t.toolCall.id?t.pendingUserQuestion:void 0),le=q(()=>t.toolCall&&t.pendingPlanReview?.toolCallId===t.toolCall.id?t.pendingPlanReview:void 0);function ue(...e){let t=[];return e.flat().filter(e=>t.includes(e.text)?!1:(t.push(e.text),!0))}let de=q(()=>t.toolCall?t.toolCall.status===`completed`?W(w)?.meta??[]:ue(W(E)?.meta??[],W(M)?.secondary??[],W(w)?.meta??[]):W(E)?.meta??[]),fe=q(()=>CB({draft:t.draft?.block,toolCall:t.toolCall,argumentRegion:W(A).argumentRegion,hasArgumentBody:W(N),hasDurableBodyContent:W(ee),bodyHydrated:W(h),hasApproval:!!W(te),hasInteraction:W(ce),resultPlaceholder:W(A).resultPlaceholder,footerItems:W(de),hasDetailsAction:!!(t.toolCall&&r())})),pe=q(()=>{if(W(E))return W(E).primaryArg?W(E).primaryArg:W(E).path?{text:W(E).path}:{text:`Preparing arguments…`}}),me=q(()=>W(w)?.badge??W(E)?.toolName??t.draft?.block.toolName??`tool`),he=q(()=>W(ce)?W(w)?.primaryArg:W(w)?.primaryArg??W(M)?.primaryArg??W(pe)),ge=q(()=>xB({draft:t.draft?.block,toolCall:t.toolCall})),_e=q(()=>TB({stage:W(ge),activityRevision:W(fe).structuralRevision,badge:W(me),arg:W(he)})),ve=q(()=>W(w)?.dotTone??`running`),ye=q(()=>W(w)?.dotPulse??!0),be=q(()=>W(de)),B=q(()=>t.toolCall&&r()?{label:W(w)?.detailsAction?.label??`Details`,onClick:Se}:void 0),V=q(()=>({label:W(w)?.detailsAction?.label??`Details`,onClick:Se})),xe=q(()=>t.toolCall?.error?si(t.toolCall.error,{headLines:4,tailLines:2,maxChars:2e3}).text:void 0);z(()=>{n()&&G(m,!0)}),z(()=>{let e=t.toolCall?.id;e!==p&&(p=e,G(c,!1),G(l,!1),G(u,void 0),G(d,void 0),G(f,void 0))});async function Se(){if(t.toolCall&&(G(c,!0),!(W(d)&&W(f)===t.toolCall.updatedAt))){G(l,!0),G(u,void 0);try{let e=_.fetchToolCall;if(!e)throw Error(`Tool details are unavailable here.`);G(d,await e(t.toolCall.id),!0),G(f,t.toolCall.updatedAt,!0)}catch(e){G(u,e instanceof Error?e.message:String(e),!0)}finally{G(l,!1)}}}var Ce=_V(),we=L(Ce);{let e=q(()=>t.toolCall?.status),n=q(()=>t.toolCall?void 0:W(fe).phase===`prepared`?`prepared`:`drafting`),r=q(()=>W(fe).errorVisible?W(xe):void 0),a=q(()=>W(se)||W(fe).argumentVisible||W(fe).interactionMode!==`none`||W(fe).resultMode!==`none`);UB(we,{get status(){return W(e)},get draftPhase(){return W(n)},get dotTone(){return W(ve)},get dotPulse(){return W(ye)},get badge(){return W(me)},get arg(){return W(he)},get error(){return W(r)},get meta(){return W(be)},get footer(){return W(fe).footerVisible},get bodyVisible(){return W(a)},get layoutRevision(){return W(_e)},get detailsAction(){return W(B)},get onOpenFile(){return t.onOpenFile},children:(e,n)=>{var r=gV(),a=L(r),c=e=>{{let n=q(()=>W(S)?.kind===`explore`?W(S):void 0);rI(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=q(()=>!!(t.toolCall||t.draft?.block.done)),r=q(()=>!t.toolCall&&!t.draft?.block.done);_P(e,{get body(){return W(re)},get highlight(){return W(n)},get streaming(){return W(r)}})}};k(a,e=>{W(se)?e(c):W(fe).argumentVisible&&W(re)&&e(l,1)});var u=I(a,2),d=e=>{{let n=q(()=>!W(fe).argumentVisible);hV(e,{get approval(){return W(te)},get toolName(){return t.toolCall.toolName},get presentation(){return W(oe)},get includeBody(){return W(n)},get detailsAction(){return W(V)},get onGrantApproval(){return t.onGrantApproval},get onDenyApproval(){return t.onDenyApproval}})}};k(u,e=>{W(fe).interactionMode===`approval`&&W(te)&&W(oe)&&t.toolCall&&e(d)});var f=I(u,2),p=e=>{KB(e,{get variant(){return W(A).resultPlaceholder.variant},get rows(){return W(A).resultPlaceholder.rows}})},m=e=>{var n=U(),r=L(n);{let e=q(()=>W(ce)?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(P)},get planReview(){return W(le)},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(se)&&W(fe).resultMode===`placeholder`&&W(A).resultPlaceholder?e(p):!W(se)&&W(fe).resultMode===`output`&&t.toolCall&&W(S)&&W(T)&&e(m,1)}),g(e,r)},$$slots:{default:!0}})}var H=I(we,2),Te=e=>{tV(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=>G(c,e,!0)})};k(H,e=>{t.toolCall&&r()&&e(Te)}),g(e,Ce),R()}function yV(e){return e.bodyVisible?e.previewVisible?`preview`:`status`:`none`}function bV(e){return[e.state,`body:${e.bodyKind}`,e.errorVisible?`error`:`no-error`,e.footerItemCount>0?`footer:${e.footerItemCount}`:`no-footer`].join(`|`)}var xV=h(`<p class="m-0 text-sm leading-6 text-muted-foreground">Summarizing recent work…</p>`),SV=h(`<p class="m-0 text-sm leading-6 text-muted-foreground">Compaction stopped.</p>`),CV=h(`<div class="my-2"><!></div>`);function wV(e,t){a(t,!0);function n(e){return e&&typeof e==`object`?e:void 0}let r=q(()=>n(t.notice.details)),i=q(()=>typeof W(r)?.compactedMessages==`number`?W(r).compactedMessages:void 0),o=q(()=>t.notice.reason===`threshold`?`auto compact`:t.notice.reason===`overflow`?`overflow recovery`:`manual`),s=q(()=>t.notice.state===`failed`?`danger`:t.notice.state===`cancelled`?`warn`:t.notice.state===`running`?`running`:`good`),c=q(()=>{let e=t.notice.contextTokens??t.notice.tokensBefore;if(!(!e||!t.notice.contextWindow))return Math.round(e/t.notice.contextWindow*100)}),l=q(()=>{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?Xt(e).slice(-6).join(`
127
- `):``}),u=J(ie(Date.now()));z(()=>{if(t.notice.state!==`running`)return;let e=setInterval(()=>{G(u,Date.now(),!0)},250);return()=>clearInterval(e)});let f=q(()=>t.notice.createdAt?Date.parse(t.notice.createdAt):NaN),p=q(()=>{if(!(t.notice.state!==`running`||Number.isNaN(W(f))))return Math.max(0,Math.floor((W(u)-W(f))/1e3))}),m=q(()=>W(p)===void 0?void 0:`${Math.floor(W(p)/60)}:${String(W(p)%60).padStart(2,`0`)}`),h=q(()=>W(p)!==void 0&&W(p)>=1),_=q(()=>{let e=[];return typeof t.notice.tokensBefore==`number`&&e.push({text:`${hv(t.notice.tokensBefore)} before`}),typeof t.notice.tokensAfter==`number`&&e.push({text:`≈${hv(t.notice.tokensAfter)} after`}),typeof t.notice.freedTokens==`number`&&t.notice.freedTokens>0&&e.push({text:`${hv(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=q(()=>{let e=[],n=t.notice.contextTokens??t.notice.tokensBefore;return typeof n==`number`&&e.push({text:`${hv(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=q(()=>t.notice.state===`completed`?W(_):t.notice.state===`running`?W(v):[]),b=q(()=>t.notice.errorMessage?.trim()||`Could not compact this conversation.`),x=q(()=>t.notice.state===`running`||t.notice.state===`cancelled`||t.notice.state===`completed`&&W(l).length>0),S=q(()=>bV({state:t.notice.state,bodyKind:yV({bodyVisible:W(x),previewVisible:W(l).length>0}),errorVisible:t.notice.state===`failed`,footerItemCount:W(y).length}));var C=CV(),w=V(C);{let e=q(()=>t.notice.state===`completed`?void 0:t.notice.state),n=q(()=>t.notice.state===`running`),r=q(()=>({text:W(o)})),i=q(()=>t.notice.state===`failed`?W(b):void 0);UB(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=L(r),a=e=>{Lj(e,{get code(){return W(l)},language:`markdown`,trim:!1,wrap:!0,overflow:`hidden`,tail:!0,get fixedRows(){return 6}})},o=e=>{g(e,xV())},s=e=>{g(e,SV())};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),R()}var TV=h(`<span class="arg svelte-1ey3ztt"> </span>`),EV=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>`),DV=h(`<article class="task-event svelte-1ey3ztt"><div class="task-event-header svelte-1ey3ztt"><!> <span class="badge svelte-1ey3ztt"> </span> <!></div> <!></article>`);function OV(e,t){a(t,!0);let n=q(()=>Wf(t.notice.status)),r=q(()=>t.notice.exitCode!==void 0&&t.notice.exitCode!==null),i=q(()=>t.notice.event?`task ${t.notice.event}`:`task update`);var o=DV(),s=V(o),c=V(s);{let e=q(()=>Gf(t.notice.status));gt(c,{get tone(){return W(n)},get pulse(){return W(e)},size:`xs`,class:`mr-1.5 align-middle`})}var l=I(c,2),u=V(l,!0);d(l);var f=I(l,2),p=e=>{var n=TV(),r=V(n,!0);d(n),P(()=>A(r,t.notice.taskName)),g(e,n)};k(f,e=>{t.notice.taskName&&e(p)}),d(s);var m=I(s,2),h=e=>{var i=EV(),a=V(i),o=V(a,!0);d(a);var s=I(a,2),c=e=>{{let n=q(()=>t.notice.exitCode===0?`neutral`:`danger`);Hi(e,{get tone(){return W(n)},size:`xs`,children:(e,n)=>{w();var r=M();P(()=>A(r,`exit ${t.notice.exitCode??``}`)),g(e,r)},$$slots:{default:!0}})}},l=e=>{Hi(e,{tone:`warn`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>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=I(s,2),f=e=>{{let r=q(()=>W(n)===`neutral`?`border-border bg-muted text-muted-foreground`:``);Hi(e,{get tone(){return W(n)},size:`xs`,get class(){return W(r)},children:(e,n)=>{w();var r=M();P(()=>A(r,t.notice.status)),g(e,r)},$$slots:{default:!0}})}};k(u,e=>{t.notice.status&&e(f)}),d(i),P(()=>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),P(()=>A(u,W(i))),g(e,o),R()}var kV=h(`<div class="status-actions svelte-qhsjll"><!></div>`),AV=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 jV(e,t){a(t,!0);let n=J(ie(Date.now()));z(()=>{if(t.notice.state!==`retrying`||!t.notice.retryAt)return;G(n,Date.now(),!0);let e=setInterval(()=>{G(n,Date.now(),!0)},250);return()=>clearInterval(e)});let r=q(()=>t.notice.state!==`retrying`&&t.isLast&&!t.sending&&t.notice.retryable===!0&&!!t.notice.runId&&!!t.onContinueFromFailure),i=q(()=>t.notice.state===`retrying`?`running`:`warn`),o=q(()=>t.notice.state===`retrying`?`retrying`:`run`),c=q(()=>{switch(t.notice.state){case`retrying`:return`model request`;case`interrupted`:return`interrupted`;default:return`failed`}}),l=q(()=>{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=q(()=>t.notice.errorMessage?.trim()?t.notice.errorMessage.trim():void 0),f=q(()=>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=q(()=>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=AV(),_=V(h),v=V(_);{let e=q(()=>t.notice.state===`retrying`);gt(v,{get tone(){return W(i)},get pulse(){return W(e)},size:`xs`,class:`mr-1.5 align-middle`})}var y=I(v,2),b=V(y,!0);d(y);var x=I(y,2),S=V(x,!0);d(x),d(_);var C=I(_,2),T=V(C,!0);d(C);var E=I(C,2),D=e=>{var t=kV();Oe(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),P(()=>{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),R()}var MV=h(`<div class="relative min-w-0 px-3"><!></div>`),NV=h(`<article class="transcript-entry assistant thinking-entry svelte-1tpvsz2" data-state="static"><div class="message-body svelte-1tpvsz2"><!></div></article>`),PV=h(`<span class="stream-caret svelte-1tpvsz2" aria-hidden="true"></span>`),FV=h(`<div class="message-content svelte-1tpvsz2"><!> <!></div>`),IV=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>`),LV=h(`<article><div class="message-body svelte-1tpvsz2"><!> <!></div></article>`),RV=h(`<div><!></div>`);function zV(e,t){a(t,!0);let n=F(t,`approvalsByToolCallId`,19,()=>new Map),r=F(t,`questionsByToolCallId`,19,()=>new Map),i=F(t,`reviewsByToolCallId`,19,()=>new Map),o=F(t,`hydrateToolBodies`,3,!0),c=F(t,`planReviewModels`,19,()=>[]),u=F(t,`planReviewModelKey`,3,``),f=F(t,`planReviewThinkingLevel`,3,`off`),p=q(()=>{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=q(()=>{if(t.node.kind!==`message`)return`static`;let e=t.node.item;return e.role===`assistant`&&e.live?e.done?`complete`:`running`:`static`}),h=J(!1),_=J(void 0),v;z(()=>{let e=t.entranceMotion;!e||e.token===v||(v=e.token,t.onClaimEntrance?.(e.token)&&(G(_,e,!0),G(h,!0)))});var y=RV();let b,x;var S=V(y),C=e=>{var a=MV(),s=V(a);{let e=q(()=>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=q(()=>!t.node.toolCall);Cy(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=q(()=>t.activeProject?.dir),s=q(()=>t.node.toolCall&&n().get(t.node.toolCall.id)?.status===`pending`?n().get(t.node.toolCall.id):void 0),l=q(()=>t.node.toolCall?r().get(t.node.toolCall.id):void 0),d=q(()=>t.node.toolCall?i().get(t.node.toolCall.id):void 0);vV(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=q(()=>({kind:`tool_result_error`,toolName:t.node.toolName,error:t.node.error}));Cy(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{var r=MV();NF(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=q(()=>({kind:`run_status`,notice:t.node.notice}));Cy(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{{let n=q(()=>t.node.key===t.lastTimelineKey);jV(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=q(()=>({kind:`compaction`,notice:t.node.notice}));Cy(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{var r=MV();wV(V(r),{get notice(){return t.node.notice}}),d(r),g(e,r)},$$slots:{default:!0}})}},D=e=>{{let n=q(()=>({kind:`task_event`,notice:t.node.notice}));Cy(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},triggerClass:`block select-text`,children:(e,n)=>{OV(e,{get notice(){return t.node.notice}})},$$slots:{default:!0}})}},O=e=>{Cy(e,{get target(){return W(p)},get menu(){return t.transcriptMenu},triggerClass:`select-text`,children:(e,n)=>{var r=NV(),i=V(r),a=V(i);{let e=q(()=>t.node.items.map(e=>e.item));yF(a,{get items(){return W(e)}})}d(i),d(r),g(e,r)},$$slots:{default:!0}})},ee=e=>{{let n=q(()=>({kind:`message`,item:t.node.item})),r=q(()=>`select-text ${t.node.item.role===`user`?`block`:``}`);Cy(e,{get target(){return W(n)},get menu(){return t.transcriptMenu},get triggerClass(){return W(r)},children:(e,n)=>{var r=LV(),i=V(r),a=V(i),o=e=>{var n=FV(),r=V(n),i=e=>{{let n=q(()=>!!t.node.item.optimistic);Ly(e,{get text(){return t.node.item.text},get pending(){return W(n)}})}},a=e=>{{let n=q(()=>t.node.item.role!==`assistant`),r=q(()=>!!(t.node.item.live&&!t.node.item.done)),i=q(()=>t.activeProject?.dir);TA(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 vS}})}};k(r,e=>{t.node.item.role===`user`?e(i):e(a,-1)});var o=I(r,2),s=e=>{g(e,PV())};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=I(a,2),l=e=>{var n=IV(),r=V(n,!0);d(n),P(e=>A(r,e),[()=>t.node.item.errorMessage.trim()]),g(e,n)},u=q(()=>t.node.item.stopReason===`error`&&t.node.item.errorMessage?.trim());k(c,e=>{W(u)&&e(l)}),d(i),d(r),P(()=>{s(r,1,`transcript-entry ${t.node.item.role} ${t.node.item.live?`streaming`:``}`,`svelte-1tpvsz2`),K(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),P(()=>{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})}),de(`animationend`,y,e=>{e.target===e.currentTarget&&(G(h,!1),G(_,void 0))}),g(e,y),R()}function BV(e){return{profile:`standard`,delaysMs:Array.from({length:e},()=>0)}}var VV=class{allocateMotion;scope;seeded=!1;sequence=0;seen=new Set;pending=new Map;constructor(e=BV){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()}},HV={burstWindowMs:160,cooldownMs:240,compactThreshold:4,minimalThreshold:9,compactDelayStepMs:12,compactDelayCapMs:60},UV={standard:0,compact:1,minimal:2};function WV(e,t){return UV[t]>UV[e]?t:e}function GV(e){return e>=HV.minimalThreshold?`minimal`:e>=HV.compactThreshold?`compact`:`standard`}var KV=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=WV(this.activeProfile,GV(this.eventTimes.length));let n=Array.from({length:e},(e,t)=>this.activeProfile===`compact`?Math.min(t*HV.compactDelayStepMs,HV.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>=HV.cooldownMs&&this.reset();let t=e-HV.burstWindowMs;for(;this.eventTimes.length>0&&this.eventTimes[0]<t;)this.eventTimes.shift()}};function qV(e){return e.timelineLength>0||!!e.streamingText||e.sending||e.queuedPromptCount>0}var JV=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>`),YV=h(`<article class="waiting-entry svelte-96a2zm"><!></article>`);function XV(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=F(t,`controller`,15),i=F(t,`atEnd`,15,!0),o=F(t,`paddingEnd`,3,0),s=F(t,`contentVisibility`,3,!1),c=F(t,`transcriptLabel`,3,`Conversation transcript`),l=F(t,`followBottom`,3,!0),u=F(t,`approvals`,19,()=>[]),f=F(t,`pendingUserQuestions`,19,()=>[]),p=F(t,`pendingPlanReviews`,19,()=>[]),m=F(t,`active`,3,!0),h=F(t,`planReviewModels`,19,()=>[]),_=F(t,`planReviewModelKey`,3,``),v=F(t,`planReviewThinkingLevel`,3,`off`),y=new KV;NB(y);let b=new VV(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=q(()=>{let e=new Map,r=pF(t.timelinePrefix).map(t=>({kind:`timeline`,key:n(t.key,e),node:t}));return C+=1,{revision:C,rows:r,seenKeys:e}}),T=q(()=>pF(t.timelineTail)),E=q(()=>t.timelinePrefix.some(e=>e.kind===`compaction`&&e.notice.state===`running`)),D=q(()=>t.timelineTail.some(e=>e.kind===`compaction`&&e.notice.state===`running`)),O=q(()=>W(E)||W(D)),ee,te=new ce,ne=q(()=>{let e=new ce(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=q(()=>new Map(u().map(e=>[e.toolCallId,e]))),M=q(()=>new Map(f().map(e=>[e.toolCallId,e]))),re=q(()=>new Map(p().map(e=>[e.toolCallId,e]))),ie=q(()=>`${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 N(e,t){return b.claim(e,t)}function ae(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=oS(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=oS(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 oe=q(()=>!qV({timelineLength:t.timelinePrefix.length+t.timelineTail.length,streamingText:t.streamingText,sending:t.sending,queuedPromptCount:t.queuedPrompts.length}));var se=U(),le=L(se),ue=e=>{my(e,{title:`Where should we start?`,message:`Ask Nerve to explore, plan, or build in this project.`,footer:e=>{var n=U(),r=L(n),i=e=>{var n=JV(),r=V(n);mn(r,{class:`size-3.5 shrink-0`,strokeWidth:2.2,"aria-hidden":`true`});var i=I(r,4),a=V(i,!0);d(i),d(n),P(()=>{K(n,`title`,t.activeProject?.dir),K(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}})},de=e=>{Bi(e,{get items(){return W(ne)},getKey:e=>e.key,get structureVersion(){return W(ie)},get heightCacheKey(){return t.heightCacheKey},getMeasurementVersion:ae,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=L(i),o=e=>{zV(e,{get node(){return r().node},get entranceMotion(){return r().entranceMotion},onClaimEntrance:e=>N(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=YV();SF(V(t),{}),d(t),g(e,t)},c=e=>{Qy(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(le,e=>{W(oe)?e(ue):e(de,-1)}),g(e,se),R()}var ZV=h(`<div><span class="font-medium text-foreground"> </span> <!></div>`);function QV(e,t){let n=F(t,`tone`,3,`muted`);var r=ZV(),i=V(r),a=V(i,!0);d(i);var o=I(i,2),c=e=>{var n=M();P(()=>A(n,t.message)),g(e,n)};k(o,e=>{t.message&&e(c)}),d(r),P(()=>{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 $V=new Set([`$$slots`,`$$events`,`$$legacy`]);function eH(e,t){let n=H(t,$V),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`}]];N(e,B({name:`message-square-off`},()=>n,{get iconNode(){return r}}))}var tH=h(`<p class="max-w-md text-xs text-muted-foreground"> </p>`),nH=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 rH(e,t){let n=F(t,`title`,3,`No conversation selected.`);var r=nH(),i=V(r);eH(i,{class:`size-8 text-muted-foreground`});var a=I(i,2),o=V(a,!0);d(a);var s=I(a,2),c=e=>{var n=tH(),r=V(n,!0);d(n),P(()=>A(r,t.message)),g(e,n)};k(s,e=>{t.message&&e(c)}),d(r),P(()=>A(o,n())),g(e,r)}var iH=h(`<div class="flex h-full min-h-0 flex-col"><!> <div class="min-h-0 flex-1"><!></div></div>`);function aH(e,t){a(t,!0);let n=q(()=>t.model.active??!0),r=q(()=>t.model.timeline.tail.at(-1)?.key??t.model.timeline.prefix.at(-1)?.key),i=q(()=>t.model.approvals?.filter(e=>e.status===`pending`)??[]),o=q(()=>W(i)[0]?.id),s=q(()=>W(i).length),c=q(()=>t.model.pendingUserQuestions?.filter(e=>e.status===`pending`).map(e=>e.id)??[]),l=q(()=>t.model.pendingPlanReviews?.filter(e=>e.status===`pending`).map(e=>e.id)??[]),f=q(()=>qV({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=dF({active:()=>W(n),conversationOpen:()=>t.model.open,conversationId:()=>t.model.conversationId,contentReady:()=>W(f)});{let i=e=>{ay(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=iH(),a=V(i),o=e=>{QV(e,B(()=>t.model.banner))};k(a,e=>{t.model.banner&&e(o)});var s=I(a,2),c=V(s);{let e=q(()=>t.model.transcriptHeightCacheKey??t.model.conversationId),i=q(()=>W(n)?p.followBottom:!1);XV(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=L(n),i=e=>{var n=U();u(L(n),()=>t.composer),g(e,n)},a=e=>{Jv(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=L(n),i=e=>{var n=U();u(L(n),()=>t.emptyExtension),g(e,n)},a=e=>{rH(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=q(()=>W(n)&&!p.atEnd);ey(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}})}R()}async function oH(e,t){let n=(await Nr(`agent.configure`,{agentId:e,...t})).result;if(!(`agent`in n))throw Error(`Workbench agent configuration returned an async result`);return n.agent}async function sH(e,t){return(await Nr(`agent.subagentTranscript.get`,{parentAgentId:e,childAgentId:t})).result.transcript}function cH(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 lH(e){if(!e.ok){let t=await e.text().catch(()=>``),n=Gee(t);throw new Ui(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 Ui(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 uH(e,t,n={}){let r=new FormData;return r.append(`file`,e,`composer-recording.${cH(e.type)}`),r.append(`durationMs`,String(Math.max(1,Math.round(t)))),(await lH(await fetch(`/api/transcription/audio`,{method:`POST`,credentials:`same-origin`,body:r,signal:n.signal}))).text}async function dH(){return(await Nr(`auth.providers.list`,{})).result.providers}async function fH(){return qi(`/api/auth/credential-key`)}async function pH(e,t){await Xee(`/api/provider-keys`,{provider:e,encryptedApiKey:t})}async function mH(e){await Kee(`/api/auth/providers/${Wi(e)}`)}async function hH(e){return(await Gi(`/api/auth/oauth/flows`,{provider:e})).flow}async function gH(e){return(await qi(`/api/auth/oauth/flows/${Wi(e)}`)).flow}async function _H(e,t){return(await Gi(`/api/auth/oauth/flows/${Wi(e)}/respond`,t)).flow}async function vH(e){return(await Gi(`/api/auth/oauth/flows/${Wi(e)}/cancel`,{})).flow}async function yH(){return(await Nr(`providerCatalog.get`,{})).result}async function bH(e){return(await Nr(`providerCatalog.custom.upsert`,e)).result}async function xH(e){return(await Nr(`providerCatalog.custom.delete`,{id:e})).result}async function SH(e){return(await Nr(`providerCatalog.model.upsert`,e)).result}async function CH(e,t){return(await Nr(`providerCatalog.model.delete`,{provider:e,modelId:t})).result}async function wH(){return qi(`/api/client-config`)}async function TH(){return(await Nr(`model.list`,{})).result.models}async function EH(){return(await Nr(`completion.slash.list`,{})).result.items}async function DH(e,t){return e?(await Nr(`completion.files.list`,{projectId:e,q:t})).result.items:[]}async function OH(e){let{result:t}=await Nr(`snapshot.conversation.get`,{conversationId:e});return t}async function kH(e){return(await Nr(`conversation.contextUsage.get`,{conversationId:e})).result.contextUsage}async function AH(e){return(await Nr(`conversation.compact`,{conversationId:e})).result}async function jH(e){await Nr(`conversation.compaction.cancel`,{conversationId:e})}async function MH(e){await Nr(`conversation.delete`,{conversationId:e})}async function NH(e){return(await Gi(`/api/filesystem/clipboard-image`,{name:e.name,type:e.type,dataBase64:await qee(e)})).path}async function PH(e,t=!1){return(await Nr(`filesystem.directories.list`,{path:e,showHidden:t})).result}async function FH(e){return(await Nr(`filesystem.project.entries.list`,e)).result}async function IH(e){return(await Nr(`filesystem.project.entries.create`,e)).result}async function LH(e,t,n){let r=new URLSearchParams({projectId:e,path:t});return n!==void 0&&r.set(`line`,String(n)),qi(`/api/filesystem/file?${r.toString()}`)}async function RH(e){return(await Nr(`git.repos.discover`,{projectId:e})).result}async function zH(e,t){return(await Nr(`git.overview.get`,{projectId:e,repo:t})).result}async function BH(e){return(await Nr(`git.project.files.status.get`,{projectId:e})).result}async function VH(e,t){return(await Nr(`git.branches.list`,{projectId:e,repo:t})).result}async function HH(e,t,n){return(await Nr(`git.branch.create`,{projectId:e,repo:t,name:n})).result}async function UH(e,t,n){return(await Nr(`git.branch.switch`,{projectId:e,repo:t,name:n})).result}async function WH(e,t){return(await Nr(`git.sync`,{projectId:e,repo:t})).result}async function GH(e,t){return(await Nr(`git.push`,{projectId:e,repo:t})).result}async function KH(e,t){return(await Nr(`git.pull`,{projectId:e,repo:t})).result}async function qH(e,t){return(await Nr(`git.fetch`,{projectId:e,repo:t})).result}async function JH(e,t){return(await Nr(`git.switchBaseAndPull`,{projectId:e,repo:t})).result}async function YH(e,t,n,r){return(await Nr(`git.file.diff.get`,{projectId:e,repo:t,path:n,area:r})).result}async function XH(e,t,n){return(await Nr(`git.file.stage`,{projectId:e,repo:t,path:n})).result}async function ZH(e,t,n){return(await Nr(`git.file.unstage`,{projectId:e,repo:t,path:n})).result}async function QH(e,t,n){return(await Nr(`git.file.discard`,{projectId:e,repo:t,path:n})).result}async function $H(e,t){return(await Nr(`github.status.get`,{projectId:e,repo:t})).result}async function eU(e,t,n){return(await Nr(`github.pr.list`,{projectId:e,repo:t,filters:n})).result}async function tU(e,t,n,r){return(await Nr(e,{projectId:t,repo:n,number:r})).result}async function nU(e,t,n){return(await Nr(`github.pr.initial.get`,{projectId:e,repo:t,number:n})).result}var rU=(e,t,n)=>tU(`github.pr.core.get`,e,t,n),iU=(e,t,n)=>tU(`github.pr.conversation.get`,e,t,n),aU=(e,t,n)=>tU(`github.pr.overview.get`,e,t,n),oU=(e,t,n)=>tU(`github.pr.commits.get`,e,t,n),sU=(e,t,n)=>tU(`github.pr.checks.get`,e,t,n);async function cU(e){return(await Nr(`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 lU(e,t,n){return(await Nr(`github.pr.files.get`,{projectId:e,repo:t,number:n})).result}async function uU(e,t,n,r,i){return(await Nr(`github.pr.merge`,{projectId:e,repo:t,number:n,method:r,expectedHeadOid:i})).result}async function dU(e,t,n){return(await Nr(`github.pr.checkout`,{projectId:e,repo:t,number:n})).result}async function fU(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 qi(`/api/logs${t.size?`?${t.toString()}`:``}`)}async function pU(e){return(await Nr(`applicationLog.prune`,e)).result}async function mU(e){return(await Nr(`project.create`,{dir:e})).result.project}async function hU(e){return(await Nr(`project.get`,{projectId:e})).result.project}async function gU(e){await Nr(`project.delete`,{projectId:e})}async function _U(e,t){return(await Nr(`project.conversations.prune`,{projectId:e,...t})).result}async function vU(e,t){return(await Nr(`project.openEditor`,{projectId:e,editor:t})).result}async function yU(e){return(await Nr(`taskDefinition.list`,{projectId:e})).result.definitions.map(e=>Cr.parse(e))}async function bU(e,t){let n=(await Nr(`taskDefinition.create`,{projectId:e,...t})).result.definition;return Cr.parse(n)}async function xU(e,t,n){let r=(await Nr(`taskDefinition.update`,{projectId:e,definitionId:t,...n})).result.definition;return Cr.parse(r)}async function SU(e,t){await Nr(`taskDefinition.delete`,{projectId:e,definitionId:t})}async function CU(e,t={}){return(await Nr(`promptSuggestion.listForProject`,{projectId:e,...t})).result}async function wU(e){return(await Nr(`promptSuggestion.statuses.list`,{projectId:e})).result.statuses}async function TU(e){return(await Nr(`promptSuggestion.create`,e)).result}async function EU(e){await Nr(`promptSuggestion.enabled.update`,e)}async function DU(e){await Nr(`promptSuggestion.trust.update`,e)}async function OU(e){let t=(await Nr(`scratchNote.list`,{projectId:e})).result;return kr.parse(t).notes}async function kU(e,t={}){let n=(await Nr(`scratchNote.create`,{projectId:e,...t})).result.note;return yr.parse(n)}async function AU(e,t,n){let r=(await Nr(`scratchNote.update`,{projectId:e,noteId:t,...n})).result.note;return yr.parse(r)}async function jU(e,t){await Nr(`scratchNote.delete`,{projectId:e,noteId:t})}async function MU(){return(await Nr(`settings.get`,{})).result}async function NU(e){return(await Nr(`settings.update`,e)).result.settings}async function PU(e){return(await Nr(`skill.list`,{projectId:e})).result}async function FU(e){let t=(await Nr(`toolCall.get`,{toolCallId:e})).result;return Er.parse(t.toolCall)}async function IU(){return(await Nr(`userQuestion.list`,{status:`pending`})).result.questions}async function LU(e,t){let n=(await Nr(`approval.grant`,{approvalId:e,note:t})).result;if(!(`toolCall`in n))throw KU(`approval.grant`);return Er.parse(n.toolCall)}async function RU(e,t){let n=(await Nr(`approval.deny`,{approvalId:e,note:t})).result;if(!(`toolCall`in n))throw KU(`approval.deny`);return Er.parse(n.toolCall)}async function zU(e,t={}){let n=(await Nr(`planReview.accept`,{reviewId:e,...t})).result;if(!(`planReview`in n))throw KU(`planReview.accept`);return hr.parse(n.planReview)}async function BU(e,t={}){return(await Nr(`planReview.acceptInNewChat`,{reviewId:e,...t})).result}async function VU(e,t){let n=(await Nr(`planReview.reject`,{reviewId:e,feedback:t})).result;if(!(`planReview`in n))throw KU(`planReview.reject`);return hr.parse(n.planReview)}async function HU(e,t){let n=(await Nr(`planReview.requestChanges`,{reviewId:e,feedback:t})).result;if(!(`planReview`in n))throw KU(`planReview.requestChanges`);return hr.parse(n.planReview)}async function UU(e,t){let n=(await Nr(`planReview.discard`,{reviewId:e,feedback:t})).result;if(!(`planReview`in n))throw KU(`planReview.discard`);return hr.parse(n.planReview)}async function WU(e,t){let n=(await Nr(`userQuestion.answer`,{questionId:e,answer:t})).result;if(!(`question`in n))throw KU(`userQuestion.answer`);return Hr.parse(n.question)}async function GU(e,t){let n=(await Nr(`userQuestion.dismiss`,{questionId:e,reason:t})).result;if(!(`question`in n))throw KU(`userQuestion.dismiss`);return Hr.parse(n.question)}function KU(e){return Error(`Workbench operation ${e} returned an async result`)}async function qU(){return(await Nr(`usage.subscription.get`,{})).result.usage}async function JU(){let{result:e}=await Nr(`snapshot.workspace.get`,{});return{...e,snapshot:{...e.snapshot,conversations:[...e.snapshot.conversations].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}}}var YU=h(`<div aria-live="polite"><span class="activity-sr svelte-9ds0r"> </span> <span aria-hidden="true"> </span></div>`);function XU(e,t){a(t,!0);let n=F(t,`recording`,3,!1),r=F(t,`transcribing`,3,!1),i=F(t,`elapsedMs`,3,0),o=F(t,`maxDurationMs`,3,1),c=F(t,`retryAttempt`,3,0),l=F(t,`maxRetries`,3,0),u=F(t,`class`,3,``),f=q(()=>n()||r()),p=q(()=>b(i())),m=q(()=>b(o())),h=q(()=>Math.max(0,Math.min(1,o()>0?i()/o():0))),_=q(()=>W(h)>=.85),v=q(()=>n()?`${W(p)} / ${W(m)}`:c()>0?`Retry ${c()}/${l()}`:`Transcribing…`),y=q(()=>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=L(x),C=e=>{var t=YU(),r=V(t),i=V(r,!0);d(r);var a=I(r,2),o=V(a,!0);d(a),d(t),P(()=>{s(t,1,`transcription-activity rounded-full ${u()}`,`svelte-9ds0r`),K(t,`data-state`,n()?`recording`:`transcribing`),K(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),R()}function ZU(e){let t=Qr(e);return X.conversationViews[t]??={conversationId:e,activeEntryId:void 0,activeEntryIds:[],entries:[],toolCalls:[],treeNodes:[],optimisticMessages:[],queuedPrompts:[],cursorSeq:0,sending:!1,stopping:!1,composerText:``,loading:!1},X.conversationViews[t]}function QU(){Cp()}function $U(e){Kp({kind:`conversation`,id:e}),ZU(e)}var eW=0;function tW(){return eW+=1,`pending_${Date.now().toString(36)}_${eW.toString(36)}`}function nW(){let e=Z.activeCenterTab;if(e?.kind===`pending-conversation`)return X.pendingConversations[ti(e.id)]}function rW(){Z.error=void 0}function iW(){tp(),X.activeConversationTabId=void 0,rW(),ep.text=``}var aW=16e3,oW=`audio/wav`,sW=4096;function cW(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 lW(e,t,n=aW){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 uW(e){let t=Math.max(-1,Math.min(1,e));return Math.round(t<0?t*32768:t*32767)}function dW(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 fW(e,t=aW){let n=t*2,r=e.length*2,i=new ArrayBuffer(44+r),a=new DataView(i);pW(a,0,`RIFF`),a.setUint32(4,36+r,!0),pW(a,8,`WAVE`),pW(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),pW(a,36,`data`),a.setUint32(40,r,!0);let o=44;for(let t of e)a.setInt16(o,uW(t),!0),o+=2;return new Uint8Array(i)}function pW(e,t,n){for(let r=0;r<n.length;r+=1)e.setUint8(t+r,n.charCodeAt(r))}function mW(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 hW(){if(!(typeof window>`u`))return window.AudioContext??window.webkitAudioContext}function gW(e){try{return new e({sampleRate:aW})}catch{return new e}}var _W=class e{audioContext;processor;source;stream;chunks=[];startedAt=0;stopped=!0;static isSupported(){return!!(typeof navigator<`u`&&navigator.mediaDevices?.getUserMedia&&hW())}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=hW();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:aW},sampleSize:{ideal:16},echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}}),this.audioContext=gW(t),this.audioContext.state===`suspended`&&await this.audioContext.resume(),this.source=this.audioContext.createMediaStreamSource(this.stream),this.processor=this.audioContext.createScriptProcessor(sW,1,1),this.processor.onaudioprocess=e=>{if(!this.stopped){this.chunks.push(mW(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=cW(i);if(a.length===0)throw Error(`No audio was captured.`);let o=fW(dW(lW(a,r,aW),aW,e.maxDurationMs),aW),s=new ArrayBuffer(o.byteLength);return new Uint8Array(s).set(o),{blob:new Blob([s],{type:oW}),durationMs:n,mimeType:oW}}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)}},vW=[500,1e3,2e3];function yW(e){return e instanceof DOMException&&e.name===`AbortError`}function bW(e){return vW[e-1]??vW.at(-1)??2e3}function xW(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 SW(e){return yW(e)?!1:e instanceof Ui&&e.status?e.status===408||e.status===429||e.status>=500:!0}function CW(e){return e instanceof Error?e.message:String(e)}var wW=class e{#e=J(!1);get recording(){return W(this.#e)}set recording(e){G(this.#e,e,!0)}#t=J(!1);get transcribing(){return W(this.#t)}set transcribing(e){G(this.#t,e,!0)}#n=J(void 0);get error(){return W(this.#n)}set error(e){G(this.#n,e,!0)}#r=J(0);get elapsedMs(){return W(this.#r)}set elapsedMs(e){G(this.#r,e,!0)}#i=J(0);get retryAttempt(){return W(this.#i)}set retryAttempt(e){G(this.#i,e,!0)}maxDurationMs=Fr;maxRetries=3;#a=J(!1);#o;#s=0;#c;#l;#u;#d;#f;constructor(e){this.#d=e.onTranscript,this.#f=e.onError}static isSupported(){return _W.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 _W;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(CW(e))}}}async stop(){if(!this.#o||W(this.#a))return!1;let e=this.#o;G(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(CW(e)),!1}finally{G(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 xW(bW(r),t.signal));try{let n=await uH(e.blob,e.durationMs,{signal:t.signal});return t.signal.aborted||!n.trim()?!1:(this.#d(n),!0)}catch(e){if(t.signal.aborted||yW(e))return!1;if(r>=this.maxRetries||!SW(e))throw n=r>=this.maxRetries,e}}}catch(e){if(t.signal.aborted||yW(e))return!1;let r=CW(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 TW(e){return`${e.kind}:${e.id}`}function EW(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function DW(e,t){let n=t.trim();return n?`${e}${e.trim()?/\s$/.test(e)?``:`
130
-
131
- `:``}${n} `:e}function OW(e){Jn.error(`Voice input failed`,{description:e})}var kW=new class{#e=J(void 0);#t=J(!1);#n=new Map;#r=new wW({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 wW.isSupported()}isTargetActive(e){return EW(W(this.#e),e)}isBusyForOtherTarget(e){return!!(W(this.#e)&&!EW(W(this.#e),e))}registerTargetHandlers(e,t){let n=TW(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;G(this.#e,e,!0),G(this.#t,!0);try{await this.#r.start()}finally{G(this.#t,!1)}return!this.#r.recording&&!this.#r.pending?(EW(W(this.#e),e)&&G(this.#e,void 0),!1):!0}async stop(e){let t=W(this.#e);if(!t||e&&!EW(t,e))return!1;let n=await this.#r.stop();return EW(W(this.#e),t)&&G(this.#e,void 0),n}async cancel(e){let t=W(this.#e);e&&!EW(t,e)||(G(this.#e,void 0),G(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=>EW(t,e))&&await this.cancel(t)}#i(e=W(this.#e)){return e?this.#n.get(TW(e)):void 0}#a(e,t=W(this.#e)){let n=this.#i(t)?.onError;n?n(e):OW(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=ZU(t.id);n.composerText=DW(n.composerText,e);return}if(t.kind===`pending-conversation`){let n=X.pendingConversations[ti(t.id)];n&&(n.composerText=DW(n.composerText,e))}}},AW=new Set([`$$slots`,`$$events`,`$$legacy`]);function jW(e,t){let n=H(t,AW),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`}]];N(e,B({name:`key-round`},()=>n,{get iconNode(){return r}}))}var MW=new Set([`$$slots`,`$$events`,`$$legacy`]);function NW(e,t){let n=H(t,MW),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`}]];N(e,B({name:`shield-check`},()=>n,{get iconNode(){return r}}))}var PW=`nerve-color-theme`,FW=1.1,IW=ie({theme:`nerve`,colorMode:`system`}),LW=ie({level:0});function RW(e){try{localStorage.setItem(PW,e)}catch{}}function zW(){try{return localStorage.getItem(PW)}catch{return}}function BW(e=IW.theme){IW.theme=e,typeof document<`u`&&(document.documentElement.dataset.theme=e),typeof localStorage<`u`&&RW(e)}function VW(e=IW.colorMode){IW.colorMode=e,No(e)}function HW(e,t){BW(e),VW(t)}function UW(e){return Number.isFinite(e)?Math.min(8,Math.max(-8,Math.round(e))):0}function WW(e){return FW**UW(e)}function GW(e){return Math.round(WW(e)*100)}function KW(e){let t=UW(e),n=WW(t);LW.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 qW(){let e=typeof localStorage>`u`?void 0:zW(),t=jee.safeParse(e);return{theme:t.success?t.data:`nerve`,colorMode:ho.current??`system`}}function JW(e){return e.rememberLastAgentSelection?e.lastAgentSelection:{mode:e.defaultMode,permissionLevel:e.defaultPermissionLevel,approvalPolicy:e.defaultApprovalPolicy,model:e.defaultModel,thinkingLevel:e.defaultThinkingLevel}}function YW(e,t,n){let r=JW(e),i=dr(t,n,e.scopedModels),a=r.model,o=(a?i.find(e=>Qn(e)===Qn(a)):void 0)??i[0];return{selectedModelKey:o?Qn(o):``,selectedThinkingLevel:Ht(r.thinkingLevel,o),selectedMode:r.mode,selectedPermissionLevel:r.permissionLevel,selectedApprovalPolicy:r.approvalPolicy}}var XW=ie({subscriptionUsage:{}}),ZW,QW,$W=!1,eG=!1,tG=0,nG,rG,iG=!1;function aG(){return Z.agents.find(e=>e.id===Q.agentId)}function oG(){return ar.models.find(e=>Qn(e)===X.selectedModelKey)}async function sG(){Kp({kind:`settings`,id:`settings`}),Zp({kind:`settings`,id:`settings`}),await _G()}async function cG(){Kp({kind:`settings`,id:`settings`}),Zp({kind:`settings`,id:`settings`}),ar.settingsDraft||await _G()}function lG(){let e={kind:`settings`,id:`settings`},t=Z.activeCenterTab?.kind===`settings`,n=Jp(e);Yp(e),t&&$p(n)}async function uG(){let e=await qU();return XW.subscriptionUsage=Object.fromEntries(e.map(e=>[e.provider,e])),e}async function dG(e=Q.projectId){let t=++tG;ar.skillsLoading=!0,ar.skillsError=void 0,ar.skillsProjectId=e??null;try{let n=await PU(e);if(t!==tG)return;ar.agentBrowserSkills=n.agentBrowserSkills,ar.globalSkills=n.globalSkills,ar.projectSkills=n.projectSkills}catch(e){if(t!==tG)return;ar.skillsError=e instanceof Error?e.message:`Could not load skills.`}finally{t===tG&&(ar.skillsLoading=!1)}}async function fG(){let[e,t,n]=await Promise.all([MU(),TH(),dH()]);ar.settingsDraft=e,HW(e.ui.theme,e.ui.colorMode),KW(e.ui.zoomLevel),ar.models=t,ar.authProviders=n,mG(),SG()||(eG=!1,ar.settingsSaveStatus=`idle`,ar.settingsMessage=void 0)}function pG(){return nG||(nG=fG().finally(()=>{nG=void 0}),nG)}function mG(){let e=ar.settingsDraft;if(!e)return;let t=ar.models,n=ar.authProviders,r=dr(t,n,e.scopedModels),i=YW(e,t,n),a=aG();if(a){X.selectedMode=a.mode,X.selectedPermissionLevel=a.permissionLevel,X.selectedApprovalPolicy=a.approvalPolicy;let e=a.model;e&&r.some(t=>Qn(t)===Qn(e))?(X.selectedModelKey=Qn(e),X.selectedThinkingLevel=a.thinkingLevel):(X.selectedModelKey=i.selectedModelKey,X.selectedThinkingLevel=i.selectedThinkingLevel)}else X.selectedMode=i.selectedMode,X.selectedPermissionLevel=i.selectedPermissionLevel,X.selectedApprovalPolicy=i.selectedApprovalPolicy,X.selectedModelKey=i.selectedModelKey,X.selectedThinkingLevel=i.selectedThinkingLevel;X.selectedThinkingLevel=Ht(X.selectedThinkingLevel,oG())}function hG(){uG().catch(()=>void 0),dG()}async function gG(e){e&&await e;do iG=!1,await pG(),hG();while(iG)}function _G(){return rG?(iG=!0,rG):(rG=gG(nG).finally(()=>{rG=void 0}),rG)}function vG(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 yG(e){return!!(e?.server&&Object.keys(e.server).length>0)}function bG(e){return!!(e?.runtime&&Object.keys(e.runtime).length>0)}function xG(){QW&&=(clearTimeout(QW),void 0)}function SG(){return!!(ZW||QW||$W)}function CG(e){let t=dr(ar.models,ar.authProviders,e);t.some(e=>Qn(e)===X.selectedModelKey)||(X.selectedModelKey=t.length>0?Qn(t[0]):``,X.selectedThinkingLevel=Ht(X.selectedThinkingLevel,oG()))}function wG(e,t={}){if(ZW=vG(ZW,e),`scopedModels`in e&&CG(e.scopedModels),ar.settingsSaveStatus=`dirty`,ar.settingsMessage=`Unsaved changes`,xG(),t.immediate){TG();return}QW=setTimeout(()=>void TG(),t.debounceMs??600)}async function TG(){if(xG(),$W||!ZW)return;let e=ZW;ZW=void 0,$W=!0,ar.settingsSaveStatus=`saving`,ar.settingsMessage=`Saving…`;try{let t=await NU(e);if(eG||=yG(e),bG(e)){let e=await wH().catch(()=>void 0);e&&(Z.config=e,Z.status=e.status)}ZW||(ar.settingsDraft=t,ar.settingsSaveStatus=`saved`,ar.settingsMessage=eG?`Saved — restart the daemon to apply server binding changes.`:`Saved`)}catch(t){let n=t instanceof Error?t.message:String(t);ZW=vG(e,ZW??{}),ar.settingsSaveStatus=`error`,ar.settingsMessage=n,Jn.error(`Could not save settings`,{description:n})}finally{$W=!1,ZW&&ar.settingsSaveStatus!==`error`&&TG()}}function EG(e){BW(e)}function DG(e){VW(e)}function OG(e){let t=UW(e);KW(t),ar.settingsDraft&&(ar.settingsDraft.ui.zoomLevel=t),wG({ui:{zoomLevel:t}})}var kG={kind:`auth`,id:`auth`};function AG(){Kp(kG),Zp(kG),NG()}function jG(){Kp(kG),Zp(kG),or.catalogLoaded||NG()}function MG(){let e=Z.activeCenterTab?.kind===`auth`,t=Jp(kG);Yp(kG),e&&$p(t)}async function NG(){let[e]=await Promise.all([yH(),_G()]);or.customProviders=e.providers,or.modelDefinitions=e.models,or.catalogLoaded=!0}async function PG(){let e=await yH();or.customProviders=e.providers,or.modelDefinitions=e.models,or.catalogLoaded=!0,await _G()}var FG=new Map,IG=new Set,LG=new Set;function RG(e){return`seq`in e}function zG(){return UG.length}function BG(e,t){let n=FG.get(e);return n||(n=new Set,FG.set(e,n)),n.add(t),()=>{n?.delete(t),n?.size===0&&FG.delete(e)}}function VG(e){return IG.add(e),()=>IG.delete(e)}function HG(e){let t=[...FG.get(e.type)??[],...IG];for(let n of t)try{let t=n(e);t instanceof Promise&&t.catch(t=>YG(e,t))}catch(t){YG(e,t)}}var UG=[],WG=!1;function GG(){if(WG)return;WG=!0;let e=()=>{WG=!1,JG()};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):queueMicrotask(e)}function KG(e){UG.push(e),GG()}async function qG(e){let t=[...FG.get(e.type)??[],...IG];for(let n of t)await n(e);for(let t of LG)t([e])}function JG(){let e=[];for(let t=0;t<UG.length;t+=1){let n=UG[t];e.push(n),HG(n)}if(UG.length=0,e.length!==0)for(let t of LG)try{t(e)}catch(e){console.error(`Workbench notify flush handler failed`,e)}}function YG(e,t){console.error(`Workbench event handler failed`,{type:e.type,seq:RG(e)?e.seq:void 0,error:t})}function XG(){return VG(ZG)}function ZG(e){or.catalogLoaded&&e.type.startsWith(`providers.`)&&PG()}var QG=h(`<!> Open authentication`,1),$G=h(`<!> <!>`,1),eK=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 tK(e,t){a(t,!0);let n=F(t,`open`,15,!1);function r(){n(!1)}function i(){r(),AG()}ZP(e,{title:`Connect ChatGPT to use voice input`,description:`Voice input needs a ChatGPT OAuth connection before Nerve can transcribe recordings.`,class:`audio-auth-required-dialog`,get open(){return n()},set open(e){n(e)},footer:e=>{var t=$G(),n=L(t);Oe(n,{size:`sm`,variant:`ghost`,onclick:r,children:(e,t)=>{w(),g(e,M(`Close`))},$$slots:{default:!0}}),Oe(I(n,2),{size:`sm`,onclick:i,children:(e,t)=>{var n=QG();jW(L(n),{size:15,strokeWidth:2.1}),w(),g(e,n)},$$slots:{default:!0}}),g(e,t)},children:(e,t)=>{var n=eK(),r=V(n),i=V(r);hS(V(i),{size:18,strokeWidth:2.2}),d(i),w(2),d(r);var a=I(r,2);NW(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}}),R()}function nK(e){return!!e?.some(e=>e.provider===`openai-codex`&&e.configured&&e.credentialType===`oauth`)}var rK={get configured(){return nK(ar.authProviders)}},iK=new Set([`$$slots`,`$$events`,`$$legacy`]);function aK(e,t){let n=H(t,iK),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`}]];N(e,B({name:`lightbulb`},()=>n,{get iconNode(){return r}}))}var oK=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>`),sK=h(`<div class="flex flex-wrap gap-1 px-0.5" role="group" aria-label="Suggested prompt actions"></div>`);function cK(e,t){a(t,!0);let n=F(t,`suggestions`,19,()=>[]),i=F(t,`disabled`,3,!1);var o=U(),s=L(o),c=e=>{var a=sK();_(a,21,n,e=>e.id,(e,n)=>{let a=q(()=>W(n).icon??aK);var o=oK(),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=I(s,2),l=V(c,!0);d(c),d(o),P(()=>{o.disabled=i(),K(o,`title`,`Click to send. Right-click to insert into composer.\n\n${W(n).prompt}`),K(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),R()}T([`click`,`contextmenu`]);function lK(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 uK(e){return/\s/.test(e)?`"${e.replaceAll(`"`,`\\"`)}"`:e}function dK(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 uK(oi(r,t)??r)})}var fK=h(`<!> <!>`,1);function pK(e,t){a(t,!0);let n=F(t,`text`,3,``),r=F(t,`pendingConversationActive`,3,!1),i=F(t,`approvals`,19,()=>[]),o=F(t,`pendingUserQuestions`,19,()=>[]),s=F(t,`pendingPlanReviews`,19,()=>[]),c=F(t,`interactive`,3,!0),l=F(t,`sending`,3,!1),u=F(t,`stopping`,3,!1),d=F(t,`compacting`,3,!1),f=F(t,`models`,19,()=>[]),p=F(t,`selectedModelKey`,3,``),m=F(t,`contextWindow`,3,0),h=F(t,`todos`,19,()=>[]),_=F(t,`focusToken`,3,0),v=F(t,`composerEscapeToken`,3,0),y=F(t,`micShortcutToken`,3,0),b=F(t,`thinkingLevel`,3,`off`),x=F(t,`mode`,3,`coding`),S=F(t,`permissionLevel`,3,`autonomous`),C=F(t,`approvalPolicy`,19,()=>({autoApproveReadOnly:!0})),w=F(t,`slashCompletions`,19,()=>[]),T=F(t,`composerSuggestions`,19,()=>[]),E=J(0),D=J(!1),O=J(void 0),ee=J(void 0),te=J(void 0),A=J(!1),ne=mf(`composer.toggleMic`),j=hf(`composer.toggleMic`),M=mf(`composer.cancelMic`),re=mf(`composer.toggleMode`),ie=hf(`composer.toggleMode`),N=mf(`composer.cyclePermission`),ae=hf(`composer.cyclePermission`),oe=mf(`composer.cycleThinking`),se=mf(`composer.stopRun`),ce=hf(`composer.stopRun`),P=q(()=>{if(t.activeConversation)return{kind:`conversation`,id:t.activeConversation.id};if(t.activePendingConversation)return{kind:`pending-conversation`,id:t.activePendingConversation.id}}),le=q(()=>!!(W(P)&&kW.isTargetActive(W(P))&&kW.recording)),ue=q(()=>!!(W(P)&&kW.isTargetActive(W(P))&&kW.transcribing)),de=q(()=>!!(W(P)&&kW.isBusyForOtherTarget(W(P)))),fe=q(()=>i().length>0),pe=q(()=>o().length>0),me=q(()=>s().length>0),he=q(()=>W(fe)||W(pe)||W(me)),ge=q(()=>Sr(n())),_e=q(()=>lK({interactive:c(),hasProject:!!t.activeProject,hasConversation:!!(t.activeConversation||r()),hasModels:f().length>0,blockedForReview:W(he),compacting:d(),stopping:u(),sending:l(),commandMode:W(ge),voiceSubmitPending:W(D)})),ve=q(()=>W(_e).canPrompt),ye=q(()=>!W(_e).canEdit),be=q(()=>!W(_e).canSubmit),B=q(()=>rK.configured),V=q(()=>!!Ln()?.files),xe=q(()=>kW.isSupported()),Se=q(()=>!c()||u()||!W(P)||kW.pending||!W(le)&&(!W(ve)||!W(xe)||W(de))),Ce=q(()=>W(le)?`Stop recording${ne?` (${ne})`:``} — ${M??`Esc`} to cancel; right-click to cancel (${Te(kW.elapsedMs)} / ${Te(kW.maxDurationMs)})`:W(de)?`Voice recording is active in another conversation`:kW.retryAttempt>0&&W(P)&&kW.isTargetActive(W(P))?`Retrying transcription ${kW.retryAttempt}/${kW.maxRetries}…`:W(ue)?`Transcribing audio…`:W(B)?ne?`Record voice prompt (${ne})`:`Record voice prompt`:`Connect ChatGPT to use voice input`),we=q(()=>W(D)?`Transcribing and sending prompt`:W(le)?`Transcribe and send prompt`:d()?`Compacting context`:W(_e).canEdit&&f().length===0?`Waiting for an available model`:W(ge)?`Run command`:l()?`Queue prompt`:`Send prompt`),H=q(()=>W(D)?`Transcribing audio, then sending prompt`:W(le)?`Stop recording, transcribe, and send prompt`:d()?`Compacting context`:W(_e).canEdit&&f().length===0?`Models are loading; you can continue drafting`:W(ge)?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(_e).canSubmit){if(W(le)&&W(P)){G(D,!0);try{await kW.stop(W(P))&&t.onSubmit?.()}finally{G(D,!1)}return}t.onSubmit?.()}}async function De(e){return NH(e)}async function ke(e){try{let n=Ln();if(!n?.files||!t.activeProject)throw Error(`Native file paths are unavailable in this window.`);return dK(e,t.activeProject.dir,n.files.getPathForFile)}catch(e){let t=e instanceof Error?e.message:String(e);throw Jn.error(`Could not add dropped paths`,{description:t}),e}}let Ae=q(()=>!c()||!(t.activeConversation||r())||u()||d()||W(he)),je=q(()=>!c()||!(t.activeConversation||r())),Me=q(()=>!c()||!(t.activeConversation||r())||f().length===0||d()||u()),K=q(()=>l()?`Changes apply to the next model request`:void 0);function Ne(){if(!(!c()||W(Se)||d()||u()||!W(P))){if(!W(le)&&!W(B)){G(A,!0);return}kW.toggle(W(P))}}function Pe(){return!W(le)||!W(P)?!1:(kW.cancel(W(P)),!0)}z(()=>{if(W(O)===void 0||!c()){G(O,_());return}_()!==W(O)&&(G(O,_()),G(E,W(E)+1))}),z(()=>{if(W(ee)===void 0||!c()){G(ee,v());return}v()!==W(ee)&&(G(ee,v()),Pe()||G(E,W(E)+1))}),z(()=>{if(W(te)===void 0||!c()){G(te,y());return}y()!==W(te)&&(G(te,y()),Ne())});function Fe(e){!W(le)||!W(P)||(e.preventDefault(),kW.cancel(W(P)))}var Ie=fK(),Le=L(Ie);{let e=e=>{var n=U(),r=L(n),i=e=>{cK(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(he)&&!d()&&W(ve)&&e(i)}),g(e,n)},r=e=>{var t=fK(),n=L(t);{let e=q(()=>W(P)&&kW.isTargetActive(W(P))?kW.retryAttempt:0);XU(n,{get recording(){return W(le)},get transcribing(){return W(ue)},get elapsedMs(){return kW.elapsedMs},get maxDurationMs(){return kW.maxDurationMs},get retryAttempt(){return W(e)},get maxRetries(){return kW.maxRetries},class:`composer-transcription-status`})}var r=I(n,2);{let e=q(()=>W(le)?`destructive`:`secondary`),t=q(()=>`rounded-full ${W(le)?`inset-ring-1 inset-ring-destructive/28`:``}`),n=q(()=>W(le)?`Stop recording; right-click to cancel`:W(B)?`Record voice prompt`:`Connect ChatGPT to use voice input`);Oe(r,{get variant(){return W(e)},size:`icon-sm`,get class(){return W(t)},type:`button`,get disabled(){return W(Se)},onclick:Ne,oncontextmenu:Fe,get"aria-label"(){return W(n)},get"aria-keyshortcuts"(){return j},get title(){return W(Ce)},children:(e,t)=>{var n=U(),r=L(n),i=e=>{zi(e,{class:`size-3.5`})},a=e=>{hS(e,{size:14,strokeWidth:2.4})};k(r,e=>{W(ue)?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}g(e,t)},i=q(()=>({text:n(),disabled:W(ye),editorDisabled:W(ye),submitDisabled:W(be),sending:l(),stopping:u(),compacting:d(),showStop:l()||u()||d(),pendingApproval:W(fe),pendingQuestion:W(pe),pendingPlan:W(me),models:f(),selectedModelKey:p(),thinkingLevel:b(),mode:x(),permissionLevel:S(),approvalPolicy:C(),contextUsage:t.contextUsage,contextWindow:m(),placeholder:W(fe)?`Approval required before the agent can continue`:W(me)?`Review the plan in the transcript before the agent can continue`:W(pe)?`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(Ae),modeDisabled:W(je),modelDisabled:W(Me),runtimeChangeHint:W(K),sendAriaLabel:W(we),sendTitle:W(H),stopAriaLabel:d()?`Stop compaction`:`Stop generation`,stopShortcutAria:ce,stopTitle:u()?d()?`Stopping compaction`:`Stopping generation`:d()?se?`Stop compaction (${se})`:`Stop compaction`:se?`Stop generation (${se})`:`Stop generation`,permissionShortcut:N,permissionShortcutAria:ae,modeShortcut:re,modeShortcutAria:ie,thinkingShortcut:oe,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=q(()=>({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)?ke:void 0}));Jv(Le,{get model(){return W(i)},get actions(){return W(a)},header:e,sendLeading:r,$$slots:{header:!0,sendLeading:!0}})}tK(I(Le,2),{get open(){return W(A)},set open(e){G(A,e,!0)}}),g(e,Ie),R()}var mK=`agent.subagent_transcript.`,hK=`agent.subagent_transcript.run.completed`;function gK(e){return e&&typeof e==`object`?e:void 0}function _K(e,t,n,r){let i=gK(e.data);return!i||r&&(i.conversationId!==r.conversationId||i.projectId!==r.projectId)?!1:e.type.startsWith(mK)?i.parentAgentId===t&&i.childAgentId===n:e.type===`toolCall.updated`&&i.agentId===n}function vK(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===hK&&!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&&_K(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||!RG(e))return;let r=e;if(_K(r,t,n,o)){if(!a){c.push(r);return}p(r)}});return m(),()=>{i=!0,c=[],h()}}}var yK=vK({fetch:sH,subscribe:VG});function bK(){return ar.settingsDraft?.tools?.jira?.siteUrl}function xK(){return ar.settingsDraft?.tools?.confluence?.siteUrl}var SK=new wa({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}),CK={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 wK(e){let t=await e.fetch(),n=await e.apply(t);return e.cache?.(t),n}function TK(e,t){return!t||e.updatedAt>=t.updatedAt}function EK(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return!t||TK(e,t)?e:t})}function DK(e,t){let n=t.findIndex(t=>t.id===e.id);if(n===-1)return[...t,e];let r=t[n];return TK(e,r)?t.map(t=>t.id===e.id?e:t):t}function OK(e){return e&&typeof e==`object`?e:void 0}function kK(e){return typeof e==`string`?e:void 0}function AK(e){let t=OK(e);return!!(t&&typeof t.id==`string`&&typeof t.updatedAt==`string`)}function jK(e){let t=OK(e);return!!(t&&typeof t.id==`string`&&typeof t.projectId==`string`&&typeof t.updatedAt==`string`)}function MK(e){let t=OK(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.status==`string`)}function NK(e){let t=OK(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.role==`string`&&typeof t.createdAt==`string`)}function PK(e){let t=OK(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.status==`string`&&typeof t.updatedAt==`string`)}function FK(e){let t=OK(e);return!!(t&&typeof t.id==`string`&&typeof t.conversationId==`string`&&typeof t.status==`string`&&typeof t.updatedAt==`string`)}function IK(e){let t=OK(e);return!!(t&&typeof t.id==`string`)}function LK(e){Z.conversations=Z.conversations.findIndex(t=>t.id===e.id)===-1?[e,...Z.conversations]:Z.conversations.map(t=>t.id===e.id?e:t)}function RK(e){Z.conversations=Z.conversations.filter(t=>t.id!==e)}function zK(e){let t=Z.conversations.findIndex(t=>t.id===e.conversationId);if(t===-1)return;let n=Z.conversations[t];if(!n)return;let r=e.role===`user`&&(!n.lastUserMessageAt||e.createdAt>n.lastUserMessageAt)?e.createdAt:n.lastUserMessageAt;Z.conversations=Z.conversations.map(t=>t.id===e.conversationId?{...t,activeEntryId:e.id,updatedAt:e.createdAt,lastUserMessageAt:r}:t)}function BK(e){Z.agents=DK(e,Z.agents)}function VK(e,t,n){if(!e)return;let r=Z.agents.find(t=>t.id===e);!r||r.updatedAt>n||BK({...r,status:t,updatedAt:n})}function HK(e){if(e.status!==`pending`){UK(e.id);return}Z.approvals=Z.approvals.findIndex(t=>t.id===e.id)===-1?[e,...Z.approvals]:Z.approvals.map(t=>t.id===e.id?{...t,...e}:t)}function UK(e){Z.approvals=Z.approvals.filter(t=>t.id!==e)}function WK(e){if(e.status!==`pending`){GK(e.id);return}Z.userQuestions=Z.userQuestions.findIndex(t=>t.id===e.id)===-1?[e,...Z.userQuestions]:Z.userQuestions.map(t=>t.id===e.id?e:t)}function GK(e){Z.userQuestions=Z.userQuestions.filter(t=>t.id!==e)}function KK(e){if(e.status!==`pending`){qK(e.id);return}Z.planReviews=Z.planReviews.findIndex(t=>t.id===e.id)===-1?[e,...Z.planReviews]:Z.planReviews.map(t=>t.id===e.id?e:t)}function qK(e){Z.planReviews=Z.planReviews.filter(t=>t.id!==e)}function JK(e){Z.planReviews=Z.planReviews.filter(t=>t.agentId!==e)}function YK(e){let t=e.data??{},n=OK(t.agent),r=OK(t.conversation),i=OK(t.entry),a=OK(t.approval),o=OK(t.question),s=OK(t.planReview);if(jK(r)&&LK(r),e.type===`conversation.entry.appended`&&NK(i)&&zK(i),e.type===`conversation.deleted`){let e=kK(t.conversationId)??kK(t.id);e&&RK(e)}if(AK(n)&&BK(n),MK(a)){let e=IK(t.toolCall)?t.toolCall:void 0;HK({...a,toolCall:e})}if(PK(o)&&WK(o),FK(s)&&KK(s),e.type===`planReview.updated`&&t.status===`force_exited`){let e=kK(t.agentId);e&&JK(e)}}var XK=[`model`,`thinkingLevel`,`mode`,`permissionLevel`,`approvalPolicy`],ZK=class{deps;entries=new Map;constructor(e){this.deps=e}desired(e){let t=this.entries.get(e);return t&&QK(t.desired)?{...t.desired}:void 0}enqueue(e,t){if(!QK(t))return;let n=this.entries.get(e)??{desired:{},generation:0};this.entries.set(e,n),n.desired={...n.desired,...$K(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(;QK(t.desired);){let n={...t.desired},r=t.generation;try{let i,a=n.mode===void 0?void 0:{mode:n.mode},o=eq(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=tq(t.desired,n),this.publishDesired(e,t),this.deps.onFailed?.(e,r,n)}}}publishDesired(e,t){this.deps.onDesiredChanged?.(e,QK(t.desired)?{...t.desired}:void 0)}};function QK(e){return XK.some(t=>e[t]!==void 0)}function $K(e){let t={};for(let n of XK)e[n]!==void 0&&(t[n]=e[n]);return t}function eq(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),QK(t)?t:void 0}function tq(e,t){let n={};for(let r of XK){let i=e[r];i!==void 0&&(nq(r,i,t[r])||(n[r]=i))}return n}function nq(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 rq=ie({byAgentId:{}}),iq=new ZK({configure:(e,t)=>oH(e,t),onDesiredChanged:(e,t)=>{t?rq.byAgentId[e]=t:delete rq.byAgentId[e]},onAgentRecord:e=>{BK(e)},onConfirmed:(e,t)=>{Q.agentId===e&&(t.model&&(X.selectedModelKey=Qn(t.model)),X.selectedThinkingLevel=t.thinkingLevel,X.selectedMode=t.mode,X.selectedPermissionLevel=t.permissionLevel,X.selectedApprovalPolicy=t.approvalPolicy)},onFailed:(e,t)=>{let n=Z.agents.find(t=>t.id===e);n&&Q.agentId===e&&(n.model&&(X.selectedModelKey=Qn(n.model)),X.selectedThinkingLevel=n.thinkingLevel,X.selectedMode=n.mode,X.selectedPermissionLevel=n.permissionLevel,X.selectedApprovalPolicy=n.approvalPolicy);let r=t instanceof Error?t.message:String(t);Jn.error(`Could not update agent settings`,{description:r})}});function aq(e,t){iq.enqueue(e,t)}function oq(e){return iq.flush(e)}function sq(e){return e?rq.byAgentId[e]:void 0}function cq(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 lq=1e3,uq,dq=!1,fq;function pq(){return[...Z.eventCursors].map(([e,t])=>({stream:e,processedSeq:t})).sort((e,t)=>e.stream.localeCompare(t.stream))}function mq(e,t={}){t.replace&&Z.eventCursors.clear();for(let t of e)Z.eventCursors.set(t.stream,t.processedSeq);t.sync!==!1&&vq()}function hq(e,t){t>(Z.eventCursors.get(e)??0)&&Z.eventCursors.set(e,t)}function gq(e){Z.eventCursors.delete(e)&&vq()}function _q(e){return uq=e,()=>{uq===e&&(uq=void 0,xq())}}function vq(){!uq||dq||(dq=!0,queueMicrotask(()=>void yq()))}async function yq(){dq=!1,xq();let e=uq;if(e)try{await e(pq())===`skipped`&&bq()}catch(e){console.error(`Stream subscription update failed; retrying`,e),bq()}}function bq(){fq!==void 0||!uq||(fq=setTimeout(()=>{fq=void 0,vq()},lq))}function xq(){fq!==void 0&&(clearTimeout(fq),fq=void 0)}function Sq(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 Cq(e){e.optimisticMessages=[],e.stopping=!1}function wq(e,t,n){return e&&!!(t&&n===t)}function Tq(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 Eq(e){return Z.projects.find(t=>t.id===e.projectId)??await hU(e.projectId)}async function Dq(e){Q.conversationId=e.id,Q.projectId=e.projectId;let t=Tq(e,Z.agents);Q.agentId=t?.id,Q.entryId=e.activeEntryId,ep.projectDir=(await Eq(e)).dir;let n=sq(t?.id),r=n?.model??void 0;r?X.selectedModelKey=Qn(r):t?.model&&(X.selectedModelKey=Qn(t.model)),X.selectedThinkingLevel=n?.thinkingLevel??t?.thinkingLevel??`off`,X.selectedMode=n?.mode??t?.mode??e.mode,X.selectedPermissionLevel=n?.permissionLevel??t?.permissionLevel??e.permissionLevel,X.selectedApprovalPolicy=n?.approvalPolicy??t?.approvalPolicy??e.approvalPolicy}async function Oq(e){let t=ZU(e);t.loading=!0;try{let n=await OH(e),r=n.snapshot,i=Rt(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=wq(t.stopping,a,i.activeRun?.runId),Z.conversations=Z.conversations.map(t=>t.id===e?r.conversation:t),t.sending=i.sending??!1,mq(n.cursor.streams),Q.conversationId===e&&(Q.entryId=r.tree.activeEntryId),kq()}finally{t.loading=!1}}async function kq(){try{Z.userQuestions=await IU()}catch(e){console.warn(`Failed to refresh pending user questions`,e)}}function Aq(e){Z.conversations=[e,...Z.conversations.filter(t=>t.id!==e.id)]}function jq(e){Z.agents=[e,...Z.agents.filter(t=>t.id!==e.id)]}async function Mq(e){let t=Z.conversations.find(t=>t.id===e)??(await Nr(`conversation.get`,{conversationId:e})).result.conversation;if(t.projectId!==Z.selectedProjectId){let{selectProject:e}=await bS(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>cY);return{selectProject:e}},void 0);await e(t.projectId)}$U(t.id),X.activeConversationTabId=t.id,Zp({kind:`conversation`,id:t.id}),QU(),await Dq(t),await Oq(t.id),Z.error=ZU(t.id).error}async function Nq(e=Z.activeCenterTab){let t=Z.openCenterTabs.filter(e=>e.kind===`conversation`).map(e=>e.id);for(let e of t)ZU(e);return X.activeConversationTabId=e?.kind===`conversation`?e.id:t[0],e?.kind===`conversation`?(await $p(e),!0):!1}async function Pq(e){let t=X.openConversationTabIds,n=t.indexOf(e);if(n===-1)return;let r={kind:`conversation`,id:e},i=Jp(r),a=t.filter(t=>t!==e),o=a[n]??a[n-1];await kW.cancelIfTarget({kind:`conversation`,id:e}),Yp(r),delete X.conversationViews[Qr(e)],gq(Lr(e));let s=Z.activeCenterTab?.kind===`conversation`&&Z.activeCenterTab.id===e;X.activeConversationTabId===e&&(X.activeConversationTabId=o),Q.conversationId===e&&!o&&iW(),QU(),s&&await $p(i)}async function Fq(e){if(!X.pendingConversations[ti(e)])return;let t={kind:`pending-conversation`,id:e},n=Jp(t),r=Z.activeCenterTab?.kind===`pending-conversation`&&Z.activeCenterTab.id===e;await kW.cancelIfTarget({kind:`pending-conversation`,id:e}),Yp(t),delete X.pendingConversations[ti(e)],r&&(iW(),await $p(n)),QU()}async function Iq(e){let t=new Set(e),n=Q.conversationId?t.has(Q.conversationId):!1;await kW.cancelIfTargets(e.map(e=>({kind:`conversation`,id:e}))),Gp(Z.openCenterTabs.filter(e=>e.kind!==`conversation`||!t.has(e.id)));for(let e of t)delete X.conversationViews[Qr(e)],gq(Lr(e));if(!n){QU();return}let r=X.openConversationTabIds[0];if(r){X.activeConversationTabId=r,QU(),await Mq(r);return}iW(),await $p(Z.openCenterTabs[0]),QU()}var Lq=cq({requests:{grantApproval:LU,denyApproval:RU,acceptPlanReview:zU,acceptPlanReviewInNewChat:BU,rejectPlanReview:VU,requestPlanChanges:HU,discardPlanReview:UU,answerUserQuestion:WU,dismissUserQuestion:GU},reconcile:{removeApproval:UK,upsertUserQuestion:WK,upsertPlanReview:KK,upsertConversation:LK,upsertAgent:BK},notify:Jn,openConversation:Mq});async function Rq(e){await Lq.grantApproval(e)}async function zq(e){await Lq.denyApproval(e)}async function Bq(e,t={}){await Lq.acceptPendingPlanReview(e,t)}async function Vq(e,t={}){await Lq.acceptPendingPlanReviewInNewChat(e,t)}async function Hq(e){await Lq.rejectPendingPlanReview(e)}async function Uq(e,t){await Lq.answerUserQuestionById(e,t)}async function Wq(e){await Lq.dismissUserQuestionById(e)}function Gq(e){let t=tW(),n=ar.settingsDraft?YW(ar.settingsDraft,ar.models,ar.authProviders):{selectedModelKey:X.selectedModelKey,selectedThinkingLevel:X.selectedThinkingLevel,selectedMode:X.selectedMode,selectedPermissionLevel:X.selectedPermissionLevel,selectedApprovalPolicy:X.selectedApprovalPolicy};X.pendingConversations[ti(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()},Kp({kind:`pending-conversation`,id:t}),Kq(t)}function Kq(e){let t=X.pendingConversations[ti(e)];t&&(Zp({kind:`pending-conversation`,id:t.id}),X.activeConversationTabId=void 0,tp(),Q.projectId=t.projectId,ep.projectDir=t.projectDir,X.selectedModelKey=t.selectedModelKey,X.selectedThinkingLevel=t.thinkingLevel,X.selectedMode=t.mode,X.selectedPermissionLevel=t.permissionLevel,X.selectedApprovalPolicy=t.approvalPolicy,rW(),Z.error=t.error)}function qq(){let e=Z.conversations.find(e=>e.id===Q.conversationId);if(e)return Tq(e,Z.agents,Q.agentId)}function Jq(){return fr(X.selectedModelKey)}function Yq(){return ar.models.find(e=>Qn(e)===X.selectedModelKey)}function Xq(e){let t=ar.settingsDraft;t?.rememberLastAgentSelection&&(t.lastAgentSelection={...t.lastAgentSelection,...e},wG({lastAgentSelection:e},{immediate:!0}))}function Zq(){let e=Z.activeCenterTab;if(e?.kind===`pending-conversation`)return X.pendingConversations[ti(e.id)]}function Qq(){return Ht(X.selectedThinkingLevel,Yq())}function $q(e){X.selectedModelKey=e;let t=Ht(X.selectedThinkingLevel,Yq());X.selectedThinkingLevel=t;let n=Zq();n&&(n.selectedModelKey=e,n.thinkingLevel=t);let r=Jq();Xq({...r?{model:r}:{},thinkingLevel:t});let i=qq()?.id;n||!i||aq(i,{model:r??null,thinkingLevel:t})}function eJ(e){let t=Ht(e,Yq());X.selectedThinkingLevel=t;let n=Zq();n&&(n.thinkingLevel=t),Xq({thinkingLevel:t});let r=qq()?.id;n||!r||aq(r,{thinkingLevel:t})}function tJ(e){X.selectedMode=e;let t=Zq();t&&(t.mode=e),Xq({mode:e});let n=qq()?.id;t||!n||aq(n,{mode:e})}function nJ(e){X.selectedPermissionLevel=e;let t=Zq();t&&(t.permissionLevel=e),Xq({permissionLevel:e});let n=qq()?.id;t||!n||aq(n,{permissionLevel:e})}function rJ(e){X.selectedApprovalPolicy=e;let t=Zq();t&&(t.approvalPolicy=e),Xq({approvalPolicy:e});let n=qq()?.id;t||!n||aq(n,{approvalPolicy:e})}function iJ(e,t){return e?.autoApproveReadOnly===t.autoApproveReadOnly}function aJ(e){let t=Jq(),n=Qq();return{desired:t,thinkingLevel:n,needsModel:t&&Qn(e?.model??{provider:``,modelId:``})!==Qn(t),needsMode:e?.mode!==X.selectedMode,needsPermission:e?.permissionLevel!==X.selectedPermissionLevel,needsApprovalPolicy:!iJ(e?.approvalPolicy,X.selectedApprovalPolicy),needsThinking:e?.thinkingLevel!==n}}function oJ(e){return e&&typeof e==`object`?e:void 0}function sJ(e){let t=oJ(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 cJ(e){return{role:`user`,text:e,optimistic:!0}}function lJ(e,t){if(e.length===0)return e;let n=sJ(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 uJ(e){await e.hydrate();let t=e.view();t.sending=!0,t.error=void 0,t.optimisticMessages=e.optimisticMessages,await e.start()}function dJ(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 fJ(e,t=!1){if(!Q.conversationId)return;let n=Q.conversationId;await Nr(`conversation.navigate`,{conversationId:n,activeEntryId:e??null,summarize:t}),await SK.invalidateQueries({queryKey:CK.workspace}),await lY(),await Mq(n)}async function pJ(){if(!Q.conversationId)return;let e=Q.conversationId;hJ.delete(e);let t=ZU(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 AH(e),t.transient={...t.transient,compaction:void 0},await SK.invalidateQueries({queryKey:CK.workspace}),await lY(),await Mq(e)}catch(r){if(hJ.delete(e))return;let i=r instanceof Error?r.message:String(r);t.transient={...t.transient,compaction:{...n,state:`failed`,errorMessage:i}},Jn.error(`Compaction failed`,{description:i})}}var mJ=new Set,hJ=new Set;async function gJ(){if(!Q.conversationId)return;let e=Q.conversationId,t=ZU(e),n=t.transient?.compaction;if(!(n?.state!==`running`||mJ.has(e))){mJ.add(e),hJ.add(e),t.stopping=!0;try{await Promise.all([jH(e),n.runId?vJ():Promise.resolve()])}catch(t){hJ.delete(e);let n=t instanceof Error?t.message:String(t);Jn.error(`Could not stop compaction`,{description:n})}finally{mJ.delete(e);let t=X.conversationViews[Qr(e)];t&&(t.stopping=!1)}}}async function _J(e){if(!Q.agentId||!Q.conversationId)return;let t=Q.agentId,n=Q.conversationId,r=ZU(n);r.sending=!0,r.error=void 0,Z.error=void 0;try{await oq(t),await Nr(`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,Z.error=t,Jn.error(`Continue failed`,{description:t})}}var vJ=dJ({agentId:()=>Q.agentId,view:(e=Q.conversationId)=>e?X.conversationViews[Qr(e)]:void 0,cancelRun:async(e,t)=>{await Nr(`run.cancel`,{agentId:e,runId:t},{idempotencyKey:crypto.randomUUID()})},notifyError:(e,t)=>Jn.error(e,t)});function yJ(e){let t=nW();if(t){t.composerText=e;return}if(!Q.conversationId){ep.text=e;return}ZU(Q.conversationId).composerText=e}async function bJ(){let e=qq();if(e){let t=e.id;Q.agentId=t,await oq(t);let{desired:n,thinkingLevel:r,needsModel:i,needsMode:a,needsPermission:o,needsApprovalPolicy:s,needsThinking:c}=aJ(e),l={...i&&n?{model:n}:{},...c?{thinkingLevel:r}:{},...a?{mode:X.selectedMode}:{},...o?{permissionLevel:X.selectedPermissionLevel}:{},...s?{approvalPolicy:X.selectedApprovalPolicy}:{}};return Object.keys(l).length>0&&aq(t,l),await oq(t),t}if(Q.projectId&&Q.conversationId){let{agent:e}=(await Nr(`agent.create`,{projectId:Q.projectId,conversationId:Q.conversationId,model:Jq(),thinkingLevel:Qq(),mode:X.selectedMode,permissionLevel:X.selectedPermissionLevel,approvalPolicy:X.selectedApprovalPolicy})).result;return Q.agentId=e.id,await SK.invalidateQueries({queryKey:CK.workspace}),await lY(),e.id}throw Z.projectPickerOpen=!0,Error(`Select a project directory before starting a conversation.`)}function xJ(){return dr(ar.models,ar.authProviders,ar.settingsDraft?.scopedModels).length>0}function SJ(e,t){Jn.error(e,{description:t})}async function CJ(e,t,n={}){let r=n.clearComposer??!0;if(!xJ()){sG();let t=`Configure a model provider or adjust Scoped Models in Settings before prompting.`;e.error=t,Z.error=t,SJ(`No usable model configured`,t);return}e.selectedModelKey=X.selectedModelKey,e.thinkingLevel=Qq(),e.mode=X.selectedMode,e.permissionLevel=X.selectedPermissionLevel,e.approvalPolicy=X.selectedApprovalPolicy,e.sending=!0,e.error=void 0,Z.error=void 0;let i,a;try{let{conversation:n}=(await Nr(`conversation.create`,{projectId:e.projectId,title:qr(t),mode:e.mode,permissionLevel:e.permissionLevel,approvalPolicy:e.approvalPolicy})).result;a=n.id;let{agent:o}=(await Nr(`agent.create`,{projectId:e.projectId,conversationId:n.id,model:Jq(),thinkingLevel:e.thinkingLevel,mode:e.mode,permissionLevel:e.permissionLevel,approvalPolicy:e.approvalPolicy})).result;Aq(n),jq(o),qp({kind:`pending-conversation`,id:e.id},{kind:`conversation`,id:n.id}),X.activeConversationTabId=n.id,Q.projectId=n.projectId,Q.conversationId=n.id,Q.entryId=n.activeEntryId,Q.agentId=o.id,ep.projectDir=e.projectDir;let s=r?``:e.composerText;delete X.pendingConversations[ti(e.id)],i=ZU(n.id),i.composerText=s,Z.error=void 0,r&&(ep.text=``),QU(),await SK.invalidateQueries({queryKey:CK.workspace}),await lY(),await uJ({hydrate:()=>Oq(n.id),view:()=>ZU(n.id),optimisticMessages:Sr(t)?[]:[cJ(t)],start:async()=>{await Nr(`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 MH(a).catch(()=>void 0),e.error=n,e.sending=!1),Z.error=n,SJ(`Prompt failed`,n)}}async function wJ(e,t={}){let n=t.clearComposer??!0,r=nW(),i=Q.conversationId?ZU(Q.conversationId):void 0,a=e.trim();if(!a||r?.sending)return;if(r){await CJ(r,a,{clearComposer:n});return}if(!Q.projectId||!Q.conversationId||!i){Z.projectPickerOpen=!0;let e=`Select a project directory before starting a conversation.`;Z.error=e,SJ(`Select a project directory`,e);return}if(!xJ()){sG();let e=`Configure a model provider or adjust Scoped Models in Settings before prompting.`;i.error=e,Z.error=e,SJ(`No usable model configured`,e);return}if(i.transient?.compaction?.state===`running`){SJ(`Compaction in progress`,`Wait for context compaction to finish before sending another prompt.`);return}let o=!!i.sending;i.error=void 0,Z.error=void 0,o||(i.sending=!0);try{let e=await bJ();if(n&&(i.composerText=``,ep.text=``),o){await Nr(`run.steer`,{agentId:e,text:a},{idempotencyKey:crypto.randomUUID()});return}Sr(a)||(i.optimisticMessages=[...i.optimisticMessages,cJ(a)]),await Nr(`run.start`,{agentId:e,text:a},{idempotencyKey:crypto.randomUUID()})}catch(e){let t=e instanceof Error?e.message:String(e);i.error=t,Z.error=t,o||(i.sending=!1),SJ(`Prompt failed`,t)}}async function TJ(){let e=nW(),t=Q.conversationId?ZU(Q.conversationId):void 0,n=(e?.composerText??t?.composerText??ep.text).trim();if(!(!n||e?.sending)){if(n===`/abort`){e&&(e.composerText=``),t&&(t.composerText=``),ep.text=``,await vJ();return}await wJ(n,{clearComposer:!0})}}var EJ=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>`),DJ=h(`<div class="pb-2 text-center text-muted-foreground"><!></div>`),OJ=h(`<pre> </pre>`),kJ=h(`<pre>No logs captured.</pre>`),AJ=h(`<pre><!></pre>`),jJ=h(`<div class="relative h-full min-h-0 bg-sidebar font-mono text-xs" role="log" aria-label="Task output"><!> <!></div>`);function MJ(e,t){a(t,!0);let n=J(void 0),i=J(!0),o=J(!1),c=J(void 0),l=q(()=>t.taskLogs?.events??[]),u=q(()=>{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)){G(o,!0),G(c,void 0);try{await t.onLoadEarlier()}catch(e){G(c,e instanceof Error?e.message:String(e),!0)}finally{G(o,!1)}}}function h(e){return e.scrollTop<=48}z(()=>{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 _=jJ(),v=V(_);{let e=(e,n)=>{let i=()=>n?.().item;var a=U(),l=L(a),u=e=>{var n=DJ(),i=V(n),a=e=>{g(e,M(`Loading earlier output…`))},s=e=>{var t=EJ();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=OJ();s(t,1,`pb-2 text-foreground ${f}`);var n=V(t);d(t),P(()=>A(n,`$ ${i().command??``}`)),g(e,t)},_=e=>{var t=kJ();s(t,1,`text-muted-foreground ${f}`),g(e,t)},v=e=>{var t=AJ();XR(V(t),{get text(){return i().event.line},get stream(){return i().event.stream},get level(){return i().event.level}}),d(t),P(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=q(()=>`task-log:${t.taskId}`);Bi(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){G(n,e,!0)},get atEnd(){return W(i)},set atEnd(e){G(i,e,!0)},row:e,$$slots:{row:!0}})}var y=I(v,2),b=e=>{Oe(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)=>{Xv(e,{class:`size-4`,strokeWidth:2.2})},$$slots:{default:!0}})};k(y,e=>{W(i)||e(b)}),d(_),g(e,_),R()}T([`click`]);var NJ=h(`<span class="ml-2 font-mono"> </span>`),PJ=h(`<div class="border-b border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning"> <!></div>`),FJ=h(`<!> <div class="min-h-0 flex-1"><!></div>`,1),IJ=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>`),LJ=h(`<section class="flex h-full min-h-0 flex-col bg-background"><!></section>`);function RJ(e,t){a(t,!0);var n=LJ(),r=V(n),i=e=>{var n=FJ(),r=L(n),i=e=>{var n=PJ(),r=V(n),i=I(r),a=e=>{var n=NJ(),r=V(n);d(n),P(()=>A(r,`PID ${t.task.runtime.childPid??``}`)),g(e,n)};k(i,e=>{t.task.runtime?.childPid&&e(a)}),d(n),P(()=>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=I(r,2);o(V(a),()=>t.task.id,e=>{MJ(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=IJ();sd(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),R()}var zJ=5e3;function BJ(e,t){return{...e,task:t.task,events:HJ(t.events,e.events),hasMoreBefore:t.hasMoreBefore,truncated:!!(e.truncated||t.truncated),previewPath:e.previewPath??t.previewPath}}function VJ(e,t){let n=HJ(e.events,t.events),r=Math.max(0,n.length-zJ);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 HJ(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 UJ=500,WJ=0,GJ=new ce,KJ,qJ=!1;async function JJ(e){let t=++WJ,n=await Ki(e,{mode:`recent`,limit:UJ});t!==WJ||lr.selectedTaskId!==e||(lr.taskLogs=n)}function YJ(e){let t=GJ.get(e);if(t)return t;let n=lr.taskLogs,r=n?.events[0]?.seq;if(lr.selectedTaskId!==e||n?.task.id!==e||!n.hasMoreBefore||r===void 0||n.events.length>=5e3)return Promise.resolve();let i=Ki(e,{mode:`recent`,beforeSeq:r,limit:UJ}).then(t=>{let n=lr.taskLogs;lr.selectedTaskId!==e||n?.task.id!==e||(lr.taskLogs=BJ(n,t))}).finally(()=>GJ.delete(e));return GJ.set(e,i),i}function XJ(e=lr.selectedTaskId){return e?(qJ=!0,KJ||(KJ=(async()=>{do{qJ=!1;let t=lr.taskLogs;if(lr.selectedTaskId!==e||t?.task.id!==e)return;let n=await Ki(e,{mode:`since_cursor`,sinceSeq:t.nextCursor,limit:UJ});for(;;){if(t=lr.taskLogs,lr.selectedTaskId!==e||t?.task.id!==e)return;if(lr.taskLogs=VJ(t,n),!n.hasMoreAfter)break;n=await Ki(e,{mode:`since_cursor`,sinceSeq:n.nextCursor,limit:UJ})}}while(qJ)})().finally(()=>{KJ=void 0}),KJ)):Promise.resolve()}function ZJ(e,t){return t&&e.some(e=>e.id===t)?t:e[0]?.id}function QJ(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 $J(e,t){return e.find(e=>e.dir===t)}function eY(e){return Z.openCenterTabs.findIndex(t=>zp(t,e))}function tY(e,t){return!!(e&&t.some(t=>zp(t,e)))}function nY(e){return new Set(e.map(Rp))}function rY(){tp(),Z.error=void 0,ep.text=``}function iY(e){let t=eY(e);return t<=0?[]:Z.openCenterTabs.slice(0,t)}function aY(e){let t=eY(e);return t===-1?[]:Z.openCenterTabs.slice(t+1)}function oY(e){return Z.openCenterTabs.filter(t=>!zp(t,e))}async function sY(e,t){let n=nY(e);if(!n.size)return;let r=[...Z.openCenterTabs];if(!r.map((e,t)=>n.has(Rp(e))?t:-1).filter(e=>e!==-1).length)return;let i=r.filter(e=>!n.has(Rp(e))),a=!!(Z.activeCenterTab&&n.has(Rp(Z.activeCenterTab))),o=!!(Q.conversationId&&n.has(Rp({kind:`conversation`,id:Q.conversationId}))),s=!!(Z.activeCenterTab?.kind===`pending-conversation`&&n.has(Rp(Z.activeCenterTab))),c=tY(t,i)?t:kp(e),l=[];for(let e of r)n.has(Rp(e))&&(e.kind===`conversation`&&l.push({kind:`conversation`,id:e.id}),e.kind===`pending-conversation`&&l.push({kind:`pending-conversation`,id:e.id}));await kW.cancelIfTargets(l);for(let t of e)bp(t)&&Op(t);Gp(i);for(let e of r)n.has(Rp(e))&&(e.kind===`file`&&delete ni.fileViews[Zr(e.id)],e.kind===`diff`&&delete rr.diffViews[ei(e.id)],e.kind===`conversation`&&delete X.conversationViews[Qr(e.id)],e.kind===`pending-conversation`&&delete X.pendingConversations[ti(e.id)]);lr.selectedTaskId&&n.has(Rp({kind:`task`,id:lr.selectedTaskId}))&&(lr.selectedTaskId=void 0,lr.taskLogs=void 0);let u=i.filter(e=>e.kind===`conversation`).map(e=>e.id);X.activeConversationTabId&&n.has(Rp({kind:`conversation`,id:X.activeConversationTabId}))&&(X.activeConversationTabId=c?.kind===`conversation`?c.id:u[0]),(o||s)&&c?.kind!==`conversation`&&c?.kind!==`pending-conversation`&&rY(),a&&(Zp(void 0),c&&await $p(c))}var cY=e({completeFiles:()=>gY,createConversationForDirectory:()=>EY,deleteConversationAndRefresh:()=>SY,deleteProjectAndRefresh:()=>xY,exportUrl:()=>mY,loadSlashCommands:()=>pY,loadWorkspaceState:()=>lY,newConversation:()=>yY,newConversationInProject:()=>bY,openProjectDirectory:()=>vY,openProjectInEditorAndNotify:()=>CY,pruneProjectConversationsAndRefresh:()=>wY,recoverWorkspaceSnapshotFromNetwork:()=>uY,selectProject:()=>_Y,systemPromptUrl:()=>hY});async function lY(){return dY(await SK.fetchQuery({queryKey:CK.workspace,queryFn:JU}))}async function uY(e={}){let t;return{cursor:await wK({fetch:JU,apply:async n=>{let r=await dY(n,e);return t=r.desiredTab,r.cursor},cache:e=>SK.setQueryData(CK.workspace,e)}),desiredTab:t}}async function dY(e,t={}){let n=EK(e.snapshot.agents,Z.agents);Z.projects=e.snapshot.projects,Z.conversations=e.snapshot.conversations,Z.agents=n,lr.tasks=e.snapshot.tasks;let r=Ip({projects:e.snapshot.projects,conversations:e.snapshot.conversations,tasks:e.snapshot.tasks},{deferActivation:t.deferTabActivation}),i=new be(lr.tasks.map(e=>e.definitionId??e.restartRootTaskId??e.id)),a=lr.openTaskTabIds.filter(e=>!i.has(e));a.length&&await sY(a.map(e=>({kind:`task`,id:e})));let o=ZJ(lr.tasks,lr.selectedTaskId);o!==lr.selectedTaskId&&(lr.selectedTaskId=o,lr.taskLogs=void 0),Z.approvals=e.snapshot.approvals,Z.userQuestions=e.snapshot.userQuestions,Z.planReviews=e.snapshot.planReviews,fY(n,e.snapshot.conversations);let s=new be(e.snapshot.conversations.map(e=>e.id)),c=X.openConversationTabIds.filter(e=>!s.has(e));if(c.length&&await Iq(c),o&&!t.deferTabActivation&&await JJ(o),!Z.projects.some(e=>ur(e)===Z.selectedProjectKey)){let e=[...Z.projects].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0];e&&(r=await _Y(e.id,{deferTabActivation:t.deferTabActivation})??r)}else if(Z.selectedProjectKey&&!Z.selectedProjectId){let e=Z.projects.find(e=>ur(e)===Z.selectedProjectKey);e&&(r=await _Y(e.id,{deferTabActivation:t.deferTabActivation})??r)}return{cursor:e.cursor,desiredTab:r}}function fY(e,t){let n=Q.agentId?e.find(e=>e.id===Q.agentId):void 0;if(n){let e=sq(n.id),t=e?.model??void 0;t?X.selectedModelKey=Qn(t):n.model&&(X.selectedModelKey=Qn(n.model)),X.selectedThinkingLevel=e?.thinkingLevel??n.thinkingLevel,X.selectedMode=e?.mode??n.mode,X.selectedPermissionLevel=e?.permissionLevel??n.permissionLevel,X.selectedApprovalPolicy=e?.approvalPolicy??n.approvalPolicy;return}let r=Q.conversationId?t.find(e=>e.id===Q.conversationId):void 0;r&&(X.selectedMode=r.mode,X.selectedPermissionLevel=r.permissionLevel,X.selectedApprovalPolicy=r.approvalPolicy)}async function pY(){X.slashCompletions=await SK.fetchQuery({queryKey:CK.slashCompletions,queryFn:EH})}function mY(e){if(!Q.conversationId)return;let t=e===`json`?`export`:`export.${e}`;return`/api/conversations/${Wi(Q.conversationId)}/${t}`}function hY(){if(Q.agentId)return`/api/agents/${Wi(Q.agentId)}/system-prompt`}async function gY(e){return SK.fetchQuery({queryKey:CK.fileCompletions(Q.projectId,e),queryFn:()=>DH(Q.projectId,e),staleTime:2e3})}async function _Y(e,t={}){let n=Z.projects.find(t=>t.id===e);if(!n)return;let r=ur(n);if(Z.selectedProjectKey===r&&Z.selectedProjectId){Z.selectedProjectId=n.id,Q.projectId=n.id,Z.projectRecency[r]=Date.now(),Lp();return}Z.selectedProjectId&&Cp(),Z.selectedProjectId=n.id,Z.selectedProjectKey=r,Z.projectRecency[r]=Date.now();let i=Tp(r,{deferActivation:t.deferTabActivation});return Q.projectId=n.id,Q.conversationId=void 0,Q.agentId=void 0,Q.entryId=void 0,Lp(),t.deferTabActivation||(i.active?await $p(i.active):Zp(void 0)),i.active}async function vY(e){try{let t=await mU(e);await SK.invalidateQueries({queryKey:CK.workspace}),await lY();let n=Z.projects.find(e=>ur(e)===ur(t))??t;Z.projects.some(e=>e.id===n.id)||(Z.projects=[...Z.projects,n]),await _Y(n.id)}catch(e){let t=e instanceof Error?e.message:String(e);Z.error=t,Jn.error(`Could not open project`,{description:t})}}function yY(){let e=Z.projects.find(e=>e.id===Z.selectedProjectId);if(!e){Z.projectPickerOpen=!0;return}TY(e)}function bY(e){let t=$J(Z.projects,e);if(t){TY(t);return}EY(e)}async function xY(e){try{let t=Z.projects.find(t=>t.id===e),n=t?ur(t):void 0,r=new be(Z.projects.filter(e=>n&&ur(e)===n).map(e=>e.id)),i=Z.conversations.filter(e=>r.has(e.projectId)).map(e=>e.id);await gU(e),n&&delete Z.projectTabSessions[n],await Iq(i),await SK.invalidateQueries({queryKey:CK.workspace}),await lY(),Jn.success(`Project removed`)}catch(e){let t=e instanceof Error?e.message:String(e);Z.error=t,Jn.error(`Could not remove project`,{description:t})}}async function SY(e){try{await MH(e),jp(t=>t.kind===`conversation`&&t.id===e),await Iq([e]),await SK.invalidateQueries({queryKey:CK.workspace}),await lY(),Jn.success(`Conversation removed`)}catch(e){let t=e instanceof Error?e.message:String(e);Z.error=t,Jn.error(`Could not remove conversation`,{description:t})}}async function CY(e,t){try{await vU(e,t),Jn.success(t===`vscode`?`Opening project in VS Code`:`Opening project in Zed`)}catch(e){let n=e instanceof Error?e.message:String(e);Z.error=n,Jn.error(t===`vscode`?`Could not open VS Code`:`Could not open Zed`,{description:n})}}async function wY(e,t){try{let n=await _U(e,t);await Iq(n.prunedConversationIds),await SK.invalidateQueries({queryKey:CK.workspace}),await lY();let r=n.prunedConversationIds.length,i=n.skipped.length;Jn.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);Z.error=t,Jn.error(`Could not clean up conversations`,{description:t})}}async function TY(e){Z.error=void 0,Z.projectPickerOpen=!1,await _Y(e.id,{deferTabActivation:!0}),Gq(e)}async function EY(e){Z.error=void 0;try{let t=await mU(e);Z.projects=[t,...Z.projects.filter(e=>e.id!==t.id)],await TY(t)}catch(e){let t=e instanceof Error?e.message:String(e);Z.error=t,Jn.error(`Could not open project`,{description:t})}}function DY(){return{fetchToolCall:e=>FU(e),watchSubagentTranscript:yK,atlassian:{jiraSiteUrl:bK,confluenceSiteUrl:xK},voice:{session:kW,targetKey:TW,appendTranscriptText:DW,chatGptConfigured:()=>rK.configured,micShortcutLabel:mf(`composer.toggleMic`),micShortcutAria:hf(`composer.toggleMic`),TranscriptionActivity:XU,AudioAuthDialog:tK},askReply:{pasteImage:NH,dropFiles:async e=>{let t=Ln(),n=Z.projects.find(e=>e.id===Q.projectId);if(!t?.files||!n)throw Error(`Native file paths are unavailable in this window.`);return dK(e,n.dir,t.files.getPathForFile)},slashCompletions:()=>X.slashCompletions,fileCompletions:gY}}}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 OY=new Set([`$$slots`,`$$events`,`$$legacy`]);function kY(e,t){let n=H(t,OY),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];N(e,B({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var AY=new Set([`$$slots`,`$$events`,`$$legacy`]);function jY(e,t){let n=H(t,AY),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`}]];N(e,B({name:`cloud-download`},()=>n,{get iconNode(){return r}}))}var MY=new Set([`$$slots`,`$$events`,`$$legacy`]);function NY(e,t){let n=H(t,MY),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`}]];N(e,B({name:`git-compare-arrows`},()=>n,{get iconNode(){return r}}))}var PY=new Set([`$$slots`,`$$events`,`$$legacy`]);function FY(e,t){let n=H(t,PY),r=[[`path`,{d:`M12 17V3`}],[`path`,{d:`m6 11 6 6 6-6`}],[`path`,{d:`M19 21H5`}]];N(e,B({name:`arrow-down-to-line`},()=>n,{get iconNode(){return r}}))}var IY=new Set([`$$slots`,`$$events`,`$$legacy`]);function LY(e,t){let n=H(t,IY),r=[[`path`,{d:`m18 9-6-6-6 6`}],[`path`,{d:`M12 3v14`}],[`path`,{d:`M5 21h14`}]];N(e,B({name:`arrow-up-from-line`},()=>n,{get iconNode(){return r}}))}var RY=[{minCount:9,maxLength:12},{minCount:5,maxLength:16},{minCount:0,maxLength:22}];function zY(e){return e.relativePath===`.`?`project root`:e.relativePath}function BY(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 VY(e,t){return BY(t.some(t=>t.relativePath!==e.relativePath&&t.name===e.name)?zY(e):e.name,RY.find(e=>t.length>=e.minCount)?.maxLength??22)}function HY(e){return e.untracked?`text-muted-foreground`:e.index===`A`?`text-success`:e.index===`D`||e.worktree===`D`?`text-destructive`:`text-info`}function UY(e,t){if(e.untracked)return`?`;let n=t===`staged`?e.index:e.worktree;return n===` `?e.index===` `?`M`:e.index:n}function WY(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 GY(e){switch(e.status){case`passing`:return`good`;case`failing`:return`danger`;case`pending`:return`warn`;default:return`neutral`}}var KY=h(`<span> </span>`),qY=h(`<!> <!>`,1),JY=h(`<p class="py-1 text-xs text-muted-foreground">Loading…</p>`),YY=h(`<p class="py-1 text-xs text-muted-foreground">Working tree clean.</p>`),XY=h(`<div class="flex min-h-0 flex-1 flex-col"><!></div>`);function ZY(e,t){a(t,!0);let n=(e,n=D,r=D,i=D,a=D,o=D)=>{var c=qY(),l=L(c);{let e=e=>{var t=U(),n=L(t),r=e=>{dn(e,{class:`-mr-1 size-3`,"aria-hidden":`true`})},i=e=>{dt(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=KY(),n=V(t,!0);d(t),P(()=>A(n,r().length)),g(e,t)},c=e=>{{let n=q(()=>i()===`staged`?FY:LY),a=q(()=>i()===`staged`?`Unstage all`:`Stage all`),o=q(()=>t.bulkMutation===(i()===`staged`?`unstage-all`:`stage-all`)),s=q(()=>r().length===0||!t.capabilities.bulkMutateFiles.enabled||!!t.bulkMutation||!!t.fileMutation);kn(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=q(()=>`${a()?`Collapse`:`Expand`} ${n().toLowerCase()} changes`);bn(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=I(l,2),f=e=>{{let a=(e,t=D)=>{var n=KY(),r=V(n,!0);d(n),P((e,t,i)=>{s(n,1,e),K(n,`title`,t),A(r,i)},[()=>x(he(`font-mono font-semibold`,HY(t()))),()=>WY(t(),i()),()=>UY(t(),i())]),g(e,n)},o=(e,n=D)=>{let r=q(()=>t.fileMutation?.path===n().path);var a=qY(),o=L(a);{let e=q(()=>i()===`staged`?FY:LY),a=q(()=>i()===`staged`?`Unstage ${n().path}`:`Stage ${n().path}`),s=q(()=>i()===`staged`?`Unstage`:`Stage`),c=q(()=>W(r)&&t.fileMutation?.action===(i()===`staged`?`unstage`:`stage`)),l=q(()=>!t.capabilities.mutateFiles.enabled||W(r));kn(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=I(o,2);{let e=q(()=>`Discard ${n().path}`),i=q(()=>W(r)&&t.fileMutation?.action===`discard`),a=q(()=>!t.capabilities.mutateFiles.enabled||W(r));kn(s,{get icon(){return Ol},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=q(()=>yn(r(),{getPath:e=>e.path.split(`/`),getKey:e=>`${i()}:${e.path}`})),l=q(()=>`${n()} file tree`);xn(e,{get nodes(){return W(c)},get ariaLabel(){return W(l)},baseIndent:0,getItemTitle:e=>`${WY(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=J(!0),i=J(!0);var o=XY(),c=V(o),l=e=>{g(e,JY())},u=e=>{g(e,YY())},f=e=>{jn(e,{class:`min-h-0 flex-1`,viewportClass:`min-w-0`,children:(e,a)=>{_n(e,{role:`none`,class:`py-0.5`,children:(e,a)=>{var o=qY(),s=L(o),c=e=>{n(e,()=>`Staged`,()=>t.stagedFiles,()=>`staged`,()=>W(r),()=>()=>G(r,!W(r)))};k(s,e=>{t.stagedFiles.length>0&&e(c)});var l=I(s,2),u=e=>{n(e,()=>`Unstaged`,()=>t.unstagedFiles,()=>`unstaged`,()=>W(i),()=>()=>G(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),R()}var QY=new Set([`$$slots`,`$$events`,`$$legacy`]);function $Y(e,t){let n=H(t,QY),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`}]];N(e,B({name:`triangle-alert`},()=>n,{get iconNode(){return r}}))}function eX(e,t){a(t,!0);var n=U(),r=L(n),i=e=>{pn(e,{tone:`muted`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.model.availability.message)),g(e,r)},$$slots:{default:!0}})},o=e=>{pn(e,{tone:`destructive`,get icon(){return $Y},children:(e,n)=>{w();var r=M();P(()=>A(r,t.model.cachedError)),g(e,r)},$$slots:{default:!0}})},s=e=>{pn(e,{tone:`warning`,get icon(){return $Y},children:(e,n)=>{w();var r=M();P(()=>A(r,`Using cached Git data. Refresh failed: ${t.model.cachedError??``}`)),g(e,r)},$$slots:{default:!0}})},c=e=>{pn(e,{tone:`muted`,children:(e,t)=>{w(),g(e,M(`Loading Git repositories…`))},$$slots:{default:!0}})},l=e=>{pn(e,{tone:`muted`,children:(e,n)=>{w();var r=M();P(()=>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),R()}var tX=new Set([`$$slots`,`$$events`,`$$legacy`]);function nX(e,t){let n=H(t,tX),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`}]];N(e,B({name:`git-branch-plus`},()=>n,{get iconNode(){return r}}))}var rX=h(`<!> New branch`,1),iX=h(`<!> <!>`,1),aX=h(`<!> Create`,1),oX=h(`<span class="text-xs text-muted-foreground">You're here</span>`),sX=h(`<!> Switch to base`,1),cX=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>`),lX=h(`<div class="flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground"><!> Loading branches…</div>`),uX=h(`<div class="px-3 py-2 text-xs text-muted-foreground">No branches found.</div>`),dX=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>`),fX=h(`<div class="grid gap-4"><!> <!> <div class="max-h-72 overflow-y-auto rounded-md border"><!></div></div>`),pX=h(`<p class="text-xs text-destructive">Enter a valid branch name (no spaces or special characters).</p>`),mX=h(`<p class="text-xs text-muted-foreground">The new branch is created from the current branch.</p>`),hX=h(`<form class="grid gap-1.5"><!> <!></form>`);function gX(e,t){a(t,!0);let n=F(t,`open`,15,!1),i=F(t,`branchFilter`,15,``),o=F(t,`newBranchName`,15,``),s=J(`switch`),c=q(()=>t.repoSummary.currentBranch??`detached`),l=q(()=>t.repoSummary.baseBranch),u=q(()=>!t.repoSummary.detached&&!!W(l)),f=q(()=>o().trim()),p=q(()=>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=q(()=>W(f).length>0&&!W(p)),h=q(()=>W(s)===`switch`?`Switch branch`:`Create branch`),v=q(()=>W(s)===`switch`?`Current branch: ${W(c)}`:`Create from: ${W(c)}`);ZP(e,{get title(){return W(h)},get description(){return W(v)},size:`sm`,onOpenChange:e=>{e||G(s,`switch`)},get open(){return n()},set open(e){n(e)},footer:e=>{var r=U(),i=L(r),a=e=>{var r=iX(),i=L(r);Oe(i,{size:`sm`,variant:`ghost`,onclick:()=>n(!1),children:(e,t)=>{w(),g(e,M(`Close`))},$$slots:{default:!0}});var a=I(i,2);{let e=q(()=>!t.branchesEnabled);Oe(a,{size:`sm`,get disabled(){return W(e)},onclick:()=>G(s,`create`),children:(e,t)=>{var n=rX();nX(L(n),{}),w(),g(e,n)},$$slots:{default:!0}})}g(e,r)},o=e=>{var n=iX(),r=L(n);Oe(r,{size:`sm`,variant:`ghost`,onclick:()=>G(s,`switch`),children:(e,t)=>{w(),g(e,M(`Back`))},$$slots:{default:!0}});var i=I(r,2);{let e=q(()=>!t.branchesEnabled||t.creatingBranch||!W(p));Oe(i,{size:`sm`,get disabled(){return W(e)},onclick:()=>t.onCreateBranch(t.selectedRepo),children:(e,n)=>{var r=aX(),i=L(r),a=e=>{zi(e,{})},o=e=>{XI(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=L(a),f=e=>{var n=fX(),a=V(n),o=e=>{var n=cX(),r=V(n);XI(r,{size:14,class:`shrink-0 text-info`});var i=I(r,2),a=I(V(i),2),o=V(a,!0);d(a),d(i);var s=I(i,2),c=e=>{g(e,oX())},u=e=>{{let n=q(()=>!t.branchesEnabled||t.switchingBranch===t.baseBranchSummary.name);Oe(e,{size:`xs`,get disabled(){return W(n)},onclick:()=>t.onSwitchBranch(t.selectedRepo,t.baseBranchSummary),children:(e,n)=>{var r=sX(),i=L(r),a=e=>{zi(e,{class:`size-3`})},o=e=>{XI(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),P(()=>A(o,W(l))),g(e,n)};k(a,e=>{W(u)&&e(o)});var s=I(a,2);w_(s,{placeholder:`Filter branches`,ariaLabel:`Filter branches`,get value(){return i()},set value(e){i(e)}});var c=I(s,2),f=V(c),p=e=>{var t=lX();zi(V(t),{class:`size-3.5`}),w(),d(t),g(e,t)},m=e=>{g(e,uX())},h=e=>{var n=U();_(L(n),17,()=>t.filteredBranches,e=>e.name,(e,n)=>{var i=dX(),a=V(i),o=e=>{zi(e,{class:`text-muted-foreground size-3.5`})},s=e=>{UL(e,{size:13,class:`text-success`})},c=e=>{XI(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=I(a,2),f=V(u,!0);d(u);var p=I(u,2),m=e=>{Hi(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=I(p,2),_=e=>{Hi(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),P(()=>{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=hX(),r=V(n);S_(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=I(r,2),a=e=>{g(e,pX())},s=e=>{g(e,mX())};k(i,e=>{W(m)?e(a):e(s,-1)}),d(n),de(`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}}),R()}T([`click`]);var _X=h(`<span class="block truncate font-mono"> </span>`);function vX(e,t){a(t,!0);var n=U(),r=L(n),i=e=>{rn(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();_(L(r),17,()=>t.repos,e=>e.relativePath,(e,n)=>{{let r=q(()=>!t.selectCapability.enabled),i=q(()=>`Switch to ${zY(W(n))}`),a=q(()=>zY(W(n)));tn(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=_X(),a=V(i,!0);d(i),P(e=>A(a,e),[()=>VY(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),R()}var yX=h(`<p class="text-xs text-muted-foreground">Remote actions are unavailable for local-only repositories.</p>`),bX=h(`<!> <button type="button"><!> <span class="truncate font-mono"> </span> <!></button> <!> <!>`,1),xX=h(`<p class="text-xs text-muted-foreground">Loading…</p>`),SX=h(`<div class="flex shrink-0 flex-col gap-1.5 pt-1.5"><!></div>`);function CX(e,t){a(t,!0);let n=F(t,`branchFilter`,15,``),i=F(t,`newBranchName`,15,``),o=F(t,`branchDialogOpen`,15,!1);var c=SX(),l=V(c),u=e=>{let a=q(()=>t.repoSummary);var c=bX(),l=L(c);vX(l,{get repos(){return t.repos},get selectedRepo(){return t.selectedRepo},get selectCapability(){return t.capabilities.selectRepository},get onSelectRepo(){return t.onSelectRepo}});var u=I(l,2),f=V(u);XI(f,{class:`size-3 shrink-0`,"aria-hidden":`true`});var p=I(f,2),m=V(p,!0);d(p),dn(I(p,2),{class:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),d(u);var h=I(u,2),_=e=>{g(e,yX())};k(h,e=>{W(a).hasRemote||e(_)}),gX(I(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)}}),P(e=>{u.disabled=!t.capabilities.branches.enabled,K(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(he(`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,xX())};k(l,e=>{t.repoSummary?e(u):e(f,-1)}),d(c),g(e,c),R()}T([`click`]);function wX(e){return{staged:e.filter(e=>e.staged),unstaged:e.filter(e=>e.untracked||e.worktree!==` `)}}function TX(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 EX={author:`any`,username:``,drafts:`include`,title:``,currentBranchOnly:!1,labels:[],sort:`updated-desc`};function DX(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 OX(e){let t=DX(e);return{...t,labels:t.labels.join(`, `)}}function kX(e,t){return DX({...e,currentBranchOnly:t&&e.currentBranchOnly,labels:e.labels.split(`,`)})}function AX(e,t){let n=DX(e),r=DX(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 jX(e){let t=DX(e);return Number(t.author!==EX.author)+Number(t.drafts!==EX.drafts)+Number(t.title.length>0)+Number(t.currentBranchOnly)+t.labels.length+Number(t.sort!==EX.sort)}function MX(e){let t=DX(e);return t.author!==EX.author||t.drafts!==EX.drafts||t.title!==EX.title||t.currentBranchOnly||t.labels.length>0||t.sort!==EX.sort}function NX(e){return e.slice(0,10)}function PX(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 FX(e,t){return t||!e.hasRemote}function IX(e,t){return FX(e,t)||e.detached||!e.hasUpstream||e.dirty}function LX(e,t){return FX(e,t)||e.detached||(e.ahead??0)<=0}function RX(e,t){return FX(e,t)||e.detached}function zX(e,t){return FX(e,t)||e.dirty}function BX(e){return e.hasUpstream&&!e.detached&&(e.behind??0)>0}function VX(e){return!e.detached&&(e.ahead??0)>0}var HX=h(`<!> <!> <!> <!> <!>`,1),UX=h(`<!> <!> <!> <!>`,1),WX=h(`<!> <!>`,1);function GX(e,t){a(t,!0);let n=J(!1),r=J(``),i=J(``),o=J(void 0),s=q(()=>wX(t.model.changes?.files??[])),c=q(()=>t.model.changes?.files.length??0),l=q(()=>TX(t.model.branches,W(r),t.model.repositorySummary?.baseBranch)),u=q(()=>t.model.branches.find(e=>e.name===t.model.repositorySummary?.baseBranch)),d=q(()=>t.model.operations.fetching||t.model.operations.pulling||t.model.operations.pushing||t.model.operations.syncing||t.model.operations.switchingBaseAndPulling);function f(){G(r,``),G(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&&(G(n,!1),f())}async function h(e){let r=W(i).trim();r&&await t.actions.createBranch(e,r)!==!1&&(G(n,!1),f())}function _(){G(n,!0),f(),t.actions.refreshBranches(t.model.selectedRepository)}var v=WX(),y=L(v);En(y,{padded:!1,scroll:!1,banner:e=>{eX(e,{get model(){return t.model}})},children:(e,a)=>{var f=U(),v=L(f),y=e=>{var a=UX(),f=L(a);vn(f,{title:`Git changes`,get count(){return W(c)},trailing:e=>{{let n=q(()=>!t.model.capabilities.refresh.enabled||t.model.refreshing);kn(e,{get icon(){return El},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=I(f,2);{let e=q(()=>[...t.model.repositories]);CX(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){G(r,e,!0)},get newBranchName(){return W(i)},set newBranchName(e){G(i,e,!0)},get branchDialogOpen(){return W(n)},set branchDialogOpen(e){G(n,e,!0)}})}var y=I(v,2),b=e=>{let n=q(()=>t.model.repositorySummary);hn(e,{dense:!0,class:`h-auto flex-wrap border-b-0 bg-transparent py-1.5`,children:(e,r)=>{var i=HX(),a=L(i);{let e=q(()=>W(n).hasRemote?`Fetch from remote and prune deleted refs`:`Add a remote before fetching`),r=q(()=>!t.model.capabilities.remote.fetch.enabled||FX(W(n),W(d)));kn(a,{get icon(){return jY},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=I(a,2),s=e=>{{let r=q(()=>`Pull${(W(n).behind??0)>0?` (${W(n).behind})`:``}`),i=q(()=>W(n).dirty?`Commit or stash changes before pulling`:`Pull current branch with fast-forward only`),a=q(()=>!t.model.capabilities.remote.pull.enabled||IX(W(n),W(d)));kn(e,{get icon(){return Xv},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=q(()=>BX(W(n)));k(o,e=>{W(c)&&e(s)});var l=I(o,2),u=e=>{{let r=q(()=>`Push${(W(n).ahead??0)>0?` (${W(n).ahead})`:``}`),i=q(()=>!t.model.capabilities.remote.push.enabled||LX(W(n),W(d)));kn(e,{get icon(){return kY},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=q(()=>VX(W(n)));k(l,e=>{W(f)&&e(u)});var p=I(l,2);{let e=q(()=>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=q(()=>!t.model.capabilities.remote.sync.enabled||RX(W(n),W(d)));kn(p,{get icon(){return El},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=I(p,2),h=e=>{{let r=q(()=>`${W(n).baseBranch} + pull`),i=q(()=>W(n).dirty?`Commit or stash changes before switching branches`:`Switch to ${W(n).baseBranch} and pull with fast-forward only`),a=q(()=>!t.model.capabilities.remote[`switch-base-and-pull`].enabled||zX(W(n),W(d)));kn(e,{get icon(){return NY},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)}),ZY(I(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=>G(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=I(y,2);{let e=q(()=>!!W(o)),n=q(()=>W(o)?`This will permanently discard all uncommitted changes for ${W(o).file.path}.`:`This will permanently discard this uncommitted change.`);lv(b,{get open(){return W(e)},title:`Discard change?`,get description(){return W(n)},confirmLabel:`Discard`,destructive:!0,onConfirm:()=>{let e=W(o);G(o,void 0),e&&t.actions.mutateFile(e.repository,e.file,`discard`)},onCancel:()=>G(o,void 0),onOpenChange:e=>{e||G(o,void 0)}})}g(e,v),R()}var KX={enabled:!0};function qX(e){return{enabled:!1,reason:e}}var JX=new Set([`$$slots`,`$$events`,`$$legacy`]);function YX(e,t){let n=H(t,JX),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`}]];N(e,B({name:`list-todo`},()=>n,{get iconNode(){return r}}))}var XX=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function ZX(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,XX);var i=U(),o=L(i);{let e=q(()=>he(`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,()=>ic,(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),R()}var QX=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`class`,`data-slot`]),$X=h(`<textarea></textarea>`);function eZ(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`value`,15),i=F(t,`data-slot`,3,`textarea`),o=H(t,QX);var s=$X();ue(s),O(s,e=>({"data-slot":i(),class:e,...o}),[()=>he(`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)]),pe(s,e=>n(e),()=>n()),Pe(s,r),g(e,s),R()}var tZ=h(`<!> <!>`,1),nZ=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 rZ(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`saving`,3,!1),i=J(``),o=J(``),s=J(``),c=J(`single`),l=q(()=>t.title??(t.definition?`Edit task`:`Create task`)),u=q(()=>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=q(()=>t.submitLabel??(t.definition?`Save task`:`Create task`)),p=q(()=>!r()&&W(o).trim().length>0);z(()=>{if(!n())return;let e=t.definition??t.initial;G(i,e?.label??``,!0),G(o,e?.command??``,!0),G(s,e?.cwd??``,!0),G(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)})}ZP(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=tZ(),i=L(t);Oe(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=I(i,2);{let e=q(()=>!W(p));Oe(a,{size:`sm`,onclick:m,get disabled(){return W(e)},children:(e,t)=>{w();var n=M();P(()=>A(n,r()?`Saving…`:W(f))),g(e,n)},$$slots:{default:!0}})}g(e,t)},children:(e,n)=>{var a=nZ(),l=V(a),u=V(l);ZX(u,{for:`task-definition-label`,children:(e,t)=>{w(),g(e,M(`Label`))},$$slots:{default:!0}}),S_(I(u,2),{id:`task-definition-label`,placeholder:`web-dev`,get disabled(){return r()},get value(){return W(i)},set value(e){G(i,e,!0)}}),d(l);var f=I(l,2),p=V(f);ZX(p,{for:`task-definition-command`,children:(e,t)=>{w(),g(e,M(`Command`))},$$slots:{default:!0}}),eZ(I(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){G(o,e,!0)}}),w(2),d(f);var m=I(f,2),h=V(m);ZX(h,{for:`task-run-policy`,children:(e,t)=>{w(),g(e,M(`Run policy`))},$$slots:{default:!0}}),an(I(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){G(c,e,!0)}}),w(2),d(m);var _=I(m,2),v=V(_);ZX(v,{for:`task-definition-cwd`,children:(e,t)=>{w(),g(e,M(`Working directory`))},$$slots:{default:!0}});var y=I(v,2);{let e=q(()=>t.projectCwd?`Default: ${t.projectCwd}`:`Default working directory`);S_(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){G(s,e,!0)}})}w(2),d(_),d(a),g(e,a)},$$slots:{footer:!0,default:!0}}),R()}var iZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function aZ(e,t){let n=H(t,iZ),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`}]];N(e,B({name:`history`},()=>n,{get iconNode(){return r}}))}var oZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function sZ(e,t){let n=H(t,oZ),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`}]];N(e,B({name:`play`},()=>n,{get iconNode(){return r}}))}var cZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function lZ(e,t){let n=H(t,cZ),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`}]];N(e,B({name:`rotate-cw`},()=>n,{get iconNode(){return r}}))}var uZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function dZ(e,t){let n=H(t,uZ),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`}]];N(e,B({name:`skull`},()=>n,{get iconNode(){return r}}))}var fZ=new Set([`starting`,`running`,`ready`,`stopping`,`recovered`]),pZ=new Set([`recovered`,`recovery_unknown`,`orphaned`]),mZ=new Set([`completed`,`failed`,`timed_out`,`cancelled`,`orphaned`,`interrupted`]);function hZ(e){return{id:e.id,label:e.label,command:e.command,cwd:e.cwd,createdAt:e.createdAt,updatedAt:e.updatedAt,runPolicy:e.runPolicy}}function gZ(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 _Z(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 vZ(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 yZ(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=>xZ(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=>bZ(e)).sort((e,t)=>Number(t.needsRecovery)-Number(e.needsRecovery)||t.run.startedAt.localeCompare(e.run.startedAt))}}function bZ(e,t){return{key:e.id,run:e,definition:t,isActive:fZ.has(e.status),canForceKill:e.status===`recovered`||e.status===`stopping`,isRemovable:mZ.has(e.status),needsRecovery:pZ.has(e.status)}}function xZ(e,t){let n=[...t].sort((e,t)=>t.startedAt.localeCompare(e.startedAt)).map(t=>bZ(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 SZ(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 CZ=h(`<!> `,1),wZ=h(`<!> <!> <!>`,1);function TZ(e,t){a(t,!0);let n=F(t,`expanded`,3,!1),r=q(()=>t.entry.latestRun),i=q(()=>t.entry.runs.length>0),o=q(()=>W(r)?.status??`saved`),s=q(()=>gZ(t.entry)),c=q(()=>t.entry.definition.command),l=q(()=>t.entry.definition.cwd),u=q(()=>t.entry.definition.runPolicy===`concurrent`),d=q(()=>W(u)||t.entry.activeRuns.length===0),f=q(()=>t.entry.activeRuns[0]),p=q(()=>t.entry.needsRecovery?W(r)?.status===`recovered`?`Process recovered; live output disconnected.`:`Process identity needs recovery review.`:void 0),m=q(()=>[W(c),W(l),W(p)].filter(Boolean).join(`
136
- `)),h=q(()=>W(u)&&W(f)?`Start another run`:`Run task`),_=q(()=>{let e=[];W(r)&&e.push({label:`Open logs`,icon:sd,disabled:!t.capabilities.logs,onSelect:()=>t.onOpen?.(W(r).id)}),W(i)&&e.push({label:n()?`Hide runs`:`Show runs`,icon:aZ,onSelect:()=>t.onToggleExpanded?.()}),W(d)&&e.push({label:W(h),icon:sZ,disabled:!t.capabilities.start,onSelect:()=>t.onRun?.()}),W(f)&&(e.push({label:`Restart`,icon:lZ,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:dZ,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:vy,disabled:!t.capabilities.manageDefinitions,onSelect:()=>t.onEdit?.()}),e.push({label:`Delete task`,icon:by,destructive:!0,disabled:!t.capabilities.manageDefinitions,onSelect:()=>t.onDelete?.()});let a=[];return W(c)&&a.push({label:`Copy command`,icon:Zu,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(c))}),W(l)&&a.push({label:`Copy working directory`,icon:On,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(l))}),a.length>0&&e.push({type:`separator`},...a),e});{let a=e=>{var n=wZ(),i=L(n),a=e=>{Hi(e,{tone:`accent`,size:`xs`,children:(e,n)=>{w();var r=M();P(()=>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=I(i,2),c=e=>{Hi(e,{tone:`neutral`,size:`xs`,children:(e,n)=>{var r=CZ(),i=L(r);aZ(i,{class:`mr-1 size-3`});var a=I(i,1,!0);P(()=>A(a,t.entry.runs.length)),g(e,r)},$$slots:{default:!0}})};k(s,e=>{t.entry.runs.length>1&&e(c)});var l=I(s,2);{let e=q(()=>W(r)?Wf(W(r).status):`neutral`);Hi(l,{get tone(){return W(e)},size:`xs`,children:(e,t)=>{w();var n=M();P(()=>A(n,W(o))),g(e,n)},$$slots:{default:!0}})}g(e,n)},c=e=>{var n=U(),r=L(n),i=e=>{{let n=q(()=>!t.capabilities.cancel);kn(e,{get icon(){return dZ},label:`Force kill task`,get disabled(){return W(n)},onclick:()=>t.onForceKill?.(W(f).id)})}},a=e=>{{let n=q(()=>!t.capabilities.cancel);kn(e,{get icon(){return Fg},label:`Stop task`,get disabled(){return W(n)},onclick:()=>t.onCancel?.(W(f).id)})}},o=e=>{{let n=q(()=>!t.capabilities.start);kn(e,{get icon(){return sZ},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=q(()=>W(s).isCommand?`muted`:`default`),u=q(()=>t.entry.needsRecovery?`warn`:W(r)?Wf(W(r).status):`neutral`),p=q(()=>n()?`outline`:`solid`),v=q(()=>W(r)?Gf(W(r).status):!1),y=q(()=>!W(i)),b=q(()=>W(i)?n():void 0);bn(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}})}R()}var EZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function DZ(e,t){let n=H(t,EZ),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`}]];N(e,B({name:`bookmark-plus`},()=>n,{get iconNode(){return r}}))}function OZ(e,t){a(t,!0);let n=F(t,`nested`,3,!1),r=q(()=>t.entry.run),i=q(()=>_Z(t.entry)),o=q(()=>vZ(W(r).startedAt)),s=q(()=>t.entry.needsRecovery?W(r).status===`recovered`?`Process recovered; live output disconnected.`:`Process identity needs recovery review.`:void 0),c=q(()=>[W(r).command,W(r).cwd,W(s)].filter(Boolean).join(`
137
- `)),l=q(()=>{let e=[{label:`Open logs`,icon:sd,disabled:!t.capabilities.logs,onSelect:()=>t.onOpen?.(W(r).id)},{label:`Restart`,icon:lZ,disabled:!t.capabilities.restart,onSelect:()=>t.onRestart?.(W(r).id)}];t.entry.definition&&t.entry.isRemovable&&e.push({label:`Run saved task again`,icon:lZ,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:dZ,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:DZ,disabled:!t.capabilities.manageDefinitions,onSelect:()=>t.onSaveAsDefinition?.(W(r))});let n=[{label:`Copy command`,icon:Zu,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(r).command)},{label:`Copy working directory`,icon:On,disabled:!t.capabilities.copy,onSelect:()=>t.onCopy?.(W(r).cwd)}];return t.entry.isRemovable&&n.push({label:`Remove run`,icon:Ol,destructive:!0,disabled:!t.capabilities.remove,onSelect:()=>t.onRemove?.(W(r).id)}),e.push({type:`separator`},...n),e});{let a=e=>{{let t=q(()=>Wf(W(r).status));Hi(e,{get tone(){return W(t)},size:`xs`,children:(e,t)=>{w();var n=M();P(()=>A(n,W(r).status)),g(e,n)},$$slots:{default:!0}})}},s=e=>{var n=U(),a=L(n),o=e=>{{let n=q(()=>`Force kill ${W(i).text}`),a=q(()=>!t.capabilities.cancel);kn(e,{get icon(){return dZ},get label(){return W(n)},get disabled(){return W(a)},onclick:()=>t.onForceKill?.(W(r).id)})}},s=e=>{{let n=q(()=>`Stop ${W(i).text}`),a=q(()=>!t.capabilities.cancel);kn(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=q(()=>`Restart ${W(i).text}`),a=q(()=>!t.capabilities.restart);kn(e,{get icon(){return lZ},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=q(()=>n()?W(o):W(i).text),d=q(()=>n()?void 0:W(o)),f=q(()=>!n()&&W(i).isCommand),p=q(()=>n()||W(i).isCommand?`muted`:`default`),m=q(()=>t.entry.needsRecovery?`warn`:Wf(W(r).status)),h=q(()=>Gf(W(r).status)),_=q(()=>+!!n());bn(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}})}R()}var kZ=h(`<p class="p-2 text-xs text-muted-foreground">No runs match.</p>`),AZ=h(`<div class="flex min-h-0 flex-col"><div class="flex shrink-0 items-center border-b border-border p-2"><!></div> <div class="min-h-0 flex-1 p-1"><!></div></div>`);function jZ(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=J(``),i=q(()=>{let e=W(r).trim().toLowerCase();return e.length===0?t.runs:t.runs.filter(t=>`${_Z(t).text} ${t.run.command}`.toLowerCase().includes(e))});z(()=>{n()&&G(r,``)});function o(e){n(e),t.onOpenChange?.(e)}function s(e){t.onOpen(e),o(!1)}{let a=q(()=>`${t.runs.length} task runs`);ZP(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=AZ(),o=V(a);w_(V(o),{class:`flex-1`,placeholder:`Filter runs`,ariaLabel:`Filter runs`,get value(){return W(r)},set value(e){G(r,e,!0)}}),d(o);var c=I(o,2),l=V(c),u=e=>{g(e,kZ())},f=e=>{jn(e,{class:`h-full`,children:(e,n)=>{_n(e,{ariaLabel:`All runs`,class:`gap-1`,children:(e,n)=>{var r=U();_(L(r),17,()=>W(i),e=>e.key,(e,n)=>{gn(e,{children:(e,r)=>{OZ(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}})}R()}var MZ=h(`<p class="py-1 text-xs text-muted-foreground">Loading tasks…</p>`),NZ=h(`<div class="flex min-w-0 flex-col border-t border-border/60 pt-0.5"></div>`),PZ=h(`<!> <!>`,1),FZ=h(`<div class="mt-auto shrink-0 p-1"><!></div>`),IZ=h(`<div class="flex min-h-0 min-w-0 flex-1 basis-0 flex-col overflow-hidden"><!> <!> <!></div>`),LZ=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>`),RZ=h(`<div class="flex h-full min-h-0 flex-col"><!></div>`),zZ=h(`<!> <!> <!>`,1),BZ=h(`<div class="h-full min-h-0"><!></div> <!> <!> <!> <!> <!> <!> <!>`,1);function VZ(e,t){a(t,!0);let n=e=>{var n=LZ(),i=V(n),a=V(i),o=e=>{g(e,MZ())},p=e=>{Cn(e,{get icon(){return YX},title:`No saved tasks`,description:`Create a task to run it anytime.`})},x=e=>{_n(e,{role:`none`,class:`gap-1`,children:(e,n)=>{var i=U();_(L(i),17,()=>W(r).definitions,e=>e.key,(e,n)=>{let r=q(()=>y.has(W(n).key));gn(e,{children:(e,i)=>{var a=PZ(),o=L(a);TZ(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=>G(c,t.model.tasks.find(t=>t.id===e),!0),onRestart:e=>void t.actions.restartTask(e),onEdit:()=>G(l,W(n).definition,!0),onDelete:()=>G(u,W(n).definition,!0),onCopy:e=>void t.actions.copyText(e)});var s=I(o,2),f=e=>{var r=NZ();_(r,21,()=>W(n).runs,e=>e.key,(e,n)=>{OZ(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=>G(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=I(i,2),O=e=>{var n=IZ(),i=V(n);Sn(i,{title:`Runs`,get count(){return W(r).runs.length},actions:e=>{{let n=q(()=>!t.model.capabilities.prune.enabled||W(S)===0);kn(e,{get icon(){return by},label:`Prune history`,title:`Prune finished ad-hoc task runs`,get disabled(){return W(n)},onclick:()=>G(s,!0)})}},$$slots:{actions:!0}});var a=I(i,2);_n(a,{ariaLabel:`Runs`,class:`shrink-0 gap-1`,children:(e,n)=>{var r=U();_(L(r),17,()=>W(T),e=>e.key,(e,n)=>{gn(e,{children:(e,r)=>{OZ(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=>G(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=>G(f,e,!0)})},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}});var o=I(a,2),l=e=>{var t=FZ();Oe(V(t),{variant:`ghost`,size:`xs`,class:`w-full text-muted-foreground`,onclick:()=>G(v,!0),children:(e,t)=>{w(),g(e,M(`See More`))},$$slots:{default:!0}}),d(t),pe(t,e=>G(h,e),()=>W(h)),g(e,t)};k(o,e=>{W(E)>0&&e(l)}),d(n),pe(n,e=>G(m,e),()=>W(m)),g(e,n)};k(C,e=>{W(r).runs.length>0&&e(O)}),d(n),g(e,n)},r=q(()=>yZ(t.model.definitions,t.model.tasks)),i=J(!1),o=J(!1),s=J(!1),c=J(void 0),l=J(void 0),u=J(void 0),f=J(void 0),p=J(0),m=J(null),h=J(null),v=J(!1),y=new be;function b(e){y.delete(e)||y.add(e)}let x=q(()=>W(p)>=720),S=q(()=>W(r).runs.filter(e=>e.isRemovable).length),C=Tn({region:()=>W(m),footer:()=>W(h),total:()=>W(r).runs.length}),T=q(()=>W(r).runs.slice(0,C.count)),E=q(()=>W(r).runs.length-W(T).length),D=q(()=>({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){G(o,!0);try{await t.actions.createDefinition(e),G(i,!1),G(f,void 0)}finally{G(o,!1)}}async function ee(e){if(W(l)){G(o,!0);try{await t.actions.updateDefinition(W(l),e),G(l,void 0)}finally{G(o,!1)}}}async function te(){W(u)&&(await t.actions.deleteDefinition(W(u)),G(u,void 0))}async function ne(){if(!W(c))return;let e=W(c).id;G(c,void 0),await t.actions.forceKillTask(e)}function j(e){e.definition&&t.actions.runDefinition(e.definition)}var ie=BZ(),N=L(ie);En(V(N),{scroll:!1,padded:!1,banner:e=>{var n=PZ(),a=L(n);{let e=e=>{var n=U(),r=L(n),a=e=>{{let n=q(()=>!t.model.capabilities.manageDefinitions.enabled);kn(e,{get icon(){return wl},label:`Create task`,get disabled(){return W(n)},onclick:()=>G(i,!0)})}};k(r,e=>{t.model.availability.available&&e(a)}),g(e,n)},n=q(()=>t.model.availability.available?W(r).definitions.length:void 0);vn(a,{title:`Tasks`,get count(){return W(n)},trailing:e,$$slots:{trailing:!0}})}var o=I(a,2),s=e=>{pn(e,{tone:`muted`,children:(e,n)=>{w();var r=M();P(()=>A(r,t.model.availability.message)),g(e,r)},$$slots:{default:!0}})},c=e=>{pn(e,{tone:`info`,children:(e,n)=>{w();var r=M();P(()=>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=L(i),o=e=>{var r=U(),i=L(r),a=e=>{Vu(e,{direction:`horizontal`,class:`min-h-0 flex-1`,children:(e,r)=>{var i=zZ(),a=L(i);zu(a,{defaultSize:38,minSize:24,maxSize:60,children:(e,t)=>{var r=RZ();n(V(r)),d(r),g(e,r)},$$slots:{default:!0}});var o=I(a,2);Bu(o,{"aria-label":`Resize task output`}),zu(I(o,2),{defaultSize:62,minSize:30,children:(e,n)=>{RJ(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(N);var ae=I(N,2);jZ(ae,{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=>G(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=>G(f,e,!0),get open(){return W(v)},set open(e){G(v,e,!0)}});var oe=I(ae,2);rZ(oe,{get projectCwd(){return t.model.defaultCwd},get saving(){return W(o)},onSave:e=>void O(e),get open(){return W(i)},set open(e){G(i,e,!0)}});var se=I(oe,2);{let e=q(()=>!!W(l));rZ(se,{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||G(l,void 0)}})}var ce=I(se,2);{let e=q(()=>!!W(f)),n=q(()=>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);rZ(ce,{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||G(f,void 0)}})}var le=I(ce,2);{let e=q(()=>!!W(c)),t=q(()=>`Immediately terminates ${W(c)?.displayName??W(c)?.name??W(c)?.command??`this task`}. Buffered output and process cleanup may be lost.`);lv(le,{get open(){return W(e)},destructive:!0,title:`Force kill task?`,get description(){return W(t)},confirmLabel:`Force kill`,onConfirm:()=>void ne(),onCancel:()=>G(c,void 0),onOpenChange:e=>{e||G(c,void 0)}})}var ue=I(le,2);{let e=q(()=>!!W(u));lv(ue,{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:()=>G(u,void 0),onOpenChange:e=>{e||G(u,void 0)}})}lv(I(ue,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){G(s,e,!0)}}),re(N,`clientWidth`,e=>G(p,e)),g(e,ie),R()}var HZ=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),UZ=h(`<kbd><!></kbd>`);function WZ(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=H(t,HZ);var i=UZ();O(i,e=>({"data-slot":`kbd`,class:e,...r}),[()=>he(`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),pe(i,e=>n(e),()=>n()),g(e,i),R()}h(`<kbd><!></kbd>`);var GZ=h(`<!> New chat`,1),KZ=h(`<div class="mt-3 flex items-center gap-1.5 text-xs text-muted-foreground"><span>or press</span> <!></div>`),qZ=h(`<!> <!>`,1);function JZ(e,t){a(t,!0);let n=F(t,`projectSelected`,3,!1),r=mf(`conversation.new`);{let i=e=>{var i=qZ(),a=L(i);{let e=q(()=>!n());Oe(a,{get onclick(){return t.onNewChat},get disabled(){return W(e)},children:(e,t)=>{var n=GZ();wl(L(n),{"aria-hidden":`true`}),w(),g(e,n)},$$slots:{default:!0}})}var o=I(a,2),s=e=>{var t=KZ();WZ(I(V(t),2),{children:(e,t)=>{w();var n=M();P(()=>A(n,r)),g(e,n)},$$slots:{default:!0}}),d(t),g(e,t)};k(o,e=>{r&&e(s)}),g(e,i)},a=q(()=>n()?`Begin a conversation in the selected project to explore, plan, and build.`:`Select a project from the top header to begin a conversation.`);my(e,{title:`Where should we start?`,get message(){return W(a)},footer:i,$$slots:{footer:!0}})}R()}var YZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function XZ(e,t){let n=H(t,YZ),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`}]];N(e,B({name:`clipboard`},()=>n,{get iconNode(){return r}}))}var ZZ=new Set([`$$slots`,`$$events`,`$$legacy`]);function QZ(e,t){let n=H(t,ZZ),r=[[`path`,{d:`M17 5H3`}],[`path`,{d:`M21 12H8`}],[`path`,{d:`M21 19H8`}],[`path`,{d:`M3 12v7`}]];N(e,B({name:`text-quote`},()=>n,{get iconNode(){return r}}))}function $Z(e){if(e)return e.split(`:thinking:`)[0]}function eQ(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 tQ(e){let t=e.filter(e=>!!e?.trim());return t.length>0?t.join(`
138
- `):void 0}function nQ(e,t){switch(e.kind){case`message`:case`thinking`:{let n=$Z(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=eQ(e.toolCall.argsPreview),n=eQ(e.toolCall.resultPreview);return{content:tQ([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:tQ([e.toolName,e.error])};case`run_status`:return{content:tQ([`Run ${e.notice.state.replaceAll(`_`,` `)}`,e.notice.errorMessage]),id:e.notice.runId,idLabel:`run id`};case`compaction`:return{content:tQ([`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:tQ([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 rQ(e){return e.filter(e=>e.length>0).flatMap((e,t)=>t===0?e:[{type:`separator`},...e])}function iQ(e,t,n){let r=nQ(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}),rQ([o,s,c])}var aQ={"Copy selection":Zu,"Copy content":XZ,Quote:QZ,"Edit message":vy,"Edit prompt":vy,Discard:by,"Continue from here":yL,"Copy ID":Zu,"Branch history":XI};function oQ(e){return e.map(e=>e.type===`separator`||e.type===`label`?e:e.type===`submenu`?{...e,items:oQ(e.items)}:{...e,icon:aQ[e.label]})}function sQ(e,t,n){return oQ(iQ(e,t,n))}function cQ(e){let t={cancelled:!1},n=()=>{t.cancelled||e()};return typeof requestAnimationFrame==`function`?t.animationFrame=requestAnimationFrame(n):queueMicrotask(n),t}function lQ(e){e.cancelled=!0,e.animationFrame!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(e.animationFrame)}var uQ=class{commit;schedule;cancel;pending;hasPending=!1;frame;destroyed=!1;constructor(e,t=cQ,n=lQ){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 dQ(e){let t=J(e.initialValue),n=e.initialScope,r=e.initialActive,i=new uQ(e=>{G(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 fQ(e,t){a(t,!0),DA(DY());let n=F(t,`pendingConversationActive`,3,!1),r=F(t,`approvals`,19,()=>[]),i=F(t,`pendingUserQuestions`,19,()=>[]),o=F(t,`pendingPlanReviews`,19,()=>[]),s=F(t,`active`,3,!0),c=F(t,`entries`,19,()=>[]),l=F(t,`optimisticMessages`,19,()=>[]),u=F(t,`toolCalls`,19,()=>[]),d=F(t,`treeNodes`,19,()=>[]),f=F(t,`queuedPrompts`,19,()=>[]),p=F(t,`live`,3,!1),m=F(t,`sending`,3,!1),h=F(t,`stopping`,3,!1),g=F(t,`composerText`,3,``),_=F(t,`models`,19,()=>[]),v=F(t,`selectedModelKey`,3,``),y=F(t,`planReviewModels`,19,()=>[]),b=F(t,`planReviewModelKey`,3,``),x=F(t,`planReviewThinkingLevel`,3,`off`),S=F(t,`contextWindow`,3,0),C=F(t,`composerFocusToken`,3,0),w=F(t,`composerEscapeToken`,3,0),T=F(t,`micShortcutToken`,3,0),E=F(t,`thinkingLevel`,3,`off`),D=F(t,`mode`,3,`coding`),O=F(t,`permissionLevel`,3,`autonomous`),ee=F(t,`approvalPolicy`,19,()=>({autoApproveReadOnly:!0})),te=F(t,`slashCompletions`,19,()=>[]),k=F(t,`composerSuggestions`,19,()=>[]),A=q(()=>Ut(u(),t.activeAgent?.id)),ne=q(()=>!!(t.activeConversation||n())),j=q(()=>t.activeProject?nr(t.activeProject.dir,t.homeDir):void 0),M=q(()=>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 ie=dQ({initialScope:ae(()=>W(M)),initialActive:ae(()=>s()),initialValue:ae(re)});z(()=>{ie.update(W(M),s(),re())}),z(()=>()=>ie.destroy());let N=q(()=>ie.current),oe=new qt,se=q(()=>oe.project({entries:W(N).entries,optimisticMessages:W(N).optimisticMessages,toolCalls:W(N).toolCalls,includeUnanchoredTerminalToolCalls:!W(N).activeRun})),ce=q(()=>Bt(W(N).activeRun,W(N).transient,W(se).context)),P=q(()=>Jt(W(se).items,W(N).activeRun,W(N).transient,W(se).context)),le=q(()=>({prefix:W(P),tail:W(ce)})),ue=q(()=>[...W(P),...W(ce)]),de=q(()=>t.transient?.compaction?.state===`running`),fe=q(()=>h()||t.activeRun?.status===`aborting`),pe=q(()=>Ot(W(N).activeRun)),I=q(()=>new Map(d().map(e=>[e.entry.id,e.entry]))),me=q(()=>uee(W(ue),W(N).activeRun));async function L(e,t=`message`){try{await cd(e),Jn.success(`Copied ${t}`)}catch{Jn.error(`Could not copy to clipboard`)}}function he(e){let n=e.split(`
139
- `).map(e=>`> ${e}`).join(`
140
- `),r=g()?`${g()}\n\n`:``;t.onComposerChange?.(`${r}${n}\n\n`)}function ge(e,n){return sQ(e,n,{treeEntriesById:W(I),copyText:L,quoteInComposer:he,onNavigateToEntry:t.onNavigateToEntry,onEditEntry:t.onEditEntry,onOpenHistory:t.onOpenHistory})}{let a=e=>{{let a=q(()=>t.activeConversation?t.onCompact:void 0);pK(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(fe)},get compacting(){return W(de)},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=q(()=>!!(t.activeProject&&t.onNewConversationInProject));JZ(e,{get projectSelected(){return W(n)},onNewChat:()=>{t.activeProject&&t.onNewConversationInProject?.(t.activeProject.dir)}})}},l=q(()=>({conversationId:W(M),open:W(ne),active:s(),timeline:W(le),streamingText:W(pe),sending:W(N).sending,hasActiveTurnOutput:W(me),queuedPrompts:W(N).queuedPrompts,approvals:W(N).approvals,pendingUserQuestions:W(N).pendingUserQuestions,pendingPlanReviews:W(N).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(fe),compacting:W(de),models:_(),selectedModelKey:v(),thinkingLevel:E(),mode:D(),permissionLevel:O(),approvalPolicy:ee(),contextUsage:t.contextUsage,contextWindow:S(),capabilities:{voice:!0,imagePaste:!0,fileDrop:!!Ln()?.files,completions:!0,suggestions:!0,shortcuts:!0,todos:!0,queueing:!0}}})),u=q(()=>({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}));aH(e,{get model(){return W(l)},get actions(){return W(u)},menus:{transcriptMenu:ge},composer:a,emptyExtension:c,$$slots:{composer:!0,emptyExtension:!0}})}R()}var pQ=ie({focusToken:0,escapeToken:0,micToken:0,historyDialogOpen:!1});function mQ(){pQ.focusToken+=1}function hQ(){pQ.escapeToken+=1}function gQ(){pQ.micToken+=1}function _Q(){pQ.historyDialogOpen=!0}function vQ(e,t){return`${e}:${encodeURIComponent(t)}`}function yQ(e){Kp({kind:`file`,id:e})}async function bQ(e){let t=ni.fileViews[Zr(e)];if(t){t.loading=!0,t.error=void 0;try{t.content=await LH(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,Jn.error(`Could not open file`,{description:n})}finally{t.loading=!1}}}async function xQ(e){if(e.projectId!==Z.selectedProjectId){let{selectProject:t}=await bS(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>cY);return{selectProject:e}},void 0);await t(e.projectId)}let t=vQ(e.projectId,e.path),n=Zr(t);yQ(t),ni.fileViews[n]??={id:t,projectId:e.projectId,path:e.path,line:e.line,loading:!1},ni.fileViews[n].line=e.line,Zp({kind:`file`,id:t}),await bQ(t)}async function SQ(e){let t=ni.fileViews[Zr(e)];t&&(yQ(e),Zp({kind:`file`,id:e}),!t.content&&!t.loading&&await bQ(e))}async function CQ(e){await bQ(e)}function wQ(e){let t=ni.fileViews[Zr(e)];t&&(t.displayMode=(t.displayMode??Xf(t.content?.relativePath??t.path))===`raw`?`rendered`:`raw`)}function TQ(e){let t=ni.fileViews[Zr(e)];t&&(t.wrapLines=!t.wrapLines)}function EQ(e){let t=new be(Object.values(ni.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=Z.activeCenterTab,r=n?.kind===`file`&&t.has(n.id),i=Z.openCenterTabs.filter(e=>e.kind!==`file`||!t.has(e.id));for(let e of t)delete ni.fileViews[Zr(e)];Gp(i),r&&$p(i.at(-1))}function DQ(e){let t={kind:`file`,id:e},n=Z.activeCenterTab?.kind===`file`&&Z.activeCenterTab.id===e,r=Jp(t);Yp(t),delete ni.fileViews[Zr(e)],n&&$p(r)}var OQ=new Set([`$$slots`,`$$events`,`$$legacy`]);function kQ(e,t){let n=H(t,OQ),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`}]];N(e,B({name:`git-commit-horizontal`},()=>n,{get iconNode(){return r}}))}function AQ(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 jQ(e){return e?.status===`pending`}function MQ(e){return e.some(e=>jQ(e.checks))}var NQ={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},PQ=class{cooldownMs;dispatch;clock;#e=new Map;constructor(e,t,n=NQ){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 FQ(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 FQ(e.pending)){let i=e.lastStartedAt[r];(i===void 0||t-i>=this.cooldownMs)&&(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=FQ(e.pending).map(n=>{let r=e.lastStartedAt[n];return r===void 0?0:Math.max(0,this.cooldownMs-(t-r))});n.length!==0&&(e.timer=this.clock.setTimeout(()=>{e.timer=void 0,this.#n(e)},Math.min(...n)))}};function FQ(e){return Object.keys(e).filter(t=>!!e[t])}function IQ(e,t){return e.reposRequestInFlight?(e.activeRequestLoadsDetails||=t,!0):!1}function LQ(e){return[e.status,e.total,e.passed,e.failed,e.pending,e.runs.map(e=>`${e.name}:${e.status}`).sort().join(`|`)].join(`,`)}function RQ(e){return[e.number,e.title,e.url,e.state,e.isDraft,e.headRefName,e.baseRefName,e.updatedAt,LQ(e.checks)].join(`\0`)}function zQ(e,t){return e!==void 0&&LQ(e)===LQ(t)}function BQ(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 VQ(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 HQ(e){return{files:e.files,stagedCount:e.stagedCount,unstagedCount:e.unstagedCount,untrackedCount:e.untrackedCount,insertions:e.insertions,deletions:e.deletions}}function UQ(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 WQ(e){return JSON.stringify(e.map(e=>({hash:e.hash,subject:e.subject,relativeDate:e.relativeDate})))}function GQ(e){return JSON.stringify(e.map(e=>({name:e.name,current:e.current,remote:e.remote,upstream:e.upstream})))}function KQ(e){if(e)return JSON.stringify({available:e.available,authenticated:e.authenticated,login:e.login,reason:e.reason})}function qQ(e){return e.map(RQ).join(`
141
- `)}function JQ(e){return JSON.stringify(e.map(e=>VQ(e)))}var YQ=ie({projects:{}}),XQ=8,ZQ=new be;function QQ(e,t,n){return`${e}:${encodeURIComponent(t)}:${n}`}function $Q(e,t,n){return n.filter(n=>!ZQ.has(QQ(e,t,n.number)))}function e$(){return{fetching:!1,pulling:!1,pushing:!1,syncing:!1,switchingBaseAndPulling:!1,switchingBranch:void 0,creatingBranch:!1,fileMutation:void 0,bulkMutation:void 0}}function t$(e,t){return{repoSummary:void 0,changes:void 0,recentCommits:[],github:void 0,prs:[],prFilters:e&&t?o$(e,t):EX,branches:[],operations:e$(),loadingOverview:!1,loadingPrs:!1,prsError:void 0,loadingBranches:!1,prsRequestInFlight:!1,prsRefreshQueued:!1,prsQueuedVisible:!1,prsRequestSeq:0,overviewRequestInFlight:!1,overviewRefreshQueued:!1,lastRepoSummaryFingerprint:void 0,lastChangesFingerprint:void 0,lastRecentCommitsFingerprint:void 0,lastBranchesFingerprint:void 0,lastPrsFingerprint:void 0,lastGithubFingerprint:void 0,loaded:!1,loadedAt:void 0,requestSeq:0}}function n$(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 r$(e){return`nerve.git.repo.${e}`}function i$(e,t){return`nerve.git.prFilters.${e}.${encodeURIComponent(t)}`}function a$(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 o$(e,t){if(typeof localStorage>`u`)return EX;try{let n=localStorage.getItem(i$(e,t));if(!n)return EX;let r=JSON.parse(n);return a$(r)?DX(r):EX}catch{return EX}}function s$(e,t,n){if(!(typeof localStorage>`u`))try{localStorage.setItem(i$(e,t),JSON.stringify(DX(n)))}catch{}}function c$(e){let t=YQ.projects[Yr(e)];t&&(t.touchedAt=Date.now(),l$())}function l$(){let e=Object.values(YQ.projects).sort((e,t)=>t.touchedAt-e.touchedAt);for(let t of e.slice(XQ))delete YQ.projects[Yr(t.projectId)]}function u$(e){let t=Yr(e.id);YQ.projects[t]??=n$(e);let n=YQ.projects[t];return n.projectDir!==e.dir&&(n.projectDir=e.dir),c$(e.id),n}function d$(e,t){let n=YQ.projects[Yr(e)];if(!n)return t$();let r=$r(t);return n.repoStates[r]??=t$(e,t),n.repoStates[r]}function f$(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 p$(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 m$(e,t){let n=VQ(t);return e.lastRepoSummaryFingerprint===n&&e.repoSummary?!1:(e.repoSummary=t,e.lastRepoSummaryFingerprint=n,!0)}function h$(e,t){let n=UQ(t);return e.lastChangesFingerprint===n&&e.changes?!1:(e.changes=t,e.lastChangesFingerprint=n,!0)}function g$(e,t){let n=WQ(t);return e.lastRecentCommitsFingerprint===n?!1:(e.recentCommits=t,e.lastRecentCommitsFingerprint=n,!0)}function _$(e,t){let n=m$(e,t.repo),r=h$(e,HQ(t)),i=g$(e,t.recentCommits),a=n||r||i;return e.loaded||=!0,e.loadedAt=Date.now(),{changed:a,repoChanged:n,changesChanged:r,recentCommitsChanged:i}}function v$(e,t){let n=JQ(t);return e.lastReposFingerprint===n?!1:(e.repos=t,e.lastReposFingerprint=n,!0)}function y$(e,t){let n=GQ(t);return e.lastBranchesFingerprint===n?!1:(e.branches=t,e.lastBranchesFingerprint=n,!0)}function b$(e,t){let n=KQ(t);return e.lastGithubFingerprint===n?!1:(e.github=t,e.lastGithubFingerprint=n,!0)}function x$(e,t){let n=qQ(t);return e.lastPrsFingerprint===n?!1:(e.prs=t,e.lastPrsFingerprint=n,!0)}function S$(e,t,n){return YQ.projects[Yr(e)]?.repoStates[$r(t)]?.prs.find(e=>e.number===n)}function C$(e,t,n){let r=YQ.projects[Yr(e)]?.repoStates[$r(t)];r&&r.prs.find(e=>e.number===n.number)&&x$(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 w$(e,t,n,r){let i=YQ.projects[Yr(e)]?.repoStates[$r(t)];i&&x$(i,i.prs.map(e=>e.number===n?{...e,checks:r}:e))}function T$(e,t,n){ZQ.add(QQ(e,t,n));let r=YQ.projects[Yr(e)]?.repoStates[$r(t)];r&&x$(r,r.prs.filter(e=>e.number!==n))}function E$(e,t){let n=YQ.projects[Yr(e)];if(!n)return;let r=n.repos.find(e=>e.relativePath===t.relativePath);r?VQ(r)!==VQ(t)&&v$(n,n.repos.map(e=>e.relativePath===t.relativePath?t:e)):v$(n,[...n.repos,t]);let i=n.repoStates[$r(t.relativePath)];i&&m$(i,t),i&&(!t.hasRemote||!t.hasGithubRemote)&&k$(e,i),N$(e)}function D$(e,t){let n=YQ.projects[Yr(e)];if(n)return n.repoStates[$r(t)]?.repoSummary??n.repos.find(e=>e.relativePath===t)}function O$(e,t){let n=D$(e,t);return!!(n?.hasRemote&&n.hasGithubRemote)}function k$(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=qQ([]);(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&&N$(e)}function A$(e){if(!(typeof localStorage>`u`))return localStorage.getItem(r$(e))??void 0}function j$(e,t){typeof localStorage>`u`||localStorage.setItem(r$(e),t)}function M$(e){if(!e.loaded&&e.repos.length===0)return;let t=e.repoStates[$r(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 N$(e){let t=YQ.projects[Yr(e)];if(!t)return;let n=M$(t);if(!n)return;let r=rr.gitContext;(!r||r.projectId!==n.projectId||AQ(r)!==AQ(n))&&(rr.gitContext=n)}var P$=3e4,F$=2e4,I$=5*6e4,L$=1e4;function R$(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 z$(e,t,n){return JSON.stringify([e,t,n.path,n.previousPath??``,n.status])}var B$=P$,V$=6e4,H$=1/0,U$=5*6e4,W$=new ce,G$=new ce;function K$(e){let t=JSON.stringify(e),n=(G$.get(t)??0)+1;return G$.set(t,n),n}function q$(e,t){return G$.get(JSON.stringify(e))===t}function J$(e){return e instanceof Error?e.message:String(e)}async function Y$(e){let t=JSON.stringify(e.key),n=W$.get(t);if(n)return n;let r=K$(e.key);if(!e.options?.force){let t=SK.getQueryState(e.key),n=SK.getQueryData(e.key);if(n!==void 0&&q$(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 SK.invalidateQueries({queryKey:e.key});let t=await SK.fetchQuery({queryKey:e.key,queryFn:e.query,staleTime:e.staleTime,gcTime:U$});return q$(e.key,r)&&(e.resource.data!==t&&(e.resource.data=t,e.apply?.(t)),e.resource.error=void 0),t}catch(n){q$(e.key,r)&&(!e.options?.silent||!t)&&(e.resource.error=J$(n));return}finally{q$(e.key,r)&&(e.resource.loading=!1,e.resource.refreshing=!1)}})();W$.set(t,i);try{return await i}finally{W$.get(t)===i&&W$.delete(t)}}function X$(e){let t=e?.core.data,n=e?.files.data?.files.find(t=>t.path===e.selectedFilePath);if(!(!e||!t||!n))return e.fileDiffs[z$(t.baseRefOid,t.headRefOid,n)]}async function Z$(e,t,n){let r=e.core.data,i=e.files.data?.files.find(e=>e.path===t);if(!r||!i)return;let a=z$(r.baseRefOid,r.headRefOid,i);e.fileDiffs[a]??={loading:!1,refreshing:!1};let o=e.fileDiffs[a];return Y$({key:CK.git.prFileDiff(e.projectId,e.repo,e.number,r.baseRefOid,r.headRefOid,i.path,i.previousPath,i.status),query:()=>cU({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:H$,resource:o,options:n})}function Q$(e,t){return CK.git.prSection(e.projectId,e.repo,e.number,t)}function $$(e,t){C$(e.projectId,e.repo,t),t1(e)}function e1(e,t){t1(e,t.mergeSettings.allowedMethods)}function t1(e,t=e.overview.data?.mergeSettings.allowedMethods??[]){(!e.selectedMergeMethod||!t.includes(e.selectedMergeMethod))&&(e.selectedMergeMethod=[`merge`,`squash`,`rebase`].find(e=>t.includes(e)))}function n1(e){if(!q$(e.key,e.version)||(SK.getQueryState(e.key)?.dataUpdatedAt??0)>e.initialUpdatedAt)return;let t=SK.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 r1(e,t={}){let n=CK.git.prInitial(e.projectId,e.repo,e.number),r=JSON.stringify(n),i=W$.get(r);if(i)return i;let a=Q$(e,`core`),o=Q$(e,`conversation`),s=Q$(e,`overview`),c={core:K$(a),conversation:K$(o),overview:K$(s)},l=t=>{let r=SK.getQueryState(n)?.dataUpdatedAt??Date.now();n1({key:a,version:c.core,initialUpdatedAt:r,resource:e.core,data:t.core,apply:t=>$$(e,t)}),n1({key:o,version:c.conversation,initialUpdatedAt:r,resource:e.conversation,data:t.conversation}),n1({key:s,version:c.overview,initialUpdatedAt:r,resource:e.overview,data:t.overview,apply:t=>e1(e,t)})};if(!t.force){let e=SK.getQueryState(n),t=SK.getQueryData(n);if(t!==void 0&&l(t),t!==void 0&&e?.dataUpdatedAt!==void 0&&Date.now()-e.dataUpdatedAt<B$)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 SK.invalidateQueries({queryKey:n});let r=await SK.fetchQuery({queryKey:n,queryFn:()=>nU(e.projectId,e.repo,e.number),staleTime:B$,gcTime:U$});return l(r),r}catch(n){let r=J$(n);for(let[n,i,l]of[[e.core,a,c.core],[e.conversation,o,c.conversation],[e.overview,s,c.overview]])q$(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]])q$(n,r)&&(t.loading=!1,t.refreshing=!1)}})();W$.set(r,d);try{return await d}finally{W$.get(r)===d&&W$.delete(r)}}async function i1(e,t={}){return Y$({key:CK.git.prSection(e.projectId,e.repo,e.number,`core`),query:()=>rU(e.projectId,e.repo,e.number),staleTime:B$,resource:e.core,options:t,apply:t=>$$(e,t)})}async function a1(e,t,n={}){if(t===`conversation`)return Y$({key:CK.git.prSection(e.projectId,e.repo,e.number,`conversation`),query:()=>iU(e.projectId,e.repo,e.number),staleTime:V$,resource:e.conversation,options:n});if(t===`overview`)return Y$({key:CK.git.prSection(e.projectId,e.repo,e.number,`overview`),query:()=>aU(e.projectId,e.repo,e.number),staleTime:B$,resource:e.overview,options:n,apply:t=>e1(e,t)});if(t===`checks`)return Y$({key:CK.git.prSection(e.projectId,e.repo,e.number,`checks`),query:()=>sU(e.projectId,e.repo,e.number),staleTime:e.checks.data?.checks.status===`pending`?0:B$,resource:e.checks,options:n,apply:({checks:t})=>w$(e.projectId,e.repo,e.number,t)});let r=e.core.data?.baseRefOid,i=e.core.data?.headRefOid;if(!(!r||!i))return Y$(t===`commits`?{key:CK.git.prHeadSection(e.projectId,e.repo,e.number,`commits`,i),query:()=>oU(e.projectId,e.repo,e.number),staleTime:H$,resource:e.commits,options:n}:{key:CK.git.prFiles(e.projectId,e.repo,e.number,r,i),query:()=>lU(e.projectId,e.repo,e.number),staleTime:H$,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&&Z$(e,e.selectedFilePath,{silent:!0})}})}function o1(e){if(e.activeTab===`conversation`){Promise.all([a1(e,`conversation`,{silent:!0}),a1(e,`overview`,{silent:!0}),...e.checks.data?[]:[a1(e,`checks`,{silent:!0})]]);return}a1(e,e.activeTab,{silent:!0})}async function s1(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 i1(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=>a1(e,t,{force:!0}))),e.refreshError=e.core.error??r.map(t=>e[t].error).find(Boolean)}finally{e.refreshing=!1}}var c1,l1,u1;function d1(e){c1=e}function f1(){if(typeof document<`u`&&document.visibilityState!==`visible`)return;let e=c1?rr.prViews[Xr(c1)]:void 0;e?.checks.data?.checks.status===`pending`&&!e.checks.loading&&!e.checks.refreshing&&a1(e,`checks`,{force:!0,silent:!0})}function p1(){f1(),document.visibilityState===`visible`&&u1?.()}function m1(e){return typeof window>`u`||l1!==void 0?h1:(u1=e,l1=window.setInterval(f1,L$),window.addEventListener(`focus`,p1),document.addEventListener(`visibilitychange`,p1),h1)}function h1(){typeof window>`u`||(l1!==void 0&&window.clearInterval(l1),l1=void 0,u1=void 0,window.removeEventListener(`focus`,p1),document.removeEventListener(`visibilitychange`,p1))}async function g1(e){e.core.data&&(e.core.data={...e.core.data,state:`MERGED`}),T$(e.projectId,e.repo,e.number);let t=[`git`,e.projectId,`repo`,e.repo,`prs`];for(let[n,r]of SK.getQueriesData({queryKey:t}))r&&SK.setQueryData(n,{...r,prs:r.prs.filter(t=>t.number!==e.number)});await SK.invalidateQueries({queryKey:CK.git.pr(e.projectId,e.repo,e.number)}),await SK.invalidateQueries({queryKey:t})}function _1(e,t,n){return`${e}:${encodeURIComponent(t)}:${n}`}function v1(){return{loading:!1,refreshing:!1}}function y1(e){return{...e,core:v1(),conversation:v1(),overview:v1(),commits:v1(),checks:v1(),files:v1(),fileDiffs:{},activeTab:`conversation`,refreshing:!1,merging:!1}}function b1(e){Kp({kind:`pr`,id:e})}async function x1(e){if(e.activeTab===`conversation`&&(!e.core.data||!e.conversation.data||!e.overview.data)){await r1(e,{silent:!!(e.core.data||e.conversation.data||e.overview.data)})&&o1(e);return}await i1(e,{silent:!!e.core.data}),o1(e)}function S1(e,t,n){for(let r of Object.values(rr.prViews)){if(r.projectId!==e||r.repo!==t)continue;let i=n.find(e=>e.number===r.number);i&&(r.summary=i,zQ(r.checks.data?.checks,i.checks)||(r.checks.data={checks:i.checks}),r.core.data&&!BQ(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 C1(e){if(e.projectId!==Z.selectedProjectId){let{selectProject:t}=await bS(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>cY);return{selectProject:e}},void 0);await t(e.projectId)}let t=_1(e.projectId,e.repo,e.number),n=Xr(t);b1(t);let r=S$(e.projectId,e.repo,e.number);rr.prViews[n]??=y1({id:t,...e,summary:r});let i=rr.prViews[n];r&&(i.summary=r),r&&!i.checks.data&&(i.checks.data={checks:r.checks}),Zp({kind:`pr`,id:t}),await x1(i)}async function w1(e){let t=rr.prViews[Xr(e)];t&&(b1(e),Zp({kind:`pr`,id:e}),await x1(t))}async function T1(e){let t=rr.prViews[Xr(e)];t&&await s1(t)}function E1(e,t){let n=rr.prViews[Xr(e)];n&&(n.activeTab=t,o1(n))}function D1(e,t){let n=rr.prViews[Xr(e)];n&&(n.selectedFilePath=t,Z$(n,t,{silent:!0}))}function O1(e){let t=rr.prViews[Xr(e)];t?.selectedFilePath&&Z$(t,t.selectedFilePath,{force:!0})}function k1(e,t){let n=rr.prViews[Xr(e)];n&&(n.selectedMergeMethod=t)}function A1(e){let t={kind:`pr`,id:e},n=Z.activeCenterTab?.kind===`pr`&&Z.activeCenterTab.id===e,r=Jp(t);Yp(t),delete rr.prViews[Xr(e)],n&&$p(r)}function j1(e,t){return JSON.stringify([e,t])}var M1=new PQ(F$,(e,t)=>{let[n,r]=JSON.parse(e),i=d$(n,r);if(p$(i)){M1.schedule(e,t);return}Promise.all([...t.overview?[I1(n,r,{force:!0,silent:!0,onlyIfChanged:!0})]:[],...t.prs&&i.github?.authenticated?[V1(n,r,!0,!0)]:[]])});function N1(e,t,n){M1.schedule(j1(e,t),n)}function P1(e,t){if(!e)return;let n=YQ.projects[Yr(e)];n?.selectedRepo&&N1(e,n.selectedRepo,t)}async function F1(e,t={}){let n=u$(e),r=t.loadDetails!==!1;if(IQ(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 SK.invalidateQueries({queryKey:CK.git.repos(e.id)});let r=await SK.fetchQuery({queryKey:CK.git.repos(e.id),queryFn:()=>RH(e.id),staleTime:P$});if(n.requestSeq!==i)return;n.projectIsRepo!==r.projectIsRepo&&(n.projectIsRepo=r.projectIsRepo),v$(n,r.repos);for(let t of r.repos)d$(e.id,t.relativePath);let a=A$(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(),N$(e.id),r.repos.length>0&&n.activeRequestLoadsDetails){let t=d$(e.id,n.selectedRepo).loaded?{silent:!0,onlyIfChanged:!0}:{};await Promise.all([I1(e.id,n.selectedRepo,t),R1(e.id,n.selectedRepo),V1(e.id,n.selectedRepo,!0,!1,!0)])}}catch(e){if(n.requestSeq!==i)return;n.discoverError=f$(e),n.loaded||v$(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 F1(e,{force:!1,silent:!0,onlyIfChanged:!0,loadDetails:t}))}}}async function I1(e,t,n={}){let r=d$(e,t);if(r.overviewRequestInFlight){n.force&&(r.overviewRefreshQueued=!0);return}M1.noteDirectStart(j1(e,t),{overview:!0});let i=r.requestSeq+1;r.requestSeq=i,r.overviewRequestInFlight=!0,n.silent||(r.loadingOverview=!0);try{n.force&&await SK.invalidateQueries({queryKey:CK.git.overview(e,t)});let a=await SK.fetchQuery({queryKey:CK.git.overview(e,t),queryFn:()=>zH(e,t),staleTime:P$});if(r.requestSeq!==i)return;E$(e,a.repo),_$(r,a)}catch(e){n.silent||Jn.error(`Git overview failed: ${f$(e)}`)}finally{r.requestSeq===i&&(n.silent||(r.loadingOverview=!1),r.overviewRequestInFlight=!1,r.overviewRefreshQueued&&(r.overviewRefreshQueued=!1,queueMicrotask(()=>void I1(e,t,{silent:!0,onlyIfChanged:!0}))))}}async function L1(e,t){let n=d$(e,t);n.loadingBranches=!0;try{y$(n,(await SK.fetchQuery({queryKey:CK.git.branches(e,t),queryFn:()=>VH(e,t),staleTime:P$})).branches)}catch(e){Jn.error(`Could not list branches: ${f$(e)}`)}finally{n.loadingBranches=!1}}async function R1(e,t,n=!1){let r=d$(e,t);if(!O$(e,t)){k$(e,r);return}try{let i=CK.git.githubStatus(e,t);n&&await SK.invalidateQueries({queryKey:i});let a=await SK.fetchQuery({queryKey:i,queryFn:()=>$H(e,t),staleTime:r.github?.authenticated?I$:P$});b$(r,a),N$(e),a.authenticated?await V1(e,t,!0,n):x$(r,[])}catch(t){b$(r,{available:!1,authenticated:!1,login:null,reason:f$(t)}),x$(r,[]),N$(e)}}var z1=new ce;function B1(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 V1(e,t,n=!1,r=!1,i=!n){let a=d$(e,t);if(!O$(e,t)){k$(e,a);return}let o=j1(e,t),s=z1.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,M1.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=B1(a),i=CK.git.prs(e,t,R$(r));o&&await SK.invalidateQueries({queryKey:i});let s=await SK.fetchQuery({queryKey:i,queryFn:()=>eU(e,t,r),staleTime:MQ(a.prs)?L$:P$});if(a.prsRequestSeq===n&&R$(r)===R$(B1(a))){let n=$Q(e,t,s.prs);x$(a,n),S1(e,t,n),a.prsError=void 0}}catch(e){a.prsRequestSeq===n&&!i&&(a.prsError=f$(e),Jn.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}})();z1.set(o,c);try{await c}finally{z1.get(o)===c&&z1.delete(o)}}function H1(e,t){typeof document<`u`&&document.visibilityState!==`visible`||YQ.projects[Yr(e)]?.repoStates[$r(t)]&&N1(e,t,{overview:!0})}function U1(e){let t=u$(e);if(!t.loaded){F1(e);return}t.reposRequestInFlight||F1(e,{silent:!0,onlyIfChanged:!0})}function W1(e,t){let n=YQ.projects[Yr(e)];if(!n||t===n.selectedRepo)return;n.selectedRepo=t,j$(e,t);let r=d$(e,t);r.loaded?p$(r)||(I1(e,t,{silent:!0,onlyIfChanged:!0}),r.github?.authenticated&&V1(e,t,!0)):(I1(e,t),R1(e,t)),N$(e)}function G1(e,t){N1(e,t,{overview:!0,prs:!0})}function K1(e,t){Jn.error(e,{description:f$(t)})}async function q1(e,t){let n=d$(e,t);n.operations.fetching=!0;try{E$(e,(await qH(e,t)).repo),Jn.success(`Fetched from remote`),G1(e,t)}catch(e){K1(`Fetch failed`,e)}finally{n.operations.fetching=!1}}async function J1(e,t){let n=d$(e,t);n.operations.pulling=!0;try{E$(e,(await KH(e,t)).repo),Jn.success(`Pulled from upstream`),G1(e,t)}catch(e){K1(`Pull failed`,e)}finally{n.operations.pulling=!1}}async function Y1(e,t){let n=d$(e,t);n.operations.pushing=!0;try{E$(e,(await GH(e,t)).repo),Jn.success(`Pushed to upstream`),G1(e,t)}catch(e){K1(`Push failed`,e)}finally{n.operations.pushing=!1}}async function X1(e,t){let n=d$(e,t);n.operations.syncing=!0;try{E$(e,(await WH(e,t)).repo),Jn.success(`Branch synced`),G1(e,t)}catch(e){K1(`Sync failed`,e)}finally{n.operations.syncing=!1}}async function Z1(e,t){let n=d$(e,t);n.operations.switchingBaseAndPulling=!0;try{let r=await JH(e,t);E$(e,r.repo),y$(n,[]),Jn.success(`Switched to ${r.repo.baseBranch} and pulled`),G1(e,t)}catch(e){K1(`Switch and pull failed`,e)}finally{n.operations.switchingBaseAndPulling=!1}}async function Q1(e,t,n){if(n.current)return!1;let r=d$(e,t);r.operations.switchingBranch=n.name;try{let i=await UH(e,t,n.name);return E$(e,i.repo),y$(r,[]),Jn.success(`Switched to ${i.repo.currentBranch??n.name}`),G1(e,t),!0}catch(e){return K1(`Switch branch failed`,e),!1}finally{r.operations.switchingBranch=void 0}}async function $1(e,t,n){if(n.trim().length===0)return!1;let r=d$(e,t);r.operations.creatingBranch=!0;try{return E$(e,(await HH(e,t,n.trim())).repo),y$(r,[]),Jn.success(`Created branch ${n.trim()}`),G1(e,t),!0}catch(e){return K1(`Create branch failed`,e),!1}finally{r.operations.creatingBranch=!1}}async function e0(e,t,n,r){let i=d$(e,t);i.operations.fileMutation={path:n.path,action:r};try{E$(e,(await(r===`stage`?XH:r===`unstage`?ZH:QH)(e,t,n.path)).repo),await I1(e,t)}catch(e){K1(`${r[0].toUpperCase()}${r.slice(1)} failed`,e)}finally{i.operations.fileMutation=void 0}}async function t0(e,t,n){let r=d$(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`?XH:ZH;r.operations.bulkMutation=n;try{for(let n of a)await o(e,t,n.path);await I1(e,t)}catch(e){K1(`${n===`stage-all`?`Stage all`:`Unstage all`} failed`,e)}finally{r.operations.bulkMutation=void 0}}var n0=2e3,r0=new be,i0,a0=0;function o0(){i0===void 0||typeof window>`u`||(window.clearTimeout(i0),i0=void 0)}function s0(e,t,n){i0!==void 0||typeof window>`u`||(i0=window.setTimeout(()=>{i0=void 0,u0(e,{...t,force:!1})},n))}function c0(e){let t=rr.gitContext;!t||t.projectId!==e.projectId||AQ(t)!==AQ(e)?rr.gitContext=e:rr.gitContext={...t,loadedAt:e.loadedAt}}async function l0(e,t={}){let n=Z.projects.find(t=>t.id===e);if(!n)return;await F1(n,{force:t.force,silent:!0,onlyIfChanged:!t.force,loadDetails:!1}),N$(e);let r=rr.gitContext;return r?.projectId===e?r:void 0}async function u0(e,t={}){let n=e??Q.projectId;if(!n)return;t.force&&o0();let r=Date.now(),i=r-a0;if(!t.force&&a0>0&&i<n0){s0(n,t,n0-i);return}if(r0.has(n)){t.force&&s0(n,t,n0);return}a0=r,r0.add(n);try{let e=await l0(n,t);e&&c0(e)}catch{rr.gitContext?.projectId===n&&(rr.gitContext=void 0)}finally{r0.delete(n)}}function d0(){o0(),rr.gitContext=void 0}function f0(e){P1(e,{overview:!0,prs:!0})}var p0=ie({suggestions:[],trustRequests:[],statuses:[],diagnostics:[],loading:!1,error:void 0,lastProjectId:void 0,dismissedTrustIds:[]}),m0={idle:0,critical:1,"core-ready":2,progressive:3};function h0(e){return e===`core-ready`||e===`progressive`||e===`failed`}var g0=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=m0[this.phase],i=m0[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)}},_0=class{#e=J(`idle`);get phase(){return W(this.#e)}set phase(e){G(this.#e,e,!0)}#t=J(0);get generation(){return W(this.#t)}set generation(e){G(this.#t,e,!0)}#n=J();get error(){return W(this.#n)}set error(e){G(this.#n,e,!0)}get coreReady(){return this.phase===`core-ready`||this.phase===`progressive`}get progressiveActive(){return this.phase===`progressive`}},v0=new g0,y0=new _0;function b0(){y0.phase=v0.phase,y0.generation=v0.generation,y0.error=v0.error}function x0(){let e=v0.begin();return b0(),e}function S0(e){return v0.isCurrent(e)}function C0(e,t,n){let r=v0.transition(e,t,n);return r&&b0(),r}function w0(e,t){return C0(e,`failed`,t)}function T0(e){let t=v0.stop(e);return t&&b0(),t}async function E0(e,t={}){if(!e){p0.suggestions=[],p0.trustRequests=[],p0.lastProjectId=void 0;return}p0.loading=!0,p0.error=void 0;try{let n=await CU(e,t);p0.suggestions=n.suggestions,p0.trustRequests=n.trustRequests.filter(e=>!p0.dismissedTrustIds.includes(e.trustId)),p0.statuses=n.statuses,p0.diagnostics=n.diagnostics??[],p0.lastProjectId=e}catch(e){p0.error=M0(e)}finally{p0.loading=!1}}async function D0(e){p0.loading=!0,p0.error=void 0;try{p0.statuses=await wU(e)}catch(e){p0.error=M0(e)}finally{p0.loading=!1}}async function O0(e,t){await EU(e),await D0(t),Jn.success(e.enabled?`Prompt suggestion enabled`:`Prompt suggestion disabled`)}async function k0(e,t){let n=await TU(e);return await D0(t),Jn.success(`Prompt suggestion created`),n.suggestion}function A0(e){p0.dismissedTrustIds.includes(e)||(p0.dismissedTrustIds=[...p0.dismissedTrustIds,e]),p0.trustRequests=p0.trustRequests.filter(t=>t.trustId!==e)}async function j0(e){await DU(e),p0.dismissedTrustIds=p0.dismissedTrustIds.filter(t=>t!==e.trustId),Jn.success(e.status===`unset`?`Prompt suggestion trust reset`:`Prompt suggestion ${e.status}`)}function M0(e){return e instanceof Error?e.message:String(e)}var N0=h(`<!> <!> <!>`,1),P0=h(`<p class="text-xs text-muted-foreground"> </p>`),F0=h(`<section class="grid gap-1 rounded-md border border-border bg-card 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>`),I0=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 L0(e,t){a(t,!0);let n=J(!1),r=q(()=>p0.trustRequests),i=q(()=>W(r).length>0);async function o(e){G(n,!0);try{for(let t of W(r))await j0({trustId:t.trustId,status:e});t.projectId&&await E0(t.projectId,{conversationId:t.conversationId,agentId:t.agentId})}finally{G(n,!1)}}function s(){for(let e of W(r))A0(e.trustId)}ZP(e,{get open(){return W(i)},title:`Allow prompt suggestion JavaScript?`,description:`Some prompt suggestions include JavaScript that decides when the suggestion appears.`,class:`max-w-2xl`,onOpenChange:e=>{e||s()},footer:e=>{var t=N0(),r=L(t);Oe(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=I(r,2);Oe(i,{size:`sm`,variant:`destructive`,get disabled(){return W(n)},onclick:()=>o(`denied`),children:(e,t)=>{w(),g(e,M(`Deny`))},$$slots:{default:!0}}),Oe(I(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=I0(),i=V(n);$Y(V(i),{class:`mt-0.5 size-4 flex-none text-warning`,strokeWidth:2.2}),w(2),d(i);var a=I(i,2);_(a,21,()=>W(r),e=>e.trustId,(e,t)=>{var n=F0(),r=V(n),i=V(r),a=V(i,!0);d(i);var o=I(i,2),s=V(o,!0);d(o),d(r);var c=I(r,2),l=V(c,!0);d(c);var u=I(c,2),f=e=>{var n=P0(),r=V(n,!0);d(n),P(()=>A(r,W(t).description)),g(e,n)};k(u,e=>{W(t).description&&e(f)}),d(n),P(()=>{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}}),R()}var R0=h(`<!> <!>`,1);function z0(e,t){a(t,!0);let n=F(t,`active`,3,!0),r=q(()=>t.tab??Z.activeCenterTab),i=q(()=>W(r)?.kind===`conversation`?W(r).id:void 0),o=q(()=>W(r)?.kind===`pending-conversation`?W(r).id:void 0),s=q(()=>W(i)?X.conversationViews[Qr(W(i))]:void 0),c=q(()=>W(o)?X.pendingConversations[ti(W(o))]:void 0),l=q(()=>W(i)?Z.conversations.find(e=>e.id===W(i)):void 0),u=q(()=>W(l)?Z.agents.find(e=>e.id===W(l).activeAgentId||e.conversationId===W(l).id):void 0),d=q(()=>{let e=W(c)?.projectId??W(l)?.projectId;return e?Z.projects.find(t=>t.id===e):W(r)?void 0:sp.activeProject}),f=q(()=>!!W(c)),p=q(()=>{let e=W(u)?.id;return Z.userQuestions.filter(t=>W(i)&&t.conversationId===W(i)?!0:!!(e&&t.agentId===e))}),m=q(()=>{let e=W(u)?.id;return Z.planReviews.filter(t=>W(i)&&t.conversationId===W(i)?!0:!!(e&&t.agentId===e))}),h=q(()=>{let e=W(u)?.id;return Z.approvals.filter(t=>W(i)&&t.conversationId===W(i)?!0:!!(e&&t.agentId===e))}),_=q(()=>W(m)[0]?Z.agents.find(e=>e.id===W(m)[0]?.agentId):void 0),v=q(()=>sq(W(u)?.id)),y=q(()=>W(c)?.selectedModelKey??(W(v)?.model?Qn(W(v).model):W(u)?.model?Qn(W(u).model):X.selectedModelKey)),b=q(()=>ar.models.find(e=>Qn(e)===W(y))),x=q(()=>W(u)?.model),S=q(()=>W(x)?ar.models.find(e=>Qn(e)===Qn(W(x))):void 0),C=q(()=>W(c)?.thinkingLevel??W(v)?.thinkingLevel??W(u)?.thinkingLevel??`off`),w=q(()=>W(c)?.mode??W(v)?.mode??W(u)?.mode??W(l)?.mode??X.selectedMode),T=q(()=>W(c)?.permissionLevel??W(v)?.permissionLevel??W(u)?.permissionLevel??W(l)?.permissionLevel??X.selectedPermissionLevel),E=q(()=>W(c)?.approvalPolicy??W(v)?.approvalPolicy??W(u)?.approvalPolicy??W(l)?.approvalPolicy??X.selectedApprovalPolicy),D=q(()=>W(c)?.composerText??W(s)?.composerText??``),O=q(()=>dr(ar.models,ar.authProviders,ar.settingsDraft?.scopedModels)),ee=q(()=>W(_)?.model?Qn(W(_).model):W(y)),te=q(()=>W(_)?.thinkingLevel??W(C)),k=q(()=>W(b)?.contextWindow??W(S)?.contextWindow??W(s)?.contextUsage?.contextWindow??0),A={"commit-changes":kQ,"commit-on-feature-branch":nX,"create-pull-request":ed},ne=q(()=>p0.suggestions.map(e=>({id:`prompt:${e.id}`,label:e.label,prompt:e.prompt,icon:e.source.kind===`builtin`?A[e.name]??hz:hz}))),j=q(()=>{let e=rr.gitContext;return e?`${e.projectId}:${AQ(e)}`:`none`}),M=q(()=>n()?X.slashCompletions:[]);function re(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}async function ie(){let e=W(r);!e||re(Z.activeCenterTab,e)||await $p(e)}function N(e){let t=W(c);if(t){t.composerText=e;return}if(W(i)){ZU(W(i)).composerText=e;return}if(n()&&re(Z.activeCenterTab,W(r))){yJ(e);return}ep.text=e}async function ae(e){await ie(),await e()}async function oe(e,t=!1){await ae(()=>fJ(e,t)),mQ()}async function se(e){await ae(()=>fJ(e.parentEntryId)),N(e.text),mQ()}function ce(e,t){W(d)&&xQ({projectId:W(d).id,path:e,line:t})}z(()=>{!y0.progressiveActive||!n()||!W(d)?.id||(W(j),E0(W(d).id,{conversationId:W(i),agentId:W(u)?.id}))});function P(e){N(W(D).trim()?`${W(D)}\n\n${e.prompt}`:e.prompt)}function le(e){ae(()=>wJ(e.prompt,{clearComposer:!1}))}async function ue(e){try{await Nr(`agent.promptQueue.cancel`,{agentId:e.agentId,queuedPromptId:e.id});let t=ZU(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 Jn.error(`Queued prompt action failed`,{description:t}),!1}}function de(e){ae(async()=>{await ue(e)&&Jn.message(`Queued prompt discarded`)})}function fe(e){ae(async()=>{await ue(e)&&(N(e.text),mQ(),Jn.success(`Moved queued prompt to composer`))})}var pe=R0(),me=L(pe);{let e=q(()=>Z.status?.storage.userHome),t=q(()=>W(s)?.entries??[]),r=q(()=>W(s)?.optimisticMessages??[]),i=q(()=>W(s)?.toolCalls??[]),a=q(()=>W(s)?.treeNodes??[]),o=q(()=>W(s)?.activeRun),g=q(()=>W(s)?.transient),_=q(()=>W(s)?.queuedPrompts??[]),v=q(()=>Z.connection===`live`),b=q(()=>W(c)?.sending??W(s)?.sending??!1),x=q(()=>W(s)?.stopping??!1),S=q(()=>W(s)?.contextUsage),A=q(()=>n()?gY:void 0);fQ(me,{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 Z.projects},get conversations(){return Z.conversations},get agents(){return Z.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:le,onDraftSuggestion:P,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 pQ.focusToken},get composerEscapeToken(){return pQ.escapeToken},get micShortcutToken(){return pQ.micToken},get fileCompletions(){return W(A)},onComposerChange:N,onSubmit:()=>{ae(TJ)},get onAnswerUserQuestion(){return Uq},get onDismissUserQuestion(){return Wq},onAbort:()=>{ae(W(s)?.transient?.compaction?.state===`running`?gJ:vJ)},onCompact:()=>{ae(pJ)},get onNewConversationInProject(){return bY},onOpenFile:ce,onModelChange:e=>{ae(()=>$q(e))},onThinkingLevelChange:e=>{ae(()=>eJ(e))},onModeChange:e=>{ae(()=>tJ(e))},onPermissionChange:e=>{ae(()=>nJ(e))},onApprovalPolicyChange:e=>{ae(()=>rJ(e))},get onGrantApproval(){return Rq},get onDenyApproval(){return zq},onAcceptPlanReview:(e,t)=>Bq(e,t),onAcceptPlanReviewInNewChat:(e,t)=>Vq(e,t),get onRejectPlanReview(){return Hq},onContinueFromFailure:e=>{ae(()=>_J(e))},onDiscardQueuedPrompt:de,onMoveQueuedPromptToComposer:fe,onNavigateToEntry:(e,t)=>{oe(e,t)},onEditEntry:e=>{se(e)},onOpenHistory:()=>{ae(_Q)}})}var he=I(me,2);{let e=q(()=>W(d)?.id),t=q(()=>W(u)?.id);L0(he,{get projectId(){return W(e)},get conversationId(){return W(i)},get agentId(){return W(t)}})}g(e,pe),R()}var B0=h(`<div class="lazy-shell-pending svelte-1iqc6q3" aria-busy="true"><!></div>`);function V0(e){var t=B0();zi(V(t),{class:`size-5`}),d(t),g(e,t)}function H0(e){return`${e.projectId}:${encodeURIComponent(e.repo)}:${e.area}:${encodeURIComponent(e.path)}`}function U0(e){Kp({kind:`diff`,id:e})}async function W0(e){e.data?e.refreshing=!0:e.loading=!0,e.error=void 0;try{e.data=await YH(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,Jn.error(`Could not load diff`,{description:n})}finally{e.loading=!1,e.refreshing=!1}}async function G0(e){if(e.projectId!==Z.selectedProjectId){let{selectProject:t}=await bS(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>cY);return{selectProject:e}},void 0);await t(e.projectId)}let t=H0(e),n=ei(t);rr.diffViews[n]??={id:t,...e,loading:!1,refreshing:!1},U0(t),Zp({kind:`diff`,id:t}),await W0(rr.diffViews[n])}async function K0(e){let t=rr.diffViews[ei(e)];t&&(U0(e),Zp({kind:`diff`,id:e}),!t.data&&!t.loading&&await W0(t))}async function q0(e){let t=rr.diffViews[ei(e)];t&&!t.loading&&!t.refreshing&&await W0(t)}function J0(e){let t={kind:`diff`,id:e},n=Z.activeCenterTab?.kind===`diff`&&Z.activeCenterTab.id===e,r=Jp(t);Yp(t),delete rr.diffViews[ei(e)],n&&$p(r)}var Y0={kind:`logs`,id:`logs`};function X0(){Z.status?.capabilities.applicationLogs&&(Kp(Y0),Zp(Y0))}function Z0(){Z.status?.capabilities.applicationLogs&&(Kp(Y0),Zp(Y0))}function Q0(){let e=Z.activeCenterTab?.kind===`logs`,t=Jp(Y0);Yp(Y0),e&&$p(t)}function $0(e){let t=lr.tasks.find(t=>t.id===e);return t?.definitionId??t?.restartRootTaskId??t?.id??e}function e2(e){let t=lr.selectedRunByEntry[e],n=lr.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 t2(e,t){lr.selectedRunByEntry[e]=t}async function n2(e){let t=lr.tasks.find(t=>t.id===e);if(t?.projectId&&t.projectId!==Z.selectedProjectId){let{selectProject:e}=await bS(async()=>{let{selectProject:e}=await Promise.resolve().then(()=>cY);return{selectProject:e}},void 0);await e(t.projectId)}let n=$0(e);t2(n,e),Kp({kind:`task`,id:n}),await r2(n)}async function r2(e){let t=e2(e);Kp({kind:`task`,id:e}),Zp({kind:`task`,id:e}),lr.selectedTaskId=t?.id,t&&await JJ(t.id)}async function i2(e){let t={kind:`task`,id:e},n=Z.activeCenterTab?.kind===`task`&&Z.activeCenterTab.id===e,r=Jp(t);Yp(t),delete lr.selectedRunByEntry[e],lr.selectedTaskId&&$0(lr.selectedTaskId)===e&&(lr.selectedTaskId=void 0,lr.taskLogs=void 0),n&&await $p(r)}Hp({select:{conversation:e=>Mq(e.id),"pending-conversation":e=>Kq(e.id),task:e=>r2(e.id),file:e=>SQ(e.id),pr:e=>w1(e.id),diff:e=>K0(e.id),settings:()=>cG(),auth:()=>jG(),logs:()=>Z0()},close:{conversation:e=>Pq(e.id),"pending-conversation":e=>Fq(e.id),task:e=>i2(e.id),file:e=>DQ(e.id),pr:e=>A1(e.id),diff:e=>J0(e.id),settings:()=>lG(),auth:()=>MG(),logs:()=>Q0()}});var a2={get activeCenterFileView(){let e=Z.activeCenterTab;if(e?.kind===`file`)return ni.fileViews[Zr(e.id)]},get openFileTabs(){return ni.openFileTabIds}};function o2(e){return e?.kind===`conversation`||e?.kind===`pending-conversation`}function s2(e){return`${e.kind}:${e.id}`}function c2(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function Jse(e,t){return e.length===t.length&&e.every((e,n)=>c2(e,t[n]))}function Yse(e,t,n,r=4){let i=new Set(n.filter(o2).map(s2)),a=e.filter(e=>i.has(s2(e)));if(!o2(t))return a.slice(0,r);let o=s2(t);return i.has(o)?[t,...a.filter(e=>s2(e)!==o)].slice(0,r):a.slice(0,r)}function Xse(e,t,n=4){if(!o2(t))return e.slice(0,n);let r=s2(t);return e.some(e=>s2(e)===r)?e.slice(0,n):[t,...e].slice(0,n)}var Zse=new Set([`$$slots`,`$$events`,`$$legacy`]);function l2(e,t){let n=H(t,Zse),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`}]];N(e,B({name:`bot`},()=>n,{get iconNode(){return r}}))}var Qse={read_only:`read only`,supervised:`supervised`,autonomous:`autonomous`};function u2(e){return Qse[e]??e}function $se({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 ece(e){return e.map(e=>`${e.label}: ${e.value??`—`}`).join(`
144
- `)}function tce(e,t){a(t,!0);let n=F(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=tr(e),n=s[e.thinkingLevel??`off`];return n?`${t} (${n})`:t}function l(e){return`${e.mode} · ${u2(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} · ${u2(e.permissionLevel)}`,`model: ${t}`,n].filter(Boolean).join(`
145
- `)}let d=q(()=>wn(i(n()),{getKey:e=>e.id,getParentKey:e=>e.parentAgentId??void 0,getLabel:o}));var f=U(),p=L(f),m=e=>{Cn(e,{get icon(){return l2},title:`No agents yet`,description:`Agents appear once a run starts.`})},h=e=>{xn(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=q(()=>Hf(t().status,!1,t().mode)),r=q(()=>Uf(t().status));gt(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),R()}var nce=new Set([`$$slots`,`$$events`,`$$legacy`]);function d2(e,t){let n=H(t,nce),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`}]];N(e,B({name:`download`},()=>n,{get iconNode(){return r}}))}var rce=new Set([`$$slots`,`$$events`,`$$legacy`]);function f2(e,t){let n=H(t,rce),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`}]];N(e,B({name:`file-code`},()=>n,{get iconNode(){return r}}))}var ice=new Set([`$$slots`,`$$events`,`$$legacy`]);function ace(e,t){let n=H(t,ice),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`}]];N(e,B({name:`file-braces`},()=>n,{get iconNode(){return r}}))}var oce=new Set([`$$slots`,`$$events`,`$$legacy`]);function sce(e,t){let n=H(t,oce),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`}]];N(e,B({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var cce=h(`<!> <span> </span>`,1),lce=h(`<!> <!>`,1);function uce(e,t){a(t,!0);let n=q(()=>{if(!t.activeConversation)return[];let e=t.activeConversation.id;return[{id:`json`,label:`JSON`,icon:ace,href:t.exportUrl?.(`json`),filename:`conversation-${e}.json`},{id:`md`,label:`Markdown`,icon:$u,href:t.exportUrl?.(`md`),filename:`conversation-${e}.md`},{id:`html`,label:`HTML`,icon:f2,href:t.exportUrl?.(`html`),filename:`conversation-${e}.html`},{id:`system-prompt`,label:`System prompt`,icon:sce,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(L(i),()=>GL,(e,i)=>{i(e,{children:(e,i)=>{var a=lce(),o=L(a);{let e=q(()=>xe({variant:`ghost`,size:`icon-xs`})),n=q(()=>!t.activeConversation);C(o,()=>tR,(t,r)=>{r(t,{get class(){return W(e)},"aria-label":`Export conversation`,title:`Export conversation`,get disabled(){return W(n)},children:(e,t)=>{d2(e,{class:`size-4`,"aria-hidden":`true`})},$$slots:{default:!0}})})}C(I(o,2),()=>YL,(e,t)=>{t(e,{align:`end`,class:`w-48`,children:(e,t)=>{var i=U();_(L(i),17,()=>W(n),e=>e.id,(e,t)=>{let n=q(()=>W(t).icon);var i=U(),a=L(i);{let e=q(()=>!W(t).href);C(a,()=>ZL,(i,a)=>{a(i,{get disabled(){return W(e)},onSelect:()=>r(W(t)),children:(e,r)=>{var i=cce(),a=L(i);C(a,()=>W(n),(e,t)=>{t(e,{})});var o=I(a,2),s=V(o,!0);d(o),P(()=>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),R()}function dce(e,t){var n=U();_(L(n),17,()=>t.fields,e=>e.label,(e,t)=>{{let n=q(()=>W(t).mono??!1);Dn(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 fce=j(`<path fill="none" stroke-width="8" stroke-linecap="round"></path>`),pce=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>`),mce=h(`<p class="py-1.5 text-xs text-muted-foreground">Context usage is available after the first run.</p>`);function hce(e,t){a(t,!0);let n=F(t,`contextWindow`,3,0),r=Math.PI*50,i=`M 10 60 A 50 50 0 0 1 110 60`,o=q(()=>n()||t.contextUsage?.contextWindow||0),c=q(()=>t.contextUsage?.tokens??null),l=q(()=>W(c)!=null&&W(o)>0?W(c)/W(o)*100:t.contextUsage?.percent??null),f=q(()=>W(o)>0||W(l)!=null),p=q(()=>W(l)==null?0:Math.max(0,Math.min(100,W(l)))),m=q(()=>W(l)==null?`—`:`${Math.round(W(l))}%`),h=q(()=>W(c)!=null&&W(o)>0?`${hv(W(c))} / ${hv(W(o))} tokens`:W(o)>0?`${hv(W(o))} token window`:`Usage unknown`),_=q(()=>gv(W(l))),v=q(()=>W(_)===`error`?`stroke-destructive-solid`:W(_)===`warning`?`stroke-warning`:`stroke-primary`),y=q(()=>W(_)===`error`?`text-destructive`:W(_)===`warning`?`text-warning`:`text-foreground`);var b=U(),S=L(b),C=e=>{var n=pce(),a=V(n),o=V(a);K(o,`d`,i);var c=I(o),f=e=>{var t=fce();K(t,`d`,i),K(t,`stroke-dasharray`,r),P(()=>{s(t,0,x(W(v))),K(t,`stroke-dashoffset`,r*(1-W(p)/100))}),g(e,t)};k(c,e=>{W(l)!=null&&e(f)}),d(a);var _=I(a,2),b=V(_),S=V(b,!0);d(b);var C=I(b,2),w=V(C,!0);d(C);var T=I(C,2),E=e=>{var n=U();u(L(n),()=>t.children),g(e,n)};k(T,e=>{t.children&&e(E)}),d(_),d(n),P(e=>{K(a,`aria-label`,`Context window usage: ${W(m)} of ${W(h)}`),s(b,1,e),A(S,W(m)),A(w,W(h))},[()=>x(he(`text-xl leading-none font-semibold`,W(y)))]),g(e,n)},w=e=>{g(e,mce())};k(S,e=>{W(f)?e(C):e(w,-1)}),g(e,b),R()}var p2=h(`<!> <!>`,1),gce=h(`<!> `,1),_ce=h(`<div class="flex flex-col gap-4 py-1"><!> <div class="flex min-w-0 flex-col"><!></div> <!></div>`);function vce(e,t){a(t,!0);let n=F(t,`contextWindow`,3,0),r=F(t,`conversationAgents`,19,()=>[]),i=F(t,`compacting`,3,!1),o=J(!1),s=q(()=>$se({status:t.status,activeProject:t.activeProject,activeConversation:t.activeConversation})),c=q(()=>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 cd(ece(W(s))),Jn.success(`Copied session details`)}catch{Jn.error(`Could not copy to clipboard`)}}var u=p2(),f=L(u);En(f,{padded:!1,banner:e=>{var n=p2(),r=L(n);vn(r,{title:`Context`,trailing:e=>{var n=p2(),r=L(n);{let e=q(()=>!t.activeProject);kn(r,{get icon(){return Zu},label:`Copy session details`,get disabled(){return W(e)},onclick:()=>void l()})}uce(I(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=I(r,2),a=e=>{pn(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=L(l),f=e=>{var a=_ce(),l=V(a);hce(l,{get contextUsage(){return t.contextUsage},get contextWindow(){return n()},children:(e,n)=>{{let n=q(()=>!t.activeConversation||i());Oe(e,{size:`xs`,variant:`outline`,class:`rounded-full`,get title(){return W(c)},get disabled(){return W(n)},onclick:()=>G(o,!0),children:(e,t)=>{var n=gce(),r=L(n);R_(r,{});var a=I(r);P(()=>A(a,` ${i()?`Compacting…`:`Compact`}`)),g(e,n)},$$slots:{default:!0}})}},$$slots:{default:!0}});var u=I(l,2);dce(V(u),{get fields(){return W(s)}}),d(u),tce(I(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}}),lv(I(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){G(o,e,!0)}}),g(e,u),R()}function m2(){let e=Q.conversationId??X.activeConversationTabId;if(e)return X.conversationViews[Qr(e)]}function h2(){let e=Z.activeCenterTab;if(e?.kind===`pending-conversation`)return X.pendingConversations[ti(e.id)]}var g2={get activeProject(){return sp.activeProject},get activeConversation(){return sp.activeConversation},get activeAgent(){return sp.activeAgent},get activePendingConversation(){return h2()},get pendingConversationActive(){return!!h2()},get activeUserQuestion(){let e=Q.conversationId,t=Q.agentId;return Z.userQuestions.find(n=>e&&n.conversationId===e?!0:!!(t&&n.agentId===t))},get activePlanReview(){let e=Q.conversationId,t=Q.agentId;return Z.planReviews.find(n=>e&&n.conversationId===e?!0:!!(t&&n.agentId===t))},get conversationActivityById(){return sp.conversationActivityById},get conversationAgents(){return Z.agents.filter(e=>e.conversationId===Q.conversationId)},get pendingApprovalCount(){return Z.approvals.length},get conversationActiveRun(){return m2()?.activeRun},get compacting(){return m2()?.transient?.compaction?.state===`running`},get entries(){return m2()?.entries??[]},get toolCalls(){return m2()?.toolCalls??[]},get treeNodes(){return m2()?.treeNodes??[]},get streamingText(){return Ot(m2()?.activeRun)},get queuedPrompts(){return m2()?.queuedPrompts??[]},get activeComposerText(){return h2()?.composerText??m2()?.composerText??``},get slashCompletions(){return X.slashCompletions},get selectedModelKey(){return X.selectedModelKey},get selectedThinkingLevel(){return X.selectedThinkingLevel},get selectedMode(){return X.selectedMode},get selectedPermissionLevel(){return X.selectedPermissionLevel},get selectedApprovalPolicy(){return X.selectedApprovalPolicy},get activeContextUsage(){return m2()?.contextUsage},get activeModelInfo(){let e=Z.agents.find(e=>e.id===Q.agentId)?.model;if(e)return ar.models.find(t=>t.provider===e.provider&&t.modelId===e.modelId)},get activeContextWindow(){let e=ar.models.find(e=>Qn(e)===X.selectedModelKey);return e?.contextWindow?e.contextWindow:this.activeModelInfo?.contextWindow?this.activeModelInfo.contextWindow:m2()?.contextUsage?.contextWindow??0},get activeConversationUsage(){let e={input:0,output:0,cacheRead:0,cacheWrite:0,cost:0};for(let t of m2()?.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 dr(ar.models,ar.authProviders,ar.settingsDraft?.scopedModels)},get live(){return Z.connection===`live`},get sending(){return h2()?.sending??m2()?.sending??!1},get activeSubscriptionProvider(){return Z.agents.find(e=>e.id===Q.agentId)?.model?.provider??fr(X.selectedModelKey)?.provider},get activeSubscriptionUsage(){let e=this.activeSubscriptionProvider;if(e)return XW.subscriptionUsage[e]}};function yce(){let e=Q.conversationId??X.activeConversationTabId;if(e)return X.conversationViews[Qr(e)]}var _2={get activeCenterPrView(){let e=Z.activeCenterTab;if(e?.kind===`pr`)return rr.prViews[Xr(e.id)]},get gitStatus(){let e=sp.activeProject?.id,t=e?YQ.projects[Yr(e)]:void 0;if(!t||t.repos.length===0)return;let n=t.repoStates[$r(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 yce()?.treeNodes.length??0}};function bce(e){let t,n=!1;return{update(r,i){r&&(n&&i===t||(n=!0,t=i,e(i)))}}}function xce(e){return!!(e.progressiveActive&&e.enabled&&e.projectId&&e.projectId!==e.lastProjectId)}var Sce=1e4,v2=qX(`Select a project to use Git operations.`);function Cce(e,t=()=>!0){let n={get model(){let t=e(),n=t?YQ.projects[Yr(t.id)]:void 0,r=n?.repos??[],i=n?.selectedRepo??`.`,a=n?.repoStates[$r(i)],o=t?{refresh:KX,selectRepository:KX,branches:KX,mutateFiles:KX,bulkMutateFiles:KX,remote:{fetch:KX,pull:KX,push:KX,sync:KX,"switch-base-and-pull":KX},openPullRequest:KX}:{refresh:v2,selectRepository:v2,branches:v2,mutateFiles:v2,bulkMutateFiles:v2,remote:{fetch:v2,pull:v2,push:v2,sync:v2,"switch-base-and-pull":v2},openPullRequest:v2};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??EX,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};n.actions=PX(()=>n.model,{refreshAll:()=>{let t=e();if(t)return F1(t,{force:!0})},refreshRepository:async t=>{let n=e();n&&await Promise.all([I1(n.id,t,{force:!0}),R1(n.id,t,!0)])},refreshBranches:t=>{let n=e();if(n)return L1(n.id,t)},refreshPullRequests:async t=>{let n=e();n&&await Promise.all([I1(n.id,t,{force:!0}),R1(n.id,t,!0)])},configurePullRequests:(t,n)=>{let r=e();if(!r)return;let i=YQ.projects[Yr(r.id)]?.repoStates[$r(t)];if(i)return i.prFilters=DX(n),s$(r.id,t,i.prFilters),V1(r.id,t,!1,!0)},resetPullRequestConfig:t=>{let n=e();if(!n)return;let r=YQ.projects[Yr(n.id)]?.repoStates[$r(t)];if(r)return r.prFilters=EX,s$(n.id,t,r.prFilters),V1(n.id,t,!1,!0)},selectRepository:t=>{let n=e();n&&W1(n.id,t)},createBranch:(t,n)=>{let r=e();return r?$1(r.id,t,n):!1},switchBranch:(t,n)=>{let r=e();return r?Q1(r.id,t,n):!1},openDiff:(t,n,r)=>{let i=e();if(i)return G0({projectId:i.id,repo:t,path:n.path,renamedFrom:n.renamedFrom,area:r})},mutateFile:(t,n,r)=>{let i=e();if(i)return e0(i.id,t,n,r)},bulkMutateFiles:(t,n)=>{let r=e();if(r)return t0(r.id,t,n)},runRemoteOperation:(t,n)=>{let r=e();if(r)return{fetch:()=>q1(r.id,t),pull:()=>J1(r.id,t),push:()=>Y1(r.id,t),sync:()=>X1(r.id,t),"switch-base-and-pull":()=>Z1(r.id,t)}[n]()},selectPullRequest:()=>void 0,openPullRequest:(t,n)=>{let r=e();if(r)return C1({projectId:r.id,repo:t,number:n})}});let r;return z(()=>{let n=e(),i=t();xce({progressiveActive:y0.progressiveActive,enabled:i,projectId:n?.id,lastProjectId:r})&&(r=n?.id,n&&queueMicrotask(()=>{y0.progressiveActive&&t()&&U1(n)}))}),z(()=>{let n=y0.progressiveActive&&t(),r=e(),i=r?YQ.projects[Yr(r.id)]:void 0,a=i?.selectedRepo;if(!n||!r||!i?.repos.length||!a)return;let o=()=>H1(r.id,a),s=()=>{document.visibilityState===`visible`&&o()};o();let c=window.setInterval(o,F$);return window.addEventListener(`focus`,o),document.addEventListener(`visibilitychange`,s),()=>{window.clearInterval(c),window.removeEventListener(`focus`,o),document.removeEventListener(`visibilitychange`,s)}}),z(()=>{let n=y0.progressiveActive&&t(),r=e(),i=r?YQ.projects[Yr(r.id)]:void 0,a=i?.selectedRepo,o=a?i?.repoStates[$r(a)]:void 0,s=o?.prs??[],c=_2.activeCenterPrView,l=s.some(e=>e.checks.status===`pending`&&!(c&&c.projectId===r?.id&&c.repo===a&&c.number===e.number&&c.checks.data?.checks.status===`pending`));if(!n||!r||!i?.repos.length||!a||!o?.repoSummary?.hasGithubRemote||!o.github?.authenticated||!MQ([...s])||!l)return;let u=window.setInterval(()=>{document.visibilityState===`visible`&&N1(r.id,a,{prs:!0})},Sce);return()=>window.clearInterval(u)}),n}var y2=ie({request:0});function wce(){y2.request+=1}var b2={get settingsDraft(){return ar.settingsDraft},get settingsSaveStatus(){return ar.settingsSaveStatus},get settingsMessage(){return ar.settingsMessage},get selectedModelKey(){return X.selectedModelKey}};function Tce(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 x2=Tce({refreshConversation:e=>void Oq(e),selectTab:e=>void $p(e),refreshFile:e=>void CQ(e),refreshPullRequest:e=>void T1(e),refreshDiff:e=>void q0(e),loadSettings:()=>void _G(),loadAuth:()=>void NG(),refreshLogs:wce}),Ece=h(`<div class="conversation-pane-layer svelte-198ko60"><!></div>`),Dce=h(`<div class="center-workspace-content h-full svelte-198ko60"><!> <!></div>`);function Oce(e,t){a(t,!0);let n=q(()=>sp.status),r=q(()=>sp.centerTabs),i=q(()=>sp.activeCenterTab),o=q(()=>Z.openCenterTabs),s=q(()=>o2(W(i))?W(i):void 0),c=J(ie([])),l=q(()=>Xse(W(c),W(s)));z(()=>{let e=Yse(W(c),W(i),W(o));Jse(W(c),e)||G(c,e,!0)});function u(e){sY(oY(e),e)}let p={task:()=>bS(()=>import(`./TaskShell-CCAZjK9o.js`),__vite__mapDeps([29,30])),file:()=>bS(()=>import(`./FileShell-Cg2bNpS1.js`),__vite__mapDeps([31,30,32,33,34,35,36])),pr:()=>bS(()=>import(`./PrShell-Dsng-Aya.js`),__vite__mapDeps([37,38,35,30,39,40,41,32,42,43,44,33,45,34,46,47,48,49])),diff:()=>bS(()=>import(`./DiffShell-CXbZJlLG.js`),__vite__mapDeps([50,38,35,30,39,40,41,32,42,43,44,33,45,34,46,51,52])),settings:()=>bS(()=>import(`./SettingsShell-C9rL1szU.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:()=>bS(()=>import(`./AuthShell-NbeFRi_q.js`),__vite__mapDeps([63,30,54,40,41,32,45,55,58,59,61,33,52,64])),logs:()=>bS(()=>import(`./LogsShell-Bn6B-So1.js`),__vite__mapDeps([65,30,41,32,57,66]))},m=ie({});z(()=>{let e=W(i)?.kind;!e||!(e in p)||m[e]||(m[e]=p[e]())});function h(e){sY(aY(e),e)}function v(e){sY(iY(e),e)}yte(e,{contentVisible:!0,tabStrip:e=>{{let t=q(()=>W(n)?.storage.userHome);If(e,{get tabs(){return W(r)},get homeDir(){return W(t)},onSelect:e=>void $p(e),onClose:e=>void em(e),get onRefresh(){return x2},onCloseOther:u,onCloseRight:h,onCloseLeft:v,get onToggleFileDisplayMode(){return wQ},get onToggleFileLineWrap(){return TQ},get onNew(){return yY},get onReorder(){return Xp}})}},content:e=>{var t=Dce(),n=V(t),r=e=>{var t=U();f(L(t),()=>m.task,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>m.file,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>m.pr,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>m.diff,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>m.settings,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>m.auth,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>m.logs,e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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=I(n,2),y=e=>{var t=U();_(L(t),17,()=>W(l),e=>s2(e),(e,t)=>{let n=q(()=>c2(W(s),W(t)));var r=Ece();z0(V(r),{get tab(){return W(t)},get active(){return W(n)}}),d(r),P(()=>K(r,`hidden`,!W(n))),g(e,r)}),g(e,t)},b=e=>{z0(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}}),R()}function kce(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return e}}function S2(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 C2(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function w2(e,t){a(t,!0);let n=F(t,`isOpen`,3,!1),r=F(t,`isActive`,3,!1),i=q(()=>t.row.agent?.status??`idle`),o=q(()=>t.activity??Qf({conversationId:t.row.conversation.id,agent:t.row.agent,mode:t.row.agent?.mode??t.row.conversation.mode})),s=q(()=>t.row.agent?.mode??t.row.conversation.mode),c=q(()=>t.row.agent?.permissionLevel??t.row.conversation.permissionLevel),l=q(()=>[t.row.conversation.title,`status: ${W(i)}`,`mode: ${W(s)} · ${W(c)}`,`model: ${tr(t.row.agent)}`,`updated: ${C2(t.row.conversation.updatedAt)}`,t.row.conversation.id].join(`
146
- `));{let i=q(()=>n()?`solid`:`outline`);bn(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)})}R()}var Ace=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>`),jce=h(`<div class="conversations-modal svelte-1m5r4e2"><div class="search-box svelte-1m5r4e2"><!></div> <div class="list-region svelte-1m5r4e2"><!></div></div>`);function Mce(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`projectLabel`,3,``),i=F(t,`projectIds`,19,()=>[]),o=F(t,`conversations`,19,()=>[]),s=F(t,`agents`,19,()=>[]),c=F(t,`conversationActivityById`,19,()=>({})),l=J(``),u=J(null),f=q(()=>cr({conversations:o(),agents:s(),projectIds:i(),filter:W(l)}));z(()=>{if(!n())return;G(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=q(()=>`${W(f).length} in ${r()}`);ZP(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(L(r),()=>Yy,(e,n)=>{n(e,{delayDuration:300,disableHoverableContent:!0,children:(e,n)=>{var r=jce(),i=V(r);w_(V(i),{placeholder:`Filter conversations`,ariaLabel:`Filter conversations`,get ref(){return W(u)},set ref(e){G(u,e,!0)},get value(){return W(l)},set value(e){G(l,e,!0)}}),d(i);var a=I(i,2),o=V(a),s=e=>{g(e,Ace())},p=e=>{Bi(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=q(()=>t.openConversationTabIds?.has(r().conversation.id)??!1),i=q(()=>r().conversation.id===t.selectedConversationId),a=q(()=>t.buildMenu?.(r().conversation)??[]);w2(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}})}R()}var Nce=`<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 Pce(e,t){a(t,!1);let n=Nce.replace(`<svg `,`<svg class="size-3.5" `);me();var r=U();p(L(r),()=>n),g(e,r),R()}var Fce=`<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 Ice(e,t){a(t,!1);let n=Fce.replace(`<svg `,`<svg class="size-3.5" `);me();var r=U();p(L(r),()=>n),g(e,r),R()}function T2(e,t){return e.filter(e=>e.projectId===t).length}function Lce(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 Rce(e,t,n){return Math.max(0,T2(e,t)-n)}async function E2(e,t){try{await cd(e),Jn.success(`Copied ${t}`)}catch{Jn.error(`Could not copy to clipboard`)}}function zce(e,t){let n=[];return t.editorAvailability?.vscode.available&&n.push({label:`Open in VS Code`,icon:Pce,onSelect:()=>t.onOpenProjectInEditor?.(e.id,`vscode`)}),t.editorAvailability?.zed.available&&n.push({label:`Open in Zed`,icon:Ice,onSelect:()=>t.onOpenProjectInEditor?.(e.id,`zed`)}),n}function Bce(e,t){let n=zce(e,t),r=[{label:`New chat`,icon:wl,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:Zu,onSelect:()=>void E2(e.dir,`path`)},{label:`Clean up`,icon:by,destructive:!0,disabled:t.conversationCount(e.id)===0,onSelect:()=>t.requestPrune(e)},{label:`Remove project`,icon:by,destructive:!0,onSelect:()=>t.requestDelete({kind:`project`,id:e.id,label:nr(e.dir,t.homeDir)})}),r}function D2(e,t,n){return[{label:`Open conversation`,icon:yL,onSelect:()=>n.onOpenConversation?.(t.id)},{label:`New chat`,icon:wl,shortcut:n.newConversationShortcut,onSelect:()=>n.onNewConversationInProject?.(e.dir)},{type:`separator`},{label:`Copy conversation id`,icon:Zu,onSelect:()=>void E2(t.id,`conversation id`)},{label:`Delete conversation`,icon:by,destructive:!0,onSelect:()=>n.requestDelete({kind:`conversation`,id:t.id,label:t.title})}]}var Vce=h(`<div class="mt-auto shrink-0 p-1"><!></div>`),Hce=h(`<div class="flex min-h-0 flex-1 flex-col overflow-hidden"><!> <!></div>`),Uce=h(`<!> <!>`,1),Wce=h(`<!> <!> <!>`,1);function Gce(e,t){a(t,!0);let n=F(t,`projects`,19,()=>[]),r=F(t,`conversations`,19,()=>[]),i=F(t,`agents`,19,()=>[]),o=F(t,`conversationActivityById`,19,()=>({})),s=F(t,`searchFocusToken`,3,0),c=J(void 0),l=J(!1),u=J(null),f=J(null),p=q(()=>n().find(e=>e.id===t.selectedProjectId)??n()[0]),m=q(()=>n().map(e=>e.id)),h=q(()=>cr({conversations:r(),agents:i(),projectIds:W(m)})),v=Tn({region:()=>W(u),footer:()=>W(f),total:()=>W(h).length}),y=q(()=>W(h).slice(0,v.count)),b=q(()=>W(y).length<W(h).length),x=mf(`conversation.new`),S=mf(`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;z(()=>{s()!==E&&(E=s(),G(l,!0))});let D=q(()=>({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=>G(c,e,!0)}));var O=Wce(),ee=L(O);C(ee,()=>Yy,(e,r)=>{r(e,{delayDuration:300,disableHoverableContent:!0,children:(e,r)=>{En(e,{padded:!1,scroll:!1,children:(e,r)=>{var i=Uce(),a=L(i);vn(a,{title:`Conversations`,get count(){return W(h).length},trailing:e=>{{let n=q(()=>x?`New chat (${x})`:`New chat`),r=q(()=>!W(p)||!t.onNewConversationInProject);kn(e,{get icon(){return wl},label:`New chat`,get title(){return W(n)},get disabled(){return W(r)},onclick:()=>{W(p)&&t.onNewConversationInProject?.(W(p).dir)}})}},$$slots:{trailing:!0}});var s=I(a,2),c=e=>{Cn(e,{title:`No project selected.`,get description(){return T}})},m=e=>{Cn(e,{title:`No conversations in this project yet.`,action:e=>{Oe(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=Hce(),i=V(r);_n(i,{ariaLabel:`Conversations`,class:`shrink-0 py-1`,children:(e,r)=>{var i=U();_(L(i),17,()=>W(y),e=>e.conversation.id,(e,r)=>{let i=q(()=>n().find(e=>e.id===W(r).conversation.projectId)??W(p));{let n=q(()=>t.openConversationTabIds?.has(W(r).conversation.id)??!1),a=q(()=>W(r).conversation.id===t.selectedConversationId),s=q(()=>D2(W(i),W(r).conversation,W(D)));w2(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=I(i,2),s=e=>{var t=Vce();Oe(V(t),{variant:`ghost`,size:`xs`,class:`w-full text-muted-foreground`,onclick:()=>G(l,!0),children:(e,t)=>{w(),g(e,M(`See More`))},$$slots:{default:!0}}),d(t),pe(t,e=>G(f,e),()=>W(f)),g(e,t)};k(a,e=>{W(b)&&e(s)}),d(r),pe(r,e=>G(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=I(ee,2);{let e=q(()=>W(c)?.kind===`conversation`),n=q(()=>W(c)?`This permanently removes “${W(c).label}”.`:``);lv(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||G(c,void 0)}})}var A=I(te,2),ne=e=>{Mce(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=>D2(n().find(t=>t.id===e.projectId)??W(p),e,W(D)),onOpenChange:e=>G(l,e,!0)})};k(A,e=>{W(p)&&e(ne)}),g(e,O),R()}var O2=ie({searchFocusToken:0});function Kce(){O2.searchFocusToken+=1}function qce(e,t){a(t,!0);let n=q(()=>sp.status),r=q(()=>new Set(sp.selectedProjectIds)),i=q(()=>sp.projects.filter(e=>W(r).has(e.id))),o=q(()=>sp.selectedProjectConversations),s=q(()=>sp.agents),c=q(()=>sp.openConversationTabIds),l=q(()=>g2.conversationActivityById);{let t=q(()=>W(n)?.storage.userHome),r=q(()=>W(n)?.runtime.editors);Gce(e,{get projects(){return W(i)},get conversations(){return W(o)},get agents(){return W(s)},get homeDir(){return W(t)},get selectedProjectId(){return Q.projectId},get selectedConversationId(){return Q.conversationId},get openConversationTabIds(){return W(c)},get conversationActivityById(){return W(l)},get searchFocusToken(){return O2.searchFocusToken},get editorAvailability(){return W(r)},get onOpenConversation(){return Mq},get onNewConversationInProject(){return bY},onOpenProjectInEditor:(e,t)=>void CY(e,t),onDeleteProject:e=>void xY(e),onDeleteConversation:e=>void SY(e),onPruneProjectConversations:(e,t)=>void wY(e,t)})}R()}var Jce=new Set([`$$slots`,`$$events`,`$$legacy`]);function k2(e,t){let n=H(t,Jce),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`}]];N(e,B({name:`folder-search`},()=>n,{get iconNode(){return r}}))}var Yce=h(`<!> <span class="truncate"> </span>`,1),Xce=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 Zce(e,t){a(t,!0);let n=F(t,`items`,19,()=>[]),r=mf(`conversation.newFromProject`),i=r?`Switch project (${r})`:`Switch project`,o=hf(`conversation.newFromProject`);function s(e){let t=Rf(e.activity);return t?`${e.label}: ${t.summary}`:e.label}var c=Xce(),l=V(c);Oe(l,{variant:`ghost`,size:`icon-sm`,class:`shrink-0 [-webkit-app-region:no-drag]`,ariaLabel:`Switch project`,get title(){return i},get"aria-keyshortcuts"(){return o},onclick:()=>t.onOpenPicker?.(),children:(e,t)=>{k2(e,{class:`size-4`,"aria-hidden":`true`})},$$slots:{default:!0}});var u=I(l,2);_(u,21,n,e=>e.key,(e,n)=>{let r=q(()=>Rf(W(n).activity)),i=q(()=>W(n).key===t.activeKey);{let a=q(()=>t.buildMenuItems?.(W(n))??[]),o=q(()=>!t.buildMenuItems);fn(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=q(()=>`w-full min-w-0 gap-1.5 px-2 ${W(i)?``:`text-muted-foreground`}`),o=q(()=>W(i)?`page`:void 0),c=q(()=>s(W(n))),l=q(()=>`${W(n).project.dir}${W(r)?` — ${W(r).summary}`:``}`);Oe(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=Yce(),a=L(i),o=e=>{gt(e,{get tone(){return W(r).tone},size:`xs`,get pulse(){return W(r).pulse}})};k(a,e=>{W(r)&&e(o)});var s=I(a,2),c=V(s,!0);d(s),P(()=>A(c,W(n).label)),g(e,i)},$$slots:{default:!0}})}},$$slots:{default:!0}})}}),d(u),d(c),g(e,c),R()}var A2={get tasks(){return lr.tasks},get scopedTasks(){let e=sp.activeProject?.dir;return e?lr.tasks.filter(t=>xf(t.cwd,e)):[]},get selectedTask(){return lr.tasks.find(e=>e.id===lr.selectedTaskId)},get activeCenterTask(){let e=Z.activeCenterTab;if(e?.kind!==`task`)return;let t=lr.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===lr.selectedRunByEntry[e.id])??t[0]},get taskLogs(){return lr.taskLogs}};async function Qce(e){lr.selectedTaskId=e,await JJ(e)}async function $ce(e,t={}){let n=lr.tasks.find(t=>t.id===e)?.status===`orphaned`;await Qee(e,t),await lY(),lr.selectedTaskId&&await JJ(lr.selectedTaskId),Jn.success(t.signal===`SIGKILL`?`Task force killed`:n?`Orphaned task cleanup completed`:`Task cancelled`)}async function ele(e){let t=$0(e),n=await Yee(e);t2(t,n.id),lr.selectedTaskId=n.id,await lY(),await JJ(n.id),Jn.success(`Task restarted`,{description:n.name??n.command??n.id})}function j2(e){let t=$0(e),n=lr.tasks.filter(n=>n.id!==e&&(n.definitionId??n.restartRootTaskId??n.id)===t).sort((e,t)=>t.startedAt.localeCompare(e.startedAt));n[0]?t2(t,n[0].id):Yp({kind:`task`,id:t}),Z.activeCenterTab?.kind===`task`&&Z.activeCenterTab.id===e&&tm(),lr.selectedTaskId===e&&(lr.selectedTaskId=void 0,lr.taskLogs=void 0)}async function tle(e){await Jee(e),j2(e),await lY(),Jn.success(`Task removed`)}async function nle(){let{removed:e}=await Wee();for(let t of e)j2(t);await lY(),Jn.success(e.length===1?`Removed 1 finished task`:`Removed ${e.length} finished tasks`)}async function rle(e){let t=await Zee(e);return await lY(),await Qce(t.id),Jn.success(`Command started`,{description:e.name??e.command}),t}var ile=`max-width: 1023px`,ale=`max-width: 639px`,M2,N2;typeof window<`u`&&typeof window.matchMedia==`function`&&(M2=new Ce(ile),N2=new Ce(ale));var P2={get isCompact(){return M2?.current??!1},get isPhone(){return N2?.current??!1}},ole=new Set([`$$slots`,`$$events`,`$$legacy`]);function F2(e,t){let n=H(t,ole),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`}]];N(e,B({name:`folder-tree`},()=>n,{get iconNode(){return r}}))}var sle=new Set([`$$slots`,`$$events`,`$$legacy`]);function I2(e,t){let n=H(t,sle),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 16v-4`}],[`path`,{d:`M12 8h.01`}]];N(e,B({name:`info`},()=>n,{get iconNode(){return r}}))}var cle=new Set([`$$slots`,`$$events`,`$$legacy`]);function L2(e,t){let n=H(t,cle),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`}]];N(e,B({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var R2=[{id:`conversations`,title:`Conversations`,icon:kP,defaultDock:`left`,defaultOrder:0,hideable:!1},{id:`files`,title:`Files`,icon:F2,defaultDock:`left`,defaultOrder:1},{id:`git`,title:`Git Changes`,icon:XI,defaultDock:`right`,defaultOrder:0},{id:`pull-requests`,title:`Pull Requests`,icon:ed,defaultDock:`right`,defaultOrder:1},{id:`context`,title:`Context`,icon:I2,defaultDock:`right`,defaultOrder:2},{id:`tasks`,title:`Tasks`,icon:sd,defaultDock:`left`,defaultOrder:2},{id:`notes`,title:`Scratch Notes`,icon:L2,defaultDock:`left`,defaultOrder:3}],z2=`nerve.layout.v1`,lle=200,B2={collapsed:[`bottom`]};function ule(){if(typeof localStorage>`u`)return Ul(void 0,R2,{collapsed:[...B2.collapsed]});let e;try{let t=localStorage.getItem(z2);e=t?JSON.parse(t):void 0}catch{e=void 0}return Ul(e,R2,{collapsed:[...B2.collapsed]})}var V2=ie({layout:ule()}),H2=ie({primary:!1,secondary:!1}),U2={get current(){return V2.layout}};function W2(){if(!(typeof localStorage>`u`))try{localStorage.setItem(z2,JSON.stringify(V2.layout))}catch{}}function G2(e){e!==V2.layout&&(V2.layout=e,W2())}function K2(e){G2(wte(V2.layout,e))}function dle(e,t){G2(Cte(V2.layout,e,t))}function fle(e){G2(Tte(V2.layout,e))}function q2(e){G2(Dte(V2.layout,e))}function ple(e){return Kl(V2.layout,e)}var J2;function mle(e,t){let n=Ote(V2.layout,e,t);n!==V2.layout&&(V2.layout=n,J2&&clearTimeout(J2),J2=setTimeout(W2,lle))}function Y2(e,t){H2[e]=t,t&&(H2[e===`primary`?`secondary`:`primary`]=!1)}function X2(){H2.primary=!1,H2.secondary=!1}function Z2(e,t){if(!t){q2(e);return}let n=e===`left`?`primary`:`secondary`;Y2(n,!H2[n])}function Q2(e,t){if(G2(Ete(V2.layout,e)),!t)return;let n=[`left`,`right`,`bottom`].find(t=>V2.layout.docks[t].views.includes(e));n&&Y2(n===`left`?`primary`:`secondary`,!0)}function hle(e,t){a(t,!0);let n=J(void 0),r=J(void 0),i=J(void 0),o=J(void 0),s=q(()=>sp.status),c=q(()=>sp.activeProject),l=q(()=>g2.activeConversation),u=q(()=>g2.activeAgent),d=q(()=>g2.conversationAgents),p=q(()=>g2.compacting),m=q(()=>g2.activeContextUsage),h=q(()=>g2.activeContextWindow),_=q(()=>A2.scopedTasks),v=q(()=>A2.selectedTask);z(()=>{t.viewId===`files`?G(n,W(n)??bS(()=>import(`./FilesPanelView-CnNkKGX2.js`),__vite__mapDeps([67,30,39,40,41,32,42,43,44,33,49,47,48])),!0):t.viewId===`tasks`?G(r,W(r)??bS(()=>import(`./TasksPanelView-BV2VovlR.js`),__vite__mapDeps([68,30,69,61,52,47,48,49])),!0):t.viewId===`notes`?G(i,W(i)??bS(()=>import(`./scratch-notes-Dp9Qv2DB.js`),__vite__mapDeps([70,30,39,40,41,32,42,43,44,33,61,47,48,49])),!0):t.viewId===`pull-requests`&&G(o,W(o)??bS(()=>import(`./GitPullRequestsPanelView-DYC3T8A7.js`),__vite__mapDeps([71,30,39,40,41,32,42,43,44,33,54,45,55,56,57,46])),!0)});function y(e){Q.agentId=e.id,Q.projectId=e.projectId,Q.conversationId=e.conversationId,Q2(`context`,P2.isCompact)}function b(){Q2(`tasks`,P2.isCompact),K2(`tasks`)}var x=U(),S=L(x),w=e=>{var t=U();f(L(t),()=>W(n),e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U();C(L(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=>{qce(e,{})},E=e=>{GX(e,{get model(){return t.gitModel},get actions(){return t.gitActions}})},D=e=>{var n=U();f(L(n),()=>W(o),e=>{V0(e,{})},(e,n)=>{let r=q(()=>W(n)?.default);var i=U(),a=L(i),o=e=>{var n=U();C(L(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=>{vce(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 mY},get systemPromptUrl(){return hY},onSelectAgent:y,onCompact:()=>void pJ()})},ee=e=>{var t=U();f(L(t),()=>W(i),e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.NotesPanelView);var r=U(),i=L(r),a=e=>{var t=U();C(L(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(L(t),()=>W(r),e=>{V0(e,{})},(e,t)=>{let n=q(()=>W(t)?.default);var r=U(),i=L(r),a=e=>{var t=U(),r=L(t);{let e=q(()=>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(),n2(e)},onCancelTask:(e,t)=>void $ce(e,t),onRestartTask:e=>void ele(e),onRemoveTask:e=>void tle(e),onPruneTasks:()=>void nle(),onRunCommand:e=>{b(),rle(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),R()}var gle={value:()=>{}};function $2(){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 e4(n)}function e4(e){this._=e}function _le(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}})}e4.prototype=$2.prototype={constructor:e4,on:function(e,t){var n=this._,r=_le(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=vle(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]=t4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=t4(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 e4(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 vle(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function t4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=gle,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var n4={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 r4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),n4.hasOwnProperty(t)?{space:n4[t],local:e}:e}function yle(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 ble(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function i4(e){var t=r4(e);return(t.local?ble:yle)(t)}function xle(){}function a4(e){return e==null?xle:function(){return this.querySelector(e)}}function Sle(e){typeof e!=`function`&&(e=a4(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 b4(r,this._parents)}function Cle(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wle(){return[]}function o4(e){return e==null?wle:function(){return this.querySelectorAll(e)}}function Tle(e){return function(){return Cle(e.apply(this,arguments))}}function Ele(e){e=typeof e==`function`?Tle(e):o4(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 b4(r,i)}function s4(e){return function(){return this.matches(e)}}function c4(e){return function(t){return t.matches(e)}}var Dle=Array.prototype.find;function Ole(e){return function(){return Dle.call(this.children,e)}}function kle(){return this.firstElementChild}function Ale(e){return this.select(e==null?kle:Ole(typeof e==`function`?e:c4(e)))}var jle=Array.prototype.filter;function Mle(){return Array.from(this.children)}function Nle(e){return function(){return jle.call(this.children,e)}}function Ple(e){return this.selectAll(e==null?Mle:Nle(typeof e==`function`?e:c4(e)))}function Fle(e){typeof e!=`function`&&(e=s4(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 b4(r,this._parents)}function l4(e){return Array(e.length)}function Ile(){return new b4(this._enter||this._groups.map(l4),this._parents)}function u4(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}u4.prototype={constructor:u4,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 Lle(e){return function(){return e}}function Rle(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 u4(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function zle(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 u4(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Ble(e){return e.__data__}function Vle(e,t){if(!arguments.length)return Array.from(this,Ble);var n=t?zle:Rle,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Lle(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=Hle(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 b4(o,r),o._enter=s,o._exit=c,o}function Hle(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Ule(){return new b4(this._exit||this._groups.map(l4),this._parents)}function Wle(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 Gle(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 b4(s,this._parents)}function Kle(){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 qle(e){e||=Jle;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 b4(i,this._parents).order()}function Jle(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Yle(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xle(){return Array.from(this)}function Zle(){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 Qle(){let e=0;for(let t of this)++e;return e}function $le(){return!this.node()}function eue(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 tue(e){return function(){this.removeAttribute(e)}}function nue(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rue(e,t){return function(){this.setAttribute(e,t)}}function iue(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aue(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function oue(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 sue(e,t){var n=r4(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?nue:tue:typeof t==`function`?n.local?oue:aue:n.local?iue:rue)(n,t))}function d4(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cue(e){return function(){this.style.removeProperty(e)}}function lue(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uue(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function due(e,t,n){return arguments.length>1?this.each((t==null?cue:typeof t==`function`?uue:lue)(e,t,n??``)):f4(this.node(),e)}function f4(e,t){return e.style.getPropertyValue(t)||d4(e).getComputedStyle(e,null).getPropertyValue(t)}function fue(e){return function(){delete this[e]}}function pue(e,t){return function(){this[e]=t}}function mue(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hue(e,t){return arguments.length>1?this.each((t==null?fue:typeof t==`function`?mue:pue)(e,t)):this.node()[e]}function p4(e){return e.trim().split(/^|\s+/)}function m4(e){return e.classList||new h4(e)}function h4(e){this._node=e,this._names=p4(e.getAttribute(`class`)||``)}h4.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 g4(e,t){for(var n=m4(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function _4(e,t){for(var n=m4(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function gue(e){return function(){g4(this,e)}}function _ue(e){return function(){_4(this,e)}}function vue(e,t){return function(){(t.apply(this,arguments)?g4:_4)(this,e)}}function yue(e,t){var n=p4(e+``);if(arguments.length<2){for(var r=m4(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?vue:t?gue:_ue)(n,t))}function bue(){this.textContent=``}function xue(e){return function(){this.textContent=e}}function Sue(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Cue(e){return arguments.length?this.each(e==null?bue:(typeof e==`function`?Sue:xue)(e)):this.node().textContent}function wue(){this.innerHTML=``}function Tue(e){return function(){this.innerHTML=e}}function Eue(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Due(e){return arguments.length?this.each(e==null?wue:(typeof e==`function`?Eue:Tue)(e)):this.node().innerHTML}function Oue(){this.nextSibling&&this.parentNode.appendChild(this)}function kue(){return this.each(Oue)}function Aue(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jue(){return this.each(Aue)}function Mue(e){var t=typeof e==`function`?e:i4(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Nue(){return null}function Pue(e,t){var n=typeof e==`function`?e:i4(e),r=t==null?Nue:typeof t==`function`?t:a4(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Fue(){var e=this.parentNode;e&&e.removeChild(this)}function Iue(){return this.each(Fue)}function Lue(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rue(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zue(e){return this.select(e?Rue:Lue)}function Bue(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Vue(e){return function(t){e.call(this,t,this.__data__)}}function Hue(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 Uue(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 Wue(e,t,n){return function(){var r=this.__on,i,a=Vue(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 Gue(e,t,n){var r=Hue(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?Wue:Uue,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function v4(e,t,n){var r=d4(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 Kue(e,t){return function(){return v4(this,e,t)}}function que(e,t){return function(){return v4(this,e,t.apply(this,arguments))}}function Jue(e,t){return this.each((typeof t==`function`?que:Kue)(e,t))}function*Yue(){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 y4=[null];function b4(e,t){this._groups=e,this._parents=t}function x4(){return new b4([[document.documentElement]],y4)}function Xue(){return this}b4.prototype=x4.prototype={constructor:b4,select:Sle,selectAll:Ele,selectChild:Ale,selectChildren:Ple,filter:Fle,data:Vle,enter:Ile,exit:Ule,join:Wle,merge:Gle,selection:Xue,order:Kle,sort:qle,call:Yle,nodes:Xle,node:Zle,size:Qle,empty:$le,each:eue,attr:sue,style:due,property:hue,classed:yue,text:Cue,html:Due,raise:kue,lower:jue,append:Mue,insert:Pue,remove:Iue,clone:zue,datum:Bue,on:Gue,dispatch:Jue,[Symbol.iterator]:Yue};function S4(e){return typeof e==`string`?new b4([[document.querySelector(e)]],[document.documentElement]):new b4([[e]],y4)}function Zue(e){let t;for(;t=e.sourceEvent;)e=t;return e}function C4(e,t){if(e=Zue(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 Que={passive:!1},w4={capture:!0,passive:!1};function T4(e){e.stopImmediatePropagation()}function E4(e){e.preventDefault(),e.stopImmediatePropagation()}function D4(e){var t=e.document.documentElement,n=S4(e).on(`dragstart.drag`,E4,w4);`onselectstart`in t?n.on(`selectstart.drag`,E4,w4):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function O4(e,t){var n=e.document.documentElement,r=S4(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,E4,w4),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 k4=e=>()=>e;function A4(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}})}A4.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $ue(e){return!e.ctrlKey&&!e.button}function ede(){return this.parentNode}function tde(e,t){return t??{x:e.x,y:e.y}}function nde(){return navigator.maxTouchPoints||`ontouchstart`in this}function rde(){var e=$ue,t=ede,n=tde,r=nde,i={},a=$2(`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`,_,Que).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&&(S4(n.view).on(`mousemove.drag`,m,w4).on(`mouseup.drag`,h,w4),D4(n.view),T4(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(E4(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){S4(e.view).on(`mousemove.drag mouseup.drag`,null),O4(e.view,l),E4(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]))&&(T4(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])&&(E4(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])&&(T4(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=C4(l||r,t),p,m,h;if((h=n.call(e,new A4(`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=C4(l||a,t),_=o;break}u.call(r,e,new A4(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:k4(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:k4(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:k4(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:k4(!!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 j4(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function M4(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function N4(){}var P4=.7,F4=1/P4,I4=`\\s*([+-]?\\d+)\\s*`,L4=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,R4=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ide=/^#([0-9a-f]{3,8})$/,ade=RegExp(`^rgb\\(${I4},${I4},${I4}\\)$`),ode=RegExp(`^rgb\\(${R4},${R4},${R4}\\)$`),sde=RegExp(`^rgba\\(${I4},${I4},${I4},${L4}\\)$`),cde=RegExp(`^rgba\\(${R4},${R4},${R4},${L4}\\)$`),lde=RegExp(`^hsl\\(${L4},${R4},${R4}\\)$`),ude=RegExp(`^hsla\\(${L4},${R4},${R4},${L4}\\)$`),z4={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};j4(N4,H4,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:B4,formatHex:B4,formatHex8:dde,formatHsl:fde,formatRgb:V4,toString:V4});function B4(){return this.rgb().formatHex()}function dde(){return this.rgb().formatHex8()}function fde(){return e3(this).formatHsl()}function V4(){return this.rgb().formatRgb()}function H4(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ide.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?U4(t):n===3?new q4(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?W4(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?W4(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=ade.exec(e))?new q4(t[1],t[2],t[3],1):(t=ode.exec(e))?new q4(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=sde.exec(e))?W4(t[1],t[2],t[3],t[4]):(t=cde.exec(e))?W4(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=lde.exec(e))?$4(t[1],t[2]/100,t[3]/100,1):(t=ude.exec(e))?$4(t[1],t[2]/100,t[3]/100,t[4]):z4.hasOwnProperty(e)?U4(z4[e]):e===`transparent`?new q4(NaN,NaN,NaN,0):null}function U4(e){return new q4(e>>16&255,e>>8&255,e&255,1)}function W4(e,t,n,r){return r<=0&&(e=t=n=NaN),new q4(e,t,n,r)}function G4(e){return e instanceof N4||(e=H4(e)),e?(e=e.rgb(),new q4(e.r,e.g,e.b,e.opacity)):new q4}function K4(e,t,n,r){return arguments.length===1?G4(e):new q4(e,t,n,r??1)}function q4(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}j4(q4,K4,M4(N4,{brighter(e){return e=e==null?F4:F4**+e,new q4(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?P4:P4**+e,new q4(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new q4(Z4(this.r),Z4(this.g),Z4(this.b),X4(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:J4,formatHex:J4,formatHex8:pde,formatRgb:Y4,toString:Y4}));function J4(){return`#${Q4(this.r)}${Q4(this.g)}${Q4(this.b)}`}function pde(){return`#${Q4(this.r)}${Q4(this.g)}${Q4(this.b)}${Q4((isNaN(this.opacity)?1:this.opacity)*255)}`}function Y4(){let e=X4(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Z4(this.r)}, ${Z4(this.g)}, ${Z4(this.b)}${e===1?`)`:`, ${e})`}`}function X4(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Z4(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Q4(e){return e=Z4(e),(e<16?`0`:``)+e.toString(16)}function $4(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new t3(e,t,n,r)}function e3(e){if(e instanceof t3)return new t3(e.h,e.s,e.l,e.opacity);if(e instanceof N4||(e=H4(e)),!e)return new t3;if(e instanceof t3)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 t3(o,s,c,e.opacity)}function mde(e,t,n,r){return arguments.length===1?e3(e):new t3(e,t,n,r??1)}function t3(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}j4(t3,mde,M4(N4,{brighter(e){return e=e==null?F4:F4**+e,new t3(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?P4:P4**+e,new t3(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 q4(i3(e>=240?e-240:e+120,i,r),i3(e,i,r),i3(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new t3(n3(this.h),r3(this.s),r3(this.l),X4(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=X4(this.opacity);return`${e===1?`hsl(`:`hsla(`}${n3(this.h)}, ${r3(this.s)*100}%, ${r3(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function n3(e){return e=(e||0)%360,e<0?e+360:e}function r3(e){return Math.max(0,Math.min(1,e||0))}function i3(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 a3=e=>()=>e;function o3(e,t){return function(n){return e+n*t}}function hde(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function gde(e,t){var n=t-e;return n?o3(e,n>180||n<-180?n-360*Math.round(n/360):n):a3(isNaN(e)?t:e)}function _de(e){return(e=+e)==1?s3:function(t,n){return n-t?hde(t,n,e):a3(isNaN(t)?n:t)}}function s3(e,t){var n=t-e;return n?o3(e,n):a3(isNaN(e)?t:e)}var c3=(function e(t){var n=_de(t);function r(e,t){var r=n((e=K4(e)).r,(t=K4(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=s3(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 vde(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 yde(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bde(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]=p3(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 xde(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function l3(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Sde(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]=p3(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var u3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,d3=new RegExp(u3.source,`g`);function Cde(e){return function(){return e}}function wde(e){return function(t){return e(t)+``}}function f3(e,t){var n=u3.lastIndex=d3.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=u3.exec(e))&&(i=d3.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:l3(r,i)})),n=d3.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?wde(c[0].x):Cde(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 p3(e,t){var n=typeof t,r;return t==null||n===`boolean`?a3(t):(n===`number`?l3:n===`string`?(r=H4(t))?(t=r,c3):f3:t instanceof H4?c3:t instanceof Date?xde:yde(t)?vde:Array.isArray(t)?bde:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Sde:l3)(e,t)}var m3=180/Math.PI,h3={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function g3(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)*m3,skewX:Math.atan(c)*m3,scaleX:o,scaleY:s}}var _3;function Tde(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?h3:g3(t.a,t.b,t.c,t.d,t.e,t.f)}function Ede(e){return e==null||(_3||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),_3.setAttribute(`transform`,e),!(e=_3.transform.baseVal.consolidate()))?h3:(e=e.matrix,g3(e.a,e.b,e.c,e.d,e.e,e.f))}function v3(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:l3(e,i)},{i:c-2,x:l3(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:l3(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:l3(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:l3(e,n)},{i:s-2,x:l3(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 Dde=v3(Tde,`px, `,`px)`,`deg)`),Ode=v3(Ede,`, `,`)`,`)`),kde=1e-12;function y3(e){return((e=Math.exp(e))+1/e)/2}function Ade(e){return((e=Math.exp(e))-1/e)/2}function jde(e){return((e=Math.exp(2*e))-1)/(e+1)}var b3=(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<kde)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=y3(y),c=s/(n*g)*(i*jde(t*r+y)-Ade(y));return[a+c*d,o+c*f,s*i/y3(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),x3=0,S3=0,C3=0,w3=1e3,T3,E3,D3=0,O3=0,k3=0,A3=typeof performance==`object`&&performance.now?performance:Date,j3=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function M3(){return O3||=(j3(Mde),A3.now()+k3)}function Mde(){O3=0}function N3(){this._call=this._time=this._next=null}N3.prototype=P3.prototype={constructor:N3,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?M3():+n)+(t==null?0:+t),!this._next&&E3!==this&&(E3?E3._next=this:T3=this,E3=this),this._call=e,this._time=n,I3()},stop:function(){this._call&&(this._call=null,this._time=1/0,I3())}};function P3(e,t,n){var r=new N3;return r.restart(e,t,n),r}function Nde(){M3(),++x3;for(var e=T3,t;e;)(t=O3-e._time)>=0&&e._call.call(void 0,t),e=e._next;--x3}function F3(){O3=(D3=A3.now())+k3,x3=S3=0;try{Nde()}finally{x3=0,Fde(),O3=0}}function Pde(){var e=A3.now(),t=e-D3;t>w3&&(k3-=t,D3=e)}function Fde(){for(var e,t=T3,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:T3=n);E3=e,I3(r)}function I3(e){x3||(S3&&=clearTimeout(S3),e-O3>24?(e<1/0&&(S3=setTimeout(F3,e-A3.now()-k3)),C3&&=clearInterval(C3)):(C3||=(D3=A3.now(),setInterval(Pde,w3)),x3=1,j3(F3)))}function L3(e,t,n){var r=new N3;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Ide=$2(`start`,`end`,`cancel`,`interrupt`),Lde=[];function R3(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Rde(e,n,{name:t,index:r,group:i,on:Ide,tween:Lde,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function z3(e,t){var n=V3(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function B3(e,t){var n=V3(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function V3(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Rde(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=P3(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 L3(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(L3(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 H3(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 zde(e){return this.each(function(){H3(this,e)})}function Bde(e,t){var n,r;return function(){var i=B3(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 Vde(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=B3(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 Hde(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=V3(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?Bde:Vde)(n,e,t))}function U3(e,t,n){var r=e._id;return e.each(function(){var e=B3(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return V3(e,r).value[t]}}function W3(e,t){var n;return(typeof t==`number`?l3:t instanceof H4?c3:(n=H4(t))?(t=n,c3):f3)(e,t)}function Ude(e){return function(){this.removeAttribute(e)}}function Wde(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Gde(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 Kde(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 qde(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 Jde(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 Yde(e,t){var n=r4(e),r=n===`transform`?Ode:W3;return this.attrTween(e,typeof t==`function`?(n.local?Jde:qde)(n,r,U3(this,`attr.`+e,t)):t==null?(n.local?Wde:Ude)(n):(n.local?Kde:Gde)(n,r,t))}function Xde(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Zde(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Qde(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Zde(e,i)),n}return i._value=t,i}function $de(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Xde(e,i)),n}return i._value=t,i}function efe(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=r4(e);return this.tween(n,(r.local?Qde:$de)(r,t))}function tfe(e,t){return function(){z3(this,e).delay=+t.apply(this,arguments)}}function nfe(e,t){return t=+t,function(){z3(this,e).delay=t}}function rfe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?tfe:nfe)(t,e)):V3(this.node(),t).delay}function ife(e,t){return function(){B3(this,e).duration=+t.apply(this,arguments)}}function afe(e,t){return t=+t,function(){B3(this,e).duration=t}}function ofe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ife:afe)(t,e)):V3(this.node(),t).duration}function sfe(e,t){if(typeof t!=`function`)throw Error();return function(){B3(this,e).ease=t}}function cfe(e){var t=this._id;return arguments.length?this.each(sfe(t,e)):V3(this.node(),t).ease}function lfe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();B3(this,e).ease=n}}function ufe(e){if(typeof e!=`function`)throw Error();return this.each(lfe(this._id,e))}function dfe(e){typeof e!=`function`&&(e=s4(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 K3(r,this._parents,this._name,this._id)}function ffe(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 K3(o,this._parents,this._name,this._id)}function pfe(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 mfe(e,t,n){var r,i,a=pfe(t)?z3:B3;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function hfe(e,t){var n=this._id;return arguments.length<2?V3(this.node(),n).on.on(e):this.each(mfe(n,e,t))}function gfe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _fe(){return this.on(`end.remove`,gfe(this._id))}function vfe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=a4(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,R3(l[f],t,n,f,l,V3(u,n)));return new K3(a,this._parents,t,n)}function yfe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=o4(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=V3(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&R3(p,t,n,h,f,m);a.push(f),o.push(u)}return new K3(a,o,t,n)}var bfe=x4.prototype.constructor;function xfe(){return new bfe(this._groups,this._parents)}function Sfe(e,t){var n,r,i;return function(){var a=f4(this,e),o=(this.style.removeProperty(e),f4(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function G3(e){return function(){this.style.removeProperty(e)}}function Cfe(e,t,n){var r,i=n+``,a;return function(){var o=f4(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function wfe(e,t,n){var r,i,a;return function(){var o=f4(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),f4(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Tfe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=B3(this,e),l=c.on,u=c.value[a]==null?s||=G3(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Efe(e,t,n){var r=(e+=``)==`transform`?Dde:W3;return t==null?this.styleTween(e,Sfe(e,r)).on(`end.style.`+e,G3(e)):typeof t==`function`?this.styleTween(e,wfe(e,r,U3(this,`style.`+e,t))).each(Tfe(this._id,e)):this.styleTween(e,Cfe(e,r,t),n).on(`end.style.`+e,null)}function Dfe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ofe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Dfe(e,a,n)),r}return a._value=t,a}function kfe(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,Ofe(e,t,n??``))}function Afe(e){return function(){this.textContent=e}}function jfe(e){return function(){var t=e(this);this.textContent=t??``}}function Mfe(e){return this.tween(`text`,typeof e==`function`?jfe(U3(this,`text`,e)):Afe(e==null?``:e+``))}function Nfe(e){return function(t){this.textContent=e.call(this,t)}}function Pfe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Nfe(r)),t}return r._value=e,r}function Ffe(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,Pfe(e))}function Ife(){for(var e=this._name,t=this._id,n=q3(),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=V3(c,t);R3(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new K3(r,this._parents,e,n)}function Lfe(){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=B3(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 Rfe=0;function K3(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function zfe(e){return x4().transition(e)}function q3(){return++Rfe}var J3=x4.prototype;K3.prototype=zfe.prototype={constructor:K3,select:vfe,selectAll:yfe,selectChild:J3.selectChild,selectChildren:J3.selectChildren,filter:dfe,merge:ffe,selection:xfe,transition:Ife,call:J3.call,nodes:J3.nodes,node:J3.node,size:J3.size,empty:J3.empty,each:J3.each,on:hfe,attr:Yde,attrTween:efe,style:Efe,styleTween:kfe,text:Mfe,textTween:Ffe,remove:_fe,tween:Hde,delay:rfe,duration:ofe,ease:cfe,easeVarying:ufe,end:Lfe,[Symbol.iterator]:J3[Symbol.iterator]};function Bfe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Vfe={time:null,delay:0,duration:250,ease:Bfe};function Hfe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ufe(e){var t,n;e instanceof K3?(t=e._id,e=e._name):(t=q3(),(n=Vfe).time=M3(),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])&&R3(c,e,t,l,o,n||Hfe(c,t));return new K3(r,this._parents,e,t)}x4.prototype.interrupt=zde,x4.prototype.transition=Ufe;var Y3=e=>()=>e;function Wfe(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 X3(e,t,n){this.k=e,this.x=t,this.y=n}X3.prototype={constructor:X3,scale:function(e){return e===1?this:new X3(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X3(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 Z3=new X3(1,0,0);Q3.prototype=X3.prototype;function Q3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Z3;return e.__zoom}function $3(e){e.stopImmediatePropagation()}function e6(e){e.preventDefault(),e.stopImmediatePropagation()}function Gfe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Kfe(){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 t6(){return this.__zoom||Z3}function qfe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Jfe(){return navigator.maxTouchPoints||`ontouchstart`in this}function Yfe(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 n6(){var e=Gfe,t=Kfe,n=Yfe,r=qfe,i=Jfe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=b3,l=$2(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,t6).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`,t6),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(Z3.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 X3(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 X3(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 X3(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=S4(this.that).datum();l.call(e,this.that,new Wfe(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=C4(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)],H3(this),s.start();e6(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=S4(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=C4(t,i),l=t.clientX,u=t.clientY;D4(t.view),$3(t),a.mouse=[c,this.__zoom.invert(c)],H3(this),a.start();function d(e){if(e6(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]=C4(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),O4(e.view,a.moved),e6(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=C4(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);e6(r),s>0?S4(this).transition().duration(s).call(x,d,c,r):S4(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($3(t),s=0;s<i;++s)c=r[s],l=C4(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)),H3(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(e6(e),s=0;s<a;++s)c=i[s],l=C4(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($3(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=C4(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=S4(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Y3(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Y3(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Y3(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Y3([[+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 r6={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.`},i6=[[-1/0,-1/0],[1/0,1/0]],a6=[`Enter`,` `,`Escape`],Xfe={"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`},o6;(function(e){e.Strict=`strict`,e.Loose=`loose`})(o6||={});var s6;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(s6||={});var c6;(function(e){e.Partial=`partial`,e.Full=`full`})(c6||={});var l6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},u6;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(u6||={});var d6;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(d6||={});var f6;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(f6||={});var p6={[f6.Left]:f6.Right,[f6.Right]:f6.Left,[f6.Top]:f6.Bottom,[f6.Bottom]:f6.Top};function Zfe(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 m6(e,t,n){if(!n)return;let r=[];e.forEach((e,n)=>{t?.has(n)||r.push(e)}),r.length&&n(r)}function Qfe(e){return e===null?null:e?`valid`:`invalid`}var h6=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,$fe=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),g6=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),_6=(e,t=[0,0])=>{let{width:n,height:r}=W6(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},epe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:O6(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):g6(n)?n:t.nodeLookup.get(n.id)),E6(e,i?A6(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),v6=(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=E6(n,A6(e)),r=!0)}),r?O6(n):{x:0,y:0,width:0,height:0}},y6=(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=M6(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},tpe=(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 npe(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}=W6(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 rpe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=V6(v6(npe(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 b6({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`,r6.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&U6(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=U6(d)?S6(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,r6.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 ipe({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=tpe(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 x6=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),S6=(e={x:0,y:0},t,n)=>({x:x6(e.x,t[0][0],t[1][0]-(n?.width??0)),y:x6(e.y,t[0][1],t[1][1]-(n?.height??0))});function C6(e,t,n){let{width:r,height:i}=W6(n),{x:a,y:o}=n.internals.positionAbsolute;return S6(e,[[a,o],[a+r,o+i]],t)}var w6=(e,t,n)=>e<t?x6(Math.abs(e-t),1,t)/t:e>n?-x6(Math.abs(e-n),1,t)/t:0,T6=(e,t,n=15,r=40)=>[w6(e.x,r,t.width-r)*n,w6(e.y,r,t.height-r)*n],E6=(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)}),D6=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),O6=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),k6=(e,t=[0,0])=>{let{x:n,y:r}=g6(e)?e.internals.positionAbsolute:_6(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}},A6=(e,t=[0,0])=>{let{x:n,y:r}=g6(e)?e.internals.positionAbsolute:_6(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)}},j6=(e,t)=>O6(E6(D6(e),D6(t))),M6=(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)},N6=(e,t)=>M6(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),P6=e=>F6(e.width)&&F6(e.height)&&F6(e.x)&&F6(e.y),F6=e=>!isNaN(e)&&isFinite(e),I6=(e,t)=>(e,t)=>{},L6=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),R6=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?L6(s,o):s},z6=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function B6(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 ape(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=B6(e,n),i=B6(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=B6(e.top??e.y??0,n),i=B6(e.bottom??e.y??0,n),a=B6(e.left??e.x??0,t),o=B6(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 ope(e,t,n,r,i,a){let{x:o,y:s}=z6(e,[t,n,r]),{x:c,y:l}=z6({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 V6=(e,t,n,r,i,a)=>{let o=ape(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=x6(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=ope(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}},H6=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function U6(e){return e!=null&&e!==`parent`}function W6(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function G6(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function spe(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 cpe(e){return{...Xfe,...e||{}}}function K6(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Z6(e),s=R6({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?L6(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var q6=e=>({width:e.offsetWidth,height:e.offsetHeight}),J6=e=>e?.getRootNode?.()||window?.document,lpe=[`INPUT`,`SELECT`,`TEXTAREA`];function Y6(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?lpe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var X6=e=>`clientX`in e,Z6=(e,t)=>{let n=X6(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)}},Q6=(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,...q6(t)}})};function upe({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 $6(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function e8({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case f6.Left:return[t-$6(t-r,a),n];case f6.Right:return[t+$6(r-t,a),n];case f6.Top:return[t,n-$6(n-i,a)];case f6.Bottom:return[t,n+$6(i-n,a)]}}function t8({sourceX:e,sourceY:t,sourcePosition:n=f6.Bottom,targetX:r,targetY:i,targetPosition:a=f6.Top,curvature:o=.25}){let[s,c]=e8({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=e8({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=upe({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 n8({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 dpe({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 fpe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=E6(A6(e),A6(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),N6({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},O6(a))>0}var ppe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,mpe=(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)),hpe=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,r6.error006()),t;let r=n.getEdgeId||ppe,i;return i=h6(e)?{...e}:{...e,id:r(e)},mpe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function r8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=n8({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var i8={[f6.Left]:{x:-1,y:0},[f6.Right]:{x:1,y:0},[f6.Top]:{x:0,y:-1},[f6.Bottom]:{x:0,y:1}},gpe=({source:e,sourcePosition:t=f6.Bottom,target:n})=>t===f6.Left||t===f6.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},a8=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function _pe({source:e,sourcePosition:t=f6.Bottom,target:n,targetPosition:r=f6.Top,center:i,offset:a,stepPosition:o}){let s=i8[t],c=i8[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=gpe({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]=n8({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 vpe(e,t,n,r){let i=Math.min(a8(e,t)/2,a8(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 o8({sourceX:e,sourceY:t,sourcePosition:n=f6.Bottom,targetX:r,targetY:i,targetPosition:a=f6.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=_pe({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+=vpe(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 s8(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ype(e){let{sourceNode:t,targetNode:n}=e;if(!s8(t)||!s8(n))return null;let r=t.internals.handleBounds||c8(t.handles),i=n.internals.handleBounds||c8(n.handles),a=u8(r?.source??[],e.sourceHandle),o=u8(e.connectionMode===o6.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,r6.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||f6.Bottom,c=o?.position||f6.Top,l=l8(t,a,s),u=l8(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function c8(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 l8(e,t,n=f6.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??W6(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case f6.Top:return{x:i+o/2,y:a};case f6.Right:return{x:i+o,y:a+s/2};case f6.Bottom:return{x:i+o/2,y:a+s};case f6.Left:return{x:i,y:a+s/2}}}function u8(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function d8(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function bpe(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=d8(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 f8=1e3,xpe=10,p8={nodeOrigin:[0,0],nodeExtent:i6,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Spe={...p8,checkEquality:!0};function m8(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Cpe(e,t,n){let r=m8(p8,n);for(let n of e.values())if(n.parentId)g8(n,e,t,r);else{let e=S6(_6(n,r.nodeOrigin),U6(n.extent)?n.extent:r.nodeExtent,W6(n));n.internals.positionAbsolute=e}}function wpe(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 h8(e){return e===`manual`}function Tpe(e,t,n,r={}){let i=m8(Spe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!h8(i.zIndexMode)?f8: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=S6(_6(u,i.nodeOrigin),U6(u.extent)?u.extent:i.nodeExtent,W6(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:wpe(u,e),z:_8(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&&g8(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Epe(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 g8(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=m8(p8,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}Epe(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*xpe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Dpe(e,u,o,s,a&&!h8(c)?f8: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 _8(e,t,n){let r=F6(e.zIndex)?e.zIndex:0;return h8(n)?r:r+(e.selected?t:0)}function Dpe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=W6(e),l=_6(e,n),u=U6(e.extent)?S6(l,e.extent,c):l,d=S6({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=C6(d,c,t));let f=_8(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Ope(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=j6(a.get(n.parentId)?.expandedRect??k6(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=W6(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 kpe(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=q6(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=U6(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=C6(h,s,n))}else m&&(h=S6(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Q6(`source`,r.nodeElement,p,d,e.id),target:Q6(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&g8(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:k6(g,i)}))}}if(f.length>0){let e=Ope(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Ape({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 v8(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 jpe(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}`;v8(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),v8(`target`,s,c,e,i,o),t.set(r.id,r)}}function y8(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:y8(n,t):!1}function b8(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 Mpe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!y8(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 x8({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 Npe({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=L6(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Ppe({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=S4(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?D6(v6(s)):null,x=v&&l?Npe({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)}:L6(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}=b6({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]=x8({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]=T6(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=K6(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Mpe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=x8({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=rde().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=K6(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Z6(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=K6(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=Z6(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=Z6(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]=x8({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||!b8(t,`.${g}`,v))&&(!_||b8(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Fpe(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())N6(i,k6(e))>0&&r.push(e);return r}var Ipe=250;function Lpe(e,t,n,r){let i=[],a=1/0,o=Fpe(e,n,t+Ipe);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}=l8(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 S8(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,...l8(o,c,c.position,!0)}:c}function C8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Rpe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var w8=()=>!0;function zpe(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:_=w8,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=J6(e.target),E=0,D,{x:O,y:ee}=Z6(e),te=C8(a,w),k=s?.getBoundingClientRect(),A=!1;if(!k||!te)return;let ne=S8(i,te,r,c,t);if(!ne)return;let j=Z6(e,k),M=!1,re=null,ie=!1,N=null;function ae(){if(!u||!k)return;let[e,t]=T6(j,k,S);f({x:e,y:t}),E=requestAnimationFrame(ae)}let oe={...ne,nodeId:i,type:te,position:ne.position},se=c.get(i),ce={inProgress:!0,isValid:null,from:l8(se,oe,f6.Left,!0),fromHandle:oe,fromPosition:oe.position,fromNode:se,to:j,toHandle:null,toPosition:p6[oe.position],toNode:null,pointer:j};function P(){A=!0,y(ce),m?.(e,{nodeId:i,handleId:r,handleType:te})}C===0&&P();function le(e){if(!A){let{x:t,y:n}=Z6(e),r=t-O,i=n-ee;if(!(r*r+i*i>C*C))return;P()}if(!x()||!oe){ue(e);return}let a=b();j=Z6(e,k),D=Lpe(R6(j,a,!1,[1,1]),n,c,oe),M||=(ae(),!0);let s=T8(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});N=s.handleDomNode,re=s.connection,ie=Rpe(!!D,s.isValid);let u=c.get(i),f=u?l8(u,oe,f6.Left,!0):ce.from,p={...ce,from:f,isValid:ie,to:s.toHandle&&ie?z6({x:s.toHandle.x,y:s.toHandle.y},a):j,toHandle:s.toHandle,toPosition:ie&&s.toHandle?s.toHandle.position:p6[oe.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:j};y(p),ce=p}function ue(e){if(!(`touches`in e&&e.touches.length>0)){if(A){(D||N)&&re&&ie&&h?.(re);let{inProgress:t,...n}=ce,r={...n,toPosition:ce.toHandle?ce.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),M=!1,ie=!1,re=null,N=null,T.removeEventListener(`mousemove`,le),T.removeEventListener(`mouseup`,ue),T.removeEventListener(`touchmove`,le),T.removeEventListener(`touchend`,ue)}}T.addEventListener(`mousemove`,le),T.addEventListener(`mouseup`,ue),T.addEventListener(`touchmove`,le),T.addEventListener(`touchend`,ue)}function T8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=w8,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}=Z6(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=C8(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===o6.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=S8(t,e,a,u,n,!0)}return _}var E8={onPointerDown:zpe,isValid:T8};function Bpe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=S4(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&&H6()?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=n6().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:C4}}var D8=e=>({x:e.x,y:e.y,zoom:e.k}),O8=({x:e,y:t,zoom:n})=>Z3.translate(e,t).scale(n),k8=(e,t)=>e.target.closest(`.${t}`),A8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vpe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,j8=(e,t=0,n=Vpe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},M8=e=>{let t=e.ctrlKey&&H6()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Hpe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(k8(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=C4(u),t=d*2**M8(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===s6.Vertical?0:u.deltaX*f,m=i===s6.Horizontal?0:u.deltaY*f;!H6()&&u.shiftKey&&i!==s6.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=D8(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 Upe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=k8(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Wpe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=D8(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 Gpe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&A8(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,D8(a.transform))}}function Kpe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&A8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=D8(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function qpe({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`&&(k8(d,`${l}-flow__node`)||k8(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||k8(d,s)&&m||k8(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 Jpe({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=n6().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=S4(e).call(f);y({x:i.x,y:i.y,zoom:x6(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(M8);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?p3:b3).transform(j8(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:!F6(E)||E<0?0:E);let ee=O?Hpe({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Upe({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,ee,{passive:!1});let te=Wpe({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,te);let k=Gpe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,k);let A=Kpe({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,A);let ne=qpe({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=O8(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=O8(e);return await g(n,t),n}function x(e){if(p){let t=O8(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?Q3(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`?p3:b3).scaleTo(j8(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?p3:b3).scaleBy(j8(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=!F6(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 Ype;(function(e){e.Line=`line`,e.Handle=`handle`})(Ype||={});var Xpe=I6(`Svelte Flow`,`https://svelteflow.dev/`);function Zpe(e,t,n={}){return hpe(e,t,{...n,onError:n.onError??Xpe})}function N8(){let e={};return[t=>{if(t&&!S(e))throw Error(t);return c(e)},t=>ve(e,t)]}var[Qpe,$pe]=N8(),[eme,tme]=N8(),[nme,rme]=N8(),ime=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`type`,`position`,`style`,`class`,`isConnectable`,`isConnectableStart`,`isConnectableEnd`,`isValidConnection`,`onconnect`,`ondisconnect`,`children`]),ame=h(`<div><!></div>`);function P8(e,t){a(t,!0);let n=F(t,`id`,3,null),r=F(t,`type`,3,`source`),i=F(t,`position`,19,()=>f6.Top),o=F(t,`isConnectableStart`,3,!0),s=F(t,`isConnectableEnd`,3,!0),c=H(t,ime),l=Qpe(`Handle must be used within a Custom Node component`),f=eme(`Handle must be used within a Custom Node component`),p=q(()=>r()===`target`),m=q(()=>t.isConnectable===void 0?f.value:t.isConnectable),h=G8(),_=q(()=>h.ariaLabelConfig),v=null;je(()=>{if(t.onconnect||t.ondisconnect){h.edges;let e=h.connectionLookup.get(`${l}-${r()}${n()?`-${n()}`:``}`);if(v&&!Zfe(e,v)){let n=e??new Map;m6(v,n,t.ondisconnect),m6(n,v,t.onconnect)}v=new Map(e)}});let b=q(()=>{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===o6.Strict?e?.type!==r():l!==e?.nodeId||n()!==e?.id,o&&i]}),x=q(()=>Ie(W(b),5)),S=q(()=>W(x)[0]),C=q(()=>W(x)[1]),w=q(()=>W(x)[2]),T=q(()=>W(x)[3]),E=q(()=>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=X6(e);e.currentTarget&&(r&&e.button===0||!r)&&E8.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=J6(e.target),a=t.isValidConnection??h.isValidConnection,{connectionMode:s,clickConnectStartHandle:c,flowId:u,nodeLookup:d}=h,{connection:f,isValid:p}=E8.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=ame(),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,[oe]:{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),R()}var ome=h(`<!> <!>`,1);function F8(e,t){a(t,!0);let n=F(t,`targetPosition`,19,()=>f6.Top),r=F(t,`sourcePosition`,19,()=>f6.Bottom);var i=ome(),o=L(i);P8(o,{type:`target`,get position(){return n()}});var s=I(o);P8(I(s),{type:`source`,get position(){return r()}}),P(()=>A(s,` ${t.data?.label??``} `)),g(e,i),R()}var sme=h(` <!>`,1);function cme(e,t){a(t,!0);let n=F(t,`data`,19,()=>({label:`Node`})),r=F(t,`sourcePosition`,19,()=>f6.Bottom);w();var i=sme(),o=L(i);P8(I(o),{type:`source`,get position(){return r()}}),P(()=>A(o,`${n()?.label??``} `)),g(e,i),R()}var lme=h(` <!>`,1);function ume(e,t){a(t,!0);let n=F(t,`data`,19,()=>({label:`Node`})),r=F(t,`targetPosition`,19,()=>f6.Top);w();var i=lme(),o=L(i);P8(I(o),{type:`target`,get position(){return r()}}),P(()=>A(o,`${n()?.label??``} `)),g(e,i),R()}function dme(e,t){}function I8(e,t,n){if(!n||!t)return;let r=n===`root`?t:t.querySelector(`.svelte-flow__${n}`);r&&r.appendChild(e)}function fme(e,t){let n=q(G8),r=q(()=>W(n).domNode),i;return W(r)?I8(e,W(r),t):i=De(()=>{z(()=>{I8(e,W(r),t),i?.()})}),{async update(t){I8(e,W(r),t)},destroy(){e.parentNode&&e.parentNode.removeChild(e),i?.()}}}function pme(){let e=J(typeof window>`u`);if(W(e)){let t=De(()=>{z(()=>{G(e,!1),t?.()})})}return{get value(){return W(e)}}}var L8=e=>$fe(e),mme=e=>h6(e);function R8(e){return e===void 0?void 0:`${e}px`}var z8={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hme=new Set([`$$slots`,`$$events`,`$$legacy`,`x`,`y`,`width`,`height`,`selectEdgeOnClick`,`transparent`,`class`,`children`]),gme=h(`<div><!></div>`);function _me(e,t){a(t,!0);let n=F(t,`x`,3,0),r=F(t,`y`,3,0),o=F(t,`selectEdgeOnClick`,3,!1),s=F(t,`transparent`,3,!1),c=H(t,hme),l=G8(),f=nme(`EdgeLabel must be used within a Custom Edge component`),p=q(()=>l.visible.edges.get(f)?.zIndex);var m=gme(),h=()=>{o()&&f&&l.handleEdgeSelection(f)};O(m,e=>({class:[`svelte-flow__edge-label`,{transparent:s()},t.class],tabindex:`-1`,onclick:h,...c,[Ne]:e}),[()=>({display:pme().value?`none`:void 0,cursor:o()?`pointer`:void 0,transform:`translate(-50%, -50%) translate(${n()??``}px,${r()??``}px)`,"pointer-events":`all`,width:R8(t.width),height:R8(t.height),"z-index":W(p)})],void 0,void 0,`svelte-lqczsv`),u(V(m),()=>t.children??D),d(m),i(m,(e,t)=>fme?.(e,t),()=>`edge-labels`),g(e,m),R()}var vme=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`path`,`label`,`labelX`,`labelY`,`labelStyle`,`markerStart`,`markerEnd`,`style`,`interactionWidth`,`class`]),yme=j(`<path></path>`),bme=j(`<path fill="none"></path><!><!>`,1);function B8(e,t){let n=F(t,`interactionWidth`,3,20),r=H(t,vme);var i=bme(),a=L(i),o=I(a),c=e=>{var i=yme();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=I(o),d=e=>{_me(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();P(()=>A(r,t.label)),g(e,r)},$$slots:{default:!0}})};k(u,e=>{t.label&&e(d)}),P(()=>{K(a,`id`,t.id),K(a,`d`,t.path),s(a,0,x([`svelte-flow__edge-path`,t.class])),K(a,`marker-start`,t.markerStart),K(a,`marker-end`,t.markerEnd),l(a,t.style)}),g(e,i)}function V8(e,t){a(t,!0);let n=q(()=>t8({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,curvature:t.pathOptions?.curvature})),r=q(()=>Ie(W(n),3)),i=q(()=>W(r)[0]),o=q(()=>W(r)[1]),s=q(()=>W(r)[2]);B8(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}}),R()}function xme(e,t){a(t,!0);let n=q(()=>o8({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition})),r=q(()=>Ie(W(n),3)),i=q(()=>W(r)[0]),o=q(()=>W(r)[1]),s=q(()=>W(r)[2]);B8(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}}),R()}function Sme(e,t){a(t,!0);let n=q(()=>r8({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY})),r=q(()=>Ie(W(n),3)),i=q(()=>W(r)[0]),o=q(()=>W(r)[1]),s=q(()=>W(r)[2]);B8(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}}),R()}function Cme(e,t){a(t,!0);let n=q(()=>o8({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,borderRadius:0})),r=q(()=>Ie(W(n),3)),i=q(()=>W(r)[0]),o=q(()=>W(r)[1]),s=q(()=>W(r)[2]);B8(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}}),R()}function wme(e,t,n,r){let i=new Map;return y6(e,{x:0,y:0,width:n,height:r},t,!0).forEach(e=>{i.set(e.id,e)}),i}function H8(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(fpe({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=ype({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:dpe({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 Tme=I6(`Svelte Flow`,`https://svelteflow.dev/`),U8={input:cme,output:ume,default:F8,group:dme},W8={straight:Sme,smoothstep:xme,default:V8,step:Cme};function Eme(e,t,n,r,i,a){return t&&!n&&r&&i?V6(v6(a,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),r,i,.5,2,.1):n??{x:0,y:0,zoom:1}}function Dme(e){class t{#e=q(()=>e.props.id??`1`);get flowId(){return W(this.#e)}set flowId(e){G(this.#e,e)}#t=J(null);get domNode(){return W(this.#t)}set domNode(e){G(this.#t,e)}#n=J(null);get panZoom(){return W(this.#n)}set panZoom(e){G(this.#n,e)}#r=J(e.width??0);get width(){return W(this.#r)}set width(e){G(this.#r,e)}#i=J(e.height??0);get height(){return W(this.#i)}set height(e){G(this.#i,e)}#a=J(e.props.zIndexMode??`basic`);get zIndexMode(){return W(this.#a)}set zIndexMode(e){G(this.#a,e)}#o=q(()=>{let{nodesInitialized:t}=Tpe(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){G(this.#o,e)}#s=q(()=>this.panZoom!==null);get viewportInitialized(){return W(this.#s)}set viewportInitialized(e){G(this.#s,e)}#c=q(()=>(jpe(this.connectionLookup,this.edgeLookup,e.edges),e.edges));get _edges(){return W(this.#c)}set _edges(e){G(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=q(()=>{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){G(this.#l,e)}_prevSelectedEdges=[];_prevSelectedEdgeIds=new Set;#u=q(()=>{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){G(this.#u,e)}selectionChangeHandlers=new Map;nodeLookup=new Map;parentLookup=new Map;connectionLookup=new Map;edgeLookup=new Map;_prevVisibleEdges=new Map;#d=q(()=>{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=wme(i,r,t,n),d=H8({...f,onlyRenderVisible:!0,visibleNodes:u,transform:r,width:t,height:n})}else u=this.nodeLookup,d=H8(f);return{nodes:u,edges:d}});get visible(){return W(this.#d)}set visible(e){G(this.#d,e)}#f=q(()=>e.props.nodesDraggable??!0);get nodesDraggable(){return W(this.#f)}set nodesDraggable(e){G(this.#f,e)}#p=q(()=>e.props.nodesConnectable??!0);get nodesConnectable(){return W(this.#p)}set nodesConnectable(e){G(this.#p,e)}#m=q(()=>e.props.elementsSelectable??!0);get elementsSelectable(){return W(this.#m)}set elementsSelectable(e){G(this.#m,e)}#h=q(()=>e.props.nodesFocusable??!0);get nodesFocusable(){return W(this.#h)}set nodesFocusable(e){G(this.#h,e)}#g=q(()=>e.props.edgesFocusable??!0);get edgesFocusable(){return W(this.#g)}set edgesFocusable(e){G(this.#g,e)}#_=q(()=>e.props.disableKeyboardA11y??!1);get disableKeyboardA11y(){return W(this.#_)}set disableKeyboardA11y(e){G(this.#_,e)}#v=q(()=>e.props.minZoom??.5);get minZoom(){return W(this.#v)}set minZoom(e){G(this.#v,e)}#y=q(()=>e.props.maxZoom??2);get maxZoom(){return W(this.#y)}set maxZoom(e){G(this.#y,e)}#b=q(()=>e.props.nodeOrigin??[0,0]);get nodeOrigin(){return W(this.#b)}set nodeOrigin(e){G(this.#b,e)}#x=q(()=>e.props.nodeExtent??i6);get nodeExtent(){return W(this.#x)}set nodeExtent(e){G(this.#x,e)}#S=q(()=>e.props.translateExtent??i6);get translateExtent(){return W(this.#S)}set translateExtent(e){G(this.#S,e)}#C=q(()=>e.props.defaultEdgeOptions??{});get defaultEdgeOptions(){return W(this.#C)}set defaultEdgeOptions(e){G(this.#C,e)}#w=q(()=>e.props.nodeDragThreshold??1);get nodeDragThreshold(){return W(this.#w)}set nodeDragThreshold(e){G(this.#w,e)}#T=q(()=>e.props.autoPanOnNodeDrag??!0);get autoPanOnNodeDrag(){return W(this.#T)}set autoPanOnNodeDrag(e){G(this.#T,e)}#E=q(()=>e.props.autoPanOnConnect??!0);get autoPanOnConnect(){return W(this.#E)}set autoPanOnConnect(e){G(this.#E,e)}#D=q(()=>e.props.autoPanOnNodeFocus??!0);get autoPanOnNodeFocus(){return W(this.#D)}set autoPanOnNodeFocus(e){G(this.#D,e)}#O=q(()=>e.props.autoPanSpeed??15);get autoPanSpeed(){return W(this.#O)}set autoPanSpeed(e){G(this.#O,e)}#k=q(()=>e.props.connectionDragThreshold??1);get connectionDragThreshold(){return W(this.#k)}set connectionDragThreshold(e){G(this.#k,e)}fitViewQueued=e.props.fitView??!1;fitViewOptions=e.props.fitViewOptions;fitViewResolver=null;#A=q(()=>e.props.snapGrid??null);get snapGrid(){return W(this.#A)}set snapGrid(e){G(this.#A,e)}#j=J(!1);get dragging(){return W(this.#j)}set dragging(e){G(this.#j,e)}#M=J(null);get selectionRect(){return W(this.#M)}set selectionRect(e){G(this.#M,e)}#N=J(!1);get selectionKeyPressed(){return W(this.#N)}set selectionKeyPressed(e){G(this.#N,e)}#P=J(!1);get multiselectionKeyPressed(){return W(this.#P)}set multiselectionKeyPressed(e){G(this.#P,e)}#F=J(!1);get deleteKeyPressed(){return W(this.#F)}set deleteKeyPressed(e){G(this.#F,e)}#I=J(!1);get panActivationKeyPressed(){return W(this.#I)}set panActivationKeyPressed(e){G(this.#I,e)}#L=J(!1);get zoomActivationKeyPressed(){return W(this.#L)}set zoomActivationKeyPressed(e){G(this.#L,e)}#R=J(null);get selectionRectMode(){return W(this.#R)}set selectionRectMode(e){G(this.#R,e)}#z=J(``);get ariaLiveMessage(){return W(this.#z)}set ariaLiveMessage(e){G(this.#z,e)}#B=q(()=>e.props.selectionMode??c6.Partial);get selectionMode(){return W(this.#B)}set selectionMode(e){G(this.#B,e)}#V=q(()=>({...U8,...e.props.nodeTypes}));get nodeTypes(){return W(this.#V)}set nodeTypes(e){G(this.#V,e)}#H=q(()=>({...W8,...e.props.edgeTypes}));get edgeTypes(){return W(this.#H)}set edgeTypes(e){G(this.#H,e)}#U=q(()=>e.props.noPanClass??`nopan`);get noPanClass(){return W(this.#U)}set noPanClass(e){G(this.#U,e)}#W=q(()=>e.props.noDragClass??`nodrag`);get noDragClass(){return W(this.#W)}set noDragClass(e){G(this.#W,e)}#G=q(()=>e.props.noWheelClass??`nowheel`);get noWheelClass(){return W(this.#G)}set noWheelClass(e){G(this.#G,e)}#K=q(()=>cpe(e.props.ariaLabelConfig));get ariaLabelConfig(){return W(this.#K)}set ariaLabelConfig(e){G(this.#K,e)}#q=J(Eme(this.nodesInitialized,e.props.fitView,e.props.initialViewport,this.width,this.height,this.nodeLookup));get _viewport(){return W(this.#q)}set _viewport(e){G(this.#q,e)}get viewport(){return e.viewport??this._viewport}set viewport(t){e.viewport&&=t,this._viewport=t}#J=J(l6);get _connection(){return W(this.#J)}set _connection(e){G(this.#J,e)}#Y=q(()=>this._connection.inProgress?{...this._connection,to:R6(this._connection.to,[this.viewport.x,this.viewport.y,this.viewport.zoom])}:this._connection);get connection(){return W(this.#Y)}set connection(e){G(this.#Y,e)}#X=q(()=>e.props.connectionMode??o6.Strict);get connectionMode(){return W(this.#X)}set connectionMode(e){G(this.#X,e)}#Z=q(()=>e.props.connectionRadius??20);get connectionRadius(){return W(this.#Z)}set connectionRadius(e){G(this.#Z,e)}#Q=q(()=>e.props.isValidConnection??(()=>!0));get isValidConnection(){return W(this.#Q)}set isValidConnection(e){G(this.#Q,e)}#$=q(()=>e.props.selectNodesOnDrag??!0);get selectNodesOnDrag(){return W(this.#$)}set selectNodesOnDrag(e){G(this.#$,e)}#ee=q(()=>e.props.defaultMarkerColor===void 0?`#b1b1b7`:e.props.defaultMarkerColor);get defaultMarkerColor(){return W(this.#ee)}set defaultMarkerColor(e){G(this.#ee,e)}#te=q(()=>bpe(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){G(this.#te,e)}#ne=q(()=>e.props.onlyRenderVisibleElements??!1);get onlyRenderVisibleElements(){return W(this.#ne)}set onlyRenderVisibleElements(e){G(this.#ne,e)}#re=q(()=>e.props.onflowerror??Tme);get onerror(){return W(this.#re)}set onerror(e){G(this.#re,e)}#ie=q(()=>e.props.ondelete);get ondelete(){return W(this.#ie)}set ondelete(e){G(this.#ie,e)}#ae=q(()=>e.props.onbeforedelete);get onbeforedelete(){return W(this.#ae)}set onbeforedelete(e){G(this.#ae,e)}#oe=q(()=>e.props.onbeforeconnect);get onbeforeconnect(){return W(this.#oe)}set onbeforeconnect(e){G(this.#oe,e)}#se=q(()=>e.props.onconnect);get onconnect(){return W(this.#se)}set onconnect(e){G(this.#se,e)}#ce=q(()=>e.props.onconnectstart);get onconnectstart(){return W(this.#ce)}set onconnectstart(e){G(this.#ce,e)}#le=q(()=>e.props.onconnectend);get onconnectend(){return W(this.#le)}set onconnectend(e){G(this.#le,e)}#ue=q(()=>e.props.onbeforereconnect);get onbeforereconnect(){return W(this.#ue)}set onbeforereconnect(e){G(this.#ue,e)}#de=q(()=>e.props.onreconnect);get onreconnect(){return W(this.#de)}set onreconnect(e){G(this.#de,e)}#fe=q(()=>e.props.onreconnectstart);get onreconnectstart(){return W(this.#fe)}set onreconnectstart(e){G(this.#fe,e)}#pe=q(()=>e.props.onreconnectend);get onreconnectend(){return W(this.#pe)}set onreconnectend(e){G(this.#pe,e)}#me=q(()=>e.props.clickConnect??!0);get clickConnect(){return W(this.#me)}set clickConnect(e){G(this.#me,e)}#he=q(()=>e.props.onclickconnectstart);get onclickconnectstart(){return W(this.#he)}set onclickconnectstart(e){G(this.#he,e)}#ge=q(()=>e.props.onclickconnectend);get onclickconnectend(){return W(this.#ge)}set onclickconnectend(e){G(this.#ge,e)}#_e=J(null);get clickConnectStartHandle(){return W(this.#_e)}set clickConnectStartHandle(e){G(this.#_e,e)}#ve=q(()=>e.props.onselectiondrag);get onselectiondrag(){return W(this.#ve)}set onselectiondrag(e){G(this.#ve,e)}#ye=q(()=>e.props.onselectiondragstart);get onselectiondragstart(){return W(this.#ye)}set onselectiondragstart(e){G(this.#ye,e)}#be=q(()=>e.props.onselectiondragstop);get onselectiondragstop(){return W(this.#be)}set onselectiondragstop(e){G(this.#be,e)}resolveFitView=async()=>{this.panZoom&&(await rpe({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=q(()=>e.props.colorMode===`system`?this._prefersDark.current?`dark`:`light`:e.props.colorMode??`light`);get colorMode(){return W(this.#xe)}set colorMode(e){G(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=l6,this.clickConnectStartHandle=null,this.viewport=e.props.initialViewport??{x:0,y:0,zoom:1},this.ariaLiveMessage=``}}return new t}var Ome=r6.error001(`svelte`);function G8(){let e=c(K8);if(!e)throw Error(Ome);return e.getStore()}var K8=Symbol();function kme(e){let t=Dme(e);function n(e){t.nodeTypes={...U8,...e}}function r(e){t.edgeTypes={...W8,...e}}function i(e){t.edges=Zpe(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:l8(e,t.connection.fromHandle,f6.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}=kpe(e,t.nodeLookup,t.parentLookup,t.domNode,t.nodeOrigin,t.nodeExtent,t.zIndexMode);if(!r)return;Cpe(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`,r6.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`,r6.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=L6(t,i));let{position:n,positionAbsolute:a}=b6({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 Ape({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=l6}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 Ame(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=Jpe({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 jme=h(`<div class="svelte-flow__zoom svelte-flow__container"><!></div>`);function Mme(e,t){a(t,!0);let n=F(t,`store`,15),r=q(()=>n().panActivationKeyPressed||t.panOnDrag),o=q(()=>n().panActivationKeyPressed||t.panOnScroll),{viewport:s}=n(),c=!1;z(()=>{!c&&n().viewportInitialized&&(t.oninit?.(),c=!0)});var l=jme();u(V(l),()=>t.children),d(l),i(l,(e,t)=>Ame?.(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),R()}function q8(e,t){return n=>{n.target===t&&e?.(n)}}function J8(e){return t=>{let n=e.has(t.id);return!!t.selected===n?t:{...t,selected:n}}}function Y8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}var Nme=h(`<div><!></div>`);function Pme(e,t){a(t,!0);let n=F(t,`store`,15),i=F(t,`panOnDrag`,3,!0),o=F(t,`paneClickDistance`,3,1),c=F(t,`autoPanOnSelection`,3,!0),l,f=null,p=!1,m=new Set,h=new Set,_=q(()=>n().panActivationKeyPressed||i()),v=q(()=>n().selectionKeyPressed||!!n().selectionRect||t.selectionOnDrag&&W(_)!==!0),y=q(()=>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}=Z6(e,f),c=R6({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=z6(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(y6(n().nodeLookup,a,[n().viewport.x,n().viewport.y,n().viewport.zoom],n().selectionMode===c6.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)}}Y8(o,m)||n(n().nodes=n().nodes.map(J8(m)),!0),Y8(s,h)||n(n().edges=n().edges.map(J8(h)),!0),n(n().selectionRectMode=`user`,!0),n(n().selectionRect=a,!0)}function E(){if(!c()||!f)return;let[e,t]=T6(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}Ae(()=>{typeof window<`u`&&D()});function O(e){if(!W(v)||!f||!n().selectionRect)return;let r=Z6(e,f);S={x:r.x,y:r.y};let i=z6({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=Nme();let M;var re=q(()=>W(y)?void 0:q8(ne,l)),ie=q(()=>q8(k,l));u(V(j),()=>t.children),d(j),pe(j,e=>l=e,()=>l),P(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)}),de(`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),de(`pointercancel`,j,function(...e){(W(y)?te:void 0)?.apply(this,e)}),r(`contextmenu`,j,function(...e){W(ie)?.apply(this,e)}),de(`click`,j,function(...e){(W(y)?A:void 0)?.apply(this,e)},!0),g(e,j),R()}T([`click`,`pointermove`,`pointerup`,`contextmenu`]);var Fme=h(`<div class="svelte-flow__viewport xyflow__viewport svelte-flow__container"><!></div>`);function Ime(e,t){a(t,!0);var n=Fme();let r;u(V(n),()=>t.children),d(n),P(()=>r=l(n,``,r,{transform:`translate(${t.store.viewport.x??``}px, ${t.store.viewport.y??``}px) scale(${t.store.viewport.zoom??``})`})),g(e,n),R()}function X8(e,t){let{store:n,onDrag:r,onDragStart:i,onDragStop:a,onNodeMouseDown:o}=t,s=Ppe({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 Lme=h(`<div aria-live="assertive" aria-atomic="true" class="a11y-live-msg svelte-pnzxrn"> </div>`),Rme=h(`<div class="a11y-hidden svelte-pnzxrn"> </div> <div class="a11y-hidden svelte-pnzxrn"> </div> <!>`,1);function zme(e,t){a(t,!0);var n=Rme(),r=L(n),i=V(r,!0);d(r);var o=I(r,2),s=V(o,!0);d(o);var c=I(o,2),l=e=>{var n=Lme(),r=V(n,!0);d(n),P(()=>{K(n,`id`,`${Bme}-${t.store.flowId}`),A(r,t.store.ariaLiveMessage)}),g(e,n)};k(c,e=>{t.store.disableKeyboardA11y||e(l)}),P(()=>{K(r,`id`,`${Z8}-${t.store.flowId}`),A(i,t.store.disableKeyboardA11y?t.store.ariaLabelConfig[`node.a11yDescription.default`]:t.store.ariaLabelConfig[`node.a11yDescription.keyboardDisabled`]),K(o,`id`,`${Q8}-${t.store.flowId}`),A(s,t.store.ariaLabelConfig[`edge.a11yDescription.default`])}),g(e,n),R()}var Z8=`svelte-flow__node-desc`,Q8=`svelte-flow__edge-desc`,Bme=`svelte-flow__aria-live`,Vme=h(`<div><!></div>`);function Hme(e,t){a(t,!0);let n=F(t,`store`,15),r=q(()=>v(t.node.data,()=>({}),!0)),o=q(()=>v(t.node.selected,!1)),s=q(()=>t.node.draggable),c=q(()=>t.node.selectable),l=q(()=>v(t.node.deletable,!0)),u=q(()=>t.node.connectable),f=q(()=>t.node.focusable),p=q(()=>v(t.node.hidden,!1)),m=q(()=>v(t.node.dragging,!1)),h=q(()=>v(t.node.style,``)),_=q(()=>t.node.class),y=q(()=>v(t.node.type,`default`)),b=q(()=>t.node.parentId),x=q(()=>t.node.sourcePosition),S=q(()=>t.node.targetPosition),w=q(()=>v(t.node.measured,()=>({width:0,height:0}),!0).width),T=q(()=>v(t.node.measured,()=>({width:0,height:0}),!0).height),E=q(()=>t.node.initialWidth),D=q(()=>t.node.initialHeight),ee=q(()=>t.node.width),te=q(()=>t.node.height),A=q(()=>t.node.dragHandle),ne=q(()=>v(t.node.internals.z,0)),j=q(()=>t.node.internals.positionAbsolute.x),M=q(()=>t.node.internals.positionAbsolute.y),re=q(()=>t.node.internals.userNode),{id:ie}=t.node,N=q(()=>W(s)??n().nodesDraggable),ae=q(()=>W(c)??n().elementsSelectable),se=q(()=>W(u)??n().nodesConnectable),ce=q(()=>G6(t.node)),P=q(()=>!!t.node.internals.handleBounds),le=q(()=>W(ce)&&W(P)),ue=q(()=>W(f)??n().nodesFocusable);function de(e){return n().parentLookup.has(e)}let fe=q(()=>de(ie)),I=J(null),me=null,he=W(y),ge=W(x),_e=W(S),ve=q(()=>n().nodeTypes[W(y)]??F8),ye=q(()=>n().ariaLabelConfig);$pe(ie),tme({get value(){return W(se)}});let be=q(()=>{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:${R8(e)};`:``}${t?`height:${R8(t)};`:``}`});z(()=>{(W(y)!==he||W(x)!==ge||W(S)!==_e)&&W(I)!==null&&requestAnimationFrame(()=>{W(I)!==null&&n().updateNodeInternals(new Map([[ie,{id:ie,nodeElement:W(I),force:!0}]]))}),he=W(y),ge=W(x),_e=W(S)}),z(()=>{t.resizeObserver&&(!W(le)||W(I)!==me)&&(me&&t.resizeObserver.unobserve(me),W(I)&&t.resizeObserver.observe(W(I)),me=W(I))}),Ae(()=>{me&&t.resizeObserver?.unobserve(me)});function B(e){W(ae)&&(!n().selectNodesOnDrag||!W(N)||n().nodeDragThreshold>0)&&n().handleNodeSelection(ie),t.onnodeclick?.({node:W(re),event:e})}function xe(e){if(!(Y6(e)||n().disableKeyboardA11y))if(a6.includes(e.key)&&W(ae)){let t=e.key===`Escape`;n().handleNodeSelection(ie,t,W(I))}else W(N)&&t.node.selected&&Object.prototype.hasOwnProperty.call(z8,e.key)&&(e.preventDefault(),n(n().ariaLiveMessage=W(ye)[`node.a11yDescription.ariaLiveMessage`]({direction:e.key.replace(`Arrow`,``).toLowerCase(),x:~~t.node.internals.positionAbsolute.x,y:~~t.node.internals.positionAbsolute.y}),!0),n().moveSelectedNodes(z8[e.key],e.shiftKey?4:1))}let Se=()=>{if(n().disableKeyboardA11y||!n().autoPanOnNodeFocus||!W(I)?.matches(`:focus-visible`))return;let{width:e,height:r,viewport:i}=n();y6(new Map([[ie,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=L(Ce),H=e=>{var a=Vme();O(a,()=>({"data-id":ie,class:[`svelte-flow__node`,`svelte-flow__node-${W(y)}`,W(_)],style:W(be),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(ue)?xe:void 0,onfocus:W(ue)?Se:void 0,tabIndex:W(ue)?0:void 0,role:t.node.ariaRole??(W(ue)?`group`:void 0),"aria-label":t.node.ariaLabel,"aria-roledescription":`node`,"aria-describedby":n().disableKeyboardA11y?void 0:`${Z8}-${n().flowId}`,...t.node.domAttributes,[oe]:{dragging:W(m),selected:W(o),draggable:W(N),connectable:W(se),selectable:W(ae),nopan:W(N),parent:W(fe)},[Ne]:{"z-index":W(ne),transform:`translate(${W(j)??``}px, ${W(M)??``}px)`,visibility:W(ce)?`visible`:`hidden`}})),C(V(a),()=>W(ve),(e,t)=>{t(e,{get data(){return W(r)},get id(){return ie},get selected(){return W(o)},get selectable(){return W(ae)},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(N)},get dragHandle(){return W(A)},get parentId(){return W(b)},get type(){return W(y)},get isConnectable(){return W(se)},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)=>X8?.(e,t),()=>({nodeId:ie,isSelectable:W(ae),disabled:!W(N),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()})),pe(a,e=>G(I,e),()=>W(I)),g(e,a)};k(we,e=>{W(p)||e(H)}),g(e,Ce),R()}var Ume=h(`<div class="svelte-flow__nodes"></div>`);function Wme(e,t){a(t,!0);let n=F(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)});Ae(()=>{r?.disconnect()});var i=Ume();_(i,21,()=>n().visible.nodes.values(),e=>e.id,(e,i)=>{Hme(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),R()}var Gme=j(`<svg class="svelte-flow__edge-wrapper"><g><!></g></svg>`);function Kme(e,t){a(t,!0);let n=q(()=>t.edge.id),r=q(()=>t.edge.source),i=q(()=>t.edge.target),o=q(()=>t.edge.sourceX),s=q(()=>t.edge.sourceY),c=q(()=>t.edge.targetX),u=q(()=>t.edge.targetY),f=q(()=>t.edge.sourcePosition),p=q(()=>t.edge.targetPosition),m=q(()=>v(t.edge.animated,!1)),h=q(()=>v(t.edge.selected,!1)),_=q(()=>t.edge.label),y=q(()=>t.edge.labelStyle),b=q(()=>v(t.edge.data,()=>({}),!0)),x=q(()=>t.edge.style),S=q(()=>t.edge.interactionWidth),w=q(()=>v(t.edge.type,`default`)),T=q(()=>t.edge.sourceHandle),E=q(()=>t.edge.targetHandle),D=q(()=>t.edge.markerStart),ee=q(()=>t.edge.markerEnd),te=q(()=>t.edge.selectable),A=q(()=>t.edge.focusable),ne=q(()=>v(t.edge.deletable,!0)),j=q(()=>t.edge.hidden),M=q(()=>t.edge.zIndex),re=q(()=>t.edge.class),ie=q(()=>t.edge.ariaLabel);rme(W(n));let N=null,ae=q(()=>W(te)??t.store.elementsSelectable),se=q(()=>W(A)??t.store.edgesFocusable),ce=q(()=>t.store.edgeTypes[W(w)]??V8),le=q(()=>W(D)?`url('#${d8(W(D),t.store.flowId)}')`:void 0),ue=q(()=>W(ee)?`url('#${d8(W(ee),t.store.flowId)}')`:void 0);function de(e){let r=t.store.edgeLookup.get(W(n));r&&(W(ae)&&t.store.handleEdgeSelection(W(n)),t.onedgeclick?.({event:e,edge:r}))}function F(e,r){let i=t.store.edgeLookup.get(W(n));i&&r({event:e,edge:i})}function fe(e){if(!t.store.disableKeyboardA11y&&a6.includes(e.key)&&W(ae)){let{unselectNodesAndEdges:r,addSelectedEdges:i}=t.store;e.key===`Escape`?(N?.blur(),r({edges:[t.edge]})):i([W(n)])}}var I=U(),me=L(I),he=e=>{var a=Gme();let v;var D=V(a);O(D,()=>({class:[`svelte-flow__edge`,W(re)],"data-id":W(n),onclick:de,oncontextmenu:t.onedgecontextmenu?e=>{F(e,t.onedgecontextmenu)}:void 0,onpointerenter:t.onedgepointerenter?e=>{F(e,t.onedgepointerenter)}:void 0,onpointerleave:t.onedgepointerleave?e=>{F(e,t.onedgepointerleave)}:void 0,"aria-label":W(ie)===null?void 0:W(ie)?W(ie):`Edge from ${W(r)} to ${W(i)}`,"aria-describedby":W(se)?`${Q8}-${t.store.flowId}`:void 0,role:t.edge.ariaRole??(W(se)?`group`:`img`),"aria-roledescription":`edge`,onkeydown:W(se)?fe:void 0,tabindex:W(se)?0:void 0,...t.edge.domAttributes,[oe]:{animated:W(m),selected:W(h),selectable:W(ae)}})),C(V(D),()=>W(ce),(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(ae)},get deletable(){return W(ne)},get type(){return W(w)},get sourceHandleId(){return W(T)},get targetHandleId(){return W(E)},get markerStart(){return W(le)},get markerEnd(){return W(ue)}})}),d(D),pe(D,e=>N=e,()=>N),d(a),P(()=>v=l(a,``,v,{"z-index":W(M)})),g(e,a)};k(me,e=>{W(j)||e(he)}),g(e,I),R()}var qme=j(`<defs></defs>`);function Jme(e,t){a(t,!1);let n=G8();me();var r=qme();_(r,5,()=>n.markers,e=>e.id,(e,t)=>{Qme(e,B(()=>W(t)))}),d(r),g(e,r),R()}var Yme=j(`<polyline class="arrow" fill="none" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4"></polyline>`),Xme=j(`<polyline class="arrowclosed" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4"></polyline>`),Zme=j(`<marker class="svelte-flow__arrowhead" viewBox="-10 -10 20 20" refX="0" refY="0"><!></marker>`);function Qme(e,t){a(t,!0);let n=F(t,`width`,3,12.5),r=F(t,`height`,3,12.5),i=F(t,`markerUnits`,3,`strokeWidth`),o=F(t,`orient`,3,`auto-start-reverse`),s=F(t,`color`,3,`none`);var c=Zme(),u=V(c),f=e=>{var n=Yme();let r;P(()=>{K(n,`stroke-width`,t.strokeWidth),r=l(n,``,r,{stroke:s()})}),g(e,n)},p=e=>{var n=Xme();let r;P(()=>{K(n,`stroke-width`,t.strokeWidth),r=l(n,``,r,{stroke:s(),fill:s()})}),g(e,n)};k(u,e=>{t.type===d6.Arrow?e(f):t.type===d6.ArrowClosed&&e(p,1)}),d(c),P(()=>{K(c,`id`,t.id),K(c,`markerWidth`,`${n()}`),K(c,`markerHeight`,`${r()}`),K(c,`markerUnits`,i()),K(c,`orient`,o())}),g(e,c),R()}var $me=h(`<div class="svelte-flow__edges"><svg class="svelte-flow__marker"><!></svg> <!></div>`);function ehe(e,t){a(t,!0);let n=F(t,`store`,15);var r=$me(),i=V(r);Jme(V(i),{}),d(i),_(I(i,2),17,()=>n().visible.edges.values(),e=>e.id,(e,r)=>{Kme(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),R()}var the=h(`<div class="svelte-flow__selection svelte-1fy294n"></div>`);function $8(e,t){a(t,!0);let n=F(t,`x`,3,0),r=F(t,`y`,3,0),i=F(t,`width`,3,0),o=F(t,`height`,3,0),s=F(t,`isVisible`,3,!0);var c=U(),u=L(c),d=e=>{var t=the();let a;P(e=>a=l(t,``,a,e),[()=>({width:typeof i()==`string`?i():R8(i()),height:typeof o()==`string`?o():R8(o()),transform:`translate(${n()}px, ${r()}px)`})]),g(e,t)};k(u,e=>{s()&&e(d)}),g(e,c),R()}var nhe=h(`<div><!></div>`);function rhe(e,t){a(t,!0);let n=J(void 0);z(()=>{t.store.disableKeyboardA11y||W(n)?.focus({preventScroll:!0})});let o=q(()=>{if(t.store.selectionRectMode===`nodes`){t.store.nodes;let e=v6(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(z8,e.key)&&(e.preventDefault(),t.store.moveSelectedNodes(z8[e.key],e.shiftKey?4:1))}var p=U(),m=L(p),h=e=>{var a=nhe();let p;$8(V(a),{width:`100%`,height:`100%`,x:0,y:0}),d(a),i(a,(e,t)=>X8?.(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})}})),pe(a,e=>G(n,e),()=>W(n)),P(e=>{s(a,1,x([`svelte-flow__selection-wrapper`,t.store.noPanClass]),`svelte-1lxk677`),K(a,`role`,t.store.disableKeyboardA11y?void 0:`button`),K(a,`tabindex`,t.store.disableKeyboardA11y?void 0:-1),p=l(a,``,p,e)},[()=>({width:R8(W(o).width),height:R8(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)},_=q(()=>t.store.selectionRectMode===`nodes`&&W(o)&&F6(W(o).x)&&F6(W(o).y));k(m,e=>{W(_)&&e(h)}),g(e,p),R()}T([`contextmenu`,`click`,`keydown`]);function ihe(e){switch(e){case`none`:return 0;case`ctrl`:return 8;case`shift`:return 4;case`alt`:return 2;case`meta`:return 1}}function e5(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|ihe(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=ke(e,i,a)),{update:t=>{let{enabled:s=!0,type:c=`keydown`}=t;n&&(!s||i!==c)?o?.():!n&&s&&(o=ke(e,c,a)),n=s,i=c,r=t.trigger},destroy:()=>{o?.()}}}function t5(){let e=q(G8),t=t=>{let n=L8(t)?t:W(e).nodeLookup.get(t.id),r=n.parentId?spe(n.position,n.measured,n.parentId,W(e).nodeLookup,W(e).nodeOrigin):n.position;return k6({...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=ae(()=>W(e).nodes).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r?.replace&&L8(t)?t:{...e,...t}}return e})}function r(t,n,r={replace:!1}){W(e).edges=ae(()=>W(e).edges).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r.replace&&mme(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:n5(W(e).nodeLookup,t),getEdge:t=>W(e).edgeLookup.get(t),getEdges:t=>t===void 0?W(e).edges:n5(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=V6(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=P6(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=k6(i),c=N6(s,o);return r&&c>0||c>=s.width*s.height||c>=o.width*o.height}):[]},isNodeIntersecting:(e,n,r=!0)=>{let i=P6(e)?e:t(e);if(!i)return!1;let a=N6(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 ipe({nodesToRemove:t,edgesToRemove:n,nodes:W(e).nodes,edges:W(e).edges,onBeforeDelete:W(e).onbeforedelete});return r&&(W(e).nodes=ae(()=>W(e).nodes).filter(e=>!r.some(({id:t})=>t===e.id))),i&&(W(e).edges=ae(()=>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 R6({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=z6(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=>epe(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 n5(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 ahe(e,t){a(t,!0);let n=F(t,`store`,15),r=F(t,`selectionKey`,3,`Shift`),o=F(t,`multiSelectionKey`,19,()=>H6()?`Meta`:`Control`),s=F(t,`deleteKey`,3,`Backspace`),c=F(t,`panActivationKey`,3,` `),l=F(t,`zoomActivationKey`,19,()=>H6()?`Meta`:`Control`),{deleteElements:u}=t5();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)})}de(`blur`,Te,h),de(`contextmenu`,Te,h),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(r(),()=>n(n().selectionKeyPressed=!0,!0)),type:`keydown`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(r(),()=>n(n().selectionKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(o(),()=>{n(n().multiselectionKeyPressed=!0,!0)}),type:`keydown`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(o(),()=>n(n().multiselectionKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(s(),e=>{!(e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)&&!Y6(e.originalEvent)&&(n(n().deleteKeyPressed=!0,!0),g())}),type:`keydown`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(s(),()=>n(n().deleteKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(c(),()=>n(n().panActivationKeyPressed=!0,!0)),type:`keydown`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(c(),()=>n(n().panActivationKeyPressed=!1,!0)),type:`keyup`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(l(),()=>n(n().zoomActivationKeyPressed=!0,!0)),type:`keydown`})),i(Te,(e,t)=>e5?.(e,t),()=>({trigger:m(l(),()=>n(n().zoomActivationKeyPressed=!1,!0)),type:`keyup`})),R()}var ohe=j(`<path fill="none" class="svelte-flow__connection-path"></path>`),she=j(`<svg class="svelte-flow__connectionline"><g><!></g></svg>`);function che(e,t){a(t,!0);let n=q(()=>{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 u6.Bezier:{let[t]=t8(e);return t}case u6.Straight:{let[t]=r8(e);return t}case u6.Step:case u6.SmoothStep:{let[n]=o8({...e,borderRadius:t.type===u6.Step?0:void 0});return n}}});var r=U(),i=L(r),o=e=>{var r=she(),i=V(r),a=V(i),o=e=>{var n=U();C(L(n),()=>t.LineComponent,(e,t)=>{t(e,{})}),g(e,n)},c=e=>{var r=ohe();P(()=>{K(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),P(e=>{K(r,`width`,t.store.width),K(r,`height`,t.store.height),l(r,t.containerStyle),s(i,0,e)},[()=>x([`svelte-flow__connection`,Qfe(t.store.connection.isValid)])]),g(e,r)};k(i,e=>{t.store.connection.inProgress&&e(o)}),g(e,r),R()}var lhe=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`style`,`class`,`children`]),uhe=h(`<div><!></div>`);function r5(e,t){a(t,!0);let n=F(t,`position`,3,`top-right`),r=H(t,lhe),i=q(()=>`${n()}`.split(`-`));var o=uhe();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),R()}var dhe=h(`<a target="_blank" rel="noopener noreferrer" aria-label="Svelte Flow attribution">Svelte Flow</a>`);function fhe(e,t){a(t,!0);let n=F(t,`position`,3,`bottom-right`),r=`https://svelteflow.dev?utm_source=attribution`;var i=U(),o=L(i),s=e=>{{let t=q(()=>`Please only hide this attribution when you are subscribed to Svelte Flow Pro: ${r}`);r5(e,{get position(){return n()},class:`svelte-flow__attribution`,get"data-message"(){return W(t)},children:(e,t)=>{var n=dhe();P(()=>K(n,`href`,r)),g(e,n)},$$slots:{default:!0}})}};k(o,e=>{t.proOptions?.hideAttribution||e(s)}),g(e,i),R()}var phe=h(`<div><!></div>`);function mhe(e,t){a(t,!0);let n=F(t,`domNode`,15),r=F(t,`clientWidth`,15),i=F(t,`clientHeight`,15);q(()=>t.rest.id);let o=q(()=>t.rest.class);q(()=>t.rest.nodeTypes),q(()=>t.rest.edgeTypes),q(()=>t.rest.colorMode),q(()=>t.rest.isValidConnection),q(()=>t.rest.onmove),q(()=>t.rest.onmovestart),q(()=>t.rest.onmoveend),q(()=>t.rest.onflowerror),q(()=>t.rest.ondelete),q(()=>t.rest.onbeforedelete),q(()=>t.rest.onbeforeconnect),q(()=>t.rest.onconnect),q(()=>t.rest.onconnectstart),q(()=>t.rest.onconnectend),q(()=>t.rest.onbeforereconnect),q(()=>t.rest.onreconnect),q(()=>t.rest.onreconnectstart),q(()=>t.rest.onreconnectend),q(()=>t.rest.onclickconnectstart),q(()=>t.rest.onclickconnectend),q(()=>t.rest.oninit),q(()=>t.rest.onselectionchange),q(()=>t.rest.onselectiondragstart),q(()=>t.rest.onselectiondrag),q(()=>t.rest.onselectiondragstop),q(()=>t.rest.onselectionstart),q(()=>t.rest.onselectionend),q(()=>t.rest.clickConnect),q(()=>t.rest.fitView),q(()=>t.rest.fitViewOptions),q(()=>t.rest.nodeOrigin),q(()=>t.rest.nodeDragThreshold),q(()=>t.rest.connectionDragThreshold),q(()=>t.rest.minZoom),q(()=>t.rest.maxZoom),q(()=>t.rest.initialViewport),q(()=>t.rest.connectionRadius),q(()=>t.rest.connectionMode),q(()=>t.rest.selectionMode),q(()=>t.rest.selectNodesOnDrag),q(()=>t.rest.snapGrid),q(()=>t.rest.defaultMarkerColor),q(()=>t.rest.translateExtent),q(()=>t.rest.nodeExtent),q(()=>t.rest.onlyRenderVisibleElements),q(()=>t.rest.autoPanOnConnect),q(()=>t.rest.autoPanOnNodeDrag),q(()=>t.rest.colorModeSSR),q(()=>t.rest.defaultEdgeOptions),q(()=>t.rest.elevateNodesOnSelect),q(()=>t.rest.elevateEdgesOnSelect),q(()=>t.rest.nodesDraggable),q(()=>t.rest.autoPanOnNodeFocus),q(()=>t.rest.nodesConnectable),q(()=>t.rest.elementsSelectable),q(()=>t.rest.nodesFocusable),q(()=>t.rest.edgesFocusable),q(()=>t.rest.disableKeyboardA11y),q(()=>t.rest.noDragClass),q(()=>t.rest.noPanClass),q(()=>t.rest.noWheelClass),q(()=>t.rest.ariaLabelConfig),q(()=>t.rest.autoPanSpeed),q(()=>t.rest.panOnScrollSpeed),q(()=>t.rest.zIndexMode),q(()=>t.rest.autoPanOnSelection);let s=q(()=>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=phe();O(l,e=>({class:[`svelte-flow`,`svelte-flow__container`,t.colorMode,W(o)],"data-testid":`svelte-flow__wrapper`,role:`application`,onscroll:c,...W(s),[Ne]:e}),[()=>({width:R8(t.width),height:R8(t.height)})],void 0,void 0,`svelte-k1b1ck`),u(V(l),()=>t.children??D),d(l),pe(l,e=>n(e),()=>n()),re(l,`clientHeight`,i),re(l,`clientWidth`,r),g(e,l),R()}var hhe=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(`.`)),ghe=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),_he=h(`<!> <!>`,1),vhe=h(`<!> <!> <!> <!> <!>`,1);function yhe(e,t){a(t,!0);let n=F(t,`paneClickDistance`,3,1),r=F(t,`nodeClickDistance`,3,1),i=F(t,`panOnScrollMode`,19,()=>s6.Free),o=F(t,`preventScrolling`,3,!0),s=F(t,`zoomOnScroll`,3,!0),l=F(t,`zoomOnDoubleClick`,3,!0),d=F(t,`zoomOnPinch`,3,!0),f=F(t,`panOnScroll`,3,!1),p=F(t,`panOnScrollSpeed`,3,.5),m=F(t,`panOnDrag`,3,!0),h=F(t,`selectionOnDrag`,3,!1),_=F(t,`autoPanOnSelection`,3,!0),v=F(t,`connectionLineType`,19,()=>u6.Bezier),y=F(t,`nodes`,31,()=>ie([])),b=F(t,`edges`,31,()=>ie([])),x=F(t,`viewport`,15,void 0),S=H(t,hhe),C=kme({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(K8);T&&T.setStore&&T.setStore(C),ve(K8,{provider:!1,getStore(){return C}}),z(()=>{let e={nodes:C.selectedNodes,edges:C.selectedEdges};ae(()=>t.onselectionchange)?.(e);for(let t of C.selectionChangeHandlers.values())t(e)}),Ae(()=>{C.reset()}),mhe(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=vhe(),y=L(c);ahe(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=I(y,2);Mme(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)=>{Pme(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=_he(),a=L(i);Ime(a,{get store(){return C},set store(e){C=e},children:(e,n)=>{var i=ghe(),a=I(L(i),2);ehe(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=I(a,4);che(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=I(o,2);Wme(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}}),rhe(I(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=I(a,2);{let e=q(()=>!!(C.selectionRect&&C.selectionRectMode===`user`)),t=q(()=>C.selectionRect?.width),n=q(()=>C.selectionRect?.height),r=q(()=>C.selectionRect?.x),i=q(()=>C.selectionRect?.y);$8(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=I(b,2);fhe(x,{get proOptions(){return t.proOptions},get position(){return t.attributionPosition}});var S=I(x,2);zme(S,{get store(){return C}}),u(I(S,2),()=>t.children??D),g(e,c)},$$slots:{default:!0}}),R()}var i5;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(i5||={});var bhe=j(`<circle></circle>`);function xhe(e,t){var n=bhe();P(()=>{K(n,`cx`,t.radius),K(n,`cy`,t.radius),K(n,`r`,t.radius),s(n,0,x([`svelte-flow__background-pattern`,`dots`,t.class]))}),g(e,n)}var She=j(`<path></path>`);function Che(e,t){a(t,!0);var n=She();P(()=>{K(n,`stroke-width`,t.lineWidth),K(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),R()}var whe={[i5.Dots]:1,[i5.Lines]:1,[i5.Cross]:6},The=j(`<svg data-testid="svelte-flow__background"><pattern patternUnits="userSpaceOnUse"><!></pattern><rect x="0" y="0" width="100%" height="100%"></rect></svg>`);function Ehe(e,t){a(t,!0);let n=F(t,`variant`,19,()=>i5.Dots),r=F(t,`gap`,3,20),i=F(t,`lineWidth`,3,1),o=q(G8),c=q(()=>n()===i5.Dots),u=q(()=>n()===i5.Cross),f=q(()=>Array.isArray(r())?r():[r(),r()]),p=q(()=>`background-pattern-${W(o).flowId}-${t.id??``}`),m=q(()=>[W(f)[0]*W(o).viewport.zoom||1,W(f)[1]*W(o).viewport.zoom||1]),h=q(()=>(t.size??whe[n()])*W(o).viewport.zoom),_=q(()=>W(u)?[W(h),W(h)]:W(m)),v=q(()=>W(c)?[W(h)/2,W(h)/2]:[W(_)[0]/2,W(_)[1]/2]);var y=The();let b;var S=V(y),C=V(S),w=e=>{{let n=q(()=>W(h)/2);xhe(e,{get radius(){return W(n)},get class(){return t.patternClass}})}},T=e=>{Che(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=I(S);d(y),P(()=>{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}),K(S,`id`,W(p)),K(S,`x`,W(o).viewport.x%W(m)[0]),K(S,`y`,W(o).viewport.y%W(m)[1]),K(S,`width`,W(m)[0]),K(S,`height`,W(m)[1]),K(S,`patternTransform`,`translate(-${W(v)[0]},-${W(v)[1]})`),K(E,`fill`,`url(#${W(p)})`)}),g(e,y),R()}function Dhe(e){let t=q(G8),n=q(()=>W(t).nodeLookup),r=q(()=>W(t).nodes),i=q(()=>(W(r),W(n).get(e)));return{get current(){return W(i)}}}var Ohe=j(`<rect></rect>`);function khe(e,t){a(t,!0);let n=F(t,`borderRadius`,3,5),r=F(t,`strokeWidth`,3,2),i=q(()=>Dhe(t.id)),o=q(()=>{if(!W(i).current)return{width:0,height:0,x:0,y:0};let{width:e,height:n}=W6(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=q(()=>W(o).width),u=q(()=>W(o).height),d=q(()=>W(o).x),f=q(()=>W(o).y);var p=U(),m=L(p),h=e=>{let i=q(()=>t.nodeComponent);var a=U();C(L(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=Ohe();let a,o;P(()=>{a=s(i,0,x([`svelte-flow__minimap-node`,t.class]),null,a,{selected:t.selected}),K(i,`x`,W(d)),K(i,`y`,W(f)),K(i,`rx`,n()),K(i,`ry`,n()),K(i,`width`,W(c)),K(i,`height`,W(u)),K(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),R()}function Ahe(e,t){let n=Bpe({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 a5=e=>e instanceof Function?e:()=>e,jhe=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`ariaLabel`,`nodeStrokeColor`,`nodeColor`,`nodeClass`,`nodeBorderRadius`,`nodeStrokeWidth`,`nodeComponent`,`bgColor`,`maskColor`,`maskStrokeColor`,`maskStrokeWidth`,`width`,`height`,`pannable`,`zoomable`,`inversePan`,`zoomStep`,`class`]),Mhe=j(`<title> </title>`),Nhe=j(`<svg class="svelte-flow__minimap-svg" role="img"><!><!><path class="svelte-flow__minimap-mask" fill-rule="evenodd" pointer-events="none"></path></svg>`),Phe=h(`<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>`,1);function Fhe(e,t){a(t,!0);let n=F(t,`position`,3,`bottom-right`),r=F(t,`nodeStrokeColor`,3,`transparent`),o=F(t,`nodeClass`,3,``),s=F(t,`nodeBorderRadius`,3,5),c=F(t,`nodeStrokeWidth`,3,2),u=F(t,`width`,3,200),f=F(t,`height`,3,150),p=F(t,`pannable`,3,!0),m=F(t,`zoomable`,3,!0),h=H(t,jhe),v=q(G8),y=q(()=>W(v).ariaLabelConfig),b=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`,x=q(()=>`svelte-flow__minimap-desc-${W(v).flowId}`),S=q(()=>({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=q(()=>j6(v6(W(v).nodeLookup,{filter:e=>!e.hidden}),W(S))),w=q(()=>W(C).width/u()),T=q(()=>W(C).height/f()),E=q(()=>Math.max(W(w),W(T))),D=q(()=>W(E)*u()),O=q(()=>W(E)*f()),ee=q(()=>5*W(E)),te=q(()=>W(C).x-(W(D)-W(C).width)/2-W(ee)),ne=q(()=>W(C).y-(W(O)-W(C).height)/2-W(ee)),j=q(()=>W(D)+W(ee)*2),M=q(()=>W(O)+W(ee)*2),re=()=>W(E);var ie=Phe(),N=L(ie);{let e=q(()=>[`svelte-flow__minimap`,t.class]);Fe(N,()=>({"--xy-minimap-background-color-props":t.bgColor})),r5(N.lastChild,B({get position(){return n()},get class(){return W(e)},"data-testid":`svelte-flow__minimap`},()=>h,{children:(e,n)=>{var a=U(),h=L(a),C=e=>{var n=Nhe();let a;var h=V(n),C=e=>{var n=Mhe(),r=V(n,!0);d(n),P(()=>{K(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=I(h);_(w,17,()=>W(v).nodes,e=>e.id,(e,n)=>{let i=q(()=>W(v).nodeLookup.get(W(n).id));var a=U(),l=L(a),u=e=>{{let a=q(()=>t.nodeColor===void 0?void 0:a5(t.nodeColor)(W(n))),l=q(()=>a5(r())(W(n))),u=q(()=>a5(o())(W(n)));khe(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=q(()=>W(i)&&G6(W(i))&&!W(i).hidden);k(l,e=>{W(d)&&e(u)}),g(e,a)});var T=I(w);d(n),i(n,(e,t)=>Ahe?.(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()})),P(()=>{K(n,`width`,u()),K(n,`height`,f()),K(n,`viewBox`,`${W(te)??``} ${W(ne)??``} ${W(j)??``} ${W(M)??``}`),K(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}),K(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(N)}g(e,ie),R()}var Ihe=/^\[Tool call:([\s\S]*)\]$/,o5=new Set([`ask_user`,`plan_mode_present`]),Lhe={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 s5(e){return e&&Lhe[e]||`wrench`}function c5(e){return e&&typeof e==`object`?e:void 0}function Rhe(e){return typeof e==`string`&&e.length>0?e:void 0}function l5(e){return typeof e==`string`&&e.startsWith(`tool_`)?e:void 0}function zhe(e){let t=e?.thinkingBlocks;return Array.isArray(t)?t.some(e=>{let t=c5(e);return t?typeof t.text==`string`&&t.text.length>0||t.redacted===!0:!1}):!1}function u5(e,t){if(!e)return;let n=c5(c5(e.details)?.toolCall),r=l5(e.toolRecordId)??l5(n?.id);return r?t.get(r):void 0}function Bhe(e,t){return u5(c5(e.details),t)}function d5(e){let t=e.trim().match(Ihe);return t?[...t[1].matchAll(/([a-z_][a-z0-9_]*)\s*\(/gi)].map(e=>e[1]):[]}function f5(e){let t=e.replace(/\s+/g,` `).trim();return t.length>160?`${t.slice(0,160)}…`:t}function p5(e,t){let n=c5(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:f5(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:f5(e.summary||e.text),tone:`info`,mono:!1,badges:r};if(e.kind===`explore_report`)return{type:`explore_report`,icon:`search`,label:`Explore`,preview:f5(e.summary||e.text),tone:`info`,mono:!1,badges:r};if(e.role===`user`)return{type:`user`,icon:`user`,label:`You`,preview:f5(e.text)||`empty message`,tone:`default`,mono:!1,badges:r};if(e.role===`assistant`){zhe(n)&&r.push({icon:`brain`,tone:`info`,title:`Includes thinking`});let t=d5(e.text);if(t.length>0){let e=t[0],n=t.some(e=>o5.has(e)),i=t.length>1?` +${t.length-1}`:``;return{type:n?`human_loop`:`tool_call`,icon:s5(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:f5(e.text)||`(thinking)`,tone:`default`,mono:!1,badges:r}}let o=Rhe(n?.toolName);if(o){let i=u5(n,t),a=n?.isError===!0||i?.status===`error`||i?.status===`denied`,s=o5.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:s5(o),label:o,preview:f5(e.text),tone:a?`danger`:s?`warning`:`success`,mono:!0,badges:r}}return{type:`system`,icon:`info`,label:`System`,preview:f5(e.text)||`system entry`,tone:`default`,mono:!1,badges:r}}function Vhe(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 Hhe(e){let t=e.details;return Array.isArray(t?.thinkingBlocks)?t.thinkingBlocks:void 0}function m5(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Uhe(e,t=560){let n=e.trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}…`}function h5(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e==`object`?Object.keys(e).length>0:!0}function g5(e,t){let n=p5(e,t),r=Bhe(e,t),i=(Hhe(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??d5(e.text)[0]??e.details?.toolName,c=h5(r?.argsPreview)?m5(r?.argsPreview):``,l=e.role===`system`&&e.text?e.text:r?.resultPreview,u=h5(l)?m5(l):``,d=r?.error??``;return{descriptor:n,record:r,thinkingText:i,messageText:a,isToolEntry:o,toolName:s,argsText:c,resultText:u,errorText:d,detailPreview:Uhe(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 _5=Object.defineProperty,Whe=(e,t,n)=>t in e?_5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ghe=(e,t)=>{for(var n in t)_5(e,n,{get:t[n],enumerable:!0})},Khe=(e,t,n)=>Whe(e,typeof t==`symbol`?t:t+``,n),v5={};Ghe(v5,{Graph:()=>b5,alg:()=>E5,json:()=>T5,version:()=>Yhe});var qhe=Object.defineProperty,y5=(e,t)=>{for(var n in t)qhe(e,n,{get:t[n],enumerable:!0})},b5=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=C5(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=Jhe(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,x5(this._preds[a],i),x5(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?w5(this._isDirected,e):C5(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?w5(this._isDirected,e):C5(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?w5(this._isDirected,e):C5(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],S5(this._preds[t],e),S5(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 x5(e,t){e[t]?e[t]++:e[t]=1}function S5(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function C5(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 Jhe(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 w5(e,t){return C5(e,t.v,t.w,t.name)}var Yhe=`4.0.1`,T5={};y5(T5,{read:()=>$he,write:()=>Xhe});function Xhe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Zhe(e),edges:Qhe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Zhe(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 Qhe(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 $he(e){let t=new b5(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 E5={};y5(E5,{CycleException:()=>j5,bellmanFord:()=>D5,components:()=>nge,dijkstra:()=>k5,dijkstraAll:()=>age,findCycles:()=>oge,floydWarshall:()=>cge,isAcyclic:()=>uge,postorder:()=>fge,preorder:()=>pge,prim:()=>mge,shortestPaths:()=>hge,tarjan:()=>A5,topsort:()=>M5});var ege=()=>1;function D5(e,t,n,r){return tge(e,String(t),n||ege,r||function(t){return e.outEdges(t)})}function tge(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 nge(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 O5=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}},rge=()=>1;function k5(e,t,n,r){return ige(e,String(t),n||rge,r||function(t){return e.outEdges(t)})}function ige(e,t,n,r){let i={},a=new O5,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 age(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=k5(e,i,t,n),r},{})}function A5(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 oge(e){return A5(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var sge=()=>1;function cge(e,t,n){return lge(e,t||sge,n||function(t){return e.outEdges(t)})}function lge(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 j5=class extends Error{constructor(...e){super(...e)}};function M5(e){let t={},n={},r=[];function i(a){if(a in n)throw new j5;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 j5;return r}function uge(e){try{M5(e)}catch(e){if(e instanceof j5)return!1;throw e}return!0}function dge(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=N5(e,t,n===`post`,o,a,r,i)}),i}function N5(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=N5(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function P5(e,t,n){return dge(e,t,n,function(e,t){return e.push(t),e},[])}function fge(e,t){return P5(e,t,`post`)}function pge(e,t){return P5(e,t,`pre`)}function mge(e,t){let n=new b5,r={},i=new O5,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 hge(e,t,n,r){return gge(e,t,n,r??(t=>e.outEdges(t)??[]))}function gge(e,t,n,r){if(n===void 0)return k5(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 D5(e,t,n,r)}return k5(e,t,n,r)}function F5(e,t,n,r){let i=r;for(;e.hasNode(i);)i=G5(r);return n.dummy=t,e.setNode(i,n),i}function _ge(e){let t=new b5().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 I5(e){let t=new b5({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 L5(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 R5(e){let t=K5(H5(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 vge(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=V5(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function yge(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=V5(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 z5(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),F5(e,`border`,i,t)}function bge(e,t=B5){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var B5=65535;function V5(e,t){return t.length>B5?e(...bge(t).map(t=>e(...t))):e(...t)}function H5(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return V5(Math.max,t)}function xge(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function U5(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function W5(e,t){return t()}var Sge=0;function G5(e){return e+(``+ ++Sge)}function K5(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 q5(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function J5(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 Cge(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var Y5=`\0`,wge=`3.0.0`,Tge=class{constructor(){Khe(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return X5(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&X5(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,Ege)),n=n._prev;return`[`+e.join(`, `)+`]`}};function X5(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ege(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Dge=Tge,Oge=()=>1;function kge(e,t){if(e.nodeCount()<=1)return[];let n=jge(e,t||Oge);return Age(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Age(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Z5(e,t,n,o);for(;o=i.dequeue();)Z5(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(Z5(e,t,n,o,!0)||[]);break}}}return r}function Z5(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,Q5(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Q5(t,n,o)}),e.removeNode(r.v),o}function jge(e,t){let n=new b5,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=Mge(i+r+3).map(()=>new Dge),o=r+1;return n.nodes().forEach(e=>{Q5(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Q5(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 Mge(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Nge(e){(e.graph().acyclicer===`greedy`?kge(e,t(e)):Pge(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,G5(`rev`))});function t(e){return t=>e.edge(t).weight}}function Pge(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 Fge(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 Ige(e){e.graph().dummyChains=[],e.edges().forEach(t=>Lge(e,t))}function Lge(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=F5(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 Rge(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 $5(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=V5(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function e7(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var t7=zge;function zge(e){let t=new b5({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(;Bge(t,e)<i&&(a=Vge(t,e),a);)o=t.hasNode(a.v)?e7(e,a):-e7(e,a),Hge(t,e,o);return t}function Bge(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)&&!e7(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Vge(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=e7(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function Hge(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:Uge,postorder:Wge}=E5,Gge=n7;n7.initLowLimValues=a7,n7.initCutValues=r7,n7.calcCutValue=i7,n7.leaveEdge=s7,n7.enterEdge=c7,n7.exchangeEdges=l7;function n7(e){e=_ge(e),$5(e);let t=t7(e);a7(t),r7(t,e);let n,r;for(;n=s7(t);)r=c7(t,e,n),l7(t,e,n,r)}function r7(e,t){let n=Wge(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Kge(e,t,n))}function Kge(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=i7(e,t,n)}function i7(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,Jge(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function a7(e,t){arguments.length<2&&(t=e.nodes()[0]),o7(e,{},1,t)}function o7(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=o7(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function s7(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function c7(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===u7(e,e.node(t.v),s)&&c!==u7(e,e.node(t.w),s)).reduce((e,n)=>e7(t,n)<e7(t,e)?n:e)}function l7(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),a7(e),r7(e,t),qge(e,t)}function qge(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=Uge(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 Jge(e,t,n){return e.hasEdge(t,n)}function u7(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Yge=Xge;function Xge(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:d7(e);break;case`tight-tree`:Qge(e);break;case`longest-path`:Zge(e);break;case`none`:break;default:d7(e)}}var Zge=$5;function Qge(e){$5(e),t7(e)}function d7(e){Gge(e)}var $ge=e_e;function e_e(e){let t=n_e(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=t_e(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 t_e(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 n_e(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(Y5).forEach(r),t}function r_e(e){let t=F5(e,`root`,{},`_root`),n=i_e(e),r=Object.values(n),i=V5(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=a_e(e)+1;e.children(Y5).forEach(r=>f7(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function f7(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=z5(e,`_bt`),l=z5(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{f7(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 i_e(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(Y5).forEach(e=>n(e,1)),t}function a_e(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function o_e(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var s_e=c_e;function c_e(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)p7(e,`borderLeft`,`_bl`,n,i,t),p7(e,`borderRight`,`_br`,n,i,t)}}e.children(Y5).forEach(t)}function p7(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=F5(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function l_e(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&m7(e)}function u_e(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&d_e(e),(t===`lr`||t===`rl`)&&(f_e(e),m7(e))}function m7(e){e.nodes().forEach(t=>h7(e.node(t))),e.edges().forEach(t=>h7(e.edge(t)))}function h7(e){let t=e.width;e.width=e.height,e.height=t}function d_e(e){e.nodes().forEach(t=>g7(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(g7),Object.hasOwn(r,`y`)&&g7(r)})}function g7(e){e.y=-e.y}function f_e(e){e.nodes().forEach(t=>_7(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(_7),Object.hasOwn(r,`x`)&&_7(r)})}function _7(e){let t=e.x;e.x=e.y,e.y=t}function p_e(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=K5(V5(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 m_e(e,t){let n=0;for(let r=1;r<t.length;++r)n+=h_e(e,t[r-1],t[r]);return n}function h_e(e,t,n){let r=Cge(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 g_e(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 __e(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))}),v_e(Object.values(n).filter(e=>!e.indegree))}function v_e(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&y_e(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=>q5(e,[`vs`,`i`,`barycenter`,`weight`]))}function y_e(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 b_e(e,t){let n=xge(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(x_e(!!t)),c=v7(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=v7(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function v7(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 x_e(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function y7(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=g_e(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=y7(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&C_e(t,i)}});let u=__e(l,n);S_e(u,c);let d=b_e(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 S_e(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function C_e(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 w_e(e,t,n,r){r||=e.nodes();let i=T_e(e),a=new b5({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 T_e(e){let t;for(;e.hasNode(t=G5(`_root`)););return t}function E_e(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 b7(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,b7);return}let n=H5(e),r=x7(e,K5(1,n+1),`inEdges`),i=x7(e,K5(n-1,-1,-1),`outEdges`),a=p_e(e);if(S7(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){D_e(t%2?r:i,t%4>=2,c),a=R5(e);let l=m_e(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}S7(e,s)}function x7(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 w_e(e,t,n,r.get(t)||[])})}function D_e(e,t,n){let r=new b5;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=y7(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),E_e(e,r,a.vs)})}function S7(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function O_e(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=A_e(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)&&C7(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function k_e(e,t){let n={};function r(t,r,i,a,o){K5(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)&&C7(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 A_e(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function C7(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 j_e(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 M_e(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&&!j_e(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 N_e(e,t,n,r,i=!1){let a={},o=P_e(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 P_e(e,t,n,r){let i=new b5,a=e.graph(),o=z_e(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 F_e(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=B_e(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 I_e(e,t){let n=Object.values(t),r=V5(Math.min,n),i=V5(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-V5(Math.min,c);a!==`l`&&(l=i-V5(Math.max,c)),l&&(e[o]=J5(s,e=>e+l))})})}function L_e(e,t=void 0){let n=e.ul;return n?J5(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 R_e(e){let t=R5(e),n=Object.assign(O_e(e,t),k_e(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=M_e(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=N_e(e,i,o.root,o.align,t===`r`);t===`r`&&(s=J5(s,e=>-e)),r[a+t]=s})}),I_e(r,F_e(e,r)),L_e(r,e.graph().align)}function z_e(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 B_e(e,t){return e.node(t).width}function V_e(e){e=I5(e),H_e(e),Object.entries(R_e(e)).forEach(([t,n])=>e.node(t).x=n)}function H_e(e){let t=R5(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 U_e(e,t={}){let n=t.debugTiming?U5:W5;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>$_e(e));return n(` runLayout`,()=>W_e(r,n,t)),n(` updateInputGraph`,()=>G_e(e,r)),r})}function W_e(e,t,n){t(` makeSpaceForEdgeLabels`,()=>eve(e)),t(` removeSelfEdges`,()=>lve(e)),t(` acyclic`,()=>Nge(e)),t(` nestingGraph.run`,()=>r_e(e)),t(` rank`,()=>Yge(I5(e))),t(` injectEdgeLabelProxies`,()=>tve(e)),t(` removeEmptyRanks`,()=>yge(e)),t(` nestingGraph.cleanup`,()=>o_e(e)),t(` normalizeRanks`,()=>vge(e)),t(` assignRankMinMax`,()=>nve(e)),t(` removeEdgeLabelProxies`,()=>rve(e)),t(` normalize.run`,()=>Ige(e)),t(` parentDummyChains`,()=>$ge(e)),t(` addBorderSegments`,()=>s_e(e)),t(` order`,()=>b7(e,n)),t(` insertSelfEdges`,()=>uve(e)),t(` adjustCoordinateSystem`,()=>l_e(e)),t(` position`,()=>V_e(e)),t(` positionSelfEdges`,()=>dve(e)),t(` removeBorderNodes`,()=>cve(e)),t(` normalize.undo`,()=>Rge(e)),t(` fixupEdgeLabelCoords`,()=>ove(e)),t(` undoCoordinateSystem`,()=>u_e(e)),t(` translateGraph`,()=>ive(e)),t(` assignNodeIntersects`,()=>ave(e)),t(` reversePoints`,()=>sve(e)),t(` acyclic.undo`,()=>Fge(e))}function G_e(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 K_e=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],q_e={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},J_e=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],Y_e=[`width`,`height`,`rank`],w7={width:0,height:0},X_e=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Z_e={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Q_e=[`labelpos`];function $_e(e){let t=new b5({multigraph:!0,compound:!0}),n=E7(e.graph());return t.setGraph(Object.assign({},q_e,T7(n,K_e),q5(n,J_e))),e.nodes().forEach(n=>{let r=T7(E7(e.node(n)),Y_e);Object.keys(w7).forEach(e=>{r[e]===void 0&&(r[e]=w7[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=E7(e.edge(n));t.setEdge(n,Object.assign({},Z_e,T7(r,X_e),q5(r,Q_e)))}),t}function eve(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 tve(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);F5(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function nve(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 rve(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 ive(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 ave(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(L5(r,a)),n.points.push(L5(i,o))})}function ove(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 sve(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function cve(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 lve(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 uve(e){R5(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{F5(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 dve(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 T7(e,t){return J5(q5(e,t),Number)}function E7(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function fve(e){let t=R5(e),n=new b5({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 D7={graphlib:v5,version:wge,layout:U_e,debug:fve,util:{time:U5,notime:W5}},O7=`history-root`,pve=`top`,mve=`bottom`,k7={root:{width:320,height:80},segment:{width:320,height:112},entry:{width:320,height:192},nodeGap:48,rankGap:64};function A7(e){return`history-entry:${e}`}function j7(e){return`history-segment:${e}`}function hve(e){return e.kind===`root`?`root`:e.kind===`entry`?`e:${e.row.node.entry.id}`:`s:${e.segment.id}`}function M7(e){return k7[e.kind]}function gve(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 N7(e,t,n){let r=M7(t);return{id:e,type:`history`,position:{x:0,y:0},initialWidth:r.width,initialHeight:r.height,data:t,selected:hve(t.selection)===n,draggable:!1,connectable:!1,deletable:!1,selectable:!0,focusable:!0,sourcePosition:mve,targetPosition:pve,ariaLabel:gve(t),class:[t.isActive&&`history-node-active`,t.isOnActivePath&&`history-node-on-path`]}}function _ve(e,t){let n=new D7.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:`TB`,ranker:`tight-tree`,nodesep:k7.nodeGap,ranksep:k7.rankGap,marginx:k7.nodeGap,marginy:k7.nodeGap});for(let t of e){let e=M7(t.data);n.setNode(t.id,{...e})}for(let e of t)n.setEdge(e.source,e.target);return D7.layout(n),e.map(e=>{let t=n.node(e.id),r=M7(e.data);return{...e,position:t?{x:t.x-r.width/2,y:t.y-r.height/2}:e.position}})}function vve({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,A7(t.row.node.entry.id));else{let e=j7(t.segment.id);for(let n of t.segment.rows)o.set(n.node.entry.id,e)}let s=[N7(O7,{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(N7(A7(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(N7(j7(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`:O7;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:_ve(s,c),edges:c,visibleNodeIdByEntryId:o}}function yve(e,t,n){return{...e,nodes:e.nodes.map(e=>({...e,data:{...e.data,zoomTier:t,actions:n}}))}}function bve(e){return e<.4?`overview`:e<.85?`summary`:`detail`}var xve=new Set([`$$slots`,`$$events`,`$$legacy`]);function P7(e,t){let n=H(t,xve),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`}]];N(e,B({name:`unfold-vertical`},()=>n,{get iconNode(){return r}}))}var Sve=new Set([`$$slots`,`$$events`,`$$legacy`]);function F7(e,t){let n=H(t,Sve),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`}]];N(e,B({name:`brain`},()=>n,{get iconNode(){return r}}))}var Cve=new Set([`$$slots`,`$$events`,`$$legacy`]);function wve(e,t){let n=H(t,Cve),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`}]];N(e,B({name:`clipboard-check`},()=>n,{get iconNode(){return r}}))}var Tve=new Set([`$$slots`,`$$events`,`$$legacy`]);function Eve(e,t){let n=H(t,Tve),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`}]];N(e,B({name:`cpu`},()=>n,{get iconNode(){return r}}))}var Dve=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ove(e,t){let n=H(t,Dve),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`}]];N(e,B({name:`file-pen`},()=>n,{get iconNode(){return r}}))}var kve=new Set([`$$slots`,`$$events`,`$$legacy`]);function I7(e,t){let n=H(t,kve),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`}]];N(e,B({name:`file-plus`},()=>n,{get iconNode(){return r}}))}var Ave=new Set([`$$slots`,`$$events`,`$$legacy`]);function jve(e,t){let n=H(t,Ave),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`}]];N(e,B({name:`globe`},()=>n,{get iconNode(){return r}}))}var Mve=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nve(e,t){let n=H(t,Mve),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`}]];N(e,B({name:`hand`},()=>n,{get iconNode(){return r}}))}var Pve=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fve(e,t){let n=H(t,Pve),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`}]];N(e,B({name:`message-circle-question-mark`},()=>n,{get iconNode(){return r}}))}var Ive=new Set([`$$slots`,`$$events`,`$$legacy`]);function Lve(e,t){let n=H(t,Ive),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];N(e,B({name:`search`},()=>n,{get iconNode(){return r}}))}var Rve=new Set([`$$slots`,`$$events`,`$$legacy`]);function L7(e,t){let n=H(t,Rve),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`}]];N(e,B({name:`wrench`},()=>n,{get iconNode(){return r}}))}var R7={user:OI,sparkles:hz,brain:F7,wrench:L7,"file-text":$u,terminal:sd,"file-pen":Ove,"file-plus":I7,search:Lve,"folder-search":k2,"folder-tree":F2,globe:jve,download:d2,cpu:Eve,bot:l2,"message-circle-question":Fve,"clipboard-list":zg,"clipboard-check":wve,"list-todo":YX,"fold-vertical":R_,"git-branch":XI,info:I2,hand:Nve,"triangle-alert":$Y},z7={default:`text-muted-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,danger:`text-destructive`},zve=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>`),Bve=h(`<!> New branch from beginning`,1),Vve=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>`),Hve=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>`),Uve=h(`<!> Expand in tree`,1),Wve=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>`),Gve=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>`),Kve=h(`<span><!> <!></span>`),qve=h(`<span class="flex items-center gap-1"><!> </span>`),Jve=h(`<!> Branch from here`,1),Yve=h(`<!> Edit & resend`,1),Xve=h(`<span class="rounded-full border px-1.5 py-0.5"> </span>`),Zve=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>`),Qve=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>`),$ve=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>`),eye=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>`),tye=h(`<p class="text-xs text-muted-foreground">No tool details available for this entry.</p>`),nye=h(`<div class="flex flex-col gap-3"><!> <!> <!> <!> <!></div>`),rye=h(`<div class="text-sm text-muted-foreground"><!></div>`),iye=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>`),aye=h(`<div class="text-sm text-foreground"><!></div> <!>`,1),oye=h(`<p class="text-xs text-muted-foreground">This entry has no text content.</p>`),sye=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 cye(e,t){a(t,!0);let n=q(()=>t.selection?.kind===`entry`?t.selection.row.node.entry:void 0),i=q(()=>W(n)?g5(W(n),t.toolCallsById):void 0),o=q(()=>W(i)?.descriptor),c=q(()=>W(i)?.record);async function l(e){try{await cd(e),Jn.success(`Copied entry id`)}catch{Jn.error(`Could not copy to clipboard`)}}var u=U(),f=L(u),p=e=>{g(e,zve())},m=e=>{var n=Vve(),r=V(n);XI(V(r),{class:`size-5`,strokeWidth:2}),w(2),d(r);var i=I(r,4);Oe(V(i),{size:`sm`,onclick:()=>t.onNavigateToEntry?.(void 0),children:(e,t)=>{var n=Bve();XI(L(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}}),d(i),d(n),g(e,n)},h=e=>{let n=q(()=>t.selection.segment);var i=Gve(),a=V(i),o=V(a),c=V(o);d(o);var l=I(o,2),u=V(l);d(l),d(a);var f=I(a,2);_(f,21,()=>W(n).parts,E,(e,t)=>{let n=q(()=>R7[W(t).icon]);var r=Hve(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{class:`size-3.5`,strokeWidth:2})});var a=I(i,2),o=V(a,!0);d(a);var s=I(a);d(r),P(()=>{A(o,W(t).count),A(s,` ${W(t).label??``}`)}),g(e,r)}),d(f);var p=I(f,2);Oe(V(p),{variant:`outline`,size:`sm`,onclick:()=>t.onExpandSegment?.(W(n).id),children:(e,t)=>{var n=Uve();P7(L(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}}),d(p);var m=I(p,2);_(m,21,()=>W(n).rows,e=>e.node.entry.id,(e,n)=>{let i=q(()=>g5(W(n).node.entry,t.toolCallsById).descriptor),a=q(()=>R7[W(i).icon]);var o=Wve(),c=V(o);C(V(c),()=>W(a),(e,t)=>{t(e,{class:`size-3.5`,strokeWidth:2})}),d(c);var l=I(c,2),u=V(l,!0);d(l);var f=I(l,2);let p;var m=V(f,!0);d(f),d(o),P(()=>{s(c,1,`flex size-4 shrink-0 items-center justify-center ${z7[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),P((e,t)=>{A(c,`${W(n).total??``} collapsed steps`),A(u,`${e??``} — ${t??``}`)},[()=>C2(W(n).startedAt),()=>C2(W(n).endedAt)]),g(e,i)},v=e=>{let a=q(()=>R7[W(o).icon]),u=q(()=>W(i)?.thinkingText??``);var f=sye(),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=I(h,2),y=V(v,!0);d(v),_(I(v,2),17,()=>W(o).badges,E,(e,t)=>{let n=q(()=>R7[W(t).icon]);var r=Kve(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{class:`size-3.5`,strokeWidth:2})});var a=I(i,2),o=e=>{var n=M();P(()=>A(n,W(t).label)),g(e,n)};k(a,e=>{W(t).label&&e(o)}),d(r),P(()=>{s(r,1,`flex items-center gap-0.5 text-xs ${z7[W(t).tone]}`),K(r,`title`,W(t).title??W(t).label)}),g(e,r)}),d(m);var b=I(m,2),x=V(b),S=V(x);d(x);var T=I(x,2),D=e=>{var t=qve(),r=V(t);hz(r,{class:`size-3.5`,strokeWidth:2});var i=I(r);d(t),P(e=>A(i,` ${e??``} tokens`),[()=>W(n).usage.totalTokens.toLocaleString()]),g(e,t)};k(T,e=>{W(n).usage?.totalTokens&&e(D)});var O=I(T,2),ee=V(O);Zu(ee,{class:`size-3 shrink-0`,strokeWidth:2});var te=I(ee,2),ne=V(te,!0);d(te),d(O),d(b);var j=I(b,2),re=V(j);Oe(re,{size:`sm`,onclick:()=>t.onNavigateToEntry?.(W(n).id),children:(e,t)=>{var n=Jve();XI(L(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}});var ie=I(re,2),N=e=>{Oe(e,{variant:`outline`,size:`sm`,onclick:()=>t.onEditEntry?.(W(n)),children:(e,t)=>{var n=Yve();vy(L(n),{class:`size-4`,strokeWidth:2}),w(),g(e,n)},$$slots:{default:!0}})};k(ie,e=>{W(n).role===`user`&&e(N)}),d(j),d(p);var ae=I(p,2),oe=V(ae),se=e=>{var t=nye(),n=V(t),r=e=>{var t=Zve(),n=I(V(t),2),r=V(n,!0);d(n);var a=I(n,2),o=e=>{var t=Xve(),n=V(t,!0);d(t),P(()=>A(n,W(c).status)),g(e,t)};k(a,e=>{W(c)?.status&&e(o)}),d(t),P(()=>A(r,W(i).toolName)),g(e,t)};k(n,e=>{W(i).toolName&&e(r)});var a=I(n,2),o=e=>{var t=Qve(),n=I(V(t),2),r=V(n,!0);d(n),d(t),P(()=>A(r,W(i).argsText)),g(e,t)};k(a,e=>{W(i).argsText&&e(o)});var s=I(a,2),l=e=>{var t=$ve(),n=I(V(t),2),r=V(n,!0);d(n),d(t),P(()=>A(r,W(i).resultText)),g(e,t)};k(s,e=>{W(i).resultText&&e(l)});var u=I(s,2),f=e=>{var t=eye(),n=I(V(t),2),r=V(n,!0);d(n),d(t),P(()=>A(r,W(i).errorText)),g(e,t)};k(u,e=>{W(i).errorText&&e(f)});var p=I(u,2),m=e=>{g(e,tye())};k(p,e=>{!W(i).argsText&&!W(i).resultText&&!W(i).errorText&&e(m)}),d(t),g(e,t)},ce=e=>{var t=rye();TA(V(t),{get text(){return W(u)}}),d(t),g(e,t)},le=e=>{var t=aye(),r=L(t),i=V(r),a=e=>{{let t=q(()=>W(n).summary||W(n).text);Ty(e,{get text(){return W(t)}})}},o=e=>{{let t=q(()=>W(n).summary||W(n).text),r=q(()=>W(n).role!==`assistant`);TA(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=I(r,2),c=e=>{var t=iye();TA(I(V(t),2),{get text(){return W(u)}}),d(t),g(e,t)};k(s,e=>{W(u)&&e(c)}),g(e,t)},ue=e=>{g(e,oye())};k(oe,e=>{W(i)?.isToolEntry?e(se):W(u)&&!W(n).text?e(ce,1):W(n).summary||W(n).text?e(le,2):e(ue,-1)}),d(ae),d(f),P((e,t)=>{s(h,1,`flex size-5 shrink-0 items-center justify-center ${z7[W(o).tone]}`),A(y,W(o).label),K(x,`title`,e),A(S,`${t??``} ago`),K(O,`title`,W(n).id),A(ne,W(n).id)},[()=>C2(W(n).createdAt),()=>S2(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),R()}T([`click`]);var lye=new Set([`$$slots`,`$$events`,`$$legacy`]);function uye(e,t){let n=H(t,lye),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`}]];N(e,B({name:`locate-fixed`},()=>n,{get iconNode(){return r}}))}var dye=new Set([`$$slots`,`$$events`,`$$legacy`]);function fye(e,t){let n=H(t,dye),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`}]];N(e,B({name:`scan`},()=>n,{get iconNode(){return r}}))}var pye=new Set([`$$slots`,`$$events`,`$$legacy`]);function B7(e,t){let n=H(t,pye),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`}]];N(e,B({name:`zoom-in`},()=>n,{get iconNode(){return r}}))}var mye=new Set([`$$slots`,`$$events`,`$$legacy`]);function V7(e,t){let n=H(t,mye),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`}]];N(e,B({name:`zoom-out`},()=>n,{get iconNode(){return r}}))}var hye=h(`<span class="mx-0.5 h-5 w-px bg-border" aria-hidden="true"></span> <!>`,1),gye=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 _ye(e,t){a(t,!0);let{fitView:n,getNode:r,getZoom:i,setCenter:o,zoomIn:s,zoomOut:c}=t5(),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})}z(()=>{t.fitRequest<=l||(l=t.fitRequest,queueMicrotask(f))}),z(()=>{!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})}))}),r5(e,{position:`top-left`,children:(e,n)=>{var r=gye(),i=V(r);Oe(i,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Zoom in`,title:`Zoom in`,onclick:()=>void s({duration:120}),children:(e,t)=>{B7(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var a=I(i,2);Oe(a,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Zoom out`,title:`Zoom out`,onclick:()=>void c({duration:120}),children:(e,t)=>{V7(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var o=I(a,2);Oe(o,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Fit entire graph`,title:`Fit entire graph`,onclick:f,children:(e,t)=>{fye(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var l=I(o,2);Oe(l,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Focus active entry`,title:`Focus active entry`,onclick:p,children:(e,t)=>{uye(e,{class:`size-4`,strokeWidth:2})},$$slots:{default:!0}});var u=I(l,2),m=e=>{var n=hye(),r=I(L(n),2);{let e=q(()=>t.allExpanded?`Collapse all tool runs`:`Expand all tool runs`),n=q(()=>t.allExpanded?`Collapse all tool runs`:`Expand all tool runs`);Oe(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=L(r),a=e=>{R_(e,{class:`size-4`,strokeWidth:2})},o=e=>{P7(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}}),R()}var vye=h(`<span><!></span>`),yye=h(`<span class="flex size-10 items-center justify-center rounded-full border border-dashed bg-card text-muted-foreground"><!></span>`),bye=h(`<span class="flex size-10 items-center justify-center rounded-full border bg-card text-primary"><!></span>`),xye=h(`<div class="flex h-full items-center justify-center"><!></div>`),Sye=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>`),Cye=h(`<span class="rounded-full border bg-muted/40 px-1.5 py-0.5 text-xs text-muted-foreground"> </span>`),wye=h(`<div class="flex flex-wrap gap-1 overflow-hidden"></div>`),Tye=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>`),Eye=h(`<span><!> <!></span>`),Dye=h(`<span class="truncate font-mono"> </span>`),Oye=h(`<pre> </pre>`),kye=h(`<p> </p>`),Aye=h(`<div class="flex items-center justify-end gap-1 border-t px-2 py-1.5"><!> <!></div>`),jye=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),Mye=h(`<div role="group"><!> <!> <!></div>`);function Nye(e,t){a(t,!0);let n=e=>{var n=Mye();let a;var c=V(n),l=e=>{P8(e,{type:`target`,get position(){return f6.Top},isConnectable:!1})};k(c,e=>{t.data.kind!==`root`&&e(l)});var f=I(c,2),p=e=>{var n=xye(),r=V(n),i=e=>{let n=q(()=>R7[t.data.view.descriptor.icon]);var r=vye();C(V(r),()=>W(n),(e,t)=>{t(e,{class:`size-5`,strokeWidth:2})}),d(r),P(()=>s(r,1,`flex size-10 items-center justify-center rounded-full border bg-card ${z7[t.data.view.descriptor.tone]}`)),g(e,r)},a=e=>{var t=yye();P7(V(t),{class:`size-5`,strokeWidth:2}),d(t),g(e,t)},o=e=>{var t=bye();XI(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=Sye(),n=V(t);XI(V(n),{class:`size-4`,strokeWidth:2}),d(n),w(2),d(t),g(e,t)},h=e=>{var n=Tye(),r=V(n),i=V(r);P7(V(i),{class:`size-4`,strokeWidth:2}),d(i);var a=I(i,2),s=V(a),c=V(s);d(s);var l=I(s,2),u=V(l,!0);d(l),d(a),Oe(I(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)=>{P7(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}}),d(r);var f=I(r,2),p=e=>{var n=wye();_(n,21,()=>t.data.segment.parts.slice(0,4),e=>e.label,(e,t)=>{var n=Cye(),r=V(n);d(n),P(()=>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),P(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=q(()=>t.data.view.descriptor),r=q(()=>R7[W(n).icon]);var i=jye(),a=L(i),c=V(a);C(V(c),()=>W(r),(e,t)=>{t(e,{class:`size-4`,strokeWidth:2})}),d(c);var l=I(c,2),f=V(l),p=V(f),m=V(p,!0);d(p);var h=I(p,2),v=V(h,!0);d(h),_(I(h,2),17,()=>W(n).badges,E,(e,t)=>{let n=q(()=>R7[W(t).icon]);var r=Eye(),i=V(r);C(i,()=>W(n),(e,t)=>{t(e,{class:`size-3`,strokeWidth:2})});var a=I(i,2),o=e=>{var n=M();P(()=>A(n,W(t).label)),g(e,n)};k(a,e=>{W(t).label&&e(o)}),d(r),P(()=>{s(r,1,`flex shrink-0 items-center gap-0.5 text-xs ${z7[W(t).tone]}`),K(r,`title`,W(t).title??W(t).label)}),g(e,r)}),d(f);var y=I(f,2),b=V(y),x=V(b);d(b);var S=I(b,2),w=e=>{var n=Dye(),r=V(n,!0);d(n),P(()=>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=I(a,2),D=V(T),O=e=>{var r=Oye();let i;var a=V(r,!0);d(r),P(()=>{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=kye();let r;var i=V(t,!0);d(t),P(()=>{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=I(T,2),ne=e=>{var n=Aye(),r=V(n);Oe(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)=>{XI(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}});var i=I(r,2),a=e=>{Oe(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)=>{vy(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)}),P((e,t)=>{s(c,1,`flex size-7 shrink-0 items-center justify-center rounded-md bg-muted/50 ${z7[W(n).tone]}`),A(m,e),A(v,W(n).label),A(x,`${t??``} ago`)},[()=>String(t.data.row.index).padStart(2,`0`),()=>S2(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=I(f,2),b=e=>{P8(e,{type:`source`,get position(){return f6.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),P(()=>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=q(()=>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 cd(e),Jn.success(`Copied entry id`)}catch{Jn.error(`Could not copy to clipboard`)}}function l(e){let t=e.row.node.entry,n=[{label:`Branch from here`,icon:XI,onSelect:()=>e.actions?.onNavigateToEntry?.(t.id)}];return t.role===`user`&&n.push({label:`Edit & resend`,icon:vy,onSelect:()=>e.actions?.onEditEntry?.(t)}),n.push({type:`separator`},{label:`Copy entry id`,icon:Zu,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=L(f),m=e=>{{let r=q(()=>l(t.data));fn(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),R()}T([`dblclick`]);var Pye=new Set([`assistant`,`tool_call`,`tool_result`,`system`]);function Fye(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 Iye(e,t,n){let r=e.map(e=>p5(e.node.entry,t)),i=t=>{let n=e[t];return!n.isActive&&!n.isLeaf&&!n.isBranchPoint&&Pye.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=Fye(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 Lye(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 Rye=h(`<!> <!> <!>`,1),zye=h(`<aside class="flex min-w-80 w-1/3 max-w-md shrink-0 flex-col overflow-hidden border-l bg-card" 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>`),Bye=h(`<div class="flex h-full min-h-0"><div class="relative min-w-0 flex-1"><!></div> <!></div>`),Vye=h(`<div class="flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground">No conversation history loaded.</div>`),Hye=h(`<div class="history-graph relative h-full min-h-0 overflow-hidden bg-background svelte-xljnpe"><!></div>`);function Uye(e,t){a(t,!0);let n=F(t,`treeNodes`,19,()=>[]),r=F(t,`toolCalls`,19,()=>[]),i={history:Nye},o=q(()=>new Map(r().map(e=>[e.id,e]))),s=q(()=>Vhe(n(),t.activeConversation?.activeEntryId)),c=q(()=>!!t.activeConversation),l=q(()=>!!(t.activeConversation&&!t.activeConversation.activeEntryId)),u=q(()=>W(l)||W(s).rows.some(e=>e.isOnActivePath)),f=q(()=>new Map(n().map(({entry:e})=>[e.id,g5(e,W(o))]))),p=J(ie(new Set)),m=J(void 0),h=J(!1),_=J(`summary`),v=J(0),y=J(0),b=J(void 0),x=J(!1),S=q(()=>Iye(W(s).rows,W(o),W(p))),C=q(()=>W(m)?Lye(W(m)):``),w=q(()=>W(S).segments.length>0&&W(S).segments.every(e=>W(p).has(e.id))),T=q(()=>vve({visible:W(S),hasConversation:W(c),rootActive:W(l),rootOnActivePath:W(u),selectedKey:W(C),entryViewById:W(f)})),E=q(()=>({onToggleSegment:j,onNavigateToEntry:t.onNavigateToEntry,onEditEntry:t.onEditEntry})),D=q(()=>yve(W(T),W(_),W(E))),O=q(()=>t.activeConversation?.activeEntryId?W(T).visibleNodeIdByEntryId.get(t.activeConversation.activeEntryId)??A7(t.activeConversation.activeEntryId):O7),ee;z(()=>{let e=t.activeConversation?.id;if(e===ee)return;ee=e,G(p,new Set,!0),G(h,!1),e||G(x,!1);let n=t.activeConversation?.activeEntryId,r=n?W(s).rows.find(e=>e.node.entry.id===n):void 0;G(m,t.activeConversation?r?{kind:`entry`,row:r}:{kind:`root`}:void 0,!0),G(v,W(v)+1)});function te(e){G(b,{id:e,serial:se(y)},!0)}function A(e){G(m,e,!0),G(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 be(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)&&G(m,{kind:`segment`,segment:e},!0),G(p,t,!0),te(`history-segment:${e.id}`);return}t.add(e.id),G(p,t,!0);let n=e.rows[0];n&&G(m,{kind:`entry`,row:n},!0),te(n?A7(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;G(p,new Set,!0),e&&(G(m,{kind:`segment`,segment:e},!0),te(`history-segment:${e.id}`));return}if(G(p,new Set(W(S).segments.map(e=>e.id)),!0),W(m)?.kind===`segment`){let e=W(m).segment.rows[0];e&&(G(m,{kind:`entry`,row:e},!0),te(A7(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 N(e){let t=ne(e.node.entry.id);if(t&&!W(p).has(t.id)){let e=new be(W(p));e.add(t.id),G(p,e,!0)}G(m,{kind:`entry`,row:e},!0),te(A7(e.node.entry.id))}function ae(e,t){let n=bve(t.zoom);n!==W(_)&&G(_,n,!0)}function oe(e){A(e.data.selection)}function ce(e){!W(x)||e.length!==1||A(e[0].data.selection)}function P(e){return e.data.isActive||e.data.isOnActivePath?`var(--primary)`:`var(--muted-foreground)`}var le=Hye(),ue=V(le),de=e=>{var n=Bye(),r=V(n);yhe(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:ae,onnodeclick:({node:e})=>oe(e),onselectionchange:({nodes:e})=>ce(e),onpaneclick:()=>G(h,!1),oninit:()=>queueMicrotask(()=>{G(x,!0)}),children:(e,t)=>{var n=Rye(),r=L(n);Ehe(r,{gap:24,size:1});var i=I(r,2);Fhe(i,{position:`bottom-left`,pannable:!0,zoomable:!0,nodeColor:P,nodeStrokeColor:P,nodeStrokeWidth:2,nodeBorderRadius:6,ariaLabel:`Conversation graph minimap`});var a=I(i,2);{let e=q(()=>W(S).segments.length>0);_ye(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=I(r,2),s=e=>{var n=zye(),r=V(n);Oe(I(V(r),2),{variant:`ghost`,size:`icon-xs`,ariaLabel:`Close details`,title:`Close details`,onclick:()=>G(h,!1),children:(e,t)=>{Ol(e,{class:`size-3.5`,strokeWidth:2})},$$slots:{default:!0}}),d(r);var i=I(r,2);cye(V(i),{get selection(){return W(m)},get toolCallsById(){return W(o)},get onNavigateToEntry(){return t.onNavigateToEntry},get onEditEntry(){return t.onEditEntry},onSelectRow:N,onExpandSegment:re}),d(i),d(n),g(e,n)};k(a,e=>{W(h)&&W(m)&&e(s)}),d(n),g(e,n)},fe=e=>{g(e,Vye())};k(ue,e=>{W(c)?e(de):e(fe,-1)}),d(le),g(e,le),R()}function Wye(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`treeNodes`,19,()=>[]),i=F(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)}ZP(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)=>{Uye(e,{get activeConversation(){return t.activeConversation},get treeNodes(){return r()},get toolCalls(){return i()},onNavigateToEntry:s,onEditEntry:c})},$$slots:{default:!0}}),R()}var Gye=h(`<!> `,1),Kye=h(`<!> Open`,1),qye=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 H7(e,t){a(t,!0);let n=F(t,`signals`,19,()=>[]),r=F(t,`loading`,3,!1);var i=qye(),o=L(i),s=V(o);On(s,{size:14,strokeWidth:2.1,"aria-hidden":`true`,class:`flex-none text-primary`});var c=I(s,2),l=V(c,!0);d(c);var u=I(c,2);_(u,20,n,e=>e,(e,n)=>{let r=q(()=>t.signalMeta[n]),i=q(()=>W(r).icon);{let t=q(()=>W(r).tone??`neutral`);Hi(e,{get tone(){return W(t)},size:`xs`,get title(){return W(r).title},children:(e,t)=>{var n=Gye(),a=L(n);C(a,()=>W(i),(e,t)=>{t(e,{size:11,strokeWidth:2.2})});var o=I(a,1,!0);P(()=>A(o,W(r).label)),g(e,n)},$$slots:{default:!0}})}}),d(u),d(o);var f=I(o,2),p=V(f);{let e=q(()=>!t.path||r()),n=q(()=>t.path?`Open ${t.path}`:`Open`);Oe(p,{size:`sm`,get disabled(){return W(e)},get title(){return W(n)},get onclick(){return t.onOpen},children:(e,t)=>{var n=Kye();On(L(n),{size:14,strokeWidth:2.2}),w(),g(e,n)},$$slots:{default:!0}})}d(f),P(e=>{K(o,`title`,t.path),A(l,e)},[()=>t.path?gf(t.path,t.homeDir):`—`]),g(e,i),R()}var Jye=h(`<span class="ml-auto text-muted-foreground tabular-nums"> </span>`),Yye=h(`<span class="skeleton-row svelte-cb8hzu"></span>`),Xye=h(`<div class="grid gap-0.5" aria-label="Loading directories"></div>`),Zye=h(`<!>Opened`,1),Qye=h(`<!> `,1),$ye=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>`),ebe=h(`<div class="grid gap-0.5" role="listbox" aria-label="Folders"></div>`),tbe=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>`),nbe=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 rbe(e,t){a(t,!0);let n=F(t,`listEl`,15);var i=nbe(),o=V(i),c=V(o),l=I(V(c),2),u=e=>{var n=Jye(),r=V(n,!0);d(n),P(()=>A(r,t.filteredEntries.length)),g(e,n)};k(l,e=>{!t.loading&&t.filteredEntries.length&&e(u)}),d(c);var f=I(c,2),p=e=>{var t=Xye();_(t,20,()=>[0,1,2,3,4,5,6],e=>e,(e,t)=>{g(e,Yye())}),d(t),g(e,t)},m=e=>{var n=ebe();K(n,`tabindex`,-1),_(n,23,()=>t.filteredEntries,e=>e.path,(e,n,i)=>{let a=q(()=>W(i));var o=$ye();let c;var l=V(o);mn(l,{size:15,strokeWidth:2.1,"aria-hidden":`true`,class:`flex-none text-muted-foreground`});var u=I(l,2),f=V(u),p=V(f,!0);d(f),d(u);var m=I(u,2),h=V(m),v=e=>{Hi(e,{tone:`good`,size:`xs`,children:(e,t)=>{var n=Zye();Fv(L(n),{size:11}),w(),g(e,n)},$$slots:{default:!0}})},y=q(()=>t.isOpened(W(n).path));k(h,e=>{W(y)&&e(v)});var b=I(h,2);_(b,16,()=>t.uniqueSignals(W(n).signals),e=>e,(e,n)=>{let r=q(()=>t.signalMeta[n]),i=q(()=>W(r).icon);{let t=q(()=>W(r).tone??`neutral`);Hi(e,{get tone(){return W(t)},size:`xs`,get title(){return W(r).title},children:(e,t)=>{var n=Qye(),a=L(n);C(a,()=>W(i),(e,t)=>{t(e,{size:11,strokeWidth:2.2})});var o=I(a,1,!0);P(()=>A(o,W(r).label)),g(e,n)},$$slots:{default:!0}})}});var x=I(b,2);dt(V(x),{size:15,strokeWidth:2.2,"aria-hidden":`true`}),d(x),d(m),d(o),P(()=>{K(o,`id`,`folder:${W(n).path}`),c=s(o,1,`row svelte-cb8hzu`,null,c,{selected:t.selectedIndex===W(a)}),K(o,`aria-selected`,t.selectedIndex===W(a)),K(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),P(()=>K(n,`aria-activedescendant`,t.selectedItem?.kind===`folder`?t.activeDescendant:void 0)),g(e,n)},h=e=>{var n=tbe(),r=V(n);On(r,{size:26,strokeWidth:1.8});var i=I(r,2),a=V(i,!0);d(i);var o=I(i,2),s=V(o,!0);d(o),d(n),P((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),pe(i,e=>n(e),()=>n()),g(e,i),R()}T([`click`,`dblclick`,`keydown`]);var ibe=new Set([`$$slots`,`$$events`,`$$legacy`]);function U7(e,t){let n=H(t,ibe),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];N(e,B({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var abe=new Set([`$$slots`,`$$events`,`$$legacy`]);function obe(e,t){let n=H(t,abe),r=[[`path`,{d:`M8 6L12 2L16 6`}],[`path`,{d:`M12 2V22`}]];N(e,B({name:`move-up`},()=>n,{get iconNode(){return r}}))}var sbe=h(`<!> <span class="h-4.5 w-px bg-border/70" aria-hidden="true"></span>`,1),cbe=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>`),lbe=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" type="button"> </button>`),ube=h(`<!> <!>`,1),dbe=h(`<div class="flex items-center gap-2 border-b border-b-border/60 py-1.5 pr-2.5 pl-3"><!> <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 fbe(e,t){a(t,!0);let n=F(t,`query`,15),i=F(t,`showHidden`,15);var o=dbe(),s=L(o),c=V(s),l=e=>{var n=sbe();Oe(L(n),{variant:`ghost`,size:`icon-sm`,title:`Back to recents`,ariaLabel:`Back to recents`,get onclick(){return t.onBack},children:(e,t)=>{U7(e,{size:15,strokeWidth:2.2})},$$slots:{default:!0}}),w(2),g(e,n)};k(c,e=>{t.onBack&&e(l)});var u=I(c,2);_(u,23,()=>t.crumbs,e=>e.path,(e,n,i)=>{var a=ube(),o=L(a),s=e=>{dt(e,{class:`flex-none text-muted-foreground/55`,size:13,strokeWidth:2.2,"aria-hidden":`true`})};k(o,e=>{W(i)>0&&e(s)});var c=I(o,2),l=e=>{var t=cbe(),r=V(t,!0);d(t),P(()=>{K(t,`title`,W(n).path),A(r,W(n).label)}),g(e,t)},u=e=>{var i=lbe(),a=V(i,!0);d(i),P(()=>{K(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=I(u,2),p=V(f);{let e=q(()=>!t.parent||t.loading);Oe(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)=>{obe(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}})}var m=I(p,2);Oe(m,{variant:`ghost`,size:`icon-sm`,get disabled(){return t.loading},title:`Refresh`,ariaLabel:`Refresh`,get onclick(){return t.onReload},children:(e,t)=>{El(e,{size:14,strokeWidth:2.2})},$$slots:{default:!0}}),h_(I(m,4),{label:`Hidden`,class:`h-7 gap-1.5 rounded-sm border border-border/60 bg-input px-1.5 text-xs`,get checked(){return i()},set checked(e){i(e)}}),d(f),d(s);var h=I(s,2);w_(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),de(`submit`,h,function(...e){t.onSubmit?.apply(this,e)}),g(e,o),R()}T([`click`]);var pbe=new Set([`$$slots`,`$$events`,`$$legacy`]);function mbe(e,t){let n=H(t,pbe),r=[[`path`,{d:`M16 14v2.2l1.6 1`}],[`path`,{d:`M7 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 2`}],[`circle`,{cx:`16`,cy:`16`,r:`6`}]];N(e,B({name:`folder-clock`},()=>n,{get iconNode(){return r}}))}var hbe=h(`<span class="ml-auto text-muted-foreground tabular-nums"> </span>`),gbe=h(`<button class="recent-browse-hint svelte-15ciugr" type="button"><!> <span>Browse <strong> </strong></span></button>`),_be=h(`<div role="option" tabindex="-1"><span class="recent-card-icon svelte-15ciugr" aria-hidden="true"><!></span> <div class="grid min-w-0 gap-px"><div><strong class="block overflow-hidden text-sm font-semibold text-ellipsis whitespace-nowrap"> </strong></div> <div class="flex items-center gap-1 overflow-hidden text-xs whitespace-nowrap text-muted-foreground tabular-nums"><span> </span> <span class="text-muted-foreground/55" aria-hidden="true">·</span> <span> </span></div> <div class="overflow-hidden font-mono text-xs text-ellipsis whitespace-nowrap text-muted-foreground/85"> </div></div></div>`),vbe=h(`<div class="grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-1.5" role="listbox" aria-label="Recent projects"></div>`),ybe=h(`<div class="grid min-h-40 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">Use Browse folders below to open a project.</span></div>`),bbe=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"><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>Recent</span> <!></header> <!></section></div>`,1);function xbe(e,t){a(t,!0);let n=F(t,`scrollEl`,15),i=F(t,`query`,15);function o(e){let n=[{label:`New chat`,icon:wl,onSelect:()=>t.onNewChat(e.dir)},{label:`Copy path`,icon:Zu,onSelect:()=>t.onCopyPath(e.dir)}];return t.onForget&&n.push({type:`separator`},{label:`Forget project`,icon:by,destructive:!0,onSelect:()=>t.onForget?.(e.id)}),n}var c=bbe(),l=L(c);w_(V(l),{onValueChange:()=>t.onQueryChange?.(),placeholder:`Search recent projects or paste a path`,get disabled(){return t.loading},inputClass:`font-mono`,ariaLabel:`Search recent projects or enter a path`,get value(){return i()},set value(e){i(e)}}),d(l);var u=I(l,2),f=V(u),p=V(f),m=I(V(p),2),h=e=>{var n=hbe(),r=V(n,!0);d(n),P(()=>A(r,t.totalRecentCount)),g(e,n)};k(m,e=>{t.totalRecentCount&&e(h)}),d(p);var v=I(p,2),y=e=>{var n=gbe(),a=V(n);yL(a,{size:14,strokeWidth:2.2,"aria-hidden":`true`});var o=I(a,2),s=I(V(o)),c=V(s,!0);d(s),d(o),d(n),P(e=>A(c,e),[()=>i().trim()]),r(`click`,n,function(...e){t.onBrowsePath?.apply(this,e)}),g(e,n)},b=e=>{var n=vbe();K(n,`tabindex`,-1),_(n,23,()=>t.recentProjects,e=>e.id,(e,n,i)=>{let a=q(()=>t.conversationCountFor(W(n)));{let c=q(()=>o(W(n)));fn(e,{get items(){return W(c)},triggerClass:`contents`,children:(e,o)=>{var c=_be();let l;var u=V(c);mbe(V(u),{size:18,strokeWidth:2.05}),d(u);var f=I(u,2),p=V(f),m=V(p),h=V(m,!0);d(m),d(p);var _=I(p,2),v=V(_),y=V(v);d(v);var b=I(v,4),x=V(b,!0);d(b),d(_);var S=I(_,2),C=V(S,!0);d(S),d(f),d(c),P((e,r,o)=>{K(c,`id`,`recent:${W(n).id}`),l=s(c,1,`recent-card svelte-15ciugr`,null,l,{selected:t.selectedIndex===W(i)}),K(c,`aria-selected`,t.selectedIndex===W(i)),K(c,`title`,e),A(h,W(n).name),A(y,`${W(a)??``} chat${W(a)===1?``:`s`}`),A(x,r),A(C,o)},[()=>`${W(n).dir}\n${C2(W(n).updatedAt)}`,()=>S2(W(n).updatedAt),()=>Sf(W(n).dir,t.homeDir)]),r(`click`,c,()=>t.onOpen(W(n))),de(`mouseenter`,c,()=>t.onSelectedIndexChange?.(W(i))),r(`keydown`,c,e=>t.onRowKeydown(e,W(i),W(n))),g(e,c)},$$slots:{default:!0}})}}),d(n),P(()=>K(n,`aria-activedescendant`,t.activeDescendant)),g(e,n)},x=e=>{var n=ybe(),r=V(n);On(r,{size:26,strokeWidth:1.8});var i=I(r,2),a=V(i,!0);d(i),w(2),d(n),P(()=>A(a,t.totalRecentCount?`No recent projects match your search.`:`No recent projects yet.`)),g(e,n)};k(v,e=>{t.pathQuery?e(y):t.recentProjects.length?e(b,1):e(x,-1)}),d(f),d(u),pe(u,e=>n(e),()=>n()),de(`submit`,l,function(...e){t.onSubmit?.apply(this,e)}),g(e,c),R()}T([`click`,`keydown`]);var Sbe=new Set([`$$slots`,`$$events`,`$$legacy`]);function W7(e,t){let n=H(t,Sbe),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`}]];N(e,B({name:`package`},()=>n,{get iconNode(){return r}}))}var G7={git:{label:`Git`,title:`Git repository`,tone:`accent`,icon:XI},package:{label:`Pkg`,title:`JavaScript package`,icon:W7},workspace:{label:`Workspace`,title:`Workspace marker`,tone:`accent`,icon:W7},python:{label:`Py`,title:`Python project`,icon:sd},rust:{label:`Rust`,title:`Rust project`,icon:sd},go:{label:`Go`,title:`Go module`,icon:sd}};function K7(e){return[...new Set(e??[])]}function q7(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 Cbe=h(`<!> Browse`,1),wbe=h(`<span class="flex-1 text-xs text-muted-foreground"> </span> <!>`,1),Tbe=h(`<p class="m-0 border-b border-b-border/60 px-3 py-2 text-xs text-destructive"> </p>`),Ebe=h(`<!> <!> <!>`,1),Dbe=h(`<div role="presentation"><!></div>`);function Obe(e,t){a(t,!0);let n=F(t,`open`,15,!1),i=F(t,`projects`,19,()=>[]),o=F(t,`conversations`,19,()=>[]),c=J(`recent`),l=J(``),u=J(void 0),f=J(!1),p=J(void 0),m=J(!1),h=J(-1),_=J(-1),v=J(!1),y=J(!1),b=J(void 0),x=J(void 0),S=q(()=>new Set(i().map(e=>Cf(e.dir)))),C=q(()=>{let e=new ce;for(let t of o())e.set(t.projectId,(e.get(t.projectId)??0)+1);return e}),T=q(()=>{let e=new be;return[...i()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).filter(t=>{let n=Cf(t.dir);return e.has(n)?!1:(e.add(n),!0)}).slice(0,24)}),E=q(()=>wf(W(l).trim())),D=q(()=>{if(W(E))return[];let e=W(l).trim().toLowerCase();return e?W(T).filter(t=>t.name.toLowerCase().includes(e)||t.dir.toLowerCase().includes(e)):W(T)}),O=q(()=>W(_)>=0?`recent:${W(D)[W(_)]?.id}`:void 0),ee=q(()=>{let e=W(u)?.entries??[],t=W(l).trim();if(!t||wf(t))return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n))}),te=q(()=>W(ee).map(e=>({kind:`folder`,id:`folder:${e.path}`,path:e.path,entry:e}))),ne=q(()=>W(h)>=0?W(te)[W(h)]:void 0),j=q(()=>W(ne)?.entry),M=q(()=>W(ne)?.path??W(u)?.path??``),re=q(()=>K7(W(j)?.signals??(W(ne)?[]:W(u)?.signals))),ie=q(()=>W(ne)?.id),N=q(()=>Of(W(u)?.path,t.homeDir));function ae(e){return W(S).has(Cf(e))}function oe(e){return W(C).get(e.id)??0}async function se(e){G(f,!0),G(p,void 0);try{G(u,await PH(e,W(m)),!0),G(l,``),G(h,-1)}catch(e){G(p,e instanceof Error?e.message:String(e),!0)}finally{G(f,!1)}}function le(){se(W(u)?.path||void 0)}function ue(){requestAnimationFrame(()=>{W(b)?.querySelector(`.row.selected`)?.scrollIntoView({block:`nearest`})})}function de(){requestAnimationFrame(()=>{W(x)?.querySelector(`.recent-card.selected`)?.scrollIntoView({block:`nearest`})})}function fe(e){G(c,`browse`),G(l,``),G(h,-1),e?se(e):W(u)||se(t.homeDir||void 0)}function pe(){G(c,`recent`),G(l,``),G(_,-1)}function me(e){n(e),e||t.onClose?.()}async function he(e){await t.onSelectProject?.(e),me(!1)}function ge(e){e.preventDefault();let n=W(l).trim();if(!n)return;if(wf(n)){fe(q7(n,t.homeDir));return}if(W(c)===`recent`){let e=W(D)[W(_)>=0?W(_):0];e&&he(e.id);return}let r=W(te)[0];r&&se(r.path)}async function _e(){let e=W(M);e&&(await t.onOpenDirectory?.(e),me(!1))}function ve(e,t,n){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),G(h,t,!0),se(n.path))}function ye(e,t,n){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),G(_,t,!0),he(n.id))}async function B(e){try{await cd(e),Jn.success(`Path copied`)}catch{Jn.error(`Could not copy to clipboard`)}}function xe(e){let n=e.target?.tagName===`INPUT`,r=W(D).length;switch(e.key){case`ArrowDown`:e.preventDefault(),r&&(G(_,W(_)<0?0:Math.min(W(_)+1,r-1),!0),de());break;case`ArrowUp`:e.preventDefault(),r&&(G(_,W(_)<=0?0:W(_)-1,!0),de());break;case`Enter`:if(n)return;if(e.preventDefault(),W(E)){fe(q7(W(l),t.homeDir));return}{let e=W(D)[W(_)>=0?W(_):0];e&&he(e.id)}break}}function Se(e){let t=e.target?.tagName===`INPUT`,n=W(te).length;switch(e.key){case`ArrowDown`:e.preventDefault(),n&&(G(h,W(h)<0?0:Math.min(W(h)+1,n-1),!0),ue());break;case`ArrowUp`:e.preventDefault(),n&&(G(h,W(h)<=0?0:W(h)-1,!0),ue());break;case`ArrowRight`:!t&&W(j)&&(e.preventDefault(),se(W(j).path));break;case`Enter`:e.metaKey||e.ctrlKey?(e.preventDefault(),_e()):!t&&W(ne)&&(e.preventDefault(),se(W(ne).path));break;case`ArrowLeft`:!t&&W(u)?.parent&&(e.preventDefault(),se(W(u).parent));break;case`Backspace`:W(l).length===0&&W(u)?.parent&&(e.preventDefault(),se(W(u).parent));break}}function Ce(e){W(c)===`recent`?xe(e):Se(e)}z(()=>{n()&&!W(v)&&(G(c,W(T).length?`recent`:`browse`,!0),G(_,-1),G(h,-1),G(l,``),se(W(u)?.path||void 0)),G(v,n(),!0)}),z(()=>{n()&&W(m)!==W(y)&&le(),G(y,W(m),!0)}),ZP(e,{flush:!0,title:`Switch project`,class:`project-picker-dialog`,onOpenChange:me,get open(){return n()},set open(e){n(e)},footer:e=>{var n=U(),r=L(n),i=e=>{var t=wbe(),n=L(t),r=V(n);d(n),Oe(I(n,2),{variant:`outline`,size:`sm`,onclick:()=>fe(),children:(e,t)=>{var n=Cbe();k2(L(n),{size:14,strokeWidth:2.2}),w(),g(e,n)},$$slots:{default:!0}}),P(()=>A(r,`${W(T).length??``} recent project${W(T).length===1?``:`s`}`)),g(e,t)},a=e=>{H7(e,{get path(){return W(M)},get homeDir(){return t.homeDir},get signals(){return W(re)},get signalMeta(){return G7},get loading(){return W(f)},onOpen:()=>void _e()})};k(r,e=>{W(c)===`recent`?e(i):e(a,-1)}),g(e,n)},children:(e,n)=>{var i=Dbe(),a=V(i),o=e=>{xbe(e,{get recentProjects(){return W(D)},get totalRecentCount(){return W(T).length},get pathQuery(){return W(E)},get selectedIndex(){return W(_)},get activeDescendant(){return W(O)},get homeDir(){return t.homeDir},get loading(){return W(f)},conversationCountFor:oe,onOpen:e=>void he(e.id),onNewChat:e=>void t.onNewChat?.(e),onCopyPath:e=>void B(e),get onForget(){return t.onForget},onBrowsePath:()=>fe(q7(W(l),t.homeDir)),onQueryChange:()=>G(_,-1),onSubmit:ge,onSelectedIndexChange:e=>G(_,e,!0),onRowKeydown:ye,get scrollEl(){return W(x)},set scrollEl(e){G(x,e,!0)},get query(){return W(l)},set query(e){G(l,e,!0)}})},v=e=>{var t=Ebe(),n=L(t);{let e=q(()=>W(u)?.parent),t=q(()=>W(T).length?pe:void 0);fbe(n,{get crumbs(){return W(N)},get loading(){return W(f)},get parent(){return W(e)},onLoad:e=>void se(e),onReload:le,onQueryChange:()=>G(h,-1),onSubmit:ge,get onBack(){return W(t)},get query(){return W(l)},set query(e){G(l,e,!0)},get showHidden(){return W(m)},set showHidden(e){G(m,e,!0)}})}var r=I(n,2),i=e=>{var t=Tbe(),n=V(t,!0);d(t),P(()=>A(n,W(p))),g(e,t)};k(r,e=>{W(p)&&e(i)}),rbe(I(r,2),{get filteredEntries(){return W(ee)},get loading(){return W(f)},get query(){return W(l)},get selectedIndex(){return W(h)},get selectedItem(){return W(ne)},get activeDescendant(){return W(ie)},get signalMeta(){return G7},isOpened:ae,get uniqueSignals(){return K7},load:e=>void se(e),onSelectedIndexChange:e=>G(h,e,!0),onRowKeydown:ve,get listEl(){return W(b)},set listEl(e){G(b,e,!0)}}),g(e,t)};k(a,e=>{W(c)===`recent`?e(o):e(v,-1)}),d(i),P(()=>s(i,1,`grid h-full min-h-0 ${W(c)===`recent`?`grid-rows-[auto_minmax(0,1fr)]`:`grid-rows-[auto_auto_minmax(0,1fr)]`}`)),r(`keydown`,i,Ce),g(e,i)},$$slots:{footer:!0,default:!0}}),R()}T([`keydown`]);var kbe=h(`<!> <!>`,1);function Abe(e,t){a(t,!0);let n=q(()=>sp.status),r=q(()=>sp.projects),i=q(()=>sp.conversations),o=q(()=>g2.activeConversation),s=q(()=>g2.treeNodes),c=q(()=>g2.toolCalls);async function l(e){await fJ(e),mQ()}async function u(e){await fJ(e.parentEntryId),yJ(e.text),mQ()}var d=kbe(),f=L(d);{let e=q(()=>W(n)?.storage.userHome);Obe(f,{get projects(){return W(r)},get conversations(){return W(i)},get homeDir(){return W(e)},onSelectProject:e=>void _Y(e),onOpenDirectory:e=>void vY(e),onNewChat:e=>void EY(e),onForget:e=>void xY(e),get open(){return Z.projectPickerOpen},set open(e){Z.projectPickerOpen=e}})}Wye(I(f,2),{get activeConversation(){return W(o)},get treeNodes(){return W(s)},get toolCalls(){return W(c)},onNavigateToEntry:e=>{l(e)},onEditEntry:e=>{u(e)},get open(){return pQ.historyDialogOpen},set open(e){pQ.historyDialogOpen=e}}),g(e,d),R()}var jbe=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mbe(e,t){let n=H(t,jbe),r=[[`path`,{d:`M12 3v14`}],[`path`,{d:`M5 10h14`}],[`path`,{d:`M5 21h14`}]];N(e,B({name:`diff`},()=>n,{get iconNode(){return r}}))}var Nbe=h(`<span> </span>`),Pbe=h(`<span class="status-trigger svelte-1bl2f4l"><!> <!></span>`),Fbe=h(`<span class="flex items-center gap-1.5"><!> </span>`),Ibe=h(`<!> <!> <!> <!> <!>`,1),Lbe=h(`<!> <!>`,1);function Rbe(e,t){a(t,!0);let n=F(t,`connection`,3,`connecting`),r=F(t,`live`,3,!1),i=F(t,`side`,3,`top`),o=F(t,`compact`,3,!1),s=q(()=>r()?`good`:n()===`error`?`danger`:n()===`closed`?`warn`:`running`),c=q(()=>r()?`Connected`:n()),l=q(()=>{if(!t.status?.startedAt)return null;let e=new Date(t.status.startedAt).getTime();return Number.isNaN(e)?null:bv((Date.now()-e)/6e4)});qg(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=Pbe(),n=V(t);gt(n,{get tone(){return W(s)},get pulse(){return r()}});var i=I(n,2),a=e=>{var t=Nbe(),n=V(t,!0);d(t),P(()=>A(n,W(c))),g(e,t)};k(i,e=>{o()||e(a)}),d(t),P(()=>K(t,`title`,`Nerve daemon · ${W(c)}`)),g(e,t)},children:(e,r)=>{Yg(e,{children:(e,r)=>{var i=Lbe(),a=L(i);Qg(a,{title:`Nerve daemon`,action:e=>{Hi(e,{size:`xs`,get tone(){return W(s)},children:(e,t)=>{w();var n=M();P(()=>A(n,W(c))),g(e,n)},$$slots:{default:!0}})},$$slots:{action:!0}}),s_(I(a,2),{children:(e,r)=>{var i=Ibe(),a=L(i);l_(a,{label:`Connection`,children:(e,t)=>{var r=Fbe(),i=V(r);gt(i,{get tone(){return W(s)},size:`xs`});var a=I(i,1,!0);d(r),P(()=>A(a,n())),g(e,r)},$$slots:{default:!0}});var o=I(a,2);{let e=q(()=>t.status?.version);l_(o,{label:`Version`,get value(){return W(e)},valueClass:`font-mono`})}var c=I(o,2);{let e=q(()=>W(l)??void 0);l_(c,{label:`Uptime`,get value(){return W(e)}})}var u=I(c,2);{let e=q(()=>t.status==null?void 0:t.status.storage.indexHealthy?`healthy`:`rebuilding`),n=q(()=>t.status?.storage.indexHealthy?`text-success`:`text-warning`);l_(u,{label:`Index`,get value(){return W(e)},get valueClass(){return W(n)}})}var f=I(u,2);{let e=q(()=>t.status?.storage.home),n=q(()=>t.status?.storage.home);l_(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}}),R()}var zbe=h(`<span class="text-xs text-muted-foreground"> </span>`),Bbe=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>`),Vbe=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>`),Hbe=h(`<span class="usage-reset svelte-fvy830"> </span>`),Ube=h(`<span class="usage-trigger svelte-fvy830"><!> <!></span>`),Wbe=h(`<span class="font-normal text-muted-foreground"> </span>`),J7=h(`<span class="text-muted-foreground">No data</span>`),Gbe=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),Kbe=h(`<!> <!>`,1);function Y7(e,t){a(t,!0);let n=(e,t=D)=>{let n=q(()=>t().window.usedPercent??null),r=q(()=>o(t().window));var i=Bbe(),a=V(i),f=V(a),p=V(f,!0);d(f);var _=I(f,2),v=V(_,!0);d(_),d(a);var y=I(a,2),b=V(y);d(y);var S=I(y,2),C=e=>{var t=zbe(),n=V(t);d(t),P(()=>A(n,`resets in ${W(r)??``}`)),g(e,t)};k(S,e=>{W(r)&&e(C)}),d(i),P((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(he(`font-medium tabular-nums`,m(W(n)))),()=>c(W(n)),()=>x(he(`h-full rounded-full`,h(W(n)))),()=>u(W(n))]),g(e,i)},r=F(t,`usages`,19,()=>[]),i=F(t,`compact`,3,!1);function o(e){return e?xv(e.resetsAt)??Sv(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,...vv(e.session.windowMinutes,{label:`Session`,abbreviation:`S`})}),e.weekly&&t.push({slot:`weekly`,window:e.weekly,...vv(e.weekly.windowMinutes,{label:`Weekly`,abbreviation:`W`})}),t}function m(e){let t=gv(e);return t===`error`?`text-destructive`:t===`warning`?`text-warning`:``}function h(e){let t=gv(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=q(r),b=q(()=>W(y).some(e=>p(e.usage).length>0)),S=q(()=>W(y).find(e=>e.active&&p(e.usage).length>0)??W(y).find(e=>p(e.usage).length>0)),C=q(()=>p(W(S)?.usage)),T=q(()=>!i()||W(C).length<=1?W(C):[W(C).reduce((e,t)=>(t.window.usedPercent??0)>(e.window.usedPercent??0)?t:e)]),E=q(()=>i()?null:o(W(T)[0]?.window)),O=q(()=>v(W(y).map(e=>e.usage?.updatedAt).filter(e=>!!e).sort().at(-1))),ee=q(()=>{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=L(te),j=e=>{qg(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=Ube(),n=V(t);_(n,17,()=>W(T),e=>e.slot,(e,t)=>{let n=q(()=>W(t).window.usedPercent);var r=Vbe(),i=V(r),a=V(i,!0);d(i);var o=I(i,2),f=V(o);d(o);var p=I(o,2),_=V(p,!0);d(p),d(r),P((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(he(`usage-meter-fill`,h(W(n)))),()=>u(W(n)),()=>x(he(`usage-meter-value`,m(W(n)))),()=>c(W(n))]),g(e,r)});var r=I(n,2),i=e=>{var t=Hbe(),n=V(t,!0);d(t),P(()=>A(n,W(E))),g(e,t)};k(r,e=>{W(E)&&e(i)}),d(t),P(()=>K(t,`title`,W(ee))),g(e,t)},children:(e,t)=>{Yg(e,{children:(e,t)=>{var r=Kbe(),i=L(r);{let e=q(()=>W(O)?`Updated ${W(O)}`:void 0);Qg(i,{title:`Subscription usage`,get meta(){return W(e)}})}_(I(i,2),19,()=>W(y),e=>e.provider,(e,t,r)=>{{let i=q(()=>W(r)>0);n_(e,{get separated(){return W(i)},children:(e,r)=>{var i=Gbe(),a=L(i),o=V(a),s=V(o),c=I(s),l=e=>{var n=Wbe(),r=V(n);d(n),P(()=>A(r,`· ${W(t).usage.planType??``}`)),g(e,n)};k(c,e=>{W(t).usage?.planType&&e(l)}),d(o);var u=I(o,2),m=e=>{Hi(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=I(a,2),v=e=>{let r=q(()=>p(W(t).usage));var i=U(),a=L(i),o=e=>{var t=U();_(L(t),17,()=>W(r),e=>e.slot,(e,t)=>{n(e,()=>W(t))}),g(e,t)},s=e=>{g(e,J7())};k(a,e=>{W(r).length>0?e(o):e(s,-1)}),g(e,i)},y=e=>{g(e,J7())};k(h,e=>{W(t).usage?e(v):e(y,-1)}),P(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),R()}var qbe=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jbe(e,t){let n=H(t,qbe),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 9h18`}],[`path`,{d:`M9 21V9`}]];N(e,B({name:`panels-top-left`},()=>n,{get iconNode(){return r}}))}var Ybe=new Set([`$$slots`,`$$events`,`$$legacy`]);function X7(e,t){let n=H(t,Ybe),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`}]];N(e,B({name:`rotate-ccw`},()=>n,{get iconNode(){return r}}))}var Xbe=h(`<span class="layout-trigger svelte-14ergwt"><!> <span> </span></span>`),Zbe=h(`<span class="flex-none text-sm font-semibold tabular-nums"> </span>`),Qbe=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 $be(e,t){a(t,!0);let n=F(t,`zoomLevel`,3,0),r=F(t,`dockToggles`,19,()=>[]),i={left:ns,right:is,bottom:es},o={left:`view.toggleLeftDock`,right:`view.toggleRightDock`,bottom:`view.toggleBottomDock`};function s(e){let t=ff(o[e]);return t?lf(t.defaultBinding):void 0}let c=q(()=>UW(n())),l=q(()=>GW(W(c))),u=q(()=>W(c)>0?`+${W(c)}`:String(W(c)));function f(e){t.onZoomLevelChange?.(UW(e))}function p(e){f(W(c)+e)}qg(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=Xbe(),n=V(t);Jbe(n,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var r=I(n,2),i=V(r);d(r),d(t),P(()=>{K(t,`title`,`Layout · Zoom ${W(l)}%`),A(i,`${W(l)??``}%`)}),g(e,t)},children:(e,t)=>{Yg(e,{children:(e,t)=>{var n=Qbe(),a=L(n);Qg(a,{title:`Layout`,action:e=>{var t=Zbe(),n=V(t);d(t),P(()=>A(n,`${W(l)??``}%`)),g(e,t)},$$slots:{action:!0}});var o=I(a,2),m=V(o),h=V(m);{let e=q(()=>W(c)<=-8);Oe(h,{variant:`ghost`,size:`icon-xs`,ariaLabel:`Zoom out`,title:`Zoom out`,get disabled(){return W(e)},onclick:()=>p(-1),children:(e,t)=>{V7(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}var v=I(h,2);{let e=q(()=>W(c)===0);Oe(v,{variant:`ghost`,size:`icon-xs`,ariaLabel:`Reset zoom`,title:`Reset zoom`,get disabled(){return W(e)},onclick:()=>f(0),children:(e,t)=>{X7(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}var y=I(v,2);{let e=q(()=>W(c)>=8);Oe(y,{variant:`ghost`,size:`icon-xs`,ariaLabel:`Zoom in`,title:`Zoom in`,get disabled(){return W(e)},onclick:()=>p(1),children:(e,t)=>{B7(e,{class:`size-3.5`,"aria-hidden":`true`})},$$slots:{default:!0}})}d(m);var b=I(m,2),x=V(b);d(b),d(o),n_(I(o,2),{label:`Panels`,separated:!0,children:(e,t)=>{var n=U();_(L(n),17,r,e=>e.dock,(e,t)=>{let n=q(()=>i[W(t).dock]),r=q(()=>s(W(t).dock));a_(e,{get label(){return Wo[W(t).dock]},get selected(){return W(t).open},get onclick(){return W(t).onToggle},icon:e=>{var t=U();C(L(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=L(t),i=e=>{WZ(e,{class:`flex-none`,children:(e,t)=>{w();var n=M();P(()=>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}}),P(()=>A(x,`Zoom level ${W(u)??``}`)),g(e,n)},$$slots:{default:!0}})},$$slots:{trigger:!0,default:!0}}),R()}var exe=h(`<span class="footer-project-path svelte-y7e2kl"> </span>`),Z7=h(`<span class="footer-git-detail svelte-y7e2kl"><!> </span>`),txe=h(`<span class="footer-git-dot svelte-y7e2kl" aria-label="Uncommitted changes">•</span>`),nxe=h(`<span class="footer-item footer-git svelte-y7e2kl"><!> <span class="footer-git-branch svelte-y7e2kl"> </span> <!> <!> <!></span>`),Q7=h(`<!> <!>`,1),rxe=h(`<span class="footer-item svelte-y7e2kl" title="Running tasks"><!> <span> </span></span>`),ixe=h(`<span class="footer-item warn svelte-y7e2kl" title="Pending approvals"><!> <span> </span></span>`),axe=h(`<!> <!> <!> <!>`,1);function oxe(e,t){a(t,!0);let n=F(t,`connection`,3,`connecting`),r=F(t,`live`,3,!1),i=F(t,`pendingApprovals`,3,0),o=F(t,`tasks`,19,()=>[]),s=F(t,`subscriptionUsages`,19,()=>[]),c=F(t,`zoomLevel`,3,0),l=F(t,`dockToggles`,19,()=>[]),u=F(t,`phone`,3,!1),f=q(()=>o().filter(e=>[`starting`,`running`,`ready`,`stopping`].includes(e.status)).length),p=q(()=>t.activeProject?Sf(t.activeProject.dir,t.homeDir):`No project`),m=q(()=>s().some(e=>!!(e.usage?.session??e.usage?.weekly))),h=q(()=>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(` • `)}Ite(e,{get toggles(){return l()},left:e=>{var n=Q7(),r=L(n),i=e=>{Y7(e,{get usages(){return s()},compact:!0})},a=e=>{var n=exe(),r=V(n,!0);d(n),P(()=>{K(n,`title`,t.activeProject?.dir),A(r,W(p))}),g(e,n)};k(r,e=>{W(h)?e(i):e(a,-1)});var o=I(r,2),c=e=>{var n=nxe(),r=V(n);XI(r,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var i=I(r,2),a=V(i,!0);d(i);var o=I(i,2),s=e=>{var n=Z7(),r=V(n);Mbe(r,{size:11,strokeWidth:2.1,"aria-hidden":`true`});var i=I(r,1,!0);d(n),P(e=>{K(n,`aria-label`,e),A(i,t.gitStatus.changeCount)},[()=>_(t.gitStatus.changeCount)]),g(e,n)},c=e=>{g(e,txe())};k(o,e=>{t.gitStatus.changeCount>0?e(s):t.gitStatus.dirty&&e(c,1)});var l=I(o,2),u=e=>{var n=Z7(),r=V(n);kY(r,{size:11,strokeWidth:2.1,"aria-hidden":`true`});var i=I(r,1,!0);d(n),P(()=>{K(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=I(l,2),p=e=>{var n=Z7(),r=V(n);Xv(r,{size:11,strokeWidth:2.1,"aria-hidden":`true`});var i=I(r,1,!0);d(n),P(()=>{K(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),P(e=>{K(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=Q7(),o=L(a),p=e=>{var n=axe(),r=L(n),a=e=>{var t=rxe(),n=V(t);sd(n,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var r=I(n,2),i=V(r,!0);d(r),d(t),P(()=>A(i,W(f))),g(e,t)};k(r,e=>{W(f)>0&&e(a)});var o=I(r,2),u=e=>{var t=ixe(),n=V(t);$Y(n,{size:12,strokeWidth:2.1,"aria-hidden":`true`});var r=I(n,2),a=V(r,!0);d(r),d(t),P(()=>A(a,i())),g(e,t)};k(o,e=>{i()>0&&e(u)});var p=I(o,2);Y7(p,{get usages(){return s()}}),$be(I(p,2),{get zoomLevel(){return c()},get dockToggles(){return l()},get onZoomLevelChange(){return t.onZoomLevelChange}}),g(e,n)};k(o,e=>{u()||e(p)}),Rbe(I(o,2),{get connection(){return n()},get live(){return r()},get status(){return t.status},side:`top`,get compact(){return u()}}),g(e,a)},$$slots:{left:!0,right:!0}}),R()}var sxe=[`anthropic`,`openai-codex`],cxe={get activeSubscriptionProvider(){return g2.activeSubscriptionProvider},get activeSubscriptionUsage(){return g2.activeSubscriptionUsage},get subscriptionUsages(){let e=g2.activeSubscriptionProvider;return sxe.map(t=>({provider:t,usage:XW.subscriptionUsage[t],active:t===e}))}};function lxe(e,t){a(t,!0);let n=q(()=>sp.activeProject),r=q(()=>sp.connection),i=q(()=>g2.live),o=q(()=>g2.pendingApprovalCount),s=q(()=>A2.scopedTasks),c=q(()=>_2.gitStatus),l=q(()=>cxe.subscriptionUsages),u=q(()=>sp.status),d=q(()=>b2.settingsDraft),f=q(()=>W(d)?.ui.zoomLevel??LW.level),p=q(()=>P2.isCompact),m=q(()=>P2.isPhone),h=q(()=>Uo.map(e=>({dock:e,label:Wo[e].toLowerCase(),open:W(p)?e===`left`?H2.primary:H2.secondary:ple(e),onToggle:()=>Z2(e,W(p))})));{let t=q(()=>W(u)?.storage.userHome);oxe(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 OG}})}R()}var uxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function dxe(e,t){let n=H(t,uxe),r=[[`path`,{d:`M5 12h14`}]];N(e,B({name:`minus`},()=>n,{get iconNode(){return r}}))}function fxe(e){let t=e-1;return t*t*t+1}function $7(e,{delay:t=0,duration:n=400,easing:r=fxe,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 e9=ie({latest:void 0}),t9=[],n9,r9=!1,i9=!1,a9=!1,o9=1e3,s9=500,pxe=1e4,mxe=[/ResizeObserver loop completed with undelivered notifications\./i,/ResizeObserver loop limit exceeded/i];function hxe(e){return typeof e==`string`&&mxe.some(t=>t.test(e))}function gxe(){r9||typeof window>`u`||(r9=!0,i9=!0,window.addEventListener(`error`,e=>{hxe((e.error instanceof Error?e.error.message:void 0)??e.message)||c9(`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=>{c9(`error`,`web-runtime`,`Unhandled promise rejection`,{error:e.reason})}))}function c9(e,t,n,r={}){i9&&(t9.push({level:e,component:t,message:n,ts:new Date().toISOString(),durationMs:r.durationMs,context:r.context,error:r.error?vxe(r.error):void 0}),t9.length>200&&t9.splice(0,t9.length-200),l9())}function l9(e=s9){n9===void 0&&(n9=setTimeout(()=>{n9=void 0,_xe()},e))}async function _xe(){if(a9||t9.length===0)return;a9=!0;let e=t9.splice(0,50),t=s9;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}`);o9=1e3}catch(n){t9.unshift(...e),t9.length>200&&t9.splice(0,t9.length-200),t=o9,o9=Math.min(o9*2,pxe),console.warn(`Failed to submit Nerve client logs`,n)}finally{a9=!1,t9.length>0&&l9(t)}}function vxe(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=yxe(e);return{message:typeof e.message==`string`?e.message:t.split(`
165
- `,1)[0],stack:t}}return{message:String(e)}}function yxe(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 bxe(){return(await Nr(`status.latestRelease.get`,{})).result}var xxe=60*6e4,u9,d9=!1;function Sxe(){f9(),p9(),u9=setInterval(()=>void p9(),xxe)}function f9(){u9!==void 0&&clearInterval(u9),u9=void 0}async function p9(){if(!d9){d9=!0;try{e9.latest=await SK.fetchQuery({queryKey:CK.latestRelease,queryFn:bxe,staleTime:0})}catch(e){c9(`warn`,`releases`,`Latest release check failed`,{error:e})}finally{d9=!1}}}var Cxe=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function m9(e){return`v${e.replace(/^v/,``)}`}function wxe(e,t){let n=h9(e),r=h9(t);return!n||!r?!1:Txe(n,r)<0}function h9(e){if(!e)return;let t=Cxe.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 Txe(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 Exe=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>`),g9=h(`<span class="inline-flex"><!></span>`),Dxe=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),Oxe=h(`<p class="text-warning"> </p> <!> <span class="text-muted-foreground">Select the latest version above to open the release notes.</span>`,1),kxe=h(`<p class="text-muted-foreground">No newer stable release is available. Select the latest version above
166
- to open the release notes.</p>`),Axe=h(`<p class="text-muted-foreground">The latest release could not be checked. Nerve will retry
167
- automatically.</p>`),jxe=h(`<!> <!>`,1),Mxe=h(`<span><!></span>`);function Nxe(e,t){a(t,!0);let n=q(()=>m9(t.currentVersion)),r=q(()=>t.latestRelease?m9(t.latestRelease.version):void 0),i=q(()=>wxe(t.currentVersion,t.latestRelease?.version)),c=q(()=>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=q(()=>t.latestRelease?`npx @nervekit/desktop@${t.latestRelease.version}`:``),u=J(void 0),f;async function p(e,t){try{await cd(e)}catch{return}G(u,t,!0),f!==void 0&&clearTimeout(f),f=setTimeout(()=>{G(u,void 0),f=void 0},1500)}Ae(()=>{f!==void 0&&clearTimeout(f)});var m=Mxe(),h=V(m);{let e=e=>{w();var t=M();P(()=>A(t,W(n))),g(e,t)},a=q(()=>`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`:``}`);qg(h,{get ariaLabel(){return W(c)},side:`bottom`,align:`end`,size:`md`,get triggerClass(){return W(a)},trigger:e,children:(e,a)=>{Yg(e,{children:(e,a)=>{var s=jxe(),c=L(s);{let e=e=>{var n=U(),i=L(n),a=e=>{var n=Exe(),i=V(n);d(n),P(()=>{K(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=q(()=>`Nerve ${W(n)}`);Qg(c,{get title(){return W(i)},action:e,$$slots:{action:!0}})}var f=I(c,2),m=e=>{var t=Oxe(),n=L(t),i=V(n);d(n),n_(I(n,2),{separated:!0,children:(e,t)=>{var n=Dxe(),r=I(L(n),2),i=V(r);i.textContent=`npx @nervekit/desktop@latest`;var a=I(i,2);{let e=q(()=>W(u)===`latest`?`Latest release command copied`:`Copy latest release command`),t=q(()=>W(u)===`latest`?`Copied`:`Copy command`);Oe(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(L(n),()=>W(u)===`latest`,e=>{var t=U(),n=L(t),r=e=>{var t=g9();UL(V(t),{class:`size-3.5 text-success`,"aria-hidden":`true`}),d(t),b(3,t,()=>$7,()=>({duration:120})),g(e,t)},i=e=>{var t=g9();Zu(V(t),{class:`size-3.5`,"aria-hidden":`true`}),d(t),b(3,t,()=>$7,()=>({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=I(r,4),c=V(s),f=V(c,!0);d(c);var m=I(c,2);{let e=q(()=>W(u)===`pinned`?`Pinned release command copied`:`Copy pinned release command`),t=q(()=>W(u)===`pinned`?`Copied`:`Copy command`);Oe(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(L(n),()=>W(u)===`pinned`,e=>{var t=U(),n=L(t),r=e=>{var t=g9();UL(V(t),{class:`size-3.5 text-success`,"aria-hidden":`true`}),d(t),b(3,t,()=>$7,()=>({duration:120})),g(e,t)},i=e=>{var t=g9();Zu(V(t),{class:`size-3.5`,"aria-hidden":`true`}),d(t),b(3,t,()=>$7,()=>({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),P(()=>A(f,W(l))),g(e,n)},$$slots:{default:!0}}),w(2),P(()=>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,kxe())},_=e=>{g(e,Axe())};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),P(()=>s(m,1,`version-indicator inline-flex ${W(i)?``:`max-sm:hidden`}`,`svelte-10mwu6d`)),g(e,m),R()}var Pxe=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),Fxe=h(`<span class="mx-0.5 h-5 w-px bg-border" aria-hidden="true"></span> <!> <!> <!>`,1),Ixe=h(`<!> <!> <!> <!> <!>`,1);function Lxe(e,t){a(t,!0);let n=F(t,`projects`,19,()=>[]),r=F(t,`desktop`,3,!1),i=F(t,`maximized`,3,!1),o=F(t,`closeToTray`,3,!0),s=F(t,`quitting`,3,!1),c=F(t,`settingsActive`,3,!1),l=F(t,`authActive`,3,!1),u=F(t,`logsActive`,3,!1),f=F(t,`applicationLogsEnabled`,3,!1);Rte(e,{get desktop(){return r()},left:e=>{var r=Pxe(),i=L(r),a=V(i);ly(V(a),{compact:!0}),d(a),d(i),Zce(I(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(L(n),()=>Uc,(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=Ixe(),d=L(a),p=e=>{Nxe(e,{get currentVersion(){return t.currentVersion},get latestRelease(){return t.latestRelease}})};k(d,e=>{t.currentVersion&&e(p)});var m=I(d,2),h=e=>{Oe(e,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Open Nerve logs`,title:`Open Nerve logs`,get active(){return u()},get pressed(){return u()},onclick:()=>t.onOpenLogs?.(),children:(e,t)=>{rd(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}})};k(m,e=>{f()&&e(h)});var _=I(m,2);Oe(_,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Open authentication`,title:`Providers & authentication`,get active(){return l()},get pressed(){return l()},onclick:()=>t.onOpenAuth?.(),children:(e,t)=>{td(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}});var v=I(_,2);Oe(v,{variant:`ghost`,size:`icon-sm`,ariaLabel:`Open settings`,title:`Open settings`,get active(){return c()},get pressed(){return c()},onclick:()=>t.onOpenSettings?.(),children:(e,t)=>{ad(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}});var y=I(v,2),b=e=>{var n=Fxe(),r=I(L(n),2);Oe(r,{variant:`ghost`,size:`icon-sm`,class:`[-webkit-app-region:no-drag]`,ariaLabel:`Minimize window`,title:`Minimize`,get disabled(){return s()},onclick:()=>t.onMinimize?.(),children:(e,t)=>{dxe(e,{size:16,strokeWidth:2.1})},$$slots:{default:!0}});var a=I(r,2);{let e=q(()=>i()?`Restore window`:`Maximize window`),n=q(()=>i()?`Restore`:`Maximize`);Oe(a,{variant:`ghost`,size:`icon-sm`,class:`[-webkit-app-region:no-drag]`,get ariaLabel(){return W(e)},get title(){return W(n)},get disabled(){return s()},onclick:()=>t.onToggleMaximize?.(),children:(e,t)=>{var n=U(),r=L(n),a=e=>{Zu(e,{size:15,strokeWidth:2.1})},o=e=>{Fg(e,{size:14,strokeWidth:2.1})};k(r,e=>{i()?e(a):e(o,-1)}),g(e,n)},$$slots:{default:!0}})}var c=I(a,2);{let e=q(()=>s()?`Closing Nerve`:o()?`Close window to tray`:`Close Nerve`),n=q(()=>s()?`Closing Nerve…`:o()?`Close to tray`:`Close Nerve`);Oe(c,{variant:`ghost`,size:`icon-sm`,class:`[-webkit-app-region:no-drag] hover:bg-destructive-solid hover:text-destructive-solid-foreground focus-visible:bg-destructive-solid focus-visible:text-destructive-solid-foreground`,get ariaLabel(){return W(e)},get title(){return W(n)},get disabled(){return s()},onclick:()=>t.onClose?.(),children:(e,t)=>{var n=U(),r=L(n),i=e=>{zi(e,{})},a=e=>{Ol(e,{size:16,strokeWidth:2.1})};k(r,e=>{s()?e(i):e(a,-1)}),g(e,n)},$$slots:{default:!0}})}g(e,n)};k(y,e=>{r()&&e(b)}),g(e,a)},$$slots:{default:!0}})}),g(e,n)},$$slots:{left:!0,actions:!0}}),R()}var Rxe=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`value`]);function _9(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`value`,15,``),i=H(t,Rxe);var o=U(),s=L(o);{let e=q(()=>he(`grid gap-3 w-full`,t.class));C(s,()=>xc,(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),R()}var zxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bxe(e,t){let n=H(t,zxe),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]];An(e,B({name:`circle`},()=>n,{get iconNode(){return r}}))}var Vxe=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`size`]),Hxe=h(`<div data-slot="radio-group-indicator" class="flex size-full items-center justify-center"><!></div>`);function v9(e,t){a(t,!0);let n=F(t,`ref`,15,null),r=F(t,`size`,3,`default`),i=H(t,Vxe);var o=U(),s=L(o);{let e=(e,t)=>{let n=()=>t?.().checked;var i=Hxe(),a=V(i),o=e=>{{let t=q(()=>he(`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`));Bxe(e,{get class(){return W(t)}})}};k(a,e=>{n()&&e(o)}),d(i),g(e,i)},a=q(()=>he(`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,()=>wc,(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),R()}var Uxe=h(`<span class="text-xs leading-snug text-muted-foreground"> </span>`),Wxe=h(`<!> <span class="grid min-w-0 gap-0.5"><span class="text-sm font-medium leading-tight"> </span> <!></span>`,1);function Gxe(e,t){a(t,!0);let n=F(t,`items`,19,()=>[]),r=F(t,`value`,15,``),i=F(t,`orientation`,3,`vertical`),o=F(t,`disabled`,3,!1);var s=U(),c=L(s);{let e=q(()=>he(`grid gap-2`,i()===`horizontal`&&`grid-cols-[repeat(auto-fit,minmax(9rem,1fr))]`,t.class));C(c,()=>_9,(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();_(L(r),17,n,e=>e.value,(e,t)=>{ZX(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=Wxe(),i=L(r);C(i,()=>v9,(e,n)=>{n(e,{get value(){return W(t).value},get disabled(){return W(t).disabled},class:`mt-0.5`})});var a=I(i,2),o=V(a),s=V(o,!0);d(o);var c=I(o,2),l=e=>{var n=Uxe(),r=V(n,!0);d(n),P(()=>A(r,W(t).detail)),g(e,n)};k(c,e=>{W(t).detail&&e(l)}),d(a),P(()=>A(s,W(t).label)),g(e,r)},$$slots:{default:!0}})}),g(e,r)},$$slots:{default:!0}})})}g(e,s),R()}var Kxe=h(`<!> <!>`,1),qxe=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 Jxe(e,t){a(t,!0);let n=F(t,`open`,15,!1),r=F(t,`projectLabel`,3,``),i=F(t,`totalCount`,3,0),o=F(t,`ageEligible`,3,()=>0),s=F(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=J(`olderThanDays`),p=J(`7`),m=J(`20`),h=q(()=>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=Kxe(),n=L(t);Oe(n,{size:`sm`,variant:`ghost`,onclick:()=>y(!1),children:(e,t)=>{w(),g(e,M(`Cancel`))},$$slots:{default:!0}});var r=I(n,2);{let e=q(()=>W(h)===0);Oe(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=q(()=>r()?`Choose how to clean up conversations in “${r()}”.`:`Choose how to clean up conversations.`);ZP(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=qxe(),r=V(n);Gxe(r,{get items(){return c},ariaLabel:`Cleanup strategy`,get value(){return W(f)},set value(e){G(f,e,!0)}});var a=I(r,2),o=V(a),s=e=>{an(e,{get items(){return l},ariaLabel:`Age window`,get value(){return W(p)},set value(e){G(p,e,!0)}})},_=e=>{an(e,{get items(){return u},ariaLabel:`Conversations to keep`,get value(){return W(m)},set value(e){G(m,e,!0)}})};k(o,e=>{W(f)===`olderThanDays`?e(s):e(_,-1)}),d(a);var v=I(a,2),y=I(V(v)),b=V(y,!0);d(y);var x=I(y);d(v),d(n),P(()=>{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}})}R()}var Yxe=h(`<!> <!> <!>`,1);function Xxe(e,t){a(t,!0);let n=q(()=>sp.projectSwitcherItems),r=q(()=>sp.status),i=q(()=>sp.conversations),o=mf(`conversation.new`),s=J(void 0),c=J(void 0),l=q(()=>P2.isPhone?1:P2.isCompact?2:5),u=q(()=>Bf(W(n),Z.selectedProjectKey,W(l))),d=q(()=>sp.activeCenterTab),f=q(()=>b2.settingsDraft),p=q(()=>Fn.quitting||Yu.quitRequested),m=q(()=>({homeDir:W(r)?.storage.userHome,newConversationShortcut:o,editorAvailability:W(r)?.runtime.editors,conversationCount:e=>T2(W(i),e),onNewConversationInProject:bY,onOpenProjectInEditor:(e,t)=>void CY(e,t),requestPrune:e=>{G(c,{id:e.id,label:nr(e.dir,W(r)?.storage.userHome)},!0)},requestDelete:e=>G(s,e,!0)}));function h(e){return Bce(e.project,W(m))}function _(){W(s)?.kind===`project`&&xY(W(s).id)}function v(e){W(c)&&wY(W(c).id,e)}function y(){Z.projectPickerOpen=!0}async function b(){let e=W(f)?.desktop.closeToTray??!0;e||(Yu.quitRequested=!0,Fn.quitting=!0);try{await Rn({closeToTray:e})}catch(t){e||(Yu.quitRequested=!1,Fn.quitting=!1),Z.error=t instanceof Error?t.message:String(t)}}var x=Yxe(),S=L(x);{let e=q(()=>W(f)?.desktop.closeToTray??!0),t=q(()=>W(d)?.kind===`settings`),n=q(()=>W(d)?.kind===`auth`),i=q(()=>W(d)?.kind===`logs`),a=q(()=>W(r)?.capabilities.applicationLogs??!1),o=q(()=>W(r)?.version);Lxe(S,{get projects(){return W(u)},get activeProjectKey(){return Z.selectedProjectKey},get desktop(){return Fn.isDesktop},get maximized(){return Fn.windowState.maximized},get closeToTray(){return W(e)},get quitting(){return W(p)},get settingsActive(){return W(t)},get authActive(){return W(n)},get logsActive(){return W(i)},get applicationLogsEnabled(){return W(a)},get currentVersion(){return W(o)},get latestRelease(){return e9.latest},buildProjectMenuItems:h,onOpenProject:y,onSelectProject:e=>void _Y(e),onOpenLogs:()=>X0(),onOpenAuth:()=>AG(),onOpenSettings:()=>void sG(),onMinimize:()=>void In(),onToggleMaximize:()=>void Pn(),onClose:()=>void b()})}var C=I(S,2);{let e=q(()=>W(s)?.kind===`project`),t=q(()=>W(s)?`This removes “${W(s).label}” from Nerve and deletes its Nerve conversations. Files on disk are not deleted.`:``);lv(C,{get open(){return W(e)},title:`Remove project?`,get description(){return W(t)},confirmLabel:`Remove`,destructive:!0,onConfirm:_,onOpenChange:e=>{e||G(s,void 0)}})}var w=I(C,2);{let e=q(()=>!!W(c)),t=q(()=>W(c)?.label??``),n=q(()=>W(c)?T2(W(i),W(c).id):0);Jxe(w,{get open(){return W(e)},get projectLabel(){return W(t)},get totalCount(){return W(n)},ageEligible:e=>W(c)?Lce(W(i),W(c).id,e):0,keepEligible:e=>W(c)?Rce(W(i),W(c).id,e):0,onConfirm:v,onOpenChange:e=>{e||G(c,void 0)}})}g(e,x),R()}var Zxe=new Set([`$$slots`,`$$events`,`$$legacy`]);function y9(e,t){let n=H(t,Zxe),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`}]];N(e,B({name:`bell`},()=>n,{get iconNode(){return r}}))}var Qxe=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 $xe(e,t){a(t,!1),me();var n=U(),r=L(n),i=e=>{var t=Qxe(),n=V(t),r=V(n);y9(V(r),{class:`size-4`,strokeWidth:2}),d(r);var i=I(r,2),a=I(V(i),2),o=V(a);Oe(o,{variant:`ghost`,size:`sm`,get onclick(){return qn},children:(e,t)=>{w(),g(e,M(`Not now`))},$$slots:{default:!0}}),Oe(I(o,2),{size:`sm`,onclick:()=>void Gn(),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=>{Wn.promptVisible&&e(i)}),g(e,n),R()}var b9=h(`<!> <!>`,1);function eSe(e,t){a(t,!0);let n=q(()=>P2.isCompact),r=q(()=>sp.activeCenterTab),i=q(()=>Object.entries(U2.current.docks).some(([e,t])=>t.activeViewId===`git`||t.activeViewId===`pull-requests`?W(n)?e===`left`?H2.primary:H2.secondary:!t.collapsed:!1)),o=Cce(()=>sp.activeProject,()=>W(i)),s;z(()=>{let e=W(r)?`${W(r).kind}:${W(r).id}`:void 0;e!==s&&(s=e,H2.primary&&X2())}),z(()=>{!W(n)&&(H2.primary||H2.secondary)&&X2()});var c=b9(),l=L(c);{let e=e=>{Xxe(e,{})},t=e=>{Oce(e,{})},r=(e,t=D)=>{hle(e,{get viewId(){return t()},get gitModel(){return o.model},get gitActions(){return o.actions}})},i=e=>{lxe(e,{})},a=e=>{var t=b9(),n=L(t);$xe(n,{}),bre(I(n,2),{}),g(e,t)},s=q(()=>({onActivateView:K2,onMoveView:dle,onHideView:fle,onToggleDock:q2,onDockResize:mle,onSheetOpenChange:Y2}));vre(l,{get layout(){return U2.current},get descriptors(){return R2},get compact(){return W(n)},get primarySheetOpen(){return H2.primary},get secondarySheetOpen(){return H2.secondary},get actions(){return W(s)},titlebar:e,editor:t,panelView:r,statusBar:i,overlays:a,$$slots:{titlebar:!0,editor:!0,panelView:!0,statusBar:!0,overlays:!0}})}Abe(I(l,2),{}),g(e,c),R()}function tSe(e){let t=x9(e);return t?wr(e.type,e.data)===Lr(t):!1}function x9(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 S9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function C9(e){return Q.conversationId===e}function w9(e){return Z.openCenterTabs.some(t=>t.kind===`conversation`&&t.id===e)}function nSe(e){C9(e.conversationId)&&(Z.error=e.error)}function rSe(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 iSe(e,t){Z.conversations=Z.conversations.map(n=>n.id===e?{...n,activeEntryId:t,updatedAt:new Date().toISOString()}:n)}function aSe(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 T9=new Map,oSe=1e3;function E9(e){let t=T9.get(e);t&&(clearTimeout(t),T9.delete(e))}function D9(e){if(!w9(e))return;E9(e);let t=setTimeout(()=>{T9.delete(e),sSe(e)},oSe);T9.set(e,t)}async function sSe(e){if(!w9(e))return;let t=await kH(e).catch(()=>void 0),n=X.conversationViews[Qr(e)];!t||!n||(n.contextUsage=t)}function O9(e){return e&&typeof e==`object`?e:void 0}function cSe(e){let t=O9(e.details),n=O9(t?.details);for(let e of[t?.toolCall,n?.toolCall]){let t=vr.safeParse(e);if(t.success)return t.data}}function lSe(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 uSe(e){let t=x9(e);if(!t||!w9(t))return;let n=ZU(t),r=e.type===`conversation.entry.appended`?e.data?.entry:void 0;if(e.type===`conversation.entry.appended`&&r&&e.seq>n.cursorSeq&&!rSe(n,r)){k9(n,t,Error(`Conversation branch diverged from the active snapshot`)),D9(t);return}let i=!1,a;try{a=wt(n,e,{consumeUnhandled:!0,onGap:()=>{i=!0}})}catch(e){if(!(e instanceof Gr))throw e;k9(n,t,e);return}if(i){k9(n,t,Error(`Conversation event gap at ${e.type}`));return}let o=n;if(a!==n){let e=Qr(t);X.conversationViews[e]=a,o=X.conversationViews[e]}dSe(o,e,r),nSe(o)}function k9(e,t,n){e.error=`Conversation state corrupted — resyncing`,console.error(`Conversation event invariant violated`,{conversationId:t,error:n}),gq(Lr(t)),Oq(t)}function dSe(e,t,n){let r=e.conversationId;switch(t.type){case`conversation.entry.appended`:if(!n)break;e.activeEntryId=n.id,aSe(e,n),iSe(r,n.id),C9(r)&&(Q.entryId=n.id),e.optimisticMessages=lJ(e.optimisticMessages,n),lSe(e,cSe(n)),D9(r);break;case`conversation.context.updated`:E9(r);break;case`run.completed`:Cq(e),Oq(r).then(()=>{Q.conversationId===r&&Mq(r)}),C9(r)&&f0(S9(t.data?.projectId));break;case`run.cancelled`:Cq(e);break;case`run.failed`:Cq(e);break;case`run.suspended`:e.optimisticMessages=[];break;case`run.waiting`:Sq(e,S9(t.data?.runId));break}}function fSe(){return VG(pSe)}function pSe(e){if(!RG(e))return;let t=x9(e);if(t&&w9(t)&&tSe(e)){uSe(e),(e.type===`conversation.compacted`||e.type===`conversation.navigated`)&&Oq(t);return}if(e.type===`agent.configured`){let t=e.data?.agent;typeof t?.conversationId==`string`&&D9(t.conversationId)}}function mSe(e,t){switch(e.type){case`approval.updated`:return N9(e.data.approval)?.status===`pending`?hSe(e,t):void 0;case`userQuestion.updated`:return N9(e.data.question)?.status===`pending`?gSe(e,t):void 0;case`planReview.updated`:return N9(e.data.planReview)?.status===`pending`?_Se(e,t):void 0;case`run.completed`:return vSe(e,t);case`run.failed`:return ySe(e,t);case`run.suspended`:return;default:return}}function hSe(e,t){let n=N9(e.data?.approval),r=N9(e.data?.toolCall),i=P9(r?.toolName),a=P9(n?.risk)??P9(r?.risk),o=P9(n?.reason);return{backgroundOnly:!1,kind:`error`,soundEvent:`approval`,tag:F9(`approval`,P9(n?.id)),payload:{title:i?`Approval needed: ${i}`:`Approval needed`,body:M9([a?`Risk: ${a}`:void 0,o??`An agent is waiting for tool approval.`,A9(e,t)]),urgency:`attention`}}}function gSe(e,t){let n=N9(e.data?.question),r=P9(n?.question),i=P9(n?.context),a=P9(n?.recommendation);return{backgroundOnly:!1,kind:`error`,soundEvent:`question`,tag:F9(`question`,P9(n?.id)),payload:{title:`Nerve needs your answer`,body:M9([r??`An agent asked a question.`,i?`Context: ${i}`:void 0,a?`Recommendation: ${a}`:void 0,A9(e,t)]),urgency:`attention`}}}function _Se(e,t){let n=N9(e.data?.planReview),r=P9(n?.title),i=P9(n?.summary),a=P9(n?.planPath);return{backgroundOnly:!1,kind:`error`,soundEvent:`planReview`,tag:F9(`plan-review`,P9(n?.id)),payload:{title:r?`Plan ready: ${r}`:`Plan ready for review`,body:M9([r,i??`An agent submitted a plan for review.`,a?`Plan: ${a}`:void 0,A9(e,t)]),urgency:`attention`}}}function vSe(e,t){return{backgroundOnly:!0,kind:`success`,soundEvent:`completed`,tag:F9(`run-completed`,P9(e.data?.runId)),payload:{title:`Agent run completed`,body:M9([A9(e,t)])??`Nerve finished a run.`,urgency:`normal`}}}function ySe(e,t){if(e.data?.aborted===!0)return;let n=N9(e.data?.retryExhausted);if(n){let r=CSe(n.maxRetries),i=P9(n.errorMessage)??P9(e.data?.message);return{backgroundOnly:!1,kind:`error`,soundEvent:`failed`,tag:F9(`run-retry-exhausted`,P9(e.data?.runId)),payload:{title:`Model request needs retry`,body:M9([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,A9(e,t)]),urgency:`attention`}}}return{backgroundOnly:!0,kind:`error`,soundEvent:`failed`,tag:F9(`run-failed`,P9(e.data?.runId)),payload:{title:`Agent run failed`,body:M9([P9(e.data?.message)??`Nerve hit an agent error.`,A9(e,t)]),urgency:`attention`}}}function A9(e,t){return M9([bSe(e,t),xSe(e,t)])}function bSe(e,t){let n=j9(e,`conversationId`);if(!n)return;let r=t.conversations.find(e=>e.id===n)?.title;return r?`Chat: ${r}`:void 0}function xSe(e,t){let n=j9(e,`projectId`);if(!n)return;let r=t.projects.find(e=>e.id===n);if(r)return`Project: ${r.name||r.dir}`}function j9(e,t){let n=P9(e.data?.[t]);if(n)return n;for(let n of[`approval`,`question`,`planReview`,`toolCall`]){let r=P9(N9(e.data?.[n])?.[t]);if(r)return r}}function M9(e){let t=e.filter(Boolean).join(` · `);return t?SSe(t):void 0}function SSe(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=220?t:`${t.slice(0,219)}…`}function N9(e){return e&&typeof e==`object`?e:void 0}function P9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function CSe(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function F9(e,t){return t?`nerve:${e}:${t}`:void 0}var I9;function wSe(){return I9||(I9=VG(TSe),()=>{I9?.(),I9=void 0})}function TSe(e){if(!RG(e)||!ESe(e))return;let t=mSe(e,{projects:Z.projects,conversations:Z.conversations});t&&Xn(t.payload,{backgroundOnly:t.backgroundOnly,kind:t.kind,soundEvent:t.soundEvent,tag:t.tag})}function ESe(e){let t=Date.parse(e.ts);return Number.isFinite(t)&&Date.now()-t<6e4}function DSe(){let e=()=>{D0(Q.projectId),E0(Q.projectId,{conversationId:Q.conversationId,agentId:Q.agentId})},t=[BG(`prompt_suggestions.trust_updated`,e),BG(`prompt_suggestions.enabled_updated`,e),BG(`prompt_suggestions.created`,e)];return()=>{for(let e of t)e()}}function OSe(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 kSe(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 ASe(){return VG(jSe)}function jSe(e){L9(e.type)&&!(e.type.startsWith(`settings.`)&&SG())&&_G()}function MSe(){let e=[BG(`task.output`,PSe),BG(`task.removed`,NSe),BG(`task.created`,R9),BG(`task.started`,R9),BG(`task.runtime_updated`,R9),BG(`task.ready`,R9),BG(`task.timed_out`,R9),BG(`task.promoted`,R9),BG(`task.completed`,R9),BG(`task.failed`,R9),BG(`task.cancelled`,R9),BG(`task.orphaned`,R9),BG(`task.recovered`,R9),BG(`task.interrupted`,R9),BG(`task.recovery_unknown`,R9),BG(`task.updated`,R9),BG(`task.orphan_cleanup_succeeded`,R9)];return()=>{for(let t of e.splice(0))t()}}function R9(e){let t=e.data?.task;t?.id&&(lr.tasks=QJ(lr.tasks,t))}function NSe(e){let t=String(e.data?.taskId??``);t&&(lr.tasks=lr.tasks.filter(e=>e.id!==t),lr.selectedTaskId===t&&(lr.selectedTaskId=void 0,lr.taskLogs=void 0))}function PSe(e){R9(e);let t=String(e.data?.taskId??``),n=lr.tasks.find(e=>e.id===t),r=n?.definitionId??n?.restartRootTaskId??t,i=Z.activeCenterTab?.kind===`task`&&Z.activeCenterTab.id===r;t&&t===lr.selectedTaskId&&i&&XJ(t).catch(()=>void 0)}function FSe(){return BG(`usage.subscription.updated`,ISe)}function ISe(e){let t=e.data;t?.provider&&(XW.subscriptionUsage={...XW.subscriptionUsage,[t.provider]:t})}var LSe=150,z9;function RSe(){return VG(zSe)}function zSe(e){if(RG(e)&&(YK(e),USe(e)),e.type===`conversation.deleted`){let t=B9(e.data?.conversationId);t&&gq(Lr(t))}if(VSe(e.type)){let t=HSe(e.data?.agent);t&&BK(t)}kSe(e.type)&&BSe()}function BSe(){z9&&clearTimeout(z9),z9=setTimeout(()=>{z9=void 0,SK.invalidateQueries({queryKey:CK.workspace}),lY()},LSe)}function B9(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function VSe(e){return e===`agent.created`||e===`agent.configured`||e===`agent.mode_changed`||e===`agent.status_changed`}function HSe(e){if(!e||typeof e!=`object`)return;let t=e;return typeof t.id==`string`&&typeof t.updatedAt==`string`?t:void 0}function USe(e){let t=OSe(e.type,e.data);t&&VK(B9(e.data?.agentId),t,e.ts)}function WSe(){let e=[RSe(),fSe(),MSe(),ASe(),XG(),FSe(),wSe(),DSe()];return()=>{for(let t of e.splice(0))t()}}function GSe(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=df.find(t=>sf(e,t.defaultBinding));if(!n)return;let r=n.id===`pane.close`;r&&e.preventDefault(),!(of(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 KSe(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`,Vr,`snapshot.workspace`],qSe=[250,500,1e3,1500,2500,4e3,5e3],JSe=1e4,YSe={role:`workbench_server`},U9,W9,G9=!1,K9=!1,q9;async function XSe(){G9=!1,K9=!1;let e=x0(),t=qW();HW(t.theme,t.colorMode);try{let t=await KSe({loadClientConfig:()=>tCe(`load client config`,wH),applyClientConfig:e=>{Z.config=e,e.status.capabilities.applicationLogs&&gxe(),Z.status=e.status,Z.error=void 0,ep.projectDir=e.status.storage.home},loadCoreSettings:pG,recoverWorkspace:()=>QSe(Z.config.wsUrl),restoreCriticalConversation:Nq,reconcileComposerSelection:mG,activateDeferredTab:async(e,t)=>{e&&!t&&await $p(e)},startProgressiveWork:()=>{pY().catch(()=>void 0),Sxe(),hG(),nCe()},transition:t=>C0(e,t),isCurrent:()=>S0(e)});return S0(e)?(c9(`info`,`workbench`,`Workbench initialized`,{context:t}),!0):!1}catch(t){if(!S0(e))return!1;throw w0(e,t),Z.error=J9(t),Z.connection=`error`,c9(`error`,`workbench`,`Workbench initialization failed`,{context:{criticalBeforeProgressive:!0},error:t}),t}}function ZSe(){return{role:`ui`,id:Rr(),instanceId:Mr(),name:`Nerve Web UI`}}async function QSe(e){await U9?.close(),W9?.();let t=zr({source:ZSe(),target:YSe}),n,r,i=new Promise((e,t)=>{n=e,r=t});return U9=new _r({transport:Ur(eCe(e)),onStateChange:$Se,onError:e=>{G9||(Z.error=J9(e),c9(`warn`,`websocket`,`Protocol transport error`,{error:e})),K9||r(e)},createSession:({send:e,onDisconnect:r})=>new Tr({createMessage:t,capabilities:H9,requiredCapabilities:H9,cursors:pq,send:e,onDisconnect:r,onReady:async e=>{Z.protocolSessionId=e.sessionId;let t;if(!K9){let e=await uY({deferTabActivation:!0});mq(e.cursor.streams,{replace:!0,sync:!1}),t=e.desiredTab,K9=!0}Z.connection=`live`,vq(),n(t)},onSnapshotRequired:async e=>{if(e===`workspace`){mq((await uY()).cursor.streams,{sync:!1}),vq();return}let t=jr(e);t&&await Oq(t)},onStreamUnavailable:e=>{c9(`warn`,`websocket`,`Event stream unavailable`,{context:{stream:e}}),gq(e)},applyEvent:async(e,t)=>{JG(),await qG(t),hq(e,t.seq)},onNotify:e=>{for(let t of e)KG(t)},diagnostics:{publish(e){c9(`warn`,`websocket`,`Protocol diagnostic`,{context:{...e,pendingNotifyEvents:zG()}})}}})}),W9=_q(async e=>{let t=U9?.session;return!t||t.state!==`ready`?`skipped`:(await t.subscribe(e),`applied`)}),U9.start().catch(r),i}function $Se(e){e===`ready`?Z.connection=`live`:e===`closed`&&G9?Z.connection=`closed`:e===`closed`?Z.connection=`error`:Z.connection=`connecting`}function eCe(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 tCe(e,t){for(let[n,r]of qSe.entries())try{return await t()}catch(t){if(G9)throw t;Z.connection=`connecting`,Z.error=`Waiting for Nerve daemon to start (${J9(t)})`,c9(`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 nCe(){Y9(),q9=setInterval(()=>void uG().catch(()=>void 0),JSe)}function Y9(){q9!==void 0&&clearInterval(q9),q9=void 0}function rCe(){G9=!0,T0(),Y9(),f9(),JG(),W9?.(),W9=void 0,U9?.close(),U9=void 0,Z.protocolSessionId=void 0,Z.connection=`closed`}var iCe=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 aCe(e,t){let n=F(t,`status`,3,`Opening Nerve`);var r=iCe(),i=V(r),a=V(i);dy(a,{class:`startup-breathe size-12`});var o=I(a,2),s=V(o),c=V(s,!0);d(s),w(2),d(o),d(i),d(r),P(()=>A(c,n())),g(e,r)}function oCe(e,t){a(t,!0);let n=q(()=>sp.activeProject),r=q(()=>g2.activeConversation),i=q(()=>sp.activeCenterTab),o=q(()=>sp.centerTabs),s=q(()=>g2.pendingConversationActive),c=q(()=>g2.selectedMode),l=q(()=>g2.selectedModelKey),d=q(()=>g2.selectedPermissionLevel),f=q(()=>g2.selectedThinkingLevel),p=q(()=>g2.sending),m=q(()=>g2.compacting),h=q(()=>b2.settingsDraft),_=q(()=>g2.usableModels),v=q(()=>W(h)?.ui.zoomLevel??LW.level),y=q(()=>h0(y0.phase));function b(){Z.projectPickerOpen=!0}function x(){Q2(`conversations`,P2.isCompact),Kce()}let S=GSe({currentZoomLevel:()=>W(v),setUiZoomLevel:OG,centerTabs:()=>W(o),activeCenterTab:()=>W(i),selectCenterTab:$p,newConversation:yY,openProjectPicker:b,closeCenterTab:em,closeCenterTabs:sY,centerTabsExcept:oY,refreshCenterTab:x2,focusProjectSearch:x,hasConversationComposer:()=>!!(W(r)||W(s)),sending:()=>W(p)||W(m),abortActiveRun:()=>W(m)?gJ():vJ(),composerEscape:hQ,toggleMic:gQ,selectedPermissionLevel:()=>W(d),setComposerPermission:nJ,usableModels:()=>W(_),selectedModelKey:()=>W(l),selectedThinkingLevel:()=>W(f),setComposerThinkingLevel:eJ,selectedMode:()=>W(c),setComposerMode:tJ,togglePanelDock:e=>Z2(e,P2.isCompact)});z(()=>{let e=W(h)?.notifications;e&&Zn(e)});let C;z(()=>{let e=W(h)?.desktop.closeToTray;!Fn.isDesktop||e===void 0||e===C||(C=e,Mn(e))});let w=bce(e=>{e?u0(e,{reason:`project`,force:!0}):d0()});z(()=>{w.update(y0.progressiveActive,W(n)?.id)}),z(()=>{if(y0.progressiveActive)return m1(()=>void u0(void 0,{reason:`focus`}))}),le(()=>{let e=WSe(),t=Yn(),n=Nn(),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}),XSe().then(e=>{e&&(Kn(),r&&sG())}).catch(()=>void 0),()=>{window.removeEventListener(`keydown`,S.handleWorkbenchShortcut,{capture:!0}),n(),t(),e(),rCe()}});var T=U(),E=L(T),O=e=>{var n=U();u(L(n),()=>t.children??D),g(e,n)},ee=e=>{aCe(e,{})};k(E,e=>{W(y)?e(O):e(ee,-1)}),g(e,T),R()}function sCe(e){_e(`629kra`,e=>{we(()=>{fe.title=`nerve`})}),oCe(e,{children:(e,t)=>{eSe(e,{})},$$slots:{default:!0}})}function cCe(e){sCe(e,{})}var lCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function uCe(e,t){let n=H(t,lCe),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]];An(e,B({name:`circle-check`},()=>n,{get iconNode(){return r}}))}var dCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function fCe(e,t){let n=H(t,dCe),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`}]];An(e,B({name:`octagon-x`},()=>n,{get iconNode(){return r}}))}var pCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function mCe(e,t){let n=H(t,pCe),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 16v-4`}],[`path`,{d:`M12 8h.01`}]];An(e,B({name:`info`},()=>n,{get iconNode(){return r}}))}var hCe=new Set([`$$slots`,`$$events`,`$$legacy`]);function gCe(e,t){let n=H(t,hCe),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`}]];An(e,B({name:`triangle-alert`},()=>n,{get iconNode(){return r}}))}var _Ce=new Set([`$$slots`,`$$events`,`$$legacy`]);function vCe(e,t){a(t,!0);let n=H(t,_Ce);tf(e,B({get theme(){return jo.current},class:`toaster group`,style:`--normal-bg: var(--color-popover); --normal-text: var(--color-popover-foreground); --normal-border: var(--color-border);`},()=>n,{loadingIcon:e=>{zi(e,{class:`size-4`})},successIcon:e=>{uCe(e,{class:`size-4`})},errorIcon:e=>{fCe(e,{class:`size-4`})},infoIcon:e=>{mCe(e,{class:`size-4`})},warningIcon:e=>{gCe(e,{class:`size-4`})},$$slots:{loadingIcon:!0,successIcon:!0,errorIcon:!0,infoIcon:!0,warningIcon:!0}})),R()}var X9=h(`<!> <!>`,1);function yCe(e,t){a(t,!1),me();var n=X9(),r=L(n);Ho(r,{}),Da(I(r,2),{get client(){return SK},children:(e,t)=>{var n=X9(),r=L(n);cCe(r,{});var i=I(r,2),a=e=>{vCe(e,{position:`bottom-right`,closeButton:!0})};k(i,e=>{Fn.isDesktop||e(a)}),g(e,n)},$$slots:{default:!0}}),g(e,n),R()}var bCe=`false`,xCe=`false`,Z9=bCe===`true`,SCe=xCe===`true`;function CCe(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 bS(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()},!SCe)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 wCe(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 TCe=`nerve-pwa-update`;function ECe(){if(!DCe())return;let e,t=CCe({immediate:!0,onNeedRefresh:()=>{Vn.message(`Update available`,{id:TCe,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?wCe({checkForUpdate:async()=>{await n.update()}}):void 0},onRegisterError:e=>{console.error(`Failed to register the Nerve service worker.`,e)}})}function DCe(){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&&KW(Number(Q9));var $9=document.getElementById(`app`);if(!$9)throw Error(`Missing #app mount target.`);ECe();var OCe=document.getElementById(`startup-bootstrap`);te(yCe,{target:$9}),OCe?.remove();export{SZ as $,ac as $n,dH as $t,k0 as A,lv as An,NW as At,D1 as B,Yf as Bn,fU as Bt,b2 as C,qy as Cn,BG as Ct,l2 as D,vy as Dn,wG as Dt,f2 as E,by as En,dG as Et,p0 as F,S_ as Fn,AU as Ft,a1 as G,ed as Gn,IH as Gt,E1 as H,df as Hn,dU as Ht,f0 as I,d_ as In,bU as It,kQ as J,Zu as Jn,CH as Jt,X$ as K,$u as Kn,FH as Kt,V1 as L,a_ as Ln,SU as Lt,O0 as M,E_ as Mn,kU as Mt,j0 as N,D_ as Nn,jU as Nt,a2 as O,Fv as On,DG as Ot,y0 as P,w_ as Pn,OU as Pt,VZ as Q,Sl as Qn,mH as Qt,T1 as R,sp as Rn,yU as Rt,kce as S,Yy as Sn,aK as St,_2 as T,zy as Tn,PG as Tt,g1 as U,lf as Un,BH as Ut,k1 as V,Kf as Vn,pU as Vt,i1 as W,cd as Wn,uU as Wt,xQ as X,El as Xn,SH as Xt,EQ as Y,Ol as Yn,bH as Yt,WZ as Z,wl as Zn,vH as Zt,M4 as _,UC as _n,LY as _t,U7 as a,hz as an,KX as at,I2 as b,bS as bn,YJ as bt,F7 as c,UL as cn,OX as ct,gde as d,yI as dn,MX as dt,fH as en,Is as er,hZ as et,s3 as f,wF as fn,NX as ft,j4 as g,TA as gn,GY as gt,G4 as h,zN as hn,$Y as ht,X7 as i,hH as in,qX as it,D0 as j,T_ as jn,jW as jt,q0 as k,fv as kn,EG as kt,p3 as l,yL as ln,EX as lt,q4 as m,oP as mn,eX as mt,v9 as n,_H as nn,eZ as nt,L7 as o,iR as on,jX as ot,N4 as p,ZP as pn,vX as pt,d1 as q,Qu as qn,xH as qt,_9 as r,pH as rn,ZX as rt,I7 as s,ZL as sn,kX as st,y9 as t,gH as tn,Ns as tr,sZ as tt,l3 as u,KI as un,AX as ut,S4 as v,jS as vn,FY as vt,y2 as w,Vy as wn,NG as wt,A2 as x,vS as xn,RJ as xt,L2 as y,AS as yn,lY as yt,O1 as z,Xf as zn,xU as zt};