kaizen-agent 1.85.2 → 1.87.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 (545) hide show
  1. package/README.md +1 -1
  2. package/cli/annotate-proxy.ts +6 -3
  3. package/cli/build-web.ts +46 -16
  4. package/cli/dev.ts +67 -0
  5. package/cli/docs.ts +1 -1
  6. package/cli/notes.ts +9 -3
  7. package/cli/ports.ts +121 -0
  8. package/cli/rea.ts +99 -11
  9. package/cli/settings.ts +16 -17
  10. package/cli/state.ts +15 -29
  11. package/cli/task-service.ts +114 -34
  12. package/cli/tasks.ts +8 -2
  13. package/cli/term-image.ts +18 -0
  14. package/cli/ui-audit.allow.json +0 -1
  15. package/cli/ui-audit.ts +12 -12
  16. package/cli/web.ts +197 -61
  17. package/package.json +21 -4
  18. package/skills/kaizen/spec.md +12 -4
  19. package/skills/optional/disk-cleanup/SKILL.md +60 -0
  20. package/skills/optional/disk-cleanup/skill.json +1 -0
  21. package/skills/optional/disk-cleanup/tui.py +90 -0
  22. package/tsconfig.json +16 -0
  23. package/web/README.md +105 -0
  24. package/web/{annotate.js → annotate/annotate.ts} +51 -50
  25. package/web/boot/boot.ts +7 -0
  26. package/web/components/annotate/annotate-bar.tsx +78 -0
  27. package/web/components/annotate/annotate-panel.tsx +20 -0
  28. package/web/components/annotate/annotate-settings.tsx +60 -0
  29. package/web/components/annotate/index.ts +1 -0
  30. package/web/components/annotate/notes-list.tsx +75 -0
  31. package/web/components/board/board-card.tsx +177 -0
  32. package/web/components/board/board-column.tsx +212 -0
  33. package/web/components/board/board-mode-switch.tsx +21 -0
  34. package/web/components/board/board-popups.tsx +45 -0
  35. package/web/components/board/card-footer.tsx +58 -0
  36. package/web/components/board/card-form.tsx +168 -0
  37. package/web/components/board/card-kids.tsx +53 -0
  38. package/web/components/board/clear-menu.tsx +36 -0
  39. package/web/components/board/filter-box.tsx +42 -0
  40. package/web/components/board/index.ts +6 -0
  41. package/web/components/board/run-form.tsx +129 -0
  42. package/web/components/board/severity-menu.tsx +44 -0
  43. package/web/components/board/status-strip.tsx +75 -0
  44. package/web/components/board/task-form.tsx +140 -0
  45. package/web/components/board/ws-card.tsx +38 -0
  46. package/web/components/context/context-panel.tsx +244 -0
  47. package/web/components/context/index.ts +1 -0
  48. package/web/components/decision/decision-bar.tsx +422 -0
  49. package/web/components/decision/index.ts +1 -0
  50. package/web/components/decision/inline-form.tsx +47 -0
  51. package/web/components/decision/plan-answers-form.tsx +78 -0
  52. package/web/components/decision/revise-form.tsx +65 -0
  53. package/web/components/decision/task-reply-form.tsx +48 -0
  54. package/web/components/footer/foot-bar.tsx +67 -0
  55. package/web/components/footer/index.ts +1 -0
  56. package/web/components/git/git-ask.tsx +88 -0
  57. package/web/components/git/git-commits.tsx +53 -0
  58. package/web/components/git/git-confirm.tsx +78 -0
  59. package/web/components/git/git-counts.tsx +10 -0
  60. package/web/components/git/git-files.tsx +113 -0
  61. package/web/components/git/git-head.tsx +70 -0
  62. package/web/components/git/git-icon.tsx +25 -0
  63. package/web/components/git/git-message.tsx +44 -0
  64. package/web/components/git/git-split.tsx +64 -0
  65. package/web/components/git/git-tab.tsx +55 -0
  66. package/web/components/git/index.ts +1 -0
  67. package/web/components/home/chat-list.tsx +57 -0
  68. package/web/components/home/home-composer.tsx +169 -0
  69. package/web/components/home/home-message.tsx +120 -0
  70. package/web/components/home/home-window.tsx +253 -0
  71. package/web/components/home/home-ws-add.tsx +47 -0
  72. package/web/components/home/index.ts +6 -0
  73. package/web/components/home/onboarding-dialog.tsx +371 -0
  74. package/web/components/icebox/board-chip.tsx +27 -0
  75. package/web/components/icebox/board-menu.tsx +41 -0
  76. package/web/components/icebox/bulk-bar.tsx +41 -0
  77. package/web/components/icebox/capture-box.tsx +155 -0
  78. package/web/components/icebox/choice-menu.tsx +39 -0
  79. package/web/components/icebox/collection-dialog.tsx +60 -0
  80. package/web/components/icebox/favicon.tsx +39 -0
  81. package/web/components/icebox/index.ts +10 -0
  82. package/web/components/icebox/kind-label.tsx +22 -0
  83. package/web/components/icebox/kind-menu.tsx +20 -0
  84. package/web/components/icebox/promote-form.tsx +93 -0
  85. package/web/components/icebox/reply-box.tsx +88 -0
  86. package/web/components/icebox/request-actions.tsx +141 -0
  87. package/web/components/icebox/request-badges.tsx +13 -0
  88. package/web/components/icebox/request-card.tsx +99 -0
  89. package/web/components/icebox/request-detail.tsx +43 -0
  90. package/web/components/icebox/request-images.tsx +33 -0
  91. package/web/components/icebox/request-phone-row.tsx +181 -0
  92. package/web/components/icebox/request-row.tsx +120 -0
  93. package/web/components/icebox/service-chip.tsx +58 -0
  94. package/web/components/icebox/snooze-menu.tsx +83 -0
  95. package/web/components/icebox/source-card.tsx +225 -0
  96. package/web/components/icebox/source-drawer.tsx +112 -0
  97. package/web/components/icebox/source-form.tsx +147 -0
  98. package/web/components/icebox/swipe-deck.tsx +242 -0
  99. package/web/components/layout/index.ts +1 -0
  100. package/web/components/layout/page-frame.tsx +44 -0
  101. package/web/components/markdown/index.ts +1 -0
  102. package/web/components/markdown/markdown.tsx +156 -0
  103. package/web/components/notebook/editor-pane.tsx +23 -0
  104. package/web/components/notebook/index.ts +5 -0
  105. package/web/components/notebook/note-body.tsx +172 -0
  106. package/web/components/notebook/note-tree.tsx +99 -0
  107. package/web/components/notebook/notes-head.tsx +37 -0
  108. package/web/components/notebook/notes-side.tsx +46 -0
  109. package/web/components/notes/index.ts +1 -0
  110. package/web/components/notes/note-composer.tsx +90 -0
  111. package/web/components/notes/notes-chat.tsx +58 -0
  112. package/web/components/panes/browser-pane.tsx +281 -0
  113. package/web/components/panes/index.ts +3 -0
  114. package/web/components/panes/preview-pane.tsx +91 -0
  115. package/web/components/panes/terminal-pane.tsx +52 -0
  116. package/web/components/phone/haptic.tsx +29 -0
  117. package/web/components/phone/index.ts +6 -0
  118. package/web/components/phone/phone-card.tsx +118 -0
  119. package/web/components/phone/phone-home.tsx +304 -0
  120. package/web/components/phone/phone-sheets.tsx +103 -0
  121. package/web/components/phone/qr-code.tsx +6 -0
  122. package/web/components/phone/usage-chips.tsx +85 -0
  123. package/web/components/phone/whatsapp-card.tsx +85 -0
  124. package/web/components/project/add-project-dialog.tsx +435 -0
  125. package/web/components/project/index.ts +3 -0
  126. package/web/components/project/project-bar.tsx +101 -0
  127. package/web/components/project/ws-menu.tsx +21 -0
  128. package/web/components/rail/agent-chips.tsx +110 -0
  129. package/web/components/rail/index.ts +4 -0
  130. package/web/components/rail/rail-filter.tsx +118 -0
  131. package/web/components/rail/rail-list.tsx +259 -0
  132. package/web/components/rail/source-marks.tsx +21 -0
  133. package/web/components/resources/index.ts +1 -0
  134. package/web/components/resources/resources-popup.tsx +490 -0
  135. package/web/components/run/doc-body.tsx +123 -0
  136. package/web/components/run/file-viewer.tsx +53 -0
  137. package/web/components/run/fix-form.tsx +88 -0
  138. package/web/components/run/index.ts +16 -0
  139. package/web/components/run/inline-md.tsx +30 -0
  140. package/web/components/run/key-hint.tsx +29 -0
  141. package/web/components/run/pane-gutter.tsx +52 -0
  142. package/web/components/run/pane-header.tsx +35 -0
  143. package/web/components/run/pane.tsx +140 -0
  144. package/web/components/run/panel-grip.tsx +49 -0
  145. package/web/components/run/panel-head.tsx +56 -0
  146. package/web/components/run/panel-tabs.tsx +35 -0
  147. package/web/components/run/phase-steps.tsx +37 -0
  148. package/web/components/run/project-notes.tsx +49 -0
  149. package/web/components/run/run-add-menu.tsx +80 -0
  150. package/web/components/run/run-bar.tsx +40 -0
  151. package/web/components/run/run-empty.tsx +10 -0
  152. package/web/components/run/run-footer.tsx +53 -0
  153. package/web/components/run/run-history.tsx +24 -0
  154. package/web/components/run/run-panes.tsx +78 -0
  155. package/web/components/run/run-picker.tsx +51 -0
  156. package/web/components/run/run-progress.tsx +30 -0
  157. package/web/components/run/run-tabs.tsx +147 -0
  158. package/web/components/run/run-wait.tsx +18 -0
  159. package/web/components/search/index.ts +1 -0
  160. package/web/components/search/search-palette.tsx +159 -0
  161. package/web/components/settings/account-rows.tsx +128 -0
  162. package/web/components/settings/agent-rows.tsx +249 -0
  163. package/web/components/settings/automation-rows.tsx +211 -0
  164. package/web/components/settings/browser-row.tsx +111 -0
  165. package/web/components/settings/cleanup-row.tsx +32 -0
  166. package/web/components/settings/commit-input.tsx +39 -0
  167. package/web/components/settings/index.ts +4 -0
  168. package/web/components/settings/integration-row.tsx +158 -0
  169. package/web/components/settings/mic-row.tsx +48 -0
  170. package/web/components/settings/orchestration-flow.tsx +87 -0
  171. package/web/components/settings/setting-row.tsx +131 -0
  172. package/web/components/settings/settings-item.tsx +78 -0
  173. package/web/components/settings/settings-loading.tsx +41 -0
  174. package/web/components/settings/settings-nav.tsx +119 -0
  175. package/web/components/settings/settings-scope.tsx +66 -0
  176. package/web/components/settings/settings-section.tsx +33 -0
  177. package/web/components/settings/skill-card.tsx +131 -0
  178. package/web/components/settings/stepper.tsx +74 -0
  179. package/web/components/settings/update-bar.tsx +167 -0
  180. package/web/components/shared/action-menu.tsx +76 -0
  181. package/web/components/shared/ask-host.tsx +18 -0
  182. package/web/components/shared/attach-button.tsx +23 -0
  183. package/web/components/shared/chip.tsx +19 -0
  184. package/web/components/shared/client-mark.tsx +15 -0
  185. package/web/components/shared/confirm-dialog.tsx +35 -0
  186. package/web/components/shared/empty-state.tsx +29 -0
  187. package/web/components/shared/field.tsx +77 -0
  188. package/web/components/shared/filter-popover.tsx +29 -0
  189. package/web/components/shared/form-frame.tsx +19 -0
  190. package/web/components/shared/icon-button.tsx +50 -0
  191. package/web/components/shared/index.ts +18 -0
  192. package/web/components/shared/mic-button.tsx +75 -0
  193. package/web/components/shared/pager.tsx +49 -0
  194. package/web/components/shared/picker.tsx +108 -0
  195. package/web/components/shared/project-mark.tsx +38 -0
  196. package/web/components/shared/segmented.tsx +43 -0
  197. package/web/components/shared/state-dot.tsx +4 -0
  198. package/web/components/shared/status-mark.tsx +26 -0
  199. package/web/components/shell/index.ts +3 -0
  200. package/web/components/shell/rail.tsx +259 -0
  201. package/web/components/shell/sprite.tsx +124 -0
  202. package/web/components/shell/wordmark.tsx +13 -0
  203. package/web/components/task/artifact-view.tsx +148 -0
  204. package/web/components/task/chat-bubble.tsx +43 -0
  205. package/web/components/task/filter-menu.tsx +38 -0
  206. package/web/components/task/index.ts +7 -0
  207. package/web/components/task/result-checks.tsx +34 -0
  208. package/web/components/task/result-view.tsx +103 -0
  209. package/web/components/task/status-badge.tsx +24 -0
  210. package/web/components/task/task-row.tsx +34 -0
  211. package/web/components/task/typing-dots.tsx +16 -0
  212. package/web/components/terminal/index.ts +3 -0
  213. package/web/components/terminal/terminal-bar.tsx +91 -0
  214. package/web/components/terminal/terminal-grid.tsx +149 -0
  215. package/web/components/terminal/terminal-modes.tsx +23 -0
  216. package/web/components/terminal/terminal-tile.tsx +139 -0
  217. package/web/dist/annotate.js +24 -0
  218. package/web/dist/board.css +718 -0
  219. package/web/dist/board.js +115 -0
  220. package/web/dist/boot.js +2 -0
  221. package/web/dist/notebook.css +319 -0
  222. package/web/dist/notebook.js +89 -0
  223. package/web/dist/popup.css +41 -0
  224. package/web/dist/popup.js +13 -0
  225. package/web/{term.js → dist/term.js} +48 -48
  226. package/web/dist/ui.css +3 -0
  227. package/web/dist/video.js +108 -0
  228. package/web/html/board.html +17 -0
  229. package/web/html/notes.html +14 -0
  230. package/web/html/popup.html +13 -0
  231. package/web/{video.html → html/video.html} +14 -15
  232. package/web/lib/annotate/index.ts +2 -0
  233. package/web/lib/annotate/notes.ts +105 -0
  234. package/web/lib/annotate/page.ts +121 -0
  235. package/web/lib/annotate/rules.ts +37 -0
  236. package/web/lib/annotate/session.ts +336 -0
  237. package/web/lib/board/board-actions.ts +119 -0
  238. package/web/lib/board/board-open.ts +12 -0
  239. package/web/lib/board/board-store.ts +159 -0
  240. package/web/lib/board/filter-box.ts +7 -0
  241. package/web/lib/board/index.ts +10 -0
  242. package/web/lib/board/nav.ts +29 -0
  243. package/web/lib/board/on-state.ts +90 -0
  244. package/web/lib/board/popups.ts +22 -0
  245. package/web/lib/board/snapshot.ts +105 -0
  246. package/web/lib/board/strip.ts +43 -0
  247. package/web/{board → lib/board}/ws-board.ts +1 -1
  248. package/web/lib/context/context-rules.ts +27 -0
  249. package/web/lib/context/context-store.ts +95 -0
  250. package/web/lib/context/feed.ts +28 -0
  251. package/web/lib/context/index.ts +3 -0
  252. package/web/lib/core/api.ts +86 -0
  253. package/web/lib/core/ask.ts +24 -0
  254. package/web/lib/core/board.ts +290 -0
  255. package/web/lib/core/brief.ts +31 -0
  256. package/web/lib/core/format.ts +8 -0
  257. package/web/lib/core/host.ts +107 -0
  258. package/web/lib/core/index.ts +16 -0
  259. package/web/{board → lib/core}/labels.ts +6 -5
  260. package/web/lib/core/layers.ts +7 -0
  261. package/web/lib/core/leave.ts +7 -0
  262. package/web/lib/core/motion.ts +10 -0
  263. package/web/{board/toast.ts → lib/core/notices.ts} +2 -20
  264. package/web/lib/core/notifier.ts +15 -0
  265. package/web/lib/core/store.ts +39 -0
  266. package/web/lib/core/term-handle.ts +8 -0
  267. package/web/lib/core/toast.ts +29 -0
  268. package/web/lib/core/utils.ts +15 -0
  269. package/web/lib/decision/index.ts +1 -0
  270. package/web/lib/decision/plan-questions.ts +39 -0
  271. package/web/lib/dictation/chunks.ts +93 -0
  272. package/web/lib/dictation/dictation-store.ts +22 -0
  273. package/web/lib/dictation/engine.ts +265 -0
  274. package/web/lib/dictation/index.ts +5 -0
  275. package/web/lib/dictation/mic.ts +42 -0
  276. package/web/lib/dictation/terminal-dictation.ts +50 -0
  277. package/web/lib/footer/footer-rules.ts +13 -0
  278. package/web/lib/footer/footer-store.ts +42 -0
  279. package/web/lib/footer/index.ts +2 -0
  280. package/web/lib/git/git-actions.ts +110 -0
  281. package/web/lib/git/git-panel.ts +43 -0
  282. package/web/lib/git/git-store.ts +47 -0
  283. package/web/lib/git/git.ts +170 -0
  284. package/web/lib/git/index.ts +4 -0
  285. package/web/lib/home/home-engine.ts +16 -0
  286. package/web/lib/home/home-events.ts +9 -0
  287. package/web/lib/home/home-store.ts +247 -0
  288. package/web/lib/home/home-window.ts +193 -0
  289. package/web/lib/home/home.ts +85 -0
  290. package/web/lib/home/index.ts +7 -0
  291. package/web/lib/home/onboarding.ts +199 -0
  292. package/web/lib/home/use-float-drag.ts +62 -0
  293. package/web/lib/icebox/icebox-actions.ts +518 -0
  294. package/web/lib/icebox/icebox-store.ts +112 -0
  295. package/web/lib/icebox/icebox-view.ts +48 -0
  296. package/web/lib/icebox/icebox.ts +273 -0
  297. package/web/lib/icebox/index.ts +8 -0
  298. package/web/lib/icebox/use-card-drag.ts +82 -0
  299. package/web/lib/icebox/use-ice-keys.ts +75 -0
  300. package/web/lib/icebox/use-icebox.ts +41 -0
  301. package/web/lib/icebox/use-row-swipe.ts +107 -0
  302. package/web/lib/markdown/index.ts +1 -0
  303. package/web/lib/markdown/markdown.ts +136 -0
  304. package/web/lib/notebook/autosave.ts +131 -0
  305. package/web/lib/notebook/deal.ts +58 -0
  306. package/web/lib/notebook/engine-complete.ts +128 -0
  307. package/web/lib/notebook/engine-preview.ts +287 -0
  308. package/web/lib/notebook/engine-types.ts +26 -0
  309. package/web/lib/notebook/engine-widgets.ts +218 -0
  310. package/web/lib/notebook/engine.ts +74 -0
  311. package/web/lib/notebook/index.ts +9 -0
  312. package/web/lib/notebook/kit-loader.ts +16 -0
  313. package/web/lib/notebook/kit.ts +12 -0
  314. package/web/{notes-lib.ts → lib/notebook/text.ts} +11 -10
  315. package/web/lib/notebook/vault-actions.ts +239 -0
  316. package/web/lib/notebook/vault-rules.ts +74 -0
  317. package/web/lib/notebook/vault-session.ts +73 -0
  318. package/web/lib/notebook/vault-store.ts +63 -0
  319. package/web/lib/notes/index.ts +4 -0
  320. package/web/lib/notes/md-html.ts +115 -0
  321. package/web/lib/notes/notes-actions.ts +32 -0
  322. package/web/lib/notes/notes-store.ts +22 -0
  323. package/web/lib/notes/notes.ts +58 -0
  324. package/web/{board → lib/notes}/rich.ts +1 -2
  325. package/web/lib/phone/index.ts +7 -0
  326. package/web/lib/phone/phone-actions.ts +77 -0
  327. package/web/lib/phone/phone-home.ts +102 -0
  328. package/web/lib/phone/phone-setup.ts +59 -0
  329. package/web/lib/phone/phone-sheet.ts +25 -0
  330. package/web/lib/phone/phone-store.ts +32 -0
  331. package/web/lib/phone/sheet-swipe.ts +55 -0
  332. package/web/lib/phone/use-phone-setup.ts +89 -0
  333. package/web/lib/project/add-project.ts +37 -0
  334. package/web/lib/project/branch.ts +14 -0
  335. package/web/lib/project/index.ts +5 -0
  336. package/web/lib/project/project-bar.ts +76 -0
  337. package/web/lib/project/project-pick.ts +36 -0
  338. package/web/lib/project/ws-menu.ts +8 -0
  339. package/web/lib/rail/agents.ts +63 -0
  340. package/web/lib/rail/card-links.ts +20 -0
  341. package/web/lib/rail/index.ts +7 -0
  342. package/web/lib/rail/rail-actions.ts +74 -0
  343. package/web/lib/rail/rail-boot.ts +99 -0
  344. package/web/lib/rail/rail-store.ts +85 -0
  345. package/web/lib/rail/rules.ts +241 -0
  346. package/web/lib/rail/source-marks.ts +17 -0
  347. package/web/lib/rail/use-rank-drag.ts +108 -0
  348. package/web/lib/resources/index.ts +3 -0
  349. package/web/lib/resources/resources-actions.ts +59 -0
  350. package/web/lib/resources/resources-store.ts +48 -0
  351. package/web/lib/resources/rules.ts +56 -0
  352. package/web/lib/router/index.ts +3 -0
  353. package/web/lib/router/route-rules.ts +96 -0
  354. package/web/lib/router/route-store.ts +115 -0
  355. package/web/lib/router/use-route-classes.ts +15 -0
  356. package/web/lib/run/browser.ts +53 -0
  357. package/web/lib/run/card-terminal.ts +32 -0
  358. package/web/lib/run/doc.ts +42 -0
  359. package/web/lib/run/grip.ts +8 -0
  360. package/web/lib/run/index.ts +19 -0
  361. package/web/lib/run/kept.ts +58 -0
  362. package/web/lib/run/layout-store.ts +156 -0
  363. package/web/lib/run/layout.ts +195 -0
  364. package/web/lib/run/panel-actions.ts +104 -0
  365. package/web/lib/run/panel-derive.ts +148 -0
  366. package/web/lib/run/panel-store.ts +125 -0
  367. package/web/lib/run/preview.ts +105 -0
  368. package/web/lib/run/run-actions.ts +118 -0
  369. package/web/lib/run/run-view-store.ts +134 -0
  370. package/web/lib/run/term-loader.ts +19 -0
  371. package/web/lib/run/use-panel-run.ts +125 -0
  372. package/web/lib/run/use-run-lifecycle.ts +70 -0
  373. package/web/lib/run/viewer.ts +12 -0
  374. package/web/lib/run/workspace.ts +281 -0
  375. package/web/lib/run/ws-actions.ts +293 -0
  376. package/web/lib/run/ws-derive.ts +50 -0
  377. package/web/lib/run/ws-draw.ts +102 -0
  378. package/web/lib/run/ws-store.ts +21 -0
  379. package/web/lib/run/ws-tabs.ts +125 -0
  380. package/web/lib/search/index.ts +3 -0
  381. package/web/lib/search/search-match.ts +48 -0
  382. package/web/lib/search/search-rows.ts +228 -0
  383. package/web/lib/search/search.ts +30 -0
  384. package/web/lib/search/use-search-rows.ts +22 -0
  385. package/web/lib/server/attention.ts +29 -0
  386. package/web/lib/server/index.ts +6 -0
  387. package/web/lib/server/poll-rules.ts +57 -0
  388. package/web/lib/server/poller.ts +210 -0
  389. package/web/lib/server/server-store.ts +39 -0
  390. package/web/lib/server/types.ts +31 -0
  391. package/web/lib/server/use-server.ts +19 -0
  392. package/web/lib/settings/agent-favicons.ts +14 -0
  393. package/web/lib/settings/index.ts +7 -0
  394. package/web/lib/settings/panel-settings.ts +29 -0
  395. package/web/lib/settings/settings-actions.ts +357 -0
  396. package/web/lib/settings/settings-store.ts +114 -0
  397. package/web/lib/settings/settings.ts +413 -0
  398. package/web/lib/settings/skill-icons.ts +24 -0
  399. package/web/lib/settings/update.ts +70 -0
  400. package/web/lib/shared/data-urls.ts +32 -0
  401. package/web/lib/shared/index.ts +4 -0
  402. package/web/lib/shared/use-draft.ts +38 -0
  403. package/web/lib/shared/use-narrow.ts +11 -0
  404. package/web/lib/shared/use-pager.ts +24 -0
  405. package/web/lib/shell/appearance.ts +97 -0
  406. package/web/lib/shell/help-store.ts +4 -0
  407. package/web/lib/shell/index.ts +4 -0
  408. package/web/lib/shell/shell-store.ts +23 -0
  409. package/web/lib/shell/stored-look.ts +47 -0
  410. package/web/lib/task/index.ts +7 -0
  411. package/web/lib/task/task-results.ts +92 -0
  412. package/web/lib/task/tasks.ts +132 -0
  413. package/web/lib/task/use-live-frame.ts +85 -0
  414. package/web/lib/task/use-saved-text.ts +25 -0
  415. package/web/lib/task/use-task.ts +161 -0
  416. package/web/lib/task/use-tasks.ts +50 -0
  417. package/web/{board → lib/task}/zoom.ts +25 -12
  418. package/web/lib/terminal/hidden-badge.ts +15 -0
  419. package/web/lib/terminal/index.ts +8 -0
  420. package/web/lib/terminal/layout.ts +138 -0
  421. package/web/{term-font.ts → lib/terminal/term-font.ts} +3 -2
  422. package/web/lib/terminal/terminal-store.ts +65 -0
  423. package/web/lib/terminal/terms-feed.ts +37 -0
  424. package/web/lib/terminal/use-arranged.ts +15 -0
  425. package/web/lib/terminal/use-terminal-keys.ts +37 -0
  426. package/web/lib/url/index.ts +1 -0
  427. package/web/lib/url/safe-url.ts +9 -0
  428. package/web/notebook/notebook.ts +27 -0
  429. package/web/notebook/notes-lib.ts +3 -0
  430. package/web/pages/board/App.tsx +76 -0
  431. package/web/pages/board/header.tsx +83 -0
  432. package/web/pages/board/help.tsx +59 -0
  433. package/web/pages/board/host-bridge.ts +94 -0
  434. package/web/pages/board/host.tsx +19 -0
  435. package/web/pages/board/keys.ts +112 -0
  436. package/web/pages/board/live.ts +39 -0
  437. package/web/pages/board/main.ts +32 -0
  438. package/web/pages/board/pages.tsx +86 -0
  439. package/web/pages/board/panel.tsx +157 -0
  440. package/web/pages/board/portal.tsx +39 -0
  441. package/web/pages/board/use-boot.ts +13 -0
  442. package/web/pages/board/views.ts +63 -0
  443. package/web/pages/board-page.tsx +62 -0
  444. package/web/pages/home-page.tsx +127 -0
  445. package/web/pages/icebox-page.tsx +440 -0
  446. package/web/pages/notebook/App.tsx +35 -0
  447. package/web/pages/notebook-page.tsx +50 -0
  448. package/web/pages/popup/App.tsx +207 -0
  449. package/web/pages/settings-page.tsx +111 -0
  450. package/web/pages/task-page.tsx +383 -0
  451. package/web/pages/tasks-page.tsx +151 -0
  452. package/web/pages/terminal-page.tsx +15 -0
  453. package/web/popup/popup.ts +7 -0
  454. package/web/term/term-paste.ts +10 -0
  455. package/web/{term.ts → term/term.ts} +101 -27
  456. package/web/ui/alert-dialog.tsx +39 -0
  457. package/web/ui/badge.tsx +20 -0
  458. package/web/ui/button.tsx +37 -0
  459. package/web/ui/checkbox.tsx +20 -0
  460. package/web/ui/command.tsx +41 -0
  461. package/web/ui/dialog.tsx +28 -0
  462. package/web/ui/dropdown-menu.tsx +54 -0
  463. package/web/ui/icon.tsx +17 -0
  464. package/web/ui/index.ts +21 -0
  465. package/web/ui/input.tsx +9 -0
  466. package/web/ui/label.tsx +7 -0
  467. package/web/ui/legacy/board.css +715 -0
  468. package/web/{notes.html → ui/legacy/notes.css} +23 -157
  469. package/web/ui/legacy/popup.css +40 -0
  470. package/web/ui/popover.tsx +28 -0
  471. package/web/ui/select.tsx +61 -0
  472. package/web/ui/sheet.tsx +43 -0
  473. package/web/ui/skeleton.tsx +6 -0
  474. package/web/ui/sonner.tsx +25 -0
  475. package/web/ui/spinner.tsx +12 -0
  476. package/web/ui/switch.tsx +18 -0
  477. package/web/ui/tabs.tsx +18 -0
  478. package/web/ui/textarea.tsx +14 -0
  479. package/web/ui/theme.css +125 -0
  480. package/web/ui/toggle.tsx +8 -0
  481. package/web/ui/tooltip.tsx +26 -0
  482. package/web/{video.ts → video/video.ts} +5 -5
  483. package/web/board/add-project.ts +0 -147
  484. package/web/board/agent-favicons.ts +0 -9
  485. package/web/board/agent-term.ts +0 -51
  486. package/web/board/annotate-lib.ts +0 -19
  487. package/web/board/annotate.ts +0 -221
  488. package/web/board/api.ts +0 -180
  489. package/web/board/approvals.ts +0 -109
  490. package/web/board/badge.ts +0 -115
  491. package/web/board/cards.ts +0 -1080
  492. package/web/board/chat.ts +0 -128
  493. package/web/board/context.ts +0 -248
  494. package/web/board/dictation.ts +0 -343
  495. package/web/board/dom.ts +0 -132
  496. package/web/board/drafts.ts +0 -21
  497. package/web/board/fixes.ts +0 -89
  498. package/web/board/git.ts +0 -416
  499. package/web/board/home-ws.ts +0 -266
  500. package/web/board/home.ts +0 -421
  501. package/web/board/icebox.ts +0 -1788
  502. package/web/board/keys.ts +0 -121
  503. package/web/board/live.ts +0 -87
  504. package/web/board/main.ts +0 -94
  505. package/web/board/markdown.ts +0 -210
  506. package/web/board/onboarding.ts +0 -227
  507. package/web/board/panel.ts +0 -437
  508. package/web/board/phone-setup.ts +0 -79
  509. package/web/board/phone.ts +0 -219
  510. package/web/board/projects.ts +0 -277
  511. package/web/board/resources.ts +0 -170
  512. package/web/board/run-pick.ts +0 -41
  513. package/web/board/run-view.ts +0 -1316
  514. package/web/board/search-match.ts +0 -20
  515. package/web/board/search.ts +0 -330
  516. package/web/board/settings-accounts.ts +0 -76
  517. package/web/board/settings-agents.ts +0 -102
  518. package/web/board/settings-automations.ts +0 -71
  519. package/web/board/settings-cleanup.ts +0 -42
  520. package/web/board/settings-orchestration.ts +0 -32
  521. package/web/board/settings-pages.ts +0 -62
  522. package/web/board/settings-skills.ts +0 -86
  523. package/web/board/settings-voice.ts +0 -28
  524. package/web/board/settings.ts +0 -490
  525. package/web/board/store.ts +0 -47
  526. package/web/board/task-page.ts +0 -615
  527. package/web/board/task-results.ts +0 -234
  528. package/web/board/tasks.ts +0 -242
  529. package/web/board/terms.ts +0 -390
  530. package/web/board/update.ts +0 -171
  531. package/web/board/viewer.ts +0 -47
  532. package/web/board/views.ts +0 -164
  533. package/web/board/whatsapp-setup.ts +0 -149
  534. package/web/board/workspace.ts +0 -650
  535. package/web/board/ws-board-ui.ts +0 -95
  536. package/web/board/ws-tabs.ts +0 -227
  537. package/web/board.html +0 -1563
  538. package/web/board.js +0 -500
  539. package/web/notebook.js +0 -514
  540. package/web/notebook.ts +0 -1254
  541. package/web/popup.html +0 -141
  542. package/web/video.js +0 -570
  543. /package/web/{term.css → dist/term.css} +0 -0
  544. /package/web/{board/term-sessions.ts → lib/terminal/sessions.ts} +0 -0
  545. /package/web/{board/terminal-viewport.ts → lib/terminal/viewport.ts} +0 -0
@@ -0,0 +1,115 @@
1
+ /* kaizen board 89ee1824202278a1 -- generated by bun run build:web from web/pages/board/main.ts; do not edit */
2
+ (()=>{var NX=Object.create;var{getPrototypeOf:RX,defineProperty:P5,getOwnPropertyNames:TX}=Object;var O5=Object.prototype.hasOwnProperty;function EX(e){return this[e]}var AX,MX,h=(e,t,n)=>{var o=e!=null&&typeof e==="object";if(o){var r=t?AX??=new WeakMap:MX??=new WeakMap,a=r.get(e);if(a)return a}n=e!=null?NX(RX(e)):{};let i=t||!e||!e.__esModule||!O5.call(e,"default")?P5(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let s of TX(e))if(!O5.call(i,s))P5(i,s,{get:EX.bind(e,s),enumerable:!0})}if(o)r.set(e,i);return i};var xs=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var jt=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var q5=xs(function(Ke){var TS=Symbol.for("react.transitional.element"),DX=Symbol.for("react.portal"),PX=Symbol.for("react.fragment"),OX=Symbol.for("react.strict_mode"),_X=Symbol.for("react.profiler"),zX=Symbol.for("react.consumer"),IX=Symbol.for("react.context"),LX=Symbol.for("react.forward_ref"),BX=Symbol.for("react.suspense"),HX=Symbol.for("react.memo"),B5=Symbol.for("react.lazy"),jX=Symbol.for("react.activity"),UX=Symbol.for("react.view_transition"),_5=Symbol.iterator;function GX(e){if(e===null||typeof e!=="object")return null;return e=_5&&e[_5]||e["@@iterator"],typeof e==="function"?e:null}var H5={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j5=Object.assign,U5={};function mf(e,t,n){this.props=e,this.context=t,this.refs=U5,this.updater=n||H5}mf.prototype.isReactComponent={};mf.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};mf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function G5(){}G5.prototype=mf.prototype;function ES(e,t,n){this.props=e,this.context=t,this.refs=U5,this.updater=n||H5}var AS=ES.prototype=new G5;AS.constructor=ES;j5(AS,mf.prototype);AS.isPureReactComponent=!0;var z5=Array.isArray;function RS(){}var un={H:null,A:null,T:null,S:null},F5=Object.prototype.hasOwnProperty;function MS(e,t,n){var o=n.ref;return{$$typeof:TS,type:e,key:t,ref:o!==void 0?o:null,props:n}}function FX(e,t){return MS(e.type,t,e.props)}function DS(e){return typeof e==="object"&&e!==null&&e.$$typeof===TS}function VX(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var I5=/\/+/g;function NS(e,t){return typeof e==="object"&&e!==null&&e.key!=null?VX(""+e.key):t.toString(36)}function KX(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(RS,RS):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ff(e,t,n,o,r){var a=typeof e;if(a==="undefined"||a==="boolean")e=null;var i=!1;if(e===null)i=!0;else switch(a){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case TS:case DX:i=!0;break;case B5:return i=e._init,ff(i(e._payload),t,n,o,r)}}if(i)return r=r(e),i=o===""?"."+NS(e,0):o,z5(r)?(n="",i!=null&&(n=i.replace(I5,"$&/")+"/"),ff(r,t,n,"",function(c){return c})):r!=null&&(DS(r)&&(r=FX(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(I5,"$&/")+"/")+i)),t.push(r)),1;i=0;var s=o===""?".":o+":";if(z5(e))for(var l=0;l<e.length;l++)o=e[l],a=s+NS(o,l),i+=ff(o,t,n,a,r);else if(l=GX(e),typeof l==="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,a=s+NS(o,l++),i+=ff(o,t,n,a,r);else if(a==="object"){if(typeof e.then==="function")return ff(KX(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function Xv(e,t,n){if(e==null)return e;var o=[],r=0;return ff(e,o,"","",function(a){return t.call(n,a,r++)}),o}function qX(e){if(e._status===-1){var t=e._result,n=t();n.then(function(o){if(e._status===0||e._status===-1)e._status=1,e._result=o,n.status===void 0&&(n.status="fulfilled",n.value=o)},function(o){if(e._status===0||e._status===-1)e._status=2,e._result=o,n.status===void 0&&(n.status="rejected",n.reason=o)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var L5=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)};function V5(e){var t=un.T,n={};n.types=t!==null?t.types:null,un.T=n;try{var o=e(),r=un.S;r!==null&&r(n,o),typeof o==="object"&&o!==null&&typeof o.then==="function"&&o.then(RS,L5)}catch(a){L5(a)}finally{t!==null&&n.types!==null&&(t.types=n.types),un.T=t}}function K5(e){var t=un.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else V5(K5.bind(null,e))}var $X={map:Xv,forEach:function(e,t,n){Xv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xv(e,function(){t++}),t},toArray:function(e){return Xv(e,function(t){return t})||[]},only:function(e){if(!DS(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ke.Activity=jX;Ke.Children=$X;Ke.Component=mf;Ke.Fragment=PX;Ke.Profiler=_X;Ke.PureComponent=ES;Ke.StrictMode=OX;Ke.Suspense=BX;Ke.ViewTransition=UX;Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=un;Ke.__COMPILER_RUNTIME={__proto__:null,c:function(e){return un.H.useMemoCache(e)}};Ke.addTransitionType=K5;Ke.cache=function(e){return function(){return e.apply(null,arguments)}};Ke.cacheSignal=function(){return null};Ke.cloneElement=function(e,t,n){if(e===null||e===void 0)throw Error("The argument must be a React element, but you passed "+e+".");var o=j5({},e.props),r=e.key;if(t!=null)for(a in t.key!==void 0&&(r=""+t.key),t)!F5.call(t,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&t.ref===void 0||(o[a]=t[a]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var i=Array(a),s=0;s<a;s++)i[s]=arguments[s+2];o.children=i}return MS(e.type,r,o)};Ke.createContext=function(e){return e={$$typeof:IX,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:zX,_context:e},e};Ke.createElement=function(e,t,n){var o,r={},a=null;if(t!=null)for(o in t.key!==void 0&&(a=""+t.key),t)F5.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var s=Array(i),l=0;l<i;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(o in i=e.defaultProps,i)r[o]===void 0&&(r[o]=i[o]);return MS(e,a,r)};Ke.createRef=function(){return{current:null}};Ke.forwardRef=function(e){return{$$typeof:LX,render:e}};Ke.isValidElement=DS;Ke.lazy=function(e){return{$$typeof:B5,_payload:{_status:-1,_result:e},_init:qX}};Ke.memo=function(e,t){return{$$typeof:HX,type:e,compare:t===void 0?null:t}};Ke.startTransition=V5;Ke.unstable_useCacheRefresh=function(){return un.H.useCacheRefresh()};Ke.use=function(e){return un.H.use(e)};Ke.useActionState=function(e,t,n){return un.H.useActionState(e,t,n)};Ke.useCallback=function(e,t){return un.H.useCallback(e,t)};Ke.useContext=function(e){return un.H.useContext(e)};Ke.useDebugValue=function(){};Ke.useDeferredValue=function(e,t){return un.H.useDeferredValue(e,t)};Ke.useEffect=function(e,t){return un.H.useEffect(e,t)};Ke.useEffectEvent=function(e){return un.H.useEffectEvent(e)};Ke.useId=function(){return un.H.useId()};Ke.useImperativeHandle=function(e,t,n){return un.H.useImperativeHandle(e,t,n)};Ke.useInsertionEffect=function(e,t){return un.H.useInsertionEffect(e,t)};Ke.useLayoutEffect=function(e,t){return un.H.useLayoutEffect(e,t)};Ke.useMemo=function(e,t){return un.H.useMemo(e,t)};Ke.useOptimistic=function(e,t){return un.H.useOptimistic(e,t)};Ke.useReducer=function(e,t,n){return un.H.useReducer(e,t,n)};Ke.useRef=function(e){return un.H.useRef(e)};Ke.useState=function(e){return un.H.useState(e)};Ke.useSyncExternalStore=function(e,t,n){return un.H.useSyncExternalStore(e,t,n)};Ke.useTransition=function(){return un.H.useTransition()};Ke.version="19.3.1"});var I=xs(function(YX,$5){$5.exports=q5()});var X5=xs(function(Pr){var WX=I();function W5(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Mc(){}var Kr={d:{f:Mc,r:function(){throw Error(W5(522))},D:Mc,C:Mc,L:Mc,m:Mc,X:Mc,S:Mc,M:Mc},p:0,findDOMNode:null},XX=Symbol.for("react.portal"),QX=Symbol.for("react.recoverable"),Y5=Symbol.for("react.optimistic_key");function ZX(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:XX,key:o==null?null:o===Y5?Y5:""+o,children:e,containerInfo:t,implementation:n}}var Kg=WX.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Qv(e,t){if(e==="font")return"";if(typeof t==="string")return t==="use-credentials"?t:""}Pr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Kr;Pr.browser=function(e){return{$$typeof:QX,_reason:e}};Pr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(W5(299));return ZX(e,t,null,n)};Pr.flushSync=function(e){var t=Kg.T,n=Kr.p;try{if(Kg.T=null,Kr.p=2,e)return e()}finally{Kg.T=t,Kr.p=n,Kr.d.f()}};Pr.preconnect=function(e,t){typeof e==="string"&&(t?(t=t.crossOrigin,t=typeof t==="string"?t==="use-credentials"?t:"":void 0):t=null,Kr.d.C(e,t))};Pr.prefetchDNS=function(e){typeof e==="string"&&Kr.d.D(e)};Pr.preinit=function(e,t){if(typeof e==="string"&&t&&typeof t.as==="string"){var n=t.as,o=Qv(n,t.crossOrigin),r=typeof t.integrity==="string"?t.integrity:void 0,a=typeof t.fetchPriority==="string"?t.fetchPriority:void 0;n==="style"?Kr.d.S(e,typeof t.precedence==="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&Kr.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce==="string"?t.nonce:void 0})}};Pr.preinitModule=function(e,t){if(typeof e==="string")if(typeof t==="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Qv(t.as,t.crossOrigin);Kr.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==="string"?t.integrity:void 0,nonce:typeof t.nonce==="string"?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==="string"?t.fetchPriority:void 0})}}else t==null&&Kr.d.M(e)};Pr.preload=function(e,t){if(typeof e==="string"&&typeof t==="object"&&t!==null&&typeof t.as==="string"){var n=t.as,o=Qv(n,t.crossOrigin);Kr.d.L(e,n,{crossOrigin:o,integrity:typeof t.integrity==="string"?t.integrity:void 0,nonce:typeof t.nonce==="string"?t.nonce:void 0,type:typeof t.type==="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority==="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==="string"?t.imageSizes:void 0,media:typeof t.media==="string"?t.media:void 0})}};Pr.preloadModule=function(e,t){if(typeof e==="string")if(t){var n=Qv(t.as,t.crossOrigin);Kr.d.m(e,{as:typeof t.as==="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==="string"?t.integrity:void 0,nonce:typeof t.nonce==="string"?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==="string"?t.fetchPriority:void 0})}else Kr.d.m(e)};Pr.requestFormReset=function(e){Kr.d.r(e)};Pr.unstable_batchedUpdates=function(e,t){return e(t)};Pr.useFormState=function(e,t,n){return Kg.H.useFormState(e,t,n)};Pr.useFormStatus=function(){return Kg.H.useHostTransitionStatus()};Pr.version="19.3.1"});var Za=xs(function(JX,Z5){function Q5(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Q5)}catch(e){console.error(e)}}Q5(),Z5.exports=X5()});var aD=xs(function(Nn){function OS(e,t){var n=e.length;e.push(t);e:for(;0<n;){var o=n-1>>>1,r=e[o];if(0<Zv(r,t))e[o]=t,e[n]=r,n=o;else break e}}function ws(e){return e.length===0?null:e[0]}function ny(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var o=0,r=e.length,a=r>>>1;o<a;){var i=2*(o+1)-1,s=e[i],l=i+1,c=e[l];if(0>Zv(s,n))l<r&&0>Zv(c,s)?(e[o]=c,e[l]=n,o=l):(e[o]=s,e[i]=n,o=i);else if(l<r&&0>Zv(c,n))e[o]=c,e[l]=n,o=l;else break e}}return t}function Zv(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}Nn.unstable_now=void 0;if(typeof performance==="object"&&typeof performance.now==="function")_S=performance,Nn.unstable_now=function(){return _S.now()};else Jv=Date,zS=Jv.now(),Nn.unstable_now=function(){return Jv.now()-zS};var _S,Jv,zS,ml=[],Dc=[],eQ=1,Ja=null,Or=3,IS=!1,qg=!1,$g=!1,BS=!1,eD=typeof setTimeout==="function"?setTimeout:null,tD=typeof clearTimeout==="function"?clearTimeout:null,J5=typeof setImmediate<"u"?setImmediate:null;function ey(e){for(var t=ws(Dc);t!==null;){if(t.callback===null)ny(Dc);else if(t.startTime<=e)ny(Dc),t.sortIndex=t.expirationTime,OS(ml,t);else break;t=ws(Dc)}}function HS(e){if($g=!1,ey(e),!qg)if(ws(ml)!==null)qg=!0,hf||(hf=!0,gf());else{var t=ws(Dc);t!==null&&jS(HS,t.startTime-e)}}var hf=!1,Yg=-1,nD=5,oD=-1;function rD(){return BS?!0:Nn.unstable_now()-oD<nD?!1:!0}function PS(){if(BS=!1,hf){var e=Nn.unstable_now();oD=e;var t=!0;try{e:{qg=!1,$g&&($g=!1,tD(Yg),Yg=-1),IS=!0;var n=Or;try{t:{ey(e);for(Ja=ws(ml);Ja!==null&&!(Ja.expirationTime>e&&rD());){var o=Ja.callback;if(typeof o==="function"){Ja.callback=null,Or=Ja.priorityLevel;var r=o(Ja.expirationTime<=e);if(e=Nn.unstable_now(),typeof r==="function"){Ja.callback=r,ey(e),t=!0;break t}Ja===ws(ml)&&ny(ml),ey(e)}else ny(ml);Ja=ws(ml)}if(Ja!==null)t=!0;else{var a=ws(Dc);a!==null&&jS(HS,a.startTime-e),t=!1}}break e}finally{Ja=null,Or=n,IS=!1}t=void 0}}finally{t?gf():hf=!1}}}var gf;if(typeof J5==="function")gf=function(){J5(PS)};else if(typeof MessageChannel<"u")ty=new MessageChannel,LS=ty.port2,ty.port1.onmessage=PS,gf=function(){LS.postMessage(null)};else gf=function(){eD(PS,0)};var ty,LS;function jS(e,t){Yg=eD(function(){e(Nn.unstable_now())},t)}Nn.unstable_IdlePriority=5;Nn.unstable_ImmediatePriority=1;Nn.unstable_LowPriority=4;Nn.unstable_NormalPriority=3;Nn.unstable_Profiling=null;Nn.unstable_UserBlockingPriority=2;Nn.unstable_cancelCallback=function(e){e.callback=null};Nn.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):nD=0<e?Math.floor(1000/e):5};Nn.unstable_getCurrentPriorityLevel=function(){return Or};Nn.unstable_next=function(e){switch(Or){case 1:case 2:case 3:var t=3;break;default:t=Or}var n=Or;Or=t;try{return e()}finally{Or=n}};Nn.unstable_requestPaint=function(){BS=!0};Nn.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=Or;Or=e;try{return t()}finally{Or=n}};Nn.unstable_scheduleCallback=function(e,t,n){var o=Nn.unstable_now();switch(typeof n==="object"&&n!==null?(n=n.delay,n=typeof n==="number"&&0<n?o+n:o):n=o,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5000}return r=n+r,e={id:eQ++,callback:t,priorityLevel:e,startTime:n,expirationTime:r,sortIndex:-1},n>o?(e.sortIndex=n,OS(Dc,e),ws(ml)===null&&e===ws(Dc)&&($g?(tD(Yg),Yg=-1):$g=!0,jS(HS,n-o))):(e.sortIndex=r,OS(ml,e),qg||IS||(qg=!0,hf||(hf=!0,gf()))),e};Nn.unstable_shouldYield=rD;Nn.unstable_wrapCallback=function(e){var t=Or;return function(){var n=Or;Or=t;try{return e.apply(this,arguments)}finally{Or=n}}}});var sD=xs(function(tQ,iD){iD.exports=aD()});var KO=xs(function(_x){var No=sD(),V4=I(),nQ=Za();function U(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function K4(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bh(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function q4(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function $4(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function lD(e){if(Bh(e)!==e)throw Error(U(188))}function oQ(e){var t=e.alternate;if(!t){if(t=Bh(e),t===null)throw Error(U(188));return t!==e?null:e}for(var n=e,o=t;;){var r=n.return;if(r===null)break;var a=r.alternate;if(a===null){if(o=r.return,o!==null){n=o;continue}break}if(r.child===a.child){for(a=r.child;a;){if(a===n)return lD(r),e;if(a===o)return lD(r),t;a=a.sibling}throw Error(U(188))}if(n.return!==o.return)n=r,o=a;else{for(var i=!1,s=r.child;s;){if(s===n){i=!0,n=r,o=a;break}if(s===o){i=!0,o=r,n=a;break}s=s.sibling}if(!i){for(s=a.child;s;){if(s===n){i=!0,n=a,o=r;break}if(s===o){i=!0,o=a,n=r;break}s=s.sibling}if(!i)throw Error(U(189))}}if(n.alternate!==o)throw Error(U(190))}if(n.tag!==3)throw Error(U(188));return n.stateNode.current===n?e:t}function Y4(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Y4(e),t!==null)return t;e=e.sibling}return null}function ua(e,t,n,o,r,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,o,r,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&ua(e.child,t,n,o,r,a))return!0;e=e.sibling}return!1}function zd(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function cD(e){var t=!1;for(e=e.return;e!==null;){if(e.tag===4&&(t=!0),e.tag===3||e.tag===5||e.tag===27)break;e=e.return}return t}function W4(e){var t=[null,null],n=zd(e);if(n===null)return t;return X4(t,e,n.child,{foundSelf:!1}),t}function X4(e,t,n,o){for(;n!==null;){if(n===t)o.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(o.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&X4(e,t,n.child,o))return!0;n=n.sibling}return!1}function Co(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(U(559))}}var Sf=null,bC=null;function rQ(e,t,n){return e===n?!0:e===t?(Sf=e,!0):!1}function aQ(e,t,n){return e===n?(bC=e,!1):e===t?(bC!==null&&(Sf=e),!0):!1}function uD(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e?e:null}function vC(e,t,n){for(var o=0,r=e;r;r=n(r))o++;r=0;for(var a=t;a;a=n(a))r++;for(;0<o-r;)e=n(e),o--;for(;0<r-o;)t=n(t),r--;for(;o--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var an=Object.assign,iQ=Symbol.for("react.element"),oy=Symbol.for("react.transitional.element"),eh=Symbol.for("react.portal"),Cf=Symbol.for("react.fragment"),Q4=Symbol.for("react.strict_mode"),yC=Symbol.for("react.profiler"),Z4=Symbol.for("react.consumer"),Ts=Symbol.for("react.context"),M2=Symbol.for("react.forward_ref"),xC=Symbol.for("react.suspense"),wC=Symbol.for("react.suspense_list"),D2=Symbol.for("react.memo"),zc=Symbol.for("react.lazy"),kC=Symbol.for("react.activity"),sQ=Symbol.for("react.legacy_hidden"),lQ=Symbol.for("react.memo_cache_sentinel"),SC=Symbol.for("react.view_transition"),cQ=Symbol.for("react.recoverable"),dD=Symbol.iterator;function Wg(e){if(e===null||typeof e!=="object")return null;return e=dD&&e[dD]||e["@@iterator"],typeof e==="function"?e:null}var uQ=Symbol.for("react.client.reference");function CC(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===uQ?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case Cf:return"Fragment";case yC:return"Profiler";case Q4:return"StrictMode";case xC:return"Suspense";case wC:return"SuspenseList";case kC:return"Activity";case SC:return"ViewTransition"}if(typeof e==="object")switch(e.$$typeof){case eh:return"Portal";case Ts:return e.displayName||"Context";case Z4:return(e._context.displayName||"Context")+".Consumer";case M2:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D2:return t=e.displayName||null,t!==null?t:CC(e.type)||"Memo";case zc:t=e._payload,e=e._init;try{return CC(e(t))}catch(n){}}return null}var th=Array.isArray,Be=V4.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Mt=nQ.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,kd={pending:!1,data:null,method:null,action:null},NC=[],Nf=-1;function _s(e){return{current:e}}function vr(e){0>Nf||(e.current=NC[Nf],NC[Nf]=null,Nf--)}function fn(e,t){Nf++,NC[Nf]=e.current,e.current=t}var Ds=_s(null),kh=_s(null),Vc=_s(null),jy=_s(null);function Uy(e,t){switch(fn(Vc,t),fn(kh,e),fn(Ds,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)?(e=e.namespaceURI)?S4(e):0:0;break;default:if(e=t.tagName,t=t.namespaceURI)t=S4(t),e=xO(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}vr(Ds),fn(Ds,e)}function Kf(){vr(Ds),vr(kh),vr(Vc)}function RC(e){var t=e.memoizedState;t!==null&&(tm._currentValue=t.memoizedState,fn(jy,e)),t=Ds.current;var n=xO(t,e.type);t!==n&&(fn(kh,e),fn(Ds,n))}function Gy(e){kh.current===e&&(vr(Ds),vr(kh)),jy.current===e&&(vr(jy),tm._currentValue=kd)}var US,pD;function Oc(e){if(US===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);US=t&&t[1]||"",pD=-1<n.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+US+e+pD}var GS=!1;function FS(e,t){if(!e||GS)return"";GS=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(t){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(g){var p=g}Reflect.construct(e,[],u)}else{try{u.call()}catch(g){p=g}u=!1;try{var f=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),u=!0,new e}finally{u&&(f!==void 0?Object.defineProperty(e.prototype,"props",f):delete e.prototype.props)}}}else{try{throw Error()}catch(g){p=g}(u=e())&&typeof u.catch==="function"&&u.catch(function(){})}}catch(g){if(g&&p&&typeof g.stack==="string")return[g.stack,p.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=o.DetermineComponentFrameRoot(),i=a[0],s=a[1];if(i&&s){var l=i.split(`
5
+ `),c=s.split(`
6
+ `);for(r=o=0;o<l.length&&!l[o].includes("DetermineComponentFrameRoot");)o++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(o===l.length||r===c.length)for(o=l.length-1,r=c.length-1;1<=o&&0<=r&&l[o]!==c[r];)r--;for(;1<=o&&0<=r;o--,r--)if(l[o]!==c[r]){if(o!==1||r!==1)do if(o--,r--,0>r||l[o]!==c[r]){var d=`
7
+ `+l[o].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=o&&0<=r);break}}}finally{GS=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Oc(n):""}function dQ(e,t){switch(e.tag){case 26:case 27:case 5:return Oc(e.type);case 16:return Oc("Lazy");case 13:return e.child!==t&&t!==null?Oc("Suspense Fallback"):Oc("Suspense");case 19:return Oc("SuspenseList");case 0:case 15:return FS(e.type,!1);case 11:return FS(e.type.render,!1);case 1:return FS(e.type,!0);case 31:return Oc("Activity");case 30:return Oc("ViewTransition");default:return""}}function fD(e){try{var t="",n=null;do t+=dQ(e,n),n=e,e=e.return;while(e);return t}catch(o){return`
8
+ Error generating stack: `+o.message+`
9
+ `+o.stack}}var TC=Object.prototype.hasOwnProperty,{unstable_scheduleCallback:P2,unstable_cancelCallback:VS,unstable_shouldYield:pQ,unstable_requestPaint:fQ,unstable_now:Ma,unstable_getCurrentPriorityLevel:mQ,unstable_ImmediatePriority:J4,unstable_UserBlockingPriority:eP,unstable_NormalPriority:Fy,unstable_LowPriority:gQ,unstable_IdlePriority:tP,log:hQ,unstable_setDisableYieldValue:bQ}=No,Hh=null,Da=null;function Bc(e){if(typeof hQ==="function"&&bQ(e),Da&&typeof Da.setStrictMode==="function")try{Da.setStrictMode(Hh,e)}catch(t){}}var Pa=Math.clz32?Math.clz32:xQ,{log:vQ,LN2:yQ}=Math;function xQ(e){return e>>>=0,e===0?32:31-(vQ(e)/yQ|0)|0}var ry=256,ay=262144,iy=4194304;function hd(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function gx(e,t,n){var o=e.pendingLanes;if(o===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=o&134217727;return s!==0?(o=s&~a,o!==0?r=hd(o):(i&=s,i!==0?r=hd(i):n||(n=s&~e,n!==0&&(r=hd(n))))):(s=o&~a,s!==0?r=hd(s):i!==0?r=hd(i):n||(n=o&~e,n!==0&&(r=hd(n)))),r===0?0:t!==0&&t!==r&&(t&a)===0&&(a=r&-r,n=t&-t,a>=n||a===32&&(n&4194048)!==0)?t:r}function jh(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nP(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var o=31-Pa(n),r=1<<o;t|=e[o],n&=~r}return t}function wQ(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function oP(){var e=iy;return iy<<=1,(iy&62914560)===0&&(iy=4194304),e}function KS(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Uh(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kQ(e,t,n,o,r,a){var i=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var{entanglements:s,expirationTimes:l,hiddenUpdates:c}=e;for(n=i&~n;0<n;){var d=31-Pa(n),u=1<<d;s[d]=0,l[d]=-1;var p=c[d];if(p!==null)for(c[d]=null,d=0;d<p.length;d++){var f=p[d];f!==null&&(f.lane&=-536870913)}n&=~u}o!==0&&rP(e,o,0),a!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=a&~(i&~t))}function rP(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var o=31-Pa(t);e.entangledLanes|=t,e.entanglements[o]=e.entanglements[o]|1073741824|n&261930}function aP(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var o=31-Pa(n),r=1<<o;r&t|e[o]&t&&(e[o]|=t),n&=~r}}function iP(e,t){var n=t&-t;return n=(n&42)!==0?1:O2(n),(n&(e.suspendedLanes|t))!==0?0:n}function O2(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function _2(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function sP(){var e=Mt.p;if(e!==0)return e;return e=window.event,e===void 0?32:GO(e.type)}function mD(e,t){var n=Mt.p;try{return Mt.p=e,t()}finally{Mt.p=n}}var Tl=Math.random().toString(36).slice(2),hr="__reactFiber$"+Tl,da="__reactProps$"+Tl,rm="__reactContainer$"+Tl,gD="__reactEvents$"+Tl,SQ="__reactListeners$"+Tl,CQ="__reactHandles$"+Tl,hD="__reactResources$"+Tl,Gh="__reactMarker$"+Tl,Vy="__reactLoad$"+Tl;function hx(e){delete e[hr],delete e[da],delete e[SQ],delete e[CQ]}function xd(e){var t;if(t=e[hr])return t;for(var n=e.parentNode;n;){if(t=n[rm]||n[hr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=D4(e);e!==null;){if(n=e[hr])return n;e=D4(e)}return t}e=n,n=e.parentNode}return null}function am(e){if(e=e[hr]||e[rm]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function nh(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(U(33))}function zf(e){var t=e[hD];return t||(t=e[hD]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Yo(e){e[Gh]=!0}function lP(e){e[Vy]=void 0}var cP=new Set,uP={};function Id(e,t){qf(e,t),qf(e+"Capture",t)}function qf(e,t){uP[e]=t;for(e=0;e<t.length;e++)cP.add(t[e])}var NQ=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),bD={},vD={};function RQ(e){if(TC.call(vD,e))return!0;if(TC.call(bD,e))return!1;if(NQ.test(e))return vD[e]=!0;return bD[e]=!0,!1}var Ct=!1;function yD(){var e=Ct;return Ct=!1,e}function xy(e,t,n){if(RQ(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var o=t.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function sy(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function gl(e,t,n,o){if(o===null)e.removeAttribute(n);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,o)}}function Ra(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dP(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function TQ(e,t,n){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get==="function"&&typeof o.set==="function"){var{get:r,set:a}=o;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(i){n=""+i,a.call(this,i)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function EC(e){if(!e._valueTracker){var t=dP(e)?"checked":"value";e._valueTracker=TQ(e,t,""+e[t])}}function pP(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),o="";return e&&(o=dP(e)?e.checked?"true":"false":e.value),e=o,e!==n?(t.setValue(e),!0):!1}var EQ=/[\n"\\]/g;function ri(e){return e.replace(EQ,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function AC(e,t,n,o,r,a,i,s){if(e.name="",i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&typeof i!=="boolean"?e.type=i:e.removeAttribute("type"),t!=null)if(i==="number"){if(t===0&&e.value===""||e.value!=t)e.value=""+Ra(t)}else e.value!==""+Ra(t)&&(e.value=""+Ra(t));else i!=="submit"&&i!=="reset"||e.removeAttribute("value");t!=null?i==="number"&&e.value==t?qS(e,Ra(e.value)):qS(e,Ra(t)):n!=null?qS(e,Ra(n)):o!=null&&e.removeAttribute("value"),r==null&&a!=null&&(e.defaultChecked=!!a),r!=null&&(e.checked=r&&typeof r!=="function"&&typeof r!=="symbol"),s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"?e.name=""+Ra(s):e.removeAttribute("name")}function fP(e,t,n,o,r,a,i,s){if(a!=null&&typeof a!=="function"&&typeof a!=="symbol"&&typeof a!=="boolean"&&(e.type=a),t!=null||n!=null){if(!(a!=="submit"&&a!=="reset"||t!==void 0&&t!==null)){EC(e);return}n=n!=null?""+Ra(n):"",t=t!=null?""+Ra(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}o=o!=null?o:r,o=typeof o!=="function"&&typeof o!=="symbol"&&!!o,e.checked=s?e.checked:!!o,e.defaultChecked=!!o,i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&typeof i!=="boolean"&&(e.name=i),EC(e)}function qS(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function If(e,t,n,o){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&o&&(e[n].defaultSelected=!0)}else{n=""+Ra(n),t=null;for(r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,o&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function mP(e,t,n){if(t!=null&&(t=""+Ra(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Ra(n):""}function gP(e,t,n,o){if(t==null){if(o!=null){if(n!=null)throw Error(U(92));if(th(o)){if(1<o.length)throw Error(U(93));o=o[0]}n=o}n==null&&(n=""),t=n}n=Ra(t),e.defaultValue=n,o=e.textContent,o===n&&o!==""&&o!==null&&(e.value=o),EC(e)}function $f(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var AQ=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xD(e,t,n){var o=t.indexOf("--")===0;n==null||typeof n==="boolean"||n===""?o?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":o?e.setProperty(t,n):typeof n!=="number"||n===0||AQ.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function hP(e,t,n){if(t!=null&&typeof t!=="object")throw Error(U(62));if(e=e.style,n!=null){for(var o in n)!n.hasOwnProperty(o)||t!=null&&t.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="",Ct=!0);for(var r in t)o=t[r],t.hasOwnProperty(r)&&n[r]!==o&&(xD(e,r,o),Ct=!0)}else for(var a in t)t.hasOwnProperty(a)&&xD(e,a,t[a])}function z2(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var MQ=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),DQ=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function wy(e){return DQ.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Es(){}var MC=null;function I2(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rf=null,Lf=null;function wD(e){var t=am(e);if(t&&(e=t.stateNode)){var n=e[da]||null;e:switch(e=t.stateNode,t.type){case"input":if(AC(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;n=n.querySelectorAll('input[name="'+ri(""+t)+'"][type="radio"]');for(t=0;t<n.length;t++){var o=n[t];if(o!==e&&o.form===e.form){var r=o[da]||null;if(!r)throw Error(U(90));AC(o,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)o=n[t],o.form===e.form&&pP(o)}break e;case"textarea":mP(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&If(e,!!n.multiple,t,!1)}}}var $S=!1;function bP(e,t,n){if($S)return e(t,n);$S=!0;try{var o=e(t);return o}finally{if($S=!1,Rf!==null||Lf!==null){if(Mx(),Rf&&(t=Rf,e=Lf,Lf=Rf=null,wD(t),e))for(t=0;t<e.length;t++)wD(e[t])}}}function Sh(e,t){var n=e.stateNode;if(n===null)return null;var o=n[da]||null;if(o===null)return null;n=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(n&&typeof n!=="function")throw Error(U(231,t,typeof n));return n}var wl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),DC=!1;if(wl)try{bd={},Object.defineProperty(bd,"passive",{get:function(){DC=!0}}),window.addEventListener("test",bd,bd),window.removeEventListener("test",bd,bd)}catch(e){DC=!1}var bd,Hc=null,L2=null,ky=null;function vP(){if(ky)return ky;var e,t=L2,n=t.length,o,r="value"in Hc?Hc.value:Hc.textContent,a=r.length;for(e=0;e<n&&t[e]===r[e];e++);var i=n-e;for(o=1;o<=i&&t[n-o]===r[a-o];o++);return ky=r.slice(e,1<o?1-o:void 0)}function Sy(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ly(){return!0}function kD(){return!1}function Wr(e){function t(n,o,r,a,i){this._reactName=n,this._targetInst=r,this.type=o,this.nativeEvent=a,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(n=e[s],this[s]=n?n(a):a[s]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?ly:kD,this.isPropagationStopped=kD,this}return an(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!=="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ly)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!=="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ly)},persist:function(){},isPersistent:ly}),t}var au={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bx=Wr(au),Fh=an({},au,{view:0,detail:0}),PQ=Wr(Fh),YS,WS,Xg,vx=an({},Fh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:B2,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){if("movementX"in e)return e.movementX;return e!==Xg&&(Xg&&e.type==="mousemove"?(YS=e.screenX-Xg.screenX,WS=e.screenY-Xg.screenY):WS=YS=0,Xg=e),YS},movementY:function(e){return"movementY"in e?e.movementY:WS}}),SD=Wr(vx),OQ=an({},vx,{dataTransfer:0}),_Q=Wr(OQ),zQ=an({},Fh,{relatedTarget:0}),XS=Wr(zQ),IQ=an({},au,{animationName:0,elapsedTime:0,pseudoElement:0}),LQ=Wr(IQ),BQ=an({},au,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),HQ=Wr(BQ),jQ=an({},au,{data:0}),CD=Wr(jQ),UQ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GQ={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},FQ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function VQ(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=FQ[e])?!!t[e]:!1}function B2(){return VQ}var KQ=an({},Fh,{key:function(e){if(e.key){var t=UQ[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Sy(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?GQ[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:B2,charCode:function(e){return e.type==="keypress"?Sy(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Sy(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qQ=Wr(KQ),$Q=an({},vx,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ND=Wr($Q),YQ=an({},au,{submitter:0}),WQ=Wr(YQ),XQ=an({},Fh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:B2}),QQ=Wr(XQ),ZQ=an({},au,{propertyName:0,elapsedTime:0,pseudoElement:0}),JQ=Wr(ZQ),eZ=an({},vx,{deltaX:function(e){return"deltaX"in e?e.deltaX:("wheelDeltaX"in e)?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:("wheelDeltaY"in e)?-e.wheelDeltaY:("wheelDelta"in e)?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),tZ=Wr(eZ),nZ=an({},au,{newState:0,oldState:0,source:0}),oZ=Wr(nZ),rZ=[9,13,27,32],H2=wl&&"CompositionEvent"in window,ch=null;wl&&"documentMode"in document&&(ch=document.documentMode);var aZ=wl&&"TextEvent"in window&&!ch,yP=wl&&(!H2||ch&&8<ch&&11>=ch),RD=String.fromCharCode(32),TD=!1;function xP(e,t){switch(e){case"keyup":return rZ.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wP(e){return e=e.detail,typeof e==="object"&&"data"in e?e.data:null}var Tf=!1;function iZ(e,t){switch(e){case"compositionend":return wP(t);case"keypress":if(t.which!==32)return null;return TD=!0,RD;case"textInput":return e=t.data,e===RD&&TD?null:e;default:return null}}function sZ(e,t){if(Tf)return e==="compositionend"||!H2&&xP(e,t)?(e=vP(),ky=L2=Hc=null,Tf=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return yP&&t.locale!=="ko"?null:t.data;default:return null}}var lZ={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ED(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!lZ[e.type]:t==="textarea"?!0:!1}function kP(e,t,n,o){Rf?Lf?Lf.push(o):Lf=[o]:Rf=o,t=px(t,"onChange"),0<t.length&&(n=new bx("onChange","change",null,n,o),e.push({event:n,listeners:t}))}var uh=null,Ch=null;function cZ(e){bO(e,0)}function yx(e){var t=nh(e);if(pP(t))return e}function AD(e,t){if(e==="change")return t}var SP=!1;if(wl){if(wl){if(rh="oninput"in document,!rh)Cy=document.createElement("div"),Cy.setAttribute("oninput","return;"),rh=typeof Cy.oninput==="function";oh=rh}else oh=!1;SP=oh&&(!document.documentMode||9<document.documentMode)}var oh,rh,Cy;function MD(){uh&&(uh.detachEvent("onpropertychange",CP),Ch=uh=null)}function CP(e){if(e.propertyName==="value"&&yx(Ch)){var t=[];kP(t,Ch,e,I2(e)),bP(cZ,t)}}function uZ(e,t,n){e==="focusin"?(MD(),uh=t,Ch=n,uh.attachEvent("onpropertychange",CP)):e==="focusout"&&MD()}function dZ(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return yx(Ch)}function pZ(e,t){if(e==="click")return yx(t)}function fZ(e,t){if(e==="input"||e==="change")return yx(t)}function mZ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _a=typeof Object.is==="function"?Object.is:mZ;function Nh(e,t){if(_a(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(o=0;o<n.length;o++){var r=n[o];if(!TC.call(t,r)||!_a(e[r],t[r]))return!1}return!0}function PC(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function DD(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function PD(e,t){var n=DD(e);e=0;for(var o;n;){if(n.nodeType===3){if(o=e+n.textContent.length,e<=t&&o>=t)return{node:n,offset:t-e};e=o}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=DD(n)}}function NP(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?NP(e,t.parentNode):("contains"in e)?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function RP(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=PC(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==="string"}catch(o){n=!1}if(n)e=t.contentWindow;else break;t=PC(e.document)}return t}function j2(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var gZ=wl&&"documentMode"in document&&11>=document.documentMode,Ef=null,OC=null,dh=null,_C=!1;function OD(e,t,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_C||Ef==null||Ef!==PC(o)||(o=Ef,("selectionStart"in o)&&j2(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),dh&&Nh(dh,o)||(dh=o,o=px(OC,"onSelect"),0<o.length&&(t=new bx("onSelect","select",null,t,n),e.push({event:t,listeners:o}),t.target=Ef)))}function md(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Af={animationend:md("Animation","AnimationEnd"),animationiteration:md("Animation","AnimationIteration"),animationstart:md("Animation","AnimationStart"),transitionrun:md("Transition","TransitionRun"),transitionstart:md("Transition","TransitionStart"),transitioncancel:md("Transition","TransitionCancel"),transitionend:md("Transition","TransitionEnd")},QS={},TP={};wl&&(TP=document.createElement("div").style,("AnimationEvent"in window)||(delete Af.animationend.animation,delete Af.animationiteration.animation,delete Af.animationstart.animation),("TransitionEvent"in window)||delete Af.transitionend.transition);function Ld(e){if(QS[e])return QS[e];if(!Af[e])return e;var t=Af[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in TP)return QS[e]=t[n];return e}var EP=Ld("animationend"),AP=Ld("animationiteration"),MP=Ld("animationstart"),hZ=Ld("transitionrun"),bZ=Ld("transitionstart"),vZ=Ld("transitioncancel"),DP=Ld("transitionend"),PP=new Map,zC="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");zC.push("scrollEnd");function Vi(e,t){PP.set(e,t),Id(t,[e])}var yZ=0;function kl(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Fi.identifierPrefix;var n=yZ++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function _D(e){if(e==null||typeof e==="string")return e;var t=null,n=Vf;if(n!==null)for(var o=0;o<n.length;o++){var r=e[n[o]];if(r!=null){if(r==="none")return"none";t=t==null?r:t+(" "+r)}}return t==null?e.default:t}function El(e,t){return e=_D(e),t=_D(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Ky=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},ti=[],Mf=0,U2=0;function xx(){for(var e=Mf,t=U2=Mf=0;t<e;){var n=ti[t];ti[t++]=null;var o=ti[t];ti[t++]=null;var r=ti[t];ti[t++]=null;var a=ti[t];if(ti[t++]=null,o!==null&&r!==null){var i=o.pending;i===null?r.next=r:(r.next=i.next,i.next=r),o.pending=r}a!==0&&OP(n,r,a)}}function wx(e,t,n,o){ti[Mf++]=e,ti[Mf++]=t,ti[Mf++]=n,ti[Mf++]=o,U2|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function G2(e,t,n,o){return wx(e,t,n,o),qy(e)}function Bd(e,t){return wx(e,null,null,t),qy(e)}function OP(e,t,n){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n);for(var r=!1,a=e.return;a!==null;)a.childLanes|=n,o=a.alternate,o!==null&&(o.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(r=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,r&&t!==null&&(r=31-Pa(n),e=a.hiddenUpdates,o=e[r],o===null?e[r]=[t]:o.push(t),t.lane=n|536870912),a):null}function qy(e){if(50<wh)throw wh=0,_y=null,Error(U(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Df={};function xZ(e,t,n,o){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function la(e,t,n,o){return new xZ(e,t,n,o)}function F2(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yl(e,t){var n=e.alternate;return n===null?(n=la(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function _P(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ny(e,t,n,o,r,a){var i=0;if(o=e,typeof o==="function")F2(o)&&(i=1);else if(typeof o==="string")i=qJ(e,n,Ds.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(o){case kC:return e=la(31,n,t,r),e.elementType=kC,e.lanes=a,e;case Cf:return Sd(n.children,r,a,t);case Q4:i=8,r|=24;break;case yC:return e=la(12,n,t,r|2),e.elementType=yC,e.lanes=a,e;case xC:return e=la(13,n,t,r),e.elementType=xC,e.lanes=a,e;case wC:return e=la(19,n,t,r),e.elementType=wC,e.lanes=a,e;case sQ:case SC:return e=r|32,e=la(30,n,t,e),e.elementType=SC,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof o==="object"&&o!==null)switch(o.$$typeof){case Ts:i=10;break e;case Z4:i=9;break e;case M2:i=11;break e;case D2:i=14;break e;case zc:i=16,o=null;break e}i=29,n=Error(U(130,e===null?"null":typeof e,"")),o=null}return t=la(i,n,t,r),t.elementType=e,t.type=o,t.lanes=a,t}function Sd(e,t,n,o){return e=la(7,e,o,t),e.lanes=n,e}function ZS(e,t,n){return e=la(6,e,null,t),e.lanes=n,e}function zP(e){var t=la(18,null,null,0);return t.stateNode=e,t}function JS(e,t,n){return t=la(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zD=new WeakMap;function ai(e,t){if(typeof e==="object"&&e!==null){var n=zD.get(e);if(n!==void 0)return n;return t={value:e,source:t,stack:fD(t)},zD.set(e,t),t}return{value:e,source:t,stack:fD(t)}}var Pf=[],Of=0,$y=null,Rh=0,ni=[],oi=0,eu=null,As=1,Ms="";function bl(e,t){Pf[Of++]=Rh,Pf[Of++]=$y,$y=e,Rh=t}function IP(e,t,n){ni[oi++]=As,ni[oi++]=Ms,ni[oi++]=eu,eu=e;var o=As;e=Ms;var r=32-Pa(o)-1;o&=~(1<<r),n+=1;var a=32-Pa(t)+r;if(30<a){var i=r-r%5;a=(o&(1<<i)-1).toString(32),o>>=i,r-=i,As=1<<32-Pa(t)+r|n<<r|o,Ms=a+e}else As=1<<a|n<<r|o,Ms=e}function kx(e){e.return!==null&&(bl(e,1),IP(e,1,0))}function V2(e){for(;e===$y;)$y=Pf[--Of],Pf[Of]=null,Rh=Pf[--Of],Pf[Of]=null;for(;e===eu;)eu=ni[--oi],ni[oi]=null,Ms=ni[--oi],ni[oi]=null,As=ni[--oi],ni[oi]=null}function LP(e,t){ni[oi++]=As,ni[oi++]=Ms,ni[oi++]=eu,As=t.id,Ms=t.overflow,eu=e}var Wo=null,pn=null,et=!1,Kc=null,ii=!1,IC=Error(U(519));function tu(e){var t=Error(U(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Th(ai(t,e)),IC}function ID(e){var{stateNode:t,type:n,memoizedProps:o}=e;switch(t[hr]=e,t[da]=o,n){case"dialog":at("cancel",t),at("close",t);break;case"iframe":case"object":case"embed":at("load",t);break;case"video":case"audio":for(n=0;n<Dh.length;n++)at(Dh[n],t);break;case"source":at("error",t);break;case"img":case"image":case"link":at("error",t),at("load",t);break;case"details":at("toggle",t);break;case"input":at("invalid",t),fP(t,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":at("invalid",t);break;case"textarea":at("invalid",t),gP(t,o.value,o.defaultValue,o.children)}n=o.children,typeof n!=="string"&&typeof n!=="number"&&typeof n!=="bigint"||t.textContent===""+n||o.suppressHydrationWarning===!0||yO(t.textContent,n)?(o.popover!=null&&(at("beforetoggle",t),at("toggle",t)),o.onScroll!=null&&at("scroll",t),o.onScrollEnd!=null&&at("scrollend",t),o.onClick!=null&&(t.onclick=Es),t=!0):t=!1,t||tu(e,!0)}function Yy(e){for(Wo=e.return;Wo;)switch(Wo.tag){case 5:case 31:case 13:ii=!1;return;case 27:case 3:ii=!0;return;default:Wo=Wo.return}}function bf(e){if(e!==Wo)return!1;if(!et)return Yy(e),et=!0,!1;var t=e.tag,n;if(n=t!==3&&t!==27){if(n=t===5)n=e.type,n=!(n!=="form"&&n!=="button")||k2(e.type,e.memoizedProps);n=!n}if(n&&pn&&tu(e),Yy(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));pn=M4(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));pn=M4(e)}else t===27?(t=pn,iu(e.type)?(e=R2,R2=null,pn=e):pn=t):pn=Wo?si(e.stateNode.nextSibling):null;return!0}function Td(){pn=Wo=null,et=!1}function eC(){var e=Kc;return e!==null&&(ia===null?ia=e:ia.push.apply(ia,e),Kc=null),e}function Th(e){Kc===null?Kc=[e]:Kc.push(e)}var LC=_s(null),Hd=null,vl=null;function jc(e,t,n){fn(LC,t._currentValue),t._currentValue=n}function xl(e){e._currentValue=LC.current,vr(LC)}function Ry(e,t,n){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===n)break;e=e.return}}function BC(e,t,n,o){var r=e.child;r!==null&&(r.return=e);for(;r!==null;){var a=r.dependencies;if(a!==null){var i=r.child;a=a.firstContext;e:for(;a!==null;){var s=a;a=r;for(var l=0;l<t.length;l++)if(s.context===t[l]){a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),Ry(a.return,n,e),o||(i=null);break e}a=s.next}}else if(r.tag===18){if(i=r.return,i===null)throw Error(U(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Ry(i,n,e),i=null}else r.tag===13&&r.memoizedState!==null&&r.memoizedState.dehydrated===null?(r.lanes|=n,i=r.alternate,i!==null&&(i.lanes|=n),Ry(r.return,n,e),i=r.child,i=i!==null?i.sibling:null):i=r.child;if(i!==null)i.return=r;else for(i=r;i!==null;){if(i===e){i=null;break}if(r=i.sibling,r!==null){r.return=i.return,i=r;break}i=i.return}r=i}}function Ed(e,t,n,o){e=null;for(var r=t,a=!1;r!==null;){if(!a){if((r.flags&524288)!==0)a=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var i=r.alternate;if(i===null)throw Error(U(387));if(i=i.memoizedProps,i!==null){var s=r.type;_a(r.pendingProps.value,i.value)||(e!==null?e.push(s):e=[s])}}else if(r===jy.current){if(i=r.alternate,i===null)throw Error(U(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(tm):e=[tm])}r=r.return}return e!==null&&BC(t,e,n,o),t.flags|=262144,e!==null}function Wy(e){for(e=e.firstContext;e!==null;){if(!_a(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ad(e){Hd=e,vl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function br(e){return BP(Hd,e)}function cy(e,t){return Hd===null&&Ad(e),BP(e,t)}function BP(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},vl===null){if(e===null)throw Error(U(308));vl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vl=vl.next=t;return n}var wZ=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,o){e.push(o)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},{unstable_scheduleCallback:kZ,unstable_NormalPriority:SZ}=No,so={$$typeof:Ts,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function K2(){return{controller:new wZ,data:new Map,refCount:0}}function Vh(e){e.refCount--,e.refCount===0&&kZ(SZ,function(){e.controller.abort()})}function LD(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;n===null&&(n=e.transitionTypes=[]);for(e=0;e<t.length;e++){var o=t[e];n.indexOf(o)===-1&&n.push(o)}}}var ah=null;function CZ(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ph=null,HC=0,Md=0,Bf=null;function NZ(e,t){if(ph===null){var n=ph=[];HC=0,Md=yN(),Bf={status:"pending",value:void 0,then:function(o){n.push(o)}}}return HC++,t.then(BD,BD),t}function BD(){if(--HC===0&&(ah=null,ph!==null)){Bf!==null&&(Bf.status="fulfilled");var e=ph;ph=null,Md=0,Bf=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function RZ(e,t){var n=[],o={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){o.status="fulfilled",o.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){o.status="rejected",o.reason=r;for(r=0;r<n.length;r++)(0,n[r])(void 0)}),o}var HD=Be.S;Be.S=function(e,t){if(nO=Ma(),typeof t==="object"&&t!==null&&typeof t.then==="function"&&NZ(e,t),ah!==null)for(var n=Zf;n!==null;)LD(n,ah),n=n.next;if(n=e.types,n!==null){for(var o=Zf;o!==null;)LD(o,n),o=o.next;if(Md!==0){o=ah,o===null&&(o=ah=[]);for(var r=0;r<n.length;r++){var a=n[r];o.indexOf(a)===-1&&o.push(a)}}}HD!==null&&HD(e,t)};var Cd=_s(null);function q2(){var e=Cd.current;return e!==null?e:rn.pooledCache}function Ty(e,t){t===null?fn(Cd,Cd.current):fn(Cd,t.pool)}function HP(){var e=q2();return e===null?null:{parent:so._currentValue,pool:e}}var im=Error(U(460)),$2=Error(U(474)),Sx=Error(U(542)),Xy={then:function(){}};function jD(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jP(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Es,Es),t=n),t.status){case"fulfilled":return t.value;case"rejected":if(e=t.reason,GD(e),e===void 0&&!("reason"in t))throw Error(U(600));throw e;default:if(typeof t.status==="string")t.then(Es,Es);else{if(e=rn,e!==null&&100<e.shellSuspendCounter)throw Error(U(482));e=t,e.status="pending",e.then(function(o){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=o}},function(o){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=o}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,GD(e),e}throw Nd=t,im}}function vd(e){try{var t=e._init;return t(e._payload)}catch(n){if(n!==null&&typeof n==="object"&&typeof n.then==="function")throw Nd=n,im;throw n}}var Nd=null;function UD(){if(Nd===null)throw Error(U(459));var e=Nd;return Nd=null,e}function GD(e){if(e===im||e===Sx)throw Error(U(483))}var Hf=null,Eh=0;function uy(e){var t=Eh;return Eh+=1,Hf===null&&(Hf=[]),jP(Hf,e,t)}function Pc(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function dy(e,t){if(t.$$typeof===iQ)throw Error(U(525));throw e=Object.prototype.toString.call(t),Error(U(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function UP(e){function t(b,x){if(e){var v=b.deletions;v===null?(b.deletions=[x],b.flags|=16):v.push(x)}}function n(b,x){if(!e)return null;for(;x!==null;)t(b,x),x=x.sibling;return null}function o(b){for(var x=new Map;b!==null;)b.key===null?x.set(b.index,b):x.set(b.key,b),b=b.sibling;return x}function r(b,x){return b=yl(b,x),b.index=0,b.sibling=null,b}function a(b,x,v){if(b.index=v,!e)return b.flags|=1048576,x;if(v=b.alternate,v!==null)return v=v.index,v<x?(b.flags|=2,x):v;return b.flags|=134217730,x}function i(b){return e&&b.alternate===null&&(b.flags|=134217730),b}function s(b,x,v,k){if(x===null||x.tag!==6)return x=ZS(v,b.mode,k),x.return=b,x;return x=r(x,v),x.return=b,x}function l(b,x,v,k){var S=v.type;if(S===Cf)return b=d(b,x,v.props.children,k,v.key),Pc(b,v),b;if(x!==null&&(x.elementType===S||typeof S==="object"&&S!==null&&S.$$typeof===zc&&vd(S)===x.type))return x=r(x,v.props),Pc(x,v),x.return=b,x;return x=Ny(v.type,v.key,v.props,null,b.mode,k),Pc(x,v),x.return=b,x}function c(b,x,v,k){if(x===null||x.tag!==4||x.stateNode.containerInfo!==v.containerInfo||x.stateNode.implementation!==v.implementation)return x=JS(v,b.mode,k),x.return=b,x;return x=r(x,v.children||[]),x.return=b,x}function d(b,x,v,k,S){if(x===null||x.tag!==7)return x=Sd(v,b.mode,k,S),x.return=b,x;return x=r(x,v),x.return=b,x}function u(b,x,v){if(typeof x==="string"&&x!==""||typeof x==="number"||typeof x==="bigint")return x=ZS(""+x,b.mode,v),x.return=b,x;if(typeof x==="object"&&x!==null){switch(x.$$typeof){case oy:return v=Ny(x.type,x.key,x.props,null,b.mode,v),Pc(v,x),v.return=b,v;case eh:return x=JS(x,b.mode,v),x.return=b,x;case zc:return x=vd(x),u(b,x,v)}if(th(x)||Wg(x))return x=Sd(x,b.mode,v,null),x.return=b,x;if(typeof x.then==="function")return u(b,uy(x),v);if(x.$$typeof===Ts)return u(b,cy(b,x),v);dy(b,x)}return null}function p(b,x,v,k){var S=x!==null?x.key:null;if(typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint")return S!==null?null:s(b,x,""+v,k);if(typeof v==="object"&&v!==null){switch(v.$$typeof){case oy:return v.key===S?l(b,x,v,k):null;case eh:return v.key===S?c(b,x,v,k):null;case zc:return v=vd(v),p(b,x,v,k)}if(th(v)||Wg(v))return S!==null?null:d(b,x,v,k,null);if(typeof v.then==="function")return p(b,x,uy(v),k);if(v.$$typeof===Ts)return p(b,x,cy(b,v),k);dy(b,v)}return null}function f(b,x,v,k,S){if(typeof k==="string"&&k!==""||typeof k==="number"||typeof k==="bigint")return b=b.get(v)||null,s(x,b,""+k,S);if(typeof k==="object"&&k!==null){switch(k.$$typeof){case oy:return b=b.get(k.key===null?v:k.key)||null,l(x,b,k,S);case eh:return b=b.get(k.key===null?v:k.key)||null,c(x,b,k,S);case zc:return k=vd(k),f(b,x,v,k,S)}if(th(k)||Wg(k))return b=b.get(v)||null,d(x,b,k,S,null);if(typeof k.then==="function")return f(b,x,v,uy(k),S);if(k.$$typeof===Ts)return f(b,x,v,cy(x,k),S);dy(x,k)}return null}function g(b,x,v,k){for(var S=null,N=null,R=x,A=x=0,D=null;R!==null&&A<v.length;A++){R.index>A?(D=R,R=null):D=R.sibling;var E=p(b,R,v[A],k);if(E===null){R===null&&(R=D);break}e&&R&&E.alternate===null&&t(b,R),x=a(E,x,A),N===null?S=E:N.sibling=E,N=E,R=D}if(A===v.length)return n(b,R),et&&bl(b,A),S;if(R===null){for(;A<v.length;A++)R=u(b,v[A],k),R!==null&&(x=a(R,x,A),N===null?S=R:N.sibling=R,N=R);return et&&bl(b,A),S}for(R=o(R);A<v.length;A++)D=f(R,b,A,v[A],k),D!==null&&(e&&(E=D.alternate,E!==null&&R.delete(E.key===null?A:E.key)),x=a(D,x,A),N===null?S=D:N.sibling=D,N=D);return e&&R.forEach(function(z){return t(b,z)}),et&&bl(b,A),S}function m(b,x,v,k){if(v==null)throw Error(U(151));for(var S=null,N=null,R=x,A=x=0,D=null,E=v.next();R!==null&&!E.done;A++,E=v.next()){R.index>A?(D=R,R=null):D=R.sibling;var z=p(b,R,E.value,k);if(z===null){R===null&&(R=D);break}e&&R&&z.alternate===null&&t(b,R),x=a(z,x,A),N===null?S=z:N.sibling=z,N=z,R=D}if(E.done)return n(b,R),et&&bl(b,A),S;if(R===null){for(;!E.done;A++,E=v.next())E=u(b,E.value,k),E!==null&&(x=a(E,x,A),N===null?S=E:N.sibling=E,N=E);return et&&bl(b,A),S}for(R=o(R);!E.done;A++,E=v.next())E=f(R,b,A,E.value,k),E!==null&&(e&&(D=E.alternate,D!==null&&R.delete(D.key===null?A:D.key)),x=a(E,x,A),N===null?S=E:N.sibling=E,N=E);return e&&R.forEach(function(B){return t(b,B)}),et&&bl(b,A),S}function y(b,x,v,k){if(typeof v==="object"&&v!==null&&v.type===Cf&&v.key===null&&v.props.ref===void 0&&(v=v.props.children),typeof v==="object"&&v!==null){switch(v.$$typeof){case oy:e:{for(var S=v.key;x!==null;){if(x.key===S){if(S=v.type,S===Cf){if(x.tag===7){n(b,x.sibling),k=r(x,v.props.children),Pc(k,v),k.return=b,b=k;break e}}else if(x.elementType===S||typeof S==="object"&&S!==null&&S.$$typeof===zc&&vd(S)===x.type){n(b,x.sibling),k=r(x,v.props),Pc(k,v),k.return=b,b=k;break e}n(b,x);break}else t(b,x);x=x.sibling}v.type===Cf?(k=Sd(v.props.children,b.mode,k,v.key),Pc(k,v),k.return=b,b=k):(k=Ny(v.type,v.key,v.props,null,b.mode,k),Pc(k,v),k.return=b,b=k)}return i(b);case eh:e:{for(S=v.key;x!==null;){if(x.key===S)if(x.tag===4&&x.stateNode.containerInfo===v.containerInfo&&x.stateNode.implementation===v.implementation){n(b,x.sibling),k=r(x,v.children||[]),k.return=b,b=k;break e}else{n(b,x);break}else t(b,x);x=x.sibling}k=JS(v,b.mode,k),k.return=b,b=k}return i(b);case zc:return v=vd(v),y(b,x,v,k)}if(th(v))return g(b,x,v,k);if(Wg(v)){if(S=Wg(v),typeof S!=="function")throw Error(U(150));return v=S.call(v),m(b,x,v,k)}if(typeof v.then==="function")return y(b,x,uy(v),k);if(v.$$typeof===Ts)return y(b,x,cy(b,v),k);dy(b,v)}return typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint"?(v=""+v,x!==null&&x.tag===6?(n(b,x.sibling),k=r(x,v),k.return=b,b=k):(n(b,x),k=ZS(v,b.mode,k),k.return=b,b=k),i(b)):n(b,x)}return function(b,x,v,k){try{Eh=0;var S=y(b,x,v,k);return Hf=null,S}catch(R){if(R===im||R===Sx)throw R;var N=la(29,R,null,b.mode);return N.lanes=k,N.return=b,N}finally{}}}var Dd=UP(!0),GP=UP(!1),Ic=!1;function Y2(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jC(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function qc(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $c(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(At&2)!==0){var r=o.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),o.pending=t,t=qy(e),OP(e,null,n),t}return wx(e,o,t,n),qy(e)}function fh(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,aP(e,n)}}function tC(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var r=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?r=a=i:a=a.next=i,n=n.next}while(n!==null);a===null?r=a=t:a=a.next=t}else r=a=t;n={baseState:o.baseState,firstBaseUpdate:r,lastBaseUpdate:a,shared:o.shared,callbacks:o.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var UC=!1;function mh(){if(UC){var e=Bf;if(e!==null)throw e}}function gh(e,t,n,o){UC=!1;var r=e.updateQueue;Ic=!1;var{firstBaseUpdate:a,lastBaseUpdate:i}=r,s=r.shared.pending;if(s!==null){r.shared.pending=null;var l=s,c=l.next;l.next=null,i===null?a=c:i.next=c,i=l;var d=e.alternate;d!==null&&(d=d.updateQueue,s=d.lastBaseUpdate,s!==i&&(s===null?d.firstBaseUpdate=c:s.next=c,d.lastBaseUpdate=l))}if(a!==null){var u=r.baseState;i=0,d=c=l=null,s=a;do{var p=s.lane&-536870913,f=p!==s.lane;if(f?(ct&p)===p:(o&p)===p){p!==0&&p===Md&&(UC=!0),d!==null&&(d=d.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var g=e,m=s;p=t;var y=n;switch(m.tag){case 1:if(g=m.payload,typeof g==="function"){u=g.call(y,u,p);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,p=typeof g==="function"?g.call(y,u,p):g,p===null||p===void 0)break e;u=an({},u,p);break e;case 2:Ic=!0}}p=s.callback,p!==null&&(e.flags|=64,f&&(e.flags|=8192),f=r.callbacks,f===null?r.callbacks=[p]:f.push(p))}else f={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},d===null?(c=d=f,l=u):d=d.next=f,i|=p;if(s=s.next,s===null)if(s=r.shared.pending,s===null)break;else f=s,s=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}while(1);d===null&&(l=u),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,a===null&&(r.shared.lanes=0),ru|=i,e.lanes=i,e.memoizedState=u}}function FP(e,t){if(typeof e!=="function")throw Error(U(191,e));e.call(t)}function VP(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)FP(n[e],t)}var nu=_s(null),Qy=_s(0);function FD(e,t){e=Rl,fn(Qy,e),fn(nu,t),Rl=e|t.baseLanes}function GC(){fn(Qy,Rl),fn(nu,nu.current)}function W2(){Rl=Qy.current,vr(nu),vr(Qy)}var wr=_s(null),_r=null;function Yc(e){var t=e.alternate;fn(yr,yr.current&1),fn(wr,e),_r===null&&(t===null||nu.current!==null?_r=e:t.memoizedState!==null&&(_r=e))}function FC(e){fn(yr,yr.current),fn(wr,e),_r===null&&(_r=e)}function KP(e){e.tag===22?(fn(yr,yr.current),fn(wr,e),_r===null&&(_r=e)):Wc()}function Wc(){fn(yr,yr.current),fn(wr,wr.current)}function Ta(e){vr(wr),_r===e&&(_r=null),vr(yr)}var yr=_s(0);function Ah(e,t){fn(wr,wr.current),fn(yr,t)}function X2(e){vr(yr),vr(wr),_r===e&&(_r=null)}function Zy(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||N2(n)||SN(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Sl=0,Qe=null,Zt=null,io=null,Jy=!1,jf=!1,Pd=!1,ex=0,Mh=0,Uf=null,TZ=0;function Kn(){throw Error(U(321))}function Q2(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_a(e[n],t[n]))return!1;return!0}function Z2(e,t,n,o,r,a){return Sl=a,Qe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Be.H=e===null||e.memoizedState===null?k3:S3,Pd=!1,a=n(o,r),Pd=!1,jf&&(a=$P(t,n,o,r)),qP(e),a}function qP(e){Be.H=tx;var t=Zt!==null&&Zt.next!==null;if(Sl=0,io=Zt=Qe=null,Jy=!1,Mh=0,Uf=null,t)throw Error(U(300));e===null||lo||(e=e.dependencies,e!==null&&Wy(e)&&(lo=!0))}function $P(e,t,n,o){Qe=e;var r=0;do{if(jf&&(Uf=null),Mh=0,jf=!1,25<=r)throw Error(U(301));if(r+=1,io=Zt=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}Be.H=zZ,a=t(n,o)}while(jf);return a}function EZ(){var e=Be.H,t=e.useState()[0];return t=typeof t.then==="function"?Kh(t):t,e=e.useState()[0],(Zt!==null?Zt.memoizedState:null)!==e&&(Qe.flags|=1024),t}function J2(){var e=ex!==0;return ex=0,e}function eN(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function tN(e){if(Jy){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Jy=!1}Sl=0,io=Zt=Qe=null,jf=!1,Mh=ex=0,Uf=null}function Yr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return io===null?Qe.memoizedState=io=e:io=io.next=e,io}function to(){if(Zt===null){var e=Qe.alternate;e=e!==null?e.memoizedState:null}else e=Zt.next;var t=io===null?Qe.memoizedState:io.next;if(t!==null)io=t,Zt=e;else{if(e===null){if(Qe.alternate===null)throw Error(U(467));throw Error(U(310))}Zt=e,e={memoizedState:Zt.memoizedState,baseState:Zt.baseState,baseQueue:Zt.baseQueue,queue:Zt.queue,next:null},io===null?Qe.memoizedState=io=e:io=io.next=e}return io}function Cx(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kh(e){var t=Mh;return Mh+=1,Uf===null&&(Uf=[]),e=jP(Uf,e,t),t=Qe,(io===null?t.memoizedState:io.next)===null&&(t=t.alternate,Be.H=t===null||t.memoizedState===null?k3:S3),e}function Nx(e){if(e!==null&&typeof e==="object"){if(typeof e.then==="function")return Kh(e);if(e.$$typeof===cQ)return;if(e.$$typeof===Ts)return br(e)}throw Error(U(438,String(e)))}function nN(e){var t=null,n=Qe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var o=Qe.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(t={data:o.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Cx(),Qe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),o=0;o<e;o++)n[o]=lQ;return t.index++,n}function Cl(e,t){return typeof t==="function"?t(e):t}function Ey(e){var t=to();return oN(t,Zt,e)}function oN(e,t,n){var o=e.queue;if(o===null)throw Error(U(311));o.lastRenderedReducer=n;var r=e.baseQueue,a=o.pending;if(a!==null){if(r!==null){var i=r.next;r.next=a.next,a.next=i}t.baseQueue=r=a,o.pending=null}if(a=e.baseState,r===null)e.memoizedState=a;else{t=r.next;var s=i=null,l=null,c=t,d=!1;do{var u=c.lane&-536870913;if(u!==c.lane?(ct&u)===u:(Sl&u)===u){var p=c.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),u===Md&&(d=!0);else if((Sl&p)===p){c=c.next,p===Md&&(d=!0);continue}else u={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(s=l=u,i=a):l=l.next=u,Qe.lanes|=p,ru|=p;u=c.action,Pd&&n(a,u),a=c.hasEagerState?c.eagerState:n(a,u)}else p={lane:u,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(s=l=p,i=a):l=l.next=p,Qe.lanes|=u,ru|=u;c=c.next}while(c!==null&&c!==t);if(l===null?i=a:l.next=s,!_a(a,e.memoizedState)&&(lo=!0,d&&(n=Bf,n!==null)))throw n;e.memoizedState=a,e.baseState=i,e.baseQueue=l,o.lastRenderedState=a}return r===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function nC(e){var t=to(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var{dispatch:o,pending:r}=n,a=t.memoizedState;if(r!==null){n.pending=null;var i=r=r.next;do a=e(a,i.action),i=i.next;while(i!==r);_a(a,t.memoizedState)||(lo=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,o]}function YP(e,t,n){var o=Qe,r=to(),a=et;if(a){if(n===void 0)throw Error(U(407));n=n()}else n=t();var i=!_a((Zt||r).memoizedState,n);if(i&&(r.memoizedState=n,lo=!0),r=r.queue,rN(QP.bind(null,o,r,e),[e]),e=r.getSnapshot!==t||i||io!==null&&(io.memoizedState.tag&1)!==0,Yf(e?9:8,{destroy:void 0},XP.bind(null,o,r,n,t),null),e){if(o.flags|=2048,rn===null)throw Error(U(349));a||(Sl&127)!==0||WP(o,t,n)}return n}function WP(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Qe.updateQueue,t===null?(t=Cx(),Qe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function XP(e,t,n,o){t.value=n,t.getSnapshot=o,ZP(t)&&JP(e)}function QP(e,t,n){return n(function(){ZP(t)&&JP(e)})}function ZP(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_a(e,n)}catch(o){return!0}}function JP(e){var t=Bd(e,2);t!==null&&ca(t,e,2)}function VC(e){var t=Yr();if(typeof e==="function"){var n=e;if(e=n(),Pd){Bc(!0);try{n()}finally{Bc(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:e},t}function e3(e,t,n,o){return e.baseState=n,oN(e,Zt,typeof o==="function"?o:Cl)}function AZ(e,t,n,o,r){if(Tx(e))throw Error(U(485));if(e=t.action,e!==null){var a={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){a.listeners.push(i)}};Be.T!==null?n(!0):a.isTransition=!1,o(a),n=t.pending,n===null?(a.next=t.pending=a,t3(t,a)):(a.next=n.next,t.pending=n.next=a)}}function t3(e,t){var{action:n,payload:o}=t,r=e.state;if(t.isTransition){var a=Be.T,i={};i.types=a!==null?a.types:null,Be.T=i;try{var s=n(r,o),l=Be.S;l!==null&&l(i,s),VD(e,t,s)}catch(c){KC(e,t,c)}finally{a!==null&&i.types!==null&&(a.types=i.types),Be.T=a}}else try{a=n(r,o),VD(e,t,a)}catch(c){KC(e,t,c)}}function VD(e,t,n){n!==null&&typeof n==="object"&&typeof n.then==="function"?n.then(function(o){KD(e,t,o)},function(o){return KC(e,t,o)}):KD(e,t,n)}function KD(e,t,n){t.status="fulfilled",t.value=n,n3(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,t3(e,n)))}function KC(e,t,n){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do t.status="rejected",t.reason=n,n3(t),t=t.next;while(t!==o)}e.action=null}function n3(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function o3(e,t){return t}function qD(e,t){if(et){var n=rn.formState;if(n!==null){e:{var o=Qe;if(et){if(pn){t:{var r=pn;for(var a=ii;r.nodeType!==8;){if(!a){r=null;break t}if(r=si(r.nextSibling),r===null){r=null;break t}}a=r.data,r=a==="F!"||a==="F"?r:null}if(r){pn=si(r.nextSibling),o=r.data==="F!";break e}}tu(o)}o=!1}o&&(t=n[0])}}return n=Yr(),n.memoizedState=n.baseState=t,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o3,lastRenderedState:t},n.queue=o,n=y3.bind(null,Qe,o),o.dispatch=n,o=VC(!1),a=lN.bind(null,Qe,!1,o.queue),o=Yr(),r={state:t,dispatch:null,action:e,pending:null},o.queue=r,n=AZ.bind(null,Qe,r,a,n),r.dispatch=n,o.memoizedState=e,[t,n,!1]}function $D(e){var t=to();return r3(t,Zt,e)}function r3(e,t,n){if(t=oN(e,t,o3)[0],e=Ey(Cl)[0],typeof t==="object"&&t!==null&&typeof t.then==="function")try{var o=Kh(t)}catch(i){if(i===im)throw Sx;throw i}else o=t;t=to();var r=t.queue,a=r.dispatch;return n!==t.memoizedState&&(Qe.flags|=2048,Yf(9,{destroy:void 0},MZ.bind(null,r,n),null)),[o,a,e]}function MZ(e,t){e.action=t}function YD(e){var t=to(),n=Zt;if(n!==null)return r3(t,n,e);to(),t=t.memoizedState,n=to();var o=n.queue.dispatch;return n.memoizedState=e,[t,o,!1]}function Yf(e,t,n,o){return e={tag:e,create:n,deps:o,inst:t,next:null},t=Qe.updateQueue,t===null&&(t=Cx(),Qe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(o=n.next,n.next=e,e.next=o,t.lastEffect=e),e}function a3(){return to().memoizedState}function Ay(e,t,n,o){var r=Yr();Qe.flags|=e,r.memoizedState=Yf(1|t,{destroy:void 0},n,o===void 0?null:o)}function Rx(e,t,n,o){var r=to();o=o===void 0?null:o;var a=r.memoizedState.inst;Zt!==null&&o!==null&&Q2(o,Zt.memoizedState.deps)?r.memoizedState=Yf(t,a,n,o):(Qe.flags|=e,r.memoizedState=Yf(1|t,a,n,o))}function WD(e,t){Ay(8390656,8,e,t)}function rN(e,t){Rx(2048,8,e,t)}function DZ(e){Qe.flags|=4;var t=Qe.updateQueue;if(t===null)t=Cx(),Qe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function i3(e){var t=to().memoizedState;return DZ({ref:t,nextImpl:e}),function(){if((At&2)!==0)throw Error(U(440));return t.impl.apply(void 0,arguments)}}function s3(e,t){return Rx(4,2,e,t)}function l3(e,t){return Rx(4,4,e,t)}function c3(e,t){if(typeof t==="function"){e=e();var n=t(e);return function(){typeof n==="function"?n():t(null)}}if(t!==null&&t!==void 0)return e=e(),t.current=e,function(){t.current=null}}function u3(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,Rx(4,4,c3.bind(null,t,e),n)}function aN(){}function d3(e,t){var n=to();t=t===void 0?null:t;var o=n.memoizedState;if(t!==null&&Q2(t,o[1]))return o[0];return n.memoizedState=[e,t],e}function p3(e,t){var n=to();t=t===void 0?null:t;var o=n.memoizedState;if(t!==null&&Q2(t,o[1]))return o[0];if(o=e(),Pd){Bc(!0);try{e()}finally{Bc(!1)}}return n.memoizedState=[o,t],o}function iN(e,t,n){if(n===void 0||(Sl&1073741824)!==0&&(ct&261930)===0)return e.memoizedState=t;return e.memoizedState=n,e=rO(),Qe.lanes|=e,ru|=e,n}function f3(e,t,n,o){if(_a(n,t))return n;if(nu.current!==null)return e=iN(e,n,o),_a(e,t)||(lo=!0),e;if((Sl&106)===0||(Sl&1073741824)!==0&&(ct&261930)===0)return lo=!0,e.memoizedState=n;return e=rO(),Qe.lanes|=e,ru|=e,t}function m3(e,t,n,o,r){var a=Mt.p;Mt.p=a!==0&&8>a?a:8;var i=Be.T,s={};s.types=i!==null?i.types:null,Be.T=s,lN(e,!1,t,n);try{var l=r(),c=Be.S;if(c!==null&&c(s,l),l!==null&&typeof l==="object"&&typeof l.then==="function"){var d=RZ(l,o);hh(e,t,d,Oa(e))}else hh(e,t,o,Oa(e))}catch(u){hh(e,t,{then:function(){},status:"rejected",reason:u},Oa())}finally{Mt.p=a,i!==null&&s.types!==null&&(i.types=s.types),Be.T=i}}function PZ(){}function qC(e,t,n,o){if(e.tag!==5)throw Error(U(476));var r=g3(e).queue;m3(e,r,t,kd,n===null?PZ:function(){return h3(e),n(o)})}function g3(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:kd,baseState:kd,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:kd},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function h3(e){var t=g3(e);t.next===null&&(t=e.alternate.memoizedState),hh(e,t.next.queue,{},Oa())}function sN(){return br(tm)}function b3(){return to().memoizedState}function v3(){return to().memoizedState}function OZ(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Oa();e=qc(n);var o=$c(t,e,n);o!==null&&(ca(o,t,n),fh(o,t,n)),t={cache:K2()},e.payload=t;return}t=t.return}}function _Z(e,t,n){var o=Oa();n={lane:o,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Tx(e)?x3(t,n):(n=G2(e,t,n,o),n!==null&&(ca(n,e,o),w3(n,t,o)))}function y3(e,t,n){var o=Oa();hh(e,t,n,o)}function hh(e,t,n,o){var r={lane:o,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Tx(e))x3(t,r);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,s=a(i,n);if(r.hasEagerState=!0,r.eagerState=s,_a(s,i))return wx(e,t,r,0),rn===null&&xx(),!1}catch(l){}finally{}if(n=G2(e,t,r,o),n!==null)return ca(n,e,o),w3(n,t,o),!0}return!1}function lN(e,t,n,o){if(o={lane:2,revertLane:yN(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Tx(e)){if(t)throw Error(U(479))}else t=G2(e,n,o,2),t!==null&&ca(t,e,2)}function Tx(e){var t=e.alternate;return e===Qe||t!==null&&t===Qe}function x3(e,t){jf=Jy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function w3(e,t,n){if((n&4194048)!==0){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,aP(e,n)}}var tx={readContext:br,use:Nx,useCallback:Kn,useContext:Kn,useEffect:Kn,useImperativeHandle:Kn,useLayoutEffect:Kn,useInsertionEffect:Kn,useMemo:Kn,useReducer:Kn,useRef:Kn,useState:Kn,useDebugValue:Kn,useDeferredValue:Kn,useTransition:Kn,useSyncExternalStore:Kn,useId:Kn,useHostTransitionStatus:Kn,useFormState:Kn,useActionState:Kn,useOptimistic:Kn,useMemoCache:Kn,useCacheRefresh:Kn,useEffectEvent:Kn},k3={readContext:br,use:Nx,useCallback:function(e,t){return Yr().memoizedState=[e,t===void 0?null:t],e},useContext:br,useEffect:WD,useImperativeHandle:function(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,Ay(4194308,4,c3.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ay(4194308,4,e,t)},useInsertionEffect:function(e,t){Ay(4,2,e,t)},useMemo:function(e,t){var n=Yr();t=t===void 0?null:t;var o=e();if(Pd){Bc(!0);try{e()}finally{Bc(!1)}}return n.memoizedState=[o,t],o},useReducer:function(e,t,n){var o=Yr();if(n!==void 0){var r=n(t);if(Pd){Bc(!0);try{n(t)}finally{Bc(!1)}}}else r=t;return o.memoizedState=o.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},o.queue=e,e=e.dispatch=_Z.bind(null,Qe,e),[o.memoizedState,e]},useRef:function(e){var t=Yr();return e={current:e},t.memoizedState=e},useState:function(e){e=VC(e);var t=e.queue,n=y3.bind(null,Qe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:aN,useDeferredValue:function(e,t){var n=Yr();return iN(n,e,t)},useTransition:function(){var e=VC(!1);return e=m3.bind(null,Qe,e.queue,!0,!1),Yr().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var o=Qe,r=Yr();if(et){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),rn===null)throw Error(U(349));(ct&127)!==0||WP(o,t,n)}r.memoizedState=n;var a={value:n,getSnapshot:t};return r.queue=a,WD(QP.bind(null,o,a,e),[e]),o.flags|=2048,Yf(9,{destroy:void 0},XP.bind(null,o,a,n,t),null),n},useId:function(){var e=Yr(),t=rn.identifierPrefix;if(et){var n=Ms,o=As;n=(o&~(1<<32-Pa(o)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ex++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=TZ++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sN,useFormState:qD,useActionState:qD,useOptimistic:function(e){var t=Yr();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=lN.bind(null,Qe,!0,n),n.dispatch=t,[e,t]},useMemoCache:nN,useCacheRefresh:function(){return Yr().memoizedState=OZ.bind(null,Qe)},useEffectEvent:function(e){var t=Yr(),n={impl:e};return t.memoizedState=n,function(){if((At&2)!==0)throw Error(U(440));return n.impl.apply(void 0,arguments)}}},S3={readContext:br,use:Nx,useCallback:d3,useContext:br,useEffect:rN,useImperativeHandle:u3,useInsertionEffect:s3,useLayoutEffect:l3,useMemo:p3,useReducer:Ey,useRef:a3,useState:function(){return Ey(Cl)},useDebugValue:aN,useDeferredValue:function(e,t){var n=to();return f3(n,Zt.memoizedState,e,t)},useTransition:function(){var e=Ey(Cl)[0],t=to().memoizedState;return[typeof e==="boolean"?e:Kh(e),t]},useSyncExternalStore:YP,useId:b3,useHostTransitionStatus:sN,useFormState:$D,useActionState:$D,useOptimistic:function(e,t){var n=to();return e3(n,Zt,e,t)},useMemoCache:nN,useCacheRefresh:v3,useEffectEvent:i3},zZ={readContext:br,use:Nx,useCallback:d3,useContext:br,useEffect:rN,useImperativeHandle:u3,useInsertionEffect:s3,useLayoutEffect:l3,useMemo:p3,useReducer:nC,useRef:a3,useState:function(){return nC(Cl)},useDebugValue:aN,useDeferredValue:function(e,t){var n=to();return Zt===null?iN(n,e,t):f3(n,Zt.memoizedState,e,t)},useTransition:function(){var e=nC(Cl)[0],t=to().memoizedState;return[typeof e==="boolean"?e:Kh(e),t]},useSyncExternalStore:YP,useId:b3,useHostTransitionStatus:sN,useFormState:YD,useActionState:YD,useOptimistic:function(e,t){var n=to();if(Zt!==null)return e3(n,Zt,e,t);return n.baseState=e,[e,n.queue.dispatch]},useMemoCache:nN,useCacheRefresh:v3,useEffectEvent:i3};function oC(e,t,n,o){t=e.memoizedState,n=n(o,t),n=n===null||n===void 0?t:an({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $C={enqueueSetState:function(e,t,n){e=e._reactInternals;var o=Oa(),r=qc(o);r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=$c(e,r,o),t!==null&&(ca(t,e,o),fh(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var o=Oa(),r=qc(o);r.tag=1,r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=$c(e,r,o),t!==null&&(ca(t,e,o),fh(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Oa(),o=qc(n);o.tag=2,t!==void 0&&t!==null&&(o.callback=t),t=$c(e,o,n),t!==null&&(ca(t,e,n),fh(t,e,n))}};function XD(e,t,n,o,r,a,i){return e=e.stateNode,typeof e.shouldComponentUpdate==="function"?e.shouldComponentUpdate(o,a,i):t.prototype&&t.prototype.isPureReactComponent?!Nh(n,o)||!Nh(r,a):!0}function QD(e,t,n,o){e=t.state,typeof t.componentWillReceiveProps==="function"&&t.componentWillReceiveProps(n,o),typeof t.UNSAFE_componentWillReceiveProps==="function"&&t.UNSAFE_componentWillReceiveProps(n,o),t.state!==e&&$C.enqueueReplaceState(t,t.state,null)}function Od(e,t){var n=t;if("ref"in t){n={};for(var o in t)o!=="ref"&&(n[o]=t[o])}if(e=e.defaultProps){n===t&&(n=an({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function C3(e){Ky(e)}function N3(e){console.error(e)}function R3(e){Ky(e)}function nx(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(o){setTimeout(function(){throw o})}}function ZD(e,t,n){try{var o=e.onCaughtError;o(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function YC(e,t,n){return n=qc(n),n.tag=3,n.payload={element:null},n.callback=function(){nx(e,t)},n}function T3(e){return e=qc(e),e.tag=3,e}function E3(e,t,n,o){var r=n.type.getDerivedStateFromError;if(typeof r==="function"){var a=o.value;e.payload=function(){return r(a)},e.callback=function(){ZD(t,n,o)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch==="function"&&(e.callback=function(){ZD(t,n,o),typeof r!=="function"&&(Xc===null?Xc=new Set([this]):Xc.add(this));var s=o.stack;this.componentDidCatch(o.value,{componentStack:s!==null?s:""})})}function IZ(e,t,n,o,r){if(n.flags|=32768,o!==null&&typeof o==="object"&&typeof o.then==="function"){if(t=n.alternate,t!==null&&Ed(t,n,r,!0),n=wr.current,n!==null){switch(n.tag){case 31:case 13:case 19:return _r===null?ux():n.alternate===null&&qn===0&&(qn=3),n.flags&=-257,n.flags|=65536,n.lanes=r,o===Xy?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([o]):t.add(o),uC(e,o,r)),!1;case 22:return n.flags|=65536,o===Xy?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([o])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([o]):n.add(o)),uC(e,o,r)),!1}throw Error(U(435,n.tag))}return uC(e,o,r),ux(),!1}if(et)return t=wr.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,o!==IC&&(e=Error(U(422),{cause:o}),Th(ai(e,n)))):(o!==IC&&(t=Error(U(423),{cause:o}),Th(ai(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,o=ai(o,n),r=YC(e.stateNode,o,r),tC(e,r),qn!==4&&(qn=2)),!1;var a=Error(U(520),{cause:o});if(a=ai(a,n),xh===null?xh=[a]:xh.push(a),qn!==4&&(qn=2),t===null)return!0;o=ai(o,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=YC(n.stateNode,o,e),tC(n,e),!1;case 1:if(t=n.type,a=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError==="function"||a!==null&&typeof a.componentDidCatch==="function"&&(Xc===null||!Xc.has(a))))return n.flags|=65536,r&=-r,n.lanes|=r,r=T3(r),E3(r,e,n,o),tC(n,r),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var cN=Error(U(461)),lo=!1;function So(e,t,n,o){t.child=e===null?GP(t,null,n,o):Dd(t,e.child,n,o)}function JD(e,t,n,o,r){n=n.render;var a=t.ref;if("ref"in o){var i={};for(var s in o)s!=="ref"&&(i[s]=o[s])}else i=o;if(Ad(t),o=Z2(e,t,n,i,a,r),s=J2(),e!==null&&!lo)return eN(e,t,r),Nl(e,t,r);return et&&s&&kx(t),t.flags|=1,So(e,t,o,r),t.child}function e4(e,t,n,o,r){if(e===null){var a=n.type;if(typeof a==="function"&&!F2(a)&&a.defaultProps===void 0&&n.compare===null)return t.tag=15,t.type=a,A3(e,t,a,o,r);return e=Ny(n.type,null,o,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e}if(a=e.child,!dN(e,r)){var i=a.memoizedProps;if(n=n.compare,n=n!==null?n:Nh,n(i,o)&&e.ref===t.ref)return Nl(e,t,r)}return t.flags|=1,e=yl(a,o),e.ref=t.ref,e.return=t,t.child=e}function A3(e,t,n,o,r){if(e!==null){var a=e.memoizedProps;if(Nh(a,o)&&e.ref===t.ref)if(lo=!1,t.pendingProps=o=a,dN(e,r))(e.flags&131072)!==0&&(lo=!0);else return t.lanes=e.lanes,Nl(e,t,r)}return WC(e,t,n,o,r)}function M3(e,t,n,o){var r=o.children,a=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((t.flags&128)!==0){if(a=a!==null?a.baseLanes|n:n,e!==null){o=t.child=e.child;for(r=0;o!==null;)r=r|o.lanes|o.childLanes,o=o.sibling;o=r&~a}else o=0,t.child=null;return t4(e,t,a,n,o)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ty(t,a!==null?a.cachePool:null),a!==null?FD(t,a):GC(),KP(t);else return o=t.lanes=536870912,t4(e,t,a!==null?a.baseLanes|n:n,n,o)}else a!==null?(Ty(t,a.cachePool),FD(t,a),Wc(),t.memoizedState=null):(e!==null&&Ty(t,null),GC(),Wc());return So(e,t,r,n),t.child}function bh(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function t4(e,t,n,o,r){var a=q2();return a=a===null?null:{parent:so._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ty(t,null),GC(),KP(t),e!==null&&Ed(e,t,o,!0),t.childLanes=r,null}function My(e,t){return t=Ex({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function n4(e,t,n){return Dd(t,e.child,null,n),e=My(t,t.pendingProps),e.flags|=2,Ta(t),t.memoizedState=null,e}function LZ(e,t,n){var o=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(et){if(o.mode==="hidden")return e=My(t,o),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},bh(null,e);if(FC(t),(e=pn)?(e=MO(e,ii),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:eu!==null?{id:As,overflow:Ms}:null,retryLane:536870912,hydrationErrors:null},n=zP(e),n.return=t,t.child=n,Wo=t,pn=null)):e=null,e===null)throw tu(t);return t.lanes=536870912,null}return My(t,o)}var a=e.memoizedState;if(a!==null){var i=a.dehydrated;if(FC(t),r)if(t.flags&256)t.flags&=-257,t=n4(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(U(558));else if(lo||Ed(e,t,n,!1),r=(n&e.childLanes)!==0,lo||r){if(nu.current===null){if(o=rn,o!==null&&(i=iP(o,n),i!==0&&i!==a.retryLane))throw a.retryLane=i,Bd(e,i),ca(o,e,i),cN;ux()}t=n4(e,t,n)}else e=a.treeContext,pn=si(i.nextSibling),Wo=t,et=!0,Kc=null,ii=!1,e!==null&&LP(t,e),t=My(t,o),t.flags|=134221824;return t}return e=yl(e.child,{mode:o.mode,children:o.children}),e.ref=t.ref,t.child=e,e.return=t,e}function yf(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=="function"&&typeof n!=="object")throw Error(U(284));if(e===null||e.ref!==n)t.flags|=4194816}}function WC(e,t,n,o,r){if(Ad(t),n=Z2(e,t,n,o,void 0,r),o=J2(),e!==null&&!lo)return eN(e,t,r),Nl(e,t,r);return et&&o&&kx(t),t.flags|=1,So(e,t,n,r),t.child}function o4(e,t,n,o,r,a){if(Ad(t),t.updateQueue=null,n=$P(t,o,n,r),qP(e),o=J2(),e!==null&&!lo)return eN(e,t,a),Nl(e,t,a);return et&&o&&kx(t),t.flags|=1,So(e,t,n,a),t.child}function r4(e,t,n,o,r){if(Ad(t),t.stateNode===null){var a=Df,i=n.contextType;typeof i==="object"&&i!==null&&(a=br(i)),a=new n(o,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=$C,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=o,a.state=t.memoizedState,a.refs={},Y2(t),i=n.contextType,a.context=typeof i==="object"&&i!==null?br(i):Df,a.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i==="function"&&(oC(t,n,i,o),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==="function"||typeof a.getSnapshotBeforeUpdate==="function"||typeof a.UNSAFE_componentWillMount!=="function"&&typeof a.componentWillMount!=="function"||(i=a.state,typeof a.componentWillMount==="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==="function"&&a.UNSAFE_componentWillMount(),i!==a.state&&$C.enqueueReplaceState(a,a.state,null),gh(t,o,a,r),mh(),a.state=t.memoizedState),typeof a.componentDidMount==="function"&&(t.flags|=4194308),o=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,l=Od(n,s);a.props=l;var c=a.context,d=n.contextType;i=Df,typeof d==="object"&&d!==null&&(i=br(d));var u=n.getDerivedStateFromProps;d=typeof u==="function"||typeof a.getSnapshotBeforeUpdate==="function",s=t.pendingProps!==s,d||typeof a.UNSAFE_componentWillReceiveProps!=="function"&&typeof a.componentWillReceiveProps!=="function"||(s||c!==i)&&QD(t,a,o,i),Ic=!1;var p=t.memoizedState;a.state=p,gh(t,o,a,r),mh(),c=t.memoizedState,s||p!==c||Ic?(typeof u==="function"&&(oC(t,n,u,o),c=t.memoizedState),(l=Ic||XD(t,n,l,o,p,c,i))?(d||typeof a.UNSAFE_componentWillMount!=="function"&&typeof a.componentWillMount!=="function"||(typeof a.componentWillMount==="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==="function"&&(t.flags|=4194308)):(typeof a.componentDidMount==="function"&&(t.flags|=4194308),t.memoizedProps=o,t.memoizedState=c),a.props=o,a.state=c,a.context=i,o=l):(typeof a.componentDidMount==="function"&&(t.flags|=4194308),o=!1)}else{a=t.stateNode,jC(e,t),i=t.memoizedProps,d=Od(n,i),a.props=d,u=t.pendingProps,p=a.context,c=n.contextType,l=Df,typeof c==="object"&&c!==null&&(l=br(c)),s=n.getDerivedStateFromProps,(c=typeof s==="function"||typeof a.getSnapshotBeforeUpdate==="function")||typeof a.UNSAFE_componentWillReceiveProps!=="function"&&typeof a.componentWillReceiveProps!=="function"||(i!==u||p!==l)&&QD(t,a,o,l),Ic=!1,p=t.memoizedState,a.state=p,gh(t,o,a,r),mh();var f=t.memoizedState;i!==u||p!==f||Ic||e!==null&&e.dependencies!==null&&Wy(e.dependencies)?(typeof s==="function"&&(oC(t,n,s,o),f=t.memoizedState),(d=Ic||XD(t,n,d,o,p,f,l)||e!==null&&e.dependencies!==null&&Wy(e.dependencies))?(c||typeof a.UNSAFE_componentWillUpdate!=="function"&&typeof a.componentWillUpdate!=="function"||(typeof a.componentWillUpdate==="function"&&a.componentWillUpdate(o,f,l),typeof a.UNSAFE_componentWillUpdate==="function"&&a.UNSAFE_componentWillUpdate(o,f,l)),typeof a.componentDidUpdate==="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!=="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=f),a.props=o,a.state=f,a.context=l,o=d):(typeof a.componentDidUpdate!=="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),o=!1)}return a=o,yf(e,t),o=(t.flags&128)!==0,a||o?(a=t.stateNode,n=o&&typeof n.getDerivedStateFromError!=="function"?null:a.render(),t.flags|=1,e!==null&&o?(t.child=Dd(t,e.child,null,r),t.child=Dd(t,null,n,r)):So(e,t,n,r),t.memoizedState=a.state,e=t.child):e=Nl(e,t,r),e}function a4(e,t,n,o){return Td(),t.flags|=256,So(e,t,n,o),t.child}var XC={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function QC(e){return{baseLanes:e,cachePool:HP()}}function ZC(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Aa),e}function D3(e,t,n){var o=t.pendingProps,r=!1,a=(t.flags&128)!==0,i;if((i=a)||(i=e!==null&&e.memoizedState===null?!1:(yr.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(et){if(r?Yc(t):Wc(),(e=pn)?(e=MO(e,ii),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:eu!==null?{id:As,overflow:Ms}:null,retryLane:536870912,hydrationErrors:null},n=zP(e),n.return=t,t.child=n,Wo=t,pn=null)):e=null,e===null)throw tu(t);return SN(e)?t.lanes=32:t.lanes=536870912,null}if(a=o.children,o=o.fallback,r)return Wc(),r=t.mode,a=Ex({mode:"hidden",children:a},r),o=Sd(o,r,n,null),a.return=t,o.return=t,a.sibling=o,t.child=a,o=t.child,o.memoizedState=QC(n),o.childLanes=ZC(e,i,n),t.memoizedState=XC,bh(null,o);return Yc(t),uN(t,a)}var s=e.memoizedState;if(s!==null){var l=s.dehydrated;if(l!==null)return BZ(e,t,a,i,o,l,s,n)}if(r)return Wc(),r=o.fallback,a=t.mode,s=e.child,l=s.sibling,o=yl(s,{mode:"hidden",children:o.children}),o.subtreeFlags=s.subtreeFlags&1206910976,l!==null?r=yl(l,r):(r=Sd(r,a,n,null),r.flags|=2),r.return=t,o.return=t,o.sibling=r,t.child=o,bh(null,o),o=t.child,r=e.child.memoizedState,r===null?r=QC(n):(a=r.cachePool,a!==null?(s=so._currentValue,a=a.parent!==s?{parent:s,pool:s}:a):a=HP(),r={baseLanes:r.baseLanes|n,cachePool:a}),o.memoizedState=r,o.childLanes=ZC(e,i,n),t.memoizedState=XC,bh(e.child,o);return Yc(t),n=e.child,e=n.sibling,n=yl(n,{mode:"visible",children:o.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n}function uN(e,t){return t=Ex({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ex(e,t){return e=la(22,e,null,t),e.lanes=0,e}function py(e,t,n){return Dd(t,e.child,null,n),e=uN(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function BZ(e,t,n,o,r,a,i,s){if(n){if(t.flags&256)return Yc(t),t.flags&=-257,py(e,t,s);if(t.memoizedState!==null)return Wc(),t.child=e.child,t.flags|=128,null;return Wc(),a=r.fallback,i=t.mode,r=Ex({mode:"visible",children:r.children},i),a=Sd(a,i,s,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,Dd(t,e.child,null,s),r=t.child,r.memoizedState=QC(s),r.childLanes=ZC(e,o,s),t.memoizedState=XC,bh(null,r)}if(Yc(t),SN(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var l=o.dgst;return o=l,o!==""&&(r=Error(U(419)),r.stack="",r.digest=o,Th({value:r,source:null,stack:null})),py(e,t,s)}if(lo||Ed(e,t,s,!1),o=(s&e.childLanes)!==0,lo||o){if(nu.current!==null)return py(e,t,s);if(o=rn,o!==null&&(r=iP(o,s),r!==0&&r!==i.retryLane))throw i.retryLane=r,Bd(e,r),ca(o,e,r),cN;return N2(a)||ux(),py(e,t,s)}if(N2(a))return t.flags|=192,t.child=e.child,null;return e=i.treeContext,pn=si(a.nextSibling),Wo=t,et=!0,Kc=null,ii=!1,e!==null&&LP(t,e),t=uN(t,r.children),t.flags|=134221824,t}function i4(e,t,n){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),Ry(e.return,t,n)}function s4(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Zy(n)===null&&(t=e),e=e.sibling}return t}function fy(e,t,n,o,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:r,treeForkCount:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=o,i.tail=n,i.tailMode=r,i.treeForkCount=a)}function rC(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function JC(e,t,n){var o=t.pendingProps,r=o.revealOrder,a=o.tail;o=o.children;var i=yr.current;if(t.flags&128)return Ah(t,i),null;var s=(i&2)!==0;if(s?(i=i&1|2,t.flags|=128):i&=1,Ah(t,i),r==="backwards"&&e!==null?(rC(e),So(e,t,o,n),rC(e)):So(e,t,o,n),o=et?Rh:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&i4(e,n,t);else if(e.tag===19)i4(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"backwards":n=s4(t.child),n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null,rC(t)),fy(t,!0,r,null,a,o);break;case"unstable_legacy-backwards":n=null,r=t.child;for(t.child=null;r!==null;){if(e=r.alternate,e!==null&&Zy(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}fy(t,!0,n,null,a,o);break;case"together":fy(t,!1,null,null,void 0,o);break;case"independent":t.memoizedState=null;break;default:n=s4(t.child),n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),fy(t,!1,r,n,a,o)}return t.child}function l4(e,t,n){var o=t.pendingProps;return jc(t,t.type,o.value),So(e,t,o.children,n),t.child}function Nl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ru|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ed(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(U(153));if(t.child!==null){e=t.child,n=yl(e,e.pendingProps),t.child=n;for(n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function dN(e,t){if((e.lanes&t)!==0)return!0;return e=e.dependencies,e!==null&&Wy(e)?!0:!1}function HZ(e,t,n){switch(t.tag){case 3:Uy(t,t.stateNode.containerInfo),jc(t,so,e.memoizedState.cache),Td();break;case 27:case 5:RC(t);break;case 4:Uy(t,t.stateNode.containerInfo);break;case 10:jc(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,FC(t),null;break;case 13:var o=t.memoizedState;if(o!==null){if(o.dehydrated!==null)return Yc(t),t.flags|=128,null;o=Ed(e,t,n,!1);var r=t.child.childLanes;if(o||(n&r)!==0)return D3(e,t,n);return Yc(t),e=Nl(e,t,n),e!==null?e.sibling:null}Yc(t);break;case 19:if(t.flags&128)return JC(e,t,n);if(r=(e.flags&128)!==0,o=(n&t.childLanes)!==0,o||(Ed(e,t,n,!1),o=(n&t.childLanes)!==0),r){if(o)return JC(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Ah(t,yr.current),o)break;else return null;case 22:return t.lanes=0,M3(e,t,n,t.pendingProps);case 24:jc(t,so,e.memoizedState.cache)}return Nl(e,t,n)}function P3(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)lo=!0;else{if(!dN(e,n)&&(t.flags&128)===0)return lo=!1,HZ(e,t,n);lo=(e.flags&131072)!==0?!0:!1}else lo=!1,et&&(t.flags&1048576)!==0&&IP(t,Rh,t.index);switch(t.lanes=0,t.tag){case 16:e:{var o=t.pendingProps;if(e=vd(t.elementType),t.type=e,typeof e==="function")F2(e)?(o=Od(e,o),t.tag=1,t=r4(null,t,e,o,n)):(t.tag=0,t=WC(null,t,e,o,n));else{if(e!==void 0&&e!==null){var r=e.$$typeof;if(r===M2){t.tag=11,t=JD(null,t,e,o,n);break e}else if(r===D2){t.tag=14,t=e4(null,t,e,o,n);break e}else if(r===Ts){t.tag=10,t.type=e,t=l4(null,t,n);break e}}throw t=CC(e)||e,Error(U(306,t,""))}}return t;case 0:return WC(e,t,t.type,t.pendingProps,n);case 1:return o=t.type,r=Od(o,t.pendingProps),r4(e,t,o,r,n);case 3:e:{if(Uy(t,t.stateNode.containerInfo),e===null)throw Error(U(387));o=t.pendingProps;var a=t.memoizedState;r=a.element,jC(e,t),gh(t,o,null,n);var i=t.memoizedState;if(o=i.cache,jc(t,so,o),o!==a.cache&&BC(t,[so],n,!0),mh(),o=i.element,a.isDehydrated)if(a={element:o,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=a4(e,t,o,n);break e}else if(o!==r){r=ai(Error(U(424)),t),Th(r),t=a4(e,t,o,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}pn=si(e.firstChild),Wo=t,et=!0,Kc=null,ii=!0,n=GP(t,null,o,n);for(t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(Td(),o===r){t=Nl(e,t,n);break e}So(e,t,o,n)}t=t.child}return t;case 26:return yf(e,t),e===null?(n=O4(t.type,null,t.pendingProps,null))?t.memoizedState=n:et||(t.stateNode=wO(t.type,t.pendingProps,Vc.current,t)):t.memoizedState=O4(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return RC(t),e===null&&et&&(o=t.stateNode=DO(t.type,t.pendingProps,Vc.current),Wo=t,ii=!0,r=pn,iu(t.type)?(R2=r,pn=si(o.firstChild)):pn=r),So(e,t,t.pendingProps.children,n),yf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:if(e===null&&et){if(r=o=pn)o=DJ(o,t.type,t.pendingProps,ii),o!==null?(t.stateNode=o,Wo=t,pn=si(o.firstChild),ii=!1,r=!0):r=!1;r||tu(t)}return RC(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,k2(r,a)?o=null:i!==null&&k2(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=Z2(e,t,EZ,null,null,n),tm._currentValue=r),yf(e,t),So(e,t,o,n),t.child;case 6:if(e===null&&et){if(e=n=pn)n=PJ(n,t.pendingProps,ii),n!==null?(t.stateNode=n,Wo=t,pn=null,e=!0):e=!1;e||tu(t)}return null;case 13:return D3(e,t,n);case 4:return Uy(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Dd(t,null,o,n):So(e,t,o,n),t.child;case 11:return JD(e,t,t.type,t.pendingProps,n);case 7:return o=t.pendingProps,yf(e,t),So(e,t,o,n),t.child;case 8:return So(e,t,t.pendingProps.children,n),t.child;case 12:return So(e,t,t.pendingProps.children,n),t.child;case 10:return l4(e,t,n);case 9:return r=t.type._context,o=t.pendingProps.children,Ad(t),r=br(r),o=o(r),t.flags|=1,So(e,t,o,n),t.child;case 14:return e4(e,t,t.type,t.pendingProps,n);case 15:return A3(e,t,t.type,t.pendingProps,n);case 19:return JC(e,t,n);case 31:return LZ(e,t,n);case 22:return M3(e,t,n,t.pendingProps);case 24:return Ad(t),o=br(so),e===null?(r=q2(),r===null&&(r=rn,a=K2(),r.pooledCache=a,a.refCount++,a!==null&&(r.pooledCacheLanes|=n),r=a),t.memoizedState={parent:o,cache:r},Y2(t),jc(t,so,r)):((e.lanes&n)!==0&&(jC(e,t),gh(t,null,null,n),mh()),r=e.memoizedState,a=t.memoizedState,r.parent!==o?(r={parent:o,cache:o},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),jc(t,so,o)):(o=a.cache,jc(t,so,o),o!==r.cache&&BC(t,[so],n,!0))),So(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),o=t.pendingProps,o.name!=null&&o.name!=="auto"?t.flags|=e===null?18882560:18874368:et&&kx(t),e!==null&&e.memoizedProps.name!==o.name?t.flags|=4194816:yf(e,t),So(e,t,o.children,n),t.child;case 29:throw t.pendingProps}throw Error(U(156,t.tag))}function hl(e){e.flags|=4}function aC(e,t,n,o,r){var a;if(a=(e.mode&32)!==0)a=n===null?I4(t,o):I4(t,o)&&(o.src!==n.src||o.srcSet!==n.srcSet);if(a){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(sO())e.flags|=8192;else throw Nd=Xy,$2}else e.flags&=-16777217}function c4(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zO(t))if(sO())e.flags|=8192;else throw Nd=Xy,$2}function my(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?oP():536870912,e.lanes|=t,Wf|=t)}function Qg(e,t){if(!et)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null;break;default:t=e.tail;for(n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function dn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,o=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,o|=r.subtreeFlags&1206910976,o|=r.flags&1206910976,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,o|=r.subtreeFlags,o|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=o,e.childLanes=n,t}function jZ(e,t,n){var o=t.pendingProps;switch(V2(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(t),null;case 1:return dn(t),null;case 3:if(n=t.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),t.memoizedState.cache!==o&&(t.flags|=2048),xl(so),Kf(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),e===null||e.child===null)bf(t)?hl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,eC());return dn(t),null;case 26:var{type:r,memoizedState:a}=t;return e===null?(hl(t),a!==null?(dn(t),c4(t,a)):(dn(t),aC(t,r,null,o,n))):a?a!==e.memoizedState?(hl(t),dn(t),c4(t,a)):(dn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==o&&hl(t),dn(t),aC(t,r,e,o,n)),null;case 27:if(Gy(t),n=Vc.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==o&&hl(t);else{if(!o){if(t.stateNode===null)throw Error(U(166));return dn(t),t.subtreeFlags&=-33554433,null}e=Ds.current,bf(t)?ID(t,e):(e=DO(r,o,n),t.stateNode=e,hl(t))}return dn(t),t.subtreeFlags&=-33554433,null;case 5:if(Gy(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==o&&hl(t);else{if(!o){if(t.stateNode===null)throw Error(U(166));return dn(t),t.subtreeFlags&=-33554433,null}if(a=Ds.current,bf(t))ID(t,a);else{var i=Oh(Vc.current);switch(a){case 1:a=i.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:a=i.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":a=i.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":a=i.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":a=i.createElement("div"),a.innerHTML="<script></script>",a=a.removeChild(a.firstChild);break;case"select":a=typeof o.is==="string"?i.createElement("select",{is:o.is}):i.createElement("select"),o.multiple?a.multiple=!0:o.size&&(a.size=o.size);break;default:a=typeof o.is==="string"?i.createElement(r,{is:o.is}):i.createElement(r)}}a[hr]=t,a[da]=o;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)a.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=a;e:switch(xr(a,r,o),r){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&hl(t)}}return dn(t),t.subtreeFlags&=-33554433,aC(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==o&&hl(t);else{if(typeof o!=="string"&&t.stateNode===null)throw Error(U(166));if(e=Vc.current,bf(t)){if(e=t.stateNode,n=t.memoizedProps,o=null,r=Wo,r!==null)switch(r.tag){case 27:case 5:o=r.memoizedProps}e[hr]=t,e=e.nodeValue===n||o!==null&&o.suppressHydrationWarning===!0||yO(e.nodeValue,n)?!0:!1,e||tu(t,!0)}else e=Oh(e).createTextNode(o),e[hr]=t,t.stateNode=e}return dn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(o=bf(t),n!==null){if(e===null){if(!o)throw Error(U(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(557));e[hr]=t}else Td(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dn(t),e=!1}else n=eC(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e){if(t.flags&256)return Ta(t),t;return Ta(t),null}if((t.flags&128)!==0)throw Error(U(558))}return dn(t),null;case 13:if(o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=bf(t),o!==null&&o.dehydrated!==null){if(e===null){if(!r)throw Error(U(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(U(317));r[hr]=t}else Td(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dn(t),r=!1}else r=eC(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r){if(t.flags&256)return Ta(t),t;return Ta(t),null}}if(Ta(t),(t.flags&128)!==0)return t.lanes=n,t;return n=o!==null,e=e!==null&&e.memoizedState!==null,n&&(o=t.child,r=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(r=o.alternate.memoizedState.cachePool.pool),a=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(a=o.memoizedState.cachePool.pool),a!==r&&(o.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),my(t,t.updateQueue),dn(t),null;case 4:return Kf(),e===null&&xN(t.stateNode.containerInfo),t.flags|=67108864,dn(t),null;case 10:return xl(t.type),dn(t),null;case 19:if(X2(t),o=t.memoizedState,o===null)return dn(t),null;if(r=(t.flags&128)!==0,a=o.rendering,a===null)if(r)Qg(o,!1);else{if(qn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=Zy(e),a!==null){t.flags|=128,Qg(o,!1),e=a.updateQueue,t.updateQueue=e,my(t,e),t.subtreeFlags=0,e=n;for(n=t.child;n!==null;)_P(n,e),n=n.sibling;return Ah(t,yr.current&1|2),et&&bl(t,o.treeForkCount),t.child}e=e.sibling}o.tail!==null&&Ma()>lx&&(t.flags|=128,r=!0,Qg(o,!1),t.lanes=4194304)}else{if(!r)if(e=Zy(a),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,my(t,e),Qg(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!a.alternate&&!et)return dn(t),null}else 2*Ma()-o.renderingStartTime>lx&&n!==536870912&&(t.flags|=128,r=!0,Qg(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(e=o.last,e!==null?e.sibling=a:t.child=a,o.last=a)}if(o.tail!==null){e=o.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Ma(),e.sibling=null,a=yr.current,a=r?a&1|2:a&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!n||et?Ah(t,a):(n=a,fn(wr,t),fn(yr,n),_r===null&&(_r=t)),et&&bl(t,o.treeForkCount),e}return dn(t),null;case 22:case 23:return Ta(t),W2(),o=t.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(t.flags|=8192):o&&(t.flags|=8192),o?(n&536870912)!==0&&(t.flags&128)===0&&(dn(t),t.subtreeFlags&6&&(t.flags|=8192)):dn(t),n=t.updateQueue,n!==null&&my(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),o=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),o!==n&&(t.flags|=2048),e!==null&&vr(Cd),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),xl(so),dn(t),null;case 25:return null;case 30:return t.flags|=33554432,dn(t),null}throw Error(U(156,t.tag))}function UZ(e,t){switch(V2(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xl(so),Kf(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Gy(t),null;case 31:if(t.memoizedState!==null){if(Ta(t),t.alternate===null)throw Error(U(340));Td()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ta(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));Td()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X2(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Kf(),null;case 10:return xl(t.type),null;case 22:case 23:return Ta(t),W2(),e!==null&&vr(Cd),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return xl(so),null;case 25:return null;default:return null}}function O3(e,t){switch(V2(t),t.tag){case 3:xl(so),Kf();break;case 26:case 27:case 5:Gy(t);break;case 4:Kf();break;case 31:t.memoizedState!==null&&Ta(t);break;case 13:Ta(t);break;case 19:X2(t);break;case 10:xl(t.type);break;case 22:case 23:Ta(t),W2(),e!==null&&vr(Cd);break;case 24:xl(so)}}function qh(e,t){try{var n=t.updateQueue,o=n!==null?n.lastEffect:null;if(o!==null){var r=o.next;n=r;do{if((n.tag&e)===e){o=void 0;var a=n.create,i=n.inst;o=a(),i.destroy=o}n=n.next}while(n!==r)}}catch(s){Yt(t,t.return,s)}}function ou(e,t,n){try{var o=t.updateQueue,r=o!==null?o.lastEffect:null;if(r!==null){var a=r.next;o=a;do{if((o.tag&e)===e){var i=o.inst,s=i.destroy;if(s!==void 0){i.destroy=void 0,r=t;var l=n,c=s;try{c()}catch(d){Yt(r,l,d)}}}o=o.next}while(o!==a)}}catch(d){Yt(t,t.return,d)}}function _3(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{VP(t,n)}catch(o){Yt(e,e.return,o)}}}function z3(e,t,n){n.props=Od(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(o){Yt(e,t,o)}}function Ns(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:var r=e.stateNode,a=kl(e.memoizedProps,r);if(r.ref===null||r.ref.name!==a)r.ref=NO(a);o=r.ref;break;case 7:if(e.stateNode===null){var i=new za(e);ua(e.child,!1,AJ,i,void 0,void 0),e.stateNode=i}o=e.stateNode;break;default:o=e.stateNode}typeof n==="function"?e.refCleanup=n(o):n.current=o}}catch(s){Yt(e,t,s)}}function gr(e,t){var n=e.ref,o=e.refCleanup;if(n!==null)if(typeof o==="function")try{o()}catch(r){Yt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==="function")try{n(null)}catch(r){Yt(e,t,r)}else n.current=null}function ox(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)AO(e.stateNode,t[n])}function u4(e){for(var t=e.return;t!==null;){if(fN(t)&&AO(e.stateNode,t.stateNode),pN(t))break;t=t.return}}function vh(e){for(var t=e.return;t!==null;){if(fN(t)&&MJ(e.stateNode,t.stateNode),pN(t))break;t=t.return}}function pN(e){return e.tag===5||e.tag===3||e.tag===27}function fN(e){return e&&e.tag===7&&e.stateNode!==null}function e2(e){var{type:t,memoizedProps:n,stateNode:o}=e;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&o.focus();break e;case"img":n.src?o.src=n.src:n.srcSet&&(o.srcset=n.srcSet)}}catch(r){Yt(e,e.return,r)}}function iC(e,t,n){try{var o=e.stateNode;dJ(o,e.type,n,t),o[da]=t}catch(r){Yt(e,e.return,r)}}function I3(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&iu(e.type)||e.tag===4}function sC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||I3(e.return))return null;e=e.return}e.sibling.return=e.return;for(e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&iu(e.type))continue e;if(e.flags&2)continue e;if(e.child===null||e.tag===4)continue e;else e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function t2(e,t,n,o){var r=e.tag;if(r===5||r===6)r=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(r,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(r),n=n._reactRootContainer,n!==null&&n!==void 0||t.onclick!==null||(t.onclick=Es)),ox(e,o),Ct=!0;else if(r!==4&&(r===27&&(ox(e,o),o=null,iu(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(t2(e,t,n,o),e=e.sibling;e!==null;)t2(e,t,n,o),e=e.sibling}function rx(e,t,n,o){var r=e.tag;if(r===5||r===6)r=e.stateNode,t?n.insertBefore(r,t):n.appendChild(r),ox(e,o),Ct=!0;else if(r!==4&&(r===27&&(ox(e,o),o=null,iu(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(rx(e,t,n,o),e=e.sibling;e!==null;)rx(e,t,n,o),e=e.sibling}function L3(e){var{stateNode:t,memoizedProps:n}=e;try{for(var o=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);xr(t,o,n),t[hr]=e,t[da]=n}catch(a){Yt(e,e.return,a)}}var ax=!1,Ea=null;function d4(e){if(e.tag===30||(e.subtreeFlags&33554432)!==0)ax=!0}var Rs=null;function p4(){var e=Rs;return Rs=null,e}var sa=0;function sm(e,t,n,o,r){return sa=0,B3(e.child,t,n,o,r)}function B3(e,t,n,o,r){for(var a=!1;e!==null;){if(e.tag===5){var i=e.stateNode;if(o!==null){var s=S2(i);o.push(s),s.view&&(a=!0)}else a||S2(i).view&&(a=!0);ax=!0,kO(i,sa===0?t:t+"_"+sa,n),sa++}else if(e.tag!==22||e.memoizedState===null)e.tag===30&&r||B3(e.child,t,n,o,r)&&(a=!0);e=e.sibling}return a}function Os(e,t){for(;e!==null;){if(e.tag===5)SO(e.stateNode,e.memoizedProps);else if(e.tag!==22||e.memoizedState===null)e.tag===30&&t||Os(e.child,t);e=e.sibling}}function Dy(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(Dy(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(U(544));var n=t.name;t=El(t.default,t.share),t!=="none"&&(sm(e,n,t,null,!1)||Os(e.child,!1))}}e=e.sibling}}function n2(e,t){if(e.tag===30){var n=e.stateNode,o=e.memoizedProps,r=kl(o,n),a=El(o.default,n.paired?o.share:o.enter);a!=="none"?sm(e,r,a,null,!1)?(Dy(e),n.paired||t||Xf(e,o.onEnter)):Os(e.child,!1):Dy(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)n2(e,t),e=e.sibling;else Dy(e)}function o2(e){if(Ea!==null&&Ea.size!==0){var t=Ea;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,o=n.name;if(o!=null&&o!=="auto"){var r=t.get(o);if(r!==void 0){var a=El(n.default,n.share);if(a!=="none"&&(sm(e,o,a,null,!1)?(a=e.stateNode,r.paired=a,a.paired=r,Xf(e,n.onShare)):Os(e.child,!1)),t.delete(o),t.size===0)break}}}o2(e)}e=e.sibling}}}function r2(e){if(e.tag===30){var t=e.memoizedProps,n=kl(t,e.stateNode),o=Ea!==null?Ea.get(n):void 0,r=El(t.default,o!==void 0?t.share:t.exit);r!=="none"&&(sm(e,n,r,null,!1)?o!==void 0?(r=e.stateNode,o.paired=r,r.paired=o,Ea.delete(n),Xf(e,t.onShare)):Xf(e,t.onExit):Os(e.child,!1)),Ea!==null&&o2(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)r2(e),e=e.sibling;else Ea!==null&&o2(e)}function H3(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=kl(t,e.stateNode);t=El(t.default,t.update),e.flags&=-5,t!=="none"&&sm(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&H3(e);e=e.sibling}}function a2(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Os(e.child,!1))}a2(e)}e=e.sibling}}function Py(e){if(e.tag===30)e.stateNode.paired=null,Os(e.child,!1),a2(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Py(e),e=e.sibling;else a2(e)}function j3(e){for(e=e.child;e!==null;)e.tag===30?Os(e.child,!1):(e.subtreeFlags&33554432)!==0&&j3(e),e=e.sibling}function mN(e,t,n,o,r,a,i){for(var s=!1;t!==null;){if(t.tag===5){var l=t.stateNode;if(a!==null&&sa<a.length){var c=a[sa],d=S2(l);if(c.view||d.view)s=!0;var u;if(u=(e.flags&4)===0)if(d.clip)u=!0;else{u=c.rect;var p=d.rect;u=u.y!==p.y||u.x!==p.x||u.height!==p.height||u.width!==p.width}u&&(e.flags|=4),d.abs?d=!c.abs:(c=c.rect,d=d.rect,d=c.height!==d.height||c.width!==d.width),d&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&kO(l,sa===0?n:n+"_"+sa,r),s&&(e.flags&4)!==0||(Rs===null&&(Rs=[]),Rs.push(l,sa===0?o:o+"_"+sa,t.memoizedProps)),sa++}else if(t.tag!==22||t.memoizedState===null)t.tag===30&&i?e.flags|=t.flags&32:mN(e,t.child,n,o,r,a,i)&&(s=!0);t=t.sibling}return s}function U3(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,o=e.stateNode,r=kl(n,o),a=El(n.default,n.update);if(t){o=o.clones;var i=o===null?null:o.map(bJ)}else i=e.memoizedState,e.memoizedState=null;o=e;var s=e.child;sa=0,r=mN(o,s,r,r,a,i,!1),(e.flags&4)!==0&&r&&(t||Xf(e,n.onUpdate))}else(e.subtreeFlags&33554432)!==0&&U3(e,t);e=e.sibling}}var qo=!1,Ut=!1,ks=!1,lC=!1,f4=typeof WeakSet==="function"?WeakSet:Set,$o=null,Ss=!1,ih=!1,ix=!1,i2=!1;function GZ(e,t,n){if(e=e.containerInfo,x2=nm,e=RP(e),j2(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var r=o.getSelection&&o.getSelection();if(r&&r.rangeCount!==0){o=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{o.nodeType,i.nodeType}catch(m){o=null;break e}var s=0,l=-1,c=-1,d=0,u=0,p=e,f=null;t:for(;;){for(var g;;){if(p!==o||a!==0&&p.nodeType!==3||(l=s+a),p!==i||r!==0&&p.nodeType!==3||(c=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)===null)break;f=p,p=g}for(;;){if(p===e)break t;if(f===o&&++d===a&&(l=s),f===i&&++u===r&&(c=s),(g=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=g}o=l===-1||c===-1?null:{start:l,end:c}}else o=null}o=o||{start:0,end:0}}else o=null;w2={focusedElem:e,selectionRange:o},nm=!1,n=(n&335544064)===n,$o=t;for(t=n?9270:1024;$o!==null;){if(e=$o,n&&(o=e.deletions,o!==null))for(a=0;a<o.length;a++)n&&r2(o[a]);if(e.alternate===null&&(e.flags&2)!==0)n&&d4(e),gy(n);else{if(e.tag===22){if(o=e.alternate,e.memoizedState!==null){o!==null&&o.memoizedState===null&&n&&r2(o),gy(n);continue}else if(o!==null&&o.memoizedState!==null){n&&d4(e),gy(n);continue}}o=e.child,(e.subtreeFlags&t)!==0&&o!==null?(o.return=e,$o=o):(n&&H3(e),gy(n))}}Ea=null}function gy(e){for(;$o!==null;){var t=$o,n=e,{alternate:o,flags:r}=t;switch(t.tag){case 0:case 11:case 15:break;case 1:if((r&1024)!==0&&o!==null){n=void 0,r=o.memoizedProps,o=o.memoizedState;var a=t.stateNode;try{var i=Od(t.type,r);n=a.getSnapshotBeforeUpdate(i,o),a.__reactInternalSnapshotBeforeUpdate=n}catch(s){Yt(t,t.return,s)}}break;case 3:if((r&1024)!==0){if(o=t.stateNode.containerInfo,n=o.nodeType,n===9)C2(o);else if(n===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":C2(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&o!==null&&(n=kl(o.memoizedProps,o.stateNode),r=t.memoizedProps,r=El(r.default,r.update),r!=="none"&&sm(o,n,r,o.memoizedState=[],!0));break;default:if((r&1024)!==0)throw Error(U(163))}if(o=t.sibling,o!==null){o.return=t.return,$o=o;break}$o=t.return}}function G3(e,t,n){var o=n.flags;switch(n.tag){case 0:case 11:case 15:Cs(e,n),o&4&&qh(5,n);break;case 1:if(Cs(e,n),o&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Yt(n,n.return,i)}else{var r=Od(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Yt(n,n.return,i)}}o&64&&_3(n),o&512&&Ns(n,n.return);break;case 3:if(Cs(e,n),o&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{VP(e,t)}catch(i){Yt(n,n.return,i)}}break;case 27:t===null&&o&4&&L3(n);case 26:case 5:Cs(e,n),t===null&&o&4&&e2(n),o&512&&Ns(n,n.return);break;case 12:Cs(e,n);break;case 31:Cs(e,n),o&4&&q3(e,n);break;case 13:Cs(e,n),o&4&&$3(e,n),o&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=eJ.bind(null,n),OJ(e,n))));break;case 22:if(o=n.memoizedState!==null||qo,!o){var a=t!==null&&t.memoizedState!==null||Ut;t=qo,r=Ut,qo=o,(Ut=a)&&!r?(o=2,(n.subtreeFlags&8772)!==0&&(o|=1),ji(e,n,o)):Cs(e,n),qo=t,Ut=r}break;case 30:Cs(e,n),o&512&&Ns(n,n.return);break;case 7:o&512&&Ns(n,n.return);default:Cs(e,n)}}function s2(e,t){for(e=e.child;e!==null;)F3(e,t),e=e.sibling}function F3(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var o=n.style;typeof o.setProperty==="function"?o.setProperty("display","none","important"):o.display="none"}else{var r=e.stateNode,a=e.memoizedProps.style,i=a!==void 0&&a!==null&&a.hasOwnProperty("display")?a.display:null;r.style.display=i==null||typeof i==="boolean"?"":(""+i).trim()}}catch(l){Yt(e,e.return,l)}l2(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,Ct=!0}catch(l){Yt(e,e.return,l)}break;case 18:try{var s=e.stateNode;t?T4(s,!0):T4(e.stateNode,!1)}catch(l){Yt(e,e.return,l)}break;case 22:case 23:e.memoizedState===null&&s2(e,t);break;default:s2(e,t)}}function l2(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,o=t;switch(n.tag){case 4:F3(n,o);break e;case 22:n.memoizedState===null&&l2(n,o);break e;default:l2(n,o)}}e=e.sibling}}function V3(e){var t=e.alternate;t!==null&&(e.alternate=null,V3(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&hx(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Rn=null,aa=!1;function Hi(e,t,n){for(n=n.child;n!==null;)K3(e,t,n),n=n.sibling}function K3(e,t,n){if(Da&&typeof Da.onCommitFiberUnmount==="function")try{Da.onCommitFiberUnmount(Hh,n)}catch(a){}switch(n.tag){case 26:Ut||gr(n,t),Hi(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Ut&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ut||gr(n,t),vh(n);var o=Rn,r=aa;iu(n.type)&&(Rn=n.stateNode,aa=!1),Hi(e,t,n),PO(n.stateNode,n.type,n.memoizedProps),Rn=o,aa=r;break;case 5:Ut||gr(n,t),vh(n);case 6:if(n.tag===6&&vh(n),o=Rn,r=aa,Rn=null,Hi(e,t,n),Rn=o,aa=r,Rn!==null)if(aa)try{(Rn.nodeType===9?Rn.body:Rn.nodeName==="HTML"?Rn.ownerDocument.body:Rn).removeChild(n.stateNode),Ct=!0}catch(a){Yt(n,t,a)}else try{Rn.removeChild(n.stateNode),Ct=!0}catch(a){Yt(n,t,a)}break;case 18:Rn!==null&&(aa?(e=Rn,R4(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),om(e)):R4(Rn,n.stateNode));break;case 4:o=Rn,r=aa,Rn=n.stateNode.containerInfo,aa=!0,Hi(e,t,n),Rn=o,aa=r;break;case 0:case 11:case 14:case 15:ou(2,n,t),Ut||ou(4,n,t),Hi(e,t,n);break;case 1:Ut||(gr(n,t),o=n.stateNode,typeof o.componentWillUnmount==="function"&&z3(n,t,o)),Hi(e,t,n);break;case 21:Hi(e,t,n);break;case 22:Ut=(o=Ut)||n.memoizedState!==null,Hi(e,t,n),Ut=o;break;case 30:gr(n,t),Hi(e,t,n);break;case 7:Ut||gr(n,t),Hi(e,t,n);break;default:Hi(e,t,n)}}function q3(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{om(e)}catch(n){Yt(t,t.return,n)}}}function $3(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{om(e)}catch(n){Yt(t,t.return,n)}}function FZ(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new f4),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new f4),t;default:throw Error(U(435,e.tag))}}function hy(e,t){var n=FZ(e);t.forEach(function(o){if(!n.has(o)){n.add(o);var r=tJ.bind(null,e,o);o.then(r,r)}})}function qr(e,t,n){var o=t.deletions;if(o!==null)for(var r=0;r<o.length;r++){var a=o[r],i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 27:if(iu(l.type)){Rn=l.stateNode,aa=!1;break e}break;case 5:Rn=l.stateNode,aa=!1;break e;case 3:case 4:Rn=l.stateNode.containerInfo,aa=!0;break e}l=l.return}if(Rn===null)throw Error(U(160));K3(i,s,a),Rn=null,aa=!1,i=a.alternate,i!==null&&(i.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Y3(t,e,n),t=t.sibling}var Ui=null;function Y3(e,t,n){var o=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(r&4&&(o=e.updateQueue,o=o!==null?o.events:null,o!==null))for(var a=0;a<o.length;a++){var i=o[a];i.ref.impl=i.nextImpl}qr(t,e,n),$r(e),r&4&&(ou(3,e,e.return),qh(3,e),ou(5,e,e.return));break;case 1:qr(t,e,n),$r(e),r&512&&(Ut||o===null||gr(o,o.return)),r&64&&qo&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=Ui,qr(t,e,n),$r(e),r&512&&(Ut||o===null||gr(o,o.return)),r&4)if(r=o!==null?o.memoizedState:null,n=e.memoizedState,o===null)if(n===null)if(e.stateNode===null)if(qo)e.stateNode=wO(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,r=a.ownerDocument||a;t:switch(t){case"title":if(o=r.getElementsByTagName("title")[0],!o||o[Gh]||o[hr]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))o=r.createElement(t),r.head.insertBefore(o,r.querySelector("head > title"));xr(o,t,n),o[hr]=e,Yo(o),t=o;break e;case"link":if(a=z4("link","href",r).get(t+(n.href||""))){for(i=0;i<a.length;i++)if(o=a[i],o.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&o.getAttribute("rel")===(n.rel==null?null:n.rel)&&o.getAttribute("title")===(n.title==null?null:n.title)&&o.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(i,1);break t}}o=r.createElement(t),xr(o,t,n),r.head.appendChild(o);break;case"meta":if(a=z4("meta","content",r).get(t+(n.content||""))){for(i=0;i<a.length;i++)if(o=a[i],o.getAttribute("content")===(n.content==null?null:""+n.content)&&o.getAttribute("name")===(n.name==null?null:n.name)&&o.getAttribute("property")===(n.property==null?null:n.property)&&o.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute("charset")===(n.charSet==null?null:n.charSet)){a.splice(i,1);break t}}o=r.createElement(t),xr(o,t,n),r.head.appendChild(o);break;default:throw Error(U(468,t))}o[hr]=e,Yo(o),t=o}e.stateNode=t}else qo||T2(a,e.type,e.stateNode);else e.stateNode=_4(a,n,e.memoizedProps);else r!==n?(r===null?(t=o.stateNode,t===null||Ut||t.parentNode.removeChild(t)):r.count--,n===null?qo||T2(a,e.type,e.stateNode):_4(a,n,e.memoizedProps)):n===null&&e.stateNode!==null&&iC(e,e.memoizedProps,o.memoizedProps);break;case 27:qr(t,e,n),$r(e),r&512&&(Ut||o===null||gr(o,o.return)),o!==null&&r&4&&iC(e,e.memoizedProps,o.memoizedProps);break;case 5:if(a=ks,ks=!1,qr(t,e,n),ks=a,$r(e),r&512&&(Ut||o===null||gr(o,o.return)),e.flags&32){t=e.stateNode;try{$f(t,""),Ct=!0}catch(d){Yt(e,e.return,d)}}r&4&&e.stateNode!=null&&(t=e.memoizedProps,iC(e,t,o!==null?o.memoizedProps:t)),r&1024&&(lC=!0);break;case 6:if(qr(t,e,n),$r(e),r&4){if(e.stateNode===null)throw Error(U(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Ct=!0}catch(d){Yt(e,e.return,d)}}break;case 3:if(Ct=!1,Iy=null,a=Ui,Ui=_h(t.containerInfo),qr(t,e,n),Ui=a,$r(e),r&4&&o!==null&&o.memoizedState.isDehydrated)try{om(t.containerInfo)}catch(d){Yt(e,e.return,d)}lC&&(lC=!1,W3(e)),Ct=!1;break;case 4:r=ks,ks=qo,o=yD(),a=Ui,Ui=_h(e.stateNode.containerInfo),qr(t,e,n),$r(e),Ui=a,Ct&&ih&&(ix=!0),Ct=o,ks=r;break;case 12:qr(t,e,n),$r(e);break;case 31:qr(t,e,n),$r(e),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,hy(e,t)));break;case 13:qr(t,e,n),$r(e),e.child.flags&8192&&e.memoizedState!==null!==(o!==null&&o.memoizedState!==null)&&(Ax=Ma()),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,hy(e,t)));break;case 22:a=e.memoizedState!==null,i=o!==null&&o.memoizedState!==null;var s=qo,l=Ut,c=ks;qo=s||a,ks=c||a,Ut=l||i,qr(t,e,n),Ut=l,ks=c,qo=s,$r(e),r&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||o===null||i||qo||Ut||(t=i||Ut,n=qo,o=Ut,qo=a||qo,Ut=t,_c(e,2),qo=n,Ut=o),!a&&ks||s2(e,a)),r&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,hy(e,n))));break;case 19:qr(t,e,n),$r(e),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,hy(e,t)));break;case 30:r&512&&(Ut||o===null||gr(o,o.return)),r=yD(),a=ih,i=(n&335544064)===n,s=e.memoizedProps,ih=i&&El(s.default,s.update)!=="none",qr(t,e,n),$r(e),i&&o!==null&&Ct&&(e.flags|=4),ih=a,Ct=r;break;case 21:break;case 7:r&512&&(Ut||o===null||gr(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=e);default:qr(t,e,n),$r(e)}}function $r(e){var t=e.flags;if(t&2){try{for(var n,o=e.return;o!==null;){if(I3(o)){n=o;break}o=o.return}o=null;for(var r=e.return;r!==null;){if(fN(r)){var a=r.stateNode;o===null?o=[a]:o.push(a)}if(pN(r))break;r=r.return}var i=o;if(n==null)throw Error(U(160));switch(n.tag){case 27:var s=n.stateNode,l=sC(e);rx(e,l,s,i);break;case 5:var c=n.stateNode;n.flags&32&&($f(c,""),n.flags&=-33);var d=sC(e);rx(e,d,c,i);break;case 3:case 4:var u=n.stateNode.containerInfo,p=sC(e);t2(e,p,u,i);break;default:throw Error(U(161))}}catch(f){Yt(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function W3(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;W3(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,nm=!0,t.reset(),nm=!1),e=e.sibling}}function vf(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)X3(t,e),t=t.sibling;else U3(t,!1)}function X3(e,t){var n=e.alternate;if(n===null)n2(e,!1);else switch(e.tag){case 3:if(i2=Ss=!1,p4(),vf(t,e),!Ss&&!ix){if(e=Rs,e!==null)for(var o=0;o<e.length;o+=3){n=e[o];var r=e[o+1];SO(n,e[o+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+r+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),i2=!0}Rs=null;break;case 5:vf(t,e);break;case 4:o=Ss,Ss=!1,vf(t,e),Ss&&(ix=!0),Ss=o;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?n2(e,!1):vf(t,e));break;case 30:o=Ss,r=p4(),Ss=!1,vf(t,e),Ss&&(e.flags|=4);var a=e.memoizedProps,i=e.stateNode;t=kl(a,i),i=kl(n.memoizedProps,i);var s=El(a.default,a.update);s==="none"?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,sa=0,t=mN(e,n,t,i,s,a,!0),sa!==(a===null?0:a.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Xf(e,e.memoizedProps.onUpdate),Rs=r):r!==null&&(r.push.apply(r,Rs),Rs=r),Ss=(e.flags&32)!==0?!0:o;break;default:vf(t,e)}}function Cs(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)G3(e,t.alternate,t),t=t.sibling}function _c(e,t){for(e=e.child;e!==null;){var n=e,o=t;switch(n.tag){case 0:case 11:case 14:case 15:ou(4,n,n.return),_c(n,o);break;case 1:gr(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount==="function"&&z3(n,n.return,r),_c(n,o);break;case 27:(o&2)!==0&&PO(n.stateNode,n.type,n.memoizedProps);case 5:gr(n,n.return),n.tag!==5&&n.tag!==27||vh(n),_c(n,o);break;case 6:vh(n);break;case 26:gr(n,n.return),r=n.stateNode,n.memoizedState!==null||r===null||Ut||r.parentNode.removeChild(r),_c(n,o);break;case 22:n.memoizedState===null&&_c(n,o);break;case 30:gr(n,n.return),_c(n,o);break;case 7:gr(n,n.return);default:_c(n,o)}e=e.sibling}}function ji(e,t,n){n=(t.subtreeFlags&8772)!==0?n:n&-2;for(t=t.child;t!==null;){var o=t.alternate,r=e,a=t,i=a.flags,s=(n&1)!==0;switch(a.tag){case 0:case 11:case 15:ji(r,a,n),qh(4,a);break;case 1:if(ji(r,a,n),o=a,r=o.stateNode,typeof r.componentDidMount==="function")try{r.componentDidMount()}catch(d){Yt(o,o.return,d)}if(o=a,r=o.updateQueue,r!==null){var l=o.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)FP(c[r],l)}catch(d){Yt(o,o.return,d)}}s&&i&64&&_3(a),Ns(a,a.return);break;case 27:(n&2)!==0&&L3(a);case 5:a.tag!==5&&a.tag!==27||u4(a),ji(r,a,n),s&&o===null&&i&4&&e2(a),Ns(a,a.return);break;case 6:u4(a);break;case 26:l=a.stateNode,a.memoizedState!==null||l===null||qo||T2(_h(l.ownerDocument),a.type,l),ji(r,a,n),s&&o===null&&i&4&&e2(a),Ns(a,a.return);break;case 12:ji(r,a,n);break;case 31:ji(r,a,n),s&&i&4&&q3(r,a);break;case 13:ji(r,a,n),s&&i&4&&$3(r,a);break;case 22:a.memoizedState===null&&ji(r,a,n),Ns(a,a.return);break;case 30:ji(r,a,n),Ns(a,a.return);break;case 7:Ns(a,a.return);default:ji(r,a,n)}t=t.sibling}}function gN(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Vh(n))}function hN(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vh(e))}function ei(e,t,n,o){var r=(n&335544064)===n;if(t.subtreeFlags&(r?10262:10256))for(t=t.child;t!==null;)Q3(e,t,n,o),t=t.sibling;else r&&j3(t)}function Q3(e,t,n,o){var r=(n&335544064)===n;r&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Py(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:ei(e,t,n,o),a&2048&&qh(9,t);break;case 1:ei(e,t,n,o);break;case 3:ei(e,t,n,o),r&&i2&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Vh(a)));break;case 12:if(a&2048){ei(e,t,n,o),a=t.stateNode;try{var i=t.memoizedProps,s=i.id,l=i.onPostCommit;typeof l==="function"&&l(s,t.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(c){Yt(t,t.return,c)}}else ei(e,t,n,o);break;case 31:ei(e,t,n,o);break;case 13:ei(e,t,n,o);break;case 23:break;case 22:i=t.stateNode,s=t.alternate,t.memoizedState!==null?(r&&s!==null&&s.memoizedState===null&&Py(s),i._visibility&2?ei(e,t,n,o):yh(e,t)):(r&&s!==null&&s.memoizedState!==null&&Py(t),i._visibility&2?ei(e,t,n,o):(i._visibility|=2,xf(e,t,n,o,(t.subtreeFlags&10256)!==0||!1))),a&2048&&gN(s,t);break;case 24:ei(e,t,n,o),a&2048&&hN(t.alternate,t);break;case 30:r&&(a=t.alternate,a!==null&&(Os(a.child,!0),Os(t.child,!0))),ei(e,t,n,o);break;default:ei(e,t,n,o)}}function xf(e,t,n,o,r){r=r&&((t.subtreeFlags&10256)!==0||!1);for(t=t.child;t!==null;){var a=e,i=t,s=n,l=o,c=i.flags;switch(i.tag){case 0:case 11:case 15:xf(a,i,s,l,r),qh(8,i);break;case 23:break;case 22:var d=i.stateNode;i.memoizedState!==null?d._visibility&2?xf(a,i,s,l,r):yh(a,i):(d._visibility|=2,xf(a,i,s,l,r)),r&&c&2048&&gN(i.alternate,i);break;case 24:xf(a,i,s,l,r),r&&c&2048&&hN(i.alternate,i);break;default:xf(a,i,s,l,r)}t=t.sibling}}function yh(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,o=t,r=o.flags;switch(o.tag){case 22:yh(n,o),r&2048&&gN(o.alternate,o);break;case 24:yh(n,o),r&2048&&hN(o.alternate,o);break;default:yh(n,o)}t=t.sibling}}var yd=8192;function gd(e,t,n){if(e.subtreeFlags&yd)for(e=e.child;e!==null;)Z3(e,t,n),e=e.sibling}function Z3(e,t,n){switch(e.tag){case 26:gd(e,t,n),e.flags&yd&&(e.memoizedState!==null?$J(n,Ui,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&L4(n,e)));break;case 5:gd(e,t,n),e.flags&yd&&(e=e.stateNode,(t&335544128)===t&&L4(n,e));break;case 3:case 4:var o=Ui;Ui=_h(e.stateNode.containerInfo),gd(e,t,n),Ui=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=yd,yd=16777216,gd(e,t,n),yd=o):gd(e,t,n));break;case 30:if((e.flags&yd)!==0&&(o=e.memoizedProps.name,o!=null&&o!=="auto")){var r=e.stateNode;r.paired=null,Ea===null&&(Ea=new Map),Ea.set(o,r)}gd(e,t,n);break;default:gd(e,t,n)}}function J3(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zg(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var o=t[n];$o=o,tO(o,e)}J3(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)eO(e),e=e.sibling}function eO(e){switch(e.tag){case 0:case 11:case 15:Zg(e),e.flags&2048&&ou(9,e,e.return);break;case 3:Zg(e);break;case 12:Zg(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Oy(e)):Zg(e);break;default:Zg(e)}}function Oy(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var o=t[n];$o=o,tO(o,e)}J3(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ou(8,t,t.return),Oy(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Oy(t));break;default:Oy(t)}e=e.sibling}}function tO(e,t){for(;$o!==null;){var n=$o;switch(n.tag){case 0:case 11:case 15:ou(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var o=n.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Vh(n.memoizedState.cache)}if(o=n.child,o!==null)o.return=n,$o=o;else e:for(n=e;$o!==null;){o=$o;var r=o.sibling,a=o.return;if(V3(o),o===n){$o=null;break e}if(r!==null){r.return=a,$o=r;break e}$o=a}}}var VZ={getCacheForType:function(e){var t=br(so),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return br(so).controller.signal}},KZ=typeof WeakMap==="function"?WeakMap:Map,At=0,rn=null,it=null,ct=0,qt=0,Na=null,Uc=!1,lm=!1,bN=!1,Rl=0,qn=0,ru=0,Rd=0,sx=0,Aa=0,Wf=0,xh=null,ia=null,c2=!1,Ax=0,nO=0,lx=1/0,cx=null,Xc=null,Dn=0,Fi=null,_d=null,Ps=0,u2=0,d2=null,oO=null,Gf=null,Ff=null,Vf=null,wh=0,_y=null;function Oa(){return(At&2)!==0&&ct!==0?ct&-ct:Be.T!==null?yN():sP()}function rO(){if(Aa===0)if((ct&536870912)===0||et){var e=ay;ay<<=1,(ay&3932160)===0&&(ay=262144),Aa=e}else Aa=536870912;return e=wr.current,e!==null&&(e.flags|=32),Aa}function Xf(e,t){if(t!=null){var n=e.stateNode,o=n.ref;o===null&&(o=n.ref=NO(kl(e.memoizedProps,n))),Ff===null&&(Ff=[]),Ff.push(t.bind(null,o))}}function ca(e,t,n){if(e===rn&&(qt===2||qt===9)||e.cancelPendingCommit!==null)Qf(e,0),Gc(e,ct,Aa,!1);if(Uh(e,n),(At&2)===0||e!==rn)e===rn&&((At&2)===0&&(Rd|=n),qn===4&&Gc(e,ct,Aa,!1)),zs(e)}function aO(e,t,n){if((At&6)!==0)throw Error(U(327));var o=!n&&(t&127)===0&&(t&e.expiredLanes)===0||jh(e,t),r=o?YZ(e,t):cC(e,t,!0),a=o;do{if(r===0){lm&&!o&&Gc(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!qZ(n)){r=cC(e,t,!1),a=!1;continue}if(r===2){if(a=t,e.errorRecoveryDisabledLanes&a)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var s=e;r=xh;var l=s.current.memoizedState.isDehydrated;if(l&&(Qf(s,i).flags|=256),i=cC(s,i,!1),i!==2&&i!==6){if(bN&&!l){s.errorRecoveryDisabledLanes|=a,Rd|=a,r=4;break e}a=ia,ia=r,a!==null&&(ia===null?ia=a:ia.push.apply(ia,a))}r=i}if(a=!1,r!==2)continue}}if(r===1){Qf(e,0),Gc(e,t,0,!0);break}e:{switch(o=e,a=r,a){case 0:case 1:throw Error(U(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Gc(o,t,Aa,!Uc);break e;case 2:ia=null;break;case 3:case 5:break;default:throw Error(U(329))}if((t&62914560)===t&&(r=Ax+300-Ma(),10<r)){if(Gc(o,t,Aa,!Uc),gx(o,0,!0)!==0)break e;Ps=t,o.timeoutHandle=wN(m4.bind(null,o,n,ia,cx,c2,t,Aa,Rd,Wf,Uc,a,"Throttled",-0,0),r);break e}m4(o,n,ia,cx,c2,t,Aa,Rd,Wf,Uc,a,null,-0,0)}}break}while(1);zs(e)}function m4(e,t,n,o,r,a,i,s,l,c,d,u,p,f){e.timeoutHandle=-1;var g=t.subtreeFlags,m=(a&335544064)===a;if(u=null,m||g&8192||(g&16785408)===16785408){if(u={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Es},Ea=null,Z3(t,a,u),m&&(g=u,m=e.containerInfo,m=(m.nodeType===9?m:m.ownerDocument).__reactViewTransition,m!=null&&(g.count++,g.waitingForViewTransition=!0,g=zh.bind(g),m.finished.then(g,g))),g=(a&62914560)===a?Ax-Ma():(a&4194048)===a?nO-Ma():0,g=YJ(u,g),g!==null){Ps=a,e.cancelPendingCommit=g(h4.bind(null,e,t,a,n,o,r,i,s,l,c,d,u,null,p,f)),Gc(e,a,i,!c);return}}h4(e,t,a,n,o,r,i,s,l,c,d,u)}function qZ(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var o=0;o<n.length;o++){var r=n[o],a=r.getSnapshot;r=r.value;try{if(!_a(a(),r))return!1}catch(i){return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gc(e,t,n,o){t=nP(e,t),t&=~sx,t&=~Rd,e.suspendedLanes|=t,e.pingedLanes&=~t,o&&(e.warmLanes|=t),o=e.expirationTimes;for(var r=t;0<r;){var a=31-Pa(r),i=1<<a;o[a]=-1,r&=~i}n!==0&&rP(e,n,t)}function Mx(){return(At&6)===0?($h(0,!1),!1):!0}function vN(){if(it!==null){if(qt===0)var e=it.return;else e=it,vl=Hd=null,tN(e),Hf=null,Eh=0,e=it;for(;e!==null;)O3(e.alternate,e),e=e.return;it=null}}function Qf(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,mJ(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ps=0,vN(),rn=e,it=n=yl(e.current,null),ct=t,qt=0,Na=null,Uc=!1,lm=jh(e,t),bN=!1,Wf=Aa=sx=Rd=ru=qn=0,ia=xh=null,c2=!1,Rl=nP(e,t),xx(),n}function iO(e,t){Qe=null,Be.H=tx,t===im||t===Sx?(t=UD(),qt=3):t===$2?(t=UD(),qt=4):qt=t===cN?8:t!==null&&typeof t==="object"&&typeof t.then==="function"?6:1,Na=t,it===null&&(qn=1,nx(e,ai(t,e.current)))}function sO(){var e=wr.current;return e===null?!0:(ct&4194048)===ct?_r===null?!0:!1:(ct&62914560)===ct||(ct&536870912)!==0?e===_r:!1}function lO(){var e=Be.H;return Be.H=tx,e===null?tx:e}function cO(){var e=Be.A;return Be.A=VZ,e}function ux(){qn=4,Uc||(ct&4194048)!==ct&&wr.current!==null||(lm=!0),(ru&134217727)===0&&(Rd&134217727)===0||rn===null||Gc(rn,ct,Aa,!1)}function cC(e,t,n){var o=At;At|=2;var r=lO(),a=cO();if(rn!==e||ct!==t)cx=null,Qf(e,t);t=!1;var i=qn;e:do try{if(qt!==0&&it!==null){var s=it,l=Na;switch(qt){case 8:vN(),i=6;break e;case 3:case 2:case 9:case 6:wr.current===null&&(t=!0);var c=qt;if(qt=0,Na=null,_f(e,s,l,c),n&&lm){i=0;break e}break;default:c=qt,qt=0,Na=null,_f(e,s,l,c)}}$Z(),i=qn;break}catch(d){iO(e,d)}while(1);return t&&e.shellSuspendCounter++,vl=Hd=null,At=o,Be.H=r,Be.A=a,it===null&&(rn=null,ct=0,xx()),i}function $Z(){for(;it!==null;)uO(it)}function YZ(e,t){var n=At;At|=2;var o=lO(),r=cO();rn!==e||ct!==t?(cx=null,lx=Ma()+500,Qf(e,t)):lm=jh(e,t);e:do try{if(qt!==0&&it!==null){t=it;var a=Na;t:switch(qt){case 1:qt=0,Na=null,_f(e,t,a,1);break;case 2:case 9:if(jD(a)){qt=0,Na=null,g4(t);break}t=function(){qt!==2&&qt!==9||rn!==e||(qt=7),zs(e)},a.then(t,t);break e;case 3:qt=7;break e;case 4:qt=5;break e;case 7:jD(a)?(qt=0,Na=null,g4(t)):(qt=0,Na=null,_f(e,t,a,7));break;case 5:var i=null;switch(it.tag){case 26:i=it.memoizedState;case 5:case 27:var s=it;if(i?zO(i):s.stateNode.complete){qt=0,Na=null;var l=s.sibling;if(l!==null)it=l;else{var c=s.return;c!==null?(it=c,Dx(c)):it=null}break t}}qt=0,Na=null,_f(e,t,a,5);break;case 6:qt=0,Na=null,_f(e,t,a,6);break;case 8:vN(),qn=6;break e;default:throw Error(U(462))}}WZ();break}catch(d){iO(e,d)}while(1);if(vl=Hd=null,Be.H=o,Be.A=r,At=n,it!==null)return 0;return rn=null,ct=0,xx(),qn}function WZ(){for(;it!==null&&!pQ();)uO(it)}function uO(e){var t=P3(e.alternate,e,Rl);e.memoizedProps=e.pendingProps,t===null?Dx(e):it=t}function g4(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=o4(n,t,t.pendingProps,t.type,void 0,ct);break;case 11:t=o4(n,t,t.pendingProps,t.type.render,t.ref,ct);break;case 5:tN(t);var o=t;o===Wo&&(et?(Yy(o),o.tag===5&&o.stateNode!=null&&(pn=o.stateNode)):(Yy(o),et=!0));default:O3(n,t),t=it=_P(t,Rl),t=P3(n,t,Rl)}e.memoizedProps=e.pendingProps,t===null?Dx(e):it=t}function _f(e,t,n,o){vl=Hd=null,tN(t),Hf=null,Eh=0;var r=t.return;try{if(IZ(e,r,t,n,ct)){qn=1,nx(e,ai(n,e.current)),it=null;return}}catch(a){if(r!==null)throw it=r,a;qn=1,nx(e,ai(n,e.current)),it=null;return}if(t.flags&32768){if(et||o===1)e=!0;else if(lm||(ct&536870912)!==0)e=!1;else if(Uc=e=!0,o===2||o===9||o===3||o===6)o=wr.current,o!==null&&o.tag===13&&(o.flags|=16384);dO(t,e)}else Dx(t)}function Dx(e){var t=e;do{if((t.flags&32768)!==0){dO(t,Uc);return}e=t.return;var n=jZ(t.alternate,t,Rl);if(n!==null){it=n;return}if(t=t.sibling,t!==null){it=t;return}it=t=e}while(t!==null);qn===0&&(qn=5)}function dO(e,t){do{var n=UZ(e.alternate,e);if(n!==null){n.flags&=32767,it=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){it=e;return}it=e=n}while(e!==null);qn=6,it=null}function h4(e,t,n,o,r,a,i,s,l,c,d,u){e.cancelPendingCommit=null;do Px();while(Dn!==0);if((At&6)!==0)throw Error(U(327));if(t!==null){if(t===e.current)throw Error(U(177));e===rn&&(it=rn=null,ct=0),_d=t,Fi=e,Ps=n,d2=r,oO=o,XZ(e,t,n,i,s,l,u)}}function XZ(e,t,n,o,r,a,i){var s=t.lanes|t.childLanes;if(u2=s,s|=U2,kQ(e,n,s,o,r,a),Ff=null,(n&335544064)===n?(Vf=CZ(e),o=10262):(Vf=null,o=10256),(t.subtreeFlags&o)!==0||(t.flags&o)!==0?(e.callbackNode=null,e.callbackPriority=0,nJ(Fy,function(){return g2(),null})):(e.callbackNode=null,e.callbackPriority=0),ax=!1,o=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||o){o=Be.T,Be.T=null,r=Mt.p,Mt.p=2,a=At,At|=4;try{GZ(e,t,n)}finally{At=a,Mt.p=r,Be.T=o}}Dn=1,ax?Gf=xJ(i,e.containerInfo,Vf,p2,f2,ZZ,m2,g2,QZ,null,null):(p2(),f2(),m2())}function QZ(e){if(Dn!==0){var t=Fi.onRecoverableError;t(e,{componentStack:null})}}function ZZ(){Dn===3&&(Dn=0,X3(_d,Fi),Dn=4)}function p2(){if(Dn===1){Dn=0;var e=Fi,t=_d,n=Ps,o=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||o){o=Be.T,Be.T=null;var r=Mt.p;Mt.p=2;var a=At;At|=4;try{ih=ix=!1,Y3(t,e,n),n=w2;var i=RP(e.containerInfo),s=n.focusedElem,l=n.selectionRange;if(i!==s&&s&&s.ownerDocument&&NP(s.ownerDocument.documentElement,s)){if(l!==null&&j2(s)){var{start:c,end:d}=l;if(d===void 0&&(d=c),"selectionStart"in s)s.selectionStart=c,s.selectionEnd=Math.min(d,s.value.length);else{var u=s.ownerDocument||document,p=u&&u.defaultView||window;if(p.getSelection){var f=p.getSelection(),g=s.textContent.length,m=Math.min(l.start,g),y=l.end===void 0?m:Math.min(l.end,g);!f.extend&&m>y&&(i=y,y=m,m=i);var b=PD(s,m),x=PD(s,y);if(b&&x&&(f.rangeCount!==1||f.anchorNode!==b.node||f.anchorOffset!==b.offset||f.focusNode!==x.node||f.focusOffset!==x.offset)){var v=u.createRange();v.setStart(b.node,b.offset),f.removeAllRanges(),m>y?(f.addRange(v),f.extend(x.node,x.offset)):(v.setEnd(x.node,x.offset),f.addRange(v))}}}}u=[];for(f=s;f=f.parentNode;)f.nodeType===1&&u.push({element:f,left:f.scrollLeft,top:f.scrollTop});typeof s.focus==="function"&&s.focus();for(s=0;s<u.length;s++){var k=u[s];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}nm=!!x2,w2=x2=null}finally{At=a,Mt.p=r,Be.T=o}}e.current=t,Dn=2}}function f2(){if(Dn===2){Dn=0;var e=Fi,t=_d,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=Be.T,Be.T=null;var o=Mt.p;Mt.p=2;var r=At;At|=4;try{G3(e,t.alternate,t)}finally{At=r,Mt.p=o,Be.T=n}}Dn=3}}function m2(){if(Dn===4||Dn===3){Dn=0;var e=Gf;Gf=null,fQ();var t=Fi,n=_d,o=Ps,r=oO,a=(o&335544064)===o?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Dn=5:(Dn=0,_d=Fi=null,pO(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Xc=null),_2(o),n=n.stateNode,Da&&typeof Da.onCommitFiberRoot==="function")try{Da.onCommitFiberRoot(Hh,n,void 0,(n.current.flags&128)===128)}catch(c){}if(r!==null){n=Be.T,a=Mt.p,Mt.p=2,Be.T=null;try{for(var i=t.onRecoverableError,s=0;s<r.length;s++){var l=r[s];i(l.value,{componentStack:l.stack})}}finally{Be.T=n,Mt.p=a}}if(r=Ff,i=Vf,Vf=null,r!==null&&(Ff=null,i===null&&(i=[]),e!==null))for(l=0;l<r.length;l++)n=(0,r[l])(i),n!==void 0&&e.finished.finally(n);(Ps&3)!==0&&Px(),zs(t),a=t.pendingLanes,(o&261930)!==0&&(a&42)!==0?t===_y?wh++:(wh=0,_y=t):(wh=0,_y=null),$h(0,!1)}}function pO(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vh(t)))}function Px(){return Gf!==null&&(Gf.skipTransition(),Gf=null),p2(),f2(),m2(),g2()}function g2(){if(Dn!==5)return!1;var e=Fi,t=u2;u2=0;var n=_2(Ps),o=Be.T,r=Mt.p;try{Mt.p=32>n?32:n,Be.T=null,n=d2,d2=null;var a=Fi,i=Ps;if(Dn=0,_d=Fi=null,Ps=0,(At&6)!==0)throw Error(U(331));var s=At;if(At|=4,eO(a.current),Q3(a,a.current,i,n),At=s,$h(0,!1),Da&&typeof Da.onPostCommitFiberRoot==="function")try{Da.onPostCommitFiberRoot(Hh,a)}catch(l){}return!0}finally{Mt.p=r,Be.T=o,pO(e,t)}}function b4(e,t,n){t=ai(n,t),t=YC(e.stateNode,t,2),e=$c(e,t,2),e!==null&&(Uh(e,2),zs(e))}function Yt(e,t,n){if(e.tag===3)b4(e,e,n);else for(;t!==null;){if(t.tag===3){b4(t,e,n);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError==="function"||typeof o.componentDidCatch==="function"&&(Xc===null||!Xc.has(o))){e=ai(n,e),n=T3(2),o=$c(t,n,2),o!==null&&(E3(n,o,t,e),Uh(o,2),zs(o));break}}t=t.return}}function uC(e,t,n){var o=e.pingCache;if(o===null){o=e.pingCache=new KZ;var r=new Set;o.set(t,r)}else r=o.get(t),r===void 0&&(r=new Set,o.set(t,r));r.has(n)||(bN=!0,r.add(n),e=JZ.bind(null,e,t,n),t.then(e,e))}function JZ(e,t,n){var o=e.pingCache;o!==null&&o.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,rn===e&&(ct&n)===n&&(qn===4||qn===3&&(ct&62914560)===ct&&300>Ma()-Ax?(At&2)===0?Qf(e,0):sx|=n:sx|=n,Wf===ct&&(Wf=0)),zs(e)}function fO(e,t){t===0&&(t=oP()),e=Bd(e,t),e!==null&&(Uh(e,t),zs(e))}function eJ(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fO(e,n)}function tJ(e,t){var n=0;switch(e.tag){case 31:case 13:var{stateNode:o,memoizedState:r}=e;r!==null&&(n=r.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(U(314))}o!==null&&o.delete(t),fO(e,n)}function nJ(e,t){return P2(e,t)}var Zf=null,wf=null,h2=!1,dx=!1,dC=!1,Fc=0;function zs(e){e!==wf&&e.next===null&&(wf===null?Zf=wf=e:wf=wf.next=e),dx=!0,h2||(h2=!0,rJ())}function $h(e,t){if(!dC&&dx){dC=!0;do{var n=!1;for(var o=Zf;o!==null;){if(!t)if(e!==0){var r=o.pendingLanes;if(r===0)var a=0;else{var i=o.suspendedLanes,s=o.pingedLanes;a=(1<<31-Pa(42|e)+1)-1,a&=r&~(i&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,v4(o,a))}else a=ct,a=gx(o,o===rn?a:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(a&3)===0||jh(o,a)||(n=!0,v4(o,a));o=o.next}}while(n);dC=!1}}function oJ(){mO()}function mO(){dx=h2=!1;var e=0;Fc!==0&&fJ()&&(e=Fc);for(var t=Ma(),n=null,o=Zf;o!==null;){var r=o.next,a=gO(o,t);if(a===0)o.next=null,n===null?Zf=r:n.next=r,r===null&&(wf=n);else if(n=o,e!==0||(a&3)!==0)dx=!0;o=r}Dn!==0&&Dn!==5||$h(e,!1),Fc!==0&&(Fc=0)}function gO(e,t){for(var{suspendedLanes:n,pingedLanes:o,expirationTimes:r}=e,a=e.pendingLanes&-62914561;0<a;){var i=31-Pa(a),s=1<<i,l=r[i];if(l===-1){if((s&n)===0||(s&o)!==0)r[i]=wQ(s,t)}else l<=t&&(e.expiredLanes|=s);a&=~s}if(t=rn,n=ct,n=gx(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,n===0||e===t&&(qt===2||qt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&VS(o),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||jh(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(o!==null&&VS(o),_2(n)){case 2:case 8:n=eP;break;case 32:n=Fy;break;case 268435456:n=tP;break;default:n=Fy}return o=hO.bind(null,e),n=P2(n,o),e.callbackPriority=t,e.callbackNode=n,t}return o!==null&&o!==null&&VS(o),e.callbackPriority=2,e.callbackNode=null,2}function hO(e,t){if(Dn!==0&&Dn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Px()&&e.callbackNode!==n)return null;var o=ct;if(o=gx(e,e===rn?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0)return null;return aO(e,o,t),gO(e,Ma()),e.callbackNode!=null&&e.callbackNode===n?hO.bind(null,e):null}function v4(e,t){if(Px())return null;aO(e,t,!0)}function rJ(){gJ(function(){(At&6)!==0?P2(J4,oJ):mO()})}function yN(){if(Fc===0){var e=Md;e===0&&(e=ry,ry<<=1,(ry&261888)===0&&(ry=256)),Fc=e}return Fc}function y4(e){return e==null||typeof e==="symbol"||typeof e==="boolean"?null:typeof e==="function"?e:wy(e)}function aJ(e,t,n,o,r){if(t==="submit"&&n&&n.stateNode===r){var a=y4((r[da]||null).action),i=o.submitter;i&&(t=(t=i[da]||null)?y4(t.formAction):i.getAttribute("formAction"),t!==null&&(a=t,i=null));var s=new bx("action","action",null,o,r);e.push({event:s,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Fc!==0){var l=new FormData(r,i);qC(n,{pending:!0,data:l,method:r.method,action:a},null,l)}}else typeof a==="function"&&(s.preventDefault(),l=new FormData(r,i),qC(n,{pending:!0,data:l,method:r.method,action:a},a,l))},currentTarget:r}]})}}for(sh=0;sh<zC.length;sh++)lh=zC[sh],b2=lh.toLowerCase(),v2=lh[0].toUpperCase()+lh.slice(1),Vi(b2,"on"+v2);var lh,b2,v2,sh;Vi(EP,"onAnimationEnd");Vi(AP,"onAnimationIteration");Vi(MP,"onAnimationStart");Vi("dblclick","onDoubleClick");Vi("focusin","onFocus");Vi("focusout","onBlur");Vi(hZ,"onTransitionRun");Vi(bZ,"onTransitionStart");Vi(vZ,"onTransitionCancel");Vi(DP,"onTransitionEnd");qf("onMouseEnter",["mouseout","mouseover"]);qf("onMouseLeave",["mouseout","mouseover"]);qf("onPointerEnter",["pointerout","pointerover"]);qf("onPointerLeave",["pointerout","pointerover"]);Id("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Id("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Id("onBeforeInput",["compositionend","keypress","textInput","paste"]);Id("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Id("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Id("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dh="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),iJ=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dh));function bO(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var o=e[n],r=o.event;o=o.listeners;e:{var a=void 0;if(t)for(var i=o.length-1;0<=i;i--){var s=o[i],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==a&&r.isPropagationStopped())break e;a=s,r.currentTarget=c;try{a(r)}catch(d){Ky(d)}r.currentTarget=null,a=l}else for(i=0;i<o.length;i++){if(s=o[i],l=s.instance,c=s.currentTarget,s=s.listener,l!==a&&r.isPropagationStopped())break e;a=s,r.currentTarget=c;try{a(r)}catch(d){Ky(d)}r.currentTarget=null,a=l}}}}function at(e,t){var n=t[gD];n===void 0&&(n=t[gD]=new Set);var o=e+"__bubble";n.has(o)||(vO(t,e,2,!1),n.add(o))}function pC(e,t,n){var o=0;t&&(o|=4),vO(n,e,o,t)}var by="_reactListening"+Math.random().toString(36).slice(2);function xN(e){if(!e[by]){e[by]=!0,cP.forEach(function(n){n!=="selectionchange"&&(iJ.has(n)||pC(n,!1,e),pC(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[by]||(t[by]=!0,pC("selectionchange",!1,t))}}function vO(e,t,n,o){switch(GO(t)){case 2:var r=ZJ;break;case 8:r=JJ;break;default:r=TN}n=r.bind(null,t,n,e),r=void 0,!DC||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),o?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function fC(e,t,n,o,r){var a=o;if((t&1)===0&&(t&2)===0&&o!==null)e:for(;;){if(o===null)return;var i=o.tag;if(i===3||i===4){var s=o.stateNode.containerInfo;if(s===r)break;if(i===4)for(i=o.return;i!==null;){var l=i.tag;if((l===3||l===4)&&i.stateNode.containerInfo===r)return;i=i.return}for(;s!==null;){if(i=xd(s),i===null)return;if(l=i.tag,l===5||l===6||l===26||l===27){o=a=i;continue e}s=s.parentNode}}o=o.return}bP(function(){var c=a,d=I2(n),u=[];e:{var p=PP.get(e);if(p!==void 0){var f=bx,g=e;switch(e){case"keypress":if(Sy(n)===0)break e;case"keydown":case"keyup":f=qQ;break;case"focusin":g="focus",f=XS;break;case"focusout":g="blur",f=XS;break;case"beforeblur":case"afterblur":f=XS;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=SD;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=_Q;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=QQ;break;case EP:case AP:case MP:f=LQ;break;case DP:f=JQ;break;case"scroll":case"scrollend":f=PQ;break;case"wheel":f=tZ;break;case"copy":case"cut":case"paste":f=HQ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=ND;break;case"submit":f=WQ;break;case"toggle":case"beforetoggle":f=oZ}var m=(t&4)!==0,y=!m&&(e==="scroll"||e==="scrollend"),b=m?p!==null?p+"Capture":null:p;m=[];for(var x=c,v;x!==null;){var k=x;if(v=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||v===null||b===null||(k=Sh(x,b),k!=null&&m.push(Ph(x,k,v))),y)break;x=x.return}0<m.length&&(p=new f(p,g,null,n,d),u.push({event:p,listeners:m}))}}if((t&7)===0){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&n!==MC&&(g=n.relatedTarget||n.fromElement)&&(xd(g)||g[rm]))break e;if(p||f){if(g=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p){if(f=n.relatedTarget||n.toElement,p=c,f=f?xd(f):null,f!==null&&(y=Bh(f),m=f.tag,f!==y||m!==5&&m!==27&&m!==6))f=null}else p=null,f=c;if(p!==f){if(m=SD,k="onMouseLeave",b="onMouseEnter",x="mouse",e==="pointerout"||e==="pointerover")m=ND,k="onPointerLeave",b="onPointerEnter",x="pointer";y=p==null?g:nh(p),v=f==null?g:nh(f),g=new m(k,x+"leave",p,n,d),g.target=y,g.relatedTarget=v,k=null,xd(d)===c&&(m=new m(b,x+"enter",f,n,d),m.target=v,m.relatedTarget=y,k=m),y=k,m=p&&f?vC(p,f,sJ):null,p!==null&&x4(u,g,p,m,!1),f!==null&&y!==null&&x4(u,y,f,m,!0)}}}e:{if(p=c?nh(c):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var S=AD;else if(ED(p))if(SP)S=fZ;else{S=dZ;var N=uZ}else f=p.nodeName,!f||f.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?c&&z2(c.elementType)&&(S=AD):S=pZ;if(S&&(S=S(e,c))){kP(u,S,n,d);break e}N&&N(e,p,c)}switch(N=c?nh(c):window,e){case"focusin":if(ED(N)||N.contentEditable==="true")Ef=N,OC=c,dh=null;break;case"focusout":dh=OC=Ef=null;break;case"mousedown":_C=!0;break;case"contextmenu":case"mouseup":case"dragend":_C=!1,OD(u,n,d);break;case"selectionchange":if(gZ)break;case"keydown":case"keyup":OD(u,n,d)}var R;if(H2)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Tf?xP(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");if(A&&(yP&&n.locale!=="ko"&&(Tf||A!=="onCompositionStart"?A==="onCompositionEnd"&&Tf&&(R=vP()):(Hc=d,L2=("value"in Hc)?Hc.value:Hc.textContent,Tf=!0)),N=px(c,A),0<N.length&&(A=new CD(A,e,null,n,d),u.push({event:A,listeners:N}),R?A.data=R:(R=wP(n),R!==null&&(A.data=R)))),R=aZ?iZ(e,n):sZ(e,n))A=px(c,"onBeforeInput"),0<A.length&&(N=new CD("onBeforeInput","beforeinput",null,n,d),u.push({event:N,listeners:A}),N.data=R);aJ(u,e,c,n,d)}bO(u,t)})}function Ph(e,t,n){return{instance:e,listener:t,currentTarget:n}}function px(e,t){for(var n=t+"Capture",o=[];e!==null;){var r=e,a=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||a===null||(r=Sh(e,n),r!=null&&o.unshift(Ph(e,r,a)),r=Sh(e,t),r!=null&&o.push(Ph(e,r,a))),e.tag===3)return o;e=e.return}return[]}function sJ(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e?e:null}function x4(e,t,n,o,r){for(var a=t._reactName,i=[];n!==null&&n!==o;){var s=n,l=s.alternate,c=s.stateNode;if(s=s.tag,l!==null&&l===o)break;s!==5&&s!==26&&s!==27||c===null||(l=c,r?(c=Sh(n,a),c!=null&&i.unshift(Ph(n,c,l))):r||(c=Sh(n,a),c!=null&&i.push(Ph(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var lJ=/\r\n?/g,cJ=/\u0000|\uFFFD/g;function w4(e){return(typeof e==="string"?e:""+e).replace(lJ,`
10
+ `).replace(cJ,"")}function yO(e,t){return t=w4(t),w4(e)===t?!0:!1}function $t(e,t,n,o,r,a){switch(n){case"children":if(typeof o==="string")t==="body"||t==="textarea"&&o===""||$f(e,o);else if(typeof o==="number"||typeof o==="bigint")t!=="body"&&$f(e,""+o);else return;break;case"className":sy(e,"class",o);break;case"tabIndex":sy(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":sy(e,n,o);break;case"style":hP(e,o,a);return;case"data":if(t!=="object"){sy(e,"data",o);break}case"src":case"href":if(o===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(o==null||typeof o==="function"||typeof o==="symbol"||typeof o==="boolean"){e.removeAttribute(n);break}o=wy(o),e.setAttribute(n,o);break;case"action":case"formAction":if(typeof o==="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof a==="function"&&(n==="formAction"?(t!=="input"&&$t(e,t,"name",r.name,r,null),$t(e,t,"formEncType",r.formEncType,r,null),$t(e,t,"formMethod",r.formMethod,r,null),$t(e,t,"formTarget",r.formTarget,r,null)):($t(e,t,"encType",r.encType,r,null),$t(e,t,"method",r.method,r,null),$t(e,t,"target",r.target,r,null)));if(o==null||typeof o==="symbol"||typeof o==="boolean"){e.removeAttribute(n);break}o=wy(o),e.setAttribute(n,o);break;case"onClick":o!=null&&(e.onclick=Es);return;case"onScroll":o!=null&&at("scroll",e);return;case"onScrollEnd":o!=null&&at("scrollend",e);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!=="object"||!("__html"in o))throw Error(U(61));if(n=o.__html,n!=null){if(r.children!=null)throw Error(U(60));(a!=null?a.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=o&&typeof o!=="function"&&typeof o!=="symbol";break;case"muted":e.muted=o&&typeof o!=="function"&&typeof o!=="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o==="function"||typeof o==="boolean"||typeof o==="symbol"){e.removeAttribute("xlink:href");break}n=wy(o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!=="function"&&typeof o!=="symbol"?e.setAttribute(n,o):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!=="function"&&typeof o!=="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":o===!0?e.setAttribute(n,""):o!==!1&&o!=null&&typeof o!=="function"&&typeof o!=="symbol"?e.setAttribute(n,o):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!=="function"&&typeof o!=="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(n,o):e.removeAttribute(n);break;case"rowSpan":case"start":o==null||typeof o==="function"||typeof o==="symbol"||isNaN(o)?e.removeAttribute(n):e.setAttribute(n,o);break;case"popover":at("beforetoggle",e),at("toggle",e),xy(e,"popover",o);break;case"xlinkActuate":gl(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":gl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":gl(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":gl(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":gl(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":gl(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":gl(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":gl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":gl(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":xy(e,"is",o);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=MQ.get(n)||n,xy(e,n,o);else return}Ct=!0}function y2(e,t,n,o,r,a){switch(n){case"style":hP(e,o,a);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!=="object"||!("__html"in o))throw Error(U(61));if(n=o.__html,n!=null){if(r.children!=null)throw Error(U(60));(a!=null?a.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof o==="string")$f(e,o);else if(typeof o==="number"||typeof o==="bigint")$f(e,""+o);else return;break;case"onScroll":o!=null&&at("scroll",e);return;case"onScrollEnd":o!=null&&at("scrollend",e);return;case"onClick":o!=null&&(e.onclick=Es);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!uP.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),a=n.slice(2,r?n.length-7:void 0),t=e[da]||null,t=t!=null?t[n]:null,typeof t==="function"&&e.removeEventListener(a,t,r),typeof o==="function")){typeof t!=="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,o,r);break e}Ct=!0,n in e?e[n]=o:o===!0?e.setAttribute(n,""):xy(e,n,o)}return}Ct=!0}function xr(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",e),at("load",e);var o=!1,r=!1,a;for(a in n)if(n.hasOwnProperty(a)){var i=n[a];if(i!=null)switch(a){case"src":o=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(U(137,t));default:$t(e,t,a,i,n,null)}}r&&$t(e,t,"srcSet",n.srcSet,n,null),o&&$t(e,t,"src",n.src,n,null);return;case"input":at("invalid",e);var s=a=i=r=null,l=null,c=null;for(o in n)if(n.hasOwnProperty(o)){var d=n[o];if(d!=null)switch(o){case"name":r=d;break;case"type":i=d;break;case"checked":l=d;break;case"defaultChecked":c=d;break;case"value":a=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(U(137,t));break;default:$t(e,t,o,d,n,null)}}fP(e,a,s,l,c,i,r,!1);return;case"select":at("invalid",e),o=i=a=null;for(r in n)if(n.hasOwnProperty(r)&&(s=n[r],s!=null))switch(r){case"value":a=s;break;case"defaultValue":i=s;break;case"multiple":o=s;default:$t(e,t,r,s,n,null)}t=a,n=i,e.multiple=!!o,t!=null?If(e,!!o,t,!1):n!=null&&If(e,!!o,n,!0);return;case"textarea":at("invalid",e),a=r=o=null;for(i in n)if(n.hasOwnProperty(i)&&(s=n[i],s!=null))switch(i){case"value":o=s;break;case"defaultValue":r=s;break;case"children":a=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(U(91));break;default:$t(e,t,i,s,n,null)}gP(e,o,r,a);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(o=n[l],o!=null))switch(l){case"selected":e.selected=o&&typeof o!=="function"&&typeof o!=="symbol";break;default:$t(e,t,l,o,n,null)}return;case"dialog":at("beforetoggle",e),at("toggle",e),at("cancel",e),at("close",e);break;case"iframe":case"object":at("load",e);break;case"video":case"audio":for(o=0;o<Dh.length;o++)at(Dh[o],e);break;case"image":at("error",e),at("load",e);break;case"details":at("toggle",e);break;case"embed":case"source":case"link":at("error",e),at("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(o=n[c],o!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(U(137,t));default:$t(e,t,c,o,n,null)}return;default:if(z2(t)){for(d in n)n.hasOwnProperty(d)&&(o=n[d],o!==void 0&&y2(e,t,d,o,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(o=n[s],o!=null&&$t(e,t,s,o,n,null))}var uJ={};function dJ(e,t,n,o){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,a=null,i=null,s=null,l=null,c=null,d=null;for(f in n){var u=n[f];if(n.hasOwnProperty(f)&&u!=null)switch(f){case"checked":break;case"value":break;case"defaultValue":l=u;default:o.hasOwnProperty(f)||$t(e,t,f,null,o,u)}}for(var p in o){var f=o[p];if(u=n[p],o.hasOwnProperty(p)&&(f!=null||u!=null))switch(p){case"type":f!==u&&(Ct=!0),a=f;break;case"name":f!==u&&(Ct=!0),r=f;break;case"checked":f!==u&&(Ct=!0),c=f;break;case"defaultChecked":f!==u&&(Ct=!0),d=f;break;case"value":f!==u&&(Ct=!0),i=f;break;case"defaultValue":f!==u&&(Ct=!0),s=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(U(137,t));break;default:f!==u&&$t(e,t,p,f,o,u)}}AC(e,i,s,l,c,d,a,r);return;case"select":f=i=s=p=null;for(a in n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case"value":break;case"multiple":f=l;default:o.hasOwnProperty(a)||$t(e,t,a,null,o,l)}for(r in o)if(a=o[r],l=n[r],o.hasOwnProperty(r)&&(a!=null||l!=null))switch(r){case"value":a!==l&&(Ct=!0),p=a;break;case"defaultValue":a!==l&&(Ct=!0),s=a;break;case"multiple":a!==l&&(Ct=!0),i=a;default:a!==l&&$t(e,t,r,a,o,l)}t=s,n=i,o=f,p!=null?If(e,!!n,p,!1):!!o!==!!n&&(t!=null?If(e,!!n,t,!0):If(e,!!n,n?[]:"",!1));return;case"textarea":f=p=null;for(s in n)if(r=n[s],n.hasOwnProperty(s)&&r!=null&&!o.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:$t(e,t,s,null,o,r)}for(i in o)if(r=o[i],a=n[i],o.hasOwnProperty(i)&&(r!=null||a!=null))switch(i){case"value":r!==a&&(Ct=!0),p=r;break;case"defaultValue":r!==a&&(Ct=!0),f=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(U(91));break;default:r!==a&&$t(e,t,i,r,o,a)}mP(e,p,f);return;case"option":for(var g in n)if(p=n[g],n.hasOwnProperty(g)&&p!=null&&!o.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:$t(e,t,g,null,o,p)}for(l in o)if(p=o[l],f=n[l],o.hasOwnProperty(l)&&p!==f&&(p!=null||f!=null))switch(l){case"selected":p!==f&&(Ct=!0),e.selected=p&&typeof p!=="function"&&typeof p!=="symbol";break;default:$t(e,t,l,p,o,f)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var m in n)p=n[m],n.hasOwnProperty(m)&&p!=null&&!o.hasOwnProperty(m)&&$t(e,t,m,null,o,p);for(c in o)if(p=o[c],f=n[c],o.hasOwnProperty(c)&&p!==f&&(p!=null||f!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(U(137,t));break;default:$t(e,t,c,p,o,f)}return;default:if(z2(t)){for(var y in n)p=n[y],n.hasOwnProperty(y)&&p!==void 0&&!o.hasOwnProperty(y)&&y2(e,t,y,void 0,o,p);for(d in o)p=o[d],f=n[d],!o.hasOwnProperty(d)||p===f||p===void 0&&f===void 0||y2(e,t,d,p,o,f);return}}for(var b in n)p=n[b],n.hasOwnProperty(b)&&p!=null&&!o.hasOwnProperty(b)&&$t(e,t,b,null,o,p);for(u in o)p=o[u],f=n[u],!o.hasOwnProperty(u)||p===f||p==null&&f==null||$t(e,t,u,p,o,f)}function k4(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pJ(){if(typeof performance.getEntriesByType==="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),o=0;o<n.length;o++){var r=n[o],{transferSize:a,initiatorType:i,duration:s}=r;if(a&&s&&k4(i)){i=0,s=r.responseEnd;for(o+=1;o<n.length;o++){var l=n[o],c=l.startTime;if(c>s)break;var d=l.transferSize,u=l.initiatorType;d&&k4(u)&&(l=l.responseEnd,i+=d*(l<s?1:(s-c)/(l-c)))}if(--o,t+=8*(a+i)/(r.duration/1000),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==="number")?e:5}var x2=null,w2=null;function Oh(e){return e.nodeType===9?e:e.ownerDocument}function S4(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function xO(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function wO(e,t,n,o){return n=Oh(n).createElement(e),n[hr]=o,n[da]=t,xr(n,e,t),Yo(n),n}function k2(e,t){return e==="textarea"||e==="noscript"||typeof t.children==="string"||typeof t.children==="number"||typeof t.children==="bigint"||typeof t.dangerouslySetInnerHTML==="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mC=null;function fJ(){var e=window.event;if(e&&e.type==="popstate"){if(e===mC)return!1;return mC=e,!0}return mC=null,!1}var wN=typeof setTimeout==="function"?setTimeout:void 0,mJ=typeof clearTimeout==="function"?clearTimeout:void 0,C4=typeof Promise==="function"?Promise:void 0,N4=typeof requestAnimationFrame==="function"?requestAnimationFrame:wN,gJ=typeof queueMicrotask==="function"?queueMicrotask:typeof C4<"u"?function(e){return C4.resolve(null).then(e).catch(hJ)}:wN;function hJ(e){setTimeout(function(){throw e})}function iu(e){return e==="head"}function R4(e,t){var n=t,o=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(o===0){e.removeChild(r),om(t);return}o--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")o++;else if(n==="html")hC(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,hC(n);for(var a=n.firstChild;a;){var i=a.nextSibling,s=a.nodeName;a[Gh]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&a.rel.toLowerCase()==="stylesheet"||n.removeChild(a),a=i}}else n==="body"&&hC(e.ownerDocument.body);n=r}while(n);om(t)}function T4(e,t){var n=e;e=0;do{var o=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),o&&o.nodeType===8)if(n=o.data,n==="/$")if(e===0)break;else e--;else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=o}while(n)}function kO(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var o=1;else for(var r=o=0;r<t.length;r++){var a=t[r];0<a.width&&0<a.height&&o++}o===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function SO(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n==="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n==="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n==="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n==="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t==="boolean"?"":t)))}function CO(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function S2(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return CO(t,n,e)}function bJ(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+20000,t.y+20000,t.width,t.height);var n=getComputedStyle(e);return CO(t,n,e)}function vJ(e){return e.documentElement.clientHeight}function yJ(e){this.addEventListener("load",e),this.addEventListener("error",e)}function xJ(e,t,n,o,r,a,i,s,l){var c=t.nodeType===9?t:t.ownerDocument;try{var d=c.startViewTransition({update:function(){var p=c.defaultView,f=p.navigation&&p.navigation.transition,g=c.fonts.status;o();var m=[];if(g==="loaded"&&(vJ(c),c.fonts.status==="loading"&&m.push(c.fonts.ready)),g=m.length,e!==null)for(var y=e.suspenseyImages,b=0,x=0;x<y.length;x++){var v=y[x];if(!v.complete){var k=v.getBoundingClientRect();if(0<k.bottom&&0<k.right&&k.top<p.innerHeight&&k.left<p.innerWidth){if(b+=IO(v),b>Ly){m.length=g;break}v=new Promise(yJ.bind(v)),m.push(v)}}}if(0<m.length)return p=Promise.race([Promise.all(m),new Promise(function(S){return setTimeout(S,500)})]).then(r,r),(f?Promise.allSettled([f.finished,p]):p).then(a,a);if(r(),f)return f.finished.then(a,a);a()},types:n});c.__reactViewTransition=d;var u=[];return d.ready.then(function(){for(var p=c.documentElement.getAnimations({subtree:!0}),f=0;f<p.length;f++){var g=p[f],m=g.effect,y=m.pseudoElement;if(y!=null&&y.startsWith("::view-transition")){u.push(g),g=m.getKeyframes();for(var b=y=void 0,x=!0,v=0;v<g.length;v++){var k=g[v],S=k.width;if(y===void 0)y=S;else if(y!==S){x=!1;break}if(S=k.height,b===void 0)b=S;else if(b!==S){x=!1;break}delete k.width,delete k.height,k.transform==="none"&&delete k.transform}x&&y!==void 0&&b!==void 0&&(m.setKeyframes(g),x=getComputedStyle(m.target,m.pseudoElement),x.width!==y||x.height!==b)&&(x=g[0],x.width=y,x.height=b,x=g[g.length-1],x.width=y,x.height=b,m.setKeyframes(g))}}i()},function(p){c.__reactViewTransition===d&&(c.__reactViewTransition=null);try{if(typeof p==="object"&&p!==null)switch(p.name){case"InvalidStateError":if(p.message==="View transition was skipped because document visibility state is hidden."||p.message==="Skipping view transition because document visibility state has become hidden."||p.message==="Skipping view transition because viewport size changed."||p.message==="Transition was aborted because of invalid state")p=null}p!==null&&l(p)}finally{o(),r(),i()}}),d.finished.finally(function(){for(var p=0;p<u.length;p++)u[p].cancel();c.__reactViewTransition===d&&(c.__reactViewTransition=null),s()}),d}catch(p){return o(),r(),i(),null}}function wd(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}wd.prototype.animate=function(e,t){return t=typeof t==="number"?{duration:t}:an({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};wd.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),o=[],r=0;r<n.length;r++){var a=n[r].effect;a!==null&&a.target===e&&a.pseudoElement===t&&o.push(n[r])}return o};wd.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function NO(e){return{name:e,group:new wd("group",e),imagePair:new wd("image-pair",e),old:new wd("old",e),new:new wd("new",e)}}function za(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}za.prototype.addEventListener=function(e,t,n){var o=null,r=null;if(n!=null&&typeof n!=="boolean"&&(o=n.signal||null,o!==null&&o.aborted))return;this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(RO(a,e,t,n)===-1){var i=this,s=t;n!=null&&typeof n!=="boolean"&&n.once===!0&&(s=function(l){i.removeEventListener(e,t,n),typeof t==="function"?t.call(this,l):t.handleEvent(l)}),o!==null&&(r=i.removeEventListener.bind(i,e,t,n),o.addEventListener("abort",r,{once:!0}),r=o.removeEventListener.bind(o,"abort",r)),o=Jf(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:r}),ua(this._fragmentFiber.child,!1,wJ,e,s,o)}this._eventListeners=a};function wJ(e,t,n,o){return Co(e).addEventListener(t,n,o),!1}za.prototype.removeEventListener=function(e,t,n){var o=this._eventListeners;if(o!==null&&(t=RO(o,e,t,n),t!==-1)){var r=o[t];n=r.attachedListener;var a=r.cleanup;r=Jf(r.optionsOrUseCapture),ua(this._fragmentFiber.child,!1,kJ,e,n,r),o.splice(t,1),a!==null&&a()}};function kJ(e,t,n,o){return Co(e).removeEventListener(t,n,o),!1}function Jf(e){return e!=null&&typeof e!=="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function E4(e){return e==null?"c=0":typeof e==="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function RO(e,t,n,o){if(e.length===0)return-1;o=E4(o);for(var r=0;r<e.length;r++){var a=e[r];if(a.type===t&&a.listener===n&&E4(a.optionsOrUseCapture)===o)return r}return-1}za.prototype.dispatchEvent=function(e){var t=zd(this._fragmentFiber);if(t===null)return!0;t=Co(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var o=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var r=0;r<n.length;r++){var a=n[r];o.addEventListener(a.type,a.attachedListener,Jf(a.optionsOrUseCapture))}if(t.appendChild(o),e=o.dispatchEvent(e),n)for(r=0;r<n.length;r++)a=n[r],o.removeEventListener(a.type,a.attachedListener,Jf(a.optionsOrUseCapture));return t.removeChild(o),e}return t.dispatchEvent(e)};za.prototype.focus=function(e){ua(this._fragmentFiber.child,!0,TO,e,void 0,void 0)};function TO(e,t){if(e.tag===6)return!1;return e=Co(e),_J(e,t)}za.prototype.focusLast=function(e){var t=[];ua(this._fragmentFiber.child,!0,kN,t,void 0,void 0);for(var n=t.length-1;0<=n&&!TO(t[n],e);n--);};function kN(e,t){return t.push(e),!1}za.prototype.blur=function(){var e=zd(this._fragmentFiber);e!==null&&(e=Co(e),e=Oh(e).activeElement,e!==null&&ua(this._fragmentFiber.child,!1,SJ,e,void 0,void 0))};function SJ(e,t){if(e.tag===6)return!1;return e=Co(e),e===t||e.contains(t)?(t.blur(),!0):!1}za.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),ua(this._fragmentFiber.child,!1,CJ,e,void 0,void 0)};function CJ(e,t){if(e.tag===6)return!1;return e=Co(e),t.observe(e),!1}za.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),ua(this._fragmentFiber.child,!1,NJ,e,void 0,void 0);for(var n=t=0;n<Gi.length;n++){var o=Gi[n];o.fragmentInstance===this&&o.observer===e?e.unobserve(o.instance):Gi[t++]=o}Gi.length=t}};function NJ(e,t){if(e.tag===6)return!1;return e=Co(e),t.unobserve(e),!1}var Gi=[],gC=!1;function RJ(e,t,n){Gi.push({fragmentInstance:e,observer:t,instance:n}),gC||(gC=!0,zJ(function(){gC=!1;var o=Gi;Gi=[];for(var r=0;r<o.length;r++){var a=o[r];a.observer.unobserve(a.instance)}}))}za.prototype.getClientRects=function(){var e=[];return ua(this._fragmentFiber.child,!1,TJ,e,void 0,void 0),e};function TJ(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=Co(e),t.push.apply(t,e.getClientRects());return!1}za.prototype.getRootNode=function(e){var t=zd(this._fragmentFiber);return t===null?this:Co(t).getRootNode(e)};za.prototype.compareDocumentPosition=function(e){var t=zd(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];ua(this._fragmentFiber.child,!1,kN,n,void 0,void 0);var o=Co(t);if(n.length===0){if(n=o,cD(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var r=o=n.compareDocumentPosition(e);return n===e?r=Node.DOCUMENT_POSITION_CONTAINS:o&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=W4(t)[1],n===null?r=Node.DOCUMENT_POSITION_PRECEDING:(e=Co(n).compareDocumentPosition(e),r=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),r|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=Co(n[0]),r=Co(n[n.length-1]);var a=cD(this._fragmentFiber)?t.parentElement:o;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;o=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY;var i=t.compareDocumentPosition(e),s=r.compareDocumentPosition(e),l=i&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=o&&a&&i&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=o&&t===e||a&&r===e||l||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&t===e||!a&&r===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:i,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||EJ(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function EJ(e,t,n,o,r){var a=xd(r);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)e:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break e}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=r.ownerDocument,r===a||r===a.documentElement||r===a.body;e:{a=t;for(t=zd(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break e}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=vC(n,a,uD),t===null?t=!1:(ua(t,!0,rQ,a,n),a=Sf,Sf=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===o)&&(t=vC(o,a,uD),t===null?t=!1:(ua(t,!0,aQ,a,o),a=Sf,bC=Sf=null,t=a!==null)),t):!1}function A4(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}za.prototype.scrollIntoView=function(e){if(typeof e==="object")throw Error(U(566));var t=[];ua(this._fragmentFiber.child,!1,kN,t,void 0,void 0);var n=e!==!1;if(t.length===0){var o=W4(this._fragmentFiber);if(o=n?o[1]||o[0]||zd(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){e=Co(o),A4(e,n);return}if(o=Co(o),o.nodeType!==9){if(o.nodeType===11){n="host"in o?o.host:null,n!==null&&n.scrollIntoView(e);return}o.scrollIntoView(e)}}for(o=n?t.length-1:0;o!==(n?-1:t.length);){var r=t[o];r.tag===6?(r=Co(r),A4(r,n)):Co(r).scrollIntoView(e),o+=n?-1:1}};function AJ(e,t){return e=Co(e),EO(e,t),!1}function EO(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function AO(e,t){var n=t._eventListeners;if(n!==null)for(var o=0;o<n.length;o++){var r=n[o];e.addEventListener(r.type,r.attachedListener,Jf(r.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(a){for(var i=0,s=0;s<Gi.length;s++){var l=Gi[s];if(l.fragmentInstance!==t||l.observer!==a||l.instance!==e)Gi[i++]=l}Gi.length=i,a.observe(e)}),EO(e,t))}function MJ(e,t){var n=t._eventListeners;if(n!==null)for(var o=0;o<n.length;o++){var r=n[o];e.removeEventListener(r.type,r.attachedListener,Jf(r.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(a){typeof a.rootMargin==="string"?RJ(t,a,e):a.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function C2(e){var t=e.firstChild;t&&t.nodeType===10&&(t=t.nextSibling);for(;t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":C2(n),hx(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function DJ(e,t,n,o){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(!o)if(t==="input"&&e.type==="hidden"){var a=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===a)return e}else return e;else if(!e[Gh])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(a=e.getAttribute("rel"),a==="stylesheet"&&e.hasAttribute("data-precedence"))break;else if(a!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(a=e.getAttribute("src"),(a!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&a&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}if(e=si(e.nextSibling),e===null)break}return null}function PJ(e,t,n){if(t==="")return null;for(;e.nodeType!==3;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n)return null;if(e=si(e.nextSibling),e===null)return null}return e}function MO(e,t){for(;e.nodeType!==8;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t)return null;if(e=si(e.nextSibling),e===null)return null}return e}function N2(e){return e.data==="$?"||e.data==="$~"}function SN(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function OJ(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var o=function(){t(),n.removeEventListener("DOMContentLoaded",o)};n.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function si(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var R2=null;function M4(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return si(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function D4(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function _J(e,t){function n(){o=!0}if(e.ownerDocument.activeElement===e)return!0;var o=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return o}function zJ(e){N4(function(){N4(function(t){return e(t)})})}function DO(e,t,n){switch(t=Oh(n),e){case"html":if(e=t.documentElement,!e)throw Error(U(452));return e;case"head":if(e=t.head,!e)throw Error(U(453));return e;case"body":if(e=t.body,!e)throw Error(U(454));return e;default:throw Error(U(451))}}function PO(e,t,n){for(var o in n){var r=n[o];n.hasOwnProperty(o)&&r!=null&&$t(e,t,o,null,uJ,r)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Es&&(e.onclick=null),hx(e)}function hC(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);hx(e)}var li=new Map,P4=new Set;function _h(e){if(typeof e.getRootNode==="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Al=Mt.d;Mt.d={f:IJ,r:LJ,D:BJ,C:HJ,L:jJ,m:UJ,X:FJ,S:GJ,M:VJ};function IJ(){var e=Al.f(),t=Mx();return e||t}function LJ(e){var t=am(e);t!==null&&t.tag===5&&t.type==="form"?h3(t):Al.r(e)}var cm=typeof document>"u"?null:document;function OO(e,t,n){var o=cm;if(o&&typeof t==="string"&&t){var r=ri(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n==="string"&&(r+='[crossorigin="'+n+'"]'),P4.has(r)||(P4.add(r),e={rel:e,crossOrigin:n,href:t},o.querySelector(r)===null&&(t=o.createElement("link"),xr(t,"link",e),Yo(t),o.head.appendChild(t)))}}function BJ(e){Al.D(e),OO("dns-prefetch",e,null)}function HJ(e,t){Al.C(e,t),OO("preconnect",e,t)}function jJ(e,t,n){Al.L(e,t,n);var o=cm;if(o&&e&&t){var r='link[rel="preload"][as="'+ri(t)+'"]';t==="image"?n&&n.imageSrcSet?(r+='[imagesrcset="'+ri(n.imageSrcSet)+'"]',typeof n.imageSizes==="string"&&(r+='[imagesizes="'+ri(n.imageSizes)+'"]')):r+='[href="'+ri(e)+'"]':r+='[href="'+ri(e)+'"]';var a=r;switch(t){case"style":a=em(e);break;case"script":a=um(e)}if(!(li.has(a)||(e=an({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),li.set(a,e),o.querySelector(r)!==null||t==="style"&&o.querySelector(Yh(a))||t==="script"&&o.querySelector(Wh(a))))){var i=o.createElement("link");xr(i,"link",e),t==="style"&&(i[Vy]=!0,i.onload=i.onerror=function(){lP(i)}),Yo(i),o.head.appendChild(i)}}}function UJ(e,t){Al.m(e,t);var n=cm;if(n&&e){var o=t&&typeof t.as==="string"?t.as:"script",r='link[rel="modulepreload"][as="'+ri(o)+'"][href="'+ri(e)+'"]',a=r;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=um(e)}if(!li.has(a)&&(e=an({rel:"modulepreload",href:e},t),li.set(a,e),n.querySelector(r)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Wh(a)))return}o=n.createElement("link"),xr(o,"link",e),Yo(o),n.head.appendChild(o)}}}function GJ(e,t,n){Al.S(e,t,n);var o=cm;if(o&&e){var r=zf(o).hoistableStyles,a=em(e);t=t||"default";var i=r.get(a);if(!i){var s={loading:0,preload:null};if(i=o.querySelector(Yh(a)))s.loading=5;else{e=an({rel:"stylesheet",href:e,"data-precedence":t},n),(n=li.get(a))&&CN(e,n);var l=i=o.createElement("link");Yo(l),xr(l,"link",e),l._p=new Promise(function(c,d){l.onload=c,l.onerror=d}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,zy(i,t,o)}i={type:"stylesheet",instance:i,count:1,state:s},r.set(a,i)}}}function FJ(e,t){Al.X(e,t);var n=cm;if(n&&e){var o=zf(n).hoistableScripts,r=um(e),a=o.get(r);a||(a=n.querySelector(Wh(r)),a||(e=an({src:e,async:!0},t),(t=li.get(r))&&NN(e,t),a=n.createElement("script"),Yo(a),xr(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},o.set(r,a))}}function VJ(e,t){Al.M(e,t);var n=cm;if(n&&e){var o=zf(n).hoistableScripts,r=um(e),a=o.get(r);a||(a=n.querySelector(Wh(r)),a||(e=an({src:e,async:!0,type:"module"},t),(t=li.get(r))&&NN(e,t),a=n.createElement("script"),Yo(a),xr(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},o.set(r,a))}}function O4(e,t,n,o){var r=(r=Vc.current)?_h(r):null;if(!r)throw Error(U(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence==="string"&&typeof n.href==="string"?(n=em(n.href),t=zf(r).hoistableStyles,o=t.get(n),o||(o={type:"style",instance:null,count:0,state:null},t.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href==="string"&&typeof n.precedence==="string"){e=em(n.href);var a=zf(r).hoistableStyles,i=a.get(e);if(i||(r=r.ownerDocument||r,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(e,i),(a=r.querySelector(Yh(e)))?a._p||(i.instance=a,i.state.loading=5):(a=li.get(e),a||(a={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},li.set(e,a)),KJ(r,e,a,i.state))),t&&o===null)throw Error(U(528,""));return i}if(t&&o!==null)throw Error(U(529,""));return null;case"script":return t=n.async,n=n.src,typeof n==="string"&&t&&typeof t!=="function"&&typeof t!=="symbol"?(n=um(n),t=zf(r).hoistableScripts,o=t.get(n),o||(o={type:"script",instance:null,count:0,state:null},t.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(U(444,e))}}function em(e){return'href="'+ri(e)+'"'}function Yh(e){return'link[rel="stylesheet"]['+e+"]"}function _O(e){return an({},e,{"data-precedence":e.precedence,precedence:null})}function KJ(e,t,n,o){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Vy]!==!0){o.loading=1;return}}else t=e.createElement("link"),t[Vy]=!0,t.onload=t.onerror=lP.bind(null,t),xr(t,"link",n),Yo(t),e.head.appendChild(t);o.preload=t,t.addEventListener("load",function(){return o.loading|=1}),t.addEventListener("error",function(){return o.loading|=2})}function um(e){return'[src="'+ri(e)+'"]'}function Wh(e){return"script[async]"+e}function _4(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var o=e.querySelector('style[data-href~="'+ri(n.href)+'"]');if(o)return t.instance=o,Yo(o),o;var r=an({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),Yo(o),xr(o,"style",r),zy(o,n.precedence,e),t.instance=o;case"stylesheet":r=em(n.href);var a=e.querySelector(Yh(r));if(a)return t.state.loading|=4,t.instance=a,Yo(a),a;o=_O(n),(r=li.get(r))&&CN(o,r),a=(e.ownerDocument||e).createElement("link"),Yo(a);var i=a;return i._p=new Promise(function(s,l){i.onload=s,i.onerror=l}),xr(a,"link",o),t.state.loading|=4,zy(a,n.precedence,e),t.instance=a;case"script":if(a=um(n.src),r=e.querySelector(Wh(a)))return t.instance=r,Yo(r),r;if(o=n,r=li.get(a))o=an({},n),NN(o,r);return e=e.ownerDocument||e,r=e.createElement("script"),Yo(r),xr(r,"link",o),e.head.appendChild(r),t.instance=r;case"void":return null;default:throw Error(U(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(o=t.instance,t.state.loading|=4,zy(o,n.precedence,e));return t.instance}function zy(e,t,n){for(var o=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=o.length?o[o.length-1]:null,a=r,i=0;i<o.length;i++){var s=o[i];if(s.dataset.precedence===t)a=s;else if(a!==r)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function CN(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function NN(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Iy=null;function z4(e,t,n){if(Iy===null){var o=new Map,r=Iy=new Map;r.set(n,o)}else r=Iy,o=r.get(n),o||(o=new Map,r.set(n,o));if(o.has(e))return o;o.set(e,null),n=n.getElementsByTagName(e);for(r=0;r<n.length;r++){var a=n[r];if(!(a[Gh]||a[hr]||e==="link"&&a.getAttribute("rel")==="stylesheet")&&a.namespaceURI!=="http://www.w3.org/2000/svg"){var i=a.getAttribute(t)||"";i=e+i;var s=o.get(i);s?s.push(a):o.set(i,[a])}}return o}function T2(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function qJ(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!=="string"||typeof t.href!=="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!=="string"||typeof t.href!=="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence==="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!=="function"&&typeof t.async!=="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==="string")return!0}return!1}function I4(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function zO(e){return e.type==="stylesheet"&&(e.state.loading&3)===0?!1:!0}function IO(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==="number"?devicePixelRatio:1)*0.25}function L4(e,t){typeof t.decode==="function"&&(e.imgCount++,t.complete||(e.imgBytes+=IO(t),e.suspenseyImages.push(t)),e=WJ.bind(e),t.decode().then(e,e))}function $J(e,t,n,o){if(n.type==="stylesheet"&&(typeof o.media!=="string"||matchMedia(o.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var r=em(o.href),a=t.querySelector(Yh(r));if(a){t=a._p,t!==null&&typeof t==="object"&&typeof t.then==="function"&&(e.count++,e=zh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Yo(a);return}a=t.ownerDocument||t,o=_O(o),(r=li.get(r))&&CN(o,r),a=a.createElement("link"),Yo(a);var i=a;i._p=new Promise(function(s,l){i.onload=s,i.onerror=l}),xr(a,"link",o),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=zh.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Ly=0;function YJ(e,t){return e.stylesheets&&e.count===0&&By(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var o=setTimeout(function(){if(e.stylesheets&&By(e,e.stylesheets),e.unsuspend){var a=e.unsuspend;e.unsuspend=null,a()}},60000+t);0<e.imgBytes&&Ly===0&&(Ly=62500*pJ());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&By(e,e.stylesheets),e.unsuspend)){var a=e.unsuspend;e.unsuspend=null,a()}},(e.imgBytes>Ly?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(r)}}:null}function LO(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)By(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function zh(){this.count--,LO(this)}function WJ(){this.imgCount--,LO(this)}var fx=null;function By(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,fx=new Map,t.forEach(XJ,e),fx=null,zh.call(e))}function XJ(e,t){if(!(t.state.loading&4)){var n=fx.get(e);if(n)var o=n.get(null);else{n=new Map,fx.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a<r.length;a++){var i=r[a];if(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")n.set(i.dataset.precedence,i),o=i}o&&n.set(null,o)}r=t.instance,i=r.getAttribute("data-precedence"),a=n.get(i)||o,a===o&&n.set(null,r),n.set(i,r),this.count++,o=zh.bind(this),r.addEventListener("load",o),r.addEventListener("error",o),a?a.parentNode.insertBefore(r,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var tm={$$typeof:Ts,Provider:null,Consumer:null,_currentValue:kd,_currentValue2:kd,_threadCount:0};function QJ(e,t,n,o,r,a,i,s,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=KS(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=KS(0),this.hiddenUpdates=KS(null),this.identifierPrefix=o,this.onUncaughtError=r,this.onCaughtError=a,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.transitionTypes=null,this.incompleteTransitions=new Map}function BO(e,t,n,o,r,a,i,s,l,c,d,u){return e=new QJ(e,t,n,i,l,c,d,u,s),t=1,a===!0&&(t|=24),a=la(3,null,null,t),e.current=a,a.stateNode=e,t=K2(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:o,isDehydrated:n,cache:t},Y2(a),e}function HO(e){if(!e)return Df;return e=Df,e}function jO(e,t,n,o,r,a){r=HO(r),o.context===null?o.context=r:o.pendingContext=r,o=qc(t),o.payload={element:n},a=a===void 0?null:a,a!==null&&(o.callback=a),n=$c(e,o,t),n!==null&&(ca(n,e,t),fh(n,e,t))}function B4(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function RN(e,t){B4(e,t),(e=e.alternate)&&B4(e,t)}function UO(e){if(e.tag===13||e.tag===31){var t=Bd(e,67108864);t!==null&&ca(t,e,67108864),RN(e,67108864)}}function H4(e){if(e.tag===13||e.tag===31){var t=Oa();t=O2(t);var n=Bd(e,t);n!==null&&ca(n,e,t),RN(e,t)}}var nm=!0;function ZJ(e,t,n,o){var r=Be.T;Be.T=null;var a=Mt.p;try{Mt.p=2,TN(e,t,n,o)}finally{Mt.p=a,Be.T=r}}function JJ(e,t,n,o){var r=Be.T;Be.T=null;var a=Mt.p;try{Mt.p=8,TN(e,t,n,o)}finally{Mt.p=a,Be.T=r}}function TN(e,t,n,o){if(nm){var r=E2(o);if(r===null)fC(e,t,o,mx,n),j4(e,o);else if(tee(r,e,t,n,o))o.stopPropagation();else if(j4(e,o),t&4&&-1<eee.indexOf(e)){for(;r!==null;){var a=am(r);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var i=hd(a.pendingLanes);if(i!==0){var s=a;s.pendingLanes|=2;for(s.entangledLanes|=2;i;){var l=1<<31-Pa(i);s.entanglements[1]|=l,i&=~l}zs(a),(At&6)===0&&(lx=Ma()+500,$h(0,!1))}}break;case 31:case 13:s=Bd(a,2),s!==null&&ca(s,a,2),Mx(),RN(a,2)}if(a=E2(o),a===null&&fC(e,t,o,mx,n),a===r)break;r=a}r!==null&&o.stopPropagation()}else fC(e,t,o,null,n)}}function E2(e){return e=I2(e),EN(e)}var mx=null;function EN(e){if(mx=null,e=xd(e),e!==null){var t=Bh(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=q4(t),e!==null)return e;e=null}else if(n===31){if(e=$4(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return mx=e,null}function GO(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(mQ()){case J4:return 2;case eP:return 8;case Fy:case gQ:return 32;case tP:return 268435456;default:return 32}default:return 32}}var A2=!1,Qc=null,Zc=null,Jc=null,Ih=new Map,Lh=new Map,Lc=[],eee="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function j4(e,t){switch(e){case"focusin":case"focusout":Qc=null;break;case"dragenter":case"dragleave":Zc=null;break;case"mouseover":case"mouseout":Jc=null;break;case"pointerover":case"pointerout":Ih.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lh.delete(t.pointerId)}}function Jg(e,t,n,o,r,a){if(e===null||e.nativeEvent!==a)return e={blockedOn:t,domEventName:n,eventSystemFlags:o,nativeEvent:a,targetContainers:[r]},t!==null&&(t=am(t),t!==null&&UO(t)),e;return e.eventSystemFlags|=o,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e}function tee(e,t,n,o,r){switch(t){case"focusin":return Qc=Jg(Qc,e,t,n,o,r),!0;case"dragenter":return Zc=Jg(Zc,e,t,n,o,r),!0;case"mouseover":return Jc=Jg(Jc,e,t,n,o,r),!0;case"pointerover":var a=r.pointerId;return Ih.set(a,Jg(Ih.get(a)||null,e,t,n,o,r)),!0;case"gotpointercapture":return a=r.pointerId,Lh.set(a,Jg(Lh.get(a)||null,e,t,n,o,r)),!0}return!1}function FO(e){var t=xd(e.target);if(t!==null){var n=Bh(t);if(n!==null){if(t=n.tag,t===13){if(t=q4(n),t!==null){e.blockedOn=t,mD(e.priority,function(){H4(n)});return}}else if(t===31){if(t=$4(n),t!==null){e.blockedOn=t,mD(e.priority,function(){H4(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hy(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=E2(e.nativeEvent);if(n===null){n=e.nativeEvent;var o=new n.constructor(n.type,n);MC=o,n.target.dispatchEvent(o),MC=null}else return t=am(n),t!==null&&UO(t),e.blockedOn=n,!1;t.shift()}return!0}function U4(e,t,n){Hy(e)&&n.delete(t)}function nee(){A2=!1,Qc!==null&&Hy(Qc)&&(Qc=null),Zc!==null&&Hy(Zc)&&(Zc=null),Jc!==null&&Hy(Jc)&&(Jc=null),Ih.forEach(U4),Lh.forEach(U4)}function vy(e,t){e.blockedOn===t&&(e.blockedOn=null,A2||(A2=!0,No.unstable_scheduleCallback(No.unstable_NormalPriority,nee)))}var yy=null;function G4(e){yy!==e&&(yy=e,No.unstable_scheduleCallback(No.unstable_NormalPriority,function(){yy===e&&(yy=null);for(var t=0;t<e.length;t+=3){var n=e[t],o=e[t+1],r=e[t+2];if(typeof o!=="function")if(EN(o||n)===null)continue;else break;var a=am(n);a!==null&&(e.splice(t,3),t-=3,qC(a,{pending:!0,data:r,method:n.method,action:o},o,r))}}))}function om(e){function t(l){return vy(l,e)}Qc!==null&&vy(Qc,e),Zc!==null&&vy(Zc,e),Jc!==null&&vy(Jc,e),Ih.forEach(t),Lh.forEach(t);for(var n=0;n<Lc.length;n++){var o=Lc[n];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Lc.length&&(n=Lc[0],n.blockedOn===null);)FO(n),n.blockedOn===null&&Lc.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(o=0;o<n.length;o+=3){var r=n[o],a=n[o+1],i=r[da]||null;if(typeof a==="function")i||G4(n);else if(i){var s=null;if(a&&a.hasAttribute("formAction")){if(r=a,i=a[da]||null)s=i.formAction;else if(EN(r)!==null)continue}else s=i.action;typeof s==="function"?n[o+1]=s:(n.splice(o,3),o-=3),G4(n)}}}function VO(){function e(a){a.canIntercept&&a.info==="react-transition"&&a.intercept({handler:function(){return new Promise(function(i){return r=i})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),o||setTimeout(n,20)}function n(){if(!o&&!navigation.transition){var a=navigation.currentEntry;a&&a.url!=null&&navigation.navigate(a.url,{state:a.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation==="object"){var o=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function AN(e){this._internalRoot=e}Ox.prototype.render=AN.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(U(409));var n=t.current,o=Oa();jO(n,o,e,t,null,null)};Ox.prototype.unmount=AN.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;jO(e.current,2,null,e,null,null),Mx(),t[rm]=null}};function Ox(e){this._internalRoot=e}Ox.prototype.unstable_scheduleHydration=function(e){if(e){var t=sP();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lc.length&&t!==0&&t<Lc[n].priority;n++);Lc.splice(n,0,e),n===0&&FO(e)}};var F4=V4.version;if(F4!=="19.3.1")throw Error(U(527,F4,"19.3.1"));Mt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0){if(typeof e.render==="function")throw Error(U(188));throw e=Object.keys(e).join(","),Error(U(268,e))}return e=oQ(t),e=e!==null?Y4(e):null,e=e===null?null:e.stateNode,e};var oee={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:Be,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){if(kf=__REACT_DEVTOOLS_GLOBAL_HOOK__,!kf.isDisabled&&kf.supportsFiber)try{Hh=kf.inject(oee),Da=kf}catch(e){}}var kf;_x.createRoot=function(e,t){if(!K4(e))throw Error(U(299));var n=!1,o="",r=C3,a=N3,i=R3;return t!==null&&t!==void 0&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=BO(e,1,!1,null,null,n,o,null,r,a,i,VO),e[rm]=t.current,xN(e),new AN(t)};_x.hydrateRoot=function(e,t,n){if(!K4(e))throw Error(U(299));var o=!1,r="",a=C3,i=N3,s=R3,l=null;return n!==null&&n!==void 0&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(a=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(s=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=BO(e,1,!0,t,n!=null?n:null,o,r,l,a,i,s,VO),t.context=HO(null),n=t.current,o=Oa(),o=O2(o),r=qc(o),r.callback=null,$c(n,r,o),n=o,t.current.lanes=n,Uh(t,n),zs(t),e[rm]=t.current,xN(e),new Ox(t)};_x.version="19.3.1"});var YO=xs(function(ree,$O){function qO(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qO)}catch(e){console.error(e)}}qO(),$O.exports=KO()});var s7=xs(function(x0){var qne=Symbol.for("react.transitional.element"),$ne=Symbol.for("react.fragment");function i7(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:qne,type:e,key:o,ref:t!==void 0?t:null,props:n}}x0.Fragment=$ne;x0.jsx=i7;x0.jsxs=i7});var w=xs(function(Yne,l7){l7.exports=s7()});var fX=h(I(),1),mX=h(Za(),1),gX=h(YO(),1);var su=()=>{throw Error("The board has not mounted this page yet")},dm=()=>!1,O={open:{card:dm,ws:dm,term:dm,tab:dm,task:dm,homeStart:dm},go:su,newTask:su,runPopup:su,scopeDir:()=>"",dirHeader:()=>({}),projects:()=>[],reload:()=>{},dataUrls:su,rich:su,pop:()=>{},motion:()=>!0,agentLine:(e)=>e.name,openSettings:su,openCard:su,openWorkspace:su,loadBoard:async()=>{},launched:()=>{},closePanel:()=>{},reopenPanel:()=>{},panelOpenFor:()=>!1,notify:()=>{},gitTab:()=>{},refetchRun:async()=>{},font:{min:8,max:24,read:()=>12,set:()=>{}},notices:{on:()=>!0,sounds:[],sound:()=>"",play:()=>{}},currentDir:()=>"",gitProjects:()=>[],wsHref:()=>"",pickProject:async()=>{},navigate:(e)=>void(location.href=e),runCards:()=>[]},WO=(e)=>Object.assign(O,e);var X=h(I(),1),JO=h(Za(),1);function aee(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var iee=(e)=>{switch(e){case"success":return cee;case"info":return dee;case"warning":return uee;case"error":return pee;default:return null}},see=Array(12).fill(0),lee=({visible:e,className:t})=>X.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},X.default.createElement("div",{className:"sonner-spinner"},see.map((n,o)=>X.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),cee=X.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},X.default.createElement("path",{fillRule:"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",clipRule:"evenodd"})),uee=X.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},X.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),dee=X.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},X.default.createElement("path",{fillRule:"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",clipRule:"evenodd"})),pee=X.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},X.default.createElement("path",{fillRule:"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",clipRule:"evenodd"})),fee=X.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},X.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),X.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),mee=()=>{let[e,t]=X.default.useState(document.hidden);return X.default.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e},gee=1,hee=100,XO=(e)=>{var t;return typeof(e==null?void 0:e.id)==="number"||(e==null?void 0:(t=e.id)==null?void 0:t.length)>0?e.id:gee++};class e_{constructor(){this.subscribe=(e)=>(this.subscribers.push(e),this.getActiveToasts().forEach((t)=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=(e)=>{this.subscribers.forEach((t)=>t(e))},this.addToast=(e)=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-hee;if(e<=0)return;this.toasts=this.toasts.filter((t)=>{if(e>0&&this.dismissedToasts.has(t.id))return this.dismissedToasts.delete(t.id),e--,!1;return!0})},this.create=(e)=>{let{message:t,...n}=e,o=XO(e),r=this.pendingDismissals.get(o);if(r!==void 0)cancelAnimationFrame(r),this.pendingDismissals.delete(o),this.dismissedToasts.delete(o);let a=this.dismissedToasts.has(o),i=e.dismissible===void 0?!0:e.dismissible;if(a)this.dismissedToasts.delete(o),this.toasts=this.toasts.filter((l)=>l.id!==o);if(a?void 0:this.toasts.find((l)=>l.id===o))this.toasts=this.toasts.map((l)=>{if(l.id===o)return this.publish({...l,...e,id:o,title:t}),{...l,...e,id:o,dismissible:i,title:t};return l});else this.addToast({title:t,...n,dismissible:i,id:o});return o},this.dismiss=(e)=>{if(e===void 0||e===null)return this.getActiveToasts().forEach((n)=>{this.dismissedToasts.add(n.id),this.subscribers.forEach((o)=>o({id:n.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);if(t!==void 0)cancelAnimationFrame(t);return this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach((n)=>n({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n=void 0;if(t.loading!==void 0)n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!=="function"?t.description:void 0});let o=Promise.resolve(e instanceof Function?e():e),r=n!==void 0,a,i=o.then(async(l)=>{if(a=["resolve",l],X.default.isValidElement(l))r=!1,this.create({id:n,type:"default",message:l});else if(vee(l)&&!l.ok){r=!1;let d=typeof t.error==="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,u=typeof t.description==="function"?await t.description(`HTTP error! status: ${l.status}`):t.description,f=typeof d==="object"&&!X.default.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:u,...f})}else if(l instanceof Error){r=!1;let d=typeof t.error==="function"?await t.error(l):t.error,u=typeof t.description==="function"?await t.description(l):t.description,f=typeof d==="object"&&!X.default.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:u,...f})}else if(t.success!==void 0){r=!1;let d=typeof t.success==="function"?await t.success(l):t.success,u=typeof t.description==="function"?await t.description(l):t.description,f=typeof d==="object"&&!X.default.isValidElement(d)?d:{message:d};this.create({id:n,type:"success",description:u,...f})}}).catch(async(l)=>{if(a=["reject",l],t.error!==void 0){r=!1;let c=typeof t.error==="function"?await t.error(l):t.error,d=typeof t.description==="function"?await t.description(l):t.description,p=typeof c==="object"&&!X.default.isValidElement(c)?c:{message:c};this.create({id:n,type:"error",description:d,...p})}}).finally(()=>{if(r)this.dismiss(n),n=void 0;t.finally==null||t.finally.call(t)}),s=()=>new Promise((l,c)=>i.then(()=>a[0]==="reject"?c(a[1]):l(a[1])).catch(c));if(typeof n!=="string"&&typeof n!=="number")return{unwrap:s};else return Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=XO(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter((e)=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}var pa=new e_,bee=(e,t)=>pa.message(e,t),vee=(e)=>e&&typeof e==="object"&&("ok"in e)&&typeof e.ok==="boolean"&&("status"in e)&&typeof e.status==="number",yee=bee,xee=()=>pa.toasts,wee=()=>pa.getActiveToasts(),MN=Object.assign(yee,{success:pa.success,info:pa.info,warning:pa.warning,error:pa.error,custom:pa.custom,message:pa.message,promise:pa.promise,dismiss:pa.dismiss,loading:pa.loading},{getHistory:xee,getToasts:wee});aee("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function zx(e){return e.label!==void 0}var kee=3,See="24px",Cee="16px",QO=4000,Nee=356,Ree=14,Tee=45,Eee=200;function Is(...e){return e.filter(Boolean).join(" ")}function Aee(e){let[t,n]=e.split("-"),o=[];if(t)o.push(t);if(n)o.push(n);return o}var Mee=(e)=>{var t,n,o,r,a,i,s,l,c;let{invert:d,toast:u,unstyled:p,interacting:f,setHeights:g,visibleToasts:m,heights:y,index:b,toasts:x,expanded:v,removeToast:k,defaultRichColors:S,closeButton:N,style:R,cancelButtonStyle:A,actionButtonStyle:D,className:E="",descriptionClassName:z="",duration:B,position:Z,gap:ee,expandByDefault:xe,classNames:V,icons:ye,closeButtonAriaLabel:ae="Close toast"}=e,[ge,P]=X.default.useState(null),[Ae,j]=X.default.useState(null),[le,te]=X.default.useState(!1),[F,H]=X.default.useState(!1),[he,Ye]=X.default.useState(!1),[ne,be]=X.default.useState(!1),[Et,pt]=X.default.useState(!1),[ze,qe]=X.default.useState(0),[rt,lf]=X.default.useState(0),pl=X.default.useRef(u.duration||B||QO),cf=X.default.useRef(null),fl=X.default.useRef(null),hX=b===0,bX=b+1<=m,Vr=u.type,C5=Vr!=null?Vr:"default",uf=u.dismissible!==!1,vX=u.className||"",yX=u.descriptionClassName||"",Wv=X.default.useMemo(()=>y.findIndex(($e)=>$e.toastId===u.id)||0,[y,u.id]),xX=X.default.useMemo(()=>{var $e;return($e=u.closeButton)!=null?$e:N},[u.closeButton,N]),N5=X.default.useMemo(()=>u.duration||B||QO,[u.duration,B]),wS=X.default.useRef(0),df=X.default.useRef(0),R5=X.default.useRef(0),pf=X.default.useRef(null),[wX,kX]=Z.split("-"),T5=X.default.useMemo(()=>y.reduce(($e,ko,fr)=>{if(fr>=Wv)return $e;return $e+ko.height},0),[y,Wv]),E5=mee(),bs=X.default.useMemo(()=>{var $e;return($e=e.swipeDirections)!=null?$e:Aee(Z)},[e.swipeDirections,Z]),SX=u.invert||d,kS=Vr==="loading";df.current=X.default.useMemo(()=>Wv*ee+T5,[Wv,T5]),X.default.useEffect(()=>{pl.current=N5},[N5]),X.default.useEffect(()=>{te(!0)},[]),X.default.useEffect(()=>{let $e=fl.current;if($e){let ko=$e.getBoundingClientRect().height;return lf(ko),g((fr)=>[{toastId:u.id,height:ko,position:u.position},...fr]),()=>g((fr)=>fr.filter((ra)=>ra.toastId!==u.id))}},[g,u.id]),X.default.useLayoutEffect(()=>{if(!le)return;let $e=fl.current,ko=$e.style.height;$e.style.height="auto";let fr=$e.getBoundingClientRect().height;$e.style.height=ko,lf(fr),g((ra)=>{if(!ra.find((mr)=>mr.toastId===u.id))return[{toastId:u.id,height:fr,position:u.position},...ra];else return ra.map((mr)=>mr.toastId===u.id?{...mr,height:fr}:mr)})},[le,u.title,u.description,g,u.id,u.jsx,u.action,u.cancel]);let Ac=X.default.useCallback(()=>{H(!0),qe(df.current),g(($e)=>$e.filter((ko)=>ko.toastId!==u.id)),setTimeout(()=>{k(u)},Eee)},[u,k,g,df]);X.default.useEffect(()=>{if(u.promise&&Vr==="loading"||u.duration===1/0||u.type==="loading")return;let $e,ko=()=>{if(R5.current<wS.current){let ra=new Date().getTime()-wS.current;pl.current=pl.current-ra}R5.current=new Date().getTime()},fr=()=>{if(pl.current===1/0)return;wS.current=new Date().getTime(),$e=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),Ac()},pl.current)};if(v||f||E5)ko();else fr();return()=>clearTimeout($e)},[v,f,u,Vr,E5,Ac]),X.default.useEffect(()=>{if(u.delete)Ac(),u.onDismiss==null||u.onDismiss.call(u,u)},[Ac,u.delete]);function A5(){var $e;if(ye==null?void 0:ye.loading){var ko;return X.default.createElement("div",{className:Is(V==null?void 0:V.loader,u==null?void 0:(ko=u.classNames)==null?void 0:ko.loader,"sonner-loader"),"data-visible":Vr==="loading"},ye.loading)}return X.default.createElement(lee,{className:Is(V==null?void 0:V.loader,u==null?void 0:($e=u.classNames)==null?void 0:$e.loader),visible:Vr==="loading"})}let CX=u.icon||(ye==null?void 0:ye[Vr])||iee(Vr);var M5,D5;return X.default.createElement("li",{tabIndex:0,ref:fl,className:Is(E,vX,V==null?void 0:V.toast,u==null?void 0:(t=u.classNames)==null?void 0:t.toast,V==null?void 0:V[C5],u==null?void 0:(n=u.classNames)==null?void 0:n[C5]),"data-sonner-toast":"","data-rich-colors":(M5=u.richColors)!=null?M5:S,"data-styled":!Boolean(u.jsx||u.unstyled||p),"data-mounted":le,"data-promise":Boolean(u.promise),"data-swiped":Et,"data-removed":F,"data-visible":bX,"data-y-position":wX,"data-x-position":kX,"data-index":b,"data-front":hX,"data-swiping":he,"data-dismissible":uf,"data-type":Vr,"data-invert":SX,"data-swipe-out":ne,"data-swipe-direction":Ae,"data-expanded":Boolean(v||xe&&le),"data-testid":u.testId,style:{"--index":b,"--toasts-before":b,"--z-index":x.length-b,"--offset":`${F?ze:df.current}px`,"--initial-height":xe?"auto":`${rt}px`,...R,...u.style},onDragEnd:()=>{Ye(!1),P(null),pf.current=null},onPointerDown:($e)=>{if($e.button===2)return;if(kS||!uf)return;if(cf.current=new Date,qe(df.current),$e.target.setPointerCapture($e.pointerId),$e.target.tagName==="BUTTON")return;Ye(!0),pf.current={x:$e.clientX,y:$e.clientY}},onPointerUp:()=>{var $e,ko,fr;if(ne||!uf)return;pf.current=null;let ra=Number((($e=fl.current)==null?void 0:$e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Vg=Number(((ko=fl.current)==null?void 0:ko.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mr=new Date().getTime()-((fr=cf.current)==null?void 0:fr.getTime()),Qa=ge==="x"?ra:Vg,vs=Math.abs(Qa)/mr;if((ge==="x"?bs.includes(ra>0?"right":"left"):bs.includes(Vg>0?"bottom":"top"))&&(Math.abs(Qa)>=Tee||vs>0.11)){if(qe(df.current),u.onDismiss==null||u.onDismiss.call(u,u),ge==="x")j(ra>0?"right":"left");else j(Vg>0?"down":"up");Ac(),be(!0);return}else{var ys,CS;(ys=fl.current)==null||ys.style.setProperty("--swipe-amount-x","0px"),(CS=fl.current)==null||CS.style.setProperty("--swipe-amount-y","0px")}pt(!1),Ye(!1),P(null)},onPointerMove:($e)=>{var ko,fr,ra;if(!pf.current||!uf)return;if(((ko=window.getSelection())==null?void 0:ko.toString().length)>0)return;let mr=$e.clientY-pf.current.y,Qa=$e.clientX-pf.current.x;if(!ge&&(Math.abs(Qa)>1||Math.abs(mr)>1))P(Math.abs(Qa)>Math.abs(mr)?"x":"y");let vs={x:0,y:0},SS=(ys)=>1/(1.5+Math.abs(ys)/20);if(ge==="y"){if(bs.includes("top")||bs.includes("bottom"))if(bs.includes("top")&&mr<0||bs.includes("bottom")&&mr>0)vs.y=mr;else{let ys=mr*SS(mr);vs.y=Math.abs(ys)<Math.abs(mr)?ys:mr}}else if(ge==="x"){if(bs.includes("left")||bs.includes("right"))if(bs.includes("left")&&Qa<0||bs.includes("right")&&Qa>0)vs.x=Qa;else{let ys=Qa*SS(Qa);vs.x=Math.abs(ys)<Math.abs(Qa)?ys:Qa}}if(Math.abs(vs.x)>0||Math.abs(vs.y)>0)pt(!0);(fr=fl.current)==null||fr.style.setProperty("--swipe-amount-x",`${vs.x}px`),(ra=fl.current)==null||ra.style.setProperty("--swipe-amount-y",`${vs.y}px`)}},xX&&!u.jsx&&Vr!=="loading"?X.default.createElement("button",{"aria-label":ae,"data-disabled":kS,"data-close-button":!0,onClick:kS||!uf?()=>{}:()=>{Ac(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Is(V==null?void 0:V.closeButton,u==null?void 0:(o=u.classNames)==null?void 0:o.closeButton)},(D5=ye==null?void 0:ye.close)!=null?D5:fee):null,(Vr||u.icon||u.promise)&&u.icon!==null&&((ye==null?void 0:ye[Vr])!==null||u.icon)?X.default.createElement("div",{"data-icon":"",className:Is(V==null?void 0:V.icon,u==null?void 0:(r=u.classNames)==null?void 0:r.icon)},Vr==="loading"?u.icon||A5():u.promise?A5():null,Vr!=="loading"?CX:null):null,X.default.createElement("div",{"data-content":"",className:Is(V==null?void 0:V.content,u==null?void 0:(a=u.classNames)==null?void 0:a.content)},X.default.createElement("div",{"data-title":"",className:Is(V==null?void 0:V.title,u==null?void 0:(i=u.classNames)==null?void 0:i.title)},u.jsx?u.jsx:typeof u.title==="function"?u.title():u.title),u.description?X.default.createElement("div",{"data-description":"",className:Is(z,yX,V==null?void 0:V.description,u==null?void 0:(s=u.classNames)==null?void 0:s.description)},typeof u.description==="function"?u.description():u.description):null),X.default.isValidElement(u.cancel)?u.cancel:u.cancel&&zx(u.cancel)?X.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||A,onClick:($e)=>{if(!zx(u.cancel))return;if(!uf)return;u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,$e),Ac()},className:Is(V==null?void 0:V.cancelButton,u==null?void 0:(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,X.default.isValidElement(u.action)?u.action:u.action&&zx(u.action)?X.default.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||D,onClick:($e)=>{if(!zx(u.action))return;if(u.action.onClick==null||u.action.onClick.call(u.action,$e),$e.defaultPrevented)return;Ac()},className:Is(V==null?void 0:V.actionButton,u==null?void 0:(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function ZO(){if(typeof window>"u")return"ltr";if(typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");if(e==="auto"||!e)return window.getComputedStyle(document.documentElement).direction;return e}function Dee(e,t){let n={};return[e,t].forEach((o,r)=>{let a=r===1,i=a?"--mobile-offset":"--offset",s=a?Cee:See;function l(c){["top","right","bottom","left"].forEach((d)=>{n[`${i}-${d}`]=typeof c==="number"?`${c}px`:c})}if(typeof o==="number"||typeof o==="string")l(o);else if(typeof o==="object")["top","right","bottom","left"].forEach((c)=>{if(o[c]===void 0)n[`${i}-${c}`]=s;else n[`${i}-${c}`]=typeof o[c]==="number"?`${o[c]}px`:o[c]});else l(s)}),n}var t_=X.default.forwardRef(function(t,n){let{id:o,invert:r,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:s,closeButton:l,className:c,offset:d,mobileOffset:u,theme:p="light",richColors:f,duration:g,style:m,visibleToasts:y=kee,toastOptions:b,dir:x=ZO(),gap:v=Ree,icons:k,customAriaLabel:S,containerAriaLabel:N="Notifications"}=t,[R,A]=X.default.useState([]),D=X.default.useMemo(()=>{if(o)return R.filter((te)=>te.toasterId===o);return R.filter((te)=>!te.toasterId)},[R,o]),E=X.default.useMemo(()=>Array.from(new Set([a].concat(D.filter((te)=>te.position).map((te)=>te.position)))),[D,a]),[z,B]=X.default.useState([]),[Z,ee]=X.default.useState(!1),[xe,V]=X.default.useState(!1),[ye,ae]=X.default.useState(p!=="system"?p:typeof window<"u"?window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"light"),ge=X.default.useRef(null),P=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),Ae=X.default.useRef(null),j=X.default.useRef(!1),le=X.default.useCallback((te)=>{A((F)=>{var H;if(!((H=F.find((he)=>he.id===te.id))==null?void 0:H.delete))pa.dismiss(te.id);return F.filter(({id:he})=>he!==te.id)})},[]);return X.default.useEffect(()=>pa.subscribe((te)=>{if(te.dismiss){requestAnimationFrame(()=>{A((F)=>F.map((H)=>H.id===te.id?{...H,delete:!0}:H))});return}setTimeout(()=>{JO.default.flushSync(()=>{A((F)=>{let H=F.findIndex((he)=>he.id===te.id);if(H!==-1)return[...F.slice(0,H),{...F[H],...te},...F.slice(H+1)];return[te,...F]})})})}),[]),X.default.useEffect(()=>{if(p!=="system"){ae(p);return}if(p==="system")if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)ae("dark");else ae("light");if(typeof window>"u")return;let te=window.matchMedia("(prefers-color-scheme: dark)");try{te.addEventListener("change",({matches:F})=>{if(F)ae("dark");else ae("light")})}catch(F){te.addListener(({matches:H})=>{try{if(H)ae("dark");else ae("light")}catch(he){console.error(he)}})}},[p]),X.default.useEffect(()=>{if(R.length<=1)ee(!1)},[R]),X.default.useEffect(()=>{let te=(F)=>{var H;if(i.length>0&&i.every((ne)=>F[ne]||F.code===ne)){var Ye;ee(!0),(Ye=ge.current)==null||Ye.focus()}if(F.code==="Escape"&&(document.activeElement===ge.current||((H=ge.current)==null?void 0:H.contains(document.activeElement))))ee(!1)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[i]),X.default.useEffect(()=>{if(ge.current)return()=>{if(Ae.current)Ae.current.focus({preventScroll:!0}),Ae.current=null,j.current=!1}},[ge.current]),X.default.createElement("section",{ref:n,"aria-label":S!=null?S:`${N} ${P}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},E.map((te,F)=>{var H;let[he,Ye]=te.split("-");if(!D.length)return null;return X.default.createElement("ol",{key:te,dir:x==="auto"?ZO():x,tabIndex:-1,ref:ge,className:c,"data-sonner-toaster":!0,"data-sonner-theme":ye,"data-y-position":he,"data-x-position":Ye,style:{"--front-toast-height":`${((H=z[0])==null?void 0:H.height)||0}px`,"--width":`${Nee}px`,"--gap":`${v}px`,...m,...Dee(d,u)},onBlur:(ne)=>{if(j.current&&!ne.currentTarget.contains(ne.relatedTarget)){if(j.current=!1,Ae.current)Ae.current.focus({preventScroll:!0}),Ae.current=null}},onFocus:(ne)=>{if(ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false")return;if(!j.current)j.current=!0,Ae.current=ne.relatedTarget},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{if(!xe)ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:(ne)=>{if(ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false")return;V(!0)},onPointerUp:()=>V(!1)},D.filter((ne)=>!ne.position&&F===0||ne.position===te).map((ne,be)=>{var Et,pt;return X.default.createElement(Mee,{key:ne.id,icons:k,index:be,toast:ne,defaultRichColors:f,duration:(Et=b==null?void 0:b.duration)!=null?Et:g,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:r,visibleToasts:y,closeButton:(pt=b==null?void 0:b.closeButton)!=null?pt:l,interacting:xe,position:te,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,closeButtonAriaLabel:b==null?void 0:b.closeButtonAriaLabel,removeToast:le,toasts:D.filter((ze)=>ze.position==ne.position),heights:z.filter((ze)=>ze.position==ne.position),setHeights:B,expandByDefault:s,gap:v,expanded:Z,swipeDirections:t.swipeDirections})}))}))});var DN;function n_(e,t){if(DN!==void 0)MN.dismiss(DN);DN=MN(e,t)}function _(e,t){n_(e,{duration:t?8000:4000,action:t?{label:"Report",onClick:()=>void window.open("/issue?"+new URLSearchParams(t),"_blank","noopener")}:void 0})}var PN=(e,t)=>ON(e,"Undo",t);function ON(e,t,n){n_(e,{duration:8000,action:{label:t,onClick:n}})}async function _N(e){try{let t=await fetch("/task",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await t.json();if(!t.ok||n.ok===!1)return _(n.why||n.error||"That did not work. Your message is still saved here."),{...n,ok:!1,conflict:t.status===409};return{...n,ok:!0}}catch{return _("The server could not be reached. Your draft is still here; try again."),{ok:!1}}}async function o_(){let e=await fetch("/tasks?all=1"),t=await e.json();if(!e.ok)throw Error(t.why||t.error||"Tasks could not be loaded");return t.tasks??[]}async function r_(e,t){let n=await fetch(`/task?id=${encodeURIComponent(e)}&dir=${encodeURIComponent(t)}`);return{ok:n.ok,body:await n.json()}}var a_=async(e)=>{let t=await fetch(e);if(!t.ok)throw Error();return t.text()},i_=async(e)=>(await fetch("/frameable?url="+encodeURIComponent(e))).json(),s_=async(e)=>(await fetch("/expose",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({url:e})})).json(),Pee="The kaizen server is not running — start it with kaizen web (or the shortcut), then reload.";async function K(e,t){let n;try{n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",...O.dirHeader()},body:JSON.stringify(t)})}catch{return _(Pee),{ok:!1}}let o=await n.json().catch(()=>({}));if(!n.ok){let r=o.error||o.why||"That did not work";_(r,{title:r.slice(0,80),what:`POST ${e} failed (HTTP ${n.status}): ${r}`})}return o}var l_=async(e)=>fetch("/sources"+(e?"?dir="+encodeURIComponent(e):"")).then((t)=>t.json()).catch(()=>null);var c_=(e)=>{let t,n=new Set,o=(c,d)=>{let u=typeof c==="function"?c(t):c;if(!Object.is(u,t)){let p=t;t=(d!=null?d:typeof u!=="object"||u===null)?u:Object.assign({},t,u),n.forEach((f)=>f(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:(c)=>(n.add(c),()=>n.delete(c))},l=t=e(o,r,s);return s},u_=(e)=>e?c_(e):c_;var Ix=h(I(),1);var Oee=(e)=>e;function _ee(e,t=Oee){let n=Ix.default.useSyncExternalStore(e.subscribe,Ix.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return Ix.default.useDebugValue(n),n}var d_=(e)=>{let t=u_(e),n=(o)=>_ee(t,o);return Object.assign(n,t),n},de=(e)=>e?d_(e):d_;var pm=de()(()=>({open:null}));function mn(e){return new Promise((t)=>{pm.getState().open?.answer(!1),pm.setState({open:{...e,answer:t}})})}function zN(e){let t=pm.getState().open;pm.setState({open:null}),t?.answer(e)}var Lx=(e="End this agent session?",t="A run can be resumed from its tile or card.")=>mn({title:e,description:t,confirmLabel:"End session",danger:!0});var co=(e,t)=>{let n=t-e;return n<3600000?Math.round(n/60000)+"m":n<86400000?Math.round(n/3600000)+"h":Math.round(n/86400000)+"d"};var p_=86400000,IN={claude:"Claude Code",codex:"Codex",agy:"Antigravity",opencode:"OpenCode",gemini:"Gemini",cursor:"Cursor",yolo:"yolo",unrechecked:"fix not rechecked"},f_={claude:1,codex:1,agy:1,opencode:1,gemini:1,cursor:1,full:1,lite:1},m_=(e,t,n)=>t&&e.includes(t)?t:n?null:e[0]??null,g_=["Tasks","Planning","Building","Review","Done"],fm={idea:"idea",starting:"start",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"},zee={explore:"exploration needs your decision","approvals.plan":"plan needs your approval","approvals.review":"review needs your approval"},Ls=(e)=>zee[e]||e,lu={idea:"idea",starting:"starting",running:"running",stalled:"stalled",waiting:"waiting on you",done:"done",abandoned:"abandoned"};var Tn=(e)=>e._k||(e.kind==="idea"?"idea:"+e.state+":"+e.text:"run:"+e.state+":"+e.id),Bx=6,Hx=[["high","High+",(e)=>e==="critical"||e==="high"],["medium","Medium",(e)=>e==="medium"],["low","Low",(e)=>e==="low"],["none","No severity",(e)=>!e]],b_=["Add a task to start a run","Tasks you run are planned here","Approved plans are built here","Finished builds are checked here"],jx=(e)=>(e||[]).map((t)=>({...t,kind:"backlog",status:t.starting?"starting":"idea",title:t.text,column:0,archived:!1,_k:"backlog:"+t.state+":"+t.source+"#"+t.n})),v_=(e,t)=>t.kind==="run"?e.filter((n)=>n.parent===t.id&&n.state===t.state):[],Iee=(e,t)=>!!t.parent&&e.some((n)=>n.kind==="run"&&n.id===t.parent&&n.state===t.state&&!n.archived&&n.column!==4),LN=(e,t)=>t?"Sent to agent":e.status!=="waiting"?"Open":e.healed?"Approve":{explore:"Review exploration","approvals.plan":"Review plan",findings:"See findings","approvals.review":"Review work"}[e.awaiting??""]||"Open";function y_(e){let t=e.query.trim().toLowerCase(),n=e.ci===0&&!e.archive&&e.tab==="backlog",r=(n?e.backlog:e.cards).filter((a)=>a.column===e.ci&&(!n||!e.sev||Hx.find((i)=>i[0]===e.sev)[2](a.severity))&&(!e.filter||a.status===e.filter)&&(e.archive||!Iee(e.all,a))&&(!t||`${a.title||""} ${a.text||""} ${a.id||""}`.toLowerCase().includes(t)));if(e.ci<4&&!n){let a=(c)=>c.kind==="run"?c.moved||0:c.added||0,i=e.order[e.ci]==="old",s=(c)=>e.all.indexOf(c),l=(c)=>c.status==="waiting"?1:0;r.sort((c,d)=>l(d)-l(c)||(i?a(c)-a(d)||s(c)-s(d):a(d)-a(c)||s(d)-s(c)))}return r}var x_=(e,t,n)=>e.filter((o)=>t-(o.moved||t)>n*p_),h_=(e)=>e.replace(/^\d{4}-\d\d-\d\d-/,"").replace(/-/g," ");function w_(e,t){let n=[],o=[];if(t)n.push({text:e.where.split("/").filter(Boolean).pop()||e.where,title:e.where,cls:"proj"});for(let i of e.tags||[])if(f_[i])o.push({icon:i,sprite:"c",title:i==="full"?"Full run: separate reviewer":i==="lite"?"Lite run: one session":IN[i]||i,cls:i==="full"||i==="lite"?"accent":""});else if(i==="yolo")o.push({text:"yolo",title:"Started in Yolo: the agent runs commands without asking",cls:"warn"});else n.push({text:IN[i]||i});let r=e.workers||[];if(r.length)n.push({text:`${r.length} workers`,title:r.map((i)=>`${i.id} ${i.status}${i.bypass?" (bypass)":""}`).join(", ")});if(e.land)o.push({text:"! "+(e.land.kind==="conflict"?"Conflict":"Land failed"),title:e.land.why,cls:"bad"});if(e.signal==="blocked")o.push({icon:"ask",title:`Waiting on you: ${e.blocked?.question??""}`,cls:"ask"});else if(e.signal==="stale")o.push({text:"stale",title:"The agent has gone quiet: no report and no terminal activity",cls:"warn"});else if(e.signal==="unverified")o.push({text:"unverified",title:"The agent ended without finishing this stage properly",cls:"warn"});if(e.pty&&e.pty.alive&&e.pty.asking)o.push({icon:"ask",title:"The agent is asking you something: open it, terminal button at the top",cls:"ask"});else if(e.pty&&e.pty.alive)o.push({icon:"term",title:"The agent is running in this run's workspace: open it",cls:"run"});let a=e.notes&&/^\[[^\]]*\] (?:Gathered from|Promoted from the icebox:) (.+?)\. Outside text/.exec(e.notes);if(e.parent)n.push({text:h_(e.parent),title:`Filed by ${e.parent}`,cls:"link"});if(e.kind==="backlog"){if(e.severity)n.push({text:e.severity,cls:e.severity==="critical"||e.severity==="high"?"warn":"",dot:!0});n.push(e.source==="orphan"?{text:"orphaned",title:"Kept from a pruned run"}:{text:h_(e.source||""),title:`Left by ${e.source}${e.at?" · "+e.at:""}`,cls:"link"})}if(e.branch)n.push({text:"branch",title:`Built on its own branch, ${e.branch}`});if(a)n.push({text:"gathered",title:`From ${a[1]}`});else if(e.notes)n.push({text:"notes"});if(e.git)o.push({icon:"git",sprite:"c",title:e.git==="pushed"?"Committed & pushed":"Not committed & pushed yet",cls:e.git==="pushed"?"ok":"warn"});if(e.open)o.push({icon:"bug",title:`${e.open} open finding${e.open===1?"":"s"} to fix`,cls:"warn"});return{chips:n,marks:o}}function k_(e,t){let n=(o,r,a,i,s)=>({id:o,label:r,icon:a,danger:i,before:s});if(t.archive)return[n("restore","Restore","restore"),n("open","Open","open"),...e.kind==="idea"?[n("delete","Delete","trash",!0,!0)]:[]];if(e.kind==="backlog")return[n("run",e.status==="starting"?"Run again":"Run","play"),n("open","Open its run","open"),n("reject","Reject","x",!0,!0)];if(e.kind==="idea"&&e.status==="idea")return[n("run","Run","play"),n("edit","Edit","pen"),...t.otherProjects?[n("move","Move to project","ext")]:[],n("archive","Archive","archive"),n("reject","Reject","x",!1,!0),n("delete","Delete","trash",!0)];if(e.kind==="idea")return[n("open","Open","open"),n("run","Run again","play"),n("archive","Archive","archive"),n("delete","Remove","trash",!0,!0)];return[n("open",LN(e,t.answered),"open"),n("archive","Archive","archive"),...e.column===1&&e.status!=="abandoned"?[n("toidea","Back to task","restore")]:[]]}var Ux=(e)=>fm[e.status]||"idea",S_=(e)=>e.status==="waiting"?Ls(e.awaiting)||"needs you":e.status||"idea",C_=(e)=>lu[e]||e,N_=(e)=>e.kind==="run"?(e.text??"").replace(/-/g," "):"";function Bs(e){let t=/(^|[.!?)]\s+|\s)((?:[A-Z][A-Z-]+(?: [A-Z][A-Z-]+){1,3}|[A-Z][\w-]*(?: [a-z][\w-]*){0,3})(?: \([^)]*\))?):\s+/g,n=[],o;while(o=t.exec(e))if(!/^\s+$/.test(o[1])||!n.length&&!o[2].includes(" "))n.push([o.index+o[1].length,o[2],t.lastIndex]);if(n.length<2)return{head:e,parts:[]};let r=n.map(([,a,i],s)=>{let l=e.slice(i,s+1<n.length?n[s+1][0]:e.length).trim(),c=l.split(/\s*\((\d+)\)\s+/);if(c.length<5)return{label:a,body:l};let d=[];for(let p=1;p<c.length;p+=2)d.push([c[p],c[p+1]]);let u=d.every(([p],f)=>+p===f+1);return{label:a,body:(c[0]?c[0]+`
11
+ `:"")+d.map(([p,f],g)=>u?`${g+1}. ${f}`:`- (${p}) ${f}`).join(`
12
+ `)}});return{head:e.slice(0,n[0][0]).trim()||`${r[0].label}: ${e.slice(n[0][2],n[1][0]).trim()}`,parts:r}}var Lee=[];function jd(e){Promise.allSettled(Lee.map((t)=>t())).then(()=>location.href=e)}function R_(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=R_(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Gx(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=R_(e))&&(o&&(o+=" "),o+=t);return o}var Bee=(e,t)=>{let n=Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},Hee=(e,t)=>({classGroupId:e,validator:t}),P_=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var T_=[];var jee=(e)=>{let t=Gee(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:(i)=>{if(i.startsWith("[")&&i.endsWith("]"))return Uee(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return O_(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],c=n[i];if(l){if(c)return Bee(c,l);return l}return c||T_}return n[i]||T_}}},O_=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let c=O_(e,t+1,a);if(c)return c}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let c=0;c<l;c++){let d=i[c];if(d.validator(s))return d.classGroupId}return},Uee=(e)=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?"arbitrary.."+o:void 0})(),Gee=(e)=>{let{theme:t,classGroups:n}=e;return Fee(n,t)},Fee=(e,t)=>{let n=P_();for(let o in e){let r=e[o];HN(r,n,o,t)}return n},HN=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];Vee(i,t,n,o)}},Vee=(e,t,n,o)=>{if(typeof e==="string"){Kee(e,t,n);return}if(typeof e==="function"){qee(e,t,n,o);return}$ee(e,t,n,o)},Kee=(e,t,n)=>{let o=e===""?t:__(t,e);o.classGroupId=n},qee=(e,t,n,o)=>{if(Yee(e)){HN(e(o),t,n,o);return}if(t.validators===null)t.validators=[];t.validators.push(Hee(n,e))},$ee=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];HN(l,__(t,s),n,o)}},__=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);if(!s)s=P_(),n.nextPart.set(i,s);n=s}return n},Yee=(e)=>("isThemeGetter"in e)&&e.isThemeGetter===!0,Wee=(e)=>{if(e<1)return{get:()=>{return},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{if(n[a]=i,t++,t>e)t=0,o=n,n=Object.create(null)};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){if(a in n)n[a]=i;else r(a,i)}}};var Xee=[],E_=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),Qee=(e)=>{let{prefix:t,experimentalParseClassName:n}=e,o=(r)=>{let a=[],i=0,s=0,l=0,c,d=r.length;for(let m=0;m<d;m++){let y=r[m];if(i===0&&s===0){if(y===":"){a.push(r.slice(l,m)),l=m+1;continue}if(y==="/"){c=m;continue}}if(y==="[")i++;else if(y==="]")i--;else if(y==="(")s++;else if(y===")")s--}let u=a.length===0?r:r.slice(l),p=u,f=!1;if(u.endsWith("!"))p=u.slice(0,-1),f=!0;else if(u.startsWith("!"))p=u.slice(1),f=!0;let g=c&&c>l?c-l:void 0;return E_(a,f,p,g)};if(t){let r=t+":",a=o;o=(i)=>i.startsWith(r)?a(i.slice(r.length)):E_(Xee,!1,i,void 0,!0)}if(n){let r=o;o=(a)=>n({className:a,parseClassName:r})}return o},Zee=(e)=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),(n)=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);if(s||l){if(r.length>0)r.sort(),o.push(...r),r=[];o.push(i)}else r.push(i)}if(r.length>0)r.sort(),o.push(...r);return o}},Jee=(e)=>({cache:Wee(e.cacheSize),parseClassName:Qee(e),sortModifiers:Zee(e),postfixLookupClassGroupIds:ete(e),...jee(e)}),ete=(e)=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},tte=/\s+/,nte=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(tte),c="";for(let d=l.length-1;d>=0;d-=1){let u=l[d],{isExternal:p,modifiers:f,hasImportantModifier:g,baseClassName:m,maybePostfixModifierPosition:y}=n(u);if(p){c=u+(c.length>0?" "+c:c);continue}let b=!!y,x;if(b){let R=m.substring(0,y);x=o(R);let A=x&&i[x]?o(m):void 0;if(A&&A!==x)x=A,b=!1}else x=o(m);if(!x){if(!b){c=u+(c.length>0?" "+c:c);continue}if(x=o(m),!x){c=u+(c.length>0?" "+c:c);continue}b=!1}let v=f.length===0?"":f.length===1?f[0]:a(f).join(":"),k=g?v+"!":v,S=k+x;if(s.indexOf(S)>-1)continue;s.push(S);let N=r(x,b);for(let R=0;R<N.length;++R){let A=N[R];s.push(k+A)}c=u+(c.length>0?" "+c:c)}return c},ote=(...e)=>{let t=0,n,o,r="";while(t<e.length)if(n=e[t++]){if(o=z_(n))r&&(r+=" "),r+=o}return r},z_=(e)=>{if(typeof e==="string")return e;let t,n="";for(let o=0;o<e.length;o++)if(e[o]){if(t=z_(e[o]))n&&(n+=" "),n+=t}return n},rte=(e,...t)=>{let n,o,r,a,i=(l)=>{let c=t.reduce((d,u)=>u(d),e());return n=Jee(c),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=(l)=>{let c=o(l);if(c)return c;let d=nte(l,n);return r(l,d),d};return a=i,(...l)=>a(ote(...l))},ate=[],Ro=(e)=>{let t=(n)=>n[e]||ate;return t.isThemeGetter=!0,t.themeKey=e,t},I_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ite=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ste=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lte=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cte=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,ute=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dte=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cu=(e)=>ite.test(e),tt=(e)=>!!e&&!Number.isNaN(Number(e)),Hs=(e)=>!!e&&Number.isInteger(Number(e)),BN=(e)=>e.endsWith("%")&&tt(e.slice(0,-1)),Ml=(e)=>ste.test(e),B_=()=>!0,pte=(e)=>lte.test(e)&&!cte.test(e),jN=()=>!1,fte=(e)=>ute.test(e),mte=(e)=>dte.test(e),gte=(e)=>!ue(e)&&!pe(e),hte=(e)=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),bte=(e)=>uu(e,U_,jN),ue=(e)=>I_.test(e),Ud=(e)=>uu(e,G_,pte),A_=(e)=>uu(e,Nte,tt),vte=(e)=>uu(e,V_,B_),yte=(e)=>uu(e,F_,jN),M_=(e)=>uu(e,H_,jN),xte=(e)=>uu(e,j_,mte),Fx=(e)=>uu(e,K_,fte),pe=(e)=>L_.test(e),Xh=(e)=>Gd(e,G_),wte=(e)=>Gd(e,F_),D_=(e)=>Gd(e,H_),kte=(e)=>Gd(e,U_),Ste=(e)=>Gd(e,j_),Vx=(e)=>Gd(e,K_,!0),Cte=(e)=>Gd(e,V_,!0),uu=(e,t,n)=>{let o=I_.exec(e);if(o){if(o[1])return t(o[1]);return n(o[2])}return!1},Gd=(e,t,n=!1)=>{let o=L_.exec(e);if(o){if(o[1])return t(o[1]);return n}return!1},H_=(e)=>e==="position"||e==="percentage",j_=(e)=>e==="image"||e==="url",U_=(e)=>e==="length"||e==="size"||e==="bg-size",G_=(e)=>e==="length",Nte=(e)=>e==="number",F_=(e)=>e==="family-name",V_=(e)=>e==="number"||e==="weight",K_=(e)=>e==="shadow";var Rte=()=>{let e=Ro("color"),t=Ro("font"),n=Ro("text"),o=Ro("font-weight"),r=Ro("tracking"),a=Ro("leading"),i=Ro("breakpoint"),s=Ro("container"),l=Ro("spacing"),c=Ro("radius"),d=Ro("shadow"),u=Ro("inset-shadow"),p=Ro("text-shadow"),f=Ro("drop-shadow"),g=Ro("blur"),m=Ro("perspective"),y=Ro("aspect"),b=Ro("ease"),x=Ro("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...k(),pe,ue],N=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],A=()=>[pe,ue,l],D=()=>[cu,"full","auto",...A()],E=()=>[Hs,"none","subgrid",pe,ue],z=()=>["auto",{span:["full",Hs,pe,ue]},Hs,pe,ue],B=()=>[Hs,"auto",pe,ue],Z=()=>["auto","min","max","fr",pe,ue],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],xe=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...A()],ye=()=>[cu,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],ae=()=>[s,cu,"screen","full","dvw","lvw","svw","min","max","fit",...A()],ge=()=>[cu,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],P=()=>[e,pe,ue],Ae=()=>[...k(),D_,M_,{position:[pe,ue]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",kte,bte,{size:[pe,ue]}],te=()=>[BN,Xh,Ud],F=()=>["","none","full",c,pe,ue],H=()=>["",tt,Xh,Ud],he=()=>["solid","dashed","dotted","double"],Ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[tt,BN,D_,M_],be=()=>["","none",g,pe,ue],Et=()=>["none",tt,pe,ue],pt=()=>["none",tt,pe,ue],ze=()=>[tt,pe,ue],qe=()=>[cu,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ml],breakpoint:[Ml],color:[B_],container:[Ml],"drop-shadow":[Ml],ease:["in","out","in-out"],font:[gte],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ml],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ml],shadow:[Ml],spacing:["px",tt],text:[Ml],"text-shadow":[Ml],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cu,ue,pe,y]}],container:["container"],"container-type":[{"@container":["","normal","size",pe,ue]}],"container-named":[hte],columns:[{columns:[tt,"auto",ue,pe,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Hs,"auto",pe,ue]}],basis:[{basis:[cu,"full","auto",s,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,cu,"auto","initial","none",ue]}],grow:[{grow:["",tt,pe,ue]}],shrink:[{shrink:["",tt,pe,ue]}],order:[{order:[Hs,"first","last","none",pe,ue]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Z()}],"auto-rows":[{"auto-rows":Z()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...xe(),"normal"]}],"justify-self":[{"justify-self":["auto",...xe()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...xe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...xe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...xe(),"baseline"]}],"place-self":[{"place-self":["auto",...xe()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:ye()}],"inline-size":[{inline:["auto",...ae()]}],"min-inline-size":[{"min-inline":["auto",...ae()]}],"max-inline-size":[{"max-inline":["none",...ae()]}],"block-size":[{block:["auto",...ge()]}],"min-block-size":[{"min-block":["auto",...ge()]}],"max-block-size":[{"max-block":["none",...ge()]}],w:[{w:[s,"screen",...ye()]}],"min-w":[{"min-w":[s,"screen","none",...ye()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...ye()]}],h:[{h:["screen","lh",...ye()]}],"min-h":[{"min-h":["screen","lh","none",...ye()]}],"max-h":[{"max-h":["screen","lh","none",...ye()]}],"font-size":[{text:["base",n,Xh,Ud]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Cte,vte]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",BN,ue]}],"font-family":[{font:[wte,yte,t]}],"font-features":[{"font-features":[ue]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,pe,ue]}],"line-clamp":[{"line-clamp":[tt,"none",pe,A_]}],leading:[{leading:["none",a,...A()]}],"list-image":[{"list-image":["none",pe,ue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pe,ue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",pe,Ud]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[tt,"auto",pe,ue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"tab-size":[{tab:[Hs,pe,ue]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pe,ue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pe,ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ae()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hs,pe,ue],radial:["",pe,ue],conic:["",Hs,pe,ue]},Ste,xte]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,pe,ue]}],"outline-w":[{outline:["",tt,Xh,Ud]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","inner","none",d,Vx,Fx]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,Vx,Fx]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[tt,Ud]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,Vx,Fx]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[tt,pe,ue]}],"mix-blend":[{"mix-blend":[...Ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[pe,ue]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ae()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pe,ue]}],filter:[{filter:["","none",pe,ue]}],blur:[{blur:be()}],brightness:[{brightness:[tt,pe,ue]}],contrast:[{contrast:[tt,pe,ue]}],"drop-shadow":[{"drop-shadow":["","none",f,Vx,Fx]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",tt,pe,ue]}],"hue-rotate":[{"hue-rotate":[tt,pe,ue]}],invert:[{invert:["",tt,pe,ue]}],saturate:[{saturate:[tt,pe,ue]}],sepia:[{sepia:["",tt,pe,ue]}],"backdrop-filter":[{"backdrop-filter":["","none",pe,ue]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[tt,pe,ue]}],"backdrop-contrast":[{"backdrop-contrast":[tt,pe,ue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,pe,ue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,pe,ue]}],"backdrop-invert":[{"backdrop-invert":["",tt,pe,ue]}],"backdrop-opacity":[{"backdrop-opacity":[tt,pe,ue]}],"backdrop-saturate":[{"backdrop-saturate":[tt,pe,ue]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,pe,ue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pe,ue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",pe,ue]}],ease:[{ease:["linear","initial",b,pe,ue]}],delay:[{delay:[tt,pe,ue]}],animate:[{animate:["none",x,pe,ue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,pe,ue]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:Et()}],"rotate-x":[{"rotate-x":Et()}],"rotate-y":[{"rotate-y":Et()}],"rotate-z":[{"rotate-z":Et()}],scale:[{scale:pt()}],"scale-x":[{"scale-x":pt()}],"scale-y":[{"scale-y":pt()}],"scale-z":[{"scale-z":pt()}],"scale-3d":["scale-3d"],skew:[{skew:ze()}],"skew-x":[{"skew-x":ze()}],"skew-y":[{"skew-y":ze()}],transform:[{transform:[pe,ue,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Hs,pe,ue]}],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pe,ue]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pe,ue]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[tt,Xh,Ud,A_]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var q_=rte(Rte);var C=(...e)=>q_(Gx(e)),$_,Y_=(e)=>void($_=e??void 0),Xo=()=>$_,nt=()=>matchMedia("(max-width:640px)").matches;var Kx=()=>!!Xo()?.querySelector("[data-state=open]"),W_=(e)=>!!e.closest("dialog")||!!Xo()?.contains(e);function X_(){let e=new Map,t=new Map;return(n,o,r,a)=>{let i=e.get(n);if(e.set(n,o),i&&o!==i)t.set(n,a);return i!==void 0&&!!o&&o!==i&&!(r&&a-(t.get(n)??-1/0)<60000)}}var Dl=de()(()=>({tasks:[],tasksLoaded:!1,tasksError:"",filter:"all",query:"",scope:"",taskId:"",taskDir:"",page:null,pageError:"",pending:!1,receipt:"",draft:""})),{getState:js,setState:uo}=Dl;var Q_=()=>globalThis.kzTerm;var UN=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},mm=(e)=>UN()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve());function J_(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}var e6=(e,t)=>{try{return localStorage.getItem(e)||t}catch(n){return t}},GN=()=>e6("kz-notify","on")==="on",qx=()=>e6("kz-sound","Bellatrix"),t6=["Adara","Alya","Bellatrix","Beryllium","Cobalt","Fluorine","Krypton","Palladium","Rubidium","Xenon"],n6=["off",...t6,"chime","bell","pop"],Z_={chime:[[880,0,0.25],[1320,0.12,0.35]],bell:[[660,0,0.9]],pop:[[520,0,0.08]]},Us;function $x(e=qx()){try{if(t6.includes(e)){let n=new Audio(`/sounds/${e}.mp3`);n.volume=0.35,n.play().catch(()=>{});return}if(!Z_[e])return;Us=Us||new AudioContext,Us.resume();let t=Us.currentTime+0.02;for(let[n,o,r]of Z_[e]){let a=Us.createOscillator(),i=Us.createGain();a.type=e==="pop"?"triangle":"sine",a.frequency.value=n,i.gain.setValueAtTime(0.0001,t+o),i.gain.exponentialRampToValueAtTime(0.25,t+o+0.01),i.gain.exponentialRampToValueAtTime(0.0001,t+o+r),a.connect(i).connect(Us.destination),a.start(t+o),a.stop(t+o+r+0.05)}}catch(t){}}addEventListener("pointerdown",()=>{try{Us=Us||new AudioContext,Us.resume()}catch(e){}},{once:!0});function FN(e,t){if(!GN())return;$x();try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var du=de()(()=>({dark:!1,min:!1,setup:null,openSetup:null,look:0})),{getState:o6,setState:Fd}=du,Qh=(e)=>Fd({setup:e&&e.resume?{resume:!0,step:e.step??0,total:e.total??4}:null});var Yx=(e)=>{try{return localStorage.getItem(e)}catch{return null}},r6="(max-width:1100px)",a6="(max-width:640px)",Tte=(e,t,n)=>n||(e?e==="min":t);function VN(e,t){let n=matchMedia("(max-width:640px)").matches,o=Tte(t,matchMedia("(max-width:1100px)").matches,n);return e.dataset.rail=o?"min":"full",e.dataset.hide=!n&&t==="min"?"1":"0",o}function i6(e=document.documentElement){VN(e,Yx("kz-rail"));let t=window.kaizenDesktop;if(t){if(e.classList.add("desk"),t.platform==="darwin")e.classList.add("mac")}if(Yx("kz-color")==="blue")e.dataset.color="blue";let n=Yx("kz-theme");if(n)e.dataset.theme=n;let o=Yx("kz-motion");if(o)e.dataset.motion=o}function s6(){let e=navigator;if(!matchMedia("(display-mode:standalone)").matches&&!e.standalone)return;let t=document.querySelector("meta[name=viewport]");if(t)t.content+=",maximum-scale=1,user-scalable=no";if(addEventListener("gesturestart",(n)=>n.preventDefault()),e.standalone)addEventListener("resize",()=>scrollTo(0,0))}var Ia=()=>document.documentElement,Ete=(e)=>{try{return localStorage.getItem(e)}catch{return null}},Qx=(e,t)=>{try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}},Ate=()=>window.kaizenDesktop,Mte=()=>matchMedia("(prefers-color-scheme: dark)").matches,l6=()=>Ia().dataset.theme?Ia().dataset.theme==="dark":Mte(),KN=()=>{Fd({dark:l6()}),Ate()?.titleBar?.(l6())},qN=()=>{Fd((e)=>({look:e.look+1})),Q_()?.retheme()};function Zh(e){if(e==="system")delete Ia().dataset.theme;else Ia().dataset.theme=e;Qx("kz-theme",e==="system"?null:e),KN(),qN()}function u6(e){if(e==="blue")Ia().dataset.color=e;else delete Ia().dataset.color;Qx("kz-color",e==="blue"?e:null),qN()}function d6(e){if(e==="system")delete Ia().dataset.motion;else Ia().dataset.motion=e;Qx("kz-motion",e==="system"?null:e)}var Zx=()=>Zh(o6().dark?"light":"dark"),Xx=null,Dte=()=>matchMedia(r6),Pte=()=>matchMedia(a6),Wx=()=>Fd({min:VN(Ia(),Xx)});function Jx(){Xx=Ia().dataset.rail==="min"?"full":"min",Qx("kz-rail",Xx),Wx()}var c6=!1;function p6(){if(c6)return;if(c6=!0,i6(),!Ia().dataset.boot)s6();Xx=Ete("kz-rail"),Dte().addEventListener("change",Wx),Pte().addEventListener("change",Wx),Wx(),addEventListener("storage",(e)=>{let t={"kz-theme":"theme","kz-color":"color","kz-motion":"motion"}[e.key??""];if(!t)return;if(e.newValue)Ia().dataset[t]=e.newValue;else delete Ia().dataset[t];qN()}),matchMedia("(prefers-color-scheme: dark)").addEventListener("change",KN),KN(),fetch("/onboarding").then((e)=>e.ok?e.json():null).then(Qh).catch(()=>{})}var Jh=de()(()=>({on:!1})),Gs=(e)=>Jh.setState({on:e});function eb(e){return e.toLowerCase().trim().replace(/[^a-z0-9/._-]+/g,"-").replace(/\.{2,}/g,".").replace(/\/{2,}/g,"/").replace(/(^|\/)[-.]+/g,"$1").slice(0,60).replace(/[-./]+(\/|$)/g,"$1").replace(/\/$/,"").replace(/\.lock(\/|$)/g,"-lock$1")}var ew=de()(()=>({open:null})),Ote=0,ci=(e={})=>ew.setState({open:{...e,n:++Ote}}),gm=()=>ew.setState({open:null});async function Pl(e,t){try{let n=await fetch(e,t?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}:void 0),o=await n.json().catch(()=>({}));return{ok:n.ok,d:n.ok?o:{error:o.error||o.why||"that did not work"}}}catch{return{ok:!1,d:{error:"kaizen is offline"}}}}var _te=(e)=>e.includes("\\")?"\\":"/",f6=(e,t)=>e.replace(/[\\/]+$/,"")+_te(e)+t,m6=(e)=>!!e&&!/[\\/:*?"<>|]/.test(e),g6=(e,t,n=()=>Math.random().toString(36).slice(2,6))=>e.trim()||eb(t)||"workspace-"+n(),tb="__current";var bz=h(I(),1);var yt=de()(()=>({state:{project:null,projects:[],cards:[],now:Date.now(),all:!1,dir:null},loaded:!1,all:typeof location>"u"?!0:new URLSearchParams(location.search).get("all")!=="0",dir:null,every:null,tasks:null,sources:null,shells:[],changed:0})),{getState:oe,setState:po}=yt,ui=(e,t)=>yt.subscribe((n,o)=>e(n)!==e(o)?t(e(n),e(o)):void 0),zr=(e)=>ui((t)=>t.state,e),tw=(e)=>po({tasks:e}),h6=(e)=>po({shells:e});function b6(e,t=oe().tasks){if(t){let n=new Set(e.map((o)=>o.state).filter(Boolean));return t.filter((o)=>(!n.size||n.has(o.dir))&&o.attention.category==="needs-you").length}return e.filter((n)=>!n.archived&&(n.kind==="run"&&n.status==="waiting"||n.pty?.alive&&n.pty.asking)).length}var v6=(e)=>e?.filter((t)=>t.attention.category==="needs-you").length??0,y6=(e)=>(e?.icebox??[]).filter((t)=>t.status==="new"&&!t.asleep).length,x6=(e,t)=>e.filter((n)=>n.pty?.alive).length+t.length;var k6=2000,S6=2000,C6=30000,$N=(e)=>e.replace(/"now":\d+\}$/,""),N6=(e,t,n)=>Math.max(0,t+(n?5000:500)-e),R6=(e,t,n,o,r)=>e&&t===n&&o-r<30000,T6=(e)=>e.kind==="idea"?"idea:"+e.state+":"+e.text:"run:"+e.state+":"+e.id,Ne=(e)=>e._k||T6(e);function E6(e){let t=new Map;for(let n of e){let o=T6(n),r=t.get(o)||0;t.set(o,r+1),n._k=r?o+"#"+r:o}}var w6=(e)=>e.status==="waiting"||!!(e.pty?.alive&&e.pty.asking);function A6(e,t){let n=[],o=[];for(let r of e?t:[]){let a=e.get(Ne(r));if(a&&a[0]!==r.column)n.push(Ne(r));if(a&&!a[1]&&w6(r))o.push(Ne(r))}return{moved:n,flash:o,next:new Map(t.map((r)=>[Ne(r),[r.column,w6(r)]]))}}var M6=(e)=>new Map(e.filter((t)=>!t.archived&&t.pty?.alive&&t.pty.asking).map((t)=>[t.pty.key,t])),D6=(e,t)=>e?[...t].filter(([n])=>!e.has(n)).map(([,n])=>n):[];var zte=["settings","sources","terminal","board","tasks","task","run","chat","device"];function nw(e,t){let n=e==="icebox"?"sources":e==="ws"?"run":e==="ideas"?"tasks":e??"";if(!zte.includes(n))n="home";if(t?n==="board"||n==="sources":n==="chat"||n==="device")n="home";return n}var Ite=(e,t)=>nw(new URLSearchParams(e).get("view"),t),P6=(e,t,n)=>n?"board":Ite(e,t);function ow(e,t){let n=t&&e==="home";return{paged:e!=="board",ice:e==="sources",setv:e==="settings",termv:e==="terminal",homev:e==="home"&&!n||e==="chat",phomev:n||e==="device",pdevv:e==="device",taskv:e==="tasks",taskpagev:e==="task",runv:e==="run"}}var O6=(e,t)=>e==="home"?t:"?view="+(e==="sources"?"icebox":e),_6=(e,t)=>e==="task"?t?"device":"tasks":e==="run"&&t?"device":e,Lte={sources:"Icebox",tasks:"Tasks",task:"Task",run:"Run",terminal:"Terminal",chat:"Chat",device:"Runs"},z6=(e,t)=>e==="home"?t?"kaizen":"Chat":Lte[e]??"Board",I6=(e,t)=>e==="tasks"?"tasks":e==="task"?"task":e==="sources"?"icebox":e==="home"&&!t||e==="chat"?"home":"",L6=(e)=>e==="tasks"?"tasks":e==="task"?"task":e==="sources"?"icebox":"";function YN(e){let t=new URLSearchParams(e);if(t.get("view")!=="run"&&t.get("view")!=="ws")return null;let n=t.get("dir");if(!n)return null;return{dir:n,...t.get("ws")?{ws:t.get("ws")}:{},...t.get("id")?{id:t.get("id")}:{},...t.get("idea")!==null?{idea:t.get("idea")}:{}}}function B6(e){let t=new URLSearchParams(e),n=t.get("run"),o=t.get("idea");if(!n&&o===null||t.get("view")==="run")return null;let r=/^(finding|backlog)-(\d+)$/.exec(t.get("item")||""),a=t.get("tab")||(r?r[1]==="finding"?"review":"backlog":"");return{dir:t.get("dir"),run:n,idea:o,tab:a==="work"?"impl":a,item:r?{type:r[1],n:+r[2]}:null}}var H6=h(Za(),1);var j6=(e,t)=>({view:e,lit:_6(e,t),title:z6(e,t),mark:e==="home"&&t,page:L6(e)}),U6=(e,t,n)=>{let o=I6(t,n);return o&&!e.includes(o)?[...e,o]:e},Bte=()=>{let e=typeof location>"u"?"":location.search,t=typeof matchMedia>"u"?!1:nt(),n=P6(e,t,typeof document<"u"&&document.documentElement.hasAttribute("data-kit"));return{...j6(n,t),seen:U6([],n,t),search:e,run:YN(e),menu:!1,visit:0}},ut=de()(Bte),Ze=ut.getState,nb={},G6=(e)=>nb=e,F6=(e)=>ut.setState({title:e}),ob=()=>ut.setState({search:location.search,run:YN(location.search)});function Ki(e,t=!1){let n=nt(),o=nw(e,n),r=Ze().view;if(nb.prepare?.(o),H6.flushSync(()=>ut.setState((a)=>({...j6(o,n),seen:U6(a.seen,o,n),menu:!1,visit:a.visit+1}))),nb.leave?.(o,r),t&&o!==r&&o!=="run"&&o!=="task")history.pushState(null,"",O6(o,location.pathname));ob(),nb.enter?.(o,r)}var hm=()=>ow(Ze().view,nt()).homev,V6=()=>ut.setState((e)=>({menu:!e.menu})),WN=!1;function XN(e){if(nb.before?.(nw(e,nt())),e==="board"&&Ze().view==="board"){let t=WN;return WN=!1,void(t?history.back():mm(()=>Ki("home",!0)))}mm(()=>{Ki(e,!0),WN=e==="board"})}function K6(){addEventListener("popstate",()=>mm(()=>Ki(new URLSearchParams(location.search).get("view")))),document.addEventListener("click",(e)=>{let t=e.target.closest?.(".rail a[data-view], .rail a.home");if(!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button)return;let n=t.classList.contains("home")?"home":t.dataset.view;if(n==="notes"||n==="video")return;e.preventDefault(),XN(n)})}var q6=h(I(),1);function $6(){let e=ut((n)=>n.view),t=ut((n)=>n.menu);q6.useLayoutEffect(()=>{let n=ow(e,nt());for(let[o,r]of Object.entries(n))document.body.classList.toggle(o,r);document.body.classList.toggle("phone-menu-open",t)},[e,t])}var tR=()=>{let{dir:e}=oe();return e?{"x-kz-dir":e}:{}},Hte="The kaizen server is not running — start it with kaizen web (or the shortcut), then reload.",oz=()=>{},rz=(e)=>oz=e,az=(e)=>({cards:e.cards,projects:[...e.projects,...e.rail??[]],agents:e.agents??[]}),eR=0;function iz(e,t={}){eR++,po({every:e,...t})}var Y6=0,W6="",X6=0,sz=0,rb=0,lz=()=>(rb=0,sz=Date.now(),cz(!0));function fo(e){if(!e)return cz(!1);if(!rb)rb=setTimeout(lz,N6(Date.now(),sz,document.hidden))}function jte(){if(!document.hidden&&rb)clearTimeout(rb),lz()}async function cz(e){let t=++Y6,n=oe().all,o;try{o=await fetch("/state"+(n?"?all=1":""),{headers:tR()})}catch{_(Hte);return}let r=await o.text();if(t!==Y6)return;let a=$N(r),i=R6(e,a,W6,Date.now(),X6);if(W6=a,i){if(!n)ab();return}X6=Date.now();let s=JSON.parse(r),l=oe().state;if(E6(s.cards),n)iz(az(s),{state:s,loaded:!0});else po({state:s,loaded:!0}),ab();await oz(s,l,e)}var Q6="",QN=!1,rw=!1,Z6=0,J6;async function ab(){if(QN){rw=!0;return}let e=Z6+k6-Date.now();if(e>0){J6??=setTimeout(()=>{J6=void 0,ab()},e);return}Z6=Date.now(),QN=!0;do{rw=!1;let t=eR;try{let n=await fetch("/state?all=1");if(!n.ok)continue;let o=await n.text(),r=$N(o);if(r===Q6)continue;if(!rw&&t===eR){Q6=r;let a=JSON.parse(o);iz(az(a))}}catch{}}while(rw);QN=!1}var ez=0,ZN=!1;async function tz(){if(ZN||Date.now()-ez<S6)return;ZN=!0,ez=Date.now();try{let e=await fetch("/tasks?all=1");if(e.ok)po({tasks:(await e.json()).tasks??[]})}catch{}finally{ZN=!1}}var nz=0;async function Ute(e=!1){if(!e&&Date.now()-nz<C6)return;nz=Date.now();try{let t=await fetch("/sources");if(t.ok)po({sources:await t.json()})}catch{}}async function ib(){try{return po({shells:await(await fetch("/shells")).json()}),!0}catch{return!1}}function uz(e=!1){return tz(),ui((t)=>t.every,()=>{if(Ute(),tz(),e)ib()})}var JN=null,dz=!1,Gte=()=>hm()?dz=!0:location.reload();function pz(){let e=new EventSource("/events");e.onmessage=(t)=>{if(t.data==="changed")fo(!0),po((n)=>({changed:n.changed+1}));else if(t.data.startsWith("hello ")){let n=t.data.slice(6);if(JN&&n!==JN)Gte();JN=n}},e.onerror=()=>{e.close(),setTimeout(pz,3000)}}function fz(){ut.subscribe((e,t)=>e.view!==t.view&&dz&&!hm()&&location.reload()),addEventListener("focus",()=>fo(!0)),addEventListener("visibilitychange",jte),pz()}var mz=h(I(),1);var gz={cards:[],projects:[],agents:[],tasks:null},qi=()=>{let e=yt((n)=>n.every),t=yt((n)=>n.tasks);return mz.useMemo(()=>e?{...e,tasks:t}:{...gz,tasks:t},[e,t])},$i=()=>{let{every:e,tasks:t}=yt.getState();return e?{...e,tasks:t}:{...gz,tasks:t}},hz=()=>yt((e)=>x6(e.every?.cards??[],e.shells));var aw="all",Ol=de()(()=>({shown:(()=>{try{return JSON.parse(localStorage.getItem("kz-show")??"null")||[]}catch{return[]}})()})),sb=()=>new Set(Ol.getState().shown);function vz(e){try{localStorage.setItem("kz-show",JSON.stringify(e))}catch{}Ol.setState({shown:e})}var yz=(e)=>{let t=sb();t.has(e)?t.delete(e):t.add(e),vz([...t])},iw=()=>vz([]);function Vd(e=oe().state){let t=[...e.projects];for(let n of e.cards)if(!t.some((o)=>o.dir===n.state))t.push({dir:n.state,label:n.where});return t}var Fte=(e=oe().state)=>[["All projects","all"],...e.projects.map((t)=>[t.label,t.dir]),...(e.fresh??[]).map((t)=>[t.label,t.dir,1]),["New project…","__new"],["Find projects on this PC…","__find"],["Clone from GitHub…","__clone"]].map((t)=>({label:t[0],value:t[1],fresh:!!t[2]}));function nR(){let e=yt((o)=>o.state),t=yt((o)=>o.all),n=Ol((o)=>o.shown);return bz.useMemo(()=>({rows:Fte(e),dir:t||!e.dir?"":e.dir,showable:Vd(e),shown:n}),[e,t,n])}var xz=(e,t)=>{let n=t.filter((o)=>e.includes(o.dir)).length;return n?`Showing ${n} of ${t.length}`:"Showing all"},wz=(e,t)=>{let n=t.filter((o)=>e.includes(o.dir)).length;return n?`${n} of ${t.length} shown`:`All ${t.length} shown`},oR=(e)=>e==="__new"||e==="__find"||e==="__clone";var sw=de()(()=>({at:null})),kz=(e,t,n)=>sw.setState({at:{x:e,y:t,items:n}}),Sz=()=>sw.setState({at:null});var rR=typeof location<"u"&&new URLSearchParams(location.search).has("all");function bm(e){if(rR)return;try{e?localStorage.setItem("kz-proj",e):localStorage.removeItem("kz-proj")}catch(t){}}async function lb(e){if(e==="__find"){_("Searching…");let t=await K("/find",{});if(t.ok)_(t.added?`Found ${t.added} new project${t.added===1?"":"s"}`:"No new projects found")}else if(e==="__new"||e==="__clone"){ci({start:e==="__new"?"create":"clone"});return}else if(e==="all")po({all:!0}),bm();else if((await K("/cd",{dir:e})).ok)po({all:!1}),po({dir:e}),bm(e);await fo()}var Cz=h(I(),1),aR="kz-d:";function Kd(e,t=""){let[n]=Cz.useState(()=>{try{return sessionStorage.getItem(aR+e)??t}catch{return t}});return[n,(o)=>{try{sessionStorage.setItem(aR+e,o)}catch{}}]}function iR(e){try{for(let t of Object.keys(sessionStorage))if(t.startsWith(aR+e))sessionStorage.removeItem(t)}catch{}}function _l(e){let t=[];for(let n of e.clipboardData.items)if(n.kind==="file"){let o=n.getAsFile();t.push(new File([o],o.name==="image.png"?`paste-${Date.now()}.png`:o.name,{type:o.type})),e.preventDefault()}return t}var Nz=h(I(),1),sR=typeof matchMedia==="function"?matchMedia("(max-width:640px)"):null,pu=()=>Nz.useSyncExternalStore((e)=>(sR?.addEventListener("change",e),()=>sR?.removeEventListener("change",e)),()=>!!sR?.matches,()=>!1);var lR=h(I(),1),lw=[5,25,50,100];function cw(e,t){let[n,o]=lR.useState(()=>{try{let l=Number(localStorage.getItem("kz-page:"+e));if(lw.includes(l))return l}catch{}return 25}),[r,a]=lR.useState(0),i=Math.max(0,Math.min(r,Math.ceil(t.length/n)-1)),s=(l)=>{o(l),a(0);try{localStorage.setItem("kz-page:"+e,String(l))}catch{}};return{rows:t.slice(i*n,(i+1)*n),at:i,size:n,total:t.length,setAt:a,setSize:s}}async function Vte(e){if(e.size<=1500000||!/^image\/(jpeg|png|webp|bmp|heic|heif)$/.test(e.type))return e;try{let t=await createImageBitmap(e),n=Math.min(1,2560/Math.max(t.width,t.height)),o=document.createElement("canvas");o.width=Math.round(t.width*n),o.height=Math.round(t.height*n),o.getContext("2d").drawImage(t,0,0,o.width,o.height);let r=await new Promise((a)=>o.toBlob(a,"image/jpeg",0.85));return r&&r.size<e.size?new File([r],e.name.replace(/\.\w+$/,"")+".jpg",{type:"image/jpeg"}):e}catch{return e}}var Rz=(e)=>Promise.all(e.map(async(t)=>{let n=await Vte(t);return new Promise((o)=>{let r=new FileReader;r.onload=()=>o({name:n.name,data:r.result}),r.readAsDataURL(n)})}));var Tz=(e,t,n)=>{try{return JSON.parse(e().getItem(t)??"null")??n}catch{return n}},Nt=de()(()=>({snap:null,tab:(()=>{try{return localStorage.getItem("kz-ideas-tab")==="backlog"?"backlog":"ideas"}catch{return"ideas"}})(),sev:null,order:Tz(()=>localStorage,"kz-order",{}),picking:!1,picked:[],unfolded:[],kidsOpen:[],form:(()=>{let e=Tz(()=>sessionStorage,"kz-form",null);return e?{mode:e[0],key:e[1]??void 0}:null})(),popup:null,filter:null,query:(()=>{try{return sessionStorage.getItem("kz-d:bq")??""}catch{return""}})(),archive:!1,mode:(()=>{try{return localStorage.getItem("kz-board-mode")==="runs"?"runs":"ws"}catch{return"ws"}})(),flash:[],names:{}})),{getState:Ir,setState:ht}=Nt,vm=(e)=>{ht({form:e});try{sessionStorage.setItem("kz-form",JSON.stringify(e&&["new","edit","reject"].includes(e.mode)?[e.mode,e.key??null]:null))}catch{}},Ez=(e)=>e==="__archive"?ht((t)=>({archive:!t.archive,filter:null})):ht((t)=>({filter:t.filter===e?null:e})),cb=(e)=>{ht({query:e});try{sessionStorage.setItem("kz-d:bq",e)}catch{}},Az=(e)=>{ht({mode:e});try{localStorage.setItem("kz-board-mode",e)}catch{}},ym=()=>(vm(null),iR("f:")),Mz=()=>Ir().form?.mode==="new"&&vm(null),Dz=()=>(ht({popup:null}),iR("f:")),cR=(e)=>{ht({tab:e});try{localStorage.setItem("kz-ideas-tab",e)}catch{}},Pz=(e)=>{let t={...Ir().order,[e]:Ir().order[e]==="old"?"new":"old"};ht({order:t});try{localStorage.setItem("kz-order",JSON.stringify(t))}catch{}};var Oz=(e)=>"kz-browse:"+e;function _z(e){try{return localStorage.getItem(Oz(e))||"http://localhost:3000"}catch{return"http://localhost:3000"}}function qd(e,t){try{localStorage.setItem(Oz(e),t)}catch{}}var zz=(e)=>/^https?:\/\//.test(e.trim())?e.trim():"http://"+e.trim(),uR=(e)=>/^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:|\/|$)/.test(e),Iz=(e)=>({url:e,back:[],fwd:[],load:0}),dR=(e,t,n=!0)=>n&&e.url!==t?{url:t,back:[...e.back,e.url],fwd:[],load:e.load+1}:{...e,url:t,load:e.load+1},Lz=(e)=>dR(e,e.url,!1),Bz=(e)=>e.back.length?{url:e.back.at(-1),back:e.back.slice(0,-1),fwd:[...e.fwd,e.url],load:e.load+1}:e,Hz=(e)=>e.fwd.length?{url:e.fwd.at(-1),back:[...e.back,e.url],fwd:e.fwd.slice(0,-1),load:e.load+1}:e,jz=(e,t)=>t===e.url?e:{url:t,back:[...e.back,e.url],fwd:[],load:e.load},pR="This page is on the computer running kaizen; from this device localhost is the device itself. Use Open in browser on that computer.",Uz={"content-type":"application/json"},Gz=(e)=>fetch("/expose",{method:"POST",headers:Uz,body:JSON.stringify({url:e})}).then((t)=>t.json()),Fz=(e)=>fetch("/frameable?url="+encodeURIComponent(e)).then((t)=>t.json());async function uw(e){let t=await fetch("/open-url",{method:"POST",headers:Uz,body:JSON.stringify({url:e})}).catch(()=>null);if(t?.ok)return null;return"Could not open a browser window"+(t?": "+(await t.json().catch(()=>({}))).error:"")}var dw="kz-rpanel-w";var Kte=(e,t)=>Math.round(Math.min(Math.max(260,t*0.6),Math.max(260,e))),fR=(e)=>document.documentElement.style.setProperty("--rpanel-w",`${Kte(e,innerWidth)}px`);var di=(e,t)=>`ws:${e}:${t}`,vn=(e)=>typeof e==="string"?[e]:e.kids.flatMap(vn);function fu(e,t){if(typeof e==="string")return t(e)?e:null;let n=[],o=[];if(e.kids.forEach((r,a)=>{let i=fu(r,t);if(i)n.push(i),o.push(e.sizes[a]??1)}),!n.length)return null;if(n.length===1)return n[0];return n.length===e.kids.length&&n.every((r,a)=>r===e.kids[a])?e:{dir:e.dir,kids:n,sizes:o}}function mR(e,t,n,o,r=!1){if(typeof e==="string")return e===t?{dir:o,kids:r?[n,e]:[e,n],sizes:[1,1]}:e;return{...e,kids:e.kids.map((a)=>mR(a,t,n,o,r))}}function gR(e,t,n){let o=e[t];if(!o)return null;let r=n==="l"||n==="r",a=(l)=>n==="l"?o.left-l.right:n==="r"?l.left-o.right:n==="u"?o.top-l.bottom:l.top-o.bottom,i=(l)=>r?Math.min(o.bottom,l.bottom)-Math.max(o.top,l.top):Math.min(o.right,l.right)-Math.max(o.left,l.left),s=null;for(let[l,c]of Object.entries(e)){if(l===t||a(c)<-1||i(c)<=0)continue;let d=s&&e[s];if(!d||a(c)<a(d)-1||Math.abs(a(c)-a(d))<=1&&i(c)>i(d))s=l}return s}var Vz=(e)=>Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{left:n.l*1000,top:n.t*1000,right:(n.l+n.w)*1000,bottom:(n.t+n.h)*1000}])),qte={l:0,t:0,w:1,h:1};function pw(e,t=qte){let n={},o=[],r=(a,i,s)=>{if(typeof a==="string")return void(n[a]=i);let l=a.dir==="cols",c=a.sizes.reduce((f,g)=>f+g,0)||1,d=l?i.w:i.h,u=l?i.l:i.t,p=u;a.kids.forEach((f,g)=>{let m=(a.sizes[g]??1)/c*d;if(g){let y=u+m-p;o.push(l?{path:s,i:g,dir:a.dir,x:u,y:i.t,len:i.h,start:p,total:y}:{path:s,i:g,dir:a.dir,x:i.l,y:u,len:i.w,start:p,total:y})}r(f,l?{...i,l:u,w:m}:{...i,t:u,h:m},[...s,g]),p=u,u+=m})};return r(e,t,[]),{panes:n,guts:o}}var Kz=(e,t)=>Math.min(0.9,Math.max(0.1,(t-e.start)/e.total));function hR(e,t,n,o){if(typeof e==="string")return e;if(t.length){let[i,...s]=t;return{...e,kids:e.kids.map((l,c)=>c===i?hR(l,s,n,o):l)}}let r=e.sizes[n-1]+e.sizes[n],a=e.sizes.slice();return a[n-1]=r*o,a[n]=r*(1-o),{...e,sizes:a}}function bR(e,t){return[["l",e],["r",1-e],["t",t],["b",1-t]].sort((o,r)=>o[1]-r[1])[0][0]}var $te=(e,t)=>e.length===t.length&&e.every((n,o)=>n===t[o]);function qz(e,t,n,o,r){let a=e.flatMap((i)=>{let s=fu(i.tree,(c)=>n.includes(c));if(!s)return[];let l=vn(s).includes(i.focus)?i.focus:vn(s)[0];return[s===i.tree&&l===i.focus?i:{...i,tree:s,focus:l}]});for(let i of n)if(!a.some((s)=>vn(s.tree).includes(i))){let s=o&&a.find((l)=>l.id===o.screen);if(s){let l=o;a=a.map((c)=>c===s?{...c,tree:mR(c.tree,c.focus,i,l.dir),focus:i}:c),t=s.id}else a=[...a,{id:r(),tree:i,focus:i}];o=null}if(!a.some((i)=>i.id===t))t=a[0]?.id??null;return{screens:$te(a,e)?e:a,on:t,target:o}}function $z(e,t,n,o,r){if(o?.pane===t)return null;if(!o&&n&&e.some((l)=>l.id===n&&vn(l.tree).includes(t)))return null;let a=e.map((l)=>{let c=fu(l.tree,(d)=>d!==t)??"";return{...l,tree:c,focus:c!==""&&!vn(c).includes(l.focus)?vn(c)[0]:l.focus}}).filter((l)=>l.tree!==""),i=n?a.find((l)=>l.id===n):void 0;if(i)return a=a.map((l)=>l===i?{...l,tree:mR(l.tree,o?.pane??l.focus,t,o?.dir??"cols",o?.before??!1),focus:t}:l),{screens:a,on:i.id};let s=r();return{screens:[...a,{id:s,tree:t,focus:t}],on:s}}var Yz="kz-runtabs",Wz={tabs:[],hidden:[],screens:[],on:null};function Xz(e){let t=Array.isArray(e.screens)&&e.screens.every((r)=>r?.tree)?e.screens:[],{split:n,...o}=e;return{...o,tabs:(e.tabs??[]).filter((r)=>r&&r.kind!=="run"),hidden:(e.hidden??[]).filter((r)=>typeof r==="string"&&!r.startsWith("rn:")),screens:t,on:e.on??null}}function Yte(e){try{let t=JSON.parse(e||"{}");return Object.fromEntries(Object.entries(t).filter(([,n])=>n&&typeof n==="object").map(([n,o])=>[n,Xz(o)]))}catch{return{}}}var Wte=()=>{try{return Yte(localStorage.getItem(Yz))}catch{return{}}},vR=(e)=>{try{localStorage.setItem(Yz,JSON.stringify(e))}catch{}},Qz=()=>"s"+Date.now().toString(36)+Math.random().toString(36).slice(2,5),mo=de()(()=>({all:Wte(),dragging:null,target:null,browse:null,previewTick:0})),mu=mo.setState,xm=(e)=>mo.getState().all[e]??Wz;function pi(e,t,n=!0){let{all:o}=mo.getState(),r=o[e]??Wz,a=t(r);if(a===r)return;let i={...o,[e]:a};if(mu({all:i}),n)vR(i)}var Zz=()=>vR(mo.getState().all);function Jz(e){let t=Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Xz(o)]));mu({all:t}),vR(t)}var eI=(e)=>mu({target:e}),wm=(e)=>mu({dragging:e}),ub=(e,t)=>mu({browse:{k:e,url:t}}),fw=()=>mu({browse:null}),tI=()=>mu((e)=>({previewTick:e.previewTick+1}));function mw(e,t){let{target:n}=mo.getState(),o=xm(e),r=qz(o.screens,o.on,t,n,Qz);if(r.target!==n)mu({target:r.target});pi(e,(a)=>r.screens===a.screens&&r.on===a.on?a:{...a,screens:r.screens,on:r.on})}var db=(e,t)=>pi(e,(n)=>n.on===t?n:{...n,on:t}),gw=(e,t)=>pi(e,(n)=>{let o=n.screens.find((r)=>r.id===n.on);return!o||o.focus===t?n:{...n,screens:n.screens.map((r)=>r===o?{...o,focus:t}:r)}}),nI=(e,t)=>pi(e,(n)=>{let o=n.screens.find((r)=>vn(r.tree).includes(t))?.id??n.on;return o===n.on?n:{...n,on:o}});function hw(e,t,n,o){let r=$z(xm(e).screens,t,n,o,Qz);if(r)pi(e,(a)=>({...a,screens:r.screens,on:r.on}));return!!r}var oI=(e,t)=>pi(e,(n)=>({...n,screens:n.screens.map((o)=>({...o,tree:fu(o.tree,(r)=>r!==t)??o.tree}))})),rI=(e,t,n,o,r)=>pi(e,(a)=>({...a,screens:a.screens.map((i)=>i.id===t?{...i,tree:hR(i.tree,n,o,r)}:i)}),!1);var pb=new Set,gu={el:null},aI=(e)=>gu.el?.scrollBy({top:e}),fb=()=>!!gu.el?.querySelector(".notes")?.contains(document.activeElement),iI="kz-sent",st=de()(()=>({body:"",term:null,terms:[],head:null,tabs:[],tab:"",wantTab:"request",ptabs:[],runDoc:null,footer:null,doc:null,fix:null,off:[],open:!1,docked:!1,wide:!1,parked:!1,pn:!1,ro:!1,instant:!1,title:"",titleTip:"",top:0,openKey:null,card:null,openN:0,fetchAsk:0,drawAsk:0,keepNext:!1,hit:null,wantTerm:null,wantPty:null,sent:(()=>{try{return JSON.parse(sessionStorage.getItem(iI)??"[]")||[]}catch{return[]}})()})),{getState:Re,setState:Pe}=st,sI=(e)=>{let t=[...new Set([...Re().sent,...e])];Pe({sent:t});try{sessionStorage.setItem(iI,JSON.stringify(t))}catch{}};var mb=(e)=>e.pty?"running in its workspace":"opened in your terminal",yR=(e)=>O.agentLine(e.agent),lI=(e)=>e.status==="stalled"||!!(e.pty&&!e.pty.alive);async function km(e){O.notify();let t=await K("/resume",{dir:e.state,id:e.id});if(!t.ok)return!1;if(_("Resumed, "+mb(t)+": "+yR(t)),t.pty)O.launched(e,t.pty);if(O.panelOpenFor(e))O.reopenPanel(e);return!0}async function bw(e,t){if((await K("/archive",e.kind==="idea"?{dir:e.state,text:e.text,archived:t}:{dir:e.state,id:e.id,archived:t})).ok)_(t?"Archived":"Restored");O.closePanel(),O.loadBoard()}async function vw(e){if((await K("/to-task",{dir:e.state,id:e.id})).ok)_("Back in Tasks");O.loadBoard()}var xR={explore:"Explore brief ready.","approvals.plan":"Plan ready.","approvals.review":"Ready to check.",findings:"Open findings."},gb=new Set,wR=(e)=>Tn(e)+":"+e.awaiting+":"+e.moved;async function cI(e,t,n){O.notify();let o=await K("/decide",{dir:e.state,id:e.id,awaiting:e.awaiting,...t===void 0?{}:{why:t},...n?{answers:n}:{}});if(!o.ok)return!1;if(gb.add(wR(e)),_((t===void 0?"Approved":"Sent back")+", "+(o.task?"sent to the task's agent":o.reused?"sent to the agent already open in its workspace":mb(o)+": "+yR(o))),o.pty)O.launched(e,o.pty);if(O.panelOpenFor(e))O.reopenPanel(e);return!0}async function uI(e){let t=await K("/accept",{dir:e.state,id:e.id});if(t.ok)_("Approved");return!!t.ok}async function dI(e){let t=await K("/explore/skip",{dir:e.state,id:e.id});if(t.ok)_("Skip Explore sent to the agent");return!!t.ok}var pI=(e,t)=>K("/task",{dir:e.task.dir,id:e.task.id,revision:e.task.revision,operationId:crypto.randomUUID(),...t});async function fI(e){let t=await pI(e,{op:"accept",resultId:e.task.result});if(t.ok)_("Accepted");return!!t.ok}async function mI(e,t){let n=await pI(e,{op:"message",text:t});if(n.ok)_("Answer sent");return!!n.ok}async function gI(e,t){O.notify();let n=await K("/fix",{dir:e.state,id:e.id,nums:t});if(!n.ok)return!1;if(_("Fixing "+t.length+" finding"+(t.length===1?"":"s")+", "+(n.reused?"sent to the agent already open in its workspace":mb(n)+": "+yR(n))),n.pty)O.launched(e,n.pty);return O.reopenPanel(e),!0}var kR="kz-rflip";function Xte(){try{return!nt()&&localStorage.getItem(kR)==="1"}catch{return!1}}function Qte(e){if(nt())return;try{e?localStorage.setItem(kR,"1"):localStorage.removeItem(kR)}catch{}}var Fe=de()(()=>({message:null,screens:[],on:null,split:!1,agents:[],defAgent:"",pty:!0,titles:{},items:[],wsk:null,ws:null,history:[],empty:!1,menu:null,hint:!1,notes:null,picker:null,kept:{},recent:[],flip:Xte(),awaiting:!1,focus:{id:null,n:0}})),hu=(e)=>{Fe.setState({flip:e}),Qte(e)},Sm=(e)=>Fe.setState((t)=>({focus:{id:e??null,n:t.focus.n+1}})),To=Fe.setState,fi=()=>{},Dt={act:{select:fi,close:fi,closeItem:fi,openNew:fi,runApp:fi,move:fi,drag:fi,dragging:()=>null,drop:fi,openHere:fi,pick:fi,openNote:fi,termEnded:fi,currentRun:()=>null,previewTarget:()=>null}},hI=(e)=>Dt.act=e;var Zte=/\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)$/i,yw=de()(()=>({file:null})),bI=(e)=>/^\/(file|ice-image)\?/.test(e),Jte=(e)=>new URLSearchParams(e.split("?")[1]).get("p")?.split("/").pop()??"Image",vI=(e,t)=>e.startsWith("/ice-image")||Zte.test(t),yI=(e)=>yw.setState({file:{href:e,name:Jte(e)}}),SR=()=>yw.setState({file:null});var xI=null,wI=()=>xI||=new Promise((e,t)=>{let n=document.createElement("link");n.rel="stylesheet",n.href="/term.css",document.head.append(n);let o=document.createElement("script");o.src="/term.js",o.onload=()=>e(window.kzTerm),o.onerror=()=>{xI=null,t()},document.head.append(o)});function Cm(e){let t=e.trim();if(!t||/[\x00-\x1f]/.test(t))return null;let n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return t.startsWith("//")?null:t;return["http","https","mailto"].includes(n[1].toLowerCase())?t:null}var ene=/`([^`]+)`|\*\*([^*]+)\*\*|(?<!\*)\*([^*\s][^*]*?)\*(?!\*)|!\[([^\]]*)\]\(([^)\s]+)\)|\[([^\]]+)\]\(([^)\s]+)\)/g;function $d(e){let t=[],n=0;for(let o of e.matchAll(ene)){if(o.index>n)t.push(e.slice(n,o.index));if(n=o.index+o[0].length,o[1]!=null)t.push({k:"code",t:o[1]});else if(o[2]!=null)t.push({k:"b",c:$d(o[2])});else if(o[3]!=null)t.push({k:"i",c:$d(o[3])});else if(o[5]!=null)t.push(Cm(o[5])?{k:"img",src:o[5],alt:o[4]??""}:o[0]);else t.push(Cm(o[7])?{k:"a",href:o[7],c:$d(o[6])}:o[0])}if(n<e.length)t.push(e.slice(n));return t}function xw(e,t=!1){let n=e.split(`
13
+ `),o=[],r=0;while(r<n.length){let a=n[r];if(/^```/.test(a)){let u=[];r++;while(r<n.length&&!/^```/.test(n[r]))u.push(n[r++]);o.push({k:"pre",t:u.join(`
14
+ `)}),r++;continue}let i=/^(#{1,6})\s+(.*)$/.exec(a);if(i){o.push({k:"h",level:Math.min(i[1].length,3),c:$d(i[2])}),r++;continue}if(/^---+$/.test(a.trim())){o.push({k:"hr"}),r++;continue}if(/^\|/.test(a)){let u=[];while(r<n.length&&/^\|/.test(n[r]))u.push(n[r++]);let p=(g)=>g.replace(/^\||\|$/g,"").split("|").map((m)=>$d(m.trim())),f=u.filter((g)=>!/^\|\s*-/.test(g)).map(p);o.push({k:"table",head:f[0]??[],rows:f.slice(1)});continue}let s=/^\s*(?:[-*]|\d+\.)\s+(.*)$/.exec(a);if(s){let u=/^\s*\d+\./.test(a),p=o[o.length-1],f=p?.k==="list"&&p.ordered===u&&kI.get(p)!==!0?p:null,g=t?/^(open|done|rejected):\s*(.*)$/.exec(s[1]):null,m=$d(g?g[2]:s[1]),y=g?.[1]??null;if(f){if(f.items.push(m),t)(f.ticks??=f.items.slice(0,-1).map(()=>null)).push(y)}else o.push({k:"list",ordered:u,items:[m],...t?{ticks:[y]}:{}});r++;continue}if(!a.trim()){let u=o[o.length-1];if(u?.k==="list")kI.set(u,!0);r++;continue}let l=[a];r++;while(r<n.length&&n[r].trim()&&!/^(#|```|\||\s*[-*]\s|\s*\d+\.\s|---)/.test(n[r]))l.push(n[r++]);let c=[],d="";l.forEach((u,p)=>{if(p<l.length-1&&/ {2}$/.test(u))c.push(d+(d?" ":"")+u.trimEnd()),d="";else d+=(d?" ":"")+u}),c.push(d),o.push({k:"p",lines:c.map($d)})}return o}var kI=new WeakMap,Yd=(e,t)=>e.replace(/(!?)\[([^\]]*)\]\(([^)\s]+)\)/g,(n,o,r,a)=>{if(/^attachments\/[^)]+$/.test(a))return`${o}[${r}](/file?dir=${encodeURIComponent(t.state)}&p=${encodeURIComponent((t.kind==="run"?`runs/${t.id}/`:"")+a)})`;if(/^([a-z][\w+.-]*:|\/|#)/i.test(a))return n;return`${r} (\`${a}\`)`});function SI(e,t){let n=e&&e.match(new RegExp(`^##\\s+${t}\\s*\\n([\\s\\S]*?)(?=\\n##\\s|$(?![\\s\\S]))`,"m"));return n?n[1].trim():null}var Fs=(e)=>SI(e,"Preview"),CR=(e)=>(SI(e,"Commit")||"").replace(/^```\w*\n|\n```$/g,"").trim();var Nm=(e)=>e?/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/.exec(e)?.[0]:void 0,CI=(e,t)=>e===t||e.startsWith(t+"/")&&!e.startsWith(t+"/.kaizen/wt/"),NR=(e,t)=>t!==void 0&&e>t,NI=(e)=>{let t=/[?&]p=([^&]*)/.exec(e.src)?.[1];return e.alt||decodeURIComponent((t?decodeURIComponent(t):e.src).split("/").pop()||"")};function RI(e){let t=[],n=(a)=>a.flatMap((i)=>{if(typeof i==="string")return[i];if(i.k==="img")return t.push({src:i.src,alt:i.alt}),[];if(i.k==="b"||i.k==="i"||i.k==="a")return[{...i,c:n(i.c)}];return[i]}),o=(a)=>!a.length||a.every((i)=>typeof i==="string"&&!i.trim()),r=[];for(let a of e)if(a.k==="p"){let i=a.lines.map(n).filter((s)=>!o(s));if(i.length)r.push({...a,lines:i})}else if(a.k==="h")r.push({...a,c:n(a.c)});else if(a.k==="list")r.push({...a,items:a.items.map(n)});else if(a.k==="table")r.push({...a,head:a.head.map(n),rows:a.rows.map((i)=>i.map(n))});else r.push(a);return{blocks:r,shots:t}}function tne(e){let{pv:t,direct:n}=e;if(!t&&n)return n.image?{kind:"image",src:e.fileUrl(n.image),name:n.image.split("/").pop()??""}:{kind:"frame",src:n.url};let o=Nm(t),r=!!t&&/!\[[^\]]*\]\(/.test(t);if(o&&e.loopback&&!r)return{kind:"frame",src:/^https?:\/\//i.test(o)?o:"about:blank"};return{kind:"report",url:o,text:t}}var RR=()=>/^(localhost|127\.0\.0\.1|\[::1\])$/.test(location.hostname),nne=(e,t)=>`${location.origin}/file?dir=${encodeURIComponent(e)}&p=${encodeURIComponent(t)}`;async function TR(e,t){let n={};try{n=await(await fetch("/preview?dir="+encodeURIComponent(e))).json()}catch{}return n.at&&n.ws&&CI(n.ws,t)&&(n.url||n.image)?n:null}async function TI(e){let t=e.impl;if(t==null&&e.card?.kind==="run")try{t=(await(await fetch(`/run/${encodeURIComponent(e.card.id)}?dir=${encodeURIComponent(e.card.state)}`)).json()).impl}catch{}let n=Fs(t),o=n?null:await TR(e.dir,e.ws),r=n&&e.card?Yd(n,e.card):n,a=tne({pv:n,direct:o,loopback:RR(),fileUrl:(i)=>nne(e.dir,i)});return a.kind==="report"?{...a,text:a.text==null?null:r}:a}var EI={request:"request",explore:"exploration brief",plan:"plan",impl:"work report",preview:"preview",review:"review",backlog:"backlog"};function AI(e){let t=[...e.matchAll(/^\s*-\s*(todo|doing|done):\s*(.*)$/gm)].map((o)=>({st:o[1],text:o[2]}));if(!t.length)return null;let n=t.filter((o)=>o.st==="done").length;return{steps:t,done:n,pct:Math.round(n/t.length*100)}}var MI=(e,t,n)=>!!e&&!!e.st[n]&&e.st[n]!==t[n].st,ER=(e)=>String(e).replace(/!?\[([^\]]*)\]\([^)\s]+\)/g,"$1").replace(/[`*]/g,"").replace(/\s+/g," ").trim();function DI(e,t){let n=[...(e.backlog||"").matchAll(/^\s*-\s*(?:open|done|rejected):\s*(.*)$/gm)],o=t.type==="finding"?(e.findings||[]).find((r)=>r.n===t.n)?.text:n[t.n-1]?.[1];return o?ER(o).slice(0,60):null}var ww=new Map,hb=(e)=>e.key+"@"+(e.born??0),PI={conflict:0,failed:0,asking:0,working:1,done:2},zl={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},Wd={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function AR(e,t,n=ww){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return n.set(hb(e),t),"working";return t-(n.get(hb(e))??-1/0)<3000?"working":"done"}var OI=(e,t,n=ww)=>Math.min(1/0,...e.filter((o)=>!o.asking&&!o.busy&&n.has(hb(o))).map((o)=>3000-(t-n.get(hb(o)))).filter((o)=>o>0)),_I=(e,t=ww)=>{let n=new Set(e.map(hb));for(let o of t.keys())if(!n.has(o))t.delete(o)},zI=(e,t,n,o,r,a=ww)=>e.filter((i)=>i.dir===t&&o({state:i.dir,ws:i.ws})===n).map((i)=>({a:i,st:AR(i,r,a)})).sort((i,s)=>PI[i.st]-PI[s.st]),MR=({a:e,st:t})=>(e.land?"":e.last)||`${zl[t]} - ${e.name}`;var one=86400000,LI={dirs:[],running:!0,done:!1},Ll=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending",vb=(e)=>e.gitDue==="push"?"push":"commit",Il=(e,t)=>t?.find((n)=>n.dir===e.state&&(n.id===e.taskId||e.kind==="run"&&[n.activeRun,...(n.runs??n.runIds??[]).map((o)=>typeof o==="string"?o:o.id),...n.legacy?.kind==="run"?[n.legacy.id]:[]].includes(e.id))),bb={wait:0,plan:1,build:2,review:3,stalled:4,idle:5,done:6,aband:7};function Rm(e,t){if(t&&!(e.kind==="run"&&(e.status==="done"||e.status==="abandoned")))return t.attention.category==="needs-you"?"wait":t.attention.category==="completed"?"done":["interrupted","failed"].includes(t.status??"")?"stalled":t.status==="draft"?"idle":"build";if(e.kind==="idea")return!e.pty?.alive?"idle":e.pty.asking?"wait":e.pty.busy?"plan":"idle";if(e.status==="waiting"||e.pty?.alive&&e.pty.asking)return"wait";if(e.status==="done")return e.accept==="needs"||Ll(e)?"wait":"done";if(e.status==="abandoned")return"aband";if(e.status==="stalled")return"stalled";return e.column>=3?"review":e.column===2?"build":"plan"}var II=(e,t)=>!e.archived&&(e.kind==="idea"?!!e.pty:!["done","abandoned"].includes(e.status)||t-(e.moved??0)<one),Vs=(e)=>(e.title||e.text||"").split(`
15
+ `)[0],Bl=(e)=>`/?view=run&dir=${encodeURIComponent(e.state)}&`+(e.kind==="run"?"id="+encodeURIComponent(e.id):"idea="+encodeURIComponent(e.text)),$n=(e,t)=>{let n=t?.find((o)=>o.dir===e)?.label||e.replace(/[\\/]\.kaizen$/,"");return n.split(/[\\/]/).pop()||n},Yi=(e)=>e.branch||(e.main?"workspace":e.path.split(/[\\/]/).pop()),rne=(e)=>e.path.split(/[\\/]/).pop()||e.path;function kw(e,t){let n=t?.find((o)=>o.dir===e.state)?.workspaces??[];return n.find((o)=>o.path===e.ws)?.path??n.find((o)=>o.main)?.path??e.ws??""}var Xd=(e,t)=>e+"\x00"+t;function BI(e,t){let{filt:n,now:o}=t,r=new Set(t.pins),a=new Set(t.folded),i=e.tasks,s=(f)=>kw(f,e.projects),l=e.projects.filter((f)=>f.workspaces?.length),c=new Map,d=(f)=>f.filter((g)=>g.st==="done"?n.done:n.running),u=(f)=>{let g=Rm(f,Il(f,i));return n.running&&["wait","plan","build","review","stalled"].includes(g)||n.done&&(g==="done"||g==="aband")},p=(f)=>Rm(f,Il(f,i));for(let f of e.cards.filter((g)=>II(g,o)&&u(g))){let g=f.state+"\x00"+s(f);if(!c.has(g))c.set(g,[]);c.get(g).push(f)}return l.filter((f)=>!n.dirs.length||n.dirs.includes(f.dir)).map((f)=>{let g=f.dir,m=f.workspaces.map((y)=>{let b=c.get(g+"\x00"+y.path)??[],x=e.cards.filter((N)=>N.state===g&&s(N)===y.path&&II(N,o)),v=x.length>0&&x.every((N)=>["done","abandoned"].includes(p(N))),k=d(zI(e.agents,g,y.path,s,o)),S=b.length>0||k.length>0||n.running&&(y.main||!v);return{w:y,cs:b,ags:k,keep:S}}).filter((y)=>y.keep).sort((y,b)=>+r.has(Xd(g,b.w.path))-+r.has(Xd(g,y.w.path)));return{dir:g,name:$n(g,e.projects),git:f.workspaces.some((y)=>y.branch),mainWs:f.workspaces?.find((y)=>y.main)?.path??f.workspaces?.[0]?.path??g,shut:a.has(g)||!m.length,empty:!m.length,rows:m.map(({w:y,cs:b,ags:x})=>{let v=b.length?p([...b].sort((k,S)=>bb[p(k)]-bb[p(S)])[0]):"";return{w:y,path:y.path,label:Yi(y),folder:rne(y),pinned:r.has(Xd(g,y.path)),st:v==="wait"||x[0]?.st==="asking"?"wait":x.some((k)=>k.st==="working")?"build":v||(x.length?"done":""),agents:x,open:!!t.open[Xd(g,y.path)],tasks:ane(i,g,y,b,n)}})}}).filter((f)=>f.rows.length||n.running)}function ane(e,t,n,o,r){return(e??[]).filter((a)=>a.dir===t&&!a.legacy&&a.attention.category!=="completed"&&r.running&&a.status!=="draft"&&(o.some((i)=>Il(i,e)?.id===a.id)||n.main&&!(a.runs??a.runIds??[]).length)).sort((a,i)=>(a.created??0)-(i.created??0))}var HI=(e)=>e.attention.category==="needs-you"?"wait":e.attention.category==="completed"?"done":["interrupted","failed"].includes(e.status??"")?"stalled":e.status==="draft"?"idle":"build",jI=(e,t)=>e.dirs.some((n)=>t.includes(n))||!e.running||e.done,UI=(e,t,n)=>e.filter((o)=>t(o).toLowerCase().includes(n.toLowerCase())),GI=(e)=>["conflict","failed","asking","working","done"].map((t)=>({st:t,rs:e.filter((n)=>n.st===t)})).filter((t)=>t.rs.length);function FI(e,t,n){let o=new URLSearchParams(e),r=o.get("id")&&t.find((a)=>a.kind==="run"&&a.state===o.get("dir")&&a.id===o.get("id"));return{dir:o.get("dir"),ws:o.get("ws")??(r?kw(r,n):null)}}var VI=(e,t,n)=>{let o=e.filter((r,a)=>a!==t);return o.splice(n>t?n-1:n,0,e[t]),o},KI=(e,t)=>{let n=e.findIndex((o)=>t<o.top+o.height/2);return n<0?e.length:n};function qI(e,t,n){let o=e.indexOf(t);return o>=0&&n!==o&&n!==o+1?VI(e,o,n):null}var Qd=(e)=>e.kind==="run"&&(e.status==="abandoned"||e.status==="done"&&e.accept!=="needs"&&!Ll(e)),$I=(e,t,n,o)=>e.state===t&&o(e)===n,Sw=(e,t,n,o)=>e.filter((r)=>!r.archived&&$I(r,t,n,o)&&(r.kind==="idea"?!!r.pty:r.kind==="run"&&!Qd(r))),DR=(e,t,n,o)=>e.filter((r)=>Qd(r)&&$I(r,t,n,o)).sort((r,a)=>(a.moved??0)-(r.moved??0));function YI(e,t,n,o){let r=!1;for(let a of t){let i=n(a),s=e[i];if(!s)continue;let l=e[di(a.state,o(a))]||={tabs:[],hidden:[],screens:[],on:null},c=new Set(l.screens.flatMap((d)=>vn(d.tree)));for(let d of s.tabs??[])if(!l.tabs.some((u)=>u.id===d.id))l.tabs.push(d);for(let d of s.hidden??[])if(!l.hidden.includes(d))l.hidden.push(d);for(let d of s.screens??[]){let u=d.tree&&fu(d.tree,(p)=>!c.has(p));if(!u)continue;vn(u).forEach((p)=>c.add(p)),l.screens.push({...d,tree:u,focus:vn(u).includes(d.focus)?d.focus:vn(u)[0]})}l.on??=s.on,delete e[i],r=!0}return r}var Tm=(e)=>e.kind==="run"&&(e.status==="waiting"||e.status==="done"&&e.accept==="needs"||Ll(e)||!!(e.pty?.alive&&e.pty.asking)),PR=(e,t,n,o)=>Sw(e,t,n,o).filter((r)=>r.kind==="run").sort((r,a)=>+Tm(a)-+Tm(r)||(a.moved??0)-(r.moved??0)),WI=(e,t,n,o=(r)=>r.id)=>[...e,...t].find((r)=>o(r)===n)??e[0]??null,XI=(e,t,n=(o)=>o.id)=>e.find((o)=>!t.has(n(o)));function ine(e){if(e?.kind!=="run")return{};let t=e?.pty?.all??[],n=e?.pty?.stages??{},o={};for(let i of["explore","impl","review"])if(n[i]&&t.includes(n[i]))o[i]=n[i];if(n.plan&&t.includes(n.plan))o.plan=n.plan;let r=t.find((i)=>!Object.values(n).includes(i)),a=e.stage==="explore"?"explore":{1:"plan",2:"impl",3:"review"}[e.column];if(r&&a&&!Object.keys(n).length)o[a]=r;return o}function QI(e,t){let n={explore:"Explore",plan:"Plan",impl:"Build",review:"Review"},o=e?.pty?e.pty.all??[e.pty.key]:[],r=new Map(Object.entries(ine(e)).map(([l,c])=>[c,n[l]])),a=o.filter((l)=>!r.has(l)),i=e?.stage==="explore"?"Explore":n[{1:"plan",2:"impl",3:"review"}[e?.column]??""],s=o.at(-1);if(i&&s&&r.has(s))r.set(s,i);return o.map((l)=>({key:l,title:r.has(l)?`${r.get(l)} · ${t}`:t+(a.length>1?" "+(a.indexOf(l)+1):"")}))}var Cw=(e)=>e.kind==="run"&&(e.column===3||e.status==="done");function Em(e,t){let n=e?[...e.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/g)].map((r)=>r[0]):[],o=(r)=>Number(new URL(r).port||80);return n.find((r)=>t.includes(o(r)))??(t.length?`http://localhost:${t[0]}`:n[0])}var ZI=(e,t,n,o)=>e.filter((r)=>Cw(r)&&!t.has(o(r))&&!n.includes(o(r)));function JI(e){try{let t=new URL(e);return/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname)&&t.port?Number(t.port):null}catch{return null}}var Nw=null;function bu(){if(Nw)Pe((e)=>e.body==="term"?{body:"",term:null,wide:!1}:{term:null,wide:!1});Nw=null}function eL(e){let t=e.pty.key;if(Nw===t&&Re().body==="term")return;bu(),Nw=t,Pe((n)=>({body:"term",term:{key:t,onEnd:()=>fo(!0)},wide:!0,terms:n.terms.some((o)=>o.key===t)?n.terms:[...n.terms,{key:t,onEnd:()=>fo(!0)}]}))}function tL(){let e=new Set(oe().state.cards.flatMap((n)=>n.pty?[n.pty.key,...n.pty.all??[]]:[])),{terms:t}=Re();if(t.some((n)=>!e.has(n.key)))Pe({terms:t.filter((n)=>e.has(n.key))})}var nL=16000;var sne=(e)=>{let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t/e.length)},lne=(e)=>Math.min(1,e*8).toFixed(2);function oL(){let e=[],t=0,n=0,o=0,r=()=>{e=[],t=0,n=0,o=0};return{push(a){e.push(a),t+=a.length;let i=sne(a);if(i>0.01)n+=a.length,o=0;else o+=a.length;return{level:lne(i),ready:t>=96000||n>=16000&&o>=12800}},take(){if(!t||n<16000)return r(),null;let a=new Float32Array(t),i=0;for(let s of e)a.set(s,i),i+=s.length;return r(),a}}}function rL(){let e=new Map,t=0;return{reserve:(n)=>void e.set(n,null),set:(n,o)=>void e.set(n,o),drain(n){while(e.has(t)&&e.get(t)!==null)n(e.get(t)),e.delete(t),t++;return!e.size},get waiting(){return e.size}}}function aL(e,t,n){t=Math.min(t,e.length);let o=e.slice(0,t),r=o&&!/\s$/.test(o)?" ":"";return{value:o+r+n+e.slice(t),at:o.length+r.length+n.length}}var OR={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},iL=(e)=>typeof e==="string"&&OR[e]?e:"small";var _R={loading:!1,pct:null,on:!1,busy:!1},Rw=de()(()=>({st:{}}));var vu=(e,t)=>Rw.setState((n)=>({st:{...n.st,[e]:{...n.st[e]??_R,...t}}})),yb=(e)=>Rw.setState((t)=>{if(!(e in t.st))return t;let{[e]:n,...o}=t.st;return{st:o}});var Tw=()=>{try{return localStorage.getItem("kz-mic")||""}catch{return""}},lL=(e)=>{try{localStorage.setItem("kz-mic",e)}catch{}},sL=(e="")=>({channelCount:1,noiseSuppression:!0,echoCancellation:!0,...e?{deviceId:{exact:e}}:{}});async function cL(e,t,n){try{return await e(sL(t))}catch(o){if(!t||o?.name!=="OverconstrainedError")throw o;return n("Chosen microphone not found. Using the default"),e(sL())}}async function uL(){if(!navigator.mediaDevices?.enumerateDevices)return[];return(await navigator.mediaDevices.enumerateDevices().catch(()=>[])).filter((t)=>t.kind==="audioinput"&&t.deviceId&&t.deviceId!=="default").map((t,n)=>({id:t.deviceId,label:t.label||`Microphone ${n+1}`}))}var cne="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",une=()=>`import{pipeline}from"${cne}";let asr=null;
16
+ onmessage=async e=>{const m=e.data;try{
17
+ if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
18
+ // WebGPU first, with the encoder in fp16 only where the adapter has shader-f16; any GPU failure falls back to the CPU.
19
+ const gpu=m.webgpu?{device:"webgpu",dtype:{encoder_model:m.f16?"fp16":"fp32",decoder_model_merged:"q4"}}:null,cpu={device:"wasm",dtype:"q8"};
20
+ try{if(!gpu)throw 0;asr=await pipeline("automatic-speech-recognition",m.model,{...gpu,progress_callback:prog})}
21
+ catch(e){if(gpu)postMessage({type:"fallback",why:String(e&&e.message||e)});asr=await pipeline("automatic-speech-recognition",m.model,{...cpu,progress_callback:prog})}
22
+ postMessage({type:"ready"})}
23
+ if(m.type==="run"){const r=await asr(m.audio,{chunk_length_s:30,return_timestamps:false});postMessage({type:"text",sid:m.sid,seq:m.seq,text:(r.text||"").trim()})}
24
+ }catch(err){postMessage({type:"error",sid:m.sid,seq:m.seq,error:String(err&&err.message||err)})}}`,dne='class T extends AudioWorkletProcessor{process(i){const c=i[0]&&i[0][0];if(c)this.port.postMessage(c.slice(0));return true}}registerProcessor("kz-tap",T)',kb=()=>!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&window.AudioWorkletNode&&window.WebAssembly&&window.Worker),zR=null,wb=null,Mm=null,xb=null,La=null,Am=!1,Ew=new Set,dL=()=>{try{wb?.terminate()}catch{}wb=null,Mm=null};async function pne(){let e="small";try{e=((await fetch("/settings").then((r)=>r.json())).rows.find((r)=>r.key==="dictation.model")||{}).value||e}catch{}let t=iL(e);if(Mm&&zR!==t)La?.stop(),dL(),Ew.clear(),La=null;if(Mm)return Mm;zR=t;let n=new Promise(async(o,r)=>{let a=wb=new Worker(URL.createObjectURL(new Blob([une()],{type:"text/javascript"})),{type:"module"}),i={};a.onmessage=(l)=>{let c=l.data;if(c.type==="progress"){i[c.file]=c.pct;let d=Object.values(i);if(xb)vu(xb,{pct:Math.round(d.reduce((u,p)=>u+p,0)/d.length)})}else if(c.type==="ready")o();else if(c.type==="fallback")_("GPU could not run the model, using the CPU: "+c.why);else if(c.type==="error"&&c.seq==null)r(Error(c.error));for(let d of Ew)d.onmsg(c)},a.onerror=(l)=>r(Error(l.message||"worker failed"));let s=null;try{s=navigator.gpu&&await navigator.gpu.requestAdapter()}catch{}if(!s)_("No WebGPU: dictation will run on the CPU and be slower");a.postMessage({type:"load",model:OR[zR],webgpu:!!s,f16:!!(s&&s.features.has("shader-f16"))})});return Mm=n,n.catch(()=>{if(Mm===n)dL()}),n}function Xr(e){if(La&&(e||!La.field.isConnected))La.stop()}var Aw=(e)=>La?.id===e;async function Mw(e){if(La){let v=La.id===e.id;if(La.stop(),v)return}if(Am)return;Am=!0;let t=(v)=>{yb(e.id),Am=!1,_(v)};vu(e.id,{loading:!0,busy:!0,pct:null}),xb=e.id;try{await pne()}catch(v){return xb=null,t("Dictation model could not load: "+v.message)}xb=null,vu(e.id,{loading:!1,pct:null});let n=()=>!!e.el&&!e.el.isConnected;if(n()){yb(e.id),Am=!1;return}let o;try{o=await cL((v)=>navigator.mediaDevices.getUserMedia({audio:v}),Tw(),_)}catch(v){return t("Microphone not available: "+(v.name==="NotAllowedError"?"permission denied":v.message))}if(n()){o.getTracks().forEach((v)=>v.stop()),yb(e.id),Am=!1;return}if(La)La.stop();let r,a,i;try{r=new AudioContext({sampleRate:nL}),await r.audioWorklet.addModule(URL.createObjectURL(new Blob([dne],{type:"text/javascript"}))),a=r.createMediaStreamSource(o),i=new AudioWorkletNode(r,"kz-tap")}catch(v){return o.getTracks().forEach((k)=>k.stop()),t("Microphone not available: "+v.message)}a.connect(i);let s=e.target(),l=e.id,c=Math.random().toString(36).slice(2),d=oL(),u=rL();s.onStart?.();let p=s.selectionStart??s.value.length,f=0,g=!1,m=(v)=>{if(!v||!s.isConnected)return;if(typeof document<"u"&&document.activeElement===s)p=s.selectionStart??p;let k=aL(s.value,p,v);s.value=k.value,p=k.at,s.selectionStart=s.selectionEnd=p,s.dispatchEvent(new Event("input",{bubbles:!0}))},y=()=>{let v=d.take();if(!v||!wb)return;u.reserve(f),wb.postMessage({type:"run",sid:c,seq:f,audio:v},[v.buffer]),f++,vu(l,{busy:!0})},b=()=>{if(!u.drain(m))return;if(vu(l,{busy:!1}),g)yb(l),Ew.delete(x)};i.port.onmessage=(v)=>{let{level:k,ready:S}=d.push(v.data);if(s.style?.setProperty("--lvl",k),e.el?.style.setProperty("--lvl",k),S)y()};let x={id:l,field:s,onmsg:(v)=>{if(v.sid!==c)return;if(v.type==="text")u.set(v.seq,v.text),b();else if(v.type==="error"&&v.seq!=null)u.set(v.seq,""),_("Dictation failed: "+v.error),b()},stop:()=>{if(g)return;g=!0,vu(l,{on:!1}),s.classList?.remove("dictating"),s.style?.removeProperty("--lvl");try{i.port.onmessage=null,a.disconnect(),i.disconnect(),o.getTracks().forEach((v)=>v.stop()),r.close()}catch{}La=null,y(),b()}};Ew.add(x),La=x,Am=!1,vu(l,{on:!0,busy:!1}),s.classList?.add("dictating"),s.focus()}var pL="terminal";function fne(e){let t=!0;return{value:"",selectionStart:0,selectionEnd:0,get isConnected(){return e.isConnected},focus(){},onStart(){_("Listening. Ctrl+Alt+D to stop")},dispatchEvent(){let n=new DataTransfer;return n.setData("text/plain",(t?"":" ")+this.value),t=!1,this.value="",e.dispatchEvent(new ClipboardEvent("paste",{clipboardData:n,bubbles:!0,cancelable:!0})),!0}}}var fL=!1;function mL(){if(fL)return;fL=!0,addEventListener("keydown",(e)=>{if(!e.ctrlKey||!e.altKey||e.key.toLowerCase()!=="d")return;if(e.preventDefault(),e.stopPropagation(),Aw(pL))return Xr(!0);let t=document.activeElement;if(!t?.classList.contains("xterm-helper-textarea"))return _("Click into a terminal first");if(!kb())return _("Dictation isn't available in this browser");let n=fne(t);Mw({id:pL,target:()=>n})},!0)}function gL(e,t){let n=t?.pr,o=e.files.length,r=(e.staged??[]).length,a=n?.state==="OPEN",i=[{a:"commit",label:"Commit",why:r?"":o?"Stage changes first":"No changes to commit"},{a:"commitpush",label:"Commit & push",why:o?"":"No changes to commit"},{a:"push",label:"Push",why:o?"Commit changes first":t&&!t.upstream?t.local?"Lands by local merge: kaizen worktree land":"Not published yet: Create PR pushes it":e.ahead>0?"":"Nothing to push"}];if(!t)return i;let s=t.local?"Lands by local merge: kaizen worktree land":t.gh?"":"Needs the GitHub CLI (gh) and a GitHub remote",l=s||(o?"Commit changes first":n&&n.state!=="CLOSED"?`Pull request #${n.number} is ${n.state==="MERGED"?"merged":"open"}`:"");return i.push({a:"pr",label:t.upstream&&e.ahead===0?"Create PR":"Push & create PR",why:l},{a:"draft",label:"Create draft PR",why:l},{a:"merge",label:"Merge PR",why:s||(!a?"No open pull request":n.draft?"Draft: mark it ready on GitHub first":o?"Commit changes first":e.ahead>0?"Push first":"")},{a:"remove",label:"Remove workspace",why:o?"Commit or discard the changes first":t.landed?"":"Merge the pull request first"}),i}function hL(e,t,n){let o=e.find((r)=>!r.why&&!["commit","commitpush","draft"].includes(r.a));return t?{a:"commit",label:"Commit",icon:"check"}:n?{a:"stageall",label:"Stage all",icon:"plus"}:o?{a:o.a,label:o.label,icon:""}:{a:"",label:"Commit",icon:"check"}}var IR=(e,t)=>t?t.local?t.base:`origin/${t.base}`:`${e.remote}/${e.branch||"HEAD"}`;function bL(e,t){let n=t?.pr,o=IR(e,t),r=e.ahead>0&&(!t||t.upstream);return{head:n?.state==="MERGED"?"Merged":t?.landed?"On "+t.base:r?"Not pushed yet":"No changes on this branch",body:n?.state==="MERGED"?`Pull request #${n.number} is merged into ${t.base}. The worktree and its branch can go.`:t?.landed?`Every commit of ${t.branch} is on ${t.base}. The worktree can go.`:r?`${e.ahead} commit${e.ahead===1?"":"s"} ahead of ${o}.`:t&&!t.upstream?`${t.branch} is not on GitHub yet. Create PR pushes it.`:`This workspace is clean and has no changes ahead of ${o}.`}}var vL=(e)=>[e.others?`${e.others} other changed file${e.others===1?" is":"s are"} not this run's`:"",...e.shared?.length?[`Also holds other runs' changes: ${e.shared.map((t)=>t.split(":")[0]).join(", ")}`]:[]].filter(Boolean).join(`
25
+ `),yL=(e)=>e.reduce((t,n)=>[t[0]+n.add,t[1]+n.del],[0,0]),xL={OPEN:"Open",MERGED:"Merged",CLOSED:"Closed"},LR={commit:"Committing…",commitpush:"Pushing…",push:"Pushing…","go-pr":"Creating PR…","go-draft":"Creating PR…","go-merge":"Merging…","go-remove":"Removing…"},wL=(e,t)=>e==="commit"?"Committed "+t.sha:e==="commitpush"||e==="push"?"Committed & pushed "+t.sha:e==="go-merge"?"Merged":e==="go-remove"?"Worktree removed":"Pull request #"+t.pr?.number+" opened";var go=de()(()=>({snap:null,ui:{},busy:null,busyRun:null,confirm:null})),Dm=(e)=>e.snap?Tn(e.snap.card):null,Hl=(e)=>e.busy&&e.busyRun===Dm(e)?e.busy:null,{getState:Pm,setState:Wi}=go,kL={shut:{}},yu=(e)=>Pm().ui[e]??kL,jl=(e,t)=>Wi((n)=>({ui:{...n.ui,[e]:{...n.ui[e]??kL,...t}}})),SL=(e)=>Wi((t)=>{let{[e]:n,...o}=t.ui;return{ui:o}});var mne=["pr","draft","merge","remove"],jR=(e)=>jl(Tn(Pm().snap.card),{ask:e}),Dw=(e)=>{let t=Tn(Pm().snap.card);jl(t,{shut:{...yu(t).shut,[e]:!yu(t).shut[e]}})},BR=(e)=>new Promise((t)=>Wi((n)=>({confirm:{...e,run:Dm(n),ok:t}}))),CL=async(e)=>{let t=Pm().snap;if(t&&Tn(t.card)===e)await O.refetchRun(t.card)},HR=async(e,t)=>{Wi((n)=>({busy:e,busyRun:Dm(n)}));try{await t()}finally{Wi({busy:null,busyRun:null})}};async function Ba(e,t="",n=!1){let o=Pm().snap,r=o.card,a=Tn(r),i=yu(a),s=o.git;if(mne.includes(e))return jR(e);if(e==="spark")return HR("spark",async()=>{let p=await K("/commit-message",{dir:r.state,id:r.id});if(p.ok){if(jl(a,{msg:p.message}),!p.ai)_("Claude was not available: wrote a plain message")}});if(/stage|discard/.test(e)){let p=e==="discardall"?"discard":e.replace("all",""),f=/all$/.test(e)&&e!=="unstageall"?(s.rows??[]).filter((g)=>!g.staged).map((g)=>g.path):e==="unstageall"?s.staged??[]:[t];if(e==="discard"&&!await BR({kind:"discard",path:t,untracked:n,many:0}))return;if(e==="discardall"&&!await BR({kind:"discard",path:f.join(`
26
+ `),untracked:!1,many:f.length}))return;return HR(e+":"+t,async()=>{await K("/stage",{dir:r.state,id:r.id,op:p,paths:f}),await CL(a)})}let l=i.msg??o.msg;if((e==="commit"||e==="commitpush")&&!l.trim())return _("A commit message is required");let c={dir:r.state,id:r.id},[d,u]=e==="commit"?["/commit",{...c,message:l,files:s.staged??[],push:!1}]:e==="commitpush"||e==="push"?["/commit",{...c,message:e==="commitpush"?l:"",files:s.files}]:e==="go-pr"||e==="go-draft"?["/pr",{...c,op:"create",title:i.title??o.title,body:i.body??`Run ${r.id}.`,draft:e==="go-draft"}]:["/pr",{...c,op:e==="go-merge"?"merge":"remove"}];return HR(e,async()=>{let p=await K(d,u);if(p.preflight&&await BR({kind:"preflight",pf:p.preflight}))p=await K(d,{...u,override:p.token});if(p.ok)_(wL(e,p)),SL(a);await CL(a)})}var UR=(e,t)=>{let n=t&&t.git;return!!(n&&n.repo)&&!e.archived&&e.accept!=="needs"&&(e.status==="done"||e.awaiting==="approvals.review")},NL=(e,t)=>{if(!UR(e,t))return!1;let{git:n,branch:o}=t;return n.files.length>0||(o?o.upstream&&n.ahead>0||o.pr&&o.pr.state==="OPEN"||o.landed&&!o.pr||o.pr&&o.pr.state==="MERGED":n.ahead>0)};function RL(e){let t=Re().runDoc.impl;Pe({body:"git"}),Wi({snap:{card:e,git:Re().runDoc.git,branch:Re().runDoc.branch,msg:CR(t)||e.title||e.text||"",title:(CR(t)||e.title||"").split(`
27
+ `)[0]}})}var Sb=()=>Wi({snap:null});var GR=[["Request","request"],["Notes","notes"],["Explore","explore"],["Plan","plan"],["Backlog","backlog"],["Work","impl"],["Review","review"],["Source control","git"],["Preview","preview"]],Pw=(e)=>e.charAt(0).toUpperCase()+e.slice(1),gne=(e)=>/\s/.test(e)?e:Pw(e.replace(/^\d{4}-\d{2}-\d{2}-/,"").split(/[-_]/).map((t)=>/^(ui|ux|api|cli|ai|ci|id|url|pr|tui|ios|pwa)$/i.test(t)?t.toUpperCase():t).join(" ")),EL=(e)=>e.kind==="idea"?Bs(e.text).head:gne(e.title||e.text),AL=(e)=>e.kind==="idea"?"":e.id||"",ML=(e)=>e.stage==="explore"?"explore":e.status==="abandoned"?"plan":{1:"plan",2:"backlog",3:"review",4:"preview"}[e.column]||"request",TL=["Plan","Build","Review","Done"],DL=(e)=>{try{return JSON.parse(e?.state||"{}")}catch{return{}}},PL=(e,t)=>{let n=DL(t);return e.stage==="explore"||n.explore_status==="completed"||n.explore_status==="active"?["Explore",...TL]:TL},OL=(e)=>Pw(lu[e.status]||e.status)+(e.awaiting?`: ${Ls(e.awaiting)}`:"");function _L(e,t){let n=PL(e,t),o=n.length-4,r=e.status==="done"?n.length:e.stage==="explore"?0:Math.max(0,(e.column||0)-1)+o;return{kind:"steps",phases:{names:n,at:r,status:e.status,tip:OL(e)}}}function hne(e,t){let n=DL(t),o=PL(e,t),r=o.length-4,a=e.status==="done"?o.length-1:e.stage==="explore"?0:Math.min(3,Math.max(0,(e.column||1)-1))+r;return{kind:"meta",id:e.id,proj:String(e.where||"").split(/[\\/]/).filter(Boolean).pop()||"",runner:[n.runner,n.agent,n.mode].filter(Boolean).join(", "),word:o[a]+(e.status==="waiting"?", needs you":e.status==="stalled"?", stalled":""),w:e.status==="done"?100:(a+0.5)/o.length*100,status:e.status,tip:OL(e)}}var zL=(e)=>({head:e.status==="starting"&&!e.archived?_L(e,null):{kind:"task",where:e.where.split(/[\\/]/).pop()||e.where},footer:{card:e,plan:"",sourceControl:!1}});function IL(e){let{card:t,runDoc:n}=e,o=t.status==="abandoned"?{kind:"chips",mark:fm[t.status]||"idea",label:Pw(lu[t.status]||t.status),awaiting:t.awaiting?Pw(Ls(t.awaiting)):void 0,parent:t.parent}:e.wide?hne(t,n):_L(t,n),r=GR.filter((d)=>d[1]==="request"||d[1]==="notes"||(d[1]==="git"?e.git.shown:d[1]==="preview"?Fs(n.impl):n[d[1]]||d[1]==="backlog"&&t.column===2&&n.progress)),a=e.wantTab;if(e.view==="run"&&a==="preview")a="review";if(!r.some((d)=>d[1]===a))a=[...r].reverse().find((d)=>d[1]!=="notes"&&d[1]!=="git"&&!(e.view==="run"&&d[1]==="preview"))[1];let i=a==="preview"?Fs(n.impl)&&Yd(Fs(n.impl),t):n[a],s=e.hit&&e.hit.k===e.key(t)?DI(n,e.hit):null,l=n.findings||[],c=a==="review"&&!t.healed&&!t.archived&&l.some((d)=>!d.done)&&(t.status==="done"||t.awaiting==="findings"||t.awaiting==="approvals.review")?{card:t,findings:l}:null;return{head:o,tabs:r.map((d)=>({k:d[1],label:d[0]})),tab:a,kind:a==="notes"?"notes":a==="git"?"git":"doc",doc:a==="notes"||a==="git"?null:{k:a,id:t.id,text:i||null,progress:a==="backlog"&&t.column===2?n.progress||null:null,needle:s&&!e.refresh?s:null,mark:0},notes:a==="notes"?{card:t,src:i,ro:!!t.archived||t.status==="done"||t.status==="abandoned",linked:n.linkedFrom}:null,fix:c,footer:{card:t,plan:n.plan,sourceControl:a!=="git"&&e.git.pending},needle:s}}var Ow=(e,t)=>{try{return JSON.parse(localStorage.getItem(e)||"null")??t}catch{return t}},_w=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}};ui((e)=>e.every,(e)=>e&&_I(e.agents));var zw=(e)=>Il(e,oe().tasks),xu={filt:"kz-rail-filter2",folded:"kz-rail-folded",pins:"kz-ws-pins",open:"kz-wsopen"},Pn=de()(()=>({filt:{...LI,...Ow(xu.filt,{})},folded:Ow(xu.folded,[]),pins:Ow(xu.pins,[]),open:Ow(xu.open,{}),q:"",tick:0})),LL=()=>Pn.setState((e)=>({tick:e.tick+1})),BL=(e)=>Pn.setState({q:e});function Cb(e){let t={...Pn.getState().filt,...e};_w(xu.filt,t),Pn.setState({filt:t})}function FR(e,t){let n=new Set(Pn.getState().folded);for(let r of e)t?n.add(r):n.delete(r);let o=[...n];_w(xu.folded,o),Pn.setState({folded:o})}var HL=(e)=>FR([e],!Pn.getState().folded.includes(e));function jL(e,t){let n=Xd(e,t),o=Pn.getState().pins,r=o.includes(n)?o.filter((a)=>a!==n):[...o,n];_w(xu.pins,r),Pn.setState({pins:r})}function UL(e,t){let n=Xd(e,t),o={...Pn.getState().open};if(o[n])delete o[n];else o[n]=!0;_w(xu.open,o),Pn.setState({open:o})}function GL(e){let t=new Map(e.map((o,r)=>[o,r])),n=oe().every;if(n)po({every:{...n,projects:[...n.projects].sort((o,r)=>(t.get(o.dir)??1e9)-(t.get(r.dir)??1e9))}})}var mi=(e)=>Rm(e,zw(e)),VR=(e)=>typeof e==="string"&&/[\\/]\.kaizen[\\/]home$/.test(e),gi=(e,t)=>VR(e)?"/?view=board&homews=1":`/?view=ws&dir=${encodeURIComponent(e)}&ws=${encodeURIComponent(t)}`,Iw=()=>$i().projects.filter((e)=>e.workspaces?.some((t)=>t.branch)).map((e)=>({dir:e.dir,name:$n(e.dir,$i().projects)})),Qo=(e,t=$i().projects)=>kw(e,t);var Ul={add:()=>{},search:()=>{}},KL=(e,t)=>O.open.task({id:e,dir:t}),KR=(e,t)=>O.open.ws({dir:e,ws:t}),qL=(e,t,n)=>{if(!O.open.term({dir:e,ws:t,key:n}))O.navigate(O.wsHref(e,t))},$L=(e)=>ci({dir:e,start:"ws"});async function FL(e,t,n){_(n==="update"?"Updating…":"Deleting…");let o=await fetch("/workspace",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:e,ws:t,op:n})}).catch(()=>null),r=await o?.json().catch(()=>({}));_(o?.ok?n==="update"?r.out||"Updated":"Deleted":r?.error||r?.why||"Failed")}var VL=(e)=>navigator.clipboard.writeText(e).then(()=>_("Copied"),()=>_("Could not copy"));function YL(e,t){let n=oe().every?.projects.find((a)=>a.dir===e)?.workspaces?.find((a)=>a.path===t);if(!n)return[];let o=Yi(n),r=Pn.getState().pins.includes(e+"\x00"+t);return[...n.main?[]:[{label:"Update",run:()=>void FL(e,t,"update")}],{label:"Copy path",run:()=>void VL(t)},{label:"Copy worktree name",run:()=>void VL(o)},{label:r?"Unpin":"Pin",run:()=>jL(e,t)},...n.main?[]:[{label:"Delete",run:async()=>{if(await mn({title:`Delete worktree "${o}"?`,description:`Removes the folder. Refused while it has uncommitted changes. The branch stays.
28
+
29
+ ${t}`,confirmLabel:"Delete",danger:!0}))FL(e,t,"delete")}}]]}var WL=(e)=>{let t=()=>_("Could not save the project order");fetch("/projects/order",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dirs:e})}).then((n)=>!n.ok&&t(),t)};var Zd=h(I(),1);var XL={lift:null,to:-1};function QL(e,t){let[n,o]=Zd.useState(XL),r=Zd.useRef(!1),a=Zd.useRef(t);return a.current=t,Zd.useEffect(()=>{let s=e.current;if(!s)return;let l=null,c=!1,d=()=>[...s.querySelectorAll(":scope > .pgrp")],u=(S)=>o((N)=>N.lift===S.lift&&N.to===S.to?N:S),p=(S)=>{if(!l)return;clearTimeout(l.hold);let N=c,{dir:R,to:A}=l,D=d().map((z)=>z.querySelector(".proj").dataset.proj);if(l=null,c=!1,u(XL),N)r.current=!0;let E=N&&S?qI(D,R,A):null;if(E)a.current(E);if(N)setTimeout(()=>r.current=!1,0)},f=()=>{if(!l)return;c=!0,u({lift:l.dir,to:l.to});try{l.bar.setPointerCapture(l.id)}catch{}navigator.vibrate?.(8)},g=(S)=>{let N=S.target.closest(".pgrp > .proj");if(!N||S.button!==0||N.parentElement?.parentElement!==s)return;if(l={dir:N.dataset.proj,bar:N,id:S.pointerId,x:S.clientX,y:S.clientY,to:-1},S.pointerType!=="mouse")l.hold=setTimeout(f,300)},m=(S)=>{if(!l||S.pointerId!==l.id)return;let N=Math.hypot(S.clientX-l.x,S.clientY-l.y);if(!c){if(S.pointerType==="mouse"?N>5:N>8)S.pointerType==="mouse"?f():p(!1);if(!c)return}S.preventDefault(),l.to=KI(d().map((R)=>R.getBoundingClientRect()),S.clientY),u({lift:l.dir,to:l.to})},y=(S)=>l&&S.pointerId===l.id&&p(!0),b=()=>p(!1),x=(S)=>c&&S.preventDefault(),v=(S)=>l&&S.preventDefault(),k=(S)=>{if(c&&S.key==="Escape")S.preventDefault(),p(!1)};return s.addEventListener("pointerdown",g),s.addEventListener("pointermove",m),s.addEventListener("pointerup",y),s.addEventListener("pointercancel",b),s.addEventListener("touchmove",x,{passive:!1}),s.addEventListener("contextmenu",v,!0),addEventListener("keydown",k),()=>{clearTimeout(l?.hold),s.removeEventListener("pointerdown",g),s.removeEventListener("pointermove",m),s.removeEventListener("pointerup",y),s.removeEventListener("pointercancel",b),s.removeEventListener("touchmove",x),s.removeEventListener("contextmenu",v,!0),removeEventListener("keydown",k)}},[e]),{view:n,swallow:()=>{let s=r.current;return r.current=!1,s}}}var bne=(e)=>{if(e.social)return{kind:"social",id:`#i-b-${e.social}`};if(/docs\.google\.com\/spreadsheets|\.(csv|tsv)$/.test(e.url))return{kind:"sheet",id:"#i-sheet"};try{return{kind:"icon",id:`${new URL(e.url).origin}/favicon.ico`}}catch{return null}},ZL=(e)=>(e??[]).slice(0,3).map(bne).filter((t)=>!!t);var Lw=(e)=>e.kind==="agent"||e.kind==="shell",qR=(e)=>e.items.filter(Lw).length,JL=(e,t)=>[...e.filter((n)=>n!==t),t];function vne(e,t,n,o={workspaces:4,terminals:12}){let r=new Set,a=0;if(n&&e[n])r.add(n),a+=qR(e[n]);let i=[...Object.keys(e).filter((s)=>!t.includes(s)),...t].filter((s)=>s!==n&&e[s]).reverse();for(let s of i){if(r.size>=o.workspaces||a+qR(e[s])>o.terminals)break;r.add(s),a+=qR(e[s])}return r}function e8(e,t,n,o){let r=vne(e,t,n,o);if(Object.keys(e).every((a)=>r.has(a)))return e;return Object.fromEntries(Object.entries(e).filter(([a])=>r.has(a)))}var t8=(e,t,n)=>new Set([...e.map((o)=>o.key),...t.map((o)=>o.key),...n.flatMap((o)=>o.pty?[o.pty.key,...o.pty.all??[]]:[])]);function n8(e,t,n){let o=!1,r=Object.fromEntries(Object.entries(e).map(([a,i])=>{if(a===n)return[a,i];let s=i.items.filter((l)=>!Lw(l)||!l.key||t.has(l.key));if(s.length===i.items.length)return[a,i];return o=!0,[a,{...i,items:s}]}));return o?r:e}var o8=["claude","codex","gemini","agy","opencode","cursor"];function r8(e){let{ctx:t,cards:n,shells:o,agents:r,key:a}=e,i=[],s=(v)=>r.find((k)=>k.cmd===v)?.name??"Agent",l=Sw(n,t.dir,t.ws,e.wsOfCard),c=new Set(l.map(a)),d=n.filter((v)=>v.state===t.dir&&e.wsOfCard(v)===t.ws),u=d.filter((v)=>!c.has(a(v))&&v.pty?.alive),p=(v)=>({id:"sh:"+v.key,kind:v.agent?"agent":"shell",agent:v.agent||void 0,title:v.title,key:v.key});for(let v of[...l,...u]){let k=a(v),S=o8.find((N)=>N===v.pty?.agent)??o8.find((N)=>v.tags?.includes(N))??void 0;for(let N of QI(v,s(S)))i.push({id:"agent:"+N.key,kind:"agent",agent:S,title:N.title,key:N.key});for(let N of o.filter((R)=>R.run===k))i.push(p(N));if(e.elsewhere.has(k))i.push({id:"wait:"+k,kind:"wait",agent:"claude",title:s("claude")})}let f=new Set(d.map(a));for(let v of o.filter((k)=>k.run===t.k||f.has(k.run)&&!c.has(k.run)))i.push(p(v));let g=e.saved.hb,m=e.serverAgents.map((v)=>"agent:"+v.key).filter((v,k)=>g&&(v in g)&&g[v]!==(e.serverAgents[k].born??0)),y=e.saved.hidden.filter((v)=>!m.includes(v)),b=e.saved.tabs.map((v)=>v.kind==="local"?{...v,title:"Browser"}:v),x=[...i.filter((v)=>!y.includes(v.id)),...b];return{tabs:x.filter((v,k)=>x.findIndex((S)=>S.id===v.id)===k),revive:m}}var a8=de()(()=>({ctx:null,card:null,shells:[],agents:[],defAgent:"",noPty:!1,elsewhere:[],selectTerm:null})),{getState:ft,setState:kr}=a8,bt=()=>ft().ctx,Eo=()=>xm(bt().k),Jd=(e)=>pi(bt().k,e),ep=()=>Eo().screens,Bw=(e)=>kr((t)=>t.shells.some((n)=>n.key===e.key)?t:{shells:[...t.shells,e]}),Nb=(e,t)=>kr((n)=>({elsewhere:t?[...new Set([...n.elsewhere,e])]:n.elsewhere.filter((o)=>o!==e)}));var Rb=()=>oe().state.cards.filter((e)=>e.state===bt().dir&&Qo(e)===bt().ws);function np(){let e=ft(),{tabs:t,revive:n}=r8({ctx:bt(),cards:oe().state.cards,shells:e.shells,agents:e.agents,serverAgents:oe().state.agents??[],elsewhere:new Set(e.elsewhere),saved:Eo(),wsOfCard:Qo,key:Ne});if(n.length)Jd((o)=>({...o,hidden:o.hidden.filter((r)=>!n.includes(r)),hb:Object.fromEntries(Object.entries(o.hb??{}).filter(([r])=>!n.includes(r)))}));return t}var tp=new Map,$R=new Map;function Hw(){let e=ft().ctx&&$R.get(bt().k);if(!e)return;let t=XI(PR(oe().state.cards,bt().dir,bt().ws,Qo),e,Ne);for(let n of Rb())e.add(Ne(n));if(t)tp.set(bt().k,Ne(t))}function Sr(){let e=np(),t=bt();mw(t.k,e.map((l)=>l.id));let n=Eo(),o=n.screens,r=o.find((l)=>l.id===n.on),a=(l)=>e.find((c)=>c.id===l),i=Date.now(),s=ft();To({message:null,screens:o.map((l)=>{let c=vn(l.tree),{id:d,kind:u,title:p,agent:f}=a(c[0]);return{id:l.id,ids:c,focus:l.focus,title:c.map((g)=>a(g).title).join(" + "),first:{id:d,kind:u,title:p,agent:f}}}),on:n.on,split:!!r,agents:s.agents,defAgent:s.defAgent,pty:!s.noPty,titles:Object.fromEntries(e.map((l)=>[l.id,l.title])),items:e,wsk:t.k,ws:t,history:DR(oe().state.cards,t.dir,t.ws,Qo).map((l)=>({k:Ne(l),title:Vs(l),state:mi(l),line:`${l.status} · ${co(l.moved??i,i)} ago`})),empty:!o.length}),To((l)=>{let c=JL(l.recent,t.k).slice(-32);return{recent:c,kept:e8({...l.kept,[t.k]:{items:e,ws:t}},c,t.k)}}),yne()}function yne(){let e=bt(),t=PR(oe().state.cards,e.dir,e.ws,Qo),n=DR(oe().state.cards,e.dir,e.ws,Qo),o=WI(t,n,tp.get(e.k),Ne);if(Pe({parked:!o}),To({awaiting:t.some(Tm)}),!o)return kr({card:null}),void To({picker:null});tp.set(e.k,Ne(o)),Pe({ro:n.includes(o)}),kr({card:o});let r=Date.now(),a=(i)=>({k:Ne(i),title:Vs(i),state:mi(i),line:`${Ll(i)?`waiting on you · ${vb(i)}`:Tm(i)?"needs you":i.status} · ${co(i.moved??r,r)}`});if(To({picker:{cur:a(o),live:t.map(a),hist:n.map(a),other:t.some((i)=>i!==o&&Tm(i))}}),Re().openKey!==Ne(o))Xi(o)}var Uw=(e)=>oe().state.cards.find((t)=>Ne(t)===e);function WR(e,t,n){if(hw(bt().k,e,t,n))Sr()}function Om(e){if(!Eo().tabs.some((t)=>t.id===e.id))Jd((t)=>({...t,tabs:[...t.tabs,e]}));else if(mo.getState().target)oI(bt().k,e.id);Tb(e.id)}var Gw=(e)=>{if(!Eo().tabs.some((t)=>t.id===e.id))Om(e)};function Tb(e){mw(bt().k,np().map((t)=>t.id)),nI(bt().k,e),Sr()}var XR=(e)=>Om({id:"note:"+e,kind:"note",title:e.slice(e.lastIndexOf("/")+1),note:e}),Eb=()=>{if(Om({id:"preview",kind:"preview",title:"Preview"}),nt())hu(!1)};async function QR(e,t=!1,n=!0){let o=Ne(e),r=await fetch("/shell",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:e.state,ws:bt().ws,run:o,resume:!0})}).catch(()=>null);if(r?.ok){Nb(o,!1);let i=await r.json();return Bw(i),n?Tb("sh:"+i.key):Sr()}let a=r?await r.json().catch(()=>({})):{};if(r?.status===409&&a.live){if(Nb(o,!0),t)_("Still running in another terminal");return Sr()}if(Nb(o,!1),t)_(a.error||"Could not resume the session");else Sr()}async function jw(e,t){let n=await fetch("/shell",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:bt().dir,ws:bt().ws,run:bt().k,...e?{agent:e,yolo:t}:{}})});if(n.status===501)return kr({noPty:!0}),Sr();if(!n.ok){let r="";try{r=(await n.json()).error}catch{}return _(r?"No new terminal: "+r:"No new terminal ("+n.status+")"),Sr()}let o=await n.json();Bw(o),Tb("sh:"+o.key)}var YR=!1;async function ZR(){if(!ft().ctx||YR)return;let e=bt(),t=async()=>{try{return await(await fetch("/devports?ws="+encodeURIComponent(e.ws))).json()}catch{return[]}},n=oe().state.cards.filter((u)=>u.state===e.dir&&Qo(u)===e.ws&&u.id).sort((u,p)=>String(p.id).localeCompare(String(u.id)))[0],o="";try{if(n)o=Fs((await(await fetch(`/run/${encodeURIComponent(n.id)}?dir=${encodeURIComponent(e.dir)}`)).json()).impl)??""}catch{}let r=(u)=>{qd(e.k,u),Om({id:"local",kind:"local",title:"Browser"}),ub(e.k,u);let p=JI(u);if(p)ON(`Opened localhost:${p}`,"Stop server",()=>void xne(p))},a=await t();if(a.length)return r(Em(o,a));let i=Em(o,[]),s=await fetch("/shell",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:e.dir,ws:e.ws,run:e.k,dev:!0})}).catch(()=>null);if(!s?.ok){let u="";try{u=(await s.json()).error}catch{}return _(u?`Preview: ${u}`:"Preview: the dev server did not start"),Eb()}let l=await s.json();Bw(l),Sr(),YR=!0,_("Starting the app…");let c=!1,d=!1;try{for(let u=0;u<40&&ft().ctx?.k===e.k;u++){await new Promise((g)=>setTimeout(g,1500));let p=await t();if(p.length)return r(Em(o,p));let f=await wne(l.key);if(f){c=!0,d=await kne(f);break}if(u===5&&i&&!navigator.platform.startsWith("Linux"))return r(i)}if(!c&&ft().ctx?.k===e.k)_("The app did not open a port. Its terminal tab shows why.")}finally{YR=!1}if(d)return ZR()}async function xne(e){try{let t=await fetch("/port/stop",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({port:e})});if(t.ok)return _(`Stopped localhost:${e}`);_(`Could not stop localhost:${e}: ${(await t.json()).error??"unknown error"}`)}catch{_(`Could not stop localhost:${e}: the board did not answer`)}}async function wne(e){try{let t=await(await fetch("/shell/conflict?key="+encodeURIComponent(e))).json();return t.port?t:null}catch{return null}}async function kne(e){let t=e.holders.map((o)=>`${o.name||"a process"} (pid ${o.pid})${o.cwd?` in ${o.cwd}`:""}`).join(", ");if(e.board)return _(`Port ${e.port} is this board's own: the app needs another port.`),!1;if(!await mn({title:`Port ${e.port} is already in use`,description:t?`${t} is using it. Stop it so the app can start on this port?`:"Something is using it. Stop it so the app can start on this port?",confirmLabel:"Stop it and run the app",danger:!0}))return!1;try{let o=await fetch("/port/stop",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({port:e.port})});if(o.ok)return!0;_(`Could not stop it: ${(await o.json()).error??"unknown error"}`)}catch{_("Could not stop it: the board did not answer")}return!1}async function Fw(e){let t=bt().k;if(e.startsWith("sh:"))await K("/pty/exit",{key:e.slice(3)}),kr((n)=>({shells:n.shells.filter((o)=>"sh:"+o.key!==e)}));else if(e.startsWith("agent:")){let n=e.slice(6),o=oe().state.agents?.find((r)=>r.key===n);if(o?.busy&&!await mn({title:"This agent is still working. End it?",confirmLabel:"End",danger:!0}))return;pi(t,(r)=>({...r,hidden:[...r.hidden,e],hb:{...r.hb,[e]:o?.born??0}})),await K("/pty/exit",{key:n}),fo(!0)}else if(e.startsWith("wait:"))Nb(e.slice(5),!1);else pi(t,(n)=>({...n,tabs:n.tabs.filter((o)=>o.id!==e)}));if(ft().ctx?.k===t)Sr()}async function s8(e){let t=Eo().screens.find((n)=>n.id===e);for(let n of t?vn(t.tree):[])await Fw(n)}function JR(e,t,n){let o=Eo();if(eI(t==="tab"||!o.on?null:{screen:o.on,dir:t}),e==="shell")jw();else if(e.startsWith("agent:"))jw(e.slice(6),n);else if(e==="local")Om({id:"local",kind:"local",title:"Browser"});else if(e==="history")Om({id:"history",kind:"history",title:"History"});else Eb()}function Sne(){let e=ep().find((o)=>o.id===Eo().on),t=e&&np().find((o)=>o.id===e.focus),n=ft();if(t?.kind==="shell")return"shell";if(t?.kind==="agent")return"agent:"+(t.agent??(n.defAgent||n.agents[0]?.cmd||""));return null}async function eT(){let e=!Re().pn;if(Pe({pn:e}),!e)return;To({notes:{loading:!0}});try{let t=await(await fetch("/vault?dir="+encodeURIComponent(bt().dir))).json();To({notes:{names:(t.notes??[]).map((n)=>n.name).sort()}})}catch{To({notes:{failed:!0}})}}var Cne=(e)=>{gw(bt().k,e),Sr(),Sm(e)},i8={ArrowLeft:"l",h:"l",ArrowRight:"r",l:"r",ArrowUp:"u",k:"u",ArrowDown:"d",j:"d"};function l8(e){if(e==="?")return document.activeElement?.blur(),void Gs(!0);if(e==="x"){let c=ep().find((d)=>d.id===Eo().on);if(c)Fw(c.focus).then(()=>Sm(ep().find((d)=>d.id===Eo().on)?.focus));return}let t={c:"tab",r:"cols",d:"rows"}[e],n=t&&t!=="tab"&&ft().noPty===!1?Sne():null;if(n)return void JR(n,t);if(t)return void To({menu:t});let o=Eo(),r=ep(),a=r.findIndex((c)=>c.id===o.on),i=r[a];if(!i)return;if(i8[e]){let c=gR(Vz(pw(i.tree).panes),i.focus,i8[e]);if(c)Cne(c);return}let s=e==="n"?(a+1)%r.length:e==="p"?(a-1+r.length)%r.length:/^[1-9]$/.test(e)?+e-1:-1,l=r[s];if(!l)return;db(bt().k,l.id),Sr(),Sm(l.focus)}var c8=null,u8=(e)=>To({message:e});async function _m(e=!1){let t=new URLSearchParams(location.search),n=t.get("dir"),o=t.get("id"),r=t.get("idea"),a=t.get("ws"),i=null,s=async()=>{if(oe().all||!n||n===oe().dir||n===c8)return!1;return c8=n,await lb(n).catch(()=>{}),!0};if(t.get("view")==="ws"&&a){if(await s())return _m(e)}else{let u=(m)=>m.find((y)=>y.state===n&&(o?y.kind==="run"&&y.id===o:y.kind==="idea"&&y.text===r)),p=u(oe().state.cards),f=r&&(p??ft().card)?.kind==="idea"&&(p??ft().card)?.pty?.key,g=f&&oe().state.cards.find((m)=>m.kind==="run"&&m.state===n&&(m.pty?.key===f||m.pty?.all?.includes(f)));if(g)return history.replaceState(null,"",Bl(g)),ob(),_m(e);if(!p){if(await s())return _m(e);if(!oe().all&&u($i().cards))location.href="/?all=1&"+t.toString();else Kw(),kr({ctx:null,card:null}),u8(`That ${o?"run":"idea"} was not found.`);return}i=p,a=Qo(p)}if(!n||!a)return Kw(),kr({ctx:null,card:null}),void u8("That workspace was not found.");let l=di(n,a),c=ft().ctx?.k!==l;if(c)Kw(),kr({card:null,ctx:{dir:n,ws:a,k:l}});if(c&&!qw.has(l))qw.set(l,new Set(Rb().filter(Cw).map(Ne)));if(c)$R.set(l,new Set(Rb().map(Ne)));if(c)tT.delete(l);let d=$i().projects?.find((u)=>u.dir===n)?.workspaces?.find((u)=>u.path===a);if(F6(i?Vs(i):d?.branch||a.split(/[\\/]/).pop()||"Workspace"),oe().state.cards.some((u)=>(Ne(u)in mo.getState().all))){let u=structuredClone(mo.getState().all);if(YI(u,oe().state.cards,Ne,Qo))Jz(u)}try{let u=await fetch("/shells?dir="+encodeURIComponent(n));kr({shells:u.ok?await u.json():[]})}catch{}if(c)try{let u=await(await fetch("/agents?dir="+encodeURIComponent(n))).json();kr({agents:u.agents??[],defAgent:u.default??""})}catch{}if(ft().ctx?.k!==l)return;if(c)tp.delete(l);if(i?.kind==="run"&&(e||c))tp.set(l,Ne(i));if(Hw(),!ft().noPty){if(!np().length&&!Vw.has(l))return Vw.add(l),void jw();let u=!!Re().wantPty&&Date.now()-Re().wantPty.at<20000;if(i&&i.kind==="run"&&!Qd(i)&&!i.pty&&!u&&!ft().shells.some((p)=>p.run===Ne(i))&&!Vw.has(Ne(i)))Vw.add(Ne(i)),QR(i,!1,!1)}if(!d8())Sr()}function d8(){let e=Re().wantPty,t=e&&Date.now()-e.at<20000?e.key:null;if(e&&!t)Pe({wantPty:null});let n=ft().selectTerm||t;if(n)Jd((r)=>({...r,hidden:r.hidden.filter((a)=>a!=="agent:"+n&&a!=="sh:"+n)}));let o=np().find((r)=>r.key===n);if(kr({selectTerm:null}),o&&Re().wantPty?.key===o.key)Pe({wantPty:null});return!!o&&(Tb(o.id),!0)}var Vw=new Set;function Kw(){Pe({parked:!0}),To({items:[],wsk:null,ws:null}),fw()}function p8(){Kw(),kr({card:null,ctx:null}),Pe({pn:!1})}var qw=new Map;async function f8(){if(!ft().ctx)return;let e=bt().k,t=Rb(),n=qw.get(e);if(qw.set(e,new Set(t.filter(Cw).map(Ne))),!n)return;for(let o of ZI(t,n,Eo().seen??[],Ne)){let r;try{let a=await(await fetch(`/run/${encodeURIComponent(o.id)}?dir=${encodeURIComponent(o.state)}`)).json(),i=Fs(a.impl);if(!Nm(i))continue;r=Em(i,await(await fetch("/devports?ws="+encodeURIComponent(bt().ws))).json())}catch{}if(!r||ft().ctx?.k!==e||Eo().seen?.includes(Ne(o)))continue;Jd((a)=>({...a,seen:[...a.seen??[],Ne(o)]})),qd(e,r),Gw({id:"local",kind:"local",title:"Browser"}),ub(e,r)}}var tT=new Map;async function m8(){if(!ft().ctx)return;let e=bt().k,t=bt().dir,n=await TR(t,bt().ws);if(ft().ctx?.k!==e)return;let o=n?.at??0,r=tT.get(e);if(r!==void 0&&o<=r)return;if(tT.set(e,o),!n||!NR(o,r))return;if(n.image){let a=Eo().tabs.some((i)=>i.id==="preview");if(Gw({id:"preview",kind:"preview",title:"Preview"}),a)tI();return}qd(e,n.url),Gw({id:"local",kind:"local",title:"Browser"}),ub(e,n.url)}function g8(){let e=oe(),t=Fe.getState().kept,n=n8(t,t8(e.shells,e.state.agents??[],e.state.cards),ft().ctx?.k??null);if(n!==t)To({kept:n})}async function h8(){let e=ft().ctx?.k;if(!Object.entries(Fe.getState().kept).some(([t,n])=>t!==e&&n.items.some(Lw)))return;if(await ib())g8()}var Nne=()=>(fo(!0),void h8());function nT(e,t){history.pushState(null,"",gi(e,t)),ob(),Ki("ws")}var b8=nT;function v8({dir:e,ws:t,key:n}){if(kr({selectTerm:n}),ft().ctx?.k===di(e,t)&&Ze().view==="run")return void d8();nT(e,t)}function y8({dir:e,ws:t,id:n}){let o=di(e,t),r=xm(o).screens.find((a)=>vn(a.tree).includes(n));if(r)db(o,r.id);if(ft().ctx?.k===o&&Ze().view==="run")return void Sr();nT(e,t)}function x8(){let e=[ui((t)=>t.shells,g8),zr(()=>void h8())];return hI({select:(t)=>{db(bt().k,t),Sr()},close:(t)=>void s8(t),closeItem:(t)=>void Fw(t),openNew:JR,runApp:()=>void ZR(),move:WR,drag:wm,dragging:()=>mo.getState().dragging,drop:(t)=>{let n=mo.getState().dragging;if(n)WR(n,t)},openHere:(t)=>Uw(t)&&void QR(Uw(t),!0),pick:(t)=>Uw(t)&&(tp.set(bt().k,t),Sr()),openNote:XR,termEnded:Nne,currentRun:()=>ft().card?.id?{dir:ft().card.state,id:ft().card.id}:null,previewTarget:()=>{let{ctx:t,card:n}=ft();return t&&{dir:t.dir,ws:t.ws,card:n?{id:n.id,kind:n.kind,state:n.state}:null,impl:Re().runDoc&&Re().runDoc.id===n?.id?Re().runDoc.impl:null}}}),()=>e.forEach((t)=>t())}function zm(e){let t=Bl(e);if(location.pathname+location.search!==t)history.pushState(null,"",t);ob(),Ki("run")}var w8=(e)=>st.setState((t)=>({[e]:t[e]+1}));function Xi(e,t){let n=Ze().view,o=n==="board"||n==="tasks";if(n!=="run"&&(nt()||!o||e.kind==="run"&&!e.archived))return Pe({keepNext:!!t}),void zm(e);t||=Re().keepNext,Xr(!0),Sb(),st.setState((r)=>({keepNext:!1,openKey:Ne(e),card:e,openN:r.openN+1,off:[],open:!0,title:EL(e),titleTip:AL(e),...e.kind==="idea"?{runDoc:null,ptabs:[]}:{},...e.kind!=="idea"&&!t?{wantTab:ML(e)}:{}}))}function k8(){let e=B6(location.search);if(!e)return;history.replaceState(null,"",location.pathname+"?all=1");let t=oe().state.cards.find((o)=>o.state===e.dir&&(e.run?o.kind==="run"&&o.id===e.run:o.kind==="idea"&&o.text===e.idea));if(!t){_(e.run?"That run was not found":"That task was not found");return}let n=GR.find((o)=>o[1]===e.tab);Pe({...n?{wantTab:n[1]}:{},hit:e.item?{type:e.item.type,n:e.item.n,k:Ne(t)}:null}),Xi(t,!!n)}function S8(e,t,n){Pe({wantTab:t==="finding"?"review":"backlog",hit:{type:t,n,k:Ne(e)}}),Xi(e,!0)}function Qi(e=!1){let t=Ze().view;if(!e&&t!=="board"&&t!=="run"&&t!=="tasks")return;let n=Re().openKey;if(Xr(!0),bu(),Sb(),Pe({openKey:null,card:null,runDoc:null,open:!1}),n)E8(n)?.focus({preventScroll:!0})}var oT=()=>Ze().view==="run"?hu(!1):Qi(),Ab=()=>w8("drawAsk"),C8=()=>new Promise((e)=>{pb.add(e),w8("fetchAsk")});function N8(e){if(Ze().view==="run"&&e==="preview")return void Eb();Pe({pn:!1,wantTab:e}),Ab()}function R8(e){let{ptabs:t,tab:n}=Re(),o=t.indexOf(n),r=t[o<0?e>0?0:t.length-1:Math.max(0,Math.min(t.length-1,o+e))];if(r&&r!==n)Pe({wantTab:r}),Ab()}var T8=()=>void eT();var Su=h(I(),1);var wu=de()(()=>({view:null,files:{},refocus:null})),{getState:A8,setState:ku}=wu,rT=(e,t)=>ku((n)=>({files:{...n.files,[e]:[...n.files[e]??[],...t]}})),M8=(e)=>ku((t)=>{let{[e]:n,...o}=t.files;return{files:o}});var Mb=(e)=>e._k||(e.kind==="idea"?"idea:"+e.state+":"+e.text:"run:"+e.state+":"+e.id);function D8(e){let t=[];for(let n of(e||"").split(`
30
+ `)){let o=/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2})\]\s?(.*)$/.exec(n);if(o){t.push({at:o[1],text:o[2]});continue}let r=t[t.length-1];if(r)r.text+=`
31
+ `+n.replace(/^\s{2}/,"");else if(n.trim())t.push({at:"",text:n})}return t.map((n)=>({...n,text:n.text.trim()})).filter((n)=>n.text)}function P8(e){let t=!1;return e.split(`
32
+ `).map((n)=>{if(/^```/.test(n))t=!t;if(t||/^\s*(#|```|\||[-*]\s|\d+\.\s|>)/.test(n))return n;let o=Bs(n);if(!o.parts.length)return n;return`
33
+ `+[...n.startsWith(o.parts[0].label+":")?[]:[o.head],...o.parts.map((a)=>`**${a.label}:** ${a.body}`)].join(`
34
+
35
+ `)+`
36
+ `}).join(`
37
+ `).trim()}var O8=(e)=>e.kind==="idea"?Bs(e.text??"").parts.map((t)=>`### ${t.label}
38
+ ${t.body}`).join(`
39
+
40
+ `):"",_8=(e,t,n)=>e.kind==="run"?{dir:e.state,id:e.id,text:t,files:n}:{dir:e.state,for:e.text,text:t,files:n};var Rne="kz-d:";async function z8(e,t,n){if(Xr(!0),t=t.trim(),!t&&!n.length)return!1;if(!(await K("/note",_8(e,t,await O.dataUrls(n)))).ok)return!1;let r=Mb(e);M8(r);try{sessionStorage.removeItem(Rne+"n:"+r)}catch{}return _("Noted"),ku({refocus:r}),document.activeElement?.blur(),O.reload(),!0}var I8=(e)=>{if(A8().refocus!==e)return!1;return ku({refocus:null}),!0};var $w=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]);function L8(e,t){let n=e.split(`
41
+ `),o=[],r=0,a=null,i=(l)=>$w(l).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s<][^*<]*?)\*(?!\*)/g,"$1<i>$2</i>").replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g,(c,d,u)=>Cm(u)?`<a href="${u}" target="_blank" rel="noopener noreferrer"><img src="${u}" alt="${d}"></a>`:c).replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(c,d,u)=>Cm(u)?`<a href="${u}" target="_blank" rel="noopener noreferrer">${d}</a>`:c),s=()=>{if(a)o.push(`</${a}>`),a=null};while(r<n.length){let l=n[r];if(/^```/.test(l)){s();let p=[];r++;while(r<n.length&&!/^```/.test(n[r]))p.push(n[r++]);o.push(`<pre>${$w(p.join(`
42
+ `))}</pre>`),r++;continue}let c=/^(#{1,6})\s+(.*)$/.exec(l);if(c){s(),o.push(`<h${Math.min(c[1].length,3)}>${i(c[2])}</h${Math.min(c[1].length,3)}>`),r++;continue}if(/^---+$/.test(l.trim())){s(),o.push("<hr>"),r++;continue}if(/^\|/.test(l)){s();let p=[];while(r<n.length&&/^\|/.test(n[r]))p.push(n[r++]);let f=(g)=>g.replace(/^\||\|$/g,"").split("|").map((m)=>i(m.trim()));o.push("<table>"+p.filter((g)=>!/^\|\s*-/.test(g)).map((g,m)=>`<tr>${f(g).map((y)=>m?`<td>${y}</td>`:`<th>${y}</th>`).join("")}</tr>`).join("")+"</table>");continue}let d=/^\s*(?:[-*]|\d+\.)\s+(.*)$/.exec(l);if(d){let p=/^\s*\d+\./.test(l)?"ol":"ul";if(a!==p)s(),o.push(`<${p}>`),a=p;let f=t&&/^(open|done|rejected):\s*(.*)$/.exec(d[1]);o.push(f?`<li class="tk${f[1]==="rejected"?" rej":""}"><label><input type="checkbox" tabindex="-1" aria-disabled="true" onclick="return false"${f[1]==="done"?" checked":""} aria-label="${f[1]}"><span>${i(f[2])}</span></label></li>`:`<li>${i(d[1])}</li>`),r++;continue}if(!l.trim()){s(),r++;continue}s();let u=[l];r++;while(r<n.length&&n[r].trim()&&!/^(#|```|\||\s*[-*]\s|\s*\d+\.\s|---)/.test(n[r]))u.push(n[r++]);o.push(`<p>${i(u.map((p,f)=>f<u.length-1&&/ {2}$/.test(p)?p.trimEnd()+"\x00":p).join(" ")).replace(/\0 /g,"<br>")}</p>`)}return s(),o.join("")}var B8=" "+String.fromCharCode(10),H8=/\u200b/g;function j8(e){let t=(a)=>{if(a.nodeType===3)return a.textContent.replace(H8,"").replace(/\u00a0/g," ").replace(/\n/g,B8);if(a.nodeType!==1)return"";let i=a.nodeName.toLowerCase(),s=()=>[...a.childNodes].map(t).join("");if(i==="br")return B8;if(i==="b"||i==="strong")return((l)=>l.trim()?`**${l}**`:l)(s());if(i==="i"||i==="em")return((l)=>l.trim()?`*${l}*`:l)(s());if(i==="code")return((l)=>l?"`"+l+"`":l)(a.textContent.replace(H8,""));if(i==="img")return`![${a.getAttribute("alt")||""}](${a.getAttribute("src")})`;if(i==="a"){let l=[...a.childNodes].find((c)=>c.nodeName.toLowerCase()==="img");return l?t(l):`[${s()}](${a.getAttribute("href")})`}return s()},n=[],o="",r=()=>{if(o.trim())n.push(o.replace(/^\n+|\s*\n+$/g,""));o=""};for(let a of e.childNodes){let i=a.nodeType===1?a.nodeName.toLowerCase():"";if(/^h[1-6]$/.test(i))r(),n.push("#".repeat(+i[1])+" "+t(a).trim());else if(i==="ul"||i==="ol"){r();let s=[...a.childNodes].filter((l)=>l.nodeName.toLowerCase()==="li");n.push(s.map((l,c)=>(i==="ol"?`${c+1}. `:"- ")+t(l).trim()).join(`
43
+ `))}else if(i==="pre")r(),n.push("```\n"+a.textContent+"\n```");else if(i==="p"||i==="div")r(),o=j8(a),r();else o+=t(a)}return r(),n.join(`
44
+
45
+ `)}var Tne=/\*\*[^*]+\*\*|`[^`]+`|(^|[^*])\*[^*\s][^*]*\*(?!\*)/,Ene=(e)=>{let t=[],n=(r)=>{if(r.nodeType===3)t.push(r.textContent.replace(/\u00a0/g," "));else if(!/^(CODE|B|STRONG|I|EM)$/.test(r.nodeName))r.childNodes.forEach(n)};n(e);let o=t.join("");return Tne.test(o)||!/^(LI|H\d)$/.test(e.nodeName)&&/^\s*([-*]|\d+\.|#{1,6})\s/.test(e.textContent.replace(/\u00a0/g," "))};function U8(e){let t=document.createElement("div");t.className="rich",t.contentEditable="true",t.setAttribute("role","textbox"),t.setAttribute("aria-multiline","true"),t.dataset.ph=e.placeholder,e.hidden=!0,e.after(t);let n=()=>[...t.querySelectorAll(":scope > :not(ul):not(ol), :scope > ul > li, :scope > ol > li")],o=(s)=>{t.innerHTML=L8(s).replace(/<(li|h\d)><\/\1>/g,"<$1><br></$1>");for(let l of n()){let c=l.lastChild;if(c&&c.nodeType===1&&/^(B|I|CODE|A)$/.test(c.nodeName))l.append("​")}},r=(s)=>{let l=document.createRange();l.selectNodeContents(s||t),l.collapse(!1);let c=getSelection();c.removeAllRanges(),c.addRange(l)},a=!1,i=()=>{a=!0,e.value=j8(t),e.dispatchEvent(new Event("input",{bubbles:!0})),a=!1};if(t.addEventListener("input",()=>{let s=getSelection(),l=n(),c=s.rangeCount?l.findIndex((u)=>u.contains(s.anchorNode)):-1,d=l[c]||(s.anchorNode&&s.anchorNode.parentNode===t?t:null);if(i(),!e.value.trim()&&!t.querySelector("img"))t.replaceChildren();else if(d&&Ene(d)){let u=c<0?0:c;o(e.value),r(n()[u])}}),e.addEventListener("input",()=>{if(a)return;if(o(e.value),document.activeElement===t)r(null)}),t.addEventListener("keydown",(s)=>{let l=s.ctrlKey||s.metaKey;if(l&&s.key.toLowerCase()==="b")s.preventDefault(),document.execCommand("bold");else if(l&&s.key.toLowerCase()==="e"){s.preventDefault();let c=String(getSelection());if(c)document.execCommand("insertHTML",!1,`<code>${$w(c)}</code>​`)}else if(s.key==="Enter"&&s.shiftKey){s.preventDefault();let c=getSelection().anchorNode,d=c&&(c.nodeType===1?c:c.parentElement);document.execCommand(d&&d.closest("li,h1,h2,h3,h4,h5,h6")?"insertParagraph":"insertLineBreak")}}),t.addEventListener("paste",(s)=>{if([...s.clipboardData.items].some((c)=>c.kind==="file"))return;let l=s.clipboardData.getData("text/plain");if(s.preventDefault(),l)document.execCommand("insertText",!1,l)}),e.value)o(e.value);return t}var Ane=0,Db=()=>{for(let e of[...pb])e();pb.clear()},aT=(e)=>oe().state.cards.find((t)=>Ne(t)===Re().openKey)??(e?Re().card:null);function G8(){let e=st((u)=>u.openKey),t=st((u)=>u.openN),n=st((u)=>u.fetchAsk),o=st((u)=>u.drawAsk),r=st((u)=>u.runDoc),a=yt((u)=>u.state),i=Su.useRef(""),s=Su.useRef(""),l=Su.useRef(""),c=`${e}|${t}`;Su.useEffect(()=>{let u=aT(l.current!==c);if(!e||!u||u.kind!=="run")return void Db();let p=`${c}|${n}`,f=i.current!==p;if(i.current=p,!f&&Re().runDoc?.id===u.id&&fb())return;let g=new AbortController;return fetch(`/run/${encodeURIComponent(u.id)}?dir=${encodeURIComponent(u.state)}`,{signal:g.signal}).then((m)=>m.json()).then((m)=>{if(Re().openKey!==e)return;if(!m||m.id!==u.id)return _(m?.error||"Could not read this run"),Db();s.current=c,Pe({runDoc:m})},()=>g.signal.aborted||Db()),()=>g.abort()},[e,t,n,a]);let d=e&&aT(!0)?.kind==="idea";Su.useLayoutEffect(()=>{let u=l.current!==c,p=aT(u);if(!e||!p)return;let f=Re();if(p.kind==="run"&&u&&s.current!==c)return;if(!u&&fb())return;if(p.kind==="run"&&f.runDoc?.id!==p.id)return;if(l.current=c,f.wantTerm===Ne(p))Pe({wantTerm:null});if(p.kind==="idea"){let m=zL(p);if(Pe({head:m.head,tabs:[],tab:"",ptabs:[],footer:m.footer}),p.pty&&Ze().view!=="run"&&Ze().view!=="tasks")eL(p);else bu(),Pe((y)=>({body:"notes",top:y.top+1})),ku({view:{card:p,src:p.notes,ro:!!p.archived||p.status!=="idea"}});return Db()}let g=IL({card:p,runDoc:f.runDoc,wantTab:f.wantTab,view:Ze().view,wide:Ze().view==="run"||innerWidth>640,git:{shown:UR(p,f.runDoc),pending:NL(p,f.runDoc)},hit:f.hit,refresh:!u,key:Ne});if(bu(),g.tab!=="git")Sb();if(Pe((m)=>({wide:!1,head:g.head,tabs:g.tabs,tab:g.tab,wantTab:g.tab,ptabs:g.tabs.map((y)=>y.k),fix:g.fix,footer:g.footer,...g.kind==="doc"?{body:"doc",doc:{...g.doc,mark:g.needle&&u?++Ane:0},top:m.top+1}:{},...g.kind==="notes"?{body:"notes",top:m.top+1}:{}})),g.kind==="notes")ku({view:g.notes});else if(g.kind==="git")RL(p);if(f.hit&&u){if(f.hit.k===Ne(p)&&!g.needle)_("That item is not in this run");Pe({hit:null})}Db()},[e,t,o,r,d?a:null])}var Ww=h(I(),1);var Mne=3000,Yw=(e)=>To({hint:e});function Dne(){let e,t=(n)=>{if(!ft().ctx||Kx())return;if(n.ctrlKey&&!n.shiftKey&&n.code==="Space"){n.preventDefault(),n.stopPropagation(),Sm(ep().find((o)=>o.id===Eo().on)?.focus),clearTimeout(e),Yw(!0),e=setTimeout(()=>(e=void 0,Yw(!1)),2000);return}if(!e||["Control","Shift","Alt","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation(),clearTimeout(e),e=void 0,Yw(!1),l8(n.key)};return addEventListener("keydown",t,!0),()=>(clearTimeout(e),Yw(!1),removeEventListener("keydown",t,!0))}function F8(){let e=ut((n)=>n.view==="run"),t=ut((n)=>n.visit);Ww.useEffect(()=>x8(),[]),Ww.useEffect(()=>{if(!e||!t)return;let n=!0;return queueMicrotask(()=>n&&void _m(!0)),()=>void(n=!1)},[e,t]),Ww.useEffect(()=>{if(!e)return;let n=Dne(),o=setInterval(()=>void m8(),Mne),r=zr(()=>{if(f8(),Hw(),ft().ctx)_m()});return()=>(n(),clearInterval(o),r())},[e])}async function V8(e){let t=await fetch("/agents?dir="+encodeURIComponent(e)).then((n)=>n.json()).catch(()=>null);if(!t?.agents?.length)return null;if(t.agents.some((n)=>n.cmd==="agy"))t.agents=t.agents.filter((n)=>n.cmd!=="gemini");return t}async function K8(e,t,n){O.notify();let o=!!n?.yolo,r=e.kind==="backlog"?{source:e.source,n:e.n}:void 0,a=await K("/run",{dir:e.state,text:e.text,backlog:r,kind:t,agent:n?.agent,account:n?.account,explore:n?.explore,yolo:o});if(a.ok){if(_((t==="full"?"Full":"Lite")+(o?" yolo":"")+" run "+mb(a)+": "+O.agentLine(a.agent)),a.pty&&!r)O.launched(e,a.pty);if(!r)O.openWorkspace(e)}O.loadBoard()}async function q8(e,t,n,o){if(!t)return!1;if(t!==e.text||n!==(e.notes||"")){if(!(await K("/inbox",{op:"edit",dir:e.state,text:e.text,next:t,notes:n})).ok)return!1}if(o.length){if(!(await K("/note",{dir:e.state,for:t,text:"",files:await O.dataUrls(o)})).ok)_("Task saved, files not attached")}return O.loadBoard(),!0}async function $8(e,t){let n=e.kind!=="run";if((e.kind==="backlog"?await K("/backlog",{op:"reject",dir:e.state,source:e.source,n:e.n,reason:t}):n?await K("/inbox",{op:"reject",dir:e.state,text:e.text,reason:t}):await K("/abort",{dir:e.state,id:e.id,why:t})).ok)_(n?"Rejected":"Abandoned, reason recorded");O.loadBoard()}async function Y8(e){if((await K("/inbox",{op:"delete",dir:e.state,text:e.text})).ok)_("Deleted");O.loadBoard()}async function W8(e,t,n){if((await K("/inbox",{op:"move",dir:e.state,to:t,text:e.text})).ok)_(`Moved to ${n}`);O.loadBoard()}async function X8(e,t,n,o,r){if((await K("/inbox",n?{op:"add",dir:n,text:e,notes:t}:{op:"add",text:e,notes:t})).ok){if(_("Task added"),o.length){if(!(await K("/note",{dir:n,for:e,text:"",files:await O.dataUrls(o)})).ok)_("Task added, files not attached")}if(r){await O.loadBoard();let i=Ir().snap?.allCards.find((s)=>s.kind==="idea"&&s.text===e&&(!n||s.state===n));if(i)return ht({popup:{kind:"run",card:i}})}}O.loadBoard()}async function iT(e){for(let t of e)await K("/archive",{dir:t.state,id:t.id});_("Archived "+e.length),O.loadBoard()}var Q8=()=>{let e=Vd(),t=sb(),n=e.filter((o)=>t.has(o.dir));return n.length?n:e};function Pb(e){if(e.kind!=="backlog")return O.openCard(e);let t=Ir().snap?.allCards.find((n)=>n.kind==="run"&&n.id===e.source&&n.state===e.state);if(!t)return _(e.source==="orphan"?"Kept from a run that was pruned":"That run was not found");O.openCard(t,"backlog",e.n)}var sT=new Set,Z8={add:(e)=>(sT.add(e),()=>void sT.delete(e))},Xw=()=>[...sT].find((e)=>e.offsetParent!==null)?.focus();var Qw={el:null},E8=(e)=>e?Qw.el?.querySelector('.card[data-k="'+CSS.escape(e)+'"]')??null:null,J8=()=>document.activeElement?.closest("#board .card")?.dataset.k;function eB(e,t){let n=[...Qw.el?.querySelectorAll("section")??[]].map((s)=>[...s.querySelectorAll(".card")]).filter((s)=>s.length);if(!n.length)return;let o=document.activeElement.closest(".card"),r=n.findIndex((s)=>o&&s.includes(o)),a=0;if(r<0)r=0;else if(a=n[r].indexOf(o),t)a=Math.max(0,Math.min(n[r].length-1,a+t));else r=Math.max(0,Math.min(n.length-1,r+e)),a=Math.min(a,n[r].length-1);let i=n[r][a];i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"})}var tB=(e)=>e.name+(e.note?". "+e.note:""),lT=(e,t)=>ht({popup:{kind:"form",mode:t,card:e}}),Zw=(e,t)=>ht({popup:{kind:"run",card:e,onStart:t}});function Zi(e,t){let n=e&&"dir"in e?e:null;Mz(),ht({popup:{kind:"new",dir:n?.dir??null,choose:!!n,text:t}})}var NB=h(Za(),1);var nB=["idea","planning","building","reviewing","done"],rB=(e)=>["done","abandoned"].includes(e.status),cT=(e)=>e.filter((t)=>t.kind==="run"&&!t.archived),oB=(e)=>e.filter((t)=>t.kind==="idea"&&!t.archived),e0=(e)=>e.kind==="run"?e.id:e.text,t0=(e,t)=>Rm(e,Il(e,t.tasks));function n0(e,t,n){if(n)return n.attention.reason+" · "+n.attention.action;if(e.kind==="idea")return!e.pty?.alive?"idea":e.pty.asking?"waiting on you":e.pty.busy?"planning · starting":"agent · open";let o=e.moved??t;if(e.stage==="explore")return e.awaiting?`exploring · ${Ls(e.awaiting)}`:`exploring · ${co(e.moved??t,t)}`;if(e.status==="waiting")return e.awaiting?`${nB[e.column]??"waiting"} · ${Ls(e.awaiting)}`:"waiting on you";if(e.accept==="needs")return"done, not approved";if(Ll(e))return`waiting on you · ${vb(e)}`;if(e.accept==="auto")return`auto-accepted · ${co(o,t)} ago`;if(e.status==="done"||e.status==="abandoned")return`${e.status} · ${co(o,t)} ago`;if(e.status==="stalled")return`stalled · ${co(o,t)}`;return`${nB[e.column]??e.status} · ${co(o,t)}`}var Jw={conflict:0,failed:0,asking:1,working:2,done:3},Pne=(e)=>e.dir+`
46
+ `+(e.ws??""),o0=(e)=>e.ws?.split(/[\\/]/).pop()||"main";function r0(e,t){let n=new Map;for(let o of e){let r=Pne(o);n.set(r,[...n.get(r)??[],{a:o,st:AR(o,t)}])}return[...n].map(([o,r])=>({k:o,rows:r.sort((a,i)=>Jw[a.st]-Jw[i.st])})).sort((o,r)=>Jw[o.rows[0].st]-Jw[r.rows[0].st])}var aB=(e)=>e.filter((t)=>t.rows[0].st==="asking").length;function iB(e){let t=cT(e.cards);return{projects:new Set(t.map((n)=>n.state)).size,active:t.filter((n)=>!rB(n)).length,waiting:t.filter((n)=>t0(n,e)==="wait").length}}var uT=(e)=>[...cT(e)].sort((t,n)=>(n.moved??0)-(t.moved??0)).slice(0,12),sB=(e,t)=>({list:e.slice(0,t?void 0:1),hidden:e.length-1});function lB(e){let t=[...cT(e.cards)].sort((r,a)=>(a.moved??0)-(r.moved??0)),n=t.filter((r)=>t0(r,e)==="wait"),o=t.filter(rB);return{wait:n,active:t.filter((r)=>!n.includes(r)&&!o.includes(r)),tasks:oB(e.cards).sort((r,a)=>(a.moved??a.added??0)-(r.moved??r.added??0)),done:o,none:!t.length&&!oB(e.cards).length}}var a0={claude:"Claude",codex:"Codex"},cB=(e)=>e.filter((t)=>a0[t.agent]),dT=(e)=>e>=95?"hi":e>=80?"mid":"",uB=(e)=>e?new Date(e).toLocaleString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):"unknown";var i0=de()(()=>({sheet:null})),pT=(e)=>i0.setState({sheet:e}),Ob=()=>i0.setState({sheet:null}),One=["claude","gemini","codex"],s0=(e)=>One.includes(e.toLowerCase())?e.toLowerCase():"ai";function l0(e){if(!O.open.term({dir:e.dir,ws:e.ws,key:e.key}))location.href=O.wsHref(e.dir,e.ws??"")}function dB(e){pT({kind:"pick",title:o0(e[0].a),rows:e.map(({a:t,st:n})=>({agent:t.agent||"",name:t.name||t.agent||"Terminal",dot:Wd[n],word:zl[n],open:()=>l0(t)})),onNew:()=>void fT(e[0].a.dir,e[0].a.ws)})}async function fT(e,t){let{projects:n,agents:o}=$i(),r=(n??[]).flatMap((c)=>(c.workspaces??[]).map((d)=>({dir:c.dir,ws:d.path,name:d.branch||d.path.split(/[\\/]/).pop()}))),a=r0(o??[],Date.now())[0]?.rows[0]?.a,i=r.find((c)=>c.dir===(e??a?.dir)&&c.ws===(t??a?.ws))??null,s=await fetch(i?"/agents?dir="+encodeURIComponent(i.dir):"/agents?home=1").then((c)=>c.json(),()=>null),l=[...s?.agents??[],{cmd:"",name:"Shell"}];pT({kind:"new",spots:r.map((c)=>({name:`${$n(c.dir,n)} ${c.name}`})),on:i?r.indexOf(i):-1,kinds:l.map((c)=>({agent:c.cmd,name:c.name})),yolo:!!s?.agents?.find((c)=>c.cmd===s.default)?.bypassDefault,start:async(c,d,u)=>{let p=l[d],f=p.cmd;if(c<0)return void O.open.homeStart({agent:f,yolo:!!p.yolo&&u});let g=r[c],m=await fetch("/shell",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:g.dir,ws:g.ws,run:di(g.dir,g.ws),...f?{agent:f,yolo:!!p.yolo&&u}:{}})}).catch(()=>null),y=m?.ok?await m.json():null;if(y)l0({dir:g.dir,ws:g.ws,key:y.key});else _("No new terminal: "+((await m?.json().catch(()=>null))?.error||"kaizen did not answer"))}})}var mT="https://tailscale.com/download";async function pB(e,t){try{return await(await fetch(e,t?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}:void 0)).json()}catch{return{error:"The board did not answer."}}}var c0=(e)=>pB("/phone/setup",e),_b=(e)=>pB("/whatsapp",e);function fB(e){let t=e.filter((n)=>n.online);return{on:t.length>0,text:t.length?`Phone online: ${t.map((n)=>n.name).join(", ")}`:e.length?"Phone on your tailnet, offline right now":"No phone on your tailnet yet"}}var mB=(e)=>"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e),gB=(e)=>e.connected?"connected":e.qrSvg?"qr":e.saved?"reconnecting":e.running?"connecting":"idle",hB=(e,t)=>!!e&&!e.connected&&!!(e.qrSvg||t||e.running||e.saved);var Im=de()(()=>({mode:null,net:{self:null,computers:[],tailscale:!1},usage:[],allDevices:!1})),_ne=async()=>{try{let[e,t]=await Promise.all([fetch("/phone").then((n)=>n.json()),fetch("/usage").then((n)=>n.ok?n.json():[])]);Im.setState({net:{self:e.self??null,computers:e.computers??[],tailscale:!!e.tailscale},usage:t})}catch{}};function bB(e){if(Im.setState({mode:e}),e==="home")_ne()}var vB=()=>Im.setState((e)=>({allDevices:!e.allDevices}));var zne=(e)=>e>10,Ine=(e,t)=>e>100||e>30&&t<250;function yB(e){let{panel:t}=e,n=null,o=0,r=0,a=(l)=>(l.closest?.(".body")?.scrollTop??0)>0;t.addEventListener("touchstart",(l)=>{n=e.active()&&l.touches.length===1&&!a(l.target)?l.touches[0].clientY:null,o=Date.now(),r=0},{passive:!0}),t.addEventListener("touchmove",(l)=>{if(n===null)return;if(a(l.target))return void(n=null);if(r=l.touches[0].clientY-n,!zne(r))return void(t.style.translate="");l.preventDefault(),t.style.transition="none",t.style.translate=`0 ${r}px`},{passive:!1});let i=()=>{if(n===null)return;if(n=null,t.style.transition="",Ine(r,Date.now()-o))t.style.translate="0 100%",setTimeout(()=>(e.close(),t.style.translate=""),180);else t.style.translate=""};t.addEventListener("touchend",i),t.addEventListener("touchcancel",i);let s=(l)=>e.active()&&!l.composedPath().some((c)=>c.matches?.(e.keep))&&e.close();return addEventListener("click",s),()=>removeEventListener("click",s)}var Zo=h(I(),1);function xB(){let[e,t]=Zo.useState(null),[n,o]=Zo.useState(""),[r,a]=Zo.useState(""),i=Zo.useRef(!0),s=Zo.useRef(null),l=Zo.useRef(!1),c=(p)=>(s.current=p,t(p)),d=Zo.useCallback(async()=>{let p=await c0();if(p.error)o(p.error);else c(p)},[]);return Zo.useEffect(()=>{i.current=!0,d();let p=setInterval(()=>s.current?.state==="connected"&&!l.current&&void d(),1e4);return()=>{i.current=!1,clearInterval(p)}},[d]),{s:e,err:n,busy:r,act:async(p)=>{if(l.current)return;if(o(""),p==="check")return d();l.current=!0,a(p);let f=await c0({do:p});if(l.current=!1,a(""),f.error)return o(f.error);if(p!=="login")return c(f);if(f.url)window.open(f.url,"_blank","noopener");for(let g=0;g<40&&i.current&&s.current?.state==="login";g++){await new Promise((y)=>setTimeout(y,3000));let m=await c0();if(!m.error&&i.current)c(m)}}}}function wB(){let[e,t]=Zo.useState(null),[n,o]=Zo.useState(""),[r,a]=Zo.useState(!1),i=Zo.useRef({s:null,busy:!1});i.current={s:e,busy:r};let s=Zo.useCallback(async()=>{let c=await _b();if(c.error&&!c.installed)o(c.error);else t(c)},[]);return Zo.useEffect(()=>{s();let c=setInterval(async()=>{if(!hB(i.current.s,i.current.busy))return;let d=await _b();if(!d.error)t(d)},2500);return()=>clearInterval(c)},[s]),{s:e,err:n,busy:r,act:async(c)=>{if(i.current.busy)return;if(o(""),c==="check")return s();if(a(!0),c==="connect"){let d=await _b({op:"connect"});if(a(!1),d.error)o(d.error);else t(d)}else await _b({op:"disconnect"}),a(!1),await s()}}}var u0=["Todo","In progress","In review","Done"];function kB(e,t,n,o,r){let a=e.filter((d)=>d.kind==="run"&&d.state===t&&o(d)===n),i=a.filter((d)=>!d.archived&&!Qd(d)),s=a.filter(Qd).sort((d,u)=>(u.moved??0)-(d.moved??0))[0];return{col:i.map(r).some((d)=>d==="wait"||d==="review")?2:i.length?1:s?.status==="done"?3:0,open:i,last:s}}function SB(e,t,n){let o=[],r=new Map;for(let a of t??[]){if(!a.workspaces?.length)continue;r.set(a.dir,new Set(a.workspaces.map((i)=>i.path)));for(let i of a.workspaces)o.push({dir:a.dir,w:i,cs:e.filter((s)=>s.state===a.dir&&n(s)===i.path)})}for(let a of e){let i=r.get(a.state),s=n(a);if(i?.has(s))continue;if(i)s=t.find((c)=>c.dir===a.state).workspaces.find((c)=>c.main)?.path??s;let l=o.find((c)=>c.dir===a.state&&c.w.path===s);if(!l)o.push(l={dir:a.state,w:{path:s,main:!0},cs:[]});l.cs.push(a)}return o}function CB(e,t,n){if(e?.signal==="blocked")return`waiting on you · ${e.blocked?.question??""}`;if(e?.signal==="stale"||e?.signal==="unverified")return e.signal;if(!e)return"no runs";if(t!=="wait"||e.kind!=="run")return n;return e.status==="waiting"&&n.includes(" · ")?`waiting on you · ${n.split(" · ").slice(1).join(" · ")}`:"waiting on you"}function Lne(e,t,n){let{cards:o,projects:r}=$i(),a=e.trim().toLowerCase(),i=u0.map(()=>[]);for(let{dir:s,w:l,cs:c}of SB(o,r,Qo)){let d=$n(s,r),{col:u,open:p,last:f}=kB(c,s,l.path,Qo,mi);if(u!==2&&!n(s))continue;if(a&&u!==2&&!`${Yi(l)} ${d} ${c.map(Vs).join(" ")}`.toLowerCase().includes(a))continue;let g=[...p].sort((y,b)=>bb[mi(y)]-bb[mi(b)])[0]??f,m=c.some((y)=>y.kind==="idea"&&mi(y)==="wait");i[u].push({dir:s,path:l.path,href:gi(s,l.path),state:m?"wait":g?mi(g):"idle",label:Yi(l),main:!!l.main,project:d,line:CB(g,g?mi(g):"",g?n0(g,t,zw(g)):"")})}return{ws:i,wsNames:u0}}function Cu(e=!1){let{state:t,all:n}=oe(),{filter:o,query:r,archive:a,mode:i,flash:s,names:l}=Ir(),c=sb(),d=n&&c.size&&Vd(t).some((m)=>c.has(m.dir)),u=t.cards.filter((m)=>m.archived===a&&(!d||c.has(m.state))),p=i==="ws",f=()=>ht({snap:{cards:u,allCards:t.cards,backlogItems:t.backlog||[],now:t.now,all:n,projects:t.projects,archive:a,filter:o,query:r,only:d?[...c]:null,mode:p?"ws":"runs",...p?Lne(r,t.now||Date.now(),(m)=>(!d||c.has(m))&&(n||!t.dir||m===t.dir)):{ws:[],wsNames:u0},colNames:g_,openKey:Re().openKey,flash:s,answered:[...gb],phone:nt(),names:l}});e?NB.flushSync(f):f();let g=b6(t.cards);document.title=g?`(${g}) kaizen`:"kaizen"}function RB(){Nt.subscribe((e,t)=>{if(e.filter!==t.filter||e.query!==t.query||e.archive!==t.archive||e.mode!==t.mode)Cu()}),st.subscribe((e,t)=>e.openKey!==t.openKey&&Cu()),Ol.subscribe((e,t)=>e.shown!==t.shown&&Cu()),yt.subscribe((e,t)=>{if((e.every!==t.every&&e.state===t.state||e.sources!==t.sources)&&Ir().mode==="ws"&&Ze().view==="board")Cu()}),Cu()}var Bne=["waiting","running","stalled","starting","idea","done","abandoned"],TB=(e,t)=>e.cards.filter((n)=>n.status===t).length;function gT(e){let t=[];for(let o of Bne){let r=TB(e,o);if(!r&&o!=="running")continue;t.push({id:o,icon:fm[o],label:`${r} ${lu[o]}${o==="idea"&&r!==1?"s":""}`,title:`Show only ${lu[o]}`,on:e.filter===o,attn:o==="waiting"})}let n=e.allCards.filter((o)=>o.archived).length;return t.push({id:"__archive",label:e.archive?"Back to board":"Archive "+n,title:`${e.cards.filter((o)=>o.kind==="idea").length} tasks · ${e.cards.filter((o)=>o.kind==="run").length} runs on the board`,on:e.archive}),t}var EB=(e)=>e.filter||e.archive?"on":TB(e,"waiting")>0?"wait":"";var e7=h(Za(),1);var hT=[["grid","Grid","lgrid"],["cols","Side by side","lcols"],["rows","Stacked","lrows"]],bT="kz-terms",MB=1,AB={mode:"grid",order:[],hidden:[],max:null,sizes:{}};function d0(e){try{let t={...AB,...JSON.parse(e||"{}")};return hT.some((n)=>n[0]===t.mode)?t:{...t,mode:"grid"}}catch{return AB}}var DB=(e)=>({...e,order:e.order.slice(-100),hidden:e.hidden.slice(-100)}),Hne=(e)=>e.kind==="run"?String(e.id||e.text).replace(/^\d{4}-\d\d-\d\d-/,"").replace(/-/g," "):String(e.text).split(`
47
+ `)[0].slice(0,80),zb=(e)=>!e.pty.alive?"ended":e.pty.asking?"asking":"running",jne=(e)=>String(e.where||"").split(/[\\/]/).filter(Boolean).pop()||e.where||"",Ib=(e)=>`${Hne(e)} - ${jne(e)}`;function PB(e,t,n,o){let r=(c)=>t.order.includes(c)?t.order.indexOf(c):1e9,a=(c)=>e.get(c).pty.alive?0:1,i=[...e.keys()].filter((c)=>!t.hidden.includes(c)).sort((c,d)=>a(c)-a(d)||r(c)-r(d)),s=[...t.order,...i.filter((c)=>!t.order.includes(c))],l=t.max&&i.includes(t.max)?t.max:null;return{keys:i,hid:[...e.keys()].filter((c)=>t.hidden.includes(c)&&e.get(c).pty.alive),order:s,max:l,one:n?o&&i.includes(o)?o:i[0]??null:l}}var OB=(e,t)=>t.hidden.filter((n)=>e.get(n)?.pty.alive).length;function _B(e,t,n){let o=e.indexOf(t),r=e.indexOf(n);if(o<0||r<0||o===r)return null;let a=[...e];return[a[o],a[r]]=[a[r],a[o]],a}function zB(e,t,n){let o=n?1:Math.max(1,e),r=t==="cols"?o:t==="rows"?1:Math.ceil(Math.sqrt(o)),a=Math.ceil(o/r),i=!n&&r*a>o?r*a-o+1:1;return{cols:r,rows:a,spanFrom:i>1?o-(a-1)*r-1:r,key:`${t}:${r}x${a}`,span:i}}function IB(e,t){return{c:e?.c?.length===t.cols?e.c:Array(t.cols).fill(1),r:e?.r?.length===t.rows?e.r:Array(t.rows).fill(1)}}var p0=(e,t)=>{let n=e.reduce((r,a)=>r+a,0),o=e.slice(0,t+1).reduce((r,a)=>r+a,0);return`calc((100% - ${(e.length-1)*1}px) * ${o/n} + ${t*1+0.5}px)`},LB=(e,t,n)=>t>=n?`calc(100% - ${p0(e,e.length-2)} + 0.5px)`:"0px";function BB(e,t,n,o){let r=e.reduce((d,u)=>d+u,0),a=r*0.1,i=e[t],s=e[t+1],l=Math.max(a-i,Math.min(s-a,n/o*r)),c=[...e];return c[t]=i+l,c[t+1]=s-l,c}var Une=()=>{try{return d0(localStorage.getItem(bT))}catch{return d0(null)}},ho=de()(()=>({showing:!1,seen:!1,all:new Map,lay:typeof localStorage>"u"?d0(null):Une(),pick:null})),f0=ho.setState,op={reload:()=>{},resume:async()=>!1},HB=(e)=>Object.assign(op,e);function Nu(e){let t=DB(e(ho.getState().lay));try{localStorage.setItem(bT,JSON.stringify(t))}catch{}ho.setState({lay:t})}var Jo={mode:(e)=>Nu((t)=>({...t,mode:e,max:null})),toggleMax:(e)=>Nu((t)=>({...t,max:t.max===e?null:e})),maxOn:(e)=>Nu((t)=>t.max&&t.max!==e?{...t,max:e}:t),hide:(e)=>Nu((t)=>({...t,hidden:[...t.hidden,e],max:t.max===e?null:t.max})),show:(e)=>Nu((t)=>({...t,hidden:t.hidden.filter((n)=>n!==e)})),swap:(e,t,n)=>{let o=_B(e,t,n);if(o)Nu((r)=>({...r,order:o}))},see:(e)=>{let t=ho.getState().lay.order;if(e.slice(-100).some((n)=>!t.includes(n)))Nu((n)=>({...n,order:e}))},sizes:(e,t)=>Nu((n)=>({...n,sizes:{...n.sizes,[e]:t}}))},m0=(e)=>ho.setState({pick:e});var jB=h(I(),1);function UB(e,t,n){jB.useEffect(()=>{let o=(r)=>{let{lay:a,showing:i}=ho.getState();if(!i)return;if(r.ctrlKey&&r.shiftKey&&!r.altKey&&!r.metaKey&&r.code==="KeyM"&&!t){let c=r.target.closest?.("[data-tile]")?.dataset.tile||a.max;if(!c)return;r.preventDefault(),r.stopPropagation(),Jo.toggleMax(c),n(c);return}let s=/^Digit([1-9])$/.exec(r.code)?.[1];if(!s||!r.altKey||r.ctrlKey||r.shiftKey||r.metaKey)return;let l=e[+s-1];if(!l)return;if(r.preventDefault(),r.stopPropagation(),t)m0(l);else Jo.maxOn(l);n(l)};return addEventListener("keydown",o,!0),()=>removeEventListener("keydown",o,!0)},[e,t,n])}var g0=h(I(),1);function h0(){let e=ho((a)=>a.all),t=ho((a)=>a.lay),n=ho((a)=>a.pick),o=pu(),r=g0.useMemo(()=>PB(e,t,o,n),[e,t,o,n]);return g0.useEffect(()=>Jo.see(r.order),[r.order]),{all:e,lay:t,phone:o,a:r}}function b0(e,t){let n=new Map;for(let o of e){if(o.archived||!o.pty)continue;for(let r of o.pty.all?.length?o.pty.all:[o.pty.key]){let a=r===o.pty.key?o.pty:{key:r,alive:!0,asking:!1};n.set(r,{...o,pty:a})}}for(let o of t)n.set(o.key,{kind:"shell",text:o.title,where:o.dir.replace(/[\\/]\.kaizen$/,""),state:o.dir,pty:{key:o.key,alive:!0,asking:!1}});return n}var GB=h(I(),1);function FB(){let e=ho((r)=>r.lay),t=yt((r)=>r.every?.cards??r.state.cards),n=yt((r)=>r.shells),o=yt((r)=>r.loaded);return GB.useMemo(()=>o?OB(b0(t,n),e):0,[o,t,n,e])}var VB=()=>b0(oe().every?.cards??oe().state.cards,oe().shells),Gne=()=>f0({all:VB()});function KB(){f0({showing:!1})}function qB(){if(!ho.getState().showing)ab();f0({showing:!0,seen:!0,all:VB()})}var v0=()=>{if(ho.getState().seen)Gne()};function $B(){ui((e)=>e.shells,v0),ui((e)=>e.every,v0),HB({reload:()=>void fo(!0),resume:async(e)=>{let t=await km(e);return Pe({wantTerm:null}),t}})}var YB=8,WB=24;function XB(){try{let e=Number(localStorage.getItem("kz-term-font"));if(Number.isInteger(e)&&e>=8&&e<=24)return e}catch{}return 12}function QB(e){try{localStorage.setItem("kz-term-font",String(e))}catch{}globalThis.kzTerm?.font(e)}var Fne=X_(),ZB=null,JB=null,t7=()=>rz(async(e,t)=>{let n=Re().openKey&&t.cards.find((s)=>Ne(s)===Re().openKey);for(let s of e.cards){if(s.kind!=="run"||s.archived)continue;if(Fne(Ne(s),s.notice,s.status==="done",e.now))FN(s.notice)}{let s=M6(e.cards);if(document.hidden)for(let l of D6(ZB,s))FN(`${l.kind==="run"?l.id:String(l.text).split(`
48
+ `)[0].slice(0,80)} needs you`,"ask:"+l.pty.key);ZB=new Set(s.keys())}let{moved:o,flash:r,next:a}=A6(JB,e.cards);JB=a;let i=Object.fromEntries(o.map((s,l)=>[s,"kzm"+l]));if(ht({flash:[...r]}),o.length)e7.flushSync(()=>ht({names:i})),await mm(()=>Cu(!0)),ht({names:{},flash:[]});else Cu(),ht({flash:[]});if(v0(),tL(),Re().wantTerm&&!Re().openKey&&!Ir().form){let s=oe().state.cards.find((l)=>Ne(l)===Re().wantTerm&&l.pty);if(s){Pe({wantTerm:null}),Xi(s);return}}if(Re().openKey&&!oe().state.cards.some((s)=>Ne(s)===Re().openKey)){if(fb())return;if(n&&n.kind==="idea")Vne(n)}});async function Vne(e){let t=Ne(e),n=(r)=>r.toLowerCase().replace(/\s+/g," ").trim(),o=n(e.text);for(let r of oe().state.cards.filter((a)=>a.kind==="run"&&a.state===e.state).sort((a,i)=>(i.moved??0)-(a.moved??0)).slice(0,5)){let a=await fetch(`/run/${encodeURIComponent(r.id)}?dir=${encodeURIComponent(r.state)}`).then((i)=>i.json()).catch(()=>null);if(Re().openKey!==t)return;if(n(a?.request||"").includes(o)){Xi(r);return}}if(Re().openKey===t)Qi()}function n7(e){if(!e.tailscale)return{text:"Tailscale off",on:!1,tip:"Tailscale is not running on this computer"};if(e.online)return{text:"Phone connected",on:!0,tip:"A phone is online on your tailnet"};return{text:"Phone offline",on:!1,tip:e.phones?"Your phone is not online on the tailnet":"No phone on your tailnet"}}var o7=(e)=>`${e} live terminal${e===1?"":"s"}: show them all`;var Ru=de()(()=>({usage:null,phone:null,refreshing:!1})),Kne=700;async function y0(e=!1){let t=Date.now();if(e)Ru.setState({refreshing:!0});try{let n=await fetch("/usage"+(e?"?refresh=1":""));if(n.ok)Ru.setState({usage:await n.json()})}catch{}finally{if(e)await new Promise((n)=>setTimeout(n,Math.max(0,Kne-(Date.now()-t)))),Ru.setState({refreshing:!1})}}async function r7(){try{Ru.setState({phone:n7(await(await fetch("/phone")).json())})}catch{}}function a7(){y0(),r7();let e=setInterval(()=>void y0(),300000),t=setInterval(()=>void r7(),60000);return()=>(clearInterval(e),clearInterval(t))}var fd=h(I(),1);var ts=h(I(),1);var bi=h(I(),1),vT=h(w(),1),Wne=Object.defineProperty,hi=(e,t)=>Wne(e,"name",{value:t,configurable:!0});function Xne(e,t){let n=bi.createContext(t);n.displayName=e+"Context";let o=hi((a)=>{let{children:i,...s}=a,l=bi.useMemo(()=>s,Object.values(s));return vT.jsx(n.Provider,{value:l,children:i})},"Provider");o.displayName=e+"Provider";function r(a,i={}){let{optional:s=!1}=i,l=bi.useContext(n);if(l)return l;if(t!==void 0)return t;if(s)return;throw Error(`\`${a}\` must be used within \`${e}\``)}return hi(r,"useContext"),[o,r]}hi(Xne,"createContext");function Wt(e,t=[]){let n=[];function o(a,i){let s=bi.createContext(i);s.displayName=a+"Context";let l=n.length;n=[...n,i];let c=hi((u)=>{let{scope:p,children:f,...g}=u,m=p?.[e]?.[l]||s,y=bi.useMemo(()=>g,Object.values(g));return vT.jsx(m.Provider,{value:y,children:f})},"Provider");c.displayName=a+"Provider";function d(u,p,f={}){let{optional:g=!1}=f,m=p?.[e]?.[l]||s,y=bi.useContext(m);if(y)return y;if(i!==void 0)return i;if(g)return;throw Error(`\`${u}\` must be used within \`${a}\``)}return hi(d,"useContext"),[c,d]}hi(o,"createContext");let r=hi(()=>{let a=n.map((i)=>bi.createContext(i));return hi(function(s){let l=s?.[e]||a;return bi.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])},"useScope")},"createScope");return r.scopeName=e,[o,c7(r,...t)]}hi(Wt,"createContextScope");function c7(...e){let t=e[0];if(e.length===1)return t;let n=hi(()=>{let o=e.map((r)=>({useScope:r(),scopeName:r.scopeName}));return hi(function(a){let i=o.reduce((s,{useScope:l,scopeName:c})=>{let u=l(a)[`__scope${c}`];return{...s,...u}},{});return bi.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}hi(c7,"composeContextScopes");var u7=h(I(),1),Qne=Object.defineProperty,xT=(e,t)=>Qne(e,"name",{value:t,configurable:!0});function yT(e,t){if(typeof e==="function")return e(t);else if(e!==null&&e!==void 0)e.current=t}xT(yT,"setRef");function Tu(...e){return(t)=>{let n=!1,o=e.map((r)=>{let a=yT(r,t);if(!n&&typeof a=="function")n=!0;return a});if(n)return()=>{for(let r=0;r<o.length;r++){let a=o[r];if(typeof a=="function")a();else yT(e[r],null)}}}}xT(Tu,"composeRefs");function ke(...e){return u7.useCallback(Tu(...e),e)}xT(ke,"useComposedRefs");var tn=h(I(),1);var Zne=Object.defineProperty,Lm=(e,t)=>Zne(e,"name",{value:t,configurable:!0}),d7=!!(typeof window<"u"&&window.document&&window.document.createElement);function J(e,t,{checkForDefaultPrevented:n=!0}={}){return Lm(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},"handleEvent")}Lm(J,"composeEventHandlers");function Jne(e){if(!d7)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Lm(Jne,"getOwnerWindow");function wT(e){if(!d7)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Lm(wT,"getOwnerDocument");function p7(e,t=!1){let{activeElement:n}=wT(e);if(!n?.nodeName)return null;if(f7(n)&&n.contentDocument)return p7(n.contentDocument.body,t);if(t){let o=n.getAttribute("aria-activedescendant");if(o){let r=wT(n).getElementById(o);if(r)return r}}return n}Lm(p7,"getActiveElement");function f7(e){return e.tagName==="IFRAME"}Lm(f7,"isFrame");var kT=h(I(),1);var m7=h(I(),1),vt=globalThis?.document?m7.useLayoutEffect:()=>{};var eoe=Object.defineProperty,toe=(e,t)=>eoe(e,"name",{value:t,configurable:!0}),noe=kT[" useId ".trim().toString()]||(()=>{return}),ooe=0;function Jt(e){let[t,n]=kT.useState(noe());return vt(()=>{if(!e)n((o)=>o??String(ooe++))},[e]),e||(t?`radix-${t}`:"")}toe(Jt,"useId");var vi=h(I(),1);var w0=!1;var Ji=h(I(),1);var Bm=h(I(),1),roe=Object.defineProperty,aoe=(e,t)=>roe(e,"name",{value:t,configurable:!0}),g7=Bm[" useEffectEvent ".trim().toString()],h7=Bm[" useInsertionEffect ".trim().toString()];function ST(e){if(typeof g7==="function")return g7(e);let t=Bm.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});if(typeof h7==="function")h7(()=>{t.current=e});else vt(()=>{t.current=e});return Bm.useMemo(()=>(...n)=>t.current?.(...n),[])}aoe(ST,"useEffectEvent");var ioe=Object.defineProperty,Lb=(e,t)=>ioe(e,"name",{value:t,configurable:!0}),soe=vi[" useInsertionEffect ".trim().toString()]||vt;function Yn({prop:e,defaultProp:t,onChange:n=Lb(()=>{},"onChange"),caller:o}){let[r,a,i]=v7({defaultProp:t,onChange:n}),s=e!==void 0,l=s?e:r;if(w0){let d=vi.useRef(e!==void 0);vi.useEffect(()=>{let u=d.current;if(u!==s)console.warn(`${o} is changing from ${u?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);d.current=s},[s,o])}let c=vi.useCallback((d)=>{if(s){let u=y7(d)?d(e):d;if(u!==e)i.current?.(u)}else a(d)},[s,e,a,i]);return[l,c]}Lb(Yn,"useControllableState");function v7({defaultProp:e,onChange:t}){let[n,o]=vi.useState(e),r=vi.useRef(n),a=vi.useRef(t);return soe(()=>{a.current=t},[t]),vi.useEffect(()=>{if(r.current!==n)a.current?.(n),r.current=n},[n,r]),[n,o,a]}Lb(v7,"useUncontrolledState");function y7(e){return typeof e==="function"}Lb(y7,"isFunction");var b7=Symbol("RADIX:SYNC_STATE");function loe(e,t,n,o){let{prop:r,defaultProp:a,onChange:i,caller:s}=t,l=r!==void 0,c=ST(i);if(w0){let y=Ji.useRef(r!==void 0);Ji.useEffect(()=>{let b=y.current;if(b!==l)console.warn(`${s} is changing from ${b?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);y.current=l},[l,s])}let d=[{...n,state:a}];if(o)d.push(o);let[u,p]=Ji.useReducer((y,b)=>{if(b.type===b7)return{...y,state:b.state};let x=e(y,b);if(l&&!Object.is(x.state,y.state))c(x.state);return x},...d),f=u.state,g=Ji.useRef(f);Ji.useEffect(()=>{if(g.current!==f){if(g.current=f,!l)c(f)}},[f,g,l]);let m=Ji.useMemo(()=>{if(r!==void 0)return{...u,state:r};return u},[u,r]);return Ji.useEffect(()=>{if(l&&!Object.is(r,u.state))p({type:b7,state:r})},[r,u.state,l]),[m,p]}Lb(loe,"useControllableStateReducer");var en=h(I(),1);var E7=h(I(),1),A7=h(Za(),1);var Cr=h(I(),1);var coe=Object.defineProperty,Ha=(e,t)=>coe(e,"name",{value:t,configurable:!0});function er(e){let t=Cr.forwardRef((n,o)=>{let{children:r,...a}=n,i=null,s=!1,l=[];if(r=N7(r),Cr.Children.forEach(r,(p)=>{if(S7(p)){s=!0;let f=p,g="child"in f.props?f.props.child:f.props.children;while(NT(g)&&typeof k0==="function")g=k0(g._payload);i=doe(f,g),l.push(i?.props?.children)}else l.push(p)}),i)i=Cr.cloneElement(i,void 0,l);else if(!s&&Cr.Children.count(r)===1&&Cr.isValidElement(r))i=r;let c=i?k7(i):void 0,d=ke(o,c);if(!i){if(r||r===0)throw Error(s?moe(e):foe(e));return r}let u=w7(a,i.props??{});if(i.type!==Cr.Fragment)u.ref=o?d:c;return Cr.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}Ha(er,"createSlot");var uoe=er("Slot"),x7=Symbol.for("radix.slottable");function CT(e){let t=Ha((n)=>("child"in n)?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=x7,t}Ha(CT,"createSlottable");var doe=Ha((e,t)=>{if("child"in e.props){if(!Cr.isValidElement(t))return null;return Cr.cloneElement(t,void 0,e.props.children(t.props.children))}return Cr.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function w7(e,t){let n={...t};for(let o in t){let r=e[o],a=t[o];if(/^on[A-Z]/.test(o)){if(r&&a)n[o]=(...s)=>{let l=a(...s);return r(...s),l};else if(r)n[o]=r}else if(o==="style")n[o]={...r,...a};else if(o==="className")n[o]=[r,a].filter(Boolean).join(" ");else if(o==="aria-describedby")n[o]=R7(a,r)}return{...e,...n}}Ha(w7,"mergeProps");function k7(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}Ha(k7,"getElementRef");function S7(e){return Cr.isValidElement(e)&&typeof e.type==="function"&&"__radixId"in e.type&&e.type.__radixId===x7}Ha(S7,"isSlottable");var poe=Symbol.for("react.lazy");function NT(e){return e!=null&&typeof e==="object"&&"$$typeof"in e&&e.$$typeof===poe&&"_payload"in e&&C7(e._payload)}Ha(NT,"isLazyComponent");function C7(e){return typeof e==="object"&&e!==null&&"then"in e}Ha(C7,"isPromiseLike");function N7(e){let t=e;while(NT(t)&&typeof k0==="function")t=k0(t._payload);return t}Ha(N7,"useUnwrappedLazy");function R7(...e){let t=new Set;for(let n of e){if(typeof n!=="string")continue;for(let o of String(n).trim().split(/\s+/))if(o)t.add(o)}return t.size>0?Array.from(t).join(" "):void 0}Ha(R7,"concatAriaDescribedby");var foe=Ha((e)=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),moe=Ha((e)=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),k0=Cr[" use ".trim().toString()];var M7=h(w(),1),goe=Object.defineProperty,hoe=(e,t)=>goe(e,"name",{value:t,configurable:!0}),boe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fe=boe.reduce((e,t)=>{let n=er(`Primitive.${t}`),o=E7.forwardRef((r,a)=>{let{asChild:i,...s}=r,l=i?n:t;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return M7.jsx(l,{...s,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Bb(e,t){if(e)A7.flushSync(()=>e.dispatchEvent(t))}hoe(Bb,"dispatchDiscreteCustomEvent");var Hb=h(I(),1),voe=Object.defineProperty,yoe=(e,t)=>voe(e,"name",{value:t,configurable:!0}),D7=Hb[" useInsertionEffect ".trim().toString()];function Ao(e){let t=Hb.useRef(e);if(typeof D7==="function")D7(()=>{t.current=e});else vt(()=>{t.current=e});return Hb.useMemo(()=>(...n)=>t.current?.(...n),[])}yoe(Ao,"useCallbackRef");var O7=h(w(),1),xoe=Object.defineProperty,tr=(e,t)=>xoe(e,"name",{value:t,configurable:!0}),RT="dismissableLayer.update",woe="dismissableLayer.pointerDownOutside",koe="dismissableLayer.focusOutside",P7,_7=en.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ks=en.forwardRef(tr(function(t,n){let{disableOutsidePointerEvents:o=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...d}=t,u=en.useContext(_7),[p,f]=en.useState(null),g=p?.ownerDocument??globalThis?.document,[,m]=en.useState({}),y=ke(n,f),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=x?b.indexOf(x):-1,k=p?b.indexOf(p):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,N=k>=v,R=en.useRef(!1),A=z7((B)=>{if(i?.(B),l?.(B),!B.defaultPrevented)c?.()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:R,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:en.useCallback((B)=>{if(!(B instanceof Node))return!1;let Z=[...u.branches].some((ee)=>ee.contains(B));return N&&!Z},[u.branches,N])}),D=I7((B)=>{if(r&&R.current)return;let Z=B.target;if([...u.branches].some((xe)=>xe.contains(Z)))return;if(s?.(B),l?.(B),!B.defaultPrevented)c?.()},g),E=p?k===b.length-1:!1,z=Ao((B)=>{if(B.key!=="Escape")return;if(a?.(B),!B.defaultPrevented&&c)B.preventDefault(),c()});return en.useEffect(()=>{if(!E)return;return g.addEventListener("keydown",z,{capture:!0}),()=>g.removeEventListener("keydown",z,{capture:!0})},[g,E,z]),en.useEffect(()=>{if(!p)return;if(o){if(u.layersWithOutsidePointerEventsDisabled.size===0)P7=g.body.style.pointerEvents,g.body.style.pointerEvents="none";u.layersWithOutsidePointerEventsDisabled.add(p)}return u.layers.add(p),TT(),()=>{if(o){if(u.layersWithOutsidePointerEventsDisabled.delete(p),u.layersWithOutsidePointerEventsDisabled.size===0)g.body.style.pointerEvents=P7}}},[p,g,o,u]),en.useEffect(()=>()=>{if(!p)return;u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),TT()},[p,u]),en.useEffect(()=>{let B=tr(()=>m({}),"handleUpdate");return document.addEventListener(RT,B),()=>document.removeEventListener(RT,B)},[]),O7.jsx(fe.div,{...d,ref:y,style:{pointerEvents:S?N?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,D.onFocusCapture),onBlurCapture:J(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,A.onPointerDownCapture)})},"DismissableLayer"));function ET(){let e=en.useContext(_7),[t,n]=en.useState(null);return en.useEffect(()=>{if(!t)return;return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}tr(ET,"useDismissableLayerSurface");var Soe=tr(()=>!0,"IS_TRUE");function z7(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:o=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=Soe}=t,s=Ao(e),l=en.useRef(!1),c=en.useRef(!1),d=en.useRef(new Map),u=en.useRef(()=>{});return en.useEffect(()=>{function p(){c.current=!1,r.current=!1,d.current.clear()}tr(p,"resetOutsideInteraction");function f(){return Array.from(d.current.values()).some(Boolean)}tr(f,"isOutsideInteractionIntercepted");function g(v){if(!c.current)return;let k=v.target;if(!(k instanceof Node&&[...a].some((N)=>N.contains(k))))d.current.set(v.type,!0);if(v.type==="click")window.setTimeout(()=>{if(c.current)u.current()},0)}tr(g,"handleInteractionCapture");function m(v){if(c.current)d.current.set(v.type,!1)}tr(m,"handleInteractionBubble");let y=tr((v)=>{if(v.target&&!l.current){let S=function(){n.removeEventListener("click",u.current);let R=f();if(p(),!R)AT(woe,s,N,{discrete:!0})};var k=S;if(tr(S,"handleAndDispatchPointerDownOutsideEvent"),!i(v.target)){n.removeEventListener("click",u.current),p(),l.current=!1;return}let N={originalEvent:v};if(c.current=!0,r.current=o&&v.button===0,d.current.clear(),!o||v.button!==0)S();else n.removeEventListener("click",u.current),u.current=S,n.addEventListener("click",u.current,{once:!0})}else n.removeEventListener("click",u.current),p();l.current=!1},"handlePointerDown"),b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let v of b)n.addEventListener(v,g,!0),n.addEventListener(v,m);let x=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",y),n.removeEventListener("click",u.current);for(let v of b)n.removeEventListener(v,g,!0),n.removeEventListener(v,m)}},[n,s,o,r,a,i]),{onPointerDownCapture:tr(()=>l.current=!0,"onPointerDownCapture")}}tr(z7,"usePointerDownOutside");function I7(e,t=globalThis?.document){let n=Ao(e),o=en.useRef(!1);return en.useEffect(()=>{let r=tr((a)=>{if(a.target&&!o.current)AT(koe,n,{originalEvent:a},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:tr(()=>o.current=!0,"onFocusCapture"),onBlurCapture:tr(()=>o.current=!1,"onBlurCapture")}}tr(I7,"useFocusOutside");function TT(){let e=new CustomEvent(RT);document.dispatchEvent(e)}tr(TT,"dispatchUpdate");function AT(e,t,n,{discrete:o}){let r=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});if(t)r.addEventListener(e,t,{once:!0});if(o)Bb(r,a);else r.dispatchEvent(a)}tr(AT,"handleAndDispatchCustomEvent");var On=h(I(),1);var _T=h(w(),1),Coe=Object.defineProperty,bo=(e,t)=>Coe(e,"name",{value:t,configurable:!0}),MT="focusScope.autoFocusOnMount",DT="focusScope.autoFocusOnUnmount",L7={bubbles:!1,cancelable:!0},Eu=On.forwardRef(bo(function(t,n){let{loop:o=!1,trapped:r=!1,branches:a,onMountAutoFocus:i,onUnmountAutoFocus:s,...l}=t,[c,d]=On.useState(null),u=Ao(i),p=Ao(s),f=On.useRef(null),g=ke(n,d),m=On.useRef(a);On.useEffect(()=>{m.current=a});let y=On.useCallback((v)=>{if(!v)return!1;if(c?.contains(v))return!0;return Boolean(m.current?.some((k)=>k.contains(v)))},[c]),b=On.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;On.useEffect(()=>{if(r){let N=function(E){if(b.paused||!c)return;let z=E.target;if(y(z))f.current=z;else Gl(f.current,{select:!0})},R=function(E){if(b.paused||!c)return;let z=E.relatedTarget;if(z===null)return;if(!y(z))Gl(f.current,{select:!0})},A=function(E){if(document.activeElement!==document.body)return;for(let B of E)if(B.removedNodes.length>0)Gl(c)};var v=N,k=R,S=A;bo(N,"handleFocusIn"),bo(R,"handleFocusOut"),bo(A,"handleMutations"),document.addEventListener("focusin",N),document.addEventListener("focusout",R);let D=new MutationObserver(A);if(c)D.observe(c,{childList:!0,subtree:!0});return()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",R),D.disconnect()}}},[r,c,b.paused,y]),On.useEffect(()=>{if(c){B7.add(b);let v=document.activeElement;if(!c.contains(v)){let S=new CustomEvent(MT,L7);if(c.addEventListener(MT,u),c.dispatchEvent(S),!S.defaultPrevented){if(j7(K7(zT(c)),{select:!0}),document.activeElement===v)Gl(c)}}return()=>{c.removeEventListener(MT,u);let S=c.ownerDocument,N=CustomEvent;setTimeout(()=>{let R=new N(DT,L7);if(c.addEventListener(DT,p),c.dispatchEvent(R),!R.defaultPrevented)Gl(v??S.body,{select:!0});c.removeEventListener(DT,p),B7.remove(b)},0)}}},[c,u,p,b]);let x=On.useCallback((v)=>{if(!o&&!r)return;if(b.paused)return;let k=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,S=document.activeElement;if(k&&S){let N=v.currentTarget,[R,A]=U7(N);if(!(R&&A)){if(S===N)v.preventDefault()}else if(!v.shiftKey&&S===A){if(v.preventDefault(),o)Gl(R,{select:!0})}else if(v.shiftKey&&S===R){if(v.preventDefault(),o)Gl(A,{select:!0})}}},[o,r,b.paused]);return _T.jsx(fe.div,{tabIndex:-1,...l,ref:g,onKeyDown:x})},"FocusScope")),H7=On.createContext(null);function rp({registry:e,children:t}){if(!e)return t;return _T.jsx(H7.Provider,{value:e,children:t})}bo(rp,"FocusScopeBranchProvider");function ap(){let[e,t]=On.useState([]),n=On.useMemo(()=>({add:bo((o)=>t((r)=>r.includes(o)?r:[...r,o]),"add"),remove:bo((o)=>t((r)=>r.filter((a)=>a!==o)),"remove")}),[]);return{nodes:e,registry:n}}bo(ap,"useFocusScopeBranchRegistry");function ip(e){let t=On.useContext(H7);On.useEffect(()=>{if(!e||!t)return;return t.add(e),()=>t.remove(e)},[e,t])}bo(ip,"useFocusScopeBranch");function j7(e,{select:t=!1}={}){let n=document.activeElement;for(let o of e)if(Gl(o,{select:t}),document.activeElement!==n)return}bo(j7,"focusFirst");function U7(e){let t=zT(e),n=PT(t,e),o=PT(t.reverse(),e);return[n,o]}bo(U7,"getTabbableEdges");function zT(e){let t=[],o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:bo((r)=>{let a=r.tagName==="INPUT"&&r.type==="hidden";if(r.disabled||r.hidden||a)return NodeFilter.FILTER_SKIP;return r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});while(o.nextNode())t.push(o.currentNode);return t}bo(zT,"getTabbableCandidates");function PT(e,t){let n=typeof t.checkVisibility==="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(let o of e)if(!(n?!o.checkVisibility({checkVisibilityCSS:!0}):G7(o,{upTo:t})))return o}bo(PT,"findVisible");function G7(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;while(e){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}bo(G7,"isHidden");function F7(e){return e.tagName==="INPUT"&&typeof e.select==="function"}bo(F7,"isSelectableInput");function Gl(e,{select:t=!1}={}){if(e&&e.focus){let o=(e.ownerDocument??document).activeElement;if(e.focus({preventScroll:!0}),e!==o&&F7(e)&&t)e.select()}}bo(Gl,"focus");var B7=V7();function V7(){let e=[];return{add(t){let n=e[0];if(t!==n)n?.pause();e=OT(e,t),e.unshift(t)},remove(t){e=OT(e,t),e[0]?.resume()}}}bo(V7,"createFocusScopesStack");function OT(e,t){let n=[...e],o=n.indexOf(t);if(o!==-1)n.splice(o,1);return n}bo(OT,"arrayRemove");function K7(e){return e.filter((t)=>t.tagName!=="A")}bo(K7,"removeLinks");var S0=h(I(),1),q7=h(Za(),1);var $7=h(w(),1),Noe=Object.defineProperty,Roe=(e,t)=>Noe(e,"name",{value:t,configurable:!0}),qs=S0.forwardRef(Roe(function(t,n){let{container:o,...r}=t,[a,i]=S0.useState(!1);vt(()=>i(!0),[]);let s=o||a&&globalThis?.document?.body;return s?q7.createPortal($7.jsx(fe.div,{...r,ref:n}),s):null},"Portal"));var Nr=h(I(),1);var Y7=h(I(),1),Toe=Object.defineProperty,Fl=(e,t)=>Toe(e,"name",{value:t,configurable:!0});function W7(e,t){return Y7.useReducer((n,o)=>t[n][o]??n,e)}Fl(W7,"useStateMachine");var Rr=Fl((e)=>{let{present:t,children:n}=e,o=X7(t),r=typeof n==="function"?n({present:o.isPresent}):Nr.Children.only(n),a=Q7(o.ref,Z7(r));return typeof n==="function"||o.isPresent?Nr.cloneElement(r,{ref:a}):null},"Presence");function X7(e){let[t,n]=Nr.useState(),o=Nr.useRef(null),r=Nr.useRef(e),a=Nr.useRef("none"),i=Nr.useRef(void 0),s=e?"mounted":"unmounted",[l,c]=W7(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Nr.useEffect(()=>{if(l==="mounted")a.current=i.current??Hm(o.current),i.current=void 0;else a.current="none"},[l]),vt(()=>{let d=o.current,u=r.current;if(u!==e){let f=a.current,g=Hm(d);if(e)i.current=g,c("MOUNT");else if(g==="none"||d?.display==="none")c("UNMOUNT");else if(u&&f!==g)c("ANIMATION_OUT");else c("UNMOUNT");r.current=e}},[e,c]),vt(()=>{if(t){let d,u=t.ownerDocument.defaultView??window,p=Fl((g)=>{let y=Hm(o.current).includes(CSS.escape(g.animationName));if(g.target===t&&y){if(c("ANIMATION_END"),!r.current){let b=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{if(t.style.animationFillMode==="forwards")t.style.animationFillMode=b})}}},"handleAnimationEnd"),f=Fl((g)=>{if(g.target===t)a.current=Hm(o.current)},"handleAnimationStart");return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:Nr.useCallback((d)=>{if(d){let u=getComputedStyle(d);o.current=u,i.current=Hm(u)}else o.current=null;n(d)},[])}}Fl(X7,"usePresence");function IT(e,t){if(typeof e==="function")return e(t);else if(e!==null&&e!==void 0)e.current=t}Fl(IT,"setRef");function Q7(...e){let t=Nr.useRef(e);return t.current=e,Nr.useCallback((n)=>{let o=t.current,r=!1,a=o.map((i)=>{let s=IT(i,n);if(!r&&typeof s==="function")r=!0;return s});if(r)return()=>{for(let i=0;i<a.length;i++){let s=a[i];if(typeof s==="function")s();else IT(o[i],null)}}},[])}Fl(Q7,"useStableComposedRefs");function Hm(e){return e?.animationName||"none"}Fl(Hm,"getAnimationName");function Z7(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}Fl(Z7,"getElementRef");var J7=h(I(),1),Eoe=Object.defineProperty,BT=(e,t)=>Eoe(e,"name",{value:t,configurable:!0}),C0=0,jm=null;function Aoe(e){return $s(),e.children}BT(Aoe,"FocusGuards");function $s(){J7.useEffect(()=>{if(!jm)jm={start:LT(),end:LT()};let{start:e,end:t}=jm;if(document.body.firstElementChild!==e)document.body.insertAdjacentElement("afterbegin",e);if(document.body.lastElementChild!==t)document.body.insertAdjacentElement("beforeend",t);return C0++,()=>{if(C0===1)jm?.start.remove(),jm?.end.remove(),jm=null;C0=Math.max(0,C0-1)}},[])}BT($s,"useFocusGuards");function LT(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}BT(LT,"createFocusGuard");var fa=function(){return fa=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(var a in n)if(Object.prototype.hasOwnProperty.call(n,a))t[a]=n[a]}return t},fa.apply(this,arguments)};function N0(e,t){var n={};for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0)n[o]=e[o];if(e!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)if(t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r]))n[o[r]]=e[o[r]]}return n}function eH(e,t,n){if(n||arguments.length===2){for(var o=0,r=t.length,a;o<r;o++)if(a||!(o in t)){if(!a)a=Array.prototype.slice.call(t,0,o);a[o]=t[o]}}return e.concat(a||Array.prototype.slice.call(t))}var M0=h(I());var Lr=h(I());var sp="right-scroll-bar-position",lp="width-before-scroll-bar",HT="with-scroll-bars-hidden",jT="--removed-body-scroll-bar-size";var T0=h(I());function R0(e,t){if(typeof e==="function")e(t);else if(e)e.current=t;return e}var tH=h(I());function nH(e,t){var n=tH.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){var r=n.value;if(r!==o)n.value=o,n.callback(o,r)}}}})[0];return n.callback=t,n.facade}var Moe=typeof window<"u"?T0.useLayoutEffect:T0.useEffect,oH=new WeakMap;function UT(e,t){var n=nH(t||null,function(o){return e.forEach(function(r){return R0(r,o)})});return Moe(function(){var o=oH.get(n);if(o){var r=new Set(o),a=new Set(e),i=n.current;r.forEach(function(s){if(!a.has(s))R0(s,null)}),a.forEach(function(s){if(!r.has(s))R0(s,i)})}oH.set(n,e)},[e]),n}function Loe(e){return e}function Boe(e,t){if(t===void 0)t=Loe;var n=[],o=!1,r={read:function(){if(o)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");if(n.length)return n[n.length-1];return e},useMedium:function(a){var i=t(a,o);return n.push(i),function(){n=n.filter(function(s){return s!==i})}},assignSyncMedium:function(a){o=!0;while(n.length){var i=n;n=[],i.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){o=!0;var i=[];if(n.length){var s=n;n=[],s.forEach(a),i=n}var l=function(){var d=i;i=[],d.forEach(a)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){i.push(d),c()},filter:function(d){return i=i.filter(d),n}}}};return r}function GT(e){if(e===void 0)e={};var t=Boe(null);return t.options=fa({async:!0,ssr:!1},e),t}var aH=h(I()),iH=function(e){var t=e.sideCar,n=N0(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw Error("Sidecar medium not found");return aH.createElement(o,fa({},n))};iH.isSideCarExport=!0;function FT(e,t){return e.useMedium(t),iH}var E0=GT();var VT=function(){return},jb=Lr.forwardRef(function(e,t){var n=Lr.useRef(null),o=Lr.useState({onScrollCapture:VT,onWheelCapture:VT,onTouchMoveCapture:VT}),r=o[0],a=o[1],{forwardProps:i,children:s,className:l,removeScrollBar:c,enabled:d,shards:u,sideCar:p,noRelative:f,noIsolation:g,inert:m,allowPinchZoom:y,as:b}=e,x=b===void 0?"div":b,v=e.gapMode,k=N0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,N=UT([n,t]),R=fa(fa({},k),r);return Lr.createElement(Lr.Fragment,null,d&&Lr.createElement(S,{sideCar:E0,removeScrollBar:c,shards:u,noRelative:f,noIsolation:g,inert:m,setCallbacks:a,allowPinchZoom:!!y,lockRef:n,gapMode:v}),i?Lr.cloneElement(Lr.Children.only(s),fa(fa({},R),{ref:N})):Lr.createElement(x,fa({},R,{className:l,ref:N}),s))});jb.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jb.classNames={fullWidth:lp,zeroRight:sp};var yn=h(I());var Gm=h(I());var cH=h(I());var sH;var lH=function(){if(sH)return sH;if(typeof __webpack_nonce__<"u")return __webpack_nonce__;return};function Hoe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lH();if(t)e.setAttribute("nonce",t);return e}function joe(e,t){if(e.styleSheet)e.styleSheet.cssText=t;else e.appendChild(document.createTextNode(t))}function Uoe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var KT=function(){var e=0,t=null;return{add:function(n){if(e==0){if(t=Hoe())joe(t,n),Uoe(t)}e++},remove:function(){if(e--,!e&&t)t.parentNode&&t.parentNode.removeChild(t),t=null}}};var qT=function(){var e=KT();return function(t,n){cH.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};var Ub=function(){var e=qT(),t=function(n){var{styles:o,dynamic:r}=n;return e(o,r),null};return t};var Goe={left:0,top:0,right:0,gap:0},$T=function(e){return parseInt(e||"",10)||0},Foe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[$T(n),$T(o),$T(r)]},YT=function(e){if(e===void 0)e="margin";if(typeof window>"u")return Goe;var t=Foe(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}};var Voe=Ub(),Um="data-scroll-locked",Koe=function(e,t,n,o){var{left:r,top:a,right:i,gap:s}=e;if(n===void 0)n="margin";return`
49
+ .`.concat(HT,` {
50
+ overflow: hidden `).concat(o,`;
51
+ padding-right: `).concat(s,"px ").concat(o,`;
52
+ }
53
+ body[`).concat(Um,`] {
54
+ overflow: hidden `).concat(o,`;
55
+ overscroll-behavior: contain;
56
+ `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&`
57
+ padding-left: `.concat(r,`px;
58
+ padding-top: `).concat(a,`px;
59
+ padding-right: `).concat(i,`px;
60
+ margin-left:0;
61
+ margin-top:0;
62
+ margin-right: `).concat(s,"px ").concat(o,`;
63
+ `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),`
64
+ }
65
+
66
+ .`).concat(sp,` {
67
+ right: `).concat(s,"px ").concat(o,`;
68
+ }
69
+
70
+ .`).concat(lp,` {
71
+ margin-right: `).concat(s,"px ").concat(o,`;
72
+ }
73
+
74
+ .`).concat(sp," .").concat(sp,` {
75
+ right: 0 `).concat(o,`;
76
+ }
77
+
78
+ .`).concat(lp," .").concat(lp,` {
79
+ margin-right: 0 `).concat(o,`;
80
+ }
81
+
82
+ body[`).concat(Um,`] {
83
+ `).concat(jT,": ").concat(s,`px;
84
+ }
85
+ `)},uH=function(){var e=parseInt(document.body.getAttribute(Um)||"0",10);return isFinite(e)?e:0},qoe=function(){Gm.useEffect(function(){return document.body.setAttribute(Um,(uH()+1).toString()),function(){var e=uH()-1;if(e<=0)document.body.removeAttribute(Um);else document.body.setAttribute(Um,e.toString())}},[])},WT=function(e){var{noRelative:t,noImportant:n,gapMode:o}=e,r=o===void 0?"margin":o;qoe();var a=Gm.useMemo(function(){return YT(r)},[r]);return Gm.createElement(Voe,{styles:Koe(a,!t,r,!n?"!important":"")})};var XT=!1;if(typeof window<"u")try{Fm=Object.defineProperty({},"passive",{get:function(){return XT=!0,!0}}),window.addEventListener("test",Fm,Fm),window.removeEventListener("test",Fm,Fm)}catch(e){XT=!1}var Fm,cp=XT?{passive:!1}:!1;var $oe=function(e){return e.tagName==="TEXTAREA"},dH=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$oe(e)&&n[t]==="visible")},Yoe=function(e){return dH(e,"overflowY")},Woe=function(e){return dH(e,"overflowX")},QT=function(e,t){var n=t.ownerDocument,o=t;do{if(typeof ShadowRoot<"u"&&o instanceof ShadowRoot)o=o.host;var r=pH(e,o);if(r){var a=fH(e,o),i=a[1],s=a[2];if(i>s)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},Xoe=function(e){var{scrollTop:t,scrollHeight:n,clientHeight:o}=e;return[t,n,o]},Qoe=function(e){var{scrollLeft:t,scrollWidth:n,clientWidth:o}=e;return[t,n,o]},pH=function(e,t){return e==="v"?Yoe(t):Woe(t)},fH=function(e,t){return e==="v"?Xoe(t):Qoe(t)},Zoe=function(e,t){return e==="h"&&t==="rtl"?-1:1},mH=function(e,t,n,o,r){var a=Zoe(e,window.getComputedStyle(t).direction),i=a*o,s=n.target,l=t.contains(s),c=!1,d=i>0,u=0,p=0;do{if(!s)break;var f=fH(e,s),g=f[0],m=f[1],y=f[2],b=m-y-a*g;if(g||b){if(pH(e,s))u+=b,p+=g}var x=s.parentNode;s=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));if(d&&(r&&Math.abs(u)<1||!r&&i>u))c=!0;else if(!d&&(r&&Math.abs(p)<1||!r&&-i>p))c=!0;return c};var A0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gH=function(e){return[e.deltaX,e.deltaY]},hH=function(e){return e&&"current"in e?e.current:e},Joe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ere=function(e){return`
86
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
87
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
88
+ `)},tre=0,Vm=[];function bH(e){var t=yn.useRef([]),n=yn.useRef([0,0]),o=yn.useRef(),r=yn.useState(tre++)[0],a=yn.useState(Ub)[0],i=yn.useRef(e);yn.useEffect(function(){i.current=e},[e]),yn.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var m=eH([e.lockRef.current],(e.shards||[]).map(hH),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}return},[e.inert,e.lockRef.current,e.shards]);var s=yn.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var b=A0(m),x=n.current,v="deltaX"in m?m.deltaX:x[0]-b[0],k="deltaY"in m?m.deltaY:x[1]-b[1],S,N=m.target,R=Math.abs(v)>Math.abs(k)?"h":"v";if("touches"in m&&R==="h"&&N.type==="range")return!1;var A=window.getSelection(),D=A&&A.anchorNode,E=D?D===N||D.contains(N):!1;if(E)return!1;var z=QT(R,N);if(!z)return!0;if(z)S=R;else S=R==="v"?"h":"v",z=QT(R,N);if(!z)return!1;if(!o.current&&"changedTouches"in m&&(v||k))o.current=S;if(!S)return!0;var B=o.current||S;return mH(B,y,m,B==="h"?v:k,!0)},[]),l=yn.useCallback(function(m){var y=m;if(!Vm.length||Vm[Vm.length-1]!==a)return;var b="deltaY"in y?gH(y):A0(y),x=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&Joe(S.delta,b)})[0];if(x&&x.should){if(y.cancelable)y.preventDefault();return}if(!x){var v=(i.current.shards||[]).map(hH).filter(Boolean).filter(function(S){return S.contains(y.target)}),k=v.length>0?s(y,v[0]):!i.current.noIsolation;if(k){if(y.cancelable)y.preventDefault()}}},[]),c=yn.useCallback(function(m,y,b,x){var v={name:m,delta:y,target:b,should:x,shadowParent:nre(b)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(k){return k!==v})},1)},[]),d=yn.useCallback(function(m){n.current=A0(m),o.current=void 0},[]),u=yn.useCallback(function(m){c(m.type,gH(m),m.target,s(m,e.lockRef.current))},[]),p=yn.useCallback(function(m){c(m.type,A0(m),m.target,s(m,e.lockRef.current))},[]);yn.useEffect(function(){return Vm.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",l,cp),document.addEventListener("touchmove",l,cp),document.addEventListener("touchstart",d,cp),function(){Vm=Vm.filter(function(m){return m!==a}),document.removeEventListener("wheel",l,cp),document.removeEventListener("touchmove",l,cp),document.removeEventListener("touchstart",d,cp)}},[]);var{removeScrollBar:f,inert:g}=e;return yn.createElement(yn.Fragment,null,g?yn.createElement(a,{styles:ere(r)}):null,f?yn.createElement(WT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nre(e){var t=null;while(e!==null){if(e instanceof ShadowRoot)t=e.host,e=e.host;e=e.parentNode}return t}var vH=FT(E0,bH);var yH=M0.forwardRef(function(e,t){return M0.createElement(jb,fa({},e,{ref:t,sideCar:vH}))});yH.classNames=jb.classNames;var Vl=yH;var ore=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Km=new WeakMap,D0=new WeakMap,P0={},ZT=0,xH=function(e){return e&&(e.host||xH(e.parentNode))},rre=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=xH(n);if(o&&e.contains(o))return o;return console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null}).filter(function(n){return Boolean(n)})},are=function(e,t,n,o){var r=rre(t,Array.isArray(e)?e:[e]);if(!P0[n])P0[n]=new WeakMap;var a=P0[n],i=[],s=new Set,l=new Set(r),c=function(u){if(!u||s.has(u))return;s.add(u),c(u.parentNode)};r.forEach(c);var d=function(u){if(!u||l.has(u))return;Array.prototype.forEach.call(u.children,function(p){if(s.has(p))d(p);else try{var f=p.getAttribute(o),g=f!==null&&f!=="false",m=(Km.get(p)||0)+1,y=(a.get(p)||0)+1;if(Km.set(p,m),a.set(p,y),i.push(p),m===1&&g)D0.set(p,!0);if(y===1)p.setAttribute(n,"true");if(!g)p.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return d(t),s.clear(),ZT++,function(){if(i.forEach(function(u){var p=Km.get(u)-1,f=a.get(u)-1;if(Km.set(u,p),a.set(u,f),!p){if(!D0.has(u))u.removeAttribute(o);D0.delete(u)}if(!f)u.removeAttribute(n)}),ZT--,!ZT)Km=new WeakMap,Km=new WeakMap,D0=new WeakMap,P0={}}},Au=function(e,t,n){if(n===void 0)n="data-aria-hidden";var o=Array.from(Array.isArray(e)?e:[e]),r=t||ore(e);if(!r)return function(){return null};return o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),are(o,r,n,"aria-hidden")};var no=h(w(),1),ire=Object.defineProperty,ma=(e,t)=>ire(e,"name",{value:t,configurable:!0}),eE="Dialog",[wH,tE]=Wt(eE),[sre,es]=wH(eE),qm=ma((e)=>{let{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:a,modal:i=!0}=e,s=tn.useRef(null),l=tn.useRef(null),{nodes:c,registry:d}=ap(),[u,p]=Yn({prop:o,defaultProp:r??!1,onChange:a,caller:eE}),[f,g]=tn.useState(0),[m,y]=tn.useState(0);return no.jsx(sre,{scope:t,triggerRef:s,contentRef:l,contentId:Jt(),titleId:Jt(),descriptionId:Jt(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:g,setDescriptionCount:y,open:u,onOpenChange:p,onOpenToggle:tn.useCallback(()=>p((b)=>!b),[p]),modal:i,branchNodes:c,branchRegistry:d,children:n})},"Dialog"),lre="DialogTrigger",O0=tn.forwardRef(ma(function(t,n){let{__scopeDialog:o,...r}=t,a=es(lre,o),i=ke(n,a.triggerRef);return no.jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":I0(a.open),...r,ref:i,onClick:J(t.onClick,a.onOpenToggle)})},"DialogTrigger")),kH="DialogPortal",[cre,SH]=wH(kH,{forceMount:void 0}),up=ma((e)=>{let{__scopeDialog:t,forceMount:n,children:o,container:r}=e,a=es(kH,t);return no.jsx(cre,{scope:t,forceMount:n,children:tn.Children.map(o,(i)=>no.jsx(Rr,{present:n||a.open,children:no.jsx(qs,{asChild:!0,container:r,children:i})}))})},"DialogPortal"),JT="DialogOverlay",dp=tn.forwardRef(ma(function(t,n){let o=SH(JT,t.__scopeDialog),{forceMount:r=o.forceMount,...a}=t,i=es(JT,t.__scopeDialog);return i.modal?no.jsx(Rr,{present:r||i.open,children:no.jsx(dre,{...a,ref:n})}):null},"DialogOverlay")),ure=er("DialogOverlay.RemoveScroll"),dre=tn.forwardRef(ma(function(t,n){let{__scopeDialog:o,...r}=t,a=es(JT,o),i=ET(),s=ke(n,i);return no.jsx(Vl,{as:ure,allowPinchZoom:!0,shards:tn.useMemo(()=>[a.contentRef,...a.branchNodes.map((l)=>({current:l}))],[a.contentRef,a.branchNodes]),children:no.jsx(fe.div,{"data-state":I0(a.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})},"DialogOverlayImpl")),Gb="DialogContent",pp=tn.forwardRef(ma(function(t,n){let o=SH(Gb,t.__scopeDialog),{forceMount:r=o.forceMount,...a}=t,i=es(Gb,t.__scopeDialog);return no.jsx(Rr,{present:r||i.open,children:i.modal?no.jsx(pre,{...a,ref:n}):no.jsx(fre,{...a,ref:n})})},"DialogContent")),pre=tn.forwardRef(ma(function(t,n){let o=es(Gb,t.__scopeDialog),r=tn.useRef(null),a=ke(n,o.contentRef,r);return tn.useEffect(()=>{let i=r.current;if(i)return Au(i)},[]),no.jsx(CH,{...t,ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,onCloseAutoFocus:J(t.onCloseAutoFocus,(i)=>{i.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,(i)=>{let s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;if(s.button===2||l)i.preventDefault()}),onFocusOutside:J(t.onFocusOutside,(i)=>i.preventDefault())})},"DialogContentModal")),fre=tn.forwardRef(ma(function(t,n){let o=es(Gb,t.__scopeDialog),r=tn.useRef(!1),a=tn.useRef(!1);return no.jsx(CH,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(i)=>{if(t.onCloseAutoFocus?.(i),!i.defaultPrevented){if(!r.current)o.triggerRef.current?.focus();i.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:(i)=>{if(t.onInteractOutside?.(i),!i.defaultPrevented){if(r.current=!0,i.detail.originalEvent.type==="pointerdown")a.current=!0}let s=i.target;if(o.triggerRef.current?.contains(s))i.preventDefault();if(i.detail.originalEvent.type==="focusin"&&a.current)i.preventDefault()}})},"DialogContentNonModal")),CH=tn.forwardRef(ma(function(t,n){let{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,"aria-describedby":s,children:l,...c}=t,d=es(Gb,o);return $s(),no.jsx(rp,{registry:d.branchRegistry,children:no.jsx(Eu,{asChild:!0,loop:!0,trapped:r,branches:d.branchNodes,onMountAutoFocus:a,onUnmountAutoFocus:i,children:no.jsx(Ks,{role:"dialog",id:d.contentId,"aria-labelledby":d.titlePresent?d.titleId:void 0,"aria-describedby":d.descriptionPresent?NH(s,d.descriptionId):s,"data-state":I0(d.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1),children:l})})})},"DialogContentImpl")),_0=tn.forwardRef(ma(function(t,n){let{__scopeDialog:o,...r}=t,a=es("DialogTitle",o),{setTitleCount:i}=a;return vt(()=>(i((s)=>s+1),()=>i((s)=>s-1)),[i]),no.jsx(fe.h2,{id:a.titleId,...r,ref:n})},"DialogTitle")),z0=tn.forwardRef(ma(function(t,n){let{__scopeDialog:o,...r}=t,a=es("DialogDescription",o),{setDescriptionCount:i}=a;return vt(()=>(i((s)=>s+1),()=>i((s)=>s-1)),[i]),no.jsx(fe.p,{id:a.descriptionId,...r,ref:n})},"DialogDescription")),mre="DialogClose",Fb=tn.forwardRef(ma(function(t,n){let{__scopeDialog:o,...r}=t,a=es(mre,o);return no.jsx(fe.button,{type:"button",...r,ref:n,onClick:J(t.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function NH(...e){let t=new Set;for(let n of e){if(typeof n!=="string")continue;for(let o of String(n).trim().split(/\s+/))if(o)t.add(o)}return t.size>0?Array.from(t).join(" "):void 0}ma(NH,"concatAriaDescribedby");function I0(e){return e?"open":"closed"}ma(I0,"getState");var ns=h(w(),1),gre=Object.defineProperty,Kl=(e,t)=>gre(e,"name",{value:t,configurable:!0}),hre="AlertDialog",[bre,R0e]=Wt(hre,[tE]),ql=tE(),vre=Kl((e)=>{let{__scopeAlertDialog:t,...n}=e,o=ql(t);return ns.jsx(qm,{...o,...n,modal:!0})},"AlertDialog"),T0e=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,...r}=t,a=ql(o);return ns.jsx(O0,{...a,...r,ref:n})},"AlertDialogTrigger")),yre=Kl((e)=>{let{__scopeAlertDialog:t,...n}=e,o=ql(t);return ns.jsx(up,{...o,...n})},"AlertDialogPortal"),xre=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,...r}=t,a=ql(o);return ns.jsx(dp,{...a,...r,ref:n})},"AlertDialogOverlay")),wre="AlertDialogContent",[kre,Sre]=bre(wre),Cre=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,children:r,...a}=t,i=ql(o),s=ts.useRef(null),l=ke(n,s),c=ts.useRef(null);return ns.jsx(kre,{scope:o,cancelRef:c,children:ns.jsx(pp,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:J(a.onOpenAutoFocus,(d)=>{d.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:(d)=>d.preventDefault(),onInteractOutside:(d)=>d.preventDefault(),children:r})})},"AlertDialogContent")),Nre=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,...r}=t,a=ql(o);return ns.jsx(_0,{...a,...r,ref:n})},"AlertDialogTitle")),Rre=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,...r}=t,a=ql(o);return ns.jsx(z0,{...a,...r,ref:n})},"AlertDialogDescription")),Tre=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,...r}=t,a=ql(o);return ns.jsx(Fb,{...a,...r,ref:n})},"AlertDialogAction")),Ere="AlertDialogCancel",Are=ts.forwardRef(Kl(function(t,n){let{__scopeAlertDialog:o,...r}=t,{cancelRef:a}=Sre(Ere,o),i=ql(o),s=ke(n,a);return ns.jsx(Fb,{...i,...r,ref:s})},"AlertDialogCancel"));var Mo=h(I(),1);var TH=h(I(),1);var Mre=Object.defineProperty,Dre=(e,t)=>Mre(e,"name",{value:t,configurable:!0});function fp(e){let[t,n]=TH.useState(void 0);return vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let o=0,r=new ResizeObserver((a)=>{if(!Array.isArray(a))return;if(!a.length)return;let i=a[0];window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{let s,l;if("borderBoxSize"in i){let c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;s=d.inlineSize,l=d.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})})});return r.observe(e,{box:"border-box"}),()=>{window.cancelAnimationFrame(o),r.unobserve(e)}}else n(void 0)},[e]),t}Dre(fp,"useSize");var ja=h(w(),1),Pre=Object.defineProperty,$l=(e,t)=>Pre(e,"name",{value:t,configurable:!0}),nE="Checkbox",[Ore,L0e]=Wt(nE),[_re,oE]=Ore(nE);function EH(e){let{__scopeCheckbox:t,checked:n,children:o,defaultChecked:r,disabled:a,form:i,name:s,onCheckedChange:l,required:c,value:d="on",internal_do_not_use_render:u}=e,[p,f]=Yn({prop:n,defaultProp:r??!1,onChange:l,caller:nE}),[g,m]=Mo.useState(null),[y,b]=Mo.useState(null),[x,v]=Mo.useState(null),k=g?!!i||!!g.closest("form"):!0,S={checked:p,disabled:a,setChecked:f,control:g,setControl:m,name:s,form:i,value:d,userClick:x,onUserClick:v,required:c,defaultChecked:yi(r)?!1:r,isFormControl:k,bubbleInput:y,setBubbleInput:b};return ja.jsx(_re,{scope:t,...S,children:AH(u)?u(S):o})}$l(EH,"CheckboxProvider");var zre="CheckboxTrigger",Ire=Mo.forwardRef($l(function({__scopeCheckbox:t,onKeyDown:n,onClick:o,...r},a){let{control:i,value:s,disabled:l,checked:c,required:d,setControl:u,setChecked:p,onUserClick:f,isFormControl:g,bubbleInput:m}=oE(zre,t),y=ke(a,u),b=Mo.useRef(c);return Mo.useEffect(()=>{let x=i?.form;if(x){let v=$l(()=>p(b.current),"reset");return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[i,p]),ja.jsx(fe.button,{type:"button",role:"checkbox","aria-checked":yi(c)?"mixed":c,"aria-required":d,"data-state":rE(c),"data-disabled":l?"":void 0,disabled:l,value:s,...r,ref:y,onKeyDown:J(n,(x)=>{if(x.key==="Enter")x.preventDefault()}),onClick:J(o,(x)=>{let v=x.isPropagationStopped();if(f({requestedChecked:yi(c)?!0:!c,hasConsumerStoppedPropagation:v}),p((k)=>yi(k)?!0:!k),m&&g){if(!v)x.stopPropagation()}})})},"CheckboxTrigger")),Lre=Mo.forwardRef($l(function(t,n){let{__scopeCheckbox:o,name:r,checked:a,defaultChecked:i,required:s,disabled:l,value:c,onCheckedChange:d,form:u,...p}=t;return ja.jsx(EH,{__scopeCheckbox:o,checked:a,defaultChecked:i,disabled:l,required:s,onCheckedChange:d,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:f})=>ja.jsxs(ja.Fragment,{children:[ja.jsx(Ire,{...p,ref:n,__scopeCheckbox:o}),f&&ja.jsx(Ure,{__scopeCheckbox:o})]})})},"Checkbox")),Bre="CheckboxIndicator",Hre=Mo.forwardRef($l(function(t,n){let{__scopeCheckbox:o,forceMount:r,...a}=t,i=oE(Bre,o);return ja.jsx(Rr,{present:r||yi(i.checked)||i.checked===!0,children:ja.jsx(fe.span,{"data-state":rE(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),jre="CheckboxBubbleInput",Ure=Mo.forwardRef($l(function({__scopeCheckbox:t,onClick:n,...o},r){let{control:a,userClick:i,checked:s,defaultChecked:l,required:c,disabled:d,name:u,value:p,form:f,bubbleInput:g,setBubbleInput:m}=oE(jre,t),y=ke(r,m),b=fp(a),x=Mo.useRef(!1),v=Mo.useRef(s),k=Mo.useRef(i),S=Mo.useRef(null);Mo.useEffect(()=>{let R=g;if(!R)return;let A=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(A,"checked").set;if(!E)return;let z=v.current!==s;v.current=s;let B=i!==null&&i!==k.current;if(k.current=i,B){if(S.current=z?null:i,z)R.indeterminate=yi(s),E.call(R,yi(s)?!1:s);R.dispatchEvent(new Event("click",{bubbles:!i.hasConsumerStoppedPropagation}))}else if(z){let Z=S.current;S.current=null;let ee=Z?.requestedChecked===s;x.current=!0,R.indeterminate=yi(s),E.call(R,yi(s)?!1:s),R.dispatchEvent(new Event("click",{bubbles:!(ee&&Z.hasConsumerStoppedPropagation)})),x.current=!1}},[g,s,i]);let N=Mo.useRef(yi(s)?!1:s);return ja.jsx(fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??N.current,required:c,disabled:d,name:u,value:p,form:f,...o,tabIndex:-1,ref:y,onClick:J(n,(R)=>{if(x.current)R.stopPropagation()}),style:{...o.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function AH(e){return typeof e==="function"}$l(AH,"isFunction");function yi(e){return e==="indeterminate"}$l(yi,"isIndeterminate");function rE(e){return yi(e)?"indeterminate":e?"checked":"unchecked"}$l(rE,"getState");var Ua=h(I(),1);var Le=h(I(),1);var os=h(I(),1);var B0=h(w(),1),Po=h(I(),1);var Mu=h(w(),1),Gre=Object.defineProperty,Do=(e,t)=>Gre(e,"name",{value:t,configurable:!0});function mp(e){let t=e+"CollectionProvider",[n,o]=Wt(t),[r,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=Do((m)=>{let{scope:y,children:b}=m,x=os.useRef(null),v=os.useRef(new Map).current;return B0.jsx(r,{scope:y,itemMap:v,collectionRef:x,children:b})},"CollectionProvider");i.displayName=t;let s=e+"CollectionSlot",l=er(s),c=os.forwardRef((m,y)=>{let{scope:b,children:x}=m,v=a(s,b),k=ke(y,v.collectionRef);return B0.jsx(l,{ref:k,children:x})});c.displayName=s;let d=e+"CollectionItemSlot",u="data-radix-collection-item",p=er(d),f=os.forwardRef((m,y)=>{let{scope:b,children:x,...v}=m,k=os.useRef(null),S=ke(y,k),N=a(d,b);return os.useEffect(()=>(N.itemMap.set(k,{ref:k,...v}),()=>void N.itemMap.delete(k))),B0.jsx(p,{...{[u]:""},ref:S,children:x})});f.displayName=d;function g(m){let y=a(e+"CollectionConsumer",m);return os.useCallback(()=>{let x=y.collectionRef.current;if(!x)return[];let v=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((N,R)=>v.indexOf(N.ref.current)-v.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return Do(g,"useCollection"),[{Provider:i,Slot:c,ItemSlot:f},g,o]}Do(mp,"createCollection");var DH=new WeakMap,L0=class e extends Map{static{Do(this,"OrderedDict")}#e;constructor(t){super(t);this.#e=[...super.keys()],DH.set(this,!0)}set(t,n){if(DH.get(this)&&!this.has(t))this.#e.push(t);return super.set(t,n),this}insert(t,n,o){let r=this.has(n),a=r?this.size:this.size+1,i=aE(t),s=i>=0?Math.min(i,a-1):Math.max(a+i,0);if(r?this.#e.indexOf(n)===s:s===this.size)return this.set(n,o),this;let l=this.#e.filter((d)=>d!==n);l.splice(s,0,n);let c=l.map((d)=>[d,d===n?o:this.get(d)]);this.clear();for(let[d,u]of c)this.set(d,u);return this}with(t,n,o){let r=new e(this);return r.insert(t,n,o),r}before(t){let n=this.#e.indexOf(t)-1;if(n<0)return;return this.entryAt(n)}setBefore(t,n,o){let r=this.#e.indexOf(t);if(r===-1)return this;let a=this.#e.indexOf(n),i=a!==-1&&a<r?r-1:r;return this.insert(i,n,o)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n===-1)return;return this.entryAt(n)}setAfter(t,n,o){let r=this.#e.indexOf(t);if(r===-1)return this;let a=this.#e.indexOf(n),i=a!==-1&&a<=r?r:r+1;return this.insert(i,n,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){let n=super.delete(t);if(n)this.#e.splice(this.#e.indexOf(t),1);return n}deleteAt(t){let n=this.keyAt(t);if(n!==void 0)return this.delete(n);return!1}at(t){let n=H0(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){let n=H0(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return H0(this.#e,t)}from(t,n){let o=this.indexOf(t);if(o===-1)return;let r=o+n;if(r<0)r=0;if(r>=this.size)r=this.size-1;return this.at(r)}keyFrom(t,n){let o=this.indexOf(t);if(o===-1)return;let r=o+n;if(r<0)r=0;if(r>=this.size)r=this.size-1;return this.keyAt(r)}find(t,n){let o=0;for(let r of this){if(Reflect.apply(t,n,[r,o,this]))return r;o++}return}findIndex(t,n){let o=0;for(let r of this){if(Reflect.apply(t,n,[r,o,this]))return o;o++}return-1}filter(t,n){let o=[],r=0;for(let a of this){if(Reflect.apply(t,n,[a,r,this]))o.push(a);r++}return new e(o)}map(t,n){let o=[],r=0;for(let a of this)o.push([a[0],Reflect.apply(t,n,[a,r,this])]),r++;return new e(o)}reduce(...t){let[n,o]=t,r=t.length>1;if(!r&&this.size===0)throw TypeError("Reduce of empty OrderedDict with no initial value");let a=0,i=o;for(let s of this){if(a===0&&!r)i=s;else i=Reflect.apply(n,this,[i,s,a,this]);a++}return i}reduceRight(...t){let[n,o]=t,r=t.length>1;if(!r&&this.size===0)throw TypeError("Reduce of empty OrderedDict with no initial value");let a=o;for(let i=this.size-1;i>=0;i--){let s=this.entryAt(i);if(i===this.size-1&&!r)a=s;else a=Reflect.apply(n,this,[a,s,i,this])}return a}sort(t){if(typeof t!=="function")throw TypeError("OrderedDict.sort requires a compare function");let n=[...this.entries()].sort(t);this.clear();for(let[o,r]of n)this.set(o,r);return this}toSorted(t){if(typeof t!=="function")throw TypeError("OrderedDict.toSorted requires a compare function");let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let n=this.size-1;n>=0;n--){let o=this.keyAt(n),r=this.get(o);t.set(o,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let o=new e;for(let r of this.#e.slice(t,n))o.set(r,this.get(r));return o}every(t,n){let o=0;for(let r of this){if(!Reflect.apply(t,n,[r,o,this]))return!1;o++}return!0}some(t,n){let o=0;for(let r of this){if(Reflect.apply(t,n,[r,o,this]))return!0;o++}return!1}};function H0(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let n=PH(e,t);return n===-1?void 0:e[n]}Do(H0,"at");function PH(e,t){let n=e.length,o=aE(t),r=o>=0?o:n+o;return r<0||r>=n?-1:r}Do(PH,"toSafeIndex");function aE(e){return e!==e||e===0?0:Math.trunc(e)}Do(aE,"toSafeInteger");function Fre(e){let t=e+"CollectionProvider",[n,o]=Wt(t),[r,a]=n(t);r.displayName=e+"CollectionStableContextProvider";let[i,s]=n(t);i.displayName=e+"CollectionStatefulContextProvider";let l=Do(({state:N,...R})=>N?Mu.jsx(d,{...R,state:N}):Mu.jsx(c,{...R}),"CollectionProvider");l.displayName=t;let c=Do((N)=>{let R=x();return Mu.jsx(d,{...N,state:R})},"CollectionInit");c.displayName=e+"CollectionInit";let d=Do((N)=>{let{scope:R,children:A,state:D}=N,E=Po.useRef(null),[z,B]=Po.useState(null),Z=ke(E,B),[ee,xe]=D,V=Po.useRef(new L0),ye=Po.useCallback(()=>{let ae=V.current;if(!zH(ae))ae.sort(j0);return ae},[]);return Po.useEffect(()=>{if(!z)return;let ae=IH(()=>{xe((ge)=>{let P=ge.toSorted(j0);return P.some(([j],le)=>ge.keyAt(le)!==j)?P:ge})});return ae.observe(z,{childList:!0,subtree:!0}),()=>{ae.disconnect()}},[z,xe]),Mu.jsx(r,{scope:R,collectionElementRef:Z,collectionElementRefObject:E,getCollection:ye,setCollection:xe,registryRef:V,children:Mu.jsx(i,{scope:R,collectionElement:z,collection:ee,children:A})})},"CollectionProviderImpl");d.displayName=e+"CollectionProviderImpl";let u=e+"CollectionSlot",p=er(u),f=Po.forwardRef((N,R)=>{let{scope:A,children:D}=N,E=a(u,A),z=ke(R,E.collectionElementRef);return Mu.jsx(p,{ref:z,children:D})});f.displayName=u;let g=e+"CollectionItemSlot",m="data-radix-collection-item",y=er(g),b=Po.forwardRef((N,R)=>{let{scope:A,children:D,...E}=N,z=Po.useRef(null),B=a(g,A),{setCollection:Z,registryRef:ee}=B,xe=Po.useRef(E);if(!OH(xe.current,E))xe.current=E;let V=xe.current,ye=Po.useCallback((P)=>{let Ae=ee.current;if(P)Ae.set(P,{...xe.current,element:P});else if(z.current)Ae.delete(z.current)},[ee]),ae=ke(R,ye,z);vt(()=>{let P=z.current,Ae=ee.current;if(P&&Ae.has(P))Ae.set(P,{...V,element:P})},[V,ee]);let ge=Po.useRef(null);return Po.useEffect(()=>{let P=z.current,Ae=ge.current;if((Ae?.element??null)===P&&(!P||Ae?.itemData===V))return;ge.current=P?{element:P,itemData:V}:null,Z((j)=>{let le=new L0(j);if(Ae&&Ae.element!==P)le.delete(Ae.element);if(P)le.set(P,{...V,element:P});return le.sort(j0)})}),Po.useEffect(()=>()=>{let P=ge.current;if(ge.current=null,!P)return;Z((Ae)=>{if(!Ae.has(P.element))return Ae;let j=new L0(Ae);return j.delete(P.element),j})},[Z]),Mu.jsx(y,{...{[m]:""},ref:ae,children:D})});b.displayName=g;function x(){return Po.useState(new L0)}Do(x,"useInitCollection");function v(N){let{collection:R}=s(e+"CollectionConsumer",N);return R}Do(v,"useCollection");function k(N){let{getCollection:R}=a(e+"CollectionConsumer",N);return R}return Do(k,"useGetCollection"),[{Provider:l,Slot:f,ItemSlot:b},{createCollectionScope:o,useCollection:v,useGetCollection:k,useInitCollection:x}]}Do(Fre,"createCollection");function OH(e,t){if(e===t)return!0;if(typeof e!=="object"||typeof t!=="object")return!1;if(e==null||t==null)return!1;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(e[r]!==t[r])return!1}return!0}Do(OH,"shallowEqual");function _H(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Do(_H,"isElementPreceding");function zH(e){let t;for(let n of e.keys()){if(t){let o=t.compareDocumentPosition(n);if(!(o&Node.DOCUMENT_POSITION_DISCONNECTED)&&o&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}Do(zH,"isInDocumentOrder");function j0(e,t){return!e[1].element||!t[1].element?0:_H(e[1].element,t[1].element)?-1:1}Do(j0,"sortByDocumentPosition");function IH(e){return new MutationObserver((n)=>{for(let o of n)if(o.type==="childList"){e();return}})}Do(IH,"getChildListObserver");var U0=h(I(),1),qre=h(w(),1),Vre=Object.defineProperty,Kre=(e,t)=>Vre(e,"name",{value:t,configurable:!0}),$re={LTR:"ltr",RTL:"rtl"},Yre=U0.createContext(void 0);function Yl(e){let t=U0.useContext(Yre);return e||t||$re.LTR}Kre(Yl,"useDirection");var Br=h(I(),1);var HH=["top","right","bottom","left"];var{min:Ys,max:rs,round:qb,floor:$b}=Math,Ws=(e)=>({x:e,y:e}),Wre={left:"right",right:"left",bottom:"top",top:"bottom"};function iE(e,t,n){return rs(e,Ys(t,n))}function Xs(e,t){return typeof e==="function"?e(t):e}function Wl(e){return e.split("-")[0]}function gp(e){return e.split("-")[1]}function F0(e){return e==="x"?"y":"x"}function V0(e){return e==="y"?"height":"width"}function as(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function K0(e){return F0(as(e))}function jH(e,t,n){if(n===void 0)n=!1;let o=gp(e),r=K0(e),a=V0(r),i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";if(t.reference[a]>t.floating[a])i=Kb(i);return[i,Kb(i)]}function UH(e){let t=Kb(e);return[G0(e),t,G0(t)]}function G0(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var LH=["left","right"],BH=["right","left"],Xre=["top","bottom"],Qre=["bottom","top"];function Zre(e,t,n){switch(e){case"top":case"bottom":if(n)return t?BH:LH;return t?LH:BH;case"left":case"right":return t?Xre:Qre;default:return[]}}function GH(e,t,n,o){let r=gp(e),a=Zre(Wl(e),n==="start",o);if(r){if(a=a.map((i)=>i+"-"+r),t)a=a.concat(a.map(G0))}return a}function Kb(e){let t=Wl(e);return Wre[t]+e.slice(t.length)}function Jre(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function sE(e){return typeof e!=="number"?Jre(e):{top:e,right:e,bottom:e,left:e}}function hp(e){let{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function FH(e,t,n){let{reference:o,floating:r}=e,a=as(t),i=K0(t),s=V0(i),l=Wl(t),c=a==="y",d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,p=o[s]/2-r[s]/2,f;switch(l){case"top":f={x:d,y:o.y-r.height};break;case"bottom":f={x:d,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:u};break;case"left":f={x:o.x-r.width,y:u};break;default:f={x:o.x,y:o.y}}let g=gp(t);if(g)f[i]+=p*(g==="end"?1:-1)*(n&&c?-1:1);return f}async function qH(e,t){var n;if(t===void 0)t={};let{x:o,y:r,platform:a,rects:i,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=Xs(t,e),g=sE(f),y=s[p?u==="floating"?"reference":"floating":u],b=hp(await a.getClippingRect({element:((n=await(a.isElement==null?void 0:a.isElement(y)))!=null?n:!0)?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),x=u==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),k=await(a.isElement==null?void 0:a.isElement(v))&&await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},S=hp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:x,offsetParent:v,strategy:l}):x);return{top:(b.top-S.top+g.top)/k.y,bottom:(S.bottom-b.bottom+g.bottom)/k.y,left:(b.left-S.left+g.left)/k.x,right:(S.right-b.right+g.right)/k.x}}var eae=50,$H=async(e,t,n)=>{let{placement:o="bottom",strategy:r="absolute",middleware:a=[],platform:i}=n,s=i.detectOverflow?i:{...i,detectOverflow:qH},l=await(i.isRTL==null?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=FH(c,o,l),p=o,f=0,g={};for(let m=0;m<a.length;m++){let y=a[m];if(!y)continue;let{name:b,fn:x}=y,{x:v,y:k,data:S,reset:N}=await x({x:d,y:u,initialPlacement:o,placement:p,strategy:r,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(d=v!=null?v:d,u=k!=null?k:u,g[b]={...g[b],...S},N&&f<eae){if(f++,typeof N==="object"){if(N.placement)p=N.placement;if(N.rects)c=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):N.rects;({x:d,y:u}=FH(c,p,l))}m=-1}}return{x:d,y:u,placement:p,strategy:r,middlewareData:g}},YH=(e)=>({name:"arrow",options:e,async fn(t){let{x:n,y:o,placement:r,rects:a,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=Xs(e,t)||{};if(c==null)return{};let u=sE(d),p={x:n,y:o},f=K0(r),g=V0(f),m=await i.getDimensions(c),y=f==="y",b=y?"top":"left",x=y?"bottom":"right",v=y?"clientHeight":"clientWidth",k=a.reference[g]+a.reference[f]-p[f]-a.floating[g],S=p[f]-a.reference[f],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c)),R=N?N[v]:0;if(!R||!await(i.isElement==null?void 0:i.isElement(N)))R=s.floating[v]||a.floating[g];let A=k/2-S/2,D=R/2-m[g]/2-1,E=Ys(u[b],D),z=Ys(u[x],D),B=R-m[g]-z,Z=R/2-m[g]/2+A,ee=iE(E,Z,B),xe=!l.arrow&&gp(r)!=null&&Z!==ee&&a.reference[g]/2-(Z<E?E:z)-m[g]/2<0,V=xe?Z<E?Z-E:Z-B:0;return{[f]:p[f]+V,data:{[f]:ee,centerOffset:Z-ee-V,...xe&&{alignmentOffset:V}},reset:xe}}});var WH=function(e){if(e===void 0)e={};return{name:"flip",options:e,async fn(t){var n,o;let{placement:r,middlewareData:a,rects:i,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...y}=Xs(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let b=Wl(r),x=as(s),v=Wl(s)===s,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=p||(v||!m?[Kb(s)]:UH(s)),N=g!=="none";if(!p&&N)S.push(...GH(s,m,g,k));let R=[s,...S],A=await l.detectOverflow(t,y),D=[],E=((o=a.flip)==null?void 0:o.overflows)||[];if(d)D.push(A[b]);if(u){let ee=jH(r,i,k);D.push(A[ee[0]],A[ee[1]])}if(E=[...E,{placement:r,overflows:D}],!D.every((ee)=>ee<=0)){var z,B;let ee=(((z=a.flip)==null?void 0:z.index)||0)+1,xe=R[ee];if(xe){if(!(u==="alignment"?x!==as(xe):!1)||E.every((ae)=>as(ae.placement)===x?ae.overflows[0]>0:!0))return{data:{index:ee,overflows:E},reset:{placement:xe}}}let V=(B=E.filter((ye)=>ye.overflows[0]<=0).sort((ye,ae)=>ye.overflows[1]-ae.overflows[1])[0])==null?void 0:B.placement;if(!V)switch(f){case"bestFit":{var Z;let ye=(Z=E.filter((ae)=>{if(N){let ge=as(ae.placement);return ge===x||ge==="y"}return!0}).map((ae)=>[ae.placement,ae.overflows.filter((ge)=>ge>0).reduce((ge,P)=>ge+P,0)]).sort((ae,ge)=>ae[1]-ge[1])[0])==null?void 0:Z[0];if(ye)V=ye;break}case"initialPlacement":V=s;break}if(r!==V)return{reset:{placement:V}}}return{}}}};function VH(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function KH(e){return HH.some((t)=>e[t]>=0)}var XH=function(e){if(e===void 0)e={};return{name:"hide",options:e,async fn(t){let{rects:n,platform:o}=t,{strategy:r="referenceHidden",...a}=Xs(e,t);switch(r){case"referenceHidden":{let i=await o.detectOverflow(t,{...a,elementContext:"reference"}),s=VH(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:KH(s)}}}case"escaped":{let i=await o.detectOverflow(t,{...a,altBoundary:!0}),s=VH(i,n.floating);return{data:{escapedOffsets:s,escaped:KH(s)}}}default:return{}}}}};var QH=new Set(["left","top"]);async function tae(e,t){let{placement:n,platform:o,elements:r}=e,a=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Wl(n),s=gp(n),l=as(n)==="y",c=QH.has(i)?-1:1,d=a&&l?-1:1,u=Xs(t,e),{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof u==="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};if(s&&typeof g==="number")f=s==="end"?g*-1:g;return l?{x:f*d,y:p*c}:{x:p*c,y:f*d}}var ZH=function(e){if(e===void 0)e=0;return{name:"offset",options:e,async fn(t){var n,o;let{x:r,y:a,placement:i,middlewareData:s}=t,l=await tae(t,e);if(i===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset)return{};return{x:r+l.x,y:a+l.y,data:{...l,placement:i}}}}},JH=function(e){if(e===void 0)e={};return{name:"shift",options:e,async fn(t){let{x:n,y:o,placement:r,platform:a}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:(x)=>{let{x:v,y:k}=x;return{x:v,y:k}}},...c}=Xs(e,t),d={x:n,y:o},u=await a.detectOverflow(t,c),p=as(r),f=F0(p),g=d[f],m=d[p],y=(x,v)=>iE(v+u[x==="y"?"top":"left"],v,v-u[x==="y"?"bottom":"right"]);if(i)g=y(f,g);if(s)m=y(p,m);let b=l.fn({...t,[f]:g,[p]:m});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[f]:i,[p]:s}}}}}},e9=function(e){if(e===void 0)e={};return{options:e,fn(t){var n,o;let{x:r,y:a,placement:i,rects:s,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:u=!0}=Xs(e,t),p={x:r,y:a},f=as(i),g=F0(f),m=p[g],y=p[f],b=Xs(c,t),x=typeof b==="number"?{mainAxis:b,crossAxis:0}:{mainAxis:(n=b.mainAxis)!=null?n:0,crossAxis:(o=b.crossAxis)!=null?o:0};if(d){let S=g==="y"?"height":"width",N=s.reference[g]-s.floating[S]+x.mainAxis,R=s.reference[g]+s.reference[S]-x.mainAxis;if(m<N)m=N;else if(m>R)m=R}if(u){var v,k;let S=g==="y"?"width":"height",N=QH.has(Wl(i)),R=s.reference[f]-s.floating[S]+(N?((v=l.offset)==null?void 0:v[f])||0:0)+(N?0:x.crossAxis),A=s.reference[f]+s.reference[S]+(N?0:((k=l.offset)==null?void 0:k[f])||0)-(N?x.crossAxis:0);if(y<R)y=R;else if(y>A)y=A}return{[g]:m,[f]:y}}}},t9=function(e){if(e===void 0)e={};return{name:"size",options:e,async fn(t){let{placement:n,rects:o,platform:r,elements:a}=t,{apply:i=()=>{},...s}=Xs(e,t),l=await r.detectOverflow(t,s),c=Wl(n),d=gp(n),u=as(n)==="y",{width:p,height:f}=o.floating,g,m;if(c==="top"||c==="bottom")g=c,m=d===(await(r.isRTL==null?void 0:r.isRTL(a.floating))?"start":"end")?"left":"right";else m=c,g=d==="end"?"top":"bottom";let y=f-l.top-l.bottom,b=p-l.left-l.right,x=Ys(f-l[g],y),v=Ys(p-l[m],b),k=t.middlewareData.shift,S=!k,N=x,R=v;if(k!=null&&k.enabled.x)R=b;if(k!=null&&k.enabled.y)N=y;if(S&&!d)if(u)R=p-2*rs(l.left,l.right);else N=f-2*rs(l.top,l.bottom);await i({...t,availableWidth:R,availableHeight:N});let A=await r.getDimensions(a.floating);if(p!==A.width||f!==A.height)return{reset:{rects:!0}};return{}}}};function q0(){return typeof window<"u"}function yp(e){if(o9(e))return(e.nodeName||"").toLowerCase();return"#document"}function Qr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qs(e){var t;return(t=(o9(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function o9(e){if(!q0())return!1;return e instanceof Node||e instanceof Qr(e).Node}function is(e){if(!q0())return!1;return e instanceof Element||e instanceof Qr(e).Element}function Xl(e){if(!q0())return!1;return e instanceof HTMLElement||e instanceof Qr(e).HTMLElement}function n9(e){if(!q0()||typeof ShadowRoot>"u")return!1;return e instanceof ShadowRoot||e instanceof Qr(e).ShadowRoot}function Yb(e){let{overflow:t,overflowX:n,overflowY:o,display:r}=ss(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function r9(e){return/^(table|td|th)$/.test(yp(e))}function Wb(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}var nae=/transform|translate|scale|rotate|perspective|filter/,oae=/paint|layout|strict|content/,bp=(e)=>!!e&&e!=="none",lE;function $0(e){let t=is(e)?ss(e):e;return bp(t.transform)||bp(t.translate)||bp(t.scale)||bp(t.rotate)||bp(t.perspective)||!Y0()&&(bp(t.backdropFilter)||bp(t.filter))||nae.test(t.willChange||"")||oae.test(t.contain||"")}function a9(e){let t=Du(e);while(Xl(t)&&!$m(t)){if($0(t))return t;else if(Wb(t))return null;t=Du(t)}return null}function Y0(){if(lE==null)lE=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none");return lE}function $m(e){return/^(html|body|#document)$/.test(yp(e))}function ss(e){return Qr(e).getComputedStyle(e)}function Xb(e){if(is(e))return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop};return{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Du(e){if(yp(e)==="html")return e;let t=e.assignedSlot||e.parentNode||n9(e)&&e.host||Qs(e);return n9(t)?t.host:t}function i9(e){let t=Du(e);if($m(t))return(e.ownerDocument||e).body;if(Xl(t)&&Yb(t))return t;return i9(t)}function vp(e,t,n){var o;if(t===void 0)t=[];if(n===void 0)n=!0;let r=i9(e),a=r===((o=e.ownerDocument)==null?void 0:o.body),i=Qr(r);if(a){let s=W0(i);return t.concat(i,i.visualViewport||[],Yb(r)?r:[],s&&n?vp(s):[])}else return t.concat(r,vp(r,[],n))}function W0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function c9(e){let t=ss(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,r=Xl(e),a=r?e.offsetWidth:n,i=r?e.offsetHeight:o,s=qb(n)!==a||qb(o)!==i;if(s)n=a,o=i;return{width:n,height:o,$:s}}function uE(e){return!is(e)?e.contextElement:e}function Ym(e){let t=uE(e);if(!Xl(t))return Ws(1);let n=t.getBoundingClientRect(),{width:o,height:r,$:a}=c9(t),i=(a?qb(n.width):n.width)/o,s=(a?qb(n.height):n.height)/r;if(!i||!Number.isFinite(i))i=1;if(!s||!Number.isFinite(s))s=1;return{x:i,y:s}}var rae=Ws(0);function u9(e){let t=Qr(e);if(!Y0()||!t.visualViewport)return rae;return{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aae(e,t,n){if(t===void 0)t=!1;return!!n&&t&&n===Qr(e)}function xp(e,t,n,o){if(t===void 0)t=!1;if(n===void 0)n=!1;let r=e.getBoundingClientRect(),a=uE(e),i=Ws(1);if(t)if(o){if(is(o))i=Ym(o)}else i=Ym(e);let s=aae(a,n,o)?u9(a):Ws(0),l=(r.left+s.x)/i.x,c=(r.top+s.y)/i.y,d=r.width/i.x,u=r.height/i.y;if(a&&o){let p=Qr(a),f=is(o)?Qr(o):o,g=p,m=W0(g);while(m&&f!==g){let y=Ym(m),b=m.getBoundingClientRect(),x=ss(m),v=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,k=b.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=v,c+=k,g=Qr(m),m=W0(g)}}return hp({width:d,height:u,x:l,y:c})}function X0(e,t){let n=Xb(e).scrollLeft;if(!t)return xp(Qs(e)).left+n;return t.left+n}function d9(e,t){let n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-X0(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function iae(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e,a=r==="fixed",i=Qs(o),s=t?Wb(t.floating):!1;if(o===i||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=Ws(1),d=Ws(0),u=Xl(o);if(u||!a){if(yp(o)!=="body"||Yb(i))l=Xb(o);if(u){let f=xp(o);c=Ym(o),d.x=f.x+o.clientLeft,d.y=f.y+o.clientTop}}let p=i&&!u&&!a?d9(i,l):Ws(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function sae(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function lae(e){let t=Xb(e),n=e.ownerDocument.body,o=rs(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=rs(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+X0(e),i=-t.scrollTop;if(ss(n).direction==="rtl")a+=rs(e.clientWidth,n.clientWidth)-o;return{width:o,height:r,x:a,y:i}}var cae=25;function uae(e,t,n){if(n===void 0)n="viewport";let o=n==="layoutViewport",r=Qr(e),a=Qs(e),i=r.visualViewport,{clientWidth:s,clientHeight:l}=a,c=0,d=0;if(i){let p=!Y0()||t==="fixed";if(o){if(!p)c=-i.offsetLeft,d=-i.offsetTop}else if(s=i.width,l=i.height,p)c=i.offsetLeft,d=i.offsetTop}if(X0(a)<=0){let p=a.ownerDocument,f=p.body,g=getComputedStyle(f),m=p.compatMode==="CSS1Compat"?parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0:0,y=Math.abs(a.clientWidth-f.clientWidth-m),b=getComputedStyle(a).scrollbarGutter==="stable both-edges"?y/2:y;if(b<=cae)s-=b}return{width:s,height:l,x:c,y:d}}function dae(e,t){let n=xp(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,a=Ym(e),i=e.clientWidth*a.x,s=e.clientHeight*a.y,l=r*a.x,c=o*a.y;return{width:i,height:s,x:l,y:c}}function s9(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=uae(e,n,t);else if(t==="document")o=lae(Qs(e));else if(is(t))o=dae(t,n);else{let r=u9(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return hp(o)}function pae(e,t){let n=t.get(e);if(n)return n;let o=vp(e,[],!1).filter((s)=>is(s)&&yp(s)!=="body"),r=null,a=ss(e).position==="fixed",i=a?Du(e):e;while(is(i)&&!$m(i)){let s=ss(i),l=$0(i),c=r?r.position:a?"fixed":"";if(!l&&(c==="fixed"||c==="absolute"&&s.position==="static"))o=o.filter((u)=>u!==i);else r=s;i=Du(i)}return t.set(e,o),o}function fae(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e,i=[...n==="clippingAncestors"?Wb(t)?[]:pae(t,this._c):[].concat(n),o],s=s9(t,i[0],r),{top:l,right:c,bottom:d,left:u}=s;for(let p=1;p<i.length;p++){let f=s9(t,i[p],r);l=rs(f.top,l),c=Ys(f.right,c),d=Ys(f.bottom,d),u=rs(f.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function mae(e){let{width:t,height:n}=c9(e);return{width:t,height:n}}function gae(e,t,n){let o=Xl(t),r=Qs(t),a=n==="fixed",i=xp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},l=Ws(0);if(o||!a){if(yp(t)!=="body"||Yb(r))s=Xb(t);if(o){let p=xp(t,!0,a,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}}if(!o&&r)l.x=X0(r);let c=r&&!o&&!a?d9(r,s):Ws(0),d=i.left+s.scrollLeft-l.x-c.x,u=i.top+s.scrollTop-l.y-c.y;return{x:d,y:u,width:i.width,height:i.height}}function cE(e){return ss(e).position==="static"}function l9(e,t){if(!Xl(e)||ss(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;if(Qs(e)===n)n=n.ownerDocument.body;return n}function p9(e,t){let n=Qr(e);if(Wb(e))return n;if(!Xl(e)){let r=Du(e);while(r&&!$m(r)){if(is(r)&&!cE(r))return r;r=Du(r)}return n}let o=l9(e,t);while(o&&r9(o)&&cE(o))o=l9(o,t);if(o&&$m(o)&&cE(o)&&!$0(o))return n;return o||a9(e)||n}var hae=async function(e){let t=this.getOffsetParent||p9,n=this.getDimensions,o=await n(e.floating);return{reference:gae(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function bae(e){return ss(e).direction==="rtl"}var f9={convertOffsetParentRelativeRectToViewportRelativeRect:iae,getDocumentElement:Qs,getClippingRect:fae,getOffsetParent:p9,getElementRects:hae,getClientRects:sae,getDimensions:mae,getScale:Ym,isElement:is,isRTL:bae};function m9(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vae(e,t,n){let o=null,r,a=Qs(e);function i(){var d;clearTimeout(r),(d=o)==null||d.disconnect(),o=null}function s(d,u){if(d===void 0)d=!1;if(u===void 0)u=1;i();let p=e.getBoundingClientRect(),{left:f,top:g,width:m,height:y}=p;if(!d)t();if(!m||!y)return;let b=$b(g),x=$b(a.clientWidth-(f+m)),v=$b(a.clientHeight-(g+y)),k=$b(f),N={rootMargin:-b+"px "+-x+"px "+-v+"px "+-k+"px",threshold:rs(0,Ys(1,u))||1},R=!0;function A(D){let E=D[0].intersectionRatio;if(!m9(p,e.getBoundingClientRect()))return s();if(E!==u){if(!R)return s();if(!E)r=setTimeout(()=>{s(!1,0.0000001)},1000);else s(!1,E)}R=!1}try{o=new IntersectionObserver(A,{...N,root:a.ownerDocument})}catch(D){o=new IntersectionObserver(A,N)}o.observe(e)}let l=Qr(e),c=()=>s(n);return l.addEventListener("resize",c),s(!0),()=>{l.removeEventListener("resize",c),i()}}function dE(e,t,n,o){if(o===void 0)o={};let{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver==="function",layoutShift:s=typeof IntersectionObserver==="function",animationFrame:l=!1}=o,c=uE(e),d=r||a?[...c?vp(c):[],...t?vp(t):[]]:[];d.forEach((b)=>{r&&b.addEventListener("scroll",n),a&&b.addEventListener("resize",n)});let u=c&&s?vae(c,n,a):null,p=-1,f=null;if(i){if(f=new ResizeObserver((b)=>{let[x]=b;if(x&&x.target===c&&f&&t)f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)});n()}),c&&!l)f.observe(c);if(t)f.observe(t)}let g,m=l?xp(e):null;if(l)y();function y(){let b=xp(e);if(m&&!m9(m,b))n();m=b,g=requestAnimationFrame(y)}return n(),()=>{var b;if(d.forEach((x)=>{r&&x.removeEventListener("scroll",n),a&&x.removeEventListener("resize",n)}),u==null||u(),(b=f)==null||b.disconnect(),f=null,l)cancelAnimationFrame(g)}}var g9=ZH;var h9=JH,b9=WH,v9=t9,y9=XH,pE=YH;var x9=e9,fE=(e,t,n)=>{let o=new Map,r=n!=null?n:{},a={...f9,...r.platform,_c:o};return $H(e,t,{...r,platform:a})};var vo=h(I(),1),k9=h(I(),1),S9=h(Za(),1),yae=typeof document<"u",xae=function(){},Q0=yae?k9.useLayoutEffect:xae;function Z0(e,t){if(e===t)return!0;if(typeof e!==typeof t)return!1;if(typeof e==="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e==="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Z0(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){let a=r[o];if(a==="_owner"&&e.$$typeof)continue;if(!Z0(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function C9(e){if(typeof window>"u")return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function w9(e,t){let n=C9(e);return Math.round(t*n)/n}function mE(e){let t=vo.useRef(e);return Q0(()=>{t.current=e}),t}function N9(e){if(e===void 0)e={};let{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=vo.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=vo.useState(o);if(!Z0(p,o))f(o);let[g,m]=vo.useState(null),[y,b]=vo.useState(null),x=vo.useCallback((ae)=>{if(ae!==N.current)N.current=ae,m(ae)},[]),v=vo.useCallback((ae)=>{if(ae!==R.current)R.current=ae,b(ae)},[]),k=a||g,S=i||y,N=vo.useRef(null),R=vo.useRef(null),A=vo.useRef(d),D=l!=null,E=mE(l),z=mE(r),B=mE(c),Z=vo.useCallback(()=>{if(!N.current||!R.current)return;let ae={placement:t,strategy:n,middleware:p};if(z.current)ae.platform=z.current;fE(N.current,R.current,ae).then((ge)=>{let P={...ge,isPositioned:B.current!==!1};if(ee.current&&!Z0(A.current,P))A.current=P,S9.flushSync(()=>{u(P)})})},[p,t,n,z,B]);Q0(()=>{if(c===!1&&A.current.isPositioned)A.current.isPositioned=!1,u((ae)=>({...ae,isPositioned:!1}))},[c]);let ee=vo.useRef(!1);Q0(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Q0(()=>{if(k)N.current=k;if(S)R.current=S;if(k&&S){if(E.current)return E.current(k,S,Z);Z()}},[k,S,Z,E,D]);let xe=vo.useMemo(()=>({reference:N,floating:R,setReference:x,setFloating:v}),[x,v]),V=vo.useMemo(()=>({reference:k,floating:S}),[k,S]),ye=vo.useMemo(()=>{let ae={position:n,left:0,top:0};if(!V.floating)return ae;let ge=w9(V.floating,d.x),P=w9(V.floating,d.y);if(s)return{...ae,transform:"translate("+ge+"px, "+P+"px)",...C9(V.floating)>=1.5&&{willChange:"transform"}};return{position:n,left:ge,top:P}},[n,s,V.floating,d.x,d.y]);return vo.useMemo(()=>({...d,update:Z,refs:xe,elements:V,floatingStyles:ye}),[d,Z,xe,V,ye])}var wae=(e)=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){let{element:o,padding:r}=typeof e==="function"?e(n):e;if(o&&t(o)){if(o.current!=null)return pE({element:o.current,padding:r}).fn(n);return{}}if(o)return pE({element:o,padding:r}).fn(n);return{}}}},R9=(e,t)=>{let n=g9(e);return{name:n.name,fn:n.fn,options:[e,t]}},T9=(e,t)=>{let n=h9(e);return{name:n.name,fn:n.fn,options:[e,t]}},E9=(e,t)=>({fn:x9(e).fn,options:[e,t]}),A9=(e,t)=>{let n=b9(e);return{name:n.name,fn:n.fn,options:[e,t]}},M9=(e,t)=>{let n=v9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var D9=(e,t)=>{let n=y9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var P9=(e,t)=>{let n=wae(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Wm=h(w(),1),kae=Object.defineProperty,Pu=(e,t)=>kae(e,"name",{value:t,configurable:!0});var O9={Partial:"partial",Always:"always"},_9={Optimized:"optimized",Always:"always"},z9="Popper",[I9,xi]=Wt(z9),[Sae,L9]=I9(z9),Ou=Pu((e)=>{let{__scopePopper:t,children:n}=e,[o,r]=Br.useState(null),[a,i]=Br.useState(void 0);return Wm.jsx(Sae,{scope:t,anchor:o,onAnchorChange:r,placementState:a,setPlacementState:i,children:n})},"Popper"),Cae="PopperAnchor",Ql=Br.forwardRef(Pu(function(t,n){let{__scopePopper:o,virtualRef:r,...a}=t,i=L9(Cae,o),s=Br.useRef(null),l=i.onAnchorChange,c=Br.useCallback((m)=>{if(s.current=m,m)l(m)},[l]),d=ke(n,c),u=Br.useRef(null);Br.useEffect(()=>{if(!r)return;let m=u.current;if(u.current=r.current,m!==u.current)l(u.current)});let p=i.placementState&&J0(i.placementState),f=p?.[0],g=p?.[1];return r?null:Wm.jsx(fe.div,{"data-radix-popper-side":f,"data-radix-popper-align":g,...a,ref:d})},"PopperAnchor")),B9="PopperContent",[Nae,v1e]=I9(B9),_u=Br.forwardRef(Pu(function(t,n){let{__scopePopper:o,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:p=O9.Partial,hideWhenDetached:f=!1,updatePositionStrategy:g=_9.Optimized,onPlaced:m,...y}=t,b=L9(B9,o),[x,v]=Br.useState(null),k=ke(n,v),[S,N]=Br.useState(null),R=fp(S),A=R?.width??0,D=R?.height??0,E=r+(i!=="center"?"-"+i:""),z=typeof u==="number"?u:{top:0,right:0,bottom:0,left:0,...u},B=Array.isArray(d)?d:[d],Z=B.length>0,ee={padding:z,boundary:B.filter(H9),altBoundary:Z},{refs:xe,floatingStyles:V,placement:ye,isPositioned:ae,middlewareData:ge}=N9({strategy:"fixed",placement:E,whileElementsMounted:Pu((...ne)=>dE(...ne,{animationFrame:g===_9.Always}),"whileElementsMounted"),elements:{reference:b.anchor},middleware:[R9({mainAxis:a+D,alignmentAxis:s}),c&&T9({mainAxis:!0,crossAxis:!1,...p===O9.Partial?{limiter:E9()}:{},...ee}),c&&A9({...ee}),M9({...ee,apply:Pu(({elements:ne,rects:be,availableWidth:Et,availableHeight:pt})=>{let{width:ze,height:qe}=be.reference,rt=ne.floating.style;rt.setProperty("--radix-popper-available-width",`${Et}px`),rt.setProperty("--radix-popper-available-height",`${pt}px`),rt.setProperty("--radix-popper-anchor-width",`${ze}px`),rt.setProperty("--radix-popper-anchor-height",`${qe}px`)},"apply")}),S&&P9({element:S,padding:l}),Rae({arrowWidth:A,arrowHeight:D}),f&&D9(Z?{strategy:"referenceHidden",...ee}:{strategy:"referenceHidden",padding:ee.padding,altBoundary:ee.altBoundary})]}),P=b.setPlacementState;vt(()=>(P(ye),()=>{P(void 0)}),[ye,P]);let[Ae,j]=J0(ye),le=Ao(m);vt(()=>{if(ae)le?.()},[ae,le]);let te=ge.arrow?.x,F=ge.arrow?.y,H=ge.arrow?.centerOffset!==0,[he,Ye]=Br.useState();return vt(()=>{if(x)Ye(window.getComputedStyle(x).zIndex)},[x]),Wm.jsx("div",{ref:xe.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:ae?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[ge.transformOrigin?.x,ge.transformOrigin?.y].join(" "),...ge.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:Wm.jsx(Nae,{scope:o,placedSide:Ae,placedAlign:j,onArrowChange:N,arrowX:te,arrowY:F,shouldHideArrow:H,children:Wm.jsx(fe.div,{"data-side":Ae,"data-align":j,...y,ref:k,style:{...y.style,animation:!ae?"none":y.style?.animation}})})})},"PopperContent"));function H9(e){return e!==null}Pu(H9,"isNotNull");var Rae=Pu((e)=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:o,middlewareData:r}=t,i=r.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[c,d]=J0(n),u={start:"0%",center:"50%",end:"100%"}[d],p=(r.arrow?.x??0)+s/2,f=(r.arrow?.y??0)+l/2,g="",m="";if(c==="bottom")g=i?u:`${p}px`,m=`${-l}px`;else if(c==="top")g=i?u:`${p}px`,m=`${o.floating.height+l}px`;else if(c==="right")g=`${-l}px`,m=i?u:`${f}px`;else if(c==="left")g=`${o.floating.width+l}px`,m=i?u:`${f}px`;return{data:{x:g,y:m}}}}),"transformOrigin");function J0(e){let[t,n="center"]=e.split("-");return[t,n]}Pu(J0,"getSideAndAlignFromPlacement");var nr=h(I(),1);var Eae=h(I(),1),t1=h(I(),1),Tae=Object.defineProperty,hE=(e,t)=>Tae(e,"name",{value:t,configurable:!0}),gE=!1;function j9(){let[e,t]=t1.useState(gE);return t1.useEffect(()=>{if(!gE)gE=!0,t(!0)},[]),e}hE(j9,"useIsHydrated");var U9=Eae[" useSyncExternalStore ".trim().toString()];function G9(){return()=>{}}hE(G9,"subscribe");function F9(){return U9(G9,()=>!0,()=>!1)}hE(F9,"useIsHydratedModern");var V9=typeof U9==="function"?F9:j9;var zu=h(w(),1),Aae=Object.defineProperty,wp=(e,t)=>Aae(e,"name",{value:t,configurable:!0}),bE="rovingFocusGroup.onEntryFocus",Mae={bubbles:!1,cancelable:!0},n1="RovingFocusGroup",[vE,q9,Dae]=mp(n1),[Pae,Xm]=Wt(n1,[Dae]),K9={Vertical:"vertical",Horizontal:"horizontal"},Oae={LTR:"ltr",RTL:"rtl"},[_ae,zae]=Pae(n1),o1=nr.forwardRef(wp(function(t,n){return zu.jsx(vE.Provider,{scope:t.__scopeRovingFocusGroup,children:zu.jsx(vE.Slot,{scope:t.__scopeRovingFocusGroup,children:zu.jsx(Iae,{...t,ref:n})})})},"RovingFocusGroup")),Iae=nr.forwardRef(wp(function(t,n){let{__scopeRovingFocusGroup:o,orientation:r,loop:a=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...p}=t,f=nr.useRef(null),g=ke(n,f),m=Yl(i),[y,b]=Yn({prop:s,defaultProp:l??null,onChange:c,caller:n1}),[x,v]=nr.useState(!1),k=Ao(d),S=q9(o),N=nr.useRef(!1),[R,A]=nr.useState(0);return nr.useEffect(()=>{let D=f.current;if(D)return D.addEventListener(bE,k),()=>D.removeEventListener(bE,k)},[k]),zu.jsx(_ae,{scope:o,orientation:r,dir:m,loop:a,currentTabStopId:y,onItemFocus:nr.useCallback((D)=>b(D),[b]),onItemShiftTab:nr.useCallback(()=>v(!0),[]),onFocusableItemAdd:nr.useCallback(()=>A((D)=>D+1),[]),onFocusableItemRemove:nr.useCallback(()=>A((D)=>D-1),[]),children:zu.jsx(fe.div,{tabIndex:x||R===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{N.current=!0}),onFocus:J(t.onFocus,(D)=>{let E=!N.current;if(D.target===D.currentTarget&&E&&!x){let z=new CustomEvent(bE,Mae);if(D.currentTarget.dispatchEvent(z),!z.defaultPrevented){let B=S().filter((ye)=>ye.focusable),Z=B.find((ye)=>ye.active),ee=B.find((ye)=>ye.id===y),V=[Z,ee,...B].filter(Boolean).map((ye)=>ye.ref.current);yE(V,u)}}N.current=!1}),onBlur:J(t.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),Lae="RovingFocusGroupItem",r1=nr.forwardRef(wp(function(t,n){let{__scopeRovingFocusGroup:o,focusable:r=!0,active:a=!1,tabStopId:i,children:s,...l}=t,c=Jt(),d=i||c,u=zae(Lae,o),p=u.currentTabStopId===d,f=q9(o),{onFocusableItemAdd:g,onFocusableItemRemove:m,currentTabStopId:y}=u,b=V9();return vt(()=>{if(!b||!r)return;return g(),()=>m()},[b,r,g,m]),nr.useEffect(()=>{if(b||!r)return;return g(),()=>m()},[b,r,g,m]),zu.jsx(vE.ItemSlot,{scope:o,id:d,focusable:r,active:a,children:zu.jsx(fe.span,{tabIndex:p?0:-1,"data-orientation":u.orientation,...l,ref:n,onMouseDown:J(t.onMouseDown,(x)=>{if(!r)x.preventDefault();else u.onItemFocus(d)}),onFocus:J(t.onFocus,()=>u.onItemFocus(d)),onKeyDown:J(t.onKeyDown,(x)=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;let v=Y9(x,u.orientation,u.dir);if(v!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=f().filter((N)=>N.focusable).map((N)=>N.ref.current);if(v==="last")S.reverse();else if(v==="prev"||v==="next"){if(v==="prev")S.reverse();let N=S.indexOf(x.currentTarget);S=u.loop?W9(S,N+1):S.slice(N+1)}setTimeout(()=>yE(S))}}),children:typeof s==="function"?s({isCurrentTabStop:p,hasTabStop:y!=null}):s})})},"RovingFocusGroupItem")),Bae={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $9(e,t){if(t!==Oae.RTL)return e;return e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}wp($9,"getDirectionAwareKey");function Y9(e,t,n){let o=$9(e.key,n);if(t===K9.Vertical&&["ArrowLeft","ArrowRight"].includes(o))return;if(t===K9.Horizontal&&["ArrowUp","ArrowDown"].includes(o))return;return Bae[o]}wp(Y9,"getFocusIntent");function yE(e,t=!1){let n=document.activeElement;for(let o of e){if(o===n)return;if(o.focus({preventScroll:t}),document.activeElement!==n)return}}wp(yE,"focusFirst");function W9(e,t){return e.map((n,o)=>e[(t+o)%e.length])}wp(W9,"wrapArray");var xt=h(w(),1),Hae=Object.defineProperty,Gt=(e,t)=>Hae(e,"name",{value:t,configurable:!0});var xE=["Enter"," "],jae=["ArrowDown","PageUp","Home"],Z9=["ArrowUp","PageDown","End"],Uae=[...jae,...Z9],Y1e={ltr:[...xE,"ArrowRight"],rtl:[...xE,"ArrowLeft"]};var i1="Menu",[wE,Gae,Fae]=mp(i1),[kp,CE]=Wt(i1,[Fae,xi,Xm]),NE=xi(),J9=Xm(),[Vae,Qb]=kp(i1),[Kae,RE]=kp(i1),ej=Gt((e)=>{let{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:a,modal:i=!0}=e,s=NE(t),[l,c]=Le.useState(null),d=Le.useRef(!1),u=Ao(a),p=Yl(r);return Le.useEffect(()=>{let f=Gt(()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=Gt(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),Le.useEffect(()=>{if(!n)return;let f=Gt(()=>u(!1),"handleBlur");return window.addEventListener("blur",f),()=>window.removeEventListener("blur",f)},[n,u]),xt.jsx(Ou,{...s,children:xt.jsx(Vae,{scope:t,open:n,onOpenChange:u,content:l,onContentChange:c,children:xt.jsx(Kae,{scope:t,onClose:Le.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:p,modal:i,children:o})})})},"Menu"),tj=Le.forwardRef(Gt(function(t,n){let{__scopeMenu:o,...r}=t,a=NE(o);return xt.jsx(Ql,{...a,...r,ref:n})},"MenuAnchor")),nj="MenuPortal",[qae,$ae]=kp(nj,{forceMount:void 0}),oj=Gt((e)=>{let{__scopeMenu:t,forceMount:n,children:o,container:r}=e,a=Qb(nj,t);return xt.jsx(qae,{scope:t,forceMount:n,children:xt.jsx(Rr,{present:n||a.open,children:xt.jsx(qs,{asChild:!0,container:r,children:o})})})},"MenuPortal"),Iu="MenuContent",[Yae,rj]=kp(Iu),aj=Le.forwardRef(Gt(function(t,n){let o=$ae(Iu,t.__scopeMenu),{forceMount:r=o.forceMount,...a}=t,i=Qb(Iu,t.__scopeMenu),s=RE(Iu,t.__scopeMenu);return xt.jsx(wE.Provider,{scope:t.__scopeMenu,children:xt.jsx(Rr,{present:r||i.open,children:xt.jsx(wE.Slot,{scope:t.__scopeMenu,children:s.modal?xt.jsx(Wae,{...a,ref:n}):xt.jsx(Xae,{...a,ref:n})})})})},"MenuContent")),Wae=Le.forwardRef(Gt(function(t,n){let o=Qb(Iu,t.__scopeMenu),r=Le.useRef(null),a=ke(n,r);return Le.useEffect(()=>{let i=r.current;if(i)return Au(i)},[]),xt.jsx(ij,{...t,ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,(i)=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),Xae=Le.forwardRef(Gt(function(t,n){let o=Qb(Iu,t.__scopeMenu);return xt.jsx(ij,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),Qae=er("MenuContent.ScrollLock"),ij=Le.forwardRef(Gt(function(t,n){let{__scopeMenu:o,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:f,onDismiss:g,disableOutsideScroll:m,...y}=t,b=Qb(Iu,o),x=RE(Iu,o),v=NE(o),k=J9(o),S=Gae(o),[N,R]=Le.useState(null),A=Le.useRef(null),[D,E]=Le.useState(null);ip(D);let{nodes:z,registry:B}=ap(),Z=Boolean(a||m),ee=ke(n,A,b.onContentChange,E),xe=Le.useRef(0),V=Le.useRef(""),ye=Le.useRef(0),ae=Le.useRef(null),ge=Le.useRef("right"),P=Le.useRef(0),Ae=Le.useMemo(()=>m?[A,...z.map((H)=>({current:H}))]:[],[A,z,m]),j=m?Vl:Le.Fragment,le=m?{as:Qae,allowPinchZoom:!0,shards:Ae}:void 0,te=Gt((H)=>{let he=V.current+H,Ye=S().filter((rt)=>!rt.disabled),ne=document.activeElement,be=Ye.find((rt)=>rt.ref.current===ne)?.textValue,Et=Ye.map((rt)=>rt.textValue),pt=bj(Et,he,be),ze=Ye.find((rt)=>rt.textValue===pt)?.ref.current;function qe(rt){if(V.current=rt,window.clearTimeout(xe.current),rt!=="")xe.current=window.setTimeout(()=>qe(""),1000)}if(Gt(qe,"updateSearch"),qe(he),ze)setTimeout(()=>ze.focus())},"handleTypeaheadSearch");Le.useEffect(()=>()=>window.clearTimeout(xe.current),[]),$s();let F=Le.useCallback((H)=>ge.current===ae.current?.side&&yj(H,ae.current?.area),[]);return xt.jsx(Yae,{scope:o,searchRef:V,onItemEnter:Le.useCallback((H)=>{if(F(H))H.preventDefault()},[F]),onItemLeave:Le.useCallback((H)=>{if(F(H))return;A.current?.focus(),R(null)},[F]),onTriggerLeave:Le.useCallback((H)=>{if(F(H))H.preventDefault()},[F]),pointerGraceTimerRef:ye,onPointerGraceIntentChange:Le.useCallback((H)=>{ae.current=H},[]),children:xt.jsx(rp,{registry:Z?B:null,children:xt.jsx(j,{...le,children:xt.jsx(Eu,{asChild:!0,trapped:a,branches:z,onMountAutoFocus:J(i,(H)=>{H.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:xt.jsx(Ks,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:f,onDismiss:g,children:xt.jsx(o1,{asChild:!0,...k,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:R,onEntryFocus:J(c,(H)=>{if(!x.isUsingKeyboardRef.current)H.preventDefault()}),preventScrollOnEntryFocus:!0,children:xt.jsx(_u,{role:"menu","aria-orientation":"vertical","data-state":pj(b.open),"data-radix-menu-content":"",dir:x.dir,...v,...y,ref:ee,style:{outline:"none",...y.style},onKeyDown:J(y.onKeyDown,(H)=>{let Ye=H.target.closest("[data-radix-menu-content]")===H.currentTarget,ne=H.ctrlKey||H.altKey||H.metaKey,be=H.key.length===1;if(Ye){if(H.key==="Tab")H.preventDefault();if(!ne&&be)te(H.key)}let Et=A.current;if(H.target!==Et)return;if(!Uae.includes(H.key))return;H.preventDefault();let ze=S().filter((qe)=>!qe.disabled).map((qe)=>qe.ref.current);if(Z9.includes(H.key))ze.reverse();gj(ze)}),onBlur:J(t.onBlur,(H)=>{if(!H.currentTarget.contains(H.target))window.clearTimeout(xe.current),V.current=""}),onPointerMove:J(t.onPointerMove,a1((H)=>{let he=H.target,Ye=P.current!==H.clientX;if(H.currentTarget.contains(he)&&Ye){let ne=H.clientX>P.current?"right":"left";ge.current=ne,P.current=H.clientX}}))})})})})})})})},"MenuContentImpl")),sj=Le.forwardRef(Gt(function(t,n){let{__scopeMenu:o,...r}=t;return xt.jsx(fe.div,{role:"group",...r,ref:n})},"MenuGroup")),lj=Le.forwardRef(Gt(function(t,n){let{__scopeMenu:o,...r}=t;return xt.jsx(fe.div,{...r,ref:n})},"MenuLabel")),kE="MenuItem",Q9="menu.itemSelect",TE=Le.forwardRef(Gt(function(t,n){let{disabled:o=!1,onSelect:r,...a}=t,i=Le.useRef(null),s=RE(kE,t.__scopeMenu),l=rj(kE,t.__scopeMenu),c=ke(n,i),d=Le.useRef(!1),u=Gt(()=>{let p=i.current;if(!o&&p){let f=new CustomEvent(Q9,{bubbles:!0,cancelable:!0});if(p.addEventListener(Q9,(g)=>r?.(g),{once:!0}),Bb(p,f),f.defaultPrevented)d.current=!1;else s.onClose()}},"handleSelect");return xt.jsx(Zae,{...a,ref:c,disabled:o,onClick:J(t.onClick,u),onPointerDown:(p)=>{t.onPointerDown?.(p),d.current=!0},onPointerUp:J(t.onPointerUp,(p)=>{if(!d.current)p.currentTarget?.click()}),onKeyDown:J(t.onKeyDown,(p)=>{if(o||p.target!==p.currentTarget)return;if(l.searchRef.current!==""&&p.key===" ")return;if(xE.includes(p.key))p.currentTarget.click(),p.preventDefault()})})},"MenuItem")),Zae=Le.forwardRef(Gt(function(t,n){let{__scopeMenu:o,disabled:r=!1,textValue:a,...i}=t,s=rj(kE,o),l=J9(o),c=Le.useRef(null),d=ke(n,c),[u,p]=Le.useState(!1),[f,g]=Le.useState("");return Le.useEffect(()=>{let m=c.current;if(m)g((m.textContent??"").trim())},[i.children]),xt.jsx(wE.ItemSlot,{scope:o,disabled:r,textValue:a??f,children:xt.jsx(r1,{asChild:!0,...l,focusable:!r,children:xt.jsx(fe.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:J(t.onPointerMove,a1((m)=>{if(r)s.onItemLeave(m);else if(s.onItemEnter(m),!m.defaultPrevented)m.currentTarget.focus({preventScroll:!0})})),onPointerLeave:J(t.onPointerLeave,a1((m)=>s.onItemLeave(m))),onFocus:J(t.onFocus,()=>p(!0)),onBlur:J(t.onBlur,()=>p(!1))})})})},"MenuItemImpl"));var Jae="MenuRadioGroup",[eie,tie]=kp(Jae,{value:void 0,onValueChange:Gt(()=>{},"onValueChange")}),cj=Le.forwardRef(Gt(function(t,n){let{value:o,onValueChange:r,...a}=t,i=Ao(r);return xt.jsx(eie,{scope:t.__scopeMenu,value:o,onValueChange:i,children:xt.jsx(sj,{...a,ref:n})})},"MenuRadioGroup")),nie="MenuRadioItem",uj=Le.forwardRef(Gt(function(t,n){let{value:o,...r}=t,a=tie(nie,t.__scopeMenu),i=o===a.value;return xt.jsx(rie,{scope:t.__scopeMenu,checked:i,children:xt.jsx(TE,{role:"menuitemradio","aria-checked":i,...r,ref:n,"data-state":mj(i),onSelect:J(r.onSelect,()=>a.onValueChange?.(o),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),oie="MenuItemIndicator",[rie,W1e]=kp(oie,{checked:!1});var dj=Le.forwardRef(Gt(function(t,n){let{__scopeMenu:o,...r}=t;return xt.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:n})},"MenuSeparator"));var aie="MenuSub",[X1e,Q1e]=kp(aie);function pj(e){return e?"open":"closed"}Gt(pj,"getOpenState");function fj(e){return e==="indeterminate"}Gt(fj,"isIndeterminate");function mj(e){return fj(e)?"indeterminate":e?"checked":"unchecked"}Gt(mj,"getCheckedState");function gj(e){let t=document.activeElement;for(let n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}Gt(gj,"focusFirst");function hj(e,t){return e.map((n,o)=>e[(t+o)%e.length])}Gt(hj,"wrapArray");function bj(e,t,n){let r=t.length>1&&Array.from(t).every((c)=>c===t[0])?t[0]:t,a=n?e.indexOf(n):-1,i=hj(e,Math.max(a,0));if(r.length===1)i=i.filter((c)=>c!==n);let l=i.find((c)=>c.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Gt(bj,"getNextMatch");function vj(e,t){let{x:n,y:o}=e,r=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){let s=t[a],l=t[i],{x:c,y:d}=s,{x:u,y:p}=l;if(d>o!==p>o&&n<(u-c)*(o-d)/(p-d)+c)r=!r}return r}Gt(vj,"isPointInPolygon");function yj(e,t){if(!t)return!1;let n={x:e.clientX,y:e.clientY};return vj(n,t)}Gt(yj,"isPointerInGraceArea");function a1(e){return(t)=>t.pointerType==="mouse"?e(t):void 0}Gt(a1,"whenMouse");var wi=h(w(),1),sie=Object.defineProperty,Zl=(e,t)=>sie(e,"name",{value:t,configurable:!0}),EE="DropdownMenu",[lie,dke]=Wt(EE,[CE]),Jl=CE(),[cie,xj]=lie(EE),uie=Zl((e)=>{let{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,l=Jl(t),c=Ua.useRef(null),[d,u]=Yn({prop:r,defaultProp:a??!1,onChange:i,caller:EE});return wi.jsx(cie,{scope:t,triggerId:Jt(),triggerRef:c,contentId:Jt(),open:d,onOpenChange:u,onOpenToggle:Ua.useCallback(()=>u((p)=>!p),[u]),modal:s,children:wi.jsx(ej,{...l,open:d,onOpenChange:u,dir:o,modal:s,children:n})})},"DropdownMenu"),die="DropdownMenuTrigger",pie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,disabled:r=!1,...a}=t,i=xj(die,o),s=Jl(o),l=ke(n,i.triggerRef);return wi.jsx(tj,{asChild:!0,...s,children:wi.jsx(fe.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:l,onPointerDown:J(t.onPointerDown,(c)=>{if(!r&&c.button===0&&c.ctrlKey===!1){if(i.onOpenToggle(),!i.open)c.preventDefault()}}),onKeyDown:J(t.onKeyDown,(c)=>{if(r)return;if(["Enter"," "].includes(c.key))i.onOpenToggle();if(c.key==="ArrowDown")i.onOpenChange(!0);if(["Enter"," ","ArrowDown"].includes(c.key))c.preventDefault()})})})},"DropdownMenuTrigger")),fie=Zl((e)=>{let{__scopeDropdownMenu:t,...n}=e,o=Jl(t);return wi.jsx(oj,{...o,...n})},"DropdownMenuPortal"),mie="DropdownMenuContent",gie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,...r}=t,a=xj(mie,o),i=Jl(o),s=Ua.useRef(!1);return wi.jsx(aj,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...r,ref:n,onCloseAutoFocus:J(t.onCloseAutoFocus,(l)=>{if(!s.current)a.triggerRef.current?.focus();s.current=!1,l.preventDefault()}),onInteractOutside:J(t.onInteractOutside,(l)=>{let c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,u=c.button===2||d;if(!a.modal||u)s.current=!0}),style:{...t.style,...{"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})},"DropdownMenuContent"));var hie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,...r}=t,a=Jl(o);return wi.jsx(lj,{...a,...r,ref:n})},"DropdownMenuLabel")),bie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,...r}=t,a=Jl(o);return wi.jsx(TE,{...a,...r,ref:n})},"DropdownMenuItem"));var vie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,...r}=t,a=Jl(o);return wi.jsx(cj,{...a,...r,ref:n})},"DropdownMenuRadioGroup")),yie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,...r}=t,a=Jl(o);return wi.jsx(uj,{...a,...r,ref:n})},"DropdownMenuRadioItem"));var xie=Ua.forwardRef(Zl(function(t,n){let{__scopeDropdownMenu:o,...r}=t,a=Jl(o);return wi.jsx(dj,{...a,...r,ref:n})},"DropdownMenuSeparator"));var kj=h(I(),1);var Sj=h(w(),1),wie=Object.defineProperty,kie=(e,t)=>wie(e,"name",{value:t,configurable:!0}),Sie=kj.forwardRef(kie(function(t,n){return Sj.jsx(fe.label,{...t,ref:n,onMouseDown:(o)=>{if(o.target.closest("button, input, select, textarea"))return;if(t.onMouseDown?.(o),!o.defaultPrevented&&o.detail>1)o.preventDefault()}})},"Label"));var sn=h(I(),1);var Oo=h(w(),1),Cie=Object.defineProperty,Zs=(e,t)=>Cie(e,"name",{value:t,configurable:!0}),AE="Popover",[Nj,Eke]=Wt(AE,[xi]),s1=xi(),[Nie,Sp]=Nj(AE),Rie=Zs((e)=>{let{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:a,modal:i=!1}=e,s=s1(t),l=sn.useRef(null),[c,d]=sn.useState(!1),[u,p]=sn.useState(0),[f,g]=sn.useState(0),[m,y]=Yn({prop:o,defaultProp:r??!1,onChange:a,caller:AE});return Oo.jsx(Ou,{...s,children:Oo.jsx(Nie,{scope:t,contentId:Jt(),titleId:Jt(),descriptionId:Jt(),titlePresent:u>0,descriptionPresent:f>0,setTitleCount:p,setDescriptionCount:g,triggerRef:l,open:m,onOpenChange:y,onOpenToggle:sn.useCallback(()=>y((b)=>!b),[y]),hasCustomAnchor:c,onCustomAnchorAdd:sn.useCallback(()=>d(!0),[]),onCustomAnchorRemove:sn.useCallback(()=>d(!1),[]),modal:i,children:n})})},"Popover"),Tie="PopoverAnchor",Eie=sn.forwardRef(Zs(function(t,n){let{__scopePopover:o,...r}=t,a=Sp(Tie,o),i=s1(o),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=a;return sn.useEffect(()=>(s(),()=>l()),[s,l]),Oo.jsx(Ql,{...i,...r,ref:n})},"PopoverAnchor")),Aie="PopoverTrigger",Mie=sn.forwardRef(Zs(function(t,n){let{__scopePopover:o,...r}=t,a=Sp(Aie,o),i=s1(o),s=ke(n,a.triggerRef),l=Oo.jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":ME(a.open),...r,ref:s,onClick:J(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:Oo.jsx(Ql,{asChild:!0,...i,children:l})},"PopoverTrigger")),Rj="PopoverPortal",[Die,Pie]=Nj(Rj,{forceMount:void 0}),Oie=Zs((e)=>{let{__scopePopover:t,forceMount:n,children:o,container:r}=e,a=Sp(Rj,t);return Oo.jsx(Die,{scope:t,forceMount:n,children:Oo.jsx(Rr,{present:n||a.open,children:Oo.jsx(qs,{asChild:!0,container:r,children:o})})})},"PopoverPortal"),Zb="PopoverContent",_ie=sn.forwardRef(Zs(function(t,n){let o=Pie(Zb,t.__scopePopover),{forceMount:r=o.forceMount,...a}=t,i=Sp(Zb,t.__scopePopover);return Oo.jsx(Rr,{present:r||i.open,children:i.modal?Oo.jsx(Iie,{...a,ref:n}):Oo.jsx(Lie,{...a,ref:n})})},"PopoverContent")),zie=er("PopoverContent.RemoveScroll"),Iie=sn.forwardRef(Zs(function(t,n){let o=Sp(Zb,t.__scopePopover),r=sn.useRef(null),a=ke(n,r),i=sn.useRef(!1),{nodes:s,registry:l}=ap();return sn.useEffect(()=>{let c=r.current;if(c)return Au(c)},[]),Oo.jsx(Vl,{as:zie,allowPinchZoom:!0,shards:sn.useMemo(()=>[r,...s.map((c)=>({current:c}))],[r,s]),children:Oo.jsx(Tj,{...t,ref:a,branchNodes:s,branchRegistry:l,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,(c)=>{if(c.preventDefault(),!i.current)o.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,(c)=>{let d=c.detail.originalEvent,u=d.button===0&&d.ctrlKey===!0,p=d.button===2||u;i.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,(c)=>c.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Lie=sn.forwardRef(Zs(function(t,n){let o=Sp(Zb,t.__scopePopover),r=sn.useRef(!1),a=sn.useRef(!1);return Oo.jsx(Tj,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(i)=>{if(t.onCloseAutoFocus?.(i),!i.defaultPrevented){if(!r.current)o.triggerRef.current?.focus();i.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:(i)=>{if(t.onInteractOutside?.(i),!i.defaultPrevented){if(r.current=!0,i.detail.originalEvent.type==="pointerdown")a.current=!0}let s=i.target;if(o.triggerRef.current?.contains(s))i.preventDefault();if(i.detail.originalEvent.type==="focusin"&&a.current)i.preventDefault()}})},"PopoverContentNonModal")),Tj=sn.forwardRef(Zs(function(t,n){let{__scopePopover:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,"aria-describedby":p,branchNodes:f,branchRegistry:g,...m}=t,y=Sp(Zb,o),b=s1(o),[x,v]=sn.useState(null),k=ke(n,v);return ip(x),$s(),Oo.jsx(rp,{registry:g,children:Oo.jsx(Eu,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:a,onUnmountAutoFocus:i,children:Oo.jsx(Ks,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>y.onOpenChange(!1),deferPointerDownOutside:!0,children:Oo.jsx(_u,{"data-state":ME(y.open),role:"dialog",id:y.contentId,"aria-labelledby":y.titlePresent?y.titleId:void 0,"aria-describedby":y.descriptionPresent?Ej(p,y.descriptionId):p,...b,...m,ref:k,style:{...m.style,...{"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}})})})})},"PopoverContentImpl"));function ME(e){return e?"open":"closed"}Zs(ME,"getState");function Ej(...e){let t=new Set;for(let n of e){if(typeof n!=="string")continue;for(let o of String(n).trim().split(/\s+/))if(o)t.add(o)}return t.size>0?Array.from(t).join(" "):void 0}Zs(Ej,"concatAriaDescribedby");var re=h(I(),1),OE=h(Za(),1);var Bie=Object.defineProperty,Hie=(e,t)=>Bie(e,"name",{value:t,configurable:!0});function l1(e,[t,n]){return Math.min(n,Math.max(t,e))}Hie(l1,"clamp");var Mj=h(I(),1);var Dj=h(w(),1),jie=Object.defineProperty,Uie=(e,t)=>jie(e,"name",{value:t,configurable:!0}),DE=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Pj=Mj.forwardRef(Uie(function(t,n){return Dj.jsx(fe.span,{...t,ref:n,style:{...DE,...t.style}})},"VisuallyHidden"));var He=h(w(),1),Fie=Object.defineProperty,Xt=(e,t)=>Fie(e,"name",{value:t,configurable:!0}),Oj={ItemAligned:"item-aligned",Popper:"popper"},Vie={LTR:"ltr",RTL:"rtl"},Kie=[" ","Enter","ArrowUp","ArrowDown"],qie=[" ","Enter"],Qm="Select",[u1,_E,$ie]=mp(Qm),[Np,Zke]=Wt(Qm,[$ie,xi]),zE=xi(),[Yie,Lu]=Np(Qm),[Wie,Xie]=Np(Qm);function Ij(e){let{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:a,value:i,defaultValue:s,onValueChange:l,dir:c,name:d,autoComplete:u,disabled:p,required:f,form:g,internal_do_not_use_render:m}=e,y=zE(t),[b,x]=re.useState(null),[v,k]=re.useState(null),[S,N]=re.useState(!1),R=Yl(c),[A,D]=Yn({prop:o,defaultProp:r??!1,onChange:a,caller:Qm}),[E,z]=Yn({prop:i,defaultProp:s,onChange:l,caller:Qm}),B=re.useRef(null),Z=re.useRef(!1),[ee,xe]=re.useState(null),V=Xt((H)=>{xe({value:H,hasConsumerStoppedPropagation:Z.current}),z(H)},"handleUserSelect"),ye=re.useRef(E);re.useEffect(()=>{let H=g?b?.ownerDocument.getElementById(g):b?.form;if(H instanceof HTMLFormElement){let he=Xt(()=>z(ye.current),"reset");return H.addEventListener("reset",he),()=>H.removeEventListener("reset",he)}},[g,b,z]);let ae=b?!!g||!!b.closest("form"):!0,[ge,P]=re.useState(new Set),Ae=Jt(),j=Array.from(ge).map((H)=>H.props.value).join(";"),le=re.useCallback((H)=>{P((he)=>new Set(he).add(H))},[]),te=re.useCallback((H)=>{P((he)=>{let Ye=new Set(he);return Ye.delete(H),Ye})},[]),F={required:f,trigger:b,onTriggerChange:x,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:N,contentId:Ae,value:E,onValueChange:z,hasConsumerStoppedPropagationRef:Z,userSelection:ee,onUserSelect:V,open:A,onOpenChange:D,dir:R,triggerPointerDownPosRef:B,disabled:p,name:d,autoComplete:u,form:g,nativeOptions:ge,nativeSelectKey:j,isFormControl:ae};return He.jsx(Ou,{...y,children:He.jsx(Yie,{scope:t,...F,children:He.jsx(u1.Provider,{scope:t,children:He.jsx(Wie,{scope:t,onNativeOptionAdd:le,onNativeOptionRemove:te,children:Hj(m)?m(F):n})})})})}Xt(Ij,"SelectProvider");var Qie=Xt((e)=>{let{__scopeSelect:t,children:n,...o}=e;return He.jsx(Ij,{__scopeSelect:t,...o,internal_do_not_use_render:({isFormControl:r})=>He.jsxs(He.Fragment,{children:[n,r?He.jsx(kse,{__scopeSelect:t}):null]})})},"Select"),Zie="SelectTrigger",Jie=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,disabled:r=!1,...a}=t,i=zE(o),s=Lu(Zie,o),l=s.disabled||r,c=ke(n,s.onTriggerChange),d=_E(o),u=re.useRef("touch"),[p,f,g]=IE((y)=>{let b=d().filter((k)=>!k.disabled),x=b.find((k)=>k.value===s.value),v=LE(b,y,x);if(v!==void 0)s.onUserSelect(v.value)}),m=Xt((y)=>{if(!l)s.onOpenChange(!0),g();if(y)s.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)}},"handleOpen");return He.jsx(Ql,{asChild:!0,...i,children:He.jsx(fe.button,{type:"button",role:"combobox","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Jb(s.value)?"":void 0,...a,ref:c,onClick:J(a.onClick,(y)=>{if(y.currentTarget.focus(),u.current!=="mouse")m(y)}),onPointerDown:J(a.onPointerDown,(y)=>{u.current=y.pointerType;let b=y.target;if(b.hasPointerCapture(y.pointerId))b.releasePointerCapture(y.pointerId);if(y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse")m(y),y.preventDefault()}),onKeyDown:J(a.onKeyDown,(y)=>{let b=p.current!=="";if(!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1)s.hasConsumerStoppedPropagationRef.current=y.isPropagationStopped(),f(y.key);if(b&&y.key===" ")return;if(Kie.includes(y.key))m(),y.preventDefault()})})})},"SelectTrigger")),ese="SelectValue",tse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,className:r,style:a,children:i,placeholder:s="",...l}=t,c=Lu(ese,o),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,p=ke(n,c.onValueNodeChange);vt(()=>{d(u)},[d,u]);let f=Jb(c.value);return He.jsx(fe.span,{...l,asChild:f?!1:l.asChild,ref:p,style:{pointerEvents:"none"},children:He.jsx(re.Fragment,{children:f?s:i},f?"placeholder":"value")})},"SelectValue")),nse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,children:r,...a}=t;return He.jsx(fe.span,{"aria-hidden":!0,...a,ref:n,children:r||"▼"})},"SelectIcon")),ose="SelectPortal",[rse,ase]=Np(ose,{forceMount:void 0}),ise=Xt((e)=>{let{__scopeSelect:t,forceMount:n,...o}=e;return He.jsx(rse,{scope:e.__scopeSelect,forceMount:n,children:He.jsx(qs,{asChild:!0,...o})})},"SelectPortal"),Cp="SelectContent",sse=re.forwardRef(Xt(function(t,n){let o=ase(Cp,t.__scopeSelect),{forceMount:r=o.forceMount,...a}=t,i=Lu(Cp,t.__scopeSelect),[s,l]=re.useState();return vt(()=>{l(new DocumentFragment)},[]),He.jsx(Rr,{present:r||i.open,children:({present:c})=>c?He.jsx(use,{...a,ref:n}):He.jsx(lse,{...a,fragment:s})})},"SelectContent")),lse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,children:r,fragment:a}=t;if(!a)return null;return OE.createPortal(He.jsx(Lj,{scope:o,children:He.jsx(u1.Slot,{scope:o,children:He.jsx("div",{ref:n,children:r})})}),a)},"SelectContentFragment")),ls=10,[Lj,d1]=Np(Cp),cse=er("SelectContent.RemoveScroll"),use=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o}=t,{position:r=Oj.ItemAligned,onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:f,collisionPadding:g,sticky:m,hideWhenDetached:y,avoidCollisions:b,...x}=t,v=Lu(Cp,o),[k,S]=re.useState(null),[N,R]=re.useState(null),A=ke(n,S),[D,E]=re.useState(null),[z,B]=re.useState(null),Z=_E(o),[ee,xe]=re.useState(!1),V=re.useRef(!1),ye=re.useRef(!1),ae=re.useRef(!1);re.useEffect(()=>{if(k)return Au(k)},[k]),$s();let ge=re.useCallback((be)=>{let[Et,...pt]=Z().map((rt)=>rt.ref.current),[ze]=pt.slice(-1),qe=document.activeElement;for(let rt of be){if(rt===qe)return;if(rt?.scrollIntoView({block:"nearest"}),rt===Et&&N)N.scrollTop=0;if(rt===ze&&N)N.scrollTop=N.scrollHeight;if(rt?.focus(),document.activeElement!==qe)return}},[Z,N]),P=re.useCallback(()=>ge([D,k]),[ge,D,k]);re.useEffect(()=>{if(ee)P()},[ee,P]);let{onOpenChange:Ae,triggerPointerDownPosRef:j}=v;re.useEffect(()=>{if(k){let be={x:0,y:0},Et=Xt((ze)=>{be={x:Math.abs(Math.round(ze.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(ze.pageY)-(j.current?.y??0))}},"handlePointerMove"),pt=Xt((ze)=>{if(be.x<=10&&be.y<=10)ze.preventDefault();else if(!ze.composedPath().includes(k))Ae(!1);document.removeEventListener("pointermove",Et),j.current=null},"handlePointerUp");if(j.current!==null)document.addEventListener("pointermove",Et),document.addEventListener("pointerup",pt,{capture:!0,once:!0});return()=>{document.removeEventListener("pointermove",Et),document.removeEventListener("pointerup",pt,{capture:!0})}}},[k,Ae,j]),re.useEffect(()=>{let be=Xt(()=>Ae(!1),"close");return window.addEventListener("blur",be),window.addEventListener("resize",be),()=>{window.removeEventListener("blur",be),window.removeEventListener("resize",be)}},[Ae]);let[le,te]=IE((be)=>{let Et=Z().filter((qe)=>!qe.disabled),pt=Et.find((qe)=>qe.ref.current===document.activeElement),ze=LE(Et,be,pt);if(ze)setTimeout(()=>ze.ref.current?.focus())}),F=re.useCallback((be,Et,pt)=>{let ze=!ye.current;if(ze)ye.current=!0;let qe=!V.current&&!pt;if(v.value!==void 0&&v.value===Et||qe){if(E(be),qe)V.current=!0}else if(ze)E(be)},[v.value]),H=re.useCallback(()=>k?.focus(),[k]),he=re.useCallback((be,Et,pt)=>{if(!be)return;let ze=!ae.current;if(ze)ae.current=!0;let qe=!V.current&&!pt;if(v.value!==void 0&&v.value===Et||qe)B(be);else if(ze)B(be)},[v.value]),Ye=r===Oj.Popper?_j:dse,ne=Ye===_j?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:f,collisionPadding:g,sticky:m,hideWhenDetached:y,avoidCollisions:b}:{};return He.jsx(Lj,{scope:o,content:k,viewport:N,onViewportChange:R,itemRefCallback:F,selectedItem:D,onItemLeave:H,itemTextRefCallback:he,focusSelectedItem:P,selectedItemText:z,position:r,isPositioned:ee,searchRef:le,children:He.jsx(Vl,{as:cse,allowPinchZoom:!0,children:He.jsx(Eu,{asChild:!0,trapped:v.open,onMountAutoFocus:(be)=>{be.preventDefault()},onUnmountAutoFocus:J(a,(be)=>{v.trigger?.focus({preventScroll:!0}),be.preventDefault()}),children:He.jsx(Ks,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:(be)=>be.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:He.jsx(Ye,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:(be)=>be.preventDefault(),...x,...ne,onPlaced:()=>xe(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:J(x.onKeyDown,(be)=>{let Et=be.ctrlKey||be.altKey||be.metaKey;if(be.key==="Tab")be.preventDefault();if(!Et&&be.key.length===1)te(be.key);if(["ArrowUp","ArrowDown","Home","End"].includes(be.key)){let ze=Z().filter((qe)=>!qe.disabled).map((qe)=>qe.ref.current);if(["ArrowUp","End"].includes(be.key))ze=ze.slice().reverse();if(["ArrowUp","ArrowDown"].includes(be.key)){let qe=be.target,rt=ze.indexOf(qe);ze=ze.slice(rt+1)}setTimeout(()=>ge(ze)),be.preventDefault()}})})})})})})},"SelectContentImpl")),dse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,onPlaced:r,...a}=t,i=Lu(Cp,o),s=d1(Cp,o),[l,c]=re.useState(null),[d,u]=re.useState(null),p=ke(n,u),f=_E(o),g=re.useRef(!1),m=re.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:x,focusSelectedItem:v}=s,k=re.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&y&&b&&x){let A=i.trigger.getBoundingClientRect(),D=d.getBoundingClientRect(),E=i.valueNode.getBoundingClientRect(),z=x.getBoundingClientRect();if(i.dir!==Vie.RTL){let pt=z.left-D.left,ze=E.left-pt,qe=A.left-ze,rt=A.width+qe,lf=Math.max(rt,D.width),pl=window.innerWidth-ls,cf=l1(ze,[ls,Math.max(ls,pl-lf)]);l.style.minWidth=rt+"px",l.style.left=cf+"px"}else{let pt=D.right-z.right,ze=window.innerWidth-E.right-pt,qe=window.innerWidth-A.right-ze,rt=A.width+qe,lf=Math.max(rt,D.width),pl=window.innerWidth-ls,cf=l1(ze,[ls,Math.max(ls,pl-lf)]);l.style.minWidth=rt+"px",l.style.right=cf+"px"}let B=f(),Z=window.innerHeight-ls*2,ee=y.scrollHeight,xe=window.getComputedStyle(d),V=parseInt(xe.borderTopWidth,10),ye=parseInt(xe.paddingTop,10),ae=parseInt(xe.borderBottomWidth,10),ge=parseInt(xe.paddingBottom,10),P=V+ye+ee+ge+ae,Ae=Math.min(b.offsetHeight*5,P),j=window.getComputedStyle(y),le=parseInt(j.paddingTop,10),te=parseInt(j.paddingBottom,10),F=A.top+A.height/2-ls,H=Z-F,he=b.offsetHeight/2,Ye=b.offsetTop+he,ne=V+ye+Ye,be=P-ne;if(ne<=F){let pt=B.length>0&&b===B[B.length-1].ref.current;l.style.bottom="0px";let ze=d.clientHeight-y.offsetTop-y.offsetHeight,qe=Math.max(H,he+(pt?te:0)+ze+ae),rt=ne+qe;l.style.height=rt+"px"}else{let pt=B.length>0&&b===B[0].ref.current;l.style.top="0px";let qe=Math.max(F,V+y.offsetTop+(pt?le:0)+he)+be;l.style.height=qe+"px",y.scrollTop=ne-F+y.offsetTop}l.style.margin=`${ls}px 0`,l.style.minHeight=Ae+"px",l.style.maxHeight=Z+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[f,i.trigger,i.valueNode,l,d,y,b,x,i.dir,r]);vt(()=>k(),[k]);let[S,N]=re.useState();vt(()=>{if(d)N(window.getComputedStyle(d).zIndex)},[d]);let R=re.useCallback((A)=>{if(A&&m.current===!0)k(),v?.(),m.current=!1},[k,v]);return He.jsx(pse,{scope:o,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:R,children:He.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:He.jsx(fe.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})},"SelectItemAlignedPosition")),_j=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,align:r="start",collisionPadding:a=ls,...i}=t,s=zE(o);return He.jsx(_u,{...s,...i,ref:n,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,...{"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}})},"SelectPopperPosition")),[pse,fse]=Np(Cp,{}),zj="SelectViewport",mse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,nonce:r,...a}=t,i=d1(zj,o),s=fse(zj,o),l=ke(n,i.onViewportChange),c=re.useRef(0);return He.jsxs(He.Fragment,{children:[He.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),He.jsx(u1.Slot,{scope:o,children:He.jsx(fe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:J(a.onScroll,(d)=>{let u=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=s;if(f?.current&&p){let g=Math.abs(c.current-u.scrollTop);if(g>0){let m=window.innerHeight-ls*2,y=parseFloat(p.style.minHeight),b=parseFloat(p.style.height),x=Math.max(y,b);if(x<m){let v=x+g,k=Math.min(m,v),S=v-k;if(p.style.height=k+"px",p.style.bottom==="0px")u.scrollTop=S>0?S:0,p.style.justifyContent="flex-end"}}}c.current=u.scrollTop})})})]})},"SelectViewport")),gse="SelectGroup",[Jke,eSe]=Np(gse);var PE="SelectItem",[hse,Bj]=Np(PE),bse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,value:r,disabled:a=!1,textValue:i,...s}=t,l=Lu(PE,o),c=d1(PE,o),d=l.value===r,[u,p]=re.useState(i??""),[f,g]=re.useState(!1),m=Ao((k)=>c.itemRefCallback?.(k,r,a)),y=ke(n,m),b=Jt(),x=re.useRef("touch");function v(k){l.hasConsumerStoppedPropagationRef.current=k.isPropagationStopped(),l.onUserSelect(r),l.onOpenChange(!1)}return Xt(v,"handleSelect"),He.jsx(hse,{scope:o,value:r,disabled:a,textId:b,isSelected:d,onItemTextChange:re.useCallback((k)=>{p((S)=>S||(k?.textContent??"").trim())},[]),children:He.jsx(u1.ItemSlot,{scope:o,value:r,disabled:a,textValue:u,children:He.jsx(fe.div,{role:"option","aria-labelledby":b,"data-highlighted":f?"":void 0,"aria-selected":d&&f,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:y,onFocus:J(s.onFocus,()=>g(!0)),onBlur:J(s.onBlur,()=>g(!1)),onClick:J(s.onClick,(k)=>{if(a)return;if(x.current!=="mouse")v(k)}),onPointerUp:J(s.onPointerUp,(k)=>{if(a)return;if(x.current==="mouse")v(k)}),onPointerDown:J(s.onPointerDown,(k)=>{x.current=k.pointerType}),onPointerMove:J(s.onPointerMove,(k)=>{if(x.current=k.pointerType,a)c.onItemLeave?.();else if(x.current==="mouse")k.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(s.onPointerLeave,(k)=>{if(k.currentTarget===document.activeElement)c.onItemLeave?.()}),onKeyDown:J(s.onKeyDown,(k)=>{if(a||k.target!==k.currentTarget)return;if(c.searchRef?.current!==""&&k.key===" ")return;if(qie.includes(k.key))v(k);if(k.key===" ")k.preventDefault()})})})})},"SelectItem")),c1="SelectItemText",vse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,className:r,style:a,...i}=t,s=Lu(c1,o),l=d1(c1,o),c=Bj(c1,o),d=Xie(c1,o),[u,p]=re.useState(null),f=Ao((v)=>l.itemTextRefCallback?.(v,c.value,c.disabled)),g=ke(n,p,c.onItemTextChange,f),m=u?.textContent,y=re.useMemo(()=>He.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return vt(()=>(b(y),()=>x(y)),[b,x,y]),He.jsxs(He.Fragment,{children:[He.jsx(fe.span,{id:c.textId,...i,ref:g}),c.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!Jb(s.value)?OE.createPortal(i.children,s.valueNode):null]})},"SelectItemText")),yse="SelectItemIndicator",xse=re.forwardRef(Xt(function(t,n){let{__scopeSelect:o,...r}=t;return Bj(yse,o).isSelected?He.jsx(fe.span,{"aria-hidden":!0,...r,ref:n}):null},"SelectItemIndicator"));var wse="SelectBubbleInput",kse=re.forwardRef(Xt(function({__scopeSelect:t,...n},o){let r=Lu(wse,t),{value:a,onValueChange:i,required:s,disabled:l,name:c,autoComplete:d,form:u,userSelection:p}=r,{nativeOptions:f,nativeSelectKey:g}=r,m=re.useRef(null),y=ke(o,m),b=a??"",x=re.useRef(b),v=re.useRef(p),k=re.useRef(!1),S=Array.from(f).some((N)=>(N.props.value??"")==="");return re.useEffect(()=>{let N=m.current;if(!N)return;let R=window.HTMLSelectElement.prototype,D=Object.getOwnPropertyDescriptor(R,"value").set,E=p!==null&&p!==v.current;v.current=p;let z=x.current!==b;x.current=b;let B=E&&z;if(E&&!z&&p.value!==b&&!p.hasConsumerStoppedPropagation&&D){k.current=!0;try{D.call(N,p.value),N.dispatchEvent(new Event("change",{bubbles:!0}))}finally{k.current=!1,D.call(N,b)}return}let Z=B&&!p.hasConsumerStoppedPropagation;if(z&&D){let ee=new Event("change",{bubbles:Z});D.call(N,b),N.dispatchEvent(ee)}},[b,p]),He.jsxs(fe.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:c,autoComplete:d,disabled:l,form:u,onChange:(N)=>{if(!k.current)i(N.target.value)},...n,style:{...DE,...n.style},ref:y,defaultValue:b,children:[Jb(a)&&!S?He.jsx("option",{value:""}):null,Array.from(f)]},g)},"SelectBubbleInput"));function Hj(e){return typeof e==="function"}Xt(Hj,"isFunction");function Jb(e){return e===""||e===void 0}Xt(Jb,"shouldShowPlaceholder");function IE(e){let t=Ao(e),n=re.useRef(""),o=re.useRef(0),r=re.useCallback((i)=>{let s=n.current+i;t(s);function l(c){if(n.current=c,window.clearTimeout(o.current),c!=="")o.current=window.setTimeout(()=>l(""),1000)}Xt(l,"updateSearch"),l(s)},[t]),a=re.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return re.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,a]}Xt(IE,"useTypeaheadSearch");function LE(e,t,n){let r=t.length>1&&Array.from(t).every((c)=>c===t[0])?t[0]:t,a=n?e.indexOf(n):-1,i=jj(e,Math.max(a,0));if(r.length===1)i=i.filter((c)=>c!==n);let l=i.find((c)=>c.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Xt(LE,"findNextItem");function jj(e,t){return e.map((n,o)=>e[(t+o)%e.length])}Xt(jj,"wrapArray");var _o=h(I(),1);var ki=h(w(),1),Sse=Object.defineProperty,Bu=(e,t)=>Sse(e,"name",{value:t,configurable:!0}),BE="Switch",[Cse,sSe]=Wt(BE),[Nse,HE]=Cse(BE);function Gj(e){let{__scopeSwitch:t,checked:n,children:o,defaultChecked:r,disabled:a,form:i,name:s,onCheckedChange:l,required:c,value:d="on",internal_do_not_use_render:u}=e,[p,f]=Yn({prop:n,defaultProp:r??!1,onChange:l,caller:BE}),[g,m]=_o.useState(null),[y,b]=_o.useState(null),[x,v]=_o.useState(null),k=g?!!i||!!g.closest("form"):!0,S={checked:p,setChecked:f,disabled:a,control:g,setControl:m,name:s,form:i,value:d,userClick:x,onUserClick:v,required:c,defaultChecked:r,isFormControl:k,bubbleInput:y,setBubbleInput:b};return ki.jsx(Nse,{scope:t,...S,children:Fj(u)?u(S):o})}Bu(Gj,"SwitchProvider");var Rse="SwitchTrigger",Tse=_o.forwardRef(Bu(function({__scopeSwitch:t,onClick:n,...o},r){let{control:a,form:i,value:s,disabled:l,checked:c,required:d,setControl:u,setChecked:p,onUserClick:f,isFormControl:g,bubbleInput:m}=HE(Rse,t),y=ke(r,u),b=_o.useRef(c);return _o.useEffect(()=>{let x=i?a?.ownerDocument.getElementById(i):a?.form;if(x instanceof HTMLFormElement){let v=Bu(()=>p(b.current),"reset");return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[a,i,p]),ki.jsx(fe.button,{type:"button",role:"switch","aria-checked":c,"aria-required":d,"data-state":jE(c),"data-disabled":l?"":void 0,disabled:l,value:s,...o,ref:y,onClick:J(n,(x)=>{let v=x.isPropagationStopped();if(f({requestedChecked:!c,hasConsumerStoppedPropagation:v}),p((k)=>!k),m&&g){if(!v)x.stopPropagation()}})})},"SwitchTrigger")),Ese=_o.forwardRef(Bu(function(t,n){let{__scopeSwitch:o,name:r,checked:a,defaultChecked:i,required:s,disabled:l,value:c,onCheckedChange:d,form:u,...p}=t;return ki.jsx(Gj,{__scopeSwitch:o,checked:a,defaultChecked:i,disabled:l,required:s,onCheckedChange:d,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:f})=>ki.jsxs(ki.Fragment,{children:[ki.jsx(Tse,{...p,ref:n,__scopeSwitch:o}),f&&ki.jsx(Pse,{__scopeSwitch:o})]})})},"Switch")),Ase="SwitchThumb",Mse=_o.forwardRef(Bu(function(t,n){let{__scopeSwitch:o,...r}=t,a=HE(Ase,o);return ki.jsx(fe.span,{"data-state":jE(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),Dse="SwitchBubbleInput",Pse=_o.forwardRef(Bu(function({__scopeSwitch:t,onClick:n,...o},r){let{control:a,userClick:i,checked:s,defaultChecked:l,required:c,disabled:d,name:u,value:p,form:f,bubbleInput:g,setBubbleInput:m}=HE(Dse,t),y=ke(r,m),b=fp(a),x=_o.useRef(!1),v=_o.useRef(s),k=_o.useRef(i),S=_o.useRef(null);_o.useEffect(()=>{let R=g;if(!R)return;let A=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(A,"checked").set;if(!E)return;let z=v.current!==s;v.current=s;let B=i!==null&&i!==k.current;if(k.current=i,B){if(S.current=z?null:i,z)E.call(R,s);R.dispatchEvent(new Event("click",{bubbles:!i.hasConsumerStoppedPropagation}))}else if(z){let Z=S.current;S.current=null;let ee=Z?.requestedChecked===s;x.current=!0,E.call(R,s),R.dispatchEvent(new Event("click",{bubbles:!(ee&&Z.hasConsumerStoppedPropagation)})),x.current=!1}},[g,s,i]);let N=_o.useRef(s);return ki.jsx(fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??N.current,required:c,disabled:d,name:u,value:p,form:f,...o,tabIndex:-1,ref:y,onClick:J(n,(R)=>{if(x.current)R.stopPropagation()}),style:{...o.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Fj(e){return typeof e==="function"}Bu(Fj,"isFunction");function jE(e){return e?"checked":"unchecked"}Bu(jE,"getState");var Zm=h(I(),1);var Rp=h(w(),1),Ose=Object.defineProperty,ev=(e,t)=>Ose(e,"name",{value:t,configurable:!0}),Kj={Automatic:"automatic",Manual:"manual"},UE="Tabs",[_se,gSe]=Wt(UE,[Xm]),qj=Xm(),[zse,$j]=_se(UE),Ise=Zm.forwardRef(ev(function(t,n){let{__scopeTabs:o,value:r,onValueChange:a,defaultValue:i,orientation:s="horizontal",dir:l,activationMode:c=Kj.Automatic,...d}=t,u=Yl(l),[p,f]=Yn({prop:r,onChange:a,defaultProp:i??"",caller:UE});return Rp.jsx(zse,{scope:o,baseId:Jt(),value:p,onValueChange:f,orientation:s,dir:u,activationMode:c,children:Rp.jsx(fe.div,{dir:u,"data-orientation":s,...d,ref:n})})},"Tabs")),Lse="TabsList",Bse=Zm.forwardRef(ev(function(t,n){let{__scopeTabs:o,loop:r=!0,...a}=t,i=$j(Lse,o),s=qj(o);return Rp.jsx(o1,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:Rp.jsx(fe.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:n})})},"TabsList")),Hse="TabsTrigger",jse=Zm.forwardRef(ev(function(t,n){let{__scopeTabs:o,value:r,disabled:a=!1,...i}=t,s=$j(Hse,o),l=qj(o),c=Yj(s.baseId,r),d=Wj(s.baseId,r),u=r===s.value;return Rp.jsx(r1,{asChild:!0,...l,focusable:!a,active:u,children:Rp.jsx(fe.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:n,onMouseDown:J(t.onMouseDown,(p)=>{if(!a&&p.button===0&&p.ctrlKey===!1)p.currentTarget.focus(),s.onValueChange(r);else p.preventDefault()}),onKeyDown:J(t.onKeyDown,(p)=>{if(a||p.target!==p.currentTarget)return;if([" ","Enter"].includes(p.key))s.onValueChange(r)}),onFocus:J(t.onFocus,()=>{let p=s.activationMode!==Kj.Manual;if(!u&&!a&&p)s.onValueChange(r)})})})},"TabsTrigger"));function Yj(e,t){return`${e}-trigger-${t}`}ev(Yj,"makeTriggerId");function Wj(e,t){return`${e}-content-${t}`}ev(Wj,"makeContentId");var Qj=h(I(),1);var Zj=h(w(),1),Use=Object.defineProperty,Gse=(e,t)=>Use(e,"name",{value:t,configurable:!0}),Fse="Toggle",Vse=Qj.forwardRef(Gse(function(t,n){let{pressed:o,defaultPressed:r,onPressedChange:a,...i}=t,[s,l]=Yn({prop:o,onChange:a,defaultProp:r??!1,caller:Fse});return Zj.jsx(fe.button,{type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:n,onClick:J(t.onClick,()=>{if(!t.disabled)l(!s)})})},"Toggle"));var We=h(I(),1);var or=h(w(),1),Kse=Object.defineProperty,zo=(e,t)=>Kse(e,"name",{value:t,configurable:!0}),[VE,PSe]=Wt("Tooltip",[xi]),KE=xi(),qse="TooltipProvider",$se=700,GE="tooltip.open",[Yse,qE]=VE(qse),Wse=zo((e)=>{let{__scopeTooltip:t,delayDuration:n=$se,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:a}=e,i=We.useRef(!0),s=We.useRef(!1),l=We.useRef(0);return We.useEffect(()=>{let c=l.current;return()=>window.clearTimeout(c)},[]),or.jsx(Yse,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:We.useCallback(()=>{if(o<=0)return;window.clearTimeout(l.current),i.current=!1},[o]),onClose:We.useCallback(()=>{if(o<=0)return;window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,o)},[o]),isPointerInTransitRef:s,onPointerInTransitChange:We.useCallback((c)=>{s.current=c},[]),disableHoverableContent:r,children:a})},"TooltipProvider"),FE="Tooltip",[Xse,nv]=VE(FE),Qse=zo((e)=>{let{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:a,disableHoverableContent:i,delayDuration:s}=e,l=qE(FE,e.__scopeTooltip),c=KE(t),[d,u]=We.useState(null),[p,f]=We.useState(void 0),g=Jt(),m=We.useRef(0),y=i??l.disableHoverableContent,b=s??l.delayDuration,x=We.useRef(!1),[v,k]=Yn({prop:o,defaultProp:r??!1,onChange:zo((E)=>{if(E)l.onOpen(),document.dispatchEvent(new CustomEvent(GE));else l.onClose();a?.(E)},"onChange"),caller:FE}),S=We.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),N=We.useCallback(()=>{window.clearTimeout(m.current),m.current=0,x.current=!1,k(!0)},[k]),R=We.useCallback(()=>{window.clearTimeout(m.current),m.current=0,k(!1)},[k]),A=We.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,k(!0),m.current=0},b)},[b,k]);return We.useEffect(()=>()=>{if(m.current)window.clearTimeout(m.current),m.current=0},[]),or.jsx(Ou,{...c,children:or.jsx(Xse,{scope:t,contentId:p??g,setContentId:f,open:v,stateAttribute:S,trigger:d,onTriggerChange:u,onTriggerEnter:We.useCallback(()=>{if(l.isOpenDelayedRef.current)A();else N()},[l.isOpenDelayedRef,A,N]),onTriggerLeave:We.useCallback(()=>{if(y)R();else window.clearTimeout(m.current),m.current=0},[R,y]),onOpen:N,onClose:R,disableHoverableContent:y,children:n})})},"Tooltip"),eU="TooltipTrigger",Zse=We.forwardRef(zo(function(t,n){let{__scopeTooltip:o,"aria-describedby":r,...a}=t,i=nv(eU,o),s=qE(eU,o),l=KE(o),c=We.useRef(null),d=ke(n,c,i.onTriggerChange),u=We.useRef(!1),p=We.useRef(!1),f=We.useCallback(()=>u.current=!1,[]);return We.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),or.jsx(Ql,{asChild:!0,...l,children:or.jsx(fe.button,{"aria-describedby":i.open?cU(r,i.contentId):r,"data-state":i.stateAttribute,...a,ref:d,onPointerMove:J(t.onPointerMove,(g)=>{if(g.pointerType==="touch")return;if(!p.current&&!s.isPointerInTransitRef.current)i.onTriggerEnter(),p.current=!0}),onPointerLeave:J(t.onPointerLeave,()=>{i.onTriggerLeave(),p.current=!1}),onPointerDown:J(t.onPointerDown,()=>{if(i.open)i.onClose();u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:J(t.onFocus,()=>{if(!u.current)i.onOpen()}),onBlur:J(t.onBlur,i.onClose),onClick:J(t.onClick,i.onClose)})})},"TooltipTrigger")),tU="TooltipPortal",[Jse,ele]=VE(tU,{forceMount:void 0}),tle=zo((e)=>{let{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,a=nv(tU,t);return or.jsx(Jse,{scope:t,forceMount:n,children:or.jsx(Rr,{present:n||a.open,children:or.jsx(qs,{asChild:!0,container:r,children:o})})})},"TooltipPortal"),tv="TooltipContent",nle=We.forwardRef(zo(function(t,n){let o=ele(tv,t.__scopeTooltip),{forceMount:r=o.forceMount,side:a="top",...i}=t,s=nv(tv,t.__scopeTooltip);return or.jsx(Rr,{present:r||s.open,children:s.disableHoverableContent?or.jsx(nU,{side:a,...i,ref:n}):or.jsx(ole,{side:a,...i,ref:n})})},"TooltipContent")),ole=We.forwardRef(zo(function(t,n){let o=nv(tv,t.__scopeTooltip),r=qE(tv,t.__scopeTooltip),a=We.useRef(null),i=ke(n,a),[s,l]=We.useState(null),{trigger:c,onClose:d}=o,u=a.current,{onPointerInTransitChange:p}=r,f=We.useCallback(()=>{l(null),p(!1)},[p]),g=We.useCallback((m,y)=>{let b=m.currentTarget,x={x:m.clientX,y:m.clientY},v=oU(x,b.getBoundingClientRect()),k=rU(x,v),S=aU(y.getBoundingClientRect()),N=sU([...k,...S]);l(N),p(!0)},[p]);return We.useEffect(()=>()=>f(),[f]),We.useEffect(()=>{if(c&&u){let m=zo((b)=>g(b,u),"handleTriggerLeave"),y=zo((b)=>g(b,c),"handleContentLeave");return c.addEventListener("pointerleave",m),u.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",y)}}},[c,u,g,f]),We.useEffect(()=>{if(s){let m=zo((y)=>{let b=y.target,x={x:y.clientX,y:y.clientY},v=c?.contains(b)||u?.contains(b),k=!iU(x,s);if(v)f();else if(k)f(),d()},"handleTrackPointerGrace");return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,u,s,d,f]),or.jsx(nU,{...t,ref:i})},"TooltipContentHoverable")),rle=CT("TooltipContent"),nU=We.forwardRef(zo(function(t,n){let{__scopeTooltip:o,children:r,"aria-label":a,id:i,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=t,d=nv(tv,o),u=KE(o),{onClose:p}=d,[f,g]=We.useState(null),m=ke(n,g);ip(f),We.useEffect(()=>(document.addEventListener(GE,p),()=>document.removeEventListener(GE,p)),[p]),We.useEffect(()=>{if(d.trigger){let b=zo((x)=>{if(x.target instanceof Node&&x.target.contains(d.trigger))p()},"handleScroll");return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[d.trigger,p]);let{setContentId:y}=d;return vt(()=>(y(i),()=>{y(void 0)}),[i,y]),or.jsx(Ks,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:(b)=>b.preventDefault(),onDismiss:p,children:or.jsxs(_u,{"data-state":d.stateAttribute,role:a?void 0:"tooltip",id:a?void 0:d.contentId,...u,...c,ref:m,style:{...c.style,...{"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}},children:[or.jsx(rle,{children:r}),a?or.jsx(Pj,{id:d.contentId,role:"tooltip",children:a}):null]})})},"TooltipContentImpl"));function oU(e,t){let n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,o,r,a)){case a:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw Error("unreachable")}}zo(oU,"getExitSideFromRect");function rU(e,t,n=5){let o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}zo(rU,"getPaddedExitPoints");function aU(e){let{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}zo(aU,"getPointsFromRect");function iU(e,t){let{x:n,y:o}=e,r=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){let s=t[a],l=t[i],{x:c,y:d}=s,{x:u,y:p}=l;if(d>o!==p>o&&n<(u-c)*(o-d)/(p-d)+c)r=!r}return r}zo(iU,"isPointInPolygon");function sU(e){let t=e.slice();return t.sort((n,o)=>{if(n.x<o.x)return-1;else if(n.x>o.x)return 1;else if(n.y<o.y)return-1;else if(n.y>o.y)return 1;else return 0}),lU(t)}zo(sU,"getHull");function lU(e){if(e.length<=1)return e.slice();let t=[];for(let o=0;o<e.length;o++){let r=e[o];while(t.length>=2){let a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(r.y-i.y)>=(a.y-i.y)*(r.x-i.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let o=e.length-1;o>=0;o--){let r=e[o];while(n.length>=2){let a=n[n.length-1],i=n[n.length-2];if((a.x-i.x)*(r.y-i.y)>=(a.y-i.y)*(r.x-i.x))n.pop();else break}n.push(r)}if(n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y)return t;else return t.concat(n)}zo(lU,"getHullPresorted");function cU(...e){let t=new Set;for(let n of e){if(typeof n!=="string")continue;for(let o of String(n).trim().split(/\s+/))if(o)t.add(o)}return t.size>0?Array.from(t).join(" "):void 0}zo(cU,"concatAriaDescribedby");var dU=(e)=>typeof e==="boolean"?`${e}`:e===0?"0":e,pU=Gx,p1=(e,t)=>(n)=>{var o;if((t===null||t===void 0?void 0:t.variants)==null)return pU(e,n===null||n===void 0?void 0:n.class,n===null||n===void 0?void 0:n.className);let{variants:r,defaultVariants:a}=t,i=Object.keys(r).map((c)=>{let d=n===null||n===void 0?void 0:n[c],u=a===null||a===void 0?void 0:a[c];if(d===null)return null;let p=dU(d)||dU(u);return r[c][p]}),s=n&&Object.entries(n).reduce((c,d)=>{let[u,p]=d;if(p===void 0)return c;return c[u]=p,c},{}),l=t===null||t===void 0?void 0:(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((c,d)=>{let{class:u,className:p,...f}=d;return Object.entries(f).every((g)=>{let[m,y]=g;return Array.isArray(y)?y.includes({...a,...s}[m]):{...a,...s}[m]===y})?[...c,u,p]:c},[]);return pU(e,i,l,n===null||n===void 0?void 0:n.class,n===null||n===void 0?void 0:n.className)};var fU=h(w(),1),f1=p1("inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-sm border px-3 py-1 text-base font-medium shadow-sm transition-colors disabled:cursor-default disabled:opacity-50",{variants:{variant:{default:"border-border bg-card text-foreground hover:border-muted-foreground",primary:"border-primary bg-primary text-primary-foreground hover:bg-[color-mix(in_srgb,var(--accent)_88%,var(--ink))]",ghost:"border-transparent bg-transparent text-muted-foreground shadow-none hover:bg-muted hover:text-foreground",danger:"border-border bg-card text-danger hover:border-danger"},size:{md:"min-h-(--btn-s)",sm:"min-h-(--btn-xs) px-2 text-sm"}},defaultVariants:{variant:"default",size:"md"}});function M({className:e,variant:t,size:n,asChild:o,type:r="button",...a}){let i=o?uoe:"button";return fU.jsx(i,{...o?{}:{type:r},className:C(f1({variant:t,size:n}),e),...a})}var ec=h(w(),1),m1=vre,ov=({className:e,...t})=>ec.jsx(Nre,{className:C("text-lg font-semibold",e),...t}),rv=({className:e,...t})=>ec.jsx(Rre,{className:C("text-base text-muted-foreground",e),...t});function g1({className:e,...t}){return ec.jsxs(yre,{container:Xo(),children:[ec.jsx(xre,{className:"fixed inset-0 z-50 bg-black/45"}),ec.jsx(Cre,{className:C("fixed left-1/2 top-1/2 z-50 flex w-[min(420px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col gap-2.5 rounded-lg border border-border bg-background p-4 text-foreground outline-none",e),...t})]})}var h1=({className:e,...t})=>ec.jsx(Are,{className:C(f1({variant:"default"}),e),...t}),b1=({className:e,danger:t,...n})=>ec.jsx(Tre,{className:C(f1({variant:t?"danger":"primary"}),e),...n});var gU=h(w(),1),ale=p1("inline-flex items-center gap-1.5 text-sm",{variants:{tone:{neutral:"text-muted-foreground",warning:"text-warning",success:"text-success",danger:"text-danger",ink:"text-foreground"}},defaultVariants:{tone:"neutral"}}),mU=({className:e,tone:t,...n})=>gU.jsx("span",{className:C(ale({tone:t}),e),...n});var $E=h(w(),1);function L({name:e,sprite:t="i",className:n,...o}){return $E.jsx("svg",{"aria-hidden":"true",className:C("size-[18px]",n),...o,children:$E.jsx("use",{href:`#${t}-${e}`})})}var v1=h(w(),1);function Hr({className:e,...t}){return v1.jsx(Lre,{className:C("grid size-4 place-items-center rounded-xs border border-border bg-card data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:v1.jsx(Hre,{children:v1.jsx(L,{name:"check",className:"size-3"})})})}var hU=1,ile=0.9,sle=0.8,lle=0.17,YE=0.1,WE=0.999,cle=0.9999,ule=0.99,dle=/[\\\/_+.#"@\[\(\{&]/,ple=/[\\\/_+.#"@\[\(\{&]/g,fle=/[\s-]/,vU=/[\s-]/g;function XE(e,t,n,o,r,a,i){if(a===t.length)return r===e.length?hU:ule;var s=`${r},${a}`;if(i[s]!==void 0)return i[s];for(var l=o.charAt(a),c=n.indexOf(l,r),d=0,u,p,f,g;c>=0;)u=XE(e,t,n,o,c+1,a+1,i),u>d&&(c===r?u*=hU:dle.test(e.charAt(c-1))?(u*=sle,f=e.slice(r,c-1).match(ple),f&&r>0&&(u*=Math.pow(WE,f.length))):fle.test(e.charAt(c-1))?(u*=ile,g=e.slice(r,c-1).match(vU),g&&r>0&&(u*=Math.pow(WE,g.length))):(u*=lle,r>0&&(u*=Math.pow(WE,c-r))),e.charAt(c)!==t.charAt(a)&&(u*=cle)),(u<YE&&n.charAt(c-1)===o.charAt(a+1)||o.charAt(a+1)===o.charAt(a)&&n.charAt(c-1)!==o.charAt(a))&&(p=XE(e,t,n,o,c+1,a+2,i),p*YE>u&&(u=p*YE)),u>d&&(d=u),c=n.indexOf(l,c+1);return i[s]=d,d}function bU(e){return e.toLowerCase().replace(vU," ")}function yU(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,XE(e,t,bU(e),bU(t),0,0,{})}var ie=h(I(),1);var av='[cmdk-group=""]',QE='[cmdk-group-items=""]',mle='[cmdk-group-heading=""]',wU='[cmdk-item=""]',xU=`${wU}:not([aria-disabled="true"])`,ZE="cmdk-item-select",Jm="data-value",gle=(e,t,n)=>yU(e,t,n),kU=ie.createContext(void 0),iv=()=>ie.useContext(kU),SU=ie.createContext(void 0),JE=()=>ie.useContext(SU),CU=ie.createContext(void 0),NU=ie.forwardRef((e,t)=>{let n=eg(()=>{var j,le;return{search:"",value:(le=(j=e.value)!=null?j:e.defaultValue)!=null?le:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=eg(()=>new Set),r=eg(()=>new Map),a=eg(()=>new Map),i=eg(()=>new Set),s=RU(e),{label:l,children:c,value:d,onValueChange:u,filter:p,shouldFilter:f,loop:g,disablePointerSelection:m=!1,vimBindings:y=!0,...b}=e,x=Jt(),v=Jt(),k=Jt(),S=ie.useRef(null),N=Rle();Tp(()=>{if(d!==void 0){let j=d.trim();n.current.value=j,R.emit()}},[d]),Tp(()=>{N(6,Z)},[]);let R=ie.useMemo(()=>({subscribe:(j)=>(i.current.add(j),()=>i.current.delete(j)),snapshot:()=>n.current,setState:(j,le,te)=>{var F,H,he,Ye;if(!Object.is(n.current[j],le)){if(n.current[j]=le,j==="search")B(),E(),N(1,z);else if(j==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ne=document.getElementById(k);ne?ne.focus():(F=document.getElementById(x))==null||F.focus()}if(N(7,()=>{var ne;n.current.selectedItemId=(ne=ee())==null?void 0:ne.id,R.emit()}),te||N(5,Z),((H=s.current)==null?void 0:H.value)!==void 0){let ne=le!=null?le:"";(Ye=(he=s.current).onValueChange)==null||Ye.call(he,ne);return}}R.emit()}},emit:()=>{i.current.forEach((j)=>j())}}),[]),A=ie.useMemo(()=>({value:(j,le,te)=>{var F;le!==((F=a.current.get(j))==null?void 0:F.value)&&(a.current.set(j,{value:le,keywords:te}),n.current.filtered.items.set(j,D(le,te)),N(2,()=>{E(),R.emit()}))},item:(j,le)=>(o.current.add(j),le&&(r.current.has(le)?r.current.get(le).add(j):r.current.set(le,new Set([j]))),N(3,()=>{B(),E(),n.current.value||z(),R.emit()}),()=>{a.current.delete(j),o.current.delete(j),n.current.filtered.items.delete(j);let te=ee();N(4,()=>{B(),(te==null?void 0:te.getAttribute("id"))===j&&z(),R.emit()})}),group:(j)=>(r.current.has(j)||r.current.set(j,new Set),()=>{a.current.delete(j),r.current.delete(j)}),filter:()=>s.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:x,inputId:k,labelId:v,listInnerRef:S}),[]);function D(j,le){var te,F;let H=(F=(te=s.current)==null?void 0:te.filter)!=null?F:gle;return j?H(j,n.current.search,le):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let j=n.current.filtered.items,le=[];n.current.filtered.groups.forEach((F)=>{let H=r.current.get(F),he=0;H.forEach((Ye)=>{let ne=j.get(Ye);he=Math.max(ne,he)}),le.push([F,he])});let te=S.current;xe().sort((F,H)=>{var he,Ye;let ne=F.getAttribute("id"),be=H.getAttribute("id");return((he=j.get(be))!=null?he:0)-((Ye=j.get(ne))!=null?Ye:0)}).forEach((F)=>{let H=F.closest(QE);H?H.appendChild(F.parentElement===H?F:F.closest(`${QE} > *`)):te.appendChild(F.parentElement===te?F:F.closest(`${QE} > *`))}),le.sort((F,H)=>H[1]-F[1]).forEach((F)=>{var H;let he=(H=S.current)==null?void 0:H.querySelector(`${av}[${Jm}="${encodeURIComponent(F[0])}"]`);he==null||he.parentElement.appendChild(he)})}function z(){let j=xe().find((te)=>te.getAttribute("aria-disabled")!=="true"),le=j==null?void 0:j.getAttribute(Jm);R.setState("value",le||void 0)}function B(){var j,le,te,F;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let H=0;for(let he of o.current){let Ye=(le=(j=a.current.get(he))==null?void 0:j.value)!=null?le:"",ne=(F=(te=a.current.get(he))==null?void 0:te.keywords)!=null?F:[],be=D(Ye,ne);n.current.filtered.items.set(he,be),be>0&&H++}for(let[he,Ye]of r.current)for(let ne of Ye)if(n.current.filtered.items.get(ne)>0){n.current.filtered.groups.add(he);break}n.current.filtered.count=H}function Z(){var j,le,te;let F=ee();F&&(((j=F.parentElement)==null?void 0:j.firstChild)===F&&((te=(le=F.closest(av))==null?void 0:le.querySelector(mle))==null||te.scrollIntoView({block:"nearest"})),F.scrollIntoView({block:"nearest"}))}function ee(){var j;return(j=S.current)==null?void 0:j.querySelector(`${wU}[aria-selected="true"]`)}function xe(){var j;return Array.from(((j=S.current)==null?void 0:j.querySelectorAll(xU))||[])}function V(j){let le=xe()[j];le&&R.setState("value",le.getAttribute(Jm))}function ye(j){var le;let te=ee(),F=xe(),H=F.findIndex((Ye)=>Ye===te),he=F[H+j];(le=s.current)!=null&&le.loop&&(he=H+j<0?F[F.length-1]:H+j===F.length?F[0]:F[H+j]),he&&R.setState("value",he.getAttribute(Jm))}function ae(j){let le=ee(),te=le==null?void 0:le.closest(av),F;for(;te&&!F;)te=j>0?Cle(te,av):Nle(te,av),F=te==null?void 0:te.querySelector(xU);F?R.setState("value",F.getAttribute(Jm)):ye(j)}let ge=()=>V(xe().length-1),P=(j)=>{j.preventDefault(),j.metaKey?ge():j.altKey?ae(1):ye(1)},Ae=(j)=>{j.preventDefault(),j.metaKey?V(0):j.altKey?ae(-1):ye(-1)};return ie.createElement(fe.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:(j)=>{var le;(le=b.onKeyDown)==null||le.call(b,j);let te=j.nativeEvent.isComposing||j.keyCode===229;if(!(j.defaultPrevented||te))switch(j.key){case"n":case"j":{y&&j.ctrlKey&&P(j);break}case"ArrowDown":{P(j);break}case"p":case"k":{y&&j.ctrlKey&&Ae(j);break}case"ArrowUp":{Ae(j);break}case"Home":{j.preventDefault(),V(0);break}case"End":{j.preventDefault(),ge();break}case"Enter":{j.preventDefault();let F=ee();if(F){let H=new Event(ZE);F.dispatchEvent(H)}}}}},ie.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:Ele},l),y1(e,(j)=>ie.createElement(SU.Provider,{value:R},ie.createElement(kU.Provider,{value:A},j))))}),hle=ie.forwardRef((e,t)=>{var n,o;let r=Jt(),a=ie.useRef(null),i=ie.useContext(CU),s=iv(),l=RU(e),c=(o=(n=l.current)==null?void 0:n.forceMount)!=null?o:i==null?void 0:i.forceMount;Tp(()=>{if(!c)return s.item(r,i==null?void 0:i.id)},[c]);let d=TU(r,a,[e.value,e.children,a],e.keywords),u=JE(),p=Hu((N)=>N.value&&N.value===d.current),f=Hu((N)=>c||s.filter()===!1?!0:N.search?N.filtered.items.get(r)>0:!0);ie.useEffect(()=>{let N=a.current;if(!(!N||e.disabled))return N.addEventListener(ZE,g),()=>N.removeEventListener(ZE,g)},[f,e.onSelect,e.disabled]);function g(){var N,R;m(),(R=(N=l.current).onSelect)==null||R.call(N,d.current)}function m(){u.setState("value",d.current,!0)}if(!f)return null;let{disabled:y,value:b,onSelect:x,forceMount:v,keywords:k,...S}=e;return ie.createElement(fe.div,{ref:Tu(a,t),...S,id:r,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!p,"data-disabled":!!y,"data-selected":!!p,onPointerMove:y||s.getDisablePointerSelection()?void 0:m,onClick:y?void 0:g},e.children)}),ble=ie.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...a}=e,i=Jt(),s=ie.useRef(null),l=ie.useRef(null),c=Jt(),d=iv(),u=Hu((f)=>r||d.filter()===!1?!0:f.search?f.filtered.groups.has(i):!0);Tp(()=>d.group(i),[]),TU(i,s,[e.value,e.heading,l]);let p=ie.useMemo(()=>({id:i,forceMount:r}),[r]);return ie.createElement(fe.div,{ref:Tu(s,t),...a,"cmdk-group":"",role:"presentation",hidden:u?void 0:!0},n&&ie.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),y1(e,(f)=>ie.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},ie.createElement(CU.Provider,{value:p},f))))}),vle=ie.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=ie.useRef(null),a=Hu((i)=>!i.search);return!n&&!a?null:ie.createElement(fe.div,{ref:Tu(r,t),...o,"cmdk-separator":"",role:"separator"})}),yle=ie.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,a=JE(),i=Hu((c)=>c.search),s=Hu((c)=>c.selectedItemId),l=iv();return ie.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),ie.createElement(fe.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":s,id:l.inputId,type:"text",value:r?e.value:i,onChange:(c)=>{r||a.setState("search",c.target.value),n==null||n(c.target.value)}})}),xle=ie.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,a=ie.useRef(null),i=ie.useRef(null),s=Hu((c)=>c.selectedItemId),l=iv();return ie.useEffect(()=>{if(i.current&&a.current){let c=i.current,d=a.current,u,p=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let f=c.offsetHeight;d.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return p.observe(c),()=>{cancelAnimationFrame(u),p.unobserve(c)}}},[]),ie.createElement(fe.div,{ref:Tu(a,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":o,id:l.listId},y1(e,(c)=>ie.createElement("div",{ref:Tu(i,l.listInnerRef),"cmdk-list-sizer":""},c)))}),wle=ie.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:a,container:i,...s}=e;return ie.createElement(qm,{open:n,onOpenChange:o},ie.createElement(up,{container:i},ie.createElement(dp,{"cmdk-overlay":"",className:r}),ie.createElement(pp,{"aria-label":e.label,"cmdk-dialog":"",className:a},ie.createElement(NU,{ref:t,...s}))))}),kle=ie.forwardRef((e,t)=>Hu((n)=>n.filtered.count===0)?ie.createElement(fe.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Sle=ie.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...a}=e;return ie.createElement(fe.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},y1(e,(i)=>ie.createElement("div",{"aria-hidden":!0},i)))}),Ep=Object.assign(NU,{List:xle,Item:hle,Input:yle,Group:ble,Separator:vle,Dialog:wle,Empty:kle,Loading:Sle});function Cle(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Nle(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function RU(e){let t=ie.useRef(e);return Tp(()=>{t.current=e}),t}var Tp=typeof window>"u"?ie.useEffect:ie.useLayoutEffect;function eg(e){let t=ie.useRef();return t.current===void 0&&(t.current=e()),t}function Hu(e){let t=JE(),n=()=>e(t.snapshot());return ie.useSyncExternalStore(t.subscribe,n,n)}function TU(e,t,n,o=[]){let r=ie.useRef(),a=iv();return Tp(()=>{var i;let s=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():r.current}})(),l=o.map((c)=>c.trim());a.value(e,s,l),(i=t.current)==null||i.setAttribute(Jm,s),r.current=s}),r}var Rle=()=>{let[e,t]=ie.useState(),n=eg(()=>new Map);return Tp(()=>{n.current.forEach((o)=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function Tle(e){let t=e.type;return typeof t=="function"?t(e.props):("render"in t)?t.render(e.props):e}function y1({asChild:e,children:t},n){return e&&ie.isValidElement(t)?ie.cloneElement(Tle(t),{ref:t.ref},n(t.props.children)):n(t)}var Ele={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};var Ap=h(w(),1),tg=({className:e,...t})=>Ap.jsx(Ep,{className:C("flex flex-col text-base",e),...t}),ng=({className:e,...t})=>Ap.jsx(Ep.Input,{className:C("mb-1.5 h-8 w-full rounded-sm border border-border bg-card px-2.5 text-base text-foreground outline-none placeholder:text-muted-foreground focus-visible:border-muted-foreground",e),...t}),og=({className:e,...t})=>Ap.jsx(Ep.List,{className:C("max-h-72 overflow-auto",e),...t}),x1=({className:e,...t})=>Ap.jsx(Ep.Empty,{className:C("px-2 py-3 text-center text-muted-foreground",e),...t}),rg=({className:e,...t})=>Ap.jsx(Ep.Item,{className:C("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-muted-foreground data-[selected=true]:bg-muted data-[selected=true]:text-foreground",e),...t}),w1=({className:e,...t})=>Ap.jsx(Ep.Group,{className:C("[&_[cmdk-group-heading]]:flex [&_[cmdk-group-heading]]:items-center [&_[cmdk-group-heading]]:gap-1.5 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-foreground",e),...t});var Mp=h(w(),1),Ga=qm,OCe=O0,_Ce=Fb,ga=({className:e,...t})=>Mp.jsx(_0,{className:C("text-lg font-semibold",e),...t}),eA=({className:e,...t})=>Mp.jsx(z0,{className:C("text-base text-muted-foreground",e),...t});function Fa({className:e,...t}){return Mp.jsxs(up,{container:Xo(),children:[Mp.jsx(dp,{className:"fixed inset-0 z-50 bg-black/45"}),Mp.jsx(pp,{className:C("fixed left-1/2 top-1/2 z-50 flex w-[min(480px,calc(100vw-32px))] max-h-[calc(100dvh-32px)] -translate-x-1/2 -translate-y-1/2 flex-col gap-2.5 rounded-lg border border-border bg-background p-4 text-foreground outline-none",e),...t})]})}var ju=h(w(),1),En=(e)=>ju.jsx(uie,{modal:!1,...e}),An=pie;function Mn({className:e,align:t="end",sideOffset:n=4,...o}){return ju.jsx(fie,{container:Xo(),children:ju.jsx(gie,{align:t,sideOffset:n,className:C("z-50 flex min-w-40 max-w-[calc(100vw-32px)] flex-col rounded-md border border-border bg-card p-1.5 text-base text-foreground shadow-md outline-none animate-fade-in",e),...o})})}var nn=({className:e,...t})=>ju.jsx(bie,{className:C("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-muted-foreground outline-none data-[disabled]:opacity-50 data-[highlighted]:bg-muted data-[highlighted]:text-foreground",e),...t}),Zr=({className:e,...t})=>ju.jsx(xie,{className:C("my-1 h-px bg-border",e),...t}),k1=({className:e,...t})=>ju.jsx(hie,{className:C("px-2 py-1 text-sm text-muted-foreground",e),...t}),EU=vie,tA=({className:e,...t})=>ju.jsx(yie,{className:C("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-foreground outline-none data-[highlighted]:bg-muted data-[state=checked]:text-primary",e),...t});var AU=h(w(),1),sv="h-(--btn-s) w-full rounded-sm border border-border bg-card px-2.5 py-1 text-base text-foreground placeholder:text-muted-foreground hover:border-muted-foreground focus-visible:border-muted-foreground aria-[invalid=true]:border-danger";function Ue({className:e,...t}){return AU.jsx("input",{className:C(sv,e),...t})}var MU=h(w(),1);function tc({className:e,...t}){return MU.jsx(Sie,{className:C("block text-base font-medium text-foreground",e),...t})}var nA=h(w(),1),rr=Rie,ar=Mie,DU=Eie;function ir({className:e,align:t="end",sideOffset:n=4,...o}){return nA.jsx(Oie,{container:Xo(),children:nA.jsx(_ie,{align:t,sideOffset:n,className:C("z-50 max-w-[calc(100vw-32px)] rounded-md border border-border bg-card p-1.5 text-base text-foreground shadow-md outline-none animate-fade-in",e),...o})})}var Va=h(w(),1),Pt=Qie,Ot=tse;function _t({className:e,size:t="md",children:n,...o}){return Va.jsxs(Jie,{className:C("inline-flex max-w-full items-center justify-between gap-2 rounded-sm border border-border bg-card px-2.5 text-base text-foreground hover:border-muted-foreground data-[placeholder]:text-muted-foreground",t==="sm"?"h-7 text-sm":"h-(--btn-s)",e),...o,children:[Va.jsx("span",{className:"min-w-0 truncate",children:n}),Va.jsx(nse,{asChild:!0,children:Va.jsx(L,{name:"chev",className:"size-3 shrink-0 text-muted-foreground"})})]})}function zt({className:e,children:t,...n}){return Va.jsx(ise,{container:Xo(),children:Va.jsx(sse,{position:"popper",sideOffset:4,className:C("z-50 max-h-72 min-w-(--radix-select-trigger-width) max-w-[calc(100vw-32px)] overflow-hidden rounded-md border border-border bg-card p-1.5 text-base text-foreground shadow-md animate-fade-in",e),...n,children:Va.jsx(mse,{children:t})})})}var dt=({className:e,children:t,...n})=>Va.jsxs(bse,{className:C("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-muted-foreground outline-none data-[highlighted]:bg-muted data-[highlighted]:text-foreground data-[state=checked]:font-medium data-[state=checked]:text-foreground",e),...n,children:[Va.jsx(vse,{children:t}),Va.jsx(xse,{className:"ml-auto",children:Va.jsx(L,{name:"check",className:"size-3.5 text-primary"})})]});var nc=h(w(),1),S1=qm,JCe=O0,PU=Fb,lv=({className:e,...t})=>nc.jsx(_0,{className:C("text-[16px] font-semibold text-strong",e),...t}),C1=z0;function OU({className:e,...t}){return nc.jsxs(up,{container:Xo(),children:[nc.jsx(dp,{className:"fixed inset-0 z-50 bg-[color-mix(in_srgb,var(--bg)_60%,transparent)] backdrop-blur-[3px] data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:animate-in data-[state=open]:fade-in"}),nc.jsx(pp,{className:C("fixed inset-y-0 right-0 z-50 flex w-[520px] max-w-full flex-col border-l border-border bg-card text-foreground shadow-md outline-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:animate-in data-[state=open]:slide-in-from-right",e),...t})]})}function _U({className:e,...t}){return nc.jsxs(up,{container:Xo(),children:[nc.jsx(dp,{className:"fixed inset-0 z-50 bg-black/45 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:animate-in data-[state=open]:fade-in"}),nc.jsx(pp,{className:C("fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col overflow-y-auto rounded-t-[16px] border-t border-border bg-card px-4 pb-[calc(20px+env(safe-area-inset-bottom))] pt-3 text-foreground outline-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",e),...t})]})}var zU=h(w(),1),Jr=({className:e,...t})=>zU.jsx("span",{className:C("block rounded-sm bg-muted motion-safe:animate-pulse",e),...t});var LU=h(w(),1),IU=({theme:e="system"})=>LU.jsx(t_,{theme:e,position:"bottom-left",offset:{left:28,bottom:56},mobileOffset:{left:16,bottom:68},style:{"--normal-bg":"var(--bg-2)","--normal-text":"var(--ink)","--normal-border":"var(--line)",fontFamily:"var(--font)"},toastOptions:{className:"toast",style:{fontSize:"var(--fs)",borderRadius:"var(--r)",boxShadow:"var(--shadow-2)"}}});var HU=h(w(),1),BU=({className:e})=>HU.jsx("span",{"aria-hidden":"true",className:C("block size-[22px] rounded-full border-2 border-border border-t-foreground motion-safe:animate-spin",e)});var oA=h(w(),1);function sr({className:e,...t}){return oA.jsx(Ese,{className:C("inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-border bg-muted p-0.5 transition-colors data-[state=checked]:border-primary data-[state=checked]:bg-primary",e),...t,children:oA.jsx(Mse,{className:"block size-3.5 rounded-full bg-card shadow-sm transition-transform data-[state=checked]:translate-x-4 data-[state=checked]:bg-primary-foreground"})})}var aA=h(w(),1),jU=Ise,UU=({className:e,...t})=>aA.jsx(Bse,{className:C("flex items-center gap-0.5",e),...t}),rA=({className:e,...t})=>aA.jsx(jse,{className:C("inline-flex min-h-[26px] items-center gap-1.5 rounded-full px-2 text-sm text-muted-foreground data-[state=active]:bg-[color-mix(in_srgb,var(--dim)_14%,transparent)] data-[state=active]:font-medium data-[state=active]:text-foreground",e),...t});var GU=h(w(),1);function xn({className:e,...t}){return GU.jsx("textarea",{className:C("w-full resize-none bg-transparent text-base leading-normal text-foreground outline-none placeholder:text-muted-foreground",e),...t})}var FU=h(w(),1),ag=({className:e,...t})=>FU.jsx(Vse,{className:C(e),...t});var N1=h(w(),1),VU=(e)=>N1.jsx(Wse,{delayDuration:400,...e}),R1=Qse,T1=Zse,E1=({className:e,sideOffset:t=6,...n})=>N1.jsx(tle,{container:Xo(),children:N1.jsx(nle,{sideOffset:t,className:C("z-50 max-w-72 rounded-sm border border-border bg-card px-2 py-1 text-sm text-foreground shadow-md animate-fade-in",e),...n})});var Si={claude:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAG1BMVEXZdlbabEjacU/aZ0H+9/X67ejil4Hruavy0som81XtAAAD70lEQVRYhe1W2ZIbIQzUwQD//8XR0RKMvZWqVN5SYe0xYNRqtWSxRP/HPzvkL83nmjeE/CEer/GMzb2ce/4WQT4+aT4+Dh2D+71HcdsDIwlQFHTbYsnn6QhL2rMI5V+MJylInFSbjinH+Is6AavXvANgcUI7ADzwnDgpbfa14SeTAiep4VMgj7EVjA+CrRxfDj9eT/G2lwOof6/bpmPlwTBqj60NcwTOSUFDUs+puRVdA+Ke4NNt8+G1V5KZAxRiOkyOsk89RcCAkJGEivyRe7DcmV2osMYwI2BCGbgUgbjYEIRu7tiPh2GUpZ9zQHtNRA3hqP98ZAUlYRM8KMRETZXR6NSBl/yFplkAY8PjMCx9PHWeAN9YWsI1/9bD1woOz1SjHhQ0zFwIm1g9FPMmfjPoGnLX7AzM1jWcATaeo9mVChG5ZpTZMgOaDvA4AI2YugCgXihtJg1HFkbGO4NCwORYepy9AXoVE46Ia+yePWnPzKrKN/FbiphoOv8YM0yZ5trPnnSJ9z30RQJU7Pcwd8jjvwh9aeCfHEPA7ZvE3r6T5ezF9smA51rT+oX9pNRj9Nr5Gk+oa71mHrYOYH55AhoMt8H9gDCevSalhlwAOdH11Bg/SejGaYsw82GVkWv2fmdRrLVtgMtLghmhxeCTRDAotIgdjy8RPDKLzYJbU5ODm1I/Cick4Z9q4UFPMKQ+CAYsHUkWI30q6PVz0midkTuEsM9nArFymq8bxfRTWvsBhkZRc7EP2+Ru75U/fnmXo/UIFyfKcYG1IAuIws2jBp/uIvMDIQiqKNyFfmFWLFQ2upq67bJWsFzN7T1tKZcjBGuv+zcQ2mfv1OhIj6NMvxkGAYErTQzNqCHdf5bjNiLRRr0/GVh0VI1/OzQPyvmgCoDbv7mPe8hMvZimUtyJ6nfFRhkerxcDoxO3uqudN6L1ZKPB0ScNaD6JwDcNugOyHJHGZ6TaZmbo1DL1Vl5RQm3QWbi2YsQN41DO2qWPi3FZFawXB4Twac5+LOtmJZEw9GBCJn4N+rSW1NIzFkzCoSIIm9F82Qvx54jbCWa7GYcqYavv4y8AKQEq36AiiGbqRRVYHYLWnh2F/YkFbL7pAkD5PO0o1QxesYqG+B624YdVTmR6IwWAkwK3eEqeVsRMZ8V6shF7UU9ysauTKkdK6k14iJ4KfJ2LaukPwcGD5AwUW3p0BOP8BjYdQ3tKm2BQ6OlKy+IDNtp9ByK4IghIuAtaqiIGK22sWtUWgUudOPeKd776IrHO9/XBYHB0w0KOa+1ItF3VuhggAG5w1ZJaLyB9vzEhPfMGLrlBUy/fxwlkI7jk17365qL3Ny8SNn4BI7siq1gJmlgAAAAASUVORK5CYII=",agy:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAEAAQAMBEQACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABQcCBAYDAf/EADEQAAEEAgADBQQLAAAAAAAAAAEAAgMEBREGITESQVFxoRMUYbEHIiMzUmJygZHB4f/EABoBAQADAQEBAAAAAAAAAAAAAAACAwUEAQb/xAAqEQACAgIBAgQFBQAAAAAAAAAAAQIDBBESBUETITFRFCOBsfEyYXGR0f/aAAwDAQACEQMRAD8AvFAEAQBAEAQBAEAQBAEBo5HK1McB7w89o9GtGyue7Kqp8pvzLaqZ2vUTDF5ujlC5tWXcjesbhp2vHXgp1XQtW4snfi20a5ryJFWnOEAQBAEB52ZWwQSTPOmxtLj5BeN6R42ktsq7J5F9qeSWR23POys+OFK6TnL1ZCnN4sj6l6WhehuQH7SJ29eI7x+4V3wsqZKSPo6ciGTU659y4K0zLFeOeM7ZI0PafEEbC6zBacXpnqh4EAQBAc5xxd91w3sw7Tp3hg8hzPy9VbVV4stHHm2cKte5WcspcVv0YiSMfxHsxbzXt2GmjTxcxwZZ/Atv3jAxxk/WrvMZ8uo9CsHIq8KejTlYrHyR0SoIhAEAQFa/SJkPb5ZlSM7bWZzA/E7n8tLe6XR8vm+5idRs5WqK7E/w3wjUq1GS5OtHYsyDbmyt7TY/ho8t/FcmV1Gyc+NT1Fe3c7MfChGO7FtnziXhOpPUfPjK7ILMY2GRN02QeGum17h9QsjPja9xfv2JX4kXHcFpoiPo8viLIS1HHQsM7Tf1N/zf8Lq6rR8tWLsVYV25cWWGsE0ggCAjOIMvDhse+zLpz+kUe+b3eC6MbHlkWKEfr/BRkXxphyf0OO4Nws+TyBzWRBMYkMjO0PvX9d+QPqtfqGTGmv4ev1+yM3Cx3ZPxp+n3LDHRYBsg9EBXfFmJnwuTbmMeNQmQSHQ5Rv33/lP9lfQYGRHIq+Hs9df2v9MjKqlTPxYeh2mCy1fMUG2YDo9JGE82O7wsbJx5Y9nCX5NGm6N0eSJFUFwQGpexlLIBgvVo5xGdtEg3pWVXWVb4S1shOqFn61s2WtDGhrQAANADuVf7k9aMkAQGL2Ne0teA5rhogjYIRPT2jxrZrUcdTx7XtpV44A93acGDWyrLLrLWnOWyMK4V+UFo21WTCAIAgCAIAgCAID//2Q==",codex:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAYFBMVEX///8AAADz8/O/v7+qqqq4uLj4+Pjo6Oh+fn7h4eHExMSwsLDKysrZ2dmioqImJiYrKytpaWmNjY3T09NMTExCQkJUVFR2dnYbGxszMzOHh4cODg5cXFwhISGUlJQ5OTkNyEhkAAADGElEQVRYhe1X2XbqMAzMQuw4KxBCCKHl///y2pJl5AVKOee+VS/E4JloGckmy/7sP5rqqnJSn6L765aj1f0HcHnLmR2K3+LLPLAuE7LrpneJKnxvq6RU1RkXSPS1TG/gO4jcvU2dPWdO8ie8MNsaFs8YxLP7gaCGmMn6E4Dmoen7bofO1C/xhd5xdYsFEHvnkIJkHF8RDHpDwZ61Dfz3Nvc8jE0rYMGnDoOvhb8BGJ7CO+NzaZ4kxnsmLUuX/Tp0isHvADJbCz94qWNfrCumTPsk/mrrVJCj7j3fXgGP+jHVZIecEezYpupCv9whe0o/VTEeKnbdMQL8Xs2AXVfXWCaG7wgPDVTCByewSshb/Aqha0pMG5Y3IEAlbPg+UcPq0swJgsEKzCNobBvsqQcfjRWFMFqXOQGbKjdSAXE2AV5R0TgBeF92WAOn/yGWd4ZlVwmC4QExeQQrDnxlTWvokkUE1AYCJbZSKmBk+VKqSZ2cgG1R6MTBpsLsmkOCMSLgG4Ls17ntOTIt700QgUwT4GzaGlp7LpQ8iVuZJGgLrKu0b8z5eJVUKAl7TkUbE+henEy/V5QUL4aZANMXUiQJYEwAgdiC0WgqY2fpQAlLEAgiyPZhP6wPfVIHBmX0PIgJeq7wHmebLySf4MKmPxoMsYUmehVL2SNITaWgS45+MwUEQyRm3am4b0+nhnRDEjvbI9CfXwGeRi9r/mlvOZuwjMc8cTZofd9t6LbCw8VF5ROYG8AW4g3B6vzQu5oLK4VHYAdwIgTTUDgv8hl752zDYQQDyCRxxlfUH9NM2VgpoSQkQb8sMd5tMlybKxwmw6zajI7MZzeEEZKAdmTneoPFeJy59ydXrYG/VJAm6ZyH6IxWlufXC7MxILen0WhBenV7Crfno6dwPt1tBC8vadB1BzeqbPCuw2CWijTUGk6C29D1fXlE+Olx2WZT56m5hrA2MsG1SQGHpk4ewcn1rADv3rn7TwuewCPGc257felucBE3QNqE6vrCXru5vXNX94zGK9rv/3hoU7Vrn0/++iBH2Zbdx+g/e8f+AUjCHMA9oP1SAAAAAElFTkSuQmCC",opencode:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAG1BMVEUTEBD///9aWFgAAABHREQGAABeXFxLSUkvLCzJjnlJAAAAVUlEQVRYhe3WMQrAMAhAUduaJvc/cWYLxUgIJfb/UfBNDooQ5exycvcPJ08AyAU8DygOjM0B1gLFFAfqbaphQE+TAgAAfAU0NbUw8BbAL4DpR5No0zpjhghz2AXH2AAAAABJRU5ErkJggg==",gemini:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABp1BMVEVHcEwks4M2ltktu2/sxyHkVmPkbFyGymJeieuhzlE7if00kO3qXVo7ifxKkez0uhzzqh4St3FLwWsxhv9Fhvj3vBj2R0gxhv8zh//KyTsrvWf6RUMUuWj0VkjxqCTwXU7zXEbsT1f4vRfb0THC1UOtcqnuZE3CaZH1nCCb1FnxSlAxhv+a01klrpoxhv85oc/wgjL4RkWDgdT2SEn6Q0FtyWW91UUxhv8yhv8yh/82h/43ivo+iPw5jfY6kPBHifg8nNNSifI8lOnsUVc8oMf2vhhLr5wUuWeTfMBqhuRJqqo7mNzyS053x2pDpblpw3KEgc1VtY/4RkXWYHZhvns0pLszqKutdKU7luPdW2y10EbCao7MZYOieLHYyi9fuYQetnbqkTLooitgk93nfka4bpmS0Fzysxx3hNlTnsxEunsqr5LTuDJLwG6Ku2aovU9kpLA/tIsxrJ29wT/Tf2q2hY+aiLBMl+GMlq1xmsLRcXjRjVuUrXPlvSW/eY6CjMfPnEvK0TrIrENxjdewqV6skouzm3GQn5R2uHZ2rotqqpoAshpHcEw3yyA9AAAAjXRSTlMA/hL+/v7+/v7+vlT91P0v/S1JLUaB3N7yEtwqgRJMvVNB3dpVSdTa2sV9fdPaha+w8rCFhbCv/////////////////////////////////////////////////////////////////////////////////////////////////////////////////wC9sE0CAAADIElEQVRYhc2V+1vSUBjHj1GghTM1byipaaV2v8LGRUVj3hCdSmVFJmaCoCKi4B0UsP7q3nO24eaVnT1PT9/fP5993/dsZwj972lu1skLgj7DW0F4o0tQLwj1enirIIyNWXUIekAw0KND8AoKDNyi59sJ/7mdWlBP+KnH1AWAx4KvD6kLiPwXygptMv/zI12FU/7bEA3fquAnXmvn2xT80MTSPa28Vc0PD9/QKDCbzVNKvrxcG//oLN/fX6mFbzUbjdvbKr6/97aG5xsxv7+P9y/xvZCSDRfzTqeztCmsxoWFjY2N/WRyc3PiYAnWJ/NOrrGEs2hbIHwS8wcHRxJPcJw71/Evgd/Z2UnmcoQ/KvKcGPvVi7j/AwJ8PpdLpVLAh9S8HefyElVdmD88PMznc4VUKp0OhcoZBW8XY2uovfjpXfM4wB/n84UC4UMM0+sivJ3jWLtssFWe+zSsdXdJ5uez2ezx8W6hsJZOh0NbDONykefbWZaVcZzGJ4oDqap78EtMNBol/O7vP2tr4fDWFuN2ORwceboosJ2m4bk0StUHKXt7YEhkV4GXBR4scMgC29nUqgR7kGgisbq6snICgvFwuA8LXJLAxrKXCPAIN0mCwWBRMDIyHu4b9ZAKHF4ACNSG4gg4TXUEDyYyouD7pHdkfLBv9BOpwJ03qJYoHWNHMJjJJGYrKkySABs87mIFWAHLipLzxyiO0pHJzIJgxXcyrazgkCrIiobLL8hOIjCZfNMXVJDfg6u/p/dgWDT5/NPqLYgG7Lj2VukEwaLP58cCpUFSXPs5w4FUKCsMikeJDbCJUi4UyNNFYpj0FoeQDCVfzN2nFWYUBg3XcreigmRwuzTwMIVcIQAVsMHj1vRjQcjkwxXi3oBsYLTxqAlXiMS964EZ0aD154pqiCC+LhlKOP+zeeePRSLx5fUANrzQziPkj8Wggmig4VENCCJly9hAMQCOJRYxlGHDMzoeKhgMc9hQTSlAFhCAgbYAVMCCubIaagEy8DwI6HnUwoOhRYfgBgh4zS+xMhaet+jh8Qx6JkComuepXwLJoJP/B/kLRT9a7+Axo0UAAAAASUVORK5CYII=",cursor:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAS1BMVEVHcEz39/QmJR7///3Ly8fOzcrn5uXT0s7My8jMy8j5+fbNzMkEAwAYFg0iIRqDg38uLSXW1tLm5uPw8O1SUUyxsa2cm5dwb2tHcEw+d/dAAAAAGXRSTlMA////5bgHQY/M//////////////////8A0IbxkwAAAmRJREFUWIWtl1migyAMRRVsRSYF1O5/p49BW1CC08uv5EgSQi5V9bN3S0jXNKxgTdMR0r6rnLUdU1obUxfNGK0V69qMu9I1pWXvYHaVVlsEYfqU8xeiGYn9X6q+5G8JtXrF/hfdPeJHIHf8HWGJomWFRRgX4CxksoPzh/U8awzSdec3AAVAKZ0F52IGq0tV6zcAfMVs4BIhyQcGxeG28M5ngGI1Ondnko8aQLA3EAE2/eoeEL3JpcLFQDIppHRCAiUm0JRLhSYWsN89G+Pff+PIpMICum37Yf3Zu/tN8M+upKarmhSA656LnHtA9HWKME3VJO50kqC7R8gpjaOp4ipmg8+kInJhMcB8uJCHZlNh8gDc8+GM2UOBIYDN0bEpGCBEoXPi/4CAYucEo4qLAsCnWYE3gFs1yjIA7pywaOLoCGCPi5igOCiSJwBwKvDM0RmAtUznuFuQo7MAKcQ+FfgjTgPcwmGTCltCdAXgSxoRKB3lNYBDRFG4El4FoBhgBvkIgOfl+01AKOEDQCjhfQBl6wbuAkb5CLCW8DbAIPkIkHy7AVia4BDAIQAek04HANRkpqoHRCV07fExNAvIjrYAGOTPPZ3yLB2utJ6E2AH8PbaELzY6o9mN91TbOAA14iuWtpeUHe9bgRGrqwD4Xff7iWEFxl7i4EXfLYClhPmL2mukjMiq5zUVHGPfBHZqZgQ9tQBA5q1CifsmkNlLPsi8A6HJ8SB98KDQLEjdaRD22NpgwEGnXyWxbQWZTYUV23Vu92sE/yD3nz847j55akX+69H1/Nn3/OH5/On7/PHt7Nbz/w/BUDv4oMpttwAAAABJRU5ErkJggg=="};var Ale={kind:"daily",time:"09:00",day:"mon",grace_minutes:"720",precheck_timeout:"60"},KU=()=>{let e=document.documentElement.dataset,t=!0;try{t=localStorage.getItem("kz-haptic")!=="off"}catch{}return{theme:e.theme||"system",color:e.color||"monochrome",motion:e.motion||"system",font:O.font.read(),notify:O.notices.on(),haptic:t,sound:O.notices.sound()}},Me=de()(()=>({data:null,scope:"all",page:null,q:"",back:!1,prefs:KU(),local:{},openAgents:[],draft:{...Ale},editing:"",busy:"",typed:{},startQ:"",startBack:!1,pageGen:0})),qU=(e,t)=>mt((n)=>({typed:{...n.typed,[e]:t}})),{getState:Tr,setState:mt}=Me;var iA=0;var Uu=(e,t)=>fetch(e,t).then((n)=>n.ok?n.json():null).catch(()=>null);async function oc(e=!1,t){let n=++iA;if(e)mt({data:null});let{scope:o}=Tr(),r={headers:O.dirHeader()},[a,i,s,l,c,d,u,p]=await Promise.all([Uu("/settings?scope="+encodeURIComponent(o)),Uu("/google"),Uu("/research-key"),Uu("/agent-prefs"),Uu("/accounts"),Uu("/skills"),Uu("/automations",r),Uu("/cleanup",r)]);if(!a&&o!=="all"){if(n!==iA||t?.())return;return mt({scope:"all"}),oc(!1,t)}if(n!==iA||t?.())return;mt({data:{cfg:a,google:i??{},research:s,agents:l,accounts:c,skills:d,automations:u,cleanup:p},prefs:KU(),local:{}})}var ig={el:null};var Io=()=>oc();async function A1(e,t){let n=Tr().data?.cfg;mt((r)=>({local:{...r.local,[e]:t}}));let o=await K("/settings",{key:e,value:t,scope:n?.scope});_(o.ok?"Saved":o.error||"Could not save"),await Io()}async function $U(e){let t=await K("/settings",{key:e,scope:Tr().data?.cfg?.scope,reset:!0});_(t.ok?"Reset to All projects":t.error||"Could not reset"),await Io()}async function YU(e){let t=await K("/pick-folder",{});if(t.path)await A1(e,t.path),O.reload()}async function sA(e){let t=await K("/settings",{key:"agent.default",value:e,scope:Tr().data?.cfg?.scope??null});_(t.ok?"Saved":t.error||"Could not save"),await Io()}async function Dp(e){let t=await K("/agent-prefs",e);_(t.error?t.error:"Saved"),await Io()}async function lA(e,t,n){if(e==="bypass"){if(!await mn({title:"Turn on bypass?",description:t?"This agent will run commands without asking.":"Agents will run commands without asking, in every project.",confirmLabel:"Turn on bypass",danger:!0}))return Io()}return Dp(t?{agent:t,agentPermissions:e}:{permissions:e})}var WU=(e)=>mt((t)=>({openAgents:t.openAgents.includes(e)?t.openAgents.filter((n)=>n!==e):[...t.openAgents,e]}));async function cv(e){let t=await K("/accounts",e);_(t.error?t.error:"Saved"),await Io()}async function M1(e,t){let n=O.currentDir();if(!n)return _("Open a project first, or run the line shown here in a terminal");let o=await K("/shell",{dir:n,agent:t,account:e,login:!0});if(o.error||!o.key)return _(o.error||"Could not open a terminal. Run the line shown here");let r=O.open.term({dir:n,ws:o.ws,key:o.key});_(r?"Sign in, then close the terminal":"Terminal started. Open it from the side menu")}async function XU(e){let t=await K("/accounts",{op:"add",tool:e});if(t.error||!t.added)return _(t.error||"Could not add the account");await M1(t.added,e),await Io()}async function QU(e,t){if(!await mn({title:`Remove ${t}?`,description:"Runs started on it won't start until you pick another.",confirmLabel:"Remove",danger:!0}))return;let o=await mn({title:"Also delete its folder?",description:"Its login and conversations are in it. Cancel keeps them.",confirmLabel:"Delete folder",danger:!0});return cv({op:"remove",id:e,deleteFolder:o})}var Mle={"kaizen-computer":"They see the window text of the apps they open and can click, set values and type in them, as you. A password manager is blocked by its name only, so one inside a browser or under another name is not. Any other open app is in reach.","lemo-opuscar":"The first time an agent uses it, it downloads the Lemo-Opuscar style library from github.com/lemomo-ai/lemo-opuscar (MIT) into ~/lemo-opuscar and installs its Node and Python packages there. It needs git, Node, Python and ffmpeg, and it runs that project's code on your computer."},Dle={"kaizen-computer":"Let agents read and operate the apps on your desktop?","lemo-opuscar":"Add film styles from Lemo-Opuscar?"},cA=()=>Tr().data?.skills?.token??"";async function uA(e,t,n){if(e==="rea")return dA(t,!1);let o=t&&n;if(o&&!await mn({title:Dle[e]??"Turn this skill on?",description:Mle[e],confirmLabel:"Turn on"}))return;let r=await K("/skills",{id:e,on:t,...o?{confirm:!0,token:cA()}:{}});_(r.error?r.error:"Saved. Applies to new sessions"),await Io()}async function ZU(e,t){if(t&&!await mn({title:"Replace your own copy?",description:"For at least one agent, a folder or link of the same name is in the way. It is deleted and kaizen's skill is linked in its place. Go ahead?",confirmLabel:"Replace",danger:!0}))return;let n=await K("/skills",{id:e,repair:!0,...t?{replace:!0,token:cA()}:{}});_(n.error?n.error:"Repaired. Applies to new sessions"),await Io()}async function dA(e,t){if(!e){if(!await mn({title:"Turn REA off?",description:"This runs REA's own uninstall: it removes REA's MCP registration and skill from every agent, also a REA you set up yourself outside kaizen. Ghidra, Java and REA's data stay.",confirmLabel:"Turn off",danger:!0}))return;_("Removing REA…");let s=await K("/rea",{step:"off"});if(!s.error)_(s.hint?`REA removed. Claude still has one: run ${s.hint}`:"REA removed. Restart your agents");return Io()}_(t?"Checking the newest REA…":"Asking REA what it would change… (first time downloads REA)");let n=await K("/rea",{step:"plan",update:t});if(n.error)return Io();let o=n.files?.length?n.files.map((i)=>" "+i).join(`
89
+ `):" (REA did not list files)";if(!await mn({title:`${t?"Update":"Set up"} REA ${n.version} for: ${n.clients.join(", ")}`,description:`REA's setup will change:
90
+ ${o}
91
+
92
+ It backs each file up first. Agents can then run REA's reverse-engineering tools on files you point them at. Go ahead?`,confirmLabel:t?"Update":"Set up"}))return;_(t?"Updating REA…":"Setting up REA…");let a=await K("/rea",{step:"apply",confirm:!0,token:n.token});if(!a.error)_(`REA ${a.version} is set up. Restart your agents to load its tools`);return Io()}async function JU(e,t){let n=e==="missing"?"Install":"Update";if(!await mn({title:`${n} Node.js?`,description:`REA needs it. kaizen will run:
93
+ ${t}
94
+
95
+ This installs Node.js for the whole computer, so other apps that use Node.js get it too. Your system may ask for permission. Go ahead?`,confirmLabel:n}))return;if(mt({busy:"rea-node"}),_(`${n==="Install"?"Installing":"Updating"} Node.js… this can take a few minutes`),!(await K("/rea",{step:"node",confirm:!0,token:cA()})).error)_("Node.js is ready. Restart any agents that are open so REA's tools load");mt({busy:""}),await Io()}async function Pp(e,t=""){let{draft:n,editing:o,data:r}=Tr(),a=r?.automations;if(e==="edit"){let s=a.rules.find((l)=>l.id===t);mt({editing:t,draft:{...n,name:s.name,text:s.text,kind:s.kind,cron:s.cron,agent:s.agent??"",precheck:s.precheck??"",precheck_timeout:String(s.precheck_timeout),grace_minutes:String(s.grace_minutes),time:"09:00",day:"mon"}});return}if(e==="cancel")return mt({editing:""});if(e==="delete"&&!await mn({title:"Delete this automation and its history?",confirmLabel:"Delete",danger:!0}))return;let i=await K("/automations",e==="save"?{op:o?"update":"create",id:o,...n}:{op:e,id:t});if(i.error)return _(i.error);if(e==="save"){let s={...n};for(let l of["name","text","cron","agent","precheck"])delete s[l];mt({editing:"",draft:s}),_("Saved")}else if(e==="run")_(i.ok?"Started":(i.status??"not started").replace(/_/g," ")+(i.why?": "+i.why:""));await Io()}var sg=(e,t)=>mt((n)=>({draft:{...n.draft,[e]:t}}));async function eG(e){let t=Tr().data?.cleanup;if(!t)return;let n=t.project?` in ${t.project}`:"",o=t.records.abandoned+t.records.unowned+t.records.gone;if(!await mn(e==="records"?{title:`Delete ${o} launch records${n}?`,confirmLabel:"Delete",danger:!0}:{title:`Permanently delete ${t.runs} finished runs${n}?`,description:"Their plans, reviews and reports go, and this cannot be undone.",confirmLabel:"Delete",danger:!0}))return;let a=await K("/cleanup",{what:e});_(a.error??`Removed ${a.removed}`),await Io()}async function tG(e,t){let n=await K("/google",{op:"client",id:e,secret:t});_(n.ok?"Saved":n.error||"Enter both the client id and the secret"),mt((o)=>({typed:{...o.typed,"gg-id":"","gg-secret":""}})),await Io()}async function nG(e){if(e)return await K("/google",{op:"disconnect"}),Io();let t=window.open("","_blank"),n=await K("/google",{op:"connect"});if(n.ok&&t)t.location=n.url;else t?.close(),_(n.error||"Could not start Google sign-in")}async function oG(e){if(!e.trim())return _("Paste your Firecrawl API key first");if((await K("/research-key",{op:"save",key:e.trim()})).set)_("Saved. kaizen search now uses Firecrawl");mt((n)=>({typed:{...n.typed,"fc-key":""}})),await Io()}async function rG(){mt({busy:"fc-test"});let e=await K("/research-key",{op:"test"});if(mt({busy:""}),e.tested)_("Firecrawl answered. The key works");else if(e.error)_(e.error)}async function aG(){if(!await mn({title:"Remove the saved Firecrawl key?",description:"Agents fall back to their own web tools.",confirmLabel:"Remove",danger:!0}))return;await K("/research-key",{op:"remove"}),await Io()}var pA=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};function iG(e,t){mt((n)=>({prefs:{...n.prefs,[e]:t}})),{theme:Zh,color:u6,motion:d6}[e](t)}function sG(e){O.font.set(e),mt((t)=>({prefs:{...t.prefs,font:e}}))}function lG(e){if(pA("kz-notify",e?"on":"off"),e)O.notify();mt((t)=>({prefs:{...t.prefs,notify:e}})),setTimeout(()=>void oc(),300)}function cG(e){pA("kz-haptic",e?"on":"off"),mt((t)=>({prefs:{...t.prefs,haptic:e}}))}function uG(e){pA("kz-sound",e),O.notices.play(e),mt((t)=>({prefs:{...t.prefs,sound:e}}))}function D1(e){mt({page:e}),history.replaceState(null,"","?view=settings"+(e?"&page="+e:""))}function dG(e){if(e===Tr().scope)return;mt({scope:e}),oc()}var fA=[["App",[{id:"general",title:"General",desc:"About kaizen, storage, folders and how the app opens.",ico:"gear"},{id:"appearance",title:"Appearance",desc:"Theme, color and motion in this browser.",ico:"sun"},{id:"notifications",title:"Notifications",desc:"Notices and sounds in this browser.",ico:"inbox"},{id:"keyboard",title:"Keyboard & Dictation",desc:"Shortcuts, and speech-to-text dictation run in the browser.",ico:"kbd"},{id:"terminal",title:"Terminal",desc:"Board terminals and the terminal dashboard.",ico:"term"}]],["Agents",[{id:"agents",title:"Agents",desc:"Manage AI agents, set a default, and customize commands.",ico:"ai"},{id:"models",title:"Models",desc:"The model each agent runs its stages and handoff sessions on.",ico:"mem"},{id:"accounts",title:"AI Accounts",desc:"Who is signed in to each AI tool kaizen runs. Add accounts only to switch between more than one.",ico:"link"},{id:"skills",title:"Skills",desc:"What your agents can do. Changes apply to new sessions.",ico:"note"}]],["Workflow",[{id:"runs",title:"Runs",desc:"How a run is carried out: who builds, who reviews, and what it remembers.",ico:"play"},{id:"approvals",title:"Approvals",desc:"Where a run stops and waits for you.",ico:"check"},{id:"autofix",title:"Auto-fix",desc:"What happens to review findings.",ico:"bug"},{id:"orchestration",title:"Orchestration",desc:"Split a run into workers, each in its own terminal. Off by default.",ico:"lgrid"},{id:"automations",title:"Automations",desc:"Schedules that start a run in this project.",ico:"clock"},{id:"git",title:"Git",desc:"Branches and commits for each run.",ico:"pen"}]],["Connections",[{id:"integrations",title:"Integrations",desc:"Icebox sources and ChatGPT, your Google account, and web research.",ico:"ext"},{id:"mobile",title:"Phone",desc:"Open kaizen from your phone, and send files to WhatsApp.",ico:"phone"}]]],uv=fA.flatMap(([,e])=>e),Ple={voice:"keyboard",shortcuts:"keyboard"},pG=(e)=>Ple[e]??e,Ole={general:["Storage","Folders","App"],keyboard:["Shortcuts","Dictation"]},_le=[[/^(preset|runner|explore\.|build\.|review\.executor)/,"runs","Workflow"],[/^review\.(write_memory|memory_max_lines)$/,"runs","Memory"],[/^(subagents\.|agent\.model\.claude$)/,"models","Claude Code"],[/^agent\.model\./,"models","Models"],[/^agent\.handoff_model\./,"models","Handoff session"],[/^agent\.default$/,"agents","Default agent"],[/^agent\./,"agents","Running agents"],[/^orchestration\./,"orchestration","Workers"],[/^dictation\./,"keyboard","Dictation"],[/^sources\./,"integrations","Icebox"],[/^(mode|approvals\.|auto_accept)/,"approvals","Approvals"],[/^auto_fix\./,"autofix","Auto-fix"],[/^auto_guard\./,"autofix","Auto mode guard"],[/^git\./,"git","Git"],[/^ui\./,"terminal","Terminal"],[/^board\.chat_hotkey$/,"keyboard","Shortcuts"],[/^board\.(projects_dir|video_dir)$/,"general","Folders"],[/^board\./,"general","App"],[/^state\./,"general","Storage"]],zle=(e)=>{let t=_le.find(([n])=>n.test(e));return t?[t[1],t[2]]:["general","Other"]},Ile=(e)=>/^(orchestration\.worker_model|agent\.model|agent\.handoff_model)\./.test(e);function fG(e){if(e.text)return Ile(e.key)?"model":e.folder?"folder":"text";let t=e.values;if(e.key==="preset")return"preset";if(t.length===2&&t.includes("true")&&t.includes("false"))return"switch";if(t.every((n)=>/^\d+$/.test(n))||t.length<=5&&t.every((n)=>n)&&t.join("").length<=32)return"segments";return"stepper"}var mA=(e)=>"s-"+e.replace(/\./g,"-"),gA={claude:["haiku","sonnet","opus"]},P1=(e)=>e.split(".").pop(),mG=(e)=>e.replace(/^(Worker|Handoff) model: /,""),gG=(e)=>[e.help,e.idle].filter(Boolean).join(" · ");function O1(e,t){if(!t)return"Off in this browser";if(e==="granted")return"";if(e==="denied")return"Pop-ups blocked by this browser; the sound still plays";return e?"Pop-ups wait for the browser to ask; the sound still plays":"Pop-ups not supported here; the sound still plays"}var hG=(e,t,n,o)=>Math.round(Math.min(o,Math.max(n,+e||t))),Lle=(e)=>e.toLowerCase(),Qt=(e,t,n,o,r)=>({id:e,kind:t,q:Lle(n),ref:o,off:r});function Ble(e,t){if(!e)return[];return e.rows.filter((n)=>!(n.key==="agent.default"&&t)).filter((n)=>!t||!/^agent\.(model|handoff_model)\./.test(n.key)||t.agents.some((o)=>o.installed&&n.key.endsWith("."+o.cmd)))}function hA(e,t){let n=new Map(uv.map((r)=>[r.id,new Map((Ole[r.id]??[]).map((a)=>[a,[]]))])),o=(r,a,i)=>{let s=n.get(r);if(!s.has(a))s.set(a,[]);s.get(a).push(i)};for(let r of Ble(e.cfg,e.agents)){let[a,i]=zle(r.key);o(a,i+(t.scoped&&r.group==="Board"?" · all projects":""),Qt(mA(r.key),"row",[r.label,r.help,r.key,r.group,...r.values].join(" "),r.key,!!r.idle))}if(e.cleanup)o("general","Storage",Qt("s-clean-records","cleanup","cleanup clean launch records sessions prune","records")),o("general","Storage",Qt("s-clean-runs","cleanup","cleanup delete old runs prune history","runs"));if(o("keyboard","Dictation",Qt("v-mic","mic","microphone input device mic dictation shortcut")),o("mobile","Phone",Qt("phset","phone","phone mobile tailscale qr connect address setup")),o("mobile","Phone",Qt("waset","whatsapp","whatsapp phone mobile qr message send")),o("integrations","Google",Qt("gg-id","google-id","google oauth client id sheets write back")),o("integrations","Google",Qt("gg-secret","google-secret","google oauth client secret")),e.research)o("integrations","Research",Qt("fc-key","fc-key","firecrawl api key research web search scrape explore internet")),o("integrations","Research",Qt("fc-test","fc-test","firecrawl status test remove research web search"));return o("integrations","Google",Qt("gg-conn","google-conn","google account connect sheets write back")),o("appearance","Browser",Qt("th","theme","theme light dark system browser")),o("appearance","Browser",Qt("co","color","color colour palette monochrome blue theme browser")),o("appearance","Browser",Qt("mo","motion","motion animation reduce reduced browser")),o("terminal","Browser",Qt("tf","font","terminal font size text zoom browser")),o("notifications","Browser",Qt("nt","notify","notifications "+t.notifyHelp+" browser")),o("notifications","Browser",Qt("hp","haptic","haptic feedback vibrate vibration touch tap phone browser")),o("notifications","Browser",Qt("ns","sound","notification sound audio browser",void 0,!t.notifyOn)),n}var bG=["claude","codex","gemini","agy"],bA={claude:"Claude",codex:"Codex",gemini:"Gemini CLI",agy:"Antigravity"},Hle=[["core","Core"],["media","Media"],["optional","Optional"]],jle=(e)=>bG.filter((t)=>e.accounts.some((n)=>n.tool===t)||(e.normal??[]).some((n)=>n.tool===t)),vG=(e)=>bG.filter((t)=>t!=="agy").filter((t)=>t!=="gemini"||(e.normal??[]).some((n)=>n.tool===t)||e.accounts.some((n)=>n.tool===t));function yG(e,t,n,o=hA(t,n)){let r=[];if(e==="agents"&&t.agents){let a=t.agents,i=a.agents.filter((s)=>s.enabled&&s.installed);r.push({title:"Default agent",items:[Qt("ag-def","agent-default","default agent auto tool launches "+i.map((s)=>s.name).join(" "))]}),r.push({title:"Permissions",items:[Qt("ag-perm","agent-perm","permissions bypass yolo all agents without asking")]}),r.push({title:`Installed · ${n.agentCount} detected`,extra:"refresh",items:a.agents.map((s)=>Qt("ag-"+s.cmd,"agent",[s.name,s.cmd,"agent installed command arguments environment permissions"].join(" "),s.cmd))})}if(e==="accounts"&&t.accounts){let a=t.accounts;for(let i of jle(a))r.push({title:bA[i],items:[...(a.normal??[]).filter((s)=>s.tool===i).map((s)=>Qt("ac-normal-"+i,"account-normal",`account login normal default ${i} ${s.who??""}`,i)),...a.accounts.filter((s)=>s.tool===i).map((s)=>Qt("ac-"+s.id,"account",`account ${s.name} ${s.tool}`,s.id))]});r.push({title:"Add an account",items:[Qt("ac-add","account-add","add account sign in claude codex gemini provider")]})}if(e==="orchestration"&&t.cfg)r.push({title:"",items:[Qt("orch","orchestration","orchestration workers flow plan merge review")]});if(e==="skills"&&t.skills)Hle.filter(([a])=>t.skills.skills.some((i)=>i.group===a)).forEach(([a,i],s)=>r.push({title:i,extra:s?void 0:"recheck",items:t.skills.skills.filter((l)=>l.group===a).map((l)=>Qt("sk-"+l.id,"skill",[l.title,l.id,l.description,l.group,"skill"].join(" "),l.id))}));if(e==="automations"){let a=t.automations;r.push({title:"Automations",items:a?[...a.rules.map((i)=>Qt("au-"+i.id,"automation",["automation",i.name,i.text,i.cron].join(" "),i.id)),Qt("au-form","automation-form","automation new create add schedule")]:[Qt("au-none","automation-none","automation")]})}for(let[a,i]of o.get(e)??[])if(i.length)r.push({title:a,items:i});return r}function xG(e,t){let n=t.trim().toLowerCase();if(!n)return e;return e.map((o)=>o.title?{...o,items:o.items.filter((r)=>r.q.includes(n))}:o).filter((o)=>!o.title||o.items.length)}var wG=(e)=>e.some((t)=>t.title&&t.items.length);function kG(e){let t=!!e.query.trim();if(e.narrow&&t&&e.typing)return null;if(e.picked&&e.hits.includes(e.picked))return e.picked;return t||!e.narrow?e.hits[0]??null:null}var SG=(e)=>e.signedIn&&(e.who||e.via||e.plan)?[e.who??(e.via?`via ${e.via}`:""),e.plan].filter(Boolean).join(" · "):"";function CG(e,t,n=!0){if(!e)return{text:t?n?"Signed in · no usage yet":"Signed in":"Not signed in",bad:!t};if(e.expired)return{text:"Sign-in expired. Sign in again",bad:!0};if(e.error)return{text:"Usage unavailable",bad:!0};return{text:`${e.five?`${e.five.pct}% of 5 hours`:""}${e.five&&e.week?" · ":""}${e.week?`${e.week.pct}% of the week`:""}`,bad:!1}}var Ka=(e)=>["path",{d:e}],Ule=[Ka("M10 4a2 2 0 1 1 4 0v2h5v5h-2a2 2 0 1 0 0 4h2v5H5v-5h2a2 2 0 1 0 0-4H5V6h5Z")],Gle={kaizen:[Ka("M4 7h11M4 12h7M4 17h11"),Ka("m16 11 2 2 3-4")],"kaizen-help":[["circle",{cx:12,cy:12,r:9}],Ka("M9.5 9.5a2.5 2.5 0 1 1 3.8 2.1c-.9.6-1.3 1.1-1.3 2.1"),Ka("M12 17h.01")],"kaizen-book":[Ka("M12 6c-2-1.5-5-2-8-2v15c3 0 6 .5 8 2 2-1.5 5-2 8-2V4c-3 0-6 .5-8 2Z"),Ka("M12 6v15")],"kaizen-deck":[["rect",{x:3,y:4,width:18,height:12,rx:1}],Ka("M12 16v4M8 20h8M8 12l3-3 2 2 3-3")],"kaizen-computer":[["rect",{x:3,y:4,width:18,height:12,rx:1}],Ka("M8 20h8M12 16v4M9 8l5 3-2 .8-.8 2Z")],"kaizen-game":[["rect",{x:2,y:7,width:20,height:11,rx:5}],Ka("M7 10.5v4M5 12.5h4"),["circle",{cx:16,cy:11.5,r:0.6}],["circle",{cx:18,cy:13.5,r:0.6}]],"kaizen-video":[["rect",{x:3,y:6,width:13,height:12,rx:2}],Ka("m16 10 5-3v10l-5-3")],rea:[["circle",{cx:10.5,cy:10.5,r:6}],Ka("m15 15 6 6"),Ka("M8.5 9 7 10.5 8.5 12M12.5 9l1.5 1.5-1.5 1.5")]},NG=(e)=>Gle[e]??Ule;var _1=()=>globalThis.kaizenDesktop,dv=()=>_1()?"Kaizen":"kaizen",Gu=de()(()=>({ver:null,later:(()=>{try{return localStorage.getItem("kz-upd-later")}catch{return null}})()})),vA=(e)=>`${dv()} ${e.latest} is available. You are running ${e.version}. Update it from the desktop app on your computer.`,RG=(e)=>e.behind?vA(e):`${dv()} ${e.version} is up to date.`,yA=(e)=>!!e?.update,xA=(e)=>_1()?_1().check():fetch(e?"/version?fresh=1":"/version").then((t)=>t.json()),wA=(e)=>Gu.setState({ver:e}),kA=()=>xA(!1).then(wA,()=>{});function TG(e){try{localStorage.setItem("kz-upd-later",e)}catch{}Gu.setState({later:e})}async function EG(e){let t=_1(),n=t?{title:`Install Kaizen ${e.latest}?`,description:"The app restarts, and agents it runs stop.",confirmLabel:"Install"}:{title:`Update kaizen to ${e.latest}?`,description:"kaizen restarts, and agents it runs stop.",confirmLabel:"Update"};if(!await mn(n))return"no";if(t){let o=await t.install().catch((r)=>({ok:!1,opened:!1,error:String(r)}));if(o&&!o.ok)_(`Could not install the update: ${o.error}`);return o&&o.opened?"opened":o&&o.ok?"restarting":"no"}if(!(await K("/upgrade",{})).ok)return"no";return setTimeout(()=>location.reload(),20000),"restarting"}async function SA(){if(Ze().view!=="settings")return;let e=Tr().pageGen+1;mt({pageGen:e}),Xr(!0);let t=!Re().open||Re().title!=="Settings";if(bu(),Pe({openKey:null,card:null,runDoc:null}),Pe({open:!0,title:"Settings",titleTip:"",head:null,tabs:[],footer:null,body:"settings"}),t)mt({typed:{},scope:"all",q:Tr().startQ,back:Tr().startBack,page:Tr().page??pG(new URLSearchParams(location.search).get("page")??"")});oc(t,()=>e!==Tr().pageGen)}var It=h(w(),1),Fle=["claude","codex","gemini"],CA=({a:e})=>It.jsx("svg",{"aria-hidden":"true",children:It.jsx("use",{href:`#i-${Fle.includes(e.agent??"")?e.agent:"ai"}`})}),NA=({st:e})=>It.jsx("i",{className:`si ${Wd[e]}`}),AG=(e,t)=>!e?"":t-e<60000?"now":co(e,t);function MG({rows:e,now:t,open:n,dir:o,ws:r}){if(!e.length)return null;let a=(s,l)=>(s.preventDefault(),qL(o,r,l));if(e.length===1){let s=e[0];return It.jsx("div",{className:"wag",children:It.jsxs("button",{type:"button",className:"aone",title:`${s.a.name}: open its terminal`,onClick:(l)=>a(l,s.a.key),children:[It.jsx(NA,{st:s.st}),It.jsx(CA,{a:s.a}),It.jsxs("span",{className:"atx",children:[zl[s.st]," - ",s.a.name]}),It.jsx("small",{children:AG(s.a.at,t)})]})})}let i=It.jsx("button",{type:"button",className:`wchev${n?" on":""}`,"aria-expanded":n,"aria-label":`${e.length} agents: ${n?"hide":"show"} the list`,onClick:(s)=>(s.preventDefault(),UL(o,r)),children:It.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:It.jsx("path",{d:"M6 9l6 6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});if(n)return It.jsxs(It.Fragment,{children:[It.jsxs("div",{className:"wag",children:[It.jsxs("span",{className:"aht",children:[e.length," agents"]}),i]}),It.jsx("div",{className:"alist",children:e.map((s)=>It.jsxs("button",{type:"button",className:"arow",title:MR(s),onClick:(l)=>a(l,s.a.key),children:[It.jsx(NA,{st:s.st}),It.jsx(CA,{a:s.a}),It.jsx("span",{className:"atx",children:MR(s)}),It.jsx("small",{children:AG(s.a.at,t)})]},s.a.key))})]});return It.jsxs("div",{className:"wag",children:[It.jsx("span",{className:"chips",children:GI(e).map((s)=>It.jsxs("span",{className:"chip",children:[It.jsx(NA,{st:s.st}),s.rs.map((l)=>It.jsx("button",{type:"button",className:"amark",title:`${l.a.name} - ${zl[s.st]}: open its terminal`,"aria-label":`${l.a.name} - ${zl[s.st]}: open its terminal`,onClick:(c)=>a(c,l.a.key),children:It.jsx(CA,{a:l.a})},l.a.key))]},s.st))}),i]})}var jF=h(I(),1);var DG=h(I(),1);var Fu=h(w(),1);function me({icon:e,label:t,active:n,size:o="md",href:r,className:a,children:i,...s}){return Fu.jsxs(R1,{children:[Fu.jsx(T1,{asChild:!0,children:Fu.jsxs(r?"a":"button",{...r?{href:r}:{type:"button"},"aria-label":n?`${t} (on)`:t,className:C("relative grid shrink-0 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",o==="sm"?"size-(--btn-xs) max-[640px]:size-8 [&_svg]:size-(--ico)":"size-(--btn-s)",n&&"text-foreground",a),...s,children:[typeof e==="string"?Fu.jsx(L,{name:e}):e,n&&Fu.jsx("span",{"aria-hidden":"true",className:"absolute right-1.5 top-1.5 size-[7px] rounded-full bg-primary shadow-[0_0_0_2px_var(--bg)]"}),i]})}),Fu.jsx(E1,{children:t})]})}var ha=h(w(),1);function z1({label:e,icon:t="more",items:n,children:o,className:r,triggerClassName:a,size:i}){return ha.jsxs(En,{children:[ha.jsx(An,{asChild:!0,children:ha.jsx(me,{icon:t,label:e,className:C(i==="sm"&&"size-(--btn-xs) [&_svg]:size-4",a),onClick:(s)=>s.stopPropagation()})}),ha.jsxs(Mn,{className:C("w-[340px] max-w-[80vw] text-sm",r),onClick:(s)=>s.stopPropagation(),onKeyDown:(s)=>s.stopPropagation(),children:[o,o&&n.length>0&&ha.jsx(Zr,{}),n.map((s)=>s.href?ha.jsx(nn,{asChild:!0,children:ha.jsx("a",{href:s.href,children:s.label})},s.id):ha.jsxs(DG.Fragment,{children:[s.before&&ha.jsx(Zr,{}),ha.jsxs(nn,{onSelect:s.onSelect,className:s.danger?"text-danger data-[highlighted]:text-danger":void 0,children:[s.icon&&ha.jsx(L,{name:s.icon,className:"size-[15px] shrink-0"}),s.label,s.count!=null&&ha.jsx("i",{className:"ml-auto text-xs not-italic text-muted-foreground",children:s.count})]})]},s.id))]})]})}var rc=h(w(),1);function lg({open:e,title:t,description:n,confirmLabel:o,danger:r,onConfirm:a,onCancel:i}){return rc.jsx(m1,{open:e,onOpenChange:(s)=>!s&&i(),children:rc.jsxs(g1,{children:[rc.jsx(ov,{children:t}),n&&rc.jsx(rv,{className:"whitespace-pre-line",children:n}),rc.jsxs("div",{className:"mt-1 flex justify-end gap-1.5",children:[rc.jsx(h1,{children:"Cancel"}),rc.jsx(b1,{danger:r,onClick:a,children:o})]})]})})}var OG=h(w(),1);function PG(){let e=pm((t)=>t.open);return OG.jsx(lg,{open:!!e,title:e?.title??"",description:e?.description,confirmLabel:e?.confirmLabel??"OK",danger:e?.danger,onConfirm:()=>zN(!0),onCancel:()=>zN(!1)})}var _G=h(I(),1);var Op=h(w(),1);function Vu({onFiles:e,className:t}){let n=_G.useRef(null);return Op.jsxs(Op.Fragment,{children:[Op.jsx(me,{icon:"clip",label:"Attach files",className:t,onClick:()=>n.current?.click()}),Op.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,onChange:(o)=>{let r=[...o.target.files??[]];o.target.value="",e(r)}})]})}var I1=h(w(),1);function ac({count:e,className:t,children:n,...o}){return I1.jsxs(ag,{className:C("inline-flex h-[26px] items-center gap-1.5 whitespace-nowrap rounded-sm border border-border bg-card px-2.5 text-sm text-foreground hover:bg-muted data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",t),...o,children:[n,e!=null&&I1.jsx("i",{className:"text-xs not-italic tabular-nums opacity-75",children:e})]})}var pv=h(w(),1);function cg(){return pv.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"size-[13px] shrink-0",children:[pv.jsx("circle",{cx:"8",cy:"5.2",r:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),pv.jsx("path",{d:"M3 13.6c.7-2.5 2.6-3.8 5-3.8s4.3 1.3 5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var _p=h(w(),1);function ba({icon:e,title:t,help:n,children:o,busy:r}){return _p.jsxs("div",{role:r?"status":void 0,className:"flex flex-col items-center gap-1 px-6 py-14 text-center text-lg text-muted-foreground",children:[e&&_p.jsx(L,{name:e,className:"mb-3 size-8 opacity-60"}),_p.jsx("p",{className:"text-[16px] font-medium text-foreground",children:t}),n&&_p.jsx("span",{children:n}),o&&_p.jsx("div",{className:"mt-2",children:o})]})}var zG=h(I(),1);var ic=h(w(),1);function Se({id:e,label:t,help:n,error:o,inline:r,row:a,dim:i,children:s}){let l=zG.useId(),c=e??l,d=`${c}-help`,u=`${c}-err`,p=[n&&d,o&&u].filter(Boolean).join(" ")||void 0,f=s({id:c,"aria-describedby":p,"aria-invalid":o?!0:void 0},`${c}-l`),g=n&&ic.jsx("p",{id:d,className:C("text-sm text-muted-foreground",a&&"col-start-1 text-xs leading-normal"),children:n}),m=o&&ic.jsx("p",{id:u,role:"alert",className:"text-sm text-danger",children:o});if(a)return ic.jsxs("div",{className:"grid min-h-11 grid-cols-[minmax(0,1fr)_auto] gap-x-6 gap-y-0.5 px-3.5 py-2.5 @max-[520px]:grid-cols-1",children:[ic.jsx(tc,{id:`${c}-l`,htmlFor:c,className:C("self-center text-sm font-normal text-strong",i&&"opacity-50"),children:t}),ic.jsx("div",{className:C("col-start-2 self-center justify-self-end @max-[520px]:col-start-1 @max-[520px]:row-auto @max-[520px]:mt-1.5 @max-[520px]:max-w-full @max-[520px]:justify-self-start",(n||o)&&"row-span-2",i&&"opacity-50"),children:f}),g,m]});return ic.jsxs("div",{className:r?"flex min-w-0 items-center gap-1.5":"flex flex-col gap-1.5",children:[ic.jsx(tc,{id:`${c}-l`,htmlFor:c,className:r?"shrink-0 text-xs text-muted-foreground":void 0,children:t}),f,g,m]})}var IG=h(I(),1);var ug=h(w(),1);function L1({label:e,active:t,children:n,className:o}){let[r,a]=IG.useState(!1);return ug.jsxs(rr,{open:r,onOpenChange:a,children:[ug.jsx(ar,{asChild:!0,children:ug.jsx(me,{icon:"filter",label:e,active:t})}),ug.jsx(ir,{className:o??"flex flex-col gap-1.5 p-2",children:typeof n==="function"?n(()=>a(!1)):n})]})}var LG=h(w(),1);function jr({inline:e,children:t,label:n}){return LG.jsx("form",{"aria-label":n,onSubmit:(o)=>o.preventDefault(),className:C("flex min-w-0 flex-col gap-2 whitespace-normal text-base [overflow-wrap:anywhere]",e&&"rounded-sm border border-primary bg-card p-3 shadow-md"),children:t})}var zp=h(I(),1);var Ku=h(w(),1),Vle=[0.5,0.9,1.3,0.8,0.45],Kle=()=>Ku.jsx("span",{"aria-hidden":"true",className:"inline-flex h-full items-center gap-0.5",children:Vle.map((e,t)=>Ku.jsx("i",{style:{"--w":e},className:"w-0.5 rounded-[1px] bg-current transition-[height] duration-[80ms] h-[calc(3px+12px*min(1,var(--lvl,0)*var(--w)))]"},t))});function sc({field:e,also:t=[],className:n}){let o=zp.useId(),r=zp.useRef(null),a=zp.useRef(null),i=Rw((s)=>s.st[o]??_R);if(zp.useEffect(()=>{if(!kb())return;let s=[e,...t].map((c)=>c.current).filter((c)=>!!c);a.current=s[0]??null;let l=s.map((c)=>{let d=()=>a.current=c;return c.addEventListener("focus",d),()=>c.removeEventListener("focus",d)});return()=>{if(l.forEach((c)=>c()),Aw(o))Xr(!0)}},[]),!kb())return null;return Ku.jsx("span",{ref:r,className:C("inline-flex",n),children:Ku.jsx(me,{icon:i.on?Ku.jsx(Kle,{}):i.loading&&i.pct!=null?Ku.jsxs("i",{className:"text-[10px] not-italic tabular-nums",children:[i.pct,"%"]}):"mic",label:"Dictate",className:C("size-[26px] [&_svg]:size-[15px]",(i.on||i.busy)&&"text-primary"),onClick:(s)=>{if(s.preventDefault(),s.stopPropagation(),a.current)Mw({id:o,el:r.current,target:()=>a.current})}})})}var Ci=h(w(),1);function fv({at:e,size:t,total:n,onAt:o,onSize:r}){if(n<=lw[0])return null;let a=e*t+1,i=Math.min(n,a+t-1);return Ci.jsxs("div",{className:"sticky bottom-0 z-[1] flex items-center justify-end gap-2.5 border-t border-border bg-background px-3 py-2 text-sm text-muted-foreground",children:[Ci.jsxs("label",{className:"mr-auto flex items-center gap-1.5",children:["Rows",Ci.jsxs(Pt,{value:String(t),onValueChange:(s)=>r(Number(s)),children:[Ci.jsx(_t,{"aria-label":"Rows per page",size:"sm",className:"w-auto",children:Ci.jsx(Ot,{})}),Ci.jsx(zt,{children:lw.map((s)=>Ci.jsx(dt,{value:String(s),children:s},s))})]})]}),Ci.jsxs("span",{children:[a,"–",i," of ",n]}),Ci.jsx(M,{size:"sm",disabled:!e,onClick:()=>o(e-1),children:"Prev"}),Ci.jsx(M,{size:"sm",disabled:i>=n,onClick:()=>o(e+1),children:"Next"})]})}var BG=h(I(),1);var yo=h(w(),1);function Ni({options:e,value:t,onChange:n,placeholder:o="Choose",label:r,className:a,groupIcons:i,open:s,onOpenChange:l}){let[c,d]=BG.useState(!1),u=s??c,p=(y)=>(d(y),l?.(y)),f=e.find((y)=>y.value===t),g=(y)=>yo.jsxs(rg,{value:`${e.indexOf(y)}:${y.value}`,keywords:[y.label,y.group??"",y.search??""],onSelect:()=>{n(y.value),p(!1)},children:[y.icon,yo.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.label}),y.count!=null&&yo.jsx("i",{className:"text-xs not-italic tabular-nums text-muted-foreground",children:y.count}),y.value===t&&yo.jsx(L,{name:"check",className:"size-3.5 text-primary"})]},y.value),m=[...new Set(e.map((y)=>y.group).filter((y)=>!!y))];return yo.jsxs(rr,{open:u,onOpenChange:p,children:[yo.jsx(ar,{asChild:!0,children:yo.jsxs("button",{type:"button","aria-label":f?`${r}: ${f.label}`:r,className:C("inline-flex h-(--btn-s) max-w-full items-center justify-between gap-2 rounded-sm border border-border bg-card px-2.5 text-base hover:border-muted-foreground",!f&&"text-muted-foreground",a),children:[f?.icon,yo.jsx("span",{className:"min-w-0 truncate",children:f?.label??o}),yo.jsx(L,{name:"chev",className:"size-3 shrink-0 text-muted-foreground"})]})}),yo.jsx(ir,{align:"start",className:"w-[320px]",children:yo.jsxs(tg,{filter:(y,b,x)=>x?.join(" ").toLowerCase().includes(b.trim().toLowerCase())?1:0,children:[yo.jsx(ng,{placeholder:"Search…","aria-label":`Search ${r}`}),yo.jsxs(og,{children:[yo.jsx(x1,{children:"Nothing matches"}),e.filter((y)=>!y.group).map(g),m.map((y)=>yo.jsx(w1,{heading:i?.[y]?yo.jsxs(yo.Fragment,{children:[i[y],y]}):y,children:e.filter((b)=>b.group===y).map(g)},y))]})]})})]})}var BF=h(I(),1);var cc={x:"X",tiktok:"TikTok",instagram:"Instagram",threads:"Threads"},Ip={client:"Client",finding:"Finding",people:"People say"},UG={casual:"Casual",fun:"Fun",helpful:"Helpful",promo:"Promo"},qu=(e)=>/^https?:\/\//i.test(String(e))?e:"#",cs=(e)=>{try{return new URL(e).hostname}catch{return e}},lc=(e,t)=>String(e||"").toLowerCase()===String(t||"").toLowerCase(),Te=(e)=>e.dir+" "+e.id,HG=(e)=>e.dir+" "+e.source,B1=(e)=>[...e].reduce((t,n)=>(t*31+n.charCodeAt(0))%360,7),Er=(e,t=Date.now())=>{let n=Math.round((t-Date.parse(e))/60000);return n<1?"just now":n<60?n+" min ago":n<1440?Math.round(n/60)+" h ago":Math.round(n/1440)+" d ago"},qle=(e,t=new Date)=>{let n=new Date(t);if(e==="1d")n.setDate(n.getDate()+1);else if(e==="1w")n.setDate(n.getDate()+7);else if(e==="1m")n.setMonth(n.getMonth()+1);else return new Date(e+"T00:00:00");return n},GG=(e)=>e.toLocaleDateString("sv"),FG=(e,t)=>`${e>1?e+" snoozed":"Snoozed"} until ${qle(t).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}`,VG=(e)=>{if(e.social)return"social";let t=e.url;if(t.includes("docs.google.com/spreadsheets")||t.endsWith(".csv")||t.endsWith(".tsv"))return"sheet";if(t.includes("docs.google.com/document"))return"doc";return"link"},H1=(e)=>e?.social&&cc[e.social]||(e?cs(e.url).replace(/^www\./,""):"")||"Other",us=(e,t)=>e.find((n)=>n.dir===t.dir&&n.url===t.source),Ri=(e,t)=>{let n=us(e,t);return n?n.label||cs(n.url):cs(t.source)},RA=(e,t)=>t.status==="dismissed"?"Dismissed":t.status==="done"?"Done":t.status==="promoted"?"Promoted":t.category||us(e,t)?.category||H1(us(e,t)||{url:t.source}),j1=(e)=>!["promoted","dismissed","done"].includes(e.status),ea=(e)=>e.status==="new",KG=(e)=>e==="Dismissed"||e==="Done"||e==="Promoted",U1=(e)=>(e.images||[]).filter((t)=>/^https:\/\//.test(t));function qG(e){let t="";try{let n=new URL(e);if(/^https?:$/.test(n.protocol))t=n.origin}catch{}return!t?"":e.includes("docs.google.com/spreadsheets")?"https://ssl.gstatic.com/docs/spreadsheets/favicon3.ico":e.includes("docs.google.com/document")?"https://ssl.gstatic.com/docs/documents/images/kix-favicon7.ico":t+"/favicon.ico"}var jG=(e,t)=>{let n=new Map;return e.forEach((o)=>{let r=t(o);n.set(r,{it:o,n:(n.get(r)?.n||0)+1})}),n};function $G(e,t,n){let o=e.sources||[],r=(e.icebox||[]).filter((S)=>!S.asleep),a=[...r,...e.dismissed||[]],i=r.filter((S)=>S.status==="new").length,s=new Set(n.dir?[]:a.map((S)=>S.dir));if(!n.dir){for(let S of n.shown)if(n.showable.some((N)=>N.dir===S))s.add(S)}let l=(S)=>!!n.dir||!n.shown.size||n.shown.has(S.dir),c=a.filter(l),d=[...new Map((e.boards||[]).filter(l).map((S)=>[S.name.toLowerCase(),S])).values()],u=t.board&&d.some((S)=>lc(S.name,t.board))?t.board:"",p=(S)=>!u||lc(S.board,u),f=(S)=>!t.kinds.length||t.kinds.includes(S.kind||""),g=c.filter((S)=>p(S)&&f(S)),m=jG(g,(S)=>RA(o,S)),y=t.cat&&m.has(t.cat)?t.cat:"",b=g.filter((S)=>!y||RA(o,S)===y),x=jG(b,HG),v=t.src&&x.has(t.src)?t.src:"",k=a.filter((S)=>l(S)&&p(S)&&f(S)&&(y?RA(o,S)===y:S.status==="new")&&(!v||HG(S)===v)).sort((S,N)=>(Date.parse(N.at)||0)-(Date.parse(S.at)||0));return{list:o,ice:a,waiting:i,many:s.size>1,boards:d,byCat:m,bySrc:x,filtered:k,board:u,cat:y,src:v,inProj:l,nOn:(S)=>c.filter((N)=>j1(N)&&lc(N.board,S.name)).length}}function YG(e,t){let n=new Map;for(let[o,{it:r}]of t){let a=H1(us(e,r)||{url:r.source});n.has(a)||n.set(a,[]),n.get(a).push([o,r])}return n}var WG=(e,t)=>e.toLowerCase().startsWith(t.toLowerCase()+":")?e.slice(t.length+1).trim():e;function XG(e,t,n){let o=e.findIndex((i)=>Te(i)===t);if(o<0||!t||!n.has(t))return t;let r=(i)=>!n.has(Te(i)),a=e.slice(o+1).find(r)??e.slice(0,o).reverse().find(r);return a?Te(a):null}function QG(e,t){let n=(i)=>t.some((s)=>s.url===i.url&&s.social),o=e.reduce((i,s)=>i+s.added,0),r=e.filter((i)=>!i.ok&&!n(i)).length,a=e.filter(n).length;return(o?`${o} new in the icebox`:"Nothing new")+(r?`, ${r} source${r===1?"":"s"} could not be read`:"")+(a?`; ${a} social for /kaizen gather`:"")}var TA=0.35;function ZG(e,t){return e.filter(j1).sort((n,o)=>(t.get(Te(n))||0)-(t.get(Te(o))||0))}var Ar=(e)=>e.split(/[\\/]/).pop()||e,JG=(e,t)=>e.project||t.find((n)=>n.dir===e.dir)?.label||"";var $le=(e)=>{try{return localStorage.getItem(e)}catch{return null}},_n=de()(()=>({data:null,loaded:!1,view:$le("kz-ice-view")==="sort"?"sort":"cards",board:"",kinds:[],cat:"",src:"",sel:[],cur:null,open:null,armed:null,form:null,task:null,reply:null,styles:{},cap:{text:"",files:[],board:"",boardDir:null,dir:null,busy:!1},srcShow:!1,srcAdd:!1,srcKind:"link",draft:{url:"",q:"",plat:"x",label:"",cat:"",to:""},swipe:null,busy:!1,order:[],deck:[],ask:null,tick:0})),gn=_n.getState,ds={swCard:null,srcTog:null},W=_n.setState,ta=(e)=>W((t)=>({cap:{...t.cap,...e}})),$u=(e)=>W((t)=>({draft:{...t.draft,...e}}));var eF=h(I(),1);var MA=0,EA=!1,AA=!1;async function uc(){if(Ze().page!=="icebox")return;if(EA){AA=!0;return}EA=!0;do{AA=!1;let e=++MA,t=await l_(O.scopeDir());if(e!==MA||Ze().page!=="icebox")continue;W({data:t,loaded:!0})}while(AA);EA=!1}function tF(){eF.useEffect(()=>{let e=()=>void uc();e();let t=[zr(e),ui((n)=>n.changed,e),Ol.subscribe((n,o)=>n.shown!==o.shown&&e())];return()=>{t.forEach((n)=>n()),MA++}},[])}var Js=async()=>{O.reload(),await uc(),requestAnimationFrame(()=>{if(!document.activeElement||document.activeElement===document.body)document.querySelector("[data-cur] [data-title]")?.focus()})},G1=(e)=>{let t=gn();W({cur:XG(t.order,t.cur,new Set(e.map(Te)))})},DA=(e)=>[...new Set(e.map((t)=>t.dir))].map((t)=>[t,e.filter((n)=>n.dir===t)]),nF=(e)=>new Promise((t)=>W({ask:e((n)=>{W({ask:null}),t(n)})})),PA=(e="")=>nF((t)=>({kind:"collection",where:e,done:t})),OA=(e,t,n,o=!1)=>nF((r)=>({kind:"confirm",title:e,description:t,label:n,danger:o,done:r}));async function dc(e,t,n,o={}){if(G1([t]),(await K("/icebox",{op:e,dir:t.dir,ids:[t.id],...o})).ok){if(e==="promote"&&gn().open===Te(t))W({open:null,armed:null,form:null});_(n)}await Js()}async function pc(e,t){if(!e.length)return;G1(e),W({busy:!0});let n=[];try{for(let[o,r]of DA(e))if((await K("/icebox",{op:"snooze",dir:o,ids:r.map((a)=>a.id),until:t})).ok)n.push(...r)}finally{W({busy:!1})}if(n.length){let o=new Set(n.map(Te));W((r)=>({sel:r.sel.filter((a)=>!o.has(a))})),PN(FG(n.length,t),async()=>{let r=0;for(let[a,i]of DA(n))if((await K("/icebox",{op:"unsnooze",dir:a,ids:i.map((s)=>s.id)})).ok)r++;if(r)W({cur:Te(n[0])}),_("Back in the icebox");await Js()})}await Js()}async function _A(e,t,n){if((await K("/icebox",{dir:e.dir,ids:[e.id],...t})).ok)_(n);await Js()}async function oF(e,t){if(t===`
96
+ `){let n=await PA();if(!n)return;if(n.client)await K("/icebox",{op:"boards",act:"add",dir:e.dir,name:n.name,client:!0});t=n.name}return _A(e,{op:"board",board:t},t?`Moved to ${t}`:"Moved to the Inbox")}async function dg(e){let t=new Set(gn().sel),n=gn().order.filter((r)=>t.has(Te(r)));if(!n.length)return;G1(n),W({busy:!0});let o=0;try{if(e==="dismiss")for(let[r,a]of DA(n)){let i=a.map((s)=>s.id);if((await K("/icebox",{op:e,dir:r,ids:i})).ok)o+=i.length}else for(let r of n)if((await K("/icebox",{op:e,dir:r.dir,ids:[r.id]})).ok)o++}finally{W({busy:!1})}if(W({sel:[]}),o)_(`${o} ${e==="promote"?"promoted to Tasks":"dismissed"}${o<n.length?`, ${n.length-o} not`:""}`);await Js()}async function rF(e,t){if(O.motion())await new Promise((o)=>setTimeout(o,180));O.pop(),G1([e]);let n=await K("/icebox",{op:t,dir:e.dir,ids:[e.id]});if(n.ok)if(t==="dismiss")PN("Dismissed",async()=>{if((await K("/icebox",{op:"restore",dir:e.dir,ids:[e.id]})).ok)W({cur:Te(e)}),_("Back in the icebox");await Js()});else _("Made a task");else _(`Could not ${t}: ${n.error||"kaizen did not answer"}`);return await Js(),!!n.ok}function Lp(e){let t=Te(e),n=gn();if(W({cur:t,open:t,armed:t,view:"sort",form:n.form?.k===t?n.form:{k:t,title:e.text,details:""}}),n.data?.gatherer?.connected&&n.task?.k!==t)zA(e)}async function zA(e){let t=Te(e),n=gn().form,o={title:n?.k===t?n.title:e.text,details:n?.k===t?n.details:""},r=gn().task;W({task:{k:t,wait:!0,title:r?.k===t?r.title:"",details:r?.k===t?r.details:""}});let a=await fetch("/icebox",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({op:"task-draft",dir:e.dir,ids:[e.id]})}).then((s)=>s.json()).catch(()=>({error:"kaizen did not answer"}));if(gn().task?.k!==t)return;let i=gn().form;if(a.ok&&a.title){let s=i?.k!==t||i.title===o.title&&i.details===o.details;if(i?.k===t&&s)W({task:{k:t,wait:!1,title:a.title,details:a.details||""},form:{k:t,title:a.title,details:a.details||""}});else if(i?.k===t)W({task:{k:t,wait:!1,title:i.title,details:i.details,kept:!0}});else W({task:{k:t,wait:!1,title:a.title,details:a.details||""}})}else W({task:{k:t,wait:!1,title:"",details:"",note:a.error||a.note||"ChatGPT did not answer"}})}var F1=()=>W({armed:null});function aF(e){let t=gn().form,n=t?.k===Te(e)?t.title.trim():"";if(!n)return!1;return dc("promote",e,"Promoted to Tasks",{text:n,details:t.details}),!0}var V1=(e)=>{let t=gn().styles;if(!t[e])try{t[e]=localStorage.getItem("kz-reply-style:"+e)||""}catch{}return t[e]||"casual"};function iF(e,t){W((n)=>({styles:{...n.styles,[e]:t}}));try{localStorage.setItem("kz-reply-style:"+e,t)}catch{}}async function sF(e){let t=Te(e);W({reply:{k:t,text:"",wait:!0}});let n=await K("/reply",{op:"draft",dir:e.dir,id:e.id,style:V1(e.dir)});if(gn().reply?.k!==t)return;W({reply:{k:t,text:n.text||"",note:n.ok?n.note||"":"",wait:!1}})}async function lF(e){let t=gn().reply;if(!t)return;W({reply:{...t,again:!0}});let n=await K("/reply",{op:"draft",dir:e.dir,id:e.id,style:V1(e.dir),avoid:t.text}),o=gn().reply;if(!o||o.k!==t.k)return;W({reply:{...o,again:!1,text:n.text||o.text,note:n.ok?n.note||"":""}})}var cF=(e)=>W((t)=>t.reply?{reply:{...t.reply,text:e}}:{}),IA=()=>W({reply:null});async function uF(e){let t=gn().reply;if(!t)return;W({reply:{...t,busy:!0}});let n=await K("/reply",{op:"send",dir:e.dir,id:e.id,text:t.text});if(n.ok)W({reply:null}),_("Reply posted");else if(n.sent)W({reply:null});else W((o)=>o.reply?{reply:{...o.reply,busy:!1}}:{});await Js()}var dF=()=>W({swipe:{n:0,pro:0,dis:0,t0:Date.now(),last:null,skip:new Map,busy:!1,pop:!1}}),mv=()=>W({swipe:null});async function fc(e,t){let n=gn().swipe,o=gn().deck[0];if(!n||n.busy||!o)return;let r=Te(o);if(e==="skip"){if(gn().deck.length<2)return;let l=Math.max(...gn().deck.map((c)=>n.skip.get(Te(c))||0));W({swipe:{...n,skip:new Map(n.skip).set(r,l+1)}});return}W({swipe:{...n,busy:!0}});let a=await t?.(e==="promote"?1:-1);O.pop();let i=await K("/icebox",{op:e,dir:o.dir,ids:[o.id]}),s=gn().swipe;if(s)if(i.ok)W({swipe:{...s,busy:!1,n:s.n+1,pro:s.pro+(e==="promote"?1:0),dis:s.dis+(e==="dismiss"?1:0),last:e==="dismiss"?o:null,pop:!0}});else W({swipe:{...s,busy:!1}}),a?.(),_(`Could not ${e}: ${i.error||"kaizen did not answer"}`);await Js()}async function K1(){let e=gn().swipe,t=e?.last;if(!e||!t||e.busy)return;W({swipe:{...e,busy:!0}});let n=await K("/icebox",{op:"restore",dir:t.dir,ids:[t.id]}),o=gn().swipe;if(o)if(n.ok)W({swipe:{...o,busy:!1,n:o.n-1,dis:o.dis-1,last:null,skip:new Map(o.skip).set(Te(t),-1)}}),_("Restored");else W({swipe:{...o,busy:!1}});await Js()}function pF(e){let t="kz-ice-streak:"+(e||"all"),n=(a)=>new Date(a).toLocaleDateString("sv"),o=n(Date.now()),r={last:"",days:0};try{r=JSON.parse(localStorage.getItem(t)||"")||r}catch{}if(r.last!==o)r={last:o,days:r.last===n(Date.now()-86400000)?r.days+1:1};try{localStorage.setItem(t,JSON.stringify(r))}catch{}return r.days}async function fF(e,t){let n=gn().cap,o=n.text.trim();if(n.busy)return;if(!o){if(n.files.length)_("Write a line about it first");return t()}if(!e)return _("Pick a project first");ta({busy:!0});let r={ok:!1};try{r=await K("/icebox",{op:"add",dir:e,text:o,board:n.board||void 0,files:await O.dataUrls(n.files)})}finally{ta({busy:!1})}if(r.ok)ta({text:"",files:[]}),W({cur:null}),_(`Added to the icebox${n.board?" · "+n.board:""}`),O.reload();await uc(),t()}async function mF(e,t){if(!e)return _("Pick a project first");let n=await PA(t);if(!n)return;if((await K("/icebox",{op:"boards",act:"add",dir:e,name:n.name,client:n.client})).ok)_(`Collection ${n.name} made`),O.reload();await uc()}async function gF(e,t){if(e===`
97
+ `){let n=await PA();if(!n)return!1;if(n.client)await K("/icebox",{op:"boards",act:"add",dir:t,name:n.name,client:!0});e=n.name}return ta({board:e,boardDir:t}),!0}async function Yu(e,t){let n=await K("/sources",e);if(n.ok)t(n),O.reload();return await uc(),n}var q1=(e)=>e.label||cs(e.url),hF=(e)=>Yu({op:"gather",dir:e.dir,url:e.url},(t)=>{let n=t.results?.[0];_(n?n.ok?`${q1(e)}: ${n.note}${n.added?" in the icebox":""}`:`Failed: ${n.note}`:"Checked")}),bF=(e)=>Yu({op:"agent",dir:e.dir,url:e.url},(t)=>{let n=t.results?.[0];_(t.via==="chatgpt"?n?.ok?`${q1(e)}: ${n.note}${n.added?" in the icebox":""}`:`Failed: ${n?n.note:"no answer"}`:"/kaizen gather opened in your terminal: "+O.agentLine(t.agent))});async function vF(e){if(await OA(`Remove ${q1(e)}?`,"What it gathered stays; added again later, it may bring back ones you deleted or dismissed.","Remove",!0))await Yu({op:"remove",dir:e.dir,url:e.url},()=>_("Source removed"))}var yF=(e,t)=>Yu({op:"move",dir:e.dir,to:t,url:e.url},()=>_("Source moved")),LA=(e,t)=>Yu({op:"category",dir:e.dir,url:e.url,category:t},()=>_(t?`New requests from ${q1(e)} go under ${t}`:"Category cleared")),xF=(e,t)=>Yu({op:"paused",dir:e.dir,url:e.url,on:!t},()=>_(t?"Auto gather on":"Auto gather off"));async function wF(e,t,n){if(t&&e.social===void 0&&/docs\.google\.com/.test(e.url)&&!n){_("Connect Google first (Sources header), so kaizen can write to the sheet.");return}if(t&&!await OA("Write back to this source?","When a promoted request's run is done, kaizen will write that back to this source. A closed issue or a changed cell is visible to others.","Turn on"))return;await Yu({op:"writeback",dir:e.dir,url:e.url,on:t},()=>_(t?"Write back on":"Write back off"))}var kF=(e,t)=>Yu({op:"gather",dir:e||void 0},(n)=>_(QG(n.results||[],t)));async function SF(e){let t=e.social?{op:"add",dir:e.to,platform:e.plat,query:e.q,label:e.label||`${cc[e.plat]}: ${e.q}`,category:e.category}:{op:"add",dir:e.to,url:e.url,label:e.label,category:e.category},n=await K("/sources",t);if(n.ok&&e.social)_("Source added"),O.reload();else if(n.ok){let o=await K("/sources",{op:"gather",dir:e.to,url:e.url}),r=o.results?.[0];_(r?r.ok?`Source added: ${r.note} in the icebox`:`Source added, but: ${r.note}`:"Source added"),O.reload()}else _(n.error||"Could not add source");if(n.ok)W({srcAdd:!1});return await uc(),!!n.ok}async function CF(e,t){let n=window.open("","_blank"),o=await K(e,{op:"connect"});if(o.ok&&n)n.location.href=o.url;else if(n?.close(),o.ok)location.href=o.url;else if(t)_(o.error||t)}var $1=()=>CF("/chatgpt");function NF(e){if(!e){_("Add your Google client in Settings first"),O.openSettings("google");return}return CF("/google","Could not start Google sign-in")}async function BA(e){let t=e==="/google";if(await OA(t?"Disconnect Google?":"Disconnect ChatGPT?",t?"Done requests stop being written to sheets.":"Gather goes back to your agent.","Disconnect")&&(await K(e,{op:"disconnect"})).ok)_(t?"Google disconnected":"ChatGPT disconnected"),await uc()}async function RF(){if((await K("/chatgpt",{op:"skip"})).ok)await uc()}var TF=(e)=>requestAnimationFrame(()=>document.querySelector(`[data-key="${CSS.escape(e)}"] [data-title]`)?.focus()),EF=(e)=>{W({view:e});try{localStorage.setItem("kz-ice-view",e)}catch{}},Y1=(e)=>W((t)=>({sel:t.sel.includes(e)?t.sel.filter((n)=>n!==e):[...t.sel,e]})),AF=(e,t)=>W((n)=>{let o=e.map(Te);return{sel:t?[...new Set([...n.sel,...o])]:n.sel.filter((r)=>!o.includes(r))}});function Bp(e){let t=Te(e);W((n)=>({cur:t,open:n.open===t?null:t,armed:null,view:"sort"})),TF(t)}function MF(e){let t=Te(e);W({cur:t,open:t,armed:null,view:"sort"}),TF(t)}function HA(e,t,n){W({board:e});let o=e&&t.find((r)=>lc(r.name,e));if(o)ta({board:o.name,boardDir:o.dir,...n?{}:{dir:o.dir}})}var DF=(e)=>W((t)=>({kinds:t.kinds.includes(e)?t.kinds.filter((n)=>n!==e):[...t.kinds,e]}));function PF(e){if(W({cat:"",src:"",board:"",kinds:[]}),!e)iw()}var OF=h(I(),1);var _F=(e)=>{if(e.dataset.lift)return;let t=e.getBoundingClientRect();Object.assign(e.style,{position:"fixed",zIndex:"95",margin:"0",left:t.left+"px",top:t.top+"px",width:t.width+"px",height:t.height+"px"}),e.dataset.lift="1"},jA=(e)=>{delete e.dataset.lift;for(let t of["position","z-index","margin","left","top","width","height","transform"])e.style.removeProperty(t);e.style.removeProperty("--p")};async function Hp(e,t){if(!e)return;if(!O.motion())return()=>jA(e);return _F(e),await e.animate([{transform:getComputedStyle(e).transform},{transform:`translateX(${t*innerWidth}px) rotate(${t*30}deg)`,opacity:0}],{duration:320,easing:"cubic-bezier(.3,.6,.4,1)",fill:"forwards"}).finished.catch(()=>{}),()=>{for(let n of e.getAnimations())n.cancel();jA(e)}}function zF(e){let t=OF.useRef(null);return{ref:t,onPointerDown:(o)=>{let r=t.current;if(!r||o.button||o.target.closest("a,button,summary,details"))return;let a=o.clientX,i=0;r.setPointerCapture(o.pointerId),r.dataset.drag="1",_F(r),r.onpointermove=(s)=>{i=s.clientX-a,r.style.transform=`translateX(${i}px) rotate(${i/r.offsetWidth*18}deg)`,r.style.setProperty("--p",String(Math.max(-1,Math.min(1,i/100))))},r.onpointerup=r.onpointercancel=()=>{if(r.onpointermove=r.onpointerup=r.onpointercancel=null,delete r.dataset.drag,Math.abs(i)>100)return e(i>0?"promote":"dismiss");let s=r.style.transform;r.style.removeProperty("--p");let l=O.motion()&&s?r.animate([{transform:s},{transform:"none"}],{duration:260,easing:"cubic-bezier(.3,1.4,.5,1)"}):null;r.style.transform="",(l?l.finished.catch(()=>{}):Promise.resolve()).then(()=>jA(r))}}}}var Yle="[role=dialog][data-state=open],[role=alertdialog][data-state=open],[role=menu][data-state=open],[role=listbox][data-state=open]";function IF(e){if(Ze().page!=="icebox"||e.altKey||e.ctrlKey||e.metaKey)return!1;let{target:t,key:n}=e;if(t?.matches?.("input:not([type=checkbox]),select,textarea,[contenteditable]")||document.querySelector(Yle))return!1;let o=gn();if(o.swipe){let c={ArrowLeft:()=>fc("dismiss",(d)=>Hp(ds.swCard,d)),ArrowRight:()=>fc("promote",(d)=>Hp(ds.swCard,d)),ArrowDown:()=>fc("skip"),z:K1,Escape:mv}[n];if(!c)return!1;return e.preventDefault(),c(),!0}if(n==="Escape"){if(o.open)W(o.armed?{armed:null}:{open:null});else if(o.sel.length)W({sel:[]});else return!1;return!0}let r=o.order.findIndex((c)=>Te(c)===o.cur),a=o.order[r];if(!a)return!1;if(n==="j"||n==="k"){e.preventDefault();let c=o.order[Math.max(0,Math.min(o.order.length-1,r+(n==="j"?1:-1)))];return W({cur:Te(c)}),document.querySelector(`[data-key="${CSS.escape(Te(c))}"]`)?.scrollIntoView({block:"nearest"}),!0}let i=new Set(o.sel);if(n==="h"){let c=i.size?o.order.filter((d)=>i.has(Te(d))&&ea(d)):ea(a)?[a]:[];if(!c.length)return!1;return e.preventDefault(),pc(c,"1w"),!0}let s=a.status==="promoted"||a.status==="done",l=n==="o"?()=>Bp(a):n==="x"?()=>Y1(Te(a)):n==="p"&&!o.busy&&(i.size||!s)?()=>i.size?void dg("promote"):Lp(a):n==="d"&&!o.busy&&(i.size||!s&&a.status!=="dismissed")?()=>i.size?void dg("dismiss"):void dc("dismiss",a,"Dismissed"):null;if(!l)return!1;return e.preventDefault(),l(),!0}var UA=h(I(),1);function LF({onDecide:e,onHold:t,enabled:n}){let o=UA.useRef(null),r=UA.useRef(null),a=(s)=>{let l=(u)=>{u.stopPropagation(),u.preventDefault()};document.addEventListener("click",l,{capture:!0,once:!0});let c=!1,d=()=>{if(c)return;c=!0,document.removeEventListener("pointerup",d,{capture:!0}),document.removeEventListener("pointercancel",d,{capture:!0}),setTimeout(()=>document.removeEventListener("click",l,{capture:!0}),60)};if(s)document.addEventListener("pointerup",d,{capture:!0}),document.addEventListener("pointercancel",d,{capture:!0}),setTimeout(d,5000);else d()};return{row:o,fg:r,onPointerDown:(s)=>{let l=o.current,c=r.current;if(!n||!l||!c||s.button||l.dataset.gone||s.target.closest("a,input,button,summary,[role=menuitem]"))return;let{clientX:d,clientY:u}=s,p=0,f="",g=setTimeout(()=>{if(f)return;f="hold",a(!0),navigator.vibrate?.(10),t()},500),m=()=>{c.style.transform="",c.style.opacity="",l.style.removeProperty("--p"),delete l.dataset.dir,delete l.dataset.gone},y=(b)=>{if(clearTimeout(g),c.onpointermove=c.onpointerup=c.onpointercancel=null,f!=="drag")return;if(delete l.dataset.drag,a(!1),!b&&Math.abs(p)>l.offsetWidth*TA){let x=p>0?"promote":"dismiss";l.dataset.gone="1",c.style.transform=`translateX(${(p>0?1:-1)*l.offsetWidth}px)`,c.style.opacity="0",Promise.resolve(e(x)).then((v)=>v===!1&&m())}else m()};c.onpointermove=(b)=>{let x=b.clientX-d,v=b.clientY-u;if(!f){if(Math.hypot(x,v)>8)clearTimeout(g);if(Math.abs(x)>10&&Math.abs(x)>Math.abs(v))f="drag",c.setPointerCapture(b.pointerId),l.dataset.drag="1";else if(Math.abs(v)>10)f="scroll"}if(f!=="drag")return;p=x,c.style.transform=`translateX(${p}px)`,l.dataset.dir=p>0?"pro":"dis",l.style.setProperty("--p",String(Math.min(1,Math.abs(p)/(l.offsetWidth*TA))))},c.onpointerup=()=>y(!1),c.onpointercancel=()=>y(!0)}}}var GA=h(w(),1);function zn({dir:e,label:t="",size:n=16,logo:o}){let[r,a]=BF.useState(!1);return(o??O.projects().some((s)=>s.dir===e&&s.logo))&&!r?GA.jsx("img",{src:"/project-logo?dir="+encodeURIComponent(e),alt:"",loading:"lazy",onError:()=>a(!0),className:"shrink-0 rounded-xs object-contain",style:{width:n,height:n}}):GA.jsx("span",{"aria-hidden":"true",className:"inline-grid shrink-0 place-items-center rounded-xs bg-muted text-[10px] font-semibold text-muted-foreground",style:{width:n,height:n},children:(Ar(t)||"?").charAt(0).toUpperCase()})}var FA=h(w(),1);function Ti({label:e,options:t,value:n,onChange:o,className:r,idPrefix:a,labelledBy:i}){return FA.jsx("div",{role:"group","aria-label":i?void 0:e,"aria-labelledby":i,id:a,className:C("inline-flex overflow-hidden rounded-sm border border-border bg-card",r),children:t.map((s)=>FA.jsx(ag,{id:a?`${a}-${s.id}`:void 0,pressed:n===s.id,onPressedChange:()=>o(s.id),className:"h-7 px-3 text-sm text-muted-foreground data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:s.label},s.id))})}var HF=h(w(),1),Ei=({state:e})=>HF.jsx("span",{"aria-hidden":"true",className:`si kz-keep ${e}`});var VA=h(w(),1),Wle={idea:"text-muted-foreground",start:"text-running motion-safe:[&_svg]:animate-pulse",run:"text-running motion-safe:[&_svg]:animate-pulse",stall:"text-muted-foreground",wait:"text-warning",done:"text-success",aband:"text-muted-foreground"};function jp({name:e,title:t,className:n}){return VA.jsx("span",{role:t?"img":void 0,title:t,"aria-label":t,className:C("grid size-3.5 shrink-0 place-items-center",Wle[e],n),children:VA.jsx(L,{sprite:"s",name:e,className:"size-3.5 stroke-[1.8]"})})}var wn=h(w(),1),W1=({on:e,label:t,children:n,onChange:o})=>wn.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 rounded-xs px-2 py-1.5 whitespace-nowrap hover:bg-muted",children:[wn.jsx(Hr,{checked:e,onCheckedChange:(r)=>o(r===!0),"aria-label":t}),n]});function UF(){let[e,t]=jF.useState(!1),n=qi(),o=Pn((u)=>u.filt),r=Pn((u)=>u.folded),a=Pn((u)=>u.q),i=n.projects.filter((u)=>u.workspaces?.length).map((u)=>u.dir),s=UI(i,(u)=>$n(u,n.projects),a),l=jI(o,i),c=i.length>0&&i.every((u)=>r.includes(u)),d=(u)=>(p)=>Cb({dirs:p?[...new Set([...o.dirs,u])]:o.dirs.filter((f)=>f!==u)});return wn.jsxs(rr,{open:e,onOpenChange:t,children:[wn.jsx(ar,{asChild:!0,children:wn.jsx("button",{type:"button",id:"pfilter","aria-pressed":l,"aria-label":"Show one project",title:l?"Filter on: choose projects and kinds":"Filter projects and kinds",children:wn.jsx("svg",{children:wn.jsx("use",{href:"#r-filter"})})})}),wn.jsxs(ir,{align:"start",className:"flex max-h-[60vh] w-[220px] flex-col gap-px p-1.5 text-sm","aria-label":"Filter the Projects list",children:[wn.jsx(Ue,{placeholder:"Search projects…","aria-label":"Search projects",autoComplete:"off",spellCheck:!1,value:a,onChange:(u)=>BL(u.target.value),className:"mb-1.5"}),wn.jsxs("div",{className:"flex items-center gap-0.5",children:[wn.jsx("div",{className:"min-w-0 flex-1",children:wn.jsx(W1,{on:!o.dirs.length,label:"All projects",onChange:()=>Cb({dirs:[]}),children:"All projects"})}),wn.jsx("button",{type:"button",className:"grid size-6 place-items-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground",title:c?"Expand all":"Collapse all","aria-label":c?"Expand all projects":"Collapse all projects",onClick:()=>FR(i,!c),children:wn.jsx("svg",{viewBox:"0 0 16 16",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:wn.jsx("path",{d:c?"M4 3l4 3 4-3M4 13l4-3 4 3":"M4 6l4-3 4 3M4 10l4 3 4-3"})})})]}),wn.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-px overflow-auto",children:s.map((u)=>wn.jsxs(W1,{on:o.dirs.includes(u),label:$n(u,n.projects),onChange:d(u),children:[wn.jsx(zn,{dir:u,label:$n(u,n.projects),logo:n.projects.some((p)=>p.dir===u&&p.logo)}),wn.jsx("span",{className:"min-w-0 truncate",children:$n(u,n.projects)})]},u))}),wn.jsxs("div",{className:"mt-1 flex flex-none flex-col gap-px border-t border-border pt-0.5",children:[wn.jsx("div",{className:"mx-2 mt-2 mb-0.5 text-xs font-semibold text-muted-foreground",children:"Show"}),wn.jsx(W1,{on:o.running,label:"Running",onChange:(u)=>Cb({running:u}),children:"Running"}),wn.jsx(W1,{on:o.done,label:"Done",onChange:(u)=>Cb({done:u}),children:"Done"})]})]})]})}var Wu=h(I(),1);var je=h(w(),1),GF=(e,t)=>{if(!(e.ctrlKey||e.metaKey||e.shiftKey||e.button!==0)&&t())e.preventDefault()};function Xle({dir:e,name:t,logo:n}){let[o,r]=Wu.useState(!1);return n&&!o?je.jsx("img",{className:"plogo",src:"/project-logo?dir="+encodeURIComponent(e),alt:"",loading:"lazy",onError:()=>r(!0)}):je.jsx("span",{className:"plogo","aria-hidden":"true",children:(t||"?").charAt(0).toUpperCase()})}var Qle=()=>je.jsx("svg",{viewBox:"0 0 24 24","aria-label":"Pinned",style:{width:12,height:12,flex:"none",marginLeft:4,color:"var(--accent)"},children:je.jsx("path",{d:"M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})}),Zle=()=>je.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:je.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[je.jsx("circle",{cx:"6",cy:"6",r:"2"}),je.jsx("circle",{cx:"6",cy:"18",r:"2"}),je.jsx("circle",{cx:"18",cy:"8",r:"2"}),je.jsx("path",{d:"M6 8v8M18 10c0 4-6 3-12 6"})]})});function Jle({t:e}){return je.jsxs("a",{className:"rtask",href:`/?view=task&task=${encodeURIComponent(e.id)}&dir=${encodeURIComponent(e.dir)}`,"data-task-id":e.id,title:`${e.attention.reason} · ${e.attention.action}`,onClick:(t)=>GF(t,()=>KL(e.id,e.dir)),children:[je.jsx("span",{className:`si ${HI(e)}`}),je.jsxs("span",{children:[je.jsx("b",{children:e.title}),je.jsx("small",{children:e.attention.reason})]})]})}function ece({dir:e,r:t,now:n,current:o}){return je.jsxs(je.Fragment,{children:[je.jsxs("div",{className:"wsr wsc",children:[je.jsxs("a",{className:"row ws",href:O.wsHref(e,t.path),"data-dir":e,"data-ws":t.path,title:t.path,"aria-current":o?"true":void 0,onClick:(r)=>GF(r,()=>KR(e,t.path)),onContextMenu:(r)=>{let a=YL(e,t.path);if(!a.length)return;r.preventDefault(),kz(Math.min(r.clientX,innerWidth-190),Math.min(r.clientY,innerHeight-a.length*34-16),a)},children:[je.jsx("span",{className:`si ${t.st||"none"}`}),je.jsxs("div",{className:"wl",children:[je.jsxs("span",{className:"l1",children:[je.jsx("b",{children:t.label}),t.pinned&&je.jsx(Qle,{})]}),je.jsxs("span",{className:"l2",children:[je.jsx("span",{children:t.folder}),!t.w.main&&je.jsx(Zle,{})]})]})]}),je.jsx(MG,{rows:t.agents,now:n,open:t.open,dir:e,ws:t.path})]}),t.tasks.map((r)=>je.jsx(Jle,{t:r},r.id))]})}function tce({g:e,logo:t,now:n,cur:o,lift:r,before:a}){let i=(s)=>{if(s.preventDefault(),e.empty&&KR(e.dir,e.mainWs))return;HL(e.dir)};return je.jsxs(je.Fragment,{children:[je.jsxs("div",{className:`pgrp${a?" rank-before":""}`,children:[je.jsxs("button",{type:"button",className:`proj${e.shut?" shut":""}${r?" rank-lift":""}`,"data-proj":e.dir,"data-ws":e.mainWs,"data-empty":e.empty?"":void 0,title:e.dir,"aria-expanded":!e.shut,onClick:i,children:[je.jsx(Xle,{dir:e.dir,name:e.name,logo:t}),je.jsx("span",{className:"pname",children:e.name}),je.jsx("svg",{className:"fchev",viewBox:"0 0 24 24","aria-hidden":"true",children:je.jsx("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.git&&je.jsx("button",{type:"button",className:"wadd",title:`New workspace in ${e.name}`,"aria-label":`New workspace in ${e.name}`,onClick:(s)=>(s.preventDefault(),$L(e.dir)),children:je.jsx("svg",{"aria-hidden":"true",children:je.jsx("use",{href:"#r-plus"})})})]}),!e.shut&&je.jsx("div",{className:"pws",children:e.rows.map((s)=>je.jsx(ece,{dir:e.dir,r:s,now:n,current:o.dir===e.dir&&o.ws===s.path},s.path))})]})}function FF(){let e=qi(),t=yt((m)=>m.every!==null),n=Pn((m)=>m.filt),o=Pn((m)=>m.folded),r=Pn((m)=>m.pins),a=Pn((m)=>m.open),i=ut((m)=>m.search),s=Pn((m)=>m.tick),l=Wu.useRef(null),c=QL(l,(m)=>{GL(m),WL(m)}),{groups:d,now:u,wait:p}=Wu.useMemo(()=>{let m=Date.now();return{groups:BI(e,{filt:n,pins:r,folded:o,open:a,now:m}),now:m,wait:OI(e.agents,m)}},[e,n,r,o,a,s]);Wu.useEffect(()=>{if(p===1/0)return;let m=setTimeout(LL,p+20);return()=>clearTimeout(m)},[p,d]);let f=FI(i,e.cards,e.projects),g=new Set(e.projects.filter((m)=>m.logo).map((m)=>m.dir));return je.jsxs("div",{ref:l,className:`rlist${c.view.to===d.length?" rank-end":""}`,onClickCapture:(m)=>c.swallow()&&(m.preventDefault(),m.stopPropagation()),children:[d.map((m,y)=>je.jsx(tce,{g:m,logo:g.has(m.dir),now:u,cur:f,lift:c.view.lift===m.dir,before:c.view.to===y},m.dir)),t&&!d.length&&je.jsx("div",{className:"none",children:"No projects"})]})}var X1=h(I(),1);var gv=h(w(),1),nce=({m:e})=>{let[t,n]=X1.useState(!1);if(e.kind!=="icon")return gv.jsx("svg",{"aria-hidden":"true",children:gv.jsx("use",{href:e.id})});return t?null:gv.jsx("img",{src:e.id,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>n(!0)})};function VF(){let e=yt((t)=>t.sources?.sources);return X1.useMemo(()=>ZL(e),[e]).map((t)=>gv.jsx(nce,{m:t},t.id))}var ZF=h(Za(),1);var KF=["What's waiting on me?","Summarize what changed this week","Plan a new feature: ","Review my last change"];var qF=(e,t)=>[...new Set(e.match(/\b\d{4}-\d{2}-\d{2}-[a-z0-9-]+\b/g)||[])].filter((n)=>t.includes(n)),oce=(e)=>e.split(/[\\/]/).pop()||e,Q1=(e,t)=>oce(t.find((n)=>n.dir===e)?.label||String(e).replace(/[\\/]\.kaizen$/,"")),$F=(e,t)=>e.length<5&&t.size<=10485760&&e.reduce((n,o)=>n+o.size,0)+t.size<=20971520;function YF(e){try{return JSON.parse(e)}catch{return null}}function WF(e,t,n){if(n.t==="chat")return e.id=n.id,{id:n.id};if(n.t==="text")t.text+=(t.text?`
98
+
99
+ `:"")+n.text;if(n.t==="status")t.activity=n.text;if(n.t==="step")(t.steps||=[]).push(n.step),t.activity="Thinking…";if(n.t==="error")t.error=n.error;if(n.t==="project")return e.project=n.dir,{project:n.dir};return{}}function XF(){let e="";return(t)=>{e+=t;let n=[];for(let o;(o=e.indexOf(`
100
+ `))>=0;)n.push(e.slice(0,o)),e=e.slice(o+1);return n}}var rce=()=>{try{return!nt()&&localStorage.getItem("kz-hist")!=="0"}catch{return!nt()}},el=de()(()=>({chats:[],cur:null,sending:!1,remoteBusy:!1,side:!1,files:[],here:null,tick:0,focusAsk:0,suggest:null})),{getState:qa,setState:In}=el,KA=()=>In((e)=>({tick:e.tick+1})),ace="kz-d:",Z1,bv=(e)=>{try{e?sessionStorage.setItem("kz-chat",e):sessionStorage.removeItem("kz-chat")}catch{}},J1=(e,t)=>fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),qA=()=>{let e=O.scopeDir();return e&&O.projects().some((t)=>t.dir===e)?e:null},$A=()=>{let e=qA();if(e!==qa().here)In({here:e})},JF=(e)=>e&&e!==O.currentDir()&&void O.pickProject(e);function pg(e){if(In({side:e}),!nt())try{localStorage.setItem("kz-hist",e?"1":"0")}catch{}}async function hv(){try{In({chats:(await(await fetch("/chats")).json()).chats||[]})}catch{In({chats:[]})}}var eV=(e)=>O.motion()&&document.startViewTransition?document.startViewTransition(()=>ZF.flushSync(e)).updateCallbackDone:(e(),Promise.resolve());function tV(){let e=qa();if(e.sending)return;clearTimeout(Z1),bv(null),eV(()=>In({cur:null,files:[],remoteBusy:!1,side:nt()?!1:e.side,here:qA()})).then(()=>In((t)=>({focusAsk:t.focusAsk+1})))}async function fg(e){let t=await(await fetch("/chat?id="+encodeURIComponent(e))).json();if(t.error)return _(t.error);let n=qa(),o=n.chats.map((r)=>r.id===t.id?{...r,busy:!!t.busy}:r);if(bv(t.id),In({chats:o,cur:t,remoteBusy:!!t.busy,files:n.cur?.id===t.id?n.files:[],tick:n.tick+1}),JF(t.project),clearTimeout(Z1),t.busy&&!qa().sending)Z1=setTimeout(()=>qa().cur?.id===e&&void fg(e),2000)}async function nV(e,t){if(!await mn({title:"Delete this chat?",description:t,confirmLabel:"Delete",danger:!0}))return;let n=await J1("/chat/delete",{id:e});if(!n.ok)return _((await n.json()).error);if(qa().cur?.id===e)In({cur:null,remoteBusy:!1}),bv(null);await hv()}var oV=()=>void J1("/chat/stop",{id:qa().cur?.id}),rV=()=>J1("/popup/open",{id:qa().cur?.id}).then((e)=>e.ok||_("Could not open the popup")).catch(()=>_("Could not open the popup"));function ek(e){if(qa().sending)return void _("Wait for the current reply");let t=[...qa().files];for(let n of e){if(!$F(t,n)){_("Up to 5 files, 10 MB each and 20 MB total");break}t.push(n)}In({files:t})}var aV=(e)=>In((t)=>({files:t.files.filter((n,o)=>o!==e)}));async function YA(e){e=e.trim();let t=qa();if(!e&&!t.files.length||t.sending||t.remoteBusy)return;let n=t.files;clearTimeout(Z1);let o=new Date().toISOString(),r=t.cur?t.cur.id:"new",a=!t.cur||!t.cur.messages.length,i=t.cur??{id:null,title:e||n[0].name,project:qA(),messages:[]},s={role:"agent",text:"",steps:[],activity:"Thinking…",at:o};i.messages.push({role:"user",text:e,files:n.map((c)=>({name:c.name})),at:o},s);try{if(sessionStorage.removeItem(ace+"home:"+r),a)sessionStorage.setItem("kz-chat-pending",o)}catch{}await(a?eV:(c)=>(c(),Promise.resolve()))(()=>In({cur:i,files:[],sending:!0,tick:t.tick+1}));let l=!1;try{let c=n.length?await fetch("/chat",{method:"POST",body:(()=>{let f=new FormData;return f.set("id",i.id||""),f.set("text",e),f.set("project",i.project||""),n.forEach((g)=>f.append("files",g)),f})()}):await J1("/chat",{id:i.id,text:e,project:i.project});if(!c.ok){s.error=(await c.json()).error||"Could not send",In((f)=>({files:[...n,...f.files]}));return}l=!0;let d=c.body.getReader(),u=new TextDecoder,p=XF();for(let f;!(f=await d.read()).done;)for(let g of p(u.decode(f.value,{stream:!0}))){let m=YF(g);if(!m)continue;let y=WF(i,s,m);if(y.id){bv(y.id);try{sessionStorage.removeItem("kz-chat-pending")}catch{}hv()}if(y.project)JF(y.project);KA()}}catch{if(s.error="Lost the connection; the agent keeps going and the chat saves when it finishes.",!l)In((c)=>({files:[...n,...c.files]}))}finally{try{sessionStorage.removeItem("kz-chat-pending")}catch{}if(In({sending:!1}),delete s.activity,l&&i.id)try{await fg(i.id)}catch{In({remoteBusy:!1}),KA()}else In({remoteBusy:!1}),KA();await hv()}}var QF=!1;async function iV(){if(!QF)QF=!0,In({side:rce()});$A(),await hv();let{chats:e}=qa(),t;try{t=sessionStorage.getItem("kz-chat")}catch{}if(!t)try{let n=sessionStorage.getItem("kz-chat-pending");if(n)t=e.find((o)=>o.updated>=n)?.id}catch{}if(!t)t=e.find((n)=>n.busy)?.id;if(t&&e.some((n)=>n.id===t))await fg(t);else bv(null),In({cur:null})}async function sV(){let e=await fetch("/popup/handoff").then((t)=>t.json()).catch(()=>null);if(!e?.id)return;if(await hv(),qa().chats.some((t)=>t.id===e.id))await fg(e.id)}var vv="kz-home-ws",lV="kz-home-ws-at",cV="kz-home-ws-btn",WA=["claude","codex","gemini"],uV=(e)=>e&&WA.includes(e)?e:"ai",tk=(e,t)=>e.filter((n)=>n.run==="home"&&!t.includes(n.key)),dV=(e,t)=>e.some((n)=>n.key===t)?t:e[e.length-1]?.key??"",XA=(e,t,n,o)=>({x:Math.max(0,Math.min(n-t,e.x)),y:Math.max(0,Math.min(o-40,e.y))}),pV=(e)=>{try{let t=JSON.parse(e??"null");return Number.isFinite(t?.x)&&Number.isFinite(t?.y)?{x:t.x,y:t.y}:null}catch{return null}},fV=(e,t)=>Math.hypot(e,t)>=4,ice=(e,t)=>!t&&(e==="open"||e==="min")?e:null,sce=(e)=>{try{return localStorage.getItem(e)}catch{return null}},nk=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},Xu=de()(()=>({st:"closed",max:!1,on:"",ending:[],agents:[],dflt:"",agentsRead:!1})),{setState:Ai,getState:yv}=Xu,QA=()=>tk(oe().shells,yv().ending);function Up(e,t=!0){if(Ai({st:e}),t)nk(vv,e)}function mV(e){let t=new URLSearchParams(e);if(t.has("homews")){if(t.delete("homews"),history.replaceState(history.state,"","/?"+t),Ai({st:"open"}),!nt())nk(vv,"open");return!0}let n=ice(sce(vv),nt());if(n)Ai({st:n});return n==="open"}var gV=(e)=>Ai({on:e}),hV=()=>Ai((e)=>({max:!e.max}));async function ZA(){if(yv().agentsRead)return;try{let e=await(await fetch("/agents?home=1")).json();Ai({agents:e.agents??[],dflt:e.default??"",agentsRead:!0})}catch{}}async function ok(){await ib()}async function rk(e,t,n){let o=await fetch("/shell",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({home:!0,...e?{agent:e,...t?{yolo:t}:{},...n?{prompt:n}:{}}:{}})}).catch(()=>null);if(!o?.ok){let a="";try{a=(await o.json()).error}catch{}return _(a?"No new terminal: "+a:"No new terminal"+(o?` (${o.status})`:""))}let r=await o.json();h6([...oe().shells.filter((a)=>a.key!==r.key),r]),Ai({on:r.key})}async function lce(){await ZA();let{agents:e,dflt:t}=yv();await rk((e.find((n)=>n.cmd===t)??e[0])?.cmd)}var JA=()=>ok().then(()=>!QA().length&&lce()),bV=(e)=>(Ai((t)=>({ending:[...t.ending,e]})),fetch("/pty/exit",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:e})}).catch(()=>null));async function vV(e){if(await bV(e),yv().on===e)Ai({on:""})}async function eM(){let e=QA();if(e.length&&!await mn({title:`End ${e.length} Home terminal${e.length===1?"":"s"}?`,confirmLabel:"End",danger:!0}))return;await Promise.all(e.map((t)=>bV(t.key))),Ai({on:""}),Up("closed")}function tM(){if(yv().st==="open")return Up("min");if(Up("open"),!QA().length)JA()}function yV(e){if(Ai({on:e,st:"open"}),!nt())nk(vv,"open");ok()}function xV(e){if(Ai({st:"open"}),!nt())nk(vv,"open");rk(e?.agent||void 0,!!e?.yolo,typeof e?.prompt==="string"?e.prompt:void 0)}var nM=["claude","codex","agy","opencode","gemini"],oM=["Default agent","Appearance","Notifications","Phone"],rM=[{title:"Pick your default agent",sub:"kaizen works with every CLI agent. Choose the one you will reach for most. You can change it any time in Settings."},{title:"Choose your look",sub:"Follow your system, or pick light or dark. You can change it any time."},{title:"Set up notifications",sub:"kaizen can tell you when a run needs you or an agent is done."},{title:"Use kaizen on your phone",sub:"Optional. Check runs and answer agents from your phone. You can skip this now; it is also in Settings → Phone."}],kV={na:"Notifications are not available at this address. Open kaizen at localhost or over HTTPS to turn them on.",default:"Allow notifications so a run that needs you, or an agent that finishes, reaches you in another window.",granted:"Notifications are on. kaizen will tell you when a run needs you or an agent is done.",denied:"Notifications are blocked for this site. Allow them in your browser's site settings, then come back."},wV="kz-onb-asked";function aM(e){let t=e.agents.filter((n)=>nM.includes(n.cmd));return{detected:t.filter((n)=>e.installed.includes(n.cmd)),rest:t.filter((n)=>!e.installed.includes(n.cmd)),all:t}}var cce=(e)=>nM.includes(e.default)?e.default:e.agents.find((t)=>nM.includes(t.cmd)&&e.installed.includes(t.cmd))?.cmd??"",SV=(e,t)=>{let n=aM(e).all.find((o)=>o.cmd===t&&!e.installed.includes(o.cmd));return n?{agent:n,how:e.install?.[n.cmd]??null}:null},ik=()=>typeof Notification>"u"||!isSecureContext?"na":Notification.permission;function uce(){try{let e=localStorage.getItem("kz-theme");return e==="light"||e==="dark"?e:"system"}catch{return"system"}}var CV=(e)=>e.step>0?`You are on step ${e.step+1} of ${e.total}. It only takes a minute.`:"You skipped setup. It only takes a minute.";async function iM(e,t){try{let n=await fetch(e,t?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}:void 0);return n.ok?await n.json():null}catch{return null}}var sk=de()(()=>({cfg:null,flow:null,offer:!1})),{getState:mc,setState:gg}=sk,NV=(e,t)=>Qh({resume:t==="skipped"||t===null&&e>0,step:e,total:mc().cfg?.total??4}),mg=(e)=>(NV(e.step??mc().flow?.step??0,e.outcome??null),iM("/onboarding",e)),hg=(e)=>gg((t)=>({flow:t.flow&&{...t.flow,...e}})),RV=()=>gg({flow:null});function ak(e){let t=mc().cfg;if(mc().flow||!t)return;gg({flow:{step:Math.max(0,Math.min(t.total-1,e)),agent:cce(t),theme:uce(),more:!1}})}var TV=()=>{let e=mc().flow;return e&&e.step===0&&e.agent?iM("/settings",{key:"agent.default",value:e.agent}):null},EV=(e)=>hg({agent:e}),AV=()=>hg({more:!mc().flow?.more});function MV(e){hg({theme:e}),Zh(e)}async function sM(){let{cfg:e,flow:t}=mc();if(!e||!t)return;if(await TV(),t.step<e.total-1)return hg({step:t.step+1}),void mg({step:t.step+1});mg({outcome:"done"}),RV(),ci({start:"folder"})}function DV(){let e=mc().flow;if(!e)return;hg({step:e.step-1}),mg({step:e.step-1})}function PV(e){TV(),hg({step:e}),mg({step:e})}async function lM(){if(!await mn({title:"Skip onboarding?",description:"It won't take long!",confirmLabel:"Skip"}))return;mg({outcome:"skipped"}),RV(),ci({start:"folder"})}function dce(){try{if(sessionStorage.getItem(wV))return;sessionStorage.setItem(wV,"1")}catch{}gg({offer:!0})}function xv(e){let t=mc().cfg;if(gg({offer:!1}),e==="go")ak(t.step);else if(e==="never")mg({outcome:"dismissed"}),NV(0,"dismissed")}function OV(){let e=!0;return(async()=>{let t=await iM("/onboarding");if(!t||!e)return;gg({cfg:t}),Qh(t),Fd({openSetup:()=>ak(t.step)});let n=new URLSearchParams(location.search);if(n.has("setup"))return n.delete("setup"),history.replaceState(null,"",location.pathname+(n.toString()?"?"+n:"")+location.hash),ak(t.resume?t.step:0);if(t.show)return ak(0);if(t.resume)dce()})(),()=>void(e=!1)}var lk=h(I(),1);function cM(e,t,n,o){let[r,a]=lk.useState(()=>{let c=pV(pce(t));return c&&XA(c,n,innerWidth,innerHeight)}),i=lk.useRef(!1);return{at:r,onPointerDown:(c)=>{if(c.button||o(c)||!e.current)return;let d=e.current.getBoundingClientRect(),u=c.clientX-d.left,p=c.clientY-d.top,f=null;i.current=!1,document.documentElement.classList.add("grabbing");let g=(y)=>{if(!i.current&&!fV(y.clientX-c.clientX,y.clientY-c.clientY))return;i.current=!0,f=XA({x:y.clientX-u,y:y.clientY-p},d.width,innerWidth,innerHeight),a(f)},m=()=>{if(document.documentElement.classList.remove("grabbing"),removeEventListener("pointermove",g),removeEventListener("pointerup",m),removeEventListener("pointercancel",m),f)try{localStorage.setItem(t,JSON.stringify(f))}catch{}};addEventListener("pointermove",g),addEventListener("pointerup",m),addEventListener("pointercancel",m)},wasDrag:()=>{let c=i.current;return i.current=!1,c}}}var pce=(e)=>{try{return localStorage.getItem(e)}catch{return null}};function _V(){setInterval(()=>hm()&&void sV(),1500),zr(()=>hm()&&$A())}function zV(){if(mV(location.search))JA()}var ps=h(w(),1);function IV({chats:e,current:t,onOpen:n,onDelete:o}){return ps.jsxs("div",{className:"flex h-full w-[260px] flex-col gap-2 py-3 pl-5 pr-2.5 max-[640px]:w-full",children:[ps.jsx("div",{className:"px-1.5 text-sm font-semibold text-muted-foreground",children:"Chats"}),ps.jsx("nav",{"aria-label":"Chats",className:"flex min-h-0 flex-col gap-0.5 overflow-y-auto",children:e.map((r)=>ps.jsxs("div",{className:C("group flex items-center rounded-sm transition-colors hover:bg-muted",t===r.id&&"bg-muted"),children:[ps.jsxs("button",{type:"button",title:r.title,onClick:()=>n(r.id),className:C("flex min-w-0 flex-1 flex-col gap-px whitespace-nowrap px-2.5 py-[7px] text-left text-base",t===r.id?"text-foreground":"text-muted-foreground"),children:[ps.jsxs("span",{className:"truncate",children:[r.busy&&ps.jsx("span",{className:"mr-1.5 inline-block size-[7px] rounded-full bg-running animate-hpulse"}),r.title]}),ps.jsx("span",{className:"truncate text-xs opacity-80",children:r.project?Q1(r.project,O.projects()):"No project"})]}),ps.jsx(me,{icon:"trash",label:`Delete chat: ${r.title}`,className:"size-(--btn-xs) opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100",onClick:()=>o(r)})]},r.id))})]})}var Mi=h(I(),1);var va=h(w(),1),uM="kz-d:",LV=()=>matchMedia("(max-width:640px)").matches,BV=(e)=>{try{return sessionStorage.getItem(uM+e)??""}catch{return""}};function HV({chatId:e,files:t,working:n,sending:o,where:r}){let a="home:"+(e??"new"),[i,s]=Mi.useState(()=>BV(a)),l=Mi.useRef(null),c=Mi.useRef(a);Mi.useEffect(()=>{let m=c.current;if(c.current=a,m==="home:new"&&n){d(i);try{sessionStorage.removeItem(uM+m)}catch{}}else s(BV(a))},[a]),Mi.useLayoutEffect(()=>{let m=l.current;if(!m)return;m.style.height="auto",m.style.height=Math.min(m.scrollHeight,220)+"px"},[i]);let d=(m)=>{s(m);try{sessionStorage.setItem(uM+a,m)}catch{}},u=()=>{let m=i;if(!m.trim()&&!t.length||n||o)return;s(""),YA(m)},p=el((m)=>m.suggest);Mi.useEffect(()=>{if(!p)return;In({suggest:null});let m=p.text;if(l.current?.focus(),m.endsWith(" "))return d(m);if(n||o)return;s(""),YA(m)},[p]);let f=el((m)=>m.focusAsk),g=Mi.useRef(f);return Mi.useEffect(()=>{if(f!==g.current)l.current?.focus();g.current=f},[f]),va.jsxs("form",{id:"hbox",onSubmit:(m)=>(m.preventDefault(),u()),onDragOver:(m)=>[...m.dataTransfer?.types??[]].includes("Files")&&m.preventDefault(),onDrop:(m)=>{if(m.dataTransfer.files.length)m.preventDefault(),ek([...m.dataTransfer.files])},style:{viewTransitionName:"hbox"},className:"relative flex w-[calc(100%-40px)] max-w-[960px] items-end gap-2 rounded-[22px] border border-border bg-card py-2.5 pl-4 pr-2.5 shadow-md transition-[border-color,box-shadow] focus-within:border-primary focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--accent)_15%,transparent),var(--shadow-2)] max-[640px]:w-[calc(100%-32px)] max-[640px]:order-2",children:[va.jsx(Vu,{onFiles:ek,className:C(o&&"pointer-events-none opacity-50")}),va.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[!!t.length&&va.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map((m,y)=>va.jsxs("span",{className:"inline-flex max-w-full items-center gap-[5px] rounded-full border border-border px-2 py-1 text-xs [overflow-wrap:anywhere]",children:[va.jsx(L,{name:"clip",className:"size-3 flex-none"}),m.name,va.jsx("button",{type:"button","aria-label":`Remove ${m.name}`,className:"px-0.5 text-muted-foreground hover:text-foreground",onClick:()=>aV(y),children:"×"})]},y))}),va.jsx("textarea",{id:"hq",ref:l,rows:1,value:i,"aria-label":"Message the agent",placeholder:LV()?"Ask or describe what to build…":"Ask anything, or describe what to build…",onChange:(m)=>d(m.target.value),onPaste:(m)=>{let y=_l(m);if(y.length)ek(y)},onKeyDown:(m)=>{if(m.key==="Enter"&&!m.shiftKey&&!m.nativeEvent.isComposing&&!LV())m.preventDefault(),u()},className:"max-h-[220px] min-h-[34px] w-full resize-none bg-transparent py-[5px] text-lg leading-6 text-foreground outline-none max-[640px]:text-[16px]"})]}),r!==void 0&&va.jsxs("span",{title:"Project",className:"flex h-[34px] max-w-[30%] flex-none items-center gap-1.5 overflow-hidden text-ellipsis whitespace-nowrap text-sm text-muted-foreground",children:[va.jsx(L,{name:"board",className:"size-[13px]"}),r]}),n?va.jsx(me,{id:"hstop",icon:"x",label:"Stop",className:"size-[34px] rounded-full bg-foreground text-background hover:bg-foreground hover:text-background",onClick:oV}):va.jsx(me,{icon:"send",label:"Send (Enter)",type:"submit",className:"size-[34px] rounded-full bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground hover:brightness-110 active:scale-90"})]})}var ot=h(w(),1);function gc({c:e}){return e.map((t,n)=>{if(typeof t==="string")return t;if(t.k==="code")return ot.jsx("code",{className:"rounded-xs bg-background px-[5px] py-px font-mono text-xs",children:t.t},n);if(t.k==="b")return ot.jsx("b",{children:ot.jsx(gc,{c:t.c})},n);if(t.k==="i")return ot.jsx("i",{children:ot.jsx(gc,{c:t.c})},n);if(t.k==="img")return ot.jsx("a",{href:t.src,target:"_blank",rel:"noopener noreferrer",children:ot.jsx("img",{src:t.src,alt:t.alt,className:"inline max-w-full"})},n);return ot.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline-offset-[3px]",children:ot.jsx(gc,{c:t.c})},n)})}var fce=["my-5 text-lg font-semibold first:mt-0 mb-2","my-5 text-lg font-semibold first:mt-0 mb-2","mb-2 mt-5 text-xs uppercase tracking-[0.08em] text-muted-foreground first:mt-0"];function mce({b:e}){switch(e.k){case"pre":return ot.jsx("pre",{className:"mb-2.5 overflow-x-auto rounded-sm border border-border bg-background px-3 py-2.5 font-mono text-xs leading-normal",children:e.t});case"h":{let t=`h${e.level}`;return ot.jsx(t,{className:fce[e.level-1],children:ot.jsx(gc,{c:e.c})})}case"hr":return ot.jsx("hr",{className:"my-3.5 border-0 border-t border-border"});case"table":return ot.jsx("table",{className:"mb-2.5 border-collapse text-sm",children:ot.jsxs("tbody",{children:[ot.jsx("tr",{children:e.head.map((t,n)=>ot.jsx("th",{className:"border border-border px-2 py-1 text-left font-semibold",children:ot.jsx(gc,{c:t})},n))}),e.rows.map((t,n)=>ot.jsx("tr",{children:t.map((o,r)=>ot.jsx("td",{className:"border border-border px-2 py-1 text-left",children:ot.jsx(gc,{c:o})},r))},n))]})});case"list":{let t=e.ordered?"ol":"ul";return ot.jsx(t,{className:C("mb-2.5 pl-[1.4em]",e.ordered?"list-decimal":"list-disc"),children:e.items.map((n,o)=>{let r=e.ticks?.[o];return r?ot.jsx("li",{className:C("-ml-[1.4em] my-[3px] list-none",r==="rejected"&&"text-muted-foreground line-through"),children:ot.jsxs("label",{className:"flex items-baseline gap-2",children:[ot.jsx("input",{type:"checkbox",checked:r==="done",readOnly:!0,tabIndex:-1,"aria-disabled":"true","aria-label":r,onClick:(a)=>a.preventDefault(),className:"relative top-0.5 m-0 flex-none cursor-default accent-primary"}),ot.jsx("span",{children:ot.jsx(gc,{c:n})})]})},o):ot.jsx("li",{className:"my-[3px]",children:ot.jsx(gc,{c:n})},o)})})}case"p":return ot.jsx("p",{className:"mb-2.5",children:e.lines.map((t,n)=>ot.jsxs("span",{children:[n>0&&ot.jsx("br",{}),ot.jsx(gc,{c:t})]},n))})}}function dM({blocks:e,className:t}){return ot.jsx("div",{className:t,children:e.map((n,o)=>ot.jsx(mce,{b:n},o))})}var Gp=({text:e,className:t,ticks:n})=>ot.jsx(dM,{blocks:xw(e,n),className:t});var on=h(w(),1),gce=(e)=>e==="edit"?"note":e==="project"?"board":"term";function hce({text:e}){return on.jsxs("div",{role:"status",className:"flex min-h-[54px] items-center gap-2.5 text-sm text-muted-foreground [overflow-wrap:anywhere]",children:[on.jsx("span",{"aria-hidden":"true",className:"relative block size-[52px] flex-none",children:on.jsx("i",{className:"absolute left-3.5 top-5 block h-[13px] w-6 rounded-[3px] border-[1.5px] border-primary bg-primary/70 animate-hfloat after:absolute after:-bottom-1 after:-left-1 after:-right-1 after:h-0.5 after:rounded-b-[5px] after:bg-primary"})}),on.jsxs("span",{className:"flex min-w-0 flex-col gap-1.5",children:[on.jsx("span",{children:e||"Thinking…"}),on.jsx("span",{"aria-hidden":"true",className:"flex h-[7px] items-center gap-1.5",children:[0,1,2].map((t)=>on.jsx("i",{className:"size-1.5 rounded-full bg-primary opacity-35 animate-hdot",style:{animationDelay:`${t*0.16}s`}},t))})]})]})}function jV({m:e,last:t,busy:n}){if(e.role==="user")return on.jsxs("div",{className:"flex flex-col items-end gap-1.5 animate-hin",children:[e.text&&on.jsx("div",{className:"max-w-[80%] whitespace-pre-wrap rounded-[18px_18px_4px_18px] bg-muted px-3.5 py-[9px] text-foreground [overflow-wrap:anywhere]",children:e.text}),!!e.files?.length&&on.jsx("div",{className:"flex max-w-[80%] flex-wrap justify-end gap-1.5",children:e.files.map((s,l)=>on.jsxs("span",{className:"inline-flex max-w-full items-center gap-[5px] rounded-full border border-border px-2 py-1 text-xs [overflow-wrap:anywhere]",children:[on.jsx(L,{name:"clip",className:"size-3 flex-none"}),s.name]},l))})]});let o=t&&n,r=e.steps??[],a=r.filter((s)=>s.kind==="project"),i=qF(e.text+" "+r.map((s)=>s.text).join(" "),O.runCards().map((s)=>s.id));if(!r.length&&!e.text&&!e.error&&!o)return null;return on.jsxs("div",{className:"flex flex-col items-start gap-1.5 animate-hin",children:[e.text&&on.jsx(Gp,{text:e.text,className:"w-full leading-[1.6] text-foreground [overflow-wrap:anywhere] [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_p]:max-w-none"}),!!r.length&&on.jsxs("details",{className:"group min-w-0 max-w-full text-sm text-muted-foreground",children:[on.jsxs("summary",{className:"w-max cursor-pointer hover:text-foreground",children:[r.length," step",r.length>1?"s":""]}),on.jsx("ul",{className:"mt-1.5 flex flex-col gap-[3px] border-l-2 border-border pl-2.5",children:r.map((s,l)=>on.jsxs("li",{className:C("flex min-w-0 items-start gap-1.5",s.ok===!1&&"text-danger"),children:[on.jsx(L,{name:gce(s.kind),className:"mt-0.5 size-[13px] flex-none"}),on.jsx("code",{className:"min-w-0 whitespace-pre-wrap font-mono [overflow-wrap:anywhere]",children:s.text})]},l))})]}),e.error&&on.jsx("div",{className:"whitespace-pre-wrap text-base text-danger",children:e.error}),a.map((s,l)=>on.jsxs("div",{className:C("flex items-center gap-1.5 text-sm",s.ok===!1?"text-danger":"text-success"),children:[on.jsx(L,{name:"board",className:"size-[13px]"}),s.text]},l)),i.map((s)=>on.jsxs(M,{variant:"ghost",size:"sm",className:"gap-1.5",onClick:()=>{let l=O.runCards().find((c)=>c.id===s);if(l)O.openCard(l)},children:[on.jsx(L,{name:"board",className:"size-3.5"}),"Open ",s]},s)),o&&on.jsx(hce,{text:e.activity||"Thinking…"})]})}var kv=h(I(),1);var Ln=h(I(),1);var UV=(e,t,n,o)=>!!n&&e.source===t&&e.origin===n&&!!e.data&&e.data.kz===1&&e.data.t===o,GV=(e,t)=>!!e&&e.kz===1&&e.t===t&&!!t,ck=(e,t,n)=>{try{let o=new URL(e);return o.origin===t?n+o.pathname+o.search+o.hash:null}catch{return null}},FV=(e)=>typeof e==="string"&&e.length<1400000&&/^data:image\/png;base64,[A-Za-z0-9+/=]+$/.test(e)?e:void 0,VV=200,pM=(e)=>/^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:|\/|$)/.test(e),KV=(e)=>/^https?:\/\//.test(e),qV=()=>[...crypto.getRandomValues(new Uint8Array(16))].map((e)=>e.toString(16).padStart(2,"0")).join("");var bce={mode:"element",level:"standard",components:!0,color:"#3c82f7",clear:!1,block:!0},$V=["compact","standard","detailed","forensic"],fM=(e)=>e.map((t)=>({n:t.n,kind:t.kind,selector:t.selector,items:t.items,pb:t.pb,page:t.page,comment:t.comment,intent:t.intent,severity:t.severity})),YV=(e)=>e.map(({crop:t,...n})=>n),WV=(e)=>e==="multi"||e==="area";function XV(e,t,n,o){if(t>=VV)return null;return{...e,id:Math.random().toString(36).slice(2),n,crop:FV(e.crop),url:ck(String(e.url||""),o.origin,o.target)??"",page:String(e.page||"")}}var QV=(e,t)=>e.filter((n)=>n.n!==t),ZV=(e,t,n)=>{let o=n.trim();return o&&e.some((r)=>r.n===t&&r.comment!==o)?e.map((r)=>r.n===t?{...r,comment:o}:r):e},JV=(e,t)=>({notes:YV(e),level:t.level,components:t.components}),eK=(e,t,n)=>({dir:e.dir,id:e.id,notes:t.map((o)=>({...o})),level:n.level,components:n.components}),uk=(e,t)=>`${e} ${t}${e===1?"":"s"}`,vce=(e,t)=>{try{return{...t,...JSON.parse(localStorage.getItem(e)||"{}")}}catch{return t}},tK=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},nK=()=>vce("kz-annotate",bce),mM=(e)=>tK("kz-annotate",e),oK=(e)=>{try{let t=JSON.parse(localStorage.getItem("kz-ann:"+e)||"[]");return Array.isArray(t)?t:[]}catch{return[]}},gM=(e,t)=>tK("kz-ann:"+e,YV(t));function rK(e){let t=oK(e.wsKey),n=de(()=>({settings:nK(),on:!1,hide:!1,pause:!1,want:!1,list:!1,setOpen:!1,px:null,notes:t,flash:null})),{getState:o,setState:r}=n,a=t.reduce((E,z)=>Math.max(E,z.n),0),i=!0,s,l=()=>{let E=e.frame();return E?.tagName==="WEBVIEW"?E:null},c=()=>e.frame()?.contentWindow??null,d=(E)=>{let{px:z}=o();if(!z)return;let B={kz:1,t:z.token,...E},Z=l();if(Z)try{Z.send("kz-ann",B)}catch{}else c()?.postMessage(B,z.origin)},u=()=>{let E=o();d({type:"config",cfg:{on:E.on,mode:E.settings.mode,hide:E.hide,block:E.settings.block,color:E.settings.color,components:E.settings.components,pause:E.pause}}),d({type:"markers",list:fM(E.notes)})},p=(E)=>{r({notes:E}),gM(e.wsKey,E),d({type:"markers",list:fM(E)})},f=()=>p([]);async function g(){let{notes:E,settings:z}=o();if(!E.length)return;let B=await K("/annotate/format",JV(E,z));if(!B?.ok)return;try{await navigator.clipboard.writeText(B.text)}catch{d({type:"copy",text:B.text})}if(_(`Copied ${uk(E.length,"note")}`),z.clear)f()}async function m(){let E=e.run();if(!E)return void _("Open this run's agent first: there is nothing to send to.");let{notes:z,settings:B}=o();if(!z.length)return;let Z=await K("/annotate/send",eK(E,z,B));if(!Z?.ok)return;if(_(`Sent ${uk(Z.sent,"note")} to the agent${Z.crops?`, ${uk(Z.crops,"crop")} saved`:""}`),B.clear)f()}let y={use:n,live(E){i=E},setMode(E){let z={...o().settings,mode:E};r({settings:z,on:!0}),mM(z),u()},pick(){r({on:!o().on}),u()},togglePause(){r({pause:!o().pause}),u()},toggleHide(){r({hide:!o().hide}),u()},toggleList(){r({list:!o().list})},toggleSettings(){let E=!o().setOpen;r({setOpen:E,...E?{list:!0}:{}})},close(){r({want:!1,on:!1,pause:!1,list:!1,px:null}),e.reload()},clear:f,copy:g,send:m,setting(E,z){let B={...o().settings,[E]:z};if(r({settings:B}),mM(B),E==="color"||E==="block"||E==="components")u()},removeNote(E){p(QV(o().notes,E))},editNote(E,z){let B=ZV(o().notes,E,z);if(B!==o().notes)r({notes:B}),gM(e.wsKey,B)},mode(E){let z=o();return z.on&&z.settings.mode===E?y.pick():y.setMode(E)},key(E){if(E==="toggle")return y.pick();if(!o().on)return;if(E==="p")y.togglePause();else if(E==="h")y.toggleHide();else if(E==="c")g();else if(E==="s")m();else if(E==="x")f();else if(E==="esc")y.pick()},proxied:()=>!!o().px,active:()=>o().on,async open(E){k=!1;let{want:z}=o();if(z&&l()&&KV(E)&&!pM(E)){let Z=new URL(E).origin;return r({px:{origin:Z,token:qV(),target:Z},on:!1}),k=!0,null}if(!z||!pM(E))return r({px:null,on:!1,pause:!1}),null;let B=await K("/annotate/open",{url:E});if(!B?.ok)return r({want:!1,px:null}),null;return r({px:{origin:B.origin,token:B.token,target:new URL(E).origin}}),B.url},closeProxy(){k=!1,r({px:null,on:!1,pause:!1})},toggle(){r({want:!o().want}),e.reload()},listen:D},b=(E)=>{let{px:z}=o();if(!z)return;if(E.type==="ready")r({on:!0}),u();else if(E.type==="loc"){let B=ck(String(E.href),z.origin,z.target);if(B)e.onLocation(B)}else if(E.type==="key")y.key(String(E.key));else if(E.type==="marker")r({flash:Number(E.n)}),clearTimeout(s),s=setTimeout(()=>r({flash:null}),900);else if(E.type==="note"&&E.note){let B=XV(E.note,o().notes.length,a+1,z);if(!B)return;a++,p([...o().notes,B])}},x=(E)=>{if(!i||!o().px)return;let z=E.target;if((E.ctrlKey||E.metaKey)&&E.shiftKey&&E.key.toLowerCase()==="f")return E.preventDefault(),y.key("toggle");if(z&&(z.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(z.tagName))||E.ctrlKey||E.metaKey||E.altKey)return;let B=E.key.toLowerCase();if(B==="escape")y.key("esc");else if(B.length===1&&"phcsx".includes(B))y.key(B)},v=(E)=>{let{px:z}=o(),B=E.data?.type;if((i||B==="ready"||B==="loc")&&z&&UV(E,c(),z.origin,z.token))b(E.data)},k=!1,S=null,N=async()=>{let E=l();if(!E||!k||!o().px)return;try{let B=new URL(E.getURL()).origin;r({px:{...o().px,origin:B,target:B}})}catch{}S??=await fetch("/annotate.js").then((B)=>B.ok?B.text():null,()=>null);let z=o().px;if(!S||!k||!z)return;E.executeJavaScript(`window.__kzAnnToken=${JSON.stringify(z.token)};
101
+ ${S}`).catch(()=>{})},R=(E)=>{let z=o().px;if(z&&E.channel==="kz-ann"&&GV(E.args?.[0],z.token))b(E.args[0])},A=()=>void N();function D(){let E=l();return addEventListener("keydown",x),addEventListener("message",v),E?.addEventListener("dom-ready",A),E?.addEventListener("ipc-message",R),()=>{removeEventListener("keydown",x),removeEventListener("message",v),E?.removeEventListener("dom-ready",A),E?.removeEventListener("ipc-message",R),clearTimeout(s)}}return y}var cK=h(I(),1);var lr=h(w(),1),yce=[["element","a-pick","Pick an element"],["text","a-text","Select text"],["multi","a-multi","Pick several elements"],["area","a-area","Drag an area"]];function hc({icon:e,title:t,on:n,off:o,badge:r,onClick:a}){return lr.jsxs("button",{type:"button",title:t,"aria-label":t,disabled:o,onClick:a,className:C("relative m-0 grid size-8 cursor-pointer place-items-center rounded-full border-0 bg-transparent p-0 text-inherit hover:bg-[#2c2c2e] hover:text-white disabled:cursor-default disabled:opacity-35 disabled:hover:bg-transparent disabled:hover:text-inherit",n&&"bg-[#3a3a3c] text-white"),children:[lr.jsx(L,{name:e,className:"size-[17px]"}),!!r&&lr.jsx("i",{className:"absolute top-px right-0 h-[15px] min-w-[15px] rounded-lg bg-[#f59e0b] px-1 text-center text-[10px] leading-[15px] font-semibold text-[#1c1c1e] not-italic",children:r})]})}var aK=()=>lr.jsx("span",{className:"mx-1 h-[18px] w-px bg-[#3a3a3c]"});function iK({ann:e,wide:t}){let n=e.use((r)=>r),o=!n.notes.length;return lr.jsxs("div",{className:C("absolute bottom-3.5 z-[6] flex max-w-[calc(100%-28px)] flex-wrap items-center justify-center gap-0.5 rounded-[26px] border border-[#3a3a3c] bg-[#1c1c1e] p-1.5 text-[#c7c7cc] shadow-[0_8px_28px_#0007]",t?"right-[314px] max-sm:right-[254px]":"right-3.5"),children:[yce.map(([r,a,i])=>lr.jsx(hc,{icon:a,title:i,on:n.on&&n.settings.mode===r,onClick:()=>e.mode(r)},r)),lr.jsx(aK,{}),lr.jsx(hc,{icon:"a-pause",title:"Freeze animations (P)",on:n.pause,onClick:e.togglePause}),lr.jsx(hc,{icon:"eye",title:"Show or hide markers (H)",on:!n.hide,onClick:e.toggleHide}),lr.jsx(hc,{icon:"a-copy",title:"Copy notes as markdown (C)",off:o,onClick:()=>void e.copy()}),lr.jsx(hc,{icon:"send",title:"Type the notes into this run's agent (S)",off:o,onClick:()=>void e.send()}),lr.jsx(hc,{icon:"trash",title:"Remove all notes (X)",off:o,onClick:e.clear}),lr.jsx(aK,{}),lr.jsx(hc,{icon:"note",title:"Notes list",on:n.list,badge:n.notes.length,onClick:e.toggleList}),lr.jsx(hc,{icon:"gear",title:"Output detail, colour, behaviour",on:n.setOpen,onClick:e.toggleSettings}),lr.jsx(hc,{icon:"x",title:"Close the annotator (the Annotate button brings it back)",onClick:e.close})]})}var fk=h(I(),1);var pk=h(I(),1);var Lo=h(w(),1),dk="flex items-center justify-between gap-1.5 text-[12px] font-normal";function hM({ann:e,k:t,label:n}){let o=e.use((r)=>r.settings[t]);return Lo.jsx(tc,{className:dk,children:Lo.jsxs("span",{className:"flex items-center gap-1.5",children:[Lo.jsx(Hr,{checked:o,onCheckedChange:(r)=>e.setting(t,r===!0)}),n]})})}function xce({ann:e,value:t}){let n=pk.useRef(null);return pk.useEffect(()=>{let o=n.current,r=()=>e.setting("color",o.value);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[]),Lo.jsx("input",{ref:n,type:"color",defaultValue:t},t)}function sK({ann:e}){let t=e.use((n)=>n.settings);return Lo.jsxs("div",{className:"flex flex-col gap-1.5 rounded-sm border border-border p-2",children:[Lo.jsxs("div",{className:dk,children:[Lo.jsx(tc,{className:dk,children:"Output detail"}),Lo.jsxs(Pt,{value:t.level,onValueChange:(n)=>e.setting("level",n),children:[Lo.jsx(_t,{size:"sm","aria-label":"Output detail",children:Lo.jsx(Ot,{})}),Lo.jsx(zt,{children:$V.map((n)=>Lo.jsx(dt,{value:n,children:n},n))})]})]}),Lo.jsx(hM,{ann:e,k:"components",label:"Component names"}),Lo.jsxs(tc,{className:dk,children:["Marker colour",Lo.jsx(xce,{ann:e,value:t.color})]}),Lo.jsx(hM,{ann:e,k:"clear",label:"Clear after copy or send"}),Lo.jsx(hM,{ann:e,k:"block",label:"Block page clicks while picking"})]})}var ya=h(w(),1);function wce({ann:e,note:t,flash:n}){let o=fk.useRef(null);return fk.useEffect(()=>{if(n)o.current?.scrollIntoView({block:"nearest"})},[n]),ya.jsxs("div",{ref:o,className:C("flex items-start gap-2 rounded-sm border border-border p-2",n&&"outline-2 outline-primary"),children:[ya.jsx("b",{className:C("grid size-[22px] shrink-0 place-items-center rounded-full bg-primary text-[12px] font-normal text-primary-foreground",WV(t.kind)&&"bg-[#34c759] text-white"),children:t.n}),ya.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[ya.jsx(xn,{defaultValue:t.comment,spellCheck:!1,rows:1,"aria-label":`Note ${t.n}`,className:"m-0 field-sizing-content min-h-[1lh] font-[inherit] rounded-[3px] border-0 p-0 text-[12px] break-words whitespace-pre-wrap focus:bg-muted",onBlur:(r)=>e.editNote(t.n,r.currentTarget.value)},t.comment),ya.jsx("code",{className:"block truncate text-[11px] text-muted-foreground",children:t.selector}),ya.jsxs("small",{className:"text-[10px] text-muted-foreground",children:[t.intent," · ",t.severity,t.crop?"":" · no crop"]}),t.crop&&ya.jsx("img",{alt:"crop",src:t.crop,className:"max-w-full rounded-xs border border-border"})]}),ya.jsx("button",{type:"button",title:"Delete","aria-label":"Delete",onClick:()=>e.removeNote(t.n),className:"m-0 cursor-pointer border-0 bg-transparent p-0 text-[16px] leading-none text-muted-foreground",children:"×"})]})}function lK({ann:e}){let t=e.use((r)=>r.notes),n=e.use((r)=>r.flash),o=e.use((r)=>r.setOpen);return ya.jsxs("div",{className:"absolute inset-y-0 right-0 z-[5] flex w-[300px] max-w-[85%] flex-col gap-2 overflow-auto border-l border-border bg-background p-2.5 text-[12px] shadow-[-8px_0_24px_#0003] max-sm:w-[240px]",children:[o&&ya.jsx(sK,{ann:e}),!t.length&&ya.jsx("p",{className:"m-2 text-muted-foreground",children:"No notes yet. Pick something on the page and write what should change."}),t.map((r)=>ya.jsx(wce,{ann:e,note:r,flash:n===r.n},r.id))]})}var Fp=h(w(),1);function uK({ann:e}){let t=e.use((o)=>!!o.px),n=e.use((o)=>o.list);if(cK.useEffect(()=>e.listen(),[e]),!t)return null;return Fp.jsxs(Fp.Fragment,{children:[n&&Fp.jsx(lK,{ann:e}),Fp.jsx(iK,{ann:e,wide:n})]})}var Ft=h(w(),1),kce=(e,t)=>t.t==="go"?dR(e,t.u):t.t==="reload"?Lz(e):t.t==="back"?Bz(e):t.t==="fwd"?Hz(e):jz(e,t.u),bM=/^(localhost|127\.0\.0\.1|\[::1\])$/.test(location.hostname),mk=!!window.kaizenDesktop?.browserPane,Sce=mk?{class:"rframe",title:"Browser",allowpopups:""}:{className:"rframe",title:"Browser",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals allow-downloads",allow:"display-capture; microphone; camera; clipboard-read; clipboard-write; fullscreen"},wv="size-[15px]",Cce=30000,dK=(e,t)=>{try{e.contentWindow.location.replace(t)}catch{e.src=t}};function pK({wsk:e,live:t=!0,shown:n=!0}){let[o,r]=Ln.useReducer(kce,e,(R)=>Iz(_z(R))),[a,i]=Ln.useState(o.url),[s,l]=Ln.useState(!0),[c,d]=Ln.useState(null),[u,p]=Ln.useState(null),f=mo((R)=>R.browse),g=Ln.useRef(null),[m]=Ln.useState(()=>rK({frame:()=>g.current,wsKey:e,run:()=>Dt.act.currentRun(),reload:()=>r({t:"reload"}),onLocation:(R)=>r({t:"landed",u:R})})),y=m.use((R)=>R.want),b=Ln.useRef(o.url),x=Ln.useRef(""),v=Ln.useRef(!1),k=Ln.useRef(!0);b.current=o.url;let S=(R,A)=>{if(x.current=A,!v.current)R.src=A};return Ln.useEffect(()=>{m.live(n)},[m,n]),Ln.useEffect(()=>{if(!t){let R=setTimeout(()=>{let A=g.current;if(!A||!x.current)return;try{let D=A.contentWindow?.location.href;if(D&&/^https?:/.test(D))x.current=D}catch{}v.current=!0,dK(A,"about:blank")},Cce);return()=>clearTimeout(R)}if(v.current){if(v.current=!1,x.current)dK(g.current,x.current)}},[t]),Ln.useEffect(()=>{if(!mk)return;let R=g.current,A=(D)=>{if(D.isMainFrame===!1||m.proxied()||!/^https?:\/\//.test(D.url))return;r({t:"landed",u:D.url})};R.addEventListener("did-navigate",A),R.addEventListener("did-navigate-in-page",A)},[e]),Ln.useEffect(()=>{qd(e,o.url),i(o.url)},[e,o.url]),Ln.useEffect(()=>{let R=k.current;if(k.current=!1,f?.k!==e)return;if(fw(),R&&o.load===0&&f.url===o.url)return;r({t:"go",u:f.url})},[f,e]),Ln.useEffect(()=>{let R=b.current,A=g.current,D=()=>b.current===R;if(p(null),!bM&&uR(R)){l(!1),d({text:"Opening this page for this device…"}),Gz(R).then((z)=>{if(!D())return;if(!z.ok)return void d({text:`${pR} (${z.error})`});d(z.hint?{text:z.hint}:null),l(!0),S(A,z.url),p(z.url)}).catch(()=>D()&&d({text:pR}));return}l(!0),d(null);let E=!0;return m.open(R).then((z)=>{if(!E)return;if(S(A,z??R),z||mk)return;Fz(R).then((B)=>{if(!D()||B.frameable!==!1)return;l(!1),x.current="",A.removeAttribute("src"),d({refused:R})}).catch(()=>{})}),()=>{E=!1}},[o.load]),Ft.jsxs(Ft.Fragment,{children:[Ft.jsxs("form",{className:"urlbar kz-keep",onSubmit:(R)=>{R.preventDefault(),r({t:"go",u:zz(a)})},children:[Ft.jsx("button",{type:"button",title:"Back","aria-label":"Back",onClick:()=>r({t:"back"}),children:"‹"}),Ft.jsx("button",{type:"button",title:"Forward","aria-label":"Forward",onClick:()=>r({t:"fwd"}),children:"›"}),Ft.jsx("button",{type:"button",title:"Reload","aria-label":"Reload",onClick:()=>r({t:"reload"}),children:Ft.jsx(L,{name:"refresh",className:wv})}),Ft.jsx("input",{className:"sel","aria-label":"Address",spellCheck:!1,value:a,onChange:(R)=>i(R.target.value)}),Ft.jsxs("button",{type:"button",className:C("rwin",y&&"on"),hidden:!bM,title:"Pick elements on this page and send notes to the agent (localhost pages)",onClick:m.toggle,children:[Ft.jsx(L,{name:"eye",className:wv}),Ft.jsx("span",{children:"Annotate"})]}),Ft.jsxs("a",{className:"rwin",target:"_blank",rel:"noopener",href:u??o.url,title:"Open in a new browser tab",children:[Ft.jsx(L,{name:"popout",className:wv}),Ft.jsx("span",{children:"New tab"})]})]}),Ft.jsxs("div",{className:"annrow kz-keep",children:[Ln.createElement(mk?"webview":"iframe",{ref:g,hidden:!s,...Sce}),Ft.jsx(uK,{ann:m})]}),Ft.jsx("p",{className:"rnote kz-keep",hidden:!c,children:c?.refused?Ft.jsx(Nce,{u:c.refused}):c?.text})]})}function Nce({u:e}){return Ft.jsxs(Ft.Fragment,{children:[Ft.jsx("b",{children:"This page refuses to be shown inside kaizen"}),new URL(e).host," sends a header that forbids framing."," ",Ft.jsxs("a",{className:"rwin",target:"_blank",rel:"noopener",href:e,children:[Ft.jsx(L,{name:"popout",className:wv}),Ft.jsx("span",{children:"Open in new tab"})]}),bM&&uR(e)&&Ft.jsxs("button",{type:"button",className:"rwin",title:"Open in an app window",onClick:()=>void uw(e).then((t)=>t&&_(t)),children:[Ft.jsx(L,{name:"popout",className:wv}),Ft.jsx("span",{children:"Open in app window"})]})]})}var bg=h(I(),1);var Wn=h(w(),1);function Rce({url:e,text:t}){let{blocks:n,shots:o}=bg.useMemo(()=>RI(t?xw(t):[]),[t]);return Wn.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e&&Wn.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border px-2.5 py-1.5",children:[Wn.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm select-text",children:e}),RR()&&Nm(e)&&Wn.jsxs(M,{size:"sm",variant:"ghost",title:"Open in an app window",onClick:()=>void uw(e).then((r)=>r&&_(r)),children:[Wn.jsx(L,{name:"popout",className:"size-[15px]"}),Wn.jsx("span",{children:"Open in app window"})]})]}),Wn.jsxs("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:[t?Wn.jsx(dM,{blocks:n}):Wn.jsx("p",{className:"text-muted-foreground",children:"This run has no Preview yet."}),o.length>0&&Wn.jsx("div",{className:"mt-3 grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3",children:o.map((r,a)=>Wn.jsxs("figure",{className:"overflow-hidden rounded-xs border border-border bg-card",children:[Wn.jsx("a",{href:r.src,target:"_blank",rel:"noopener noreferrer",children:Wn.jsx("img",{src:r.src,alt:r.alt,className:"block h-[180px] w-full object-cover object-top"})}),Wn.jsx("figcaption",{className:"truncate px-2.5 py-1.5 text-sm text-muted-foreground",children:NI(r)})]},a))})]})]})}function fK({live:e=!0}){let t=mo((r)=>r.previewTick),[n,o]=bg.useState(null);if(bg.useEffect(()=>{let r=e&&Dt.act.previewTarget();if(!r)return;let a=!1;return TI(r).then((i)=>!a&&o(i)),()=>{a=!0}},[t,e]),!n)return null;if(n.kind==="frame")return Wn.jsx("iframe",{className:"min-h-0 w-full flex-1 border-0 bg-card",title:"Preview",src:n.src});if(n.kind==="image")return Wn.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:Wn.jsxs("figure",{children:[Wn.jsx("img",{src:n.src,alt:"Latest change",className:"max-w-full rounded-xs"}),Wn.jsx("figcaption",{className:"mt-1.5 text-sm text-muted-foreground",children:n.name})]})});return Wn.jsx(Rce,{url:n.url,text:n.text})}var vg=h(I(),1);var vM=h(w(),1);function Qu({sessionKey:e,onEnd:t=()=>Dt.act.termEnded(),focus:n,className:o,label:r}){let a=vg.useRef(null),[i,s]=vg.useState(!1);return vg.useEffect(()=>{let l=null,c=!1;return wI().then((d)=>{if(c)return;if(l=d(a.current,e,t),n)requestAnimationFrame(()=>a.current?.querySelector(".xterm-helper-textarea")?.focus({preventScroll:!0}))},()=>s(!0)),()=>{c=!0,l?.()}},[e]),vM.jsx("div",{className:"kz-keep contents",children:vM.jsx("div",{ref:a,"aria-label":r,className:C("term min-h-0 flex-1",o),children:i&&"The terminal could not load."})})}var fs=h(w(),1);function mK(){let{agents:e,dflt:t}=Xu(),n=(o,r,a,i)=>fs.jsxs(nn,{onSelect:()=>void rk(o||void 0),className:"items-start gap-2.5 px-2.5 py-1.5 text-foreground",children:[fs.jsx(L,{name:i,className:"mt-0.5 size-4"}),fs.jsxs("span",{className:"flex flex-col",children:[r,fs.jsx("small",{className:"text-xs text-muted-foreground",children:a})]})]},o||"shell");return fs.jsxs(En,{onOpenChange:(o)=>o&&void ZA(),children:[fs.jsx(An,{asChild:!0,children:fs.jsx(me,{icon:"plus",label:"New tab",className:"size-(--btn-xs) max-[640px]:size-10"})}),fs.jsxs(Mn,{align:"start",className:"min-w-[250px]",children:[e.map((o)=>n(o.cmd,o.name,o.cmd===t?"default agent, in your Home folder":"in your Home folder",uV(o.cmd))),!!e.length&&fs.jsx(Zr,{}),n("","Shell","a terminal in your Home folder","term")]})]})}var Xe=h(w(),1),Tce="grid size-(--btn-xs) place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground max-[640px]:size-10";function yM({label:e,onClick:t,children:n,className:o}){return Xe.jsxs(R1,{children:[Xe.jsx(T1,{asChild:!0,children:Xe.jsx("button",{type:"button","aria-label":e,onClick:t,className:C(Tce,o),children:n})}),Xe.jsx(E1,{children:e})]})}var xM="size-(--ico) fill-none stroke-current stroke-2 [stroke-linecap:round]";function gK(){let e=Xu(),t=kv.useRef(null),n=yt((s)=>s.shells),o=tk(n,e.ending),r=dV(o,e.on),a=e.st==="open",i=cM(t,lV,Math.min(760,innerWidth-32),(s)=>nt()||e.max||!!s.target.closest("button,summary"));return kv.useEffect(()=>{let s=(l)=>{if(!l.ctrlKey||!l.altKey||l.shiftKey||l.metaKey||l.code!=="KeyA"||l.getModifierState?.("AltGraph")||nt())return;l.preventDefault(),l.stopPropagation(),tM()};return addEventListener("keydown",s,!0),()=>removeEventListener("keydown",s,!0)},[]),Xe.jsxs("section",{ref:t,"aria-label":"Home workspace",hidden:!a,style:i.at&&!e.max?{left:i.at.x,top:i.at.y,right:"auto",bottom:"auto"}:void 0,className:C(a?"flex":"hidden","fixed right-4 bottom-[calc(var(--foot-h,0px)+16px)] z-35 h-[min(480px,calc(100vh-96px))] max-h-[calc(100vh-16px)] min-h-[220px] w-[min(760px,calc(100vw-32px))] max-w-[calc(100vw-16px)] min-w-[360px] resize flex-col overflow-hidden rounded-lg border border-border bg-card text-foreground shadow-[var(--shadow-2),0_18px_48px_-12px_var(--shade)]",e.max&&"inset-2! h-auto! max-h-none! w-auto! max-w-none! resize-none","max-[640px]:inset-0! max-[640px]:z-45 max-[640px]:h-auto! max-[640px]:max-h-none! max-[640px]:min-h-0 max-[640px]:w-auto! max-[640px]:max-w-none! max-[640px]:min-w-0 max-[640px]:resize-none max-[640px]:rounded-none max-[640px]:border-0 max-[640px]:pt-[env(safe-area-inset-top)] max-[640px]:pb-[env(safe-area-inset-bottom)] max-[640px]:shadow-none"),children:[Xe.jsxs("header",{onPointerDown:i.onPointerDown,className:"flex h-(--tabbar) flex-none cursor-default touch-none items-center gap-1.5 border-b border-border pr-1.5 pl-3 select-none max-[640px]:h-12 max-[640px]:cursor-default max-[640px]:pr-1 max-[640px]:pl-3",children:[Xe.jsx(L,{name:"home",className:"size-(--ico) flex-none stroke-[1.8] text-muted-foreground"}),Xe.jsx("span",{className:"sr-only",children:"Home"}),Xe.jsx("div",{role:"tablist","aria-label":"Home terminals",className:"ml-1.5 flex min-w-0 self-stretch overflow-x-auto overflow-y-hidden [scrollbar-width:none]",children:o.map((s)=>Xe.jsxs("div",{role:"presentation",className:C("group flex max-w-[220px] min-w-[120px] flex-none items-center gap-2 pr-1.5 pl-3 text-base max-[640px]:max-w-40 max-[640px]:min-w-0 max-[640px]:pr-1 max-[640px]:pl-2.5",s.key===r?"text-strong shadow-[inset_0_-2px_var(--ink-hi)]":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[Xe.jsxs("button",{type:"button",role:"tab","aria-selected":s.key===r,title:s.title,onClick:()=>gV(s.key),className:"flex h-full min-w-0 flex-1 items-center gap-2 text-left",children:[Xe.jsx(L,{name:s.agent&&WA.includes(s.agent)?s.agent:"term",className:"size-(--ico-s) flex-none"}),Xe.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.title})]}),Xe.jsx("button",{type:"button","aria-label":`Close ${s.title}`,title:"Close tab",onClick:()=>void vV(s.key),className:C("grid size-5 flex-none place-items-center rounded-sm opacity-0 group-hover:opacity-60 hover:bg-muted hover:opacity-100 max-[640px]:size-7 max-[640px]:opacity-60",s.key===r&&"opacity-60"),children:Xe.jsx(L,{name:"x",className:"size-(--ico)"})})]},s.key))}),Xe.jsx(mK,{}),Xe.jsx("span",{className:"flex-1"}),Xe.jsx(yM,{label:"Minimize to the sidebar",onClick:()=>Up("min"),className:"max-[640px]:hidden",children:Xe.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:xM,children:Xe.jsx("path",{d:"M5 18h14"})})}),Xe.jsx(yM,{label:e.max?"Restore size":"Maximize",onClick:hV,className:"max-[640px]:hidden",children:Xe.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:xM,children:Xe.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"})})}),Xe.jsx(yM,{label:"Close the Home workspace",onClick:()=>nt()?Up("closed",!1):void eM(),className:"max-[640px]:size-10",children:Xe.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:xM,children:Xe.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})})]}),Xe.jsx("div",{className:C("flex min-h-0 flex-1 flex-col",r?"bg-(--term-bg,var(--bg))":"bg-background"),children:!a?null:r?Xe.jsx(Qu,{sessionKey:r,focus:!0,onEnd:()=>void ok(),className:"p-[8px_4px_4px_10px] [&_.xterm]:h-full [&_.xterm-viewport]:bg-transparent!"},r):Xe.jsx("p",{className:"m-auto text-sm text-muted-foreground",children:"No terminals. Start an agent or a shell with +."})})]})}function hK(){let e=Xu((o)=>o.st==="open"),t=kv.useRef(null),n=cM(t,cV,40,()=>!1);return Xe.jsx("button",{ref:t,type:"button",hidden:e,title:"Home workspace (Ctrl+Alt+A)","aria-label":"Home workspace",onPointerDown:n.onPointerDown,onClick:()=>!n.wasDrag()&&tM(),style:n.at?{left:n.at.x,top:n.at.y,right:"auto",bottom:"auto"}:void 0,className:C("fixed right-4 bottom-[calc(var(--foot-h,0px)+16px)] z-34 size-10 touch-none place-items-center rounded-full border border-border bg-card text-foreground shadow-md hover:bg-[color-mix(in_srgb,var(--bg-2)_85%,var(--ink))] hover:text-strong max-[640px]:hidden!",e?"hidden":"grid"),children:Xe.jsx(L,{sprite:"r",name:"term",className:"size-[18px] fill-none stroke-current stroke-2"})})}function bK(){let e=Xu(),t=yt((o)=>o.shells),n=tk(t,e.ending).length;return Xe.jsx("div",{className:"plist hwsslot",hidden:e.st!=="min",children:Xe.jsxs("div",{className:"pgrp",children:[Xe.jsxs("button",{type:"button",className:"proj",title:"Home workspace: agents outside any project (Ctrl+Alt+A)",onClick:()=>Up("open"),children:[Xe.jsx("svg",{className:"plogo hwsico","aria-hidden":"true",children:Xe.jsx("use",{href:"#i-home"})}),Xe.jsx("span",{className:"pname",children:"Home"}),Xe.jsx("span",{className:"c",children:n||""})]}),Xe.jsx("button",{type:"button",className:"wadd hwsrx",title:"Close the Home workspace","aria-label":"Close the Home workspace",onClick:()=>void eM(),children:Xe.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:Xe.jsx("path",{d:"M7 7l10 10M17 7 7 17",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]})})}var TM=h(I(),1);var gk=h(I(),1);var wM=h(w(),1),Ece="button,a,summary,label,select,[role=button],input[type=checkbox]";function vK(){let e=gk.useRef(null);return gk.useEffect(()=>{let t=(n)=>{if(!nt()||!n.isTrusted||!n.target.closest?.(Ece))return;try{if(localStorage.getItem("kz-haptic")==="off")return}catch{}if(navigator.vibrate)return void navigator.vibrate(8);e.current?.click()};return addEventListener("click",t,!0),()=>removeEventListener("click",t,!0)},[]),wM.jsx("label",{ref:e,hidden:!0,onClick:(t)=>t.stopPropagation(),children:wM.jsx("input",{type:"checkbox",...{switch:""}})})}var yK=h(w(),1);function hk({svg:e,label:t}){return yK.jsx("img",{src:mB(e),alt:t,className:"w-[168px] flex-none rounded-md"})}var De=h(w(),1),xK=({href:e,children:t})=>De.jsx("a",{className:"text-primary",href:e,target:"_blank",rel:"noopener",children:t}),bk=({children:e})=>De.jsx("ol",{className:"grid list-decimal gap-1 pl-5 text-foreground",children:e}),Zu=({text:e})=>e?De.jsx("p",{role:"alert",className:"text-sm text-danger",children:e}):null,vk=({on:e})=>De.jsx("i",{className:C("size-[7px] flex-none rounded-full",e?"bg-success":"bg-muted-foreground")}),Ju=({children:e})=>De.jsx("div",{className:"flex flex-col gap-3 text-base leading-normal text-foreground",children:e});function yk(){let{s:e,err:t,busy:n,act:o}=xB(),r=De.jsx(M,{onClick:()=>void o("check"),children:"Check again"});if(!e)return De.jsx(Ju,{children:t?De.jsx(Zu,{text:t}):De.jsx("p",{className:"text-muted-foreground",children:"Checking Tailscale…"})});let a=e.account?De.jsx("b",{children:e.account}):"the same account";if(e.state==="missing")return De.jsxs(Ju,{children:[De.jsx("p",{children:"Your phone reaches this computer through Tailscale, a free private network between your own devices."}),De.jsxs(bk,{children:[De.jsx("li",{children:"Install Tailscale on this computer and log in."}),De.jsx("li",{children:"Install it on your phone too and log in with the same account."})]}),De.jsxs("div",{className:"flex flex-wrap gap-2",children:[De.jsx(M,{variant:"primary",asChild:!0,children:De.jsx("a",{href:mT,target:"_blank",rel:"noopener",children:"Install Tailscale"})}),r]}),De.jsx(Zu,{text:t})]});if(e.state==="login")return De.jsxs(Ju,{children:[De.jsx("p",{children:"Tailscale is installed but not logged in on this computer."}),De.jsxs("div",{className:"flex flex-wrap gap-2",children:[De.jsx(M,{variant:"primary",disabled:!!n,onClick:()=>void o("login"),children:n==="login"?"Opening…":"Log in to Tailscale"}),r]}),De.jsx(Zu,{text:t})]});if(e.state==="ready")return De.jsxs(Ju,{children:[De.jsxs("p",{children:["Tailscale is running",e.account?De.jsxs(De.Fragment,{children:[" as ",a]}):"",". Connect to show the code your phone scans."]}),De.jsx("div",{className:"flex flex-wrap gap-2",children:De.jsx(M,{variant:"primary",disabled:!!n,onClick:()=>void o("connect"),children:n==="connect"?"Connecting…":"Connect phone"})}),De.jsx(Zu,{text:t})]});let i=fB(e.phones);return De.jsxs(Ju,{children:[De.jsxs("div",{className:"flex flex-wrap items-start gap-5",children:[e.qr&&De.jsx(hk,{svg:e.qr,label:`QR code for ${e.url}`}),De.jsxs("div",{className:"grid min-w-0 flex-[1_1_220px] gap-2",children:[De.jsx("p",{className:"font-semibold text-strong",children:"On your phone"}),De.jsxs(bk,{children:[De.jsxs("li",{children:["Install Tailscale from the ",De.jsx(xK,{href:mT,children:"App Store or Play Store"}),"."]}),De.jsx("li",{children:e.account?De.jsxs(De.Fragment,{children:["Log in with ",a,", the account this computer uses."]}):"Log in with the same account as this computer."}),De.jsxs("li",{children:["Scan this code with the camera, or open ",De.jsx(xK,{href:e.url,children:e.url}),"."]}),De.jsx("li",{children:"Choose Add to Home screen so it opens like an app."})]}),De.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[De.jsx(vk,{on:i.on}),i.text]})]})]}),De.jsx("p",{className:"text-sm text-muted-foreground",children:"Anyone on your tailnet can use this board. Keep the tailnet to your own devices, or limit it with Tailscale access rules."}),De.jsx(Zu,{text:t})]})}var xk=h(I(),1);var oo=h(w(),1),kK={hi:"text-danger",mid:"text-warning","":"text-foreground"},Ace={hi:"bg-danger",mid:"bg-warning","":"bg-success"};function wK({label:e,w:t}){if(!t)return null;let n=dT(t.pct);return oo.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-x-2.5 gap-y-1",children:[oo.jsx("span",{className:"text-muted-foreground",children:e}),oo.jsxs("b",{className:C("font-medium",n&&kK[n]),children:[t.pct,"%"]}),oo.jsx("i",{className:"col-span-full h-1 overflow-hidden rounded-xs bg-border",children:oo.jsx("i",{className:C("block h-full",Ace[n]),style:{width:Math.min(100,t.pct)+"%"}})}),oo.jsxs("small",{className:"col-span-full text-xs text-muted-foreground",children:["resets ",uB(t.resetsAt)]})]})}function Mce({u:e,hover:t,side:n}){let o=e.five??e.week,r=dT(o?.pct??0),[a,i]=xk.useState(!1),s=xk.useRef(void 0),l=(d)=>{if(clearTimeout(s.current),d)i(!0);else s.current=setTimeout(()=>i(!1),120)},c=t?{onPointerEnter:(d)=>d.pointerType==="mouse"&&l(!0),onPointerLeave:(d)=>d.pointerType==="mouse"&&l(!1)}:{};return oo.jsxs(rr,{open:a,onOpenChange:i,children:[oo.jsxs(ar,{"aria-label":`${a0[e.agent]} usage`,className:C("flex min-h-8 items-center gap-1.5 text-base",e.error&&"opacity-75"),...c,...t?{onFocus:(d)=>d.currentTarget.matches(":focus-visible")&&l(!0),onBlur:()=>l(!1)}:{},children:[oo.jsx(L,{name:e.agent,className:"size-[15px]"}),oo.jsx("b",{className:C("font-medium",e.error?"text-foreground":kK[r]),children:e.error?"–":o?o.pct+"%":""})]}),oo.jsxs(ir,{align:"start",side:n,className:"flex min-w-60 flex-col gap-2 p-3 text-sm",...c,onOpenAutoFocus:t?(d)=>d.preventDefault():void 0,onCloseAutoFocus:t?(d)=>d.preventDefault():void 0,children:[oo.jsx("b",{className:"font-semibold",children:a0[e.agent]}),e.error?oo.jsxs("span",{className:"text-muted-foreground",children:["Usage unavailable: ",e.error]}):oo.jsxs(oo.Fragment,{children:[oo.jsx(wK,{label:"5-hour window",w:e.five}),oo.jsx(wK,{label:"Week",w:e.week})]})]})]})}var wk=({list:e,hover:t,side:n})=>cB(e).map((o)=>oo.jsx(Mce,{u:o,hover:t,side:n},o.agent));var Q=h(w(),1),SK="active:bg-muted focus-visible:outline-2 focus-visible:outline-primary",Sv="rounded-xl border border-border bg-card",CK=()=>Q.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"size-4 flex-none fill-none stroke-muted-foreground stroke-2 [stroke-linecap:round] [stroke-linejoin:round]",children:Q.jsx("path",{d:"M9 6l6 6-6 6"})}),Sk=({children:e})=>Q.jsx("p",{className:"m-1 text-[12.5px] text-muted-foreground",children:e}),kM=({title:e,children:t})=>Q.jsxs("section",{children:[Q.jsx("h3",{className:"mx-1 mt-[26px] mb-2 text-[11px] font-semibold tracking-[.06em] text-muted-foreground uppercase",children:e}),t]}),SM=(e)=>!(e.ctrlKey||e.metaKey);function Dce(){let{agents:e,projects:t}=qi(),n=r0(e??[],Date.now()),o=aB(n),r=(a)=>a.rows.length>1?dB(a.rows):l0(a.rows[0].a);return Q.jsxs("section",{children:[Q.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[Q.jsxs("h3",{className:"mx-1 mb-0 flex-1 text-[11px] font-semibold tracking-[.06em] text-muted-foreground uppercase",children:["Agents",!!o&&Q.jsxs("span",{className:"float-right tracking-normal normal-case",children:[o," asking"]})]}),Q.jsx("button",{type:"button",onClick:()=>void fT(),className:C("flex min-h-11 items-center pr-1 pl-3 text-[14px] font-semibold",SK),children:"New"})]}),n.length?Q.jsx("div",{className:C(n.length>2?"grid-rows-2":"grid-rows-1","-mx-4 grid snap-x snap-proximity auto-cols-[min(44vw,164px)] grid-flow-col gap-2 overflow-x-auto overscroll-x-contain scroll-px-4 px-4 pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"),children:n.map((a)=>{let{a:i,st:s}=a.rows[0];return Q.jsxs("button",{type:"button",onClick:()=>r(a),className:C("flex min-h-[92px] min-w-0 snap-start flex-col gap-1.5 px-3 py-2.5 text-left transition-colors",Sv,"active:border-foreground focus-visible:outline-2 focus-visible:outline-primary",(s==="asking"||Wd[s]==="fail")&&"border-warning"),children:[Q.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[Q.jsx(Ei,{state:Wd[s]}),a.rows.length>1?a.rows.length+" agents":zl[s],Q.jsx("span",{className:"ml-auto flex gap-1",children:a.rows.map((l,c)=>Q.jsx(L,{name:s0(l.a.agent||""),className:"size-4 flex-none"},c))})]}),Q.jsx("span",{className:"truncate font-mono text-[12px]",children:o0(i)}),Q.jsx("small",{className:"truncate text-[12px] text-muted-foreground",children:$n(i.dir,t)})]},a.k)})}):Q.jsx(Sk,{children:"No agents running. Tap New to start one."})]})}function NK({c:e,now:t}){let n=qi(),o=$n(e.state,n.projects),r=(a)=>{if(!SM(a))return;if(a.preventDefault(),e.kind==="idea"&&e.status==="idea")O.runPopup(e);else O.openWorkspace(e)};return Q.jsxs("a",{href:Bl(e),"data-id":e0(e),onClick:r,className:"flex items-start gap-3 border-b border-border/60 px-1 py-[11px] last:border-b-0",children:[Q.jsx("span",{className:"mt-1 flex",children:Q.jsx(Ei,{state:t0(e,n)})}),Q.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[Q.jsx("b",{className:"truncate text-[14px] font-semibold",children:(e.title||e.text||"").split(`
102
+ `)[0]}),Q.jsxs("small",{className:"flex items-center gap-1.5 truncate text-[12px] text-muted-foreground",children:[Q.jsx(zn,{dir:e.state,label:o,size:14,logo:n.projects?.some((a)=>a.dir===e.state&&a.logo)}),o]}),Q.jsx("code",{className:"truncate font-mono text-[11.5px] leading-[1.4] text-muted-foreground",children:n0(e,t,Il(e,n.tasks))})]})]})}function Pce({d:e}){return Q.jsxs("a",{href:e.dns?"https://"+e.dns+"/":"#",target:"_blank",rel:"noopener","aria-disabled":e.dns?void 0:!0,onClick:(t)=>!e.dns&&t.preventDefault(),className:C("mb-2 flex items-center gap-3 px-3 py-2.5",Sv,!e.dns&&"opacity-60"),children:[Q.jsx("span",{className:"grid size-9 flex-none place-items-center rounded-full bg-muted text-muted-foreground",children:Q.jsx(L,{sprite:"r",name:"desk",className:"size-[18px] fill-none stroke-current stroke-[1.8]"})}),Q.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[Q.jsx("b",{className:"truncate text-[14px] font-semibold",children:e.name}),Q.jsxs("small",{className:"flex items-center gap-1.5 truncate text-[12px] text-muted-foreground",children:[Q.jsx("i",{className:C("size-[7px] flex-none rounded-full bg-muted-foreground",e.online&&"bg-success")}),e.online?"Connected":"Disconnected",e.os?" · "+e.os:""]})]}),Q.jsx(CK,{})]})}function Oce(){let e=qi(),{net:t,usage:n,allDevices:o}=Im(),r=Date.now(),a=iB(e),i=sB(t.computers,o);return Q.jsxs(Q.Fragment,{children:[Q.jsx(Dce,{}),Q.jsxs(kM,{title:"Devices on your Tailnet",children:[Q.jsxs("a",{href:"/?view=device",onClick:(s)=>SM(s)&&(s.preventDefault(),O.go("device",!0)),className:C("mb-2 flex items-center gap-3 px-3 py-2.5",Sv),children:[Q.jsx("span",{className:"grid size-9 flex-none place-items-center rounded-full bg-muted text-muted-foreground",children:Q.jsx(L,{sprite:"r",name:"desk",className:"size-[18px] fill-none stroke-current stroke-[1.8]"})}),Q.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[Q.jsx("b",{className:"truncate text-[14px] font-semibold",children:t.self?.name||"This computer"}),Q.jsxs("small",{className:"flex items-center gap-1.5 truncate text-[12px] text-muted-foreground",children:[Q.jsx("i",{className:"size-[7px] flex-none rounded-full bg-success"}),"Connected · ",a.projects," project",a.projects===1?"":"s"," · ",a.active," active",!!a.waiting&&Q.jsxs(Q.Fragment,{children:[" · ",Q.jsxs("em",{className:"text-warning not-italic",children:[a.waiting," waiting"]})]})]})]}),Q.jsx(CK,{})]}),i.list.map((s)=>Q.jsx(Pce,{d:s},s.dns||s.name)),i.hidden>0&&Q.jsxs("button",{type:"button","aria-expanded":o,onClick:vB,className:C("mb-2 flex min-h-12 w-full items-center justify-between px-3 text-[15px]",Sv,SK),children:[Q.jsx("span",{children:o?"Show less":`Show ${i.hidden} more`}),Q.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:C("size-[18px] fill-none stroke-muted-foreground stroke-2 [stroke-linecap:round] [stroke-linejoin:round] motion-safe:transition-transform",o&&"rotate-180"),children:Q.jsx("path",{d:"M6 9l6 6 6-6"})})]}),!t.tailscale&&Q.jsx(Sk,{children:"Tailscale is off on this computer: other devices do not show."})]}),Q.jsx(kM,{title:"Runs",children:Q.jsxs("div",{className:"flex flex-col",children:[uT(e.cards).map((s,l)=>Q.jsx(NK,{c:s,now:r},l+s.state+e0(s))),!uT(e.cards).length&&Q.jsx(Sk,{children:"No runs yet."})]})}),n.length>0&&Q.jsx(kM,{title:"Usage",children:Q.jsx("div",{className:C("flex flex-wrap gap-3.5 p-3 text-[13px]",Sv),children:Q.jsx(wk,{list:n})})})]})}function kk({title:e,cards:t,shut:n}){let o=Date.now();if(!t.length)return null;return Q.jsxs("details",{open:!n,className:"group mt-1.5",children:[Q.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-1 pt-3 pb-1.5 text-[11px] font-semibold tracking-[.06em] text-muted-foreground uppercase [&::-webkit-details-marker]:hidden",children:[Q.jsx("span",{className:"size-1.5 -rotate-45 border-r-[1.5px] border-b-[1.5px] border-current motion-safe:transition-transform group-open:rotate-45"}),e,Q.jsx("span",{children:t.length})]}),Q.jsx("div",{className:"flex flex-col",children:t.map((r,a)=>Q.jsx(NK,{c:r,now:o},a+r.state+e0(r)))})]})}function _ce(){let e=qi(),t=lB(e);return Q.jsxs(Q.Fragment,{children:[Q.jsx(M,{asChild:!0,children:Q.jsx("a",{href:"?view=tasks",onClick:(n)=>SM(n)&&(n.preventDefault(),O.go("tasks",!0)),children:"All tasks and results"})}),Q.jsx(kk,{title:"Waiting on you",cards:t.wait}),Q.jsx(kk,{title:"Active",cards:t.active}),Q.jsx(kk,{title:"Tasks",cards:t.tasks}),Q.jsx(kk,{title:"Done",cards:t.done,shut:!0}),t.none&&Q.jsx(Sk,{children:"No runs yet."})]})}function RK(){let e=Im((t)=>t.mode);return e==="home"?Q.jsx(Oce,{}):e==="device"?Q.jsx(_ce,{}):null}var CM=h(I(),1);var wt=h(w(),1),TK=s0,NM="flex min-h-12 w-full items-center gap-2 border-t border-border text-left text-lg [&_small]:ml-auto [&_small]:text-sm [&_small]:text-muted-foreground",RM=({name:e})=>wt.jsx(L,{name:e,className:"size-[18px] flex-none"});function zce({s:e}){return wt.jsxs(wt.Fragment,{children:[wt.jsx(lv,{className:"mb-2 font-mono text-base font-normal text-foreground",children:e.title}),e.rows.map((t,n)=>wt.jsxs("button",{type:"button",className:NM,onClick:()=>{Ob(),t.open()},children:[wt.jsx(RM,{name:TK(t.agent)}),t.name,wt.jsx(Ei,{state:t.dot}),wt.jsx("small",{children:t.word})]},n)),wt.jsxs("button",{type:"button",className:NM,onClick:()=>{Ob(),e.onNew()},children:[wt.jsx(RM,{name:"ai"}),"New agent"]})]})}function Ice({s:e}){let[t,n]=CM.useState(String(e.on)),[o,r]=CM.useState(e.yolo);return wt.jsxs(wt.Fragment,{children:[wt.jsx(lv,{className:"mb-2 font-mono text-base font-normal text-foreground",children:"New agent in"}),wt.jsxs(Pt,{value:t,onValueChange:n,children:[wt.jsx(_t,{"aria-label":"Workspace",className:"mb-2 min-h-11 w-full",children:wt.jsx(Ot,{})}),wt.jsxs(zt,{children:[wt.jsx(dt,{value:"-1",children:"Home — no project"}),e.spots.map((a,i)=>wt.jsx(dt,{value:String(i),children:a.name},i))]})]}),wt.jsxs("label",{className:"flex items-center justify-between gap-3 border-t border-border py-2.5 text-lg",children:[wt.jsxs("span",{children:["Yolo / bypass permissions",wt.jsx("small",{className:"block text-sm text-muted-foreground",children:"Run commands without permission prompts"})]}),wt.jsx(sr,{checked:o,onCheckedChange:r,"aria-label":"Yolo / bypass permissions"})]}),e.kinds.map((a,i)=>wt.jsxs("button",{type:"button",className:NM,onClick:()=>{Ob(),e.start(Number(t),i,o)},children:[wt.jsx(RM,{name:a.agent?TK(a.agent):"term"}),a.name]},i))]})}function EK(){let e=i0((t)=>t.sheet);return wt.jsx(S1,{open:!!e,onOpenChange:(t)=>!t&&Ob(),children:e&&wt.jsxs(_U,{"aria-describedby":void 0,children:[wt.jsx(C1,{className:"sr-only",children:"Choose where to open or start an agent"}),e.kind==="pick"?wt.jsx(zce,{s:e}):wt.jsx(Ice,{s:e})]})})}var Oe=h(w(),1),Cv=({children:e})=>Oe.jsx("p",{className:"font-semibold text-strong",children:e}),AK=({children:e})=>Oe.jsx("p",{className:"text-sm text-muted-foreground",children:e});function MK(){let{s:e,err:t,busy:n,act:o}=wB();if(!e)return Oe.jsx(Ju,{children:t?Oe.jsx(Zu,{text:t}):Oe.jsx("p",{className:"text-muted-foreground",children:"Checking WhatsApp…"})});let r=(i)=>Oe.jsx(M,{disabled:n,onClick:()=>void o("disconnect"),children:n?i:"Unlink WhatsApp"}),a=gB(e);return Oe.jsxs(Ju,{children:[a==="connected"&&Oe.jsxs(Oe.Fragment,{children:[Oe.jsx(Cv,{children:"WhatsApp Bridge"}),Oe.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[Oe.jsx(vk,{on:!0})," Connected as ",Oe.jsx("b",{children:e.user||"WhatsApp"})]}),Oe.jsx(AK,{children:"Kaizen can send files and videos directly to your WhatsApp in the background."}),Oe.jsx("div",{className:"flex flex-wrap gap-2",children:r("Disconnecting…")})]}),a==="qr"&&Oe.jsxs("div",{className:"flex flex-wrap items-start gap-5",children:[Oe.jsx(hk,{svg:e.qrSvg,label:"WhatsApp QR code"}),Oe.jsxs("div",{className:"grid min-w-0 flex-[1_1_220px] gap-2",children:[Oe.jsx(Cv,{children:"Link WhatsApp"}),Oe.jsxs(bk,{children:[Oe.jsx("li",{children:"Open WhatsApp on your phone"}),Oe.jsxs("li",{children:["Tap ",Oe.jsx("b",{children:"Settings"})," or ",Oe.jsx("b",{children:"⋮"})," > ",Oe.jsx("b",{children:"Linked Devices"})]}),Oe.jsxs("li",{children:["Tap ",Oe.jsx("b",{children:"Link a Device"})," and scan this QR code"]})]}),Oe.jsxs("div",{className:"flex flex-wrap gap-2",children:[Oe.jsx(M,{onClick:()=>void o("check"),children:"Refresh"}),Oe.jsx(M,{onClick:()=>void o("disconnect"),children:"Cancel"})]})]})]}),a==="reconnecting"&&Oe.jsxs(Oe.Fragment,{children:[Oe.jsx(Cv,{children:"WhatsApp Bridge"}),Oe.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[Oe.jsx(vk,{})," Linked · reconnecting…"]}),Oe.jsx(AK,{children:"Your saved login is used; no new QR code."}),Oe.jsx("div",{className:"flex flex-wrap gap-2",children:r("Unlinking…")})]}),a==="connecting"&&Oe.jsxs(Oe.Fragment,{children:[Oe.jsx(Cv,{children:"WhatsApp Bridge"}),Oe.jsx("p",{className:"text-muted-foreground",children:"Connecting…"})]}),a==="idle"&&Oe.jsxs(Oe.Fragment,{children:[Oe.jsx(Cv,{children:"WhatsApp Bridge"}),Oe.jsx("p",{children:"Send finished videos and files straight to your phone's WhatsApp without opening any app."}),Oe.jsx("div",{className:"flex flex-wrap gap-2",children:Oe.jsx(M,{variant:"primary",disabled:n,onClick:()=>void o("connect"),children:n?"Starting…":"Link WhatsApp"})})]}),Oe.jsx(Zu,{text:t})]})}var Y=h(w(),1),Lce=typeof navigator<"u"&&/Mac|iP(hone|ad)/.test(navigator.platform)?"⌘":"Ctrl";function DK({on:e,onPick:t,children:n,className:o}){return Y.jsxs("button",{type:"button",role:"radio","aria-checked":e,"data-card":!0,onClick:t,className:C("relative flex min-h-12 items-center gap-2.5 rounded-md border border-border px-3 text-left text-base font-medium transition-colors hover:bg-muted",e&&"border-[color-mix(in_srgb,var(--accent)_55%,var(--line))] bg-[color-mix(in_srgb,var(--accent)_14%,transparent)]",o),children:[n,e&&Y.jsx("i",{className:"relative ml-auto grid size-4 flex-none place-items-center rounded-full bg-strong text-background",children:Y.jsx(L,{name:"check",className:"size-2.5"})})]})}var EM=({children:e})=>Y.jsx("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3.5 text-base text-muted-foreground",children:e});function Bce({cfg:e,agent:t,more:n}){let{detected:o,rest:r,all:a}=aM(e),i=SV(e,t),[s,l]=TM.useState(""),c=(p,f)=>Y.jsxs(DK,{on:t===p.cmd,onPick:()=>EV(p.cmd),children:[Y.jsx(L,{name:p.cmd,sprite:"c"}),Y.jsxs("span",{children:[p.name,f&&Y.jsx("small",{className:"block text-xs font-normal text-muted-foreground",children:"Not found"})]})]},p.cmd),d=i&&Y.jsxs(EM,{children:[Y.jsxs("p",{children:[Y.jsx("b",{children:i.agent.name})," is not installed yet.",i.how?.command?" Run this in a terminal, then open kaizen again.":""," You can carry on now: kaizen uses it as soon as it is on your PATH."]}),i.how?.command&&Y.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-border bg-canvas px-2.5 py-2",children:[Y.jsx("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-nowrap font-mono text-sm text-foreground",children:i.how.command}),Y.jsx(M,{onClick:()=>void navigator.clipboard?.writeText(i.how.command).then(()=>l("Copied"),()=>l("Select and copy")),children:s||"Copy"})]}),i.how&&Y.jsx("a",{className:"self-start underline underline-offset-2",href:i.how.docs,target:"_blank",rel:"noopener",children:"Install instructions"})]}),u="grid grid-cols-3 gap-2.5 max-[640px]:grid-cols-2";if(!o.length)return Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:"No agents found on your PATH. Pick the one you will use to see how to install it, or carry on."}),Y.jsx("div",{role:"radiogroup","aria-label":"Default agent",className:"grid grid-cols-3 gap-2.5 max-[640px]:grid-cols-2",children:a.map((p)=>c(p,!0))}),d]});return Y.jsxs(Y.Fragment,{children:[Y.jsxs("div",{className:"text-sm text-muted-foreground",children:["Detected on your system ",Y.jsx("span",{className:"ml-1",children:o.length})]}),Y.jsxs("div",{role:"radiogroup","aria-label":"Default agent",className:"grid grid-cols-3 gap-2.5 max-[640px]:grid-cols-2",children:[o.map((p)=>c(p,!1)),n&&r.map((p)=>c(p,!0))]}),!!r.length&&Y.jsx("button",{type:"button",className:"self-start px-0.5 py-1.5 text-base text-muted-foreground hover:text-foreground",onClick:AV,children:n?"Hide agents":`Show ${r.length} more ${r.length===1?"agent":"agents"} →`}),d]})}var Hce={dark:"bg-[#121212]",light:"bg-[#f7f7f7]",system:"bg-[linear-gradient(90deg,#121212_50%,#f7f7f7_50%)]"};function jce({theme:e}){let t=(n,o,r,a)=>Y.jsxs(DK,{on:e===n,onPick:()=>MV(n),className:"flex-col items-stretch gap-2.5 p-2.5",children:[Y.jsxs("span",{className:C("flex h-[84px] overflow-hidden rounded-sm border border-border",Hce[n]),"aria-hidden":!0,children:[Y.jsx("i",{className:"block w-[30%] bg-[rgb(128_140_170/0.22)]"}),Y.jsx("i",{className:"ml-2.5 mt-3.5 block h-[5px] w-[36%] self-start rounded-[3px] bg-[rgb(128_140_170/0.45)]"})]}),Y.jsxs("span",{className:"flex items-baseline justify-between gap-2",children:[Y.jsxs("b",{className:"inline-flex items-center gap-1.5 font-medium",children:[Y.jsx("svg",{viewBox:"0 0 24 24",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Y.jsx("path",{d:a})}),o]}),Y.jsx("small",{className:"text-xs font-normal text-muted-foreground",children:r})]})]},n);return Y.jsxs(Y.Fragment,{children:[Y.jsxs("div",{role:"radiogroup","aria-label":"Theme",className:"grid grid-cols-3 gap-3 max-[640px]:grid-cols-2",children:[t("system","System","Match OS","M3 5h18v11H3zM8 20h8M12 16v4"),t("dark","Dark","Easy on the eyes","M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"),t("light","Light","Bright & crisp","M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M5 19l1.5-1.5M17.5 6.5 19 5")]}),Y.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[Y.jsx("svg",{viewBox:"0 0 24 24",className:"size-3.5 flex-none",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Y.jsx("path",{d:"M4 7h10M18 7h2M4 17h2M10 17h10M14 5v4M8 15v4"})}),Y.jsxs("span",{children:["Motion, density and more live in ",Y.jsx("b",{children:"Settings"}),"."]})]})]})}function Uce(){let[e,t]=TM.useState(ik());return Y.jsxs(EM,{children:[Y.jsx("p",{children:kV[e]}),Y.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e==="default"&&Y.jsx(M,{variant:"primary",onClick:()=>void Notification.requestPermission().then(()=>t(ik()),()=>t(ik())),children:"Allow notifications"}),e==="granted"&&Y.jsx(M,{onClick:()=>new Notification("kaizen",{body:"This is how kaizen will tell you something needs you.",icon:"/logo.png"}),children:"Send test notification"})]})]})}function Gce({cfg:e,flow:t}){let{step:n}=t,o=n===e.total-1,r=rM[n];return Y.jsx(Ga,{open:!0,children:Y.jsxs(Fa,{"aria-label":"Welcome to kaizen","aria-describedby":"onb-sub",onEscapeKeyDown:(a)=>(a.preventDefault(),void lM()),onInteractOutside:(a)=>a.preventDefault(),onKeyDown:(a)=>{if(a.key!=="Enter"||a.nativeEvent.isComposing)return;let i=a.target.closest("button:not([data-card]),input,select,textarea");if(a.ctrlKey||a.metaKey||!i)a.preventDefault(),sM()},onOpenAutoFocus:(a)=>{a.preventDefault(),a.currentTarget.querySelector("[data-card][aria-checked=true],[data-next]")?.focus()},className:"h-[min(740px,calc(100dvh-32px))] w-[min(720px,calc(100vw-32px))] gap-0 px-8 pb-[18px] pt-[26px] shadow-md max-[640px]:h-dvh max-[640px]:w-screen max-[640px]:max-h-none max-[640px]:rounded-none max-[640px]:px-[18px] max-[640px]:pb-3 max-[640px]:pt-[18px]",children:[Y.jsx("div",{children:Y.jsxs("pre",{className:"mark kz-keep",style:{fontSize:6},children:[Y.jsx("span",{children:"█ █ ▄▀█ █ ▀▀█ █▀▀ █▄ █"}),`
103
+ `,Y.jsx("span",{children:"█▀▄ █▀█ █ ▄▀ ██▄ █ ▀█"}),`
104
+ `,Y.jsx("span",{children:"█ █ █ █ █ █▄▄ █▄▄ █ █"})]})}),Y.jsxs("div",{className:"mt-[22px] flex items-center gap-1.5 text-sm text-muted-foreground",children:[rM.map((a,i)=>Y.jsx("button",{type:"button","aria-label":`Go to step ${i+1}: ${oM[i]}`,title:oM[i],onClick:()=>PV(i),className:C("h-[3px] rounded-[2px] p-0 transition-[background,width] motion-reduce:transition-none",i===n?"w-11 bg-strong":"w-8",i<n?"bg-[color-mix(in_srgb,var(--ink)_40%,var(--line))]":i>n&&"bg-border")},i)),Y.jsxs("span",{className:"ml-1.5",children:[n+1," of ",e.total]})]}),Y.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3.5 overflow-auto px-0.5 pb-1.5 pt-[30px]",children:[n===0&&Y.jsx("small",{className:"text-xs uppercase tracking-[0.14em] text-muted-foreground",children:"Welcome to kaizen"}),Y.jsx(ga,{className:"text-[30px] font-bold leading-[1.15] text-strong max-[640px]:text-2xl",children:r.title}),Y.jsx(eA,{id:"onb-sub",className:"mb-3 max-w-[56ch] text-lg",children:r.sub}),n===0&&Y.jsx(Bce,{cfg:e,agent:t.agent,more:t.more}),n===1&&Y.jsx(jce,{theme:t.theme}),n===2&&Y.jsx(Uce,{}),n===3&&Y.jsx(EM,{children:Y.jsx(yk,{})})]}),Y.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto_auto] items-center gap-2.5 border-t border-border pt-3.5",children:[o?Y.jsx("span",{}):Y.jsx("button",{type:"button",className:"px-0.5 py-1.5 text-base text-muted-foreground hover:text-foreground",onClick:()=>void lM(),children:"Skip to project setup"}),Y.jsx("span",{}),n>0&&Y.jsx(M,{onClick:DV,children:"‹ Back"}),Y.jsxs(M,{variant:"primary","data-next":!0,className:"gap-2.5",onClick:()=>void sM(),children:[o?"Add your first project":"Continue",Y.jsxs("kbd",{className:"rounded-xs border border-current/35 px-1.5 py-px font-sans text-xs opacity-75 max-[640px]:hidden",children:[Lce," ↵"]})]})]})]})})}function Fce({cfg:e}){return Y.jsx(Ga,{open:!0,onOpenChange:(t)=>!t&&xv("later"),children:Y.jsxs(Fa,{className:"w-[min(360px,calc(100vw-32px))] gap-0 p-[18px] shadow-md",children:[Y.jsx(ga,{className:"mb-1 text-[16px] font-semibold text-strong",children:"Continue setup?"}),Y.jsx(eA,{className:"mb-4 text-base",children:CV(e)}),Y.jsxs("div",{className:"flex flex-wrap justify-end gap-1.5",children:[Y.jsx(M,{variant:"primary",onClick:()=>xv("go"),children:"Continue"}),Y.jsx(M,{onClick:()=>xv("later"),children:"Not now"}),Y.jsx(M,{onClick:()=>xv("never"),children:"Don't ask again"})]})]})})}function PK(){let{cfg:e,flow:t,offer:n}=sk();if(!e)return null;return t?Y.jsx(Gce,{cfg:e,flow:t}):n?Y.jsx(Fce,{cfg:e}):null}var yg=h(w(),1);function Ck(e){let t=e.label?{role:"img","aria-label":e.label}:{};return yg.jsxs("pre",{className:"mark",...t,children:[yg.jsx("span",{children:"█ █ ▄▀█ █ ▀▀█ █▀▀ █▄ █"}),`
105
+ `,yg.jsx("span",{children:"█▀▄ █▀█ █ ▄▀ ██▄ █ ▀█"}),`
106
+ `,yg.jsx("span",{children:"█ █ █ █ █ █▄▄ █▄▄ █ █"})]})}var we=h(w(),1);function xg(e){let t=ut((n)=>n.lit);return we.jsxs("a",{className:e.className??"it",href:e.href,"data-view":e.view,"data-n":e.n||void 0,title:e.title,"aria-label":e.aria,"aria-current":t===e.view?"page":void 0,children:[we.jsx("svg",{children:we.jsx("use",{href:`#${e.icon}`})}),we.jsx("span",{className:"lbl",children:e.label??e.title}),e.children]})}function OK(e){let{min:t,dark:n,setup:o,openSetup:r}=du(),a=ut((m)=>m.lit),i=Gu((m)=>m.ver?.update?m.ver.latest:""),s=yt((m)=>v6(m.tasks)),l=yt((m)=>m.tasks!==null),c=yt((m)=>y6(m.sources)),d=yt((m)=>m.loaded),u=FB(),p=!l?"Tasks: every task and run, filtered":s?`Tasks · ${s} need you`:"Tasks",f=t?"Expand menu":"Collapse menu",g=n?"Dark theme: switch to light":"Light theme: switch to dark";return we.jsxs("nav",{className:"rail","aria-label":"Main",children:[we.jsxs("div",{className:"top",children:[we.jsxs("a",{className:"home",href:"/",title:"Home","aria-label":"kaizen home",children:[we.jsx(Ck,{}),we.jsx("span",{className:"mascot"})]}),we.jsx(me,{size:"sm",icon:"side",label:f,id:"fold","aria-expanded":!t,onClick:Jx})]}),we.jsxs("a",{className:"it gs-it",href:"#",id:"gsearch",title:"Search everything",onClick:(m)=>(m.preventDefault(),Ul.search()),children:[we.jsxs("svg",{viewBox:"0 0 24 24",children:[we.jsx("circle",{cx:"11",cy:"11",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"2"}),we.jsx("path",{d:"M20 20l-4-4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),we.jsx("span",{className:"lbl",children:"Search"})]}),we.jsxs("a",{className:"it",href:"/","data-view":"home",title:"Chat with the project's agent","aria-current":a==="home"?"page":void 0,children:[we.jsx("svg",{className:"dkl",children:we.jsx("use",{href:"#r-chat"})}),we.jsx("svg",{className:"phl",children:we.jsx("use",{href:"#i-home"})}),we.jsxs("span",{className:"lbl",children:[we.jsx("span",{className:"dkl",children:"Chat"}),we.jsx("span",{className:"phl",children:"Home"})]})]}),we.jsx(xg,{className:"it ponly",href:"/?view=chat",view:"chat",title:"Chat with kaizen's agent",label:"Chat",icon:"r-chat"}),we.jsx(xg,{className:"it ponly",href:"/?view=device",view:"device",title:"This computer's runs",label:"Runs",icon:"r-runs"}),we.jsx(xg,{className:"it ponly",href:"/?view=terminal",view:"terminal",n:u,title:d?"Terminal: every agent kaizen runs"+(u?` (${u} hidden)`:""):"Open terminals across all projects",label:"Terminal",icon:"r-term"}),we.jsxs(xg,{className:"it fold",href:"/?view=icebox",view:"sources",title:"Icebox: requests gathered from your sources",label:"Icebox",icon:"r-tray",children:[we.jsx("span",{className:"srcs",id:"rail-srcs",children:e.srcs}),we.jsx("span",{className:"n",id:"ice-n",children:c||""})]}),we.jsx(xg,{href:"/?view=tasks",view:"tasks",n:s,title:p,aria:l?p:void 0,label:"Tasks",icon:"r-bulb"}),we.jsxs("a",{className:"it",href:"/?setup=1",id:"rsetup",onClick:(m)=>{if(!r)return;m.preventDefault(),r()},hidden:!o,title:o?`Continue setup: step ${o.step+1} of ${o.total}`:"Continue setup",children:[we.jsx("span",{className:"ring",style:o?{"--p":Math.round(o.step/o.total*100)+"%"}:void 0}),we.jsx("span",{className:"lbl",children:"Setup"})]}),we.jsxs("div",{className:"psec",children:[we.jsx("span",{className:"lbl",children:"Projects"}),we.jsx("a",{className:"pbd",href:"/?view=board","data-view":"board",title:"Board","aria-label":"Board","aria-current":a==="board"?"page":void 0,children:we.jsx("svg",{children:we.jsx("use",{href:"#i-board"})})}),we.jsx("span",{id:"pfilter-host",style:{display:"contents"},children:we.jsx(UF,{})}),we.jsx("button",{id:"padd",title:"Add project or workspace","aria-label":"Add project or workspace",onClick:()=>Ul.add(),children:we.jsx("svg",{children:we.jsx("use",{href:"#r-plus"})})})]}),e.before,we.jsx("div",{className:"plist",id:"plist","aria-label":"Tasks and runs by project",children:we.jsx(FF,{})}),we.jsxs("div",{className:"rbot",children:[we.jsx(xg,{className:C("it fold",i&&"upd"),href:"/?view=settings",view:"settings",title:i?`Settings: ${globalThis.kaizenDesktop?"Kaizen":"kaizen"} ${i} is available`:"Settings",aria:"Settings",icon:"i-gear"}),we.jsx("a",{className:"ib xs",href:"/issue",target:"_blank",rel:"noopener",title:"Report an issue","aria-label":"Report an issue",children:we.jsx("svg",{children:we.jsx("use",{href:"#r-bug"})})}),we.jsx("button",{className:"ib xs",id:"kbd",title:"Keyboard shortcuts","aria-label":"Keyboard shortcuts",onClick:()=>Gs(!0),children:we.jsx("svg",{children:we.jsx("use",{href:"#r-kbd"})})}),we.jsxs("button",{className:"ib xs th",id:"themet",title:g,"aria-label":g,"data-dark":n,onClick:Zx,children:[we.jsx("svg",{className:"sun",children:we.jsx("use",{href:"#i-sun"})}),we.jsx("svg",{className:"moon",children:we.jsx("use",{href:"#i-moon"})})]})]})]})}var T=h(w(),1);function _K({notebook:e=!1}){return T.jsx("svg",{style:{display:"none"},"aria-hidden":"true",children:T.jsxs("defs",{children:[T.jsx("symbol",{id:"i-clip",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M21.4 11.1l-9.2 9.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"})}),T.jsxs("symbol",{id:"i-bug",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"8",y:"6",width:"8",height:"14",rx:"4"}),T.jsx("path",{d:"M12 20v-9M8 12H4M20 12h-4M9 7 7 4M15 7l2-3M8 17l-3 2M16 17l3 2M8.5 8.5 5 7M15.5 8.5 19 7"})]}),T.jsxs("symbol",{id:"i-kbd",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),T.jsx("path",{d:"M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10"})]}),T.jsx("symbol",{id:"i-check",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M20 6 9 17l-5-5"})}),T.jsxs("symbol",{id:"i-clock",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"12",cy:"12",r:"9"}),T.jsx("path",{d:"M12 7v5l3 2"})]}),T.jsx("symbol",{id:"i-chev",viewBox:"0 0 24 24",children:T.jsx("path",{d:e?"M9 6l6 6-6 6":"m6 9 6 6 6-6"})}),e&&T.jsxs(T.Fragment,{children:[T.jsx("symbol",{id:"i-box",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 5v14M20 5v14M8 12h8M11 9l-3 3 3 3M13 9l3 3-3 3"})}),T.jsx("symbol",{id:"i-folder",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),T.jsx("symbol",{id:"i-list",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),T.jsx("symbol",{id:"i-wide",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M3 12h18M7 8l-4 4 4 4M17 8l4 4-4 4"})})]}),T.jsxs("symbol",{id:"i-ai",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z"}),T.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z"})]}),T.jsx("symbol",{id:"i-google",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"currentColor",stroke:"none",d:"M12.48 10.92v3.28h7.84c-.24 1.84-.85 3.18-1.73 4.1-1.08 1.08-2.76 2.26-5.7 2.26-4.82 0-8.6-3.89-8.6-8.72s3.78-8.72 8.6-8.72c2.6 0 4.5 1.02 5.9 2.34l2.31-2.31C19.13 1.19 16.56 0 12.48 0 5.87 0 .31 5.39.31 12s5.56 12 12.17 12c3.57 0 6.26-1.17 8.37-3.36 2.16-2.16 2.84-5.21 2.84-7.66 0-.76-.05-1.47-.17-2.06z"})}),T.jsx("symbol",{id:"i-popout",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M14 4h6v6M20 4l-8 8M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"})}),T.jsx("symbol",{id:"i-plus",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M12 5v14M5 12h14"})}),T.jsx("symbol",{id:"i-send",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M12 19V5M6 11l6-6 6 6"})}),T.jsx("symbol",{id:"i-home",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 11l8-7 8 7v8a1 1 0 0 1-1 1h-4v-6h-6v6H5a1 1 0 0 1-1-1z"})}),T.jsxs("symbol",{id:"i-gear",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"12",cy:"12",r:"3"}),T.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"})]}),T.jsxs("symbol",{id:"i-inbox",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M22 12h-6l-2 3h-4l-2-3H2"}),T.jsx("path",{d:"M5.5 5.1L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z"})]}),T.jsx("symbol",{id:"i-link",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M10 13a5 5 0 0 0 7.1.4l3-3a5 5 0 0 0-7.1-7.1l-1.7 1.7M14 11a5 5 0 0 0-7.1-.4l-3 3a5 5 0 0 0 7.1 7.1l1.7-1.7"})}),T.jsx("symbol",{id:"i-play",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M6 4l14 8-14 8z"})}),T.jsxs("symbol",{id:"i-mic",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),T.jsx("path",{d:"M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6"})]}),T.jsx("symbol",{id:"i-pen",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"})}),T.jsx("symbol",{id:"i-x",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M18 6L6 18M6 6l12 12"})}),T.jsx("symbol",{id:"i-filter",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 5h16l-6 8v6l-4-2v-4z"})}),T.jsxs("symbol",{id:"i-note",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M6 3h9l4 4v14H6z"}),T.jsx("path",{d:"M14 3v5h5M9 13h6M9 17h6"})]}),T.jsxs("symbol",{id:"i-video",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"6",width:"13",height:"12",rx:"2"}),T.jsx("path",{d:"M16 10.5l5-3v9l-5-3z"})]}),T.jsx("symbol",{id:"i-trash",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14M10 11v6M14 11v6"})}),T.jsxs("symbol",{id:"i-ask",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"}),T.jsx("path",{d:"M9.8 9.5a2.3 2.3 0 0 1 4.4.8c0 1.5-2.2 2-2.2 3.2M12 16.5h.01"})]}),T.jsx("symbol",{id:"i-mem",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M3 7h18v9H3zM7 16v3M12 16v3M17 16v3M7 10v3M12 10v3M17 10v3"})}),T.jsx("symbol",{id:"i-term",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),T.jsx("symbol",{id:"i-max",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"})}),T.jsx("symbol",{id:"i-min",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"})}),T.jsxs("symbol",{id:"i-lgrid",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),T.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),T.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),T.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),T.jsxs("symbol",{id:"i-lcols",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),T.jsx("path",{d:"M12 3v18"})]}),T.jsxs("symbol",{id:"i-lrows",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),T.jsx("path",{d:"M3 12h18"})]}),T.jsx("symbol",{id:"i-dash",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M5 12h14"})}),T.jsx("symbol",{id:"i-close",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M18 6L6 18M6 6l12 12"})}),T.jsxs("symbol",{id:"i-more",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"5",cy:"12",r:"1.2",fill:"currentColor"}),T.jsx("circle",{cx:"12",cy:"12",r:"1.2",fill:"currentColor"}),T.jsx("circle",{cx:"19",cy:"12",r:"1.2",fill:"currentColor"})]}),T.jsxs("symbol",{id:"i-open",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),T.jsx("path",{d:"M15 3v18"})]}),T.jsxs("symbol",{id:"i-archive",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"2",y:"3",width:"20",height:"5",rx:"1"}),T.jsx("path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8M10 12h4"})]}),T.jsxs("symbol",{id:"i-restore",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),T.jsx("path",{d:"M3 3v5h5"})]}),T.jsx("symbol",{id:"i-b-x",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"currentColor",stroke:"none",d:"M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z"})}),T.jsx("symbol",{id:"i-b-tiktok",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"currentColor",stroke:"none",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"})}),T.jsx("symbol",{id:"i-b-instagram",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"currentColor",stroke:"none",d:"M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"})}),T.jsx("symbol",{id:"i-b-threads",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"currentColor",stroke:"none",d:"M18.263 11.097c-.03-3.486-1.92-5.586-5.111-5.586-2.13 0-3.922.963-4.863 2.499l2.062 1.438c.535-.843 1.272-1.543 2.628-1.543 1.528 0 2.318.85 2.544 2.431a15 15 0 0 0-2.236-.173c-4.125 0-6.068 1.867-6.068 4.336s1.943 3.99 4.804 3.99c3.139 0 5.013-2.115 5.781-4.735.798.361 1.348 1.204 1.348 2.47 0 3.387-3.907 5.232-7.22 5.232-4.885 0-8.077-3.207-8.077-8.424 0-6.392 4.223-10.487 9.9-10.487 3.808 0 5.69 1.671 6.97 3.914l2.108-1.475C21.44 2.078 18.331 0 13.663 0 6.227 0 1.168 5.277 1.168 12.934c0 7 4.953 11.066 10.856 11.066 4.878 0 9.809-2.846 9.809-7.716 0-2.545-1.46-4.231-3.569-5.187m-6.33 4.855c-1.077 0-2.026-.512-2.026-1.453 0-1.483 1.822-1.934 3.606-1.934.678 0 1.34.045 1.927.173-.422 1.927-1.671 3.215-3.508 3.214Z"})}),T.jsxs("symbol",{id:"i-at",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"12",cy:"12",r:"4"}),T.jsx("path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.9 7.9"})]}),T.jsxs("symbol",{id:"i-sheet",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),T.jsx("path",{d:"M3 9h18M3 15h18M9 3v18"})]}),T.jsxs("symbol",{id:"i-doc",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),T.jsx("path",{d:"M14 2v6h6M16 13H8M16 17H8M10 9H8"})]}),T.jsx("symbol",{id:"i-refresh",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M21 3v5h-5M3 21v-5h5M20.5 13A9 9 0 0 1 5.7 18.3L3 16M3.5 11A9 9 0 0 1 18.3 5.7L21 8"})}),T.jsx("symbol",{id:"i-ext",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3"})}),T.jsxs("symbol",{id:"i-board",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),T.jsx("path",{d:"M9 4v16M15 4v16"})]}),T.jsxs("symbol",{id:"i-search",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"11",cy:"11",r:"7"}),T.jsx("path",{d:"M20 20l-4-4"})]}),T.jsxs("symbol",{id:"i-side",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),T.jsx("path",{d:"M9 3v18"})]}),T.jsx("symbol",{id:"i-claude",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"#D97757",stroke:"none",d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})}),T.jsx("symbol",{id:"i-gemini",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"#8E75B2",stroke:"none",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"})}),T.jsx("symbol",{id:"i-codex",viewBox:"0 0 24 24",children:T.jsx("path",{fill:"currentColor",stroke:"none",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})}),T.jsx("symbol",{id:"i-arrow",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})}),T.jsxs("symbol",{id:"i-img",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),T.jsx("circle",{cx:"9",cy:"10",r:"2"}),T.jsx("path",{d:"m21 17-5-5-9 8"})]}),T.jsx("symbol",{id:"i-a-pick",viewBox:"0 0 24 24",children:T.jsx("path",{d:"m5 3 14 7-6 2-2 6z"})}),T.jsx("symbol",{id:"i-a-text",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M5 6V4h14v2M12 4v16M9 20h6"})}),T.jsxs("symbol",{id:"i-a-multi",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1.5"}),T.jsx("rect",{x:"11",y:"11",width:"10",height:"10",rx:"1.5"})]}),T.jsx("symbol",{id:"i-a-area",viewBox:"0 0 24 24",children:T.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2",strokeDasharray:"3 3"})}),T.jsx("symbol",{id:"i-a-pause",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M9 5v14M15 5v14"})}),T.jsxs("symbol",{id:"i-a-copy",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),T.jsx("path",{d:"M5 15V6a2 2 0 0 1 2-2h8"})]}),T.jsxs("symbol",{id:"i-eye",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),T.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),T.jsx("symbol",{id:"t-request",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),T.jsx("symbol",{id:"t-notes",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M12 17v5M9 3h6l-1 6 3 3H7l3-3z"})}),T.jsxs("symbol",{id:"t-explore",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"12",cy:"12",r:"9"}),T.jsx("path",{d:"m16 8-2.5 5.5L8 16l2.5-5.5L16 8z"})]}),T.jsxs("symbol",{id:"t-plan",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M9 5h11M9 12h11M9 19h11"}),T.jsx("path",{d:"M4 5l1 1 2-2M4 12l1 1 2-2M4 19h2"})]}),T.jsxs("symbol",{id:"t-backlog",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"4",width:"18",height:"5",rx:"1"}),T.jsx("path",{d:"M5 9v10h14V9M10 13h4"})]}),T.jsx("symbol",{id:"t-impl",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M16 18l6-6-6-6M8 6l-6 6 6 6"})}),T.jsxs("symbol",{id:"t-git",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"6",cy:"5",r:"2"}),T.jsx("circle",{cx:"6",cy:"19",r:"2"}),T.jsx("circle",{cx:"18",cy:"8",r:"2"}),T.jsx("path",{d:"M6 7v10M18 10c0 5-12 3-12 7"})]}),T.jsxs("symbol",{id:"t-review",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),T.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),T.jsxs("symbol",{id:"t-preview",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),T.jsx("circle",{cx:"9",cy:"10",r:"2"}),T.jsx("path",{d:"M21 16l-5-5-9 9"})]}),T.jsx("symbol",{id:"t-book",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 4h6a3 3 0 0 1 3 3v13a2 2 0 0 0-2-2H4zM20 4h-6a3 3 0 0 0-3 3v13a2 2 0 0 1 2-2h7z"})}),T.jsxs("symbol",{id:"i-phone",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:"3"}),T.jsx("path",{d:"M11 18h2"})]}),T.jsxs("symbol",{id:"i-sun",viewBox:"0 0 24 24",children:[T.jsx("circle",{cx:"12",cy:"12",r:"4"}),T.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),T.jsx("symbol",{id:"i-moon",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"})}),T.jsx("symbol",{id:"s-idea",viewBox:"0 0 16 16",children:T.jsx("circle",{cx:"8",cy:"8",r:"6",strokeDasharray:"2 2.5"})}),T.jsxs("symbol",{id:"s-start",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"8",cy:"8",r:"6",strokeDasharray:"2 2.5"}),T.jsx("path",{d:"M6.5 5.5v5l4-2.5z",fill:"currentColor",stroke:"none"})]}),T.jsxs("symbol",{id:"s-run",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"8",cy:"8",r:"6"}),T.jsx("path",{d:"M8 2a6 6 0 0 1 0 12z",fill:"currentColor",stroke:"none"})]}),T.jsxs("symbol",{id:"s-stall",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"8",cy:"8",r:"6"}),T.jsx("path",{d:"M8 2a6 6 0 0 1 0 12z",fill:"currentColor",stroke:"none",opacity:".35"})]}),T.jsxs("symbol",{id:"s-wait",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"8",cy:"8",r:"6"}),T.jsx("path",{d:"M8 5v3.5M8 11v.1"})]}),T.jsxs("symbol",{id:"s-done",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"currentColor",stroke:"none"}),T.jsx("path",{d:"M5.5 8l1.8 1.8L10.8 6",stroke:"var(--bg-2)"})]}),T.jsxs("symbol",{id:"s-aband",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"8",cy:"8",r:"6"}),T.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]}),T.jsx("symbol",{id:"c-claude",viewBox:"0 0 16 16",children:T.jsx("path",{d:"M8 2v12M2 8h12M3.8 3.8l8.4 8.4M12.2 3.8l-8.4 8.4"})}),T.jsxs("symbol",{id:"c-codex",viewBox:"0 0 16 16",children:[T.jsx("path",{d:"M8 2l5.2 3v6L8 14l-5.2-3V5z"}),T.jsx("circle",{cx:"8",cy:"8",r:"2"})]}),T.jsx("symbol",{id:"c-agy",viewBox:"0 0 16 16",children:T.jsx("path",{d:"M8 13V4M4.5 7.5L8 4l3.5 3.5M4 13h8"})}),T.jsx("symbol",{id:"c-opencode",viewBox:"0 0 16 16",children:T.jsx("path",{d:"M3 4l4 4-4 4M8.5 12H13"})}),T.jsx("symbol",{id:"c-gemini",viewBox:"0 0 16 16",children:T.jsx("path",{d:"M8 2c0 4 2 6 6 6-4 0-6 2-6 6 0-4-2-6-6-6 4 0 6-2 6-6z"})}),T.jsx("symbol",{id:"c-cursor",viewBox:"0 0 16 16",children:T.jsx("path",{d:"M4 3l9 5-4 1-1 4z"})}),T.jsxs("symbol",{id:"c-full",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"5.5",cy:"8",r:"3"}),T.jsx("circle",{cx:"11",cy:"8",r:"3"})]}),T.jsx("symbol",{id:"c-lite",viewBox:"0 0 16 16",children:T.jsx("circle",{cx:"8",cy:"8",r:"3"})}),T.jsxs("symbol",{id:"c-git",viewBox:"0 0 16 16",children:[T.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.5"}),T.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.5"}),T.jsx("circle",{cx:"11.5",cy:"5.5",r:"1.5"}),T.jsx("path",{d:"M4.5 5v6M11.5 7c0 2.5-7 1.5-7 4"})]}),T.jsx("symbol",{id:"r-bulb",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z"})}),T.jsxs("symbol",{id:"r-tray",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M12 3v9M8.5 8.5 12 12l3.5-3.5"}),T.jsx("path",{d:"M3 14h5l1.5 2.5h5L16 14h5"}),T.jsx("path",{d:"M3 14v5a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-5l-2.5-6H15M9 8H5.5L3 14"})]}),T.jsx("symbol",{id:"r-filter",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M4 5h16l-6 8v6l-4-2v-4z"})}),T.jsx("symbol",{id:"r-plus",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M12 5v14M5 12h14"})}),T.jsxs("symbol",{id:"r-bug",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"8",y:"6",width:"8",height:"14",rx:"4"}),T.jsx("path",{d:"M12 20v-9M8 12H4M20 12h-4M9 7 7 4M15 7l2-3M8 17l-3 2M16 17l3 2"})]}),T.jsxs("symbol",{id:"r-kbd",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),T.jsx("path",{d:"M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10"})]}),T.jsxs("symbol",{id:"r-desk",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"4",width:"18",height:"12",rx:"2"}),T.jsx("path",{d:"M8 20h8M12 16v4"})]}),T.jsx("symbol",{id:"r-chat",viewBox:"0 0 24 24",children:T.jsx("path",{d:"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"})}),T.jsxs("symbol",{id:"r-runs",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M9 6h11M9 12h11M9 18h11"}),T.jsx("circle",{cx:"4.5",cy:"6",r:"1.2"}),T.jsx("circle",{cx:"4.5",cy:"12",r:"1.2"}),T.jsx("circle",{cx:"4.5",cy:"18",r:"1.2"})]}),T.jsxs("symbol",{id:"r-term",viewBox:"0 0 24 24",children:[T.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),T.jsx("path",{d:"m7 9 3 3-3 3M13 15h4"})]})]})})}var wg=h(I(),1);var zK=(e)=>{try{return localStorage.getItem(e)==="1"}catch{return!1}},Bn=de()(()=>({res:null,disk:null,history:[],ports:null,portsError:"",confirmPort:0,open:!1,memOpen:zK("kz-res-mem"),diskOpen:zK("kz-res-disk"),confirm:"",failed:""})),xa=Bn.setState;function AM(e){let t=e==="mem"?"memOpen":"diskOpen",n=!Bn.getState()[t];try{localStorage.setItem("kz-res-"+e,n?"1":"0")}catch{}Bn.setState({[t]:n})}var IK=(e)=>Bn.setState(e?{open:e}:{open:e,confirm:"",confirmPort:0,failed:""});async function Nk(){try{let e=await(await fetch("/resources")).json(),t=Bn.getState().history;xa({res:e,history:[...t,e.system.used/e.system.total*100].slice(-60)})}catch{}}async function Rk(e=!1){try{xa({disk:await(await fetch("/resources/storage"+(e?"?refresh=1":""))).json()})}catch{}}async function LK(e){xa({confirm:""});let t=await fetch("/pty/kill",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:e})}).catch(()=>null);xa({failed:t?.ok?"":"Could not kill that terminal."}),await Nk()}var BK=()=>void O.open.homeStart({agent:"claude",prompt:"/disk-cleanup"});function HK(e){if(xa({open:!1,confirm:"",failed:""}),!O.open.term({dir:e.dir,ws:e.ws,key:e.key}))location.href=`/?view=ws&dir=${encodeURIComponent(e.dir??"")}&ws=${encodeURIComponent(e.ws)}`}async function Tk(){try{let e=await fetch("/ports");xa(e.ok?{ports:await e.json(),portsError:""}:{portsError:"The board is older than this list: restart it to see ports."})}catch{xa({portsError:"The board did not answer."})}}async function jK(e){xa({confirmPort:0});try{let t=await fetch("/port/stop",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({port:e})});if(!t.ok)_(`Could not stop localhost:${e}: ${(await t.json()).error??"unknown error"}`)}catch{_(`Could not stop localhost:${e}: the board did not answer`)}await Tk()}var ms=(e)=>{if(e<1048576)return`${Math.round(e/1024)} KB`;if(e<1073741824)return`${Math.round(e/1048576)} MB`;return`${(e/1073741824).toFixed(1)} GB`},UK=(e)=>Math.round(e.system.used/e.system.total*100);var GK=(e)=>(e/100*94.25).toFixed(1),FK=(e)=>[["Kaizen and its terminals",e.kaizen],["Other apps",Math.max(0,e.system.used-e.kaizen)],["Free",Math.max(0,e.system.total-e.system.used)]],VK=(e)=>{let t=e.slice(0,4).map((o)=>[o.name,o.bytes]),n=e.slice(4).reduce((o,r)=>o+r.bytes,0);return n?[...t,["Other",n]]:t},KK=(e,t)=>Math.round(t/(e.reduce((n,o)=>n+o[1],0)||1)*100),qK=(e)=>[...e].sort((t,n)=>(n.rss??0)-(t.rss??0));function $K(e){if(e.length<2)return null;let t=(r)=>r/(e.length-1)*100,n=(r)=>36-r*0.34,o=e.map((r,a)=>`${t(a).toFixed(1)},${n(r).toFixed(1)}`).join(" ");return{line:o,area:`0,36 ${o} 100,36`}}var YK=(e)=>`${e.project||"Home"} / ${e.ws.split(/[\\/]/).pop()||"main"}`,WK=(e,t=56)=>{let n=e.trim().replace(/\s+/g," ").replace(/^(\S*[\\/])?([^\\/\s]+)/,"$2");return n.length>t?n.slice(0,t-1)+"…":n};var G=h(w(),1),Ek=["bg-primary","bg-foreground/45","bg-foreground/30","bg-foreground/20","bg-foreground/10"],Ak="min-w-0 flex-1 rounded-md border border-border/70 bg-foreground/4 px-3 py-2.5 text-left",QK="block text-xs tabular-nums text-muted-foreground",ZK=({open:e})=>G.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:C("size-3.5 fill-none stroke-muted-foreground stroke-2 transition-transform duration-200",e&&"rotate-180"),children:G.jsx("path",{d:"M6 9l6 6 6-6"})});function JK({parts:e,rows:t=!0,hide:n}){return G.jsxs(G.Fragment,{children:[G.jsx("div",{className:C("my-2 mb-1 flex h-1.5 gap-0.5 overflow-hidden rounded-xs",n&&"hidden"),children:e.map(([o,r],a)=>G.jsx("i",{className:C("min-w-0.5",Ek[a]??Ek[4]),style:{flex:`${r} 0 2px`},title:`${o}: ${ms(r)}`},o))}),t&&e.map(([o,r],a)=>G.jsxs("div",{className:"flex min-h-5 items-center gap-2",children:[G.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[G.jsx("u",{className:C("mr-2 inline-block size-2 rounded-[2px]",Ek[a]??Ek[4])}),o]}),G.jsxs("em",{className:"text-muted-foreground tabular-nums not-italic",children:[KK(e,r),"%"]}),G.jsx("b",{className:"font-medium tabular-nums",children:ms(r)})]},o))]})}function Vce(){let e=$K(Bn((t)=>t.history));return e?G.jsxs("svg",{className:"mb-1.5 block h-10 w-full",viewBox:"0 0 100 36",preserveAspectRatio:"none",role:"img","aria-label":"Memory use over recent minutes",children:[G.jsx("polygon",{points:e.area,className:"fill-primary/12 stroke-none"}),G.jsx("polyline",{points:e.line,vectorEffect:"non-scaling-stroke",className:"fill-none stroke-primary stroke-2"})]}):null}function Kce({slim:e}){let t=Bn((r)=>r.res),n=Bn((r)=>r.memOpen),o=UK(t);return G.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>AM("mem"),className:C(Ak,"hover:bg-foreground/7",e&&"grid grid-cols-[auto_1fr_auto] items-center gap-3 py-2"),children:[G.jsxs("span",{className:C("mb-1.5 flex items-center justify-between gap-1.5 text-sm font-semibold text-strong",e&&"mb-0"),children:["Memory",G.jsx(ZK,{open:n})]}),G.jsxs("svg",{className:C("mx-auto mt-0.5 mb-1 block size-[72px]",e&&"m-0 size-9"),viewBox:"0 0 36 36",role:"img","aria-label":`${o}% of memory used`,children:[G.jsx("circle",{cx:"18",cy:"18",r:"15",className:"fill-none stroke-border stroke-[3.5]"}),G.jsx("circle",{cx:"18",cy:"18",r:"15",className:"fill-none stroke-primary stroke-[3.5] transition-[stroke-dasharray] duration-500 ease-out",strokeLinecap:"round",strokeDasharray:`${GK(o)} 94.25`,transform:"rotate(-90 18 18)"}),G.jsxs("text",{x:"18",y:"20.6",textAnchor:"middle",className:"fill-strong stroke-none text-[7.5px] font-semibold tabular-nums",children:[o,"%"]})]}),G.jsxs("span",{className:C(QK,"text-center",e&&"text-right"),children:[ms(t.system.used)," of ",ms(t.system.total)]}),n&&G.jsxs("span",{className:"col-span-full mt-2.5 block border-t border-border pt-2.5",children:[G.jsx(Vce,{}),G.jsx(JK,{parts:FK(t)})]})]})}var XK=({label:e,title:t,spin:n,onClick:o,children:r})=>G.jsx("button",{type:"button",title:t,"aria-label":e,onClick:o,className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-strong",children:G.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:C("size-4 fill-none stroke-current stroke-[1.8]",n&&"motion-safe:animate-spin"),strokeLinecap:"round",strokeLinejoin:"round",children:r})});function qce({slim:e}){let t=Bn((o)=>o.disk),n=Bn((o)=>o.diskOpen);return G.jsxs("div",{className:C(Ak,e&&"grid grid-cols-[auto_1fr_auto] items-center gap-3 py-2"),children:[G.jsxs("div",{className:C("mb-1.5 flex items-center justify-between gap-1.5 text-sm font-semibold text-strong",e&&"mb-0"),children:[G.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>AM("disk"),className:"inline-flex cursor-pointer items-center gap-1 rounded-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:["Storage",G.jsx(ZK,{open:n})]}),G.jsxs("span",{className:"inline-flex gap-0.5",children:[G.jsxs(XK,{label:"Clean up",title:"Clean up: a Claude Code in Home runs /disk-cleanup",onClick:BK,children:[G.jsx("path",{d:"M14 3l-4 9"}),G.jsx("path",{d:"M6.5 12h8l1.5 8.5a.5.5 0 0 1-.5.5H5.5a.5.5 0 0 1-.5-.5z"}),G.jsx("path",{d:"M8 21l.5-4M11.5 21v-4M15 21l-.5-4"})]}),G.jsxs(XK,{label:"Rescan",title:t?.scanning?"Scanning…":"Rescan",spin:t?.scanning,onClick:()=>void Rk(!0),children:[G.jsx("path",{d:"M20 12a8 8 0 1 1-2.3-5.7"}),G.jsx("path",{d:"M20 4v5h-5"})]})]})]}),t?.at?G.jsxs(G.Fragment,{children:[G.jsx("div",{className:"text-[22px] font-semibold tracking-tight text-strong tabular-nums",children:ms(t.total)}),G.jsx("span",{className:C(QK,e&&"text-right"),children:"used by kaizen"}),G.jsx(JK,{parts:VK(t.rows),rows:!1,hide:e}),n&&G.jsxs("div",{className:"col-span-full mt-2.5 block border-t border-border pt-2.5",children:[t.rows.slice(0,6).map((o)=>G.jsxs("div",{className:"flex min-h-5 items-center gap-2",children:[G.jsx("span",{className:"min-w-0 flex-1 truncate",title:o.name,children:o.name}),G.jsx("b",{className:"font-medium tabular-nums",children:ms(o.bytes)})]},o.name)),t.rows.length>6&&G.jsxs("div",{className:"flex min-h-5 items-center gap-2",children:[G.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[t.rows.length-6," more"]}),G.jsx("b",{className:"font-medium tabular-nums",children:ms(t.rows.slice(6).reduce((o,r)=>o+r.bytes,0))})]})]})]}):G.jsxs(G.Fragment,{children:[G.jsx(Jr,{className:"my-2 h-2.5 w-[70%]"}),G.jsx(Jr,{className:"my-2 h-2.5 w-[45%]"})]})]})}var $ce=["claude","codex","gemini"];function Yce({t:e}){let t=Bn((o)=>o.confirm===e.key),n="h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted";return G.jsxs("div",{className:"group grid grid-cols-[24px_minmax(0,1fr)_auto_auto] items-center gap-2.5 border-t border-border/70 py-[7px] first:border-t-0",children:[G.jsx("span",{className:"grid size-6 place-items-center rounded-md border border-border bg-card",children:G.jsx("svg",{"aria-hidden":"true",className:"size-3.5",children:G.jsx("use",{href:`#i-${$ce.includes(e.agent??"")?e.agent:"term"}`})})}),G.jsxs("span",{className:"min-w-0",children:[G.jsx("b",{className:"block truncate font-medium text-strong",title:e.title,children:e.title}),G.jsx("small",{className:"block truncate text-xs text-muted-foreground",children:YK(e)})]}),G.jsx("span",{className:"tabular-nums",children:e.rss==null?"–":ms(e.rss)}),G.jsx("span",{className:"flex gap-1",children:t?G.jsxs(G.Fragment,{children:[G.jsx("button",{type:"button",className:"h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted",onClick:()=>xa({confirm:""}),children:"Keep"}),G.jsx("button",{type:"button",className:C("h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted","border-danger/40 text-danger"),onClick:()=>void LK(e.key),children:"Kill"})]}):G.jsxs(G.Fragment,{children:[e.dir&&G.jsx("button",{type:"button",className:"h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted",onClick:()=>HK(e),children:"Open"}),G.jsx("button",{type:"button",className:C("h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted","[@media(hover:hover)]:opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"),"aria-label":`Kill ${e.title}`,onClick:()=>xa({confirm:e.key,failed:""}),children:"Kill"})]})})]})}function Wce(){let e=Bn((o)=>o.res),t=Bn((o)=>o.failed),n=qK(e.terminals);return G.jsxs("div",{className:C(Ak,"col-span-full"),children:[G.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-1.5 text-sm font-semibold text-strong",children:[G.jsx("span",{children:"Terminals"}),G.jsx("small",{className:"text-xs font-normal text-muted-foreground tabular-nums",children:n.length?`${n.length} running`:""})]}),t&&G.jsx("div",{className:"text-xs text-muted-foreground",role:"alert",children:t}),n.length?G.jsx("div",{className:"-mr-1.5 max-h-[226px] overflow-y-auto overscroll-contain pr-1.5",children:n.map((o)=>G.jsx(Yce,{t:o},o.key))}):G.jsx("div",{className:"text-xs text-muted-foreground",children:"No terminals. Start one with + in a workspace."})]})}function Xce({p:e}){let t=Bn((o)=>o.confirmPort===e.port),n="h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted";return G.jsxs("div",{className:"group grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 border-t border-border/70 py-[7px] first:border-t-0",children:[G.jsxs("b",{className:"min-w-12 font-mono text-sm font-medium text-strong tabular-nums",children:[":",e.port]}),G.jsxs("span",{className:"min-w-0",children:[G.jsx("b",{className:"block truncate font-medium text-strong",title:e.cmd,children:WK(e.cmd)||e.name||"process"}),G.jsx("small",{className:"block truncate text-xs text-muted-foreground",title:e.cwd,children:e.project})]}),G.jsx("span",{className:"flex gap-1",children:t?G.jsxs(G.Fragment,{children:[G.jsx("button",{type:"button",className:"h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted",onClick:()=>xa({confirmPort:0}),children:"Keep"}),G.jsx("button",{type:"button",className:C("h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted","border-danger/40 text-danger"),onClick:()=>void jK(e.port),children:"Stop"})]}):G.jsxs(G.Fragment,{children:[G.jsx("button",{type:"button",className:"h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted",onClick:()=>window.open(`http://localhost:${e.port}`,"_blank","noopener"),children:"Open"}),G.jsx("button",{type:"button",className:C("h-[26px] rounded-sm border border-border bg-card px-2 text-xs text-foreground hover:bg-muted","[@media(hover:hover)]:opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"),"aria-label":`Stop localhost:${e.port}`,onClick:()=>xa({confirmPort:e.port}),children:"Stop"})]})})]})}function Qce(){let e=Bn((n)=>n.ports),t=Bn((n)=>n.portsError);if(!e?.length&&!t)return null;return G.jsxs("div",{className:C(Ak,"col-span-full"),children:[G.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-1.5 text-sm font-semibold text-strong",children:[G.jsx("span",{children:"Ports"}),G.jsx("small",{className:"text-xs font-normal text-muted-foreground tabular-nums",children:e?.length?`${e.length} listening`:""})]}),e?.length?G.jsx("div",{className:"-mr-1.5 max-h-[170px] overflow-y-auto overscroll-contain pr-1.5",children:e.map((n)=>G.jsx(Xce,{p:n},`${n.port}:${n.pid}`))}):G.jsx("div",{className:"text-xs text-muted-foreground",children:t})]})}function eq(){let e=Bn((c)=>c.open),t=Bn((c)=>c.res),n=Bn((c)=>c.memOpen),o=Bn((c)=>c.diskOpen);wg.useEffect(()=>{if(Nk(),e)Rk(),Tk();let c=setInterval(()=>{if(Nk(),e)Tk();let d=Bn.getState().disk;if(e&&(d?.scanning||!d?.at))Rk()},e?3000:15000);return()=>clearInterval(c)},[e]);let r=n||o,a=wg.useRef(null),[i,s]=wg.useState({x:0,y:6});return G.jsxs(rr,{open:e,onOpenChange:(c)=>{let d=a.current?.getBoundingClientRect(),u=a.current?.closest("footer")?.getBoundingClientRect();if(c&&d)s({x:innerWidth-12-d.right,y:6+(u?d.top-u.top:0)});IK(c)},children:[G.jsx(ar,{asChild:!0,children:G.jsxs("button",{ref:a,type:"button",className:"fb",id:"res",title:t?`Kaizen uses ${ms(t.kaizen)} of memory`:"Resources","aria-haspopup":"dialog",children:[G.jsx("svg",{children:G.jsx("use",{href:"#i-mem"})}),G.jsx("span",{children:t?ms(t.kaizen):""})]})}),G.jsx(ir,{side:"top",align:"end",sideOffset:i.y,alignOffset:-i.x,collisionPadding:12,"aria-label":"Resources",className:"grid max-h-(--radix-popover-content-available-height) w-[360px] grid-cols-2 content-start gap-2 overflow-auto rounded-lg bg-card/94 p-2.5 text-sm whitespace-normal backdrop-blur-xl",children:t?G.jsxs(G.Fragment,{children:[G.jsx("div",{className:C("flex min-w-0",r&&"col-span-2"),children:G.jsx(Kce,{slim:r&&!n})}),G.jsx("div",{className:C("flex min-w-0",r&&"col-span-2"),children:G.jsx(qce,{slim:r&&!o})}),G.jsx(Wce,{}),G.jsx(Qce,{})]}):null})]})}var Bo=h(w(),1),tq="flex items-center gap-1.5 rounded-sm px-[7px] py-[3px] text-muted-foreground hover:bg-muted hover:text-foreground";function nq(){let e=Ru((r)=>r.usage),t=Ru((r)=>r.phone),n=Ru((r)=>r.refreshing),o=hz();return Bo.jsxs(Bo.Fragment,{children:[Bo.jsx("span",{className:"flex min-w-0 items-center gap-3.5",children:e&&Bo.jsx(wk,{list:e,hover:!0,side:"top"})}),e&&e.length>0&&Bo.jsx("button",{type:"button",className:tq,title:"Refresh usage","aria-label":"Refresh usage","aria-busy":n,disabled:n,onClick:()=>void y0(!0),children:Bo.jsx(L,{name:"refresh",className:C("size-[15px]",n&&"motion-safe:animate-spin")})}),Bo.jsx("span",{className:"flex-1"}),Bo.jsx("span",{className:"kz-keep contents",children:Bo.jsx(eq,{})}),o>0&&Bo.jsxs("a",{href:"/?view=terminal",className:tq,title:o7(o),onClick:(r)=>{if(r.ctrlKey||r.metaKey||r.shiftKey||r.button)return;r.preventDefault(),O.go("terminal",!0)},children:[Bo.jsx(L,{name:"term",className:"size-[15px]"}),Bo.jsx("span",{children:o})]}),t&&Bo.jsxs("span",{className:"flex items-center gap-1.5",title:t.tip,children:[Bo.jsx(L,{name:"phone",className:"size-[15px]"}),Bo.jsx("span",{className:"max-[640px]:hidden",children:t.text}),Bo.jsx("span",{className:C("size-[7px] rounded-full",t.on?"bg-success shadow-[0_0_6px_var(--ok)]":"bg-muted-foreground")})]})]})}var nl=h(I(),1);var oq=(e)=>e?e.split(/[\\/]/).filter(Boolean).at(-2)||"Project":"Project",rq=(e)=>8+10*Math.min(e.split("/").length-1,4),aq=(e)=>[...e].sort((t,n)=>t.name.localeCompare(n.name)),MM=(e,t)=>"/notebook?dir="+encodeURIComponent(e)+"&note="+encodeURIComponent(t),iq=(e)=>(e.dir?"▸ ":" ")+e.name,DM=(e,t)=>e?e+"/"+t.name:t.name,sq=(e)=>e.split("/").slice(0,-1).join("/"),lq=(e,t)=>"/project-tree?dir="+encodeURIComponent(e)+"&path="+encodeURIComponent(t),Mk=(e,t,n=!1)=>"/project-text?dir="+encodeURIComponent(e)+"&path="+encodeURIComponent(t)+(n?"&download=1":""),cq=(e)=>(e.pty?.alive?"● ":"○ ")+(e.id||String(e.text).split(`
107
+ `)[0]);var Dk=de()(()=>({open:!1,tab:"files",folder:"",dir:"",sessions:[],body:{kind:"message",text:""}})),{setState:tl,getState:ed}=Dk,OM={openSession:()=>{}},uq=(e)=>Object.assign(OM,e),_M=(e)=>tl(e),Nv=0,PM=(e)=>tl({body:{kind:"message",text:e}}),Zce=async(e)=>{let t=await fetch(e,{headers:O.dirHeader()}),n=await t.json();if(!t.ok)throw Error(n.error||n.message||"Could not load this project");return n};async function zM(e,t,n){let o=++Nv;PM(e);try{let r=await Zce(t);if(o===Nv)n(r)}catch(r){if(o===Nv)PM(String(r))}}function Jce(){let{dir:e}=ed();zM("Loading notes…","/vault?dir="+encodeURIComponent(e),(t)=>tl({body:t.notes.length?{kind:"notes",dir:t.dir,notes:aq(t.notes)}:{kind:"message",text:"No notes in this project yet."}}))}function Rv(e=ed().folder){tl({folder:e});let{dir:t}=ed();if(!t)return++Nv,PM("Pick a project to see its files.");zM("Loading files…",lq(t,e),(n)=>tl({body:{kind:"files",folder:e,entries:n.entries}}))}function dq(e){zM("Loading file…",Mk(ed().dir,e),(t)=>tl({body:{kind:"file",path:e,content:t.content}}))}function eue(){++Nv,tl({body:{kind:"terminals"}})}function Tv(e){if(tl({tab:e}),e==="notes")Jce();else if(e==="files")Rv();else eue()}var pq=()=>Rv(sq(ed().folder));var fq={el:null},kg=(e)=>{if(tl({open:e}),e)Tv(ed().tab)};function mq(e){if(tl({dir:e,folder:""}),ed().open)Tv(ed().tab)}var IM=()=>oe().dir||oe().state.dir||"",gq=()=>oe().state.cards.filter((e)=>e.pty&&!e.archived);function hq(){uq({openSession:(t)=>{Pe({wantTerm:Ne(t)}),Xi(t)}}),_M({dir:IM(),sessions:gq()});let e=IM();zr(()=>{_M({sessions:gq()});let t=IM();if(t!==e)e=t,mq(t)})}var Lt=h(w(),1),tue=[["files","Files"],["notes","Notes"],["terminal","Terminal"]],Ev="(min-width:1701px)",nue=()=>{let[e,t]=nl.useState(()=>matchMedia(Ev).matches);return nl.useEffect(()=>{let n=matchMedia(Ev),o=()=>t(n.matches);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[]),e};function bq(){let{open:e,tab:t,dir:n,body:o,sessions:r}=Dk(),a=nue(),i=nl.useRef(null),s=e&&!a,l=()=>{kg(!1),requestAnimationFrame(()=>fq.el?.focus())};return nl.useEffect(()=>{if(!a)kg(!1)},[a]),nl.useEffect(()=>{let c=()=>!matchMedia(Ev).matches&&kg(!1);return ut.subscribe((d,u)=>d.view!==u.view&&c())},[]),nl.useEffect(()=>{if(s)requestAnimationFrame(()=>i.current?.querySelector("nav button.on")?.focus())},[s]),nl.useEffect(()=>{if(!s)return;let c=[document.querySelector(".rail"),...document.querySelector(".app")?.children??[]].filter((u)=>!!u&&!u.contains(i.current));c.forEach((u)=>u.inert=!0);let d=(u)=>{let p=i.current;if(!p)return;if(u.key==="Escape")u.preventDefault(),u.stopPropagation(),l();else if(u.key==="Tab"){let f=[...p.querySelectorAll("button,a[href]")].filter((y)=>!y.hasAttribute("disabled")&&y.getClientRects().length),g=f[0],m=f.at(-1);if(!g||!m)return;if(!p.contains(document.activeElement)||u.shiftKey&&document.activeElement===g||!u.shiftKey&&document.activeElement===m)u.preventDefault(),(u.shiftKey?m:g).focus()}};return addEventListener("keydown",d,!0),()=>{c.forEach((u)=>u.inert=!1),removeEventListener("keydown",d,!0)}},[s]),Lt.jsx(Lt.Fragment,{children:Lt.jsxs("section",{id:"context",ref:i,"aria-label":"Project context","aria-modal":s||void 0,role:a?"complementary":"dialog",className:C("kz-keep",e&&"on"),children:[Lt.jsxs("header",{children:[Lt.jsx("strong",{id:"context-title",children:oq(n)}),Lt.jsx("button",{type:"button",className:"ib",id:"ctx-close","aria-label":"Close side panel",title:"Close",onClick:l,children:Lt.jsx("svg",{children:Lt.jsx("use",{href:"#i-close"})})})]}),Lt.jsx("nav",{"aria-label":"Side content",children:tue.map(([c,d])=>Lt.jsx("button",{type:"button",className:t===c?"on":"","aria-pressed":t===c,onClick:()=>Tv(c),children:d},c))}),Lt.jsxs("div",{id:"context-body",children:[o.kind==="message"&&o.text,o.kind==="notes"&&o.notes.map((c)=>Lt.jsx("a",{className:"tree-row",style:{paddingLeft:rq(c.name)},href:MM(o.dir,c.name),children:c.name},c.name)),o.kind==="files"&&Lt.jsxs(Lt.Fragment,{children:[o.folder&&Lt.jsx("button",{type:"button",className:"tree-row tree-back",onClick:pq,children:"← "+o.folder}),!o.entries.length&&"This folder is empty.",o.entries.map((c)=>Lt.jsx("button",{type:"button",className:C("tree-row",c.dir&&"folder"),onClick:()=>c.dir?Rv(DM(o.folder,c)):dq(DM(o.folder,c)),children:iq(c)},c.name))]}),o.kind==="file"&&Lt.jsxs(Lt.Fragment,{children:[Lt.jsxs("div",{className:"ctx-actions",children:[Lt.jsx("button",{type:"button",className:"btn",onClick:()=>Rv(),children:"← Files"}),Lt.jsx("a",{className:"btn",href:Mk(n,o.path,!0),children:"Download"})]}),Lt.jsx("strong",{children:o.path}),Lt.jsx("pre",{children:o.content})]}),o.kind==="terminals"&&Lt.jsxs(Lt.Fragment,{children:[Lt.jsx("button",{type:"button",className:"btn",onClick:()=>{if(!matchMedia(Ev).matches)kg(!1);Tv("files"),O.go("terminal",!0)},children:"Open terminal workspace"}),!r.length&&Lt.jsx("p",{children:"No terminal sessions yet."}),r.map((c,d)=>Lt.jsx("button",{type:"button",className:"tree-row",onClick:()=>{if(!matchMedia(Ev).matches)kg(!1);OM.openSession(c)},children:cq(c)},d))]})]})]})})}var Vt=h(I(),1);var se=h(w(),1),oue=typeof navigator<"u"&&/Mac/.test(navigator.platform)?"⌘":"Ctrl",Vp={autoComplete:"off",spellCheck:!1};function Ok({title:e,hint:t,err:n,go:o,busy:r,back:a,onSubmit:i,keys:s,children:l}){return se.jsxs("form",{className:"flex flex-col gap-2.5",onSubmit:(c)=>(c.preventDefault(),i()),onKeyDown:(c)=>{if(s&&c.key==="Enter"&&(c.ctrlKey||c.metaKey))c.preventDefault(),c.currentTarget.requestSubmit()},children:[se.jsx(ga,{className:"text-base font-semibold",children:e}),t&&se.jsx("p",{className:"text-sm text-muted-foreground",children:t}),l,n&&se.jsx("p",{role:"alert",className:"rounded-xs border border-[color-mix(in_srgb,var(--danger)_30%,transparent)] bg-[color-mix(in_srgb,var(--danger)_10%,transparent)] px-3 py-2 text-sm text-danger",children:n}),se.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[s&&se.jsxs("kbd",{"aria-hidden":!0,className:"mr-auto font-mono text-xs text-muted-foreground",children:[oue," ↵"]}),a&&se.jsx(M,{variant:"ghost",onClick:a,children:"Back to add options"}),se.jsx(M,{variant:"ghost",onClick:gm,children:"Cancel"}),se.jsx(M,{variant:"primary",type:"submit",disabled:!!r,children:r||o})]})]})}var LM=(e,t)=>{gm(),_(t),O.pickProject(e)};async function BM(e,t){let n=await Pl("/pick-folder",{});if(n.d.path)e(t?f6(n.d.path,t()):n.d.path)}var HM=({children:e,onPick:t})=>se.jsxs("div",{className:"flex items-center gap-1.5",children:[e,se.jsx(M,{variant:"ghost",onClick:t,children:"Pick…"})]});function Pk({title:e,sub:t,to:n,go:o}){return se.jsxs(M,{className:"h-auto flex-col items-start gap-0.5 whitespace-normal px-3 py-2 text-left",onClick:()=>o(n),children:[se.jsx("b",{className:"font-semibold",children:e}),se.jsx("small",{className:"text-sm font-normal text-muted-foreground",children:t})]})}function rue({back:e}){let[t,n]=Vt.useState(""),[o,r]=Vt.useState(""),[a,i]=Vt.useState(!1);return se.jsx(Ok,{title:"Existing folder",hint:"Pick a folder, or type its path. A .kaizen folder is added to it.",err:o,go:"Add project",busy:a?"Adding...":"",back:e,onSubmit:async()=>{if(!t.trim())return;i(!0);let s=await Pl("/add-project",{path:t.trim()});i(!1),s.ok?LM(s.d.dir,s.d.already?"Project already added":"Project added"):r(s.d.error)},children:se.jsx(HM,{onPick:()=>void BM(n),children:se.jsx(Ue,{...Vp,autoFocus:!0,value:t,onChange:(s)=>n(s.target.value),placeholder:"/path/to/folder","aria-label":"Folder",required:!0})})})}function aue({back:e}){let[t,n]=Vt.useState(""),[o,r]=Vt.useState(""),[a,i]=Vt.useState(""),[s,l]=Vt.useState(!1),c=Vt.useRef(""),d=Vt.useRef(""),u=Vt.useRef(""),p=async(f=t,g=o)=>{if(!f.trim())return!1;u.current=f;let m=await Pl("/clone",{url:f.trim(),check:!0});if(!m.ok)return i(m.d.error),!1;if(i(""),d.current=m.d.name,!g.trim()||g===c.current)c.current=m.d.to,r(m.d.to);return!0};return se.jsxs(Ok,{title:"Clone from URL",hint:"Enter the Git URL (https or ssh) and choose where to clone it.",err:a,go:"Clone",busy:s?"Cloning...":"",back:e,onSubmit:async()=>{if(!await p())return;l(!0);let f=await Pl("/clone",{url:t.trim(),to:o.trim()||void 0});l(!1),f.ok?LM(f.d.dir,"Cloned"):i(f.d.error)},children:[se.jsx(Ue,{...Vp,autoFocus:!0,value:t,onChange:(f)=>n(f.target.value),onBlur:()=>t!==u.current&&void p(),placeholder:"https://github.com/user/repo.git","aria-label":"Git URL",required:!0}),se.jsx(HM,{onPick:async()=>await p()?BM(r,()=>d.current):void 0,children:se.jsx(Ue,{...Vp,value:o,onChange:(f)=>r(f.target.value),placeholder:"Folder to clone into","aria-label":"Clone into"})})]})}function iue({back:e}){let[t,n]=Vt.useState(""),[o,r]=Vt.useState(""),[a,i]=Vt.useState(!0),[s,l]=Vt.useState(""),[c,d]=Vt.useState(!1),u=Vt.useRef(""),p=Vt.useRef(""),f=Vt.useRef(null),g=async(m)=>{n(m),p.current=m.trim();let y=p.current;if(!m6(y)||o.trim()&&o!==u.current)return;let b=await Pl("/new-project",{name:y,check:!0});if(b.ok&&p.current===y)u.current=b.d.to,r(b.d.to)};return se.jsxs(Ok,{title:"Create a new project",hint:"Name it and kaizen will create the folder with a .kaizen inside.",err:s,go:"Create project",busy:c?"Creating...":"",back:e,onSubmit:async()=>{if(!t.trim())return f.current?.focus();d(!0);let m=await Pl("/new-project",{name:t.trim(),to:o.trim()||void 0,git:a});if(d(!1),!m.ok)return l(m.d.error);LM(m.d.dir,m.d.git===!1?"Project created, but git init failed":"Project created")},children:[se.jsx(Ue,{...Vp,ref:f,autoFocus:!0,value:t,onChange:(m)=>void g(m.target.value),placeholder:"my-project","aria-label":"Name",required:!0}),se.jsx(HM,{onPick:()=>void BM(r,()=>t.trim()),children:se.jsx(Ue,{...Vp,value:o,onChange:(m)=>r(m.target.value),placeholder:"Folder to create","aria-label":"Create in"})}),se.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[se.jsx(Hr,{checked:a,onCheckedChange:(m)=>i(m===!0)})," Git repository"]})]})}function sue({dir:e,back:t}){let n=O.gitProjects(),[o,r]=Vt.useState(n.some((b)=>b.dir===e)?e:n[0]?.dir??""),[a,i]=Vt.useState({def:"",list:[]}),[s,l]=Vt.useState(tb),[c,d]=Vt.useState(""),[u,p]=Vt.useState(""),[f,g]=Vt.useState(""),[m,y]=Vt.useState(!1);return Vt.useEffect(()=>{let b=!0;return Pl("/branches?dir="+encodeURIComponent(o)).then((x)=>{if(!b)return;let{def:v="",branches:k=[]}=x.ok?x.d:{};i({def:v,list:k}),l(k.length?v||k[0]:tb)}),()=>{b=!1}},[o]),se.jsxs(Ok,{title:"New workspace",err:f,go:"Create workspace",busy:m?"Creating...":"",back:t,keys:!0,onSubmit:async()=>{if(m)return;g(""),y(!0);let b=await Pl("/worktree",{dir:o,branch:g6(u,c),base:s===tb?void 0:s});if(y(!1),!b.ok)return g(b.d.error);gm(),O.navigate(O.wsHref(o,b.d.path))},children:[se.jsx(Se,{label:"Project",children:(b)=>se.jsxs(Pt,{value:o,onValueChange:r,children:[se.jsx(_t,{...b,"aria-label":"Project",className:"min-w-0 flex-1",children:se.jsx(Ot,{})}),se.jsx(zt,{children:n.map((x)=>se.jsx(dt,{value:x.dir,children:x.name},x.dir))})]})}),se.jsxs("div",{className:"flex items-center justify-between gap-2",children:[se.jsxs("span",{id:"wsfl",className:"text-sm text-muted-foreground",children:["Create from ",se.jsx("i",{className:"opacity-70 not-italic",children:"[Optional]"})]}),se.jsxs("label",{className:"flex min-w-0 items-center gap-1 text-sm text-muted-foreground",children:["from",se.jsxs(Pt,{value:s,onValueChange:l,children:[se.jsx(_t,{size:"sm","aria-label":"Start from branch",className:"max-w-[200px]",children:se.jsx(Ot,{})}),se.jsx(zt,{children:a.list.length?a.list.map((b)=>se.jsx(dt,{value:b,children:b},b)):se.jsx(dt,{value:tb,children:"current branch"})})]})]})]}),se.jsx(Ue,{...Vp,autoFocus:!0,value:c,onChange:(b)=>d(b.target.value),placeholder:"What is this workspace for?","aria-labelledby":"wsfl"}),se.jsxs("details",{className:"group",children:[se.jsx("summary",{className:"cursor-pointer py-0.5 text-sm text-muted-foreground group-open:mb-2",children:"Advanced"}),se.jsx(Se,{label:"Branch name",children:(b)=>se.jsx(Ue,{...b,...Vp,value:u,onChange:(x)=>p(x.target.value),placeholder:eb(c)||"feature/my-branch"})})]})]})}function lue({go:e}){let t=O.gitProjects().length>0;return se.jsxs("div",{className:"flex flex-col gap-2.5",children:[se.jsx(ga,{className:"text-base font-semibold",children:"Add a project"}),se.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a project to get started with kaizen."}),se.jsx(Pk,{title:"Existing folder",sub:"A project, a Git repo, or any folder",to:"folder",go:e}),se.jsx("p",{className:"text-sm text-muted-foreground",children:"Other ways to add"}),se.jsx(Pk,{title:"Clone from URL",sub:"Clone a remote Git repository",to:"clone",go:e}),se.jsx(Pk,{title:"Create new project",sub:"Start from an empty folder",to:"create",go:e}),t&&se.jsx(Pk,{title:"New workspace",sub:"A branch in its own folder, in a project you have",to:"ws",go:e}),se.jsx("div",{className:"flex justify-end",children:se.jsx(M,{variant:"ghost",onClick:gm,children:"Cancel"})})]})}function cue({dir:e,start:t}){let[n,o]=Vt.useState(t??"menu"),r=t==="ws"?void 0:()=>o("menu");return se.jsxs(Fa,{"aria-describedby":void 0,"aria-label":"Add a project",className:C(n==="ws"&&"w-[min(576px,calc(100vw-32px))] max-h-[85dvh] overflow-y-auto"),children:[n==="menu"&&se.jsx(lue,{go:o}),n==="folder"&&se.jsx(rue,{back:r}),n==="clone"&&se.jsx(aue,{back:r}),n==="create"&&se.jsx(iue,{back:r}),n==="ws"&&se.jsx(sue,{dir:e,back:r})]})}function vq(){let e=ew((t)=>t.open);return se.jsx(Ga,{open:!!e,onOpenChange:(t)=>!t&&gm(),children:e&&se.jsx(cue,{dir:e.dir,start:e.start},e.n)})}var yq=h(I(),1);var Hn=h(w(),1),uue=({value:e,label:t})=>e===aw?Hn.jsx(L,{name:"board",className:"size-4 text-muted-foreground"}):oR(e)?Hn.jsx(L,{name:"plus",className:"size-4 text-muted-foreground"}):Hn.jsx(zn,{dir:e,label:t});function xq(){let{rows:e,dir:t}=nR(),n=e.map((o)=>({value:o.value,label:o.value===aw||oR(o.value)?o.label:o.label.split(/[\\/]/).pop()||o.label,group:o.fresh?"In your projects folder":void 0,icon:Hn.jsx(uue,{value:o.value,label:o.label}),search:o.label}));return Hn.jsx(Ni,{label:"project",value:t||aw,options:n,onChange:(o)=>void O.pickProject(o),className:"border-transparent bg-transparent hover:border-border max-w-[260px]"})}function wq(){let{showable:e,shown:t}=nR(),[n,o]=yq.useState(!1);return Hn.jsxs(rr,{open:n,onOpenChange:o,children:[Hn.jsx(ar,{asChild:!0,children:Hn.jsxs("button",{type:"button","aria-label":"Projects shown",className:"inline-flex h-(--btn-s) max-w-full items-center gap-2 whitespace-nowrap rounded-sm border border-transparent bg-transparent px-2.5 text-base hover:border-border",children:[xz(t,e),Hn.jsx(L,{name:"chev",className:"size-3 shrink-0 text-muted-foreground"})]})}),Hn.jsx(ir,{align:"start",className:"w-[320px] p-1.5",children:Hn.jsxs(tg,{children:[Hn.jsx(ng,{placeholder:"Search projects…","aria-label":"Search projects"}),Hn.jsxs(og,{className:"max-h-80",children:[Hn.jsx(x1,{children:"No match"}),e.map((r)=>{let a=t.includes(r.dir);return Hn.jsxs(rg,{value:r.dir,keywords:[r.label],title:r.label,role:"menuitemcheckbox","aria-checked":a,onSelect:()=>yz(r.dir),className:"gap-2.5 px-2.5",children:[Hn.jsx(zn,{dir:r.dir,label:r.label,size:18}),Hn.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.label.split(/[\\/]/).pop()||r.label}),Hn.jsx(L,{name:"check",className:C("size-3.5 text-primary",!a&&"invisible")})]},r.dir)})]}),Hn.jsxs("div",{className:"mt-1.5 flex items-center justify-between border-t border-border px-1 pt-1.5 text-sm text-muted-foreground",children:[Hn.jsx("span",{children:wz(t,e)}),Hn.jsx(M,{variant:"ghost",size:"sm",onClick:iw,children:"Show all"})]})]})})]})}var Kp=h(w(),1);function kq(){let e=sw((t)=>t.at);return Kp.jsxs(En,{open:!!e,onOpenChange:(t)=>!t&&Sz(),children:[Kp.jsx(An,{asChild:!0,children:Kp.jsx("span",{"aria-hidden":!0,className:"pointer-events-none fixed size-0",style:{left:e?.x??0,top:e?.y??0}})}),Kp.jsx(Mn,{align:"start",sideOffset:0,className:"min-w-[170px]",children:e?.items.map((t)=>Kp.jsx(nn,{onSelect:t.run,children:t.label},t.label))})]})}var Nq=h(I(),1);var bc=h(w(),1),due={"":"text-muted-foreground",link:"border-primary/40 text-primary",warn:"text-foreground",proj:"max-w-full truncate border-transparent bg-muted text-foreground"},pue={"":"",accent:"text-primary",ok:"text-success",warn:"text-warning",run:"text-running",bad:"font-semibold text-danger",ask:"text-warning motion-safe:animate-pulse"};function Sq({chips:e,marks:t}){return bc.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[bc.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap gap-1",children:e.map((n,o)=>bc.jsxs("span",{title:n.title,className:C("inline-flex min-h-5 items-center gap-1.5 rounded-full border border-border px-2 py-px text-xs font-medium [overflow-wrap:anywhere]",due[n.cls??""]),children:[n.dot&&bc.jsx("i",{className:C("size-1.5 rounded-full bg-muted-foreground not-italic",n.cls==="warn"&&"bg-warning")}),n.text]},o))}),bc.jsx("span",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",children:t.map((n,o)=>bc.jsx("span",{role:"img",title:n.title,"aria-label":n.title,className:C("grid place-items-center text-xs font-medium",pue[n.cls]),children:n.icon?bc.jsx(L,{name:n.icon,sprite:n.sprite??"i",className:"size-[13px] stroke-[1.7]"}):n.text},o))})]})}var ol=h(w(),1);function Cq({k:e,kids:t}){let n=Nt((i)=>i.kidsOpen.includes(e)),o=t.filter((i)=>i.status==="done").length,r=t.some((i)=>i.status==="waiting"),a=()=>{let i=Ir().kidsOpen;ht({kidsOpen:i.includes(e)?i.filter((s)=>s!==e):[...i,e]})};return ol.jsxs("div",{className:"mt-1.5 border-t border-[color-mix(in_srgb,var(--line)_70%,transparent)] pt-1.5",children:[ol.jsxs("button",{type:"button","aria-expanded":n,onClick:(i)=>(i.stopPropagation(),a()),className:"flex w-full cursor-pointer items-center gap-1.5 text-sm text-muted-foreground",children:[n?"▾":"▸"," ",t.length," ",t.length===1?"child":"children",o?` · ${o} done`:"",r&&ol.jsx("span",{title:"A child is waiting on you",className:"ml-auto size-[7px] rounded-full bg-warning"})]}),n&&ol.jsx("ul",{className:"mt-1 flex flex-col gap-px",children:t.map((i,s)=>{let l=(c)=>(c.stopPropagation(),O.openCard(t[s]));return ol.jsxs("li",{tabIndex:0,role:"button",title:"Open",onClick:l,onKeyDown:(c)=>(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l(c)),className:"grid cursor-pointer grid-cols-[16px_auto_1fr] items-start gap-2 rounded-sm px-1 py-[3px] text-sm hover:bg-muted",children:[ol.jsx(jp,{name:Ux(i)}),ol.jsx("span",{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:C_(i.status)}),ol.jsx("span",{className:"leading-[1.35] [overflow-wrap:anywhere]",title:i.title||i.text||i.id,children:i.kind==="idea"?Bs(i.text??"").head:(i.text||i.id||"").replace(/-/g," ")})]},s)})})]})}var Xn=h(w(),1);function Rq({card:e,pick:t,picked:n,onPick:o}){let r=Nt((v)=>v.snap),[a,i]=Nq.useState(!1),s=Tn(e),l=Nt((v)=>v.names[s]),c=r.answered.includes(s+":"+e.awaiting+":"+e.moved),d=v_(r.allCards,e),{chips:u,marks:p}=w_(e,r.all),f=e.column===4&&!r.archive,g=e.workers||[],m=k_(e,{archive:r.archive,answered:c,otherProjects:r.projects.some((v)=>v.dir!==e.state)}),y=(v)=>{if(v==="open")return Pb(e);if(v==="archive"||v==="restore")return void bw(e,v==="archive");if(v==="toidea")return void vw(e);vm({mode:v,key:s})},b=e.kind==="run"&&!r.archive&&!t?e.status==="waiting"?Xn.jsx(M,{variant:c?"default":"primary",size:"sm",className:"min-h-6 self-start px-2.5 text-xs",onClick:(v)=>(v.stopPropagation(),Pb(e)),children:LN(e,c)}):e.status==="stalled"&&lI(e)?Xn.jsx(M,{size:"sm",className:"min-h-6 self-start px-2.5 text-xs",disabled:a,onClick:async(v)=>{v.stopPropagation(),i(!0),await km(e),i(!1)},children:"Resume"}):null:null;return Xn.jsxs("div",{role:"button",tabIndex:0,"data-k":s,style:l?{viewTransitionName:l}:void 0,onClick:()=>t?o():Pb(e),onKeyDown:t?void 0:(v)=>{if(v.target===v.currentTarget&&(v.key==="Enter"||v.key===" "))v.preventDefault(),Pb(e)},className:C("card group relative flex cursor-pointer flex-col gap-1.5 rounded-sm border border-border bg-card px-3.5 py-3 shadow-sm transition-[border-color,box-shadow] hover:border-[color-mix(in_srgb,var(--dim)_45%,var(--line))] hover:shadow-md",s===r.openKey&&"border-primary shadow-[0_0_0_3px_color-mix(in_srgb,var(--accent)_22%,transparent)] hover:border-primary",r.flash.includes(s)&&"motion-safe:animate-flash",n&&"border-primary",f&&"flex-row items-center gap-2 px-3 py-[7px]"),children:[t&&Xn.jsx("input",{type:"checkbox","aria-label":"Select",checked:n,readOnly:!0,className:"pointer-events-none absolute right-3.5 top-3.5 m-0 accent-primary"}),Xn.jsxs("div",{className:C("flex min-h-[18px] items-center gap-2 text-xs text-muted-foreground",f&&"contents"),children:[Xn.jsx(jp,{name:Ux(e),title:S_(e)}),Xn.jsx("span",{title:e.kind==="run"&&e.title?e.title:void 0,className:C("min-w-0 flex-1 truncate tabular-nums",f&&"order-1 text-foreground",e.archived&&"opacity-70"),children:N_(e)}),!t&&Xn.jsxs(Xn.Fragment,{children:[Xn.jsx("span",{className:C("tabular-nums group-hover:hidden group-has-[[data-state=open]]:hidden",f&&"order-2"),children:e.kind==="run"?co(e.moved||r.now,r.now):""}),Xn.jsx(z1,{label:"Actions",size:"sm",triggerClassName:C("-my-1 -mr-1.5 hidden group-focus-within:grid group-hover:grid data-[state=open]:grid max-[900px]:grid [@media(hover:none)]:grid",f&&"order-3"),className:"w-auto min-w-40 text-base",items:m.map((v)=>({...v,onSelect:()=>y(v.id)}))})]})]}),!f&&Xn.jsxs(Xn.Fragment,{children:[e.signal==="blocked"?Xn.jsx("div",{className:"order-2 text-xs text-warning [overflow-wrap:anywhere]",children:e.blocked?.question??""}):e.phase&&e.status==="running"?Xn.jsx("div",{className:"order-2 text-xs text-muted-foreground [overflow-wrap:anywhere]",children:e.phase}):null,Xn.jsx("div",{title:e.kind==="idea"&&Bs(e.text??"").parts.length?e.text:void 0,className:C("line-clamp-2 text-[13px] font-medium leading-[1.45] text-foreground",e.archived&&"opacity-70"),children:e.kind==="idea"?Bs(e.text??"").head:e.title||e.id}),g.length>0&&Xn.jsxs("div",{className:"order-2 text-xs text-muted-foreground [overflow-wrap:anywhere]",children:[g.map((v)=>`${v.id} ${v.status}${v.bypass?" · bypass":""}`).join(" · "),e.workersMerge?` · merge ${e.workersMerge}`:""]}),b,(u.length>0||p.length>0)&&Xn.jsx(Sq,{chips:u,marks:p}),d.length>0&&Xn.jsx(Cq,{k:s,kids:d})]})]})}var qp=h(I(),1);var Bt=h(w(),1),jM="text-base font-medium",fue="text-sm font-normal text-muted-foreground",mue="min-h-18 rounded-sm border border-border bg-card px-3 py-2 hover:border-muted-foreground focus-visible:border-primary";function _k({card:e,mode:t,inline:n,onDone:o}){let r=Tn(e),a=qp.useRef(null),i=qp.useRef(null),s=qp.useRef(null),[l,c]=qp.useState([]),[d,u]=Kd(`f:${t}:${r}:0`,e.text??""),[p,f]=Kd(`f:${t}:${r}:1`,e.notes??""),[g,m]=Kd(`f:${t}:${r}:0`,""),y=O.projects().filter((S)=>S.dir!==e.state),[b,x]=qp.useState(y[0]?.dir??""),v=e.kind!=="run",k=Bt.jsx(M,{variant:"ghost",onClick:o,children:t==="edit"||t==="move"?"Cancel":"Keep it"});if(t==="edit"){let S=async()=>{if(await q8(e,a.current.value.trim(),i.current.value.trim(),l))o()};return Bt.jsxs(jr,{inline:n,label:"Edit task",children:[Bt.jsx(Ue,{ref:a,"aria-label":"Task",defaultValue:d,autoFocus:!0,onInput:(N)=>u(N.currentTarget.value),onPaste:(N)=>c([...l,..._l(N)]),onKeyDown:(N)=>{if(N.key==="Enter")N.preventDefault(),S();if(N.key==="Escape")N.stopPropagation(),o()}}),Bt.jsx(xn,{ref:i,"aria-label":"Notes",className:mue,placeholder:"Anything the planner should know",defaultValue:p,onInput:(N)=>f(N.currentTarget.value),onPaste:(N)=>c([...l,..._l(N)])}),l.length>0&&Bt.jsx("div",{className:"text-sm text-muted-foreground",children:l.map((N)=>N.name).join(" · ")}),Bt.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[Bt.jsx(Vu,{className:"mr-auto",onFiles:(N)=>c([...l,...N])}),Bt.jsx(sc,{field:a,also:[i]}),k,Bt.jsx(M,{variant:"primary",onClick:()=>void S(),children:"Save"})]})]})}if(t==="reject"){let S=()=>{let N=s.current.value.trim();if(!N)return void _("A reason is required");o(),$8(e,N)};return Bt.jsxs(jr,{inline:n,label:v?"Reject":"Abandon",children:[Bt.jsxs("div",{className:jM,children:[e.kind==="backlog"?"Not doing this backlog item?":v?"Reject this task?":"Abandon this run?"," ","The reason is recorded."]}),Bt.jsx(Ue,{ref:s,"aria-label":"Reason",placeholder:"Why not?",defaultValue:g,autoFocus:!0,onInput:(N)=>m(N.currentTarget.value),onKeyDown:(N)=>{if(N.key==="Enter")N.preventDefault(),S();if(N.key==="Escape")N.stopPropagation(),o()}}),Bt.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[Bt.jsx(sc,{field:s}),k,Bt.jsx(M,{className:"border-warning text-warning",onClick:S,children:v?"Reject":"Abandon"})]})]})}if(t==="delete")return Bt.jsxs(jr,{inline:n,label:"Delete task",children:[Bt.jsxs("div",{className:jM,children:['Delete "',e.text,'"?']}),Bt.jsx("div",{className:fue,children:"Not recorded anywhere."}),Bt.jsxs("div",{className:"flex justify-end gap-1.5",children:[k,Bt.jsx(M,{variant:"danger",onClick:()=>{o(),Y8(e)},children:"Delete"})]})]});return Bt.jsxs(jr,{inline:n,label:"Move task",children:[Bt.jsxs("div",{className:jM,children:['Move "',e.text,'" to']}),Bt.jsxs(Pt,{value:b,onValueChange:x,children:[Bt.jsx(_t,{"aria-label":"Project",children:Bt.jsx(Ot,{})}),Bt.jsx(zt,{children:y.map((S)=>Bt.jsx(dt,{value:S.dir,title:S.label,children:Ar(S.label)},S.dir))})]}),Bt.jsxs("div",{className:"flex justify-end gap-1.5",children:[k,Bt.jsx(M,{variant:"primary",onClick:()=>{let S=y.find((N)=>N.dir===b);if(o(),S)W8(e,b,Ar(S.label))},children:"Move"})]})]})}var rl=h(w(),1);function Tq({counts:e,onClear:t,onPick:n}){let o=(r,a,i)=>rl.jsxs(nn,{onSelect:()=>t(i),className:"text-foreground",children:[r," ",rl.jsx("i",{className:"ml-auto text-xs not-italic text-muted-foreground",children:a})]});return rl.jsxs(En,{children:[rl.jsx(An,{asChild:!0,children:rl.jsx(M,{variant:"ghost",size:"sm",className:"ml-auto min-h-[22px] px-2",title:"Archive finished runs",children:"Clear ▾"})}),rl.jsxs(Mn,{className:"min-w-[200px]",children:[o("Older than a week",e[0],7),o("Older than 3 days",e[1],3),o("Everything",e[2],0),rl.jsx(Zr,{}),rl.jsx(nn,{onSelect:n,className:"text-foreground",children:"Pick which…"})]})]})}var vc=h(I(),1);var ln=h(w(),1),zk="__normal";function Ik({card:e,inline:t,onDone:n,onStart:o}){let[r,a]=vc.useState(void 0),[i,s]=vc.useState(""),[l,c]=vc.useState(zk),[d,u]=vc.useState(!1),[p,f]=vc.useState(!1),[g,m]=vc.useState(!1),y=r?.agents.find((v)=>v.cmd===i),b=(v)=>{s(v.cmd),c(v.defaultAccount??zk)};vc.useEffect(()=>{V8(e.state).then((v)=>{if(a(v),!v)return;b(v.agents.find((k)=>k.cmd===v.default)??v.agents[0]),f(v.explore===!0)})},[e.state]);let x=(v)=>{let k={kind:v,agent:r?i:void 0,account:y?.accounts?.length?l===zk?"":l:void 0,yolo:!!(d&&y?.yolo),explore:r&&g?p:void 0};if(n(),o)o(k);else K8(e,v,k)};return ln.jsxs(jr,{inline:t,label:"Run",children:[ln.jsxs("div",{className:"text-base font-medium",children:['Run "',e.text,'"']}),ln.jsx("div",{className:"text-sm text-muted-foreground",children:"Opens your agent with this request in a terminal."}),ln.jsx("div",{className:"text-sm text-muted-foreground",children:"Full plans, builds, and checks with a separate reviewer. Lite does it in one session."}),r&&ln.jsxs(ln.Fragment,{children:[ln.jsx("div",{role:"radiogroup","aria-label":"Agent",className:"flex flex-wrap gap-1.5",children:r.agents.map((v)=>ln.jsxs("button",{type:"button",role:"radio","aria-checked":v.cmd===i,onClick:()=>b(v),className:C("inline-flex h-(--btn-s) items-center gap-1.5 rounded-sm border border-border bg-card px-2.5 text-base hover:border-muted-foreground",v.cmd===i&&"border-primary bg-primary/10 text-foreground"),children:[ln.jsx(L,{sprite:"c",name:v.cmd,className:"size-4"}),v.name]},v.cmd))}),y?.accounts?.length?ln.jsxs(Pt,{value:l,onValueChange:c,children:[ln.jsx(_t,{"aria-label":"Account",children:ln.jsx(Ot,{})}),ln.jsxs(zt,{children:[ln.jsx(dt,{value:zk,children:"Normal login"}),y.accounts.map((v)=>ln.jsx(dt,{value:v.id,children:v.name},v.id))]})]}):null,ln.jsxs("label",{className:"flex items-center gap-2 text-base",children:[ln.jsx(Hr,{checked:p,onCheckedChange:(v)=>(f(v===!0),m(!0)),"aria-label":"Explore first"}),"Explore first"]})]}),ln.jsxs("div",{className:"grid gap-2",children:[y?.yolo&&ln.jsxs("label",{className:"flex items-center gap-2 text-base",title:"Yolo: the agent runs every command and edit without asking",children:[ln.jsx(sr,{checked:d,onCheckedChange:u,"aria-label":"Yolo"}),"Yolo"]}),ln.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[ln.jsx(M,{variant:"ghost",onClick:n,children:"Cancel"}),ln.jsx(M,{onClick:()=>x("lite"),children:"Lite"}),ln.jsx(M,{variant:"primary",className:"col-span-2",onClick:()=>x("full"),children:"Full run"})]})]})]})}var Di=h(w(),1);function Eq({value:e,items:t,onChange:n}){let o=Hx.find((r)=>r[0]===e);return Di.jsxs(En,{children:[Di.jsx(An,{asChild:!0,children:Di.jsx(me,{icon:"filter",label:o?"Severity: "+o[1]:"Filter by severity","aria-label":"Filter by severity",className:`ml-auto size-(--btn-xs) [&_svg]:size-4 ${e?"bg-primary/12 text-primary":""}`})}),Di.jsx(Mn,{className:"min-w-[180px]",children:Di.jsxs(EU,{value:e??"",onValueChange:(r)=>n(r||null),children:[Di.jsxs(tA,{value:"",children:["All severities ",Di.jsx("i",{className:"ml-auto text-xs not-italic text-muted-foreground",children:t.length})]}),Di.jsx(Zr,{}),Hx.map(([r,a,i])=>Di.jsxs(tA,{value:r,children:[a," ",Di.jsx("i",{className:"ml-auto text-xs not-italic text-muted-foreground",children:t.filter((s)=>i(s.severity)).length})]},r))]})})]})}var yc=h(I(),1);var kn=h(w(),1),Aq=null;function Lk({inline:e,picking:t,preset:n,choose:o,text:r,onDone:a}){let i=Q8(),s=yc.useRef(null),l=yc.useRef(null),[c,d]=Kd("f:new:0"),[u,p]=Kd("f:new:1"),[f,g]=yc.useState([]),[m,y]=yc.useState(()=>m_(i.map((S)=>S.dir),n??Aq,o)),[b,x]=yc.useState(!1);yc.useEffect(()=>{if(r)d(r)},[]);let v=(S)=>{let N=s.current.value.trim();if(!N)return;if(t&&!m)return _("Choose a project for this task"),x(!0);a(),X8(N,l.current.value.trim(),t?m:null,f,S)},k=(S)=>g((N)=>[...N,..._l(S)]);return kn.jsxs(jr,{inline:e,label:"New task",children:[kn.jsxs("div",{className:"flex items-center justify-between gap-2",children:[kn.jsx("h2",{className:"text-lg font-semibold",children:"New task"}),t&&kn.jsx(Ni,{label:"Project for this task",placeholder:"Choose project",value:m??"",open:b,onOpenChange:x,options:i.map((S)=>({value:S.dir,label:Ar(S.label),search:S.label,icon:kn.jsx(zn,{dir:S.dir,label:S.label})})),onChange:(S)=>{Aq=S,y(S),s.current?.focus()}})]}),kn.jsx(Ue,{ref:s,id:"newidea","aria-label":"Task",placeholder:"What do you want to build?",defaultValue:r??c,autoFocus:!0,onInput:(S)=>d(S.currentTarget.value),onPaste:k,onKeyDown:(S)=>{if(S.key==="Enter"&&!S.nativeEvent.isComposing)S.preventDefault(),v(!1);if(S.key==="Escape")S.preventDefault(),a()}}),kn.jsxs(tc,{htmlFor:"newnotes",className:"mt-0.5 font-normal",children:["Anything the planner should know ",kn.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),kn.jsx(xn,{ref:l,id:"newnotes",className:"h-21 min-h-21 rounded-sm border border-border bg-card px-3 py-2 hover:border-muted-foreground focus-visible:border-primary",placeholder:"Context, constraints, examples, and what a good result looks like",defaultValue:u,onInput:(S)=>p(S.currentTarget.value),onPaste:k}),f.length>0&&kn.jsx("div",{className:"text-sm text-muted-foreground",children:f.map((S)=>S.name).join(" · ")}),kn.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[kn.jsx(Vu,{className:"mr-auto",onFiles:(S)=>g((N)=>[...N,...S])}),kn.jsx(sc,{field:s,also:[l]}),kn.jsx(M,{variant:"ghost",onClick:a,children:"Cancel"}),kn.jsxs("div",{className:"inline-flex",children:[kn.jsx(M,{variant:"primary",className:"rounded-r-none",onClick:()=>v(!1),children:"Add"}),kn.jsxs(En,{children:[kn.jsx(An,{asChild:!0,children:kn.jsx(M,{variant:"primary",className:"rounded-l-none border-l-[color-mix(in_srgb,var(--on-accent)_30%,transparent)] px-2","aria-label":"More ways to add",children:kn.jsx(L,{name:"chev",className:"size-3"})})}),kn.jsx(Mn,{children:kn.jsxs(nn,{title:"Add the task and run it now",onSelect:()=>v(!0),children:[kn.jsx(L,{name:"play",className:"size-[15px]"}),"Start run"]})})]})]})]})]})}var lt=h(w(),1);function Dq({ci:e}){let t=Nt((R)=>R.snap),{tab:n,sev:o,order:r,picking:a,picked:i,unfolded:s,form:l}=Nt(),c=e===0&&!t.archive,d=c&&n==="backlog",u=(R)=>!t.only||t.only.includes(R.state),p=jx(t.backlogItems).filter(u),f=y_({cards:t.cards,backlog:p,ci:e,archive:t.archive,filter:t.filter,query:t.query,tab:n,sev:o,order:r,all:t.allCards}),g=e===4&&!t.archive&&f.length>0,m=(R)=>x_(f,t.now,R),y=s.includes(e)||f.length<=Bx+1?f:f.slice(0,Bx),b=(R)=>l&&l.key===Tn(R)&&l.mode!=="new",x=async(R)=>{let A=m(R);if(!A.length)return void _("Nothing that old");await iT(A)},v=async()=>{let R=f.filter((A)=>i.includes(Tn(A)));ht({picking:!1,picked:[]}),await iT(R)},k=(R)=>ht({picked:i.includes(R)?i.filter((A)=>A!==R):[...i,R]}),S=(R)=>ht({unfolded:R?[...s,e]:s.filter((A)=>A!==e)}),N=()=>ym();return lt.jsxs("section",{className:"pt-2","aria-labelledby":`col-${e}`,children:[lt.jsxs("h2",{id:`col-${e}`,className:"sticky top-0 z-[1] flex h-8 items-center gap-2 bg-background px-0.5 text-[13px] font-medium shadow-[0_-12px_0_var(--bg)]",children:[c?lt.jsx(jU,{value:n,onValueChange:(R)=>cR(R),children:lt.jsxs(UU,{"aria-label":"To do column",children:[lt.jsxs(rA,{value:"ideas",title:"To do","aria-label":"To do",children:[lt.jsx(L,{sprite:"s",name:"idea",className:"size-3.5 stroke-[1.7]"}),n==="ideas"&&lt.jsx("b",{className:"whitespace-nowrap font-[inherit]",children:"To do"})]}),lt.jsxs(rA,{value:"backlog",title:"Backlog: what finished runs left undone","aria-label":"Backlog: what finished runs left undone",children:[lt.jsx(L,{name:"clock",className:"size-3.5 stroke-[1.7]"}),n==="backlog"&&lt.jsx("b",{className:"whitespace-nowrap font-[inherit]",children:"Backlog"})]})]})}):lt.jsxs(lt.Fragment,{children:[t.colNames[e],lt.jsx("i",{className:"text-xs font-normal not-italic text-muted-foreground empty:hidden",children:f.length||""})]}),e<4&&!d&&f.length>1&&lt.jsx(M,{variant:"ghost",size:"sm",className:"min-h-[22px] px-2 font-medium",title:"Sort order",onClick:()=>Pz(e),children:r[e]==="old"?"Oldest":"Newest"}),d&&lt.jsx(Eq,{value:o,items:p,onChange:(R)=>ht({sev:R})}),c&&lt.jsx(me,{icon:"plus",label:"New task",className:`size-(--btn-xs) [&_svg]:size-4 ${d?"":"ml-auto"}`,onClick:()=>(cR("ideas"),vm({mode:"new"}))}),g&&a&&lt.jsxs("span",{className:"ml-auto flex gap-1",children:[lt.jsx(M,{variant:"ghost",size:"sm",className:"min-h-[22px] px-2",onClick:()=>ht({picking:!1,picked:[]}),children:"Cancel"}),lt.jsxs(M,{variant:"primary",size:"sm",className:"min-h-[22px] px-2",disabled:!i.length,onClick:()=>void v(),children:["Archive ",i.length||""]})]}),g&&!a&&lt.jsx(Tq,{counts:[m(7).length,m(3).length,f.length],onClear:(R)=>void x(R),onPick:()=>ht({picking:!0,picked:[]})})]}),lt.jsxs("ul",{className:"flex flex-col gap-1.5 pt-1",children:[e===0&&l?.mode==="new"&&lt.jsx("li",{children:lt.jsx(Lk,{inline:!0,picking:t.all||t.phone,preset:null,choose:!1,onDone:N})}),y.map((R)=>{let A=Tn(R);if(b(R))return lt.jsx("li",{children:l.mode==="run"?lt.jsx(Ik,{card:R,inline:!0,onDone:N}):lt.jsx(_k,{card:R,mode:l.mode,inline:!0,onDone:N})},A);return lt.jsx("li",{children:lt.jsx(Rq,{card:R,pick:a&&!t.archive&&R.column===4,picked:i.includes(A),onPick:()=>k(A)})},A)}),y.length<f.length&&lt.jsx("li",{children:lt.jsxs("button",{type:"button",className:"w-full rounded-full p-1.5 text-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>S(!0),children:["Show ",f.length-y.length," more"]})}),y.length>=f.length&&s.includes(e)&&f.length>Bx+1&&lt.jsx("li",{children:lt.jsx("button",{type:"button",className:"w-full rounded-full p-1.5 text-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>S(!1),children:"Show less"})}),!f.length&&e<=3&&!d&&t.cards.length>0&&!t.filter&&!t.query.trim()&&!t.archive&&!(e===0&&l?.mode==="new")&&lt.jsx("li",{className:Mq,children:b_[e]}),d&&!f.length&&!t.filter&&!t.query.trim()&&lt.jsx("li",{className:Mq,children:o?"Nothing at this severity":"What finished runs left undone shows here"})]})]})}var Mq="block rounded-sm border border-dashed border-border p-3.5 text-center text-sm text-muted-foreground";var Oq=h(w(),1);function Pq(){let e=Nt((n)=>n.mode);if(!ut((n)=>n.view==="board"))return null;return Oq.jsx(Ti,{label:"Board mode",value:e,onChange:Az,options:[{id:"ws",label:"Workspaces"},{id:"runs",label:"Runs"}]})}var td=h(w(),1);function _q(){let e=Nt((r)=>r.popup),t=Nt((r)=>r.snap);if(!e)return null;let n=()=>{Xr(!0),Dz()},o=e.kind==="new"?"New task":e.kind==="run"?"Run":e.mode==="edit"?"Edit task":"Task";return td.jsx(Ga,{open:!0,onOpenChange:(r)=>!r&&n(),children:td.jsxs(Fa,{"aria-describedby":void 0,className:C("max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-h-[85dvh] max-sm:w-screen max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none",e.kind==="new"&&"overflow-y-auto"),children:[td.jsx(ga,{className:"sr-only",children:o}),e.kind==="form"&&td.jsx(_k,{card:e.card,mode:e.mode,onDone:n}),e.kind==="run"&&td.jsx(Ik,{card:e.card,onStart:e.onStart,onDone:n}),e.kind==="new"&&td.jsx(Lk,{picking:!!t&&(t.all||e.choose||t.phone),preset:e.dir??null,text:e.text,choose:e.choose,onDone:n})]})})}var Ur=h(w(),1);function gue({icon:e}){if(!e)return null;return e==="run"?Ur.jsx("span",{className:"grid size-3 place-items-center","aria-hidden":"true",children:Ur.jsx("span",{className:"size-2 rounded-full bg-running motion-safe:animate-pulse"})}):Ur.jsx(L,{sprite:"s",name:e,className:"size-3 stroke-[1.8]"})}function zq({chips:e}){return Ur.jsx("span",{className:"flex flex-wrap items-center gap-2 text-sm",children:e.map((t)=>Ur.jsxs("button",{type:"button",title:t.title,"aria-pressed":t.on,onClick:()=>Ez(t.id),className:C("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-muted-foreground shadow-[inset_0_0_0_1px_var(--line)] transition-colors hover:bg-muted hover:text-foreground",t.attn&&"bg-warning/18 text-foreground shadow-[inset_0_0_0_1px_var(--warn)] hover:bg-warning/30 [&_svg]:text-warning",t.on&&"bg-muted text-foreground",t.on&&t.attn&&"bg-warning/30"),children:[Ur.jsx(gue,{icon:t.icon}),t.label]},t.id))})}function Iq(){let e=Nt((t)=>t.snap);return e&&e.mode!=="ws"?Ur.jsx(zq,{chips:gT(e)}):null}function Lq(){let e=Nt((n)=>n.snap);if(!e||e.mode==="ws")return null;let t=EB(e);return Ur.jsxs(rr,{children:[Ur.jsx(ar,{asChild:!0,children:Ur.jsx("button",{type:"button",id:"fbtn",className:C("ib kz-keep",t),"aria-label":"Filter by status",title:"Filter by status",children:Ur.jsx("svg",{children:Ur.jsx("use",{href:"#i-filter"})})})}),Ur.jsx(ir,{align:"end",className:"max-w-[calc(100vw-24px)] p-3",children:Ur.jsx(zq,{chips:gT(e)})})]})}var al=h(w(),1);function Bq({w:e}){return al.jsxs("a",{href:e.href,"data-dir":e.dir,"data-ws":e.path,onClick:(t)=>{if(t.ctrlKey||t.metaKey||t.shiftKey||t.button)return;if(O.open.ws({dir:e.dir,ws:e.path}))t.preventDefault()},className:"flex min-h-(--row-h) items-start gap-2 rounded-md border border-border bg-background px-2.5 py-2 text-foreground hover:bg-muted focus-visible:-outline-offset-2",children:[al.jsx("span",{className:`si mt-[3px] ${e.state}`}),al.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[al.jsxs("b",{className:"flex min-w-0 items-center gap-1.5 truncate text-base font-medium",children:[e.label,e.main&&al.jsx("i",{className:"rounded-xs border border-border px-1.5 text-xs font-normal not-italic text-muted-foreground",children:"primary"})]}),al.jsxs("small",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[al.jsx(zn,{dir:e.dir,label:e.project,size:14}),e.project]}),al.jsx("code",{className:"truncate font-[inherit] text-sm text-muted-foreground",children:e.line})]})]})}var Bk=h(I(),1);var Hq=h(w(),1);function Hk({id:e="bq",placeholder:t,className:n="sel"}){let o=Nt((l)=>l.query),r=Nt((l)=>l.mode==="ws"),a=ut((l)=>l.view==="board"),i=Bk.useRef(null);return Bk.useEffect(()=>Z8.add(i.current),[]),Hq.jsx("input",{ref:i,type:"search",className:n,id:e,placeholder:t??(a&&r?"Search workspaces (press /)":"Filter cards (press /)"),"aria-label":"Filter cards",spellCheck:!1,autoComplete:"off",value:o,onChange:(l)=>cb(l.target.value),onKeyDown:(l)=>{if(l.key!=="Escape")return;l.stopPropagation(),cb(""),l.currentTarget.blur()}})}var jk=h(I(),1);var Gr=h(w(),1),hue={running:"bg-running",asking:"bg-warning",ended:"bg-muted-foreground opacity-60"};function jq(){let{a:e,all:t,phone:n}=h0(),o=jk.useRef(null),r=n&&e.keys.length>0;if(jk.useEffect(()=>{o.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[e.one,r]),!e.hid.length&&!r)return null;let a=(i)=>{if(zb(t.get(i))==="ended")Jo.hide(i);else Lx().then((s)=>s&&K("/pty/exit",{key:i}).then(()=>op.reload()))};return Gr.jsxs("div",{className:C("flex flex-wrap items-center gap-1.5 text-xs",n?"border-b border-border px-3.5 pb-2":"px-4 py-2"),children:[e.hid.length>0&&Gr.jsxs(Gr.Fragment,{children:[Gr.jsx("span",{className:"text-muted-foreground",children:"Hidden"}),e.hid.map((i)=>Gr.jsxs(M,{size:"sm",variant:"ghost",className:"text-[11px]",title:"Show this terminal",onClick:()=>Jo.show(i),children:[Gr.jsx(L,{name:"plus",className:"size-3"}),Ib(t.get(i))]},i))]}),r&&Gr.jsx("div",{role:"group","aria-label":"Terminals",className:"order-first flex min-w-0 flex-[1_0_100%] gap-1.5 overflow-x-auto [scrollbar-width:none]",children:e.keys.map((i)=>{let s=t.get(i),l=i===e.one;return Gr.jsxs("div",{ref:l?o:void 0,className:C("inline-flex h-[30px] flex-none items-center gap-1.5 rounded-full border border-border pr-2 pl-2.5 text-xs whitespace-nowrap text-muted-foreground",l&&"border-primary bg-muted text-foreground"),children:[Gr.jsxs("button",{type:"button","aria-pressed":l,className:"inline-flex h-full items-center gap-1.5",onClick:()=>m0(i),children:[Gr.jsx("span",{className:C("size-2 shrink-0 rounded-full",hue[zb(s)])}),Gr.jsx("span",{children:Ib(s)})]}),Gr.jsx("button",{type:"button",title:"Close terminal","aria-label":"Close terminal",className:"grid size-5 place-items-center rounded-sm opacity-60 hover:bg-border hover:text-foreground hover:opacity-100",onClick:()=>a(i),children:Gr.jsx(L,{name:"x",className:"size-(--ico)"})})]},i)})})]})}var Sg=h(I(),1);var UM=h(I(),1);var wa=h(w(),1),bue={running:"bg-running",asking:"bg-warning",ended:"bg-muted-foreground opacity-60"},Av=(e)=>requestAnimationFrame(()=>document.querySelector(`[data-tile="${CSS.escape(e)}"] .xterm-helper-textarea`)?.focus({preventScroll:!0}));function Uq({k:e,c:t,index:n,off:o,max:r,phone:a,span:i,order:s,noPointer:l}){let c=zb(t),d=c==="ended",[u,p]=UM.useState(!1),[f,g]=UM.useState(!1),m=()=>void Lx().then((v)=>v&&K("/pty/exit",{key:e}).then(()=>op.reload())),y=r?"Restore":"Maximise",b=()=>(Jo.hide(e),Av(e)),x=(v)=>{p(!1);let k=v.dataTransfer.getData("text/kz-term");if(!k||k===e)return;v.preventDefault(),Jo.swap(s,k,e)};return wa.jsxs("section",{"data-tile":e,className:C("relative flex min-h-0 min-w-0 flex-col overflow-hidden bg-background pt-2","focus-within:after:pointer-events-none focus-within:after:absolute focus-within:after:inset-0 focus-within:after:z-3 focus-within:after:shadow-[inset_0_0_0_1px_var(--ring-soft)] focus-within:after:content-['']",a&&"flex-1",o&&"hidden",r&&"fixed inset-2 z-10 shadow-(--shadow-1)",c==="asking"&&"shadow-[inset_0_0_0_2px_var(--warn)] motion-safe:animate-ask",u&&"outline-2 -outline-offset-2 outline-(--ring-soft)",l&&"pointer-events-none"),style:i>1?{gridColumn:`span ${i}`}:void 0,onDragOver:(v)=>{if(!v.dataTransfer.types.includes("text/kz-term"))return;v.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:x,children:[wa.jsxs("header",{draggable:!0,title:`${t.kind==="run"?t.id:t.text} · ${t.where}${n<9?` · Alt+${n+1}`:""}`,className:C("flex min-h-[26px] cursor-default select-none active:cursor-grabbing items-center gap-2 pr-1 pl-2.5",a&&"hidden"),onDragStart:(v)=>{v.dataTransfer.setData("text/kz-term",e),v.dataTransfer.effectAllowed="move"},onDoubleClick:(v)=>{if(v.target.closest("button")||a)return;Jo.toggleMax(e),Av(e)},children:[wa.jsx("span",{role:"img",title:c,"aria-label":c,className:C("size-2 shrink-0 rounded-full",bue[c])}),wa.jsx("b",{className:"min-w-0 truncate text-[11px] font-normal text-muted-foreground",children:Ib(t)}),d&&wa.jsx("span",{className:"shrink-0 rounded-full px-1.5 text-[11px] text-muted-foreground ring-1 ring-border ring-inset",children:"ended"}),wa.jsx("span",{className:"flex-1"}),d&&t.kind==="run"&&wa.jsx(M,{size:"sm",title:"Continue this run's agent",disabled:f,onClick:()=>{g(!0),op.resume(t).then((v)=>!v&&g(!1))},children:"Resume"}),t.kind!=="shell"&&wa.jsx(me,{icon:"open",label:"Open card",size:"sm",onClick:()=>O.openCard(t)}),wa.jsx(me,{icon:r?"min":"max",label:`${y} (Ctrl+Shift+M)`,size:"sm",onClick:()=>(Jo.toggleMax(e),Av(e))}),!d&&wa.jsx(me,{icon:"dash",label:"Hide",size:"sm",onClick:b}),wa.jsx(me,{icon:"close",label:d?"Close":"Exit session",size:"sm",onClick:d?b:m})]}),wa.jsx(Qu,{sessionKey:e,label:"Agent terminal",onEnd:()=>op.reload(),className:C("[&_.xterm]:h-full [&_.xterm]:p-1 [&_.xterm-viewport]:bg-transparent!",d&&"opacity-60")})]})}var il=h(w(),1);function vue({axis:e,i:t,sizes:n,shape:o,grid:r,live:a}){let i=n[e],s=(l)=>{l.preventDefault(),l.currentTarget.setPointerCapture(l.pointerId);let c=r.current,d=(e==="c"?c.clientWidth:c.clientHeight)-(i.length-1)*MB,u=e==="c"?l.clientX:l.clientY,p=n;a(n);let f=(m)=>{p={...n,[e]:BB(i,t,(e==="c"?m.clientX:m.clientY)-u,d)},a(p)},g=()=>{removeEventListener("pointermove",f),removeEventListener("pointerup",g),removeEventListener("pointercancel",g),a(p,!0)};addEventListener("pointermove",f),addEventListener("pointerup",g),addEventListener("pointercancel",g)};return il.jsx("div",{role:"separator","aria-orientation":e==="c"?"vertical":"horizontal",title:"Drag to resize, double-click to even out",className:C("absolute z-[2] touch-none hover:bg-[color-mix(in_srgb,var(--accent)_35%,transparent)] active:bg-[color-mix(in_srgb,var(--accent)_35%,transparent)]",e==="c"?"top-0 -ml-[5px] w-2.5 cursor-col-resize":"inset-x-0 -mt-[5px] h-2.5 cursor-row-resize"),style:e==="c"?{left:p0(n.c,t),bottom:LB(n.r,t,o.spanFrom)}:{top:p0(n.r,t)},onPointerDown:s,onDoubleClick:()=>Jo.sizes(o.key,{...n,[e]:i.map(()=>1)})})}function Gq(){let{a:e,all:t,lay:n,phone:o}=h0(),r=Sg.useRef(null),[a,i]=Sg.useState(null),s=zB(e.keys.length,n.mode,!!e.one),l=a??IB(n.sizes[s.key],s),c=typeof document>"u"?null:document.activeElement;if(UB(e.keys,o,Av),Sg.useLayoutEffect(()=>{if(c instanceof HTMLElement&&c!==document.activeElement&&c.isConnected)c.focus({preventScroll:!0})}),!e.keys.length)return il.jsxs("div",{className:"flex flex-col items-center gap-3 py-[60px] text-center text-muted-foreground",children:[il.jsx("div",{className:"mascot"}),il.jsx("b",{className:"text-[16px] font-semibold text-foreground",children:e.hid.length?"Every terminal is hidden":"No terminals running"}),il.jsx("p",{className:"mb-1.5 max-w-[44ch]",children:"Runs with an agent open in kaizen show here, from Tasks to Done."})]});let d=(u,p)=>{if(p&&u)Jo.sizes(s.key,u);i(p?null:u)};return il.jsxs("div",{ref:r,className:C("relative min-h-0 flex-1 gap-px bg-border",o?"flex flex-col":"grid",a&&"select-none"),style:o?void 0:{gridTemplateColumns:l.c.map((u)=>u+"fr").join(" "),gridTemplateRows:l.r.map((u)=>u+"fr").join(" ")},children:[e.keys.map((u,p)=>il.jsx(Uq,{k:u,c:t.get(u),index:p,off:!!e.one&&e.one!==u,max:!o&&e.max===u,phone:o,span:!e.one&&p===e.keys.length-1?s.span:1,order:e.order,noPointer:!!a},u)),!e.one&&["c","r"].flatMap((u)=>l[u].slice(0,-1).map((p,f)=>il.jsx(vue,{axis:u,i:f,sizes:l,shape:s,grid:r,live:d},u+f)))]})}var Cg=h(w(),1);function Fq(){let e=ho((t)=>t.lay.mode);return Cg.jsx(Cg.Fragment,{children:hT.map(([t,n,o])=>Cg.jsx(ag,{pressed:e===t,onPressedChange:()=>Jo.mode(t),title:n,"aria-label":n,className:"grid size-6 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground data-[state=on]:bg-muted data-[state=on]:text-foreground",children:Cg.jsx(L,{name:o,className:"size-(--ico)"})},t))})}var Rt=h(w(),1),Mv=({id:e})=>Rt.jsx("svg",{children:Rt.jsx("use",{href:`#${e}`})});function yue(){let e=ut((n)=>n.title),t=ut((n)=>n.mark);return Rt.jsx("h1",{children:t?Rt.jsx(Ck,{label:"kaizen"}):e})}function Vq(){let e=ut((a)=>a.menu),t=e?"Hide navigation menu":"Show navigation menu",n=yt((a)=>a.all),o=el((a)=>a.side),r=el((a)=>a.sending);return Rt.jsxs("div",{className:"hdr",children:[Rt.jsx("button",{type:"button",className:"ib",id:"phone-menu","aria-label":t,"aria-expanded":e,title:t,onClick:V6,children:Rt.jsx(Mv,{id:"i-more"})}),Rt.jsx("button",{className:"ib",id:"hsidetop","aria-label":"Chats","aria-expanded":o,title:o?"Hide chats":"Show chats",onClick:()=>pg(!o),children:Rt.jsx(Mv,{id:"i-side"})}),Rt.jsx(yue,{}),Rt.jsx("div",{className:"combo",id:"combo",children:Rt.jsx(xq,{})}),Rt.jsx("div",{className:"combo",id:"showc",hidden:!n,children:Rt.jsx(wq,{})}),Rt.jsx("span",{id:"fbtn-host",style:{display:"contents"},children:Rt.jsx(Lq,{})}),Rt.jsx(Hk,{}),Rt.jsx("span",{className:"hx",id:"hx",children:Rt.jsx(Pq,{})}),Rt.jsx("span",{className:"sp"}),Rt.jsx("span",{className:"kz-ui",id:"tmodes",role:"group","aria-label":"Layout",children:Rt.jsx(Fq,{})}),Rt.jsxs("button",{className:"btn pri",id:"newtop",onClick:()=>Zi(),children:[Rt.jsx(Mv,{id:"i-plus"}),Rt.jsx("span",{children:"New task"})]}),Rt.jsx("button",{className:"ib",id:"hpop",title:"Pop out chat","aria-label":"Pop out chat",onClick:()=>void rV(),children:Rt.jsx(Mv,{id:"i-popout"})}),Rt.jsxs("button",{className:"btn pri",id:"hnewtop","aria-label":"New chat",disabled:r,onClick:tV,children:[Rt.jsx(Mv,{id:"i-plus"}),Rt.jsx("span",{children:"New chat"})]})]})}var Kq=h(I(),1);var Mr=h(w(),1),xue=[[["←↓↑→","hjkl"],"move between cards"],[["Enter"],"open"],[["←→","hl"],"tabs, in an open run"],[["↑↓","jk"],"scroll, in an open run"],[["n"],"new task"],[["e"],"edit"],[["x"],"reject / abandon"],[["r"],"run"],[["a"],"all projects"],[["Esc"],"close"],[["?"],"this list"]],wue=[[["←↓↑→","hjkl"],"move between panes"],[["1-9"],"go to tab"],[["n","p"],"next, previous tab"],[["c"],"new tab menu"],[["r"],"split right menu"],[["d"],"split down menu"],[["x"],"close pane"],[["?"],"this list"]],GM=({rows:e,style:t})=>Mr.jsx("dl",{style:t,children:e.map(([n,o])=>Mr.jsxs(Kq.Fragment,{children:[Mr.jsx("dt",{children:n.map((r)=>Mr.jsx("kbd",{children:r},r))}),Mr.jsx("dd",{children:o})]},n.join()))});function qq(){let e=Jh((t)=>t.on);return Mr.jsx("div",{className:C("help",e&&"on"),id:"help",onClick:()=>Gs(!1),children:Mr.jsxs("div",{children:[Mr.jsx("p",{children:"Optional. Everything here is also a button."}),Mr.jsx(GM,{rows:xue}),Mr.jsx(GM,{rows:[[["Ctrl","Shift","Space"],"search, also from a terminal"]],style:{marginTop:16}}),Mr.jsx("h3",{children:"In a workspace"}),Mr.jsxs("p",{children:["Press ",Mr.jsx("kbd",{children:"Ctrl"})," ",Mr.jsx("kbd",{children:"Space"})," to focus the current pane, then one key:"]}),Mr.jsx(GM,{rows:wue})]})})}var $q=h(I(),1);var sl=h(w(),1);function Yq(){let e=yw((t)=>t.file);return $q.useEffect(()=>{let t=(n)=>{if(n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey)return;let o=n.target.closest?.("a[href]"),r=o?.getAttribute("href")??"";if(!bI(r)||o?.hasAttribute("data-viewer-tab"))return;n.preventDefault(),yI(r)};return document.addEventListener("click",t),()=>document.removeEventListener("click",t)},[]),sl.jsx(Ga,{open:!!e,onOpenChange:(t)=>!t&&SR(),children:e&&sl.jsxs(Fa,{"aria-describedby":void 0,className:"h-[calc(100dvh-32px)] w-[min(1100px,calc(100vw-32px))] gap-0 overflow-hidden p-0",children:[sl.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-3 py-2",children:[sl.jsx(ga,{className:"min-w-0 flex-1 truncate text-base font-semibold",children:e.name}),sl.jsx("a",{className:"text-primary",href:e.href,target:"_blank",rel:"noopener","data-viewer-tab":!0,children:"Open in new tab"}),sl.jsx(M,{size:"sm",onClick:SR,children:"Close"})]}),vI(e.href,e.name)?sl.jsx("img",{src:e.href,alt:e.name,referrerPolicy:"no-referrer",className:"min-h-0 w-full flex-1 object-contain"}):sl.jsx("iframe",{src:e.href,title:e.name,className:"w-full flex-1 border-0 bg-white"})]})})}var ll=h(I(),1);var Xq=h(I(),1);var $p=h(w(),1);function Wq({text:e}){let t=[],n=/`([^`]+)`|\*\*([^*]+)\*\*|\*([^*\s][^*]*)\*|\[([^\]]*)\]\([^)\s]+\)/g,o=0,r;while(r=n.exec(e)){if(r.index>o)t.push(e.slice(o,r.index));let a=t.length;t.push(r[1]!=null?$p.jsx("code",{className:"rounded-xs bg-muted px-1 font-mono text-[0.92em]",children:r[1]},a):r[2]!=null?$p.jsx("strong",{children:r[2]},a):r[3]!=null?$p.jsx("em",{children:r[3]},a):r[4]),o=n.lastIndex}if(o<e.length)t.push(e.slice(o));return $p.jsx($p.Fragment,{children:t})}var $a=h(w(),1);function Qq(){let e=st((f)=>f.fix),t=st((f)=>f.off),n=st((f)=>f.sent),[o,r]=Xq.useState(!1);if(!e)return null;let{card:a,findings:i}=e,s=(f)=>a.id+":"+f,l=(f)=>n.includes(s(f)),c=i.filter((f)=>!f.done&&!l(f.n)),d=c.filter((f)=>!t.includes(s(f.n))).map((f)=>f.n),u=d.length===c.length,p=(f,g)=>Pe({off:g?t.filter((m)=>m!==s(f)):[...t,s(f)]});return $a.jsxs("div",{className:"mt-4 flex flex-col gap-2 rounded-sm border border-primary bg-card p-3 shadow-md",children:[$a.jsx("div",{className:"text-base font-medium",children:"Fix findings"}),$a.jsx("div",{className:"text-sm text-muted-foreground",children:"Opens your agent in this project, told to fix the ticked findings and recheck them."}),a.status==="waiting"&&$a.jsx("div",{className:"text-sm text-muted-foreground",children:"An agent is already open on this run; the fix is sent to it when it runs in its card, else another one opens."}),i.map((f)=>{let g=f.done||l(f.n),m=f.done?" (closed)":l(f.n)?" (sent)":"";return $a.jsxs("label",{className:C("flex items-baseline gap-2 text-base",g?"cursor-default text-muted-foreground":"cursor-pointer"),children:[$a.jsx(Hr,{checked:g||!t.includes(s(f.n)),disabled:g,onCheckedChange:(y)=>p(f.n,y===!0),"aria-label":`Finding ${f.n}`,"data-n":f.n,className:"translate-y-[3px]"}),$a.jsxs("span",{children:[f.n,". ",$a.jsx(Wq,{text:f.text}),m]})]},f.n)}),c.length>0&&$a.jsxs("div",{className:"flex flex-wrap justify-end gap-1.5",children:[$a.jsx(M,{variant:"ghost","data-a":"all",onClick:()=>Pe({off:u?[...t,...c.map((f)=>s(f.n))]:t.filter((f)=>!c.some((g)=>s(g.n)===f))}),children:u?"Select none":"Select all"}),$a.jsx(M,{variant:"primary",disabled:!d.length||o,onClick:async()=>{r(!0);let f=await gI(a,d);if(r(!1),f)sI(d.map(s))},children:u?"Fix all "+d.length:"Fix "+d.length+" selected"})]})]})}var Ho=h(w(),1),FM=null,Zq=["outline-2","outline-offset-[3px]","outline-(--accent)","rounded-sm","transition-[outline-color]","duration-[600ms]"],kue=(e)=>e.split(/`([^`]+)`/).map((t,n)=>n%2?Ho.jsx("code",{className:"rounded-xs bg-background px-[5px] py-px font-mono text-xs",children:t},n):t),Sue={done:"text-success",doing:"text-running",todo:"text-muted-foreground"};function Cue({id:e,src:t}){let n=ll.useMemo(()=>AI(t),[t]),o=FM?.id===e?FM:null,[r,a]=ll.useState(o?o.w:n?.pct??0),i=ll.useMemo(()=>n?n.steps.map((s,l)=>MI(o,n.steps,l)):[],[n,e]);if(ll.useEffect(()=>{if(!n)return;a(n.pct),FM={id:e,st:n.steps.map((s)=>s.st),w:n.pct}},[n,e]),!n)return null;return Ho.jsxs("div",{"data-prog":!0,className:"mb-[18px]",children:[Ho.jsxs("div",{className:"mb-1.5 flex justify-between text-base text-muted-foreground",children:[Ho.jsxs("b",{className:"font-medium text-foreground",children:[n.done," of ",n.steps.length," done"]}),Ho.jsxs("span",{children:[n.pct,"%"]})]}),Ho.jsx("div",{className:"h-1.5 overflow-hidden rounded-[3px] bg-border",children:Ho.jsx("i",{className:"block h-full rounded-[3px] bg-primary transition-[width] duration-[260ms] ease-[cubic-bezier(.22,.61,.36,1)] motion-reduce:transition-none",style:{width:r+"%"}})}),Ho.jsx("ol",{className:"mt-3 flex flex-col gap-0.5",children:n.steps.map((s,l)=>Ho.jsxs("li",{className:C("flex items-baseline gap-2.5 rounded-sm px-2 py-1.5",s.st==="todo"&&"text-muted-foreground",i[l]&&"motion-safe:animate-[kz-fade_.26s]"),children:[Ho.jsx("span",{className:C("relative top-[3px] inline-grid size-4 flex-none place-items-center text-[11px]",Sue[s.st]),children:s.st==="done"?"✓":s.st==="doing"?Ho.jsx("span",{className:"size-[7px] rounded-full bg-current motion-safe:animate-pulse"}):""}),Ho.jsx("span",{children:kue(s.text)})]},l))})]})}function Jq(){let e=st((a)=>a.doc),t=st((a)=>a.fix),n=ll.useRef(null),o=e?.mark;if(ll.useEffect(()=>{if(!o||!e?.needle||!n.current)return;let a=e.needle,i=[...n.current.querySelectorAll("li,p")].find((s)=>!s.closest("[data-prog]")&&ER(s.textContent).includes(a));if(!i)return;i.scrollIntoView({block:"center"}),i.classList.add(...Zq),setTimeout(()=>i.classList.remove(...Zq),2400)},[o]),!e)return null;let r=e.k==="backlog";return Ho.jsxs("div",{ref:n,children:[r&&e.progress&&Ho.jsx(Cue,{id:e.id,src:e.progress}),e.text?Ho.jsx(Gp,{text:r&&e.progress?`### Backlog
108
+
109
+ `+e.text:e.text,ticks:r}):!(r&&e.progress)&&Ho.jsxs("p",{className:"text-muted-foreground",children:["No ",EI[e.k]," yet."]}),e.k==="review"&&t&&Ho.jsx(Qq,{})]})}var Dv=h(w(),1),Nue=[["←↓↑→","pane"],["1-9","tab"],["n p","next, prev"],["c","new tab"],["r","split right, same as this pane"],["d","split down, same as this pane"],["x","close pane"],["?","all keys"]];function e$(){if(!Fe((e)=>e.hint))return null;return Dv.jsx("div",{role:"status",className:"fixed bottom-11 left-1/2 z-[60] flex w-max max-w-[calc(100vw-32px)] -translate-x-1/2 flex-wrap justify-center gap-x-4 gap-y-1.5 rounded-lg border border-border bg-card px-3.5 py-2 text-sm text-foreground shadow-[0_8px_24px_rgba(0,0,0,.35)] animate-fade-in",children:Nue.map(([e,t])=>Dv.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[Dv.jsx("kbd",{className:"rounded-xs border border-border px-1.5 py-0.5 font-mono text-xs text-strong",children:e}),t]},e))})}var cr=h(w(),1);function t$({id:e}){let t=Fe((o)=>o.titles[e]??""),n=Fe((o)=>o.screens).filter((o)=>!o.ids.includes(e));return cr.jsxs(cr.Fragment,{children:[cr.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),cr.jsxs(En,{children:[cr.jsx(An,{asChild:!0,children:cr.jsx(me,{size:"sm",icon:"more",label:"Move to another tab","aria-label":`Move ${t}`})}),cr.jsxs(Mn,{align:"end",className:"min-w-50 text-sm",children:[cr.jsx(k1,{children:"Move to"}),n.map((o)=>cr.jsxs(nn,{onSelect:()=>Dt.act.move(e,o.id),children:[cr.jsx(L,{name:"arrow",className:"size-(--ico)"}),cr.jsx("span",{children:o.title})]},o.id)),cr.jsxs(nn,{onSelect:()=>Dt.act.move(e,null),children:[cr.jsx(L,{name:"plus",className:"size-(--ico)"}),cr.jsx("span",{children:"New tab"})]})]})]}),cr.jsx(me,{size:"sm",icon:"x",label:"Close","aria-label":`Close ${t}`,onClick:()=>Dt.act.closeItem(e)})]})}var n$=h(I(),1);var r$=h(w(),1);function o$(){return n$.useEffect(()=>{try{let e=Number(localStorage.getItem(dw));if(e)fR(e)}catch{}},[]),r$.jsx("div",{id:"rgrip",title:"Drag to resize, double-click to reset",onPointerDown:(e)=>{e.preventDefault();let t=e.currentTarget,n=t.parentElement.parentElement;t.setPointerCapture(e.pointerId),document.body.classList.add("rdrag");let o=(a)=>fR(n.getBoundingClientRect().right-a.clientX),r=()=>{t.removeEventListener("pointermove",o),document.body.classList.remove("rdrag");try{localStorage.setItem(dw,String(Math.round(n.getBoundingClientRect().width)))}catch{}};t.addEventListener("pointermove",o),t.addEventListener("pointerup",r,{once:!0}),t.addEventListener("pointercancel",r,{once:!0})},onDoubleClick:()=>{document.documentElement.style.removeProperty("--rpanel-w");try{localStorage.removeItem(dw)}catch{}}})}var Pv=h(w(),1),Rue={waiting:"[--c:var(--warn)]",stalled:"[--c:var(--danger)]"};function a$({phases:{names:e,at:t,status:n,tip:o}}){return Pv.jsx("span",{title:o,"aria-label":o,className:C("inline-grid w-[210px] max-w-full grid-flow-col auto-cols-fr [--c:var(--run)]",Rue[n]),children:e.map((r,a)=>Pv.jsxs("span",{className:C("relative flex flex-col items-center gap-[3px] text-[10px] leading-[1.2] text-muted-foreground",a>0&&"before:absolute before:right-1/2 before:top-1 before:h-0.5 before:w-full before:bg-border",a>0&&a-1<t&&"before:bg-success",a===t&&"font-semibold text-(--c)"),children:[Pv.jsx("i",{className:C("relative z-[1] size-2.5 rounded-full border-2 border-border bg-card",a<t&&"border-success bg-success",a===t&&"border-(--c) shadow-[0_0_0_3px_color-mix(in_srgb,var(--c)_25%,transparent)]")}),r]},r))})}var Uk=h(I(),1);var Ng=h(w(),1),Tue={running:"bg-running after:absolute after:inset-0 after:bg-[linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent)] motion-safe:after:animate-[rsweep_1.6s_ease-in-out_infinite]",waiting:"bg-warning motion-safe:animate-[rpulse_1.8s_ease-in-out_infinite]",stalled:"bg-danger",done:"bg-success"};function i$({word:e,w:t,status:n,tip:o}){let[r,a]=Uk.useState(0);return Uk.useEffect(()=>a(t),[t]),Ng.jsxs("div",{title:o,className:"col-span-full mt-2 flex items-center gap-2.5 text-[11px] text-muted-foreground",children:[Ng.jsx("span",{className:C("max-w-1/2 min-w-0 truncate",n==="waiting"&&"text-warning"),children:e}),Ng.jsx("b",{className:"relative h-[3px] flex-1 overflow-hidden rounded-[2px] bg-border",children:Ng.jsx("i",{style:{width:r+"%"},className:C("absolute inset-y-0 left-0 rounded-[2px] bg-running transition-[width] duration-[600ms] ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none",Tue[n])})})]})}var jo=h(w(),1),Ov="inline-flex items-center gap-1.5 rounded-full bg-muted py-0.5 pl-1.5 pr-[9px] text-sm font-medium text-foreground";function s$(){let e=st((t)=>t.head);if(!e)return null;if(e.kind==="steps")return jo.jsx(a$,{phases:e.phases});if(e.kind==="task")return jo.jsxs(jo.Fragment,{children:[jo.jsxs("span",{className:Ov,children:[jo.jsx(jp,{name:"idea"}),"Task"]})," ",jo.jsx("span",{className:C(Ov,"pl-[9px] font-normal text-muted-foreground"),children:e.where})]});if(e.kind==="chips")return jo.jsxs(jo.Fragment,{children:[jo.jsxs("span",{className:Ov,children:[jo.jsx(jp,{name:e.mark}),e.label]}),e.awaiting&&jo.jsx("span",{className:C(Ov,"ml-1.5 pl-[9px] font-normal text-muted-foreground"),children:e.awaiting}),e.parent&&jo.jsx("span",{title:"Filed by this run",className:C(Ov,"ml-1.5 bg-primary/10 pl-[9px] text-primary shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--accent)_40%,transparent)]"),children:e.parent})]});return jo.jsxs(jo.Fragment,{children:[jo.jsx("div",{title:e.runner,className:"max-w-[120px] truncate whitespace-nowrap text-xs text-muted-foreground",children:e.proj}),jo.jsx(i$,{word:e.word,w:e.w,status:e.status,tip:e.tip},e.id)]})}var nd=h(w(),1);function l$(){let e=st((n)=>n.tabs),t=st((n)=>n.tab);return nd.jsx(nd.Fragment,{children:e.map((n)=>nd.jsxs("button",{type:"button","data-k":n.k,title:n.label,"aria-label":n.label,"aria-current":n.k===t||void 0,onClick:()=>N8(n.k),className:C("whitespace-nowrap p-3 text-base font-medium text-muted-foreground hover:text-foreground",n.k===t&&"text-foreground shadow-[inset_0_-2px_var(--accent)]","col:grid col:size-8 col:place-items-center col:rounded-sm col:p-0 col:shadow-none col:hover:bg-muted",n.k===t&&"col:bg-muted","max-[640px]:[body.runv_&]:size-11"),children:[nd.jsx(L,{sprite:"t",name:n.k,className:"hidden size-[17px] col:block"}),nd.jsx("span",{className:"col:sr-only",children:n.label})]},n.k))})}var na=h(w(),1),Eue=(e)=>e.slice(e.lastIndexOf("/")+1);function c$(){let e=Fe((o)=>o.notes);if(!e)return null;if(e.failed)return na.jsx(na.Fragment,{children:"The notes could not load."});let t=e.names??[],n=new Map;for(let o of t){let r=o.lastIndexOf("/"),a=r<0?"":o.slice(0,r);n.set(a,[...n.get(a)??[],o])}return na.jsxs(na.Fragment,{children:[na.jsx("h3",{className:"mb-2 text-xs uppercase tracking-[.06em] text-muted-foreground",children:"Project notes"}),e.loading?null:t.length?[...n].map(([o,r])=>na.jsxs("div",{children:[o&&na.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-sm text-muted-foreground",children:[na.jsx(L,{name:"side",className:"size-(--ico)"}),o]}),na.jsx("div",{className:o?"ml-3":void 0,children:r.map((a)=>na.jsxs("button",{type:"button",onClick:()=>Dt.act.openNote(a),className:"flex w-full items-center gap-1.5 rounded-sm px-2 py-1 text-left hover:bg-muted",children:[na.jsx(L,{name:"note",className:"size-(--ico) shrink-0"}),Eue(a)]},a))})]},o)):na.jsx("p",{className:"text-muted-foreground",children:"No notes in this project yet."})]})}var Vk=h(I(),1);var VM=h(I(),1);var Gk=h(I(),1);var Qn=h(w(),1),Aue=["claude","codex","gemini"],Mue="grid grid-cols-[18px_1fr] items-start gap-2.5 px-2.5 py-1.5",_v=({icon:e,name:t,note:n,onSelect:o})=>Qn.jsxs(nn,{className:Mue,onSelect:o,children:[Qn.jsx(L,{name:e,className:"mt-px size-4"}),Qn.jsxs("span",{className:"text-foreground",children:[t,Qn.jsx("small",{className:"block text-[11.5px] text-muted-foreground",children:n})]})]}),Due=(e)=>{let t={j:1,k:-1}[e.key];if(!t)return;let n=[...e.currentTarget.querySelectorAll("[role=menuitem]")];n[(n.indexOf(document.activeElement)+t+n.length)%n.length]?.focus()};function Fk({mode:e,children:t}){let n=Fe((u)=>u.agents),o=Fe((u)=>u.defAgent),r=Fe((u)=>u.pty),a=Fe((u)=>u.menu===e),i=n.find((u)=>u.cmd===o)??n[0],[s,l]=Gk.useState(!1),c=(u)=>Dt.act.openNew(u,e,u.startsWith("agent:")&&s!==!!i?.bypassDefault?s:void 0);Gk.useEffect(()=>{if(a)l(!!i?.bypassDefault)},[a,i?.bypassDefault]);let d=(u)=>Qn.jsx(_v,{icon:Aue.includes(u.cmd)?u.cmd:"ai",name:u.name,note:u===i?"default agent, in this folder":"the agent alone, no run",onSelect:()=>c("agent:"+u.cmd)},u.cmd);return Qn.jsxs(En,{open:a,onOpenChange:(u)=>To({menu:u?e:null}),children:[Qn.jsx(An,{asChild:!0,children:t}),Qn.jsxs(Mn,{align:"start",className:"min-w-[250px] max-h-[calc(100vh-60px)] overflow-y-auto",onKeyDown:Due,children:[r&&n.length>0&&Qn.jsxs(Qn.Fragment,{children:[n.some((u)=>u.yolo)&&Qn.jsxs("label",{className:"mb-1 flex items-center justify-between gap-4 border-b border-border px-2.5 pb-2.5 pt-1.5 text-base",children:[Qn.jsxs("span",{children:["Bypass permissions",Qn.jsx("small",{className:"block text-[11.5px] text-muted-foreground",children:"run commands without asking"})]}),Qn.jsx(sr,{checked:s,onCheckedChange:l,"aria-label":"Bypass permissions"})]}),d(i),n.filter((u)=>u!==i).map(d),Qn.jsx(Zr,{})]}),r&&Qn.jsx(_v,{icon:"term",name:"Shell",note:"a terminal in this folder",onSelect:()=>c("shell")}),Qn.jsx(_v,{icon:"link",name:"Browser",note:"localhost pages, e.g. the dev server",onSelect:()=>c("local")}),Qn.jsx(_v,{icon:"eye",name:"Preview",note:"the run's Preview",onSelect:()=>c("preview")}),Qn.jsx(_v,{icon:"note",name:"History",note:"finished runs in this workspace",onSelect:()=>c("history")})]})]})}var jn=h(w(),1),Pue=["claude","codex","gemini"],Oue={agent:"ai",shell:"term",local:"link",preview:"eye",note:"note",wait:"ai",history:"note"};function _ue({sc:e,on:t}){let[n,o]=VM.useState(!1),r=e.first;return jn.jsxs("div",{draggable:!0,title:e.title,onDragStart:(a)=>{Dt.act.drag(e.ids.includes(e.focus)?e.focus:e.ids[0]),a.dataTransfer.setData("text/plain",e.focus),a.dataTransfer.effectAllowed="move"},onDragEnd:()=>Dt.act.drag(null),onDragOver:(a)=>{if(!Dt.act.dragging())return;a.preventDefault(),o(!0)},onDragLeave:()=>o(!1),onDrop:(a)=>{a.preventDefault(),o(!1),Dt.act.drop(e.id)},className:C("group/tab flex h-auto min-w-35 max-w-60 items-center gap-2 pl-3 pr-2 text-muted-foreground hover:bg-muted hover:text-foreground max-[640px]:min-w-0 max-[640px]:gap-1.5 max-[640px]:pl-2.5 max-[640px]:pr-0.5 max-[640px]:text-sm max-[640px]:hover:bg-transparent",t&&"text-strong shadow-[inset_0_-2px_var(--ink-hi)] hover:text-strong",n&&"bg-muted shadow-[inset_0_-2px_0_var(--accent)]"),children:[jn.jsxs("button",{type:"button",role:"tab","aria-selected":t,onClick:()=>Dt.act.select(e.id),className:"flex min-w-0 flex-1 items-center gap-2 text-left max-[640px]:gap-1.5",children:[jn.jsx(L,{name:r.agent&&Pue.includes(r.agent)?r.agent:Oue[r.kind]??"ai",className:"size-(--ico) shrink-0"}),jn.jsx("span",{className:"min-w-0 flex-1 truncate max-[640px]:max-w-27.5 max-[640px]:flex-none",children:e.title})]}),jn.jsx("button",{type:"button","aria-label":`Close ${e.title}`,title:"Close tab",onClick:()=>Dt.act.close(e.id),className:C("grid size-5 shrink-0 place-items-center rounded-sm opacity-0 hover:bg-muted hover:opacity-100 focus-visible:opacity-60 group-hover/tab:opacity-60 max-[640px]:grid max-[640px]:size-7 max-[640px]:place-items-center max-[640px]:p-0 max-[640px]:opacity-60",t&&"opacity-60"),children:jn.jsx(L,{name:"x",className:"size-(--ico)"})})]})}function u$(){let e=Fe((i)=>i.message),t=Fe((i)=>i.screens),n=Fe((i)=>i.on),o=Fe((i)=>i.split),[r,a]=VM.useState(!1);if(e)return jn.jsx("span",{className:"px-3 text-muted-foreground",children:e});return jn.jsxs(jn.Fragment,{children:[t.map((i)=>jn.jsx(_ue,{sc:i,on:i.id===n},i.id)),jn.jsx(Fk,{mode:"tab",children:jn.jsx(me,{size:"sm",icon:"plus",label:"New tab",className:C("self-center",t.length&&"ml-1",r&&"bg-muted shadow-[inset_0_-2px_0_var(--accent)]"),onDragOver:(i)=>{if(!Dt.act.dragging())return;i.preventDefault(),a(!0)},onDragLeave:()=>a(!1),onDrop:(i)=>{i.preventDefault(),a(!1),Dt.act.drop(null)}})}),jn.jsx("span",{className:"flex-1"}),jn.jsx(me,{size:"sm",icon:"play",label:"Run app: start the dev server if it is off and open the app","aria-label":"Run app",onClick:()=>Dt.act.runApp(),className:"self-center"}),o&&jn.jsxs(jn.Fragment,{children:[jn.jsx(Fk,{mode:"cols",children:jn.jsx(me,{size:"sm",icon:"lcols",label:"Split right: add to this tab","aria-label":"Split right",className:"self-center max-[640px]:hidden"})}),jn.jsx(Fk,{mode:"rows",children:jn.jsx(me,{size:"sm",icon:"lrows",label:"Split down: add to this tab","aria-label":"Split down",className:"self-center max-[640px]:hidden"})})]})]})}var Yp=h(w(),1);function d$(){let e=Vk.useRef(null),t=Fe((a)=>a.on),n=Fe((a)=>a.flip),o=Fe((a)=>!a.picker),r=Fe((a)=>a.awaiting&&a.flip!==nt());return Vk.useEffect(()=>{let a=requestAnimationFrame(()=>e.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest",inline:"nearest"}));return()=>cancelAnimationFrame(a)},[t]),Yp.jsxs("div",{id:"rbar",children:[Yp.jsx("nav",{id:"rtabs","aria-label":"Workspace tabs",ref:e,children:Yp.jsx("div",{className:"kz-ui",style:{display:"contents"},children:Yp.jsx(u$,{})})}),Yp.jsx(me,{size:"sm",icon:"open",label:"Show or hide the run panel",id:"rside","aria-pressed":n,hidden:o,"data-dot":r?"":void 0,onClick:()=>hu(!n)})]})}var f$=h(w(),1);function p$(){return Fe((t)=>t.empty)?f$.jsx(ba,{title:"No tabs open",help:"Open an agent, a shell, the project's localhost or the Preview with +."}):null}function m$(e){let t=(e||"").split(`
110
+ `),n=t.findIndex((l)=>/^#+\s*(\d+\.\s*)?open questions/i.test(l.trim()));if(n<0)return[];let o=/^#+/.exec(t[n].trim())[0].length,r=[],a=null,i=!1;for(let l of t.slice(n+1)){let c=l.trim(),d=/^#+(?=\s)/.exec(c);if(d&&d[0].length<=o)break;if(!d&&c&&!/^```/.test(c)&&!/^none\.?$/i.test(c))i=!0;let u=/^\**Q\d*\s*[:.)]\**\s*(.+)$/.exec(c);if(u){r.push(a={q:u[1].trim(),multi:/multi-?select/i.test(u[1]),options:[]});continue}let p=/^[-*]\s+(.+)$/.exec(c);if(p&&a){let f=p[1].trim();a.options.push({text:f,rec:/\(recommended\)/i.test(f),label:f.replace(/\s*\(recommended\)/i,"").split(/\s+[—–-]\s+|:\s/)[0].trim()})}else if(a&&a.options.length)a=null}let s=r.filter((l)=>l.options.length);return s.length||!i?s:null}var Tg=h(I(),1);var Rg=(e)=>{try{let t=new URL(String(e));return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password?t.href:null}catch{return null}},KM=(e)=>typeof e==="string"&&/^\/task-artifact(?:\?|\/)/.test(e)&&!e.includes("\\")&&!/[\r\n]/.test(e)?e:null,qM=(e)=>e==null?"":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`,g$=(e)=>/^image\//.test(e.mediaType??"")||e.kind==="image"||e.kind==="screenshot",$M=(e)=>e.kind==="website"||e.kind==="app"||e.kind==="link"||e.kind==="live",zue=(e)=>/^(?:text\/(?:html|javascript|xml)|application\/(?:javascript|xml|xhtml\+xml)|image\/svg\+xml)(?:;|$)/i.test(e.mediaType??"")||/\.(html?|svg|m?js|xml)$/i.test(e.name);function h$(e,t){let n=$M(e),o=n?Rg(e.url):KM(e.url);if(e.missing||!o)return{mode:"missing",href:o};if(!t)return{mode:"none",href:o};if(n)return{mode:"live",href:o};if(zue(e))return{mode:"download",href:o};if(e.preview===!1||e.preview==="download"||e.preview==="none")return{mode:"unavailable",href:o};let r=e.mediaType??"";if(/^image\//.test(r)||e.kind==="image"||e.kind==="screenshot")return{mode:"image",href:o};if(/^video\//.test(r)||e.kind==="video")return{mode:"video",href:o};if(/^audio\//.test(r)||e.kind==="audio")return{mode:"audio",href:o};if(r==="application/pdf"||e.kind==="pdf")return{mode:"pdf",href:o};if(/^text\//.test(r)||["text","markdown","document"].includes(e.kind))return{mode:"text",href:o};return{mode:"unavailable",href:o}}var b$=(e)=>e?.createdAt?`Saved ${new Date(e.createdAt).toLocaleString()}${(e.storedSize??e.size)!=null?" · "+qM(e.storedSize??e.size)+" preserved":""}`:"",v$=(e)=>typeof e==="string"?e:[e.label,e.outcome,e.evidence].filter(Boolean).join(" — "),y$=(e)=>!e.title||e.title==="Existing result",YM=1e6;var x$=[["all","All"],["needs-you","Needs you"],["in-progress","In progress"],["completed","Completed"]];function w$(e,t="all",n="",o=""){let r=n.trim().toLocaleLowerCase(),a={"needs-you":0,"in-progress":1,completed:2};return e.filter((i)=>(!o||i.dir===o)&&(t==="all"||i.attention.category===t)&&(!r||[i.title,i.goal,i.projectName,i.attention.reason,i.attention.action].filter(Boolean).join(" ").toLocaleLowerCase().includes(r))).sort((i,s)=>a[i.attention.category]-a[s.attention.category]||Number(new Date(s.updatedAt??0))-Number(new Date(i.updatedAt??0))||i.id.localeCompare(s.id))}var WM=(e)=>(e.inputs??[]).filter((t)=>["received","queued","dispatched"].includes(t.state));function k$(e,t){return!!t&&e.actions?.accept!==!1&&!e.queuePaused&&t.id===e.currentResultId&&!e.decision&&!e.activeRun&&!WM(e).length&&e.attention.category!=="completed"}var S$=(e)=>`?view=task&task=${encodeURIComponent(e.id)}&dir=${encodeURIComponent(e.dir||"")}`,zv=(e)=>e.attention?.reason||e.status||"Saved",Iv=(e)=>e.replace(/[\\/]\.kaizen$/,"").split(/[\\/]/).pop()||"",C$=(e,t=[])=>e.projectName||t.find((n)=>n.dir===e.dir)?.name||t.find((n)=>n.dir===e.dir)?.label||(e.dir?Iv(e.dir):"Choose a project");function N$(e=[]){if(!e?.length)return[];let t=e.filter((o)=>{if(o.type==="boundary")return!1;if(o.role==="user"&&o.text.includes("Continue production under the frozen task policy"))return!1;return!0}),n=t.reduce((o,r,a)=>r.type==="result"?a:o,-1);return t.filter((o,r)=>!(o.type==="result"&&r!==n))}var R$=(e=[])=>[...e].sort((t,n)=>Number(new Date(t.createdAt??0))-Number(new Date(n.createdAt??0))),T$=(e)=>e.actions??{abandon:!!e.activeRun,delete:!e.activeRun&&!(e.runs??[]).length},XM=(e)=>[...new Set([...(e.runs??[]).map((t)=>typeof t==="string"?t:t.id),...e.activeRun?[e.activeRun]:[]])];var Kk=h(I(),1);var E$=/^(localhost|127\.0\.0\.1|\[::1\])$/;function A$(e){let[t,n]=Kk.useState({src:"",hidden:!0,note:"Checking preview availability… You can also use Open link.",link:e});return Kk.useEffect(()=>{let o=!0,r=(a)=>o&&n((i)=>({...i,...a}));return(async()=>{let a=Rg(e);if(!a)return r({hidden:!0,note:"The preview address is unavailable."});let i=a,s="Checking preview availability… You can also use Open link.";try{let c=await i_(a);if(!o)return;if(c.frameable===!1)return r({hidden:!0,note:"This site refuses to appear inside kaizen. Use Open link to view it in another tab."})}catch{s="Preview availability could not be checked. Use Open link if it does not appear."}let l=e;if(E$.test(new URL(a).hostname)&&!E$.test(location.hostname)){r({hidden:!0,note:"Opening this computer’s preview for this device…"});try{let c=await s_(a);if(!o)return;let d=c.ok&&Rg(c.url);if(!d)return r({hidden:!0,linkLabel:"Open on computer",note:"This preview is on the computer running kaizen and could not be opened for this device. Open the task on that computer."});i=d,l=d,s=c.hint||"Live preview. This address can change during later work."}catch{return r({hidden:!0,linkLabel:"Open on computer",note:"The preview could not be opened for this device. Open the task on the computer running kaizen."})}}r({src:i,hidden:!1,note:s,link:l})})(),()=>{o=!1}},[e]),{...t,loaded:()=>n((o)=>o.note.startsWith("Checking")?{...o,note:"Live preview. If it does not appear, use Open link. Some apps require their own browser tab."}:o),failed:()=>n((o)=>({...o,hidden:!0,note:"The live preview could not be opened. Use Open link or ask for a saved screenshot."}))}}var qk=h(I(),1);function M$(e){let[t,n]=qk.useState("Loading saved text…");return qk.useEffect(()=>{let o=!0;return n("Loading saved text…"),a_(e).then((r)=>o&&n(r.length>YM?r.slice(0,YM)+`
111
+ Preview shortened. Download for the whole file.`:r)).catch(()=>o&&n("The saved file could not be read. Try Download or refresh the task.")),()=>{o=!1}},[e]),t}var D$=h(I(),1);var JM=()=>crypto.randomUUID(),P$=(e)=>{try{return sessionStorage.getItem("kz-task:"+e)||""}catch{return""}},QM=(e,t)=>{try{sessionStorage.setItem("kz-task:"+e,t)}catch{}};function Lv(e,t=!1){(t?history.replaceState:history.pushState).call(history,null,"",S$(e)),O.go("task")}async function e5(e){if(e.legacy){let t=await _N({op:"adopt",dir:e.dir,legacy:e.legacy,operationId:JM()});if(t.ok&&t.task)return Lv(t.task);return}Lv(e)}function O$(){let e=new URLSearchParams(location.search),t=e.get("task")||"",n=e.get("dir")||"",o=js();if(t!==o.taskId||n!==o.taskDir)uo({taskId:t,taskDir:n,page:null,pageError:"",pending:!1,receipt:"",draft:P$(t)})}var ZM=0;async function $k(){let{taskId:e,taskDir:t}=js();if(!e)return;let n=++ZM;try{let{ok:o,body:r}=await r_(e,t),a=js();if(n!==ZM||e!==a.taskId||Ze().page!=="task")return;if(!o||!r.task){if(!a.page)uo({pageError:r.why||r.error||"Refresh or return to Tasks."});return}if(a.page&&r.task.revision<a.page.task.revision)return;uo({page:r,pageError:""});let i=oe().tasks??[];tw([...i.filter((s)=>s.id!==r.task.id||s.dir!==r.task.dir),r.task])}catch{if(!js().page)uo({pageError:"offline"})}}function _$(){D$.useEffect(()=>{$k();let e,t=()=>{$k(),e=setTimeout(t,4000)};e=setTimeout(t,4000);let o=zr(()=>void $k());return()=>{ZM++,clearTimeout(e),o()}},[])}var Iue={stop:"Cancellation requested. Waiting for confirmation; saved files are not rolled back.",accept:"Result accepted. It has not been published by this action.",confirm:"Plan approved."};async function xc(e,t={}){let{page:n,pending:o}=js();if(o||!n)return;uo({pending:!0});let r={op:e,id:n.task.id,dir:n.task.dir,operationId:JM(),revision:n.task.revision,...t},a=await _N(r);uo({pending:!1});let{taskId:i,taskDir:s,page:l}=js();if(a.task&&a.ok){if(a.task.dir!==s||a.task.id!==i)return Lv(a.task,!0);if(l)uo({page:{...l,task:a.task}})}if(a.ok)uo({receipt:Iue[e]??"Saved."});if(await $k(),a.conflict)uo({receipt:"This task changed. Your message is still saved. Review the current result and send it again when ready."});return a}var Yk=(e)=>{uo({draft:e}),QM(js().taskId,e)};async function z$(e){let{draft:t,page:n,pending:o,taskId:r}=js(),a=t.trim();if(!a||o||!n)return!1;let i=e||n.task.currentResultId||null,s=JSON.stringify([a,i,n.task.decision?.id,"auto"]),l;try{l=JSON.parse(P$(r+":operation"))}catch{}let c=l?.identity===s?l.id:JM();if(QM(r+":operation",JSON.stringify({identity:s,id:c})),(await xc("message",{operationId:c,text:a,intent:"auto",baseResultId:i,decisionId:n.task.decision?.id}))?.ok&&js().draft===t)return Yk(""),QM(r+":operation",""),uo({receipt:"Message received. Follow its receipt in the conversation."}),!0;return!1}var U$=h(I(),1);var j$=h(I(),1);var I$=(e)=>(Symbol.iterator in e),L$=(e)=>("entries"in e),B$=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),o=t instanceof Map?t:new Map(t.entries());if(n.size!==o.size)return!1;for(let[r,a]of n)if(!o.has(r)||!Object.is(a,o.get(r)))return!1;return!0},Lue=(e,t)=>{let n=e[Symbol.iterator](),o=t[Symbol.iterator](),r=n.next(),a=o.next();while(!r.done&&!a.done){if(!Object.is(r.value,a.value))return!1;r=n.next(),a=o.next()}return!!r.done&&!!a.done};function H$(e,t){if(Object.is(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(I$(e)&&I$(t)){if(L$(e)&&L$(t))return B$(e,t);return Lue(e,t)}return B$({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function od(e){let t=j$.default.useRef(void 0);return(n)=>{let o=e(n);return H$(t.current,o)?t.current:t.current=o}}var o5=0,t5=!1,n5=!1;async function Wk(){if(Ze().page!=="tasks")return;if(t5){n5=!0;return}t5=!0;do{n5=!1;let e=++o5;try{let t=await o_();if(e!==o5||Ze().page!=="tasks")continue;uo({tasks:t,tasksLoaded:!0,tasksError:""}),tw(t)}catch(t){if(Ze().page==="tasks")uo({tasksError:t instanceof Error?t.message:"Tasks could not be loaded"})}}while(n5);t5=!1}function G$(){return U$.useEffect(()=>{let e=()=>{uo({scope:O.scopeDir()}),Wk()};e();let t=zr(e);return()=>{t(),o5++}},[]),Dl(od((e)=>({tasks:e.tasks,loaded:e.tasksLoaded,error:e.tasksError,scope:e.scope})))}function F$(e){e.querySelectorAll(".tp-zoom:not([data-zoom])").forEach((t)=>{let n=t.querySelector("img");if(!n)return;t.dataset.zoom="1";let o=1,r=0,a=0,i=new Map,s=0,l=!1,c=t.querySelector("[data-zoom-reset]"),d=()=>{let{clientWidth:m,clientHeight:y}=t;if(r=Math.min(0,Math.max(m-m*o,r)),a=Math.min(0,Math.max(y-y*o,a)),n.style.transform=`translate(${r}px,${a}px) scale(${o})`,t.classList.toggle("zoomed",o>1.001),c)c.textContent=Math.round(o*100)+"%"},u=(m,y,b)=>{b=Math.min(8,Math.max(1,b)),r=m-(m-r)*b/o,a=y-(y-a)*b/o,o=b,d()},p=(m)=>{let y=t.getBoundingClientRect();return{x:m.clientX-y.left,y:m.clientY-y.top}},f=()=>{let[m,y]=[...i.values()];return{x:(m.x+y.x)/2,y:(m.y+y.y)/2,d:Math.hypot(m.x-y.x,m.y-y.y)}};t.addEventListener("wheel",(m)=>{m.preventDefault();let y=p(m);u(y.x,y.y,o*Math.exp(-m.deltaY*(m.ctrlKey?0.01:0.0015)))},{passive:!1}),t.addEventListener("pointerdown",(m)=>{if(m.target.closest("button"))return;if(t.setPointerCapture(m.pointerId),i.set(m.pointerId,p(m)),l=!1,i.size===2)s=f().d}),t.addEventListener("pointermove",(m)=>{let y=i.get(m.pointerId);if(!y)return;let b=p(m);if(i.size===2){let x=f();i.set(m.pointerId,b);let v=f();if(r+=v.x-x.x,a+=v.y-x.y,s>0)u(v.x,v.y,o*(v.d/s));s=v.d,l=!0}else if(o>1)r+=b.x-y.x,a+=b.y-y.y,i.set(m.pointerId,b),l=!0,d()});let g=(m)=>{i.delete(m.pointerId),s=0};t.addEventListener("pointerup",g),t.addEventListener("pointercancel",g),t.addEventListener("dblclick",(m)=>{if(m.target.closest("button")||l)return;let y=p(m);if(o>1)u(y.x,y.y,1);else u(y.x,y.y,2.5)}),t.querySelector("[data-zoom-in]")?.addEventListener("click",()=>u(t.clientWidth/2,t.clientHeight/2,o*1.5)),t.querySelector("[data-zoom-out]")?.addEventListener("click",()=>u(t.clientWidth/2,t.clientHeight/2,o/1.5)),c?.addEventListener("click",()=>u(t.clientWidth/2,t.clientHeight/2,1)),new ResizeObserver(d).observe(t),d()})}var V$=h(I(),1);var Wp=h(w(),1);function K$({label:e,placeholder:t,submitLabel:n,onSubmit:o,disabled:r}){let[a,i]=V$.useState("");return Wp.jsx("form",{className:"mt-3.5",onSubmit:(s)=>{if(s.preventDefault(),a.trim())o(a.trim())},children:Wp.jsx(Se,{label:e,children:(s)=>Wp.jsxs("div",{className:"flex flex-wrap gap-2 max-sm:[&>input]:basis-full",children:[Wp.jsx(Ue,{...s,required:!0,value:a,onChange:(l)=>i(l.target.value),placeholder:t,className:"min-w-0 flex-1"}),Wp.jsx(M,{type:"submit",disabled:r,children:n})]})})})}var r5=h(I(),1);var ka=h(w(),1);function q$({questions:e,busy:t,onCancel:n,onApprove:o}){let r=(u)=>u.options.flatMap((p,f)=>p.rec||!u.multi&&!f&&!u.options.some((g)=>g.rec)?[f]:[]),[a,i]=r5.useState(()=>e.map(r)),[s,l]=r5.useState(()=>e.map(()=>"")),c=(u,p,f)=>i((g)=>g.map((m,y)=>y!==u?m:f?m.includes(p)?m.filter((b)=>b!==p):[...m,p]:[p])),d=()=>o(e.map((u,p)=>{let f=a[p].map((m)=>`"${u.options[m].label}"`).join(", ")||"none of the options",g=s[p].trim();return`${u.q} — ${f}${g?"; "+g:""}`}));return ka.jsx("div",{className:"max-h-[60vh] min-w-0 flex-1 overflow-auto",children:ka.jsxs(jr,{inline:!0,label:"Plan questions",children:[ka.jsxs("div",{className:"text-base font-medium",children:["The plan asks ",e.length===1?"one question":e.length+" questions","."]}),ka.jsx("div",{className:"text-sm text-muted-foreground",children:"Your answers go to your agent with the approval. It records them and builds the plan."}),e.map((u,p)=>ka.jsxs("fieldset",{className:"flex flex-col gap-1",children:[ka.jsx("legend",{className:"text-base font-medium",children:u.q}),u.options.map((f,g)=>ka.jsxs("label",{className:"flex items-baseline gap-2 text-base",children:[ka.jsx("input",{type:u.multi?"checkbox":"radio",name:`q${p}`,checked:a[p].includes(g),onChange:()=>c(p,g,u.multi),className:"relative top-0.5 shrink-0 accent-primary"}),f.text]},g)),ka.jsx(Ue,{placeholder:"Note (optional)","aria-label":`Note: ${u.q}`,value:s[p],onChange:(f)=>l((g)=>g.map((m,y)=>y===p?f.target.value:m))})]},p)),ka.jsxs("div",{className:"flex flex-wrap justify-end gap-1.5",children:[ka.jsx(M,{variant:"ghost",onClick:n,children:"Cancel"}),ka.jsx(M,{variant:"primary",disabled:t,onClick:d,children:"Approve with these answers"})]})]})})}var Y$=h(I(),1);var Ya=h(w(),1),$$="min-h-18 rounded-sm border border-border bg-card px-3 py-2 hover:border-muted-foreground focus-visible:border-primary";function W$({kind:e,busy:t,onCancel:n,onSend:o}){let r=Y$.useRef(null),a=()=>{let i=r.current.value.trim();if(i)return o(i);if(e!=="explore")_("Say what should change"),r.current.focus()};if(e==="explore")return Ya.jsxs(jr,{inline:!0,label:"Explore feedback",children:[Ya.jsxs("label",{className:"flex flex-col gap-1.5 text-base font-medium",children:["What should we explore further?",Ya.jsx(xn,{ref:r,"aria-label":"Explore feedback",autoFocus:!0,className:$$})]}),Ya.jsx(M,{variant:"primary",disabled:t,onClick:a,children:"Continue Explore"})]});return Ya.jsxs(jr,{inline:!0,label:"Revise",children:[Ya.jsx("div",{className:"text-base font-medium",children:e==="plan"?"What should the plan do differently?":"What should change in the work?"}),Ya.jsxs("div",{className:"text-sm text-muted-foreground",children:["Opens your agent on this run with your comment.",e==="plan"?" It revises the plan and comes back here for approval.":" It changes the work, rechecks it and comes back here."]}),Ya.jsx(xn,{ref:r,"aria-label":"Revise comment",autoFocus:!0,className:$$}),Ya.jsxs("div",{className:"flex flex-wrap justify-end gap-1.5",children:[Ya.jsx(M,{variant:"ghost",onClick:n,children:"Cancel"}),Ya.jsx(M,{variant:"primary",disabled:t,onClick:a,children:"Send back"})]})]})}var X$=h(I(),1);var wc=h(w(),1);function Q$({question:e,busy:t,onCancel:n,onSend:o}){let r=X$.useRef(null);return wc.jsxs(jr,{inline:!0,label:"Reply",children:[wc.jsx("div",{className:"text-base font-medium",children:e}),wc.jsx("div",{className:"text-sm text-muted-foreground",children:"Your answer goes to the agent, as from the task page."}),wc.jsx(xn,{ref:r,"aria-label":"Your answer",autoFocus:!0,className:"min-h-18 rounded-sm border border-border bg-card px-3 py-2 hover:border-muted-foreground focus-visible:border-primary"}),wc.jsxs("div",{className:"flex flex-wrap justify-end gap-1.5",children:[wc.jsx(M,{variant:"ghost",onClick:n,children:"Cancel"}),wc.jsx(M,{variant:"primary",disabled:t,onClick:()=>{let a=r.current.value.trim();if(a)return o(a);_("Write your answer"),r.current.focus()},children:"Send"})]})]})}var q=h(w(),1),Z$="mb-3 rounded-sm border border-[color:color-mix(in_srgb,var(--warn)_50%,var(--line))] p-3";function Xk(e){return e.layout==="strip"?q.jsx(Hue,{...e}):q.jsx(Bue,{...e})}function J$({options:e,onPick:t,disabled:n}){return e.map((o)=>q.jsx(M,{"data-a":"tq-opt",disabled:n,onClick:()=>t(o),children:o},o))}function Bue({decision:e,needsProject:t,projects:n=[],pending:o,onApprove:r,onAnswer:a,onProject:i}){let[s,l]=Tg.useState(""),c=e&&e.kind!=="project"?e:null;return q.jsxs(q.Fragment,{children:[t&&q.jsxs("section",{className:Z$,children:[q.jsx("h3",{className:"mb-2 text-base font-semibold",children:"Where should this task belong?"}),q.jsx("p",{className:"my-2",children:"Your goal and files are saved. Choose a named project or create one."}),q.jsx(Se,{label:"Project",children:(d)=>q.jsxs("div",{className:"flex flex-wrap gap-2",children:[q.jsx(Ni,{label:"Project",options:n.map((u)=>({value:u.dir,label:Iv(u.name||u.label||u.dir)})),value:s,onChange:l,placeholder:"Choose a project"}),q.jsx(M,{id:d.id,onClick:()=>s?i({projectDir:s}):_("Choose a named project first"),children:"Use project"})]})}),q.jsx(K$,{label:"New project name",placeholder:"Community workshop",submitLabel:"Create project",onSubmit:(d)=>i({name:d})})]}),c&&q.jsxs("section",{className:Z$,"aria-labelledby":"decision-title",children:[q.jsx("h3",{id:"decision-title",className:"mb-2 text-base font-semibold",children:c.kind==="proposal"?"Approve the plan":"Your answer is needed"}),q.jsx("p",{className:"my-2 whitespace-pre-wrap break-words",children:c.summary||c.text}),c.summary&&c.text!==c.summary&&q.jsx("p",{className:"my-2 whitespace-pre-wrap break-words",children:c.text}),c.details&&q.jsxs("details",{children:[q.jsx("summary",{className:"cursor-pointer",children:"Detailed plan"}),q.jsx("pre",{className:"max-h-[520px] overflow-auto whitespace-pre-wrap break-words bg-background p-3 font-mono text-sm",children:c.details})]}),c.kind==="proposal"?q.jsxs(q.Fragment,{children:[q.jsx(M,{variant:"primary",className:"mt-2",disabled:o,onClick:()=>r(c.id),children:"Approve plan"}),q.jsx("p",{className:"my-2 text-muted-foreground",children:"The build starts after you approve this plan. Ask for changes below if needed."})]}):c.options?.length?q.jsx("div",{className:"flex flex-wrap gap-1.5",children:q.jsx(J$,{options:c.options,onPick:a})}):null]})]})}function Hue({card:e,answered:t,questions:n,sourceControl:o,actions:r}){let[a,i]=Tg.useState("idle"),[s,l]=Tg.useState("");Tg.useEffect(()=>l(""),[e.status,e.awaiting,e.moved,e.accept,e.pty?.alive]);let c=async(v,k)=>{if(l(v),await k())i("idle");l("")},d=e.task?.question;if(a==="revise")return q.jsx(W$,{kind:e.awaiting==="explore"?"explore":e.awaiting==="approvals.plan"?"plan":"review",busy:!!s,onCancel:()=>i("idle"),onSend:(v)=>void c("send",()=>r.decide(v))});if(a==="answers"&&n?.length)return q.jsx(q$,{questions:n,busy:!!s,onCancel:()=>i("idle"),onApprove:(v)=>void c("send",()=>r.decide(void 0,v))});if(a==="reply"&&d)return q.jsx(Q$,{question:d.text,busy:!!s,onCancel:()=>i("idle"),onSend:(v)=>void c("send",async()=>{let k=await r.answer(v);if(k)i("idle");return k})});let u=(v)=>q.jsx("span",{className:"min-w-0 basis-full whitespace-normal text-sm leading-normal text-muted-foreground",children:v}),p=(...v)=>q.jsx("span",{className:"ml-auto flex gap-2",children:v}),f=e.pty&&!e.pty.alive?q.jsx(M,{"data-a":"resume",disabled:s==="resume",onClick:()=>void c("resume",r.resume),children:"Resume session"}):null,g=q.jsxs(q.Fragment,{children:[o&&q.jsx(M,{"data-a":"gittab",onClick:r.sourceControl,children:"Source control"}),e.archived?q.jsx(M,{variant:"primary","data-a":"restore",onClick:()=>r.archive(!1),children:"Restore"}):q.jsx(M,{variant:"ghost","data-a":"archive",onClick:()=>r.archive(!0),children:"Archive"})]}),m=q.jsx(M,{variant:"ghost","data-a":"ab",onClick:r.abandon,children:"Abandon"}),y=(v)=>q.jsx(M,{variant:"primary","data-a":"approve",disabled:t||!!s,onClick:()=>n?.length?i("answers"):void c("approve",()=>r.decide()),children:v}),b=q.jsx(M,{variant:"primary","data-a":"accept",disabled:s==="accept",onClick:()=>void c("accept",r.accept),children:"Approve"}),x;if(e.kind==="idea")if(e.archived)x=g;else if(e.status==="idea")x=q.jsxs(q.Fragment,{children:[q.jsx(M,{variant:"ghost",className:"text-danger","data-a":"delete",onClick:()=>r.form("delete"),children:"Delete"}),g,p(q.jsx(M,{"data-a":"reject",onClick:()=>r.form("reject"),children:"Reject"}),q.jsx(M,{"data-a":"edit",onClick:()=>r.form("edit"),children:"Edit"}),q.jsx(M,{variant:"primary","data-a":"run",onClick:r.run,children:"Run"}))]});else x=q.jsxs(q.Fragment,{children:[u(e.pty?"Starting: the agent runs below.":"Starting: a run was launched for this task. No terminal with your agent? Run it again."),p(q.jsx(M,{"data-a":"run",onClick:r.run,children:"Run again"}))]});else if(e.archived)x=g;else if(d)x=q.jsxs(q.Fragment,{children:[u(q.jsxs(q.Fragment,{children:[q.jsx("b",{children:"Question:"})," ",d.text]})),f,p(q.jsx(J$,{options:d.options,disabled:!!s,onPick:(v)=>void c("tq",()=>r.answer(v))}),q.jsx(M,{variant:"primary","data-a":"tq-reply",onClick:()=>i("reply"),children:"Reply"}))]});else if(e.task?.accept&&e.status==="done"&&e.accept!=="needs")x=q.jsxs(q.Fragment,{children:[u("Result ready."),g,f,q.jsx(M,{variant:"primary","data-a":"looks-good",disabled:s==="lg",onClick:()=>void c("lg",r.looksGood),children:"Looks good"})]});else if(e.healed&&e.awaiting==="approvals.review")x=q.jsxs(q.Fragment,{children:[u("Finished by its agent without your approval. Nothing is committed until you approve."),g,f,b]});else if((e.status==="waiting"||e.awaiting==="findings")&&xR[e.awaiting??""]){let v=!n?" Has questions: answer in its terminal.":n.length?` ${n.length===1?"1 question":n.length+" questions"}.`:"";x=q.jsxs(q.Fragment,{children:[u(t?"Sent to your agent.":xR[e.awaiting]+v),q.jsxs(En,{children:[q.jsx(An,{asChild:!0,children:q.jsx(M,{variant:"ghost",children:"More"})}),q.jsxs(Mn,{align:"start",children:[q.jsx(nn,{"data-a":"archive",onSelect:()=>r.archive(!0),className:"text-foreground",children:"Archive"}),e.column===1&&q.jsx(nn,{"data-a":"toidea",onSelect:r.backToTask,className:"text-foreground",children:"Back to task"}),q.jsx(Zr,{}),q.jsx(nn,{"data-a":"ab",onSelect:r.abandon,className:"text-danger data-[highlighted]:text-danger",children:"Abandon"})]})]}),f,p(q.jsx(M,{"data-a":"revise",disabled:t,onClick:()=>i("revise"),children:"Revise"}),y(e.awaiting==="explore"?"Continue to Plan":e.awaiting==="findings"?"Approve as-is":"Approve"))]})}else if(e.status==="waiting")x=q.jsxs(q.Fragment,{children:[u(`Waiting: ${Ls(e.awaiting)}.`),g,m,f]});else if(e.status==="done"&&e.accept==="needs")x=q.jsxs(q.Fragment,{children:[u("Done, not approved: its agent finished without your approval. Nothing is committed until you approve."),g,f,b]});else if(e.status==="done")x=q.jsxs(q.Fragment,{children:[g,f]});else if(e.status==="abandoned")x=g;else x=q.jsxs(q.Fragment,{children:[u(e.pty&&!e.pty.alive?"Agent ended early.":e.status==="stalled"?"Stalled.":""),g,m,e.status==="stalled"||e.pty&&!e.pty.alive?q.jsx(M,{variant:"primary","data-a":"resume",disabled:s==="resume",onClick:()=>void c("resume",r.resume),children:"Resume"}):null]});return q.jsxs(q.Fragment,{children:[x,e.stage==="explore"&&q.jsx(M,{"data-a":"skip-explore",disabled:s==="skip",onClick:()=>void c("skip",r.skipExplore),children:"Skip Explore"})]})}var tY=h(w(),1);function eY(){let e=st((i)=>i.footer);if(!e)return null;let{card:t,plan:n,sourceControl:o}=e,r=t.status==="waiting"&&t.awaiting==="approvals.plan"?m$(n):[],a={decide:(i,s)=>cI(t,i,s),accept:()=>uI(t),resume:()=>km(t),skipExplore:()=>dI(t),looksGood:()=>fI(t),answer:(i)=>mI(t,i),archive:(i)=>void bw(t,i),backToTask:()=>void vw(t),abandon:()=>ht({popup:{kind:"form",mode:"reject",card:t}}),sourceControl:()=>O.gitTab(t),form:(i)=>ht({popup:{kind:"form",mode:i,card:t}}),run:()=>ht({popup:{kind:"run",card:t}})};return tY.jsx(Xk,{layout:"strip",card:t,answered:gb.has(wR(t)),questions:r,sourceControl:o,actions:a},`${t.id}:${t.status}:${t.awaiting}`)}var rd=h(w(),1);function nY(){let e=Fe((t)=>t.history);if(!e.length)return rd.jsx("p",{className:"p-3 text-muted-foreground",children:"No finished runs in this workspace yet."});return rd.jsx("div",{className:"flex-1 overflow-auto px-4.5 py-3",children:e.map((t)=>rd.jsxs("button",{type:"button",onClick:()=>Dt.act.pick(t.k),className:"grid w-full grid-cols-[18px_1fr_auto] items-center gap-2.5 rounded-sm px-2.5 py-1.5 text-left hover:bg-muted",children:[rd.jsx(Ei,{state:t.state}),rd.jsx("b",{className:"truncate font-medium",children:t.title}),rd.jsx("small",{className:"text-[11.5px] text-muted-foreground",children:t.line})]},t.k))})}var Eg=h(I(),1);var Xp=h(I(),1);var Bv=h(w(),1);function oY({id:e}){return Bv.jsx(ba,{title:"This run's agent is running in another terminal",help:"One conversation cannot run in two places. Close it there, then open it here.",children:Bv.jsxs(M,{onClick:()=>Dt.act.openHere(e.slice(5)),children:[Bv.jsx(L,{name:"refresh",className:"size-(--ico)"}),"Open here"]})})}var Pi=h(w(),1),Qk=(e)=>`${e*100}%`,jue={l:"shadow-[inset_3px_0_0_var(--accent)]",r:"shadow-[inset_-3px_0_0_var(--accent)]",t:"shadow-[inset_0_3px_0_var(--accent)]",b:"shadow-[inset_0_-3px_0_var(--accent)]"};function Uue({item:e,wsk:t,ws:n,live:o,shown:r}){switch(e.kind){case"agent":case"shell":return Pi.jsx(Qu,{sessionKey:e.key});case"history":return Pi.jsx(nY,{});case"wait":return Pi.jsx(oY,{id:e.id});case"local":return Pi.jsx(pK,{wsk:t,live:o,shown:r});case"note":return Pi.jsx("iframe",{className:"rframe",title:e.title,src:`/notebook?dir=${encodeURIComponent(n?.dir??"")}&note=${encodeURIComponent(e.note)}&embed=1`});default:return Pi.jsx(fK,{live:o})}}function rY({item:e,rect:t,wsk:n,ws:o,sid:r,split:a,focus:i,live:s}){let[l,c]=Xp.useState(null),d=mo((m)=>m.dragging),u=d&&d!==e.id;Xp.useEffect(()=>{if(!d)c(null)},[d]);let p=Fe((m)=>m.focus.id===e.id?m.focus.n:0),f=Xp.useRef(null);Xp.useEffect(()=>{if(!p)return;let m=requestAnimationFrame(()=>f.current?.querySelector("textarea,input,iframe")?.focus());return()=>cancelAnimationFrame(m)},[p]);let g=t&&{left:Qk(t.l),top:Qk(t.t),width:Qk(t.w),height:Qk(t.h)};return Pi.jsxs("section",{className:C("rpane absolute flex min-h-0 min-w-0 flex-col bg-background pt-2 has-[.term]:bg-[var(--term-bg,var(--bg))]",!t&&"hidden",a&&"focus-within:after:absolute focus-within:after:inset-0 focus-within:after:z-3 focus-within:after:pointer-events-none focus-within:after:shadow-[inset_0_0_0_1px_var(--ring-soft)] focus-within:after:content-['']",i&&"focus outline outline-1 -outline-offset-1 outline-(--ring-soft)",l&&jue[l]),"data-t":e.id,ref:f,hidden:!t,style:g,onPointerDown:()=>gw(n,e.id),onDragOver:(m)=>{if(!u)return;m.preventDefault();let y=m.currentTarget.getBoundingClientRect();c(bR((m.clientX-y.left)/y.width,(m.clientY-y.top)/y.height))},onDragLeave:()=>c(null),onDrop:(m)=>{if(!u||!r)return;m.preventDefault();let y=m.currentTarget.getBoundingClientRect(),b=bR((m.clientX-y.left)/y.width,(m.clientY-y.top)/y.height);c(null),hw(n,d,r,{pane:e.id,dir:b==="l"||b==="r"?"cols":"rows",before:b==="l"||b==="t"}),wm(null)},children:[Pi.jsx("header",{className:C("ph flex h-(--pane-h) cursor-default active:cursor-grabbing items-center justify-between gap-1.5 px-2.5 pt-1 text-[11px] text-muted-foreground",!a&&"hidden"),draggable:!0,onDragStart:(m)=>{wm(e.id),m.dataTransfer.setData("text/plain",e.id),m.dataTransfer.effectAllowed="move"},onDragEnd:()=>wm(null),children:Pi.jsx(t$,{id:e.id})}),Pi.jsx(Uue,{item:e,wsk:n,ws:o,live:s,shown:s&&!!t})]})}var iY=h(w(),1);function aY({g:e,wsk:t,sid:n,box:o}){let r=e.dir==="cols",a=(i)=>`${i*100}%`;return iY.jsx("div",{role:"separator","aria-orientation":r?"vertical":"horizontal",onPointerDown:(i)=>{i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),document.body.classList.add("rdrag");let s=(c)=>{let d=o();rI(t,n,e.path,e.i,Kz(e,r?(c.clientX-d.left)/d.width:(c.clientY-d.top)/d.height))},l=()=>{removeEventListener("pointermove",s),removeEventListener("pointerup",l),removeEventListener("pointercancel",l),document.body.classList.remove("rdrag"),Zz()};addEventListener("pointermove",s),addEventListener("pointerup",l),addEventListener("pointercancel",l)},style:r?{left:`calc(${a(e.x)} - 0.5px)`,top:a(e.y),height:a(e.len),width:1}:{top:`calc(${a(e.y)} - 0.5px)`,left:a(e.x),width:a(e.len),height:1},className:C("absolute z-2 touch-none bg-border after:absolute after:content-['']",r?"after:inset-x-[-4px] after:inset-y-0 after:cursor-col-resize":"after:inset-x-0 after:inset-y-[-4px] after:cursor-row-resize")})}var Qp=h(w(),1);function sY(){F8();let e=Fe((g)=>g.wsk),t=Fe((g)=>g.items),n=Fe((g)=>g.kept),o=Fe((g)=>g.empty),r=Fe((g)=>g.ws),a=mo((g)=>e?g.all[e]:void 0),i=a?.screens.find((g)=>g.id===a.on),s=Eg.useRef(null),l=Eg.useRef({}),c=Eg.useRef([]),{panes:d,guts:u}=Eg.useMemo(()=>i?pw(i.tree):{panes:{},guts:[]},[i?.tree]),p=Object.entries(n).filter(([g])=>g!==e).map(([g,m])=>[g,m.items,m.ws]);if(e)p.push([e,t,r]);for(let[g]of p)if(!c.current.includes(g))c.current.push(g);p.sort((g,m)=>c.current.indexOf(g[0])-c.current.indexOf(m[0]));for(let[g,m]of p){let y=m.map((x)=>x.id),b=l.current[g]??[];l.current[g]=[...b.filter((x)=>y.includes(x)),...y.filter((x)=>!b.includes(x))]}let f=!!i&&vn(i.tree).length>1;return Qp.jsxs("div",{ref:s,className:"absolute inset-0",children:[p.flatMap(([g,m,y])=>l.current[g].map((b)=>{let x=m.find((k)=>k.id===b),v=g===e;return Qp.jsx(rY,{item:x,rect:v?d[b]:void 0,wsk:g,ws:y,sid:v?i?.id??null:null,split:v&&f,focus:v&&f&&i?.focus===b,live:v},g+"|"+b)})),e&&i&&u.map((g)=>Qp.jsx(aY,{g,wsk:e,sid:i.id,box:()=>s.current.getBoundingClientRect()},g.path.join(".")+"/"+g.i)),o&&Qp.jsx("div",{className:"absolute inset-0 overflow-auto",children:Qp.jsx(p$,{})})]})}var ur=h(w(),1);function lY(){let e=Fe((n)=>n.picker);if(!e)return null;let t=(n)=>ur.jsxs(nn,{onSelect:()=>Dt.act.pick(n.k),"aria-current":n.k===e.cur.k||void 0,className:C("min-h-[30px] gap-2 text-sm max-[640px]:min-h-11",n.k===e.cur.k&&"bg-muted text-foreground"),children:[ur.jsx(Ei,{state:n.state}),ur.jsx("b",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:n.title}),ur.jsx("small",{className:"shrink-0 text-xs text-muted-foreground",children:n.line})]},n.k);return ur.jsxs(En,{children:[ur.jsx(An,{asChild:!0,children:ur.jsxs("button",{type:"button",title:"Choose a run",className:"-ml-2 flex min-h-[30px] w-full items-center gap-2 rounded-sm px-2 text-foreground hover:bg-muted max-[640px]:min-h-11 [&[aria-expanded=true]_svg:last-child]:rotate-180",children:[ur.jsx(Ei,{state:e.cur.state}),ur.jsx("b",{className:"min-w-0 flex-1 truncate text-sm font-medium leading-[1.4]",children:e.cur.title}),e.other&&ur.jsx("i",{title:"Another run needs you",className:"size-[7px] shrink-0 rounded-full bg-warning"}),ur.jsx(L,{name:"chev",className:"size-3 shrink-0 text-muted-foreground transition-transform"})]})}),ur.jsxs(Mn,{align:"start",className:"max-h-[min(60vh,420px)] w-(--radix-dropdown-menu-trigger-width) min-w-[260px] overflow-y-auto",children:[e.live.map(t),e.hist.length>0&&ur.jsxs(ur.Fragment,{children:[ur.jsx(k1,{className:"pt-2 text-xs",children:"History"}),e.hist.map(t)]})]})]})}var cY=h(I(),1);var xo=h(w(),1);function uY(){let e=Nt((n)=>n.snap),t=Nt((n)=>n.form);if(cY.useEffect(()=>{if(!e||!t||t.mode==="new")return;if(![...e.allCards,...jx(e.backlogItems)].some((n)=>Tn(n)===t.key))ym()},[e,t]),!e)return null;if(e.mode==="ws")return xo.jsx(xo.Fragment,{children:e.wsNames.map((n,o)=>xo.jsxs("section",{className:"pt-2",children:[xo.jsxs("h2",{className:"sticky top-0 z-[1] flex h-8 items-center gap-2 bg-background px-0.5 text-[13px] font-medium shadow-[0_-12px_0_var(--bg)]",children:[n," ",xo.jsx("i",{className:"text-xs font-normal not-italic text-muted-foreground empty:hidden",children:e.ws[o].length||""})]}),xo.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.ws[o].map((r)=>xo.jsx(Bq,{w:r},r.dir+r.path)),!e.ws[o].length&&xo.jsx("p",{className:"px-0.5 py-2 text-sm text-muted-foreground",children:"Empty"})]})]},n))});return xo.jsxs(xo.Fragment,{children:[!e.cards.length&&t?.mode!=="new"&&xo.jsxs("div",{className:"col-span-full flex flex-col items-center gap-3 py-[60px] text-center text-muted-foreground",children:[xo.jsx("b",{className:"text-[16px] font-semibold text-foreground",children:e.archive?"Nothing archived":"Nothing here yet"}),!e.archive&&xo.jsxs(xo.Fragment,{children:[xo.jsx("p",{className:"mb-1.5 max-w-[44ch]",children:"Add a task and kaizen will plan it, build it, and check the result."}),xo.jsx(M,{variant:"primary",onClick:()=>O.newTask(),children:"New task"})]})]}),[0,1,2,3,4].map((n)=>xo.jsx(Dq,{ci:n},n))]})}var Zp=h(I(),1);var Uo=h(w(),1);function dY(){let e=el(),t=Zp.useRef(null),n=Zp.useRef(!0),{cur:o,chats:r,side:a,sending:i,remoteBusy:s,files:l,here:c}=e,d=!o||!o.messages.length,u=i||s,p=(y)=>Q1(y,O.projects()),f=o?.id??null,g=Zp.useRef({cur:o,k:String(f)});if(g.current.cur!==o)g.current={cur:o,k:String(f)};Zp.useEffect(()=>void(n.current=!0),[f]),Zp.useEffect(()=>{let y=t.current;if(y&&n.current)y.scrollTop=y.scrollHeight});let m=matchMedia("(max-width:640px)").matches;return Uo.jsxs(Uo.Fragment,{children:[Uo.jsx("div",{className:C("flex-none overflow-hidden border-r border-border/60 transition-[width,opacity,border-color] duration-300",a?"w-[260px]":"w-0 border-transparent opacity-0","max-[640px]:absolute max-[640px]:inset-y-0 max-[640px]:left-0 max-[640px]:z-[6] max-[640px]:w-[280px] max-[640px]:max-w-[85%] max-[640px]:bg-card max-[640px]:opacity-100 max-[640px]:shadow-md max-[640px]:transition-transform",a?"max-[640px]:translate-x-0":"max-[640px]:-translate-x-[105%]"),children:Uo.jsx(IV,{chats:r,current:f,onOpen:(y)=>(m&&pg(!1),void fg(y)),onDelete:(y)=>void nV(y.id,y.title)})}),a&&Uo.jsx("div",{className:"absolute inset-0 z-[5] hidden bg-[var(--shade)] max-[640px]:block",onClick:()=>pg(!1)}),Uo.jsxs("div",{className:C("flex min-h-0 min-w-0 flex-1 flex-col items-center gap-3 pb-4",d&&"justify-start"),children:[Uo.jsx("div",{className:"flex items-center gap-1 self-stretch px-4 pt-2 max-[640px]:hidden",children:Uo.jsx(me,{id:"htog",size:"sm",icon:"side",label:a?"Hide chats":"Show chats","aria-expanded":a,onClick:()=>pg(!a)})}),Uo.jsx("div",{id:"hlog",ref:t,"aria-live":"polite",onWheel:(y)=>{let b=t.current;if(y.deltaY<0&&b.scrollHeight>b.clientHeight)n.current=!1},onScroll:()=>{let y=t.current;n.current=y.scrollHeight-y.scrollTop-y.clientHeight<=0.5},className:C("box-border flex w-full flex-col gap-4 px-[max(20px,calc((100%-960px)/2))] py-2 [overflow-anchor:none] max-[640px]:px-4",d?"mt-auto flex-none max-[640px]:my-auto":"flex-1 overflow-y-auto"),children:d?Uo.jsxs("div",{className:"w-full text-center animate-hin",children:[Uo.jsx("h2",{className:"mb-1.5 text-[28px] font-semibold tracking-[-0.01em] text-strong max-[640px]:text-[22px]",children:c?`What should we do in ${p(c)}?`:"What should we work on?"}),Uo.jsxs("p",{className:"text-muted-foreground",children:[c?"Ask about this project or another one, or start a new one.":"Name a project, or describe a new one and the agent will set it up."," ","Bigger work becomes a kaizen run on the Board."]})]}):o.messages.map((y,b)=>Uo.jsx(jV,{m:y,last:b===o.messages.length-1,busy:u},`${g.current.k}:${b}`))}),Uo.jsx(HV,{chatId:f,files:l,working:u,sending:i,where:d?void 0:o.project?p(o.project):"No project"}),d&&Uo.jsx("div",{className:"flex w-[calc(100%-40px)] max-w-[960px] flex-wrap justify-center gap-2 animate-hin mb-auto max-[640px]:order-1 max-[640px]:mb-0 max-[640px]:w-full max-[640px]:flex-nowrap max-[640px]:justify-start max-[640px]:overflow-x-auto max-[640px]:px-4 [&::-webkit-scrollbar]:hidden",children:KF.map((y)=>Uo.jsx("button",{type:"button",onClick:()=>In({suggest:{text:y}}),className:"flex-none whitespace-nowrap rounded-full border border-border px-3 py-1 text-base text-muted-foreground transition hover:-translate-y-px hover:bg-muted hover:text-foreground",children:y},y))})]})]})}var ef=h(I(),1);var Hv=h(w(),1);function pY({board:e,count:t,pressed:n,onPress:o}){return Hv.jsxs(ac,{count:t,pressed:n,onPressedChange:o,title:e.client?"A client's collection: its items are Client":void 0,children:[e.client&&Hv.jsx(cg,{}),Hv.jsx("span",{children:e.name})]})}var Oi=h(w(),1);function fY({count:e,busy:t,onPromote:n,onSnooze:o,onDismiss:r,onClear:a}){return Oi.jsxs("div",{role:"toolbar","aria-label":"Selected requests",className:"sticky top-0 z-[1] flex items-center gap-2 rounded-t-md border border-b-0 border-[color:color-mix(in_srgb,var(--line)_50%,transparent)] bg-[color-mix(in_srgb,var(--dim)_12%,var(--bg-2))] py-1.5 pr-2 pl-3.5 text-base text-foreground",children:[Oi.jsxs("span",{children:[e," selected"]}),Oi.jsx("span",{className:"flex-1"}),Oi.jsxs(M,{size:"sm",title:"Promote (p)",disabled:t,onClick:n,children:[Oi.jsx(L,{name:"plus",className:"size-3.5"})," Promote"]}),Oi.jsxs(M,{variant:"ghost",size:"sm",title:"Snooze a week (h)",disabled:t,onClick:o,children:[Oi.jsx(L,{name:"clock",className:"size-3.5"})," Snooze"]}),Oi.jsxs(M,{variant:"ghost",size:"sm",title:"Dismiss (d)",disabled:t,onClick:r,children:[Oi.jsx(L,{name:"x",className:"size-3.5"})," Dismiss"]}),Oi.jsx(M,{variant:"ghost",size:"sm",title:"Clear selection (Esc)",onClick:a,children:"Clear"})]})}var jv=h(I(),1);var Zn=h(w(),1),Gue=`
112
+ `;function mY({to:e,projects:t,boards:n,board:o}){let r=_n((u)=>u.cap),a=pu(),i=jv.useRef(null),s=jv.useRef(null),l=()=>i.current?.focus();jv.useEffect(()=>{if(i.current&&i.current.value!==r.text)i.current.value=r.text},[r.text]);let c=(u)=>{ta({files:[..._n.getState().cap.files,...u]}),l()},d=()=>void fF(e,l);return Zn.jsxs("div",{className:"mb-3.5 mt-1 flex flex-col gap-1.5 rounded-lg border border-border bg-card py-3 pr-3 pl-4 shadow-sm transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--accent)_60%,var(--line))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--accent)_12%,transparent)] max-sm:mb-2.5 max-sm:rounded-md max-sm:py-2.5 max-sm:pr-2.5 max-sm:pl-3.5",children:[Zn.jsx(xn,{ref:i,id:"ice-cap-t",rows:2,defaultValue:r.text,readOnly:r.busy,"aria-label":"Drop anything into the icebox",placeholder:a?"Drop a note, link or picture…":"Drop anything: a note, a link, a picture — or dictate",onInput:(u)=>ta({text:u.currentTarget.value}),onKeyDown:(u)=>{if(u.key==="Enter"&&!u.shiftKey&&!u.nativeEvent.isComposing)u.preventDefault(),d()},onPaste:(u)=>{for(let p of u.clipboardData.items)if(p.kind==="file"){let f=p.getAsFile();u.preventDefault(),c([new File([f],f.name==="image.png"?`paste-${Date.now()}.png`:f.name,{type:f.type})])}},className:"max-h-60 min-h-12 [field-sizing:content] py-0.5 text-[14px] leading-[1.55] read-only:opacity-60 max-sm:min-h-6 max-sm:text-[15px]"}),r.files.length>0&&Zn.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.files.map((u,p)=>Zn.jsxs("span",{className:"inline-flex max-w-[260px] items-center gap-1 rounded-sm border border-border py-0 pr-0.5 pl-2 text-sm text-muted-foreground",children:[Zn.jsx(L,{name:"clip",className:"size-3"}),Zn.jsx("span",{className:"truncate",children:u.name}),Zn.jsx(me,{icon:"x",label:`Remove ${u.name}`,className:"size-6",onClick:()=>{ta({files:r.files.filter((f,g)=>g!==p)}),l()}})]},p))}),Zn.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 max-sm:flex-nowrap max-sm:gap-0.5",children:[Zn.jsx(me,{icon:"clip",label:"Attach files",className:"size-[30px] border border-border max-sm:size-11 max-sm:border-0",onClick:()=>s.current?.click()}),Zn.jsx("input",{ref:s,type:"file",multiple:!0,hidden:!0,onChange:(u)=>{let p=[...u.target.files??[]];u.target.value="",c(p)}}),Zn.jsx(sc,{field:i,className:"[&>button]:size-[30px] [&>button]:rounded-sm [&>button]:border [&>button]:border-border max-sm:[&>button]:size-11 max-sm:[&>button]:border-0"}),t.length>0&&Zn.jsx(Ni,{label:"Project",placeholder:"Choose project",className:"h-[30px] text-sm max-sm:h-[30px] max-sm:max-w-[120px] max-sm:border-transparent max-sm:bg-muted",value:e??"",options:t.map((u)=>({value:u.dir,label:Ar(u.label),search:u.label,icon:Zn.jsx(zn,{dir:u.dir,label:u.label})})),onChange:(u)=>ta({dir:u})}),Zn.jsx(Ni,{label:"Collection",className:"h-[30px] text-sm max-sm:max-w-[120px] max-sm:border-transparent max-sm:bg-muted",value:o,options:[{value:"",label:"Inbox"},...n.map((u)=>({value:u.name,label:u.name,icon:u.client?Zn.jsx(cg,{}):void 0})),...o&&!n.some((u)=>lc(u.name,o))?[{value:o,label:`${o} (new)`}]:[],{value:Gue,label:"New collection…",icon:Zn.jsx(L,{name:"plus",className:"size-3.5"})}],onChange:async(u)=>{await gF(u,e),l()}}),Zn.jsx("span",{className:"flex-1"}),Zn.jsxs(M,{variant:"primary",size:"sm","aria-label":"Save to the icebox",disabled:r.busy,onClick:d,className:"h-[30px] px-3.5 max-sm:size-11 max-sm:min-w-11 max-sm:rounded-full max-sm:p-0",children:[Zn.jsx(L,{name:"send",className:"hidden size-[17px] max-sm:block"}),Zn.jsx("span",{className:"max-sm:sr-only",children:r.busy?"Saving…":"Save ↵"})]})]})]})}var Jp=h(I(),1);var Sa=h(w(),1);function gY({where:e,onDone:t}){let[n,o]=Jp.useState(""),[r,a]=Jp.useState(!1),i=Jp.useRef(null),s=Jp.useId();return Sa.jsx(Ga,{open:!0,onOpenChange:(l)=>!l&&t(null),children:Sa.jsxs(Fa,{"aria-describedby":void 0,children:[Sa.jsx(ga,{className:"sr-only",children:"New collection"}),Sa.jsxs("form",{className:"flex flex-col gap-2.5",onSubmit:(l)=>{if(l.preventDefault(),!n.trim())return i.current?.focus();t({name:n.trim(),client:r})},children:[Sa.jsx(Se,{label:`New collection${e?` in ${e}`:""}: a client or a topic`,children:(l)=>Sa.jsx(Ue,{...l,ref:i,value:n,onChange:(c)=>o(c.target.value),maxLength:40,placeholder:"e.g. Arupadatu, Pricing",autoComplete:"off",spellCheck:!1})}),Sa.jsxs("div",{className:"flex items-center gap-2 text-base text-muted-foreground",children:[Sa.jsx(Hr,{id:s,checked:r,onCheckedChange:(l)=>a(l===!0)}),Sa.jsx("label",{htmlFor:s,className:"cursor-pointer",children:"A client — its items count as Client"})]}),Sa.jsxs("div",{className:"flex justify-end gap-1.5",children:[Sa.jsx(M,{onClick:()=>t(null),children:"Cancel"}),Sa.jsx(M,{variant:"primary",type:"submit",children:"Create"})]})]})]})})}var hY=h(I(),1);var Uv=h(w(),1);function kc({url:e,social:t,fallback:n="link",size:o=16}){let[r,a]=hY.useState(!1),i=qG(e);return Uv.jsx("span",{className:"inline-flex shrink-0 items-center justify-center",style:{width:o,height:o},children:t&&cc[t]?Uv.jsx(L,{name:"b-"+t,style:{width:o-2,height:o-2}}):i&&!r?Uv.jsx("img",{src:i,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>a(!0),className:"rounded-xs bg-white p-px",style:{width:o,height:o}}):Uv.jsx(L,{name:n,style:{width:o-2,height:o-2}})})}var bY=h(w(),1),Fue={client:"text-kind-client",finding:"text-kind-finding",people:"text-kind-people"};function ad({kind:e,className:t}){return bY.jsx("span",{className:C("whitespace-nowrap text-[11px] font-semibold uppercase tracking-[.06em]",e&&Fue[e]||"text-muted-foreground",t),children:e&&Ip[e]||"Unsorted"})}var Ag=h(w(),1);function Zk({label:e,choices:t,onPick:n,children:o}){return Ag.jsxs(En,{children:[Ag.jsx(An,{asChild:!0,children:o}),Ag.jsx(Mn,{"aria-label":e,className:"max-h-[min(360px,calc(100vh-16px))] min-w-[200px] overflow-y-auto",children:t.map((r)=>Ag.jsx(nn,{onSelect:()=>n(r.value),"aria-current":r.on||void 0,className:C(r.on&&"bg-muted font-medium text-foreground"),children:r.label},r.value))})]})}var cl=h(w(),1);function Gv({item:e,boards:t,children:n}){return cl.jsx(Zk,{label:"Collection",choices:[{value:"",label:"Inbox",on:!e.board},...t.filter((o)=>o.dir===e.dir).map((o)=>({value:o.name,on:lc(e.board,o.name),label:cl.jsxs(cl.Fragment,{children:[o.client&&cl.jsx(cg,{}),o.name]})})),{value:`
113
+ `,label:cl.jsxs(cl.Fragment,{children:[cl.jsx(L,{name:"plus",className:"size-3.5"}),"New collection…"]})}],onPick:(o)=>void oF(e,o),children:n})}var vY=h(w(),1);function Mg({item:e,children:t}){return vY.jsx(Zk,{label:"Kind",choices:Object.entries(Ip).map(([n,o])=>({value:n,label:o,on:e.kind===n&&e.sorted!=="rules"})),onPick:(n)=>void _A(e,{op:"kind",kind:n},`Kind: ${Ip[n]}`),children:t})}var Fv=h(I(),1);var ul=h(w(),1),Vue=[["1d","Tomorrow"],["1w","Next week"],["1m","Next month"]];function Vv({onPick:e,children:t,anchor:n,open:o,onOpenChange:r}){let[a,i]=Fv.useState(!1),s=o??a,l=(g)=>(i(g),r?.(g)),[c,d]=Fv.useState(""),u=Fv.useRef(null),p=(g)=>GG(new Date(Date.now()+g*86400000)),f=(g)=>{l(!1),e(g)};return ul.jsxs(rr,{open:s,onOpenChange:l,children:[n?ul.jsx(DU,{asChild:!0,children:n}):ul.jsx(ar,{asChild:!0,children:t}),ul.jsxs(ir,{role:"menu","aria-label":"Snooze until",className:"flex w-[220px] flex-col",onKeyDown:(g)=>{let m=[...g.currentTarget.querySelectorAll("button,input")],y=m.indexOf(document.activeElement);if((g.key==="ArrowDown"||g.key==="ArrowUp")&&document.activeElement?.type!=="date")g.preventDefault(),m[(y+(g.key==="ArrowDown"?1:m.length-1))%m.length]?.focus()},children:[Vue.map(([g,m])=>ul.jsx("button",{type:"button",role:"menuitem",onClick:()=>f(g),className:"rounded-sm px-2 py-1.5 text-left text-muted-foreground hover:bg-muted hover:text-foreground",children:m},g)),ul.jsxs("div",{className:C("mt-1 flex gap-1.5 border-t border-border px-1 pt-1.5"),children:[ul.jsx(Ue,{ref:u,type:"date","aria-label":"Snooze until",min:p(1),max:p(365),value:c,onChange:(g)=>d(g.target.value),className:"h-7 min-w-0 flex-1 text-sm"}),ul.jsx(M,{size:"sm",onClick:()=>c?f(c):u.current?.focus(),children:"Snooze"})]})]})]})}var hn=h(w(),1);function Dg({item:e,boards:t,variant:n,className:o}){let r=e.status==="promoted"||e.status==="done",a=ea(e),i=e.text,s=n!=="row",l=(d)=>C("gap-1.5",d),c=r?null:e.status==="dismissed"?hn.jsx(M,{variant:"ghost",size:"sm",title:"Restore to waiting","aria-label":`Restore: ${i}`,onClick:()=>void dc("restore",e,"Restored"),children:"Restore"}):s&&n==="phone"?hn.jsxs(M,{variant:"ghost",size:"sm","aria-label":`Dismiss: ${i}`,className:"min-h-11",onClick:()=>void dc("dismiss",e,"Dismissed"),children:[hn.jsx(L,{name:"x",className:"size-3.5"}),"Dismiss"]}):hn.jsx(me,{icon:"x",label:"Dismiss (d)","aria-label":`Dismiss: ${i}`,className:"size-7",onClick:()=>void dc("dismiss",e,"Dismissed")});if(n==="phone")return hn.jsxs("div",{className:C("flex flex-wrap items-center gap-1",o),children:[a&&hn.jsx(Vv,{onPick:(d)=>void pc([e],d),children:hn.jsxs(M,{variant:"ghost",size:"sm","aria-label":`Snooze: ${i}`,className:"min-h-11 gap-1.5",children:[hn.jsx(L,{name:"clock",className:"size-3.5"}),"Snooze"]})}),a&&hn.jsx(Gv,{item:e,boards:t,children:hn.jsx(M,{variant:"ghost",size:"sm","aria-label":`Collection: ${i}`,className:"min-h-11",children:e.board||"Inbox"})}),hn.jsx("span",{className:"flex-1"}),c]});return hn.jsxs("div",{className:C("flex items-center gap-0.5",o),children:[!r&&(s?hn.jsxs(M,{variant:"ghost",size:"sm",title:"Promote to Tasks (p)","aria-label":`Promote to Tasks: ${i}`,className:l(),onClick:()=>Lp(e),children:[hn.jsx(L,{name:"arrow",className:"size-[13px]"}),"Task"]}):hn.jsx(me,{icon:"plus",label:"Promote to Tasks (p)","aria-label":`Promote to Tasks: ${i}`,className:"size-7",onClick:()=>Lp(e)})),a&&hn.jsx(Vv,{onPick:(d)=>void pc([e],d),children:s?hn.jsxs(M,{variant:"ghost",size:"sm","aria-label":`Snooze: ${i}`,className:l(),children:[hn.jsx(L,{name:"clock",className:"size-[13px]"}),"Snooze"]}):hn.jsx(me,{icon:"clock",label:"Snooze (h: a week)","aria-label":`Snooze: ${i}`,className:"size-7"})}),a&&s&&hn.jsx(Mg,{item:e,children:hn.jsx(M,{variant:"ghost",size:"sm","aria-label":`Kind: ${i}`,children:"Kind"})}),a&&s&&hn.jsx(Gv,{item:e,boards:t,children:hn.jsx(M,{variant:"ghost",size:"sm","aria-label":`Collection: ${i}`,children:"Collection"})}),s&&hn.jsx("span",{className:"flex-1"}),c]})}var Sc=h(w(),1);function Pg({item:e}){return Sc.jsxs(Sc.Fragment,{children:[e.status==="done"&&e.written&&Sc.jsx("span",{title:`Written back ${Er(e.written)}`,children:"written back"}),e.status==="done"&&e.writeError&&Sc.jsx("span",{title:e.writeError,children:"write-back failed"}),e.status==="promoted"&&Sc.jsx("span",{title:`Promoted to Tasks: ${e.idea||""}`,children:"promoted"}),e.replied&&Sc.jsx("span",{title:`Replied ${Er(e.replied)}`,children:"replied"})]})}var yY=h(I(),1);var Og=h(w(),1);function _g({item:e,card:t}){let[n,o]=yY.useState(!1),r=U1(e).length;if(!r)return null;return Og.jsxs("details",{onToggle:(a)=>o(a.currentTarget.open),className:"text-sm text-muted-foreground open:flex open:flex-wrap open:gap-1.5",children:[Og.jsx("summary",{className:"basis-full cursor-pointer",title:t?"Loads them from the source's site":void 0,children:t?`${r} pictures · show`:`Show images (${r}) — loads them from the source's site`}),n&&Array.from({length:r},(a,i)=>{let s=`/ice-image?dir=${encodeURIComponent(e.dir)}&id=${encodeURIComponent(e.id)}&i=${i}`;return Og.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:Og.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",className:"h-[72px] max-w-[120px] rounded-xs border border-border object-cover"})},i)})]})}var Un=h(w(),1);function xY({item:e,ctx:t}){let n=Te(e),o=t.cur===n,r=e.link&&/^https?:\/\//i.test(e.link.url)?e.link:null,a=r?cs(r.url).replace(/^www\./,""):"";return Un.jsxs("article",{"data-cur":o||void 0,"data-key":n,onFocusCapture:()=>!o&&W({cur:n}),className:"group/card relative mb-3 flex break-inside-avoid flex-col rounded-lg border border-[color:color-mix(in_srgb,var(--line)_80%,transparent)] bg-card shadow-sm hover:border-border hover:shadow-md data-[cur]:border-border data-[cur]:shadow-md data-[cur]:outline data-[cur]:outline-1 data-[cur]:outline-border",children:[r&&Un.jsxs("a",{href:qu(r.url),target:"_blank",rel:"noopener noreferrer",style:{"--h":B1(a)},className:"group/lk flex min-h-[88px] flex-col justify-end gap-[3px] rounded-t-lg bg-[hsl(var(--h)_42%_40%)] px-3 pb-2.5 pt-3.5 text-white",children:[Un.jsx("b",{className:"break-words text-base leading-[1.35] group-hover/lk:underline",children:r.title||a}),r.summary&&Un.jsx("span",{className:"line-clamp-2 text-sm leading-[1.4] opacity-90",children:r.summary}),Un.jsx("small",{className:"text-xs opacity-85",children:a})]}),Un.jsxs("div",{className:"flex flex-col gap-2 px-3 pb-2.5 pt-3",children:[Un.jsxs("div",{className:"flex min-h-4 items-center gap-2",children:[Un.jsx(ad,{kind:e.kind}),e.sorted==="rules"&&ea(e)&&Un.jsx("span",{className:"text-xs italic text-muted-foreground",title:"Kind set by a rule: pick one with Kind",children:"unsorted"}),Un.jsx("span",{className:"ml-auto inline-flex items-center gap-2.5 text-xs text-muted-foreground",children:Un.jsx(Pg,{item:e})})]}),Un.jsx("button",{type:"button","data-title":!0,title:"Open in the Sort list",onClick:()=>MF(e),className:"line-clamp-6 cursor-pointer whitespace-pre-line break-words bg-transparent text-left text-[14px] leading-[1.45] text-foreground hover:underline hover:decoration-border hover:underline-offset-[3px]",children:e.text}),Un.jsx(_g,{item:e,card:!0}),Un.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-sm text-muted-foreground",children:[e.board&&Un.jsx("span",{className:"text-foreground",children:e.board}),(e.tags||[]).map((i)=>Un.jsxs("span",{className:"rounded-xs bg-muted px-1.5 text-xs leading-[18px]",children:["#",i]},i)),t.many&&Un.jsxs("span",{className:"inline-flex items-center gap-1.5",title:e.project||"",children:[Un.jsx(zn,{dir:e.dir,label:e.project||"",size:14}),Ar(e.project||"")]}),Un.jsx("span",{className:"flex-1"}),Un.jsxs("span",{className:"whitespace-nowrap tabular-nums",children:[e.source!=="manual"?`${Ri(t.list,e)} · `:"",Er(e.at)]})]})]}),Un.jsx(Dg,{item:e,boards:t.boards,variant:"card",className:"hidden border-t border-[color:color-mix(in_srgb,var(--line)_50%,transparent)] px-1.5 pb-1.5 pt-1 group-focus-within/card:flex group-hover/card:flex group-data-[cur]/card:flex [@media(hover:none)]:flex"})]})}var CY=h(I(),1);var Jk=h(I(),1);var Ca=h(w(),1);function wY({item:e,chat:t}){let n=Te(e),o=_n((c)=>c.form?.k===n?c.form:null),r=_n((c)=>c.task?.k===n?c.task:null),a=Jk.useRef(null),i=r?.wait?"Drafting a task with ChatGPT…":r?.kept?"ChatGPT's draft came after you started typing, so your words stay. Redraft to use it.":r?.note?`No draft: ${r.note}`:r?.title?"Drafted by ChatGPT. Edit it before promoting.":"",s=(c)=>W({form:{k:n,title:o?.title??e.text,details:o?.details??"",...c}}),l=()=>aF(e)||a.current?.focus();return Jk.useEffect(()=>{a.current?.focus(),a.current?.select()},[]),Ca.jsxs("div",{className:"grid gap-1.5 border-t border-border pt-2",children:[Ca.jsx(Se,{label:"Task title",children:(c)=>Ca.jsx(Ue,{...c,ref:a,maxLength:200,value:o?.title??e.text,onChange:(d)=>s({title:d.target.value}),onKeyDown:(d)=>{if(d.key==="Enter")l();if(d.key==="Escape")F1()}})}),Ca.jsx(Se,{label:"Details",children:(c)=>Ca.jsx(xn,{...c,rows:r?.details?5:3,value:o?.details??"",onChange:(d)=>s({details:d.target.value}),onKeyDown:(d)=>{if(d.key==="Enter"&&(d.ctrlKey||d.metaKey))l();if(d.key==="Escape")F1()},className:C(sv,"h-auto resize-y bg-card py-1.5")})}),i&&Ca.jsx("span",{role:"status",className:"text-sm text-muted-foreground",children:i}),Ca.jsxs("div",{className:"flex items-center gap-1.5",children:[t&&Ca.jsxs(M,{variant:"ghost",size:"sm",disabled:r?.wait,title:"Ask ChatGPT for another draft",onClick:()=>{W({task:null}),zA(e)},children:[Ca.jsx(L,{name:"ai",className:"size-3.5"}),r?.title?"Redraft":"Draft with ChatGPT"]}),Ca.jsx("span",{className:"flex-1"}),Ca.jsx(M,{variant:"ghost",size:"sm",onClick:F1,children:"Cancel"}),Ca.jsx(M,{variant:"primary",size:"sm",onClick:l,children:"Promote"})]})]})}var Gn=h(w(),1),kY=({dir:e,disabled:t})=>Gn.jsxs(Pt,{value:V1(e),onValueChange:(n)=>iF(e,n),disabled:t,children:[Gn.jsx(_t,{"aria-label":"Reply style",size:"sm",className:"w-auto",children:Gn.jsx(Ot,{})}),Gn.jsx(zt,{children:Object.entries(UG).map(([n,o])=>Gn.jsx(dt,{value:n,children:o},n))})]});function SY({item:e,chat:t}){let n=Te(e),o=_n((a)=>a.reply?.k===n?a.reply:null);if(_n((a)=>a.styles),!e.post)return null;if(e.replied)return Gn.jsxs("span",{className:"text-sm text-muted-foreground",children:["You replied to this post ",Er(e.replied),"."]});if(!o)return Gn.jsxs("div",{className:"flex items-center gap-1.5",children:[Gn.jsx("span",{className:"text-sm text-muted-foreground",children:"You review it before it posts."}),t&&Gn.jsx(kY,{dir:e.dir,disabled:!1}),Gn.jsx(M,{size:"sm",onClick:()=>void sF(e),children:"Reply"})]});if(o.wait)return Gn.jsx("span",{className:"text-sm text-muted-foreground",children:"Drafting…"});let r=!!(o.busy||o.again);return Gn.jsxs("div",{className:"grid gap-1.5 border-t border-border pt-2",children:[Gn.jsx(Se,{label:`Your reply${o.note?` · ${o.note}`:""}`,children:(a)=>Gn.jsx(xn,{...a,rows:3,maxLength:2000,disabled:r,value:o.text,onChange:(i)=>cF(i.target.value),onKeyDown:(i)=>i.key==="Escape"&&IA(),autoFocus:!0,className:C(sv,"h-auto resize-y bg-card py-1.5")})}),Gn.jsx("span",{className:"text-sm text-muted-foreground",children:o.again?"Writing another…":`${o.text.length} chars`}),Gn.jsxs("div",{className:"flex items-center gap-1.5",children:[Gn.jsx("span",{className:"flex-1"}),t&&Gn.jsx(kY,{dir:e.dir,disabled:r}),t&&Gn.jsx(M,{variant:"ghost",size:"sm",disabled:r,onClick:()=>void lF(e),children:"Regenerate"}),Gn.jsx(M,{variant:"ghost",size:"sm",disabled:!!o.busy,onClick:IA,children:"Cancel"}),Gn.jsx(M,{variant:"primary",size:"sm",disabled:r||!o.text.trim(),onClick:()=>void uF(e),children:o.busy?"Sending…":"Send reply"})]})]})}var Wa=h(w(),1);function eS({item:e,ctx:t,chat:n,phone:o}){return Wa.jsxs("div",{className:C("-mt-px grid gap-2 rounded-b-sm bg-muted py-1.5 pr-3 pb-3 pl-[61px]",o&&"pl-3"),children:[e.notes&&Wa.jsx("div",{className:"whitespace-pre-wrap break-words text-sm leading-[1.45] text-muted-foreground",children:e.notes}),Wa.jsx(_g,{item:e}),Wa.jsxs("span",{className:"text-sm text-muted-foreground",children:["From ",Ri(t.list,e)," · ",Er(e.at),e.post&&Wa.jsxs(Wa.Fragment,{children:[" · ",Wa.jsx("a",{href:qu(e.post),target:"_blank",rel:"noopener",className:"underline",children:"open post"})]})]}),o&&ea(e)&&Wa.jsx(Dg,{item:e,boards:t.boards,variant:"phone"}),Wa.jsx(SY,{item:e,chat:n}),t.armed===Te(e)&&Wa.jsx(wY,{item:e,chat:n})]})}var gt=h(w(),1);function NY({item:e,ctx:t,chat:n}){let o=Te(e),r=t.open===o,a=t.cur===o,i=ea(e),s=e.status==="promoted"||e.status==="done",[l,c]=CY.useState(!1),d=LF({enabled:i,onDecide:(g)=>rF(e,g),onHold:()=>{W({cur:o}),c(!0)}}),u=e.link&&/^https?:\/\//i.test(e.link.url)?e.link:null,p=u?cs(u.url).replace(/^www\./,""):"",f=U1(e).length;return gt.jsxs("div",{children:[gt.jsxs("div",{ref:d.row,"data-cur":a||void 0,"data-key":o,className:"group/pr relative overflow-hidden border-b border-[color:color-mix(in_srgb,var(--line)_30%,transparent)]",children:[gt.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 flex items-center justify-between bg-muted px-[18px] text-base font-semibold text-white group-data-[dir=dis]/pr:bg-[color-mix(in_srgb,var(--dim)_85%,var(--ink))] group-data-[dir=pro]/pr:bg-promote",children:[gt.jsxs("span",{className:"inline-flex items-center gap-1.5 opacity-[calc(.35+var(--p,0)*.65)] invisible group-data-[dir=pro]/pr:visible",children:[gt.jsx(L,{name:"check",className:"size-4"}),"Task"]}),gt.jsxs("span",{className:"inline-flex items-center gap-1.5 opacity-[calc(.35+var(--p,0)*.65)] invisible group-data-[dir=dis]/pr:visible",children:["Dismiss",gt.jsx(L,{name:"x",className:"size-4"})]})]}),gt.jsx(Vv,{open:l,onOpenChange:c,onPick:(g)=>void pc([e],g),anchor:gt.jsxs("div",{ref:d.fg,onPointerDown:d.onPointerDown,className:C("relative flex touch-pan-y items-center gap-2.5 bg-background py-3 pr-1.5 pl-1 transition-[transform,opacity] duration-200 ease-[cubic-bezier(.3,1.3,.5,1)] group-data-[drag]/pr:transition-none motion-reduce:transition-none",(a||r)&&"bg-muted"),children:[gt.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[gt.jsxs("div",{className:"flex min-h-5 items-center gap-1.5",children:[i?gt.jsx(Mg,{item:e,children:gt.jsx("button",{type:"button","aria-label":`Kind: ${e.text}`,title:"Kind",className:"min-h-7 rounded-xs px-1 text-[10px]",children:gt.jsx(ad,{kind:e.kind})})}):gt.jsx(ad,{kind:e.kind}),e.sorted==="rules"&&i&&gt.jsx("span",{className:"text-xs italic text-muted-foreground",children:"unsorted"}),gt.jsx("span",{className:"flex gap-1.5 text-xs text-muted-foreground",children:gt.jsx(Pg,{item:e})})]}),gt.jsx("button",{type:"button","data-title":!0,"aria-expanded":r,onClick:()=>Bp(e),className:"line-clamp-2 bg-transparent py-0.5 text-left text-[15px] leading-[1.35] text-foreground",children:e.text}),gt.jsxs("span",{className:"flex min-w-0 gap-2 text-sm text-muted-foreground",children:[t.many&&gt.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",title:e.project||"",children:[gt.jsx(zn,{dir:e.dir,label:e.project||"",size:14}),Ar(e.project||"")]}),e.board&&gt.jsx("span",{className:"truncate",children:e.board}),gt.jsx("span",{className:"whitespace-nowrap",children:Er(e.at)})]})]}),u?gt.jsx("span",{"aria-hidden":"true",title:u.title||p,style:{"--h":B1(p)},className:"grid size-10 shrink-0 place-items-center rounded-[9px] bg-[hsl(var(--h)_42%_40%)] text-base font-bold text-white",children:(p[0]||"").toUpperCase()}):f>0&&gt.jsxs("span",{"aria-hidden":"true",title:`${f} pictures`,className:"relative grid size-10 shrink-0 place-items-center rounded-[9px] bg-muted text-muted-foreground",children:[gt.jsx(L,{name:"img",className:"size-5"}),gt.jsx("i",{className:"absolute right-1 bottom-0.5 text-[10px] font-semibold not-italic",children:f})]}),!s&&(e.status==="dismissed"?gt.jsx(Kue,{item:e}):gt.jsx(M,{variant:"default","aria-label":`Make a task: ${e.text}`,title:"Make a task",className:"size-11 min-h-11 shrink-0 rounded-full p-0 text-muted-foreground shadow-none",onClick:()=>Lp(e),children:gt.jsx(L,{name:"arrow",className:"size-4"})}))]})})]}),r&&gt.jsx(eS,{item:e,ctx:t,chat:n,phone:!0})]})}function Kue({item:e}){return gt.jsx(M,{variant:"ghost",size:"sm","aria-label":`Restore: ${e.text}`,onClick:()=>void dc("restore",e,"Restored"),children:"Restore"})}var Jn=h(w(),1),RY="-mx-1 -my-0.5 inline-flex max-w-[140px] items-center truncate rounded-xs px-1 py-0.5 hover:bg-muted data-[state=open]:bg-muted";function TY({item:e,ctx:t,chat:n}){let o=Te(e),r=t.open===o,a=t.cur===o,i=t.sel.has(o),s=ea(e);return Jn.jsxs("div",{children:[Jn.jsxs("div",{"data-cur":a||void 0,"data-key":o,onFocusCapture:()=>!a&&W({cur:o}),onClick:(l)=>{if(!l.target.closest("input,button,a,[role=checkbox],[role=menuitem]"))Bp(e)},className:C("group/row relative grid min-h-12 cursor-pointer grid-cols-[auto_86px_auto_minmax(0,1fr)_auto] items-center gap-3 border-b border-[color:color-mix(in_srgb,var(--line)_30%,transparent)] px-3 py-2 hover:bg-muted max-sm:grid-cols-[auto_auto_minmax(0,1fr)_auto]",a&&"bg-muted shadow-[inset_0_0_0_1px_var(--line)]",i&&"bg-[color-mix(in_srgb,var(--accent)_8%,transparent)]",r&&"rounded-t-sm bg-muted"),children:[Jn.jsx(Hr,{checked:i,"aria-label":`Select: ${e.text}`,onCheckedChange:()=>{W({cur:o}),Y1(o)}}),s?Jn.jsx(Mg,{item:e,children:Jn.jsx("button",{type:"button","aria-label":`Kind: ${e.text}`,title:"Kind",className:RY,children:Jn.jsx(ad,{kind:e.kind})})}):Jn.jsx(ad,{kind:e.kind}),Jn.jsx("span",{className:"inline-flex items-center max-sm:hidden",title:Ri(t.list,e),children:Jn.jsx(kc,{url:e.source,social:us(t.list,e)?.social,size:14})}),Jn.jsx("button",{type:"button","data-title":!0,"aria-expanded":r,title:e.text,onClick:()=>Bp(e),className:C("truncate bg-transparent py-1.5 text-left text-base text-foreground",r&&"font-medium"),children:e.text}),Jn.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2.5 text-xs text-muted-foreground",children:[t.many&&Jn.jsxs("span",{className:"inline-flex max-w-[140px] items-center gap-1.5 truncate max-sm:hidden",title:e.project||"",children:[Jn.jsx(zn,{dir:e.dir,label:e.project||"",size:14}),Ar(e.project||"")]}),Jn.jsx(Pg,{item:e}),s?Jn.jsx(Gv,{item:e,boards:t.boards,children:Jn.jsx("button",{type:"button","aria-label":`Collection: ${e.text}`,title:"Collection",className:C(RY,"text-xs max-sm:hidden",!e.board&&"opacity-70"),children:e.board||"Inbox"})}):e.board&&Jn.jsx("span",{className:"max-sm:hidden",children:e.board}),Jn.jsx("span",{className:"min-w-16 whitespace-nowrap text-right tabular-nums group-focus-within/row:hidden group-hover/row:hidden group-data-[cur]/row:hidden [@media(hover:none)]:hidden",children:Er(e.at)}),Jn.jsx(Dg,{item:e,boards:t.boards,variant:"row",className:"hidden min-w-16 justify-end group-focus-within/row:flex group-hover/row:flex group-data-[cur]/row:flex [@media(hover:none)]:flex"})]})]}),r&&Jn.jsx(eS,{item:e,ctx:t,chat:n})]})}var MY=h(I(),1);var zg=h(w(),1);function tS({icon:e,label:t,title:n,connected:o,onPress:r,onDisconnect:a,disconnectLabel:i}){if(o)return zg.jsxs("span",{title:n,className:C("inline-flex h-6 items-center gap-1.5 rounded-full border px-2.5 text-sm [&_svg]:size-3.5","border-[color-mix(in_srgb,var(--ok)_35%,var(--line))] bg-[color-mix(in_srgb,var(--ok)_10%,transparent)] text-foreground [&>svg:first-child]:text-success"),children:[e,t,zg.jsx("button",{type:"button","aria-label":i,title:"Disconnect",onClick:a,className:"-mr-1 grid size-4 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-danger",children:zg.jsx(L,{name:"x",className:"size-[11px]"})})]});return zg.jsxs("button",{type:"button",title:n,onClick:r,className:C("inline-flex h-6 items-center gap-1.5 rounded-full border px-2.5 text-sm [&_svg]:size-3.5","border-border bg-card text-muted-foreground hover:text-foreground"),children:[e,t]})}var Ig=h(I(),1);var _e=h(w(),1),a5="inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium [&_svg]:size-3";function EY({s:e,chatOn:t,googleConnected:n}){let[o,r]=Ig.useState(e.category||"");Ig.useEffect(()=>r(e.category||""),[e.category]);let[a,i]=Ig.useState(e.dir),[s,l]=Ig.useState(""),c=e.label||cs(e.url),d=VG(e),u=O.projects(),p=async(g,m)=>{l(g);try{await m()}finally{l("")}},f=e.social&&(!e.last||!e.last.ok&&/gathered by your agent/i.test(e.last.note))?_e.jsxs("span",{className:C(a5,"bg-[color-mix(in_srgb,var(--dim)_14%,transparent)] text-muted-foreground"),children:[_e.jsx(L,{name:"at"}),t?"Gathered with ChatGPT":"Gathered by your agent"]}):!e.last?_e.jsx("span",{className:C(a5,"bg-[color-mix(in_srgb,var(--dim)_14%,transparent)] text-muted-foreground"),children:"Not gathered yet"}):_e.jsxs(_e.Fragment,{children:[_e.jsxs("span",{className:C(a5,e.last.ok?"bg-[color-mix(in_srgb,var(--ok)_14%,transparent)] text-success":"bg-[color-mix(in_srgb,var(--warn)_20%,transparent)] text-foreground"),children:[e.last.ok?_e.jsx(L,{name:"check"}):_e.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"text-warning",children:[_e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",fill:"none",strokeWidth:"1.8"}),_e.jsx("path",{d:"M8 5v3.5M8 11v.1",stroke:"currentColor",fill:"none",strokeWidth:"2",strokeLinecap:"round"})]}),e.last.ok?e.last.note:`Failed: ${e.last.note}`]}),_e.jsx("span",{children:Er(e.last.at)})]});return _e.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-card px-3 pb-2.5 pt-3 transition-colors hover:border-[color-mix(in_srgb,var(--line)_70%,var(--ink))]",children:[_e.jsxs("div",{className:"flex items-center gap-2.5",children:[_e.jsx("span",{className:"inline-grid size-7 shrink-0 place-items-center rounded-sm bg-muted",title:d==="social"?cc[e.social]||"social":d,children:_e.jsx(kc,{url:e.url,social:e.social,fallback:d==="sheet"?"sheet":d==="doc"?"doc":d==="social"?"at":"link"})}),_e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-px",children:[_e.jsx("span",{className:"truncate text-base font-semibold text-foreground",title:c,children:c}),_e.jsxs("a",{href:qu(e.url),target:"_blank",rel:"noopener noreferrer",title:e.url,className:"group/u inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[_e.jsx("span",{className:"truncate",children:e.url.replace(/^https?:\/\/(www\.)?/,"")}),_e.jsx(L,{name:"ext",className:"size-[11px] shrink-0 opacity-0 transition-opacity group-hover/u:opacity-100"})]})]}),_e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.social?_e.jsx(me,{icon:"refresh",label:t?"Gather with your ChatGPT plan":"Gather: opens your agent on /kaizen gather","aria-label":`Gather ${c} with your agent`,disabled:!!s,className:"size-7",onClick:()=>void p("gather",()=>bF(e))}):_e.jsx(me,{icon:"refresh",label:"Check now","aria-label":`Check ${c} now`,disabled:!!s,className:"size-7",onClick:()=>void p("gather",()=>hF(e))}),_e.jsx(me,{icon:"trash",label:"Remove source","aria-label":`Remove ${c}`,className:"size-7 hover:text-danger",onClick:()=>void vF(e)})]})]}),s==="gather"&&_e.jsx("span",{className:"text-xs text-muted-foreground",role:"status",children:e.social?t?"Gathering…":"":"Checking…"}),_e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:f}),_e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 border-t border-border pt-2 max-sm:grid-cols-1",children:[_e.jsx(Se,{label:"Category",inline:!0,children:(g)=>_e.jsxs(_e.Fragment,{children:[_e.jsx(Ue,{...g,value:o,maxLength:40,placeholder:H1(e),"aria-label":`Category of ${c}`,className:"h-7 min-w-0 flex-1 text-sm",onChange:(m)=>r(m.target.value),onKeyDown:(m)=>m.key==="Enter"&&o.trim()!==(e.category||"")&&void LA(e,o.trim())}),o.trim()!==(e.category||"")&&_e.jsx(M,{variant:"primary",size:"sm","aria-label":`Save the category of ${c}`,onClick:()=>void LA(e,o.trim()),children:"Save"})]})}),_e.jsx(Se,{label:"Project",inline:!0,children:(g)=>_e.jsxs(_e.Fragment,{children:[_e.jsx(zn,{dir:e.dir,label:e.project||""}),_e.jsxs(Pt,{value:a,onValueChange:i,children:[_e.jsx(_t,{id:g.id,"aria-label":`Project of ${c}`,size:"sm",className:"min-w-0 flex-1",children:_e.jsx(Ot,{})}),_e.jsxs(zt,{children:[!u.some((m)=>m.dir===e.dir)&&_e.jsx(dt,{value:e.dir,children:e.project||e.dir}),u.map((m)=>_e.jsx(dt,{value:m.dir,title:m.label,children:m.label.split(/[\\/]/).pop()},m.dir))]})]}),a!==e.dir&&_e.jsx(M,{variant:"primary",size:"sm","aria-label":`Move ${c} to the chosen project`,onClick:()=>void yF(e,a),children:"Move"})]})})]}),_e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-xs text-muted-foreground",children:[(d==="sheet"||/github\.com/.test(e.url))&&_e.jsxs("label",{className:"inline-flex items-center gap-2",children:["Write back",_e.jsx(sr,{checked:!!e.writeback,"aria-label":`Write back to ${c}`,onCheckedChange:(g)=>void wF(e,g,n)})]}),_e.jsxs("label",{className:"inline-flex items-center gap-2",title:"Off: the scheduled gather skips this source; Check now still reads it",children:["Auto gather",_e.jsx(sr,{checked:!e.paused,"aria-label":`Auto gather ${c}`,onCheckedChange:(g)=>void xF(e,g)})]})]})]})}var nS=h(I(),1);var Kt=h(w(),1);function AY({dir:e,projects:t}){let n=_n((d)=>d.draft),o=_n((d)=>d.srcKind)==="social",[r,a]=nS.useState(!1),i=nS.useRef(null),s=n.to||e,l=async()=>{if(o?!n.q.trim():!n.url.trim())return i.current?.focus();if(!s)return _("Pick a project first");a(!0);let d=await SF({social:o,url:n.url.trim(),q:n.q.trim(),plat:n.plat,label:n.label.trim(),category:n.cat.trim(),to:s});if(a(!1),d)$u(o?{q:"",label:"",cat:""}:{url:"",label:"",cat:""})},c=(d)=>d.key==="Enter"&&void l();return Kt.jsxs("div",{className:"mb-4 flex flex-col gap-2.5 rounded-md border border-border bg-background p-3",children:[Kt.jsxs("div",{className:"flex items-center justify-between",children:[Kt.jsx("h4",{className:"text-base font-semibold text-foreground",children:"Add a source"}),Kt.jsx(Ti,{label:"Kind of source",value:o?"social":"link",options:[{id:"link",label:"Link"},{id:"social",label:"Social"}],onChange:(d)=>{W({srcKind:d}),requestAnimationFrame(()=>i.current?.focus())}})]}),o?Kt.jsxs("div",{className:"grid grid-cols-2 gap-2.5 max-sm:grid-cols-1",children:[Kt.jsx(Se,{label:"Platform",children:(d)=>Kt.jsxs(Pt,{value:n.plat,onValueChange:(u)=>$u({plat:u}),children:[Kt.jsx(_t,{id:d.id,className:"w-full",children:Kt.jsx(Ot,{})}),Kt.jsx(zt,{children:Object.entries(cc).map(([u,p])=>Kt.jsx(dt,{value:u,children:p},u))})]})}),Kt.jsx(Se,{label:"Follow",children:(d)=>Kt.jsx(Ue,{...d,ref:i,value:n.q,onChange:(u)=>$u({q:u.target.value}),onKeyDown:c,placeholder:"keyword, #hashtag or @account",maxLength:100,spellCheck:!1,autoComplete:"off"})})]}):Kt.jsx(Se,{label:"Link",children:(d)=>Kt.jsx(Ue,{...d,ref:i,value:n.url,onChange:(u)=>$u({url:u.target.value}),onKeyDown:c,placeholder:"Link",spellCheck:!1,autoComplete:"off"})}),Kt.jsxs("div",{className:"grid grid-cols-2 gap-2.5 max-sm:grid-cols-1",children:[Kt.jsx(Se,{label:"Label (optional)",children:(d)=>Kt.jsx(Ue,{...d,value:n.label,onChange:(u)=>$u({label:u.target.value}),onKeyDown:c,placeholder:o?"e.g. Mentions on X":"e.g. Feedback Q4"})}),Kt.jsx(Se,{label:"Category (optional)",children:(d)=>Kt.jsx(Ue,{...d,value:n.cat,onChange:(u)=>$u({cat:u.target.value}),onKeyDown:c,placeholder:o?"e.g. Social":"e.g. Bugs",maxLength:40})})]}),Kt.jsx(Se,{label:"Project",children:(d)=>Kt.jsxs(Pt,{value:s||void 0,onValueChange:(u)=>$u({to:u}),children:[Kt.jsx(_t,{id:d.id,className:"w-full",children:Kt.jsx(Ot,{placeholder:"Choose project…"})}),Kt.jsx(zt,{children:t.map((u)=>Kt.jsx(dt,{value:u.dir,title:u.label,children:u.label.split(/[\\/]/).pop()},u.dir))})]})}),Kt.jsx("div",{className:"flex justify-end",children:Kt.jsx(M,{variant:"primary",disabled:r,onClick:()=>void l(),children:r?"Adding…":"Add source"})})]})}var kt=h(w(),1);function i5({data:e,dir:t}){let n=_n((f)=>f.srcShow),o=_n((f)=>f.srcAdd),r=_n((f)=>f.draft),[a,i]=MY.useState(!1),s=e.sources||[],l=e.gatherer||{},c=e.google||{},d=l.use==="chatgpt"&&!!l.connected,u=e.every&&e.every!=="off"?e.every:"",p=!s.length||o||[r.url,r.label,r.cat,r.q].some(Boolean);return kt.jsx(S1,{open:n,onOpenChange:(f)=>W({srcShow:f}),children:kt.jsxs(OU,{"aria-label":"Sources",id:"src-sec",onCloseAutoFocus:(f)=>{f.preventDefault(),ds.srcTog?.focus()},children:[kt.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-2.5 border-b border-border px-6 py-5",children:[kt.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[kt.jsx(lv,{children:"Sources"}),kt.jsx(C1,{className:"sr-only",children:"Where requests come from"}),kt.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[kt.jsx(tS,{icon:kt.jsx(L,{name:"clock"}),label:u||"Off",title:`${u?`Checked every ${u}`:"Auto-check off"}: change in Settings`,onPress:()=>{W({srcShow:!1}),O.openSettings("sources")}}),kt.jsx(tS,{icon:kt.jsx(L,{name:"ai"}),label:"ChatGPT",connected:!!l.connected,title:l.connected?`ChatGPT${l.email?": "+l.email:""}`:"Connect ChatGPT",onPress:()=>void $1(),onDisconnect:()=>void BA("/chatgpt"),disconnectLabel:"Disconnect ChatGPT"}),kt.jsx(tS,{icon:kt.jsx(L,{name:"google"}),label:"Google",connected:!!c.connected,title:c.connected?"Google connected":"Connect Google",onPress:()=>void NF(!!c.hasClient),onDisconnect:()=>void BA("/google"),disconnectLabel:"Disconnect Google"})]})]}),kt.jsxs("div",{className:"flex items-center gap-2",children:[s.length>0&&kt.jsxs(kt.Fragment,{children:[kt.jsxs(M,{size:"sm",disabled:a,onClick:async()=>{i(!0),await kF(t,s),i(!1)},children:[kt.jsx(L,{name:"refresh",className:"size-3.5"})," ",a?"Gathering…":"Gather all"]}),kt.jsxs(M,{size:"sm","aria-expanded":p,onClick:()=>W({srcAdd:!p}),children:[kt.jsx(L,{name:"plus",className:"size-3.5"})," Add"]})]}),kt.jsx(PU,{asChild:!0,children:kt.jsx(me,{icon:"close",label:"Close sources","aria-label":"Close sources"})})]})]}),kt.jsxs("div",{className:"flex-1 overflow-auto px-6 py-6",children:[p&&kt.jsx(AY,{dir:t,projects:O.projects()}),s.length?kt.jsx("div",{className:"flex flex-col gap-2.5",children:s.map((f)=>kt.jsx(EY,{s:f,chatOn:d,googleConnected:!!c.connected},f.dir+" "+f.url))}):kt.jsxs("div",{className:"mx-0 my-3 rounded-md border border-dashed border-border bg-background px-4 py-6 text-center",children:[kt.jsx("div",{className:"mx-auto mb-2.5 flex size-9 items-center justify-center text-muted-foreground",children:kt.jsx(L,{name:"link",className:"size-8"})}),kt.jsx("h4",{className:"text-base font-semibold text-foreground",children:"No sources yet"})]})]})]})})}var rS=h(I(),1);var Ce=h(w(),1),DY="pointer-events-none absolute top-[18px] rounded-sm border-[3px] px-3 py-1 text-[20px] font-bold uppercase tracking-[.06em]";function que({item:e,list:t,projectName:n}){let o=zF((r)=>void fc(r,(a)=>Hp(o.ref.current,a)));return Ce.jsxs("div",{ref:(r)=>{o.ref.current=r,ds.swCard=r},id:"sw-card",tabIndex:-1,"aria-label":"Request: swipe or press → to promote, ← to dismiss",onPointerDown:o.onPointerDown,className:"relative col-start-1 row-start-1 flex cursor-grab touch-pan-y select-none flex-col gap-3.5 overflow-auto rounded-lg border border-border bg-card p-6 shadow-md focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary data-[drag]:cursor-grabbing data-[lift]:fixed data-[lift]:z-[95] data-[lift]:m-0",children:[Ce.jsx(PY,{item:e,list:t,projectName:n}),Ce.jsx("p",{className:"whitespace-pre-wrap break-words text-[20px] leading-normal font-medium text-strong max-sm:text-[18px]",children:e.text}),e.notes&&Ce.jsx("div",{className:"whitespace-pre-wrap break-words text-[14px] leading-[1.65] text-muted-foreground max-sm:text-[16px]",children:e.notes}),Ce.jsx(_g,{item:e}),e.post&&Ce.jsx("a",{className:"text-sm text-muted-foreground underline",href:qu(e.post),target:"_blank",rel:"noopener",children:"open post"}),Ce.jsx("span",{className:C(DY,"left-[18px] -rotate-12 text-success opacity-[max(0,var(--p,0))]"),children:"Promote"}),Ce.jsx("span",{className:C(DY,"right-[18px] rotate-12 text-danger opacity-[max(0,calc(-1*var(--p,0)))]"),children:"Dismiss"})]})}function PY({item:e,list:t,projectName:n}){return Ce.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[Ce.jsx(kc,{url:e.source,social:us(t,e)?.social}),Ce.jsx("span",{className:"min-w-0 truncate",title:Ri(t,e),children:Ri(t,e)}),Ce.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5",title:n,children:[Ce.jsx(zn,{dir:e.dir,label:n,size:14}),Ar(n)]}),Ce.jsx("span",{className:"ml-auto whitespace-nowrap tabular-nums",children:Er(e.at)})]})}function $ue({S:e,dir:t}){let n=rS.useMemo(()=>e.n?pF(t):0,[]),o=Math.round((Date.now()-e.t0)/1000),r=o<60?o+" s":Math.floor(o/60)+" min "+o%60+" s";return Ce.jsxs("div",{className:"relative flex flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden rounded-md border border-border bg-card px-4 py-10 text-center",children:[e.n>0&&O.motion()&&Ce.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",children:Array.from({length:14},(a,i)=>Ce.jsx("i",{className:"absolute -top-2.5 h-3 w-2 animate-fall bg-[hsl(var(--h)_80%_60%)]",style:{left:`${i*37%100}%`,animationDelay:`${i%5*0.08}s`,"--h":i*53%360}},i))}),Ce.jsx("h4",{className:"text-[20px] font-medium",children:"Icebox zero"}),Ce.jsx("p",{className:"text-muted-foreground",children:e.n?`${e.n} sorted · ${e.pro} promoted · ${e.dis} dismissed · in ${r}`:"Nothing waiting here."}),n>0&&Ce.jsxs("p",{className:"text-muted-foreground",children:[n,"-day streak",n>1?" — cleared every day":""]}),Ce.jsx("p",{className:"mt-3.5",children:Ce.jsx(M,{variant:"primary",size:"sm",onClick:mv,children:"Back to list"})})]})}var oS="min-h-11 gap-2 max-sm:min-h-12";function OY({list:e,dir:t,name:n}){let o=_n((l)=>l.swipe),r=_n((l)=>l.deck),a=o.n+r.length,i=r[0];rS.useEffect(()=>{if(!o.pop)return;let l=setTimeout(()=>W((c)=>c.swipe?{swipe:{...c.swipe,pop:!1}}:{}),900);return()=>clearTimeout(l)},[o.pop,o.n]);let s=(l)=>Ce.jsx("kbd",{className:"rounded-xs border border-border px-1.5 font-mono text-xs leading-4 text-muted-foreground max-sm:hidden",children:l});return Ce.jsxs("div",{id:"sw",className:"mx-auto flex h-[calc(100dvh-130px)] min-h-[420px] w-full max-w-[680px] flex-col justify-center gap-4 max-sm:fixed max-sm:inset-0 max-sm:z-[90] max-sm:h-auto max-sm:min-h-0 max-sm:max-w-none max-sm:justify-start max-sm:bg-background max-sm:px-4 max-sm:pt-[max(12px,env(safe-area-inset-top))] max-sm:pb-[max(16px,env(safe-area-inset-bottom))]",children:[Ce.jsxs("div",{className:"flex items-center gap-2.5",children:[Ce.jsx(M,{variant:"ghost",size:"sm",title:"Back to the list (Esc)",onClick:mv,className:"shrink-0",children:"← List"}),Ce.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":o.n,className:"h-[3px] flex-1 overflow-hidden rounded-xs bg-border",children:Ce.jsx("i",{className:"block h-full bg-primary transition-[width] duration-200 ease-out",style:{width:`${a?Math.round(o.n/a*100):100}%`}})}),Ce.jsx("span",{className:"whitespace-nowrap text-sm text-muted-foreground",children:i?`${o.n+1} of ${a}`:`${a} of ${a}`}),Ce.jsxs("span",{className:"relative whitespace-nowrap text-sm text-muted-foreground",title:"Sorted this session",children:[o.n," sorted",o.pop&&Ce.jsx("b",{className:"absolute -top-3.5 -right-1 animate-rise text-sm text-success",children:"+1"})]})]}),!i?Ce.jsx($ue,{S:o,dir:t}):Ce.jsxs(Ce.Fragment,{children:[Ce.jsxs("div",{className:"relative grid min-h-[300px] flex-none overflow-visible max-sm:flex-1",children:[r[1]&&Ce.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 flex origin-center translate-y-2.5 scale-[.96] flex-col gap-3.5 overflow-hidden rounded-lg border border-border bg-card p-6 opacity-50 shadow-md",children:[Ce.jsx(PY,{item:r[1],list:e,projectName:n(r[1])}),Ce.jsx("p",{className:"text-[20px] leading-normal font-medium text-strong",children:r[1].text})]}),Ce.jsx(que,{item:i,list:e,projectName:n(i)},Te(i))]}),Ce.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto_1fr] gap-2 max-sm:grid-cols-2",children:[Ce.jsxs(M,{id:"sw-d","aria-label":"Dismiss (←)",title:"Dismiss (←)",className:C(oS,"text-danger max-sm:order-1"),onClick:()=>void fc("dismiss",(l)=>Hp(ds.swCard,l)),children:[Ce.jsx(L,{name:"x",className:"size-4"}),Ce.jsx("small",{children:"Dismiss"}),s("←")]}),Ce.jsxs(M,{id:"sw-s","aria-label":"Skip (↓)",title:"Skip (↓)",className:C(oS,"max-sm:order-3"),disabled:r.length<2,onClick:()=>void fc("skip"),children:[Ce.jsx("span",{children:"↓"}),Ce.jsx("small",{children:"Skip"}),s("↓")]}),Ce.jsxs(M,{id:"sw-u","aria-label":"Undo (z)",title:"Undo (z)",className:C(oS,"max-sm:order-3"),disabled:!o.last,onClick:()=>void K1(),children:[Ce.jsx(L,{name:"restore",className:"size-4"}),Ce.jsx("small",{children:"Undo"}),s("z")]}),Ce.jsxs(M,{id:"sw-p",variant:"primary","aria-label":"Promote (→)",title:"Promote (→)",className:C(oS,"border-strong bg-strong text-background max-sm:order-2"),onClick:()=>void fc("promote",(l)=>Hp(ds.swCard,l)),children:[Ce.jsx(L,{name:"check",className:"size-4"}),Ce.jsx("small",{children:"Promote"}),s("→")]})]})]})]})}var ce=h(w(),1);function zY(){return ut((e)=>e.page==="icebox")?ce.jsx(Wue,{}):null}var Yue={client:"text-kind-client data-[state=on]:border-kind-client data-[state=on]:bg-kind-client data-[state=on]:text-card",finding:"text-kind-finding data-[state=on]:border-kind-finding data-[state=on]:bg-kind-finding data-[state=on]:text-card",people:"text-kind-people data-[state=on]:border-kind-people data-[state=on]:bg-kind-people data-[state=on]:text-card"};function Wue(){tF();let[,e]=ef.useReducer((D)=>D+1,0);ef.useEffect(()=>{let D=zr(e);return()=>{D(),Xr(!0)}},[]);let t=_n(od((D)=>({data:D.data,loaded:D.loaded,view:D.view,board:D.board,kinds:D.kinds,cat:D.cat,src:D.src,sel:D.sel,cur:D.cur,open:D.open,armed:D.armed,swipe:D.swipe,busy:D.busy,ask:D.ask,cap:D.cap,srcShow:D.srcShow,skip:D.swipe?.skip}))),n=pu(),o=O.scopeDir()||null,r=new Set(Ol((D)=>D.shown)),a=Vd(),i=t.data,s=i&&!i.error?$G(i,t,{dir:o,shown:r,showable:a}):null,l=cw("icebox",s?.filtered??[]),c=l.rows,d=t.view==="cards"&&!n,u=!!i?.gatherer?.connected,p=s&&t.swipe?ZG(s.filtered,t.skip??new Map):[];ef.useEffect(()=>void W({order:c,deck:p}),[c.map(Te).join("|"),p.map(Te).join("|")]),ef.useEffect(()=>{if(!s)return;let D=new Set(s.ice.map(Te)),E=new Set(c.map(Te));W((z)=>{let B=c[0]?Te(c[0]):null,Z={...z.board!==s.board?{board:s.board}:{},...z.cat!==s.cat?{cat:s.cat}:{},...z.src!==s.src?{src:s.src}:{},...z.sel.some((ee)=>!E.has(ee))?{sel:z.sel.filter((ee)=>E.has(ee))}:{},...z.open&&!D.has(z.open)?{open:null,armed:null}:{},...z.cur&&E.has(z.cur)||z.cur===B?{}:{cur:B}};return Object.keys(Z).length?Z:z})});let f=o||(a.some((D)=>D.dir===t.cap.dir)?t.cap.dir:(r.size===1?[...r][0]:null)||a[0]?.dir||null);if(ef.useEffect(()=>{if(!o&&t.cap.dir!==f)ta({dir:f});if(t.cap.board&&t.cap.boardDir&&t.cap.boardDir!==f)ta({board:""})}),!t.loaded)return ce.jsxs(Kv,{children:[ce.jsx(Jr,{className:"mb-3.5 h-[110px]"}),ce.jsx(Jr,{className:"h-11"})]});if(!i)return ce.jsx(Kv,{children:ce.jsx("p",{className:"text-muted-foreground",children:"The icebox could not be read."})});if(i.error||!s)return ce.jsx(Kv,{children:ce.jsx("p",{className:"text-muted-foreground",children:i.error})});let g={list:s.list,many:s.many,boards:i.boards||[],cur:t.cur,sel:new Set(t.sel),open:t.open,armed:t.armed},m=c.filter((D)=>g.sel.has(Te(D))).length,y=a.find((D)=>D.dir===f),b=(i.boards||[]).filter((D)=>D.dir===f),x=YG(s.list,s.bySrc),v=KG(s.cat),k=!!(s.cat||s.src),S=!!o,N=ce.jsxs(ce.Fragment,{children:[t.ask?.kind==="collection"&&ce.jsx(gY,{where:t.ask.where,onDone:t.ask.done}),t.ask?.kind==="confirm"&&ce.jsx(lg,{open:!0,title:t.ask.title,description:t.ask.description,confirmLabel:t.ask.label,danger:t.ask.danger,onConfirm:()=>t.ask?.kind==="confirm"&&t.ask.done(!0),onCancel:()=>t.ask?.kind==="confirm"&&t.ask.done(!1)})]});if(t.swipe)return ce.jsxs(Kv,{children:[ce.jsx(OY,{list:s.list,dir:o,name:(D)=>JG(D,O.projects())}),ce.jsx(i5,{data:i,dir:o??""}),N]});let R=v?`${c.length} ${s.cat.toLowerCase()}`:`${c.length<s.waiting?`${c.length} of ${s.waiting}`:s.waiting} waiting`,A=s.waiting&&!c.length?ce.jsx(_Y,{children:ce.jsx(ba,{title:"No matches",children:ce.jsx(M,{id:"ice-unf",onClick:()=>PF(S),children:"Clear filters"})})}):c.length?d?ce.jsxs(ce.Fragment,{children:[ce.jsx("div",{className:"[columns:3_280px] [column-gap:12px]",children:c.map((D)=>ce.jsx(xY,{item:D,ctx:g},Te(D)))}),ce.jsx(fv,{at:l.at,size:l.size,total:l.total,onAt:l.setAt,onSize:l.setSize})]}):ce.jsxs("div",{className:`flex flex-col rounded-md border border-[color:color-mix(in_srgb,var(--line)_50%,transparent)] ${t.sel.length?"rounded-t-none border-t-0":""}`,children:[c.map((D)=>n?ce.jsx(NY,{item:D,ctx:g,chat:u},Te(D)):ce.jsx(TY,{item:D,ctx:g,chat:u},Te(D))),ce.jsx(fv,{at:l.at,size:l.size,total:l.total,onAt:l.setAt,onSize:l.setSize})]}):ce.jsx(_Y,{children:ce.jsx(ba,{title:"Nothing waiting",help:"Drop anything above: what a client asked for, something you found, what people say.",children:!s.list.length&&ce.jsxs(M,{variant:"primary",id:"ice-addsrc",onClick:()=>W({srcShow:!0}),children:[ce.jsx(L,{name:"plus",className:"size-3.5"})," Add a source"]})})});return ce.jsxs(Kv,{children:[ce.jsx(mY,{to:f,projects:S?[]:a,boards:b,board:t.cap.board&&t.cap.boardDir&&t.cap.boardDir!==f?"":t.cap.board}),!n&&i.gatherer?.use==="ask"&&!u&&ce.jsxs("div",{className:"mb-3 mt-1 flex flex-wrap items-center gap-2 rounded-md border border-[color-mix(in_srgb,var(--accent)_45%,var(--line))] bg-[color-mix(in_srgb,var(--accent)_8%,var(--bg-2))] px-4 py-3.5",children:[ce.jsx("b",{className:"text-[14px] text-strong",children:"Gather social posts with ChatGPT?"}),ce.jsx("span",{className:"flex-1"}),ce.jsx(M,{variant:"ghost",onClick:()=>void RF(),children:"Skip"}),ce.jsx(M,{variant:"primary",onClick:()=>void $1(),children:"Connect"})]}),ce.jsxs("div",{className:"mb-2.5 flex items-start justify-between gap-4 max-sm:-mx-4 max-sm:mb-1.5 max-sm:flex-nowrap max-sm:gap-1.5 max-sm:overflow-x-auto max-sm:px-4 max-sm:pb-0.5 max-sm:[scrollbar-width:none]",children:[ce.jsxs("div",{role:"group","aria-label":"Collections",className:"flex min-w-0 flex-wrap gap-1.5 max-sm:flex-none max-sm:flex-nowrap",children:[ce.jsx(ac,{pressed:!s.board,onPressedChange:()=>HA("",s.boards,S),children:"All"}),s.boards.map((D)=>ce.jsx(pY,{board:D,count:s.nOn(D),pressed:s.board.toLowerCase()===D.name.toLowerCase(),onPress:()=>HA(D.name,s.boards,S)},D.name)),ce.jsxs(M,{size:"sm",id:"ice-nb",title:"Make a collection for a client or a topic",className:"h-[26px] border-dashed text-muted-foreground",onClick:()=>void mF(f,S?"":y?.label||"this project"),children:[ce.jsx(L,{name:"plus",className:"size-[13px]"}),"Collection"]})]}),ce.jsx("div",{role:"group","aria-label":"Kinds",className:"flex min-w-0 flex-wrap gap-1.5 max-sm:flex-none max-sm:flex-nowrap max-sm:border-l max-sm:border-border max-sm:pl-1.5",children:Object.entries(Ip).map(([D,E])=>ce.jsx(ac,{className:Yue[D],pressed:t.kinds.includes(D),onPressedChange:()=>DF(D),children:E},D))})]}),ce.jsxs("div",{className:"mb-2.5 flex items-center gap-2 max-sm:flex-wrap",children:[!d&&!n&&c.length>0&&ce.jsx(Hr,{"aria-label":"Select every request shown",checked:m>0&&m===c.length?!0:m>0?"indeterminate":!1,onCheckedChange:()=>AF(c,m!==c.length)}),!n&&ce.jsx(Ti,{label:"View",value:d?"cards":"sort",options:[{id:"cards",label:"Cards"},{id:"sort",label:"Sort"}],onChange:EF}),ce.jsx("span",{className:"text-base font-semibold text-foreground",children:R}),ce.jsx("span",{className:"flex-1"}),(s.byCat.size>1||s.byCat.has("Dismissed")||s.byCat.has("Done")||s.byCat.has("Promoted")||s.bySrc.size>1)&&ce.jsxs(L1,{label:"Filter requests",active:k,className:"flex flex-col gap-1.5 p-2",children:[(s.byCat.size>1||s.byCat.has("Dismissed")||s.byCat.has("Done")||s.byCat.has("Promoted"))&&ce.jsx(Ni,{label:"Category",value:s.cat,placeholder:"All categories",options:[{value:"",label:"All categories"},...[...s.byCat].map(([D,{n:E}])=>({value:D,label:D,count:E}))],onChange:(D)=>W({cat:D})}),s.bySrc.size>1&&ce.jsx(Ni,{label:"Source",value:s.src,placeholder:"All sources",options:[{value:"",label:"All sources"},...[...x].flatMap(([D,E])=>E.map(([z,B])=>({value:z,group:D,label:WG(Ri(s.list,B),D),search:Ri(s.list,B),count:s.bySrc.get(z).n,icon:ce.jsx(kc,{url:B.source,social:us(s.list,B)?.social,size:15})})))],groupIcons:Object.fromEntries([...x].map(([D,E])=>[D,ce.jsx(kc,{url:E[0][1].source,social:us(s.list,E[0][1])?.social,size:15},D)])),onChange:(D)=>W({src:D})})]}),c.some(j1)&&ce.jsxs(M,{variant:"ghost",size:"sm",id:"ice-sw",title:"Sort one at a time: swipe right to promote, left to dismiss",onClick:dF,children:[ce.jsx("span",{"aria-hidden":"true",children:"⇆"})," Swipe"]}),!n&&ce.jsxs(M,{id:"src-tog",ref:(D)=>void(ds.srcTog=D),size:"sm","aria-expanded":t.srcShow,"aria-controls":"src-sec",title:"Sources, and Gather all",onClick:()=>W({srcShow:!0}),children:[ce.jsx(L,{name:"link",className:"size-3.5"})," Sources · ",s.list.length]})]}),t.sel.length>0&&ce.jsx(fY,{count:t.sel.length,busy:t.busy,onPromote:()=>void dg("promote"),onSnooze:()=>void pc(c.filter((D)=>g.sel.has(Te(D))&&ea(D)),"1w"),onDismiss:()=>void dg("dismiss"),onClear:()=>W({sel:[]})}),(i.failed||[]).map((D)=>ce.jsxs("p",{className:"text-muted-foreground",children:["The sources of ",D," could not be read."]},D)),A,ce.jsx(i5,{data:i,dir:o??""}),N]})}var Kv=({children:e})=>ce.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-auto px-7 pt-6 pb-6 max-[900px]:px-4",children:e}),_Y=({children:e})=>ce.jsx("div",{className:"rounded-md border border-[color:color-mix(in_srgb,var(--line)_50%,transparent)]",children:e});var _i=h(I(),1);var IY=h(I(),1);var Cc=h(w(),1);function LY({from:e,name:t,at:n,text:o}){let[r,a]=IY.useState(!1),i=o.length>320&&!r,s=e==="user";return Cc.jsxs("article",{className:C("flex max-w-[88%] flex-col gap-[3px]",s?"items-end self-end":"items-start self-start"),children:[Cc.jsxs("div",{className:C("flex items-baseline gap-1.5 px-1 text-xs text-muted-foreground",s&&"flex-row-reverse"),children:[Cc.jsx("strong",{className:"font-medium",children:t}),n?Cc.jsx("time",{children:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}):null]}),Cc.jsx("div",{className:C("whitespace-pre-wrap break-words rounded-[14px] px-3 py-2 text-base leading-[1.45]",s?"rounded-br-xs bg-foreground text-primary-foreground":"rounded-bl-xs bg-muted"),children:i?Cc.jsxs("button",{type:"button",className:"block text-left",onClick:()=>a(!0),children:[o.slice(0,280).trimEnd(),"… ",Cc.jsx("span",{className:"whitespace-nowrap text-sm opacity-65",children:"Show more"})]}):o})]})}var aS=h(w(),1);function BY({label:e,options:t,value:n,onChange:o}){return aS.jsx(L1,{label:e,active:n!==t[0]?.id,children:(r)=>aS.jsx("div",{role:"group","aria-label":e,className:"flex flex-wrap gap-1.5",children:t.map((a)=>aS.jsx(ac,{count:a.count,pressed:n===a.id,onPressedChange:()=>{o(a.id),r()},children:a.label},a.id))})})}var Nc=h(w(),1);function HY({result:e}){if(!e)return null;return Nc.jsxs("details",{className:"mb-2.5",children:[Nc.jsx("summary",{className:"cursor-pointer text-xs font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Checks and limits"}),!!e.checks?.length&&Nc.jsx("ul",{className:"mt-1.5 list-disc pl-5",children:e.checks.map((t,n)=>Nc.jsx("li",{className:"my-[3px] text-sm text-muted-foreground",children:v$(t)},n))}),!!e.limitations?.length&&Nc.jsx("ul",{className:"mt-1.5 list-disc pl-5",children:e.limitations.map((t,n)=>Nc.jsx("li",{className:"my-[3px] text-sm text-muted-foreground",children:t},n))}),Nc.jsx("p",{className:"my-[3px] text-sm text-muted-foreground",children:"Accepting a result does not publish it. A preview alone does not prove that a backend works."})]})}var sS=h(I(),1);var Ht=h(w(),1),Lg="rounded-md border border-[color:color-mix(in_srgb,var(--line)_40%,transparent)]",iS="px-0 text-muted-foreground";function Xue({href:e,name:t}){let n=A$(e);return Ht.jsxs(Ht.Fragment,{children:[Ht.jsx("p",{className:"text-warning",children:"Live preview — this address can change during later work."}),Ht.jsx("iframe",{title:`Live preview of ${t}`,src:n.hidden?void 0:n.src,hidden:n.hidden,sandbox:"allow-forms allow-scripts allow-popups",referrerPolicy:"no-referrer",onLoad:n.loaded,onError:n.failed,className:C("block min-h-[360px] w-full flex-1 border-0 bg-background",Lg)}),Ht.jsx("p",{className:iS,children:n.note})]})}function Que({href:e,name:t}){return Ht.jsx("pre",{"aria-label":t,className:C("min-h-[360px] flex-1 overflow-auto whitespace-pre-wrap break-words bg-background p-3 font-mono text-sm text-foreground",Lg),children:M$(e)})}function Zue({href:e,name:t}){let n=sS.useRef(null);return sS.useEffect(()=>void(n.current&&F$(n.current.parentElement)),[e]),Ht.jsxs("div",{ref:n,"aria-label":`${t}. Pinch, scroll or double-click to zoom.`,className:C("tp-zoom relative min-h-80 flex-1 touch-none cursor-zoom-in select-none overflow-hidden bg-[color-mix(in_srgb,var(--dim)_7%,var(--bg))] [&.zoomed]:cursor-grab",Lg),children:[Ht.jsx("img",{className:"tp-image absolute inset-0 box-border size-full max-h-none max-w-none origin-top-left object-contain p-4 will-change-transform",src:e,alt:t,loading:"lazy",draggable:!1}),Ht.jsx("div",{className:"absolute bottom-2.5 right-2.5 z-[2] flex gap-0.5 rounded-sm border border-border bg-card p-0.5 shadow-sm",children:[["out","Zoom out","−"],["reset","Reset zoom","100%"],["in","Zoom in","+"]].map(([o,r,a])=>Ht.jsx("button",{type:"button","aria-label":r,...{[`data-zoom-${o}`]:""},className:"grid h-7 min-w-7 place-items-center rounded-sm px-1.5 text-[14px] tabular-nums text-muted-foreground hover:bg-muted hover:text-foreground",children:a},o))})]})}function s5({artifact:e,selected:t=!1}){let{mode:n,href:o}=h$(e,t),r=$M(e);return Ht.jsxs("section",{className:"my-2 flex min-h-0 min-w-0 flex-1 flex-col overflow-visible",children:[Ht.jsxs("div",{className:"flex items-center justify-between gap-2 pb-2",children:[Ht.jsxs("span",{className:"min-w-0 break-words text-sm text-muted-foreground",children:[e.name,Ht.jsxs("small",{className:"block text-xs text-muted-foreground",children:[r?"Live link · mutable":"Saved file",e.size!=null?" · "+qM(e.size):""]})]}),o&&Ht.jsx(M,{asChild:!0,children:Ht.jsx("a",{href:r?o:o+(o.includes("?")?"&":"?")+"download=1",target:"_blank",rel:"noopener noreferrer",...r?{}:{download:""},children:r?"Open link":"Download"})})]}),n==="missing"&&Ht.jsxs("p",{className:"text-warning",children:[e.missing?"This saved file is unavailable.":"No preview is available for this output."," Ask for the file again or inspect the technical details."]}),n==="live"&&o&&Ht.jsx(Xue,{href:o,name:e.name}),n==="image"&&o&&Ht.jsx(Zue,{href:o,name:e.name},o),n==="video"&&Ht.jsx("video",{className:C("block max-h-[560px] w-full",Lg),controls:!0,preload:"metadata",src:o,children:"Download this video to watch it."}),n==="audio"&&Ht.jsx("audio",{className:C("block max-h-[560px] w-full",Lg),controls:!0,preload:"metadata",src:o,children:"Download this audio to listen."}),n==="pdf"&&Ht.jsxs(Ht.Fragment,{children:[Ht.jsx("iframe",{className:C("block min-h-[360px] w-full flex-1 border-0 bg-background",Lg),src:o,title:e.name,sandbox:""}),Ht.jsx("p",{className:iS,children:"Your browser may need you to download this PDF."})]}),n==="text"&&Ht.jsx(Que,{href:o,name:e.name}),n==="download"&&Ht.jsx("p",{className:iS,children:"Download this file to open it. Executable files are kept separate from this task page."}),n==="unavailable"&&Ht.jsx("p",{className:iS,children:"Preview is unavailable for this format. Download to open it in your app."})]})}var Sn=h(w(),1);function jY({result:e,artifactId:t,working:n,onSelect:o}){if(!e&&n)return Sn.jsxs("div",{role:"status",className:"grid min-h-60 place-content-center justify-items-center gap-1.5 p-5 text-center text-muted-foreground",children:[Sn.jsx(BU,{className:"mb-1.5"}),Sn.jsx("h3",{className:"font-semibold text-foreground",children:"The agent is building"}),Sn.jsx("p",{className:"line-clamp-3 max-w-[52ch]",children:n})]});if(!e)return Sn.jsxs("div",{className:"grid min-h-60 place-content-center p-5 text-center text-muted-foreground",children:[Sn.jsx("h3",{className:"mb-2 font-semibold text-foreground",children:"Your result will appear here"}),Sn.jsx("p",{children:"Answer any questions in the conversation. You approve a short plan before the build starts."})]});let r=e.artifacts??[],a=r.find((c)=>c.id===t)??r[0],i=y$(e),s=r.length>1,l=e.liveUrl&&!r.some((c)=>c.url===e.liveUrl)&&Rg(e.liveUrl);return Sn.jsxs(Sn.Fragment,{children:[Sn.jsxs("div",{className:"mb-3.5",children:[!i&&Sn.jsx("h2",{className:"mb-1 text-[16px] font-semibold",children:e.title}),e.summary&&!i&&Sn.jsx("p",{className:"mb-1 text-muted-foreground",children:e.summary})]}),Sn.jsxs("div",{className:C("grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] grid-rows-[minmax(0,1fr)] gap-4",s&&"grid-cols-[200px_minmax(0,1fr)] max-[700px]:grid-cols-[minmax(0,1fr)] max-[700px]:grid-rows-[auto_minmax(0,1fr)]"),children:[s&&Sn.jsx("nav",{role:"group","aria-label":"Outputs",className:"flex min-h-0 flex-col gap-0.5 overflow-auto pr-1 max-[700px]:flex-row max-[700px]:overflow-x-auto max-[700px]:overflow-y-hidden max-[700px]:pb-1 max-[700px]:pr-0",children:r.map((c)=>Sn.jsxs("button",{type:"button","aria-pressed":c.id===a?.id,onClick:()=>o(c.id),className:"grid grid-cols-[44px_minmax(0,1fr)] items-center gap-2.5 rounded-sm p-1.5 text-left text-sm leading-[1.35] text-muted-foreground hover:bg-muted hover:text-foreground aria-pressed:bg-muted aria-pressed:text-foreground max-[700px]:min-w-14 max-[700px]:grid-cols-[44px]",children:[g$(c)?Sn.jsx("img",{src:KM(c.url)??void 0,alt:"",loading:"lazy",draggable:!1,className:"size-11 rounded-xs border border-border bg-card object-cover object-top"}):Sn.jsx("i",{className:"grid size-11 place-items-center rounded-xs border border-border bg-card text-[10px] uppercase not-italic",children:(c.name.split(".").pop()||"file").slice(0,4)}),Sn.jsx("span",{className:"line-clamp-2 overflow-hidden max-[700px]:hidden",children:c.name})]},c.id))}),Sn.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col gap-2 overflow-auto",children:[a?Sn.jsx(s5,{artifact:a,selected:!0}):Sn.jsx("p",{className:"text-warning",children:"No saved file was published for this result."}),l&&Sn.jsx(s5,{artifact:{id:"live",name:"Live website",kind:"website",url:e.liveUrl},selected:!0})]})]})]})}var l5=h(w(),1),Jue={"needs-you":"warning",completed:"success","in-progress":"neutral"};function qv({category:e,dot:t,children:n}){if(!t)return l5.jsx(mU,{tone:Jue[e],children:n});return l5.jsx("span",{"aria-hidden":"true",className:C("relative block size-3 shrink-0 rounded-full",e==="needs-you"&&"bg-warning after:absolute after:inset-0 after:rounded-full after:bg-warning after:content-[''] motion-safe:after:animate-ping",e==="completed"&&"bg-success after:absolute after:left-[4.2px] after:top-[2px] after:h-[5.5px] after:w-[2.5px] after:rotate-45 after:border-solid after:border-background after:border-b-[1.6px] after:border-r-[1.6px] after:content-['']",e==="in-progress"&&"shadow-[inset_0_0_0_1.5px_var(--dim)]")})}var dl=h(w(),1);function UY({task:e,kb:t,...n}){let o=e;return dl.jsxs("button",{type:"button",className:C("grid min-h-12 w-full grid-cols-[12px_minmax(0,1fr)_minmax(0,34%)_auto] items-center gap-3 border-b border-b-[color:color-mix(in_srgb,var(--line)_30%,transparent)] px-3 py-2 text-left text-foreground last:border-b-0 hover:bg-muted focus-visible:shadow-[inset_0_0_0_1px_var(--line)] max-sm:grid-cols-[12px_minmax(0,1fr)_auto] max-sm:gap-2.5 max-sm:p-3",t&&"bg-muted shadow-[inset_0_0_0_1px_var(--line)]"),...n,children:[dl.jsx(qv,{dot:!0,category:o.attention.category}),dl.jsxs("span",{className:"min-w-0",children:[dl.jsx("strong",{className:"block break-words font-normal",children:o.title}),dl.jsxs("small",{className:"mt-0.5 block break-words text-xs text-muted-foreground",children:[o.projectName||(o.dir?Iv(o.dir):"Project needed"),o.currentResultId?" · Result available":""]})]}),dl.jsx("span",{className:"min-w-0 text-sm max-sm:hidden",children:dl.jsx(qv,{category:o.attention.category,children:zv(o)})}),dl.jsx("span",{className:"min-w-16 whitespace-nowrap text-right text-xs tabular-nums text-muted-foreground",children:o.updatedAt?co(Number(new Date(o.updatedAt)),Date.now())+" ago":""})]})}var c5=h(w(),1),GY=()=>c5.jsx("div",{role:"status","aria-label":"The agent is working",className:"mb-2 -mt-1 inline-flex gap-1 self-start rounded-[14px] rounded-bl-sm bg-muted px-3 py-2.5",children:[0,1,2].map((e)=>c5.jsx("i",{style:{animationDelay:`${e*0.15}s`},className:"block size-1.5 rounded-full bg-muted-foreground motion-safe:animate-dot"},e))});var ve=h(w(),1),ede="Accepting a result does not publish it. A preview alone does not prove that a backend works.",tde="text-xs font-semibold uppercase tracking-[0.06em] text-muted-foreground";function FY(){let e=ut((n)=>n.page==="task"),t=Dl((n)=>e?n.taskId+`
114
+ `+n.taskDir:"");return t?ve.jsx(nde,{},t):null}function nde(){_$();let{page:e,pageError:t,pending:n,receipt:o,draft:r}=Dl(od((P)=>({page:P.page,pageError:P.pageError,pending:P.pending,receipt:P.receipt,draft:P.draft}))),[a,i]=_i.useState(""),[s,l]=_i.useState(!0),[c,d]=_i.useState(""),[u,p]=_i.useState(null),[f,g]=_i.useState(""),m=_i.useRef(null),y=_i.useRef(null),b=e?.task,x=b?.messages?.length??0;if(_i.useEffect(()=>{if(b)document.title=b.title+" · kaizen"},[b?.title]),_i.useEffect(()=>{let P=m.current;if(P)requestAnimationFrame(()=>P.scrollTop=P.scrollHeight)},[x,!!b]),!e||!b)return t?ve.jsx(ba,{title:t==="offline"?"The server could not be reached":"This task could not be opened",help:t==="offline"?void 0:t,children:ve.jsx(M,{asChild:!0,children:ve.jsx("a",{href:"?view=tasks",children:"Back to Tasks"})})}):ve.jsx("p",{role:"status",className:"p-7 text-muted-foreground",children:"Opening task…"});let v=R$(e.results),k=v.find((P)=>P.id===b.currentResultId),S=s&&k?k:v.find((P)=>P.id===a)??k??v[v.length-1],N=S?.id??"",R=N===b.currentResultId,A=u??!!b.pendingDecision,D=b.actions?.stop??(!!b.activeRun&&!["interrupted","failed"].includes(b.status??"")),E=b.actions?.resume??["interrupted","failed"].includes(b.status??""),z=!(b.actions?.start===!1||!b.dir||!!b.activeRun||!!b.currentResultId||b.status!=="draft"||b.decision?.kind==="project"),B=R&&k$(b,k),Z=WM(b).filter((P)=>P.state!=="dispatched"),ee=T$(b),xe=async(P,Ae={})=>{if((await xc(P,Ae))?.ok)history.pushState(null,"","?view=tasks"),O.go("tasks")},V=async()=>{if(!await z$(N))return void y.current?.focus();l(!0),p(!0),y.current?.focus()},ye=[...XM(b).map((P)=>({id:"run-"+P,label:"Open workspace · "+P,href:`?view=run&id=${P}&dir=${encodeURIComponent(b.dir)}`})),{id:"archive",label:"Archive",onSelect:()=>void xe("archive")},...ee.abandon?[{id:"abandon",label:"Abandon",danger:!0,onSelect:()=>g("abandon")}]:[],...ee.delete?[{id:"delete",label:"Delete",danger:!0,onSelect:()=>g("delete")}]:[]],ae=b.activeRun?"Changes are saved for the next safe pass. Questions do not interrupt production.":b.attention.category==="completed"?"A new change stays in this task and starts a linked revision.":"Ask a question or describe a change. Your message stays with this task.",ge=!A&&!!(b.pendingDecision||b.inputs?.some((P)=>P.state==="queued"));return ve.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col gap-3",children:[ve.jsxs("header",{className:"flex flex-none items-center gap-2.5 max-sm:flex-wrap",children:[ve.jsx(me,{icon:"arrow",label:"Back to tasks",href:"?view=tasks",className:"[&_svg]:rotate-180",onClick:(P)=>(P.preventDefault(),O.go("tasks",!0))}),ve.jsx("h1",{className:"min-w-0 truncate text-[18px] font-semibold leading-snug",children:b.title}),ve.jsx("span",{className:"mr-auto shrink-0 whitespace-nowrap text-sm text-muted-foreground",children:C$(b,e.projects)}),D&&ve.jsx(M,{disabled:n||b.status==="stopping",onClick:()=>void xc("stop"),children:b.status==="stopping"?"Stopping…":"Stop"}),E&&ve.jsx(M,{onClick:()=>void xc("resume"),children:b.status==="failed"?"Retry":"Resume"}),z&&ve.jsx(M,{variant:"primary",onClick:()=>O.runPopup({_k:"task:"+b.id,kind:"task",state:b.dir,text:b.title},(P)=>void xc("start",{pick:P})),children:"Start planning"}),B&&ve.jsx(M,{variant:"primary",title:ede,onClick:()=>void xc("accept",{resultId:b.currentResultId}),children:"Looks good"}),ve.jsx(me,{icon:"note",label:"Conversation","aria-expanded":A,onClick:()=>p(!A),children:ge&&ve.jsx("i",{className:"absolute right-[5px] top-[5px] size-2 rounded-full bg-warning shadow-[0_0_0_2px_var(--bg)]"})}),ve.jsxs(z1,{label:"Task details",items:ye,children:[ve.jsx(HY,{result:S}),ve.jsxs("p",{className:"mb-2 text-sm",children:[e.defaults?.agent?"Agent: "+e.defaults.agent+". ":"Configured project agent and workflow. ",e.defaults?.workflow?"Workflow: "+e.defaults.workflow+". ":"",e.defaults?.permissions||"Tool permissions follow the existing project settings."]}),ve.jsx("p",{className:"mb-2 text-sm text-muted-foreground",children:"Permission prompts may require the supported terminal controls in the workspace. Stop requests cancellation; it does not undo files."}),!XM(b).length&&ve.jsx("p",{className:"mb-2 text-sm",children:"No run has started yet."}),ve.jsxs("small",{className:"mb-1 block break-words text-muted-foreground",children:["Task ",b.id," · revision ",b.revision]})]})]}),ve.jsxs("div",{role:"status",className:"flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5 text-base",children:[ve.jsx(qv,{category:b.attention?.category??"in-progress",children:zv(b)}),ve.jsx("span",{className:"text-muted-foreground",children:b.attention?.action||""}),ve.jsx("span",{className:"text-muted-foreground",children:R&&!b.decision?b.actions?.acceptWhy??"":""}),ve.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:b$(S)})]}),ve.jsxs("div",{className:"flex min-h-0 flex-1 items-stretch",children:[ve.jsxs("section",{"aria-label":"Task results",className:"flex min-h-0 min-w-0 flex-1 flex-col max-md:data-[drawer=true]:hidden","data-drawer":A,children:[v.length>1&&ve.jsx("div",{className:"mb-3.5",children:ve.jsxs(Pt,{value:N,onValueChange:(P)=>{i(P),l(P===b.currentResultId),d("")},children:[ve.jsx(_t,{"aria-label":"Saved results",size:"sm",title:"Files are retained without automatic expiry. Live links remain mutable.",children:ve.jsx(Ot,{})}),ve.jsx(zt,{children:[...v].reverse().map((P,Ae)=>ve.jsxs(dt,{value:P.id,children:[P.title||"Version "+(v.length-Ae),P.id===b.currentResultId?" · current":" · earlier saved output"]},P.id))})]})}),ve.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:ve.jsx(jY,{result:S,artifactId:c,working:b.status==="working"?zv(b):void 0,onSelect:d})}),b.acceptedResultId&&b.attention.category==="completed"&&ve.jsx("div",{className:"mt-2.5 text-success",children:"Accepted. Publishing is a separate action."})]}),ve.jsxs("div",{role:"complementary","aria-label":"Conversation and requests",className:C("flex min-h-0 w-0 flex-none flex-col gap-1.5 overflow-hidden opacity-0 invisible transition-[width,margin,opacity] duration-300 motion-reduce:transition-none",A&&"visible ml-6 w-[380px] border-l border-[color:color-mix(in_srgb,var(--line)_50%,transparent)] pl-5 opacity-100 max-md:ml-0 max-md:w-full max-md:border-l-0 max-md:pl-0"),children:[ve.jsxs("header",{className:"flex min-w-[340px] items-center max-md:min-w-0",children:[ve.jsx("h2",{className:C(tde,"mr-auto"),children:"Conversation"}),ve.jsx(me,{icon:"x",label:"Close conversation",onClick:()=>p(!1)})]}),ve.jsxs("div",{ref:m,className:"min-h-0 min-w-[340px] flex-1 overflow-auto max-md:min-w-0 [scrollbar-gutter:stable]",children:[ve.jsx(Xk,{decision:b.decision,needsProject:!b.dir||b.decision?.kind==="project",projects:e.projects,pending:n,onApprove:(P)=>void xc("confirm",{decisionId:P}),onAnswer:(P)=>(Yk(P),void V()),onProject:(P)=>void xc("project",P)}),!!b.files?.length&&ve.jsxs("details",{className:"mb-3",children:[ve.jsxs("summary",{className:"cursor-pointer",children:["Reference files · ",b.files.length]}),ve.jsx("ul",{className:"list-disc pl-5",children:b.files.map((P,Ae)=>ve.jsx("li",{className:"my-1",children:P.url&&/^\/file\?/.test(P.url)?ve.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:"underline",children:P.name}):P.name},Ae))})]}),ve.jsx("div",{role:"log","aria-label":"Task conversation","aria-live":"polite","aria-relevant":"additions",className:"flex flex-col gap-3 pb-2 pt-1",children:N$(b.messages).map((P)=>ve.jsx(LY,{from:P.role==="user"?"user":"agent",name:P.role==="user"?"You":P.role==="system"?"kaizen":"Assistant",at:P.at,text:P.text},P.id))}),b.status==="working"&&ve.jsx(GY,{}),Z.length>0&&ve.jsx("div",{"aria-label":"Requests awaiting completion",className:"mb-1.5 flex justify-end gap-1.5 px-1",children:Z.map((P)=>ve.jsx("span",{title:`Receipt ${P.id.slice(0,8)}`,className:"text-xs text-warning",children:P.state==="received"?"Received":"Queued for next pass"},P.id))})]})]})]}),ve.jsxs("form",{className:"flex-none",onSubmit:(P)=>{P.preventDefault(),V()},children:[ve.jsxs("div",{className:"flex items-end gap-2 rounded-lg border border-border bg-card py-2 pl-3.5 pr-2 shadow-sm focus-within:border-muted-foreground",children:[ve.jsx(xn,{ref:y,rows:1,"aria-label":"Your message","aria-describedby":"task-composer-help",placeholder:"Message the agent",title:"Enter to send, Shift+Enter for a new line",value:r,onChange:(P)=>Yk(P.target.value),onKeyDown:(P)=>{if(P.key==="Enter"&&!P.shiftKey&&!P.nativeEvent.isComposing&&!matchMedia("(pointer:coarse)").matches)P.preventDefault(),V()},className:"max-h-[140px] min-h-[30px] min-w-0 flex-1 py-1 [field-sizing:content]"}),ve.jsx(M,{type:"submit",variant:"primary",disabled:n,children:n?"Sending…":b.decision?.kind==="question"?"Send answer":"Send"})]}),ve.jsx("p",{id:"task-composer-help",className:"sr-only",children:ae}),ve.jsx("p",{role:"status",className:C("mx-0.5 mt-1.5 text-sm text-muted-foreground",!o&&"hidden"),children:o})]}),ve.jsx(lg,{open:!!f,title:f==="delete"?"Delete this task?":"Abandon this run?",description:f==="delete"?"It is not recorded anywhere.":"Saved files are not rolled back.",confirmLabel:f==="delete"?"Delete":"Abandon",danger:!0,onCancel:()=>g(""),onConfirm:()=>{let P=f;g(""),xe(P,P==="abandon"?{why:"abandoned from the task page"}:{})}})]})}var id=h(I(),1);var cn=h(w(),1);function VY(){return ut((e)=>e.page==="tasks")?cn.jsx(ode,{}):null}function ode(){let{tasks:e,loaded:t,error:n,scope:o}=G$(),{filter:r,query:a}=Dl(od((N)=>({filter:N.filter,query:N.query}))),[i,s]=id.useState(0),[l,c]=id.useState(!1),d=async()=>{let N=Date.now();c(!0),await Wk(),await new Promise((R)=>setTimeout(R,Math.max(0,700-(Date.now()-N)))),c(!1)},u=e.filter((N)=>!o||N.dir===o),p=w$(u,r,a),f=cw("tasks",p),g=f.rows,m=Math.max(0,Math.min(i,g.length-1)),y=()=>{s(0),f.setAt(0)},b=Nt((N)=>N.query);id.useEffect(()=>{uo({query:b}),y()},[b]);let x=id.useRef({rows:g,pick:m});x.current={rows:g,pick:m},id.useEffect(()=>{let N=(R)=>{let{rows:A,pick:D}=x.current,E=R.target;if(!A.length||R.defaultPrevented)return;if(E.id!=="tq"&&E.closest("input,textarea,select,[contenteditable],details,dialog,[role=dialog],[role=menu],[role=listbox]"))return;if(R.key==="ArrowDown"||R.key==="ArrowUp"){R.preventDefault();let z=Math.max(0,Math.min(A.length-1,D+(R.key==="ArrowDown"?1:-1)));s(z),document.querySelector(`[data-task-row="${z}"]`)?.scrollIntoView({block:"nearest"})}else if(R.key==="Enter"&&E.id==="tq"&&!R.isComposing)R.preventDefault(),e5(A[D])};return addEventListener("keydown",N),()=>removeEventListener("keydown",N)},[]);let v=(N)=>N==="all"?u.length:u.filter((R)=>R.attention.category===N).length,k=()=>{uo({filter:"all"}),cb(""),y(),Xw()},S=n?cn.jsx(ba,{title:n,children:cn.jsx(M,{onClick:()=>void Wk(),children:"Try again"})}):!t?cn.jsx(ba,{busy:!0,title:"Loading tasks…"}):u.length?cn.jsx(ba,{icon:"plus",title:"No tasks match",help:"Try another search or show all tasks.",children:cn.jsx(M,{onClick:k,children:"Clear search and filters"})}):cn.jsx(ba,{icon:"plus",title:"What would you like to make?",help:"Describe a goal. Keep the decisions, results and later changes together.",children:cn.jsx(M,{variant:"primary",onClick:()=>O.newTask(),children:"New task"})});return cn.jsxs(cn.Fragment,{children:[cn.jsxs("div",{className:"mb-2.5 flex flex-wrap items-center gap-2",children:[cn.jsxs("label",{className:"tk-q kz-keep",children:[cn.jsx(L,{name:"search",className:"size-3.5"}),cn.jsx(Hk,{id:"tq",placeholder:"Search tasks (press /)"})]}),cn.jsxs("span",{className:"flex items-center gap-2",children:[cn.jsx(me,{icon:cn.jsx(L,{name:"refresh",className:C(l&&"motion-safe:animate-spin")}),label:"Refresh tasks","aria-busy":l,disabled:l,onClick:()=>void d()}),cn.jsx(BY,{label:"Task filters",options:x$.map(([N,R])=>({id:N,label:R,count:v(N)})),value:r,onChange:(N)=>{uo({filter:N}),y()}}),cn.jsx("span",{className:"kz-keep flex",children:cn.jsx("button",{className:"btn pri",onClick:()=>Zi(),children:"New task"})})]})]}),cn.jsxs("div",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-[color:color-mix(in_srgb,var(--line)_50%,transparent)]",children:[g.length?cn.jsx("div",{"aria-label":"Tasks",className:"flex flex-col",children:g.map((N,R)=>cn.jsx(UY,{task:N,kb:m===R,"data-task-row":R,onClick:()=>void e5(N)},N.dir+N.id))}):S,cn.jsx(fv,{at:f.at,size:f.size,total:f.total,onAt:f.setAt,onSize:f.setSize})]})]})}var tf=h(w(),1);function KY(){return ho((t)=>t.seen)?tf.jsxs(tf.Fragment,{children:[tf.jsx(jq,{}),tf.jsx(Gq,{})]}):null}var Bg=h(w(),1),zi=({children:e,off:t})=>Bg.jsx("div",{className:"kz-ui",style:{display:t?"none":"contents"},children:e}),lS=({children:e})=>Bg.jsx("div",{className:"kz-ui",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:e}),$v=({page:e,children:t})=>ut((n)=>n.seen.includes(e))?Bg.jsx(Bg.Fragment,{children:t}):null;var Je=h(w(),1),rde=()=>[0,1,2,3,4].map((e)=>Je.jsxs("section",{"aria-hidden":"true",children:[Je.jsx("span",{className:"skel",style:{height:14,width:"40%",margin:"4px 0 12px"}}),Je.jsx("span",{className:"skel",style:{height:72,marginBottom:8}}),Je.jsx("span",{className:"skel",style:{height:72}})]},e));function ade(){let e=Nt((t)=>!t.snap);return Je.jsxs("main",{id:"board","aria-live":"polite","aria-busy":e||void 0,ref:(t)=>void(Qw.el=t),children:[e&&Je.jsx(rde,{}),Je.jsx(zi,{children:Je.jsx(uY,{})})]})}function qY(){return Je.jsxs(Je.Fragment,{children:[Je.jsx(ade,{}),Je.jsx("div",{id:"terms",className:"kz-ui","aria-label":"Terminals",children:Je.jsx(KY,{})}),Je.jsx("div",{id:"home","aria-label":"Chat",children:Je.jsx($v,{page:"home",children:Je.jsx(zi,{children:Je.jsx(dY,{})})})}),Je.jsx("div",{id:"phome",className:"kz-ui","aria-label":"Devices and runs",children:Je.jsx(RK,{})}),Je.jsx("div",{id:"tasksv","aria-label":"Tasks",children:Je.jsx($v,{page:"tasks",children:Je.jsx(lS,{children:Je.jsx(VY,{})})})}),Je.jsx("div",{id:"taskpagev","aria-label":"Task",children:Je.jsx($v,{page:"task",children:Je.jsx(lS,{children:Je.jsx(FY,{})})})}),Je.jsx("div",{id:"icev","aria-label":"Icebox",children:Je.jsx($v,{page:"icebox",children:Je.jsx(lS,{children:Je.jsx(zY,{})})})}),Je.jsxs("div",{id:"runv","aria-label":"Run workspace",children:[Je.jsx(d$,{}),Je.jsx("div",{id:"rpanes",children:Je.jsx(zi,{children:Je.jsx(sY,{})})})]}),Je.jsx("div",{className:"ftr kz-ui",id:"ftr",children:Je.jsx(Iq,{})})]})}var Ec=h(I(),1);var nf=h(I(),1);var Ii=h(w(),1),$Y="kz-d:",ide=(e)=>{try{return sessionStorage.getItem($Y+e)??""}catch{return""}},sde=[];function lde({k:e}){let t=wu((i)=>i.view),n=wu((i)=>i.files[e])??sde,o=nf.useRef(null),r=nf.useRef(null);nf.useLayoutEffect(()=>(o.current.selectionStart=o.current.selectionEnd=o.current.value.length,r.current=O.rich(o.current),()=>{if(r.current?.remove(),r.current=null,o.current)o.current.hidden=!1}),[]),nf.useEffect(()=>{if(I8(e))r.current?.focus()},[t]);let a=async()=>{let i=o.current;if(!await z8(t.card,i.value,n))return;i.value="",i.dispatchEvent(new Event("input",{bubbles:!0}))};return Ii.jsxs("div",{className:"notes flex flex-col gap-2",children:[Ii.jsx("div",{className:"kz-keep",onPaste:(i)=>{let s=_l(i);if(s.length)rT(e,s)},onKeyDown:(i)=>{if(i.key==="Enter"&&!i.shiftKey&&!i.nativeEvent.isComposing)i.preventDefault(),a()},children:Ii.jsx("textarea",{ref:o,defaultValue:ide("n:"+e),placeholder:"Add a note. Paste a screenshot, or attach files.",onInput:(i)=>{try{sessionStorage.setItem($Y+"n:"+e,i.currentTarget.value)}catch{}}})}),!!n.length&&Ii.jsx("div",{className:"text-xs text-muted-foreground",children:n.map((i)=>i.name).join(" · ")}),Ii.jsxs("div",{className:"flex items-center gap-1.5",children:[Ii.jsx(sc,{field:o}),Ii.jsx(Vu,{onFiles:(i)=>rT(e,i)}),Ii.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:"Enter sends, Shift+Enter newline"}),Ii.jsx(M,{variant:"primary",onClick:()=>void a(),children:"Send"})]})]})}function YY(){let e=wu((t)=>t.view?.card);return e?Ii.jsx(lde,{k:Mb(e)},Mb(e)):null}var Go=h(w(),1);function cde({card:e,src:t}){let n=D8(t);return Go.jsxs("div",{className:"mb-3.5 flex flex-col gap-2.5",children:[n.map((o,r)=>Go.jsxs("div",{className:"rounded-md border border-border bg-background px-3 py-2.5 [&_img]:my-1 [&_img]:block [&_img]:max-h-[260px] [&_img]:rounded-xs [&_p:last-child]:mb-0",children:[o.at&&Go.jsx("time",{className:"mb-1 block text-xs text-muted-foreground",children:o.at}),Go.jsx(Gp,{text:Yd(P8(o.text),e),className:"[&_a]:underline"})]},r)),!n.length&&Go.jsx("p",{className:"text-muted-foreground",children:"No notes yet."})]})}function WY(){let e=wu((i)=>i.view);if(!e)return null;let{card:t,src:n,ro:o,linked:r}=e,a=O8(t);return Go.jsxs(Go.Fragment,{children:[!!r?.length&&Go.jsxs("section",{className:"mb-3.5",children:[Go.jsx("h3",{className:"mb-2 text-xs tracking-[0.08em] text-muted-foreground uppercase",children:"Linked from notes"}),Go.jsx("ul",{className:"pl-[1.4em] list-disc",children:r.map((i)=>Go.jsx("li",{className:"my-[3px]",children:Go.jsx("a",{className:"text-primary underline-offset-[3px] hover:underline",href:`/notebook?dir=${encodeURIComponent(t.state)}&note=${encodeURIComponent(i)}`,children:i})},i))})]}),a&&Go.jsx("section",{className:"mb-3.5 border-b border-border pb-1.5",children:Go.jsx(Gp,{text:Yd(a,t),className:"[&_a]:underline"})}),Go.jsx(cde,{card:t,src:n}),!o&&Go.jsx(YY,{})]})}var wo=h(w(),1),u5="flex items-center gap-1.5 text-sm font-semibold";function XY(){let e=go((c)=>c.snap),t=go(Hl),n=Tn(e.card),o=go((c)=>c.ui[n]??yu(n)),r=e.branch,a=r.pr,i=o.ask;if(!i)return null;let s=wo.jsx(M,{variant:"ghost",onClick:()=>jR(void 0),children:"Cancel"}),l=r.upstream&&e.git.ahead===0?"":"Push & ";if(i==="pr"||i==="draft")return wo.jsxs("div",{className:"flex flex-col gap-1.5",children:[wo.jsxs("div",{className:u5,children:[i==="draft"?"Draft pull request":"Pull request"," into ",r.base]}),wo.jsx(Se,{label:"Title",children:(c)=>wo.jsx(Ue,{...c,value:o.title??e.title,onChange:(d)=>jl(n,{title:d.target.value})})}),wo.jsx(Se,{label:"Description",children:(c)=>wo.jsx(xn,{...c,value:o.body??`Run ${e.card.id}.`,onChange:(d)=>jl(n,{body:d.target.value}),className:"min-h-(--btn-s) resize-y rounded-sm border border-border bg-card px-2.5 py-1.5 hover:border-muted-foreground focus-visible:border-primary",rows:3})}),wo.jsxs("div",{className:"flex justify-end gap-1.5",children:[s,wo.jsx(M,{variant:"primary",disabled:!!t,onClick:()=>void Ba(i==="draft"?"go-draft":"go-pr"),children:t==="go-pr"||t==="go-draft"?"Creating PR…":`${l}${i==="draft"?"create draft PR":"create PR"}`})]})]});if(i==="merge")return wo.jsxs("div",{className:"flex flex-col gap-1.5",children:[wo.jsxs("div",{className:u5,children:["Merge #",a?.number," into ",r.base," by rebase?"]}),wo.jsxs("div",{className:"flex justify-end gap-1.5",children:[s,wo.jsx(M,{variant:"primary",disabled:!!t,onClick:()=>void Ba("go-merge"),children:t==="go-merge"?"Merging…":"Merge PR"})]})]});return wo.jsxs("div",{className:"flex flex-col gap-1.5",children:[wo.jsxs("div",{className:u5,children:["Remove the worktree and delete ",r.branch,"?"]}),wo.jsxs("div",{className:"text-sm text-muted-foreground",children:["Its work is on ",r.base,". The branch is deleted here",r.local?"":" and on GitHub","."]}),wo.jsxs("div",{className:"flex justify-end gap-1.5",children:[s,wo.jsx(M,{variant:"danger",disabled:!!t,onClick:()=>void Ba("go-remove"),children:t==="go-remove"?"Removing…":"Remove workspace"})]})]})}var d5=h(w(),1),ude={undo:["M9 14 4 9l5-5","M4 9h11a5 5 0 0 1 0 10h-4"],minus:["M5 12h14"],chev:["m9 6 6 6-6 6"],file:["M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z","M14 3v5h5"]};function sd({name:e,className:t}){return d5.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:C("size-(--ico-s) shrink-0 fill-none stroke-current stroke-2 [stroke-linecap:round] [stroke-linejoin:round]",t),children:ude[e].map((n)=>d5.jsx("path",{d:n},n))})}var Li=h(w(),1);function QY({log:e,head:t,shut:n}){if(!e.length)return null;return Li.jsxs("section",{className:"mt-auto border-t border-border pt-1.5",children:[Li.jsx("div",{className:"flex min-h-(--row) items-center text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:Li.jsxs("button",{type:"button","aria-expanded":!n,onClick:()=>Dw("log"),className:"inline-flex items-center gap-1.5 font-semibold uppercase tracking-wide text-foreground",children:[Li.jsx(sd,{name:"chev",className:C("transition-transform",!n&&"rotate-90")}),"Commits"," ",Li.jsxs("span",{className:"font-medium text-muted-foreground",children:[e.length,e.length>=50?"+":""]})]})}),!n&&Li.jsx("ol",{children:e.map((o,r)=>Li.jsxs("li",{title:o.sha+(o.unpushed?" (not pushed)":""),className:"relative flex min-h-[calc(var(--row)+2px)] items-center gap-2 pl-2 text-sm before:absolute before:bottom-0 before:left-[11px] before:top-0 before:w-0.5 before:bg-primary before:opacity-50 first:before:top-1/2 last:before:bottom-1/2",children:[Li.jsx("i",{className:C("relative size-2 shrink-0 rounded-full bg-primary",r===0&&"shadow-[0_0_0_3px_color-mix(in_srgb,var(--accent)_30%,transparent)]",o.unpushed&&"box-border border-2 border-primary bg-background")}),Li.jsx("span",{className:"min-w-0 flex-1 truncate",children:o.subject}),r===0&&t&&Li.jsx("em",{className:"rounded-full border border-primary px-1.5 font-mono text-xs not-italic text-primary",children:t})]},o.sha))})]})}var ZY=h(I(),1);var Fn=h(w(),1);function JY(){let e=go((r)=>r.confirm),t=go(Dm),n=(r)=>e&&(Wi({confirm:null}),e.ok(r));if(ZY.useEffect(()=>{if(e&&e.run!==t)n(!1)}),!e||e.run!==t)return null;let o="max-h-[180px] overflow-auto whitespace-pre-wrap break-words rounded-xs border border-border px-2 py-1.5 font-mono text-sm";return Fn.jsx(m1,{open:!0,onOpenChange:(r)=>!r&&n(!1),children:Fn.jsxs(g1,{children:[e.kind==="discard"?Fn.jsxs(Fn.Fragment,{children:[Fn.jsx(ov,{children:e.many?`Discard all ${e.many} unstaged changes?`:`Discard changes to "${e.path.split("/").pop()}"?`}),Fn.jsxs(rv,{children:[e.many?"This reverts every unstaged file below; new files are deleted.":e.untracked?"This will delete this new file.":"This will revert the unstaged changes to this file."," ","This cannot be undone."]}),Fn.jsx("div",{className:o,children:e.path})]}):Fn.jsxs(Fn.Fragment,{children:[Fn.jsx(ov,{children:e.pf.branch===e.pf.base?`Stopped before pushing to ${e.pf.base}`:`Stopped before landing ${e.pf.branch||"this run"} on ${e.pf.base}`}),Fn.jsx(rv,{children:"Other work needs a look first. Rebase, wait for CI or land the other work first, or go ahead anyway."}),Fn.jsx("div",{className:o,children:e.pf.issues.map((r,a)=>Fn.jsxs("div",{children:[r.what,r.files?.length?`: ${r.files.slice(0,6).join(", ")}${r.files.length>6?` +${r.files.length-6} more`:""}`:""]},a))}),e.pf.notes.length>0&&Fn.jsx("p",{className:"text-sm text-muted-foreground",children:e.pf.notes.map((r)=>`${r}. `)})]}),Fn.jsxs("div",{className:"mt-1 flex justify-end gap-1.5",children:[Fn.jsx(h1,{children:"Cancel"}),Fn.jsx(b1,{danger:!0,onClick:()=>n(!0),children:e.kind==="discard"?Fn.jsxs(Fn.Fragment,{children:[Fn.jsx(sd,{name:"undo"}),"Discard"]}):"Go ahead anyway"})]})]})})}var cS=h(w(),1);function uS({add:e,del:t}){if(!e&&!t)return null;return cS.jsxs("span",{className:"inline-flex gap-1.5 font-mono text-xs",children:[cS.jsxs("i",{className:"not-italic text-success",children:["+",e]}),cS.jsxs("i",{className:"not-italic text-danger",children:["-",t]})]})}var eo=h(w(),1),dde="size-[calc(var(--row)-4px)] min-w-[calc(var(--row)-4px)] [&_svg]:size-(--ico-s) [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:stroke-2",Hg=(e,t,n,o="",r=!1,a=!1)=>eo.jsx(me,{icon:n==="plus"?eo.jsx(L,{name:"plus"}):eo.jsx(sd,{name:n}),label:e,disabled:a,onClick:()=>void Ba(t,o,r),className:dde},t);function pde({r:e}){let t=go((a)=>!!Hl(a)),n=e.path.lastIndexOf("/"),o=e.path.slice(n+1),r=n>0?e.path.slice(0,n):"";return eo.jsxs("li",{className:"group/row flex min-h-[calc(var(--row)+2px)] items-center gap-2 rounded-sm px-2 hover:bg-muted",title:e.path,children:[eo.jsx(sd,{name:"file",className:"text-warning"}),eo.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[o,r&&eo.jsx("small",{className:"ml-1.5 text-xs text-muted-foreground",children:r})]}),eo.jsxs("span",{className:"grid h-full items-center justify-items-end [&>*]:[grid-area:1/1]",children:[eo.jsx("span",{className:"invisible inline-flex group-focus-within/row:visible group-hover/row:visible pointer-coarse:visible",children:e.staged?Hg(`Unstage ${e.path}`,"unstage","minus",e.path,!1,t):[Hg(`Discard changes to ${e.path}`,"discard","undo",e.path,e.code==="U",t),Hg(`Stage ${e.path}`,"stage","plus",e.path,!1,t)]}),eo.jsxs("span",{className:"inline-flex items-center gap-1.5 group-focus-within/row:invisible group-hover/row:invisible pointer-coarse:invisible",children:[eo.jsx(uS,{add:e.add,del:e.del}),eo.jsx("span",{className:C("w-(--ico) text-center font-mono text-xs font-semibold text-warning",(e.code==="A"||e.code==="U")&&"text-success",e.code==="D"&&"text-danger"),children:e.code})]})]})]})}function p5({id:e,title:t,rows:n,shut:o}){let r=go((a)=>!!Hl(a));if(!n.length)return null;return eo.jsxs("section",{children:[eo.jsxs("div",{className:"flex min-h-(--row) items-center justify-between gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[eo.jsxs("button",{type:"button","aria-expanded":!o,onClick:()=>Dw(e),className:"inline-flex items-center gap-1.5 font-semibold uppercase tracking-wide text-foreground",children:[eo.jsx(sd,{name:"chev",className:C("transition-transform",!o&&"rotate-90")}),t," ",eo.jsx("span",{className:"font-medium text-muted-foreground",children:n.length})]}),eo.jsx("span",{className:"inline-flex",children:e==="staged"?Hg("Unstage all","unstageall","minus","",!1,r):[Hg("Discard all changes","discardall","undo","",!1,r),Hg("Stage all","stageall","plus","",!1,r)]})]}),!o&&eo.jsx("ul",{children:n.map((a)=>eo.jsx(pde,{r:a},(a.staged?"s:":"u:")+a.path))})]})}var Xa=h(w(),1),f5="mb-1.5 inline-flex h-(--btn-xs) items-center gap-1.5 self-start rounded-sm border border-border bg-card px-2 text-xs font-medium";function eW({g:e,b:t,rows:n,all:o}){let r=t?.pr,[a,i]=yL(n);return Xa.jsxs("div",{className:"flex flex-col",children:[r?Xa.jsxs("a",{className:C(f5,"hover:bg-muted",r.state==="OPEN"&&!r.draft&&"text-success",r.state==="MERGED"&&"text-primary",(r.state==="CLOSED"||r.draft)&&"text-muted-foreground"),href:r.url,target:"_blank",rel:"noopener",title:"Open on GitHub",children:[Xa.jsx(L,{name:"git",sprite:"t",className:"size-(--ico-s)"}),"#",r.number," ",r.draft&&r.state==="OPEN"?"Draft":xL[r.state]||r.state]}):t?.checking?Xa.jsx("span",{className:C(f5,"text-muted-foreground"),children:"Checking PR…"}):t?.gh&&!o.find((s)=>s.a==="pr").why?Xa.jsxs("button",{type:"button",className:C(f5,"hover:bg-muted"),onClick:()=>void Ba("pr"),children:[Xa.jsx(L,{name:"git",sprite:"t",className:"size-(--ico-s)"}),"Create PR"]}):null,Xa.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-sm font-medium",title:vL(e)||e.branch,children:[Xa.jsx("span",{className:"min-w-0 flex-1 truncate",children:t?t.branch:e.branch||"HEAD"}),Xa.jsx(uS,{add:a,del:i})]}),Xa.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-sm text-muted-foreground",children:["→ ",IR(e,t),r&&Xa.jsx(me,{icon:"ext",label:"Open on GitHub",href:r.url,target:"_blank",rel:"noopener",className:"ml-auto"})]})]})}var dS=h(I(),1);var Rc=h(w(),1);function tW({value:e,onChange:t}){let n=dS.useRef(null),o=go((r)=>Hl(r)==="spark");return dS.useLayoutEffect(()=>{let r=n.current;r.style.height="auto",r.style.height=Math.min(r.scrollHeight+2,innerHeight/2)+"px"},[e]),Rc.jsxs(Rc.Fragment,{children:[Rc.jsxs("div",{className:"relative",children:[Rc.jsx(xn,{ref:n,"aria-label":"Commit message",placeholder:"Message",value:e,onChange:(r)=>t(r.target.value),className:"min-h-[calc(var(--row)*3)] resize-y rounded-sm border border-border bg-card py-2 pl-3 pr-8 hover:border-muted-foreground focus-visible:border-primary"}),Rc.jsx(me,{icon:"ai",label:"Write a commit message from the changes",disabled:o,onClick:()=>void Ba("spark"),className:C("absolute right-1.5 top-1.5 size-(--btn-xs) hover:text-primary [&_svg]:size-3.5",o&&"[&_svg]:motion-safe:animate-spin")})]}),e.split(`
115
+ `)[0].length>72&&Rc.jsx("div",{className:"text-sm text-muted-foreground",children:"First line over 72 characters."})]})}var pS=h(I(),1);var ro=h(w(),1);function nW({main:e,all:t,prUrl:n}){let o=go(Hl),r=pS.useRef(null),[a,i]=pS.useState();return ro.jsxs("div",{ref:r,className:"flex w-full",children:[ro.jsx(M,{disabled:!e.a||!!o,onClick:()=>void Ba(e.a),className:"min-h-(--btn-s) flex-1 rounded-r-none",children:o&&LR[o]?LR[o]:ro.jsxs(ro.Fragment,{children:[e.icon&&ro.jsx(L,{name:e.icon,className:"size-(--ico-s) stroke-current stroke-2"}),e.label]})}),ro.jsxs(En,{onOpenChange:(s)=>s&&i(r.current?.offsetWidth),children:[ro.jsx(An,{asChild:!0,children:ro.jsx(M,{"aria-label":"More commit and remote actions",title:"More commit and remote actions",className:"min-h-(--btn-s) rounded-l-none border-l-border px-2",children:ro.jsx(L,{name:"chev",className:"size-(--ico)"})})}),ro.jsxs(Mn,{style:{width:a},className:"text-sm",children:[t.map((s)=>ro.jsxs(nn,{disabled:!!s.why||!!o,onSelect:()=>void Ba(s.a),className:"flex-col items-start gap-0 py-1 text-foreground data-[disabled]:text-muted-foreground data-[disabled]:opacity-100",children:[ro.jsx("span",{children:s.label}),s.why&&ro.jsx("small",{className:"text-xs",children:s.why})]},s.a)),n&&ro.jsxs(ro.Fragment,{children:[ro.jsx(Zr,{}),ro.jsx(nn,{asChild:!0,children:ro.jsx("a",{href:n,target:"_blank",rel:"noopener",children:"Open PR on GitHub"})})]})]})]})]})}var Fr=h(w(),1);function fde(){let e=go((d)=>d.snap),t=e?Tn(e.card):"",n=go((d)=>d.ui[t]??yu(t));if(!e)return null;let{git:o,branch:r}=e,a=gL(o,r),i=o.rows??[],s=i.filter((d)=>d.staged),l=i.filter((d)=>!d.staged),c=!i.length&&bL(o,r);return Fr.jsxs("div",{className:"flex min-h-full flex-col gap-4.5 px-2 pt-1.5 text-base",children:[Fr.jsx(eW,{g:o,b:r,rows:i,all:a}),i.length>0&&Fr.jsx(tW,{value:n.msg??e.msg,onChange:(d)=>jl(t,{msg:d})}),c&&Fr.jsxs("div",{className:"flex flex-col gap-1.5",children:[Fr.jsx("b",{className:"text-lg font-semibold",children:c.head}),Fr.jsx("span",{className:"text-sm text-muted-foreground",children:c.body})]}),n.ask&&r?Fr.jsx(XY,{}):Fr.jsx(nW,{main:hL(a,s.length,l.length),all:a,prUrl:r?.pr?.url}),Fr.jsx(p5,{id:"staged",title:"Staged changes",rows:s,shut:n.shut.staged}),Fr.jsx(p5,{id:"changes",title:"Changes",rows:l,shut:n.shut.changes}),Fr.jsx(QY,{log:o.log??[],head:r?r.branch:o.branch,shut:n.shut.log}),Fr.jsx(JY,{})]})}function oW(){return go((t)=>!!t.snap)?Fr.jsx("div",{className:"kz-ui",children:Fr.jsx(fde,{})}):null}var dd=h(I(),1);var ld=h(w(),1);function fS({sidebar:e,title:t,actions:n,phone:o="content",bodyRef:r,children:a}){return ld.jsxs("div",{className:"grid h-full grid-cols-[280px_minmax(0,1fr)] max-[640px]:block max-[640px]:h-auto",children:[ld.jsx("div",{className:C("min-h-0 min-w-0",o==="content"&&"max-[640px]:hidden"),children:e}),ld.jsxs("div",{className:C("mr-2 mt-2 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg border border-border bg-background","max-[640px]:m-0 max-[640px]:overflow-visible max-[640px]:rounded-none max-[640px]:border-0 max-[640px]:bg-transparent",o==="sidebar"&&"max-[640px]:hidden"),children:[ld.jsxs("header",{className:"flex h-[52px] shrink-0 items-center gap-3 border-b border-border/60 pl-7 pr-5 max-[640px]:hidden",children:[ld.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:t}),n]}),ld.jsx("div",{ref:r,className:"min-h-0 flex-1 overflow-y-auto max-[640px]:overflow-visible",children:a})]})]})}var Dr=h(w(),1);function rW(){return Dr.jsx(fS,{title:"Settings",phone:"sidebar",sidebar:Dr.jsxs("div",{"aria-busy":"true","aria-label":"Loading",className:"flex flex-col px-3 pt-[18px]",children:[Dr.jsx(Jr,{className:"mb-6 h-8 w-3/5"}),Dr.jsx(Jr,{className:"mb-6 h-8 w-full"}),[4,3,4].map((e,t)=>Dr.jsxs("div",{className:"mb-5 grid gap-0.5",children:[Dr.jsx(Jr,{className:"mx-3 mb-3 h-[11px] w-2/5"}),Array.from({length:e},(n,o)=>Dr.jsx(Jr,{className:"h-8 w-full"},o))]},t))]}),children:Dr.jsx("div",{className:"px-[clamp(16px,5vw,56px)] pt-9",children:Dr.jsxs("div",{className:"mx-auto max-w-[720px]",children:[Dr.jsx(Jr,{className:"mb-2 h-7 w-[30%]"}),Dr.jsx(Jr,{className:"mb-6 h-3.5 w-[55%]"}),Dr.jsx("div",{className:"rounded-lg border border-border bg-card px-3.5 py-1",children:Array.from({length:6},(e,t)=>Dr.jsxs("div",{children:[Dr.jsx(Jr,{className:"mb-1.5 mt-3 h-[13px] w-[70%]"}),Dr.jsx(Jr,{className:"mb-3 h-[11px] w-[45%]"})]},t))})]})})})}var mS=h(I(),1);var Fo=h(w(),1),aW=(e)=>e.split(/[\\/]/).filter(Boolean).pop()??e,iW=(e,t)=>Fo.jsx("span",{className:`grid shrink-0 place-items-center rounded-md border border-border bg-background text-foreground ${t?"size-[34px]":"size-[22px]"}`,children:Fo.jsx(L,{name:e,className:t?"size-[18px]":"size-3.5"})});function sW(){let e=Me((o)=>o.data?.cfg);if(!e)return null;let t=e.scope!=="all",n=t?aW(e.projects.find((o)=>o.dir===e.scope)?.label??e.scope):"All projects";return Fo.jsx("div",{className:"mb-2.5 max-[640px]:mb-4",children:Fo.jsxs(Pt,{value:e.scope,onValueChange:dG,children:[Fo.jsx(_t,{id:"s-scope","aria-label":"Settings for",title:t?"This project's own .kaizen/config.yml; anything it does not set comes from All projects.":"~/.kaizen/config.yml; a project's own config wins where it sets a value.",className:"h-auto w-full gap-2.5 rounded-lg px-3 py-2.5 text-left",children:Fo.jsx(Ot,{children:Fo.jsxs("span",{className:"flex items-center gap-2.5",children:[iW(t?"board":"home",!0),Fo.jsxs("span",{className:"grid min-w-0 flex-1 leading-snug",children:[Fo.jsx("small",{className:"text-xs text-muted-foreground",children:"Settings for"}),Fo.jsx("b",{className:"truncate text-lg font-semibold text-strong",children:n}),Fo.jsx("small",{className:"text-xs text-muted-foreground",children:t?"Overrides All projects":"Every project"})]})]})})}),Fo.jsx(zt,{children:[{dir:"all",label:"All projects"},...e.projects].map((o)=>Fo.jsx(dt,{value:o.dir,className:"min-h-9 gap-2.5",children:Fo.jsxs("span",{className:"flex items-center gap-2.5",children:[iW(o.dir==="all"?"home":"board"),Fo.jsxs("span",{className:"grid min-w-0 leading-snug",children:[Fo.jsx("span",{className:"truncate",children:o.dir==="all"?o.label:aW(o.label)}),o.dir!=="all"&&Fo.jsx("small",{className:"truncate text-xs text-muted-foreground [direction:rtl] text-left",children:"‎"+o.label+"‎"})]})]})},o.dir))})]})})}var oa=h(w(),1),m5=({name:e,className:t})=>oa.jsx("span",{className:C("grid shrink-0 place-items-center rounded-sm text-muted-foreground",t),children:oa.jsx(L,{name:e,className:"size-full max-h-[18px] max-w-[18px]"})});function lW({hits:e,current:t,onSearchFocus:n}){let o=Me((i)=>i.q),r=Me((i)=>i.back),a=mS.useRef(null);return mS.useEffect(()=>{let i=(s)=>{if(!(s.ctrlKey||s.metaKey)||s.key.toLowerCase()!=="f")return;s.preventDefault(),a.current?.focus()};return addEventListener("keydown",i),ig.el=a.current,()=>{removeEventListener("keydown",i),ig.el=null}},[]),oa.jsxs("nav",{"aria-label":"Settings",className:"flex h-full min-h-0 flex-col px-3 pb-3.5 pt-[18px] max-[640px]:block max-[640px]:p-0",children:[oa.jsxs("button",{id:"sback",type:"button",className:"mb-1.5 flex h-(--row) shrink-0 items-center gap-(--gap) rounded-sm px-(--padx) text-base font-medium text-muted-foreground hover:text-foreground max-[640px]:hidden",onClick:()=>r?history.back():O.go("home",!0),children:[oa.jsx(L,{name:"chev",className:"size-(--ico) rotate-90"}),"Back to app"]}),oa.jsx("div",{className:"pb-2.5 max-[640px]:pb-3",children:oa.jsx(Ue,{id:"sq",ref:a,type:"search",placeholder:"Search settings","aria-label":"Search settings",spellCheck:!1,autoComplete:"off",value:o,onChange:(i)=>mt({q:i.target.value}),onFocus:()=>n(!0),onBlur:()=>n(!1),onKeyDown:(i)=>{if(i.key!=="Escape")return;if(i.preventDefault(),o)mt({q:""});else O.closePanel()}})}),oa.jsx(sW,{}),oa.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pt-1 max-[640px]:overflow-visible max-[640px]:pt-0",children:fA.map(([i,s])=>{let l=s.filter((c)=>e.includes(c.id));if(!l.length)return null;return oa.jsx("div",{role:"group","aria-label":i,className:"mb-3.5 grid gap-px max-[640px]:mb-5 max-[640px]:gap-0 max-[640px]:divide-y max-[640px]:divide-border max-[640px]:overflow-hidden max-[640px]:rounded-lg max-[640px]:border max-[640px]:border-border max-[640px]:bg-card",children:l.map((c)=>oa.jsxs("button",{type:"button","data-page":c.id,"aria-current":c.id===t?"page":void 0,className:C("group flex h-[30px] items-center gap-2 overflow-hidden whitespace-nowrap rounded-sm px-1.5 text-left text-sm text-foreground hover:bg-muted max-[640px]:h-11 max-[640px]:gap-3 max-[640px]:rounded-none max-[640px]:px-3 max-[640px]:text-[15px]","aria-[current=page]:bg-[color-mix(in_srgb,var(--accent)_14%,transparent)] aria-[current=page]:font-medium aria-[current=page]:text-strong"),onClick:()=>{document.activeElement?.blur?.(),D1(c.id)},children:[oa.jsx(m5,{name:c.ico,className:"size-[22px] group-hover:text-foreground group-aria-[current=page]:text-primary max-[640px]:size-7"}),oa.jsx("span",{className:"truncate",children:c.title})]},c.id))},i)})})]})}var of=h(I(),1);var cW=h(w(),1);function rf({value:e,onCommit:t,raw:n,...o}){let[r,a]=of.useState(e),[i,s]=of.useState(0),l=of.useRef(null);of.useEffect(()=>a(e),[e,i]);let c=()=>{let d=n?r:r.trim();if(d===e||d===l.current)return;l.current=d,Promise.resolve(t(d)).finally(()=>{l.current=null,s((u)=>u+1)})};return cW.jsx(Ue,{...o,value:r,onChange:(d)=>a(d.target.value),onBlur:c,onKeyDown:(d)=>d.key==="Enter"&&c()})}var Tt=h(w(),1);function uW({a:e}){let t=SG(e),n=CG(e.usage,e.signedIn,e.usageKnown!==!1);return Tt.jsxs(Tt.Fragment,{children:[t&&Tt.jsx("span",{className:"block text-xs text-foreground",children:t}),Tt.jsx("span",{className:C("text-xs text-muted-foreground",n.bad&&"text-warning"),children:n.text})]})}var gS=(e)=>!e.signedIn||e.usage?.expired;function dW({id:e}){let t=Me((n)=>n.data?.accounts?.accounts.find((o)=>o.id===e));if(!t)return null;return Tt.jsxs("div",{className:"px-3.5 py-2.5",children:[Tt.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[Tt.jsx("img",{src:Si[t.tool]??"",alt:"",width:28,height:28,className:"size-7 shrink-0 rounded-sm"}),Tt.jsxs("span",{className:"min-w-0 flex-[1_1_200px]",children:[Tt.jsx(rf,{value:t.name,maxLength:60,autoComplete:"off",spellCheck:!1,"aria-label":"Account name, click to rename",title:"Click to rename","data-ac-name":t.id,className:"-ml-1.5 h-6 max-w-70 border-transparent bg-transparent px-1.5 font-medium",onCommit:(n)=>cv({op:"rename",id:t.id,name:n})}),Tt.jsx(uW,{a:t})]}),gS(t)&&Tt.jsx(M,{"data-ac-sign":t.id,onClick:()=>void M1(t.id,t.tool),children:"Sign in"}),Tt.jsx(M,{"data-ac-def":t.isDefault?"":t.id,"aria-pressed":t.isDefault,onClick:()=>void cv({op:"default",tool:t.tool,id:t.isDefault?"":t.id}),children:t.isDefault?"✓ Default":"Default"}),Tt.jsx(M,{"data-ac-rm":t.id,onClick:()=>void QU(t.id,t.name),children:"Remove"})]}),gS(t)&&Tt.jsx(pW,{line:t.signIn})]})}var pW=({line:e})=>Tt.jsx("div",{className:"mt-1.5 text-xs text-muted-foreground",children:Tt.jsx("code",{className:"break-words",children:e})});function fW({tool:e}){let t=Me((n)=>n.data?.accounts?.normal?.find((o)=>o.tool===e));if(!t)return null;return Tt.jsxs("div",{className:"px-3.5 py-2.5",children:[Tt.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[Tt.jsx("img",{src:Si[e]??"",alt:"",width:28,height:28,className:"size-7 shrink-0 rounded-sm"}),Tt.jsxs("span",{className:"min-w-0 flex-[1_1_200px]",children:[Tt.jsxs("span",{className:"block font-medium",children:["Your login ",Tt.jsxs("i",{className:"ml-1.5 font-mono text-[11px] not-italic text-muted-foreground",children:["~/.",e]})]}),Tt.jsx(uW,{a:t})]}),gS(t)&&Tt.jsx(M,{"data-ac-sign":"",onClick:()=>void M1("",e),children:"Sign in"}),!t.noAccounts&&Tt.jsx(M,{"data-ac-def":"","aria-pressed":t.isDefault,disabled:t.isDefault,className:"disabled:opacity-100",title:t.isDefault?"Runs use this login":"Use this login for runs again",onClick:()=>void cv({op:"default",tool:e,id:""}),children:t.isDefault?"✓ Default":"Default"})]}),gS(t)&&Tt.jsx(pW,{line:t.signIn})]})}function mW(){let e=Me((t)=>t.data?.accounts);if(!e)return null;return Tt.jsx("div",{className:"flex flex-wrap items-center gap-1.5 px-3.5 py-3",children:vG(e).map((t)=>Tt.jsxs(M,{"data-ac-new":t,disabled:e.windows,onClick:()=>void XU(t),children:[Tt.jsx("img",{src:Si[t],alt:"",width:16,height:16,className:"rounded-[3px]"}),"Add ",bA[t]," account"]},t))})}var g5=h(I(),1);var Ie=h(w(),1),gW=[["own","Each agent's own settings"],["bypass","Bypass every permission prompt"]],mde=(e,t)=>Si[e]?Ie.jsx("img",{src:Si[e],alt:"",width:t,height:t,className:"shrink-0 rounded-[3px]"}):null;function hW(){let e=Me((r)=>r.data?.agents),t=Me((r)=>r.data?.cfg),n=Me((r)=>r.local["agent.default"]??t?.rows.find((a)=>a.key==="agent.default")?.value??"auto");if(!e)return null;let o=t&&t.scope!=="all"?t.projects.find((r)=>r.dir===t.scope)?.label:"";return Ie.jsxs("div",{className:"flex flex-col gap-2 px-3.5 py-2.5",children:[Ie.jsxs("span",{id:"ag-def-l",className:"text-sm text-strong",children:["Default for new agents",o?` in ${o}`:""]}),Ie.jsx("div",{role:"group","aria-labelledby":"ag-def-l",className:"flex flex-wrap gap-1.5",children:[{cmd:"auto",name:"Auto"},...e.agents.filter((r)=>r.enabled&&r.installed)].map((r)=>Ie.jsxs(ac,{className:"h-8 px-3 text-base",pressed:r.cmd===n,onPressedChange:()=>void sA(r.cmd),children:[mde(r.cmd,16),r.name,r.cmd===n?" ✓":""]},r.cmd))})]})}function bW(){let e=Me((t)=>t.data?.agents);if(!e)return null;return Ie.jsx(Se,{row:!0,id:"ag-perm",label:"All agents",help:"What every agent may do without asking, for all your projects. You can set one agent differently below. Cards show when a run uses bypass.",children:({id:t})=>Ie.jsxs(Pt,{value:e.permissions,onValueChange:(n)=>void lA(n),children:[Ie.jsx(_t,{id:t,className:"w-60 @max-[520px]:w-full",children:Ie.jsx(Ot,{})}),Ie.jsx(zt,{children:gW.map(([n,o])=>Ie.jsx(dt,{value:n,children:o},n))})]})})}function vW({cmd:e}){let t=Me((s)=>s.data?.agents),n=Me((s)=>s.data?.cfg),o=Me((s)=>s.openAgents.includes(e)),r=Me((s)=>s.local["agent.default"]??n?.rows.find((l)=>l.key==="agent.default")?.value??"auto"),a=t?.agents.find((s)=>s.cmd===e);if(!t||!a)return null;let i="ag-"+e;return Ie.jsxs("div",{className:C("px-3.5 py-2.5",!a.installed&&"opacity-65"),children:[Ie.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[Ie.jsx("img",{src:Si[e]??"",alt:"",width:28,height:28,className:"size-7 shrink-0 rounded-sm"}),Ie.jsxs("span",{className:"min-w-0 flex-[1_1_120px]",children:[Ie.jsx("b",{className:"block font-medium",children:a.name}),Ie.jsx("code",{className:"break-words text-xs text-muted-foreground",children:a.command||a.cmd})]}),!a.installed&&Ie.jsx("span",{className:"text-xs text-muted-foreground",children:"Not installed"}),Ie.jsx(Ti,{label:`${a.name} enabled`,idPrefix:`${i}-on`,options:[{id:"true",label:"Enabled"},{id:"false",label:"Disabled"}],value:String(a.enabled),onChange:(s)=>void Dp({agent:e,enabled:s==="true"})}),Ie.jsx(M,{id:`${i}-def`,"aria-pressed":r===e,disabled:!a.enabled||!a.installed,onClick:()=>void sA(e),children:r===e?"✓ Default":"Default"}),Ie.jsx(me,{id:`${i}-more`,icon:Ie.jsx(L,{name:"chev",className:C("transition-transform",o&&"rotate-180")}),label:`Details for ${a.name}`,"aria-expanded":o,"aria-controls":`${i}-b`,onClick:()=>WU(e)})]}),o&&Ie.jsx(gde,{a,envWorks:t.envWorks,all:t.permissions})]})}function gde({a:e,envWorks:t,all:n}){let o="ag-"+e.cmd,[r,a]=g5.useState(""),[i,s]=g5.useState(""),l=gW.find(([c])=>c===n)?.[1];return Ie.jsxs("div",{id:`${o}-b`,className:"mt-3 grid gap-3 pl-[38px] @max-[520px]:pl-0",children:[e.bypass?Ie.jsx(Se,{id:`${o}-perm`,label:"Permissions",children:({id:c},d)=>Ie.jsxs(Pt,{value:e.permissions,onValueChange:(u)=>void lA(u,e.cmd,e.name),children:[Ie.jsx(_t,{id:c,"aria-labelledby":d,className:"w-full",children:Ie.jsx(Ot,{})}),Ie.jsx(zt,{children:[["all",`Same as all agents · ${l}`],["own",`Use ${e.name}'s own settings`],["bypass","Bypass every permission prompt"]].map(([u,p])=>Ie.jsx(dt,{value:u,children:p},u))})]})}):Ie.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.name," has no bypass mode, so it uses its own settings."]}),Ie.jsx(Se,{id:`${o}-cmd`,label:"Command",children:(c)=>Ie.jsx(rf,{...c,raw:!0,value:e.command,placeholder:e.cmd,spellCheck:!1,autoComplete:"off",onCommit:(d)=>Dp({agent:e.cmd,command:d})})}),Ie.jsx(Se,{id:`${o}-args`,label:"Arguments",children:(c)=>Ie.jsx(rf,{...c,raw:!0,value:e.args,placeholder:"No default arguments",spellCheck:!1,autoComplete:"off",onCommit:(d)=>Dp({agent:e.cmd,args:d})})}),Ie.jsxs("div",{className:"flex flex-col gap-1.5",children:[Ie.jsx("span",{className:"text-base font-medium",children:"Environment"}),e.env.map((c)=>Ie.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Ie.jsxs("code",{className:"min-w-0 flex-[1_1_120px] break-words",children:[c,"=•••"]}),Ie.jsx(M,{size:"sm",onClick:()=>void Dp({agent:e.cmd,envRemove:c}),children:"Remove"})]},c)),Ie.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-1.5 @max-[520px]:grid-cols-1",children:[Ie.jsx(Ue,{id:`${o}-ek`,placeholder:"NAME","aria-label":"Variable name",spellCheck:!1,autoComplete:"off",value:r,onChange:(c)=>a(c.target.value)}),Ie.jsx(Ue,{id:`${o}-ev`,type:"password",placeholder:"value","aria-label":"Variable value",autoComplete:"new-password",value:i,onChange:(c)=>s(c.target.value)}),Ie.jsx(M,{id:`${o}-ea`,onClick:()=>{if(!r.trim())return;Dp({agent:e.cmd,envName:r.trim(),envValue:i}).then(()=>(a(""),s("")))},children:"Add"})]}),Ie.jsxs("p",{className:"text-xs text-muted-foreground",children:["Don't store secrets here: values are saved as plain text in ~/.kaizen/agents.json and are visible in the process list while the agent runs.",t?"":" Not applied on Windows yet."]})]}),Ie.jsxs("div",{className:"flex flex-col gap-1.5",children:[Ie.jsx("span",{className:"text-base font-medium",children:"Launch line"}),Ie.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-md border border-border bg-background p-2 text-xs",children:e.preview})]})]})}var Ge=h(w(),1),yW=(e)=>new Date(e).toLocaleString([],{weekday:"short",hour:"2-digit",minute:"2-digit",day:"numeric",month:"short"}),xW={hourly:"Every hour",daily:"Every day",weekdays:"Weekdays",weekly:"Every week",cron:"Cron"},hde=["mon","tue","wed","thu","fri","sat","sun"],h5="default";function wW({id:e}){let t=Me((n)=>n.data?.automations?.rules.find((o)=>o.id===e));if(!t)return null;return Ge.jsxs("div",{className:"px-3.5 py-2.5",children:[Ge.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[Ge.jsxs("span",{className:"min-w-0 flex-[1_1_200px]",children:[Ge.jsx("b",{className:"block font-medium",children:t.name}),Ge.jsxs("span",{className:"text-xs text-muted-foreground",children:[xW[t.kind]," · ",Ge.jsx("code",{children:t.cron})," ·"," ",t.enabled?t.next?"next "+yW(t.next):"never":"paused"]})]}),Ge.jsx(M,{"data-auto":"run","data-id":t.id,onClick:()=>void Pp("run",t.id),children:"Run now"}),Ge.jsx(M,{"data-auto":"edit","data-id":t.id,onClick:()=>void Pp("edit",t.id),children:"Edit"}),Ge.jsx(M,{"data-auto":"delete","data-id":t.id,onClick:()=>void Pp("delete",t.id),children:"Delete"}),Ge.jsx(sr,{"data-auto":t.enabled?"pause":"resume","data-id":t.id,"aria-label":t.name,title:t.enabled?"On":"Paused",checked:t.enabled,onCheckedChange:()=>void Pp(t.enabled?"pause":"resume",t.id)})]}),Ge.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:t.text.length>140?t.text.slice(0,140)+"…":t.text}),t.history.length>0&&Ge.jsxs("details",{className:"mt-1.5 text-xs text-muted-foreground",children:[Ge.jsxs("summary",{className:"cursor-pointer",children:["History (",t.history.length,")"]}),Ge.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.history.map((n,o)=>Ge.jsxs("li",{children:[Ge.jsx("time",{children:yW(n.at)})," · ",n.kind," · ",Ge.jsx("b",{children:n.status.replace(/_/g," ")}),n.reason?` · ${n.reason}`:"",n.run&&Ge.jsxs(Ge.Fragment,{children:[" ","· ",Ge.jsx("code",{children:n.run})]})]},o))})]})]})}var b5=(e,t,n,o)=>Ge.jsxs(Pt,{value:e,onValueChange:t,children:[Ge.jsx(_t,{...o,className:"w-full",children:Ge.jsx(Ot,{})}),Ge.jsx(zt,{children:n.map(([r,a])=>Ge.jsx(dt,{value:r,children:a},r))})]});function kW(){let e=Me((i)=>i.data?.automations),t=Me((i)=>i.draft),n=Me((i)=>i.editing);if(!e)return null;let o=(i)=>t[i]??"",r=(i,s,l={})=>Ge.jsx(Se,{id:`au-${i}`,label:s,children:(c)=>Ge.jsx(Ue,{...c,value:o(i),spellCheck:!1,autoComplete:"off",onChange:(d)=>sg(i,d.target.value),...l})}),a=o("kind");return Ge.jsxs("div",{className:"grid gap-3 px-3.5 py-2.5",children:[Ge.jsxs("div",{children:[Ge.jsx("b",{className:"block font-medium",children:n?"Edit automation":"New automation"}),Ge.jsxs("span",{className:"text-xs text-muted-foreground",children:["Project: ",e.project,". Times are ",e.zone,", this computer's. One board per project: runs start only while a board is open."]})]}),Ge.jsxs("p",{role:"alert",className:"text-xs text-warning",children:["Warning: an automation runs unattended in auto mode. It plans, builds and reviews with nobody watching, so it changes code in this project and spends tokens. It stops at the final approval only if your approval settings say so. At most ",e.cap," runs a day, and one open run at a time."]}),r("name","Name",{maxLength:60}),Ge.jsx(Se,{id:"au-text",label:"Request (what each run should do)",children:(i)=>Ge.jsx(xn,{...i,rows:3,value:o("text"),onChange:(s)=>sg("text",s.target.value),className:"min-h-16 rounded-sm border border-border bg-card px-2.5 py-1.5 hover:border-muted-foreground"})}),Ge.jsx(Se,{id:"au-kind",label:"Schedule",children:(i)=>b5(a,(s)=>sg("kind",s),Object.entries(xW),{id:i.id,"aria-describedby":i["aria-describedby"]})}),a==="cron"?r("cron","Cron (minute hour day month weekday)",{placeholder:"0 9 * * 1-5"}):Ge.jsxs(Ge.Fragment,{children:[r("time",a==="hourly"?"At minute (uses the minutes of HH:MM)":"Time (HH:MM)",{placeholder:"09:00"}),a==="weekly"&&Ge.jsx(Se,{id:"au-day",label:"Day",children:(i)=>b5(o("day"),(s)=>sg("day",s),hde.map((s)=>[s,s]),{id:i.id})})]}),Ge.jsx(Se,{id:"au-agent",label:"Agent",children:(i)=>b5(o("agent")||h5,(s)=>sg("agent",s===h5?"":s),[[h5,"Project default"],...e.agents.map((s)=>[s.cmd,s.name])],{id:i.id})}),r("precheck","Check before each scheduled run (optional shell command; exit 0 continues)",{placeholder:'git fetch -q && test -n "$(git log --since=7.days -1)"'}),Ge.jsx("p",{className:"-mt-2 text-xs text-muted-foreground",children:"Runs on this computer, in the project folder, every time this fires. Not run by Run now."}),r("precheck_timeout","Check time limit (seconds)",{inputMode:"numeric"}),r("grace_minutes","Late start allowed (minutes after the due time)",{inputMode:"numeric"}),Ge.jsxs("div",{className:"flex gap-1.5",children:[Ge.jsx(M,{variant:"primary","data-auto":"save",onClick:()=>void Pp("save"),children:n?"Save":"Create"}),n&&Ge.jsx(M,{"data-auto":"cancel",onClick:()=>void Pp("cancel"),children:"Cancel"})]})]})}var SW=()=>Ge.jsx("p",{className:"px-3.5 py-2.5 text-sm text-muted-foreground",children:"Open a project to add automations. They belong to one project each."});var bS=h(I(),1);var cd=h(I(),1);var jg=h(w(),1);function hS({id:e,values:t,value:n,onChange:o,delay:r=0,labelledBy:a}){let[i,s]=cd.useState(()=>Math.max(t.indexOf(n),0)),l=cd.useRef(void 0),c=cd.useRef(null),d=cd.useRef(null);cd.useEffect(()=>{if(!l.current)s(Math.max(t.indexOf(n),0))},[n,t]);let u=(f)=>{let g=(i+f+t.length)%t.length;if(s(g),clearTimeout(l.current),!r)return o(t[g]);l.current=setTimeout(()=>(l.current=void 0,o(t[g])),r)},p="size-7 rounded-sm text-[16px] text-muted-foreground hover:bg-card hover:text-foreground";return jg.jsxs("span",{id:e,role:"group","aria-labelledby":a,className:"inline-flex items-center gap-0.5 rounded-sm border border-border p-0.5",onKeyDown:(f)=>{if(f.key!=="ArrowLeft"&&f.key!=="ArrowRight")return;f.preventDefault();let g=(f.key==="ArrowLeft"?c:d).current;g?.focus(),g?.click()},children:[jg.jsx("button",{ref:c,id:`${e}-prev`,type:"button","aria-label":"Previous",className:p,onClick:()=>u(-1),children:"‹"}),jg.jsx("output",{"aria-live":"polite",className:C("min-w-22 whitespace-nowrap px-1.5 text-center text-sm text-foreground"),children:t[i]===""?"—":t[i]}),jg.jsx("button",{ref:d,id:`${e}-next`,type:"button","aria-label":"Next",className:p,onClick:()=>u(1),children:"›"})]})}var Bi=h(w(),1),bde={theme:{id:"th",label:"Theme",values:["system","light","dark"],help:""},color:{id:"co",label:"Color",values:["monochrome","blue"],help:""},motion:{id:"mo",label:"Motion",values:["system","full","reduce"],help:"Animations across kaizen. System follows the device's reduce-motion setting."}},vde=()=>typeof Notification>"u"?null:Notification.permission;function CW({kind:e,off:t}){let n=Me((o)=>o.prefs);if(e==="theme"||e==="color"||e==="motion"){let o=bde[e];return Bi.jsx(Se,{row:!0,id:o.id,label:o.label,help:o.help,children:(r,a)=>Bi.jsx(Ti,{label:o.label,labelledBy:a,idPrefix:o.id,options:o.values.map((i)=>({id:i,label:i})),value:n[e],onChange:(i)=>iG(e,i)})})}if(e==="font")return Bi.jsx(yde,{});if(e==="notify")return Bi.jsx(Se,{row:!0,id:"nt",label:"Notifications",help:O1(vde(),n.notify),children:(o)=>Bi.jsx(sr,{...o,checked:n.notify,onCheckedChange:lG})});if(e==="haptic")return Bi.jsx(Se,{row:!0,id:"hp",label:"Haptic feedback",help:"A light tick when you tap something on a phone.",children:(o)=>Bi.jsx(sr,{...o,checked:n.haptic,onCheckedChange:cG})});return Bi.jsx(Se,{row:!0,id:"ns",dim:t,label:"Notification sound",help:"Plays with each notice. Changing it plays it.",children:(o,r)=>Bi.jsx(hS,{id:"ns",labelledBy:r,values:O.notices.sounds,value:n.sound,onChange:uG})})}function yde(){let e=Me((r)=>r.prefs.font),[t,n]=bS.useState(String(e));bS.useEffect(()=>n(String(e)),[e]);let o=()=>{let r=hG(t,e,O.font.min,O.font.max);if(n(String(r)),r!==e)sG(r)};return Bi.jsx(Se,{row:!0,id:"tf",label:"Terminal font size",help:"In every board terminal. Ctrl+= and Ctrl+- change it from a terminal, Ctrl+0 resets it.",children:(r)=>Bi.jsx(Ue,{...r,type:"number",min:O.font.min,max:O.font.max,value:t,"aria-label":"Terminal font size in pixels",className:"w-20",onChange:(a)=>n(a.target.value),onBlur:o,onKeyDown:(a)=>a.key==="Enter"&&o()})})}var v5=h(w(),1);function NW({which:e}){let t=Me((i)=>i.data?.cleanup);if(!t)return null;let n=t.records.abandoned+t.records.unowned+t.records.gone,o=e==="records",r=o?n:t.runs,a=o?"s-clean-records":"s-clean-runs";return v5.jsx(Se,{row:!0,id:a,label:o?"Clean launch records":"Delete old runs",help:o?`${n} older than a week: ${t.records.abandoned} abandoned · ${t.records.unowned} unowned · ${t.records.gone} run gone`:`${t.runs} finished runs beyond the newest ${t.keep}${t.rescued?`; ${t.rescued} open backlog items move to backlog.md`:""}`,children:()=>v5.jsx(M,{id:a,disabled:!r,onClick:()=>void eG(e),children:o?"Clean up":"Delete"})})}var Vn=h(w(),1),xde="w-60 @max-[520px]:w-full";function y5({id:e,placeholder:t,password:n,disabled:o}){let r=Me((a)=>a.typed[e]??"");return Vn.jsx(Ue,{id:e,type:n?"password":"text",value:r,placeholder:t,disabled:o,spellCheck:!1,autoComplete:"off",className:xde,onChange:(a)=>qU(e,a.target.value)})}var x5=(e,t)=>Vn.jsxs("span",{className:"inline-flex items-center gap-1.5 @max-[520px]:w-full",children:[e,t]});function RW({kind:e}){let t=Me((s)=>s.data?.google??{}),n=Me((s)=>s.data?.research),o=Me((s)=>s.typed),r=Me((s)=>s.busy),a=t.hasClient?"Saved. Paste a new one to replace it":"";if(e==="google-id")return Vn.jsx(Se,{row:!0,id:"gg-id",label:"OAuth client id",children:()=>Vn.jsx(y5,{id:"gg-id",placeholder:t.hasClient?a:"Desktop app client id from Google Cloud"})});if(e==="google-secret")return Vn.jsx(Se,{row:!0,id:"gg-secret",label:"OAuth client secret",children:()=>x5(Vn.jsx(y5,{id:"gg-secret",password:!0,placeholder:a}),Vn.jsx(M,{id:"gg-save",onClick:()=>void tG(o["gg-id"]??"",o["gg-secret"]??""),children:"Save"}))});if(e==="google-conn")return Vn.jsx(Se,{row:!0,id:"gg-conn",label:"Google account",children:()=>Vn.jsx(M,{id:"gg-conn",variant:t.connected?"default":"primary",disabled:!t.hasClient&&!t.connected,onClick:()=>void nG(!!t.connected),children:t.connected?"Disconnect":"Connect"})});if(!n)return null;let i=n.source==="env";if(e==="fc-key")return Vn.jsx(Se,{row:!0,id:"fc-key",label:"Firecrawl API key",help:i?`Set by FIRECRAWL_API_KEY in the board's environment (${n.hint}); that one wins.`:Vn.jsxs(Vn.Fragment,{children:["Your own key from"," ",Vn.jsx("a",{className:"text-primary",href:"https://www.firecrawl.dev/app/api-keys",target:"_blank",rel:"noopener",children:"firecrawl.dev"}),". Agents search the web with ",Vn.jsx("code",{children:"kaizen search"})," and read pages with ",Vn.jsx("code",{children:"kaizen scrape"}),"; Explore uses it first. Kept in ~/.kaizen/firecrawl.json, on this machine only."]}),children:()=>x5(Vn.jsx(y5,{id:"fc-key",password:!0,disabled:i,placeholder:n.set?"Paste a new key to replace it":"fc-…"}),Vn.jsx(M,{id:"fc-save",disabled:i,onClick:()=>void oG(o["fc-key"]??""),children:"Save"}))});return Vn.jsx(Se,{row:!0,id:"fc-test",label:"Status",help:n.set?`Key saved (${n.hint}). Test spends one search credit.`:"Not set. Without it, agents use their own web tools.",children:()=>x5(Vn.jsx(M,{id:"fc-test",disabled:!n.set||r==="fc-test",onClick:()=>void rG(),children:r==="fc-test"?"Testing…":"Test"}),n.set&&!i?Vn.jsx(M,{id:"fc-del",onClick:()=>void aG(),children:"Remove"}):null)})}var Yv=h(I(),1);var Tc=h(w(),1),vS="default";function TW(){let[e,t]=Yv.useState([]),[n,o]=Yv.useState(vS);return Yv.useEffect(()=>{uL().then((r)=>{t(r);let a=Tw();o(r.some((i)=>i.id===a)?a:vS)})},[]),Tc.jsx(Se,{row:!0,id:"v-mic",label:"Microphone",help:"Used by this browser. Names appear after you first allow the microphone. Ctrl+Alt+D dictates into the focused terminal.",children:({id:r},a)=>Tc.jsxs(Pt,{value:n,onValueChange:(i)=>{o(i),lL(i===vS?"":i)},children:[Tc.jsx(_t,{id:r,"aria-labelledby":a,className:"w-60 @max-[520px]:w-full",children:Tc.jsx(Ot,{})}),Tc.jsxs(zt,{children:[Tc.jsx(dt,{value:vS,children:"System default"}),e.map((i)=>Tc.jsx(dt,{value:i.id,children:i.label},i.id))]})]})})}var bn=h(w(),1),wde=".orch-flow svg{display:block;overflow:visible;width:100%!important;height:auto!important;max-width:none!important;fill:none}.orch-l{fill:none;stroke:currentColor;stroke-width:2;opacity:.16}.orch-b{fill:none;stroke:var(--accent);stroke-width:3;stroke-linecap:round;filter:drop-shadow(0 0 5px var(--accent))}.orch-flow rect{fill:var(--bg);stroke:currentColor;stroke-width:1.5}.orch-i path,.orch-i circle{fill:none;stroke:var(--accent);stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.orch-flow text{fill:currentColor;stroke:none;font:600 15px var(--mono,ui-monospace,monospace)}@keyframes orch-beam{from{stroke-dashoffset:125}to{stroke-dashoffset:-25}}@media (prefers-reduced-motion:no-preference){.orch-b{stroke-dasharray:25 100;stroke-dashoffset:125;animation:orch-beam 4s linear infinite}}",EW=[["M150 125H200",0],["M265 96V50Q265 32 283 32H500",0.5],["M265 154V200Q265 218 283 218H500",0.5],["M500 60H335Q317 60 317 78V96",1.7],["M500 190H335Q317 190 317 172V154",1.7],["M382 125H740",2.8]],kde=[{x:20,y:96,w:130,name:"plan",icon:"doc"},{x:200,y:96,w:182,name:"conductor",icon:"hub"},{x:500,y:18,w:160,name:"worker 1",icon:"term"},{x:500,y:174,w:160,name:"worker 2",icon:"term"},{x:740,y:96,w:150,name:"review",icon:"ok"}],Sde={doc:bn.jsx("path",{d:"M1 1h7l4 4v9H1zM8 1v4h4"}),hub:bn.jsxs(bn.Fragment,{children:[bn.jsx("circle",{cx:"6.5",cy:"6.5",r:"2.5"}),bn.jsx("path",{d:"M6.5 0v3M6.5 10v3M0 6.5h3M10 6.5h3"})]}),term:bn.jsx("path",{d:"M1 2l4 3-4 3M7 10h5"}),ok:bn.jsxs(bn.Fragment,{children:[bn.jsx("circle",{cx:"6.5",cy:"6.5",r:"6"}),bn.jsx("path",{d:"M4 6.5l2 2 3.5-4"})]})};function AW(){let e=Me((o)=>!!o.data?.cfg?.windows),t=Me((o)=>!!o.data?.cfg?.rows.some((r)=>r.key==="orchestration.permissions"&&r.value==="bypass")),n=(o)=>bn.jsx("p",{className:"px-3.5 py-2.5 text-xs leading-normal text-muted-foreground",children:o});return bn.jsxs(bn.Fragment,{children:[bn.jsx("div",{className:"orch-flow mb-6 block w-full py-2",children:bn.jsxs("svg",{viewBox:"0 0 910 250",width:"100%",role:"img","aria-label":"A conductor takes the approved plan and hands tasks to workers. Each worker brings its work back to the conductor, which merges it and sends it to review.",children:[bn.jsx("style",{children:wde}),EW.map(([o])=>bn.jsx("path",{className:"orch-l",d:o},o)),EW.map(([o,r])=>bn.jsx("path",{className:"orch-b",pathLength:100,style:{animationDelay:`${r}s`},d:o},o)),kde.map((o)=>bn.jsxs("g",{transform:`translate(${o.x} ${o.y})`,children:[bn.jsx("rect",{width:o.w,height:58,rx:12}),bn.jsx("g",{transform:"translate(18 21) scale(1.15)",className:"orch-i",children:Sde[o.icon]}),bn.jsx("text",{x:44,y:35,children:o.name})]},o.name))]})}),(e||t)&&bn.jsxs("div",{className:"mb-6 divide-y divide-border rounded-lg border border-border bg-card",children:[e&&n("Not available on Windows: workers run in real terminals on Linux and macOS. Orchestration reads as off here."),t&&n("Warning: bypass skips every prompt in every worker. Each worker tab and the run's card say so.")]})]})}var dr=h(w(),1),Cde="w-60 @max-[520px]:w-full",Nde=(e)=>e.charAt(0).toUpperCase()+e.slice(1);function MW({row:e,off:t}){let n=Me((u)=>u.data?.cfg?.scope!=="all"),o=Me((u)=>u.local[e.key]??e.value),r=mA(e.key),a=fG(e),i=a==="model",s=gG(e),l=e.own&&n?dr.jsxs(dr.Fragment,{children:[s&&`${s} · `,"Set for this project ·"," ",dr.jsx("button",{type:"button",id:`${r}-reset`,className:"text-primary underline underline-offset-2",onClick:()=>void $U(e.key),children:"Reset"})]}):s,c=(u)=>void A1(e.key,u),d=i?dr.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[dr.jsx("img",{src:Si[P1(e.key)]??"",alt:"",width:16,height:16,className:"size-4 rounded-[3px]"}),mG(e.label)]}):e.label;return dr.jsx(Se,{row:!0,id:r,dim:t,label:d,help:l,children:(u,p)=>{if(a==="switch")return dr.jsx(sr,{...u,checked:o==="true",title:o==="true"?"On":"Off",onCheckedChange:(g)=>c(String(g))});if(a==="preset"||a==="segments"){let g=e.values;return dr.jsx(Ti,{label:e.label,labelledBy:p,idPrefix:r,options:g.map((m)=>({id:m,label:a==="preset"?Nde(m):m})),value:o,onChange:(m)=>m!=="custom"&&c(m)})}if(a==="stepper")return dr.jsx(hS,{id:r,labelledBy:p,values:e.values,value:o,delay:300,onChange:c});let f=dr.jsx(rf,{...u,value:e.value,placeholder:i?"inherit":"not set",list:i?`${r}-dl`:void 0,spellCheck:!1,autoComplete:"off",className:Cde,onCommit:(g)=>A1(e.key,g).then(()=>O.reload())});if(a==="folder")return dr.jsxs("span",{className:"inline-flex items-center gap-1.5 @max-[520px]:w-full",children:[f,dr.jsx(M,{id:`${r}-pick`,onClick:()=>void YU(e.key),children:"Browse…"})]});if(i)return dr.jsxs("span",{children:[f,gA[P1(e.key)]&&dr.jsx("datalist",{id:`${r}-dl`,children:gA[P1(e.key)].map((g)=>dr.jsx("option",{value:g},g))})]});return f}})}var DW=h(I(),1);var Cn=h(w(),1),Rde={installed:"installed",missing:"missing",other:"your own copy"},Tde={"Claude Code":"claude",Codex:"codex",Antigravity:"agy",OpenCode:"opencode",Cursor:"cursor","Gemini CLI":"gemini"};function Ede({n:e}){let t=Me((n)=>n.busy==="rea-node");if(e.how==="link")return Cn.jsx(M,{asChild:!0,children:Cn.jsx("a",{href:e.url,target:"_blank",rel:"noopener",children:"Get Node.js"})});return Cn.jsx(M,{"data-rea-node":e.state,disabled:t,onClick:()=>void JU(e.state,e.command??""),children:e.state==="missing"?"Install Node.js":"Update Node.js"})}function PW({id:e}){let t=Me((o)=>o.data?.skills?.skills.find((r)=>r.id===e));if(!t)return null;let n=t.group==="core";return Cn.jsxs("div",{className:"px-3.5 py-2.5",children:[Cn.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[Cn.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"size-6 shrink-0 fill-none stroke-current stroke-[1.6] [stroke-linecap:round] [stroke-linejoin:round]",children:NG(t.id).map(([o,r],a)=>DW.createElement(o,{key:a,...r}))}),Cn.jsxs("span",{className:"min-w-0 flex-[1_1_200px]",children:[Cn.jsxs("b",{className:"block font-medium",children:[t.title,t.status&&t.status!=="stable"&&Cn.jsx("em",{className:"ml-1.5 rounded-xs border border-border px-1.5 text-[10.5px] font-normal not-italic text-muted-foreground",children:t.status==="beta"?"Beta":"Experimental"})]}),Cn.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]}),n?t.agents.some((o)=>o.state!=="installed")?Cn.jsx(M,{"data-repair":t.id,onClick:()=>void ZU(t.id,t.agents.some((o)=>o.state==="other")),children:"Repair"}):Cn.jsx("span",{className:"text-xs text-muted-foreground",children:"Always on"}):Cn.jsxs(Cn.Fragment,{children:[t.rea?.node&&Cn.jsx(Ede,{n:t.rea.node}),t.rea?.update&&Cn.jsxs(M,{"data-rea-update":"1",onClick:()=>void dA(!0,!0),children:["Update to ",t.rea.latest]}),!t.rea&&!t.off&&t.agents.some((o)=>o.state==="missing")&&Cn.jsx(M,{"data-skill":t.id,"data-on":"true",onClick:()=>void uA(t.id,!0,!1),children:"Install"}),Cn.jsx(sr,{"data-skill":t.id,"aria-label":t.title,title:t.off?"Off":"On",checked:!t.off,onCheckedChange:(o)=>void uA(t.id,o,!!t.offByDefault)})]})]}),Cn.jsxs("div",{className:"ml-[34px] mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground @max-[520px]:ml-0",children:[t.agents.map((o)=>{let r=`${o.agent}: ${Rde[o.state]??o.state}`;return Cn.jsx("img",{src:Si[Tde[o.agent]??""]??"",width:18,height:18,alt:r,title:r,className:C("rounded-[3px]",o.state!=="installed"&&"opacity-30 grayscale")},o.agent)}),t.needs.map((o)=>Cn.jsxs("span",{className:C(!o.found&&"text-warning"),children:["Needs ",o.name,o.found?"":" (not found)"]},o.name)),t.note&&Cn.jsx("span",{children:t.note})]})]})}var ao=h(w(),1);function w5({item:e}){let t=Me((o)=>e.kind==="row"?o.data?.cfg?.rows.find((r)=>r.key===e.ref):void 0),n=e.ref??"";switch(e.kind){case"row":return t?ao.jsx(MW,{row:t,off:e.off}):null;case"cleanup":return ao.jsx(NW,{which:n});case"mic":return ao.jsx(TW,{});case"phone":return ao.jsx("div",{id:"phset",className:"px-3.5 py-2.5",children:ao.jsx(yk,{})});case"whatsapp":return ao.jsx("div",{id:"waset",className:"px-3.5 py-2.5",children:ao.jsx(MK,{})});case"google-id":case"google-secret":case"google-conn":case"fc-key":case"fc-test":return ao.jsx(RW,{kind:e.kind});case"theme":case"color":case"motion":case"font":case"notify":case"haptic":case"sound":return ao.jsx(CW,{kind:e.kind,off:e.off});case"agent-default":return ao.jsx(hW,{});case"agent-perm":return ao.jsx(bW,{});case"agent":return ao.jsx(vW,{cmd:n});case"account-normal":return ao.jsx(fW,{tool:n});case"account":return ao.jsx(dW,{id:n});case"account-add":return ao.jsx(mW,{});case"skill":return ao.jsx(PW,{id:n});case"automation":return ao.jsx(wW,{id:n});case"automation-form":return ao.jsx(kW,{});case"automation-none":return ao.jsx(SW,{});case"orchestration":return ao.jsx(AW,{});default:return null}}var ud=h(w(),1);function OW({section:e}){if(!e.title)return e.items.map((t)=>ud.jsx(w5,{item:t},t.id));return ud.jsxs("section",{className:"mt-6 first:mt-0",children:[ud.jsxs("h3",{className:"mb-2 flex items-center justify-between text-sm font-semibold normal-case tracking-normal text-strong",children:[e.title,e.extra&&ud.jsx(M,{id:e.extra==="refresh"?"ag-refresh":"sk-recheck",variant:"ghost",size:"sm",className:"text-primary",onClick:()=>void oc(),children:e.extra==="refresh"?"Refresh":"Re-check"})]}),ud.jsx("div",{className:"@container divide-y divide-border rounded-lg border border-border bg-card",children:e.items.map((t)=>ud.jsx(w5,{item:t},t.id))})]})}var gs=h(I(),1);var St=h(w(),1);function _W({v:e,label:t}){let[n,o]=gs.useState(""),[r,a]=gs.useState(!1);return St.jsx(M,{variant:"primary",id:"upd-go",disabled:r,onClick:async()=>{a(!0);let i=await EG(e);if(i==="no")o("");else o(i==="opened"?"Opened the download page":"Restarting…");a(i==="restarting")},children:n||t})}function Ade({v:e}){if(!e.notes?.length)return null;return St.jsxs(rr,{children:[St.jsx(ar,{asChild:!0,children:St.jsx(M,{children:"What's new"})}),St.jsxs(ir,{className:"w-[min(360px,calc(100vw-32px))] px-3.5 py-2.5 leading-normal",children:[St.jsx("ul",{className:"mb-2 list-disc pl-[18px]",children:e.notes.map((t)=>St.jsxs("li",{className:"my-0.5",children:[St.jsx("b",{children:t.v})," ",t.text]},t.v))}),St.jsx("a",{className:"text-primary",href:"https://github.com/hfadhlullah/kaizen/releases",target:"_blank",rel:"noopener",children:"All release notes"})]})]})}function zW(){let e=Gu((f)=>f.ver),[t,n]=gs.useState(""),[o,r]=gs.useState(""),[a,i]=gs.useState(!1),s=yA(e)?e:null,l=dv(),c=gs.useRef(null),d=async()=>{i(!0);let f=await xA(!0).catch(()=>null);if(i(!1),!f||!f.latest){if(s)r("Could not check. Try again");else n(`Could not reach ${globalThis.kaizenDesktop?"GitHub Releases":"npm"}. Try again later.`);return}if(r(""),wA(f),n(f.update?"":RG(f)),f.update)queueMicrotask(()=>c.current?.querySelector("#upd-go")?.focus())},u=t||(e?e.behind?vA(e):`${l} ${e.version}`:l),p=St.jsx(M,{id:"upd-chk",disabled:a,onClick:d,children:a?"Checking…":o||"Check for updates"});return St.jsxs("div",{className:"mb-6",children:[St.jsx("div",{className:"mb-2 text-sm font-semibold text-strong",children:"About"}),St.jsxs("div",{className:s?"relative flex flex-wrap items-center justify-between gap-3 rounded-lg border border-primary bg-[color-mix(in_srgb,var(--accent)_10%,var(--bg-2))] px-3.5 py-2.5 text-base":"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-card px-3.5 py-2.5 text-base text-strong",children:[e?.failed&&St.jsxs("span",{role:"alert",className:"basis-full text-warning",children:["Last update failed: ",e.failed]}),s?St.jsxs(St.Fragment,{children:[St.jsxs("span",{children:[l," ",St.jsx("b",{children:s.latest})," is available. You are running ",s.version,"."]}),St.jsxs("span",{ref:c,className:"flex items-center gap-2",children:[St.jsx(Ade,{v:s}),p,St.jsx(_W,{v:s,label:`Update ${l}`})]})]}):St.jsxs(St.Fragment,{children:[St.jsx("span",{id:"upd-msg","aria-live":"polite",children:u}),p]})]})]})}function IW(){let e=Gu((r)=>r.ver),t=Gu((r)=>r.later),[n,o]=gs.useState(!1);if(gs.useEffect(()=>o(!1),[e?.latest]),!yA(e)||t===e.latest||n)return null;return St.jsxs("div",{role:"status",className:"fixed bottom-7 right-7 z-40 flex w-80 max-w-[calc(100%-32px)] flex-col gap-3 rounded-md border border-primary bg-card px-4 py-3.5 text-base text-foreground shadow-md max-[640px]:bottom-[calc(68px+env(safe-area-inset-bottom))] max-[640px]:right-4",children:[St.jsxs("span",{children:[dv()," ",St.jsx("b",{children:e.latest})," is available. You are running ",e.version,"."]}),St.jsxs("span",{className:"flex items-center justify-end gap-2",children:[St.jsx(M,{onClick:()=>{TG(e.latest),o(!0)},children:"Later"}),St.jsx(_W,{v:e,label:"Update now"})]})]})}var Vo=h(w(),1);function LW(){let e=Me((f)=>f.data),t=Me((f)=>f.q),n=Me((f)=>f.page),o=Me((f)=>f.prefs.notify),r=pu(),[a,i]=dd.useState(!1),s=dd.useRef(null),{pages:l,hits:c,current:d}=dd.useMemo(()=>{if(!e)return{pages:new Map,hits:[],current:null};let f=typeof Notification>"u"?null:Notification.permission,g={notifyHelp:O1(f,o),notifyOn:o,scoped:!!e.cfg&&e.cfg.scope!=="all",agentCount:e.agents?.agents.filter((x)=>x.installed).length??0},m=hA(e,g),y=new Map(uv.map((x)=>[x.id,xG(yG(x.id,e,g,m),t)])),b=uv.filter((x)=>wG(y.get(x.id))).map((x)=>x.id);return{pages:y,hits:b,current:kG({picked:n,hits:b,query:t,narrow:r,typing:a&&r})}},[e,t,n,r,a,o]);if(dd.useEffect(()=>{if(s.current)s.current.scrollTop=0;if(gu.el)gu.el.scrollTop=0},[d]),!e)return Vo.jsx(rW,{});let u=uv.find((f)=>f.id===d),p=e.cfg&&e.cfg.scope!=="all"?e.cfg.projects.find((f)=>f.dir===e.cfg.scope)?.label??"":"";return Vo.jsx(fS,{sidebar:Vo.jsx(lW,{hits:c,current:d,onSearchFocus:i}),title:"Settings",phone:d===null?"sidebar":"content",bodyRef:s,children:Vo.jsxs("div",{className:"px-[clamp(16px,5vw,56px)] pb-16 pt-9 max-[640px]:p-0 max-[640px]:pb-6",children:[u&&Vo.jsxs("div",{"data-page":u.id,className:"mx-auto max-w-[720px]",children:[Vo.jsxs("button",{type:"button",className:"mb-3 hidden items-center gap-1.5 text-base text-muted-foreground hover:text-foreground max-[640px]:flex",onClick:()=>D1(""),children:[Vo.jsx(L,{name:"chev",className:"size-(--ico) rotate-90"}),"Settings"]}),Vo.jsxs("header",{className:"mb-6 flex items-center gap-3.5 max-[640px]:mb-5 max-[640px]:gap-3",children:[Vo.jsx(m5,{name:u.ico,className:"size-[52px] rounded-lg border border-border bg-background text-foreground max-[640px]:size-10 [&_svg]:size-[26px] max-[640px]:[&_svg]:size-5"}),Vo.jsxs("div",{children:[Vo.jsx("h2",{className:"mb-1.5 text-[22px] font-semibold leading-tight text-strong",children:u.title}),Vo.jsxs("p",{className:"text-sm leading-normal text-muted-foreground",children:[u.desc,p?` Editing ${p}.`:""]})]})]}),u.id==="general"&&Vo.jsx(zW,{}),l.get(u.id).map((f)=>Vo.jsx(OW,{section:f},f.title))]}),!e.cfg&&Vo.jsxs("p",{className:"mt-5 text-muted-foreground",children:["Settings could not be read. Run ",Vo.jsx("code",{children:"kaizen settings"}),"."]}),!c.length&&Vo.jsxs("p",{id:"snone",className:"mt-5 text-muted-foreground",children:["No setting matches “",t.trim(),"”."]})]})})}var Ve=h(w(),1),BW=({id:e})=>Ve.jsx("svg",{children:Ve.jsx("use",{href:`#${e}`})});function Mde(){let e=st((a)=>a.body),t=st((a)=>a.term),n=st((a)=>a.terms),o=st((a)=>a.top),r=Ec.useRef(null);return Ec.useLayoutEffect(()=>(gu.el=r.current,()=>void(gu.el=null)),[]),Ec.useLayoutEffect(()=>void(r.current.scrollTop=0),[o]),Ve.jsxs("div",{className:"body md",id:"pbody",ref:r,children:[e==="doc"&&Ve.jsx("div",{className:"kz-ui",children:Ve.jsx(Jq,{})}),e==="settings"&&Ve.jsx("div",{className:"kz-ui",style:{height:"100%",display:"contents"},children:Ve.jsx(LW,{})}),e==="notes"&&Ve.jsx("div",{className:"kz-ui",children:Ve.jsx(WY,{})}),n.length>0&&Ve.jsx("div",{className:"pterms",hidden:e!=="term",children:n.map((a)=>Ve.jsx(zi,{off:e!=="term"||t?.key!==a.key,children:Ve.jsx(Qu,{sessionKey:a.key,onEnd:a.onEnd,label:"Agent terminal"})},a.key))}),e==="git"&&Ve.jsx(oW,{})]})}function HW(){G8();let e=st((i)=>C(i.open&&"open",i.docked&&"docked",i.wide&&"wide",i.parked&&"parked",i.pn&&"pn",i.ro&&"ro")),t=st((i)=>i.open),n=st((i)=>i.title),o=st((i)=>i.titleTip),r=st((i)=>i.instant),a=Ec.useRef(null);return Ec.useLayoutEffect(()=>{if(!r)return;a.current.offsetWidth,Pe({instant:!1})},[r]),Ec.useEffect(()=>yB({panel:a.current,active:()=>nt()&&Ze().view==="run"&&Fe.getState().flip,close:()=>hu(!1),keep:"#panel,#rside,dialog,.toast,[data-sonner-toast]"}),[]),Ve.jsxs(Ve.Fragment,{children:[Ve.jsx("div",{className:C("scrim",t&&"on"),id:"scrim",onClick:oT}),Ve.jsxs("aside",{id:"panel","aria-label":"detail",ref:a,className:e||void 0,style:r?{transition:"none"}:void 0,children:[Ve.jsxs("header",{children:[Ve.jsxs("div",{className:"t",children:[Ve.jsx("div",{className:"pwrap",children:Ve.jsx(zi,{children:Ve.jsx(lY,{})})}),Ve.jsx("b",{id:"ptitle",title:o,children:n}),Ve.jsx("div",{className:"sub",id:"psub",children:Ve.jsx(zi,{children:Ve.jsx(s$,{})})})]}),Ve.jsx("button",{className:"ib",id:"pclose","aria-label":"Close",title:"Close",onClick:oT,children:Ve.jsx(BW,{id:"i-close"})})]}),Ve.jsxs("div",{className:"pstrip",children:[Ve.jsx("nav",{id:"ptabs",children:Ve.jsx(zi,{children:Ve.jsx(l$,{})})}),Ve.jsx("button",{className:"pnotes",id:"pnotes",title:"Project notes","aria-label":"Project notes",onClick:T8,children:Ve.jsx(BW,{id:"t-book"})})]}),Ve.jsx("div",{className:"body md",id:"pnlist",children:Ve.jsx(zi,{children:Ve.jsx(c$,{})})}),Ve.jsx(Mde,{}),Ve.jsx("div",{className:"foot",id:"pfoot",children:Ve.jsx(zi,{children:Ve.jsx(eY,{})})}),Ve.jsx(zi,{children:Ve.jsx(o$,{})})]})]})}var UW=h(I(),1);var GW=!1;function jW(e){{if(Ze().view==="sources"&&!Jh.getState().on&&IF(e))return;if(e.target.matches("input,select,textarea,[contenteditable]")||W_(e.target)||GW)return;if(e.key==="/"&&ig.el&&Re().open){e.preventDefault(),ig.el.focus();return}if(e.key==="/"&&(Ze().view==="board"||Ze().view==="tasks")){e.preventDefault(),Xw();return}if(e.key==="Escape"){if(Gs(!1),Ir().form)ym();else Qi();return}if(Ze().view==="terminal"||Ze().view==="task")return;if(e.key==="n")Zi();if(e.key==="a")po({all:!oe().all}),bm(oe().all?null:oe().state.dir),fo();let t={ArrowUp:[0,-1],k:[0,-1],ArrowDown:[0,1],j:[0,1],ArrowLeft:[-1,0],h:[-1,0],ArrowRight:[1,0],l:[1,0]}[e.key];if(t&&Re().openKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&oe().state.cards.find((a)=>Ne(a)===Re().openKey&&a.kind==="run")&&Re().ptabs?.length){if(e.preventDefault(),t[0])R8(t[0]);else aI(t[1]*40);return}if(t&&!Re().open&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.target===document.body||e.target.matches("#board .card"))){e.preventDefault(),eB(...t);return}let o=Re().openKey||J8(),r=o&&oe().state.cards.find((a)=>Ne(a)===o);if(!r)return;if(e.key==="e"&&r.kind==="idea")lT(r,"edit");if(e.key==="x"&&!["done","abandoned","starting"].includes(r.status))lT(r,"reject");if(e.key==="r"&&r.kind==="idea")Zw(r)}}function FW(){UW.useEffect(()=>{let e=()=>GW=Kx();return addEventListener("keydown",e,!0),document.addEventListener("keydown",jW),()=>{removeEventListener("keydown",e,!0),document.removeEventListener("keydown",jW)}},[])}var nX=h(I(),1);function VW(e,t){if(e===t)return!0;if(Math.abs(e.length-t.length)>1)return!1;let n=0;while(n<e.length&&n<t.length&&e[n]===t[n])n++;if(e.length===t.length){if(e.slice(n+1)===t.slice(n+1))return!0;return e[n]===t[n+1]&&e[n+1]===t[n]&&e.slice(n+2)===t.slice(n+2)}let[o,r]=e.length<t.length?[e,t]:[t,e];return o.slice(n)===r.slice(n+1)}var Dde=(e,t)=>e.includes(t)||t.length>=4&&e.split(/[^\p{L}\p{N}]+/u).some((n)=>VW(t,n.slice(0,t.length))||VW(t,n));function KW(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return e;let o=t.trim().toLowerCase(),r=(a)=>{let i=a.title.toLowerCase();return i===o?0:i.startsWith(o)?1:i.split(/[^\p{L}\p{N}]+/u).some((s)=>s.startsWith(o))?2:i.includes(o)?3:4};return e.filter((a)=>{let i=(a.title+" "+(a.sub??"")+" "+a.hay).toLowerCase();return n.every((s)=>Dde(i,s))}).sort((a,i)=>r(a)-r(i)||+(i.dot==="wait")-+(a.dot==="wait")||(i.at??0)-(a.at??0))}var Ug=de()(()=>({open:!1,newTask:()=>{}})),Pde=["Current","Workspaces","Runs","Tasks","Chats & terminals"];function qW(e,t,n){let o=t.trim();if(!o){let i=(d,u)=>(u.at??0)-(d.at??0),s=e.filter((d)=>d.dot==="wait"&&(d.group==="Runs"||d.group==="Tasks")).sort(i).slice(0,3),l=e.filter((d)=>Pde.includes(d.group)&&!s.includes(d)).sort(i).slice(0,5),c=[...s.map((d)=>({...d,group:"Needs you"})),...l.map((d)=>({...d,group:d.group==="Current"?"Current":"Recent"}))];if(c.length<4)c.push(...e.filter((d)=>d.group==="Actions"&&d.page).map((d)=>({...d,group:"Go to"})));return c}let r=KW(e,t),a=[...new Set(r.map((i)=>i.group))].flatMap((i)=>r.filter((s)=>s.group===i).slice(0,8));return a.push({group:"Create",title:`New task "${o}"`,hay:"",ico:"plus",act:()=>n(o)}),a}var sf=()=>!1,pd=(e)=>sf()?void(location.href=e):jd(e),af=(e,t)=>()=>sf()?XN(e):pd(t),$W=(e,t)=>{if(!O.open.ws({dir:e,ws:t}))pd(gi(e,t))},XW=()=>{try{return JSON.parse(localStorage.getItem("kz-runtabs")||"{}")}catch{return{}}},Ode=(e,t,n)=>{if(O.open.tab({dir:e,ws:t,id:n}))return;let o=XW(),r=o[di(e,t)],a=r?.screens?.find((i)=>vn(i.tree).includes(n));if(a)try{r.on=a.id,localStorage.setItem("kz-runtabs",JSON.stringify(o))}catch{}pd(gi(e,t))},_de=["local","preview","note","history","shell"],zde=(e)=>{try{return localStorage.getItem("kz-browse:"+e)?.replace(/^https?:\/\//,"").replace(/\/$/,"")}catch{}},Ide={wait:"needs you",plan:"planning",build:"building",review:"in review",stalled:"stalled",done:"done",aband:"abandoned"};function QW({cards:e,projects:t=[],agents:n=[]},o){let r=Date.now(),a=new URLSearchParams(location.search),i=a.get("id")&&e.find((p)=>p.kind==="run"&&p.state===a.get("dir")&&p.id===a.get("id")),s=a.get("ws")??(i?Qo(i,t):null),l=[],c=XW(),d=new Map;for(let p of e){let f=p.state+"\x00"+Qo(p,t);d.set(f,Math.max(d.get(f)??0,p.moved??0))}for(let p of t){let f=$n(p.dir,t);for(let g of p.workspaces??[]){let m=a.get("dir")===p.dir&&s===g.path,y=d.get(p.dir+"\x00"+g.path);l.push({group:m?"Current":"Workspaces",title:Yi(g),sub:f,when:y?co(y,r):void 0,hay:`${Yi(g)} ${f} ${g.path} workspace`,at:m?1/0:y??0,ico:"ws",act:()=>$W(p.dir,g.path)});let b=di(p.dir,g.path),x=c[b];for(let v of x?.tabs??[]){if(!_de.includes(v.kind)||x.hidden?.includes(v.id))continue;let k=v.kind==="local"&&zde(b)||v.title;l.push({group:"Tabs",title:k,sub:`${Yi(g)} · ${f}`,hay:`${k} ${v.title} ${v.kind} ${v.note??""} ${Yi(g)} ${f} tab`,ico:"tab",act:()=>Ode(p.dir,g.path,v.id)})}}l.push({group:"Projects",title:f,hay:`${f} ${p.dir} project`,ico:"proj",act:()=>{let g=p.workspaces?.find((m)=>m.main)??p.workspaces?.[0];g?$W(p.dir,g.path):af("board","/?view=board")()}})}for(let p of e.filter((f)=>!f.archived)){let f=mi(p);l.push({group:p.kind==="run"?"Runs":"Tasks",title:Vs(p)||p.id,sub:[$n(p.state,t),Ide[f]].filter(Boolean).join(" · "),when:p.moved?co(p.moved,r):void 0,hay:`${Vs(p)} ${p.id??""} ${p.text??""} ${$n(p.state,t)} ${f}`,at:p.moved??0,dot:f,ico:p.kind==="run"?"run":"idea",act:()=>{if(!O.open.card({dir:p.state,id:p.kind==="run"?p.id:void 0,text:p.text}))pd(Bl(p))}})}for(let p of o){let f=Date.parse(p.updated)||0;l.push({group:"Chats & terminals",title:p.title||"Chat",sub:p.project?$n(p.project,t):void 0,when:f?co(f,r):void 0,hay:`${p.title} chat ${p.project??""}`,at:f,dot:p.busy?"build":void 0,ico:"chat",act:()=>{try{sessionStorage.setItem("kz-chat",p.id)}catch{}af("home","/")()}})}for(let p of n)l.push({group:"Chats & terminals",title:p.name||p.agent||"Terminal",sub:$n(p.dir,t),hay:`${p.name} ${p.agent??""} ${p.run??""} ${p.last??""} ${$n(p.dir,t)} terminal agent`,at:p.at??p.born??0,dot:p.asking?"wait":p.busy?"build":"done",ico:"term",act:()=>{if(!O.open.term({dir:p.dir,ws:p.ws,key:p.key}))pd(gi(p.dir,p.ws??""))}});let u=[["Chat","chat",af("home","/"),"home",!0],["Icebox","inbox",af("sources","/?view=icebox"),"requests sources gathered capture inbox later add note",!0],["Tasks","idea",af("tasks","/?view=tasks"),"backlog",!0],["Board","board",af("board","/?view=board"),"kanban runs",!0],["Notes","doc",()=>pd("/notebook"),"notebook docs",!0],["Settings","gear",af("settings","/?view=settings"),"preferences config",!0],["New task","plus",()=>sf()?Zi():pd("/?view=board"),"create add run"],["Add a project","proj",()=>ci({dir:null}),"clone folder create workspace"],["Toggle theme","moon",Zx,"dark light"],["Collapse or expand menu","side",Jx,"sidebar rail"],["Keyboard shortcuts","kbd",()=>Gs(!0),"keys help"],["Report an issue","bug",()=>open("/issue","_blank","noopener"),"bug feedback"]];for(let[p,f,g,m,y]of u)l.push({group:"Actions",title:p,hay:`${p} ${m??""}`,ico:f,act:g,page:y});return l}function Lde(e){if(!sf())return void pd("/?view=board");Zi(void 0,e)}var yS=Ug;function k5(){if(sf())return YW();xS().then((e)=>{yS=e.useSearch,YW()},()=>jd("/?view=board&search=1"))}function YW(){yS.setState({open:!0,newTask:Lde})}var WW=()=>yS.getState().open?yS.setState({open:!1}):k5();function ZW(e){sf=()=>e,Ul.search=k5;let t=/Mac|iP(hone|ad)/.test(navigator.platform),n;if(sf()&&new URLSearchParams(location.search).get("search")==="1"){let r=new URLSearchParams(location.search);r.delete("search"),history.replaceState(null,"",location.pathname+(r.toString()?"?"+r:"")+location.hash),n=setTimeout(k5,400)}let o=(r)=>{if(r.ctrlKey&&r.shiftKey&&r.code==="Space")return r.preventDefault(),r.stopPropagation(),void WW();if(r.target?.closest?.(".xterm"))return;let a=t?r.metaKey:r.ctrlKey,i=r.key.toLowerCase();if(a&&!r.altKey&&(i==="k"&&!r.shiftKey||t&&i==="j"&&!r.shiftKey))r.preventDefault(),r.stopPropagation(),WW()};return addEventListener("keydown",o,!0),()=>(clearTimeout(n),removeEventListener("keydown",o,!0))}var JW=()=>document.documentElement.hasAttribute("data-kit");var eX=()=>window.kzKit?Promise.resolve(window.kzKit):Promise.reject(Error("this page has no kit"));var Gg=!1;async function xS(){let e=await eX();return e.setHost({gitProjects:Iw,wsHref:gi,navigate:jd,pickProject:async(t)=>{await fetch("/cd",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:t})}).catch(()=>null);try{localStorage.setItem("kz-proj",t)}catch{}jd("/notebook?dir="+encodeURIComponent(t))}}),e}function Bde(e){if(Gg)return ci(e);let t=new URLSearchParams({view:"board",add:e.start??"1"});if(e.dir)t.set("adddir",e.dir);xS().then((n)=>n.openAdd(e),()=>jd("/?"+t))}function Hde(){let e=new URLSearchParams(location.search),t=e.get("add");if(!t||!Gg)return;let n=e.get("adddir");return e.delete("add"),e.delete("adddir"),history.replaceState(null,"",location.pathname+(e.toString()?"?"+e:"")+location.hash),setTimeout(()=>ci({dir:n,...t==="ws"||t==="folder"||t==="clone"||t==="create"?{start:t}:{}}),400)}var jde=()=>document.getAnimations().forEach((e)=>{if(e.animationName?.startsWith("si-")&&e.startTime!==0)e.startTime=0});function tX(e={}){Gg=!!e.board;let t=ZW(Gg),n=!1,o=(s)=>s.nodeType===1&&(s.classList.contains("si")||s.querySelector(".si")),r=new MutationObserver((s)=>{if(n||!s.some((l)=>[...l.addedNodes].some(o)))return;n=!0,requestAnimationFrame(()=>{n=!1,jde()})});r.observe(document.body,{childList:!0,subtree:!0});let a=uz(Gg);if(!Gg&&JW())xS().catch(()=>{});let i=Hde();if(e.video){if(e.video.add)e.video.add.onclick=Ul.add;if(e.video.search)e.video.search.onclick=(s)=>(s.preventDefault(),Ul.search())}return()=>(r.disconnect(),a(),t(),clearTimeout(i))}Ul.add=()=>{let e=new URLSearchParams(location.search);Bde({dir:["run","ws"].includes(e.get("view")??"")?e.get("dir"):Ude()})};function Ude(){try{let e=JSON.parse(localStorage.getItem("kz-rail-filter2")||"{}").dirs;return Array.isArray(e)&&e.length===1?e[0]:null}catch{return null}}function oX(){nX.useEffect(()=>{let e=tX({board:!0}),t=OV();return()=>(e(),t())},[])}var hs=h(I(),1);var Fg=h(I(),1);function rX(e){let t=qi(),[n,o]=Fg.useState([]);return Fg.useEffect(()=>{if(!e)return o([]);let r=new AbortController;return fetch("/chats",{signal:r.signal}).then((a)=>a.json()).then((a)=>o(a.chats??[])).catch(()=>{}),()=>r.abort()},[e]),Fg.useMemo(()=>e?QW(t,n):[],[e,t,n])}var Ee=h(w(),1),Gde={ws:Ee.jsxs(Ee.Fragment,{children:[Ee.jsx("circle",{cx:"6",cy:"6",r:"2"}),Ee.jsx("circle",{cx:"6",cy:"18",r:"2"}),Ee.jsx("circle",{cx:"18",cy:"8",r:"2"}),Ee.jsx("path",{d:"M6 8v8M18 10c0 4-6 3-12 6"})]}),run:Ee.jsx("path",{d:"M5 4l14 8-14 8z"}),idea:Ee.jsx("path",{d:"M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z"}),chat:Ee.jsx("path",{d:"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"}),term:Ee.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"}),proj:Ee.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),page:Ee.jsxs(Ee.Fragment,{children:[Ee.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),Ee.jsx("path",{d:"M4 9h16"})]}),act:Ee.jsx("path",{d:"M13 3L5 14h6l-1 7 8-11h-6z"}),tab:Ee.jsxs(Ee.Fragment,{children:[Ee.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),Ee.jsx("path",{d:"M3 9h8V5"})]}),plus:Ee.jsx("path",{d:"M12 5v14M5 12h14"}),search:Ee.jsxs(Ee.Fragment,{children:[Ee.jsx("circle",{cx:"11",cy:"11",r:"7"}),Ee.jsx("path",{d:"M20 20l-4-4"})]})},aX=({name:e,className:t})=>Ee.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:t,children:Ee.jsx("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Gde[e]??Ee.jsx("use",{href:`#i-${e}`})})});function Fde({text:e,words:t}){if(!t.length)return Ee.jsx(Ee.Fragment,{children:e});let n=new RegExp(`(${t.map((o)=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})`,"gi");return Ee.jsx(Ee.Fragment,{children:e.split(n).map((o,r)=>r%2?Ee.jsx("b",{className:"font-semibold text-strong",children:o},r):o)})}function iX(){let e=Ug((f)=>f.open),t=Ug((f)=>f.newTask),n=rX(e),[o,r]=hs.useState(""),[a,i]=hs.useState("0"),s=hs.useMemo(()=>qW(n,o,t),[n,o,t]);hs.useEffect(()=>{if(e)r("")},[e]);let l=hs.useRef(!1),c=()=>Ug.setState({open:!1});hs.useEffect(()=>i("0"),[o]);let d=[];s.forEach((f,g)=>{let m=d.find((y)=>y[0]===f.group);m?m[1].push({row:f,n:g}):d.push([f.group,[{row:f,n:g}]])});let u=!!o.trim()&&s.length===1,p=hs.useMemo(()=>o.toLowerCase().split(/\s+/).filter(Boolean),[o]);return Ee.jsx(Ga,{open:e,onOpenChange:(f)=>!f&&c(),children:Ee.jsxs(Fa,{"aria-label":"Search","aria-describedby":void 0,onCloseAutoFocus:(f)=>{if(!l.current)return;l.current=!1,f.preventDefault()},className:"top-[14vh] w-[min(560px,calc(100vw-32px))] translate-y-0 gap-0 overflow-hidden rounded-md p-0 shadow-md",children:[Ee.jsx(ga,{className:"sr-only",children:"Search"}),Ee.jsxs(tg,{shouldFilter:!1,value:a,onValueChange:i,loop:!0,className:"max-h-[min(480px,72vh)]",children:[Ee.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[Ee.jsx(aX,{name:"search",className:"size-[15px] flex-none text-muted-foreground"}),Ee.jsx(ng,{value:o,onValueChange:r,placeholder:"Search","aria-label":"Search",autoFocus:!0,autoComplete:"off",spellCheck:!1,className:"mb-0 h-10 min-w-0 flex-1 border-0 bg-transparent px-0 text-lg focus-visible:border-0"})]}),Ee.jsxs(og,{className:"max-h-none flex-1 overflow-auto p-1",children:[d.map(([f,g])=>Ee.jsx(w1,{heading:f,children:g.map(({row:m,n:y})=>Ee.jsxs(rg,{value:String(y),className:"h-(--btn-s) gap-2 px-2 text-base text-foreground",onSelect:()=>{l.current=!0,c(),setTimeout(m.act,0)},children:[Ee.jsx(aX,{name:m.ico,className:"size-3.5 flex-none text-muted-foreground"}),m.dot&&Ee.jsx(Ei,{state:m.dot}),Ee.jsx("span",{className:"min-w-0 truncate",children:Ee.jsx(Fde,{text:m.title,words:p})}),m.sub&&Ee.jsx("span",{className:"min-w-0 flex-[0_1_auto] truncate text-sm text-muted-foreground",children:m.sub}),m.when&&Ee.jsx("span",{className:"ml-auto flex-none pl-2 text-xs text-muted-foreground",children:m.when})]},y))},f)),u&&Ee.jsx("div",{className:"px-2 py-3.5 text-center text-sm text-muted-foreground",children:"No results"})]}),Ee.jsxs("span",{role:"status","aria-live":"polite",className:"sr-only",children:[s.length," result",s.length===1?"":"s"," found"]})]})]})})}var Ko=h(w(),1);function sX(){let e=du((t)=>t.dark);return Ko.jsxs("div",{id:"kz-portal",className:"kz-ui",ref:Y_,children:[Ko.jsx("div",{children:Ko.jsx(IU,{theme:e?"dark":"light"})}),Ko.jsxs("div",{children:[Ko.jsx(_q,{}),Ko.jsx(PG,{}),Ko.jsx(EK,{}),Ko.jsx(PK,{}),Ko.jsx(iX,{}),Ko.jsx(Yq,{}),Ko.jsx(kq,{}),Ko.jsx(vq,{}),Ko.jsx(IW,{}),Ko.jsx(e$,{}),Ko.jsx(gK,{}),Ko.jsx(hK,{}),Ko.jsx(vK,{})]})]})}var pr=h(w(),1);function lX(){$6(),FW(),oX();let e=fd.useRef(null);fd.useLayoutEffect(()=>{let o=()=>document.documentElement.style.setProperty("--foot-h",e.current.offsetHeight+"px"),r=new ResizeObserver(o);return r.observe(e.current),o(),()=>r.disconnect()},[]);let t=Fe((o)=>o.flip);fd.useLayoutEffect(()=>void document.body.classList.toggle("rflip",t),[t]);let n=Nt((o)=>o.mode==="ws");return fd.useLayoutEffect(()=>void document.body.classList.toggle("wsb",n),[n]),fd.useEffect(()=>{kA();let o=setInterval(kA,3600000);return()=>clearInterval(o)},[]),pr.jsxs(VU,{children:[pr.jsx(_K,{}),pr.jsx(OK,{srcs:pr.jsx(VF,{}),before:pr.jsx("div",{style:{display:"contents"},children:pr.jsx(bK,{})})}),pr.jsxs("div",{className:"app",children:[pr.jsx(Vq,{}),pr.jsx(qY,{}),pr.jsx(HW,{})]}),pr.jsx("footer",{className:"foot kz-ui",id:"foot","aria-label":"Usage and status",ref:e,children:pr.jsx(nq,{})}),pr.jsx("div",{id:"context-host",className:"kz-ui",style:{display:"contents"},children:pr.jsx(bq,{})}),pr.jsx(qq,{}),pr.jsx(sX,{})]})}function Vde({dir:e,id:t,text:n}){let o=()=>oe().state.cards.find((i)=>i.state===e&&(t?i.kind==="run"&&i.id===t:i.kind==="idea"&&i.text===n)),r=o();if(r)return zm(r),!0;if(!e||e===oe().dir)return!1;let a=Bl({state:e,kind:t?"run":"idea",id:t,text:n});return lb(e).then(()=>{let i=o();if(i)zm(i);else location.href=a}).catch(()=>location.href=a),!0}function cX(){mL(),WO({open:{card:Vde,ws:({dir:e,ws:t})=>(b8(e,t),!0),term:(e)=>{if(VR(e.dir))yV(String(e.key??""));else v8({dir:e.dir??"",ws:e.ws??"",key:e.key});return!0},tab:(e)=>(y8(e),!0),task:(e)=>(Lv(e),!0),homeStart:(e)=>(xV(e),!0)},go:Ki,newTask:()=>Zi(),runPopup:Zw,scopeDir:()=>!oe().all?oe().state.dir??"":"",dirHeader:tR,projects:()=>oe().state.projects,reload:()=>void fo(),dataUrls:Rz,rich:U8,pop:()=>qx()!=="off"&&$x("pop"),motion:UN,agentLine:tB,openCard:(e,t,n)=>n!=null?S8(e,t==="backlog"?"backlog":"finding",n):Xi(e),openWorkspace:zm,loadBoard:()=>fo(),launched:(e,t)=>{if(!t)return;Pe({wantTerm:Ne(e),wantPty:{key:t,at:Date.now()}})},closePanel:Qi,reopenPanel:()=>Ab(),refetchRun:()=>C8(),gitTab:()=>(Pe({wantTab:"git"}),Ab()),panelOpenFor:(e)=>Re().openKey===Ne(e),notify:J_,font:{min:YB,max:WB,read:XB,set:QB},notices:{on:GN,sounds:n6,sound:qx,play:(e)=>$x(e)},currentDir:()=>oe().dir||oe().state?.dir||"",gitProjects:Iw,runCards:()=>oe().state.cards.filter((e)=>e.kind==="run"),wsHref:gi,pickProject:lb,openSettings:(e)=>{mt({startQ:e}),Ki("settings",!0)}})}var Kde=new URLSearchParams(location.search).get("view");function uX(){(async()=>{let e;try{e=localStorage.getItem("kz-proj")}catch(t){}if(e&&!rR)try{if((await fetch("/cd",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:e})})).ok)po({all:!1}),po({dir:e});else bm()}catch(t){}fo().then(()=>{Ki(Kde),k8()}),fz()})()}var S5="board",dX=["board","terminal","home","tasks","task","run","chat","device","sources"];G6({before:(e)=>{if(e!=="settings")return;mt({startQ:"",startBack:Ze().view!=="settings"})},prepare:(e)=>{if(mt({pageGen:Tr().pageGen+1}),e==="task")O$()},leave:(e)=>{if(S5==="run"&&e!=="run")p8(),Qi(!0)},enter:(e)=>{let t=S5;S5=e;let n=nt()&&e==="home";if(e==="terminal")qB();else KB();if(e==="home"&&!n||e==="chat")iV();if(bB(n?"home":e==="device"?"device":null),dX.includes(e)){if(dX.includes(t)){if(e!=="board"&&(t==="board"||t==="tasks"||t==="sources"))Qi(!0);return}Pe({open:!1,docked:!1,instant:!0}),Qi(!0);return}Pe({docked:!0}),SA()}});function pX(){K6(),du.subscribe((e,t)=>e.look!==t.look&&Ze().view==="settings"&&SA())}p6();cX();mX.flushSync(()=>gX.createRoot(document.getElementById("root")).render(fX.createElement(lX)));t7();$B();_V();zV();pX();RB();uX();hq();a7();})();